@coffre/ui 0.1.8 → 0.1.10

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 (72) hide show
  1. package/dist/client/_coffre/assets/{account-J194gi6l.js → account-B48wuSF8.js} +1 -1
  2. package/dist/client/_coffre/assets/{account-C3rBPdu6.js → account-BkNyIDT7.js} +2 -2
  3. package/dist/client/_coffre/assets/{audit-CdCJ1U8E.js → audit-BvwKYb-5.js} +2 -2
  4. package/dist/client/_coffre/assets/audit-D02H-zxS.js +1 -0
  5. package/dist/client/_coffre/assets/{auth.device--rDR2F8w.js → auth.device-BP5FY0K1.js} +1 -1
  6. package/dist/client/_coffre/assets/{auth.device-viDUwZRT.js → auth.device-DYOONgFF.js} +2 -2
  7. package/dist/client/_coffre/assets/{coffre-CXkp3Efg.js → coffre-BBp7cKVa.js} +1 -1
  8. package/dist/client/_coffre/assets/{directory-PEjdb8PS.js → directory-Bu0EIxqI.js} +1 -1
  9. package/dist/client/_coffre/assets/{grants-4mSkXPU4.js → grants-DavcwofW.js} +1 -1
  10. package/dist/client/_coffre/assets/{index-DoJkcH-T.js → index-CDPlq5rM.js} +1 -1
  11. package/dist/client/_coffre/assets/{offboarding-DQ-56W0H.js → offboarding-DWsE2FSa.js} +1 -1
  12. package/dist/client/_coffre/assets/{principal-page-DjH1cUyz.js → principal-page-Bp_iwuSd.js} +1 -1
  13. package/dist/client/_coffre/assets/{projects._project._environment-CLUpTvi-.js → projects._project._environment-BMeX_B8l.js} +2 -2
  14. package/dist/client/_coffre/assets/{projects._project._environment-BZnNvENc.js → projects._project._environment-CT0A-hIU.js} +1 -1
  15. package/dist/client/_coffre/assets/{projects._project.index-CWXRo307.js → projects._project.index-C_xYOGLT.js} +2 -2
  16. package/dist/client/_coffre/assets/{projects._project.index-Dzgf95zv.js → projects._project.index-Chcf-cUd.js} +1 -1
  17. package/dist/client/_coffre/assets/{projects.index-BG8W91BX.js → projects.index-CfOtb1X5.js} +2 -2
  18. package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +1 -0
  19. package/dist/client/_coffre/assets/{settings-CNIY0--5.js → settings-BC9cUJNK.js} +1 -1
  20. package/dist/client/_coffre/assets/{settings-EimGqlQL.js → settings-Bkj_E21y.js} +2 -2
  21. package/dist/client/_coffre/assets/{tokens._token-CkU4dCwo.js → tokens._token-BA0KqvaW.js} +1 -1
  22. package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +2 -0
  23. package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +2 -0
  24. package/dist/client/_coffre/assets/{tokens.index-DtiWrKVq.js → tokens.index-CHueIAv1.js} +1 -1
  25. package/dist/client/_coffre/assets/{use-action-CUvWPRTx.js → use-action-l__xZDYY.js} +1 -1
  26. package/dist/client/_coffre/assets/{users._user-CImGVpYj.js → users._user-Dwqa0gv5.js} +1 -1
  27. package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +2 -0
  28. package/dist/client/_coffre/assets/users.index-BJoF-L37.js +2 -0
  29. package/dist/client/_coffre/assets/{users.index-B-7o0KBD.js → users.index-YUjtbTGy.js} +1 -1
  30. package/dist/server/.vite/manifest.json +114 -114
  31. package/dist/server/_coffre/assets/{_tanstack-start-manifest_v-C2PEUeJL.js → _tanstack-start-manifest_v-BKg2AlPu.js} +33 -33
  32. package/dist/server/_coffre/assets/{account-CZgVVZTf.js → account-CUQYGCYh.js} +4 -4
  33. package/dist/server/_coffre/assets/{account-D7-ZAE2T.js → account-DMlUoBxQ.js} +2 -2
  34. package/dist/server/_coffre/assets/{audit-CnfDYD-u.js → audit-CCdSLmvK.js} +3 -110
  35. package/dist/server/_coffre/assets/{audit-Bb9Er3nm.js → audit-CThXn2v7.js} +2 -2
  36. package/dist/server/_coffre/assets/{auth.device-CMR3csAI.js → auth.device-BoFM1jcf.js} +2 -2
  37. package/dist/server/_coffre/assets/{auth.device-w9N3FlNk.js → auth.device-C05u5ROO.js} +2 -2
  38. package/dist/server/_coffre/assets/{coffre-DMs96kfX.js → coffre-C2ANsTAz.js} +2 -1
  39. package/dist/server/_coffre/assets/{directory-Dr5X9TB5.js → directory-GsnYkse0.js} +2 -2
  40. package/dist/server/_coffre/assets/{grants-C6UmWE8b.js → grants-B6k4Fu9z.js} +2 -2
  41. package/dist/server/_coffre/assets/{offboarding-DY5MarpG.js → offboarding-8yMa7ViM.js} +1 -1
  42. package/dist/server/_coffre/assets/{principal-page-SdG8_zcu.js → principal-page-B8zPcS2b.js} +5 -5
  43. package/dist/server/_coffre/assets/{projects._project._environment-CUS0VFUe.js → projects._project._environment-BZ5Z80V8.js} +3 -3
  44. package/dist/server/_coffre/assets/{projects._project._environment-BQIrmE3r.js → projects._project._environment-DdIOc7wx.js} +2 -2
  45. package/dist/server/_coffre/assets/{projects._project.index-D1NxvBtZ.js → projects._project.index-CuEAUwGn.js} +5 -5
  46. package/dist/server/_coffre/assets/{projects._project.index-BjNdR4KC.js → projects._project.index-DvbcU1kh.js} +2 -2
  47. package/dist/server/_coffre/assets/{projects.index-BQDuuh6t.js → projects.index-5HI0wOuG.js} +11 -5
  48. package/dist/server/_coffre/assets/{projects.index-ha7jO4nC.js → projects.index-uiomWX_l.js} +2 -2
  49. package/dist/server/_coffre/assets/{router-BimLwejs.js → router-CQDoql8s.js} +13 -13
  50. package/dist/server/_coffre/assets/{settings-Cy__khNA.js → settings-4oRyDizv.js} +2 -2
  51. package/dist/server/_coffre/assets/{settings-HOErM3pd.js → settings-BVz78wjP.js} +1 -1
  52. package/dist/server/_coffre/assets/{tokens._token-CmpmtfB_.js → tokens._token-CF_deAwq.js} +3 -3
  53. package/dist/server/_coffre/assets/{tokens._token-BZUArbzi.js → tokens._token-CWs3Mtki.js} +4 -4
  54. package/dist/server/_coffre/assets/{tokens.index-BReCgoV9.js → tokens.index-Ck0LN7aC.js} +3 -3
  55. package/dist/server/_coffre/assets/{tokens.index-B5-4dD4C.js → tokens.index-DF_07KEe.js} +2 -2
  56. package/dist/server/_coffre/assets/{use-action-DQUmeH-5.js → use-action-DwEmf58L.js} +1 -1
  57. package/dist/server/_coffre/assets/{users._user-DHTNhQ9o.js → users._user-CMwj-VI9.js} +2 -2
  58. package/dist/server/_coffre/assets/{users._user-BKdSQhIg.js → users._user-DUzwkSKT.js} +2 -2
  59. package/dist/server/_coffre/assets/{users.index-dMn0tlmc.js → users.index-BbuweTwH.js} +2 -2
  60. package/dist/server/_coffre/assets/{users.index-Cfo3ODpX.js → users.index-fWHv6A30.js} +3 -3
  61. package/dist/server/index.js +2 -2
  62. package/package.json +3 -3
  63. package/src/lib/audit-sentences.ts +0 -31
  64. package/src/lib/coffre.ts +3 -2
  65. package/src/routes/audit.tsx +2 -23
  66. package/src/routes/projects.index.tsx +12 -4
  67. package/dist/client/_coffre/assets/audit-EWPPhR7U.js +0 -1
  68. package/dist/client/_coffre/assets/projects.index-N_kCFBMq.js +0 -1
  69. package/dist/client/_coffre/assets/tokens._token-Df2R8TF_.js +0 -2
  70. package/dist/client/_coffre/assets/tokens.index-CSf5Mlz8.js +0 -2
  71. package/dist/client/_coffre/assets/users._user-D0JK911L.js +0 -2
  72. package/dist/client/_coffre/assets/users.index-BoFWF3mF.js +0 -2
