@coffre/ui 0.1.11 → 0.1.13

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 (122) hide show
  1. package/dist/client/_coffre/assets/account-CyJDFhek.js +2 -0
  2. package/dist/client/_coffre/assets/account-DHSs5h2f.js +1 -0
  3. package/dist/client/_coffre/assets/affordances-BQD5B421.js +1 -0
  4. package/dist/client/_coffre/assets/audit-Bcyp_dU1.js +2 -0
  5. package/dist/client/_coffre/assets/audit-rMy9mU9Q.js +1 -0
  6. package/dist/client/_coffre/assets/auth.device-DuvaComb.js +1 -0
  7. package/dist/client/_coffre/assets/{auth.device-CWHNQn9W.js → auth.device-yBt_sLZW.js} +2 -2
  8. package/dist/client/_coffre/assets/directory-C4BMGC7-.js +1 -0
  9. package/dist/client/_coffre/assets/dist-BNkBTkxj.js +1 -0
  10. package/dist/client/_coffre/assets/{globals-CKBoTlyH.css → globals-BJkzu6T5.css} +1 -1
  11. package/dist/client/_coffre/assets/{grants-CjoOnxzz.js → grants-CyDW25eX.js} +1 -1
  12. package/dist/client/_coffre/assets/icons-BRl8DlXW.js +1 -0
  13. package/dist/client/_coffre/assets/{index-CUGytaO3.js → index-CA1mtrIx.js} +5 -5
  14. package/dist/client/_coffre/assets/link-CqlAJWBd.js +1 -0
  15. package/dist/client/_coffre/assets/login-B73b6bsJ.js +1 -0
  16. package/dist/client/_coffre/assets/login-BO1KAGPU.js +2 -0
  17. package/dist/client/_coffre/assets/offboarding--5vSKNHv.js +1 -0
  18. package/dist/client/_coffre/assets/page-Dngv8FMr.js +1 -0
  19. package/dist/client/_coffre/assets/preload-helper-DBha3tys.js +1 -0
  20. package/dist/client/_coffre/assets/principal-page-C4qDD-d8.js +1 -0
  21. package/dist/client/_coffre/assets/projects._project._environment-eBKxOZ0_.js +2 -0
  22. package/dist/client/_coffre/assets/projects._project._environment-or_AX6o5.js +3 -0
  23. package/dist/client/_coffre/assets/projects._project.index-DHdXfEh-.js +2 -0
  24. package/dist/client/_coffre/assets/projects._project.index-iynQgenH.js +1 -0
  25. package/dist/client/_coffre/assets/projects.index-CGW8mRil.js +1 -0
  26. package/dist/client/_coffre/assets/row-state-BlarvG7E.js +1 -0
  27. package/dist/client/_coffre/assets/{settings-D2zp1Ssu.js → settings-D-7RJIDf.js} +1 -1
  28. package/dist/client/_coffre/assets/suspense-q_eJaZ18.js +1 -0
  29. package/dist/client/_coffre/assets/tokens._token-0u7midqA.js +2 -0
  30. package/dist/client/_coffre/assets/tokens._token-C53NqScg.js +1 -0
  31. package/dist/client/_coffre/assets/{tokens.index-CSi5Wxwf.js → tokens.index-DBZTLnbi.js} +1 -1
  32. package/dist/client/_coffre/assets/{ui-BdipqGpP.js → ui-BPWFJNz7.js} +3 -3
  33. package/dist/client/_coffre/assets/{unregistered-CA7B4C1m.js → unregistered-CLhgtwUt.js} +1 -1
  34. package/dist/client/_coffre/assets/use-action-LULgF26O.js +1 -0
  35. package/dist/client/_coffre/assets/{use-change-BRRMJocl.js → use-change-Bd6NZJj9.js} +1 -1
  36. package/dist/client/_coffre/assets/use-shell-Dx92Huhb.js +1 -0
  37. package/dist/client/_coffre/assets/useQuery-BIIZz1CB.js +1 -0
  38. package/dist/client/_coffre/assets/useSuspenseQuery-tP9HFZ8w.js +1 -0
  39. package/dist/client/_coffre/assets/users._user-BXtaL8Ee.js +2 -0
  40. package/dist/client/_coffre/assets/users._user-CNYVkXaY.js +1 -0
  41. package/dist/client/_coffre/assets/{users.index-CKnQ1G76.js → users.index-Cs9tibIv.js} +1 -1
  42. package/dist/server/.vite/manifest.json +205 -206
  43. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-T9tMsCwo.js +162 -0
  44. package/dist/server/_coffre/assets/{account-BocTPU1J.js → account-BUhhOS5-.js} +8 -8
  45. package/dist/server/_coffre/assets/{account-CL8hOGhO.js → account-B_h55GCs.js} +4 -4
  46. package/dist/server/_coffre/assets/{audit-Bcka4vA6.js → audit-B8Ck358-.js} +6 -6
  47. package/dist/server/_coffre/assets/{audit-CSRQYIhu.js → audit-DFsXfeAQ.js} +2 -2
  48. package/dist/server/_coffre/assets/{auth.device-DqO0T-rU.js → auth.device-BXf_JjT7.js} +2 -2
  49. package/dist/server/_coffre/assets/{auth.device-CMcUISZY.js → auth.device-cqjWACvB.js} +4 -4
  50. package/dist/server/_coffre/assets/{directory-CyYx6Jx1.js → directory-C9SfNgpM.js} +5 -5
  51. package/dist/server/_coffre/assets/{globals-CKBoTlyH.css → globals-BJkzu6T5.css} +1 -1
  52. package/dist/server/_coffre/assets/{grants-CRijabX0.js → grants--315KmXu.js} +5 -5
  53. package/dist/server/_coffre/assets/{icons-Dy-5ccDF.js → icons-CWsTEfpn.js} +123 -241
  54. package/dist/server/_coffre/assets/{login-BI9tzJEy.js → login-CQSkYW_D.js} +5 -5
  55. package/dist/server/_coffre/assets/{login-C-v88YwP.js → login-LBpXXfsQ.js} +1 -1
  56. package/dist/server/_coffre/assets/{offboarding-1H0LavTd.js → offboarding-CykelNis.js} +9 -79
  57. package/dist/server/_coffre/assets/{page-D_mO0-sn.js → page-BGeDoQO5.js} +3 -64
  58. package/dist/server/_coffre/assets/{principal-page-DQDoXute.js → principal-page-CRdoAQOq.js} +11 -11
  59. package/dist/server/_coffre/assets/{projects._project._environment-D_5R40of.js → projects._project._environment-BXU1Mee5.js} +3 -3
  60. package/dist/server/_coffre/assets/{projects._project._environment-C-yVwC92.js → projects._project._environment-BrDqn8kW.js} +11 -550
  61. package/dist/server/_coffre/assets/{projects._project.index-A2BImFIT.js → projects._project.index-CAxBU4tY.js} +12 -12
  62. package/dist/server/_coffre/assets/{projects._project.index-BPPKxKrt.js → projects._project.index-CYyUVTCl.js} +2 -2
  63. package/dist/server/_coffre/assets/{projects.index-543IsPzY.js → projects.index-D6ZoDE_0.js} +7 -7
  64. package/dist/server/_coffre/assets/{router-CM3vK8QO.js → router-Bu2qtyqw.js} +20 -20
  65. package/dist/server/_coffre/assets/{row-state-XBtDoIA4.js → row-state-CAItu3n_.js} +2 -2
  66. package/dist/server/_coffre/assets/{settings-BLVU74ym.js → settings-ByeF6hBa.js} +3 -3
  67. package/dist/server/_coffre/assets/{suspense-CzYTwxOj.js → suspense-beD01bb8.js} +1 -1
  68. package/dist/server/_coffre/assets/{tokens._token-B-hBgwBW.js → tokens._token-CM01QPCq.js} +2 -2
  69. package/dist/server/_coffre/assets/{tokens._token-aubAUonP.js → tokens._token-D2E4P3Qc.js} +10 -10
  70. package/dist/server/_coffre/assets/{tokens.index-4D3jwp5v.js → tokens.index-Cmrgn3mU.js} +6 -6
  71. package/dist/server/_coffre/assets/{ui-BI3Bf72q.js → ui-DvlGkmaH.js} +1 -1
  72. package/dist/server/_coffre/assets/{unregistered-CagDxMyw.js → unregistered-DSArejP9.js} +3 -3
  73. package/dist/server/_coffre/assets/{use-action-tzBZvjjQ.js → use-action-C2wz34kq.js} +2 -2
  74. package/dist/server/_coffre/assets/{use-change-Dggqxy5y.js → use-change-CJpGSNIq.js} +3 -3
  75. package/dist/server/_coffre/assets/{use-shell-CwStDfzX.js → use-shell-C3iYcyP1.js} +2 -2
  76. package/dist/server/_coffre/assets/{useQuery-C6_dBjem.js → useQuery-ChxaQ4Cb.js} +2 -2
  77. package/dist/server/_coffre/assets/{useSuspenseQuery-BuapQt_P.js → useSuspenseQuery-BjAmlGZl.js} +2 -2
  78. package/dist/server/_coffre/assets/{users._user-C252Iilj.js → users._user-BVeR9fZP.js} +2 -2
  79. package/dist/server/_coffre/assets/{users._user-137WNyxn.js → users._user-Cih2Etf4.js} +2 -2
  80. package/dist/server/_coffre/assets/{users.index-DQHsfnal.js → users.index-Bo2_a95G.js} +6 -6
  81. package/dist/server/index.js +2 -2
  82. package/package.json +3 -3
  83. package/src/components/icons.tsx +0 -34
  84. package/src/components/offboarding.tsx +1 -52
  85. package/src/lib/coffre.ts +1 -1
  86. package/src/lib/queries.ts +2 -10
  87. package/src/routes/projects.$project.$environment.tsx +1 -11
  88. package/src/shared/models.ts +1 -5
  89. package/src/styles/globals.css +2 -49
  90. package/dist/client/_coffre/assets/account-BJAdDvZf.js +0 -2
  91. package/dist/client/_coffre/assets/account-D0jLpk5c.js +0 -1
  92. package/dist/client/_coffre/assets/affordances-Bq2-oUB5.js +0 -1
  93. package/dist/client/_coffre/assets/audit-C-pcBgKe.js +0 -2
  94. package/dist/client/_coffre/assets/audit-CHGlDeBB.js +0 -1
  95. package/dist/client/_coffre/assets/auth.device-BndOUjse.js +0 -1
  96. package/dist/client/_coffre/assets/directory-nDExpkAz.js +0 -1
  97. package/dist/client/_coffre/assets/dist-QVHMLatb.js +0 -1
  98. package/dist/client/_coffre/assets/icons-BQ27Ds9u.js +0 -1
  99. package/dist/client/_coffre/assets/link-DP8SVWon.js +0 -1
  100. package/dist/client/_coffre/assets/login-CeaxDMcr.js +0 -2
  101. package/dist/client/_coffre/assets/login-DrMgvqZn.js +0 -1
  102. package/dist/client/_coffre/assets/offboarding-CNr_1tnl.js +0 -1
  103. package/dist/client/_coffre/assets/page-CGmvjSy4.js +0 -1
  104. package/dist/client/_coffre/assets/preload-helper-ClBkJ19f.js +0 -1
  105. package/dist/client/_coffre/assets/principal-page-DNLb_q_e.js +0 -1
  106. package/dist/client/_coffre/assets/projects._project._environment-CHzbboGp.js +0 -3
  107. package/dist/client/_coffre/assets/projects._project._environment-DDxu_HHD.js +0 -2
  108. package/dist/client/_coffre/assets/projects._project.index-CIAsjvg6.js +0 -2
  109. package/dist/client/_coffre/assets/projects._project.index-DZ9l6d-1.js +0 -1
  110. package/dist/client/_coffre/assets/projects.index-4eUXreE_.js +0 -1
  111. package/dist/client/_coffre/assets/row-state-ByET1OKX.js +0 -1
  112. package/dist/client/_coffre/assets/suspense-C7KwSnTG.js +0 -1
  113. package/dist/client/_coffre/assets/tokens._token-DWmbqzNk.js +0 -2
  114. package/dist/client/_coffre/assets/tokens._token-Dui_4KfS.js +0 -1
  115. package/dist/client/_coffre/assets/use-action-DRm9yVhV.js +0 -1
  116. package/dist/client/_coffre/assets/use-shell-BMGlJ25Q.js +0 -1
  117. package/dist/client/_coffre/assets/useQuery-D__2KBOs.js +0 -1
  118. package/dist/client/_coffre/assets/useSuspenseQuery-CSXyDALB.js +0 -1
  119. package/dist/client/_coffre/assets/users._user-BkNrX7Qf.js +0 -1
  120. package/dist/client/_coffre/assets/users._user-jbSvtdOg.js +0 -2
  121. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-Dx-c3XVk.js +0 -162
  122. package/src/components/syncs.tsx +0 -597
