@coffre/ui 0.1.17 → 0.2.0

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/README.md +23 -3
  2. package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
  3. package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
  4. package/dist/chunks/directory-CSjWWUQ1.js +370 -0
  5. package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
  6. package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
  7. package/dist/chunks/grants-saMQagmG.js.map +1 -0
  8. package/dist/chunks/icons-D-PfAfnH.js +203 -0
  9. package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
  10. package/dist/chunks/mounted-jJmqqV_n.js +17 -0
  11. package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
  12. package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
  13. package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
  14. package/dist/chunks/page-C5HcNqf2.js +190 -0
  15. package/dist/chunks/page-C5HcNqf2.js.map +1 -0
  16. package/dist/chunks/page-route-Drfw7lmn.js +20 -0
  17. package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
  18. package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
  19. package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
  20. package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
  21. package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
  22. package/dist/chunks/queries-CQ81o4so.js +376 -0
  23. package/dist/chunks/queries-CQ81o4so.js.map +1 -0
  24. package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
  25. package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
  26. package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
  27. package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
  28. package/dist/chunks/theme-B2vQolVR.js +86 -0
  29. package/dist/chunks/theme-B2vQolVR.js.map +1 -0
  30. package/dist/chunks/ui-DixXLQvQ.js +405 -0
  31. package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
  32. package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
  33. package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
  34. package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
  35. package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
  36. package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
  37. package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
  38. package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
  39. package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
  40. package/dist/index.d.ts +386 -18
  41. package/dist/index.js +1147 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/pages/account.d.ts +9 -0
  44. package/dist/pages/account.js +334 -0
  45. package/dist/pages/account.js.map +1 -0
  46. package/dist/pages/audit.d.ts +3 -0
  47. package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
  48. package/dist/pages/audit.js.map +1 -0
  49. package/dist/pages/device-login.d.ts +9 -0
  50. package/dist/pages/device-login.js +211 -0
  51. package/dist/pages/device-login.js.map +1 -0
  52. package/dist/pages/environment.d.ts +3 -0
  53. package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
  54. package/dist/pages/environment.js.map +1 -0
  55. package/dist/pages/login.d.ts +10 -0
  56. package/dist/pages/login.js +104 -0
  57. package/dist/pages/login.js.map +1 -0
  58. package/dist/pages/project.d.ts +2 -0
  59. package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
  60. package/dist/pages/project.js.map +1 -0
  61. package/dist/pages/projects.d.ts +3 -0
  62. package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
  63. package/dist/pages/projects.js.map +1 -0
  64. package/dist/pages/settings.d.ts +3 -0
  65. package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
  66. package/dist/pages/settings.js.map +1 -0
  67. package/dist/pages/token.d.ts +3 -0
  68. package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
  69. package/dist/pages/token.js.map +1 -0
  70. package/dist/pages/tokens.d.ts +3 -0
  71. package/dist/pages/tokens.js +39 -0
  72. package/dist/pages/tokens.js.map +1 -0
  73. package/dist/pages/unregistered.d.ts +8 -0
  74. package/dist/pages/unregistered.js +54 -0
  75. package/dist/pages/unregistered.js.map +1 -0
  76. package/dist/pages/user.d.ts +3 -0
  77. package/dist/pages/user.js +16 -0
  78. package/dist/pages/user.js.map +1 -0
  79. package/dist/pages/users.d.ts +3 -0
  80. package/dist/pages/users.js +39 -0
  81. package/dist/pages/users.js.map +1 -0
  82. package/dist/project-BqIy8gYR.d.ts +5 -0
  83. package/dist/vite.d.ts +16 -0
  84. package/dist/vite.js +52 -0
  85. package/package.json +36 -21
  86. package/src/assets/icon.svg +1 -0
  87. package/src/components/affordances.ts +10 -4
  88. package/src/components/command-palette.tsx +229 -203
  89. package/src/components/directory.tsx +34 -38
  90. package/src/components/principal.tsx +7 -3
  91. package/src/components/shell.tsx +89 -127
  92. package/src/components/theme.tsx +14 -81
  93. package/src/components/ui.tsx +97 -68
  94. package/src/index.ts +29 -0
  95. package/src/layout.tsx +113 -0
  96. package/src/lib/coffre.ts +8 -4
  97. package/src/lib/mounted.ts +13 -0
  98. package/src/lib/page-context.ts +31 -0
  99. package/src/lib/page-route.ts +22 -0
  100. package/src/lib/preferences.tsx +46 -0
  101. package/src/options.ts +240 -0
  102. package/src/{routes → pages}/account.tsx +7 -24
  103. package/src/{routes → pages}/audit.tsx +5 -16
  104. package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
  105. package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
  106. package/src/{routes → pages}/login.tsx +5 -16
  107. package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
  108. package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
  109. package/src/{routes → pages}/settings.tsx +3 -10
  110. package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
  111. package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
  112. package/src/{routes → pages}/unregistered.tsx +1 -6
  113. package/src/pages/user.tsx +10 -0
  114. package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
  115. package/src/register.ts +55 -0
  116. package/src/router.tsx +31 -62
  117. package/src/styles/globals.css +104 -46
  118. package/src/vite.ts +78 -0
  119. package/dist/client/.assetsignore +0 -2
  120. package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
  121. package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
  122. package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
  123. package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
  124. package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
  125. package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
  126. package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
  127. package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
  128. package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
  129. package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
  130. package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
  131. package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
  132. package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
  133. package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  134. package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  135. package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  136. package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  137. package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  138. package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  139. package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  140. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  141. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  142. package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  143. package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  144. package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  145. package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  146. package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
  147. package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
  148. package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
  149. package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
  150. package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
  151. package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
  152. package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
  153. package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
  154. package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
  155. package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
  156. package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
  157. package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
  158. package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
  159. package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
  160. package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
  161. package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
  162. package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
  163. package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
  164. package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
  165. package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
  166. package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
  167. package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
  168. package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
  169. package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
  170. package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
  171. package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
  172. package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
  173. package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
  174. package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
  175. package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
  176. package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
  177. package/dist/server/.vite/manifest.json +0 -668
  178. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
  179. package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
  180. package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
  181. package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
  182. package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
  183. package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
  184. package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
  185. package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
  186. package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
  187. package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
  188. package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
  189. package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
  190. package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  191. package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  192. package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  193. package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  194. package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  195. package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  196. package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  197. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  198. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  199. package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  200. package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  201. package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  202. package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  203. package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
  204. package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
  205. package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
  206. package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
  207. package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
  208. package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
  209. package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
  210. package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
  211. package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
  212. package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
  213. package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
  214. package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
  215. package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
  216. package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
  217. package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
  218. package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
  219. package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
  220. package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
  221. package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
  222. package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
  223. package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
  224. package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
  225. package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
  226. package/dist/server/index.js +0 -13911
  227. package/src/assets/favicon-32.png +0 -0
  228. package/src/components/agentation.tsx +0 -34
  229. package/src/entry.ts +0 -19
  230. package/src/routeTree.gen.ts +0 -367
  231. package/src/routes/__root.tsx +0 -169
  232. package/src/routes/access.tsx +0 -11
  233. package/src/routes/index.tsx +0 -15
  234. package/src/routes/users.$user.tsx +0 -13
  235. package/src/types.ts +0 -21