@@ -1 +1 @@
1
- import{$ as e,A as t,J as n,R as r,U as i,ct as a,i as o,r as s,t as c,tt as l}from"./page-DbSS7pYH.js";import{a as u,c as d,n as f,o as p,u as m}from"./preload-helper-DduCCcmc.js";import{s as h}from"./coffre-CXkp3Efg.js";import{r as g,t as _}from"./use-action-CUvWPRTx.js";import{n as v,t as y}from"./account-C3rBPdu6.js";import{r as b}from"./directory-PEjdb8PS.js";import{t as x}from"./signin-errors-CroZWZgm.js";var S=a();function C(){let{principal:e,instanceRole:t}=l({from:`__root__`}),n=y.useLoaderData();return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{title:`Account`,actions:e!==null&&(0,S.jsx)(w,{})}),(0,S.jsx)(c,{labelledBy:`appearance`,title:`Appearance`,children:(0,S.jsx)(`div`,{className:`card-body`,children:(0,S.jsx)(v,{})})}),e!==null&&(0,S.jsx)(c,{labelledBy:`identity`,title:`Identity`,children:(0,S.jsxs)(`dl`,{className:`facts`,children:[(0,S.jsx)(s,{label:e.type===`user`?`Email`:`Name`,children:(0,S.jsx)(`span`,{className:`mono`,children:e.id})}),(0,S.jsx)(s,{label:`Kind`,children:e.type===`user`?`User`:`Token`}),e.type===`user`&&(0,S.jsx)(s,{label:`Instance role`,children:(0,S.jsx)(b,{principal:{principalType:`user`,principalId:e.id,instanceRole:t??`user`,isRootAdmin:t===`root-admin`}})})]})}),n.ok?n.signin&&e?.type===`user`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(E,{email:e.id,...n}),(0,S.jsx)(D,{sessions:n.sessions,providers:n.providers})]}):(0,S.jsx)(p,{error:n.error})]})}function w(){return(0,S.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,S.jsxs)(`button`,{className:`btn`,type:`submit`,children:[(0,S.jsx)(i,{size:14}),`Sign out`]})})}function T(e,t){return e.find(e=>e.id===t)?.label??t??`unknown`}function E({email:t,providers:n,identities:i}){let{linked:a,error:o}=y.useSearch(),s=x(o),l=h(),{pending:v,error:b,run:C}=_();return(0,S.jsxs)(c,{labelledBy:`signin-accounts`,title:`Sign-in accounts`,description:`coffre recognises you by these accounts, never by an email address alone. A new account is linked here, while you are signed in.`,children:[(a!==void 0||s!==null||b!==null)&&(0,S.jsxs)(`div`,{className:`card-body`,children:[a!==void 0&&(0,S.jsxs)(d,{tone:`good`,children:[T(n,a),` account linked.`]}),(0,S.jsx)(p,{error:s??b})]}),i.length===0?(0,S.jsxs)(u,{title:`No account linked`,children:[`Your next sign-in with a verified `,(0,S.jsx)(`span`,{className:`mono`,children:t}),` links that account.`]}):(0,S.jsx)(`div`,{className:`dt-wrap`,children:(0,S.jsxs)(`table`,{className:`dt`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Account`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Linked (UTC)`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Last sign-in`}),(0,S.jsx)(`th`,{className:`col-actions`,children:(0,S.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,S.jsx)(`tbody`,{children:i.map(a=>{let o=T(n,a.provider);return(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`cell-account`,children:[(0,S.jsx)(r,{brand:n.find(e=>e.id===a.provider)?.brand??`oidc`}),(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsx)(`span`,{children:o}),a.email!==null&&(0,S.jsx)(`small`,{className:`mono`,children:a.email})]})]})}),(0,S.jsx)(`td`,{className:`nowrap`,children:(0,S.jsx)(m,{iso:a.createdAt})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:a.lastSignInAt===null?`Never`:(0,S.jsx)(m,{iso:a.lastSignInAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`col-actions`,children:(0,S.jsx)(f,{trigger:(0,S.jsxs)(`button`,{className:`act`,disabled:v,children:[(0,S.jsx)(e,{size:13}),`Unlink`]}),title:`Unlink this ${o} account?`,body:i.length===1?(0,S.jsxs)(S.Fragment,{children:[`It stops signing you in, and every session it opened ends now, this one included if you signed in with it. Your next sign-in with any account whose verified email is`,` `,(0,S.jsx)(`span`,{className:`mono`,children:t}),` links that account instead.`]}):(0,S.jsx)(S.Fragment,{children:`It stops signing you in, and every session it opened ends now, this one included if you signed in with it.`}),confirmLabel:`Unlink`,onConfirm:()=>C(()=>l.identities.unlink(a.id),()=>g.success(`${o} account unlinked`))})})]},a.id)})})]})}),n.length>0&&(0,S.jsxs)(`div`,{className:`card-foot`,children:[(0,S.jsx)(`span`,{className:`hint`,children:`Link another account`}),(0,S.jsx)(`div`,{className:`link-providers`,children:n.map(e=>(0,S.jsxs)(`a`,{className:`btn btn-sm`,href:`/auth/signin/${encodeURIComponent(e.id)}?link=1`,children:[(0,S.jsx)(r,{brand:e.brand,size:14}),e.label]},e.id))})]})]})}function D({sessions:r,providers:a}){let o=h(),{pending:s,error:l,run:d}=_();return(0,S.jsxs)(c,{labelledBy:`sessions`,title:`Sessions`,description:`Browsers and command lines signed in as you. Ending one signs it out at its next request.`,children:[l!==null&&(0,S.jsx)(`div`,{className:`card-body`,children:(0,S.jsx)(p,{error:l})}),r.length===0?(0,S.jsx)(u,{title:`No sessions`,children:`Nothing is signed in as you right now.`}):(0,S.jsx)(`div`,{className:`dt-wrap`,children:(0,S.jsxs)(`table`,{className:`dt`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Where`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Last active`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,S.jsx)(`th`,{className:`col-actions`,children:(0,S.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,S.jsx)(`tbody`,{children:r.map(r=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`cell-account`,children:[r.kind===`cli`?(0,S.jsx)(n,{size:15}):(0,S.jsx)(t,{size:15}),(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsxs)(`span`,{children:[r.label??(r.kind===`cli`?`Command line`:`Browser`),` `,r.current&&(0,S.jsx)(`span`,{className:`tag tag-blue`,children:`this browser`})]}),(0,S.jsxs)(`small`,{children:[r.kind===`cli`?`coffre login`:`via ${T(a,r.provider)}`,r.lastUsedIp!==null&&(0,S.jsxs)(S.Fragment,{children:[` · `,(0,S.jsx)(`span`,{className:`mono`,children:r.lastUsedIp})]})]})]})]})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,S.jsx)(m,{iso:r.lastUsedAt??r.createdAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,S.jsx)(m,{iso:r.expiresAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`col-actions`,children:r.current?(0,S.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,S.jsxs)(`button`,{className:`act`,type:`submit`,children:[(0,S.jsx)(i,{size:13}),`Sign out`]})}):(0,S.jsxs)(`button`,{className:`act`,disabled:s,onClick:()=>d(()=>o.sessions.revoke(r.id),()=>g.success(`Session ended`)),children:[(0,S.jsx)(e,{size:13}),`End`]})})]},r.id))})]})})]})}export{C as component};
1
+ import{$ as e,A as t,J as n,R as r,U as i,ct as a,i as o,r as s,t as c,tt as l}from"./page-DbSS7pYH.js";import{a as u,c as d,n as f,o as p,u as m}from"./preload-helper-DduCCcmc.js";import{s as h}from"./coffre-BBp7cKVa.js";import{r as g,t as _}from"./use-action-l__xZDYY.js";import{n as v,t as y}from"./account-BkNyIDT7.js";import{r as b}from"./directory-Bu0EIxqI.js";import{t as x}from"./signin-errors-CroZWZgm.js";var S=a();function C(){let{principal:e,instanceRole:t}=l({from:`__root__`}),n=y.useLoaderData();return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{title:`Account`,actions:e!==null&&(0,S.jsx)(w,{})}),(0,S.jsx)(c,{labelledBy:`appearance`,title:`Appearance`,children:(0,S.jsx)(`div`,{className:`card-body`,children:(0,S.jsx)(v,{})})}),e!==null&&(0,S.jsx)(c,{labelledBy:`identity`,title:`Identity`,children:(0,S.jsxs)(`dl`,{className:`facts`,children:[(0,S.jsx)(s,{label:e.type===`user`?`Email`:`Name`,children:(0,S.jsx)(`span`,{className:`mono`,children:e.id})}),(0,S.jsx)(s,{label:`Kind`,children:e.type===`user`?`User`:`Token`}),e.type===`user`&&(0,S.jsx)(s,{label:`Instance role`,children:(0,S.jsx)(b,{principal:{principalType:`user`,principalId:e.id,instanceRole:t??`user`,isRootAdmin:t===`root-admin`}})})]})}),n.ok?n.signin&&e?.type===`user`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(E,{email:e.id,...n}),(0,S.jsx)(D,{sessions:n.sessions,providers:n.providers})]}):(0,S.jsx)(p,{error:n.error})]})}function w(){return(0,S.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,S.jsxs)(`button`,{className:`btn`,type:`submit`,children:[(0,S.jsx)(i,{size:14}),`Sign out`]})})}function T(e,t){return e.find(e=>e.id===t)?.label??t??`unknown`}function E({email:t,providers:n,identities:i}){let{linked:a,error:o}=y.useSearch(),s=x(o),l=h(),{pending:v,error:b,run:C}=_();return(0,S.jsxs)(c,{labelledBy:`signin-accounts`,title:`Sign-in accounts`,description:`coffre recognises you by these accounts, never by an email address alone. A new account is linked here, while you are signed in.`,children:[(a!==void 0||s!==null||b!==null)&&(0,S.jsxs)(`div`,{className:`card-body`,children:[a!==void 0&&(0,S.jsxs)(d,{tone:`good`,children:[T(n,a),` account linked.`]}),(0,S.jsx)(p,{error:s??b})]}),i.length===0?(0,S.jsxs)(u,{title:`No account linked`,children:[`Your next sign-in with a verified `,(0,S.jsx)(`span`,{className:`mono`,children:t}),` links that account.`]}):(0,S.jsx)(`div`,{className:`dt-wrap`,children:(0,S.jsxs)(`table`,{className:`dt`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Account`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Linked (UTC)`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Last sign-in`}),(0,S.jsx)(`th`,{className:`col-actions`,children:(0,S.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,S.jsx)(`tbody`,{children:i.map(a=>{let o=T(n,a.provider);return(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`cell-account`,children:[(0,S.jsx)(r,{brand:n.find(e=>e.id===a.provider)?.brand??`oidc`}),(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsx)(`span`,{children:o}),a.email!==null&&(0,S.jsx)(`small`,{className:`mono`,children:a.email})]})]})}),(0,S.jsx)(`td`,{className:`nowrap`,children:(0,S.jsx)(m,{iso:a.createdAt})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:a.lastSignInAt===null?`Never`:(0,S.jsx)(m,{iso:a.lastSignInAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`col-actions`,children:(0,S.jsx)(f,{trigger:(0,S.jsxs)(`button`,{className:`act`,disabled:v,children:[(0,S.jsx)(e,{size:13}),`Unlink`]}),title:`Unlink this ${o} account?`,body:i.length===1?(0,S.jsxs)(S.Fragment,{children:[`It stops signing you in, and every session it opened ends now, this one included if you signed in with it. Your next sign-in with any account whose verified email is`,` `,(0,S.jsx)(`span`,{className:`mono`,children:t}),` links that account instead.`]}):(0,S.jsx)(S.Fragment,{children:`It stops signing you in, and every session it opened ends now, this one included if you signed in with it.`}),confirmLabel:`Unlink`,onConfirm:()=>C(()=>l.identities.unlink(a.id),()=>g.success(`${o} account unlinked`))})})]},a.id)})})]})}),n.length>0&&(0,S.jsxs)(`div`,{className:`card-foot`,children:[(0,S.jsx)(`span`,{className:`hint`,children:`Link another account`}),(0,S.jsx)(`div`,{className:`link-providers`,children:n.map(e=>(0,S.jsxs)(`a`,{className:`btn btn-sm`,href:`/auth/signin/${encodeURIComponent(e.id)}?link=1`,children:[(0,S.jsx)(r,{brand:e.brand,size:14}),e.label]},e.id))})]})]})}function D({sessions:r,providers:a}){let o=h(),{pending:s,error:l,run:d}=_();return(0,S.jsxs)(c,{labelledBy:`sessions`,title:`Sessions`,description:`Browsers and command lines signed in as you. Ending one signs it out at its next request.`,children:[l!==null&&(0,S.jsx)(`div`,{className:`card-body`,children:(0,S.jsx)(p,{error:l})}),r.length===0?(0,S.jsx)(u,{title:`No sessions`,children:`Nothing is signed in as you right now.`}):(0,S.jsx)(`div`,{className:`dt-wrap`,children:(0,S.jsxs)(`table`,{className:`dt`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Where`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Last active`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,S.jsx)(`th`,{className:`col-actions`,children:(0,S.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,S.jsx)(`tbody`,{children:r.map(r=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`cell-account`,children:[r.kind===`cli`?(0,S.jsx)(n,{size:15}):(0,S.jsx)(t,{size:15}),(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsxs)(`span`,{children:[r.label??(r.kind===`cli`?`Command line`:`Browser`),` `,r.current&&(0,S.jsx)(`span`,{className:`tag tag-blue`,children:`this browser`})]}),(0,S.jsxs)(`small`,{children:[r.kind===`cli`?`coffre login`:`via ${T(a,r.provider)}`,r.lastUsedIp!==null&&(0,S.jsxs)(S.Fragment,{children:[` · `,(0,S.jsx)(`span`,{className:`mono`,children:r.lastUsedIp})]})]})]})]})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,S.jsx)(m,{iso:r.lastUsedAt??r.createdAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,S.jsx)(m,{iso:r.expiresAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`col-actions`,children:r.current?(0,S.jsx)(`form`,{method:`post`,action:`/auth/signout`,children:(0,S.jsxs)(`button`,{className:`act`,type:`submit`,children:[(0,S.jsx)(i,{size:13}),`Sign out`]})}):(0,S.jsxs)(`button`,{className:`act`,disabled:s,onClick:()=>d(()=>o.sessions.revoke(r.id),()=>g.success(`Session ended`)),children:[(0,S.jsx)(e,{size:13}),`End`]})})]},r.id))})]})})]})}export{C as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/account-J194gi6l.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/signin-errors-CroZWZgm.js"])))=>i.map(i=>d[i]);
2
- import{A as e,G as t,Ot as n,Tt as r,ct as i,j as a,u as o}from"./page-DbSS7pYH.js";import{T as s,g as c,t as l,w as u}from"./preload-helper-DduCCcmc.js";import{o as d}from"./coffre-CXkp3Efg.js";var f=n(r(),1),p=i(),m=`coffre-theme`,h=`coffre-theme-change`,g=`(function(){try{var t=localStorage.getItem(${JSON.stringify(m)});if(t==="light"||t==="dark"){document.documentElement.setAttribute("data-theme",t)}}catch(e){}})()`;function _(){try{let e=localStorage.getItem(m);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function v(e){let t=document.documentElement;try{e===`system`?localStorage.removeItem(m):localStorage.setItem(m,e)}catch{}e===`system`?t.removeAttribute(`data-theme`):t.setAttribute(`data-theme`,e),window.dispatchEvent(new CustomEvent(h))}var y=[{value:`system`,label:`Match system`,Icon:e},{value:`light`,label:`Light`,Icon:t},{value:`dark`,label:`Dark`,Icon:a}];function b(){let[e,t]=(0,f.useState)(`system`);return(0,f.useEffect)(()=>{let e=()=>t(_());return e(),window.addEventListener(h,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(h,e),window.removeEventListener(`storage`,e)}},[]),e}function x(){let e=b();return(0,p.jsx)(c.RadioGroup,{value:e,onValueChange:e=>v(e),children:y.map(({value:e,label:t,Icon:n})=>(0,p.jsxs)(c.RadioItem,{value:e,className:`menu-item`,children:[(0,p.jsx)(n,{size:15}),t,(0,p.jsx)(c.ItemIndicator,{className:`menu-check`,children:(0,p.jsx)(o,{size:14})})]},e))})}function S(){let e=b();return(0,p.jsx)(`div`,{className:`theme-choice`,role:`group`,"aria-label":`Colour scheme`,children:y.map(({value:t,label:n,Icon:r})=>(0,p.jsx)(`button`,{type:`button`,"aria-pressed":e===t,"aria-label":n,title:n,onClick:()=>v(t),children:(0,p.jsx)(r,{size:14})},t))})}function C(e){v(e)}function w(){let e=b();return(0,p.jsx)(`div`,{className:`choice-grid`,role:`group`,"aria-label":`Colour scheme`,children:y.map(({value:t,label:n,Icon:r})=>(0,p.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e===t,onClick:()=>v(t),children:[(0,p.jsx)(r,{size:16}),n]},t))})}var T=s(`/account`)({validateSearch:e=>{let t={};for(let n of[`linked`,`error`]){let r=e[n];typeof r==`string`&&/^[a-z0-9_-]{1,40}$/.test(r)&&(t[n]=r)}return t},loader:async({context:{client:e},parentMatchPromise:t})=>{let n=(await t).loaderData?.auth;if(n===void 0||n.signin===null)return{ok:!0,signin:!1,providers:[],identities:[],sessions:[]};let{providers:r}=n.signin;return d(async()=>{let[{identities:t},{sessions:n}]=await Promise.all([e.identities.list(),e.sessions.list()]);return{signin:!0,providers:r,identities:t,sessions:n}})},component:u(()=>l(()=>import(`./account-J194gi6l.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{C as a,S as i,w as n,g as o,x as r,T as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/account-B48wuSF8.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/signin-errors-CroZWZgm.js"])))=>i.map(i=>d[i]);
2
+ import{A as e,G as t,Ot as n,Tt as r,ct as i,j as a,u as o}from"./page-DbSS7pYH.js";import{T as s,g as c,t as l,w as u}from"./preload-helper-DduCCcmc.js";import{o as d}from"./coffre-BBp7cKVa.js";var f=n(r(),1),p=i(),m=`coffre-theme`,h=`coffre-theme-change`,g=`(function(){try{var t=localStorage.getItem(${JSON.stringify(m)});if(t==="light"||t==="dark"){document.documentElement.setAttribute("data-theme",t)}}catch(e){}})()`;function _(){try{let e=localStorage.getItem(m);return e===`light`||e===`dark`?e:`system`}catch{return`system`}}function v(e){let t=document.documentElement;try{e===`system`?localStorage.removeItem(m):localStorage.setItem(m,e)}catch{}e===`system`?t.removeAttribute(`data-theme`):t.setAttribute(`data-theme`,e),window.dispatchEvent(new CustomEvent(h))}var y=[{value:`system`,label:`Match system`,Icon:e},{value:`light`,label:`Light`,Icon:t},{value:`dark`,label:`Dark`,Icon:a}];function b(){let[e,t]=(0,f.useState)(`system`);return(0,f.useEffect)(()=>{let e=()=>t(_());return e(),window.addEventListener(h,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(h,e),window.removeEventListener(`storage`,e)}},[]),e}function x(){let e=b();return(0,p.jsx)(c.RadioGroup,{value:e,onValueChange:e=>v(e),children:y.map(({value:e,label:t,Icon:n})=>(0,p.jsxs)(c.RadioItem,{value:e,className:`menu-item`,children:[(0,p.jsx)(n,{size:15}),t,(0,p.jsx)(c.ItemIndicator,{className:`menu-check`,children:(0,p.jsx)(o,{size:14})})]},e))})}function S(){let e=b();return(0,p.jsx)(`div`,{className:`theme-choice`,role:`group`,"aria-label":`Colour scheme`,children:y.map(({value:t,label:n,Icon:r})=>(0,p.jsx)(`button`,{type:`button`,"aria-pressed":e===t,"aria-label":n,title:n,onClick:()=>v(t),children:(0,p.jsx)(r,{size:14})},t))})}function C(e){v(e)}function w(){let e=b();return(0,p.jsx)(`div`,{className:`choice-grid`,role:`group`,"aria-label":`Colour scheme`,children:y.map(({value:t,label:n,Icon:r})=>(0,p.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e===t,onClick:()=>v(t),children:[(0,p.jsx)(r,{size:16}),n]},t))})}var T=s(`/account`)({validateSearch:e=>{let t={};for(let n of[`linked`,`error`]){let r=e[n];typeof r==`string`&&/^[a-z0-9_-]{1,40}$/.test(r)&&(t[n]=r)}return t},loader:async({context:{client:e},parentMatchPromise:t})=>{let n=(await t).loaderData?.auth;if(n===void 0||n.signin===null)return{ok:!0,signin:!1,providers:[],identities:[],sessions:[]};let{providers:r}=n.signin;return d(async()=>{let[{identities:t},{sessions:n}]=await Promise.all([e.identities.list(),e.sessions.list()]);return{signin:!0,providers:r,identities:t,sessions:n}})},component:u(()=>l(()=>import(`./account-B48wuSF8.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{C as a,S as i,w as n,g as o,x as r,T as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/audit-EWPPhR7U.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r,o as i}from"./coffre-CXkp3Efg.js";var a=()=>t(()=>import(`./audit-EWPPhR7U.js`),__vite__mapDeps([0,1,2])),o=200,s=e(`/audit`)({validateSearch:e=>({decision:e.decision===`deny`?`deny`:void 0,actorId:typeof e.actorId==`string`&&e.actorId!==``?e.actorId:void 0,detail:e.detail===`1`||e.detail===1?`1`:void 0}),loaderDeps:({search:e})=>e,loader:async({context:{client:e},deps:t})=>{let[n,r]=await Promise.all([c(e,t),l(e)]);return{entries:n,chain:r}},component:n(a,`component`)});function c(e,t){return i(async()=>e.audit.list({limit:o,decision:t.decision,actor:t.actorId,detail:t.detail}))}async function l(e){try{let t=await e.audit.verify();return t.ok?{integrity:`intact`,through:t.through,entries:t.entries,checkpoint:t.checkpoint,pending:t.pending??0}:{integrity:`broken`,through:t.through,failedAtSeq:t.failedAtSeq,author:t.author,reason:t.reason}}catch(e){let t=r(e);return t===403?{integrity:`owners-only`}:{integrity:`unknown`,problem:t===void 0?`the request never got an answer`:`the request failed with HTTP ${t}`}}}export{s as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/audit-D02H-zxS.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r,o as i}from"./coffre-BBp7cKVa.js";var a=()=>t(()=>import(`./audit-D02H-zxS.js`),__vite__mapDeps([0,1,2])),o=200,s=e(`/audit`)({validateSearch:e=>({decision:e.decision===`deny`?`deny`:void 0,actorId:typeof e.actorId==`string`&&e.actorId!==``?e.actorId:void 0,detail:e.detail===`1`||e.detail===1?`1`:void 0}),loaderDeps:({search:e})=>e,loader:async({context:{client:e},deps:t})=>{let[n,r]=await Promise.all([c(e,t),l(e)]);return{entries:n,chain:r}},component:n(a,`component`)});function c(e,t){return i(async()=>e.audit.list({limit:o,decision:t.decision,actor:t.actorId,detail:t.detail}))}async function l(e){try{let t=await e.audit.verify();return t.ok?{integrity:`intact`,through:t.through,entries:t.entries,checkpoint:t.checkpoint,pending:t.pending??0}:{integrity:`broken`,through:t.through,failedAtSeq:t.failedAtSeq,author:t.author,reason:t.reason}}catch(e){let t=r(e);return t===403?{integrity:`owners-only`}:{integrity:`unknown`,problem:t===void 0?`the request never got an answer`:`the request failed with HTTP ${t}`}}}export{s as t};
@@ -0,0 +1 @@
1
+ import{$ as e,H as t,Ot as n,S as r,T as i,Tt as a,W as o,X as s,c,ct as l,f as u,i as d,m as f,n as p,o as m}from"./page-DbSS7pYH.js";import{D as h,a as g,c as _,f as v,m as y,u as b}from"./preload-helper-DduCCcmc.js";import{t as x}from"./audit-BvwKYb-5.js";var S=n(a()),C=e=>typeof e==`string`&&e!==``?e:null,w=e=>typeof e==`number`?e:null;function T({project:e,environment:t,key:n}){let r=[e,t,n].filter(e=>e!==null);return r.length===0?[`coffre`]:[{place:r.join(`/`)}]}function E({project:e,environment:t}){return T({project:e,environment:t,key:null})}function D(e){if(e.subject!==null)return[{member:e.subject}];let t=C(e.metadata.principalId);return t===null?[`someone`]:[{member:`${e.metadata.principalType===`service`?`token`:`user`}:${t}`}]}function O(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function k(e){return e.batch.length===1?T(e.entry):[...E(e.entry),e.refused?`, `:`: `,O(e.count,`secret`)]}function A(e){let t=C(e.metadata.destination);return t===null?``:` to ${t}`}function j(e){return C(e.metadata.destination)??`its destination`}var M={reveal:[`revealed`,`reveal`],run:[`ran`,`run`],compare:[`compared`,`compare`],sync:[`read`,`read`]};function N({entry:e}){return M[C(e.metadata.purpose)??`reveal`]??M.reveal}var P=e=>{let t=t=>[`${e} `,...e===`project`?T({...t.entry,environment:null,key:null}):E(t.entry)];return{[`${e}.create`]:{did:`created`,tried:`create`,what:t},[`${e}.update`]:{did:`changed`,tried:`change`,what:t},[`${e}.archive`]:{did:`archived`,tried:`archive`,what:t},[`${e}.restore`]:{did:`restored`,tried:`restore`,what:t}}},F={"secret.read":{did:e=>N(e)[0],tried:e=>N(e)[1],what:k},"secret.write":{did:({batch:e})=>{let t=e.filter(e=>e.version===1).length;return t===e.length?`added`:t===0?`changed`:`wrote`},tried:`change`,what:k,then:({entry:e,batch:t})=>t.length>1||e.version===null||e.version===1?[]:[`, now version ${e.version}`]},"secret.restore":{did:`restored`,tried:`restore`,what:({entry:e})=>[...T(e),...w(e.metadata.from)===null?[]:[` to version ${w(e.metadata.from)}`]],then:({entry:e})=>e.version===null?[]:[`, now ${e.version}`]},"secret.rename":{did:`renamed`,tried:`rename`,what:({entry:e})=>[...T(e),...C(e.metadata.nextKey)===null?[]:[` to ${C(e.metadata.nextKey)}`]]},"secret.archive":{did:`archived`,tried:`archive`,what:e=>T(e.entry)},"secret.unarchive":{did:`brought back`,tried:`bring back`,what:e=>T(e.entry)},...P(`project`),...P(`environment`),"access.grant":{did:`gave`,tried:`give`,what:({entry:e})=>[...D(e),` ${C(e.metadata.role)??`a role`} on `,...I(e)],then:({entry:e})=>[...C(e.metadata.previousRole)===null?[]:[`, was ${C(e.metadata.previousRole)}`],...C(e.metadata.expiresAt)===null?[]:[`, until ${C(e.metadata.expiresAt).slice(0,10)}`]]},"access.revoke":{did:`took`,tried:`take`,what:({entry:e})=>[...C(e.metadata.previousRole??e.metadata.role)===null?[`access to `]:[`${C(e.metadata.previousRole??e.metadata.role)} on `],...I(e),` from `,...D(e)]},"member.add":{did:`added`,tried:`add`,what:({entry:e})=>[...D(e),...e.metadata.rootAdmin===!0?[` as a root admin`]:e.metadata.owner===!0?[` as an owner`]:[]]},"member.remove":{did:`removed`,tried:`remove`,what:e=>D(e.entry),then:({entry:e})=>w(e.metadata.revoked)===null?[]:[`, who held ${O(w(e.metadata.revoked),`grant`)}`]},"member.restore":{did:`brought back`,tried:`bring back`,what:e=>D(e.entry)},"member.owner":{did:({entry:e})=>e.metadata.owner===!1?`took owner from`:`made`,tried:({entry:e})=>e.metadata.owner===!1?`take owner from`:`make`,what:({entry:e})=>[...D(e),...e.metadata.owner===!1?[]:[` an owner`]]},"sync.create":{did:`set up a sync of`,tried:`set up a sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.update":{did:({entry:e})=>e.metadata.paused===!0?`paused the sync of`:e.metadata.paused===!1?`resumed the sync of`:`changed the sync of`,tried:`change the sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.delete":{did:`removed the sync of`,tried:`remove the sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.push":{did:`pushed`,tried:`push`,what:e=>e.batch.length===1?[...T(e.entry),` to ${j(e.entry)}`]:[...E(e.entry),` to ${j(e.entry)}: ${O(e.count,`secret`)}`]},"sync.remove":{did:`removed`,tried:`remove`,what:e=>e.batch.length===1?[...T(e.entry),` from ${j(e.entry)}`]:[O(e.count,`secret`),` of `,...E(e.entry),` from ${j(e.entry)}`]},"vault.tampered":{did:`found`,tried:`check`,what:({entry:e})=>[...e.subject===null?[`an entry`]:[...D(e),`'s record`],` tampered with: ${R[e.reason??``]??`it fails its seal`}`]},"key.rotate":{did:`rotated its key`,tried:`rotate its key`,what:()=>[]},sign_in:{did:({entry:e})=>e.metadata.kind===`cli`?`signed in to the CLI`:`signed in`,tried:`sign in`,what:({entry:e})=>C(e.metadata.provider)===null?[]:[`with ${C(e.metadata.provider)}`]},sign_out:{did:`signed out`,tried:`sign out`,what:()=>[]},"token.create":{did:`issued a token to`,tried:`issue a token to`,what:e=>D(e.entry)},"token.revoke":{did:`revoked a token of`,tried:`revoke a token of`,what:e=>D(e.entry)},"device.approve":{did:`approved a CLI sign-in`,tried:`approve a CLI sign-in`,what:()=>[]},"device.deny":{did:`turned down a CLI sign-in`,tried:`turn down a CLI sign-in`,what:()=>[]},"account.link":{did:`linked`,tried:`link`,what:({entry:e})=>[`a ${C(e.metadata.provider)??`sign-in`} account`]},"account.unlink":{did:`unlinked`,tried:`unlink`,what:({entry:e})=>[`a ${C(e.metadata.provider)??`sign-in`} account`]},"key.wrap":{did:`sealed the key of`,tried:`seal the key of`,what:e=>L(e.entry)},"key.rewrap":{did:`resealed the key of`,tried:`reseal the key of`,what:e=>L(e.entry)},"key.intent":{did:`asked KMS about`,tried:`ask KMS about`,what:e=>k(e)},"key.check":{did:`recorded the check value of`,tried:`check`,what:({entry:e})=>[[`the`,C(e.metadata.kekProvider)===`local`?null:C(e.metadata.kekProvider),`vault key`,C(e.metadata.kekId)].filter(e=>e!==null).join(` `)]},"sync.run":{did:`ran the sync of`,tried:`run the sync of`,what:({entry:e})=>[...E(e),A(e)]},"audit.heartbeat":{did:`checked in`,tried:`check in`,what:()=>[]},"audit.checkpoint":{did:`signed the log`,tried:`sign the log`,what:({entry:e})=>w(e.metadata.seq)===null?[]:[`through entry ${w(e.metadata.seq)}`]},"secret.list":{did:`listed`,tried:`list`,what:({entry:e})=>E(e)},"secret.history":{did:`read the history of`,tried:`read the history of`,what:e=>T(e.entry)},"secret.update":{did:`changed`,tried:`change`,what:e=>T(e.entry)},"sync.list":{did:`listed the syncs of`,tried:`list the syncs of`,what:({entry:e})=>E(e)}};function I(e){return T({...e,key:null})}function L(e){return[...T(e),...e.version===null?[]:[`, version ${e.version}`]]}var R={mac:`it does not carry the vault's seal`,stale:`an older copy was put back`,forged_entry:`the vault did not write it`},z={no_grant:`no grant`,bulk_limit:`bulk limit`,expired:`grant expired`,removed:`removed from coffre`,not_a_member:`not a member`,not_registered:`not invited`,tampered:`their record was tampered with`,bad_claim:`the key did not match the secret`,not_allowed:`not allowed`,root_admin:`root admins are set by the deployment`,unknown_environment:`no such environment`,unknown_secret:`no such secret`,unknown_project:`no such project`,unusable_credential:`its token is not a secret they can read`,duplicate_destination:`already synced from elsewhere`,cannot_grant_sync:`cannot grant the sync its reads`,kms_unavailable:`KMS did not answer`,wrong_kek:`the vault's key is not the one that wrapped the data`},B={secret_read:`no grant to read it`,secret_write:`no grant to write`,secret_archive:`no grant to archive`,audit_read:`no grant to read the audit log`,environment_manage:`no grant to manage environments`,grant_manage:`no grant to manage access`,project_manage:`no grant to manage the project`};function V(e){return e===null?`refused`:e.startsWith(`missing_`)?B[e.slice(8)]??`no grant`:z[e]??e.replace(/_/g,` `)}var H=[`sync.push`,`sync.remove`,`secret.write`,`secret.read`];function ee(e){for(let t of H){let n=e.find(e=>e.action===t);if(n!==void 0)return n}return e[0]}function U(e){let t=ee(e),n=e.filter(e=>e.action===t.action),r=n.filter(e=>e.decision===`deny`),i=r.length===n.length,a={entry:t,batch:n,count:new Set(n.map(e=>`${e.project}/${e.environment}/${e.key}`)).size,refused:i},o=F[t.action];if(o===void 0)return{parts:[t.action,` `,...T(t)],refused:i};let s=e=>typeof e==`string`?e:e(a),c=o.what(a),l=c.length===0?[]:[` `];if(i){let e=V((r[0]??t).reason);return{parts:[`tried to `,s(o.tried),...l,...c,`: ${e}`],refused:i}}let u=r.length===0?[]:[`, ${r.length} refused: ${V(r[0].reason)}`];return{parts:[s(o.did),...l,...c,...o.then?.(a)??[],...u],refused:i}}function W(e){let t=e[0];if(t.actorType===`user`)return{member:`user:${t.actorId}`};if(t.actorType===`service`)return{member:`token:${t.actorId}`};if(t.actorId.startsWith(`sync:`)){let t=e.map(e=>C(e.metadata.provider)).find(e=>e!==null),n=t===void 0?void 0:G[t]??t;return n===void 0?`a sync`:`sync to ${n}`}return K[t.actorId]??t.actorId}var G={"github-actions":`GitHub`,vercel:`Vercel`,railway:`Railway`,"cloudflare-workers":`Cloudflare`},K={scheduler:`the scheduler`,cron:`the scheduler`,vault:`the vault`,app:`coffre`};function q(e){return[`vault`,`app`].filter(t=>e.some(e=>e.author===t)).join(`, `)}function J(e){let t=[],n=new Map;for(let r of e){let e=r.operationId===null?void 0:n.get(r.operationId);if(e!==void 0){e.push(r);continue}let i=[r];r.operationId!==null&&n.set(r.operationId,i),t.push(i)}return t}var Y=l();function X(){let{entries:n,chain:r}=x.useLoaderData(),a=x.useSearch(),{decision:c,actorId:l}=a,u=a.detail===`1`,v=c===`deny`;if(!n.ok)return(0,Y.jsx)(p,{icon:(0,Y.jsx)(i,{size:18}),label:`Audit`,title:`The audit log is closed to you`,children:n.error});let y=r.integrity===`broken`?r:null,b=y?.failedAtSeq??null,S=J(n.entries),C={decision:c,actorId:l};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(d,{title:`Audit`,actions:(0,Y.jsx)(ae,{chain:r})}),y!==null&&(0,Y.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,Y.jsxs)(_,{tone:`bad`,children:[(0,Y.jsx)(`strong`,{children:`Treat this as an incident.`}),` `,y.failedAtSeq===null?`The log does not verify, found by the ${y.author}'s check: ${y.reason}.`:`The log breaks at entry ${y.failedAtSeq}, found by the ${y.author}'s check: ${y.reason}.`,` `,y.through!==null&&`Every entry through ${y.through} holds. `,`Something with direct access to the database has changed what it records`,y.failedAtSeq===null?``:`, and nothing from entry ${y.failedAtSeq} on can be relied on`,` until that is explained.`,b!==null&&!n.entries.some(e=>e.seq===b)&&(0,Y.jsxs)(Y.Fragment,{children:[` `,`Entry `,b,` is not among the entries below`,u?(0,Y.jsxs)(Y.Fragment,{children:[`; `,(0,Y.jsx)(`code`,{children:`coffre audit`}),` lists them all.`]}):`: it may be detail, which Show detail lists.`]})]})}),(0,Y.jsxs)(`div`,{className:`toolbar`,children:[(0,Y.jsxs)(`nav`,{className:`segmented`,"aria-label":`Filter by decision`,children:[(0,Y.jsx)(h,{to:`/audit`,search:{...C,decision:void 0,detail:a.detail},activeOptions:{exact:!0},children:`All events`}),(0,Y.jsxs)(h,{to:`/audit`,search:{...C,decision:`deny`,detail:a.detail},activeOptions:{exact:!0},children:[(0,Y.jsx)(o,{size:13}),`Denials only`]})]}),l!==void 0&&(0,Y.jsxs)(h,{className:`filter-chip`,to:`/audit`,search:{...C,actorId:void 0,detail:a.detail},"aria-label":`Stop filtering by ${l}`,children:[`Actor `,(0,Y.jsx)(`span`,{className:`mono`,children:l}),(0,Y.jsx)(e,{size:13})]}),(0,Y.jsxs)(h,{className:`detail-toggle`,to:`/audit`,search:{...C,detail:u?void 0:`1`},"aria-pressed":u,children:[(0,Y.jsx)(`span`,{className:`switch`,"aria-hidden":`true`}),`Show detail`]})]}),(0,Y.jsx)(`section`,{className:`card`,"aria-label":`Audit entries`,children:S.length===0?(0,Y.jsx)(g,{title:v?`No denials recorded`:`Nothing recorded yet`,children:v?`Every decision reaches this log, refusals included. An empty page means nobody has been turned away.`:`The log fills as people read and write secrets and change who has access.`}):(0,Y.jsx)(`div`,{className:`dt-wrap`,children:(0,Y.jsxs)(`table`,{className:`dt audit events stacks`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`n`,title:`Sequence number in the log`,children:`#`}),(0,Y.jsx)(`th`,{className:`col-shrink`,children:(0,Y.jsxs)(`span`,{className:`th`,children:[(0,Y.jsx)(f,{size:14}),`When (UTC)`]})}),(0,Y.jsx)(`th`,{className:`col-shrink`,children:(0,Y.jsxs)(`span`,{className:`th`,children:[(0,Y.jsx)(s,{size:14}),`Who`]})}),(0,Y.jsx)(`th`,{children:(0,Y.jsxs)(`span`,{className:`th`,children:[(0,Y.jsx)(m,{size:14}),`What they did`]})}),(0,Y.jsx)(`th`,{className:`col-shrink`,children:(0,Y.jsxs)(`span`,{className:`th`,children:[(0,Y.jsx)(t,{size:14}),`Decided by`]})})]})}),(0,Y.jsx)(`tbody`,{children:S.map(e=>(0,Y.jsx)(Z,{batch:e,filters:C,detail:a.detail,breakAt:b},e[0].seq))})]})})})]})}function Z({batch:e,filters:t,detail:n,breakAt:r}){let i=r!==null&&e.some(e=>e.seq===r),[a,o]=(0,S.useState)(i),s=e[0],c=U(e),l=e.map(e=>e.seq),d=e.length>1;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{entry:s,seq:d?`${Math.min(...l)}–${Math.max(...l)}`:String(s.seq),parts:c.parts,refused:c.refused,decided:q(e),filters:t,detail:n,breaks:i&&!d,marked:i,batch:e,toggle:d?(0,Y.jsx)(`button`,{type:`button`,className:`batch-toggle`,"aria-expanded":a,"aria-label":a?`Hide each entry`:`Show each of ${e.length} entries`,onClick:()=>o(!a),children:(0,Y.jsx)(u,{size:14})}):void 0}),d&&a&&e.map(e=>{let i=U([e]);return(0,Y.jsx)(Q,{entry:e,seq:String(e.seq),parts:i.parts,refused:i.refused,decided:q([e]),filters:t,detail:n,breaks:e.seq===r,marked:!1,child:!0},e.seq)})]})}function Q({entry:e,seq:t,parts:n,refused:r,decided:i,filters:a,detail:s,breaks:l,marked:u,toggle:d,child:f=!1,batch:p}){let m=W(p??[e]),g=[r&&`is-denied`,(l||u)&&`is-break`,f&&`is-child`,e.detail&&`is-detail`,e.action===`vault.tampered`&&`is-tampered`].filter(Boolean);return(0,Y.jsxs)(`tr`,{className:g.length===0?void 0:g.join(` `),children:[(0,Y.jsx)(`td`,{className:`n`,"data-label":`Sequence`,children:t}),(0,Y.jsx)(`td`,{className:`nowrap cell-mono`,"data-label":`When (UTC)`,children:(0,Y.jsx)(b,{iso:e.occurredAt,precise:!0})}),(0,Y.jsx)(`td`,{"data-label":`Who`,children:(0,Y.jsx)(`span`,{className:`actor`,children:typeof m==`string`?(0,Y.jsx)(h,{to:`/audit`,search:{...a,actorId:e.actorId,detail:s},children:m}):(0,Y.jsx)(h,{to:`/audit`,search:{...a,actorId:e.actorId,detail:s},children:$(m.member)})})}),(0,Y.jsx)(`td`,{className:`cell-sentence`,"data-label":`What they did`,children:(0,Y.jsxs)(`span`,{className:`sentence`,children:[d,e.action===`vault.tampered`&&(0,Y.jsx)(c,{size:13}),(0,Y.jsx)(te,{parts:n}),l&&(0,Y.jsx)(ie,{})]})}),(0,Y.jsx)(`td`,{className:`nowrap`,"data-label":`Decided by`,children:(0,Y.jsxs)(`span`,{className:r?`decided decided-refused`:`decided`,children:[r&&(0,Y.jsx)(o,{size:13}),i,r&&`, refused`]})})]})}function te({parts:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsx)(S.Fragment,{children:typeof e==`string`?e:`place`in e?(0,Y.jsx)(ne,{path:e.place}):(0,Y.jsx)(re,{member:e.member})},t))})}function ne({path:e}){let[t,n]=e.split(`/`),r=(0,Y.jsx)(`span`,{className:`mono`,children:y(e)});return n===void 0?(0,Y.jsx)(h,{to:`/projects/$project`,params:{project:t},children:r}):(0,Y.jsx)(h,{to:`/projects/$project/$environment`,params:{project:t,environment:n},children:r})}function re({member:e}){return e.startsWith(`token:`)?(0,Y.jsx)(h,{to:`/tokens/$token`,params:{token:e.slice(6)},children:e}):(0,Y.jsx)(h,{to:`/users/$user`,params:{user:$(e)},children:$(e)})}function $(e){return e.startsWith(`user:`)?e.slice(5):e}function ie(){return(0,Y.jsxs)(`span`,{className:`break-mark`,children:[(0,Y.jsx)(c,{size:11}),`breaks here`]})}function ae({chain:e}){return e.integrity===`owners-only`?(0,Y.jsx)(v,{align:`end`,label:`Owners and root admins see whether the log is intact. Checking it means recomputing every entry, and you read only your projects' part of it.`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`chain-note`,children:[(0,Y.jsx)(r,{size:14}),`Verified by owners`]})}):e.integrity===`unknown`?(0,Y.jsx)(v,{align:`end`,label:`coffre could not check the log: ${e.problem}. The entries below loaded, but whether they are intact is unknown until it can. Reload to try again.`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`chain-flag chain-flag-warn`,children:[(0,Y.jsx)(c,{size:14}),`Log not verified`]})}):e.integrity===`broken`?(0,Y.jsxs)(`span`,{className:`chain-flag chain-flag-bad`,role:`status`,children:[(0,Y.jsx)(c,{size:14}),e.failedAtSeq===null?`Log does not verify`:`Log broken at ${e.failedAtSeq}`]}):(0,Y.jsxs)(`div`,{className:`chain`,children:[e.pending>0&&(0,Y.jsx)(v,{align:`end`,label:`Keys released through KMS whose outcome the vault has not logged yet. Each settles within seconds, or is logged as failed.`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`chain-note`,role:`status`,children:[e.pending,` key operation`,e.pending===1?``:`s`,` in flight`]})}),(0,Y.jsx)(v,{align:`end`,label:`Every entry through ${e.through??0} holds, under the app's key and the vault's.`+(e.checkpoint===null?` The vault has not signed the log yet.`:` The vault last signed it through entry ${e.checkpoint.seq}, at ${e.checkpoint.signedAt}.`),children:(0,Y.jsxs)(`button`,{type:`button`,className:`chain-seal`,children:[(0,Y.jsx)(t,{size:14}),`Verified`]})})]})}export{X as component};
@@ -1 +1 @@
1
- import{J as e,Ot as t,Tt as n,W as r,ct as i,d as a,n as o}from"./page-DbSS7pYH.js";import{D as s,O as c,l,o as u,u as d}from"./preload-helper-DduCCcmc.js";import{i as f,n as p,s as m}from"./coffre-CXkp3Efg.js";import{t as h}from"./auth.device-viDUwZRT.js";var g=t(n()),_=i();function v(){let e=h.useLoaderData(),[t,n]=(0,g.useState)(null);return t===`approved`?(0,_.jsx)(o,{icon:(0,_.jsx)(a,{size:18}),label:`coffre CLI`,title:`Your terminal is signed in`,children:(0,_.jsx)(`p`,{children:`You can close this tab and go back to the terminal.`})}):t===`denied`?(0,_.jsx)(o,{icon:(0,_.jsx)(r,{size:18}),label:`coffre CLI`,title:`Sign-in refused`,children:(0,_.jsxs)(`p`,{children:[`The terminal that asked gets nothing. If you did not run `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself, someone may be trying to get you to approve theirs; the refusal is in the audit log.`]})}):e===null?(0,_.jsx)(y,{}):e.ok?e.request===null?(0,_.jsx)(y,{error:`That code is unknown, already used, or expired. Run coffre login again for a new one.`}):(0,_.jsx)(b,{request:e.request,sessionDays:e.sessionDays,onDecided:n}):(0,_.jsx)(y,{error:e.error})}function y({error:e=null}){let t=c(),[n,r]=(0,g.useState)(``);return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Sign in the coffre CLI`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Enter the code your terminal shows after `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),`.`]})]}),(0,_.jsxs)(`form`,{className:`signin-form`,onSubmit:e=>{e.preventDefault(),t({to:`/auth/device`,search:{code:n.trim()}})},children:[(0,_.jsxs)(`label`,{className:`field`,children:[(0,_.jsx)(`span`,{className:`label`,children:`Code`}),(0,_.jsx)(`input`,{className:`input mono device-code-input`,name:`code`,autoComplete:`off`,autoCapitalize:`characters`,spellCheck:!1,placeholder:`XXXX-XXXX`,maxLength:16,value:n,onChange:e=>r(e.target.value)})]}),(0,_.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,style:{height:`2.125rem`},disabled:n.trim()===``,children:`Continue`})]}),e!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(u,{error:e})})]})}function b({request:t,sessionDays:n,onDecided:r}){let i=m(),[a,o]=(0,g.useState)(null),[c,h]=(0,g.useState)(null);async function v(e){o(e?`approve`:`deny`);try{await i.deviceLogins.decide(t.userCode,e),r(e?`approved`:`denied`)}catch(e){h(f(e)===404?`That code is unknown, already used, or expired. Run coffre login again.`:f(e)===void 0?`The decision could not be sent. Nothing was approved.`:p(e))}finally{o(null)}}return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Approve this terminal?`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Only if you just ran `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself and it shows this code. It gets your access, in your name, for `,n,` days or until you end it from your account page.`]})]}),(0,_.jsx)(`p`,{className:`device-code`,"aria-label":`Code`,children:t.userCode}),(0,_.jsxs)(`dl`,{className:`facts device-facts`,children:[(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Client`}),(0,_.jsx)(`dd`,{children:(0,_.jsxs)(`span`,{className:`cell-account`,children:[(0,_.jsx)(e,{size:14}),t.clientLabel??`coffre CLI`]})})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested from`}),(0,_.jsx)(`dd`,{className:`mono`,children:t.clientIp??`an unknown address`})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested (UTC)`}),(0,_.jsx)(`dd`,{children:(0,_.jsx)(d,{iso:t.createdAt})})]})]}),c!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(u,{error:c})}),(0,_.jsxs)(`div`,{className:`device-actions`,children:[(0,_.jsx)(s,{className:`btn btn-quiet`,to:`/projects`,children:`Cancel`}),(0,_.jsxs)(`button`,{className:`btn`,disabled:a!==null,onClick:()=>void v(!1),children:[a===`deny`&&(0,_.jsx)(l,{}),`Deny`]}),(0,_.jsxs)(`button`,{className:`btn btn-primary`,disabled:a!==null,onClick:()=>void v(!0),children:[a===`approve`&&(0,_.jsx)(l,{}),`Approve`]})]})]})}export{v as component};
1
+ import{J as e,Ot as t,Tt as n,W as r,ct as i,d as a,n as o}from"./page-DbSS7pYH.js";import{D as s,O as c,l,o as u,u as d}from"./preload-helper-DduCCcmc.js";import{i as f,n as p,s as m}from"./coffre-BBp7cKVa.js";import{t as h}from"./auth.device-DYOONgFF.js";var g=t(n()),_=i();function v(){let e=h.useLoaderData(),[t,n]=(0,g.useState)(null);return t===`approved`?(0,_.jsx)(o,{icon:(0,_.jsx)(a,{size:18}),label:`coffre CLI`,title:`Your terminal is signed in`,children:(0,_.jsx)(`p`,{children:`You can close this tab and go back to the terminal.`})}):t===`denied`?(0,_.jsx)(o,{icon:(0,_.jsx)(r,{size:18}),label:`coffre CLI`,title:`Sign-in refused`,children:(0,_.jsxs)(`p`,{children:[`The terminal that asked gets nothing. If you did not run `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself, someone may be trying to get you to approve theirs; the refusal is in the audit log.`]})}):e===null?(0,_.jsx)(y,{}):e.ok?e.request===null?(0,_.jsx)(y,{error:`That code is unknown, already used, or expired. Run coffre login again for a new one.`}):(0,_.jsx)(b,{request:e.request,sessionDays:e.sessionDays,onDecided:n}):(0,_.jsx)(y,{error:e.error})}function y({error:e=null}){let t=c(),[n,r]=(0,g.useState)(``);return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Sign in the coffre CLI`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Enter the code your terminal shows after `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),`.`]})]}),(0,_.jsxs)(`form`,{className:`signin-form`,onSubmit:e=>{e.preventDefault(),t({to:`/auth/device`,search:{code:n.trim()}})},children:[(0,_.jsxs)(`label`,{className:`field`,children:[(0,_.jsx)(`span`,{className:`label`,children:`Code`}),(0,_.jsx)(`input`,{className:`input mono device-code-input`,name:`code`,autoComplete:`off`,autoCapitalize:`characters`,spellCheck:!1,placeholder:`XXXX-XXXX`,maxLength:16,value:n,onChange:e=>r(e.target.value)})]}),(0,_.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,style:{height:`2.125rem`},disabled:n.trim()===``,children:`Continue`})]}),e!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(u,{error:e})})]})}function b({request:t,sessionDays:n,onDecided:r}){let i=m(),[a,o]=(0,g.useState)(null),[c,h]=(0,g.useState)(null);async function v(e){o(e?`approve`:`deny`);try{await i.deviceLogins.decide(t.userCode,e),r(e?`approved`:`denied`)}catch(e){h(f(e)===404?`That code is unknown, already used, or expired. Run coffre login again.`:f(e)===void 0?`The decision could not be sent. Nothing was approved.`:p(e))}finally{o(null)}}return(0,_.jsxs)(`section`,{className:`card signin`,"aria-labelledby":`device-title`,children:[(0,_.jsxs)(`div`,{className:`signin-head`,children:[(0,_.jsx)(`h1`,{className:`signin-title`,id:`device-title`,children:`Approve this terminal?`}),(0,_.jsxs)(`p`,{className:`signin-lede`,children:[`Only if you just ran `,(0,_.jsx)(`span`,{className:`mono`,children:`coffre login`}),` yourself and it shows this code. It gets your access, in your name, for `,n,` days or until you end it from your account page.`]})]}),(0,_.jsx)(`p`,{className:`device-code`,"aria-label":`Code`,children:t.userCode}),(0,_.jsxs)(`dl`,{className:`facts device-facts`,children:[(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Client`}),(0,_.jsx)(`dd`,{children:(0,_.jsxs)(`span`,{className:`cell-account`,children:[(0,_.jsx)(e,{size:14}),t.clientLabel??`coffre CLI`]})})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested from`}),(0,_.jsx)(`dd`,{className:`mono`,children:t.clientIp??`an unknown address`})]}),(0,_.jsxs)(`div`,{className:`fact`,children:[(0,_.jsx)(`dt`,{children:`Requested (UTC)`}),(0,_.jsx)(`dd`,{children:(0,_.jsx)(d,{iso:t.createdAt})})]})]}),c!==null&&(0,_.jsx)(`div`,{className:`signin-error`,children:(0,_.jsx)(u,{error:c})}),(0,_.jsxs)(`div`,{className:`device-actions`,children:[(0,_.jsx)(s,{className:`btn btn-quiet`,to:`/projects`,children:`Cancel`}),(0,_.jsxs)(`button`,{className:`btn`,disabled:a!==null,onClick:()=>void v(!1),children:[a===`deny`&&(0,_.jsx)(l,{}),`Deny`]}),(0,_.jsxs)(`button`,{className:`btn btn-primary`,disabled:a!==null,onClick:()=>void v(!0),children:[a===`approve`&&(0,_.jsx)(l,{}),`Approve`]})]})]})}export{v as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/auth.device--rDR2F8w.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-CXkp3Efg.js";var i=e(`/auth/device`)({validateSearch:e=>{let t=e.code;return typeof t==`string`&&t.length<=16?{code:t}:{}},loaderDeps:({search:e})=>({code:e.code}),loader:async({context:{client:e},deps:t,parentMatchPromise:n})=>{if(t.code===void 0)return null;if(!(await n).loaderData?.auth.signin)return{ok:!1,error:`This instance has no CLI sign-in.`};let i=t.code;return r(()=>e.deviceLogins.get(i))},component:n(()=>t(()=>import(`./auth.device--rDR2F8w.js`),__vite__mapDeps([0,1,2,3])),`component`)});export{i as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/auth.device-BP5FY0K1.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-BBp7cKVa.js";var i=e(`/auth/device`)({validateSearch:e=>{let t=e.code;return typeof t==`string`&&t.length<=16?{code:t}:{}},loaderDeps:({search:e})=>({code:e.code}),loader:async({context:{client:e},deps:t,parentMatchPromise:n})=>{if(t.code===void 0)return null;if(!(await n).loaderData?.auth.signin)return{ok:!1,error:`This instance has no CLI sign-in.`};let i=t.code;return r(()=>e.deviceLogins.get(i))},component:n(()=>t(()=>import(`./auth.device-BP5FY0K1.js`),__vite__mapDeps([0,1,2,3])),`component`)});export{i as t};
@@ -1 +1 @@
1
- import{ot as e}from"./page-DbSS7pYH.js";function t(e){return Object.fromEntries(e.fields.map(e=>[e.name,e.type===`text`?``:e.initial]))}function n(e,t){if(e.type===`options`||e.when===void 0)return!0;let n=t[e.when.field],r=Array.isArray(n)?n:[];return r.length===e.when.is.length&&e.when.is.every(e=>r.includes(e))}function r(e,t){for(let r of e.fields){if(!n(r,t))continue;let e=t[r.name];if((typeof e==`string`?e.trim()===``:(e??[]).length===0)&&(r.type===`options`||r.optional!==!0))return r.label}return null}function i(e,t){let r={};for(let i of e.fields){if(!n(i,t))continue;let e=t[i.name];if(i.type===`options`){let t=Array.isArray(e)?e:[];r[i.name]=i.multiple?t:t[0]}else{let t=typeof e==`string`?e.trim():``;t!==``&&(r[i.name]=t)}}return r}var a=Symbol.for(`@coffre/client:CoffreError`),o=class extends Error{static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&a in e}[a]=!0;status;code;reason;constructor(e,t,n,r){super(n),this.name=`CoffreError`,this.status=e,this.code=t,this.reason=r}};function s(e){let[t=``,n=``,r=``]=e.replace(/^\/+|\/+$/g,``).split(`/`);return{project:t,environment:n,key:r}}function c(e){let t=e.url.replace(/\/+$/,``),n=e.transport??(e=>fetch(e));async function r(r,i,a){let s=new URL(`${t}/api${i}`),c=new Headers(await e.headers?.()),l;if(r===`GET`)for(let[e,t]of Object.entries(a??{}))t!=null&&s.searchParams.set(e,String(t));else a!==void 0&&(c.set(`content-type`,`application/json`),l=JSON.stringify(a));let u=await n(new Request(s,{method:r,headers:c,body:l})),d=await u.json().catch(()=>null);if(!u.ok){let e=d;throw new o(u.status,typeof e?.error==`string`?e.error:`http_error`,typeof e?.message==`string`?e.message:`request failed with status ${u.status}`,typeof e?.reason==`string`?e.reason:void 0)}return d}function i(e,t){let[n,r]=e.split(` `);return[n,r.replace(/:(\w+)/g,(e,n)=>encodeURIComponent(t[n]))]}async function a(e,...[t,n]){let[a,o]=i(e,t);return await r(a,o,n)}return{call:a,auth:()=>r(`GET`,`/auth`,void 0),me:()=>a(`GET /me`,{}),projects:{list:()=>a(`GET /projects`,{}),create:(e,t)=>a(`PUT /projects/:project`,{project:e},t),update:(e,t)=>a(`PATCH /projects/:project`,{project:e},t)},environments:{create:(e,t)=>a(`PUT /projects/:project/:environment`,s(e),t),update:(e,t)=>a(`PATCH /projects/:project/:environment`,s(e),t)},secrets:{list:e=>a(`GET /secrets/:project/:environment`,s(e)),reveal:e=>a(`POST /reveals`,{},{path:e}),set:(e,t)=>a(`PATCH /secrets/:project/:environment`,s(e),t),dryRun:(e,t)=>{let[n,a]=i(`PATCH /secrets/:project/:environment`,s(e));return r(n,`${a}?dryRun=1`,t)},history:e=>a(`GET /secrets/:project/:environment/:key/versions`,s(e)),restore:(e,t)=>a(`POST /secrets/:project/:environment/:key/restore`,s(e),{version:t}),rename:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,s(e),{key:t}),update:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,s(e),t)},members:{list:e=>a(`GET /members`,{},{path:e}),get:e=>a(`GET /members/:member`,{member:e}),add:(e,t={})=>a(`PUT /members/:member`,{member:e},t),remove:e=>a(`DELETE /members/:member`,{member:e})},tokens:{list:e=>a(`GET /members/:member/tokens`,{member:e}),issue:(e,t)=>a(`POST /members/:member/tokens`,{member:e},t),revoke:(e,t)=>a(`DELETE /members/:member/tokens/:id`,{member:e,id:t})},access:{set:(e,t)=>a(`PATCH /access/:member`,{member:e},t)},sessions:{list:()=>a(`GET /sessions`,{}),revoke:e=>a(`DELETE /sessions/:id`,{id:e})},identities:{list:()=>a(`GET /identities`,{}),unlink:e=>a(`DELETE /identities/:id`,{id:e})},deviceLogins:{get:e=>a(`GET /device-logins/:code`,{code:e}),decide:(e,t)=>a(`POST /device-logins/:code`,{code:e},{approve:t})},syncs:{providers:()=>a(`GET /syncs/providers`,{}),list:e=>a(`GET /syncs/:project/:environment`,s(e)),add:(e,t)=>a(`POST /syncs/:project/:environment`,s(e),t),update:(e,t)=>a(`PATCH /syncs/by-id/:id`,{id:e},t),remove:e=>a(`DELETE /syncs/by-id/:id`,{id:e}),run:e=>a(`POST /syncs/by-id/:id/runs`,{id:e})},audit:{list:(e={})=>a(`GET /audit`,{},e),verify:()=>a(`GET /audit/verification`,{}),keys:()=>a(`GET /audit/keys`,{})}}}async function l(e,t,n){let r=Object.create(null);for(let{key:e,value:t}of n)r[e]=t;let[i,a]=await Promise.allSettled([e.secrets.list(t),e.secrets.dryRun(t,{...r})]);if(i.status===`rejected`)throw i.reason;if(a.status===`rejected`)throw a.reason;let[{keys:o},s]=[i.value,a.value],c=new Map(o.map(e=>[e.key,e.version])),l=[],u=Object.create(null);for(let[e,t]of Object.entries(r)){let n=s.keys[e];l.push({key:e,action:n,version:c.get(e)??null}),n!==`unchanged`&&(u[e]=t)}return{plan:l,changes:{...u}}}function u(){return e().options.context.client}var d=class extends Error{};function f(e){return e instanceof o?e.status:void 0}function p(e){return e instanceof d?e.message:e instanceof o?e.status===401?`Your session has ended. Sign in again, then retry.`:e.code===`cross_origin`?`coffre refused a change that did not come from this page. Reload, then retry.`:e.status===403?`You hold no grant that covers this. Someone with grant.manage on the project can add one.`:e.status===404?`Not found. It may have been renamed or archived.`:e.status===400||e.status===409?e.message:`coffre is unavailable. Nothing was read or written.`:`The request could not be sent. Nothing was changed.`}function m(e){return{ok:!1,error:p(e)}}async function h(e){try{return{ok:!0,...await e()}}catch(e){return m(e)}}function g(e,t){return`${e===`user`?`user`:`token`}:${t}`}export{m as a,o as c,r as d,t as f,f as i,i as l,l as m,p as n,h as o,n as p,g as r,u as s,d as t,c as u};
1
+ import{ot as e}from"./page-DbSS7pYH.js";function t(e){return Object.fromEntries(e.fields.map(e=>[e.name,e.type===`text`?``:e.initial]))}function n(e,t){if(e.type===`options`||e.when===void 0)return!0;let n=t[e.when.field],r=Array.isArray(n)?n:[];return r.length===e.when.is.length&&e.when.is.every(e=>r.includes(e))}function r(e,t){for(let r of e.fields){if(!n(r,t))continue;let e=t[r.name];if((typeof e==`string`?e.trim()===``:(e??[]).length===0)&&(r.type===`options`||r.optional!==!0))return r.label}return null}function i(e,t){let r={};for(let i of e.fields){if(!n(i,t))continue;let e=t[i.name];if(i.type===`options`){let t=Array.isArray(e)?e:[];r[i.name]=i.multiple?t:t[0]}else{let t=typeof e==`string`?e.trim():``;t!==``&&(r[i.name]=t)}}return r}var a=Symbol.for(`@coffre/client:CoffreError`),o=class extends Error{static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&a in e}[a]=!0;status;code;reason;constructor(e,t,n,r){super(n),this.name=`CoffreError`,this.status=e,this.code=t,this.reason=r}};function s(e){let[t=``,n=``,r=``]=e.replace(/^\/+|\/+$/g,``).split(`/`);return{project:t,environment:n,key:r}}function c(e){let t=e.url.replace(/\/+$/,``),n=e.transport??(e=>fetch(e));async function r(r,i,a){let s=new URL(`${t}/api${i}`),c=new Headers(await e.headers?.()),l;if(r===`GET`)for(let[e,t]of Object.entries(a??{}))t!=null&&s.searchParams.set(e,String(t));else a!==void 0&&(c.set(`content-type`,`application/json`),l=JSON.stringify(a));let u=await n(new Request(s,{method:r,headers:c,body:l})),d=await u.json().catch(()=>null);if(!u.ok){let e=d;throw new o(u.status,typeof e?.error==`string`?e.error:`http_error`,typeof e?.message==`string`?e.message:`request failed with status ${u.status}`,typeof e?.reason==`string`?e.reason:void 0)}return d}function i(e,t){let[n,r]=e.split(` `);return[n,r.replace(/:(\w+)/g,(e,n)=>encodeURIComponent(t[n]))]}async function a(e,...[t,n]){let[a,o]=i(e,t);return await r(a,o,n)}return{call:a,auth:()=>r(`GET`,`/auth`,void 0),me:()=>a(`GET /me`,{}),projects:{list:()=>a(`GET /projects`,{}),create:(e,t)=>a(`PUT /projects/:project`,{project:e},t),update:(e,t)=>a(`PATCH /projects/:project`,{project:e},t)},environments:{create:(e,t)=>a(`PUT /projects/:project/:environment`,s(e),t),update:(e,t)=>a(`PATCH /projects/:project/:environment`,s(e),t)},secrets:{list:e=>a(`GET /secrets/:project/:environment`,s(e)),reveal:e=>a(`POST /reveals`,{},{path:e}),set:(e,t)=>a(`PATCH /secrets/:project/:environment`,s(e),t),dryRun:(e,t)=>{let[n,a]=i(`PATCH /secrets/:project/:environment`,s(e));return r(n,`${a}?dryRun=1`,t)},history:e=>a(`GET /secrets/:project/:environment/:key/versions`,s(e)),restore:(e,t)=>a(`POST /secrets/:project/:environment/:key/restore`,s(e),{version:t}),rename:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,s(e),{key:t}),update:(e,t)=>a(`PATCH /secrets/:project/:environment/:key`,s(e),t)},members:{list:e=>a(`GET /members`,{},{path:e}),get:e=>a(`GET /members/:member`,{member:e}),add:(e,t={})=>a(`PUT /members/:member`,{member:e},t),remove:e=>a(`DELETE /members/:member`,{member:e})},tokens:{list:e=>a(`GET /members/:member/tokens`,{member:e}),issue:(e,t)=>a(`POST /members/:member/tokens`,{member:e},t),revoke:(e,t)=>a(`DELETE /members/:member/tokens/:id`,{member:e,id:t})},access:{set:(e,t)=>a(`PATCH /access/:member`,{member:e},t)},sessions:{list:()=>a(`GET /sessions`,{}),revoke:e=>a(`DELETE /sessions/:id`,{id:e})},identities:{list:()=>a(`GET /identities`,{}),unlink:e=>a(`DELETE /identities/:id`,{id:e})},deviceLogins:{get:e=>a(`GET /device-logins/:code`,{code:e}),decide:(e,t)=>a(`POST /device-logins/:code`,{code:e},{approve:t})},syncs:{providers:()=>a(`GET /syncs/providers`,{}),list:e=>a(`GET /syncs/:project/:environment`,s(e)),add:(e,t)=>a(`POST /syncs/:project/:environment`,s(e),t),update:(e,t)=>a(`PATCH /syncs/by-id/:id`,{id:e},t),remove:e=>a(`DELETE /syncs/by-id/:id`,{id:e}),run:e=>a(`POST /syncs/by-id/:id/runs`,{id:e})},audit:{list:(e={})=>a(`GET /audit`,{},e),verify:()=>a(`GET /audit/verification`,{}),keys:()=>a(`GET /audit/keys`,{})}}}async function l(e,t,n){let r=Object.create(null);for(let{key:e,value:t}of n)r[e]=t;let[i,a]=await Promise.allSettled([e.secrets.list(t),e.secrets.dryRun(t,{...r})]);if(i.status===`rejected`)throw i.reason;if(a.status===`rejected`)throw a.reason;let[{keys:o},s]=[i.value,a.value],c=new Map(o.map(e=>[e.key,e.version])),l=[],u=Object.create(null);for(let[e,t]of Object.entries(r)){let n=s.keys[e];l.push({key:e,action:n,version:c.get(e)??null}),n!==`unchanged`&&(u[e]=t)}return{plan:l,changes:{...u}}}function u(){return e().options.context.client}var d=class extends Error{};function f(e){return e instanceof o?e.status:void 0}function p(e){return e instanceof d?e.message:e instanceof o?e.status===401?`Your session has ended. Sign in again, then retry.`:e.code===`cross_origin`?`coffre refused a change that did not come from this page. Reload, then retry.`:e.status===403?`You hold no grant that covers this. Someone with grant.manage on the project can add one.`:e.status===404?`Not found. It may have been renamed or archived.`:e.status===400||e.status===409?e.message:`coffre is unavailable. Nothing was read or written.`:`The request could not be sent. Nothing was changed.`}function m(e){return{ok:!1,error:p(e),signedOut:f(e)===401}}async function h(e){try{return{ok:!0,...await e()}}catch(e){return m(e)}}function g(e,t){return`${e===`user`?`user`:`token`}:${t}`}export{m as a,o as c,r as d,t as f,f as i,i as l,l as m,p as n,h as o,n as p,g as r,u as s,d as t,c as u};
@@ -1 +1 @@
1
- import{$ as e,C as t,D as n,F as r,H as i,L as a,M as o,Ot as s,Tt as c,X as l,ct as u}from"./page-DbSS7pYH.js";import{D as d,a as f,f as p,g as m,l as h,o as g,r as _,s as v}from"./preload-helper-DduCCcmc.js";import{o as y,r as b,s as x,t as S}from"./coffre-CXkp3Efg.js";import{r as C,t as w}from"./use-action-CUvWPRTx.js";var T=s(c(),1),E=u();function D({type:e,id:n,size:r=`sm`}){return(0,E.jsx)(`span`,{className:`avatar${e===`service`?` avatar-token`:``}${r===`lg`?` avatar-lg`:``}`,"aria-hidden":!0,children:e===`service`?(0,E.jsx)(t,{size:r===`lg`?18:13}):n.slice(0,1)})}function O({type:e,id:t,stretch:n=!1}){let r=`cell-link${n?` stretch`:``}`;return(0,E.jsxs)(`span`,{className:`cell-principal`,children:[(0,E.jsx)(D,{type:e,id:t}),e===`user`?(0,E.jsx)(d,{className:r,to:`/users/$user`,params:{user:t},children:t}):(0,E.jsx)(d,{className:r,to:`/tokens/$token`,params:{token:t},children:t})]})}async function k(e,t){return t?y(async()=>{let{members:t,removed:n}=await e.members.list();return{principals:t.map(({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})=>({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})),removed:n}}):{ok:!1,error:`Only owners can manage users and service accounts.`}}var A={"root-admin":`Root admin`,owner:`Owner`,user:`Member`},j={user:`user`,service:`token`};function M({principalType:e,principals:n,hasRemoved:r=!1}){let a=e===`user`;return(0,E.jsx)(`section`,{className:`card`,"aria-label":a?`Users`:`Tokens`,children:n.length===0?(0,E.jsxs)(f,{title:r?`No active ${j[e]}s`:a?`Nobody is registered`:`No tokens yet`,children:[r?`Add a ${j[e]}`:`Add the first ${j[e]}`,` to let it through the door. Project access is a separate step, granted from each project's page.`]}):(0,E.jsx)(`div`,{className:`dt-wrap`,children:(0,E.jsxs)(`table`,{className:`dt directory directory-${e} stacks`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`n`,children:`#`}),(0,E.jsx)(`th`,{className:`col-principal`,children:(0,E.jsxs)(`span`,{className:`th`,children:[a?(0,E.jsx)(l,{size:14}):(0,E.jsx)(t,{size:14}),a?`Email`:`Name`]})}),a&&(0,E.jsx)(`th`,{className:`col-role`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(i,{size:14}),`Instance role`]})}),(0,E.jsx)(`th`,{className:`col-actions`,children:(0,E.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,E.jsx)(`tbody`,{children:n.map((e,t)=>(0,E.jsxs)(`tr`,{className:`row-link`,children:[(0,E.jsx)(`td`,{className:`n`,children:t+1}),(0,E.jsx)(`td`,{className:`col-lead`,"data-label":e.principalType===`user`?`Email`:`Name`,children:(0,E.jsx)(O,{type:e.principalType,id:e.principalId,stretch:!0})}),a&&(0,E.jsx)(`td`,{className:`col-role`,"data-label":`Instance role`,children:(0,E.jsx)(N,{principal:e})}),(0,E.jsx)(`td`,{className:`col-actions`,children:(0,E.jsx)(P,{principal:e})})]},e.principalId))})]})})})}function N({principal:e}){return e.tampered===!0?(0,E.jsx)(p,{label:(0,E.jsx)(E.Fragment,{children:`Their record was changed outside coffre, so the vault refuses them everything. Remove them to start them over, then add them again.`}),children:(0,E.jsxs)(`button`,{type:`button`,className:`tag tag-red tag-button`,children:[(0,E.jsx)(n,{size:11}),`Integrity check failed`]})}):e.isRootAdmin?(0,E.jsx)(p,{label:(0,E.jsxs)(E.Fragment,{children:[`Set by `,(0,E.jsx)(`code`,{children:`rootAdmins`}),` in the vault's configuration, so it cannot be changed or removed here.`]}),children:(0,E.jsxs)(`button`,{type:`button`,className:`tag tag-violet tag-button`,children:[(0,E.jsx)(n,{size:11}),`Root admin`]})}):(0,E.jsx)(`span`,{className:`tag${e.instanceRole===`user`?``:` tag-violet`}`,children:A[e.instanceRole]})}function P({principal:t,trigger:n=`act act-quiet act-menu`,onRemoved:i}){let[a,s]=(0,T.useState)(!1),[c,l]=(0,T.useState)(!1),[u,d]=(0,T.useState)(t.instanceRole===`owner`?`owner`:`user`),f=x(),{pending:p,error:y,setError:S,run:D}=w(),O=j[t.principalType];return(0,T.useEffect)(()=>{y!==null&&!a&&C.error(y)},[a,y]),t.isRootAdmin?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m.Root,{children:[(0,E.jsx)(m.Trigger,{asChild:!0,children:(0,E.jsx)(`button`,{className:n,"aria-label":`Actions for ${t.principalId}`,disabled:p,children:p?(0,E.jsx)(h,{size:13}):(0,E.jsx)(o,{size:16})})}),(0,E.jsx)(m.Portal,{children:(0,E.jsxs)(m.Content,{className:`menu`,sideOffset:6,align:`end`,children:[t.principalType===`user`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m.Item,{className:`menu-item`,onSelect:()=>{d(t.instanceRole===`owner`?`owner`:`user`),s(!0)},children:[(0,E.jsx)(r,{size:14}),`Change role`]}),(0,E.jsx)(m.Separator,{className:`menu-sep`})]}),(0,E.jsxs)(m.Item,{className:`menu-item menu-item-danger`,onSelect:()=>l(!0),children:[(0,E.jsx)(e,{size:14}),`Remove `,O,`…`]})]})})]}),t.principalType===`user`&&(0,E.jsx)(v,{open:a,onOpenChange:e=>{s(e),e||S(null)},title:(0,E.jsxs)(E.Fragment,{children:[`Role of `,(0,E.jsx)(`span`,{className:`mono`,children:t.principalId})]}),children:(0,E.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),D(()=>f.members.add(b(`user`,t.principalId),{owner:u===`owner`}),()=>{C.success(`${t.principalId} is now ${A[u].toLowerCase()}`),s(!1)})},children:[(0,E.jsx)(I,{value:u,onChange:d}),(0,E.jsx)(g,{error:y}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>s(!1),children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:p,children:[p&&(0,E.jsx)(h,{}),`Save`]})]})]})}),(0,E.jsx)(_,{open:c,onOpenChange:l,title:(0,E.jsxs)(E.Fragment,{children:[`Remove `,(0,E.jsx)(`span`,{className:`mono`,children:t.principalId}),`?`]}),body:t.principalType===`user`?(0,E.jsx)(E.Fragment,{children:`They are signed out everywhere, and their CLI logins, linked sign-in accounts and project permissions are revoked at once. Their past actions stay in the audit log, and their page then lists the values they saw, to rotate.`}):(0,E.jsx)(E.Fragment,{children:`Every token issued to it stops working and its project permissions are revoked at once, including for anything running with it right now. Its past actions stay in the audit log, and its page then lists the values it read, to rotate.`}),confirmLabel:`Remove ${O}`,onConfirm:()=>void D(()=>f.members.remove(b(t.principalType,t.principalId)),async()=>{C.success(`${t.principalId} removed`),await i?.()})})]})}function F({principalType:e}){let[t,n]=(0,T.useState)(!1),[r,i]=(0,T.useState)(``),[o,s]=(0,T.useState)(`user`),c=x(),{pending:l,error:u,setError:d,run:f}=w(),p=j[e];function m(){n(!1),i(``),s(`user`),d(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>n(!0),children:[(0,E.jsx)(a,{size:14}),`Add `,p]}),(0,E.jsx)(v,{open:t,onOpenChange:e=>e?n(!0):m(),title:`Add a ${p}`,description:`This lets the ${p} through the door and nothing more. Grant project access from its page or from each project's.`,children:(0,E.jsxs)(`form`,{className:`form`,onSubmit:t=>{t.preventDefault(),f(async()=>{let t=b(e,r.trim()),{members:n}=await c.members.list();if(n.some(e=>e.member===t))throw new S(`That principal already exists.`);await c.members.add(t,{owner:e===`user`&&o===`owner`})},()=>{C.success(`${r.trim()} added`),m()})},children:[(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:e===`user`?`Cloudflare Access email`:`Service token common name`}),(0,E.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,value:r,placeholder:e===`user`?`someone@acme.example`:`ci-deploy`,onChange:e=>i(e.target.value)})]}),e===`user`&&(0,E.jsx)(I,{value:o,onChange:s}),(0,E.jsx)(g,{error:u}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:m,children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:l||r.trim()===``,children:[l&&(0,E.jsx)(h,{}),`Add `,p]})]})]})})]})}function I({value:e,onChange:t}){return(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Instance role`}),(0,E.jsxs)(`select`,{className:`select`,value:e,onChange:e=>t(e.target.value),children:[(0,E.jsx)(`option`,{value:`user`,children:`Member`}),(0,E.jsx)(`option`,{value:`owner`,children:`Owner`})]}),(0,E.jsx)(`span`,{className:`hint`,children:`Owners manage users and tokens, can create projects, and read the whole audit log. Neither role reads a secret without a project grant.`})]})}export{P as a,O as c,j as i,M as n,k as o,N as r,D as s,F as t};
1
+ import{$ as e,C as t,D as n,F as r,H as i,L as a,M as o,Ot as s,Tt as c,X as l,ct as u}from"./page-DbSS7pYH.js";import{D as d,a as f,f as p,g as m,l as h,o as g,r as _,s as v}from"./preload-helper-DduCCcmc.js";import{o as y,r as b,s as x,t as S}from"./coffre-BBp7cKVa.js";import{r as C,t as w}from"./use-action-l__xZDYY.js";var T=s(c(),1),E=u();function D({type:e,id:n,size:r=`sm`}){return(0,E.jsx)(`span`,{className:`avatar${e===`service`?` avatar-token`:``}${r===`lg`?` avatar-lg`:``}`,"aria-hidden":!0,children:e===`service`?(0,E.jsx)(t,{size:r===`lg`?18:13}):n.slice(0,1)})}function O({type:e,id:t,stretch:n=!1}){let r=`cell-link${n?` stretch`:``}`;return(0,E.jsxs)(`span`,{className:`cell-principal`,children:[(0,E.jsx)(D,{type:e,id:t}),e===`user`?(0,E.jsx)(d,{className:r,to:`/users/$user`,params:{user:t},children:t}):(0,E.jsx)(d,{className:r,to:`/tokens/$token`,params:{token:t},children:t})]})}async function k(e,t){return t?y(async()=>{let{members:t,removed:n}=await e.members.list();return{principals:t.map(({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})=>({principalType:e,principalId:t,instanceRole:n,isRootAdmin:r,tampered:i})),removed:n}}):{ok:!1,error:`Only owners can manage users and service accounts.`}}var A={"root-admin":`Root admin`,owner:`Owner`,user:`Member`},j={user:`user`,service:`token`};function M({principalType:e,principals:n,hasRemoved:r=!1}){let a=e===`user`;return(0,E.jsx)(`section`,{className:`card`,"aria-label":a?`Users`:`Tokens`,children:n.length===0?(0,E.jsxs)(f,{title:r?`No active ${j[e]}s`:a?`Nobody is registered`:`No tokens yet`,children:[r?`Add a ${j[e]}`:`Add the first ${j[e]}`,` to let it through the door. Project access is a separate step, granted from each project's page.`]}):(0,E.jsx)(`div`,{className:`dt-wrap`,children:(0,E.jsxs)(`table`,{className:`dt directory directory-${e} stacks`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`n`,children:`#`}),(0,E.jsx)(`th`,{className:`col-principal`,children:(0,E.jsxs)(`span`,{className:`th`,children:[a?(0,E.jsx)(l,{size:14}):(0,E.jsx)(t,{size:14}),a?`Email`:`Name`]})}),a&&(0,E.jsx)(`th`,{className:`col-role`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(i,{size:14}),`Instance role`]})}),(0,E.jsx)(`th`,{className:`col-actions`,children:(0,E.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,E.jsx)(`tbody`,{children:n.map((e,t)=>(0,E.jsxs)(`tr`,{className:`row-link`,children:[(0,E.jsx)(`td`,{className:`n`,children:t+1}),(0,E.jsx)(`td`,{className:`col-lead`,"data-label":e.principalType===`user`?`Email`:`Name`,children:(0,E.jsx)(O,{type:e.principalType,id:e.principalId,stretch:!0})}),a&&(0,E.jsx)(`td`,{className:`col-role`,"data-label":`Instance role`,children:(0,E.jsx)(N,{principal:e})}),(0,E.jsx)(`td`,{className:`col-actions`,children:(0,E.jsx)(P,{principal:e})})]},e.principalId))})]})})})}function N({principal:e}){return e.tampered===!0?(0,E.jsx)(p,{label:(0,E.jsx)(E.Fragment,{children:`Their record was changed outside coffre, so the vault refuses them everything. Remove them to start them over, then add them again.`}),children:(0,E.jsxs)(`button`,{type:`button`,className:`tag tag-red tag-button`,children:[(0,E.jsx)(n,{size:11}),`Integrity check failed`]})}):e.isRootAdmin?(0,E.jsx)(p,{label:(0,E.jsxs)(E.Fragment,{children:[`Set by `,(0,E.jsx)(`code`,{children:`rootAdmins`}),` in the vault's configuration, so it cannot be changed or removed here.`]}),children:(0,E.jsxs)(`button`,{type:`button`,className:`tag tag-violet tag-button`,children:[(0,E.jsx)(n,{size:11}),`Root admin`]})}):(0,E.jsx)(`span`,{className:`tag${e.instanceRole===`user`?``:` tag-violet`}`,children:A[e.instanceRole]})}function P({principal:t,trigger:n=`act act-quiet act-menu`,onRemoved:i}){let[a,s]=(0,T.useState)(!1),[c,l]=(0,T.useState)(!1),[u,d]=(0,T.useState)(t.instanceRole===`owner`?`owner`:`user`),f=x(),{pending:p,error:y,setError:S,run:D}=w(),O=j[t.principalType];return(0,T.useEffect)(()=>{y!==null&&!a&&C.error(y)},[a,y]),t.isRootAdmin?null:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m.Root,{children:[(0,E.jsx)(m.Trigger,{asChild:!0,children:(0,E.jsx)(`button`,{className:n,"aria-label":`Actions for ${t.principalId}`,disabled:p,children:p?(0,E.jsx)(h,{size:13}):(0,E.jsx)(o,{size:16})})}),(0,E.jsx)(m.Portal,{children:(0,E.jsxs)(m.Content,{className:`menu`,sideOffset:6,align:`end`,children:[t.principalType===`user`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m.Item,{className:`menu-item`,onSelect:()=>{d(t.instanceRole===`owner`?`owner`:`user`),s(!0)},children:[(0,E.jsx)(r,{size:14}),`Change role`]}),(0,E.jsx)(m.Separator,{className:`menu-sep`})]}),(0,E.jsxs)(m.Item,{className:`menu-item menu-item-danger`,onSelect:()=>l(!0),children:[(0,E.jsx)(e,{size:14}),`Remove `,O,`…`]})]})})]}),t.principalType===`user`&&(0,E.jsx)(v,{open:a,onOpenChange:e=>{s(e),e||S(null)},title:(0,E.jsxs)(E.Fragment,{children:[`Role of `,(0,E.jsx)(`span`,{className:`mono`,children:t.principalId})]}),children:(0,E.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),D(()=>f.members.add(b(`user`,t.principalId),{owner:u===`owner`}),()=>{C.success(`${t.principalId} is now ${A[u].toLowerCase()}`),s(!1)})},children:[(0,E.jsx)(I,{value:u,onChange:d}),(0,E.jsx)(g,{error:y}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>s(!1),children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:p,children:[p&&(0,E.jsx)(h,{}),`Save`]})]})]})}),(0,E.jsx)(_,{open:c,onOpenChange:l,title:(0,E.jsxs)(E.Fragment,{children:[`Remove `,(0,E.jsx)(`span`,{className:`mono`,children:t.principalId}),`?`]}),body:t.principalType===`user`?(0,E.jsx)(E.Fragment,{children:`They are signed out everywhere, and their CLI logins, linked sign-in accounts and project permissions are revoked at once. Their past actions stay in the audit log, and their page then lists the values they saw, to rotate.`}):(0,E.jsx)(E.Fragment,{children:`Every token issued to it stops working and its project permissions are revoked at once, including for anything running with it right now. Its past actions stay in the audit log, and its page then lists the values it read, to rotate.`}),confirmLabel:`Remove ${O}`,onConfirm:()=>void D(()=>f.members.remove(b(t.principalType,t.principalId)),async()=>{C.success(`${t.principalId} removed`),await i?.()})})]})}function F({principalType:e}){let[t,n]=(0,T.useState)(!1),[r,i]=(0,T.useState)(``),[o,s]=(0,T.useState)(`user`),c=x(),{pending:l,error:u,setError:d,run:f}=w(),p=j[e];function m(){n(!1),i(``),s(`user`),d(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>n(!0),children:[(0,E.jsx)(a,{size:14}),`Add `,p]}),(0,E.jsx)(v,{open:t,onOpenChange:e=>e?n(!0):m(),title:`Add a ${p}`,description:`This lets the ${p} through the door and nothing more. Grant project access from its page or from each project's.`,children:(0,E.jsxs)(`form`,{className:`form`,onSubmit:t=>{t.preventDefault(),f(async()=>{let t=b(e,r.trim()),{members:n}=await c.members.list();if(n.some(e=>e.member===t))throw new S(`That principal already exists.`);await c.members.add(t,{owner:e===`user`&&o===`owner`})},()=>{C.success(`${r.trim()} added`),m()})},children:[(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:e===`user`?`Cloudflare Access email`:`Service token common name`}),(0,E.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,value:r,placeholder:e===`user`?`someone@acme.example`:`ci-deploy`,onChange:e=>i(e.target.value)})]}),e===`user`&&(0,E.jsx)(I,{value:o,onChange:s}),(0,E.jsx)(g,{error:u}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:m,children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:l||r.trim()===``,children:[l&&(0,E.jsx)(h,{}),`Add `,p]})]})]})})]})}function I({value:e,onChange:t}){return(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Instance role`}),(0,E.jsxs)(`select`,{className:`select`,value:e,onChange:e=>t(e.target.value),children:[(0,E.jsx)(`option`,{value:`user`,children:`Member`}),(0,E.jsx)(`option`,{value:`owner`,children:`Owner`})]}),(0,E.jsx)(`span`,{className:`hint`,children:`Owners manage users and tokens, can create projects, and read the whole audit log. Neither role reads a secret without a project grant.`})]})}export{P as a,O as c,j as i,M as n,k as o,N as r,D as s,F as t};
@@ -1 +1 @@
1
- import{H as e,ct as t,m as n}from"./page-DbSS7pYH.js";import{l as r,n as i,o as a}from"./preload-helper-DduCCcmc.js";import{a as o,n as s,r as c,s as l}from"./coffre-CXkp3Efg.js";import{r as u,t as d}from"./use-action-CUvWPRTx.js";var f={owner:`Owner`,viewer:`Read`,developer:`Write`};function p(e){let t=[{value:`owner:`,role:`owner`,environmentSlug:null,label:`Owner`}];for(let e of[`viewer`,`developer`])t.push({value:`${e}:`,role:e,environmentSlug:null,label:`${f[e]}: all`});for(let n of e)if(!(n.details===null||n.details.archivedAt!==null))for(let e of[`viewer`,`developer`])t.push({value:`${e}:${n.slug}`,role:e,environmentSlug:n.slug,label:`${f[e]}: ${n.slug}`});return t}function m(e){let[t,n=``]=e.split(`:`,2);if(t!==`owner`&&t!==`viewer`&&t!==`developer`)throw Error(`unknown project access level`);return{role:t,environmentSlug:n||null}}function h(e){let t=e.environmentSlug===null?`all environments`:e.environmentSlug;return e.role===`owner`?`Owner`:e.role===`viewer`?e.environmentSlug===null?`Read: all`:`Read: ${t}`:e.role===`developer`?e.environmentSlug===null?`Write: all`:`Write: ${t}`:`${e.roleName}: ${t}`}var g=t();async function _(e,t){let n;try{n=(await e.projects.list()).projects.find(e=>e.slug===t)}catch(e){return o(e)}if(n===void 0)return{ok:!1,error:null};if(!n.permissions.includes(`grant.manage`))return{ok:!0,project:n,grants:[],grantsError:null};try{let{members:r}=await e.members.list(t),i=r.flatMap(e=>e.grants.map(t=>({id:t.id,principalType:e.principalType,principalId:e.principalId,role:t.role,roleName:t.roleName,permissions:t.permissions,scope:t.environment===null?`project`:`environment`,environmentSlug:t.environment,expiresAt:t.expiresAt})));return{ok:!0,project:n,grants:i,grantsError:null}}catch(e){return{ok:!0,project:n,grants:[],grantsError:s(e)}}}function v(e,t){return t===null?e:`${e}/${t}`}async function y(e,t){let n=v(t.project,t.environmentSlug),r=t.role,{changes:i}=await e.access.set(c(t.principalType,t.principalId),{[n]:t.expiresAt===null?r:{role:r,until:t.expiresAt}});return{existed:i[n]===`unchanged`}}function b({lead:t,children:r}){return(0,g.jsx)(`div`,{className:`dt-wrap`,children:(0,g.jsxs)(`table`,{className:`dt grants stacks`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`n`,children:`#`}),(0,g.jsx)(`th`,{className:`col-principal`,children:t}),(0,g.jsx)(`th`,{children:(0,g.jsxs)(`span`,{className:`th`,children:[(0,g.jsx)(e,{size:14}),`Permissions`]})}),(0,g.jsx)(`th`,{className:`col-expires`,children:(0,g.jsxs)(`span`,{className:`th`,children:[(0,g.jsx)(n,{size:14}),`Expires`]})}),(0,g.jsx)(`th`,{className:`col-actions`,children:(0,g.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,g.jsx)(`tbody`,{children:r})]})})}function x({number:e,project:t,grant:n,lead:o,leadLabel:s}){let f=l(),{pending:p,error:m,run:_}=d(),y=h(n),b=n.expiresAt!==null&&new Date(n.expiresAt).getTime()<Date.now();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`n`,children:e}),(0,g.jsx)(`td`,{className:`col-lead`,"data-label":s,children:o}),(0,g.jsx)(`td`,{className:`col-access`,"data-label":`Permissions`,children:(0,g.jsx)(`span`,{className:`tag${n.role===`owner`?` tag-violet`:``}`,children:y})}),(0,g.jsx)(`td`,{className:`col-expires cell-mono cell-muted${n.expiresAt===null?` is-never`:``}`,"data-label":`Expires`,children:n.expiresAt===null?`never`:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`narrow-only`,children:`expires `}),n.expiresAt.slice(0,10),b&&(0,g.jsxs)(g.Fragment,{children:[` `,(0,g.jsx)(`span`,{className:`tag tag-red`,children:`expired`})]})]})}),(0,g.jsx)(`td`,{className:`col-actions`,children:(0,g.jsx)(i,{trigger:(0,g.jsxs)(`button`,{className:`act act-danger`,disabled:p,children:[p&&(0,g.jsx)(r,{size:13}),`Revoke`]}),title:(0,g.jsxs)(g.Fragment,{children:[`Revoke `,y,` from `,(0,g.jsx)(`span`,{className:`mono`,children:n.principalId}),`?`]}),body:(0,g.jsxs)(g.Fragment,{children:[`They lose `,(0,g.jsx)(`strong`,{children:y}),` on `,(0,g.jsx)(`span`,{className:`mono`,children:t}),` `,`immediately, including any process using it right now. Other grants they hold still apply.`]}),confirmLabel:`Revoke access`,onConfirm:()=>_(()=>f.access.set(c(n.principalType,n.principalId),{[v(t,n.environmentSlug)]:null}),()=>u.success(`Revoked ${y} on ${t} from ${n.principalId}`))})})]}),m!==null&&(0,g.jsx)(`tr`,{className:`row-error`,children:(0,g.jsx)(`td`,{colSpan:5,children:(0,g.jsx)(a,{error:m})})})]})}export{m as a,_ as i,b as n,h as o,y as r,p as s,x as t};
1
+ import{H as e,ct as t,m as n}from"./page-DbSS7pYH.js";import{l as r,n as i,o as a}from"./preload-helper-DduCCcmc.js";import{a as o,n as s,r as c,s as l}from"./coffre-BBp7cKVa.js";import{r as u,t as d}from"./use-action-l__xZDYY.js";var f={owner:`Owner`,viewer:`Read`,developer:`Write`};function p(e){let t=[{value:`owner:`,role:`owner`,environmentSlug:null,label:`Owner`}];for(let e of[`viewer`,`developer`])t.push({value:`${e}:`,role:e,environmentSlug:null,label:`${f[e]}: all`});for(let n of e)if(!(n.details===null||n.details.archivedAt!==null))for(let e of[`viewer`,`developer`])t.push({value:`${e}:${n.slug}`,role:e,environmentSlug:n.slug,label:`${f[e]}: ${n.slug}`});return t}function m(e){let[t,n=``]=e.split(`:`,2);if(t!==`owner`&&t!==`viewer`&&t!==`developer`)throw Error(`unknown project access level`);return{role:t,environmentSlug:n||null}}function h(e){let t=e.environmentSlug===null?`all environments`:e.environmentSlug;return e.role===`owner`?`Owner`:e.role===`viewer`?e.environmentSlug===null?`Read: all`:`Read: ${t}`:e.role===`developer`?e.environmentSlug===null?`Write: all`:`Write: ${t}`:`${e.roleName}: ${t}`}var g=t();async function _(e,t){let n;try{n=(await e.projects.list()).projects.find(e=>e.slug===t)}catch(e){return o(e)}if(n===void 0)return{ok:!1,error:null};if(!n.permissions.includes(`grant.manage`))return{ok:!0,project:n,grants:[],grantsError:null};try{let{members:r}=await e.members.list(t),i=r.flatMap(e=>e.grants.map(t=>({id:t.id,principalType:e.principalType,principalId:e.principalId,role:t.role,roleName:t.roleName,permissions:t.permissions,scope:t.environment===null?`project`:`environment`,environmentSlug:t.environment,expiresAt:t.expiresAt})));return{ok:!0,project:n,grants:i,grantsError:null}}catch(e){return{ok:!0,project:n,grants:[],grantsError:s(e)}}}function v(e,t){return t===null?e:`${e}/${t}`}async function y(e,t){let n=v(t.project,t.environmentSlug),r=t.role,{changes:i}=await e.access.set(c(t.principalType,t.principalId),{[n]:t.expiresAt===null?r:{role:r,until:t.expiresAt}});return{existed:i[n]===`unchanged`}}function b({lead:t,children:r}){return(0,g.jsx)(`div`,{className:`dt-wrap`,children:(0,g.jsxs)(`table`,{className:`dt grants stacks`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{className:`n`,children:`#`}),(0,g.jsx)(`th`,{className:`col-principal`,children:t}),(0,g.jsx)(`th`,{children:(0,g.jsxs)(`span`,{className:`th`,children:[(0,g.jsx)(e,{size:14}),`Permissions`]})}),(0,g.jsx)(`th`,{className:`col-expires`,children:(0,g.jsxs)(`span`,{className:`th`,children:[(0,g.jsx)(n,{size:14}),`Expires`]})}),(0,g.jsx)(`th`,{className:`col-actions`,children:(0,g.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,g.jsx)(`tbody`,{children:r})]})})}function x({number:e,project:t,grant:n,lead:o,leadLabel:s}){let f=l(),{pending:p,error:m,run:_}=d(),y=h(n),b=n.expiresAt!==null&&new Date(n.expiresAt).getTime()<Date.now();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{className:`n`,children:e}),(0,g.jsx)(`td`,{className:`col-lead`,"data-label":s,children:o}),(0,g.jsx)(`td`,{className:`col-access`,"data-label":`Permissions`,children:(0,g.jsx)(`span`,{className:`tag${n.role===`owner`?` tag-violet`:``}`,children:y})}),(0,g.jsx)(`td`,{className:`col-expires cell-mono cell-muted${n.expiresAt===null?` is-never`:``}`,"data-label":`Expires`,children:n.expiresAt===null?`never`:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`narrow-only`,children:`expires `}),n.expiresAt.slice(0,10),b&&(0,g.jsxs)(g.Fragment,{children:[` `,(0,g.jsx)(`span`,{className:`tag tag-red`,children:`expired`})]})]})}),(0,g.jsx)(`td`,{className:`col-actions`,children:(0,g.jsx)(i,{trigger:(0,g.jsxs)(`button`,{className:`act act-danger`,disabled:p,children:[p&&(0,g.jsx)(r,{size:13}),`Revoke`]}),title:(0,g.jsxs)(g.Fragment,{children:[`Revoke `,y,` from `,(0,g.jsx)(`span`,{className:`mono`,children:n.principalId}),`?`]}),body:(0,g.jsxs)(g.Fragment,{children:[`They lose `,(0,g.jsx)(`strong`,{children:y}),` on `,(0,g.jsx)(`span`,{className:`mono`,children:t}),` `,`immediately, including any process using it right now. Other grants they hold still apply.`]}),confirmLabel:`Revoke access`,onConfirm:()=>_(()=>f.access.set(c(n.principalType,n.principalId),{[v(t,n.environmentSlug)]:null}),()=>u.success(`Revoked ${y} on ${t} from ${n.principalId}`))})})]}),m!==null&&(0,g.jsx)(`tr`,{className:`row-error`,children:(0,g.jsx)(`td`,{colSpan:5,children:(0,g.jsx)(a,{error:m})})})]})}export{m as a,_ as i,b as n,h as o,y as r,p as s,x as t};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/unregistered-D5go1AfR.js","_coffre/assets/page-DbSS7pYH.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,A as t,B as n,C as r,Ct as i,Et as a,G as o,N as s,O as c,Ot as l,Q as u,St as d,T as f,Tt as p,U as m,V as h,W as g,Z as _,_t as v,a as y,at as b,c as x,ct as S,dt as C,et as ee,ft as te,gt as ne,ht as re,it as w,j as ie,k as ae,lt as oe,mt as se,n as ce,ot as E,p as D,pt as le,rt as ue,st as de,u as fe,ut as pe,v as O,vt as me,w as he,wt as ge,xt as _e,y as ve,yt as ye}from"./page-DbSS7pYH.js";import{A as be,B as xe,C as Se,D as Ce,E as we,F as Te,G as Ee,H as De,I as Oe,J as ke,K as Ae,L as je,M as Me,N as Ne,O as Pe,P as Fe,Q as Ie,R as Le,S as Re,T as ze,U as Be,V as Ve,W as He,X as Ue,Y as We,Z as Ge,_ as Ke,b as qe,d as Je,g as Ye,h as Xe,j as Ze,k as Qe,p as $e,q as et,t as tt,v as nt,w as rt,x as it,y as at,z as ot}from"./preload-helper-DduCCcmc.js";import{c as st,u as ct}from"./coffre-CXkp3Efg.js";import{n as lt}from"./use-action-CUvWPRTx.js";import{a as ut,s as dt,t as ft}from"./affordances-CmoY-8Xf.js";import{n as pt}from"./project-environments-CfIH5kFM.js";import{a as mt,i as ht,o as gt,r as _t,t as vt}from"./account-C3rBPdu6.js";import{t as yt}from"./audit-CdCJ1U8E.js";import{t as bt}from"./login-C-wTm_t1.js";import{t as xt}from"./settings-EimGqlQL.js";import{t as St}from"./auth.device-viDUwZRT.js";import{t as Ct}from"./projects.index-BG8W91BX.js";import{t as wt}from"./tokens.index-CSf5Mlz8.js";import{t as Tt}from"./tokens._token-Df2R8TF_.js";import{t as Et}from"./users.index-BoFWF3mF.js";import{t as Dt}from"./users._user-D0JK911L.js";import{t as Ot}from"./projects._project.index-CWXRo307.js";import{t as kt}from"./projects._project._environment-CLUpTvi-.js";var At=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,w());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,ee=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<ee)}function re(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():S=!1}}}var w;if(typeof y==`function`)w=function(){y(re)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=re,w=function(){ae.postMessage(null)}}else w=function(){_(re,0)};function oe(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,w()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),jt=a(((e,t)=>{t.exports=At()})),Mt=a((e=>{var t=jt(),n=p(),r=Ie();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),w=Symbol.for(`react.memo_cache_sentinel`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case ee:return`SuspenseList`;case re:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case te:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,E=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function fe(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function O(e,t){de++,ue[de]=e.current,e.current=t}var me=fe(null),he=fe(null),ge=fe(null),_e=fe(null);function ve(e,t){switch(O(ge,t),O(he,e),O(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hd(t),e=Ud(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(me),O(me,e)}function ye(){pe(me),pe(he),pe(ge)}function be(e){e.memoizedState!==null&&O(_e,e);var t=me.current,n=Ud(t,e.type);t!==n&&(O(he,e),O(me,n))}function xe(e){he.current===e&&(pe(me),pe(he)),_e.current===e&&(pe(_e),$f._currentValue=le)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
2
+ import{$ as e,A as t,B as n,C as r,Ct as i,Et as a,G as o,N as s,O as c,Ot as l,Q as u,St as d,T as f,Tt as p,U as m,V as h,W as g,Z as _,_t as v,a as y,at as b,c as x,ct as S,dt as C,et as ee,ft as te,gt as ne,ht as re,it as w,j as ie,k as ae,lt as oe,mt as se,n as ce,ot as E,p as D,pt as le,rt as ue,st as de,u as fe,ut as pe,v as O,vt as me,w as he,wt as ge,xt as _e,y as ve,yt as ye}from"./page-DbSS7pYH.js";import{A as be,B as xe,C as Se,D as Ce,E as we,F as Te,G as Ee,H as De,I as Oe,J as ke,K as Ae,L as je,M as Me,N as Ne,O as Pe,P as Fe,Q as Ie,R as Le,S as Re,T as ze,U as Be,V as Ve,W as He,X as Ue,Y as We,Z as Ge,_ as Ke,b as qe,d as Je,g as Ye,h as Xe,j as Ze,k as Qe,p as $e,q as et,t as tt,v as nt,w as rt,x as it,y as at,z as ot}from"./preload-helper-DduCCcmc.js";import{c as st,u as ct}from"./coffre-BBp7cKVa.js";import{n as lt}from"./use-action-l__xZDYY.js";import{a as ut,s as dt,t as ft}from"./affordances-CmoY-8Xf.js";import{n as pt}from"./project-environments-CfIH5kFM.js";import{a as mt,i as ht,o as gt,r as _t,t as vt}from"./account-BkNyIDT7.js";import{t as yt}from"./audit-BvwKYb-5.js";import{t as bt}from"./login-C-wTm_t1.js";import{t as xt}from"./settings-Bkj_E21y.js";import{t as St}from"./auth.device-DYOONgFF.js";import{t as Ct}from"./projects.index-CfOtb1X5.js";import{t as wt}from"./tokens.index-BgAMWkHT.js";import{t as Tt}from"./tokens._token-Dh9jLOkm.js";import{t as Et}from"./users.index-BJoF-L37.js";import{t as Dt}from"./users._user-xJAb3T6Y.js";import{t as Ot}from"./projects._project.index-C_xYOGLT.js";import{t as kt}from"./projects._project._environment-BMeX_B8l.js";var At=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,w());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,ee=5,te=-1;function ne(){return g?!0:!(e.unstable_now()-te<ee)}function re(){if(g=!1,S){var t=e.unstable_now();te=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ne());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():S=!1}}}var w;if(typeof y==`function`)w=function(){y(re)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=re,w=function(){ae.postMessage(null)}}else w=function(){_(re,0)};function oe(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,w()))),r},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),jt=a(((e,t)=>{t.exports=At()})),Mt=a((e=>{var t=jt(),n=p(),r=Ie();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),ee=Symbol.for(`react.suspense_list`),te=Symbol.for(`react.memo`),ne=Symbol.for(`react.lazy`),re=Symbol.for(`react.activity`),w=Symbol.for(`react.memo_cache_sentinel`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case ee:return`SuspenseList`;case re:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case te:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case ne:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,E=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function fe(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function O(e,t){de++,ue[de]=e.current,e.current=t}var me=fe(null),he=fe(null),ge=fe(null),_e=fe(null);function ve(e,t){switch(O(ge,t),O(he,e),O(me,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hd(t),e=Ud(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(me),O(me,e)}function ye(){pe(me),pe(he),pe(ge)}function be(e){e.memoizedState!==null&&O(_e,e);var t=me.current,n=Ud(t,e.type);t!==n&&(O(he,e),O(me,n))}function xe(e){he.current===e&&(pe(me),pe(he)),_e.current===e&&(pe(_e),$f._currentValue=le)}var Se,Ce;function we(e){if(Se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||``,Ce=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -1 +1 @@
1
- import{C as e,X as t,ct as n,f as r,q as i,t as a}from"./page-DbSS7pYH.js";import{D as o,a as s,c,u as l}from"./preload-helper-DduCCcmc.js";import{c as u}from"./directory-PEjdb8PS.js";var d=n();function f({report:e}){let t=e.status===`removed`,n=e.principalType===`user`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{report:e,removed:t,person:n}),e.syncs.length>0&&(0,d.jsx)(g,{report:e,person:n}),e.issuedTokens.length>0&&(0,d.jsx)(_,{report:e})]})}function p({report:e}){let t=e.principalType===`user`;return(0,d.jsx)(`div`,{className:`report-notice`,children:(0,d.jsxs)(c,{children:[`Removed`,e.removedBy!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`by `,(0,d.jsx)(`span`,{className:`mono`,children:e.removedBy})]}),e.removedAt!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`on `,(0,d.jsx)(l,{iso:e.removedAt})]}),`.`,` `,t?`Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing.`:`Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.`]})})}function m({principalType:n,removed:i}){let a=n===`user`,o=i.filter(e=>e.principalType===n);return o.length===0?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`h2`,{className:`section-title`,children:`Removed`}),(0,d.jsx)(`section`,{className:`card`,"aria-label":a?`Removed users`:`Removed tokens`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt directory stacks`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`n`,children:`#`}),(0,d.jsx)(`th`,{className:`col-principal`,children:(0,d.jsxs)(`span`,{className:`th`,children:[a?(0,d.jsx)(t,{size:14}):(0,d.jsx)(e,{size:14}),a?`Email`:`Name`]})}),(0,d.jsx)(`th`,{className:`col-role`,children:`Still to rotate`}),(0,d.jsx)(`th`,{className:`col-actions`,children:(0,d.jsx)(`span`,{className:`visually-hidden`,children:`Report`})})]})}),(0,d.jsx)(`tbody`,{children:o.map((e,t)=>(0,d.jsxs)(`tr`,{className:`row-link`,children:[(0,d.jsx)(`td`,{className:`n`,children:t+1}),(0,d.jsx)(`td`,{className:`col-lead`,"data-label":a?`Email`:`Name`,children:(0,d.jsx)(u,{type:e.principalType,id:e.principalId,stretch:!0})}),(0,d.jsx)(`td`,{className:`col-role`,"data-label":`Still to rotate`,children:e.toRotate===0?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Nothing`}):`${e.toRotate} ${e.toRotate===1?`value`:`values`}`}),(0,d.jsx)(`td`,{className:`col-actions col-open cell-muted`,"aria-hidden":`true`,children:(0,d.jsx)(r,{size:16})})]},e.principalId))})]})})}),(0,d.jsxs)(`p`,{className:`hint section-foot`,children:[a?`They`:`These`,` can no longer sign in. Each page lists the values`,` `,a?`they`:`it`,` saw that nobody has changed since.`]})]})}function h({report:e,removed:t,person:n}){let r=n?`they`:`it`,i=t?`Values ${r} read or wrote that nobody has changed since, so ${r} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.`:`Current values ${r} ${n?`have`:`has`} read or written: the ones to rotate if ${r} ${n?`leave`:`is retired`}. Saving a new version takes a value off.`;return(0,d.jsx)(a,{labelledBy:`seen-values`,title:t?`Still to rotate`:`Values seen`,description:i,actions:e.rotated>0&&(0,d.jsxs)(`span`,{className:`card-aside`,children:[e.rotated,` already rotated`]}),children:e.exposed.length===0?(0,d.jsx)(s,{title:t?`Nothing left to rotate`:`No current values seen`,children:e.rotated>0?`Every value ${r} saw has had a new version since.`:`${n?`They have`:`It has`} not read or written a value that is still current.`}):(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-values`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Secret`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Last seen`})]})}),(0,d.jsx)(`tbody`,{children:e.exposed.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(o,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},search:{filter:e.key},children:[(0,d.jsxs)(`span`,{className:`report-path`,children:[e.project,`/`,e.environment,`/`]}),e.key]})}),(0,d.jsxs)(`td`,{className:`col-shrink cell-mono cell-muted`,children:[`v`,e.version]}),(0,d.jsxs)(`td`,{className:`col-shrink nowrap`,children:[e.how===`wrote`?`Wrote`:`Read`,` `,(0,d.jsx)(l,{iso:e.at,display:`relative`})]})]},`${e.project}/${e.environment}/${e.key}`))})]})})})}function g({report:e,person:t}){return(0,d.jsx)(a,{labelledBy:`created-syncs`,title:t?`Syncs they set up`:`Syncs it set up`,description:`A sync keeps pushing every change to the destination it names, whoever set it up. Check each one still points somewhere you control.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt syncs`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Destination`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`From`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`})]})}),(0,d.jsx)(`tbody`,{children:e.syncs.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-account`,children:[(0,d.jsx)(i,{brand:e.brand,size:15}),(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsxs)(`span`,{children:[e.providerLabel,e.paused&&(0,d.jsx)(`span`,{className:`tag`,children:`Paused`})]}),(0,d.jsx)(`small`,{className:`mono`,children:e.destination})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink`,children:(0,d.jsxs)(o,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},children:[e.project,`/`,e.environment]})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:e.credential})]},e.id))})]})})})}function _({report:e}){return(0,d.jsx)(a,{labelledBy:`issued-tokens`,title:`Tokens they issued`,description:`Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-tokens`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Token`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Last used`})]})}),(0,d.jsx)(`tbody`,{children:e.issuedTokens.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsx)(o,{className:`cell-link mono`,to:`/tokens/$token`,params:{token:e.service},children:e.service}),(0,d.jsxs)(`small`,{children:[e.label??`No label`,` · `,(0,d.jsx)(`span`,{className:`mono`,children:e.hint})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink nowrap`,children:(0,d.jsx)(l,{iso:e.expiresAt,display:`relative`})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow nowrap`,children:e.lastUsedAt===null?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Never`}):(0,d.jsx)(l,{iso:e.lastUsedAt,display:`relative`})})]},e.id))})]})})})}export{m as n,p as r,f as t};
1
+ import{C as e,X as t,ct as n,f as r,q as i,t as a}from"./page-DbSS7pYH.js";import{D as o,a as s,c,u as l}from"./preload-helper-DduCCcmc.js";import{c as u}from"./directory-Bu0EIxqI.js";var d=n();function f({report:e}){let t=e.status===`removed`,n=e.principalType===`user`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{report:e,removed:t,person:n}),e.syncs.length>0&&(0,d.jsx)(g,{report:e,person:n}),e.issuedTokens.length>0&&(0,d.jsx)(_,{report:e})]})}function p({report:e}){let t=e.principalType===`user`;return(0,d.jsx)(`div`,{className:`report-notice`,children:(0,d.jsxs)(c,{children:[`Removed`,e.removedBy!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`by `,(0,d.jsx)(`span`,{className:`mono`,children:e.removedBy})]}),e.removedAt!==null&&(0,d.jsxs)(d.Fragment,{children:[` `,`on `,(0,d.jsx)(l,{iso:e.removedAt})]}),`.`,` `,t?`Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing.`:`Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.`]})})}function m({principalType:n,removed:i}){let a=n===`user`,o=i.filter(e=>e.principalType===n);return o.length===0?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`h2`,{className:`section-title`,children:`Removed`}),(0,d.jsx)(`section`,{className:`card`,"aria-label":a?`Removed users`:`Removed tokens`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt directory stacks`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`n`,children:`#`}),(0,d.jsx)(`th`,{className:`col-principal`,children:(0,d.jsxs)(`span`,{className:`th`,children:[a?(0,d.jsx)(t,{size:14}):(0,d.jsx)(e,{size:14}),a?`Email`:`Name`]})}),(0,d.jsx)(`th`,{className:`col-role`,children:`Still to rotate`}),(0,d.jsx)(`th`,{className:`col-actions`,children:(0,d.jsx)(`span`,{className:`visually-hidden`,children:`Report`})})]})}),(0,d.jsx)(`tbody`,{children:o.map((e,t)=>(0,d.jsxs)(`tr`,{className:`row-link`,children:[(0,d.jsx)(`td`,{className:`n`,children:t+1}),(0,d.jsx)(`td`,{className:`col-lead`,"data-label":a?`Email`:`Name`,children:(0,d.jsx)(u,{type:e.principalType,id:e.principalId,stretch:!0})}),(0,d.jsx)(`td`,{className:`col-role`,"data-label":`Still to rotate`,children:e.toRotate===0?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Nothing`}):`${e.toRotate} ${e.toRotate===1?`value`:`values`}`}),(0,d.jsx)(`td`,{className:`col-actions col-open cell-muted`,"aria-hidden":`true`,children:(0,d.jsx)(r,{size:16})})]},e.principalId))})]})})}),(0,d.jsxs)(`p`,{className:`hint section-foot`,children:[a?`They`:`These`,` can no longer sign in. Each page lists the values`,` `,a?`they`:`it`,` saw that nobody has changed since.`]})]})}function h({report:e,removed:t,person:n}){let r=n?`they`:`it`,i=t?`Values ${r} read or wrote that nobody has changed since, so ${r} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.`:`Current values ${r} ${n?`have`:`has`} read or written: the ones to rotate if ${r} ${n?`leave`:`is retired`}. Saving a new version takes a value off.`;return(0,d.jsx)(a,{labelledBy:`seen-values`,title:t?`Still to rotate`:`Values seen`,description:i,actions:e.rotated>0&&(0,d.jsxs)(`span`,{className:`card-aside`,children:[e.rotated,` already rotated`]}),children:e.exposed.length===0?(0,d.jsx)(s,{title:t?`Nothing left to rotate`:`No current values seen`,children:e.rotated>0?`Every value ${r} saw has had a new version since.`:`${n?`They have`:`It has`} not read or written a value that is still current.`}):(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-values`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Secret`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Last seen`})]})}),(0,d.jsx)(`tbody`,{children:e.exposed.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(o,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},search:{filter:e.key},children:[(0,d.jsxs)(`span`,{className:`report-path`,children:[e.project,`/`,e.environment,`/`]}),e.key]})}),(0,d.jsxs)(`td`,{className:`col-shrink cell-mono cell-muted`,children:[`v`,e.version]}),(0,d.jsxs)(`td`,{className:`col-shrink nowrap`,children:[e.how===`wrote`?`Wrote`:`Read`,` `,(0,d.jsx)(l,{iso:e.at,display:`relative`})]})]},`${e.project}/${e.environment}/${e.key}`))})]})})})}function g({report:e,person:t}){return(0,d.jsx)(a,{labelledBy:`created-syncs`,title:t?`Syncs they set up`:`Syncs it set up`,description:`A sync keeps pushing every change to the destination it names, whoever set it up. Check each one still points somewhere you control.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt syncs`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Destination`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`From`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`})]})}),(0,d.jsx)(`tbody`,{children:e.syncs.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-account`,children:[(0,d.jsx)(i,{brand:e.brand,size:15}),(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsxs)(`span`,{children:[e.providerLabel,e.paused&&(0,d.jsx)(`span`,{className:`tag`,children:`Paused`})]}),(0,d.jsx)(`small`,{className:`mono`,children:e.destination})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink`,children:(0,d.jsxs)(o,{className:`cell-link mono`,to:`/projects/$project/$environment`,params:{project:e.project,environment:e.environment},children:[e.project,`/`,e.environment]})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:e.credential})]},e.id))})]})})})}function _({report:e}){return(0,d.jsx)(a,{labelledBy:`issued-tokens`,title:`Tokens they issued`,description:`Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.`,children:(0,d.jsx)(`div`,{className:`dt-wrap`,children:(0,d.jsxs)(`table`,{className:`dt report-tokens`,children:[(0,d.jsx)(`thead`,{children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{children:`Token`}),(0,d.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,d.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Last used`})]})}),(0,d.jsx)(`tbody`,{children:e.issuedTokens.map(e=>(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`td`,{children:(0,d.jsxs)(`span`,{className:`cell-stack`,children:[(0,d.jsx)(o,{className:`cell-link mono`,to:`/tokens/$token`,params:{token:e.service},children:e.service}),(0,d.jsxs)(`small`,{children:[e.label??`No label`,` · `,(0,d.jsx)(`span`,{className:`mono`,children:e.hint})]})]})}),(0,d.jsx)(`td`,{className:`col-shrink nowrap`,children:(0,d.jsx)(l,{iso:e.expiresAt,display:`relative`})}),(0,d.jsx)(`td`,{className:`col-shrink col-hide-narrow nowrap`,children:e.lastUsedAt===null?(0,d.jsx)(`span`,{className:`cell-muted`,children:`Never`}):(0,d.jsx)(l,{iso:e.lastUsedAt,display:`relative`})})]},e.id))})]})})})}export{m as n,p as r,f as t};
@@ -1 +1 @@
1
- import{$ as e,C as t,F as n,Ot as r,Q as i,Tt as a,a as o,ct as s,i as c,m as l,n as u,ot as d,tt as f,v as p}from"./page-DbSS7pYH.js";import{D as m,a as h,c as g,l as _,o as v,s as y}from"./preload-helper-DduCCcmc.js";import{i as b,o as x,r as S,s as C}from"./coffre-CXkp3Efg.js";import{r as w,t as T}from"./use-action-CUvWPRTx.js";import{a as E,i as D,r as O,s as k}from"./directory-PEjdb8PS.js";import{i as A,n as j,o as M,t as N}from"./grants-4mSkXPU4.js";import{r as P,t as F}from"./offboarding-DQ-56W0H.js";var I=r(a(),1);function L(e,t){return Object.hasOwn(e.environments,t)?e.environments[t]:null}function R(e,t){if(e.length===0)return{level:`none`,expiresAt:null,environments:{}};let[n]=e;if(e.length===1&&n.environmentSlug===null&&(n.role===`owner`||n.role===`viewer`||n.role===`developer`))return{level:n.role,expiresAt:n.expiresAt,environments:{}};let r={};for(let n of e){let e=n.environmentSlug;if(e===null||!t.includes(e)||Object.hasOwn(r,e)||n.role!==`viewer`&&n.role!==`developer`)return{level:`custom`,expiresAt:null,environments:{}};r[e]={role:n.role,expiresAt:n.expiresAt}}return{level:`env`,expiresAt:null,environments:r}}function z(e,t,n){if(t===`env`&&(e.level===`viewer`||e.level===`developer`)&&Object.keys(e.environments).length===0){let r={role:e.level,expiresAt:e.expiresAt};return{...e,level:t,environments:Object.fromEntries(n.map(e=>[e,r]))}}return{...e,level:t}}function B(e,t,n){let r={...e.environments};return n===null?delete r[t]:r[t]=n,{...e,environments:r}}function V(e){switch(e.level){case`none`:case`custom`:return[];case`owner`:case`viewer`:case`developer`:return[{role:e.level,environmentSlug:null,expiresAt:e.expiresAt}];case`env`:return Object.entries(e.environments).map(([e,t])=>({environmentSlug:e,...t}))}}function H(e,t){return e===t||e!==null&&t!==null&&Date.parse(e)===Date.parse(t)}function U(e,t){if(t.level===`custom`)return[];let n=e=>`${e.role}@${e.environmentSlug??``}`,r=new Map(V(t).map(e=>[n(e),e])),i=new Map(e.map(e=>[n(e),e])),a=[];for(let[e,t]of r)i.has(e)||a.push({kind:`create`,...t});for(let[e,t]of i){let n=r.get(e);n!==void 0&&!H(t.expiresAt,n.expiresAt)&&a.push({kind:`expiry`,grant:t,expiresAt:n.expiresAt})}for(let[e,t]of i)r.has(e)||a.push({kind:`revoke`,grant:t});return a}function W(e,t){let n=t=>t===null?e:`${e}/${t}`,r=(e,t)=>t===null?e:{role:e,until:t},i={};for(let e of t)e.kind===`revoke`&&(i[n(e.grant.environmentSlug)]=null);for(let e of t)e.kind===`expiry`&&(i[n(e.grant.environmentSlug)]=r(e.grant.role,e.expiresAt)),e.kind===`create`&&(i[n(e.environmentSlug)]=r(e.role,e.expiresAt));return i}function G(e){return e===``?null:new Date(`${e}T23:59:59Z`).toISOString()}function K(e){return e===null?``:e.slice(0,10)}var q=s();async function J(e,t,n,r){let i=(r?.projects??[]).filter(e=>e.permissions.includes(`grant.manage`)),[a,o]=await Promise.all([r?.capabilities.canManageGrants?x(async()=>{try{return{report:await e.members.get(S(t,n))}}catch(e){if(b(e)===404)return{report:null};throw e}}):Promise.resolve(null),Promise.all(i.map(t=>A(e,t.slug)))]);return{report:a,access:o.flatMap(e=>e.ok?[{project:e.project,grants:e.grants.filter(e=>e.principalType===t&&e.principalId===n),grantsError:e.grantsError}]:[])}}function Y({principalType:e,principalId:n,data:r}){let a=d(),{instanceRole:s}=f({from:`__root__`}),{report:l,access:_}=r,v=D[e],y=e===`user`,b=y?`/users`:`/tokens`,x=l?.ok===!0?l.report:null,S=x?.status===`removed`,C=x!==null&&!S?{principalType:e,principalId:n,instanceRole:x.instanceRole,isRootAdmin:x.isRootAdmin,tampered:x.status===`tampered`}:void 0;if(l?.ok===!0&&x===null||l===null&&_.length===0)return(0,q.jsx)(u,{icon:y?(0,q.jsx)(i,{size:18}):(0,q.jsx)(t,{size:18}),label:(0,q.jsx)(`span`,{className:`mono`,children:n}),title:y?`No such user for you`:`No such token for you`,actions:(0,q.jsxs)(m,{className:`btn`,to:b,children:[`All `,y?`users`:`tokens`]}),children:l===null?`A ${v}'s page lists its access to the projects where you manage access, and you manage none.`:`No ${v} by that name has ever been registered here.`});let w=_.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=_.filter(e=>e.grantsError!==null),A=S?[]:_.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{lead:(0,q.jsx)(k,{type:e,id:n,size:`lg`}),title:n,meta:S?(0,q.jsx)(`span`,{className:`tag tag-red`,children:`Removed`}):C?.principalType===`user`&&(0,q.jsx)(O,{principal:C}),actions:(A.length>0||C!==void 0)&&(0,q.jsxs)(q.Fragment,{children:[A.length>0&&(0,q.jsx)(X,{principalType:e,principalId:n,access:A}),C!==void 0&&(0,q.jsx)(E,{principal:C,trigger:`btn btn-icon`,onRemoved:()=>a.invalidate()})]})}),l?.ok===!1&&(0,q.jsx)(`div`,{className:`report-notice`,children:(0,q.jsx)(g,{tone:`bad`,children:l.error})}),S&&x!==null&&(0,q.jsx)(P,{report:x}),!S&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{className:`section-title`,children:`Project access`}),T.map(({project:e,grantsError:t})=>(0,q.jsx)(`div`,{style:{marginBottom:`0.75rem`},children:(0,q.jsxs)(g,{tone:`bad`,children:[(0,q.jsx)(`span`,{className:`mono`,children:e.slug}),`: `,t]})},e.slug)),(0,q.jsx)(`section`,{className:`card`,"aria-label":`Project access`,children:w.length===0?(0,q.jsx)(h,{title:`No project access yet`,children:A.length>0?`Edit access gives this ${v} access to several projects at once.`:`None of the projects where you manage access has a grant for this ${v}.`}):(0,q.jsx)(j,{lead:(0,q.jsxs)(`span`,{className:`th`,children:[(0,q.jsx)(p,{size:14}),`Project`]}),children:w.map(({project:e,grant:t},n)=>(0,q.jsx)(N,{number:n+1,project:e.slug,grant:t,leadLabel:`Project`,lead:(0,q.jsxs)(`span`,{className:`cell-project`,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsx)(m,{className:`cell-link`,to:`/projects/$project`,params:{project:e.slug},search:{tab:y?`users`:`tokens`},children:e.name}),e.archivedAt!==null&&(0,q.jsx)(`span`,{className:`tag tag-red`,children:`archived`})]})},t.id))})}),s!==`root-admin`&&(0,q.jsx)(`p`,{className:`hint section-foot`,children:`Only projects where you manage access are listed.`})]}),x!==null&&(0,q.jsx)(F,{report:x})]})}function X({principalType:e,principalId:t,access:r}){let i=C(),[a,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)({}),{pending:u,error:d,setError:f,run:p}=T(),m=D[e],h=r.map(({project:e,grants:t})=>{let n=e.environments.filter(e=>e.details!==null&&e.details.archivedAt===null).map(e=>e.slug),r=R(t,n),i=Object.hasOwn(c,e.slug)?c[e.slug]:r;return{project:e,grants:t,environments:n,held:r,plan:i,changes:U(t,i)}}),g=h.filter(e=>e.changes.length>0);function b(){s(!1),l({}),f(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,q.jsx)(n,{size:14}),`Edit access`]}),(0,q.jsx)(y,{open:a,onOpenChange:e=>e?s(!0):b(),title:(0,q.jsxs)(q.Fragment,{children:[`Edit access for `,(0,q.jsx)(`span`,{className:`mono`,children:t})]}),description:`Set what this ${m} can reach on each project you manage, and until when. Saving applies only what you changed.`,wide:!0,children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault(),p(()=>i.access.set(S(e,t),Object.assign({},...g.map(({project:e,changes:t})=>W(e.slug,t)))),()=>{w.success(`Updated ${t}’s access on ${g.length} project${g.length===1?``:`s`}`),b()})},children:[(0,q.jsxs)(`ul`,{className:`plan-list`,children:[(0,q.jsxs)(`li`,{className:`plan-head`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{children:`Project`}),(0,q.jsx)(`span`,{children:`Access`}),(0,q.jsx)(`span`,{children:`Expires`})]}),h.map(({project:e,grants:t,environments:n,held:r,plan:i,changes:a})=>{let s=`plan-${e.slug}`,c=t=>l(n=>({...n,[e.slug]:t}));return(0,q.jsxs)(`li`,{className:`plan-row${a.length>0?` is-changed`:``}`,children:[(0,q.jsxs)(`label`,{className:`plan-project`,htmlFor:s,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsxs)(`span`,{className:`plan-project-text`,children:[(0,q.jsx)(`span`,{className:`plan-project-name`,children:e.name}),r.level===`custom`&&(0,q.jsxs)(`span`,{className:`plan-project-held`,children:[`Holds `,t.map(e=>M(e)).join(`, `)]})]})]}),(0,q.jsxs)(`select`,{id:s,className:`select select-sm`,value:i.level,onChange:e=>c(z(i,e.target.value,n)),children:[r.level===`custom`&&(0,q.jsx)(`option`,{value:`custom`,children:`Keep as is`}),(0,q.jsx)(`option`,{value:`none`,children:`No access`}),(0,q.jsx)(`option`,{value:`owner`,children:`Owner`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read: all`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write: all`}),n.length>0&&(0,q.jsx)(`option`,{value:`env`,children:`Per environment…`})]}),(i.level===`owner`||i.level===`viewer`||i.level===`developer`)&&(0,q.jsx)(Z,{label:`${e.name} expires`,expiresAt:i.expiresAt,onChange:e=>c({...i,expiresAt:e})}),i.level===`env`&&(0,q.jsx)(`ul`,{className:`plan-envs`,"aria-label":`Environments of ${e.name}`,children:n.map(t=>{let n=L(i,t);return(0,q.jsxs)(`li`,{className:`plan-env`,children:[(0,q.jsx)(`label`,{className:`mono`,htmlFor:`${s}-${t}`,children:t}),(0,q.jsxs)(`select`,{id:`${s}-${t}`,className:`select select-sm`,value:n?.role??``,onChange:e=>{let r=e.target.value;c(B(i,t,r===`viewer`||r===`developer`?{role:r,expiresAt:n?.expiresAt??null}:null))},children:[(0,q.jsx)(`option`,{value:``,children:`No access`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write`})]}),n!==null&&(0,q.jsx)(Z,{label:`${t} of ${e.name} expires`,expiresAt:n.expiresAt,onChange:e=>c(B(i,t,{...n,expiresAt:e}))})]},t)})}),a.length>0&&(0,q.jsx)(`ul`,{className:`plan-changes`,"aria-label":`Changes to ${e.name}`,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{change:e})},e.kind===`create`?`+${e.role}@${e.environmentSlug??``}`:e.grant.id))})]},e.slug)})]}),(0,q.jsx)(v,{error:d}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:u||g.length===0,children:[u&&(0,q.jsx)(_,{}),`Save changes`]})]})]})})]})}function Z({label:t,expiresAt:n,onChange:r}){let i=K(n);return(0,q.jsxs)(`span`,{className:`expiry${i===``?` is-never`:``}`,children:[(0,q.jsx)(`input`,{className:`input select-sm`,type:`date`,"aria-label":t,min:new Date().toISOString().slice(0,10),value:i,onChange:e=>r(G(e.target.value))}),(0,q.jsx)(`span`,{className:`expiry-never`,"aria-hidden":`true`,children:`Never`}),(0,q.jsx)(`button`,{className:`btn btn-quiet btn-sm btn-icon`,type:`button`,"aria-label":`${t}: never`,title:`Never expires`,onClick:()=>r(null),children:(0,q.jsx)(e,{size:12})})]})}function Q({change:e}){let t=e=>e===null?``:` until ${K(e)}`;switch(e.kind){case`create`:return(0,q.jsxs)(`span`,{className:`tag tag-green`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Adds`}),M({...e,roleName:e.role}),t(e.expiresAt)]});case`expiry`:return(0,q.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,q.jsx)(l,{size:12}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Moves the expiry of`}),M(e.grant),e.expiresAt===null?`, no expiry`:t(e.expiresAt)]});case`revoke`:return(0,q.jsxs)(`span`,{className:`tag tag-red`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Removes`}),M(e.grant)]})}}export{J as n,Y as t};
1
+ import{$ as e,C as t,F as n,Ot as r,Q as i,Tt as a,a as o,ct as s,i as c,m as l,n as u,ot as d,tt as f,v as p}from"./page-DbSS7pYH.js";import{D as m,a as h,c as g,l as _,o as v,s as y}from"./preload-helper-DduCCcmc.js";import{i as b,o as x,r as S,s as C}from"./coffre-BBp7cKVa.js";import{r as w,t as T}from"./use-action-l__xZDYY.js";import{a as E,i as D,r as O,s as k}from"./directory-Bu0EIxqI.js";import{i as A,n as j,o as M,t as N}from"./grants-DavcwofW.js";import{r as P,t as F}from"./offboarding-DWsE2FSa.js";var I=r(a(),1);function L(e,t){return Object.hasOwn(e.environments,t)?e.environments[t]:null}function R(e,t){if(e.length===0)return{level:`none`,expiresAt:null,environments:{}};let[n]=e;if(e.length===1&&n.environmentSlug===null&&(n.role===`owner`||n.role===`viewer`||n.role===`developer`))return{level:n.role,expiresAt:n.expiresAt,environments:{}};let r={};for(let n of e){let e=n.environmentSlug;if(e===null||!t.includes(e)||Object.hasOwn(r,e)||n.role!==`viewer`&&n.role!==`developer`)return{level:`custom`,expiresAt:null,environments:{}};r[e]={role:n.role,expiresAt:n.expiresAt}}return{level:`env`,expiresAt:null,environments:r}}function z(e,t,n){if(t===`env`&&(e.level===`viewer`||e.level===`developer`)&&Object.keys(e.environments).length===0){let r={role:e.level,expiresAt:e.expiresAt};return{...e,level:t,environments:Object.fromEntries(n.map(e=>[e,r]))}}return{...e,level:t}}function B(e,t,n){let r={...e.environments};return n===null?delete r[t]:r[t]=n,{...e,environments:r}}function V(e){switch(e.level){case`none`:case`custom`:return[];case`owner`:case`viewer`:case`developer`:return[{role:e.level,environmentSlug:null,expiresAt:e.expiresAt}];case`env`:return Object.entries(e.environments).map(([e,t])=>({environmentSlug:e,...t}))}}function H(e,t){return e===t||e!==null&&t!==null&&Date.parse(e)===Date.parse(t)}function U(e,t){if(t.level===`custom`)return[];let n=e=>`${e.role}@${e.environmentSlug??``}`,r=new Map(V(t).map(e=>[n(e),e])),i=new Map(e.map(e=>[n(e),e])),a=[];for(let[e,t]of r)i.has(e)||a.push({kind:`create`,...t});for(let[e,t]of i){let n=r.get(e);n!==void 0&&!H(t.expiresAt,n.expiresAt)&&a.push({kind:`expiry`,grant:t,expiresAt:n.expiresAt})}for(let[e,t]of i)r.has(e)||a.push({kind:`revoke`,grant:t});return a}function W(e,t){let n=t=>t===null?e:`${e}/${t}`,r=(e,t)=>t===null?e:{role:e,until:t},i={};for(let e of t)e.kind===`revoke`&&(i[n(e.grant.environmentSlug)]=null);for(let e of t)e.kind===`expiry`&&(i[n(e.grant.environmentSlug)]=r(e.grant.role,e.expiresAt)),e.kind===`create`&&(i[n(e.environmentSlug)]=r(e.role,e.expiresAt));return i}function G(e){return e===``?null:new Date(`${e}T23:59:59Z`).toISOString()}function K(e){return e===null?``:e.slice(0,10)}var q=s();async function J(e,t,n,r){let i=(r?.projects??[]).filter(e=>e.permissions.includes(`grant.manage`)),[a,o]=await Promise.all([r?.capabilities.canManageGrants?x(async()=>{try{return{report:await e.members.get(S(t,n))}}catch(e){if(b(e)===404)return{report:null};throw e}}):Promise.resolve(null),Promise.all(i.map(t=>A(e,t.slug)))]);return{report:a,access:o.flatMap(e=>e.ok?[{project:e.project,grants:e.grants.filter(e=>e.principalType===t&&e.principalId===n),grantsError:e.grantsError}]:[])}}function Y({principalType:e,principalId:n,data:r}){let a=d(),{instanceRole:s}=f({from:`__root__`}),{report:l,access:_}=r,v=D[e],y=e===`user`,b=y?`/users`:`/tokens`,x=l?.ok===!0?l.report:null,S=x?.status===`removed`,C=x!==null&&!S?{principalType:e,principalId:n,instanceRole:x.instanceRole,isRootAdmin:x.isRootAdmin,tampered:x.status===`tampered`}:void 0;if(l?.ok===!0&&x===null||l===null&&_.length===0)return(0,q.jsx)(u,{icon:y?(0,q.jsx)(i,{size:18}):(0,q.jsx)(t,{size:18}),label:(0,q.jsx)(`span`,{className:`mono`,children:n}),title:y?`No such user for you`:`No such token for you`,actions:(0,q.jsxs)(m,{className:`btn`,to:b,children:[`All `,y?`users`:`tokens`]}),children:l===null?`A ${v}'s page lists its access to the projects where you manage access, and you manage none.`:`No ${v} by that name has ever been registered here.`});let w=_.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=_.filter(e=>e.grantsError!==null),A=S?[]:_.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{lead:(0,q.jsx)(k,{type:e,id:n,size:`lg`}),title:n,meta:S?(0,q.jsx)(`span`,{className:`tag tag-red`,children:`Removed`}):C?.principalType===`user`&&(0,q.jsx)(O,{principal:C}),actions:(A.length>0||C!==void 0)&&(0,q.jsxs)(q.Fragment,{children:[A.length>0&&(0,q.jsx)(X,{principalType:e,principalId:n,access:A}),C!==void 0&&(0,q.jsx)(E,{principal:C,trigger:`btn btn-icon`,onRemoved:()=>a.invalidate()})]})}),l?.ok===!1&&(0,q.jsx)(`div`,{className:`report-notice`,children:(0,q.jsx)(g,{tone:`bad`,children:l.error})}),S&&x!==null&&(0,q.jsx)(P,{report:x}),!S&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{className:`section-title`,children:`Project access`}),T.map(({project:e,grantsError:t})=>(0,q.jsx)(`div`,{style:{marginBottom:`0.75rem`},children:(0,q.jsxs)(g,{tone:`bad`,children:[(0,q.jsx)(`span`,{className:`mono`,children:e.slug}),`: `,t]})},e.slug)),(0,q.jsx)(`section`,{className:`card`,"aria-label":`Project access`,children:w.length===0?(0,q.jsx)(h,{title:`No project access yet`,children:A.length>0?`Edit access gives this ${v} access to several projects at once.`:`None of the projects where you manage access has a grant for this ${v}.`}):(0,q.jsx)(j,{lead:(0,q.jsxs)(`span`,{className:`th`,children:[(0,q.jsx)(p,{size:14}),`Project`]}),children:w.map(({project:e,grant:t},n)=>(0,q.jsx)(N,{number:n+1,project:e.slug,grant:t,leadLabel:`Project`,lead:(0,q.jsxs)(`span`,{className:`cell-project`,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsx)(m,{className:`cell-link`,to:`/projects/$project`,params:{project:e.slug},search:{tab:y?`users`:`tokens`},children:e.name}),e.archivedAt!==null&&(0,q.jsx)(`span`,{className:`tag tag-red`,children:`archived`})]})},t.id))})}),s!==`root-admin`&&(0,q.jsx)(`p`,{className:`hint section-foot`,children:`Only projects where you manage access are listed.`})]}),x!==null&&(0,q.jsx)(F,{report:x})]})}function X({principalType:e,principalId:t,access:r}){let i=C(),[a,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)({}),{pending:u,error:d,setError:f,run:p}=T(),m=D[e],h=r.map(({project:e,grants:t})=>{let n=e.environments.filter(e=>e.details!==null&&e.details.archivedAt===null).map(e=>e.slug),r=R(t,n),i=Object.hasOwn(c,e.slug)?c[e.slug]:r;return{project:e,grants:t,environments:n,held:r,plan:i,changes:U(t,i)}}),g=h.filter(e=>e.changes.length>0);function b(){s(!1),l({}),f(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,q.jsx)(n,{size:14}),`Edit access`]}),(0,q.jsx)(y,{open:a,onOpenChange:e=>e?s(!0):b(),title:(0,q.jsxs)(q.Fragment,{children:[`Edit access for `,(0,q.jsx)(`span`,{className:`mono`,children:t})]}),description:`Set what this ${m} can reach on each project you manage, and until when. Saving applies only what you changed.`,wide:!0,children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault(),p(()=>i.access.set(S(e,t),Object.assign({},...g.map(({project:e,changes:t})=>W(e.slug,t)))),()=>{w.success(`Updated ${t}’s access on ${g.length} project${g.length===1?``:`s`}`),b()})},children:[(0,q.jsxs)(`ul`,{className:`plan-list`,children:[(0,q.jsxs)(`li`,{className:`plan-head`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{children:`Project`}),(0,q.jsx)(`span`,{children:`Access`}),(0,q.jsx)(`span`,{children:`Expires`})]}),h.map(({project:e,grants:t,environments:n,held:r,plan:i,changes:a})=>{let s=`plan-${e.slug}`,c=t=>l(n=>({...n,[e.slug]:t}));return(0,q.jsxs)(`li`,{className:`plan-row${a.length>0?` is-changed`:``}`,children:[(0,q.jsxs)(`label`,{className:`plan-project`,htmlFor:s,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsxs)(`span`,{className:`plan-project-text`,children:[(0,q.jsx)(`span`,{className:`plan-project-name`,children:e.name}),r.level===`custom`&&(0,q.jsxs)(`span`,{className:`plan-project-held`,children:[`Holds `,t.map(e=>M(e)).join(`, `)]})]})]}),(0,q.jsxs)(`select`,{id:s,className:`select select-sm`,value:i.level,onChange:e=>c(z(i,e.target.value,n)),children:[r.level===`custom`&&(0,q.jsx)(`option`,{value:`custom`,children:`Keep as is`}),(0,q.jsx)(`option`,{value:`none`,children:`No access`}),(0,q.jsx)(`option`,{value:`owner`,children:`Owner`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read: all`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write: all`}),n.length>0&&(0,q.jsx)(`option`,{value:`env`,children:`Per environment…`})]}),(i.level===`owner`||i.level===`viewer`||i.level===`developer`)&&(0,q.jsx)(Z,{label:`${e.name} expires`,expiresAt:i.expiresAt,onChange:e=>c({...i,expiresAt:e})}),i.level===`env`&&(0,q.jsx)(`ul`,{className:`plan-envs`,"aria-label":`Environments of ${e.name}`,children:n.map(t=>{let n=L(i,t);return(0,q.jsxs)(`li`,{className:`plan-env`,children:[(0,q.jsx)(`label`,{className:`mono`,htmlFor:`${s}-${t}`,children:t}),(0,q.jsxs)(`select`,{id:`${s}-${t}`,className:`select select-sm`,value:n?.role??``,onChange:e=>{let r=e.target.value;c(B(i,t,r===`viewer`||r===`developer`?{role:r,expiresAt:n?.expiresAt??null}:null))},children:[(0,q.jsx)(`option`,{value:``,children:`No access`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write`})]}),n!==null&&(0,q.jsx)(Z,{label:`${t} of ${e.name} expires`,expiresAt:n.expiresAt,onChange:e=>c(B(i,t,{...n,expiresAt:e}))})]},t)})}),a.length>0&&(0,q.jsx)(`ul`,{className:`plan-changes`,"aria-label":`Changes to ${e.name}`,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{change:e})},e.kind===`create`?`+${e.role}@${e.environmentSlug??``}`:e.grant.id))})]},e.slug)})]}),(0,q.jsx)(v,{error:d}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:u||g.length===0,children:[u&&(0,q.jsx)(_,{}),`Save changes`]})]})]})})]})}function Z({label:t,expiresAt:n,onChange:r}){let i=K(n);return(0,q.jsxs)(`span`,{className:`expiry${i===``?` is-never`:``}`,children:[(0,q.jsx)(`input`,{className:`input select-sm`,type:`date`,"aria-label":t,min:new Date().toISOString().slice(0,10),value:i,onChange:e=>r(G(e.target.value))}),(0,q.jsx)(`span`,{className:`expiry-never`,"aria-hidden":`true`,children:`Never`}),(0,q.jsx)(`button`,{className:`btn btn-quiet btn-sm btn-icon`,type:`button`,"aria-label":`${t}: never`,title:`Never expires`,onClick:()=>r(null),children:(0,q.jsx)(e,{size:12})})]})}function Q({change:e}){let t=e=>e===null?``:` until ${K(e)}`;switch(e.kind){case`create`:return(0,q.jsxs)(`span`,{className:`tag tag-green`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Adds`}),M({...e,roleName:e.role}),t(e.expiresAt)]});case`expiry`:return(0,q.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,q.jsx)(l,{size:12}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Moves the expiry of`}),M(e.grant),e.expiresAt===null?`, no expiry`:t(e.expiresAt)]});case`revoke`:return(0,q.jsxs)(`span`,{className:`tag tag-red`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Removes`}),M(e.grant)]})}}export{J as n,Y as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-BZnNvENc.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-CXkp3Efg.js";var i=e(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:async({context:{client:e},params:t})=>{let n=`${t.project}/${t.environment}`,[i,a]=await Promise.all([r(()=>e.secrets.list(n)),r(()=>e.syncs.list(n))]);return{keys:i,syncs:a}},component:n(()=>t(()=>import(`./projects._project._environment-BZnNvENc.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-CT0A-hIU.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-BBp7cKVa.js";var i=e(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:async({context:{client:e},params:t})=>{let n=`${t.project}/${t.environment}`,[i,a]=await Promise.all([r(()=>e.secrets.list(n)),r(()=>e.syncs.list(n))]);return{keys:i,syncs:a}},component:n(()=>t(()=>import(`./projects._project._environment-CT0A-hIU.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
@@ -1,3 +1,3 @@
1
- import{$ as e,B as t,C as n,D as r,F as i,I as a,J as o,K as s,L as c,M as l,Ot as u,P as d,Tt as f,Y as p,_ as m,b as h,c as g,ct as _,g as v,i as y,l as b,m as x,n as S,ot as C,q as w,s as ee,t as T,tt as E,x as D,z as O}from"./page-DbSS7pYH.js";import{D as te,a as ne,c as k,d as A,f as j,g as M,i as re,l as N,m as P,n as F,o as I,r as L,s as R,u as z}from"./preload-helper-DduCCcmc.js";import{c as ie,d as ae,f as B,l as V,m as H,n as U,o as W,p as G,s as K,t as q}from"./coffre-CXkp3Efg.js";import{r as J,t as Y}from"./use-action-CUvWPRTx.js";import{i as X,o as oe}from"./affordances-CmoY-8Xf.js";import{t as se}from"./projects._project._environment-CLUpTvi-.js";import{t as ce}from"./validation-9Cl_XS-l.js";var le=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function ue(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!le.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=fe(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=pe(u.slice(1,e)),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function de(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function fe(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function pe(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
1
+ import{$ as e,B as t,C as n,D as r,F as i,I as a,J as o,K as s,L as c,M as l,Ot as u,P as d,Tt as f,Y as p,_ as m,b as h,c as g,ct as _,g as v,i as y,l as b,m as x,n as S,ot as C,q as w,s as ee,t as T,tt as E,x as D,z as O}from"./page-DbSS7pYH.js";import{D as te,a as ne,c as k,d as A,f as j,g as M,i as re,l as N,m as P,n as F,o as I,r as L,s as R,u as z}from"./preload-helper-DduCCcmc.js";import{c as ie,d as ae,f as B,l as V,m as H,n as U,o as W,p as G,s as K,t as q}from"./coffre-BBp7cKVa.js";import{r as J,t as Y}from"./use-action-l__xZDYY.js";import{i as X,o as oe}from"./affordances-CmoY-8Xf.js";import{t as se}from"./projects._project._environment-BMeX_B8l.js";import{t as ce}from"./validation-9Cl_XS-l.js";var le=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function ue(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!le.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=fe(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=pe(u.slice(1,e)),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function de(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function fe(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function pe(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
2
2
  `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Z=u(f(),1);function Q(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function me(e,t,n){let r=e.filter(e=>!Q(n,e.key)?.archived).map(e=>Q(n,e.key)?.key.trim()??e.key);if(new Set(r).size!==r.length)return!0;let i=t.map(e=>e.key.trim());if(new Set(i).size!==i.length)return!0;let a=new Set(e.flatMap(e=>{let t=Q(n,e.key);return t!==void 0&&!t.archived&&t.value!==null?[t.key.trim()]:[]}));if(i.some(e=>a.has(e)))return!0;let o=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key));return i.some(e=>o.has(e))}async function he({active:e,drafts:t,changes:n,operations:r}){let i={...n},a=ge(e,t,n);if(a instanceof Error)return{applied:0,drafts:[...t],changes:i,error:a};let o=0,s=Object.create(null);try{for(let{sourceKey:e,change:t}of a){if(t.archived){s[e]=null;continue}let n=t.key.trim();n!==e&&(await r.rename(e,n),delete i[e],o+=1,t.value!==null&&(i[n]={key:n,value:t.value,archived:!1})),t.value!==null&&(s[n]=t.value)}for(let e of t)s[e.key.trim()]=e.value;let e=Object.keys(s).length;return e>0&&await r.write({...s}),{applied:o+e,drafts:[],changes:{},error:null}}catch(e){return{applied:o,drafts:[...t],changes:i,error:e}}}function ge(e,t,n){let r=new Set(e.map(e=>e.key)),i=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key)),a=t.find(e=>i.has(e.key.trim()));if(a)return Error(`${a.key.trim()}: cannot archive and write the same key in one save`);let o=new Map,s=[];for(let t of e){let e=Q(n,t.key);e!==void 0&&(!e.archived&&e.key.trim()!==t.key?o.set(t.key,e):s.push({sourceKey:t.key,change:e}))}for(let[e,t]of o){let n=t.key.trim();if(r.has(n)&&!o.has(n))return Error(`${e}: ${n} is already in use`)}let c=[],l=new Set;for(;o.size>0;){let e=[...o].find(([,e])=>{let t=e.key.trim();return!r.has(t)||l.has(t)});if(!e)return Error(`Secret renames contain a cycle. Save them in separate steps.`);let[t,n]=e;o.delete(t),l.add(t),c.push({sourceKey:t,change:n})}return[...c,...s]}function _e(e,t){return e!==null&&e.version===t}var $=_(),ve=2e3,ye=6e4;function be({project:e,environment:t,result:n,canRun:r}){let i=C(),a=n.ok&&n.syncs.some(e=>e.running);if((0,Z.useEffect)(()=>{if(!a)return;let e=setInterval(()=>void i.invalidate(),ve);return()=>clearInterval(e)},[a,i]),n.ok&&n.syncs.length===0&&!n.canManage)return null;let o=n.ok&&n.canManage;return(0,$.jsx)(T,{labelledBy:`syncs`,title:`Syncs`,description:`Destinations these secrets are pushed to. A change goes out when it is saved, and every hour coffre checks each destination and repairs what drifted.`,actions:o?(0,$.jsx)(De,{project:e,environment:t}):void 0,children:n.ok?n.syncs.length===0?(0,$.jsxs)(ne,{title:`Not synced anywhere`,children:[`Push these secrets where your code runs, such as GitHub Actions or Vercel, and keep them current there. Anything else can read them with `,(0,$.jsx)(`code`,{children:`coffre run`}),`.`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt syncs stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Destination`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Status`}),(0,$.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:n.syncs.map(e=>(0,$.jsx)(xe,{sync:e,canRun:r,canManage:o},e.id))})]})}):(0,$.jsx)(`div`,{className:`card-body`,children:(0,$.jsx)(I,{error:n.error})})})}function xe({sync:t,canRun:n,canManage:r}){let[i,o]=(0,Z.useState)(!1),c=K(),u=Y(),f=Y(),p=u.pending||f.pending,m=u.error??f.error;function h(){u.run(()=>c.syncs.run(t.id),e=>we(t,e.outcome))}function g(e){f.run(()=>c.syncs.update(t.id,{paused:e}),()=>J.success(e?`Paused ${t.destination}`:`Resumed ${t.destination}`,{action:{label:`Undo`,onClick:()=>g(!e)}}))}let _=m??(t.offered?t.lastError:null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:_!==null&&!t.running?`has-error`:void 0,children:[(0,$.jsx)(`td`,{className:`col-destination`,children:(0,$.jsxs)(`span`,{className:`cell-account`,children:[(0,$.jsx)(w,{brand:t.brand,size:15}),(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(`span`,{children:t.providerLabel}),t.offered?(0,$.jsx)(`small`,{className:`mono`,children:t.destination}):(0,$.jsx)(`small`,{children:`No longer offered by this deployment`})]})]})}),(0,$.jsx)(`td`,{className:`nowrap col-status`,children:(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(Se,{sync:t}),(0,$.jsx)(`small`,{children:(0,$.jsx)(Ce,{sync:t})})]})}),(0,$.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:t.credential}),(0,$.jsxs)(`td`,{className:`col-actions`,children:[(0,$.jsxs)(`div`,{className:`acts`,children:[n&&!t.paused&&(0,$.jsxs)(`button`,{className:`act`,onClick:h,disabled:p||t.running||!t.offered,title:t.offered?void 0:`This deployment no longer offers this provider`,children:[u.pending?(0,$.jsx)(N,{size:13}):(0,$.jsx)(s,{size:13}),`Run now`]}),r&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${t.destination}`,disabled:p,children:(0,$.jsx)(l,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>g(!t.paused),children:[t.paused?(0,$.jsx)(a,{size:14}):(0,$.jsx)(d,{size:14}),t.paused?`Resume`:`Pause`]}),(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>o(!0),children:[(0,$.jsx)(e,{size:14}),`Remove`]})]})})]})]}),(0,$.jsx)(L,{open:i,onOpenChange:o,title:(0,$.jsxs)($.Fragment,{children:[`Stop syncing to `,(0,$.jsx)(`span`,{className:`mono`,children:t.destination}),`?`]}),body:`Nothing more is pushed to ${t.providerLabel}. Keys coffre already pushed stay there; remove them at ${t.providerLabel} if they should go too.`,confirmLabel:`Remove sync`,onConfirm:()=>f.run(()=>c.syncs.remove(t.id),()=>J.success(`No longer syncing to ${t.destination}`))})]})]}),_!==null&&!t.running&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:4,children:(0,$.jsx)(I,{error:_})})})]})}function Se({sync:e}){return e.offered?e.running?(0,$.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,$.jsx)(N,{size:11}),`Pushing`]}):e.paused?(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Paused`}):e.lastStatus===`failed`?(0,$.jsx)(`span`,{className:`tag tag-red`,children:`Failed`}):e.pending>0?(0,$.jsxs)(`span`,{className:`tag tag-amber`,children:[e.pending,` pending`]}):e.lastStatus===`partial`?(0,$.jsx)(`span`,{className:`tag tag-amber`,children:`Partial`}):e.lastRunAt===null?(0,$.jsx)(`span`,{className:`tag`,children:`Not run yet`}):(0,$.jsx)(`span`,{className:`tag tag-green`,children:`In sync`}):(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Unavailable`})}function Ce({sync:e}){let t=e.skipped.length,n=[];return(e.synced>0||e.pending===0)&&n.push(`${e.synced} synced`),e.pending>0&&n.push(`${e.pending} pending`),t>0&&n.push((0,$.jsx)(j,{label:(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:`1rem`},children:e.skipped.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`mono`,children:e.key}),`: `,e.reason]},e.key))}),children:(0,$.jsxs)(`button`,{type:`button`,className:`tag tag-amber tag-button`,children:[(0,$.jsx)(g,{size:11}),t,` skipped`]})})),e.lastRunAt!==null&&n.push((0,$.jsx)(z,{iso:e.lastRunAt,display:`relative`})),(0,$.jsx)($.Fragment,{children:n.map((e,t)=>(0,$.jsxs)(Z.Fragment,{children:[t>0&&` · `,e]},t))})}function we(e,t){if(t.status===`busy`){J(`A run is already under way`,{description:`Its result appears here when it ends.`});return}let n=t.upserted.length+t.deleted.length;if(t.status===`failed`)J.error(`Could not sync to ${e.destination}`,{description:t.error??void 0});else if(t.status===`partial`)J.warning(`${t.failed.length} of ${n+t.failed.length} changes failed`,{description:t.failed[0]?.message});else if(n===0)J.success(`${e.destination} was already current`);else{let n=[t.upserted.length>0&&`pushed ${t.upserted.length}`,t.deleted.length>0&&`removed ${t.deleted.length}`].filter(Boolean);J.success(`${Ee(n.join(`, `))} to ${e.destination}`)}}async function Te(e,t,n,r){let i=J.loading(`Pushing to ${n.destination}`,{description:`The first push is under way.`}),a=Date.now()+ye;for(;Date.now()<a;){await new Promise(e=>setTimeout(e,ve));let a=await W(()=>e.syncs.list(t)),o=a.ok?a.syncs.find(e=>e.id===n.id):void 0;if(!(o===void 0||o.running||o.lastRunAt===null)){await r(),o.lastStatus===`failed`?J.error(`Could not sync to ${n.destination}`,{id:i,description:o.lastError??void 0}):o.lastStatus===`partial`?J.warning(`Synced to ${n.destination}, but not every key`,{id:i,description:o.lastError??void 0}):J.success(`Synced to ${n.destination}`,{id:i,description:`${o.synced} ${o.synced===1?`key is`:`keys are`} there now.`});return}}await r(),J(`Still pushing to ${n.destination}`,{id:i,description:`Its result appears in the list when it ends.`})}function Ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}function De({project:e,environment:t}){let[n,r]=(0,Z.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,$.jsx)(c,{size:14}),`Add sync`]}),(0,$.jsx)(R,{open:n,onOpenChange:r,title:(0,$.jsxs)($.Fragment,{children:[`Sync `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),description:`Every key in this environment is pushed to the destination and kept current. coffre only ever removes keys it pushed itself.`,wide:!0,children:(0,$.jsx)(Oe,{children:n=>(0,$.jsx)(ke,{project:e,environment:t,providers:n,onDone:()=>r(!1)})})})]})}function Oe({children:e}){let t=K(),[n,r]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{let e=!0;return W(()=>t.syncs.providers()).then(t=>{e&&r(t)}),()=>{e=!1}},[t]),n===null?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[(0,$.jsx)(N,{size:13}),`Loading where coffre can sync to…`]}):n.ok?n.providers.length===0?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[`This instance offers nowhere to sync to. Whoever runs coffre lists the providers in its`,` `,(0,$.jsx)(`span`,{className:`mono`,children:`syncs`}),` settings.`]}):e(n.providers):(0,$.jsx)(`div`,{className:`sync-providers-state`,children:(0,$.jsx)(I,{error:n.error})})}function ke({project:e,environment:t,providers:n,onDone:r}){let[i,a]=(0,Z.useState)(n[0]),[o,s]=(0,Z.useState)(()=>B(n[0])),[c,l]=(0,Z.useState)(``),u=K(),d=C(),{pending:f,error:p,setError:m,run:h}=Y(),g=ae(i,o);function _(e){a(e),s(B(e)),m(null)}function v(e,t){s(n=>({...n,[e]:t}))}return(0,$.jsxs)(`form`,{className:`form`,style:{marginTop:`1.25rem`},onSubmit:n=>{n.preventDefault(),h(()=>u.syncs.add(`${e}/${t}`,{provider:i.id,config:V(i,o),credential:c.trim()}),n=>{r(),Te(u,`${e}/${t}`,n,()=>d.invalidate())})},children:[n.length>1&&(0,$.jsx)(`div`,{className:`choice-grid sync-providers`,role:`group`,"aria-label":`Destination`,children:n.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e.id===i.id,onClick:()=>_(e),children:[(0,$.jsx)(w,{brand:e.brand}),e.label]},e.id))}),(0,$.jsx)(`div`,{className:`form-row`,children:i.fields.map(e=>{if(!G(e,o))return null;if(e.type===`text`)return(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsxs)(`span`,{className:`label`,children:[e.label,e.optional===!0&&(0,$.jsx)(`span`,{className:`hint`,children:` (optional)`})]}),(0,$.jsx)(`input`,{className:`input input-mono`,value:o[e.name],placeholder:e.placeholder,spellCheck:!1,autoComplete:`off`,onChange:t=>v(e.name,t.target.value)}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`);let t=o[e.name];return(0,$.jsxs)(`div`,{className:`field field-options`,role:`group`,"aria-label":e.label,children:[(0,$.jsx)(`span`,{className:`label`,children:e.label}),(0,$.jsx)(`div`,{className:`segmented`,children:e.options.map(n=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t.includes(n.value),onClick:()=>v(e.name,e.multiple?t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value]:[n.value]),children:n.label},n.value))}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`)})}),(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`Token`}),(0,$.jsx)(`input`,{className:`input input-mono`,value:c,placeholder:i.credential.placeholder,spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value)}),(0,$.jsxs)(`span`,{className:`hint`,children:[`The secret that holds it, as `,(0,$.jsx)(`code`,{children:`project/environment/KEY`}),`. An environment of its own, such as `,(0,$.jsx)(`code`,{children:`ops/sync`}),`, keeps it from everyone who reads these secrets. You need read access to it.`]})]}),(0,$.jsx)(k,{tone:`info`,children:i.credential.hint}),(0,$.jsx)(I,{error:p}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,type:`button`,onClick:r,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:f||g!==null||c.trim()===``,title:g===null?void 0:`${g} is required`,children:[f&&(0,$.jsx)(N,{}),`Start syncing`]})]})]})}var Ae=45;function je(){let{keys:e,syncs:t}=se.useLoaderData(),{project:n,environment:i}=se.useParams();return e.ok?(0,$.jsx)(Me,{project:n,environment:i,permissions:e.permissions,keys:e.keys,syncs:t},`${n}/${i}`):(0,$.jsx)(S,{icon:(0,$.jsx)(r,{size:18}),label:(0,$.jsxs)(`span`,{className:`mono`,children:[n,`/`,i]}),title:`This environment is closed to you`,actions:(0,$.jsxs)(te,{className:`btn`,to:`/projects/$project`,params:{project:n},children:[`Back to `,n]}),children:e.error})}function Me({project:e,environment:i,permissions:a,keys:s,syncs:l}){let u=C(),d=K(),f=`${e}/${i}`,[p,m]=(0,Z.useState)([]),[g,_]=(0,Z.useState)({}),[v,b]=(0,Z.useState)(()=>new Set),[S,w]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[O,te]=(0,Z.useState)(se.useSearch().filter??``),k=(0,Z.useRef)(0),A=a.includes(`secret.write`),j=a.includes(`secret.archive`),M=oe(a),P=s.filter(e=>!e.archived),F=s.filter(e=>e.archived),I=new Set(s.map(e=>e.key)),L=P.filter(e=>Q(g,e.key)!==void 0),R=me(P,p,g),z=[...p.map(e=>e.key.trim()),...L.flatMap(e=>{let t=Q(g,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],ie=z.some(e=>e===``),ae=z.some(e=>e!==``&&ce(e)!==null),B=p.length+L.length,V=B>0&&!ie&&!ae&&!R;function H(e,t){_(n=>{let r={...Q(n,e.key)??{key:e.key,value:null,archived:!1},...t};if(r.key!==e.key||r.value!==null||r.archived)return{...n,[e.key]:r};let{[e.key]:i,...a}=n;return a})}function W(e){_(t=>{let{[e]:n,...r}=t;return r}),b(t=>{let n=new Set(t);return n.delete(e),n})}function G(){m(e=>[{id:k.current++,key:``,value:``},...e])}function Y(){m([]),_({}),b(new Set),D(null)}async function X(){if(!V||S)return;w(!0),D(null);let e=await he({active:P,drafts:p,changes:g,operations:{rename:async(e,t)=>{try{await d.secrets.rename(`${f}/${e}`,t)}catch(t){throw new q(`${e}: ${U(t)}`)}},write:async e=>{try{await d.secrets.set(f,e)}catch(e){throw new q(U(e))}}}});if(m(e.drafts),_(e.changes),b(new Set),e.applied>0)try{await u.invalidate()}catch{D(`Saved, but the page could not refresh. Reload before you retry.`),w(!1);return}if(e.error===null)J.success(`Saved ${B} change${B===1?``:`s`}`);else{let t=e.error instanceof Error?e.error.message:`The request could not be sent.`;D(e.applied===0?t:`${t} The renames before it were saved; nothing else was, and the rest is ready to retry.`)}w(!1)}let le=(0,Z.useRef)(X);le.current=X,(0,Z.useEffect)(()=>{if(B===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),le.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B]);let ue=[...p.map(e=>({key:e.key.trim()||`unnamed`,what:I.has(e.key.trim())?`new version`:`added`})),...L.map(e=>{let t=Q(g,e.key);if(t.archived)return{key:e.key,what:`archived`};let n=t.key.trim()!==e.key;return n&&t.value!==null?{key:e.key,what:`→ ${t.key.trim()}, new value`}:n?{key:e.key,what:`→ ${t.key.trim()}`}:{key:e.key,what:`new value`}})],de=ie?null:R?`Two pending edits would end up with the same name. Secret names are unique in an environment.`:ae?`Names are letters, digits and underscores, and cannot start with a digit.`:null,fe=O.trim().toLowerCase(),pe=fe===``?P:P.filter(e=>e.key.toLowerCase().includes(fe));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(y,{tile:e,title:i,aside:(0,$.jsx)(Ne,{project:e,environment:i}),actions:(0,$.jsxs)($.Fragment,{children:[A&&M&&(0,$.jsx)(We,{project:e,environment:i}),A&&(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,disabled:S,children:[(0,$.jsx)(c,{size:14}),`New secret`]})]})}),(P.length>0||p.length>0)&&(0,$.jsxs)(`div`,{className:`toolbar`,children:[(0,$.jsxs)(`label`,{className:`filter input-group`,children:[(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Filter secrets by name`}),(0,$.jsx)(t,{size:14,className:`input-icon`}),(0,$.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:O,onChange:e=>te(e.target.value)})]}),(0,$.jsx)(`div`,{className:`toolbar-meta`,children:(0,$.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,$.jsx)(o,{size:14}),(0,$.jsxs)(`code`,{children:[`coffre run `,e,`/`,i,` -- …`]}),(0,$.jsx)(re,{value:`coffre run ${e}/${i} -- `,label:`Copy command`})]})})]}),(0,$.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:P.length===0&&p.length===0?(0,$.jsx)(ne,{title:`No secrets yet`,actions:A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,children:[(0,$.jsx)(c,{size:14}),`New secret`]}),M&&(0,$.jsx)(We,{project:e,environment:i})]}):void 0,children:A?`Add them one by one, or import an existing .env file. Nothing is written until you save, or until you have seen the import plan.`:`Nothing has been written to this environment, and adding the first secret needs secret.write.`}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(n,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(r,{size:14}),`Value`,!M&&(0,$.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(x,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsxs)(`tbody`,{children:[p.map(e=>(0,$.jsx)(ze,{draft:e,existingVersion:s.find(t=>t.key===e.key.trim())?.version??null,disabled:S,onChange:t=>m(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>m(t=>t.filter(t=>t.id!==e.id))},e.id)),pe.map(t=>{let n=Q(g,t.key);return(0,$.jsx)(Le,{number:P.indexOf(t)+1,project:e,environment:i,entry:t,change:n??{key:t.key,value:null,archived:!1},editing:n?.archived!==!0&&(v.has(t.key)||n!==void 0),canWrite:A,canArchive:j,canReveal:M,disabled:S,columns:6,onEdit:()=>b(e=>new Set(e).add(t.key)),onPatch:e=>H(t,e),onUndo:()=>W(t.key),onMarkArchive:()=>{b(e=>{let n=new Set(e);return n.delete(t.key),n}),_(e=>({...e,[t.key]:{key:t.key,value:null,archived:!0}}))}},t.key)}),pe.length===0&&P.length>0&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,O.trim(),`”.`]})})]})]})})}),(0,$.jsx)(be,{project:e,environment:i,result:l,canRun:A||a.includes(`environment.manage`)}),F.length>0&&(0,$.jsx)(T,{labelledBy:`archived-secrets`,title:`Archived`,description:(0,$.jsxs)($.Fragment,{children:[`Retired, so no longer served or injected by `,(0,$.jsx)(`code`,{children:`coffre run`}),`. Their history and audit trail are intact, and restoring is immediate.`]}),children:(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets secrets-archived stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(n,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(x,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:F.map((t,n)=>(0,$.jsx)(Be,{number:n+1,project:e,environment:i,entry:t,canArchive:j,canReveal:M},t.key))})]})})}),B>0&&(0,$.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,$.jsxs)(`div`,{className:`savebar-inner`,children:[(0,$.jsxs)(`span`,{className:`savebar-count`,children:[(0,$.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),B,` unsaved change`,B===1?``:`s`]}),(0,$.jsxs)(`span`,{className:`savebar-summary`,children:[ue.slice(0,3).map((e,t)=>(0,$.jsxs)(`span`,{children:[t>0&&` · `,(0,$.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),ue.length>3&&` · and ${ue.length-3} more`]}),(0,$.jsxs)(`div`,{className:`savebar-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-sm`,onClick:Y,disabled:S,children:`Discard`}),(0,$.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>void X(),disabled:S||!V,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[S&&(0,$.jsx)(N,{size:13}),`Save `,B===1?`change`:`${B} changes`]})]}),(E??de)!==null&&(0,$.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,$.jsx)(ee,{size:14}),(0,$.jsx)(`span`,{children:E??de})]})]})})]})}function Ne({project:e,environment:t}){let{projects:n}=E({from:`__root__`}),r=n.find(t=>t.slug===e)?.environments.find(e=>e.slug===t)?.name;return r===void 0?null:(0,$.jsx)($.Fragment,{children:r})}function Pe({masked:e,className:t=``,...n}){let[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{i(typeof CSS<`u`&&CSS.supports(`-webkit-text-security`,`disc`))},[]),(0,$.jsx)(`input`,{...n,type:e&&!r?`password`:`text`,className:`${t}${e&&r?` is-masked`:``}`,autoComplete:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0})}function Fe({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Z.useState)(!1);return(0,$.jsxs)(`div`,{className:`input-group`,children:[(0,$.jsx)(Pe,{className:`input input-mono`,masked:!s,"aria-label":e,placeholder:r,value:t,disabled:i,autoFocus:a,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&o!==void 0&&o()}}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm btn-icon input-addon`,"aria-label":s?`Mask the value`:`Show the value`,"aria-pressed":s,onClick:()=>c(e=>!e),children:s?(0,$.jsx)(m,{size:14}):(0,$.jsx)(v,{size:14})})]})}function Ie(e){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.ceil(Ae-(t-e.at)/1e3))}function Le({number:t,project:n,environment:r,entry:a,change:o,editing:s,canWrite:c,canArchive:u,canReveal:d,disabled:f,columns:p,onEdit:h,onPatch:g,onUndo:_,onMarkArchive:y}){let[x,S]=(0,Z.useState)(null),C=K(),[w,ee]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),[k,j]=(0,Z.useState)(null),F=_e(x,a.version)?x:null;(0,Z.useEffect)(()=>{x!==null&&!_e(x,a.version)&&S(null)},[x,a.version]),(0,Z.useEffect)(()=>{if(x===null)return;let e=setTimeout(()=>S(null),Ae*1e3);return()=>clearTimeout(e)},[x]);let L=Ie(F),R=s&&_e(k,a.version)?k:null;(0,Z.useEffect)(()=>{s||j(null)},[s]);async function z(){if(F!==null)return F.value;ee(!0);try{let{values:e}=await C.secrets.reveal(`${n}/${r}/${a.key}`),t=e[a.key];return ne(null),S({value:t,version:a.version,at:Date.now()}),t}catch(e){return ne(e instanceof ie?U(e):`The request could not be sent. Nothing was read.`),null}finally{ee(!1)}}function ae(){F===null?z():S(null)}let B=o.archived,V=o.key!==a.key,H=o.value!==null,W=s?ce(o.key.trim()):null,G=B?` is-leaving`:s&&(V||H)?` is-changed`:F===null?``:` is-revealed`,q=a.version??0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row${G}`,children:[(0,$.jsx)(`td`,{className:`n`,children:t}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,"aria-label":`Name for ${a.key}`,"aria-invalid":W!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>g({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&_()}}),(W!==null||V)&&(0,$.jsx)(`span`,{className:`edit-note${W===null?``:` edit-note-error`}`,children:W??(0,$.jsxs)($.Fragment,{children:[`Renamed from `,(0,$.jsx)(`span`,{className:`mono`,children:a.key})]})})]}):(0,$.jsxs)(`div`,{className:`key-cell`,children:[(0,$.jsx)(`span`,{children:P(a.key)}),B&&(0,$.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(Fe,{label:`New value for ${a.key}`,value:o.value??R?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>g({value:e===(R?.value??``)?null:e}),onEscape:_}),(0,$.jsxs)(`span`,{className:`edit-note`,children:[(0,$.jsx)(`span`,{children:H?`Saving appends v${q+1}; v${q} stays restorable.`:R===null?`Nothing is decrypted to edit. Left empty, v${q} stays current.`:`This is v${q}. Change it to append v${q+1}.`}),d&&!H&&R===null&&(0,$.jsxs)(`button`,{type:`button`,className:`act`,disabled:w,onClick:async()=>{let e=await z();e!==null&&j({value:e,version:a.version,at:Date.now()})},children:[w&&(0,$.jsx)(N,{size:12}),`Start from current value`]})]})]}):F!==null&&!B?(0,$.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Ae}s`},children:[(0,$.jsx)(`span`,{className:`revealed-value`,children:F.value===``?`(empty)`:F.value}),(0,$.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,L,`s`]}),(0,$.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:s&&H?(0,$.jsxs)(`span`,{className:`version-shift`,children:[`v`,q,` → `,(0,$.jsxs)(`b`,{children:[`v`,q+1]})]}):(0,$.jsx)(`span`,{className:`version-shift`,children:a.version===null?`—`:`v${a.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Re,{entry:a})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:B?(0,$.jsx)(A,{label:`Keep`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`Keep ${a.key}`,children:(0,$.jsx)(O,{size:14})})}):s?(0,$.jsx)(A,{label:V||H?`Undo changes`:`Cancel`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`${V||H?`Undo changes to`:`Stop editing`} ${a.key}`,children:V||H?(0,$.jsx)(O,{size:14}):(0,$.jsx)(e,{size:15})})}):(0,$.jsxs)($.Fragment,{children:[F!==null&&(0,$.jsx)(re,{variant:`act`,value:F.value,label:`Copy ${a.key}`}),(0,$.jsx)(X,{canReveal:d,children:(0,$.jsx)(A,{label:F===null?`Reveal`:`Hide`,children:(0,$.jsx)(`button`,{className:`act act-icon act-accent`,onClick:ae,disabled:w,"aria-label":`${F===null?`Reveal`:`Hide`} ${a.key}`,children:w?(0,$.jsx)(N,{size:13}):F===null?(0,$.jsx)(v,{size:15}):(0,$.jsx)(m,{size:15})})})}),c&&(0,$.jsx)(A,{label:`Edit`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>{F!==null&&j(F),S(null),h()},disabled:f,"aria-label":`Edit ${a.key}`,children:(0,$.jsx)(i,{size:14})})}),(d||u)&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${a.key}`,disabled:f,children:(0,$.jsx)(l,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsx)(X,{canReveal:d,children:(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>E(e=>!e),children:[(0,$.jsx)(D,{size:14}),T?`Hide history`:`Version history`]})}),u&&(0,$.jsxs)($.Fragment,{children:[d&&(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{S(null),y()},children:[(0,$.jsx)(b,{size:14}),`Archive`,(0,$.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),T&&d&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(Ve,{project:n,environment:r,secretKey:a.key,currentVersion:a.version,canWrite:c,onClose:()=>E(!1),onRolledBack:()=>S(null)})})}),te!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(I,{error:te})})})]})}function Re({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,$.jsxs)(`span`,{className:`written`,children:[(0,$.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{className:`cell-muted`,children:(0,$.jsx)(z,{iso:e.updatedAt,display:`relative`})})]})]})}function ze({draft:t,existingVersion:n,disabled:r,onChange:i,onRemove:a}){let[o,s]=(0,Z.useState)(!1),c=t.key.trim(),l=c===``?o?`Give it a name.`:null:ce(c),u=c!==``&&n!==null;return(0,$.jsxs)(`tr`,{className:`secret-row is-draft`,children:[(0,$.jsx)(`td`,{className:`n`,"aria-label":`New`,children:`+`}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`New secret`,children:(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,"aria-label":`Name of the new secret`,"aria-invalid":l!==null,placeholder:`NAME_OF_SECRET`,spellCheck:!1,autoComplete:`off`,value:t.key,disabled:r,onBlur:()=>s(!0),onChange:e=>i({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&a()}}),(l!==null||u)&&(0,$.jsx)(`span`,{className:`edit-note${l===null?``:` edit-note-error`}`,children:l??`This name already exists here. Saving appends a new version to it rather than creating a second secret.`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:(0,$.jsx)(`div`,{className:`edit-stack`,children:(0,$.jsx)(Fe,{label:`Value for ${c===``?`the new secret`:c}`,value:t.value,placeholder:`Value`,disabled:r,onChange:e=>i({value:e}),onEscape:a})})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:u?(0,$.jsxs)($.Fragment,{children:[`v`,n,` → `,(0,$.jsxs)(`b`,{children:[`v`,n+1]})]}):(0,$.jsx)(`b`,{children:`new`})})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,children:(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:(0,$.jsx)(A,{label:`Remove`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:a,disabled:r,"aria-label":c===``?`Remove this new secret`:`Remove new secret ${c}`,children:(0,$.jsx)(e,{size:15})})})})})]})}function Be({number:e,project:t,environment:n,entry:r,canArchive:i,canReveal:a}){let[o,s]=(0,Z.useState)(!1),c=K(),{pending:l,error:u,run:d}=Y();function f(e){d(()=>c.secrets.update(`${t}/${n}/${r.key}`,{archived:e}),()=>J.success(e?`${r.key} archived`:`${r.key} restored`,{action:{label:`Undo`,onClick:()=>f(!e)}}))}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row is-archived`,children:[(0,$.jsx)(`td`,{className:`n`,children:e}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:P(r.key)}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:r.version===null?`—`:`v${r.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Re,{entry:r})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsxs)(`div`,{className:`acts`,children:[(0,$.jsx)(X,{canReveal:a,children:(0,$.jsx)(A,{label:o?`Hide history`:`Version history`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:()=>s(e=>!e),"aria-label":`${o?`Hide history of`:`Version history of`} ${r.key}`,"aria-expanded":o,children:(0,$.jsx)(D,{size:15})})})}),i&&(0,$.jsx)(A,{label:`Restore`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>f(!1),disabled:l,"aria-label":`Restore ${r.key}`,children:l?(0,$.jsx)(N,{size:13}):(0,$.jsx)(O,{size:14})})})]})})]}),o&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(Ve,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>s(!1),onRolledBack:()=>void 0})})}),u!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(I,{error:u})})})]})}function Ve({project:e,environment:t,secretKey:n,currentVersion:r,canWrite:i,onClose:a,onRolledBack:o}){let[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),d=K(),{pending:f,error:p,run:m}=Y();return(0,Z.useEffect)(()=>{let r=!1;return d.secrets.history(`${e}/${t}/${n}`).then(e=>{r||(c(e.versions),u(null))}).catch(e=>{r||u(e instanceof ie?U(e):`The version history could not be loaded.`)}),()=>{r=!0}},[d,e,t,n,r]),(0,$.jsxs)(`div`,{className:`history`,children:[(0,$.jsxs)(`div`,{className:`history-head`,children:[(0,$.jsxs)(`span`,{className:`history-title th`,children:[(0,$.jsx)(D,{size:14}),`Versions of `,(0,$.jsx)(`span`,{className:`mono`,children:n})]}),(0,$.jsx)(`button`,{className:`act`,onClick:a,children:`Close`})]}),l===null?s===null?(0,$.jsxs)(`p`,{className:`hint history-body`,children:[(0,$.jsx)(N,{size:13}),` Loading versions…`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Written (UTC)`}),(0,$.jsx)(`th`,{children:`By`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Key id`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:s.map(r=>(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,r.version,` `,r.current&&(0,$.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,$.jsx)(`td`,{className:`nowrap`,children:(0,$.jsx)(z,{iso:r.createdAt})}),(0,$.jsx)(`td`,{children:r.createdBy}),(0,$.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:r.kek}),(0,$.jsx)(`td`,{className:`col-actions`,children:i&&!r.current&&(0,$.jsx)(F,{trigger:(0,$.jsxs)(`button`,{className:`act`,disabled:f,children:[(0,$.jsx)(O,{size:13}),`Roll back`]}),title:(0,$.jsxs)($.Fragment,{children:[`Roll `,(0,$.jsx)(`span`,{className:`mono`,children:n}),` back to v`,r.version,`?`]}),body:(0,$.jsxs)($.Fragment,{children:[`The current pointer moves to v`,r.version,`. Nothing is copied or deleted, every version stays readable, and the next write continues the numbering forward. Anything reading`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]}),` `,`picks up the change immediately.`]}),confirmLabel:`Roll back to v${r.version}`,destructive:!1,onConfirm:()=>m(()=>d.secrets.restore(`${e}/${t}/${n}`,r.version),()=>{o(),J.success(`${n} rolled back to v${r.version}`)})})})]},r.version))})]})}):(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:l})}),p!==null&&(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:p})}),(0,$.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var He={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function Ue(e,t,n){let r=ue(n);return r.entries.length===0?{plan:[],changes:{},problems:r.problems}:{...await H(e,t,r.entries),problems:r.problems}}function We({project:e,environment:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!1),u=K(),{pending:d,error:f,setError:m,run:h}=Y(),g=`${e}/${t}`;function _(){h(()=>Ue(u,g,n),e=>{s(e.problems),a({entries:e.plan,changes:e.changes})})}function v(){if(i===null)return;let e=Object.keys(i.changes).length;h(()=>u.secrets.set(g,i.changes),()=>{J.success(`Imported ${e} change${e===1?``:`s`}`),y()})}function y(){l(!1),a(null),r(``),s([]),m(null)}let b=i?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn`,onClick:()=>l(!0),children:[(0,$.jsx)(p,{size:14}),`Import .env`]}),(0,$.jsx)(R,{open:c,onOpenChange:e=>e?l(!0):y(),title:(0,$.jsxs)($.Fragment,{children:[`Import into`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),wide:!0,description:(0,$.jsx)($.Fragment,{children:`Paste a .env file. It is read by the CLI’s own parser, so this page and the CLI cannot disagree about what it means, and malformed lines are reported rather than guessed at. coffre compares it with the current values without sending any to this page.`}),children:(0,$.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`File contents`}),(0,$.jsx)(`textarea`,{className:`textarea`,autoFocus:!0,spellCheck:!1,placeholder:`DATABASE_URL=postgres://…
3
3
  STRIPE_KEY="sk_live_…"`,value:n,onChange:e=>{r(e.target.value),a(null),s([])}})]}),i!==null&&i.entries.length>0&&(0,$.jsx)(`div`,{className:`card dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Key`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,$.jsx)(`tbody`,{children:i.entries.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`cell-key`,children:P(e.key)}),(0,$.jsx)(`td`,{className:`col-shrink`,children:(0,$.jsx)(`span`,{className:He[e.action],children:e.action})}),(0,$.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),i!==null&&i.entries.length>0&&b.length===0&&(0,$.jsx)(k,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),o.length>0&&(0,$.jsxs)(k,{tone:`bad`,children:[(0,$.jsxs)(`strong`,{children:[o.length,` line`,o.length===1?``:`s`,` could not be parsed`]}),(0,$.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:o.map(e=>(0,$.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,$.jsx)(I,{error:f}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,onClick:y,children:`Cancel`}),i===null?(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||n.trim()===``,onClick:_,children:[d&&(0,$.jsx)(N,{}),`Preview changes`]}):(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||b.length===0,onClick:v,children:[d&&(0,$.jsx)(N,{}),`Write `,b.length,` change`,b.length===1?``:`s`]})]})]})})]})}export{je as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-Dzgf95zv.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/grants-4mSkXPU4.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r}from"./grants-4mSkXPU4.js";var i=e(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:e},params:t})=>r(e,t.project),component:n(()=>t(()=>import(`./projects._project.index-Dzgf95zv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-Chcf-cUd.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/grants-DavcwofW.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r}from"./grants-DavcwofW.js";var i=e(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:e},params:t})=>r(e,t.project),component:n(()=>t(()=>import(`./projects._project.index-Chcf-cUd.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};