@@ -1,3 +0,0 @@
1
- import{C as e,G as t,J as n,S as r,U as i,W as a,X as o,Y as s,Z as c,c as l,et as u,g as d,h as f,i as p,n as m,o as h,q as g,t as _,w as v,y}from"./page-CGmvjSy4.js";import{t as b}from"./link-DP8SVWon.js";import{f as x}from"./suspense-C7KwSnTG.js";import{C as S,a as C,n as w,r as T,t as E,v as ee,w as D,x as O}from"./use-change-BRRMJocl.js";import{t as k}from"./use-shell-BMGlJ25Q.js";import{t as A}from"./useSuspenseQuery-CSXyDALB.js";import{n as j}from"./dist-QVHMLatb.js";import{a as M,c as N,d as P,h as F,i as te,l as I,n as L,o as R,p as z,r as ne,s as B,t as V,u as H}from"./ui-BdipqGpP.js";import{i as U}from"./affordances-Bq2-oUB5.js";import{A as re,D as W,F as G,H as K,J as q,M as ie,P as J,S as ae,U as oe,V as se,W as ce,d as le,f as Y,g as X,h as ue,i as de,j as fe,k as pe,l as me,n as he,r as ge,v as _e}from"./icons-BQ27Ds9u.js";import{a as ve,i as ye,r as be}from"./row-state-ByET1OKX.js";import{t as xe}from"./projects._project._environment-DDxu_HHD.js";import{t as Z}from"./use-action-DRm9yVhV.js";import{t as Se}from"./validation-9Cl_XS-l.js";var Ce=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function we(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(!Ce.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=Ee(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=De(u.slice(1,e)),Te(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),Te(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 Te(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function Ee(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function De(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
2
- `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Q=u(c(),1);function Oe(e,t){return e!==null&&e.version===t}var $=i(),ke=2e3,Ae=6e4;function je({project:t,environment:n,canRun:r}){let i={project:t,environment:n},{data:a}=A({...f.syncs(e(),i),refetchInterval:e=>e.state.data?.ok===!0&&e.state.data.syncs.some(e=>e.running)?ke:!1});if(a.ok&&a.syncs.length===0&&!a.canManage)return null;let o=a.ok&&a.canManage;return(0,$.jsx)(_,{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)(Re,{project:t,environment:n}):void 0,children:a.ok?a.syncs.length===0?(0,$.jsxs)(te,{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:a.syncs.map(e=>(0,$.jsx)(Me,{place:i,sync:e,canRun:r,canManage:o},e.id))})]})}):(0,$.jsx)(`div`,{className:`card-body`,children:(0,$.jsx)(M,{error:a.error})})})}function Me({place:t,sync:n,canRun:r,canManage:i}){let[a,o]=(0,Q.useState)(!1),s=e(),c=Z(),l=Z(),u=c.pending||l.pending,d=c.error??l.error;function f(){c.run(()=>s.syncs.run(n.id),{affects:h.syncs(t),onSuccess:e=>Fe(n,e.outcome)})}function p(e){l.run(()=>s.syncs.update(n.id,{paused:e}),{affects:h.syncs(t),onSuccess:()=>j.success(e?`Paused ${n.destination}`:`Resumed ${n.destination}`,{action:{label:`Undo`,onClick:()=>p(!e)}})})}let m=d??(n.offered?n.lastError:null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:m!==null&&!n.running?`has-error`:void 0,children:[(0,$.jsx)(`td`,{className:`col-destination`,children:(0,$.jsxs)(`span`,{className:`cell-account`,children:[(0,$.jsx)(K,{brand:n.brand,size:15}),(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(`span`,{children:n.providerLabel}),n.offered?(0,$.jsx)(`small`,{className:`mono`,children:n.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)(Ne,{sync:n}),(0,$.jsx)(`small`,{children:(0,$.jsx)(Pe,{sync:n})})]})}),(0,$.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:n.credential}),(0,$.jsxs)(`td`,{className:`col-actions`,children:[(0,$.jsxs)(`div`,{className:`acts`,children:[r&&!n.paused&&(0,$.jsxs)(`button`,{className:`act`,onClick:f,disabled:u||n.running||!n.offered,title:n.offered?void 0:`This deployment no longer offers this provider`,children:[c.pending?(0,$.jsx)(N,{size:13}):(0,$.jsx)(se,{size:13}),`Run now`]}),i&&(0,$.jsxs)(F.Root,{children:[(0,$.jsx)(F.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${n.destination}`,disabled:u,children:(0,$.jsx)(W,{size:16})})}),(0,$.jsx)(F.Portal,{children:(0,$.jsxs)(F.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsxs)(F.Item,{className:`menu-item`,onSelect:()=>p(!n.paused),children:[n.paused?(0,$.jsx)(fe,{size:14}):(0,$.jsx)(pe,{size:14}),n.paused?`Resume`:`Pause`]}),(0,$.jsx)(F.Separator,{className:`menu-sep`}),(0,$.jsxs)(F.Item,{className:`menu-item menu-item-danger`,onSelect:()=>o(!0),children:[(0,$.jsx)(q,{size:14}),`Remove`]})]})})]})]}),(0,$.jsx)(L,{open:a,onOpenChange:o,title:(0,$.jsxs)($.Fragment,{children:[`Stop syncing to `,(0,$.jsx)(`span`,{className:`mono`,children:n.destination}),`?`]}),body:`Nothing more is pushed to ${n.providerLabel}. Keys coffre already pushed stay there; remove them at ${n.providerLabel} if they should go too.`,confirmLabel:`Remove sync`,onConfirm:()=>l.run(()=>s.syncs.remove(n.id),{affects:h.syncs(t),onSuccess:()=>j.success(`No longer syncing to ${n.destination}`)})})]})]}),m!==null&&!n.running&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:4,children:(0,$.jsx)(M,{error:m})})})]})}function Ne({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 Pe({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)(P,{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)(ge,{size:11}),t,` skipped`]})})),e.lastRunAt!==null&&n.push((0,$.jsx)(I,{iso:e.lastRunAt,display:`relative`})),(0,$.jsx)($.Fragment,{children:n.map((e,t)=>(0,$.jsxs)(Q.Fragment,{children:[t>0&&` · `,e]},t))})}function Fe(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(`${Le(n.join(`, `))} to ${e.destination}`)}}async function Ie(e,t,n,i){let a=j.loading(`Pushing to ${n.destination}`,{description:`The first push is under way.`}),o=Date.now()+Ae;for(;Date.now()<o;){await new Promise(e=>setTimeout(e,ke));let o=await r(()=>e.syncs.list(t)),s=o.ok?o.syncs.find(e=>e.id===n.id):void 0;if(!(s===void 0||s.running||s.lastRunAt===null)){await i(),s.lastStatus===`failed`?j.error(`Could not sync to ${n.destination}`,{id:a,description:s.lastError??void 0}):s.lastStatus===`partial`?j.warning(`Synced to ${n.destination}, but not every key`,{id:a,description:s.lastError??void 0}):j.success(`Synced to ${n.destination}`,{id:a,description:`${s.synced} ${s.synced===1?`key is`:`keys are`} there now.`});return}}await i(),j(`Still pushing to ${n.destination}`,{id:a,description:`Its result appears in the list when it ends.`})}function Le(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Re({project:e,environment:t}){let[n,r]=(0,Q.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,$.jsx)(ie,{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)(ze,{children:n=>(0,$.jsx)(Be,{project:e,environment:t,providers:n,onDone:()=>r(!1)})})})]})}function ze({children:t}){let n=e(),[i,a]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let e=!0;return r(()=>n.syncs.providers()).then(t=>{e&&a(t)}),()=>{e=!1}},[n]),i===null?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[(0,$.jsx)(N,{size:13}),`Loading where coffre can sync to…`]}):i.ok?i.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.`]}):t(i.providers):(0,$.jsx)(`div`,{className:`sync-providers-state`,children:(0,$.jsx)(M,{error:i.error})})}function Be({project:r,environment:i,providers:a,onDone:o}){let[c,l]=(0,Q.useState)(a[0]),[u,f]=(0,Q.useState)(()=>n(a[0])),[p,m]=(0,Q.useState)(``),_=e(),v=x(),{pending:y,error:b,setError:S,run:C}=Z(),w=g(c,u);function T(e){l(e),f(n(e)),S(null)}function E(e,t){f(n=>({...n,[e]:t}))}return(0,$.jsxs)(`form`,{className:`form`,style:{marginTop:`1.25rem`},onSubmit:e=>{e.preventDefault(),C(()=>_.syncs.add(`${r}/${i}`,{provider:c.id,config:t(c,u),credential:p.trim()}),{affects:h.syncs({project:r,environment:i}),onSuccess:e=>{o(),Ie(_,`${r}/${i}`,e,()=>d(v,h.syncs({project:r,environment:i})))}})},children:[a.length>1&&(0,$.jsx)(`div`,{className:`choice-grid sync-providers`,role:`group`,"aria-label":`Destination`,children:a.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e.id===c.id,onClick:()=>T(e),children:[(0,$.jsx)(K,{brand:e.brand}),e.label]},e.id))}),(0,$.jsx)(`div`,{className:`form-row`,children:c.fields.map(e=>{if(!s(e,u))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:u[e.name],placeholder:e.placeholder,spellCheck:!1,autoComplete:`off`,onChange:t=>E(e.name,t.target.value)}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${c.id}.${e.name}`);let t=u[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:()=>E(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})]},`${c.id}.${e.name}`)})}),(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`Token`}),(0,$.jsx)(`input`,{className:`input input-mono`,value:p,placeholder:c.credential.placeholder,spellCheck:!1,autoComplete:`off`,onChange:e=>m(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)(B,{tone:`info`,children:c.credential.hint}),(0,$.jsx)(M,{error:b}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,type:`button`,onClick:o,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:y||w!==null||p.trim()===``,title:w===null?void 0:`${w} is required`,children:[y&&(0,$.jsx)(N,{}),`Start syncing`]})]})]})}var Ve=45;function He(){let{project:t,environment:n}=xe.useParams(),{data:r}=A(f.secrets(e(),{project:t,environment:n}));return r.ok?(0,$.jsx)(Ue,{project:t,environment:n,permissions:r.permissions,keys:r.keys},`${t}/${n}`):(0,$.jsx)(m,{icon:(0,$.jsx)(ae,{size:18}),label:(0,$.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]}),title:`This environment is closed to you`,actions:(0,$.jsxs)(b,{className:`btn`,to:`/projects/$project`,params:{project:t},children:[`Back to `,t]}),children:r.error})}function Ue({project:t,environment:n,permissions:r,keys:i}){let a=e(),{principal:o}=k(),s=E(O(a,{project:t,environment:n},o?.id??null)),c=E(ee(a,{project:t,environment:n})),u=E(C(a,{project:t,environment:n})),{status:d,dismiss:f}=w(l.secrets({project:t,environment:n})),[m,h]=(0,Q.useState)([]),[g,b]=(0,Q.useState)({}),[x,A]=(0,Q.useState)(()=>new Set),[M,N]=(0,Q.useState)(null),[P,F]=(0,Q.useState)(xe.useSearch().filter??``),I=(0,Q.useRef)(0),L=r.includes(`secret.write`),R=r.includes(`secret.archive`),z=v(r),B=i.filter(e=>!e.archived),V=i.filter(e=>e.archived),H=new Set(i.map(e=>e.key)),U=B.filter(e=>D(g,e.key)!==void 0),re=S(B,m,g),W=[...m.map(e=>e.key.trim()),...U.flatMap(e=>{let t=D(g,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],K=W.some(e=>e===``),q=W.some(e=>e!==``&&Se(e)!==null),J=m.length+U.length,se=J>0&&!K&&!q&&!re;function ce(e,t){b(n=>{let r={...D(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 le(e){b(t=>{let{[e]:n,...r}=t;return r}),A(t=>{let n=new Set(t);return n.delete(e),n})}function Y(){h(e=>[{id:I.current++,key:``,value:``},...e])}function X(){h([]),b({}),A(new Set),N(null);for(let e of i){let t=d(e.key);t.state===`failed`&&f(t.mutationId)}}function de(){if(!se)return;let e={active:B,drafts:m,changes:g};h([]),b({}),A(new Set),N(null),s(e,{onError:t=>{let n=t instanceof T?t.outcome:e;h(n.drafts),b(n.changes),N(y(t))}})}function fe(e){c({key:e},{onSuccess:()=>j.success(`${e} restored`,{action:{label:`Undo`,onClick:()=>u({key:e})}})})}let pe=(0,Q.useRef)(de);pe.current=de,(0,Q.useEffect)(()=>{if(J===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),pe.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[J]);let ge=[...m.map(e=>({key:e.key.trim()||`unnamed`,what:H.has(e.key.trim())?`new version`:`added`})),...U.map(e=>{let t=D(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`}})],ve=K?null:re?`Two pending edits would end up with the same name. Secret names are unique in an environment.`:q?`Names are letters, digits and underscores, and cannot start with a digit.`:null,ye=P.trim().toLowerCase(),be=ye===``?B:B.filter(e=>e.key.toLowerCase().includes(ye));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{tile:t,title:n,aside:(0,$.jsx)(We,{project:t,environment:n}),actions:(0,$.jsxs)($.Fragment,{children:[L&&z&&(0,$.jsx)(tt,{project:t,environment:n}),L&&(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:Y,children:[(0,$.jsx)(ie,{size:14}),`New secret`]})]})}),(B.length>0||m.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)(G,{size:14,className:`input-icon`}),(0,$.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:P,onChange:e=>F(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)(oe,{size:14}),(0,$.jsxs)(`code`,{children:[`coffre run `,t,`/`,n,` -- …`]}),(0,$.jsx)(ne,{value:`coffre run ${t}/${n} -- `,label:`Copy command`})]})})]}),(0,$.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:B.length===0&&m.length===0?(0,$.jsx)(te,{title:`No secrets yet`,actions:L?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:Y,children:[(0,$.jsx)(ie,{size:14}),`New secret`]}),z&&(0,$.jsx)(tt,{project:t,environment:n})]}):void 0,children:L?`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)(_e,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(ae,{size:14}),`Value`,!z&&(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)(ue,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(me,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsxs)(`tbody`,{children:[m.map(e=>(0,$.jsx)(Xe,{draft:e,existingVersion:i.find(t=>t.key===e.key.trim())?.version??null,disabled:!1,onChange:t=>h(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>h(t=>t.filter(t=>t.id!==e.id))},e.id)),be.map(e=>{let r=D(g,e.key),i=d(e.key);return(0,$.jsx)(Je,{number:B.indexOf(e)+1,project:t,environment:n,entry:e,change:r??{key:e.key,value:null,archived:!1},editing:r?.archived!==!0&&(x.has(e.key)||r!==void 0),canWrite:L,canArchive:R,canReveal:z,status:i,disabled:i.state===`pending`,columns:6,onEdit:()=>A(t=>new Set(t).add(e.key)),onPatch:t=>ce(e,t),onUndo:()=>le(e.key),onMarkArchive:()=>{A(t=>{let n=new Set(t);return n.delete(e.key),n}),b(t=>({...t,[e.key]:{key:e.key,value:null,archived:!0}}))}},e.key)}),be.length===0&&B.length>0&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,P.trim(),`”.`]})})]})]})})}),(0,$.jsx)(je,{project:t,environment:n,canRun:L||r.includes(`environment.manage`)}),V.length>0&&(0,$.jsx)(_,{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)(_e,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(ue,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(me,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:V.map((e,r)=>(0,$.jsx)(Ze,{number:r+1,project:t,environment:n,entry:e,canArchive:R,canReveal:z,status:d(e.key),onRestore:()=>fe(e.key),onDismiss:f},e.key))})]})})}),J>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}),J,` unsaved change`,J===1?``:`s`]}),(0,$.jsxs)(`span`,{className:`savebar-summary`,children:[ge.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}`)),ge.length>3&&` · and ${ge.length-3} more`]}),(0,$.jsxs)(`div`,{className:`savebar-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-sm`,onClick:X,children:`Discard`}),(0,$.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:de,disabled:!se,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[`Save `,J===1?`change`:`${J} changes`]})]}),(M??ve)!==null&&(0,$.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,$.jsx)(he,{size:14}),(0,$.jsx)(`span`,{children:M??ve})]})]})})]})}function We({project:e,environment:t}){let{projects:n}=k(),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 Ge({masked:e,className:t=``,...n}){let[r,i]=(0,Q.useState)(!1);return(0,Q.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 Ke({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Q.useState)(!1);return(0,$.jsxs)(`div`,{className:`input-group`,children:[(0,$.jsx)(Ge,{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)(Y,{size:14}):(0,$.jsx)(le,{size:14})})]})}function qe(e){let[t,n]=(0,Q.useState)(()=>Date.now());return(0,Q.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(Ve-(t-e.at)/1e3))}function Je({number:t,project:n,environment:r,entry:i,change:o,editing:s,canWrite:c,canArchive:l,canReveal:u,status:d,disabled:f,columns:p,onEdit:m,onPatch:h,onUndo:g,onMarkArchive:_}){let[v,b]=(0,Q.useState)(null),x=e(),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,ee]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(null),k=Oe(v,i.version)?v:null;(0,Q.useEffect)(()=>{v!==null&&!Oe(v,i.version)&&b(null)},[v,i.version]),(0,Q.useEffect)(()=>{if(v===null)return;let e=setTimeout(()=>b(null),Ve*1e3);return()=>clearTimeout(e)},[v]);let A=qe(k),j=s&&Oe(D,i.version)?D:null;(0,Q.useEffect)(()=>{s||O(null)},[s]);async function P(){if(k!==null)return k.value;C(!0);try{let{values:e}=await x.secrets.reveal(`${n}/${r}/${i.key}`),t=e[i.key];return ee(null),b({value:t,version:i.version,at:Date.now()}),t}catch(e){return ee(e instanceof a?y(e):`The request could not be sent. Nothing was read.`),null}finally{C(!1)}}function te(){k===null?P():b(null)}let I=o.archived,L=o.key!==i.key,R=o.value!==null,B=s?Se(o.key.trim()):null,V=I?` is-leaving`:s&&(L||R)?` is-changed`:k===null?``:` is-revealed`,G=i.version??0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row${V} ${ve(d)}`,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 ${i.key}`,"aria-invalid":B!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>h({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&g()}}),(B!==null||L)&&(0,$.jsx)(`span`,{className:`edit-note${B===null?``:` edit-note-error`}`,children:B??(0,$.jsxs)($.Fragment,{children:[`Renamed from `,(0,$.jsx)(`span`,{className:`mono`,children:i.key})]})})]}):(0,$.jsxs)(`div`,{className:`key-cell`,children:[(0,$.jsx)(`span`,{children:z(i.key)}),I&&(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)(Ke,{label:`New value for ${i.key}`,value:o.value??j?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>h({value:e===(j?.value??``)?null:e}),onEscape:g}),(0,$.jsxs)(`span`,{className:`edit-note`,children:[(0,$.jsx)(`span`,{children:R?`Saving appends v${G+1}; v${G} stays restorable.`:j===null?`Nothing is decrypted to edit. Left empty, v${G} stays current.`:`This is v${G}. Change it to append v${G+1}.`}),u&&!R&&j===null&&(0,$.jsxs)(`button`,{type:`button`,className:`act`,disabled:S,onClick:async()=>{let e=await P();e!==null&&O({value:e,version:i.version,at:Date.now()})},children:[S&&(0,$.jsx)(N,{size:12}),`Start from current value`]})]})]}):k!==null&&!I?(0,$.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Ve}s`},children:[(0,$.jsx)(`span`,{className:`revealed-value`,children:k.value===``?`(empty)`:k.value}),(0,$.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,A,`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&&R?(0,$.jsxs)(`span`,{className:`version-shift`,children:[`v`,G,` → `,(0,$.jsxs)(`b`,{children:[`v`,G+1]})]}):(0,$.jsx)(`span`,{className:`version-shift`,children:i.version===null?`—`:`v${i.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Ye,{entry:i})}),(0,$.jsx)(`td`,{className:`col-actions`,children:d.state===`pending`?(0,$.jsx)(ye,{status:d}):(0,$.jsx)(`div`,{className:`acts`,children:I?(0,$.jsx)(H,{label:`Keep`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:g,disabled:f,"aria-label":`Keep ${i.key}`,children:(0,$.jsx)(J,{size:14})})}):s?(0,$.jsx)(H,{label:L||R?`Undo changes`:`Cancel`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:g,disabled:f,"aria-label":`${L||R?`Undo changes to`:`Stop editing`} ${i.key}`,children:L||R?(0,$.jsx)(J,{size:14}):(0,$.jsx)(q,{size:15})})}):(0,$.jsxs)($.Fragment,{children:[k!==null&&(0,$.jsx)(ne,{variant:`act`,value:k.value,label:`Copy ${i.key}`}),(0,$.jsx)(U,{canReveal:u,children:(0,$.jsx)(H,{label:k===null?`Reveal`:`Hide`,children:(0,$.jsx)(`button`,{className:`act act-icon act-accent`,onClick:te,disabled:S,"aria-label":`${k===null?`Reveal`:`Hide`} ${i.key}`,children:S?(0,$.jsx)(N,{size:13}):k===null?(0,$.jsx)(le,{size:15}):(0,$.jsx)(Y,{size:15})})})}),c&&(0,$.jsx)(H,{label:`Edit`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>{k!==null&&O(k),b(null),m()},disabled:f,"aria-label":`Edit ${i.key}`,children:(0,$.jsx)(re,{size:14})})}),(u||l)&&(0,$.jsxs)(F.Root,{children:[(0,$.jsx)(F.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${i.key}`,disabled:f,children:(0,$.jsx)(W,{size:16})})}),(0,$.jsx)(F.Portal,{children:(0,$.jsxs)(F.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsx)(U,{canReveal:u,children:(0,$.jsxs)(F.Item,{className:`menu-item`,onSelect:()=>T(e=>!e),children:[(0,$.jsx)(X,{size:14}),w?`Hide history`:`Version history`]})}),l&&(0,$.jsxs)($.Fragment,{children:[u&&(0,$.jsx)(F.Separator,{className:`menu-sep`}),(0,$.jsxs)(F.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{b(null),_()},children:[(0,$.jsx)(de,{size:14}),`Archive`,(0,$.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),w&&u&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(Qe,{project:n,environment:r,secretKey:i.key,currentVersion:i.version,canWrite:c,onClose:()=>T(!1),onRolledBack:()=>b(null)})})}),E!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(M,{error:E})})})]})}function Ye({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)(I,{iso:e.updatedAt,display:`relative`})})]})]})}function Xe({draft:e,existingVersion:t,disabled:n,onChange:r,onRemove:i}){let[a,o]=(0,Q.useState)(!1),s=e.key.trim(),c=s===``?a?`Give it a name.`:null:Se(s),l=s!==``&&t!==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":c!==null,placeholder:`NAME_OF_SECRET`,spellCheck:!1,autoComplete:`off`,value:e.key,disabled:n,onBlur:()=>o(!0),onChange:e=>r({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&i()}}),(c!==null||l)&&(0,$.jsx)(`span`,{className:`edit-note${c===null?``:` edit-note-error`}`,children:c??`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)(Ke,{label:`Value for ${s===``?`the new secret`:s}`,value:e.value,placeholder:`Value`,disabled:n,onChange:e=>r({value:e}),onEscape:i})})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:l?(0,$.jsxs)($.Fragment,{children:[`v`,t,` → `,(0,$.jsxs)(`b`,{children:[`v`,t+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)(H,{label:`Remove`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:i,disabled:n,"aria-label":s===``?`Remove this new secret`:`Remove new secret ${s}`,children:(0,$.jsx)(q,{size:15})})})})})]})}function Ze({number:e,project:t,environment:n,entry:r,canArchive:i,canReveal:a,status:o,onRestore:s,onDismiss:c}){let[l,u]=(0,Q.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row is-archived ${ve(o)}`,children:[(0,$.jsx)(`td`,{className:`n`,children:e}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:z(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)(Ye,{entry:r})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsxs)(`div`,{className:`acts`,children:[(0,$.jsx)(U,{canReveal:a,children:(0,$.jsx)(H,{label:l?`Hide history`:`Version history`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:()=>u(e=>!e),"aria-label":`${l?`Hide history of`:`Version history of`} ${r.key}`,"aria-expanded":l,children:(0,$.jsx)(X,{size:15})})})}),i&&(o.state===`pending`?(0,$.jsx)(ye,{status:o}):(0,$.jsx)(H,{label:`Restore`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:s,"aria-label":`Restore ${r.key}`,children:(0,$.jsx)(J,{size:14})})}))]})})]}),l&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(Qe,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>u(!1),onRolledBack:()=>void 0})})}),(0,$.jsx)(be,{status:o,columns:5,onDismiss:()=>o.state===`failed`&&c(o.mutationId)})]})}function Qe({project:t,environment:n,secretKey:r,currentVersion:i,canWrite:o,onClose:s,onRolledBack:c}){let[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=e(),{pending:m,error:g,run:_}=Z();return(0,Q.useEffect)(()=>{let e=!1;return p.secrets.history(`${t}/${n}/${r}`).then(t=>{e||(u(t.versions),f(null))}).catch(t=>{e||f(t instanceof a?y(t):`The version history could not be loaded.`)}),()=>{e=!0}},[p,t,n,r,i]),(0,$.jsxs)(`div`,{className:`history`,children:[(0,$.jsxs)(`div`,{className:`history-head`,children:[(0,$.jsxs)(`span`,{className:`history-title th`,children:[(0,$.jsx)(X,{size:14}),`Versions of `,(0,$.jsx)(`span`,{className:`mono`,children:r})]}),(0,$.jsx)(`button`,{className:`act`,onClick:s,children:`Close`})]}),d===null?l===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:l.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,e.version,` `,e.current&&(0,$.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,$.jsx)(`td`,{className:`nowrap`,children:(0,$.jsx)(I,{iso:e.createdAt})}),(0,$.jsx)(`td`,{children:e.createdBy}),(0,$.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:e.kek}),(0,$.jsx)(`td`,{className:`col-actions`,children:o&&!e.current&&(0,$.jsx)(V,{trigger:(0,$.jsxs)(`button`,{className:`act`,disabled:m,children:[(0,$.jsx)(J,{size:13}),`Roll back`]}),title:(0,$.jsxs)($.Fragment,{children:[`Roll `,(0,$.jsx)(`span`,{className:`mono`,children:r}),` back to v`,e.version,`?`]}),body:(0,$.jsxs)($.Fragment,{children:[`The current pointer moves to v`,e.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:[t,`/`,n]}),` `,`picks up the change immediately.`]}),confirmLabel:`Roll back to v${e.version}`,destructive:!1,onConfirm:()=>_(()=>p.secrets.restore(`${t}/${n}/${r}`,e.version),{affects:h.secrets({project:t,environment:n}),onSuccess:()=>{c(),j.success(`${r} rolled back to v${e.version}`)}})})})]},e.version))})]})}):(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(M,{error:d})}),g!==null&&(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(M,{error:g})}),(0,$.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var $e={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function et(e,t,n){let r=we(n);return r.entries.length===0?{plan:[],changes:{},problems:r.problems}:{...await o(e,t,r.entries),problems:r.problems}}function tt({project:t,environment:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)(!1),d=e(),{pending:f,error:p,setError:m,run:g}=Z(),_=`${t}/${n}`;function v(){g(()=>et(d,_,r),{affects:[],onSuccess:e=>{c(e.problems),o({entries:e.plan,changes:e.changes})}})}function y(){if(a===null)return;let e=Object.keys(a.changes).length;g(()=>d.secrets.set(_,a.changes),{affects:h.secrets({project:t,environment:n}),onSuccess:()=>{j.success(`Imported ${e} change${e===1?``:`s`}`),b()}})}function b(){u(!1),o(null),i(``),c([]),m(null)}let x=a?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn`,onClick:()=>u(!0),children:[(0,$.jsx)(ce,{size:14}),`Import .env`]}),(0,$.jsx)(R,{open:l,onOpenChange:e=>e?u(!0):b(),title:(0,$.jsxs)($.Fragment,{children:[`Import into`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[t,`/`,n]})]}),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
- STRIPE_KEY="sk_live_…"`,value:r,onChange:e=>{i(e.target.value),o(null),c([])}})]}),a!==null&&a.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:a.entries.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`cell-key`,children:z(e.key)}),(0,$.jsx)(`td`,{className:`col-shrink`,children:(0,$.jsx)(`span`,{className:$e[e.action],children:e.action})}),(0,$.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),a!==null&&a.entries.length>0&&x.length===0&&(0,$.jsx)(B,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),s.length>0&&(0,$.jsxs)(B,{tone:`bad`,children:[(0,$.jsxs)(`strong`,{children:[s.length,` line`,s.length===1?``:`s`,` could not be parsed`]}),(0,$.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:s.map(e=>(0,$.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,$.jsx)(M,{error:p}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,onClick:b,children:`Cancel`}),a===null?(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:f||r.trim()===``,onClick:v,children:[f&&(0,$.jsx)(N,{}),`Preview changes`]}):(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:f||x.length===0,onClick:y,children:[f&&(0,$.jsx)(N,{}),`Write `,x.length,` change`,x.length===1?``:`s`]})]})]})})]})}export{He as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-CHzbboGp.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/affordances-Bq2-oUB5.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
- import{h as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:({context:{client:t,queryClient:n},params:r})=>Promise.all([n.fetchQuery(e.secrets(t,r)),n.fetchQuery(e.syncs(t,r))]),component:t(()=>r(()=>import(`./projects._project._environment-CHzbboGp.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])),`component`)});export{i as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-DZ9l6d-1.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/useQuery-D__2KBOs.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-nDExpkAz.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/validation-9Cl_XS-l.js","_coffre/assets/grants-CjoOnxzz.js"])))=>i.map(i=>d[i]);
2
- import{d as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,r.project),component:t(()=>r(()=>import(`./projects._project.index-DZ9l6d-1.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])),`component`)});export{i as t};
@@ -1 +0,0 @@
1
- import{C as e,U as t,V as n,Z as r,c as i,et as a,h as o,i as s,m as c,n as l,o as u,t as d}from"./page-CGmvjSy4.js";import{t as f}from"./link-DP8SVWon.js";import{D as p,E as m,T as h,_ as g,d as _,f as v,i as y,n as b,p as x,s as S,t as C}from"./use-change-BRRMJocl.js";import{t as w}from"./use-shell-BMGlJ25Q.js";import{t as T}from"./useSuspenseQuery-CSXyDALB.js";import{t as E}from"./useQuery-D__2KBOs.js";import{n as D}from"./dist-QVHMLatb.js";import{a as O,c as k,h as A,i as j,n as M,o as N,s as P}from"./ui-BdipqGpP.js";import{t as ee}from"./project-environments-CfIH5kFM.js";import{A as te,D as F,F as I,G as L,I as ne,M as R,P as z,a as B,i as V,p as re,q as ie,v as H,y as ae}from"./icons-BQ27Ds9u.js";import{a as U,i as W,t as G}from"./row-state-ByET1OKX.js";import{t as K}from"./projects._project.index-CIAsjvg6.js";import{i as q,o as oe,s as se}from"./directory-nDExpkAz.js";import{t as J}from"./use-action-DRm9yVhV.js";import{n as Y}from"./validation-9Cl_XS-l.js";import{i as ce,n as le,r as ue,t as de}from"./grants-CjoOnxzz.js";var X=a(r(),1),Z=t();function fe({principalType:t,canList:n,grants:r,value:i,onChange:a}){let s=e(),c=E(o.directory(s,n)).data??null,[l,u]=(0,X.useState)(``),d=(0,X.useId)(),p=q[t],h=t===`user`?`User`:`Token`;if(!n||c?.ok===!1)return(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:t===`user`?`Email`:`Service token common name`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t===`user`?`someone@acme.example`:`ci-deploy`,value:i,onChange:e=>a(e.target.value)}),(0,Z.jsxs)(`span`,{className:`hint`,children:[`The `,p,` must already be registered under `,t===`user`?`Users`:`Tokens`,`.`]})]});let g=c?.principals.filter(e=>e.principalType===t)??[],_=l.trim().toLowerCase(),v=g.filter(e=>e.principalId.toLowerCase().includes(_));return(0,Z.jsxs)(`fieldset`,{className:`field picker`,children:[(0,Z.jsx)(`legend`,{className:`label`,children:h}),(0,Z.jsxs)(`label`,{className:`input-group`,children:[(0,Z.jsxs)(`span`,{className:`visually-hidden`,children:[`Filter `,p,`s by name`]}),(0,Z.jsx)(I,{size:14,className:`input-icon`}),(0,Z.jsx)(`input`,{className:`input`,type:`search`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:t===`user`?`Filter by email…`:`Filter by name…`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v.length===1&&(e.preventDefault(),a(v[0].principalId))}})]}),(0,Z.jsx)(`div`,{className:`picker-list`,children:c===null?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[(0,Z.jsx)(k,{size:13}),`Loading `,p,`s…`]}):g.length===0?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[`No `,p,`s are registered yet.`,` `,(0,Z.jsx)(f,{to:t===`user`?`/users`:`/tokens`,children:`Add one`}),` first.`]}):v.length===0?(0,Z.jsxs)(`p`,{className:`picker-empty`,children:[`No registered `,p,` matches “`,l.trim(),`”.`]}):v.map(e=>{let n=r.filter(n=>n.principalType===t&&n.principalId===e.principalId).map(m),o=e.principalId===i;return(0,Z.jsxs)(`label`,{className:`picker-option${o?` is-chosen`:``}`,children:[(0,Z.jsx)(`input`,{type:`radio`,className:`visually-hidden`,name:d,value:e.principalId,checked:o,onChange:()=>a(e.principalId)}),(0,Z.jsx)(oe,{type:t,id:e.principalId}),(0,Z.jsx)(`span`,{className:`picker-name`,children:e.principalId}),n.length>0&&(0,Z.jsxs)(`span`,{className:`picker-held`,children:[(0,Z.jsx)(`span`,{className:`visually-hidden`,children:`holds`}),n.map(e=>(0,Z.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,Z.jsx)(B,{size:14,className:`picker-check`})]},e.principalId)})})]})}var pe=[{key:`environments`,label:`Environments`,icon:(0,Z.jsx)(ae,{size:15})},{key:`users`,label:`Users`,icon:(0,Z.jsx)(ie,{size:15})},{key:`tokens`,label:`Tokens`,icon:(0,Z.jsx)(H,{size:15})},{key:`settings`,label:`Settings`,icon:(0,Z.jsx)(ne,{size:15})}];function me(){let{project:t}=K.useParams(),{data:n}=T(o.projects(e())),r=c(n,t);return r.ok?r.managesAccess?(0,Z.jsx)(he,{project:r.project}):(0,Z.jsx)(Q,{project:r.project,grants:[],grantsError:null}):(0,Z.jsx)(l,{icon:(0,Z.jsx)(re,{size:18}),label:(0,Z.jsx)(`span`,{className:`mono`,children:t}),title:`No project here for you`,actions:(0,Z.jsx)(f,{className:`btn`,to:`/projects`,children:`All projects`}),children:r.error??`There is no such project, or you hold no grant on it. The two look the same on purpose: an answer that told them apart would let anyone list project names.`})}function he({project:t}){let{data:n}=T(o.grants(e(),t.slug));return n.ok?(0,Z.jsx)(Q,{project:t,grants:n.grants,grantsError:null}):(0,Z.jsx)(Q,{project:t,grants:[],grantsError:n.error})}function Q({project:e,grants:t,grantsError:n}){let r=K.useSearch(),i=e.permissions.includes(`project.manage`),a=e.permissions.includes(`environment.manage`),o=e.permissions.includes(`grant.manage`),c=pe.filter(({key:e})=>e===`environments`||(e===`users`||e===`tokens`)&&o||e===`settings`&&i),l=c.find(({key:e})=>e===r.tab)?.key??`environments`,u=l===`users`?`user`:`service`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{tile:e.slug,title:e.name,aside:(0,Z.jsx)(`span`,{className:`page-title-slug`,children:e.slug}),actions:l===`environments`?a&&(0,Z.jsx)(_e,{project:e.slug}):(l===`users`||l===`tokens`)&&n===null&&(0,Z.jsx)(ye,{principalType:u,project:e.slug,environments:e.environments,grants:t})}),e.archivedAt!==null&&(0,Z.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,Z.jsxs)(P,{tone:`bad`,children:[(0,Z.jsx)(`strong`,{children:`This project is archived.`}),` Its environments serve no reads, to people or to machines, until it is restored.`]})}),c.length>1&&(0,Z.jsx)(`nav`,{className:`tabs`,"aria-label":`Project sections`,children:c.map(({key:t,label:n,icon:r})=>(0,Z.jsxs)(f,{to:`/projects/$project`,params:{project:e.slug},search:{tab:t===`environments`?void 0:t},activeOptions:{exact:!0,explicitUndefined:!0},"aria-current":t===l?`page`:void 0,children:[r,n]},t))}),l===`environments`&&(0,Z.jsx)(ge,{project:e,canManage:a}),(l===`users`||l===`tokens`)&&(n===null?(0,Z.jsx)(ve,{principalType:u,project:e.slug,grants:t.filter(e=>e.principalType===u)}):(0,Z.jsx)(P,{tone:`bad`,children:n})),l===`settings`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(be,{project:e}),(0,Z.jsx)(xe,{project:e})]})]})}function ge({project:e,canManage:t}){let n=e.environments.filter(ee).filter(e=>e.details.archivedAt!==null),r=e.environments.filter(e=>e.details===null||e.details.archivedAt===null),{failedAdds:a,dismiss:o}=b(i.projects),s=a(e.environments.map(t=>_(e.slug,t.slug))).filter(({ids:t})=>t.every(t=>t.startsWith(`${e.slug}/`)));return(0,Z.jsxs)(Z.Fragment,{children:[r.length===0&&s.length===0?(0,Z.jsx)(`div`,{className:`card`,children:(0,Z.jsx)(j,{title:`No environments yet`,children:t?`Add the first with Add environment.`:`Creating environments needs environment.manage on this project.`})}):(0,Z.jsxs)(`ul`,{className:`env-grid`,"aria-label":`Environments`,children:[r.map(n=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)($,{project:e.slug,environment:n,isAdmin:t})},`${e.slug}:${n.slug}`)),s.map(({mutationId:e,vars:t,status:n})=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`div`,{className:`env-card is-muted is-failed`,children:[(0,Z.jsxs)(`div`,{className:`env-card-text`,children:[(0,Z.jsx)(`span`,{className:`env-card-name`,children:t.name}),(0,Z.jsx)(`span`,{className:`env-card-meta`,children:(0,Z.jsx)(`span`,{className:`mono`,children:t.slug})})]}),(0,Z.jsx)(G,{status:n,onDismiss:()=>o(e),children:`Not added.`})]})},e))]}),n.length>0&&(0,Z.jsxs)(`section`,{"aria-labelledby":`archived-environments`,children:[(0,Z.jsx)(`h2`,{className:`section-title`,id:`archived-environments`,children:`Archived`}),(0,Z.jsx)(`ul`,{className:`env-grid`,children:n.map(n=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)($,{project:e.slug,environment:n,isAdmin:t})},n.slug))})]})]})}function $({project:t,environment:n,isAdmin:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(n.slug),[d,p]=(0,X.useState)(n.name),m=e(),h=C(g(m,t)),v=C(y(m,t)),{status:x,dismiss:S}=b(i.projects),w=x(_(t,n.slug)),T=w.state===`pending`,E=n.details,D=E!==null&&E.archivedAt!==null,O=E?.secretCount??null,k=E!==null&&!D&&n.accessible&&!T,j=r&&E!==null,P=l===``?null:Y(l);return(0,Z.jsxs)(`div`,{className:`env-card${k?` is-link`:` is-muted`} ${U(w)}`,children:[(0,Z.jsxs)(`div`,{className:`env-card-text`,children:[k?(0,Z.jsx)(f,{className:`env-card-name stretch`,to:`/projects/$project/$environment`,params:{project:t,environment:n.slug},children:n.name}):(0,Z.jsx)(`span`,{className:`env-card-name`,children:n.name}),(0,Z.jsxs)(`span`,{className:`env-card-meta`,children:[(0,Z.jsx)(`span`,{className:`mono`,children:n.slug}),D?(0,Z.jsx)(`span`,{className:`tag tag-red`,children:`archived`}):!n.accessible&&!T?(0,Z.jsx)(`span`,{className:`tag tag-outline`,children:`no secret access`}):O!==null&&(0,Z.jsxs)(`span`,{children:[O,` secret`,O===1?``:`s`]})]})]}),T&&(0,Z.jsx)(W,{status:w}),j&&!T&&(0,Z.jsxs)(A.Root,{children:[(0,Z.jsx)(A.Trigger,{asChild:!0,children:(0,Z.jsx)(`button`,{className:`act act-quiet env-card-menu`,"aria-label":`Actions for ${n.slug}`,children:(0,Z.jsx)(F,{size:16})})}),(0,Z.jsx)(A.Portal,{children:(0,Z.jsxs)(A.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,Z.jsxs)(A.Item,{className:`menu-item`,onSelect:()=>{u(n.slug),p(n.name),o(!0)},children:[(0,Z.jsx)(te,{size:14}),`Rename`]}),(0,Z.jsx)(A.Separator,{className:`menu-sep`}),(0,Z.jsxs)(A.Item,{className:`menu-item${D?``:` menu-item-danger`}`,onSelect:()=>c(!0),children:[D?(0,Z.jsx)(z,{size:14}):(0,Z.jsx)(V,{size:14}),D?`Restore`:`Archive…`]})]})})]}),j&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(N,{open:a,onOpenChange:o,title:(0,Z.jsxs)(Z.Fragment,{children:[`Rename`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]})]}),children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),h({from:n.slug,slug:l,name:d.trim()}),o(!1)},children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,value:l,"aria-invalid":P!==null,onChange:e=>u(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${P===null?``:` edit-note-error`}`,children:P??`Anything running coffre run ${t}/${n.slug} will need the new path.`})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,value:d,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>o(!1),children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:l===``||P!==null||d.trim()===``,children:`Save`})]})]})}),(0,Z.jsx)(M,{open:s,onOpenChange:c,title:(0,Z.jsxs)(Z.Fragment,{children:[D?`Restore`:`Archive`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]}),`?`]}),body:O===null?(0,Z.jsx)(Z.Fragment,{children:`This changes whether the environment serves secrets to principals who have access. Values and history remain stored.`}):D?(0,Z.jsxs)(Z.Fragment,{children:[`The environment starts serving its `,O,` secret`,O===1?``:`s`,` again, to everyone who holds a grant on it.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`Its `,O,` secret`,O===1?``:`s`,` stop being served, so anything running `,(0,Z.jsx)(`code`,{children:`coffre run`}),` against`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,n.slug]}),` `,`loses them at its next start. Values and history survive, and restoring is one click.`]}),confirmLabel:D?`Restore environment`:`Archive environment`,destructive:!D,onConfirm:()=>v({slug:n.slug,archived:!D})})]}),(0,Z.jsx)(G,{status:w,onDismiss:()=>w.state===`failed`&&S(w.mutationId)})]})}function _e({project:t}){let[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),c=C(S(e(),t)),l=i===``?null:Y(i);function u(){r(!1)}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>r(!0),children:[(0,Z.jsx)(R,{size:14}),`Add environment`]}),(0,Z.jsx)(N,{open:n,onOpenChange:e=>e?r(!0):u(),title:(0,Z.jsxs)(Z.Fragment,{children:[`New environment in `,(0,Z.jsx)(`span`,{className:`mono`,children:t})]}),children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),c({slug:i,name:o.trim()}),a(``),s(``),u()},children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`staging`,value:i,"aria-invalid":l!==null,onChange:e=>a(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${l===null?``:` edit-note-error`}`,children:l??(0,Z.jsxs)(Z.Fragment,{children:[`The CLI will address it as`,` `,(0,Z.jsxs)(`span`,{className:`mono`,children:[t,`/`,i===``?`staging`:i]}),`.`]})})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,placeholder:`Staging`,value:o,onChange:e=>s(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:i===``||l!==null||o.trim()===``,children:`Add environment`})]})]})})]})}function ve({principalType:e,project:t,grants:n}){let r=e===`user`,i=ce(t,n,e);return(0,Z.jsx)(`section`,{className:`card`,"aria-label":r?`Users with access`:`Tokens with access`,children:n.length===0&&i.length===0?(0,Z.jsxs)(j,{title:r?`No user has access`:`No token has access`,children:[`Add `,r?`a user`:`a token`,` with permissions on the whole project or on one environment.`]}):(0,Z.jsxs)(le,{lead:(0,Z.jsxs)(`span`,{className:`th`,children:[r?(0,Z.jsx)(L,{size:14}):(0,Z.jsx)(H,{size:14}),r?`Email`:`Name`]}),children:[n.map((e,n)=>(0,Z.jsx)(de,{number:n+1,project:t,grant:e,leadLabel:r?`Email`:`Name`,lead:(0,Z.jsx)(se,{type:e.principalType,id:e.principalId})},x(e))),(0,Z.jsx)(ue,{refused:i})]})})}function ye({principalType:t,project:n,environments:r,grants:i}){let{capabilities:a}=w(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`viewer:`),[f,m]=(0,X.useState)(``),g=C(v(e(),n)),_=p(r),y=t===`user`?`user`:`token`;function b(){s(!1)}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,Z.jsx)(R,{size:14}),`Add `,y]}),(0,Z.jsx)(N,{open:o,onOpenChange:e=>e?s(!0):b(),title:(0,Z.jsxs)(Z.Fragment,{children:[`Give a `,y,` access to `,(0,Z.jsx)(`span`,{className:`mono`,children:n})]}),wide:!0,description:`Owners manage the whole project and its access. Read and write can cover every environment, or one.`,children:(0,Z.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault();let n=h(u);g({principalType:t,principalId:c.trim(),role:n.role,roleName:_.find(e=>e.value===u)?.label??n.role,environmentSlug:n.environmentSlug,expiresAt:f===``?null:new Date(`${f}T23:59:59Z`).toISOString()}),l(``),m(``),d(`viewer:`),b()},children:[(0,Z.jsx)(fe,{principalType:t,canList:a.canManageGrants,grants:i,value:c,onChange:l}),(0,Z.jsxs)(`div`,{className:`form-row`,children:[(0,Z.jsxs)(`label`,{className:`field`,style:{flexGrow:2},children:[(0,Z.jsx)(`span`,{className:`label`,children:`Permissions`}),(0,Z.jsx)(`select`,{className:`select`,value:u,onChange:e=>d(e.target.value),children:_.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsxs)(`span`,{className:`label`,children:[`Expires `,(0,Z.jsx)(`span`,{className:`hint`,children:`(optional)`})]}),(0,Z.jsx)(`input`,{className:`input`,type:`date`,value:f,onChange:e=>m(e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`dialog-actions`,children:[(0,Z.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c.trim()===``,children:`Grant access`})]})]})})]})}function be({project:t}){let r=n(),[i,a]=(0,X.useState)(t.slug),[o,s]=(0,X.useState)(t.name),c=e(),{pending:l,error:d,run:f}=J(),p=i===``?null:Y(i),m=i!==t.slug||o.trim()!==t.name;return(0,X.useEffect)(()=>{a(t.slug),s(t.name)},[t.slug,t.name]),(0,Z.jsxs)(`section`,{className:`card`,"aria-labelledby":`general-settings`,children:[(0,Z.jsx)(`div`,{className:`card-head`,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`h2`,{className:`card-title`,id:`general-settings`,children:`General`})})}),(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),f(()=>c.projects.update(t.slug,{slug:i,name:o}),{affects:u.places(),onSuccess:async()=>{D.success(`Project renamed`),i!==t.slug&&await r.navigate({to:`/projects/$project`,params:{project:i},search:{tab:`settings`}})}})},children:[(0,Z.jsxs)(`div`,{className:`card-body form-row`,children:[(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Slug`}),(0,Z.jsx)(`input`,{className:`input input-mono`,spellCheck:!1,value:i,"aria-invalid":p!==null,onChange:e=>a(e.target.value)}),(0,Z.jsx)(`span`,{className:`hint${p===null?``:` edit-note-error`}`,children:p??`Scripts that name the old slug will need the new one.`})]}),(0,Z.jsxs)(`label`,{className:`field`,children:[(0,Z.jsx)(`span`,{className:`label`,children:`Display name`}),(0,Z.jsx)(`input`,{className:`input`,value:o,onChange:e=>s(e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`card-foot`,children:[d!==null&&(0,Z.jsx)(`span`,{className:`hint`,children:(0,Z.jsx)(O,{error:d})}),(0,Z.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:!m||l||i===``||p!==null||o.trim()===``,children:[l&&(0,Z.jsx)(k,{}),`Save`]})]})]})]})}function xe({project:t}){let[n,r]=(0,X.useState)(!1),i=e(),{pending:a,error:o,run:s}=J(),c=t.archivedAt!==null;return(0,Z.jsxs)(d,{labelledBy:`danger-zone`,title:`Danger zone`,tone:`danger`,children:[(0,Z.jsxs)(`div`,{className:`card-row`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`card-row-title`,children:c?`Restore project`:`Archive project`}),(0,Z.jsx)(`p`,{className:`card-row-desc`,children:c?`The project reappears in listings and its environments serve reads again, for everyone who holds a grant on it.`:`Every environment stops serving reads, including to machine callers already running. Nothing is deleted, and you can restore it here at any time.`}),o!==null&&(0,Z.jsx)(`div`,{style:{marginTop:`0.5rem`},children:(0,Z.jsx)(O,{error:o})})]}),(0,Z.jsxs)(`button`,{className:`btn ${c?``:`btn-danger-outline`}`,onClick:()=>r(!0),disabled:a,children:[a?(0,Z.jsx)(k,{}):c?(0,Z.jsx)(z,{size:14}):(0,Z.jsx)(V,{size:14}),c?`Restore project`:`Archive project…`]})]}),(0,Z.jsx)(M,{open:n,onOpenChange:r,title:(0,Z.jsxs)(Z.Fragment,{children:[c?`Restore`:`Archive`,` `,(0,Z.jsx)(`span`,{className:`mono`,children:t.slug}),`?`]}),body:c?(0,Z.jsx)(Z.Fragment,{children:`The project reappears in listings and its environments start serving reads again, for everyone who holds a grant on it.`}):(0,Z.jsxs)(Z.Fragment,{children:[`Every environment in `,(0,Z.jsx)(`span`,{className:`mono`,children:t.slug}),` stops serving reads, including to machine callers already running. Nothing is deleted: values, versions and the audit trail over them stay intact, and you can restore it here at any time.`]}),confirmLabel:c?`Restore project`:`Archive project`,destructive:!c,onConfirm:()=>s(()=>i.projects.update(t.slug,{archived:!c}),{affects:u.places(),onSuccess:()=>D.success(c?`${t.slug} restored`:`${t.slug} archived`)})})]})}export{me as component};
@@ -1 +0,0 @@
1
- import{C as e,U as t,Z as n,a as r,et as i,h as a,i as o,n as s}from"./page-CGmvjSy4.js";import{t as c}from"./link-DP8SVWon.js";import{c as l,h as u,n as d,t as f}from"./use-change-BRRMJocl.js";import{t as p}from"./use-shell-BMGlJ25Q.js";import{t as m}from"./useSuspenseQuery-CSXyDALB.js";import{i as h,o as g}from"./ui-BdipqGpP.js";import{n as _}from"./project-environments-CfIH5kFM.js";import{n as v,r as y}from"./affordances-Bq2-oUB5.js";import{M as b,h as x,p as S,r as C,y as w}from"./icons-BQ27Ds9u.js";import{a as T,i as E,r as D}from"./row-state-ByET1OKX.js";import{n as O}from"./validation-9Cl_XS-l.js";var k=i(n()),A=t();function j(){let{data:t,refetch:n}=m(a.projects(e())),{capabilities:r}=p(),{failedAdds:i}=d(u.queryKey),l=t.ok?i(t.projects.map(e=>e.slug)):[];if(!t.ok)return(0,A.jsx)(s,{icon:(0,A.jsx)(C,{size:18}),title:`Projects could not be listed`,actions:t.signedOut?(0,A.jsx)(c,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,A.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n(),children:`Try again`}),children:t.error});let f=t.projects.filter(e=>e.archivedAt===null),g=t.projects.filter(e=>e.archivedAt!==null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(o,{title:`Projects`,actions:(0,A.jsx)(y,{capabilities:r,children:(0,A.jsx)(P,{})})}),f.length===0&&l.length===0?(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(h,{title:`Nothing here for you yet`,children:(0,A.jsx)(v,{capabilities:r,hasArchivedProjects:g.length>0})})}):(0,A.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,A.jsx)(M,{projects:f,refused:!0})}),g.length>0&&(0,A.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,A.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(M,{projects:g})})]})]})}function M({projects:e,refused:t=!1}){let{status:n,failedAdds:r,dismiss:i}=d(u.queryKey);return(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{className:`n`,children:`#`}),(0,A.jsx)(`th`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Project`]})}),(0,A.jsx)(`th`,{children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(w,{size:14}),`Environments`]})}),(0,A.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(x,{size:14}),`Secrets`]})})]})}),(0,A.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,A.jsx)(N,{number:t+1,project:e,status:n(e.slug),onDismiss:i},e.slug)),t&&r(e.map(e=>e.slug)).map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(D,{status:n,columns:4,onDismiss:()=>i(e),children:[`Project `,t.slug,` was not created.`]},e))]})]})})}function N({number:e,project:t,status:n,onDismiss:i}){let a=t.secretCount,o=n.state===`pending`,s=t.archivedAt!==null,l=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${T(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:e}),(0,A.jsx)(`td`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`cell-project`,children:[(0,A.jsx)(r,{name:t.slug}),(0,A.jsxs)(`span`,{className:`cell-stack`,children:[o?(0,A.jsx)(`span`,{children:t.name}):(0,A.jsx)(c,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,A.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,A.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:s||l.length===0?(0,A.jsx)(`span`,{className:`cell-muted`,children:l.length===0?`No environments yet`:`${l.length} environment${l.length===1?``:`s`}`}):(0,A.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:l.map(e=>_(e)?(0,A.jsxs)(c,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,A.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,A.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,A.jsx)(`td`,{className:`col-secrets num nowrap`,children:o?(0,A.jsx)(E,{status:n}):a!==null&&!s?(0,A.jsxs)(A.Fragment,{children:[a,(0,A.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,a===1?``:`s`]})]}):(0,A.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]}),(0,A.jsx)(D,{status:n,columns:4,onDismiss:()=>n.state===`failed`&&i(n.mutationId)})]})}function P(){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=f(l(e())),c=t===``?null:O(t);function u(){o(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,A.jsx)(b,{size:14}),`New project`]}),(0,A.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):u(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),s({slug:t,name:r.trim()}),n(``),i(``),u()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Slug`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":c!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,A.jsx)(`span`,{className:`hint${c===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:c??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Display name`}),(0,A.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:t===``||c!==null||r.trim()===``,children:`Create project`})]})]})})]})}export{j as component};
@@ -1 +0,0 @@
1
- import{U as e,Z as t,et as n}from"./page-CGmvjSy4.js";import{c as r}from"./ui-BdipqGpP.js";import{J as i,n as a}from"./icons-BQ27Ds9u.js";var o=n(t(),1),s={polite:null,urgent:null},c=0,l=new Set;function u(e,{urgent:t=!1}={}){let n={text:e,id:c++};s=t?{...s,urgent:n}:{...s,polite:n};for(let e of l)e()}function d(e){return l.add(e),()=>l.delete(e)}function f(){return s}var p={polite:null,urgent:null};function m(){return p}var h=e();function g(e){return e.state===`pending`?e.kind===`removing`?`is-removing`:`is-saving`:e.state===`failed`?`is-failed`:``}function _({status:e}){return e.state===`pending`?(0,h.jsxs)(`span`,{className:`row-pending`,children:[(0,h.jsx)(r,{size:13}),e.words.pending]}):null}function v({status:e,columns:t,onDismiss:n,children:r}){return e.state===`failed`?(0,h.jsx)(`tr`,{className:`row-error row-failure`,children:(0,h.jsx)(`td`,{colSpan:t,children:(0,h.jsx)(y,{status:e,onDismiss:n,children:r})})}):null}function y({status:e,onDismiss:t,children:n}){return e.state===`failed`?(0,h.jsxs)(`div`,{className:`row-failure-line`,children:[(0,h.jsxs)(`p`,{className:`error-line`,children:[(0,h.jsx)(a,{size:14}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:n??e.words.failed}),` `,e.error]})]}),(0,h.jsx)(`button`,{type:`button`,className:`act act-quiet`,onClick:t,"aria-label":`Dismiss`,children:(0,h.jsx)(i,{size:13})})]}):null}function b(){let{polite:e,urgent:t}=(0,o.useSyncExternalStore)(d,f,m);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:e!==null&&(0,h.jsx)(`span`,{children:e.text},e.id)}),(0,h.jsx)(`div`,{className:`visually-hidden`,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,children:t!==null&&(0,h.jsx)(`span`,{children:t.text},t.id)})]})}export{g as a,_ as i,b as n,u as o,v as r,y as t};
@@ -1 +0,0 @@
1
- import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,Z as f,et as p,k as m,z as h}from"./page-CGmvjSy4.js";var g=p(f(),1),_=d(),v=g.createContext(void 0),y=e=>{let t=g.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x=class extends m{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let o=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o!==this.#f)&&this.#v(o)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return a(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(s)),t}#h(t){return!e()&&i(this.options.enabled,this.#t)!==!1&&o(t)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let n=h(this.#r.dataUpdatedAt,e)+1;this.#u=t.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return i(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=t.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(t.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(t.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,a=this.options,o=this.#r,s=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),o=!i&&C(e,t),s=i&&T(e,n,t,a);(o||s)&&(f={...f,...r(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=l(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v)if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=l(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,w=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!w,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&w,isStale:E(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),a(t,e))return;this.#r=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=i(n,e);return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var D=g.createContext(!1),O=()=>g.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=g.createContext(k()),j=()=>g.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{g.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e?.suspense&&t.isPending,R=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{M as a,j as c,b as d,y as f,L as i,O as l,I as n,P as o,R as r,N as s,F as t,x as u};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-Dui_4KfS.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/principal-page-DNLb_q_e.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/directory-nDExpkAz.js","_coffre/assets/grants-CjoOnxzz.js","_coffre/assets/offboarding-CNr_1tnl.js"])))=>i.map(i=>d[i]);
2
- import{u as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/tokens/$token`)({loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,`service`,r.token),component:t(()=>r(()=>import(`./tokens._token-Dui_4KfS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),`component`)});export{i as t};
@@ -1 +0,0 @@
1
- import{C as e,U as t,Z as n,b as r,et as i,h as a,o,t as s}from"./page-CGmvjSy4.js";import{n as c,t as l,y as u}from"./use-change-BRRMJocl.js";import{t as d}from"./use-shell-BMGlJ25Q.js";import{t as f}from"./useSuspenseQuery-CSXyDALB.js";import{a as p,c as m,i as h,l as g,o as _,r as v,s as y,t as b}from"./ui-BdipqGpP.js";import{J as x,M as S,v as C}from"./icons-BQ27Ds9u.js";import{a as w,i as T,r as E}from"./row-state-ByET1OKX.js";import{t as D}from"./tokens._token-DWmbqzNk.js";import{t as O}from"./use-action-DRm9yVhV.js";import{t as k}from"./principal-page-DNLb_q_e.js";var A=i(n(),1),j=t(),M=[30,90,180,365];function N({serviceId:t,tokens:n}){let r=u(e(),t),i=l(r),{status:a,dismiss:o}=c(r.list.queryKey);return(0,j.jsx)(s,{labelledBy:`service-tokens`,title:`Credentials`,description:`Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.`,actions:(0,j.jsx)(P,{serviceId:t}),children:n.length===0?(0,j.jsx)(h,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,j.jsx)(`div`,{className:`dt-wrap`,children:(0,j.jsxs)(`table`,{className:`dt`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{children:`Token`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,j.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,j.jsx)(`th`,{className:`col-actions`,children:(0,j.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id);return(0,j.jsxs)(A.Fragment,{children:[(0,j.jsxs)(`tr`,{className:w(t),children:[(0,j.jsx)(`td`,{children:(0,j.jsxs)(`span`,{className:`cell-account`,children:[(0,j.jsx)(C,{size:15}),(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(`span`,{children:e.label??`Unlabelled`}),(0,j.jsx)(`small`,{className:`mono`,children:e.hint})]})]})}),(0,j.jsx)(`td`,{className:`nowrap`,children:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.createdAt}),(0,j.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,j.jsxs)(`span`,{className:`cell-stack`,children:[(0,j.jsx)(g,{iso:e.lastUsedAt,display:`relative`}),e.lastUsedIp!==null&&(0,j.jsx)(`small`,{className:`mono`,children:e.lastUsedIp})]})}),(0,j.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,j.jsx)(g,{iso:e.expiresAt,display:`relative`})}),(0,j.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,j.jsx)(T,{status:t}):(0,j.jsx)(b,{trigger:(0,j.jsxs)(`button`,{className:`act`,children:[(0,j.jsx)(x,{size:13}),`Revoke`]}),title:(0,j.jsxs)(j.Fragment,{children:[`Revoke `,(0,j.jsx)(`span`,{className:`mono`,children:e.hint}),`?`]}),body:`Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.`,confirmLabel:`Revoke token`,onConfirm:()=>i(e)})})]}),(0,j.jsx)(E,{status:t,columns:5,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function P({serviceId:t}){let[n,i]=(0,A.useState)(!1),[a,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(90),[u,d]=(0,A.useState)(null),f=e(),{pending:h,error:b,setError:x,run:C}=O();function w(){i(!1),d(null),s(``),x(null)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,j.jsx)(S,{size:14}),`Issue token`]}),(0,j.jsx)(_,{open:n,onOpenChange:e=>e?i(!0):w(),title:u===null?`Issue a token`:`Copy the token now`,children:u===null?(0,j.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),C(()=>f.tokens.issue(r(`service`,t),{label:a.trim()===``?null:a.trim(),expiresInDays:c}),{affects:o.credentials(r(`service`,t)),onSuccess:e=>d(e)})},children:[(0,j.jsxs)(`div`,{className:`form-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{className:`label`,children:`Label`}),(0,j.jsx)(`input`,{className:`input`,value:a,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>s(e.target.value)})]}),(0,j.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,j.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,j.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(Number(e.target.value)),children:M.map(e=>(0,j.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,j.jsx)(p,{error:b}),(0,j.jsxs)(`div`,{className:`dialog-actions`,children:[(0,j.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,j.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h,children:[h&&(0,j.jsx)(m,{}),`Issue token`]})]})]}):(0,j.jsxs)(`div`,{className:`form`,children:[(0,j.jsxs)(y,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,j.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,j.jsxs)(`div`,{className:`token-once`,children:[(0,j.jsx)(`code`,{className:`mono`,children:u.token}),(0,j.jsx)(v,{value:u.token,label:`Copy token`})]}),(0,j.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,j.jsx)(g,{iso:u.expiresAt}),`. Send it as`,` `,(0,j.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,j.jsx)(`div`,{className:`dialog-actions`,children:(0,j.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:w,children:`Done`})})]})})]})}function F(){let{token:t}=D.useParams(),n=e(),{auth:i,capabilities:o}=d(),s=r(`service`,t),c=o.canManageGrants,{data:l}=f(a.report(n,s,c)),{data:u}=f(a.credentials(n,s,c&&i.signin!==null)),p=l?.ok===!0&&l.report?.status===`active`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k,{principalType:`service`,principalId:t}),p&&u?.ok===!0&&(0,j.jsx)(N,{serviceId:t,tokens:u.tokens})]})}export{F as component};
@@ -1 +0,0 @@
1
- import{Z as e,et as t,g as n,y as r}from"./page-CGmvjSy4.js";import{f as i}from"./suspense-C7KwSnTG.js";var a=t(e(),1);function o(){let e=i(),[t,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(null);async function l(t,{affects:i,onSuccess:a}){o(!0);let s;try{s=await t()}catch(e){c(r(e)),o(!1);return}c(null);try{await n(e,typeof i==`function`?i(s):i),await a?.(s)}catch{c(`The change was saved, but the page could not refresh. Reload before you retry.`)}o(!1)}return{pending:t,error:s,setError:c,run:l}}export{o as t};
@@ -1 +0,0 @@
1
- import{C as e,D as t,F as n,L as r,N as i,Z as a,_ as o,et as s,h as c,k as l}from"./page-CGmvjSy4.js";import{a as u,c as d,f,i as p,l as m,n as h,o as g,r as _,s as v,t as y,u as b}from"./suspense-C7KwSnTG.js";function x(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var S=class extends l{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,n){this.#n=e,this.#r=n,t.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),i=n.map(e=>e.getCurrentResult()),a=e.length!==n.length,o=n.some((t,n)=>t!==e[n]),s=a||o,c=s?!0:i.some((e,t)=>{let n=this.#t[t];return!n||!r(e,n)});!s&&!c||(s&&(this.#l=t,this.#i=n),this.#t=i,this.hasListeners()&&(s&&(x(e,n).forEach(e=>{e.destroy()}),x(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,r){if(t){let i=this.#c,a=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((e,t)=>e!==i[t]));return(this.#t!==this.#s||a||t!==this.#o)&&(this.#o=t,this.#s=this.#t,r!==void 0&&(this.#c=r),this.#a=n(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new b(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),n=this.#a,r=e?n:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||n!==r)&&t.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},C=s(a(),1);function w({queries:e,...n},r){let a=f(r),o=m(),s=d(),c=n.subscribed!==!1,l=C.useMemo(()=>e.map(e=>{let t=a.defaultQueryOptions(e);return t._optimisticResults=o?`isRestoring`:c?`optimistic`:void 0,t}),[e,a,o,c]);l.forEach(e=>{h(e);let t=a.getQueryCache().get(e.queryHash);u(e,s,t)}),v(s);let[y]=C.useState(()=>new S(a,l,n)),[x,w,T]=y.getOptimisticResult(l,n.combine),E=!o&&c;C.useSyncExternalStore(C.useCallback(e=>E?y.subscribe(t.batchCalls(e)):i,[y,E]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),C.useEffect(()=>{y.setQueries(l,n)},[l,n,y]);let D=x.some((e,t)=>p(l[t],e))?x.flatMap((e,t)=>{let n=l[t];return n&&p(n,e)?_(n,new b(a,n),s):[]}):[];if(D.length>0)throw Promise.all(D);let O=x.find((e,t)=>{let n=l[t];return n&&g({result:e,errorResetBoundary:s,throwOnError:n.throwOnError,query:a.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(O)throw O.error;return w(T())}function T(e,t){return w({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:y,enabled:!0,placeholderData:void 0}))},t)}function E(){let t=e(),[n,r,i]=T({queries:[c.auth(t),c.me(t),c.projects(t)]});return(0,C.useMemo)(()=>o(n.data,r.data,i.data),[n.data,r.data,i.data])}export{T as n,E as t};
@@ -1 +0,0 @@
1
- import{u as e}from"./suspense-C7KwSnTG.js";import{n as t}from"./useSuspenseQuery-CSXyDALB.js";function n(n,r){return t(n,e,r)}export{n as t};
@@ -1 +0,0 @@
1
- import{D as e,N as t,Z as n,et as r}from"./page-CGmvjSy4.js";import{a as i,c as a,f as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./suspense-C7KwSnTG.js";var h=r(n(),1);function g(n,r,p){let m=c(),g=a(),_=o(p),v=_.defaultQueryOptions(n),y=_.getQueryCache().get(v.queryHash),b=n.subscribed!==!1;v._optimisticResults=m?`isRestoring`:b?`optimistic`:void 0,l(v),i(v,g,y),f(g);let[x]=h.useState(()=>new r(_,v)),S=x.getOptimisticResult(v),C=!m&&b;if(h.useSyncExternalStore(h.useCallback(n=>{let r=C?x.subscribe(e.batchCalls(n)):t;return x.updateResult(),r},[x,C]),()=>x.getCurrentResult(),()=>x.getCurrentResult()),h.useEffect(()=>{x.setOptions(v)},[v,x]),s(v,S))throw d(v,x,g);if(u({result:S,errorResetBoundary:g,throwOnError:v.throwOnError,query:y,suspense:v.suspense}))throw S.error;return v.notifyOnChangeProps?S:x.trackResult(S)}function _(e,t){return g({...e,enabled:!0,suspense:!0,throwOnError:p,placeholderData:void 0},m,t)}export{g as n,_ as t};
@@ -1 +0,0 @@
1
- import{U as e}from"./page-CGmvjSy4.js";import{t}from"./users._user-jbSvtdOg.js";import{t as n}from"./principal-page-DNLb_q_e.js";var r=e();function i(){let{user:e}=t.useParams();return(0,r.jsx)(n,{principalType:`user`,principalId:e})}export{i as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users._user-BkNrX7Qf.js","_coffre/assets/page-CGmvjSy4.js","_coffre/assets/principal-page-DNLb_q_e.js","_coffre/assets/link-DP8SVWon.js","_coffre/assets/use-change-BRRMJocl.js","_coffre/assets/suspense-C7KwSnTG.js","_coffre/assets/row-state-ByET1OKX.js","_coffre/assets/ui-BdipqGpP.js","_coffre/assets/icons-BQ27Ds9u.js","_coffre/assets/use-shell-BMGlJ25Q.js","_coffre/assets/useSuspenseQuery-CSXyDALB.js","_coffre/assets/dist-QVHMLatb.js","_coffre/assets/directory-nDExpkAz.js","_coffre/assets/use-action-DRm9yVhV.js","_coffre/assets/grants-CjoOnxzz.js","_coffre/assets/offboarding-CNr_1tnl.js"])))=>i.map(i=>d[i]);
2
- import{u as e}from"./page-CGmvjSy4.js";import{n as t,r as n,t as r}from"./preload-helper-ClBkJ19f.js";var i=n(`/users/$user`)({loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,`user`,r.user),component:t(()=>r(()=>import(`./users._user-BkNrX7Qf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),`component`)});export{i as t};
@@ -1,162 +0,0 @@
1
- //#region \0tanstack-start-manifest:v
2
- var tsrStartManifest = () => ({ routes: {
3
- __root__: {
4
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/__root.tsx",
5
- children: [
6
- "/",
7
- "/access",
8
- "/account",
9
- "/audit",
10
- "/login",
11
- "/settings",
12
- "/unregistered",
13
- "/auth/device",
14
- "/tokens/$token",
15
- "/users/$user",
16
- "/projects/",
17
- "/tokens/",
18
- "/users/",
19
- "/projects/$project/$environment",
20
- "/projects/$project/"
21
- ],
22
- preloads: [
23
- "/_coffre/assets/index-CUGytaO3.js",
24
- "/_coffre/assets/page-CGmvjSy4.js",
25
- "/_coffre/assets/link-DP8SVWon.js",
26
- "/_coffre/assets/preload-helper-ClBkJ19f.js",
27
- "/_coffre/assets/suspense-C7KwSnTG.js",
28
- "/_coffre/assets/use-shell-BMGlJ25Q.js",
29
- "/_coffre/assets/dist-QVHMLatb.js",
30
- "/_coffre/assets/ui-BdipqGpP.js",
31
- "/_coffre/assets/project-environments-CfIH5kFM.js",
32
- "/_coffre/assets/affordances-Bq2-oUB5.js",
33
- "/_coffre/assets/icons-BQ27Ds9u.js",
34
- "/_coffre/assets/account-BJAdDvZf.js",
35
- "/_coffre/assets/row-state-ByET1OKX.js",
36
- "/_coffre/assets/audit-C-pcBgKe.js",
37
- "/_coffre/assets/login-CeaxDMcr.js",
38
- "/_coffre/assets/auth.device-CWHNQn9W.js",
39
- "/_coffre/assets/tokens._token-DWmbqzNk.js",
40
- "/_coffre/assets/users._user-jbSvtdOg.js",
41
- "/_coffre/assets/projects._project.index-CIAsjvg6.js",
42
- "/_coffre/assets/projects._project._environment-DDxu_HHD.js"
43
- ],
44
- scripts: [{ attrs: {
45
- type: "module",
46
- async: !0,
47
- src: "/_coffre/assets/index-CUGytaO3.js"
48
- } }]
49
- },
50
- "/account": {
51
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/account.tsx",
52
- children: void 0,
53
- preloads: [
54
- "/_coffre/assets/account-D0jLpk5c.js",
55
- "/_coffre/assets/use-change-BRRMJocl.js",
56
- "/_coffre/assets/directory-nDExpkAz.js",
57
- "/_coffre/assets/signin-errors-CroZWZgm.js"
58
- ]
59
- },
60
- "/audit": {
61
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/audit.tsx",
62
- children: void 0,
63
- preloads: [
64
- "/_coffre/assets/audit-CHGlDeBB.js",
65
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
66
- "/_coffre/assets/useQuery-D__2KBOs.js"
67
- ]
68
- },
69
- "/login": {
70
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/login.tsx",
71
- children: void 0,
72
- preloads: ["/_coffre/assets/login-DrMgvqZn.js", "/_coffre/assets/signin-errors-CroZWZgm.js"]
73
- },
74
- "/settings": {
75
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/settings.tsx",
76
- children: void 0,
77
- preloads: ["/_coffre/assets/settings-D2zp1Ssu.js", "/_coffre/assets/useSuspenseQuery-CSXyDALB.js"]
78
- },
79
- "/unregistered": {
80
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/unregistered.tsx",
81
- children: void 0,
82
- preloads: ["/_coffre/assets/unregistered-CA7B4C1m.js"]
83
- },
84
- "/auth/device": {
85
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/auth.device.tsx",
86
- children: void 0,
87
- preloads: ["/_coffre/assets/auth.device-BndOUjse.js"]
88
- },
89
- "/tokens/$token": {
90
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.$token.tsx",
91
- children: void 0,
92
- preloads: [
93
- "/_coffre/assets/tokens._token-Dui_4KfS.js",
94
- "/_coffre/assets/use-change-BRRMJocl.js",
95
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
96
- "/_coffre/assets/use-action-DRm9yVhV.js",
97
- "/_coffre/assets/principal-page-DNLb_q_e.js"
98
- ]
99
- },
100
- "/users/$user": {
101
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.$user.tsx",
102
- children: void 0,
103
- preloads: ["/_coffre/assets/users._user-BkNrX7Qf.js", "/_coffre/assets/principal-page-DNLb_q_e.js"]
104
- },
105
- "/projects/": {
106
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.index.tsx",
107
- children: void 0,
108
- preloads: [
109
- "/_coffre/assets/projects.index-4eUXreE_.js",
110
- "/_coffre/assets/use-change-BRRMJocl.js",
111
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
112
- "/_coffre/assets/validation-9Cl_XS-l.js"
113
- ]
114
- },
115
- "/tokens/": {
116
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.index.tsx",
117
- children: void 0,
118
- preloads: [
119
- "/_coffre/assets/tokens.index-CSi5Wxwf.js",
120
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
121
- "/_coffre/assets/directory-nDExpkAz.js",
122
- "/_coffre/assets/offboarding-CNr_1tnl.js"
123
- ]
124
- },
125
- "/users/": {
126
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.index.tsx",
127
- children: void 0,
128
- preloads: [
129
- "/_coffre/assets/users.index-CKnQ1G76.js",
130
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
131
- "/_coffre/assets/directory-nDExpkAz.js",
132
- "/_coffre/assets/offboarding-CNr_1tnl.js"
133
- ]
134
- },
135
- "/projects/$project/$environment": {
136
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.$environment.tsx",
137
- children: void 0,
138
- preloads: [
139
- "/_coffre/assets/projects._project._environment-CHzbboGp.js",
140
- "/_coffre/assets/use-change-BRRMJocl.js",
141
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
142
- "/_coffre/assets/use-action-DRm9yVhV.js",
143
- "/_coffre/assets/validation-9Cl_XS-l.js"
144
- ]
145
- },
146
- "/projects/$project/": {
147
- filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.index.tsx",
148
- children: void 0,
149
- preloads: [
150
- "/_coffre/assets/projects._project.index-DZ9l6d-1.js",
151
- "/_coffre/assets/use-change-BRRMJocl.js",
152
- "/_coffre/assets/useSuspenseQuery-CSXyDALB.js",
153
- "/_coffre/assets/useQuery-D__2KBOs.js",
154
- "/_coffre/assets/directory-nDExpkAz.js",
155
- "/_coffre/assets/use-action-DRm9yVhV.js",
156
- "/_coffre/assets/validation-9Cl_XS-l.js",
157
- "/_coffre/assets/grants-CjoOnxzz.js"
158
- ]
159
- }
160
- } });
161
- //#endregion
162
- export { tsrStartManifest };