@@ -1,2322 +0,0 @@
1
- import { i as require_react, r as require_jsx_runtime, s as __toESM, t as useRouter } from "./useRouter-CaUSUNsw.js";
2
- import { D as deepEqual, i as useHydrated, k as escapeHtml, n as useStore } from "./react-dom-bBoJXlK2.js";
3
- import { C as createNonReactiveReadonlyStore, S as createNonReactiveMutableStore, d as appendUniqueUserTags, h as getScriptPreloadAttrs, i as Outlet, m as getAssetCrossOrigin, o as ScriptOnce, t as getStartContext, v as resolveManifestCssLink, y as RouterCore } from "./async-local-storage-C10uQtMM.js";
4
- import { a as redirect, r as isRedirect } from "./matchContext-qLfYbC6_.js";
5
- import { t as Link } from "./link-42ZWdjzZ.js";
6
- import { a as useStructuralSharing, i as useNavigate, n as createFileRoute, r as createRootRouteWithContext, t as lazyRouteComponent } from "./lazyRouteComponent-CqBNCGuZ.js";
7
- import { H as createClient, N as noop, a as Tile, f as loadShell, h as queries, l as loadDirectory, n as ClosedDoor, s as createQueryClient } from "./page-D6n45dcK.js";
8
- import { d as QueryClientProvider } from "./suspense-C-2QfDd2.js";
9
- import { t as useShell } from "./use-shell-DwOzEi87.js";
10
- import { t as Toaster } from "./dist-CnnV3t2g.js";
11
- import { S as composeRefs, _ as DialogContent, b as useId, f as TooltipProvider, g as Dialog, h as dropdown_menu_exports, m as dialog_exports, s as Notice, u as Tip, v as DialogOverlay, x as Primitive, y as DialogPortal } from "./ui-Cc0CGMtr.js";
12
- import { n as isActiveAccessibleEnvironment } from "./project-environments-lEzFHUt4.js";
13
- import { a as hasAdministrationItems, t as AdministrationItems } from "./affordances-CKANXDTG.js";
14
- import { D as Moon, E as Monitor, F as Settings, G as X$1, K as markSvg, L as SignOut, P as Search, R as SlashCircle, T as Menu, U as UserCog, W as Users, a as Check, b as Ledger, c as ChevronsUpDown, k as PanelLeft, m as GitHub, p as Folder, r as AlertTriangle, v as Key, w as Mark, y as Layers, z as Sun } from "./icons-DOFT-eWB.js";
15
- import { a as setTheme, i as ThemeToggle, o as themeBootScript, r as ThemeMenuItems, t as Route$8 } from "./account-hk6wcIXU.js";
16
- import { n as LiveRegion } from "./row-state-C2P57xT1.js";
17
- import { t as Route$9 } from "./audit-C1_Ej6YB.js";
18
- import { t as Route$10 } from "./login-DRKUKkaW.js";
19
- import { t as Route$11 } from "./auth.device-CLoAxC2T.js";
20
- import { t as Route$12 } from "./tokens._token-rY86Cjgp.js";
21
- import { t as Route$13 } from "./users._user-BmLKYeo_.js";
22
- import { t as Route$14 } from "./projects._project.index-BGfcNpj0.js";
23
- import { t as Route$15 } from "./projects._project._environment-CS8DdSMY.js";
24
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/routerStores.js
25
- var getStoreFactory = (opts) => {
26
- return {
27
- createMutableStore: createNonReactiveMutableStore,
28
- createReadonlyStore: createNonReactiveReadonlyStore,
29
- batch: (fn) => fn()
30
- };
31
- };
32
- //#endregion
33
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/router.js
34
- /**
35
- * Creates a new Router instance for React.
36
- *
37
- * Pass the returned router to `RouterProvider` to enable routing.
38
- * Notable options: `routeTree` (your route definitions) and `context`
39
- * (required if the root route was created with `createRootRouteWithContext`).
40
- *
41
- * @param options Router options used to configure the router.
42
- * @returns A Router instance to be provided to `RouterProvider`.
43
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction
44
- */
45
- var createRouter = (options) => {
46
- return new Router(options);
47
- };
48
- var Router = class extends RouterCore {
49
- constructor(options) {
50
- super(options, getStoreFactory);
51
- }
52
- };
53
- //#endregion
54
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/useRouterState.js
55
- /**
56
- * Subscribe to the router's state store with optional selection and
57
- * structural sharing for render optimization.
58
- *
59
- * Options:
60
- * - `select`: Project the full router state to a derived slice
61
- * - `structuralSharing`: Replace-equal semantics for stable references
62
- * - `router`: Read state from a specific router instance instead of context
63
- *
64
- * @returns The selected router state (or the full state by default).
65
- * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook
66
- */
67
- function useRouterState(opts) {
68
- const contextRouter = useRouter({ warn: opts?.router === void 0 });
69
- const router = opts?.router || contextRouter;
70
- {
71
- const state = router.stores.__store.get();
72
- return opts?.select ? opts.select(state) : state;
73
- }
74
- return useStore(router.stores.__store, useStructuralSharing(opts, router));
75
- }
76
- //#endregion
77
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/Asset.js
78
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
79
- var import_jsx_runtime = require_jsx_runtime();
80
- var noopScriptHandler = () => {};
81
- function setScriptAttrs(script, attrs) {
82
- if (!attrs) return;
83
- for (const [key, value] of Object.entries(attrs)) if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) script.setAttribute(key, typeof value === "boolean" ? "" : String(value));
84
- }
85
- function Asset(asset) {
86
- const { attrs, children, nonce, preventScriptHoist } = asset;
87
- switch (asset.tag) {
88
- case "title": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", {
89
- ...attrs,
90
- suppressHydrationWarning: true,
91
- children
92
- });
93
- case "meta": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("meta", {
94
- ...attrs,
95
- suppressHydrationWarning: true
96
- });
97
- case "link": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("link", {
98
- ...attrs,
99
- precedence: attrs?.precedence ?? (attrs?.rel === "stylesheet" ? "default" : void 0),
100
- nonce,
101
- suppressHydrationWarning: true
102
- });
103
- case "style":
104
- if (asset.inlineCss && false);
105
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
106
- ...attrs,
107
- dangerouslySetInnerHTML: { __html: children },
108
- nonce
109
- });
110
- case "script": return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Script, {
111
- attrs,
112
- preventScriptHoist,
113
- children
114
- });
115
- default: return null;
116
- }
117
- }
118
- function Script({ attrs, children, preventScriptHoist }) {
119
- useRouter();
120
- useHydrated();
121
- const dataScript = typeof attrs?.type === "string" && attrs.type !== "" && attrs.type !== "text/javascript" && attrs.type !== "module";
122
- import_react.useEffect(() => {
123
- if (dataScript) return;
124
- if (attrs?.src) {
125
- const normSrc = (() => {
126
- try {
127
- const base = document.baseURI || window.location.href;
128
- return new URL(attrs.src, base).href;
129
- } catch {
130
- return attrs.src;
131
- }
132
- })();
133
- for (const el of document.querySelectorAll("script[src]")) if (el.src === normSrc) return;
134
- const script = document.createElement("script");
135
- setScriptAttrs(script, attrs);
136
- document.head.appendChild(script);
137
- return () => script.remove();
138
- }
139
- if (typeof children === "string") {
140
- const typeAttr = typeof attrs?.type === "string" ? attrs.type : "text/javascript";
141
- const nonceAttr = typeof attrs?.nonce === "string" ? attrs.nonce : void 0;
142
- for (const el of document.querySelectorAll("script:not([src])")) {
143
- if (!(el instanceof HTMLScriptElement)) continue;
144
- const sType = el.getAttribute("type") ?? "text/javascript";
145
- const sNonce = el.getAttribute("nonce") ?? void 0;
146
- if (el.textContent === children && sType === typeAttr && sNonce === nonceAttr) return;
147
- }
148
- const script = document.createElement("script");
149
- script.textContent = children;
150
- setScriptAttrs(script, attrs);
151
- document.head.appendChild(script);
152
- return () => script.remove();
153
- }
154
- }, [
155
- attrs,
156
- children,
157
- dataScript
158
- ]);
159
- if (attrs?.src) {
160
- if (!preventScriptHoist) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
161
- ...attrs,
162
- suppressHydrationWarning: true
163
- });
164
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
165
- ...attrs,
166
- onLoad: noopScriptHandler,
167
- suppressHydrationWarning: true
168
- });
169
- }
170
- if (typeof children === "string") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
171
- ...attrs,
172
- dangerouslySetInnerHTML: { __html: children },
173
- suppressHydrationWarning: true
174
- });
175
- return null;
176
- }
177
- //#endregion
178
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/headContentUtils.js
179
- function buildTagsFromMatches(router, nonce, matches, assetCrossOrigin) {
180
- const routeMeta = matches.map((match) => match.meta).filter((meta) => meta !== void 0);
181
- const resultMeta = [];
182
- const metaByAttribute = {};
183
- let title;
184
- for (let i = routeMeta.length - 1; i >= 0; i--) {
185
- const metas = routeMeta[i];
186
- for (let j = metas.length - 1; j >= 0; j--) {
187
- const m = metas[j];
188
- if (!m) continue;
189
- if (m.title) {
190
- if (!title) title = {
191
- tag: "title",
192
- children: m.title
193
- };
194
- } else if ("script:ld+json" in m) try {
195
- const json = JSON.stringify(m["script:ld+json"]);
196
- resultMeta.push({
197
- tag: "script",
198
- attrs: { type: "application/ld+json" },
199
- children: escapeHtml(json)
200
- });
201
- } catch {}
202
- else {
203
- const attribute = m.name ?? m.property;
204
- if (attribute) if (metaByAttribute[attribute]) continue;
205
- else metaByAttribute[attribute] = true;
206
- resultMeta.push({
207
- tag: "meta",
208
- attrs: {
209
- ...m,
210
- nonce
211
- }
212
- });
213
- }
214
- }
215
- }
216
- if (title) resultMeta.push(title);
217
- if (nonce) resultMeta.push({
218
- tag: "meta",
219
- attrs: {
220
- property: "csp-nonce",
221
- content: nonce
222
- }
223
- });
224
- resultMeta.reverse();
225
- const constructedLinks = matches.flatMap((match) => match.links ?? []).filter((link) => link !== void 0).map((link) => ({
226
- tag: "link",
227
- attrs: {
228
- ...link,
229
- nonce
230
- }
231
- }));
232
- const manifest = router.ssr?.manifest;
233
- const manifestCssTags = [];
234
- if (manifest) {
235
- matches.forEach((match) => {
236
- (manifest.routes[match.routeId]?.css)?.forEach((link) => {
237
- const resolvedLink = resolveManifestCssLink(link);
238
- manifestCssTags.push({
239
- tag: "link",
240
- attrs: {
241
- rel: "stylesheet",
242
- ...resolvedLink,
243
- crossOrigin: getAssetCrossOrigin(assetCrossOrigin, "stylesheet") ?? resolvedLink.crossOrigin,
244
- suppressHydrationWarning: true,
245
- nonce
246
- }
247
- });
248
- });
249
- });
250
- if (manifest.inlineStyle) manifestCssTags.push({
251
- tag: "style",
252
- attrs: {
253
- ...manifest.inlineStyle.attrs,
254
- nonce
255
- },
256
- children: manifest.inlineStyle.children,
257
- inlineCss: true
258
- });
259
- }
260
- const preloadLinks = [];
261
- if (manifest) matches.forEach((match) => {
262
- manifest.routes[match.routeId]?.preloads?.forEach((preload) => {
263
- preloadLinks.push({
264
- tag: "link",
265
- attrs: {
266
- ...getScriptPreloadAttrs(manifest, preload, assetCrossOrigin),
267
- nonce
268
- }
269
- });
270
- });
271
- });
272
- const styles = matches.flatMap((match) => match.styles ?? []).filter((style) => style !== void 0).map(({ children, ...attrs }) => ({
273
- tag: "style",
274
- attrs: {
275
- ...attrs,
276
- nonce
277
- },
278
- children
279
- }));
280
- const headScripts = matches.flatMap((match) => match.headScripts ?? []).filter((script) => script !== void 0).map(({ children, ...script }) => ({
281
- tag: "script",
282
- attrs: {
283
- ...script,
284
- nonce
285
- },
286
- children
287
- }));
288
- const tags = [];
289
- appendUniqueUserTags(tags, resultMeta);
290
- tags.push(...preloadLinks);
291
- appendUniqueUserTags(tags, constructedLinks);
292
- tags.push(...manifestCssTags);
293
- appendUniqueUserTags(tags, styles);
294
- appendUniqueUserTags(tags, headScripts);
295
- return tags;
296
- }
297
- /**
298
- * Build the list of head/link/meta/script tags to render for active matches.
299
- * Used internally by `HeadContent`.
300
- */
301
- var useTags = (assetCrossOrigin) => {
302
- const router = useRouter();
303
- const nonce = router.options.ssr?.nonce;
304
- return buildTagsFromMatches(router, nonce, router.stores.matches.get(), assetCrossOrigin);
305
- };
306
- //#endregion
307
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/HeadContent.js
308
- /**
309
- * Render route-managed head tags (title, meta, links, styles, head scripts).
310
- * Place inside the document head of your app shell.
311
- * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management
312
- */
313
- function HeadContent(props) {
314
- const tags = useTags(props.assetCrossOrigin);
315
- const nonce = useRouter().options.ssr?.nonce;
316
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: tags.map((tag) => /* @__PURE__ */ (0, import_react.createElement)(Asset, {
317
- ...tag,
318
- key: `tsr-meta-${JSON.stringify(tag)}`,
319
- nonce
320
- })) });
321
- }
322
- //#endregion
323
- //#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/Scripts.js
324
- /**
325
- * Render body script tags collected from route matches and SSR manifests.
326
- * Should be placed near the end of the document body.
327
- */
328
- var Scripts = () => {
329
- const router = useRouter();
330
- const nonce = router.options.ssr?.nonce;
331
- const getAssetScripts = (matches) => {
332
- const assetScripts = [];
333
- const manifest = router.ssr?.manifest;
334
- if (!manifest) return [];
335
- for (const match of matches) {
336
- const scripts = manifest.routes[match.routeId]?.scripts;
337
- if (!scripts) continue;
338
- for (const asset of scripts) assetScripts.push({
339
- tag: "script",
340
- attrs: {
341
- ...asset.attrs,
342
- nonce
343
- },
344
- children: asset.children,
345
- ...typeof asset.attrs?.src === "string" ? { preventScriptHoist: true } : {}
346
- });
347
- }
348
- return assetScripts;
349
- };
350
- const getScripts = (matches) => matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
351
- tag: "script",
352
- attrs: {
353
- ...script,
354
- suppressHydrationWarning: true,
355
- nonce
356
- },
357
- children
358
- }));
359
- {
360
- const activeMatches = router.stores.matches.get();
361
- const assetScripts = getAssetScripts(activeMatches);
362
- return renderScripts(router, getScripts(activeMatches), assetScripts);
363
- }
364
- const assetScripts = useStore(router.stores.matches, getAssetScripts, deepEqual);
365
- return renderScripts(router, useStore(router.stores.matches, getScripts, deepEqual), assetScripts);
366
- };
367
- function renderScripts(router, scripts, assetScripts) {
368
- const allScripts = [...scripts, ...assetScripts];
369
- if (router.serverSsr) {
370
- const serverBufferedScript = router.serverSsr.takeBufferedScripts();
371
- if (serverBufferedScript) allScripts.unshift(serverBufferedScript);
372
- }
373
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ (0, import_react.createElement)(Asset, {
374
- ...asset,
375
- key: `tsr-scripts-${asset.tag}-${i}`
376
- })) });
377
- }
378
- //#endregion
379
- //#region ../../node_modules/.pnpm/@tanstack+start-client-core@1.170.14/node_modules/@tanstack/start-client-core/dist/esm/getGlobalStartContext.js
380
- var getGlobalStartContext = () => {
381
- const context = getStartContext().contextAfterGlobalMiddlewares;
382
- if (!context) throw new Error(`Global context not set yet, you are calling getGlobalStartContext() before the global middlewares are applied.`);
383
- return context;
384
- };
385
- //#endregion
386
- //#region ../../node_modules/.pnpm/@tanstack+query-core@5.103.1/node_modules/@tanstack/query-core/build/modern/hydration.js
387
- function tryResolveSync(promise) {
388
- let data;
389
- promise.then((result) => {
390
- data = result;
391
- return result;
392
- }, noop)?.catch?.(noop);
393
- if (data !== void 0) return { data };
394
- }
395
- function dehydratePromise(query, serializeData, shouldRedactErrors) {
396
- const promise = query.promise?.then(serializeData).catch((error) => {
397
- if (shouldRedactErrors?.(error) === false) return Promise.reject(error);
398
- return Promise.reject(/* @__PURE__ */ new Error("redacted"));
399
- });
400
- promise?.catch(noop);
401
- return promise;
402
- }
403
- /**
404
- * Dehydrates a single `Query` into a serializable `DehydratedQuery` snapshot. Note that most query config (e.g.
405
- * `queryFn`, `staleTime`) is not dehydrated but instead meant to be configured again when consuming the
406
- * de/rehydrated data, typically with `useQuery` on the client. If the query is still `pending`, its in-flight
407
- * promise is dehydrated too so it can be resumed on the other side instead of re-fetched.
408
- * @param query - The query to dehydrate.
409
- * @param serializeData - Optional transform applied to `query.state.data` before it is included in the snapshot.
410
- * @param shouldRedactErrors - Optional predicate; if it returns `false` for the promise's rejection error, that
411
- * error is kept as-is instead of being redacted.
412
- */
413
- function dehydrateQuery(query, serializeData, shouldRedactErrors) {
414
- return {
415
- dehydratedAt: Date.now(),
416
- state: {
417
- ...query.state,
418
- ...query.state.data !== void 0 && { data: serializeData ? serializeData(query.state.data) : query.state.data }
419
- },
420
- queryKey: query.queryKey,
421
- queryHash: query.queryHash,
422
- ...query.state.status === "pending" && { promise: dehydratePromise(query, serializeData, shouldRedactErrors) },
423
- ...query.meta && { meta: query.meta },
424
- ...query.queryType && { queryType: query.queryType }
425
- };
426
- }
427
- /**
428
- * Restores a `DehydratedState` (as produced by `dehydrate`) into a `QueryClient`'s cache, typically to seed the
429
- * client with data already fetched on the server. `mutations` and `queries` are each optional on `dehydratedState`.
430
- * Queries not yet in the cache are built from the dehydrated snapshot; queries that already exist are only updated
431
- * when the dehydrated data is newer than what's already cached. Newly built queries have their `fetchStatus` reset
432
- * to `'idle'` so they don't hydrate stuck in a fetching state. If a dehydrated query still had an in-flight
433
- * promise, it is resumed via `query.fetch()` (reusing that promise as `initialPromise`) rather than re-invoking
434
- * `queryFn`.
435
- * @example
436
- * ```ts
437
- * // dehydratedState was produced by `dehydrate` on the server
438
- * // and sent to the client, e.g. embedded in server-rendered markup.
439
- * const queryClient = new QueryClient()
440
- *
441
- * hydrate(queryClient, dehydratedState)
442
- * ```
443
- */
444
- function hydrate(client, dehydratedState, options) {
445
- const mutationCache = client.getMutationCache();
446
- const queryCache = client.getQueryCache();
447
- const deserializeData = options?.defaultOptions?.deserializeData ?? client.getDefaultOptions().hydrate?.deserializeData;
448
- dehydratedState.mutations?.forEach(({ state, ...mutationOptions }) => {
449
- mutationCache.build(client, {
450
- ...client.getDefaultOptions().hydrate?.mutations,
451
- ...options?.defaultOptions?.mutations,
452
- ...mutationOptions
453
- }, state);
454
- });
455
- dehydratedState.queries?.forEach(({ queryKey, state, queryHash, meta, promise, dehydratedAt, queryType }) => {
456
- const syncData = promise ? tryResolveSync(promise) : void 0;
457
- const rawData = state.data === void 0 ? syncData?.data : state.data;
458
- const data = rawData === void 0 ? rawData : deserializeData ? deserializeData(rawData) : rawData;
459
- let query = queryCache.get(queryHash);
460
- const existingQueryIsPending = query?.state.status === "pending";
461
- const existingQueryIsFetching = query?.state.fetchStatus === "fetching";
462
- if (query) {
463
- const hasNewerSyncData = syncData && dehydratedAt > query.state.dataUpdatedAt;
464
- if (state.dataUpdatedAt > query.state.dataUpdatedAt || hasNewerSyncData) {
465
- const { fetchStatus: _ignored, ...serializedState } = state;
466
- query.setState({
467
- ...serializedState,
468
- data,
469
- ...state.status === "pending" && data !== void 0 && {
470
- status: "success",
471
- dataUpdatedAt: dehydratedAt,
472
- ...!existingQueryIsFetching && { fetchStatus: "idle" }
473
- }
474
- });
475
- }
476
- } else query = queryCache.build(client, {
477
- ...client.getDefaultOptions().hydrate?.queries,
478
- ...options?.defaultOptions?.queries,
479
- queryKey,
480
- queryHash,
481
- meta,
482
- _type: queryType
483
- }, {
484
- ...state,
485
- data,
486
- fetchStatus: "idle",
487
- status: state.status === "pending" && data !== void 0 ? "success" : state.status,
488
- ...state.status === "pending" && data !== void 0 && { dataUpdatedAt: dehydratedAt }
489
- });
490
- if (promise && !syncData && !existingQueryIsPending && !existingQueryIsFetching && dehydratedAt > query.state.dataUpdatedAt) query.fetch(void 0, { initialPromise: Promise.resolve(promise).then(deserializeData) }).catch(noop);
491
- });
492
- }
493
- //#endregion
494
- //#region ../../node_modules/.pnpm/@tanstack+router-ssr-query-core@1.169.2_@tanstack+query-core@5.103.1_@tanstack+router-core@1.171.15/node_modules/@tanstack/router-ssr-query-core/dist/esm/index.js
495
- var shouldDehydrateAllQueries = () => true;
496
- function setupCoreRouterSsrQueryIntegration({ router, queryClient, dehydrateOptions, hydrateOptions, handleRedirects = true }) {
497
- {
498
- const originalDehydrate = router.options.dehydrate;
499
- let streamState;
500
- let cleanedUp = false;
501
- const finalizeQueryStream = (failure) => {
502
- const state = streamState;
503
- streamState = void 0;
504
- if (!state) return;
505
- state.unsubscribe();
506
- try {
507
- if (failure) state.controller.error(failure.error);
508
- else state.controller.close();
509
- } catch {}
510
- };
511
- const teardown = () => {
512
- cleanedUp = true;
513
- finalizeQueryStream();
514
- queryClient.clear();
515
- };
516
- router.serverSsrLifecycle = {
517
- ...router.serverSsrLifecycle,
518
- onServerSsrAttach: [...router.serverSsrLifecycle?.onServerSsrAttach ?? [], (serverSsr) => serverSsr.onCleanup(teardown)]
519
- };
520
- router.options.dehydrate = async () => {
521
- let originalDehydrated;
522
- try {
523
- originalDehydrated = await originalDehydrate?.();
524
- } finally {
525
- if (cleanedUp) queryClient.clear();
526
- }
527
- if (cleanedUp) return;
528
- const currentDehydrateOptions = queryClient.getDefaultOptions().dehydrate;
529
- const shouldDehydrateQuery = dehydrateOptions?.shouldDehydrateQuery ?? currentDehydrateOptions?.shouldDehydrateQuery ?? shouldDehydrateAllQueries;
530
- const serializeData = dehydrateOptions?.serializeData ?? currentDehydrateOptions?.serializeData;
531
- const shouldRedactErrors = dehydrateOptions?.shouldRedactErrors ?? currentDehydrateOptions?.shouldRedactErrors;
532
- const initialQueries = new Array();
533
- const sentQueries = /* @__PURE__ */ new Set();
534
- for (const query of queryClient.getQueryCache().getAll()) if (shouldDehydrateQuery(query)) {
535
- initialQueries.push(dehydrateQuery(query, serializeData, shouldRedactErrors));
536
- sentQueries.add(query.queryHash);
537
- }
538
- let controller;
539
- const stream = new ReadableStream({ start(value) {
540
- controller = value;
541
- } });
542
- const flushPendingQueries = () => {
543
- const state = streamState;
544
- const queries = state?.pendingQueries;
545
- if (!state || !queries) return;
546
- state.pendingQueries = void 0;
547
- const dehydratedQueries = new Array();
548
- for (const query of queries.values()) {
549
- if (state.sentQueries.has(query.queryHash) || !shouldDehydrateQuery(query)) continue;
550
- dehydratedQueries.push(dehydrateQuery(query, serializeData, shouldRedactErrors));
551
- state.sentQueries.add(query.queryHash);
552
- }
553
- if (dehydratedQueries.length > 0) state.controller.enqueue(dehydratedQueries);
554
- };
555
- const unsubscribe = queryClient.getQueryCache().subscribe((event) => {
556
- const state = streamState;
557
- if (!state) return;
558
- if (state.sentQueries.has(event.query.queryHash) || !event.query.promise) return;
559
- if (!state.pendingQueries) {
560
- state.pendingQueries = /* @__PURE__ */ new Map();
561
- queueMicrotask(() => {
562
- try {
563
- flushPendingQueries();
564
- } catch (error) {
565
- finalizeQueryStream({ error });
566
- }
567
- });
568
- }
569
- state.pendingQueries.set(event.query.queryHash, event.query);
570
- });
571
- streamState = {
572
- controller,
573
- sentQueries,
574
- unsubscribe
575
- };
576
- const finishRendering = () => {
577
- try {
578
- flushPendingQueries();
579
- } catch (error) {
580
- finalizeQueryStream({ error });
581
- return;
582
- }
583
- finalizeQueryStream();
584
- };
585
- router.serverSsr.onRenderFinished(finishRendering);
586
- return {
587
- ...originalDehydrated,
588
- query: {
589
- ...initialQueries.length > 0 && { initial: initialQueries },
590
- stream
591
- }
592
- };
593
- };
594
- return;
595
- }
596
- const originalHydrate = router.options.hydrate;
597
- router.options.hydrate = async (dehydrated) => {
598
- await originalHydrate?.(dehydrated);
599
- const query = dehydrated.query;
600
- if (query.initial) hydrate(queryClient, { queries: query.initial }, hydrateOptions);
601
- const reader = query.stream.getReader();
602
- reader.read().then(function handle({ done, value }) {
603
- if (done) return;
604
- hydrate(queryClient, { queries: value }, hydrateOptions);
605
- return reader.read().then(handle);
606
- }).catch((error) => {
607
- console.error("Error reading query stream:", error);
608
- });
609
- };
610
- if (handleRedirects) {
611
- const originalMutationCacheConfig = queryClient.getMutationCache().config;
612
- queryClient.getMutationCache().config = {
613
- ...originalMutationCacheConfig,
614
- onError: (error, ...rest) => {
615
- if (isRedirect(error)) {
616
- error.options._fromLocation = router.stores.location.get();
617
- return router.navigate(router.resolveRedirect(error).options);
618
- }
619
- return originalMutationCacheConfig.onError?.(error, ...rest);
620
- }
621
- };
622
- const originalQueryCacheConfig = queryClient.getQueryCache().config;
623
- queryClient.getQueryCache().config = {
624
- ...originalQueryCacheConfig,
625
- onError: (error, ...rest) => {
626
- if (isRedirect(error)) {
627
- error.options._fromLocation = router.stores.location.get();
628
- return router.navigate(router.resolveRedirect(error).options);
629
- }
630
- return originalQueryCacheConfig.onError?.(error, ...rest);
631
- }
632
- };
633
- }
634
- }
635
- //#endregion
636
- //#region ../../node_modules/.pnpm/@tanstack+react-router-ssr-query@1.167.2_@tanstack+query-core@5.103.1_@tanstack+react-q_96d12b7c743d2faaec19af9a09514089/node_modules/@tanstack/react-router-ssr-query/dist/esm/index.js
637
- function setupRouterSsrQueryIntegration(opts) {
638
- setupCoreRouterSsrQueryIntegration(opts);
639
- if (opts.wrapQueryClient === false) return;
640
- const OGWrap = opts.router.options.Wrap || import_react.Fragment;
641
- opts.router.options.Wrap = ({ children }) => {
642
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientProvider, {
643
- client: opts.queryClient,
644
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OGWrap, { children })
645
- });
646
- };
647
- }
648
- //#endregion
649
- //#region src/styles/globals.css?url
650
- var globals_default = "/_coffre/assets/globals-CpMrgkV6.css";
651
- //#endregion
652
- //#region src/lib/instance.ts
653
- /** Where an owner reads how to upgrade: update the CLI, deploy, then migrate. */
654
- var UPGRADE_DOC = "https://github.com/erwinkn/coffre/blob/main/docs/deploy.md#upgrading";
655
- /**
656
- * The migrations this instance's code ships and its database lacks. Only
657
- * owners and root admins are told an instance's state; for anyone else it
658
- * is null, and nothing is pending as far as they can tell.
659
- */
660
- function pendingMigrations(instance) {
661
- return instance === null ? [] : instance.migrations.known.slice(instance.migrations.applied);
662
- }
663
- //#endregion
664
- //#region ../../node_modules/.pnpm/cmdk@1.1.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/cmdk/dist/chunk-NZJY6EH4.mjs
665
- var U = 1;
666
- var Y$1 = .9;
667
- var H = .8;
668
- var J = .17;
669
- var p = .1;
670
- var u = .999;
671
- var $ = .9999;
672
- var k$1 = .99;
673
- var m = /[\\\/_+.#"@\[\(\{&]/;
674
- var B$1 = /[\\\/_+.#"@\[\(\{&]/g;
675
- var K$1 = /[\s-]/;
676
- var X = /[\s-]/g;
677
- function G(_, C, h, P, A, f, O) {
678
- if (f === C.length) return A === _.length ? U : k$1;
679
- var T = `${A},${f}`;
680
- if (O[T] !== void 0) return O[T];
681
- for (var L = P.charAt(f), c = h.indexOf(L, A), S = 0, E, N, R, M; c >= 0;) E = G(_, C, h, P, c + 1, f + 1, O), E > S && (c === A ? E *= U : m.test(_.charAt(c - 1)) ? (E *= H, R = _.slice(A, c - 1).match(B$1), R && A > 0 && (E *= Math.pow(u, R.length))) : K$1.test(_.charAt(c - 1)) ? (E *= Y$1, M = _.slice(A, c - 1).match(X), M && A > 0 && (E *= Math.pow(u, M.length))) : (E *= J, A > 0 && (E *= Math.pow(u, c - A))), _.charAt(c) !== C.charAt(f) && (E *= $)), (E < p && h.charAt(c - 1) === P.charAt(f + 1) || P.charAt(f + 1) === P.charAt(f) && h.charAt(c - 1) !== P.charAt(f)) && (N = G(_, C, h, P, c + 1, f + 2, O), N * p > E && (E = N * p)), E > S && (S = E), c = h.indexOf(L, c + 1);
682
- return O[T] = S, S;
683
- }
684
- function D(_) {
685
- return _.toLowerCase().replace(X, " ");
686
- }
687
- function W(_, C, h) {
688
- return _ = h && h.length > 0 ? `${_ + " " + h.join(" ")}` : _, G(_, C, D(_), D(C), 0, 0, {});
689
- }
690
- //#endregion
691
- //#region ../../node_modules/.pnpm/cmdk@1.1.1_@types+react@19.2.17_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/cmdk/dist/index.mjs
692
- var N = "[cmdk-group=\"\"]";
693
- var Y = "[cmdk-group-items=\"\"]";
694
- var be = "[cmdk-group-heading=\"\"]";
695
- var le = "[cmdk-item=\"\"]";
696
- var ce = `${le}:not([aria-disabled="true"])`;
697
- var Z = "cmdk-item-select";
698
- var T = "data-value";
699
- var Re = (r, o, n) => W(r, o, n);
700
- var ue = import_react.createContext(void 0);
701
- var K = () => import_react.useContext(ue);
702
- var de = import_react.createContext(void 0);
703
- var ee = () => import_react.useContext(de);
704
- var fe = import_react.createContext(void 0);
705
- var me = import_react.forwardRef((r, o) => {
706
- let n = L(() => {
707
- var e, a;
708
- return {
709
- search: "",
710
- value: (a = (e = r.value) != null ? e : r.defaultValue) != null ? a : "",
711
- selectedItemId: void 0,
712
- filtered: {
713
- count: 0,
714
- items: /* @__PURE__ */ new Map(),
715
- groups: /* @__PURE__ */ new Set()
716
- }
717
- };
718
- }), u = L(() => /* @__PURE__ */ new Set()), c = L(() => /* @__PURE__ */ new Map()), d = L(() => /* @__PURE__ */ new Map()), f = L(() => /* @__PURE__ */ new Set()), p = pe(r), { label: b, children: m, value: R, onValueChange: x, filter: C, shouldFilter: S, loop: A, disablePointerSelection: ge = !1, vimBindings: j = !0, ...O } = r, $ = useId(), q = useId(), _ = useId(), I = import_react.useRef(null), v = ke();
719
- k(() => {
720
- if (R !== void 0) {
721
- let e = R.trim();
722
- n.current.value = e, E.emit();
723
- }
724
- }, [R]), k(() => {
725
- v(6, ne);
726
- }, []);
727
- let E = import_react.useMemo(() => ({
728
- subscribe: (e) => (f.current.add(e), () => f.current.delete(e)),
729
- snapshot: () => n.current,
730
- setState: (e, a, s) => {
731
- var i, l, g, y;
732
- if (!Object.is(n.current[e], a)) {
733
- if (n.current[e] = a, e === "search") J(), z(), v(1, W);
734
- else if (e === "value") {
735
- if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
736
- let h = document.getElementById(_);
737
- h ? h.focus() : (i = document.getElementById($)) == null || i.focus();
738
- }
739
- if (v(7, () => {
740
- var h;
741
- n.current.selectedItemId = (h = M()) == null ? void 0 : h.id, E.emit();
742
- }), s || v(5, ne), ((l = p.current) == null ? void 0 : l.value) !== void 0) {
743
- let h = a != null ? a : "";
744
- (y = (g = p.current).onValueChange) == null || y.call(g, h);
745
- return;
746
- }
747
- }
748
- E.emit();
749
- }
750
- },
751
- emit: () => {
752
- f.current.forEach((e) => e());
753
- }
754
- }), []), U = import_react.useMemo(() => ({
755
- value: (e, a, s) => {
756
- var i;
757
- a !== ((i = d.current.get(e)) == null ? void 0 : i.value) && (d.current.set(e, {
758
- value: a,
759
- keywords: s
760
- }), n.current.filtered.items.set(e, te(a, s)), v(2, () => {
761
- z(), E.emit();
762
- }));
763
- },
764
- item: (e, a) => (u.current.add(e), a && (c.current.has(a) ? c.current.get(a).add(e) : c.current.set(a, /* @__PURE__ */ new Set([e]))), v(3, () => {
765
- J(), z(), n.current.value || W(), E.emit();
766
- }), () => {
767
- d.current.delete(e), u.current.delete(e), n.current.filtered.items.delete(e);
768
- let s = M();
769
- v(4, () => {
770
- J(), (s == null ? void 0 : s.getAttribute("id")) === e && W(), E.emit();
771
- });
772
- }),
773
- group: (e) => (c.current.has(e) || c.current.set(e, /* @__PURE__ */ new Set()), () => {
774
- d.current.delete(e), c.current.delete(e);
775
- }),
776
- filter: () => p.current.shouldFilter,
777
- label: b || r["aria-label"],
778
- getDisablePointerSelection: () => p.current.disablePointerSelection,
779
- listId: $,
780
- inputId: _,
781
- labelId: q,
782
- listInnerRef: I
783
- }), []);
784
- function te(e, a) {
785
- var i, l;
786
- let s = (l = (i = p.current) == null ? void 0 : i.filter) != null ? l : Re;
787
- return e ? s(e, n.current.search, a) : 0;
788
- }
789
- function z() {
790
- if (!n.current.search || p.current.shouldFilter === !1) return;
791
- let e = n.current.filtered.items, a = [];
792
- n.current.filtered.groups.forEach((i) => {
793
- let l = c.current.get(i), g = 0;
794
- l.forEach((y) => {
795
- let h = e.get(y);
796
- g = Math.max(h, g);
797
- }), a.push([i, g]);
798
- });
799
- let s = I.current;
800
- V().sort((i, l) => {
801
- var h, F;
802
- let g = i.getAttribute("id"), y = l.getAttribute("id");
803
- return ((h = e.get(y)) != null ? h : 0) - ((F = e.get(g)) != null ? F : 0);
804
- }).forEach((i) => {
805
- let l = i.closest(Y);
806
- l ? l.appendChild(i.parentElement === l ? i : i.closest(`${Y} > *`)) : s.appendChild(i.parentElement === s ? i : i.closest(`${Y} > *`));
807
- }), a.sort((i, l) => l[1] - i[1]).forEach((i) => {
808
- var g;
809
- let l = (g = I.current) == null ? void 0 : g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);
810
- l?.parentElement.appendChild(l);
811
- });
812
- }
813
- function W() {
814
- let e = V().find((s) => s.getAttribute("aria-disabled") !== "true"), a = e == null ? void 0 : e.getAttribute(T);
815
- E.setState("value", a || void 0);
816
- }
817
- function J() {
818
- var a, s, i, l;
819
- if (!n.current.search || p.current.shouldFilter === !1) {
820
- n.current.filtered.count = u.current.size;
821
- return;
822
- }
823
- n.current.filtered.groups = /* @__PURE__ */ new Set();
824
- let e = 0;
825
- for (let g of u.current) {
826
- let F = te((s = (a = d.current.get(g)) == null ? void 0 : a.value) != null ? s : "", (l = (i = d.current.get(g)) == null ? void 0 : i.keywords) != null ? l : []);
827
- n.current.filtered.items.set(g, F), F > 0 && e++;
828
- }
829
- for (let [g, y] of c.current) for (let h of y) if (n.current.filtered.items.get(h) > 0) {
830
- n.current.filtered.groups.add(g);
831
- break;
832
- }
833
- n.current.filtered.count = e;
834
- }
835
- function ne() {
836
- var a, s, i;
837
- let e = M();
838
- e && (((a = e.parentElement) == null ? void 0 : a.firstChild) === e && ((i = (s = e.closest(N)) == null ? void 0 : s.querySelector(be)) == null || i.scrollIntoView({ block: "nearest" })), e.scrollIntoView({ block: "nearest" }));
839
- }
840
- function M() {
841
- var e;
842
- return (e = I.current) == null ? void 0 : e.querySelector(`${le}[aria-selected="true"]`);
843
- }
844
- function V() {
845
- var e;
846
- return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
847
- }
848
- function X(e) {
849
- let s = V()[e];
850
- s && E.setState("value", s.getAttribute(T));
851
- }
852
- function Q(e) {
853
- var g;
854
- let a = M(), s = V(), i = s.findIndex((y) => y === a), l = s[i + e];
855
- (g = p.current) != null && g.loop && (l = i + e < 0 ? s[s.length - 1] : i + e === s.length ? s[0] : s[i + e]), l && E.setState("value", l.getAttribute(T));
856
- }
857
- function re(e) {
858
- let a = M(), s = a == null ? void 0 : a.closest(N), i;
859
- for (; s && !i;) s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
860
- i ? E.setState("value", i.getAttribute(T)) : Q(e);
861
- }
862
- let oe = () => X(V().length - 1), ie = (e) => {
863
- e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
864
- }, se = (e) => {
865
- e.preventDefault(), e.metaKey ? X(0) : e.altKey ? re(-1) : Q(-1);
866
- };
867
- return import_react.createElement(Primitive.div, {
868
- ref: o,
869
- tabIndex: -1,
870
- ...O,
871
- "cmdk-root": "",
872
- onKeyDown: (e) => {
873
- var s;
874
- (s = O.onKeyDown) == null || s.call(O, e);
875
- let a = e.nativeEvent.isComposing || e.keyCode === 229;
876
- if (!(e.defaultPrevented || a)) switch (e.key) {
877
- case "n":
878
- case "j":
879
- j && e.ctrlKey && ie(e);
880
- break;
881
- case "ArrowDown":
882
- ie(e);
883
- break;
884
- case "p":
885
- case "k":
886
- j && e.ctrlKey && se(e);
887
- break;
888
- case "ArrowUp":
889
- se(e);
890
- break;
891
- case "Home":
892
- e.preventDefault(), X(0);
893
- break;
894
- case "End":
895
- e.preventDefault(), oe();
896
- break;
897
- case "Enter": {
898
- e.preventDefault();
899
- let i = M();
900
- if (i) {
901
- let l = new Event(Z);
902
- i.dispatchEvent(l);
903
- }
904
- }
905
- }
906
- }
907
- }, import_react.createElement("label", {
908
- "cmdk-label": "",
909
- htmlFor: U.inputId,
910
- id: U.labelId,
911
- style: Te
912
- }, b), B(r, (e) => import_react.createElement(de.Provider, { value: E }, import_react.createElement(ue.Provider, { value: U }, e))));
913
- });
914
- var he = import_react.forwardRef((r, o) => {
915
- var _, I;
916
- let n = useId(), u = import_react.useRef(null), c = import_react.useContext(fe), d = K(), f = pe(r), p = (I = (_ = f.current) == null ? void 0 : _.forceMount) != null ? I : c == null ? void 0 : c.forceMount;
917
- k(() => {
918
- if (!p) return d.item(n, c == null ? void 0 : c.id);
919
- }, [p]);
920
- let b = ve(n, u, [
921
- r.value,
922
- r.children,
923
- u
924
- ], r.keywords), m = ee(), R = P((v) => v.value && v.value === b.current), x = P((v) => p || d.filter() === !1 ? !0 : v.search ? v.filtered.items.get(n) > 0 : !0);
925
- import_react.useEffect(() => {
926
- let v = u.current;
927
- if (!(!v || r.disabled)) return v.addEventListener(Z, C), () => v.removeEventListener(Z, C);
928
- }, [
929
- x,
930
- r.onSelect,
931
- r.disabled
932
- ]);
933
- function C() {
934
- var v, E;
935
- S(), (E = (v = f.current).onSelect) == null || E.call(v, b.current);
936
- }
937
- function S() {
938
- m.setState("value", b.current, !0);
939
- }
940
- if (!x) return null;
941
- let { disabled: A, value: ge, onSelect: j, forceMount: O, keywords: $, ...q } = r;
942
- return import_react.createElement(Primitive.div, {
943
- ref: composeRefs(u, o),
944
- ...q,
945
- id: n,
946
- "cmdk-item": "",
947
- role: "option",
948
- "aria-disabled": !!A,
949
- "aria-selected": !!R,
950
- "data-disabled": !!A,
951
- "data-selected": !!R,
952
- onPointerMove: A || d.getDisablePointerSelection() ? void 0 : S,
953
- onClick: A ? void 0 : C
954
- }, r.children);
955
- });
956
- var Ee = import_react.forwardRef((r, o) => {
957
- let { heading: n, children: u, forceMount: c, ...d } = r, f = useId(), p = import_react.useRef(null), b = import_react.useRef(null), m = useId(), R = K(), x = P((S) => c || R.filter() === !1 ? !0 : S.search ? S.filtered.groups.has(f) : !0);
958
- k(() => R.group(f), []), ve(f, p, [
959
- r.value,
960
- r.heading,
961
- b
962
- ]);
963
- let C = import_react.useMemo(() => ({
964
- id: f,
965
- forceMount: c
966
- }), [c]);
967
- return import_react.createElement(Primitive.div, {
968
- ref: composeRefs(p, o),
969
- ...d,
970
- "cmdk-group": "",
971
- role: "presentation",
972
- hidden: x ? void 0 : !0
973
- }, n && import_react.createElement("div", {
974
- ref: b,
975
- "cmdk-group-heading": "",
976
- "aria-hidden": !0,
977
- id: m
978
- }, n), B(r, (S) => import_react.createElement("div", {
979
- "cmdk-group-items": "",
980
- role: "group",
981
- "aria-labelledby": n ? m : void 0
982
- }, import_react.createElement(fe.Provider, { value: C }, S))));
983
- });
984
- var ye = import_react.forwardRef((r, o) => {
985
- let { alwaysRender: n, ...u } = r, c = import_react.useRef(null), d = P((f) => !f.search);
986
- return !n && !d ? null : import_react.createElement(Primitive.div, {
987
- ref: composeRefs(c, o),
988
- ...u,
989
- "cmdk-separator": "",
990
- role: "separator"
991
- });
992
- });
993
- var Se = import_react.forwardRef((r, o) => {
994
- let { onValueChange: n, ...u } = r, c = r.value != null, d = ee(), f = P((m) => m.search), p = P((m) => m.selectedItemId), b = K();
995
- return import_react.useEffect(() => {
996
- r.value != null && d.setState("search", r.value);
997
- }, [r.value]), import_react.createElement(Primitive.input, {
998
- ref: o,
999
- ...u,
1000
- "cmdk-input": "",
1001
- autoComplete: "off",
1002
- autoCorrect: "off",
1003
- spellCheck: !1,
1004
- "aria-autocomplete": "list",
1005
- role: "combobox",
1006
- "aria-expanded": !0,
1007
- "aria-controls": b.listId,
1008
- "aria-labelledby": b.labelId,
1009
- "aria-activedescendant": p,
1010
- id: b.inputId,
1011
- type: "text",
1012
- value: c ? r.value : f,
1013
- onChange: (m) => {
1014
- c || d.setState("search", m.target.value), n?.(m.target.value);
1015
- }
1016
- });
1017
- });
1018
- var Ce = import_react.forwardRef((r, o) => {
1019
- let { children: n, label: u = "Suggestions", ...c } = r, d = import_react.useRef(null), f = import_react.useRef(null), p = P((m) => m.selectedItemId), b = K();
1020
- return import_react.useEffect(() => {
1021
- if (f.current && d.current) {
1022
- let m = f.current, R = d.current, x, C = new ResizeObserver(() => {
1023
- x = requestAnimationFrame(() => {
1024
- let S = m.offsetHeight;
1025
- R.style.setProperty("--cmdk-list-height", S.toFixed(1) + "px");
1026
- });
1027
- });
1028
- return C.observe(m), () => {
1029
- cancelAnimationFrame(x), C.unobserve(m);
1030
- };
1031
- }
1032
- }, []), import_react.createElement(Primitive.div, {
1033
- ref: composeRefs(d, o),
1034
- ...c,
1035
- "cmdk-list": "",
1036
- role: "listbox",
1037
- tabIndex: -1,
1038
- "aria-activedescendant": p,
1039
- "aria-label": u,
1040
- id: b.listId
1041
- }, B(r, (m) => import_react.createElement("div", {
1042
- ref: composeRefs(f, b.listInnerRef),
1043
- "cmdk-list-sizer": ""
1044
- }, m)));
1045
- });
1046
- var xe = import_react.forwardRef((r, o) => {
1047
- let { open: n, onOpenChange: u, overlayClassName: c, contentClassName: d, container: f, ...p } = r;
1048
- return import_react.createElement(Dialog, {
1049
- open: n,
1050
- onOpenChange: u
1051
- }, import_react.createElement(DialogPortal, { container: f }, import_react.createElement(DialogOverlay, {
1052
- "cmdk-overlay": "",
1053
- className: c
1054
- }), import_react.createElement(DialogContent, {
1055
- "aria-label": r.label,
1056
- "cmdk-dialog": "",
1057
- className: d
1058
- }, import_react.createElement(me, {
1059
- ref: o,
1060
- ...p
1061
- }))));
1062
- });
1063
- var Ie = import_react.forwardRef((r, o) => P((u) => u.filtered.count === 0) ? import_react.createElement(Primitive.div, {
1064
- ref: o,
1065
- ...r,
1066
- "cmdk-empty": "",
1067
- role: "presentation"
1068
- }) : null);
1069
- var Pe = import_react.forwardRef((r, o) => {
1070
- let { progress: n, children: u, label: c = "Loading...", ...d } = r;
1071
- return import_react.createElement(Primitive.div, {
1072
- ref: o,
1073
- ...d,
1074
- "cmdk-loading": "",
1075
- role: "progressbar",
1076
- "aria-valuenow": n,
1077
- "aria-valuemin": 0,
1078
- "aria-valuemax": 100,
1079
- "aria-label": c
1080
- }, B(r, (f) => import_react.createElement("div", { "aria-hidden": !0 }, f)));
1081
- });
1082
- var _e = Object.assign(me, {
1083
- List: Ce,
1084
- Item: he,
1085
- Input: Se,
1086
- Group: Ee,
1087
- Separator: ye,
1088
- Dialog: xe,
1089
- Empty: Ie,
1090
- Loading: Pe
1091
- });
1092
- function we(r, o) {
1093
- let n = r.nextElementSibling;
1094
- for (; n;) {
1095
- if (n.matches(o)) return n;
1096
- n = n.nextElementSibling;
1097
- }
1098
- }
1099
- function De(r, o) {
1100
- let n = r.previousElementSibling;
1101
- for (; n;) {
1102
- if (n.matches(o)) return n;
1103
- n = n.previousElementSibling;
1104
- }
1105
- }
1106
- function pe(r) {
1107
- let o = import_react.useRef(r);
1108
- return k(() => {
1109
- o.current = r;
1110
- }), o;
1111
- }
1112
- var k = typeof window == "undefined" ? import_react.useEffect : import_react.useLayoutEffect;
1113
- function L(r) {
1114
- let o = import_react.useRef();
1115
- return o.current === void 0 && (o.current = r()), o;
1116
- }
1117
- function P(r) {
1118
- let o = ee(), n = () => r(o.snapshot());
1119
- return import_react.useSyncExternalStore(o.subscribe, n, n);
1120
- }
1121
- function ve(r, o, n, u = []) {
1122
- let c = import_react.useRef(), d = K();
1123
- return k(() => {
1124
- var b;
1125
- let f = (() => {
1126
- var m;
1127
- for (let R of n) {
1128
- if (typeof R == "string") return R.trim();
1129
- if (typeof R == "object" && "current" in R) return R.current ? (m = R.current.textContent) == null ? void 0 : m.trim() : c.current;
1130
- }
1131
- })(), p = u.map((m) => m.trim());
1132
- d.value(r, f, p), (b = o.current) == null || b.setAttribute(T, f), c.current = f;
1133
- }), c;
1134
- }
1135
- var ke = () => {
1136
- let [r, o] = import_react.useState(), n = L(() => /* @__PURE__ */ new Map());
1137
- return k(() => {
1138
- n.current.forEach((u) => u()), n.current = /* @__PURE__ */ new Map();
1139
- }, [r]), (u, c) => {
1140
- n.current.set(u, c), o({});
1141
- };
1142
- };
1143
- function Me(r) {
1144
- let o = r.type;
1145
- return typeof o == "function" ? o(r.props) : "render" in o ? o.render(r.props) : r;
1146
- }
1147
- function B({ asChild: r, children: o }, n) {
1148
- return r && import_react.isValidElement(o) ? import_react.cloneElement(Me(o), { ref: o.ref }, n(o.props.children)) : n(o);
1149
- }
1150
- var Te = {
1151
- position: "absolute",
1152
- width: "1px",
1153
- height: "1px",
1154
- padding: "0",
1155
- margin: "-1px",
1156
- overflow: "hidden",
1157
- clip: "rect(0, 0, 0, 0)",
1158
- whiteSpace: "nowrap",
1159
- borderWidth: "0"
1160
- };
1161
- //#endregion
1162
- //#region src/components/command-palette.tsx
1163
- /**
1164
- * Command palette.
1165
- *
1166
- * The fast path, never the only path: everything reachable here is also
1167
- * reachable by clicking.
1168
- *
1169
- * Selecting an item uses router navigation so the destination loader finishes
1170
- * before the new screen replaces the current one.
1171
- */
1172
- function CommandPalette({ projects, capabilities }) {
1173
- const navigate = useNavigate();
1174
- const [open, setOpen] = (0, import_react.useState)(false);
1175
- (0, import_react.useEffect)(() => {
1176
- function onKeyDown(event) {
1177
- if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
1178
- event.preventDefault();
1179
- setOpen((value) => !value);
1180
- }
1181
- }
1182
- document.addEventListener("keydown", onKeyDown);
1183
- return () => document.removeEventListener("keydown", onKeyDown);
1184
- }, []);
1185
- const active = projects.filter((project) => project.archivedAt === null);
1186
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
1187
- type: "button",
1188
- className: "search-trigger",
1189
- onClick: () => setOpen(true),
1190
- "aria-label": "Search projects and environments",
1191
- "aria-keyshortcuts": "Meta+K Control+K",
1192
- children: [
1193
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { size: 14 }),
1194
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1195
- className: "search-label",
1196
- children: "Search…"
1197
- }),
1198
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", {
1199
- "aria-hidden": true,
1200
- children: "⌘K"
1201
- })
1202
- ]
1203
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Dialog, {
1204
- open,
1205
- onOpenChange: setOpen,
1206
- label: "Jump to a project, environment or page",
1207
- overlayClassName: "overlay",
1208
- contentClassName: "palette",
1209
- loop: true,
1210
- children: [
1211
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Input, { placeholder: "Search projects, environments and pages…" }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.List, { children: [
1213
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Empty, { children: "Nothing by that name." }),
1214
- active.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Group, {
1215
- heading: "Environments",
1216
- children: active.flatMap((project) => project.environments.filter(isActiveAccessibleEnvironment).map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1217
- value: `${project.slug}/${environment.slug} ${environment.name}`,
1218
- onSelect: () => {
1219
- setOpen(false);
1220
- navigate({
1221
- to: "/projects/$project/$environment",
1222
- params: {
1223
- project: project.slug,
1224
- environment: environment.slug
1225
- }
1226
- });
1227
- },
1228
- children: [
1229
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layers, { size: 15 }),
1230
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1231
- className: "mono",
1232
- children: [
1233
- project.slug,
1234
- "/",
1235
- environment.slug
1236
- ]
1237
- }),
1238
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1239
- className: "palette-hint",
1240
- children: [
1241
- environment.details.secretCount,
1242
- " secret",
1243
- environment.details.secretCount === 1 ? "" : "s"
1244
- ]
1245
- })
1246
- ]
1247
- }, `${project.slug}/${environment.slug}`)))
1248
- }),
1249
- active.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_e.Group, {
1250
- heading: "Projects",
1251
- children: active.map((project) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1252
- value: `${project.slug} ${project.name}`,
1253
- onSelect: () => {
1254
- setOpen(false);
1255
- navigate({
1256
- to: "/projects/$project",
1257
- params: { project: project.slug }
1258
- });
1259
- },
1260
- children: [
1261
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 15 }),
1262
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1263
- className: "mono",
1264
- children: project.slug
1265
- }),
1266
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1267
- className: "palette-hint",
1268
- children: project.name
1269
- })
1270
- ]
1271
- }, project.slug))
1272
- }),
1273
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Group, {
1274
- heading: "Pages",
1275
- children: [
1276
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1277
- value: "projects all",
1278
- onSelect: () => {
1279
- setOpen(false);
1280
- navigate({ to: "/projects" });
1281
- },
1282
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 15 }), "Projects"]
1283
- }),
1284
- hasAdministrationItems(capabilities) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdministrationItems, {
1285
- capabilities,
1286
- audit: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1287
- value: "audit log history reads",
1288
- onSelect: () => {
1289
- setOpen(false);
1290
- navigate({
1291
- to: "/audit",
1292
- search: {}
1293
- });
1294
- },
1295
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ledger, { size: 15 }), "Audit"]
1296
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1297
- value: "audit denials denied refused",
1298
- onSelect: () => {
1299
- setOpen(false);
1300
- navigate({
1301
- to: "/audit",
1302
- search: { decision: "deny" }
1303
- });
1304
- },
1305
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashCircle, { size: 15 }), "Audit, denials only"]
1306
- })] }),
1307
- users: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1308
- value: "users people members directory",
1309
- onSelect: () => {
1310
- setOpen(false);
1311
- navigate({ to: "/users" });
1312
- },
1313
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Users, { size: 15 }), "Users"]
1314
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1315
- value: "tokens service accounts machines ci directory",
1316
- onSelect: () => {
1317
- setOpen(false);
1318
- navigate({ to: "/tokens" });
1319
- },
1320
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), "Tokens"]
1321
- })] })
1322
- }),
1323
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1324
- value: "settings instance sign-in",
1325
- onSelect: () => {
1326
- setOpen(false);
1327
- navigate({ to: "/settings" });
1328
- },
1329
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Settings, { size: 15 }), "Settings"]
1330
- }),
1331
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1332
- value: "account preferences appearance identity profile me",
1333
- onSelect: () => {
1334
- setOpen(false);
1335
- navigate({ to: "/account" });
1336
- },
1337
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCog, { size: 15 }), "Account"]
1338
- })
1339
- ]
1340
- }),
1341
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Group, {
1342
- heading: "Appearance",
1343
- children: [
1344
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1345
- value: "theme system automatic",
1346
- onSelect: () => {
1347
- setTheme("system");
1348
- setOpen(false);
1349
- },
1350
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Monitor, { size: 15 }), "Match system colours"]
1351
- }),
1352
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1353
- value: "theme light paper",
1354
- onSelect: () => {
1355
- setTheme("light");
1356
- setOpen(false);
1357
- },
1358
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sun, { size: 15 }), "Light"]
1359
- }),
1360
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(_e.Item, {
1361
- value: "theme dark night",
1362
- onSelect: () => {
1363
- setTheme("dark");
1364
- setOpen(false);
1365
- },
1366
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Moon, { size: 15 }), "Dark"]
1367
- })
1368
- ]
1369
- })
1370
- ] }),
1371
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1372
- className: "palette-foot",
1373
- "aria-hidden": true,
1374
- children: [
1375
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
1376
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↑" }),
1377
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↓" }),
1378
- " move"
1379
- ] }),
1380
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "↵" }), " open"] }),
1381
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "esc" }), " close"] })
1382
- ]
1383
- })
1384
- ]
1385
- })] });
1386
- }
1387
- //#endregion
1388
- //#region src/components/shell.tsx
1389
- var REPOSITORY = "https://github.com/erwinkn/coffre";
1390
- var SIDEBAR_KEY = "coffre-sidebar";
1391
- /** Wide enough for the sidebar to sit beside the page; narrower, it is a drawer. */
1392
- var WIDE = "(width > 60rem)";
1393
- /**
1394
- * Collapses the sidebar before first paint, inlined in <head> like the
1395
- * theme's script: drawn wide and then snapped narrow, the whole page would
1396
- * lurch sideways on every load.
1397
- */
1398
- var sidebarBootScript = `(function(){try{if(localStorage.getItem(${JSON.stringify(SIDEBAR_KEY)})==="collapsed"){document.documentElement.setAttribute("data-sidebar","collapsed")}}catch(e){}})()`;
1399
- /**
1400
- * Whether the sidebar is folded down to its icons, and the switch.
1401
- *
1402
- * The attribute on <html> is the truth and the stylesheet reads it, so the
1403
- * boot script has already drawn the right width. Server-rendered markup
1404
- * cannot know it, so this state starts expanded and catches up on mount.
1405
- */
1406
- function useSidebarCollapsed() {
1407
- const [collapsed, setCollapsed] = (0, import_react.useState)(false);
1408
- (0, import_react.useEffect)(() => setCollapsed(document.documentElement.dataset.sidebar === "collapsed"), []);
1409
- return [collapsed, (0, import_react.useCallback)(() => {
1410
- const root = document.documentElement;
1411
- const next = root.dataset.sidebar !== "collapsed";
1412
- if (next) root.dataset.sidebar = "collapsed";
1413
- else delete root.dataset.sidebar;
1414
- try {
1415
- if (next) localStorage.setItem(SIDEBAR_KEY, "collapsed");
1416
- else localStorage.removeItem(SIDEBAR_KEY);
1417
- } catch {}
1418
- setCollapsed(next);
1419
- }, [])];
1420
- }
1421
- /** Marks the current route without each link having to compare paths itself. */
1422
- var CURRENT = { "aria-current": "page" };
1423
- function roleLabel(principal, instanceRole) {
1424
- if (principal?.type === "service") return "Token";
1425
- if (instanceRole === "root-admin") return "Root admin";
1426
- if (instanceRole === "owner") return "Owner";
1427
- return "Member";
1428
- }
1429
- /**
1430
- * Above every page, for owners and root admins, while the database is behind
1431
- * the code this instance runs: what to run, and where the steps are.
1432
- */
1433
- function MigrationBanner({ instance }) {
1434
- const pending = pendingMigrations(instance);
1435
- if (pending.length === 0) return null;
1436
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1437
- className: "migration-banner",
1438
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
1439
- tone: "info",
1440
- children: [
1441
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Database migrations pending:" }),
1442
- " run ",
1443
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "coffre migrate" }),
1444
- " to apply",
1445
- " ",
1446
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1447
- className: "mono",
1448
- children: pending.join(", ")
1449
- }),
1450
- ", which coffre ",
1451
- instance?.version,
1452
- " ships.",
1453
- " ",
1454
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1455
- href: UPGRADE_DOC,
1456
- target: "_blank",
1457
- rel: "noreferrer",
1458
- children: "How to upgrade"
1459
- })
1460
- ]
1461
- })
1462
- });
1463
- }
1464
- /** The product's mark and name, for the pages you see before signing in. */
1465
- function Brand() {
1466
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1467
- className: "brand",
1468
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mark, { size: 24 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1469
- className: "brand-name",
1470
- children: "coffre"
1471
- })]
1472
- });
1473
- }
1474
- /**
1475
- * The application frame: a sidebar of sections, headed by coffre's mark and
1476
- * footed by your account, and a bar across the content with search on the
1477
- * right. The sidebar folds down to its icons (⌘B, or the button at the left
1478
- * of the bar) and stays folded across visits.
1479
- *
1480
- * Inside a project, the left of that bar is the path to where you are, and
1481
- * each step of it switches: that is the only place project and environment
1482
- * navigation lives outside the pages themselves. Everywhere else the page's
1483
- * own title says where you are, so the bar leaves it out rather than repeat it.
1484
- */
1485
- function Shell({ projects, principal, instanceRole, capabilities, instance, children }) {
1486
- const pathname = useRouterState({ select: (state) => state.location.pathname });
1487
- const [drawerOpen, setDrawerOpen] = (0, import_react.useState)(false);
1488
- const [collapsed, toggleSidebar] = useSidebarCollapsed();
1489
- (0, import_react.useEffect)(() => setDrawerOpen(false), [pathname]);
1490
- (0, import_react.useEffect)(() => {
1491
- function onKeyDown(event) {
1492
- if (event.key === "b" && (event.metaKey || event.ctrlKey) && matchMedia(WIDE).matches) {
1493
- event.preventDefault();
1494
- toggleSidebar();
1495
- }
1496
- }
1497
- document.addEventListener("keydown", onKeyDown);
1498
- return () => document.removeEventListener("keydown", onKeyDown);
1499
- }, [toggleSidebar]);
1500
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1501
- className: "shell",
1502
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("aside", {
1503
- className: "sidebar",
1504
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
1505
- principal,
1506
- instanceRole,
1507
- capabilities,
1508
- collapsed
1509
- })
1510
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1511
- className: "main",
1512
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
1513
- className: "header",
1514
- children: [
1515
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1516
- label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [collapsed ? "Expand sidebar" : "Collapse sidebar", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { children: "⌘B" })] }),
1517
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1518
- type: "button",
1519
- className: "btn btn-quiet btn-icon header-sidebar",
1520
- "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1521
- "aria-keyshortcuts": "Meta+B Control+B",
1522
- onClick: toggleSidebar,
1523
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelLeft, { size: 16 })
1524
- })
1525
- }),
1526
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Root, {
1527
- open: drawerOpen,
1528
- onOpenChange: setDrawerOpen,
1529
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Trigger, {
1530
- asChild: true,
1531
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1532
- type: "button",
1533
- className: "btn btn-quiet btn-icon header-menu",
1534
- "aria-label": "Open navigation",
1535
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu, { size: 18 })
1536
- })
1537
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Portal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Overlay, { className: "overlay" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialog_exports.Content, {
1538
- className: "drawer",
1539
- "aria-describedby": void 0,
1540
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Title, {
1541
- className: "visually-hidden",
1542
- children: "Navigation"
1543
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
1544
- principal,
1545
- instanceRole,
1546
- capabilities,
1547
- close: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialog_exports.Close, {
1548
- asChild: true,
1549
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1550
- type: "button",
1551
- className: "btn btn-quiet btn-sm btn-icon",
1552
- "aria-label": "Close navigation",
1553
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X$1, { size: 16 })
1554
- })
1555
- })
1556
- })]
1557
- })] })]
1558
- }),
1559
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Breadcrumbs, {
1560
- pathname,
1561
- projects,
1562
- canListPrincipals: capabilities.canManageGrants
1563
- }),
1564
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1565
- className: "header-end",
1566
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommandPalette, {
1567
- projects,
1568
- capabilities
1569
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1570
- label: "coffre on GitHub",
1571
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
1572
- className: "btn btn-quiet btn-icon",
1573
- href: REPOSITORY,
1574
- target: "_blank",
1575
- rel: "noreferrer",
1576
- "aria-label": "coffre on GitHub",
1577
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitHub, { size: 16 })
1578
- })
1579
- })]
1580
- })
1581
- ]
1582
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", {
1583
- className: "content",
1584
- id: "content",
1585
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MigrationBanner, { instance }), children]
1586
- })]
1587
- })]
1588
- });
1589
- }
1590
- /** The sidebar's contents, shared by the wide layout and the narrow drawer. */
1591
- function Sidebar({ principal, instanceRole, capabilities, collapsed = false, close }) {
1592
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1593
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1594
- className: "sidebar-head",
1595
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1596
- collapsed,
1597
- label: "coffre",
1598
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
1599
- className: "brand sidebar-brand",
1600
- to: "/projects",
1601
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mark, { size: 24 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1602
- className: "brand-name",
1603
- children: "coffre"
1604
- })]
1605
- })
1606
- }), close]
1607
- }),
1608
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1609
- className: "sidebar-nav",
1610
- "aria-label": "Sections",
1611
- children: [
1612
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1613
- to: "/projects",
1614
- label: "Projects",
1615
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 16 }),
1616
- collapsed
1617
- }),
1618
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdministrationItems, {
1619
- capabilities,
1620
- users: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1621
- to: "/users",
1622
- label: "Users",
1623
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Users, { size: 16 }),
1624
- collapsed
1625
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1626
- to: "/tokens",
1627
- label: "Tokens",
1628
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 16 }),
1629
- collapsed
1630
- })] }),
1631
- audit: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1632
- to: "/audit",
1633
- label: "Audit",
1634
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ledger, { size: 16 }),
1635
- collapsed
1636
- })
1637
- }),
1638
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, {
1639
- to: "/settings",
1640
- label: "Settings",
1641
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Settings, { size: 16 }),
1642
- collapsed
1643
- })
1644
- ]
1645
- }),
1646
- principal !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
1647
- className: "sidebar-foot",
1648
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountMenu, {
1649
- principal,
1650
- instanceRole,
1651
- collapsed
1652
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1653
- label: "Account settings",
1654
- side: collapsed ? "right" : void 0,
1655
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1656
- className: "btn btn-quiet btn-icon sidebar-foot-settings",
1657
- to: "/account",
1658
- "aria-label": "Account settings",
1659
- activeProps: CURRENT,
1660
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCog, { size: 16 })
1661
- })
1662
- })]
1663
- })
1664
- ] });
1665
- }
1666
- /** A folded sidebar's stand-in for the labels it hides. */
1667
- function CollapsedTip({ collapsed, label, children }) {
1668
- return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
1669
- label,
1670
- side: "right",
1671
- children
1672
- }) : children;
1673
- }
1674
- function NavLink({ to, label, icon, collapsed }) {
1675
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1676
- collapsed,
1677
- label,
1678
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
1679
- className: "nav-link",
1680
- to,
1681
- activeProps: CURRENT,
1682
- children: [icon, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1683
- className: "nav-label",
1684
- children: label
1685
- })]
1686
- })
1687
- });
1688
- }
1689
- /**
1690
- * Sign out with a real form post, built on the spot: the menu item unmounts
1691
- * as the menu closes, so it cannot hold the form itself, and the response is
1692
- * a redirect the browser should follow (to Access's logout, in Cloudflare
1693
- * mode).
1694
- */
1695
- function signOut() {
1696
- const form = document.createElement("form");
1697
- form.method = "post";
1698
- form.action = "/auth/signout";
1699
- document.body.appendChild(form);
1700
- form.submit();
1701
- }
1702
- function AccountMenu({ principal, instanceRole, collapsed }) {
1703
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsedTip, {
1704
- collapsed,
1705
- label: principal.id,
1706
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1707
- asChild: true,
1708
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
1709
- type: "button",
1710
- className: "account",
1711
- title: collapsed ? void 0 : principal.id,
1712
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1713
- className: "avatar",
1714
- "aria-hidden": true,
1715
- children: principal.id.slice(0, 1)
1716
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1717
- className: "account-text",
1718
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1719
- className: "account-name",
1720
- children: principal.id
1721
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1722
- className: "account-role",
1723
- children: roleLabel(principal, instanceRole)
1724
- })]
1725
- })]
1726
- })
1727
- })
1728
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1729
- className: "menu menu-account",
1730
- side: "top",
1731
- align: "start",
1732
- sideOffset: 6,
1733
- children: [
1734
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Label, {
1735
- className: "menu-label",
1736
- children: "Theme"
1737
- }),
1738
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeMenuItems, {}),
1739
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Separator, { className: "menu-sep" }),
1740
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1741
- className: "menu-item",
1742
- onSelect: signOut,
1743
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignOut, { size: 14 }), "Sign out"]
1744
- })
1745
- ]
1746
- }) })] });
1747
- }
1748
- /**
1749
- * The path to the project or environment you are in, where each step also
1750
- * switches: one click on `prod` lists its siblings. Absent everywhere else.
1751
- */
1752
- function Breadcrumbs({ pathname, projects, canListPrincipals }) {
1753
- const [section, projectSlug, environmentSlug] = pathname.split("/").filter((segment) => segment !== "").map(decodeURIComponent);
1754
- if ((section === "users" || section === "tokens") && projectSlug !== void 0) {
1755
- const label = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: section === "users" ? "Users" : "Tokens" });
1756
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1757
- className: "crumbs",
1758
- "aria-label": "Breadcrumb",
1759
- children: [
1760
- canListPrincipals ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1761
- className: "crumb-link crumb-root",
1762
- to: section === "users" ? "/users" : "/tokens",
1763
- children: label
1764
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1765
- className: "crumb-link crumb-root",
1766
- children: label
1767
- }),
1768
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1769
- className: "crumb-sep",
1770
- "aria-hidden": true,
1771
- children: "/"
1772
- }),
1773
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1774
- className: "crumb",
1775
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1776
- className: "crumb-link",
1777
- "aria-current": "page",
1778
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: projectSlug })
1779
- })
1780
- })
1781
- ]
1782
- });
1783
- }
1784
- if (section !== "projects" || projectSlug === void 0) return null;
1785
- const active = projects.filter((project) => project.archivedAt === null);
1786
- const project = projects.find((entry) => entry.slug === projectSlug);
1787
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
1788
- className: "crumbs",
1789
- "aria-label": "Breadcrumb",
1790
- children: [
1791
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
1792
- className: "crumb-link crumb-root",
1793
- to: "/projects",
1794
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Projects" })
1795
- }),
1796
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1797
- className: "crumb-sep",
1798
- "aria-hidden": true,
1799
- children: "/"
1800
- }),
1801
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectCrumb, {
1802
- slug: projectSlug,
1803
- current: environmentSlug === void 0,
1804
- projects: active
1805
- }),
1806
- environmentSlug !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1807
- className: "crumb-sep",
1808
- "aria-hidden": true,
1809
- children: "/"
1810
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EnvironmentCrumb, {
1811
- projectSlug,
1812
- slug: environmentSlug,
1813
- environments: project?.environments.filter(isActiveAccessibleEnvironment) ?? []
1814
- })] })
1815
- ]
1816
- });
1817
- }
1818
- function ProjectCrumb({ slug, current, projects }) {
1819
- const navigate = useNavigate();
1820
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1821
- className: "crumb",
1822
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
1823
- className: "crumb-link",
1824
- to: "/projects/$project",
1825
- params: { project: slug },
1826
- "aria-current": current ? "page" : void 0,
1827
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: slug }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1828
- className: "crumb-project-name",
1829
- children: slug
1830
- })]
1831
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1832
- asChild: true,
1833
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1834
- type: "button",
1835
- className: "crumb-switch",
1836
- "aria-label": "Switch project",
1837
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { size: 14 })
1838
- })
1839
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1840
- className: "menu",
1841
- sideOffset: 6,
1842
- align: "start",
1843
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Label, {
1844
- className: "menu-label",
1845
- children: "Projects"
1846
- }), projects.map((project) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1847
- className: "menu-item",
1848
- onSelect: () => navigate({
1849
- to: "/projects/$project",
1850
- params: { project: project.slug }
1851
- }),
1852
- children: [
1853
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: project.slug }),
1854
- project.slug,
1855
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1856
- className: "menu-hint",
1857
- children: project.name
1858
- }),
1859
- project.slug === slug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, {
1860
- size: 14,
1861
- className: "menu-check"
1862
- })
1863
- ]
1864
- }, project.slug))]
1865
- }) })] })]
1866
- });
1867
- }
1868
- function EnvironmentCrumb({ projectSlug, slug, environments }) {
1869
- const navigate = useNavigate();
1870
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1871
- className: "crumb",
1872
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1873
- className: "crumb-link",
1874
- "aria-current": "page",
1875
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: slug })
1876
- }), environments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
1877
- asChild: true,
1878
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
1879
- type: "button",
1880
- className: "crumb-switch",
1881
- "aria-label": "Switch environment",
1882
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { size: 14 })
1883
- })
1884
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
1885
- className: "menu",
1886
- sideOffset: 6,
1887
- align: "start",
1888
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Label, {
1889
- className: "menu-label",
1890
- children: ["Environments in ", projectSlug]
1891
- }), environments.map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
1892
- className: "menu-item",
1893
- onSelect: () => navigate({
1894
- to: "/projects/$project/$environment",
1895
- params: {
1896
- project: projectSlug,
1897
- environment: environment.slug
1898
- }
1899
- }),
1900
- children: [
1901
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
1902
- className: "mono",
1903
- children: environment.slug
1904
- }),
1905
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
1906
- className: "menu-hint",
1907
- children: [
1908
- environment.details?.secretCount ?? 0,
1909
- " secret",
1910
- environment.details?.secretCount === 1 ? "" : "s"
1911
- ]
1912
- }),
1913
- environment.slug === slug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, {
1914
- size: 14,
1915
- className: "menu-check"
1916
- })
1917
- ]
1918
- }, environment.slug))]
1919
- }) })] })]
1920
- });
1921
- }
1922
- //#endregion
1923
- //#region src/components/agentation.tsx
1924
- function Agentation() {
1925
- return null;
1926
- }
1927
- /** Reads the page's origin, so it renders only inside ClientOnly, never on the server. */
1928
- //#endregion
1929
- //#region src/assets/favicon-32.png?url
1930
- var favicon_32_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACJUlEQVR42s1Xu4oqQRAtBMVHoKjRZqKBiX/iC8xu4AcoGvoBvuYLBP9D0cDA3FB8xL5TWVTYUfdcalBYd0anZ/Q690DB0NMz53RVdVU30S0+iEgiohERyUSEF5l8+ad04dDEHyL6fCHpPfu8cKnIv99AfrXvnyI+3rRyLU8o4ZAsIL8acyvJIfSB3+9HLpdDq9XCfD7H8XhUbLFYoN1uI5/PK3MMCGBu+tKb6HQ6US6XsdvtoAeeU61W4XK5RAQw9+NJoVAIw+EQRjEajRAOh0VEPCZfLpcwi/V6LSLivtvNrFzLEzrh0H7BMX8VKpWKMQGcySIJ9wiz2QzNZhPJZBIej8eYAN5qWphOp0ilUsoP2fiZxxiyLKPf76NUKiEWixnZiupB3uda5D6fTzWXxzKZDLxer9lipB7kIvMbvNpnqp7D4RAXwO78DZ043pjNZkM0GkU2m0Wj0cBgMMDhcPh3Aux2O9LpNOr1Onq9Hrbbrer70+n0XAg4m+8JSCQSurtitVo9l4STyUQz0XhsPB7rCuh0OuICuKtpgUXwarmyscXjcSFyRrFYfG8h+on9fo9gMGisFHNLfRUkSTLeC9jF3EieBYfN7Xaba8fcSrmlmsVms0EkEjF/HriKMOMJTk4BcggdyTgctVpNSSaRhOOY67j95kgmfCgNBAIoFArKnubCcj6fFePnbrerbLUH2X73UGr5sdzyi4nlV7P/4nJq2fX8L1/XRcNQT98wAAAAAElFTkSuQmCC";
1931
- //#endregion
1932
- //#region src/assets/apple-touch-icon.png?url
1933
- var apple_touch_icon_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAKcElEQVR42u2daUhVXRSGrWyiuWygLAptckiiLBqgILLJBhvEBqKCVPoTJUSZRTbYTNFMGCFUREVR+UMaMCrLKJpVKI0mM6J5MBtsfawdfl+FX+i9d++z9z7vCw9E/ege7+O5++6z9lp+fn5+BIBF4IcAIDQAEBoACA0AhAYQGgAIDQCEBgBCAwChAYQGAEIDAKEBgNAAQGgAoQGA0ABAaAAgNAAQGkBoACA0ABAaAAgNAIQGEBoACA0AhAYAQgMAoQGEBgBCAwChAYDQAEBoAKEBgNAAQGgAILQztG7dmgYMGECTJ0+mpKQkWr16NW3fvp327t37G/x3aWlpNH/+fIqLi6N+/fpRy5Yt8TOE0M7RqlUrmjhxIm3YsIHOnTtHr1+/Jm/z8uVLOnv2LK1bt45iYmIoICAAP2sILYcaNWqIO+maNWvo1q1b9OPHD5Kd8vJyun79Oq1cuZIiIyPFa8B7AaG9olu3bkLix48fk9N58OCBkDs4OBjvDYSuOjVr1qTx48dTdna2kjtxdcOv6dSpUxQdHS1eK94zCF0p/v7+NGvWLLp37x6Zkry8PJo2bRrVqlUL7yGE/m99HBsba5TIfyY/P5/Gjh0Lmd0udEREBF24cIFsCe+ShISEQGi3Ub9+fbE99u3bN7ItX758oeXLl1OdOnUgtBvo1asXFRQUkO3h7cXw8HAIbfNaed68eeIO5pZ8/vyZEhMTIbRtNGjQgA4dOkRuTUZGBtWrVw9C20BgYCDduHGD3J7c3FxRbwKhDYa/8T958oSQnykqKnLDk0Z7v/xxwQ/ye0pKSigsLAxCmyazLyrgbM2LFy8oNDQUQpuyzMCduWp36qCgIAit+xdArJmrnsLCQlHbDaE13ZrDbkb1c+nSJdu29Ox4aOLmfWZvw0fDILRG8BNAxLvMnj0bQutA7969XfU4W1ZKS0tt2fkwu2rODYVGqsJnGGvXrg2hnYJLQBHfZunSpRDaqeJ8G+uZnU5ZWRl16dIFQqve1bDppIluycrKgtAq4TOAiNyMHDkSQqs6nW3ygVZTwideDG2TYNYL5lYDiJrwJyGElgj3n8DdWV3OnDkDoWXCHY10C5ep3rlzR3RaYi5fvizadpm4A8Ndma5du0apqanUt29fLDlkw8I4nadPn9K2bdtEY5c2bdr872vlNgJclz137lw6ffo0ff/+XUuJ3759S4cPH6aZM2f+9XogtITGiU72mmMp+Zu/p3ettm3b0rJly7So1b579y6tX7+eBg8ebMOTQTOF5i6gTn3bHzRokM+uo3HjxqIZusr6k0+fPlFmZibNmTOHOnbsiDOFOjxIUd3SlpcIvJaUdQfr0aOHuFPKCq/jt27dSiNGjBA1L+jLoRHcbFz1unLYsGFKDiUcOXLEJ6+Z7/jc245HXfDyDL3tsNwQ4TVuz549lfaj3r17t0evtbi4mNLT08XuDy9l0HnUEKF5HasiHz58EPXVTjRZ379/f5WWQTk5OZSSkiJ+6TCmwkChuduPit0N/j/4TufUddatW5euXLlS6ScGyz516lRq0aIFhDVdaJ42pSI8bs3pa+3UqRO9e/dOHPbleSr9+/dHd37bhN64caN0mbn1QcOGDbU5vQ4pLRaa5wDKzvTp0yEChFaD7JZe9+/fx8c6hFb3hVB2uAUCJIDQSuDZ2bKfBlrYCkvq4QrejYHQHsKD4GWGzyVC1P8vN+DDslOmTKHNmzeL/W+uCRk9ejSE9hR+jCszPC0K8v6kXbt2FBMTQ2lpaWJS7Zs3byr9mcXHx0NoT+GqNJkZM2aMK+Vt3rw5RUVF0eLFi+n48eP07NmzKv/MkpOTIbSn7NixQ6rQbiji4X3tgQMHik+7AwcOiF0db7J27VoI7SncFVNmmjRpYpW8XOrKp2QSEhJE0dLt27d9flKGS1IhtIfs27dPqtCGnpn7t6CJP2F4eP2WLVvEWUaeSyg7u3btgtC6Cm3SA5X27dvThAkTRCktn8bmmg8nAqGx5PAYPoh78uRJev78uTaHarHk8AKugJOZ7t27a/3mHDx4ULtT4vhS6AW8JyozfAfU+fq5X7NuWbRoEYT2FNmjJlasWKHttfMgHx0nExgwukLfFxcXFyf1zbl48aK21z5kyBAtG9NER0dDaF1Pe/Mera4D3fnLl44JDw+H0J7ClXCyw0/QdLturmjj8cW6hc9dGnCiRu/9V9mts4qKirTbj54xY4aWd+eHDx+iHtpbuHmK7LBAOj2+1rVlMBcyQWgvUTHpijuKNmrUyBU7O97EkAlZer9ArtFVkZ07dzp+rUFBQaLZja4ZOnQohPaWgIAAKi8vV/KGTZo0ydF956tXr2or89evX7Vp9WB8KzBVT8w+fvxIffr0caRyTsfH3L/m/PnzOCTrK7iLkKq8evVK1BSrujbeYdmzZw/pnoULF0JoXxEZGan0zXv//r2SOX38EX7s2DEyIboXchklNJ9A5gbeKsPr9lWrVolZKTKuibuH5ufnGyEzD0VCXw6Dlx1/vplcV+Gr62jatKmYb8JfskyJQcsNc4QODg52dGgQT+DinhSePlXkEyf8Sym7tZmvw+PpeOARhJYA94twOiUlJeIYEh+HCgwM/Os2HO+YJCUliV8GVVuPvs7Ro0fRCkwWfIfULXy2Ly8vT5Sisrg8uJIHHOk6l7C64dFvEFrifi3Lg6gJP+hBs0bJ8LF9RE3GjRsHoVU8iDBlu8v0u7OhQ4nMa7LCh1sRufHlViWE1qRO2q0xpO7ZLqFDQkK0PBVtekpLS8U0LgjtANzfGfFtFixYgJEUTsF1FqqmzLohubm5NgxQMruFLB+rV9F10/bwSZnOnTtjaJAOJCYmwkgvw/v7lvTJtqPZd0ZGBqz0MDqMhYbQlRQD8RoQqV64/oRbJ0BoDeG2Xtw4Bqla+IkrDxCybK6MXUNyuG6aSzyRv+fRo0fUoUMHGwcl2Tf5KSwsTMvecLqkuLjYlh0NdwhdITXu1JXfmS2W2V6hK5YfhYWFsPiXNbOlywx3CF3RkpdHnmE3I5uaNWtmu8z2C12xpSd7opbu+8yWbc25W+gKeD4IV5O56XG2RU8AIXRlhIaGajldSkahkeVf/iD0r03FuddxWVmZdSLzJxCXgPr7+7tRZncKXUHXrl0pKyvLGpn5pInhxfkQ2hdwY0aT66q5F4jBZwAhtKyeH7GxsXTz5k1jROaT2dxqwNDT2RBaVafTqKgoMTRex/Zd3GuO23MZ2NEIQjsNP1VLSUmhgoICx0XmLqjcBdSwxokQWuejXix3Tk6OuEvKDrfb5TEQLLFBzcYhtInwCLjhw4dTamoqZWZmioIfb8Jtgnmo5YkTJ2jJkiVi2pQBE1shtM3weImIiAjRITUhIYGSk5PFjMVNmzaJGSrp6eniz/x3/G/x8fE0atQoceeHvBAaAAgNIDQAEBoACA0AhAYAQgMIDQCEBgBCAwChAYDQAEIDAKEBgNAAQGgAIDSA0ABAaAAgNAAQGkBoACA0ABAaAAgNAIQGEBoACA0AhAYAQgMAoQGEBgBCAwChAYDQAEBoAKEBgNAAQGgAfMQ/OzTmaDWn3fUAAAAASUVORK5CYII=";
1934
- //#endregion
1935
- //#region src/routes/__root.tsx
1936
- var Route$7 = createRootRouteWithContext()({
1937
- head: () => ({
1938
- meta: [
1939
- { charSet: "utf-8" },
1940
- {
1941
- name: "viewport",
1942
- content: "width=device-width, initial-scale=1"
1943
- },
1944
- { title: "coffre" },
1945
- {
1946
- name: "description",
1947
- content: "Secrets, with an audit log"
1948
- }
1949
- ],
1950
- links: [
1951
- {
1952
- rel: "stylesheet",
1953
- href: globals_default
1954
- },
1955
- {
1956
- rel: "icon",
1957
- type: "image/png",
1958
- sizes: "32x32",
1959
- href: favicon_32_default
1960
- },
1961
- {
1962
- rel: "icon",
1963
- type: "image/svg+xml",
1964
- href: `data:image/svg+xml,${encodeURIComponent(markSvg(16, { adaptive: true }))}`
1965
- },
1966
- {
1967
- rel: "apple-touch-icon",
1968
- href: apple_touch_icon_default
1969
- }
1970
- ]
1971
- }),
1972
- loader: async ({ context: { client, queryClient }, location }) => {
1973
- const shell = await loadShell(queryClient, client);
1974
- if (shell.registrationRequired && location.pathname !== "/unregistered") throw redirect({ to: "/unregistered" });
1975
- if (shell.principal === null && location.pathname !== "/login") throw redirect({
1976
- to: "/login",
1977
- search: { next: location.href }
1978
- });
1979
- if (shell.principal !== null && location.pathname === "/login") throw redirect({ to: "/projects" });
1980
- if (shell.principal !== null && !shell.registrationRequired && location.pathname === "/unregistered") throw redirect({ to: "/projects" });
1981
- },
1982
- shellComponent: RootDocument,
1983
- component: RootComponent
1984
- });
1985
- function RootDocument({ children }) {
1986
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("html", {
1987
- lang: "en",
1988
- suppressHydrationWarning: true,
1989
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("head", { children: [
1990
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HeadContent, {}),
1991
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: themeBootScript }),
1992
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: sidebarBootScript })
1993
- ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("body", { children: [children, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Scripts, {})] })]
1994
- });
1995
- }
1996
- function Toasts() {
1997
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toaster, {
1998
- position: "bottom-right",
1999
- gap: 10,
2000
- offset: 20,
2001
- toastOptions: {
2002
- duration: 4200,
2003
- unstyled: true,
2004
- classNames: {
2005
- toast: "toast",
2006
- title: "toast-title",
2007
- description: "toast-description",
2008
- actionButton: "toast-action",
2009
- success: "toast-success",
2010
- error: "toast-error"
2011
- }
2012
- }
2013
- });
2014
- }
2015
- function RootComponent() {
2016
- const { principal, instanceRole, projects, capabilities, instance } = useShell();
2017
- const pathname = useRouterState({ select: (state) => state.location.pathname });
2018
- if (pathname === "/login" || pathname === "/unregistered" || pathname === "/auth/device") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, { children: [
2019
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2020
- className: "solo",
2021
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2022
- className: "solo-top",
2023
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Brand, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeToggle, {})]
2024
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
2025
- className: "solo-main",
2026
- id: "content",
2027
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})
2028
- })]
2029
- }),
2030
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toasts, {}),
2031
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveRegion, {}),
2032
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Agentation, {})
2033
- ] });
2034
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipProvider, { children: [
2035
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
2036
- className: "skip-link",
2037
- href: "#content",
2038
- children: "Skip to content"
2039
- }),
2040
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Shell, {
2041
- projects,
2042
- principal,
2043
- instanceRole,
2044
- capabilities,
2045
- instance,
2046
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})
2047
- }),
2048
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toasts, {}),
2049
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveRegion, {}),
2050
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Agentation, {})
2051
- ] });
2052
- }
2053
- //#endregion
2054
- //#region src/routes/index.tsx
2055
- /**
2056
- * The root is the project list, one level up.
2057
- *
2058
- * Projects live under `/projects/:slug` rather than at `/:slug` so that a
2059
- * project may be called `audit` or `login` without shadowing the page of that
2060
- * name. Nothing renders here; `/` only exists so the obvious URL still lands
2061
- * somewhere.
2062
- */
2063
- var Route$6 = createFileRoute("/")({ beforeLoad: () => {
2064
- throw redirect({ to: "/projects" });
2065
- } });
2066
- //#endregion
2067
- //#region src/routes/access.tsx
2068
- /**
2069
- * The directory used to be one page here. It is now Users and Tokens; the
2070
- * old address still lands somewhere sensible for bookmarks and links.
2071
- */
2072
- var Route$5 = createFileRoute("/access")({ beforeLoad: () => {
2073
- throw redirect({ to: "/users" });
2074
- } });
2075
- //#endregion
2076
- //#region src/routes/settings.tsx
2077
- var $$splitComponentImporter$4 = () => import("./settings-BDQTF5XW.js");
2078
- /** The instance's settings. Your own are under Account, at the sidebar's foot. */
2079
- var Route$4 = createFileRoute("/settings")({
2080
- loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
2081
- component: lazyRouteComponent($$splitComponentImporter$4, "component")
2082
- });
2083
- //#endregion
2084
- //#region src/routes/unregistered.tsx
2085
- var $$splitComponentImporter$3 = () => import("./unregistered-D9ZKLOPJ.js");
2086
- var Route$3 = createFileRoute("/unregistered")({ component: lazyRouteComponent($$splitComponentImporter$3, "component") });
2087
- /**
2088
- * Cloudflare Access has authenticated this person, but Coffre has not
2089
- * registered them as a member. Keep this deliberately actionless: registration is
2090
- * an owner decision, not a self-service privilege escalation path.
2091
- */
2092
- //#endregion
2093
- //#region src/routes/projects.index.tsx
2094
- var $$splitComponentImporter$2 = () => import("./projects.index-iSoBpRFz.js");
2095
- var Route$2 = createFileRoute("/projects/")({
2096
- loader: ({ context: { client, queryClient } }) => queryClient.fetchQuery(queries.projects(client)),
2097
- component: lazyRouteComponent($$splitComponentImporter$2, "component")
2098
- });
2099
- /**
2100
- * One project. The whole row opens it; the environment links inside it sit
2101
- * above that and go straight to the environment.
2102
- */
2103
- //#endregion
2104
- //#region src/routes/tokens.index.tsx
2105
- var $$splitComponentImporter$1 = () => import("./tokens.index-Bq5qDW9q.js");
2106
- var Route$1 = createFileRoute("/tokens/")({
2107
- loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
2108
- component: lazyRouteComponent($$splitComponentImporter$1, "component")
2109
- });
2110
- //#endregion
2111
- //#region src/routes/users.index.tsx
2112
- var $$splitComponentImporter = () => import("./users.index-BiEax90r.js");
2113
- var Route = createFileRoute("/users/")({
2114
- loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
2115
- component: lazyRouteComponent($$splitComponentImporter, "component")
2116
- });
2117
- //#endregion
2118
- //#region src/routeTree.gen.ts
2119
- var IndexRoute = Route$6.update({
2120
- id: "/",
2121
- path: "/",
2122
- getParentRoute: () => Route$7
2123
- });
2124
- var AccessRoute = Route$5.update({
2125
- id: "/access",
2126
- path: "/access",
2127
- getParentRoute: () => Route$7
2128
- });
2129
- var AccountRoute = Route$8.update({
2130
- id: "/account",
2131
- path: "/account",
2132
- getParentRoute: () => Route$7
2133
- });
2134
- var AuditRoute = Route$9.update({
2135
- id: "/audit",
2136
- path: "/audit",
2137
- getParentRoute: () => Route$7
2138
- });
2139
- var LoginRoute = Route$10.update({
2140
- id: "/login",
2141
- path: "/login",
2142
- getParentRoute: () => Route$7
2143
- });
2144
- var SettingsRoute = Route$4.update({
2145
- id: "/settings",
2146
- path: "/settings",
2147
- getParentRoute: () => Route$7
2148
- });
2149
- var UnregisteredRoute = Route$3.update({
2150
- id: "/unregistered",
2151
- path: "/unregistered",
2152
- getParentRoute: () => Route$7
2153
- });
2154
- var AuthDeviceRoute = Route$11.update({
2155
- id: "/auth/device",
2156
- path: "/auth/device",
2157
- getParentRoute: () => Route$7
2158
- });
2159
- var ProjectsIndexRoute = Route$2.update({
2160
- id: "/projects/",
2161
- path: "/projects/",
2162
- getParentRoute: () => Route$7
2163
- });
2164
- var TokensIndexRoute = Route$1.update({
2165
- id: "/tokens/",
2166
- path: "/tokens/",
2167
- getParentRoute: () => Route$7
2168
- });
2169
- var TokensTokenRoute = Route$12.update({
2170
- id: "/tokens/$token",
2171
- path: "/tokens/$token",
2172
- getParentRoute: () => Route$7
2173
- });
2174
- var UsersIndexRoute = Route.update({
2175
- id: "/users/",
2176
- path: "/users/",
2177
- getParentRoute: () => Route$7
2178
- });
2179
- var UsersUserRoute = Route$13.update({
2180
- id: "/users/$user",
2181
- path: "/users/$user",
2182
- getParentRoute: () => Route$7
2183
- });
2184
- var ProjectsProjectIndexRoute = Route$14.update({
2185
- id: "/projects/$project/",
2186
- path: "/projects/$project/",
2187
- getParentRoute: () => Route$7
2188
- });
2189
- var rootRouteChildren = {
2190
- IndexRoute,
2191
- AccessRoute,
2192
- AccountRoute,
2193
- AuditRoute,
2194
- LoginRoute,
2195
- SettingsRoute,
2196
- UnregisteredRoute,
2197
- AuthDeviceRoute,
2198
- TokensTokenRoute,
2199
- UsersUserRoute,
2200
- ProjectsIndexRoute,
2201
- TokensIndexRoute,
2202
- UsersIndexRoute,
2203
- ProjectsProjectEnvironmentRoute: Route$15.update({
2204
- id: "/projects/$project/$environment",
2205
- path: "/projects/$project/$environment",
2206
- getParentRoute: () => Route$7
2207
- }),
2208
- ProjectsProjectIndexRoute
2209
- };
2210
- var routeTree = Route$7._addFileChildren(rootRouteChildren)._addFileTypes();
2211
- //#endregion
2212
- //#region src/components/route-states.tsx
2213
- /** A path that matches no page. */
2214
- function NotFound() {
2215
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
2216
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { size: 18 }),
2217
- label: "404",
2218
- title: "Nothing at this address",
2219
- actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
2220
- className: "btn",
2221
- to: "/projects",
2222
- children: "All projects"
2223
- }),
2224
- children: "There is no page at this address. If you followed a link to a project or environment, it may have been renamed or archived since."
2225
- });
2226
- }
2227
- /**
2228
- * A loader or render failure the page itself did not anticipate.
2229
- *
2230
- * Deliberately says nothing about the error's contents: they can include
2231
- * server detail that has no business on screen. Retrying re-runs the loaders.
2232
- */
2233
- function RouteError({ reset }) {
2234
- const router = useRouter();
2235
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
2236
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 18 }),
2237
- label: "Something went wrong",
2238
- title: "This page could not be shown",
2239
- actions: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2240
- type: "button",
2241
- className: "btn btn-primary",
2242
- onClick: () => {
2243
- reset();
2244
- router.invalidate();
2245
- },
2246
- children: "Try again"
2247
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
2248
- className: "btn",
2249
- to: "/projects",
2250
- children: "All projects"
2251
- })] }),
2252
- children: "coffre could not load what this page needs, and nothing was read or written. If you typed this address, check it; if it keeps happening, the service or its database may be unavailable."
2253
- });
2254
- }
2255
- //#endregion
2256
- //#region src/router.tsx
2257
- /**
2258
- * The router factory. TanStack Start calls this once per request on the server
2259
- * and once on the client, so each gets a query cache of its own: a request's
2260
- * reads are never another visitor's. The server's reads travel with the page,
2261
- * so the browser starts from them rather than asking again.
2262
- *
2263
- * Loaders read through the query cache (`lib/queries.ts`, which says how
2264
- * fresh it keeps a page), so the router keeps no copy of its own: it runs a
2265
- * route's loader on every navigation and every hover, and the cache answers
2266
- * whatever it already holds. A hover is then a read the click reuses.
2267
- */
2268
- function getRouter() {
2269
- const queryClient = createQueryClient();
2270
- const router = createRouter({
2271
- routeTree,
2272
- defaultPreload: "intent",
2273
- defaultStaleTime: 0,
2274
- defaultPreloadStaleTime: 0,
2275
- scrollRestoration: true,
2276
- defaultNotFoundComponent: NotFound,
2277
- defaultErrorComponent: RouteError,
2278
- ssr: { nonce: cspNonce() },
2279
- context: {
2280
- client: requestClient(),
2281
- queryClient
2282
- }
2283
- });
2284
- setupRouterSsrQueryIntegration({
2285
- router,
2286
- queryClient
2287
- });
2288
- return router;
2289
- }
2290
- /**
2291
- * The API as this visitor, which every loader reads through:
2292
- * `context.client.secrets.list('market/dev')`. On the server `@coffre/server`
2293
- * builds it per request, calling the API in process with the visitor's
2294
- * credential (`server/fetch-api.ts`); the UI only uses it. In the browser it
2295
- * is plain `fetch` to `/api`, which sends the session cookie itself.
2296
- */
2297
- function requestClient() {
2298
- if (typeof window !== "undefined") return createClient({ url: window.location.origin });
2299
- try {
2300
- const client = getGlobalStartContext()?.client;
2301
- if (client !== void 0) return client;
2302
- } catch {}
2303
- return createClient({
2304
- url: "http://coffre.invalid",
2305
- transport: () => Promise.reject(/* @__PURE__ */ new Error("no request to call the API for"))
2306
- });
2307
- }
2308
- /**
2309
- * The nonce the server minted for this response's Content-Security-Policy,
2310
- * which the router puts on every script it renders. The client has none to
2311
- * give: hydration reads it back from the page. A router built only to
2312
- * resolve a redirect runs outside the request's context and renders nothing.
2313
- */
2314
- function cspNonce() {
2315
- try {
2316
- return getGlobalStartContext()?.cspNonce;
2317
- } catch {
2318
- return;
2319
- }
2320
- }
2321
- //#endregion
2322
- export { getRouter };