@coffre/ui 0.1.4 → 0.1.6

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 (98) hide show
  1. package/dist/client/_coffre/assets/account-BIyXNVE7.js +1 -0
  2. package/dist/client/_coffre/assets/{account-C4bNbeO7.js → account-aO-xPRzC.js} +2 -2
  3. package/dist/client/_coffre/assets/{affordances-DiuJIiR2.js → affordances-CmoY-8Xf.js} +1 -1
  4. package/dist/client/_coffre/assets/audit-BOhJ99zA.js +1 -0
  5. package/dist/client/_coffre/assets/{audit-Dzj5DyKt.js → audit-SvZcBu5r.js} +2 -2
  6. package/dist/client/_coffre/assets/{auth.device-D2pCLF-X.js → auth.device-DKOf08ug.js} +1 -1
  7. package/dist/client/_coffre/assets/{auth.device-BfCfeBWe.js → auth.device-u__CNnL_.js} +2 -2
  8. package/dist/client/_coffre/assets/{coffre-C7qL3HGR.js → coffre-B0SRYkyG.js} +1 -1
  9. package/dist/client/_coffre/assets/directory--9Q70fmm.js +1 -0
  10. package/dist/client/_coffre/assets/globals-BvlyrLi8.css +1 -0
  11. package/dist/client/_coffre/assets/{grants-fqTtJ-aW.js → grants-BxXkQT0q.js} +1 -1
  12. package/dist/client/_coffre/assets/index-CBgc7lsY.js +12 -0
  13. package/dist/client/_coffre/assets/login-C-wTm_t1.js +2 -0
  14. package/dist/client/_coffre/assets/{login-DZizFxa4.js → login-CLLv1om9.js} +1 -1
  15. package/dist/client/_coffre/assets/{offboarding-DOLJQcXU.js → offboarding-BmFuQEv1.js} +1 -1
  16. package/dist/client/_coffre/assets/{page-BxW2MwaX.js → page-DbSS7pYH.js} +1 -1
  17. package/dist/client/_coffre/assets/{preload-helper-BHuP8_FL.js → preload-helper-DduCCcmc.js} +3 -3
  18. package/dist/client/_coffre/assets/principal-page-CaAlOB_1.js +1 -0
  19. package/dist/client/_coffre/assets/projects._project._environment-CAHNmhje.js +2 -0
  20. package/dist/client/_coffre/assets/{projects._project._environment-CwRVG9Ne.js → projects._project._environment-D5vWbgMo.js} +3 -3
  21. package/dist/client/_coffre/assets/projects._project.index-BQw4N8k-.js +1 -0
  22. package/dist/client/_coffre/assets/projects._project.index-CnqMmMG7.js +2 -0
  23. package/dist/client/_coffre/assets/{projects.index-B8eV8JIn.js → projects.index-9RVSbXjb.js} +1 -1
  24. package/dist/client/_coffre/assets/{projects.index-BNEC7Oz8.js → projects.index-DHIeFVLP.js} +2 -2
  25. package/dist/client/_coffre/assets/settings-BHtK75j4.js +2 -0
  26. package/dist/client/_coffre/assets/{settings-BrS0-wEt.js → settings-DYc9gBwr.js} +1 -1
  27. package/dist/client/_coffre/assets/tokens._token-D69aJAyr.js +2 -0
  28. package/dist/client/_coffre/assets/tokens._token-Yb0ESFen.js +1 -0
  29. package/dist/client/_coffre/assets/{tokens.index-XvA4XRxh.js → tokens.index-Cl6jAaG1.js} +1 -1
  30. package/dist/client/_coffre/assets/tokens.index-T5bax16J.js +2 -0
  31. package/dist/client/_coffre/assets/{unregistered-CTRMtBIy.js → unregistered-D5go1AfR.js} +1 -1
  32. package/dist/client/_coffre/assets/{use-action-DgAf-tiX.js → use-action-LiHC8kKH.js} +1 -1
  33. package/dist/client/_coffre/assets/users._user-5op2n3T0.js +2 -0
  34. package/dist/client/_coffre/assets/users._user-Dd--epXf.js +1 -0
  35. package/dist/client/_coffre/assets/{users.index-B03beUHq.js → users.index-CBnyTZ5s.js} +1 -1
  36. package/dist/client/_coffre/assets/users.index-D2wC7VUt.js +2 -0
  37. package/dist/server/.vite/manifest.json +141 -141
  38. package/dist/server/_coffre/assets/{_tanstack-start-manifest_v-CQrSBuAx.js → _tanstack-start-manifest_v-DxrPXbxf.js} +39 -39
  39. package/dist/server/_coffre/assets/{account-B71_b5xc.js → account-BCWiHL02.js} +4 -4
  40. package/dist/server/_coffre/assets/{account-BoO6ZqMc.js → account-o6Aa9ewL.js} +3 -3
  41. package/dist/server/_coffre/assets/{audit-mGcuoCZV.js → audit-DErFBScb.js} +3 -3
  42. package/dist/server/_coffre/assets/{audit-BsLd3asn.js → audit-LnICjwY-.js} +2 -2
  43. package/dist/server/_coffre/assets/{auth.device-1IcJ475s.js → auth.device-MPFjFR1J.js} +3 -3
  44. package/dist/server/_coffre/assets/{auth.device-CJwZYYtn.js → auth.device-SSruoUMA.js} +2 -2
  45. package/dist/server/_coffre/assets/{directory-wm_JQUfk.js → directory-CRoVBkX-.js} +2 -2
  46. package/dist/server/_coffre/assets/globals-BvlyrLi8.css +1 -0
  47. package/dist/server/_coffre/assets/{grants-BmhEY1vz.js → grants-ahmQsPAJ.js} +2 -2
  48. package/dist/server/_coffre/assets/{login-B5O5LPXV.js → login-CQw_o6Gr.js} +3 -3
  49. package/dist/server/_coffre/assets/{login-Bvc4gp0X.js → login-SfzjEmZT.js} +2 -2
  50. package/dist/server/_coffre/assets/{offboarding-CvSilnSm.js → offboarding-uVHZUfo4.js} +3 -3
  51. package/dist/server/_coffre/assets/{page-BjXk0Ehu.js → page-DiOsIrE3.js} +42 -31
  52. package/dist/server/_coffre/assets/{principal-page-DkwNGzM2.js → principal-page-DtNYUrPB.js} +5 -5
  53. package/dist/server/_coffre/assets/{projects._project._environment-7grhqlgq.js → projects._project._environment-B32fcj4E.js} +3 -3
  54. package/dist/server/_coffre/assets/{projects._project._environment-ByEf6pmz.js → projects._project._environment-DX0oRk5K.js} +2 -2
  55. package/dist/server/_coffre/assets/{projects._project.index-B1bjowP-.js → projects._project.index-CVXek833.js} +5 -5
  56. package/dist/server/_coffre/assets/{projects._project.index-DU8wtoHD.js → projects._project.index-DolB6jZJ.js} +3 -3
  57. package/dist/server/_coffre/assets/{projects.index-kMDA6pMy.js → projects.index-DRUvHYRZ.js} +2 -2
  58. package/dist/server/_coffre/assets/{projects.index-B0DoHbCz.js → projects.index-JE5sEeRy.js} +3 -3
  59. package/dist/server/_coffre/assets/{router-xk2rumMi.js → router-C8HpE1F2.js} +44 -29
  60. package/dist/server/_coffre/assets/{settings-Cg5qOGij.js → settings-BI5qwClp.js} +3 -3
  61. package/dist/server/_coffre/assets/{settings-CM9-h7in.js → settings-RcERS7mp.js} +3 -3
  62. package/dist/server/_coffre/assets/{tokens._token-Di4OZdAA.js → tokens._token-BuCKWsUv.js} +3 -3
  63. package/dist/server/_coffre/assets/{tokens._token-CCpaPMAk.js → tokens._token-DAWPmrdO.js} +4 -4
  64. package/dist/server/_coffre/assets/{tokens.index-tDKq4AFh.js → tokens.index-BLOTM9hK.js} +3 -3
  65. package/dist/server/_coffre/assets/{tokens.index-Do3OHR31.js → tokens.index-C31-24r3.js} +4 -4
  66. package/dist/server/_coffre/assets/{ui-BNzhIAQP.js → ui-LHVjaG5-.js} +1 -1
  67. package/dist/server/_coffre/assets/{unregistered-BqaWYFJK.js → unregistered-DRza-1nD.js} +1 -1
  68. package/dist/server/_coffre/assets/{users._user-Cp039Va-.js → users._user-CC9cDYJq.js} +3 -3
  69. package/dist/server/_coffre/assets/{users._user-BenYva93.js → users._user-CTNj1X5H.js} +2 -2
  70. package/dist/server/_coffre/assets/{users.index-DQ_45DQl.js → users.index-CNR62ijQ.js} +4 -4
  71. package/dist/server/_coffre/assets/{users.index-BrzG1Ecq.js → users.index-CwDEKMnN.js} +3 -3
  72. package/dist/server/index.js +2 -2
  73. package/package.json +5 -4
  74. package/src/assets/apple-touch-icon.png +0 -0
  75. package/src/assets/favicon-32.png +0 -0
  76. package/src/components/icons.tsx +17 -11
  77. package/src/components/mark.ts +44 -0
  78. package/src/components/shell.tsx +1 -3
  79. package/src/routes/__root.tsx +10 -4
  80. package/src/styles/globals.css +0 -10
  81. package/dist/client/_coffre/assets/account-C3Zo1l5A.js +0 -1
  82. package/dist/client/_coffre/assets/audit-h7CmJBTo.js +0 -1
  83. package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +0 -1
  84. package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +0 -1
  85. package/dist/client/_coffre/assets/index-C1l9I4jg.js +0 -12
  86. package/dist/client/_coffre/assets/login-CR9CBXlw.js +0 -2
  87. package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +0 -1
  88. package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +0 -2
  89. package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +0 -2
  90. package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +0 -1
  91. package/dist/client/_coffre/assets/settings-2BPsenNM.js +0 -2
  92. package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +0 -2
  93. package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +0 -1
  94. package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +0 -2
  95. package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +0 -2
  96. package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +0 -1
  97. package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +0 -2
  98. package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +0 -1
@@ -0,0 +1 @@
1
+ import{$ as e,C as t,F as n,Ot as r,Q as i,Tt as a,a as o,ct as s,i as c,m as l,n as u,ot as d,tt as f,v as p}from"./page-DbSS7pYH.js";import{D as m,a as h,c as g,l as _,o as v,s as y}from"./preload-helper-DduCCcmc.js";import{i as b,o as x,r as S,s as C}from"./coffre-B0SRYkyG.js";import{r as w,t as T}from"./use-action-LiHC8kKH.js";import{a as E,i as D,r as O,s as k}from"./directory--9Q70fmm.js";import{i as A,n as j,o as M,t as N}from"./grants-BxXkQT0q.js";import{r as P,t as F}from"./offboarding-BmFuQEv1.js";var I=r(a(),1);function L(e,t){return Object.hasOwn(e.environments,t)?e.environments[t]:null}function R(e,t){if(e.length===0)return{level:`none`,expiresAt:null,environments:{}};let[n]=e;if(e.length===1&&n.environmentSlug===null&&(n.role===`owner`||n.role===`viewer`||n.role===`developer`))return{level:n.role,expiresAt:n.expiresAt,environments:{}};let r={};for(let n of e){let e=n.environmentSlug;if(e===null||!t.includes(e)||Object.hasOwn(r,e)||n.role!==`viewer`&&n.role!==`developer`)return{level:`custom`,expiresAt:null,environments:{}};r[e]={role:n.role,expiresAt:n.expiresAt}}return{level:`env`,expiresAt:null,environments:r}}function z(e,t,n){if(t===`env`&&(e.level===`viewer`||e.level===`developer`)&&Object.keys(e.environments).length===0){let r={role:e.level,expiresAt:e.expiresAt};return{...e,level:t,environments:Object.fromEntries(n.map(e=>[e,r]))}}return{...e,level:t}}function B(e,t,n){let r={...e.environments};return n===null?delete r[t]:r[t]=n,{...e,environments:r}}function V(e){switch(e.level){case`none`:case`custom`:return[];case`owner`:case`viewer`:case`developer`:return[{role:e.level,environmentSlug:null,expiresAt:e.expiresAt}];case`env`:return Object.entries(e.environments).map(([e,t])=>({environmentSlug:e,...t}))}}function H(e,t){return e===t||e!==null&&t!==null&&Date.parse(e)===Date.parse(t)}function U(e,t){if(t.level===`custom`)return[];let n=e=>`${e.role}@${e.environmentSlug??``}`,r=new Map(V(t).map(e=>[n(e),e])),i=new Map(e.map(e=>[n(e),e])),a=[];for(let[e,t]of r)i.has(e)||a.push({kind:`create`,...t});for(let[e,t]of i){let n=r.get(e);n!==void 0&&!H(t.expiresAt,n.expiresAt)&&a.push({kind:`expiry`,grant:t,expiresAt:n.expiresAt})}for(let[e,t]of i)r.has(e)||a.push({kind:`revoke`,grant:t});return a}function W(e,t){let n=t=>t===null?e:`${e}/${t}`,r=(e,t)=>t===null?e:{role:e,until:t},i={};for(let e of t)e.kind===`revoke`&&(i[n(e.grant.environmentSlug)]=null);for(let e of t)e.kind===`expiry`&&(i[n(e.grant.environmentSlug)]=r(e.grant.role,e.expiresAt)),e.kind===`create`&&(i[n(e.environmentSlug)]=r(e.role,e.expiresAt));return i}function G(e){return e===``?null:new Date(`${e}T23:59:59Z`).toISOString()}function K(e){return e===null?``:e.slice(0,10)}var q=s();async function J(e,t,n,r){let i=(r?.projects??[]).filter(e=>e.permissions.includes(`grant.manage`)),[a,o]=await Promise.all([r?.capabilities.canManageGrants?x(async()=>{try{return{report:await e.members.get(S(t,n))}}catch(e){if(b(e)===404)return{report:null};throw e}}):Promise.resolve(null),Promise.all(i.map(t=>A(e,t.slug)))]);return{report:a,access:o.flatMap(e=>e.ok?[{project:e.project,grants:e.grants.filter(e=>e.principalType===t&&e.principalId===n),grantsError:e.grantsError}]:[])}}function Y({principalType:e,principalId:n,data:r}){let a=d(),{instanceRole:s}=f({from:`__root__`}),{report:l,access:_}=r,v=D[e],y=e===`user`,b=y?`/users`:`/tokens`,x=l?.ok===!0?l.report:null,S=x?.status===`removed`,C=x!==null&&!S?{principalType:e,principalId:n,instanceRole:x.instanceRole,isRootAdmin:x.isRootAdmin,tampered:x.status===`tampered`}:void 0;if(l?.ok===!0&&x===null||l===null&&_.length===0)return(0,q.jsx)(u,{icon:y?(0,q.jsx)(i,{size:18}):(0,q.jsx)(t,{size:18}),label:(0,q.jsx)(`span`,{className:`mono`,children:n}),title:y?`No such user for you`:`No such token for you`,actions:(0,q.jsxs)(m,{className:`btn`,to:b,children:[`All `,y?`users`:`tokens`]}),children:l===null?`A ${v}'s page lists its access to the projects where you manage access, and you manage none.`:`No ${v} by that name has ever been registered here.`});let w=_.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=_.filter(e=>e.grantsError!==null),A=S?[]:_.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{lead:(0,q.jsx)(k,{type:e,id:n,size:`lg`}),title:n,meta:S?(0,q.jsx)(`span`,{className:`tag tag-red`,children:`Removed`}):C?.principalType===`user`&&(0,q.jsx)(O,{principal:C}),actions:(A.length>0||C!==void 0)&&(0,q.jsxs)(q.Fragment,{children:[A.length>0&&(0,q.jsx)(X,{principalType:e,principalId:n,access:A}),C!==void 0&&(0,q.jsx)(E,{principal:C,trigger:`btn btn-icon`,onRemoved:()=>a.invalidate()})]})}),l?.ok===!1&&(0,q.jsx)(`div`,{className:`report-notice`,children:(0,q.jsx)(g,{tone:`bad`,children:l.error})}),S&&x!==null&&(0,q.jsx)(P,{report:x}),!S&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{className:`section-title`,children:`Project access`}),T.map(({project:e,grantsError:t})=>(0,q.jsx)(`div`,{style:{marginBottom:`0.75rem`},children:(0,q.jsxs)(g,{tone:`bad`,children:[(0,q.jsx)(`span`,{className:`mono`,children:e.slug}),`: `,t]})},e.slug)),(0,q.jsx)(`section`,{className:`card`,"aria-label":`Project access`,children:w.length===0?(0,q.jsx)(h,{title:`No project access yet`,children:A.length>0?`Edit access gives this ${v} access to several projects at once.`:`None of the projects where you manage access has a grant for this ${v}.`}):(0,q.jsx)(j,{lead:(0,q.jsxs)(`span`,{className:`th`,children:[(0,q.jsx)(p,{size:14}),`Project`]}),children:w.map(({project:e,grant:t},n)=>(0,q.jsx)(N,{number:n+1,project:e.slug,grant:t,leadLabel:`Project`,lead:(0,q.jsxs)(`span`,{className:`cell-project`,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsx)(m,{className:`cell-link`,to:`/projects/$project`,params:{project:e.slug},search:{tab:y?`users`:`tokens`},children:e.name}),e.archivedAt!==null&&(0,q.jsx)(`span`,{className:`tag tag-red`,children:`archived`})]})},t.id))})}),s!==`root-admin`&&(0,q.jsx)(`p`,{className:`hint section-foot`,children:`Only projects where you manage access are listed.`})]}),x!==null&&(0,q.jsx)(F,{report:x})]})}function X({principalType:e,principalId:t,access:r}){let i=C(),[a,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)({}),{pending:u,error:d,setError:f,run:p}=T(),m=D[e],h=r.map(({project:e,grants:t})=>{let n=e.environments.filter(e=>e.details!==null&&e.details.archivedAt===null).map(e=>e.slug),r=R(t,n),i=Object.hasOwn(c,e.slug)?c[e.slug]:r;return{project:e,grants:t,environments:n,held:r,plan:i,changes:U(t,i)}}),g=h.filter(e=>e.changes.length>0);function b(){s(!1),l({}),f(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,q.jsx)(n,{size:14}),`Edit access`]}),(0,q.jsx)(y,{open:a,onOpenChange:e=>e?s(!0):b(),title:(0,q.jsxs)(q.Fragment,{children:[`Edit access for `,(0,q.jsx)(`span`,{className:`mono`,children:t})]}),description:`Set what this ${m} can reach on each project you manage, and until when. Saving applies only what you changed.`,wide:!0,children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault(),p(()=>i.access.set(S(e,t),Object.assign({},...g.map(({project:e,changes:t})=>W(e.slug,t)))),()=>{w.success(`Updated ${t}’s access on ${g.length} project${g.length===1?``:`s`}`),b()})},children:[(0,q.jsxs)(`ul`,{className:`plan-list`,children:[(0,q.jsxs)(`li`,{className:`plan-head`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{children:`Project`}),(0,q.jsx)(`span`,{children:`Access`}),(0,q.jsx)(`span`,{children:`Expires`})]}),h.map(({project:e,grants:t,environments:n,held:r,plan:i,changes:a})=>{let s=`plan-${e.slug}`,c=t=>l(n=>({...n,[e.slug]:t}));return(0,q.jsxs)(`li`,{className:`plan-row${a.length>0?` is-changed`:``}`,children:[(0,q.jsxs)(`label`,{className:`plan-project`,htmlFor:s,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsxs)(`span`,{className:`plan-project-text`,children:[(0,q.jsx)(`span`,{className:`plan-project-name`,children:e.name}),r.level===`custom`&&(0,q.jsxs)(`span`,{className:`plan-project-held`,children:[`Holds `,t.map(e=>M(e)).join(`, `)]})]})]}),(0,q.jsxs)(`select`,{id:s,className:`select select-sm`,value:i.level,onChange:e=>c(z(i,e.target.value,n)),children:[r.level===`custom`&&(0,q.jsx)(`option`,{value:`custom`,children:`Keep as is`}),(0,q.jsx)(`option`,{value:`none`,children:`No access`}),(0,q.jsx)(`option`,{value:`owner`,children:`Owner`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read: all`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write: all`}),n.length>0&&(0,q.jsx)(`option`,{value:`env`,children:`Per environment…`})]}),(i.level===`owner`||i.level===`viewer`||i.level===`developer`)&&(0,q.jsx)(Z,{label:`${e.name} expires`,expiresAt:i.expiresAt,onChange:e=>c({...i,expiresAt:e})}),i.level===`env`&&(0,q.jsx)(`ul`,{className:`plan-envs`,"aria-label":`Environments of ${e.name}`,children:n.map(t=>{let n=L(i,t);return(0,q.jsxs)(`li`,{className:`plan-env`,children:[(0,q.jsx)(`label`,{className:`mono`,htmlFor:`${s}-${t}`,children:t}),(0,q.jsxs)(`select`,{id:`${s}-${t}`,className:`select select-sm`,value:n?.role??``,onChange:e=>{let r=e.target.value;c(B(i,t,r===`viewer`||r===`developer`?{role:r,expiresAt:n?.expiresAt??null}:null))},children:[(0,q.jsx)(`option`,{value:``,children:`No access`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write`})]}),n!==null&&(0,q.jsx)(Z,{label:`${t} of ${e.name} expires`,expiresAt:n.expiresAt,onChange:e=>c(B(i,t,{...n,expiresAt:e}))})]},t)})}),a.length>0&&(0,q.jsx)(`ul`,{className:`plan-changes`,"aria-label":`Changes to ${e.name}`,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{change:e})},e.kind===`create`?`+${e.role}@${e.environmentSlug??``}`:e.grant.id))})]},e.slug)})]}),(0,q.jsx)(v,{error:d}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:u||g.length===0,children:[u&&(0,q.jsx)(_,{}),`Save changes`]})]})]})})]})}function Z({label:t,expiresAt:n,onChange:r}){let i=K(n);return(0,q.jsxs)(`span`,{className:`expiry${i===``?` is-never`:``}`,children:[(0,q.jsx)(`input`,{className:`input select-sm`,type:`date`,"aria-label":t,min:new Date().toISOString().slice(0,10),value:i,onChange:e=>r(G(e.target.value))}),(0,q.jsx)(`span`,{className:`expiry-never`,"aria-hidden":`true`,children:`Never`}),(0,q.jsx)(`button`,{className:`btn btn-quiet btn-sm btn-icon`,type:`button`,"aria-label":`${t}: never`,title:`Never expires`,onClick:()=>r(null),children:(0,q.jsx)(e,{size:12})})]})}function Q({change:e}){let t=e=>e===null?``:` until ${K(e)}`;switch(e.kind){case`create`:return(0,q.jsxs)(`span`,{className:`tag tag-green`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Adds`}),M({...e,roleName:e.role}),t(e.expiresAt)]});case`expiry`:return(0,q.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,q.jsx)(l,{size:12}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Moves the expiry of`}),M(e.grant),e.expiresAt===null?`, no expiry`:t(e.expiresAt)]});case`revoke`:return(0,q.jsxs)(`span`,{className:`tag tag-red`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Removes`}),M(e.grant)]})}}export{J as n,Y as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-D5vWbgMo.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-B0SRYkyG.js";var i=e(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:async({context:{client:e},params:t})=>{let n=`${t.project}/${t.environment}`,[i,a]=await Promise.all([r(()=>e.secrets.list(n)),r(()=>e.syncs.list(n))]);return{keys:i,syncs:a}},component:n(()=>t(()=>import(`./projects._project._environment-D5vWbgMo.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
@@ -1,3 +1,3 @@
1
- import{B as e,C as t,D as n,F as r,I as i,J as a,L as o,N as s,Ot as c,R as l,Tt as u,V as d,X as f,Y as p,_ as m,b as h,c as g,ct as _,et as v,g as y,i as b,l as x,m as S,n as C,ot as w,q as T,s as ee,t as E,tt as D,x as O}from"./page-BxW2MwaX.js";import{D as te,a as ne,c as k,d as A,f as j,g as M,i as re,l as N,m as P,n as F,o as I,r as L,s as R,u as z}from"./preload-helper-BHuP8_FL.js";import{c as ie,d as ae,f as B,l as V,m as H,n as U,o as W,p as G,s as K,t as q}from"./coffre-C7qL3HGR.js";import{r as J,t as Y}from"./use-action-DgAf-tiX.js";import{i as X,o as oe}from"./affordances-DiuJIiR2.js";import{t as se}from"./projects._project._environment-CrWjQmIA.js";import{t as ce}from"./validation-9Cl_XS-l.js";var le=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function ue(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!le.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=fe(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=pe(u.slice(1,e)),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function de(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function fe(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function pe(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
2
- `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Z=c(u(),1);function Q(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function me(e,t,n){let r=e.filter(e=>!Q(n,e.key)?.archived).map(e=>Q(n,e.key)?.key.trim()??e.key);if(new Set(r).size!==r.length)return!0;let i=t.map(e=>e.key.trim());if(new Set(i).size!==i.length)return!0;let a=new Set(e.flatMap(e=>{let t=Q(n,e.key);return t!==void 0&&!t.archived&&t.value!==null?[t.key.trim()]:[]}));if(i.some(e=>a.has(e)))return!0;let o=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key));return i.some(e=>o.has(e))}async function he({active:e,drafts:t,changes:n,operations:r}){let i={...n},a=ge(e,t,n);if(a instanceof Error)return{applied:0,drafts:[...t],changes:i,error:a};let o=0,s=Object.create(null);try{for(let{sourceKey:e,change:t}of a){if(t.archived){s[e]=null;continue}let n=t.key.trim();n!==e&&(await r.rename(e,n),delete i[e],o+=1,t.value!==null&&(i[n]={key:n,value:t.value,archived:!1})),t.value!==null&&(s[n]=t.value)}for(let e of t)s[e.key.trim()]=e.value;let e=Object.keys(s).length;return e>0&&await r.write({...s}),{applied:o+e,drafts:[],changes:{},error:null}}catch(e){return{applied:o,drafts:[...t],changes:i,error:e}}}function ge(e,t,n){let r=new Set(e.map(e=>e.key)),i=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key)),a=t.find(e=>i.has(e.key.trim()));if(a)return Error(`${a.key.trim()}: cannot archive and write the same key in one save`);let o=new Map,s=[];for(let t of e){let e=Q(n,t.key);e!==void 0&&(!e.archived&&e.key.trim()!==t.key?o.set(t.key,e):s.push({sourceKey:t.key,change:e}))}for(let[e,t]of o){let n=t.key.trim();if(r.has(n)&&!o.has(n))return Error(`${e}: ${n} is already in use`)}let c=[],l=new Set;for(;o.size>0;){let e=[...o].find(([,e])=>{let t=e.key.trim();return!r.has(t)||l.has(t)});if(!e)return Error(`Secret renames contain a cycle. Save them in separate steps.`);let[t,n]=e;o.delete(t),l.add(t),c.push({sourceKey:t,change:n})}return[...c,...s]}function _e(e,t){return e!==null&&e.version===t}var $=_(),ve=2e3,ye=6e4;function be({project:e,environment:t,result:n,canRun:r}){let i=w(),a=n.ok&&n.syncs.some(e=>e.running);if((0,Z.useEffect)(()=>{if(!a)return;let e=setInterval(()=>void i.invalidate(),ve);return()=>clearInterval(e)},[a,i]),n.ok&&n.syncs.length===0&&!n.canManage)return null;let o=n.ok&&n.canManage;return(0,$.jsx)(E,{labelledBy:`syncs`,title:`Syncs`,description:`Destinations these secrets are pushed to. A change goes out when it is saved, and every hour coffre checks each destination and repairs what drifted.`,actions:o?(0,$.jsx)(De,{project:e,environment:t}):void 0,children:n.ok?n.syncs.length===0?(0,$.jsxs)(ne,{title:`Not synced anywhere`,children:[`Push these secrets where your code runs, such as GitHub Actions or Vercel, and keep them current there. Anything else can read them with `,(0,$.jsx)(`code`,{children:`coffre run`}),`.`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt syncs stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Destination`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Status`}),(0,$.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:n.syncs.map(e=>(0,$.jsx)(xe,{sync:e,canRun:r,canManage:o},e.id))})]})}):(0,$.jsx)(`div`,{className:`card-body`,children:(0,$.jsx)(I,{error:n.error})})})}function xe({sync:e,canRun:t,canManage:n}){let[i,c]=(0,Z.useState)(!1),l=K(),u=Y(),d=Y(),f=u.pending||d.pending,p=u.error??d.error;function m(){u.run(()=>l.syncs.run(e.id),t=>we(e,t.outcome))}function h(t){d.run(()=>l.syncs.update(e.id,{paused:t}),()=>J.success(t?`Paused ${e.destination}`:`Resumed ${e.destination}`,{action:{label:`Undo`,onClick:()=>h(!t)}}))}let g=p??(e.offered?e.lastError:null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:g!==null&&!e.running?`has-error`:void 0,children:[(0,$.jsx)(`td`,{className:`col-destination`,children:(0,$.jsxs)(`span`,{className:`cell-account`,children:[(0,$.jsx)(a,{brand:e.brand,size:15}),(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(`span`,{children:e.providerLabel}),e.offered?(0,$.jsx)(`small`,{className:`mono`,children:e.destination}):(0,$.jsx)(`small`,{children:`No longer offered by this deployment`})]})]})}),(0,$.jsx)(`td`,{className:`nowrap col-status`,children:(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(Se,{sync:e}),(0,$.jsx)(`small`,{children:(0,$.jsx)(Ce,{sync:e})})]})}),(0,$.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:e.credential}),(0,$.jsxs)(`td`,{className:`col-actions`,children:[(0,$.jsxs)(`div`,{className:`acts`,children:[t&&!e.paused&&(0,$.jsxs)(`button`,{className:`act`,onClick:m,disabled:f||e.running||!e.offered,title:e.offered?void 0:`This deployment no longer offers this provider`,children:[u.pending?(0,$.jsx)(N,{size:13}):(0,$.jsx)(T,{size:13}),`Run now`]}),n&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${e.destination}`,disabled:f,children:(0,$.jsx)(s,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>h(!e.paused),children:[e.paused?(0,$.jsx)(o,{size:14}):(0,$.jsx)(r,{size:14}),e.paused?`Resume`:`Pause`]}),(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>c(!0),children:[(0,$.jsx)(v,{size:14}),`Remove`]})]})})]})]}),(0,$.jsx)(L,{open:i,onOpenChange:c,title:(0,$.jsxs)($.Fragment,{children:[`Stop syncing to `,(0,$.jsx)(`span`,{className:`mono`,children:e.destination}),`?`]}),body:`Nothing more is pushed to ${e.providerLabel}. Keys coffre already pushed stay there; remove them at ${e.providerLabel} if they should go too.`,confirmLabel:`Remove sync`,onConfirm:()=>d.run(()=>l.syncs.remove(e.id),()=>J.success(`No longer syncing to ${e.destination}`))})]})]}),g!==null&&!e.running&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:4,children:(0,$.jsx)(I,{error:g})})})]})}function Se({sync:e}){return e.offered?e.running?(0,$.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,$.jsx)(N,{size:11}),`Pushing`]}):e.paused?(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Paused`}):e.lastStatus===`failed`?(0,$.jsx)(`span`,{className:`tag tag-red`,children:`Failed`}):e.pending>0?(0,$.jsxs)(`span`,{className:`tag tag-amber`,children:[e.pending,` pending`]}):e.lastStatus===`partial`?(0,$.jsx)(`span`,{className:`tag tag-amber`,children:`Partial`}):e.lastRunAt===null?(0,$.jsx)(`span`,{className:`tag`,children:`Not run yet`}):(0,$.jsx)(`span`,{className:`tag tag-green`,children:`In sync`}):(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Unavailable`})}function Ce({sync:e}){let t=e.skipped.length,n=[];return(e.synced>0||e.pending===0)&&n.push(`${e.synced} synced`),e.pending>0&&n.push(`${e.pending} pending`),t>0&&n.push((0,$.jsx)(j,{label:(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:`1rem`},children:e.skipped.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`mono`,children:e.key}),`: `,e.reason]},e.key))}),children:(0,$.jsxs)(`button`,{type:`button`,className:`tag tag-amber tag-button`,children:[(0,$.jsx)(g,{size:11}),t,` skipped`]})})),e.lastRunAt!==null&&n.push((0,$.jsx)(z,{iso:e.lastRunAt,display:`relative`})),(0,$.jsx)($.Fragment,{children:n.map((e,t)=>(0,$.jsxs)(Z.Fragment,{children:[t>0&&` · `,e]},t))})}function we(e,t){if(t.status===`busy`){J(`A run is already under way`,{description:`Its result appears here when it ends.`});return}let n=t.upserted.length+t.deleted.length;if(t.status===`failed`)J.error(`Could not sync to ${e.destination}`,{description:t.error??void 0});else if(t.status===`partial`)J.warning(`${t.failed.length} of ${n+t.failed.length} changes failed`,{description:t.failed[0]?.message});else if(n===0)J.success(`${e.destination} was already current`);else{let n=[t.upserted.length>0&&`pushed ${t.upserted.length}`,t.deleted.length>0&&`removed ${t.deleted.length}`].filter(Boolean);J.success(`${Ee(n.join(`, `))} to ${e.destination}`)}}async function Te(e,t,n,r){let i=J.loading(`Pushing to ${n.destination}`,{description:`The first push is under way.`}),a=Date.now()+ye;for(;Date.now()<a;){await new Promise(e=>setTimeout(e,ve));let a=await W(()=>e.syncs.list(t)),o=a.ok?a.syncs.find(e=>e.id===n.id):void 0;if(!(o===void 0||o.running||o.lastRunAt===null)){await r(),o.lastStatus===`failed`?J.error(`Could not sync to ${n.destination}`,{id:i,description:o.lastError??void 0}):o.lastStatus===`partial`?J.warning(`Synced to ${n.destination}, but not every key`,{id:i,description:o.lastError??void 0}):J.success(`Synced to ${n.destination}`,{id:i,description:`${o.synced} ${o.synced===1?`key is`:`keys are`} there now.`});return}}await r(),J(`Still pushing to ${n.destination}`,{id:i,description:`Its result appears in the list when it ends.`})}function Ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}function De({project:e,environment:t}){let[n,r]=(0,Z.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,$.jsx)(l,{size:14}),`Add sync`]}),(0,$.jsx)(R,{open:n,onOpenChange:r,title:(0,$.jsxs)($.Fragment,{children:[`Sync `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),description:`Every key in this environment is pushed to the destination and kept current. coffre only ever removes keys it pushed itself.`,wide:!0,children:(0,$.jsx)(Oe,{children:n=>(0,$.jsx)(ke,{project:e,environment:t,providers:n,onDone:()=>r(!1)})})})]})}function Oe({children:e}){let t=K(),[n,r]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{let e=!0;return W(()=>t.syncs.providers()).then(t=>{e&&r(t)}),()=>{e=!1}},[t]),n===null?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[(0,$.jsx)(N,{size:13}),`Loading where coffre can sync to…`]}):n.ok?n.providers.length===0?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[`This instance offers nowhere to sync to. Whoever runs coffre lists the providers in its`,` `,(0,$.jsx)(`span`,{className:`mono`,children:`syncs`}),` settings.`]}):e(n.providers):(0,$.jsx)(`div`,{className:`sync-providers-state`,children:(0,$.jsx)(I,{error:n.error})})}function ke({project:e,environment:t,providers:n,onDone:r}){let[i,o]=(0,Z.useState)(n[0]),[s,c]=(0,Z.useState)(()=>B(n[0])),[l,u]=(0,Z.useState)(``),d=K(),f=w(),{pending:p,error:m,setError:h,run:g}=Y(),_=ae(i,s);function v(e){o(e),c(B(e)),h(null)}function y(e,t){c(n=>({...n,[e]:t}))}return(0,$.jsxs)(`form`,{className:`form`,style:{marginTop:`1.25rem`},onSubmit:n=>{n.preventDefault(),g(()=>d.syncs.add(`${e}/${t}`,{provider:i.id,config:V(i,s),credential:l.trim()}),n=>{r(),Te(d,`${e}/${t}`,n,()=>f.invalidate())})},children:[n.length>1&&(0,$.jsx)(`div`,{className:`choice-grid sync-providers`,role:`group`,"aria-label":`Destination`,children:n.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e.id===i.id,onClick:()=>v(e),children:[(0,$.jsx)(a,{brand:e.brand}),e.label]},e.id))}),(0,$.jsx)(`div`,{className:`form-row`,children:i.fields.map(e=>{if(!G(e,s))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:s[e.name],placeholder:e.placeholder,spellCheck:!1,autoComplete:`off`,onChange:t=>y(e.name,t.target.value)}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`);let t=s[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:()=>y(e.name,e.multiple?t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value]:[n.value]),children:n.label},n.value))}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`)})}),(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`Token`}),(0,$.jsx)(`input`,{className:`input input-mono`,value:l,placeholder:i.credential.placeholder,spellCheck:!1,autoComplete:`off`,onChange:e=>u(e.target.value)}),(0,$.jsxs)(`span`,{className:`hint`,children:[`The secret that holds it, as `,(0,$.jsx)(`code`,{children:`project/environment/KEY`}),`. An environment of its own, such as `,(0,$.jsx)(`code`,{children:`ops/sync`}),`, keeps it from everyone who reads these secrets. You need read access to it.`]})]}),(0,$.jsx)(k,{tone:`info`,children:i.credential.hint}),(0,$.jsx)(I,{error:m}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,type:`button`,onClick:r,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:p||_!==null||l.trim()===``,title:_===null?void 0:`${_} is required`,children:[p&&(0,$.jsx)(N,{}),`Start syncing`]})]})]})}var Ae=45;function je(){let{keys:e,syncs:t}=se.useLoaderData(),{project:r,environment:i}=se.useParams();return e.ok?(0,$.jsx)(Me,{project:r,environment:i,permissions:e.permissions,keys:e.keys,syncs:t},`${r}/${i}`):(0,$.jsx)(C,{icon:(0,$.jsx)(n,{size:18}),label:(0,$.jsxs)(`span`,{className:`mono`,children:[r,`/`,i]}),title:`This environment is closed to you`,actions:(0,$.jsxs)(te,{className:`btn`,to:`/projects/$project`,params:{project:r},children:[`Back to `,r]}),children:e.error})}function Me({project:e,environment:r,permissions:i,keys:a,syncs:o}){let s=w(),c=K(),u=`${e}/${r}`,[f,m]=(0,Z.useState)([]),[g,_]=(0,Z.useState)({}),[v,y]=(0,Z.useState)(()=>new Set),[x,C]=(0,Z.useState)(!1),[T,D]=(0,Z.useState)(null),[O,te]=(0,Z.useState)(se.useSearch().filter??``),k=(0,Z.useRef)(0),A=i.includes(`secret.write`),j=i.includes(`secret.archive`),M=oe(i),P=a.filter(e=>!e.archived),F=a.filter(e=>e.archived),I=new Set(a.map(e=>e.key)),L=P.filter(e=>Q(g,e.key)!==void 0),R=me(P,f,g),z=[...f.map(e=>e.key.trim()),...L.flatMap(e=>{let t=Q(g,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],ie=z.some(e=>e===``),ae=z.some(e=>e!==``&&ce(e)!==null),B=f.length+L.length,V=B>0&&!ie&&!ae&&!R;function H(e,t){_(n=>{let r={...Q(n,e.key)??{key:e.key,value:null,archived:!1},...t};if(r.key!==e.key||r.value!==null||r.archived)return{...n,[e.key]:r};let{[e.key]:i,...a}=n;return a})}function W(e){_(t=>{let{[e]:n,...r}=t;return r}),y(t=>{let n=new Set(t);return n.delete(e),n})}function G(){m(e=>[{id:k.current++,key:``,value:``},...e])}function Y(){m([]),_({}),y(new Set),D(null)}async function X(){if(!V||x)return;C(!0),D(null);let e=await he({active:P,drafts:f,changes:g,operations:{rename:async(e,t)=>{try{await c.secrets.rename(`${u}/${e}`,t)}catch(t){throw new q(`${e}: ${U(t)}`)}},write:async e=>{try{await c.secrets.set(u,e)}catch(e){throw new q(U(e))}}}});if(m(e.drafts),_(e.changes),y(new Set),e.applied>0)try{await s.invalidate()}catch{D(`Saved, but the page could not refresh. Reload before you retry.`),C(!1);return}if(e.error===null)J.success(`Saved ${B} change${B===1?``:`s`}`);else{let t=e.error instanceof Error?e.error.message:`The request could not be sent.`;D(e.applied===0?t:`${t} The renames before it were saved; nothing else was, and the rest is ready to retry.`)}C(!1)}let le=(0,Z.useRef)(X);le.current=X,(0,Z.useEffect)(()=>{if(B===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),le.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B]);let ue=[...f.map(e=>({key:e.key.trim()||`unnamed`,what:I.has(e.key.trim())?`new version`:`added`})),...L.map(e=>{let t=Q(g,e.key);if(t.archived)return{key:e.key,what:`archived`};let n=t.key.trim()!==e.key;return n&&t.value!==null?{key:e.key,what:`→ ${t.key.trim()}, new value`}:n?{key:e.key,what:`→ ${t.key.trim()}`}:{key:e.key,what:`new value`}})],de=ie?null:R?`Two pending edits would end up with the same name. Secret names are unique in an environment.`:ae?`Names are letters, digits and underscores, and cannot start with a digit.`:null,fe=O.trim().toLowerCase(),pe=fe===``?P:P.filter(e=>e.key.toLowerCase().includes(fe));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{tile:e,title:r,aside:(0,$.jsx)(Ne,{project:e,environment:r}),actions:(0,$.jsxs)($.Fragment,{children:[A&&M&&(0,$.jsx)(We,{project:e,environment:r}),A&&(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,disabled:x,children:[(0,$.jsx)(l,{size:14}),`New secret`]})]})}),(P.length>0||f.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)(d,{size:14,className:`input-icon`}),(0,$.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:O,onChange:e=>te(e.target.value)})]}),(0,$.jsx)(`div`,{className:`toolbar-meta`,children:(0,$.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,$.jsx)(p,{size:14}),(0,$.jsxs)(`code`,{children:[`coffre run `,e,`/`,r,` -- …`]}),(0,$.jsx)(re,{value:`coffre run ${e}/${r} -- `,label:`Copy command`})]})})]}),(0,$.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:P.length===0&&f.length===0?(0,$.jsx)(ne,{title:`No secrets yet`,actions:A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,children:[(0,$.jsx)(l,{size:14}),`New secret`]}),M&&(0,$.jsx)(We,{project:e,environment:r})]}):void 0,children:A?`Add them one by one, or import an existing .env file. Nothing is written until you save, or until you have seen the import plan.`:`Nothing has been written to this environment, and adding the first secret needs secret.write.`}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(t,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(n,{size:14}),`Value`,!M&&(0,$.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(S,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsxs)(`tbody`,{children:[f.map(e=>(0,$.jsx)(ze,{draft:e,existingVersion:a.find(t=>t.key===e.key.trim())?.version??null,disabled:x,onChange:t=>m(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>m(t=>t.filter(t=>t.id!==e.id))},e.id)),pe.map(t=>{let n=Q(g,t.key);return(0,$.jsx)(Le,{number:P.indexOf(t)+1,project:e,environment:r,entry:t,change:n??{key:t.key,value:null,archived:!1},editing:n?.archived!==!0&&(v.has(t.key)||n!==void 0),canWrite:A,canArchive:j,canReveal:M,disabled:x,columns:6,onEdit:()=>y(e=>new Set(e).add(t.key)),onPatch:e=>H(t,e),onUndo:()=>W(t.key),onMarkArchive:()=>{y(e=>{let n=new Set(e);return n.delete(t.key),n}),_(e=>({...e,[t.key]:{key:t.key,value:null,archived:!0}}))}},t.key)}),pe.length===0&&P.length>0&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,O.trim(),`”.`]})})]})]})})}),(0,$.jsx)(be,{project:e,environment:r,result:o,canRun:A||i.includes(`environment.manage`)}),F.length>0&&(0,$.jsx)(E,{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)(t,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(S,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:F.map((t,n)=>(0,$.jsx)(Be,{number:n+1,project:e,environment:r,entry:t,canArchive:j,canReveal:M},t.key))})]})})}),B>0&&(0,$.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,$.jsxs)(`div`,{className:`savebar-inner`,children:[(0,$.jsxs)(`span`,{className:`savebar-count`,children:[(0,$.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),B,` unsaved change`,B===1?``:`s`]}),(0,$.jsxs)(`span`,{className:`savebar-summary`,children:[ue.slice(0,3).map((e,t)=>(0,$.jsxs)(`span`,{children:[t>0&&` · `,(0,$.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),ue.length>3&&` · and ${ue.length-3} more`]}),(0,$.jsxs)(`div`,{className:`savebar-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-sm`,onClick:Y,disabled:x,children:`Discard`}),(0,$.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>void X(),disabled:x||!V,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[x&&(0,$.jsx)(N,{size:13}),`Save `,B===1?`change`:`${B} changes`]})]}),(T??de)!==null&&(0,$.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,$.jsx)(ee,{size:14}),(0,$.jsx)(`span`,{children:T??de})]})]})})]})}function Ne({project:e,environment:t}){let{projects:n}=D({from:`__root__`}),r=n.find(t=>t.slug===e)?.environments.find(e=>e.slug===t)?.name;return r===void 0?null:(0,$.jsx)($.Fragment,{children:r})}function Pe({masked:e,className:t=``,...n}){let[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{i(typeof CSS<`u`&&CSS.supports(`-webkit-text-security`,`disc`))},[]),(0,$.jsx)(`input`,{...n,type:e&&!r?`password`:`text`,className:`${t}${e&&r?` is-masked`:``}`,autoComplete:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0})}function Fe({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Z.useState)(!1);return(0,$.jsxs)(`div`,{className:`input-group`,children:[(0,$.jsx)(Pe,{className:`input input-mono`,masked:!s,"aria-label":e,placeholder:r,value:t,disabled:i,autoFocus:a,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&o!==void 0&&o()}}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm btn-icon input-addon`,"aria-label":s?`Mask the value`:`Show the value`,"aria-pressed":s,onClick:()=>c(e=>!e),children:s?(0,$.jsx)(m,{size:14}):(0,$.jsx)(y,{size:14})})]})}function Ie(e){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.ceil(Ae-(t-e.at)/1e3))}function Le({number:t,project:n,environment:r,entry:a,change:o,editing:c,canWrite:l,canArchive:u,canReveal:d,disabled:f,columns:p,onEdit:h,onPatch:g,onUndo:_,onMarkArchive:b}){let[S,C]=(0,Z.useState)(null),w=K(),[T,ee]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),[k,j]=(0,Z.useState)(null),F=_e(S,a.version)?S:null;(0,Z.useEffect)(()=>{S!==null&&!_e(S,a.version)&&C(null)},[S,a.version]),(0,Z.useEffect)(()=>{if(S===null)return;let e=setTimeout(()=>C(null),Ae*1e3);return()=>clearTimeout(e)},[S]);let L=Ie(F),R=c&&_e(k,a.version)?k:null;(0,Z.useEffect)(()=>{c||j(null)},[c]);async function z(){if(F!==null)return F.value;ee(!0);try{let{values:e}=await w.secrets.reveal(`${n}/${r}/${a.key}`),t=e[a.key];return ne(null),C({value:t,version:a.version,at:Date.now()}),t}catch(e){return ne(e instanceof ie?U(e):`The request could not be sent. Nothing was read.`),null}finally{ee(!1)}}function ae(){F===null?z():C(null)}let B=o.archived,V=o.key!==a.key,H=o.value!==null,W=c?ce(o.key.trim()):null,G=B?` is-leaving`:c&&(V||H)?` is-changed`:F===null?``:` is-revealed`,q=a.version??0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row${G}`,children:[(0,$.jsx)(`td`,{className:`n`,children:t}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:c&&l?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,"aria-label":`Name for ${a.key}`,"aria-invalid":W!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>g({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&_()}}),(W!==null||V)&&(0,$.jsx)(`span`,{className:`edit-note${W===null?``:` edit-note-error`}`,children:W??(0,$.jsxs)($.Fragment,{children:[`Renamed from `,(0,$.jsx)(`span`,{className:`mono`,children:a.key})]})})]}):(0,$.jsxs)(`div`,{className:`key-cell`,children:[(0,$.jsx)(`span`,{children:P(a.key)}),B&&(0,$.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:c&&l?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(Fe,{label:`New value for ${a.key}`,value:o.value??R?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>g({value:e===(R?.value??``)?null:e}),onEscape:_}),(0,$.jsxs)(`span`,{className:`edit-note`,children:[(0,$.jsx)(`span`,{children:H?`Saving appends v${q+1}; v${q} stays restorable.`:R===null?`Nothing is decrypted to edit. Left empty, v${q} stays current.`:`This is v${q}. Change it to append v${q+1}.`}),d&&!H&&R===null&&(0,$.jsxs)(`button`,{type:`button`,className:`act`,disabled:T,onClick:async()=>{let e=await z();e!==null&&j({value:e,version:a.version,at:Date.now()})},children:[T&&(0,$.jsx)(N,{size:12}),`Start from current value`]})]})]}):F!==null&&!B?(0,$.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Ae}s`},children:[(0,$.jsx)(`span`,{className:`revealed-value`,children:F.value===``?`(empty)`:F.value}),(0,$.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,L,`s`]}),(0,$.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:c&&H?(0,$.jsxs)(`span`,{className:`version-shift`,children:[`v`,q,` → `,(0,$.jsxs)(`b`,{children:[`v`,q+1]})]}):(0,$.jsx)(`span`,{className:`version-shift`,children:a.version===null?`—`:`v${a.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Re,{entry:a})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:B?(0,$.jsx)(A,{label:`Keep`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`Keep ${a.key}`,children:(0,$.jsx)(e,{size:14})})}):c?(0,$.jsx)(A,{label:V||H?`Undo changes`:`Cancel`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`${V||H?`Undo changes to`:`Stop editing`} ${a.key}`,children:V||H?(0,$.jsx)(e,{size:14}):(0,$.jsx)(v,{size:15})})}):(0,$.jsxs)($.Fragment,{children:[F!==null&&(0,$.jsx)(re,{variant:`act`,value:F.value,label:`Copy ${a.key}`}),(0,$.jsx)(X,{canReveal:d,children:(0,$.jsx)(A,{label:F===null?`Reveal`:`Hide`,children:(0,$.jsx)(`button`,{className:`act act-icon act-accent`,onClick:ae,disabled:T,"aria-label":`${F===null?`Reveal`:`Hide`} ${a.key}`,children:T?(0,$.jsx)(N,{size:13}):F===null?(0,$.jsx)(y,{size:15}):(0,$.jsx)(m,{size:15})})})}),l&&(0,$.jsx)(A,{label:`Edit`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>{F!==null&&j(F),C(null),h()},disabled:f,"aria-label":`Edit ${a.key}`,children:(0,$.jsx)(i,{size:14})})}),(d||u)&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${a.key}`,disabled:f,children:(0,$.jsx)(s,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsx)(X,{canReveal:d,children:(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>D(e=>!e),children:[(0,$.jsx)(O,{size:14}),E?`Hide history`:`Version history`]})}),u&&(0,$.jsxs)($.Fragment,{children:[d&&(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{C(null),b()},children:[(0,$.jsx)(x,{size:14}),`Archive`,(0,$.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),E&&d&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(Ve,{project:n,environment:r,secretKey:a.key,currentVersion:a.version,canWrite:l,onClose:()=>D(!1),onRolledBack:()=>C(null)})})}),te!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(I,{error:te})})})]})}function Re({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,$.jsxs)(`span`,{className:`written`,children:[(0,$.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{className:`cell-muted`,children:(0,$.jsx)(z,{iso:e.updatedAt,display:`relative`})})]})]})}function ze({draft:e,existingVersion:t,disabled:n,onChange:r,onRemove:i}){let[a,o]=(0,Z.useState)(!1),s=e.key.trim(),c=s===``?a?`Give it a name.`:null:ce(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)(Fe,{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)(A,{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)(v,{size:15})})})})})]})}function Be({number:t,project:n,environment:r,entry:i,canArchive:a,canReveal:o}){let[s,c]=(0,Z.useState)(!1),l=K(),{pending:u,error:d,run:f}=Y();function p(e){f(()=>l.secrets.update(`${n}/${r}/${i.key}`,{archived:e}),()=>J.success(e?`${i.key} archived`:`${i.key} restored`,{action:{label:`Undo`,onClick:()=>p(!e)}}))}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row is-archived`,children:[(0,$.jsx)(`td`,{className:`n`,children:t}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:P(i.key)}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(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)(Re,{entry:i})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsxs)(`div`,{className:`acts`,children:[(0,$.jsx)(X,{canReveal:o,children:(0,$.jsx)(A,{label:s?`Hide history`:`Version history`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:()=>c(e=>!e),"aria-label":`${s?`Hide history of`:`Version history of`} ${i.key}`,"aria-expanded":s,children:(0,$.jsx)(O,{size:15})})})}),a&&(0,$.jsx)(A,{label:`Restore`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>p(!1),disabled:u,"aria-label":`Restore ${i.key}`,children:u?(0,$.jsx)(N,{size:13}):(0,$.jsx)(e,{size:14})})})]})})]}),s&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(Ve,{project:n,environment:r,secretKey:i.key,currentVersion:i.version,canWrite:!1,onClose:()=>c(!1),onRolledBack:()=>void 0})})}),d!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(I,{error:d})})})]})}function Ve({project:t,environment:n,secretKey:r,currentVersion:i,canWrite:a,onClose:o,onRolledBack:s}){let[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),f=K(),{pending:p,error:m,run:h}=Y();return(0,Z.useEffect)(()=>{let e=!1;return f.secrets.history(`${t}/${n}/${r}`).then(t=>{e||(l(t.versions),d(null))}).catch(t=>{e||d(t instanceof ie?U(t):`The version history could not be loaded.`)}),()=>{e=!0}},[f,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)(O,{size:14}),`Versions of `,(0,$.jsx)(`span`,{className:`mono`,children:r})]}),(0,$.jsx)(`button`,{className:`act`,onClick:o,children:`Close`})]}),u===null?c===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:c.map(i=>(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,i.version,` `,i.current&&(0,$.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,$.jsx)(`td`,{className:`nowrap`,children:(0,$.jsx)(z,{iso:i.createdAt})}),(0,$.jsx)(`td`,{children:i.createdBy}),(0,$.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:i.kek}),(0,$.jsx)(`td`,{className:`col-actions`,children:a&&!i.current&&(0,$.jsx)(F,{trigger:(0,$.jsxs)(`button`,{className:`act`,disabled:p,children:[(0,$.jsx)(e,{size:13}),`Roll back`]}),title:(0,$.jsxs)($.Fragment,{children:[`Roll `,(0,$.jsx)(`span`,{className:`mono`,children:r}),` back to v`,i.version,`?`]}),body:(0,$.jsxs)($.Fragment,{children:[`The current pointer moves to v`,i.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${i.version}`,destructive:!1,onConfirm:()=>h(()=>f.secrets.restore(`${t}/${n}/${r}`,i.version),()=>{s(),J.success(`${r} rolled back to v${i.version}`)})})})]},i.version))})]})}):(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:u})}),m!==null&&(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:m})}),(0,$.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var He={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function Ue(e,t,n){let r=ue(n);return r.entries.length===0?{plan:[],changes:{},problems:r.problems}:{...await H(e,t,r.entries),problems:r.problems}}function We({project:e,environment:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!1),u=K(),{pending:d,error:p,setError:m,run:h}=Y(),g=`${e}/${t}`;function _(){h(()=>Ue(u,g,n),e=>{s(e.problems),a({entries:e.plan,changes:e.changes})})}function v(){if(i===null)return;let e=Object.keys(i.changes).length;h(()=>u.secrets.set(g,i.changes),()=>{J.success(`Imported ${e} change${e===1?``:`s`}`),y()})}function y(){l(!1),a(null),r(``),s([]),m(null)}let b=i?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn`,onClick:()=>l(!0),children:[(0,$.jsx)(f,{size:14}),`Import .env`]}),(0,$.jsx)(R,{open:c,onOpenChange:e=>e?l(!0):y(),title:(0,$.jsxs)($.Fragment,{children:[`Import into`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),wide:!0,description:(0,$.jsx)($.Fragment,{children:`Paste a .env file. It is read by the CLI’s own parser, so this page and the CLI cannot disagree about what it means, and malformed lines are reported rather than guessed at. coffre compares it with the current values without sending any to this page.`}),children:(0,$.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`File contents`}),(0,$.jsx)(`textarea`,{className:`textarea`,autoFocus:!0,spellCheck:!1,placeholder:`DATABASE_URL=postgres://…
3
- STRIPE_KEY="sk_live_…"`,value:n,onChange:e=>{r(e.target.value),a(null),s([])}})]}),i!==null&&i.entries.length>0&&(0,$.jsx)(`div`,{className:`card dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Key`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,$.jsx)(`tbody`,{children:i.entries.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`cell-key`,children:P(e.key)}),(0,$.jsx)(`td`,{className:`col-shrink`,children:(0,$.jsx)(`span`,{className:He[e.action],children:e.action})}),(0,$.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),i!==null&&i.entries.length>0&&b.length===0&&(0,$.jsx)(k,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),o.length>0&&(0,$.jsxs)(k,{tone:`bad`,children:[(0,$.jsxs)(`strong`,{children:[o.length,` line`,o.length===1?``:`s`,` could not be parsed`]}),(0,$.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:o.map(e=>(0,$.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,$.jsx)(I,{error:p}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,onClick:y,children:`Cancel`}),i===null?(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||n.trim()===``,onClick:_,children:[d&&(0,$.jsx)(N,{}),`Preview changes`]}):(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||b.length===0,onClick:v,children:[d&&(0,$.jsx)(N,{}),`Write `,b.length,` change`,b.length===1?``:`s`]})]})]})})]})}export{je as component};
1
+ import{$ as e,B as t,C as n,D as r,F as i,I as a,J as o,K as s,L as c,M as l,Ot as u,P as d,Tt as f,Y as p,_ as m,b as h,c as g,ct as _,g as v,i as y,l as b,m as x,n as S,ot as C,q as w,s as ee,t as T,tt as E,x as D,z as O}from"./page-DbSS7pYH.js";import{D as te,a as ne,c as k,d as A,f as j,g as M,i as re,l as N,m as P,n as F,o as I,r as L,s as R,u as z}from"./preload-helper-DduCCcmc.js";import{c as ie,d as ae,f as B,l as V,m as H,n as U,o as W,p as G,s as K,t as q}from"./coffre-B0SRYkyG.js";import{r as J,t as Y}from"./use-action-LiHC8kKH.js";import{i as X,o as oe}from"./affordances-CmoY-8Xf.js";import{t as se}from"./projects._project._environment-CAHNmhje.js";import{t as ce}from"./validation-9Cl_XS-l.js";var le=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function ue(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!le.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=fe(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=pe(u.slice(1,e)),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function de(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function fe(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function pe(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
2
+ `;case`r`:return`\r`;case`\\`:case`"`:case`'`:return t;default:return e}})}var Z=u(f(),1);function Q(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function me(e,t,n){let r=e.filter(e=>!Q(n,e.key)?.archived).map(e=>Q(n,e.key)?.key.trim()??e.key);if(new Set(r).size!==r.length)return!0;let i=t.map(e=>e.key.trim());if(new Set(i).size!==i.length)return!0;let a=new Set(e.flatMap(e=>{let t=Q(n,e.key);return t!==void 0&&!t.archived&&t.value!==null?[t.key.trim()]:[]}));if(i.some(e=>a.has(e)))return!0;let o=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key));return i.some(e=>o.has(e))}async function he({active:e,drafts:t,changes:n,operations:r}){let i={...n},a=ge(e,t,n);if(a instanceof Error)return{applied:0,drafts:[...t],changes:i,error:a};let o=0,s=Object.create(null);try{for(let{sourceKey:e,change:t}of a){if(t.archived){s[e]=null;continue}let n=t.key.trim();n!==e&&(await r.rename(e,n),delete i[e],o+=1,t.value!==null&&(i[n]={key:n,value:t.value,archived:!1})),t.value!==null&&(s[n]=t.value)}for(let e of t)s[e.key.trim()]=e.value;let e=Object.keys(s).length;return e>0&&await r.write({...s}),{applied:o+e,drafts:[],changes:{},error:null}}catch(e){return{applied:o,drafts:[...t],changes:i,error:e}}}function ge(e,t,n){let r=new Set(e.map(e=>e.key)),i=new Set(e.filter(e=>Q(n,e.key)?.archived).map(e=>e.key)),a=t.find(e=>i.has(e.key.trim()));if(a)return Error(`${a.key.trim()}: cannot archive and write the same key in one save`);let o=new Map,s=[];for(let t of e){let e=Q(n,t.key);e!==void 0&&(!e.archived&&e.key.trim()!==t.key?o.set(t.key,e):s.push({sourceKey:t.key,change:e}))}for(let[e,t]of o){let n=t.key.trim();if(r.has(n)&&!o.has(n))return Error(`${e}: ${n} is already in use`)}let c=[],l=new Set;for(;o.size>0;){let e=[...o].find(([,e])=>{let t=e.key.trim();return!r.has(t)||l.has(t)});if(!e)return Error(`Secret renames contain a cycle. Save them in separate steps.`);let[t,n]=e;o.delete(t),l.add(t),c.push({sourceKey:t,change:n})}return[...c,...s]}function _e(e,t){return e!==null&&e.version===t}var $=_(),ve=2e3,ye=6e4;function be({project:e,environment:t,result:n,canRun:r}){let i=C(),a=n.ok&&n.syncs.some(e=>e.running);if((0,Z.useEffect)(()=>{if(!a)return;let e=setInterval(()=>void i.invalidate(),ve);return()=>clearInterval(e)},[a,i]),n.ok&&n.syncs.length===0&&!n.canManage)return null;let o=n.ok&&n.canManage;return(0,$.jsx)(T,{labelledBy:`syncs`,title:`Syncs`,description:`Destinations these secrets are pushed to. A change goes out when it is saved, and every hour coffre checks each destination and repairs what drifted.`,actions:o?(0,$.jsx)(De,{project:e,environment:t}):void 0,children:n.ok?n.syncs.length===0?(0,$.jsxs)(ne,{title:`Not synced anywhere`,children:[`Push these secrets where your code runs, such as GitHub Actions or Vercel, and keep them current there. Anything else can read them with `,(0,$.jsx)(`code`,{children:`coffre run`}),`.`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt syncs stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Destination`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Status`}),(0,$.jsx)(`th`,{className:`col-shrink col-hide-narrow`,children:`Token`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:n.syncs.map(e=>(0,$.jsx)(xe,{sync:e,canRun:r,canManage:o},e.id))})]})}):(0,$.jsx)(`div`,{className:`card-body`,children:(0,$.jsx)(I,{error:n.error})})})}function xe({sync:t,canRun:n,canManage:r}){let[i,o]=(0,Z.useState)(!1),c=K(),u=Y(),f=Y(),p=u.pending||f.pending,m=u.error??f.error;function h(){u.run(()=>c.syncs.run(t.id),e=>we(t,e.outcome))}function g(e){f.run(()=>c.syncs.update(t.id,{paused:e}),()=>J.success(e?`Paused ${t.destination}`:`Resumed ${t.destination}`,{action:{label:`Undo`,onClick:()=>g(!e)}}))}let _=m??(t.offered?t.lastError:null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:_!==null&&!t.running?`has-error`:void 0,children:[(0,$.jsx)(`td`,{className:`col-destination`,children:(0,$.jsxs)(`span`,{className:`cell-account`,children:[(0,$.jsx)(w,{brand:t.brand,size:15}),(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(`span`,{children:t.providerLabel}),t.offered?(0,$.jsx)(`small`,{className:`mono`,children:t.destination}):(0,$.jsx)(`small`,{children:`No longer offered by this deployment`})]})]})}),(0,$.jsx)(`td`,{className:`nowrap col-status`,children:(0,$.jsxs)(`span`,{className:`cell-stack`,children:[(0,$.jsx)(Se,{sync:t}),(0,$.jsx)(`small`,{children:(0,$.jsx)(Ce,{sync:t})})]})}),(0,$.jsx)(`td`,{className:`col-shrink col-hide-narrow cell-mono cell-muted`,children:t.credential}),(0,$.jsxs)(`td`,{className:`col-actions`,children:[(0,$.jsxs)(`div`,{className:`acts`,children:[n&&!t.paused&&(0,$.jsxs)(`button`,{className:`act`,onClick:h,disabled:p||t.running||!t.offered,title:t.offered?void 0:`This deployment no longer offers this provider`,children:[u.pending?(0,$.jsx)(N,{size:13}):(0,$.jsx)(s,{size:13}),`Run now`]}),r&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${t.destination}`,disabled:p,children:(0,$.jsx)(l,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>g(!t.paused),children:[t.paused?(0,$.jsx)(a,{size:14}):(0,$.jsx)(d,{size:14}),t.paused?`Resume`:`Pause`]}),(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>o(!0),children:[(0,$.jsx)(e,{size:14}),`Remove`]})]})})]})]}),(0,$.jsx)(L,{open:i,onOpenChange:o,title:(0,$.jsxs)($.Fragment,{children:[`Stop syncing to `,(0,$.jsx)(`span`,{className:`mono`,children:t.destination}),`?`]}),body:`Nothing more is pushed to ${t.providerLabel}. Keys coffre already pushed stay there; remove them at ${t.providerLabel} if they should go too.`,confirmLabel:`Remove sync`,onConfirm:()=>f.run(()=>c.syncs.remove(t.id),()=>J.success(`No longer syncing to ${t.destination}`))})]})]}),_!==null&&!t.running&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:4,children:(0,$.jsx)(I,{error:_})})})]})}function Se({sync:e}){return e.offered?e.running?(0,$.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,$.jsx)(N,{size:11}),`Pushing`]}):e.paused?(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Paused`}):e.lastStatus===`failed`?(0,$.jsx)(`span`,{className:`tag tag-red`,children:`Failed`}):e.pending>0?(0,$.jsxs)(`span`,{className:`tag tag-amber`,children:[e.pending,` pending`]}):e.lastStatus===`partial`?(0,$.jsx)(`span`,{className:`tag tag-amber`,children:`Partial`}):e.lastRunAt===null?(0,$.jsx)(`span`,{className:`tag`,children:`Not run yet`}):(0,$.jsx)(`span`,{className:`tag tag-green`,children:`In sync`}):(0,$.jsx)(`span`,{className:`tag tag-outline`,children:`Unavailable`})}function Ce({sync:e}){let t=e.skipped.length,n=[];return(e.synced>0||e.pending===0)&&n.push(`${e.synced} synced`),e.pending>0&&n.push(`${e.pending} pending`),t>0&&n.push((0,$.jsx)(j,{label:(0,$.jsx)(`ul`,{style:{margin:0,paddingLeft:`1rem`},children:e.skipped.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{className:`mono`,children:e.key}),`: `,e.reason]},e.key))}),children:(0,$.jsxs)(`button`,{type:`button`,className:`tag tag-amber tag-button`,children:[(0,$.jsx)(g,{size:11}),t,` skipped`]})})),e.lastRunAt!==null&&n.push((0,$.jsx)(z,{iso:e.lastRunAt,display:`relative`})),(0,$.jsx)($.Fragment,{children:n.map((e,t)=>(0,$.jsxs)(Z.Fragment,{children:[t>0&&` · `,e]},t))})}function we(e,t){if(t.status===`busy`){J(`A run is already under way`,{description:`Its result appears here when it ends.`});return}let n=t.upserted.length+t.deleted.length;if(t.status===`failed`)J.error(`Could not sync to ${e.destination}`,{description:t.error??void 0});else if(t.status===`partial`)J.warning(`${t.failed.length} of ${n+t.failed.length} changes failed`,{description:t.failed[0]?.message});else if(n===0)J.success(`${e.destination} was already current`);else{let n=[t.upserted.length>0&&`pushed ${t.upserted.length}`,t.deleted.length>0&&`removed ${t.deleted.length}`].filter(Boolean);J.success(`${Ee(n.join(`, `))} to ${e.destination}`)}}async function Te(e,t,n,r){let i=J.loading(`Pushing to ${n.destination}`,{description:`The first push is under way.`}),a=Date.now()+ye;for(;Date.now()<a;){await new Promise(e=>setTimeout(e,ve));let a=await W(()=>e.syncs.list(t)),o=a.ok?a.syncs.find(e=>e.id===n.id):void 0;if(!(o===void 0||o.running||o.lastRunAt===null)){await r(),o.lastStatus===`failed`?J.error(`Could not sync to ${n.destination}`,{id:i,description:o.lastError??void 0}):o.lastStatus===`partial`?J.warning(`Synced to ${n.destination}, but not every key`,{id:i,description:o.lastError??void 0}):J.success(`Synced to ${n.destination}`,{id:i,description:`${o.synced} ${o.synced===1?`key is`:`keys are`} there now.`});return}}await r(),J(`Still pushing to ${n.destination}`,{id:i,description:`Its result appears in the list when it ends.`})}function Ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}function De({project:e,environment:t}){let[n,r]=(0,Z.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,$.jsx)(c,{size:14}),`Add sync`]}),(0,$.jsx)(R,{open:n,onOpenChange:r,title:(0,$.jsxs)($.Fragment,{children:[`Sync `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),description:`Every key in this environment is pushed to the destination and kept current. coffre only ever removes keys it pushed itself.`,wide:!0,children:(0,$.jsx)(Oe,{children:n=>(0,$.jsx)(ke,{project:e,environment:t,providers:n,onDone:()=>r(!1)})})})]})}function Oe({children:e}){let t=K(),[n,r]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{let e=!0;return W(()=>t.syncs.providers()).then(t=>{e&&r(t)}),()=>{e=!1}},[t]),n===null?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[(0,$.jsx)(N,{size:13}),`Loading where coffre can sync to…`]}):n.ok?n.providers.length===0?(0,$.jsxs)(`p`,{className:`picker-empty sync-providers-state`,children:[`This instance offers nowhere to sync to. Whoever runs coffre lists the providers in its`,` `,(0,$.jsx)(`span`,{className:`mono`,children:`syncs`}),` settings.`]}):e(n.providers):(0,$.jsx)(`div`,{className:`sync-providers-state`,children:(0,$.jsx)(I,{error:n.error})})}function ke({project:e,environment:t,providers:n,onDone:r}){let[i,a]=(0,Z.useState)(n[0]),[o,s]=(0,Z.useState)(()=>B(n[0])),[c,l]=(0,Z.useState)(``),u=K(),d=C(),{pending:f,error:p,setError:m,run:h}=Y(),g=ae(i,o);function _(e){a(e),s(B(e)),m(null)}function v(e,t){s(n=>({...n,[e]:t}))}return(0,$.jsxs)(`form`,{className:`form`,style:{marginTop:`1.25rem`},onSubmit:n=>{n.preventDefault(),h(()=>u.syncs.add(`${e}/${t}`,{provider:i.id,config:V(i,o),credential:c.trim()}),n=>{r(),Te(u,`${e}/${t}`,n,()=>d.invalidate())})},children:[n.length>1&&(0,$.jsx)(`div`,{className:`choice-grid sync-providers`,role:`group`,"aria-label":`Destination`,children:n.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`choice`,"aria-pressed":e.id===i.id,onClick:()=>_(e),children:[(0,$.jsx)(w,{brand:e.brand}),e.label]},e.id))}),(0,$.jsx)(`div`,{className:`form-row`,children:i.fields.map(e=>{if(!G(e,o))return null;if(e.type===`text`)return(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsxs)(`span`,{className:`label`,children:[e.label,e.optional===!0&&(0,$.jsx)(`span`,{className:`hint`,children:` (optional)`})]}),(0,$.jsx)(`input`,{className:`input input-mono`,value:o[e.name],placeholder:e.placeholder,spellCheck:!1,autoComplete:`off`,onChange:t=>v(e.name,t.target.value)}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`);let t=o[e.name];return(0,$.jsxs)(`div`,{className:`field field-options`,role:`group`,"aria-label":e.label,children:[(0,$.jsx)(`span`,{className:`label`,children:e.label}),(0,$.jsx)(`div`,{className:`segmented`,children:e.options.map(n=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":t.includes(n.value),onClick:()=>v(e.name,e.multiple?t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value]:[n.value]),children:n.label},n.value))}),e.hint!==void 0&&(0,$.jsx)(`span`,{className:`hint`,children:e.hint})]},`${i.id}.${e.name}`)})}),(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`Token`}),(0,$.jsx)(`input`,{className:`input input-mono`,value:c,placeholder:i.credential.placeholder,spellCheck:!1,autoComplete:`off`,onChange:e=>l(e.target.value)}),(0,$.jsxs)(`span`,{className:`hint`,children:[`The secret that holds it, as `,(0,$.jsx)(`code`,{children:`project/environment/KEY`}),`. An environment of its own, such as `,(0,$.jsx)(`code`,{children:`ops/sync`}),`, keeps it from everyone who reads these secrets. You need read access to it.`]})]}),(0,$.jsx)(k,{tone:`info`,children:i.credential.hint}),(0,$.jsx)(I,{error:p}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,type:`button`,onClick:r,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:f||g!==null||c.trim()===``,title:g===null?void 0:`${g} is required`,children:[f&&(0,$.jsx)(N,{}),`Start syncing`]})]})]})}var Ae=45;function je(){let{keys:e,syncs:t}=se.useLoaderData(),{project:n,environment:i}=se.useParams();return e.ok?(0,$.jsx)(Me,{project:n,environment:i,permissions:e.permissions,keys:e.keys,syncs:t},`${n}/${i}`):(0,$.jsx)(S,{icon:(0,$.jsx)(r,{size:18}),label:(0,$.jsxs)(`span`,{className:`mono`,children:[n,`/`,i]}),title:`This environment is closed to you`,actions:(0,$.jsxs)(te,{className:`btn`,to:`/projects/$project`,params:{project:n},children:[`Back to `,n]}),children:e.error})}function Me({project:e,environment:i,permissions:a,keys:s,syncs:l}){let u=C(),d=K(),f=`${e}/${i}`,[p,m]=(0,Z.useState)([]),[g,_]=(0,Z.useState)({}),[v,b]=(0,Z.useState)(()=>new Set),[S,w]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(null),[O,te]=(0,Z.useState)(se.useSearch().filter??``),k=(0,Z.useRef)(0),A=a.includes(`secret.write`),j=a.includes(`secret.archive`),M=oe(a),P=s.filter(e=>!e.archived),F=s.filter(e=>e.archived),I=new Set(s.map(e=>e.key)),L=P.filter(e=>Q(g,e.key)!==void 0),R=me(P,p,g),z=[...p.map(e=>e.key.trim()),...L.flatMap(e=>{let t=Q(g,e.key);return t===void 0||t.archived?[]:[t.key.trim()]})],ie=z.some(e=>e===``),ae=z.some(e=>e!==``&&ce(e)!==null),B=p.length+L.length,V=B>0&&!ie&&!ae&&!R;function H(e,t){_(n=>{let r={...Q(n,e.key)??{key:e.key,value:null,archived:!1},...t};if(r.key!==e.key||r.value!==null||r.archived)return{...n,[e.key]:r};let{[e.key]:i,...a}=n;return a})}function W(e){_(t=>{let{[e]:n,...r}=t;return r}),b(t=>{let n=new Set(t);return n.delete(e),n})}function G(){m(e=>[{id:k.current++,key:``,value:``},...e])}function Y(){m([]),_({}),b(new Set),D(null)}async function X(){if(!V||S)return;w(!0),D(null);let e=await he({active:P,drafts:p,changes:g,operations:{rename:async(e,t)=>{try{await d.secrets.rename(`${f}/${e}`,t)}catch(t){throw new q(`${e}: ${U(t)}`)}},write:async e=>{try{await d.secrets.set(f,e)}catch(e){throw new q(U(e))}}}});if(m(e.drafts),_(e.changes),b(new Set),e.applied>0)try{await u.invalidate()}catch{D(`Saved, but the page could not refresh. Reload before you retry.`),w(!1);return}if(e.error===null)J.success(`Saved ${B} change${B===1?``:`s`}`);else{let t=e.error instanceof Error?e.error.message:`The request could not be sent.`;D(e.applied===0?t:`${t} The renames before it were saved; nothing else was, and the rest is ready to retry.`)}w(!1)}let le=(0,Z.useRef)(X);le.current=X,(0,Z.useEffect)(()=>{if(B===0)return;function e(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),le.current())}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[B]);let ue=[...p.map(e=>({key:e.key.trim()||`unnamed`,what:I.has(e.key.trim())?`new version`:`added`})),...L.map(e=>{let t=Q(g,e.key);if(t.archived)return{key:e.key,what:`archived`};let n=t.key.trim()!==e.key;return n&&t.value!==null?{key:e.key,what:`→ ${t.key.trim()}, new value`}:n?{key:e.key,what:`→ ${t.key.trim()}`}:{key:e.key,what:`new value`}})],de=ie?null:R?`Two pending edits would end up with the same name. Secret names are unique in an environment.`:ae?`Names are letters, digits and underscores, and cannot start with a digit.`:null,fe=O.trim().toLowerCase(),pe=fe===``?P:P.filter(e=>e.key.toLowerCase().includes(fe));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(y,{tile:e,title:i,aside:(0,$.jsx)(Ne,{project:e,environment:i}),actions:(0,$.jsxs)($.Fragment,{children:[A&&M&&(0,$.jsx)(We,{project:e,environment:i}),A&&(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,disabled:S,children:[(0,$.jsx)(c,{size:14}),`New secret`]})]})}),(P.length>0||p.length>0)&&(0,$.jsxs)(`div`,{className:`toolbar`,children:[(0,$.jsxs)(`label`,{className:`filter input-group`,children:[(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Filter secrets by name`}),(0,$.jsx)(t,{size:14,className:`input-icon`}),(0,$.jsx)(`input`,{className:`input`,type:`search`,placeholder:`Filter by name…`,spellCheck:!1,autoComplete:`off`,value:O,onChange:e=>te(e.target.value)})]}),(0,$.jsx)(`div`,{className:`toolbar-meta`,children:(0,$.jsxs)(`span`,{className:`th`,title:`Run a process with these secrets in its environment`,children:[(0,$.jsx)(o,{size:14}),(0,$.jsxs)(`code`,{children:[`coffre run `,e,`/`,i,` -- …`]}),(0,$.jsx)(re,{value:`coffre run ${e}/${i} -- `,label:`Copy command`})]})})]}),(0,$.jsx)(`section`,{className:`card`,"aria-label":`Secrets`,children:P.length===0&&p.length===0?(0,$.jsx)(ne,{title:`No secrets yet`,actions:A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-primary`,onClick:G,children:[(0,$.jsx)(c,{size:14}),`New secret`]}),M&&(0,$.jsx)(We,{project:e,environment:i})]}):void 0,children:A?`Add them one by one, or import an existing .env file. Nothing is written until you save, or until you have seen the import plan.`:`Nothing has been written to this environment, and adding the first secret needs secret.write.`}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(n,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(r,{size:14}),`Value`,!M&&(0,$.jsx)(`span`,{className:`th-note`,children:`hidden from you`})]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(x,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsxs)(`tbody`,{children:[p.map(e=>(0,$.jsx)(ze,{draft:e,existingVersion:s.find(t=>t.key===e.key.trim())?.version??null,disabled:S,onChange:t=>m(n=>n.map(n=>n.id===e.id?{...n,...t}:n)),onRemove:()=>m(t=>t.filter(t=>t.id!==e.id))},e.id)),pe.map(t=>{let n=Q(g,t.key);return(0,$.jsx)(Le,{number:P.indexOf(t)+1,project:e,environment:i,entry:t,change:n??{key:t.key,value:null,archived:!1},editing:n?.archived!==!0&&(v.has(t.key)||n!==void 0),canWrite:A,canArchive:j,canReveal:M,disabled:S,columns:6,onEdit:()=>b(e=>new Set(e).add(t.key)),onPatch:e=>H(t,e),onUndo:()=>W(t.key),onMarkArchive:()=>{b(e=>{let n=new Set(e);return n.delete(t.key),n}),_(e=>({...e,[t.key]:{key:t.key,value:null,archived:!0}}))}},t.key)}),pe.length===0&&P.length>0&&(0,$.jsx)(`tr`,{children:(0,$.jsxs)(`td`,{colSpan:6,className:`cell-muted`,style:{padding:`1rem`},children:[`No secret name contains “`,O.trim(),`”.`]})})]})]})})}),(0,$.jsx)(be,{project:e,environment:i,result:l,canRun:A||a.includes(`environment.manage`)}),F.length>0&&(0,$.jsx)(T,{labelledBy:`archived-secrets`,title:`Archived`,description:(0,$.jsxs)($.Fragment,{children:[`Retired, so no longer served or injected by `,(0,$.jsx)(`code`,{children:`coffre run`}),`. Their history and audit trail are intact, and restoring is immediate.`]}),children:(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt secrets secrets-archived stacks`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`n`,children:`#`}),(0,$.jsx)(`th`,{className:`col-key`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(n,{size:14}),`Key`]})}),(0,$.jsx)(`th`,{className:`col-version`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(h,{size:14}),`Version`]})}),(0,$.jsx)(`th`,{className:`col-written col-hide-narrow`,children:(0,$.jsxs)(`span`,{className:`th`,children:[(0,$.jsx)(x,{size:14}),`Last written`]})}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:F.map((t,n)=>(0,$.jsx)(Be,{number:n+1,project:e,environment:i,entry:t,canArchive:j,canReveal:M},t.key))})]})})}),B>0&&(0,$.jsx)(`div`,{className:`savebar`,role:`region`,"aria-label":`Unsaved changes`,children:(0,$.jsxs)(`div`,{className:`savebar-inner`,children:[(0,$.jsxs)(`span`,{className:`savebar-count`,children:[(0,$.jsx)(`span`,{className:`dot`,"aria-hidden":!0}),B,` unsaved change`,B===1?``:`s`]}),(0,$.jsxs)(`span`,{className:`savebar-summary`,children:[ue.slice(0,3).map((e,t)=>(0,$.jsxs)(`span`,{children:[t>0&&` · `,(0,$.jsx)(`span`,{className:`mono`,children:e.key}),` `,e.what]},`${e.key}:${t}`)),ue.length>3&&` · and ${ue.length-3} more`]}),(0,$.jsxs)(`div`,{className:`savebar-actions`,children:[(0,$.jsx)(`button`,{className:`btn btn-sm`,onClick:Y,disabled:S,children:`Discard`}),(0,$.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>void X(),disabled:S||!V,title:`Save (⌘ Enter or Ctrl Enter)`,"aria-keyshortcuts":`Meta+Enter Control+Enter`,children:[S&&(0,$.jsx)(N,{size:13}),`Save `,B===1?`change`:`${B} changes`]})]}),(E??de)!==null&&(0,$.jsxs)(`p`,{className:`savebar-error`,role:`alert`,children:[(0,$.jsx)(ee,{size:14}),(0,$.jsx)(`span`,{children:E??de})]})]})})]})}function Ne({project:e,environment:t}){let{projects:n}=E({from:`__root__`}),r=n.find(t=>t.slug===e)?.environments.find(e=>e.slug===t)?.name;return r===void 0?null:(0,$.jsx)($.Fragment,{children:r})}function Pe({masked:e,className:t=``,...n}){let[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{i(typeof CSS<`u`&&CSS.supports(`-webkit-text-security`,`disc`))},[]),(0,$.jsx)(`input`,{...n,type:e&&!r?`password`:`text`,className:`${t}${e&&r?` is-masked`:``}`,autoComplete:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0})}function Fe({label:e,value:t,onChange:n,placeholder:r,disabled:i,autoFocus:a,onEscape:o}){let[s,c]=(0,Z.useState)(!1);return(0,$.jsxs)(`div`,{className:`input-group`,children:[(0,$.jsx)(Pe,{className:`input input-mono`,masked:!s,"aria-label":e,placeholder:r,value:t,disabled:i,autoFocus:a,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Escape`&&o!==void 0&&o()}}),(0,$.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm btn-icon input-addon`,"aria-label":s?`Mask the value`:`Show the value`,"aria-pressed":s,onClick:()=>c(e=>!e),children:s?(0,$.jsx)(m,{size:14}):(0,$.jsx)(v,{size:14})})]})}function Ie(e){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?0:Math.max(0,Math.ceil(Ae-(t-e.at)/1e3))}function Le({number:t,project:n,environment:r,entry:a,change:o,editing:s,canWrite:c,canArchive:u,canReveal:d,disabled:f,columns:p,onEdit:h,onPatch:g,onUndo:_,onMarkArchive:y}){let[x,S]=(0,Z.useState)(null),C=K(),[w,ee]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(null),[k,j]=(0,Z.useState)(null),F=_e(x,a.version)?x:null;(0,Z.useEffect)(()=>{x!==null&&!_e(x,a.version)&&S(null)},[x,a.version]),(0,Z.useEffect)(()=>{if(x===null)return;let e=setTimeout(()=>S(null),Ae*1e3);return()=>clearTimeout(e)},[x]);let L=Ie(F),R=s&&_e(k,a.version)?k:null;(0,Z.useEffect)(()=>{s||j(null)},[s]);async function z(){if(F!==null)return F.value;ee(!0);try{let{values:e}=await C.secrets.reveal(`${n}/${r}/${a.key}`),t=e[a.key];return ne(null),S({value:t,version:a.version,at:Date.now()}),t}catch(e){return ne(e instanceof ie?U(e):`The request could not be sent. Nothing was read.`),null}finally{ee(!1)}}function ae(){F===null?z():S(null)}let B=o.archived,V=o.key!==a.key,H=o.value!==null,W=s?ce(o.key.trim()):null,G=B?` is-leaving`:s&&(V||H)?` is-changed`:F===null?``:` is-revealed`,q=a.version??0;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row${G}`,children:[(0,$.jsx)(`td`,{className:`n`,children:t}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,"aria-label":`Name for ${a.key}`,"aria-invalid":W!==null,spellCheck:!1,autoComplete:`off`,value:o.key,disabled:f,onChange:e=>g({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&_()}}),(W!==null||V)&&(0,$.jsx)(`span`,{className:`edit-note${W===null?``:` edit-note-error`}`,children:W??(0,$.jsxs)($.Fragment,{children:[`Renamed from `,(0,$.jsx)(`span`,{className:`mono`,children:a.key})]})})]}):(0,$.jsxs)(`div`,{className:`key-cell`,children:[(0,$.jsx)(`span`,{children:P(a.key)}),B&&(0,$.jsx)(`span`,{className:`tag tag-red`,children:`will be archived`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:s&&c?(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(Fe,{label:`New value for ${a.key}`,value:o.value??R?.value??``,placeholder:`New value`,disabled:f,autoFocus:!0,onChange:e=>g({value:e===(R?.value??``)?null:e}),onEscape:_}),(0,$.jsxs)(`span`,{className:`edit-note`,children:[(0,$.jsx)(`span`,{children:H?`Saving appends v${q+1}; v${q} stays restorable.`:R===null?`Nothing is decrypted to edit. Left empty, v${q} stays current.`:`This is v${q}. Change it to append v${q+1}.`}),d&&!H&&R===null&&(0,$.jsxs)(`button`,{type:`button`,className:`act`,disabled:w,onClick:async()=>{let e=await z();e!==null&&j({value:e,version:a.version,at:Date.now()})},children:[w&&(0,$.jsx)(N,{size:12}),`Start from current value`]})]})]}):F!==null&&!B?(0,$.jsxs)(`div`,{className:`revealed`,style:{"--reveal-ttl":`${Ae}s`},children:[(0,$.jsx)(`span`,{className:`revealed-value`,children:F.value===``?`(empty)`:F.value}),(0,$.jsxs)(`span`,{className:`revealed-note`,children:[`Hides in `,L,`s`]}),(0,$.jsx)(`span`,{className:`revealed-meter`,"aria-hidden":!0})]}):(0,$.jsx)(`span`,{className:`mask`,"aria-label":`Hidden`,children:`••••••••••••`})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:s&&H?(0,$.jsxs)(`span`,{className:`version-shift`,children:[`v`,q,` → `,(0,$.jsxs)(`b`,{children:[`v`,q+1]})]}):(0,$.jsx)(`span`,{className:`version-shift`,children:a.version===null?`—`:`v${a.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Re,{entry:a})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:B?(0,$.jsx)(A,{label:`Keep`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`Keep ${a.key}`,children:(0,$.jsx)(O,{size:14})})}):s?(0,$.jsx)(A,{label:V||H?`Undo changes`:`Cancel`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:_,disabled:f,"aria-label":`${V||H?`Undo changes to`:`Stop editing`} ${a.key}`,children:V||H?(0,$.jsx)(O,{size:14}):(0,$.jsx)(e,{size:15})})}):(0,$.jsxs)($.Fragment,{children:[F!==null&&(0,$.jsx)(re,{variant:`act`,value:F.value,label:`Copy ${a.key}`}),(0,$.jsx)(X,{canReveal:d,children:(0,$.jsx)(A,{label:F===null?`Reveal`:`Hide`,children:(0,$.jsx)(`button`,{className:`act act-icon act-accent`,onClick:ae,disabled:w,"aria-label":`${F===null?`Reveal`:`Hide`} ${a.key}`,children:w?(0,$.jsx)(N,{size:13}):F===null?(0,$.jsx)(v,{size:15}):(0,$.jsx)(m,{size:15})})})}),c&&(0,$.jsx)(A,{label:`Edit`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>{F!==null&&j(F),S(null),h()},disabled:f,"aria-label":`Edit ${a.key}`,children:(0,$.jsx)(i,{size:14})})}),(d||u)&&(0,$.jsxs)(M.Root,{children:[(0,$.jsx)(M.Trigger,{asChild:!0,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,"aria-label":`More for ${a.key}`,disabled:f,children:(0,$.jsx)(l,{size:16})})}),(0,$.jsx)(M.Portal,{children:(0,$.jsxs)(M.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,$.jsx)(X,{canReveal:d,children:(0,$.jsxs)(M.Item,{className:`menu-item`,onSelect:()=>E(e=>!e),children:[(0,$.jsx)(D,{size:14}),T?`Hide history`:`Version history`]})}),u&&(0,$.jsxs)($.Fragment,{children:[d&&(0,$.jsx)(M.Separator,{className:`menu-sep`}),(0,$.jsxs)(M.Item,{className:`menu-item menu-item-danger`,onSelect:()=>{S(null),y()},children:[(0,$.jsx)(b,{size:14}),`Archive`,(0,$.jsx)(`span`,{className:`menu-hint`,children:`on save`})]})]})]})})]})]})})})]}),T&&d&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(Ve,{project:n,environment:r,secretKey:a.key,currentVersion:a.version,canWrite:c,onClose:()=>E(!1),onRolledBack:()=>S(null)})})}),te!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:p,children:(0,$.jsx)(I,{error:te})})})]})}function Re({entry:e}){if(e.updatedBy===null&&e.updatedAt===null)return(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`});let t=e.updatedBy??`unknown`;return(0,$.jsxs)(`span`,{className:`written`,children:[(0,$.jsx)(`span`,{className:`written-by`,title:t,children:t.split(`@`)[0]}),e.updatedAt!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`cell-muted`,"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{className:`cell-muted`,children:(0,$.jsx)(z,{iso:e.updatedAt,display:`relative`})})]})]})}function ze({draft:t,existingVersion:n,disabled:r,onChange:i,onRemove:a}){let[o,s]=(0,Z.useState)(!1),c=t.key.trim(),l=c===``?o?`Give it a name.`:null:ce(c),u=c!==``&&n!==null;return(0,$.jsxs)(`tr`,{className:`secret-row is-draft`,children:[(0,$.jsx)(`td`,{className:`n`,"aria-label":`New`,children:`+`}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`New secret`,children:(0,$.jsxs)(`div`,{className:`edit-stack`,children:[(0,$.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,"aria-label":`Name of the new secret`,"aria-invalid":l!==null,placeholder:`NAME_OF_SECRET`,spellCheck:!1,autoComplete:`off`,value:t.key,disabled:r,onBlur:()=>s(!0),onChange:e=>i({key:e.target.value}),onKeyDown:e=>{e.key===`Escape`&&a()}}),(l!==null||u)&&(0,$.jsx)(`span`,{className:`edit-note${l===null?``:` edit-note-error`}`,children:l??`This name already exists here. Saving appends a new version to it rather than creating a second secret.`})]})}),(0,$.jsx)(`td`,{"data-label":`Value`,children:(0,$.jsx)(`div`,{className:`edit-stack`,children:(0,$.jsx)(Fe,{label:`Value for ${c===``?`the new secret`:c}`,value:t.value,placeholder:`Value`,disabled:r,onChange:e=>i({value:e}),onEscape:a})})}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:u?(0,$.jsxs)($.Fragment,{children:[`v`,n,` → `,(0,$.jsxs)(`b`,{children:[`v`,n+1]})]}):(0,$.jsx)(`b`,{children:`new`})})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,children:(0,$.jsx)(`span`,{className:`cell-muted`,children:`—`})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsx)(`div`,{className:`acts`,children:(0,$.jsx)(A,{label:`Remove`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:a,disabled:r,"aria-label":c===``?`Remove this new secret`:`Remove new secret ${c}`,children:(0,$.jsx)(e,{size:15})})})})})]})}function Be({number:e,project:t,environment:n,entry:r,canArchive:i,canReveal:a}){let[o,s]=(0,Z.useState)(!1),c=K(),{pending:l,error:u,run:d}=Y();function f(e){d(()=>c.secrets.update(`${t}/${n}/${r.key}`,{archived:e}),()=>J.success(e?`${r.key} archived`:`${r.key} restored`,{action:{label:`Undo`,onClick:()=>f(!e)}}))}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`tr`,{className:`secret-row is-archived`,children:[(0,$.jsx)(`td`,{className:`n`,children:e}),(0,$.jsx)(`td`,{className:`cell-key`,"data-label":`Key`,children:P(r.key)}),(0,$.jsx)(`td`,{className:`col-version`,"data-label":`Version`,children:(0,$.jsx)(`span`,{className:`version-shift`,children:r.version===null?`—`:`v${r.version}`})}),(0,$.jsx)(`td`,{className:`col-written col-hide-narrow`,"data-label":`Last written`,children:(0,$.jsx)(Re,{entry:r})}),(0,$.jsx)(`td`,{className:`col-actions`,children:(0,$.jsxs)(`div`,{className:`acts`,children:[(0,$.jsx)(X,{canReveal:a,children:(0,$.jsx)(A,{label:o?`Hide history`:`Version history`,children:(0,$.jsx)(`button`,{className:`act act-icon act-quiet`,onClick:()=>s(e=>!e),"aria-label":`${o?`Hide history of`:`Version history of`} ${r.key}`,"aria-expanded":o,children:(0,$.jsx)(D,{size:15})})})}),i&&(0,$.jsx)(A,{label:`Restore`,children:(0,$.jsx)(`button`,{className:`act act-icon`,onClick:()=>f(!1),disabled:l,"aria-label":`Restore ${r.key}`,children:l?(0,$.jsx)(N,{size:13}):(0,$.jsx)(O,{size:14})})})]})})]}),o&&(0,$.jsx)(`tr`,{className:`detail-row`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(Ve,{project:t,environment:n,secretKey:r.key,currentVersion:r.version,canWrite:!1,onClose:()=>s(!1),onRolledBack:()=>void 0})})}),u!==null&&(0,$.jsx)(`tr`,{className:`row-error`,children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsx)(I,{error:u})})})]})}function Ve({project:e,environment:t,secretKey:n,currentVersion:r,canWrite:i,onClose:a,onRolledBack:o}){let[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(null),d=K(),{pending:f,error:p,run:m}=Y();return(0,Z.useEffect)(()=>{let r=!1;return d.secrets.history(`${e}/${t}/${n}`).then(e=>{r||(c(e.versions),u(null))}).catch(e=>{r||u(e instanceof ie?U(e):`The version history could not be loaded.`)}),()=>{r=!0}},[d,e,t,n,r]),(0,$.jsxs)(`div`,{className:`history`,children:[(0,$.jsxs)(`div`,{className:`history-head`,children:[(0,$.jsxs)(`span`,{className:`history-title th`,children:[(0,$.jsx)(D,{size:14}),`Versions of `,(0,$.jsx)(`span`,{className:`mono`,children:n})]}),(0,$.jsx)(`button`,{className:`act`,onClick:a,children:`Close`})]}),l===null?s===null?(0,$.jsxs)(`p`,{className:`hint history-body`,children:[(0,$.jsx)(N,{size:13}),` Loading versions…`]}):(0,$.jsx)(`div`,{className:`dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`col-shrink`,children:`Version`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Written (UTC)`}),(0,$.jsx)(`th`,{children:`By`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Key id`}),(0,$.jsx)(`th`,{className:`col-actions`,children:(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:s.map(r=>(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{className:`cell-mono nowrap`,children:[`v`,r.version,` `,r.current&&(0,$.jsx)(`span`,{className:`tag tag-blue`,children:`current`})]}),(0,$.jsx)(`td`,{className:`nowrap`,children:(0,$.jsx)(z,{iso:r.createdAt})}),(0,$.jsx)(`td`,{children:r.createdBy}),(0,$.jsx)(`td`,{className:`cell-mono cell-muted nowrap`,children:r.kek}),(0,$.jsx)(`td`,{className:`col-actions`,children:i&&!r.current&&(0,$.jsx)(F,{trigger:(0,$.jsxs)(`button`,{className:`act`,disabled:f,children:[(0,$.jsx)(O,{size:13}),`Roll back`]}),title:(0,$.jsxs)($.Fragment,{children:[`Roll `,(0,$.jsx)(`span`,{className:`mono`,children:n}),` back to v`,r.version,`?`]}),body:(0,$.jsxs)($.Fragment,{children:[`The current pointer moves to v`,r.version,`. Nothing is copied or deleted, every version stays readable, and the next write continues the numbering forward. Anything reading`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]}),` `,`picks up the change immediately.`]}),confirmLabel:`Roll back to v${r.version}`,destructive:!1,onConfirm:()=>m(()=>d.secrets.restore(`${e}/${t}/${n}`,r.version),()=>{o(),J.success(`${n} rolled back to v${r.version}`)})})})]},r.version))})]})}):(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:l})}),p!==null&&(0,$.jsx)(`div`,{className:`history-body`,children:(0,$.jsx)(I,{error:p})}),(0,$.jsx)(`p`,{className:`history-note`,children:`Metadata only. Listing versions decrypts nothing.`})]})}var He={added:`tag tag-green`,changed:`tag tag-blue`,unchanged:`tag`};async function Ue(e,t,n){let r=ue(n);return r.entries.length===0?{plan:[],changes:{},problems:r.problems}:{...await H(e,t,r.entries),problems:r.problems}}function We({project:e,environment:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)([]),[c,l]=(0,Z.useState)(!1),u=K(),{pending:d,error:f,setError:m,run:h}=Y(),g=`${e}/${t}`;function _(){h(()=>Ue(u,g,n),e=>{s(e.problems),a({entries:e.plan,changes:e.changes})})}function v(){if(i===null)return;let e=Object.keys(i.changes).length;h(()=>u.secrets.set(g,i.changes),()=>{J.success(`Imported ${e} change${e===1?``:`s`}`),y()})}function y(){l(!1),a(null),r(``),s([]),m(null)}let b=i?.entries.filter(e=>e.action!==`unchanged`)??[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn`,onClick:()=>l(!0),children:[(0,$.jsx)(p,{size:14}),`Import .env`]}),(0,$.jsx)(R,{open:c,onOpenChange:e=>e?l(!0):y(),title:(0,$.jsxs)($.Fragment,{children:[`Import into`,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[e,`/`,t]})]}),wide:!0,description:(0,$.jsx)($.Fragment,{children:`Paste a .env file. It is read by the CLI’s own parser, so this page and the CLI cannot disagree about what it means, and malformed lines are reported rather than guessed at. coffre compares it with the current values without sending any to this page.`}),children:(0,$.jsxs)(`div`,{className:`form`,style:{marginTop:`1.25rem`},children:[(0,$.jsxs)(`label`,{className:`field`,children:[(0,$.jsx)(`span`,{className:`label`,children:`File contents`}),(0,$.jsx)(`textarea`,{className:`textarea`,autoFocus:!0,spellCheck:!1,placeholder:`DATABASE_URL=postgres://…
3
+ STRIPE_KEY="sk_live_…"`,value:n,onChange:e=>{r(e.target.value),a(null),s([])}})]}),i!==null&&i.entries.length>0&&(0,$.jsx)(`div`,{className:`card dt-wrap`,children:(0,$.jsxs)(`table`,{className:`dt`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Key`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Plan`}),(0,$.jsx)(`th`,{className:`col-shrink`,children:`Current`})]})}),(0,$.jsx)(`tbody`,{children:i.entries.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{className:`cell-key`,children:P(e.key)}),(0,$.jsx)(`td`,{className:`col-shrink`,children:(0,$.jsx)(`span`,{className:He[e.action],children:e.action})}),(0,$.jsx)(`td`,{className:`col-shrink cell-mono cell-muted`,children:e.version===null?`—`:`v${e.version}`})]},e.key))})]})}),i!==null&&i.entries.length>0&&b.length===0&&(0,$.jsx)(k,{tone:`good`,children:`Every key already has this value. There is nothing to write.`}),o.length>0&&(0,$.jsxs)(k,{tone:`bad`,children:[(0,$.jsxs)(`strong`,{children:[o.length,` line`,o.length===1?``:`s`,` could not be parsed`]}),(0,$.jsx)(`ul`,{style:{margin:`0.375rem 0 0`,paddingLeft:`1.1rem`},children:o.map(e=>(0,$.jsxs)(`li`,{children:[`Line `,e.line,`: `,e.reason,` `,(0,$.jsxs)(`span`,{className:`mono`,children:[`(`,e.text,`)`]})]},e.line))})]}),(0,$.jsx)(I,{error:f}),(0,$.jsxs)(`div`,{className:`dialog-actions`,children:[(0,$.jsx)(`button`,{className:`btn`,onClick:y,children:`Cancel`}),i===null?(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||n.trim()===``,onClick:_,children:[d&&(0,$.jsx)(N,{}),`Preview changes`]}):(0,$.jsxs)(`button`,{className:`btn btn-primary`,disabled:d||b.length===0,onClick:v,children:[d&&(0,$.jsx)(N,{}),`Write `,b.length,` change`,b.length===1?``:`s`]})]})]})})]})}export{je as component};
@@ -0,0 +1 @@
1
+ import{B as e,C as t,F as n,L as r,M as i,Ot as a,Q as o,Tt as s,V as c,X as l,ct as u,i as d,l as f,n as p,ot as m,t as h,tt as g,u as _,v,w as y,z as b}from"./page-DbSS7pYH.js";import{D as x,a as S,c as C,g as w,l as T,o as E,r as D,s as O}from"./preload-helper-DduCCcmc.js";import{s as k,t as A}from"./coffre-B0SRYkyG.js";import{r as j,t as M}from"./use-action-LiHC8kKH.js";import{t as N}from"./project-environments-CfIH5kFM.js";import{c as P,i as F,o as I,s as L}from"./directory--9Q70fmm.js";import{a as R,n as z,o as B,r as V,s as H,t as U}from"./grants-BxXkQT0q.js";import{t as W}from"./projects._project.index-CnqMmMG7.js";import{n as G}from"./validation-9Cl_XS-l.js";var K=a(s(),1),q=u();function J({principalType:t,canList:n,grants:r,value:i,onChange:a}){let o=k(),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(``),d=(0,K.useId)(),f=F[t],p=t===`user`?`User`:`Token`;if((0,K.useEffect)(()=>{if(!n)return;let e=!0;return I(o,!0).then(t=>{e&&c(t)}),()=>{e=!1}},[n,o]),!n||s?.ok===!1)return(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:t===`user`?`Email`:`Service token common name`}),(0,q.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,q.jsxs)(`span`,{className:`hint`,children:[`The `,f,` must already be registered under `,t===`user`?`Users`:`Tokens`,`.`]})]});let m=s?.principals.filter(e=>e.principalType===t)??[],h=l.trim().toLowerCase(),g=m.filter(e=>e.principalId.toLowerCase().includes(h));return(0,q.jsxs)(`fieldset`,{className:`field picker`,children:[(0,q.jsx)(`legend`,{className:`label`,children:p}),(0,q.jsxs)(`label`,{className:`input-group`,children:[(0,q.jsxs)(`span`,{className:`visually-hidden`,children:[`Filter `,f,`s by name`]}),(0,q.jsx)(e,{size:14,className:`input-icon`}),(0,q.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`&&g.length===1&&(e.preventDefault(),a(g[0].principalId))}})]}),(0,q.jsx)(`div`,{className:`picker-list`,children:s===null?(0,q.jsxs)(`p`,{className:`picker-empty`,children:[(0,q.jsx)(T,{size:13}),`Loading `,f,`s…`]}):m.length===0?(0,q.jsxs)(`p`,{className:`picker-empty`,children:[`No `,f,`s are registered yet.`,` `,(0,q.jsx)(x,{to:t===`user`?`/users`:`/tokens`,children:`Add one`}),` first.`]}):g.length===0?(0,q.jsxs)(`p`,{className:`picker-empty`,children:[`No registered `,f,` matches “`,l.trim(),`”.`]}):g.map(e=>{let n=r.filter(n=>n.principalType===t&&n.principalId===e.principalId).map(B),o=e.principalId===i;return(0,q.jsxs)(`label`,{className:`picker-option${o?` is-chosen`:``}`,children:[(0,q.jsx)(`input`,{type:`radio`,className:`visually-hidden`,name:d,value:e.principalId,checked:o,onChange:()=>a(e.principalId)}),(0,q.jsx)(L,{type:t,id:e.principalId}),(0,q.jsx)(`span`,{className:`picker-name`,children:e.principalId}),n.length>0&&(0,q.jsxs)(`span`,{className:`picker-held`,children:[(0,q.jsx)(`span`,{className:`visually-hidden`,children:`holds`}),n.map(e=>(0,q.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,q.jsx)(_,{size:14,className:`picker-check`})]},e.principalId)})})]})}var Y=[{key:`environments`,label:`Environments`,icon:(0,q.jsx)(y,{size:15})},{key:`users`,label:`Users`,icon:(0,q.jsx)(o,{size:15})},{key:`tokens`,label:`Tokens`,icon:(0,q.jsx)(t,{size:15})},{key:`settings`,label:`Settings`,icon:(0,q.jsx)(c,{size:15})}];function X(){let e=W.useLoaderData(),{project:t}=W.useParams(),n=W.useSearch();if(!e.ok)return(0,q.jsx)(p,{icon:(0,q.jsx)(v,{size:18}),label:(0,q.jsx)(`span`,{className:`mono`,children:t}),title:`No project here for you`,actions:(0,q.jsx)(x,{className:`btn`,to:`/projects`,children:`All projects`}),children:e.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.`});let{project:r,grants:i,grantsError:a}=e,o=r.permissions.includes(`project.manage`),s=r.permissions.includes(`environment.manage`),c=r.permissions.includes(`grant.manage`),l=Y.filter(({key:e})=>e===`environments`||(e===`users`||e===`tokens`)&&c||e===`settings`&&o),u=l.find(({key:e})=>e===n.tab)?.key??`environments`,f=u===`users`?`user`:`service`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{tile:r.slug,title:r.name,aside:(0,q.jsx)(`span`,{className:`page-title-slug`,children:r.slug}),actions:u===`environments`?s&&(0,q.jsx)($,{project:r.slug}):(u===`users`||u===`tokens`)&&a===null&&(0,q.jsx)(te,{principalType:f,project:r.slug,environments:r.environments,grants:i})}),r.archivedAt!==null&&(0,q.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,q.jsxs)(C,{tone:`bad`,children:[(0,q.jsx)(`strong`,{children:`This project is archived.`}),` Its environments serve no reads, to people or to machines, until it is restored.`]})}),l.length>1&&(0,q.jsx)(`nav`,{className:`tabs`,"aria-label":`Project sections`,children:l.map(({key:e,label:t,icon:n})=>(0,q.jsxs)(x,{to:`/projects/$project`,params:{project:r.slug},search:{tab:e===`environments`?void 0:e},activeOptions:{exact:!0,explicitUndefined:!0},"aria-current":e===u?`page`:void 0,children:[n,t]},e))}),u===`environments`&&(0,q.jsx)(Z,{project:r,canManage:s}),(u===`users`||u===`tokens`)&&(a===null?(0,q.jsx)(ee,{principalType:f,project:r.slug,grants:i.filter(e=>e.principalType===f)}):(0,q.jsx)(C,{tone:`bad`,children:a})),u===`settings`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ne,{project:r}),(0,q.jsx)(re,{project:r})]})]})}function Z({project:e,canManage:t}){let n=e.environments.filter(N).filter(e=>e.details.archivedAt!==null),r=e.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,q.jsxs)(q.Fragment,{children:[r.length===0?(0,q.jsx)(`div`,{className:`card`,children:(0,q.jsx)(S,{title:`No environments yet`,children:t?`Add the first with Add environment.`:`Creating environments needs environment.manage on this project.`})}):(0,q.jsx)(`ul`,{className:`env-grid`,"aria-label":`Environments`,children:r.map(n=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{project:e.slug,environment:n,isAdmin:t})},`${e.slug}:${n.slug}`))}),n.length>0&&(0,q.jsxs)(`section`,{"aria-labelledby":`archived-environments`,children:[(0,q.jsx)(`h2`,{className:`section-title`,id:`archived-environments`,children:`Archived`}),(0,q.jsx)(`ul`,{className:`env-grid`,children:n.map(n=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{project:e.slug,environment:n,isAdmin:t})},n.slug))})]})]})}function Q({project:e,environment:t,isAdmin:r}){let[a,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(t.slug),[d,p]=(0,K.useState)(t.name),m=k(),{pending:h,error:g,setError:_,run:v}=M(),y=t.details,S=y!==null&&y.archivedAt!==null,C=y?.secretCount??null,A=y!==null&&!S&&t.accessible,N=r&&y!==null,P=l===``?null:G(l);return(0,K.useEffect)(()=>{g!==null&&!a&&j.error(g)},[g,a]),(0,q.jsxs)(`div`,{className:`env-card${A?` is-link`:` is-muted`}`,children:[(0,q.jsxs)(`div`,{className:`env-card-text`,children:[A?(0,q.jsx)(x,{className:`env-card-name stretch`,to:`/projects/$project/$environment`,params:{project:e,environment:t.slug},children:t.name}):(0,q.jsx)(`span`,{className:`env-card-name`,children:t.name}),(0,q.jsxs)(`span`,{className:`env-card-meta`,children:[(0,q.jsx)(`span`,{className:`mono`,children:t.slug}),S?(0,q.jsx)(`span`,{className:`tag tag-red`,children:`archived`}):t.accessible?C!==null&&(0,q.jsxs)(`span`,{children:[C,` secret`,C===1?``:`s`]}):(0,q.jsx)(`span`,{className:`tag tag-outline`,children:`no secret access`})]})]}),N&&(0,q.jsxs)(w.Root,{children:[(0,q.jsx)(w.Trigger,{asChild:!0,children:(0,q.jsx)(`button`,{className:`act act-quiet env-card-menu`,"aria-label":`Actions for ${t.slug}`,disabled:h,children:h?(0,q.jsx)(T,{size:14}):(0,q.jsx)(i,{size:16})})}),(0,q.jsx)(w.Portal,{children:(0,q.jsxs)(w.Content,{className:`menu`,sideOffset:6,align:`end`,children:[(0,q.jsxs)(w.Item,{className:`menu-item`,onSelect:()=>{u(t.slug),p(t.name),o(!0)},children:[(0,q.jsx)(n,{size:14}),`Rename`]}),(0,q.jsx)(w.Separator,{className:`menu-sep`}),(0,q.jsxs)(w.Item,{className:`menu-item${S?``:` menu-item-danger`}`,onSelect:()=>c(!0),children:[S?(0,q.jsx)(b,{size:14}):(0,q.jsx)(f,{size:14}),S?`Restore`:`Archive…`]})]})})]}),N&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(O,{open:a,onOpenChange:e=>{o(e),e||_(null)},title:(0,q.jsxs)(q.Fragment,{children:[`Rename`,` `,(0,q.jsxs)(`span`,{className:`mono`,children:[e,`/`,t.slug]})]}),children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault(),v(()=>m.environments.update(`${e}/${t.slug}`,{slug:l,name:d}),()=>{o(!1),j.success(`Environment renamed`)})},children:[(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Slug`}),(0,q.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,value:l,"aria-invalid":P!==null,onChange:e=>u(e.target.value)}),(0,q.jsx)(`span`,{className:`hint${P===null?``:` edit-note-error`}`,children:P??`Anything running coffre run ${e}/${t.slug} will need the new path.`})]}),(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Display name`}),(0,q.jsx)(`input`,{className:`input`,value:d,onChange:e=>p(e.target.value)})]}),(0,q.jsx)(E,{error:g}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>o(!1),children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h||l===``||P!==null||d.trim()===``,children:[h&&(0,q.jsx)(T,{}),`Save`]})]})]})}),(0,q.jsx)(D,{open:s,onOpenChange:c,title:(0,q.jsxs)(q.Fragment,{children:[S?`Restore`:`Archive`,` `,(0,q.jsxs)(`span`,{className:`mono`,children:[e,`/`,t.slug]}),`?`]}),body:C===null?(0,q.jsx)(q.Fragment,{children:`This changes whether the environment serves secrets to principals who have access. Values and history remain stored.`}):S?(0,q.jsxs)(q.Fragment,{children:[`The environment starts serving its `,C,` secret`,C===1?``:`s`,` again, to everyone who holds a grant on it.`]}):(0,q.jsxs)(q.Fragment,{children:[`Its `,C,` secret`,C===1?``:`s`,` stop being served, so anything running `,(0,q.jsx)(`code`,{children:`coffre run`}),` against`,` `,(0,q.jsxs)(`span`,{className:`mono`,children:[e,`/`,t.slug]}),` `,`loses them at its next start. Values and history survive, and restoring is one click.`]}),confirmLabel:S?`Restore environment`:`Archive environment`,destructive:!S,onConfirm:()=>v(()=>m.environments.update(`${e}/${t.slug}`,{archived:!S}),()=>j.success(S?`${t.slug} restored`:`${t.slug} archived`))})]})]})}function $({project:e}){let[t,n]=(0,K.useState)(!1),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(``),c=k(),{pending:l,error:u,setError:d,run:f}=M(),p=i===``?null:G(i);function m(){n(!1),d(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>n(!0),children:[(0,q.jsx)(r,{size:14}),`Add environment`]}),(0,q.jsx)(O,{open:t,onOpenChange:e=>e?n(!0):m(),title:(0,q.jsxs)(q.Fragment,{children:[`New environment in `,(0,q.jsx)(`span`,{className:`mono`,children:e})]}),children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:t=>{t.preventDefault(),f(async()=>{let{created:t}=await c.environments.create(`${e}/${i}`,{name:o});if(!t)throw new A(`An environment named "${i}" already exists.`)},()=>{j.success(`Environment ${i} added`),a(``),s(``),m()})},children:[(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Slug`}),(0,q.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`staging`,value:i,"aria-invalid":p!==null,onChange:e=>a(e.target.value)}),(0,q.jsx)(`span`,{className:`hint${p===null?``:` edit-note-error`}`,children:p??(0,q.jsxs)(q.Fragment,{children:[`The CLI will address it as`,` `,(0,q.jsxs)(`span`,{className:`mono`,children:[e,`/`,i===``?`staging`:i]}),`.`]})})]}),(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Display name`}),(0,q.jsx)(`input`,{className:`input`,placeholder:`Staging`,value:o,onChange:e=>s(e.target.value)})]}),(0,q.jsx)(E,{error:u}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:m,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:l||i===``||p!==null||o.trim()===``,children:[l&&(0,q.jsx)(T,{}),`Add environment`]})]})]})})]})}function ee({principalType:e,project:n,grants:r}){let i=e===`user`;return(0,q.jsx)(`section`,{className:`card`,"aria-label":i?`Users with access`:`Tokens with access`,children:r.length===0?(0,q.jsxs)(S,{title:i?`No user has access`:`No token has access`,children:[`Add `,i?`a user`:`a token`,` with permissions on the whole project or on one environment.`]}):(0,q.jsx)(z,{lead:(0,q.jsxs)(`span`,{className:`th`,children:[i?(0,q.jsx)(l,{size:14}):(0,q.jsx)(t,{size:14}),i?`Email`:`Name`]}),children:r.map((e,t)=>(0,q.jsx)(U,{number:t+1,project:n,grant:e,leadLabel:i?`Email`:`Name`,lead:(0,q.jsx)(P,{type:e.principalType,id:e.principalId})},e.id))})})}function te({principalType:e,project:t,environments:n,grants:i}){let{capabilities:a}=g({from:`__root__`}),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(``),[u,d]=(0,K.useState)(`viewer:`),[f,p]=(0,K.useState)(``),m=k(),{pending:h,error:_,setError:v,run:y}=M(),b=H(n),x=e===`user`?`user`:`token`;function S(){s(!1),v(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,q.jsx)(r,{size:14}),`Add `,x]}),(0,q.jsx)(O,{open:o,onOpenChange:e=>e?s(!0):S(),title:(0,q.jsxs)(q.Fragment,{children:[`Give a `,x,` access to `,(0,q.jsx)(`span`,{className:`mono`,children:t})]}),wide:!0,description:`Owners manage the whole project and its access. Read and write can cover every environment, or one.`,children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault();let r=R(u);y(()=>V(m,{project:t,principalType:e,principalId:c.trim(),role:r.role,environmentSlug:r.environmentSlug,expiresAt:f===``?null:new Date(`${f}T23:59:59Z`).toISOString()}),({existed:e})=>{let t=b.find(e=>e.value===u)?.label??`access`;j.success(e?`${c} already has ${t}`:`${c} granted ${t.toLowerCase()}`),l(``),p(``),d(`viewer:`),S()})},children:[(0,q.jsx)(J,{principalType:e,canList:a.canManageGrants,grants:i,value:c,onChange:l}),(0,q.jsxs)(`div`,{className:`form-row`,children:[(0,q.jsxs)(`label`,{className:`field`,style:{flexGrow:2},children:[(0,q.jsx)(`span`,{className:`label`,children:`Permissions`}),(0,q.jsx)(`select`,{className:`select`,value:u,onChange:e=>d(e.target.value),children:b.map(e=>(0,q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsxs)(`span`,{className:`label`,children:[`Expires `,(0,q.jsx)(`span`,{className:`hint`,children:`(optional)`})]}),(0,q.jsx)(`input`,{className:`input`,type:`date`,value:f,onChange:e=>p(e.target.value)})]})]}),(0,q.jsx)(E,{error:_}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:S,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:h||c.trim()===``,children:[h&&(0,q.jsx)(T,{}),`Grant access`]})]})]})})]})}function ne({project:e}){let t=m(),[n,r]=(0,K.useState)(e.slug),[i,a]=(0,K.useState)(e.name),o=k(),{pending:s,error:c,run:l}=M(),u=n===``?null:G(n),d=n!==e.slug||i.trim()!==e.name;return(0,K.useEffect)(()=>{r(e.slug),a(e.name)},[e.slug,e.name]),(0,q.jsxs)(`section`,{className:`card`,"aria-labelledby":`general-settings`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`div`,{children:(0,q.jsx)(`h2`,{className:`card-title`,id:`general-settings`,children:`General`})})}),(0,q.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),l(()=>o.projects.update(e.slug,{slug:n,name:i}),async()=>{j.success(`Project renamed`),n!==e.slug&&await t.navigate({to:`/projects/$project`,params:{project:n},search:{tab:`settings`}})})},children:[(0,q.jsxs)(`div`,{className:`card-body form-row`,children:[(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Slug`}),(0,q.jsx)(`input`,{className:`input input-mono`,spellCheck:!1,value:n,"aria-invalid":u!==null,onChange:e=>r(e.target.value)}),(0,q.jsx)(`span`,{className:`hint${u===null?``:` edit-note-error`}`,children:u??`Scripts that name the old slug will need the new one.`})]}),(0,q.jsxs)(`label`,{className:`field`,children:[(0,q.jsx)(`span`,{className:`label`,children:`Display name`}),(0,q.jsx)(`input`,{className:`input`,value:i,onChange:e=>a(e.target.value)})]})]}),(0,q.jsxs)(`div`,{className:`card-foot`,children:[c!==null&&(0,q.jsx)(`span`,{className:`hint`,children:(0,q.jsx)(E,{error:c})}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:!d||s||n===``||u!==null||i.trim()===``,children:[s&&(0,q.jsx)(T,{}),`Save`]})]})]})]})}function re({project:e}){let[t,n]=(0,K.useState)(!1),r=k(),{pending:i,error:a,run:o}=M(),s=e.archivedAt!==null;return(0,q.jsxs)(h,{labelledBy:`danger-zone`,title:`Danger zone`,tone:`danger`,children:[(0,q.jsxs)(`div`,{className:`card-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`card-row-title`,children:s?`Restore project`:`Archive project`}),(0,q.jsx)(`p`,{className:`card-row-desc`,children:s?`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.`}),a!==null&&(0,q.jsx)(`div`,{style:{marginTop:`0.5rem`},children:(0,q.jsx)(E,{error:a})})]}),(0,q.jsxs)(`button`,{className:`btn ${s?``:`btn-danger-outline`}`,onClick:()=>n(!0),disabled:i,children:[i?(0,q.jsx)(T,{}):s?(0,q.jsx)(b,{size:14}):(0,q.jsx)(f,{size:14}),s?`Restore project`:`Archive project…`]})]}),(0,q.jsx)(D,{open:t,onOpenChange:n,title:(0,q.jsxs)(q.Fragment,{children:[s?`Restore`:`Archive`,` `,(0,q.jsx)(`span`,{className:`mono`,children:e.slug}),`?`]}),body:s?(0,q.jsx)(q.Fragment,{children:`The project reappears in listings and its environments start serving reads again, for everyone who holds a grant on it.`}):(0,q.jsxs)(q.Fragment,{children:[`Every environment in `,(0,q.jsx)(`span`,{className:`mono`,children:e.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:s?`Restore project`:`Archive project`,destructive:!s,onConfirm:()=>o(()=>r.projects.update(e.slug,{archived:!s}),()=>j.success(s?`${e.slug} restored`:`${e.slug} archived`))})]})}export{X as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-BQw4N8k-.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory--9Q70fmm.js","_coffre/assets/grants-BxXkQT0q.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r}from"./grants-BxXkQT0q.js";var i=e(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:e},params:t})=>r(e,t.project),component:n(()=>t(()=>import(`./projects._project.index-BQw4N8k-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
@@ -1 +1 @@
1
- import{Ot as e,R as t,Tt as n,a as r,b as i,c as a,ct as o,i as s,n as c,v as l,w as u}from"./page-BxW2MwaX.js";import{D as d,a as f,l as p,o as m,s as h}from"./preload-helper-BHuP8_FL.js";import{s as g,t as _}from"./coffre-C7qL3HGR.js";import{r as v,t as y}from"./use-action-DgAf-tiX.js";import{n as b,r as x}from"./affordances-DiuJIiR2.js";import{n as S}from"./project-environments-CfIH5kFM.js";import{t as C}from"./projects.index-BNEC7Oz8.js";import{n as w}from"./validation-9Cl_XS-l.js";var T=e(n()),E=o();function D(){let{result:e,secrets:t}=C.useLoaderData();if(!e.ok)return(0,E.jsx)(c,{icon:(0,E.jsx)(a,{size:18}),title:`Projects could not be listed`,actions:(0,E.jsx)(d,{className:`btn`,to:`/login`,children:`Sign in again`}),children:e.error});let n=e.projects.filter(e=>e.archivedAt===null),r=e.projects.filter(e=>e.archivedAt!==null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s,{title:`Projects`,actions:(0,E.jsx)(x,{capabilities:e.capabilities,children:(0,E.jsx)(A,{})})}),n.length===0?(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(f,{title:`Nothing here for you yet`,children:(0,E.jsx)(b,{capabilities:e.capabilities,hasArchivedProjects:r.length>0})})}):(0,E.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,E.jsx)(O,{projects:n,secrets:t})}),r.length>0&&(0,E.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,E.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(O,{projects:r,secrets:t})})]})]})}function O({projects:e,secrets:t}){return(0,E.jsx)(`div`,{className:`dt-wrap`,children:(0,E.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`n`,children:`#`}),(0,E.jsx)(`th`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(l,{size:14}),`Project`]})}),(0,E.jsx)(`th`,{children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(u,{size:14}),`Environments`]})}),(0,E.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(i,{size:14}),`Secrets`]})})]})}),(0,E.jsx)(`tbody`,{children:e.map((e,n)=>(0,E.jsx)(k,{number:n+1,project:e,secrets:t[e.slug]??null},e.slug))})]})})}function k({number:e,project:t,secrets:n}){let i=t.archivedAt!==null,a=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,E.jsxs)(`tr`,{className:`row-link`,children:[(0,E.jsx)(`td`,{className:`n`,children:e}),(0,E.jsx)(`td`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`cell-project`,children:[(0,E.jsx)(r,{name:t.slug}),(0,E.jsxs)(`span`,{className:`cell-stack`,children:[(0,E.jsx)(d,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,E.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,E.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:i||a.length===0?(0,E.jsx)(`span`,{className:`cell-muted`,children:a.length===0?`No environments yet`:`${a.length} environment${a.length===1?``:`s`}`}):(0,E.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:a.map(e=>S(e)?(0,E.jsxs)(d,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,E.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,E.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,E.jsx)(`td`,{className:`col-secrets num nowrap`,children:n!==null&&!i?(0,E.jsxs)(E.Fragment,{children:[n,(0,E.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,n===1?``:`s`]})]}):(0,E.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]})}function A(){let[e,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(``),[a,o]=(0,T.useState)(!1),s=g(),{pending:c,error:l,setError:u,run:d}=y(),f=e===``?null:w(e);function b(){o(!1),u(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,E.jsx)(t,{size:14}),`New project`]}),(0,E.jsx)(h,{open:a,onOpenChange:e=>e?o(!0):b(),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,E.jsxs)(`form`,{className:`form`,onSubmit:t=>{t.preventDefault(),d(async()=>{let{created:t}=await s.projects.create(e,{name:r});if(!t)throw new _(`A project named "${e}" already exists.`)},()=>{v.success(`Project ${e} created`),n(``),i(``),o(!1)})},children:[(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Slug`}),(0,E.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:e,"aria-invalid":f!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,E.jsx)(`span`,{className:`hint${f===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:f??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Display name`}),(0,E.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,E.jsx)(m,{error:l}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c||e===``||f!==null||r.trim()===``,children:[c&&(0,E.jsx)(p,{}),`Create project`]})]})]})})]})}export{D as component};
1
+ import{L as e,Ot as t,Tt as n,a as r,b as i,c as a,ct as o,i as s,n as c,v as l,w as u}from"./page-DbSS7pYH.js";import{D as d,a as f,l as p,o as m,s as h}from"./preload-helper-DduCCcmc.js";import{s as g,t as _}from"./coffre-B0SRYkyG.js";import{r as v,t as y}from"./use-action-LiHC8kKH.js";import{n as b,r as x}from"./affordances-CmoY-8Xf.js";import{n as S}from"./project-environments-CfIH5kFM.js";import{t as C}from"./projects.index-DHIeFVLP.js";import{n as w}from"./validation-9Cl_XS-l.js";var T=t(n()),E=o();function D(){let{result:e,secrets:t}=C.useLoaderData();if(!e.ok)return(0,E.jsx)(c,{icon:(0,E.jsx)(a,{size:18}),title:`Projects could not be listed`,actions:(0,E.jsx)(d,{className:`btn`,to:`/login`,children:`Sign in again`}),children:e.error});let n=e.projects.filter(e=>e.archivedAt===null),r=e.projects.filter(e=>e.archivedAt!==null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s,{title:`Projects`,actions:(0,E.jsx)(x,{capabilities:e.capabilities,children:(0,E.jsx)(A,{})})}),n.length===0?(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(f,{title:`Nothing here for you yet`,children:(0,E.jsx)(b,{capabilities:e.capabilities,hasArchivedProjects:r.length>0})})}):(0,E.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,E.jsx)(O,{projects:n,secrets:t})}),r.length>0&&(0,E.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,E.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(O,{projects:r,secrets:t})})]})]})}function O({projects:e,secrets:t}){return(0,E.jsx)(`div`,{className:`dt-wrap`,children:(0,E.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`n`,children:`#`}),(0,E.jsx)(`th`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(l,{size:14}),`Project`]})}),(0,E.jsx)(`th`,{children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(u,{size:14}),`Environments`]})}),(0,E.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(i,{size:14}),`Secrets`]})})]})}),(0,E.jsx)(`tbody`,{children:e.map((e,n)=>(0,E.jsx)(k,{number:n+1,project:e,secrets:t[e.slug]??null},e.slug))})]})})}function k({number:e,project:t,secrets:n}){let i=t.archivedAt!==null,a=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,E.jsxs)(`tr`,{className:`row-link`,children:[(0,E.jsx)(`td`,{className:`n`,children:e}),(0,E.jsx)(`td`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`cell-project`,children:[(0,E.jsx)(r,{name:t.slug}),(0,E.jsxs)(`span`,{className:`cell-stack`,children:[(0,E.jsx)(d,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,E.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,E.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:i||a.length===0?(0,E.jsx)(`span`,{className:`cell-muted`,children:a.length===0?`No environments yet`:`${a.length} environment${a.length===1?``:`s`}`}):(0,E.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:a.map(e=>S(e)?(0,E.jsxs)(d,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,E.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,E.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,E.jsx)(`td`,{className:`col-secrets num nowrap`,children:n!==null&&!i?(0,E.jsxs)(E.Fragment,{children:[n,(0,E.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,n===1?``:`s`]})]}):(0,E.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]})}function A(){let[t,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(``),[a,o]=(0,T.useState)(!1),s=g(),{pending:c,error:l,setError:u,run:d}=y(),f=t===``?null:w(t);function b(){o(!1),u(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,E.jsx)(e,{size:14}),`New project`]}),(0,E.jsx)(h,{open:a,onOpenChange:e=>e?o(!0):b(),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,E.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),d(async()=>{let{created:e}=await s.projects.create(t,{name:r});if(!e)throw new _(`A project named "${t}" already exists.`)},()=>{v.success(`Project ${t} created`),n(``),i(``),o(!1)})},children:[(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Slug`}),(0,E.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":f!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,E.jsx)(`span`,{className:`hint${f===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:f??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Display name`}),(0,E.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,E.jsx)(m,{error:l}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c||t===``||f!==null||r.trim()===``,children:[c&&(0,E.jsx)(p,{}),`Create project`]})]})]})})]})}export{D as component};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects.index-B8eV8JIn.js","_coffre/assets/page-BxW2MwaX.js","_coffre/assets/preload-helper-BHuP8_FL.js","_coffre/assets/coffre-C7qL3HGR.js","_coffre/assets/use-action-DgAf-tiX.js","_coffre/assets/affordances-DiuJIiR2.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-BHuP8_FL.js";import{o as r}from"./coffre-C7qL3HGR.js";import{s as i}from"./affordances-DiuJIiR2.js";import{n as a}from"./project-environments-CfIH5kFM.js";var o=e(`/projects/`)({loader:async({context:{client:e}})=>{let t=await r(async()=>{let[t,{projects:n}]=await Promise.all([e.me(),e.projects.list()]);return{projects:n,capabilities:i(t,n)}});return{result:t,secrets:t.ok?await s(e,t.projects):{}}},component:n(()=>t(()=>import(`./projects.index-B8eV8JIn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`component`)});async function s(e,t){let n=await Promise.all(t.filter(e=>e.archivedAt===null).map(async t=>{let n=t.environments.filter(a);if(n.length===0)return[t.slug,null];let i=await Promise.all(n.map(n=>r(()=>e.secrets.list(`${t.slug}/${n.slug}`)))),o=new Set;for(let e of i){if(!e.ok)return[t.slug,null];for(let t of e.keys)t.archived||o.add(t.key)}return[t.slug,o.size]}));return Object.fromEntries(n)}export{o as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects.index-9RVSbXjb.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-B0SRYkyG.js";import{s as i}from"./affordances-CmoY-8Xf.js";import{n as a}from"./project-environments-CfIH5kFM.js";var o=e(`/projects/`)({loader:async({context:{client:e}})=>{let t=await r(async()=>{let[t,{projects:n}]=await Promise.all([e.me(),e.projects.list()]);return{projects:n,capabilities:i(t,n)}});return{result:t,secrets:t.ok?await s(e,t.projects):{}}},component:n(()=>t(()=>import(`./projects.index-9RVSbXjb.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`component`)});async function s(e,t){let n=await Promise.all(t.filter(e=>e.archivedAt===null).map(async t=>{let n=t.environments.filter(a);if(n.length===0)return[t.slug,null];let i=await Promise.all(n.map(n=>r(()=>e.secrets.list(`${t.slug}/${n.slug}`)))),o=new Set;for(let e of i){if(!e.ok)return[t.slug,null];for(let t of e.keys)t.archived||o.add(t.key)}return[t.slug,o.size]}));return Object.fromEntries(n)}export{o as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/settings-DYc9gBwr.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./directory--9Q70fmm.js";var i=e(`/settings`)({loader:async({context:{client:e},parentMatchPromise:t})=>{let n=(await t).loaderData,i=n?.capabilities.canManageGrants??!1;return{auth:n?.auth,directory:i?await r(e,!0):null}},component:n(()=>t(()=>import(`./settings-DYc9gBwr.js`),__vite__mapDeps([0,1,2])),`component`)});export{i as t};
@@ -1 +1 @@
1
- import{ct as e,i as t,r as n,t as r}from"./page-BxW2MwaX.js";import{D as i}from"./preload-helper-BHuP8_FL.js";import{t as a}from"./settings-2BPsenNM.js";var o=e(),s=new Intl.ListFormat(`en`,{type:`disjunction`});function c(){let{auth:e,directory:c}=a.useLoaderData(),l=e?.signin?.providers.map(e=>e.label)??[],u=c?.ok===!0?c.principals:null,d=u?.filter(e=>e.isRootAdmin)??[],f=u?.filter(e=>e.principalType===`user`).length??0,p=u?.filter(e=>e.principalType===`service`).length??0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t,{title:`Settings`}),(0,o.jsx)(r,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,o.jsxs)(`dl`,{className:`facts`,children:[(0,o.jsx)(n,{label:`Sign-in`,children:e?.signin?`coffre’s own sign-in, with ${s.format(l)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),u!==null&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n,{label:`Root admins`,children:(0,o.jsx)(`span`,{className:`fact-list`,children:d.map(e=>(0,o.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,o.jsx)(n,{label:`Directory`,children:(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(i,{to:`/users`,children:[f,` user`,f===1?``:`s`]}),` · `,(0,o.jsxs)(i,{to:`/tokens`,children:[p,` token`,p===1?``:`s`]})]})})]})]})})]})}export{c as component};
1
+ import{ct as e,i as t,r as n,t as r}from"./page-DbSS7pYH.js";import{D as i}from"./preload-helper-DduCCcmc.js";import{t as a}from"./settings-BHtK75j4.js";var o=e(),s=new Intl.ListFormat(`en`,{type:`disjunction`});function c(){let{auth:e,directory:c}=a.useLoaderData(),l=e?.signin?.providers.map(e=>e.label)??[],u=c?.ok===!0?c.principals:null,d=u?.filter(e=>e.isRootAdmin)??[],f=u?.filter(e=>e.principalType===`user`).length??0,p=u?.filter(e=>e.principalType===`service`).length??0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t,{title:`Settings`}),(0,o.jsx)(r,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,o.jsxs)(`dl`,{className:`facts`,children:[(0,o.jsx)(n,{label:`Sign-in`,children:e?.signin?`coffre’s own sign-in, with ${s.format(l)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),u!==null&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n,{label:`Root admins`,children:(0,o.jsx)(`span`,{className:`fact-list`,children:d.map(e=>(0,o.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,o.jsx)(n,{label:`Directory`,children:(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(i,{to:`/users`,children:[f,` user`,f===1?``:`s`]}),` · `,(0,o.jsxs)(i,{to:`/tokens`,children:[p,` token`,p===1?``:`s`]})]})})]})]})})]})}export{c as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-Yb0ESFen.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/principal-page-CaAlOB_1.js","_coffre/assets/directory--9Q70fmm.js","_coffre/assets/grants-BxXkQT0q.js","_coffre/assets/offboarding-BmFuQEv1.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r,r as i}from"./coffre-B0SRYkyG.js";import{n as a}from"./principal-page-CaAlOB_1.js";var o=e(`/tokens/$token`)({loader:async({context:{client:e},params:t,parentMatchPromise:n})=>{let o=(await n).loaderData,[s,c]=await Promise.all([a(e,`service`,t.token,o),o?.capabilities.canManageGrants&&o.auth.signin!==null?r(()=>e.tokens.list(i(`service`,t.token))):Promise.resolve(null)]);return{page:s,credentials:c}},component:n(()=>t(()=>import(`./tokens._token-Yb0ESFen.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{o as t};
@@ -0,0 +1 @@
1
+ import{$ as e,C as t,L as n,Ot as r,Tt as i,ct as a,t as o}from"./page-DbSS7pYH.js";import{a as s,c,i as l,l as u,n as d,o as f,s as p,u as m}from"./preload-helper-DduCCcmc.js";import{r as h,s as g}from"./coffre-B0SRYkyG.js";import{r as _,t as v}from"./use-action-LiHC8kKH.js";import{t as y}from"./principal-page-CaAlOB_1.js";import{t as b}from"./tokens._token-D69aJAyr.js";var x=r(i(),1),S=a(),C=[30,90,180,365];function w({serviceId:n,tokens:r}){let i=g(),{pending:a,error:c,run:l}=v();return(0,S.jsxs)(o,{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,S.jsx)(T,{serviceId:n}),children:[c!==null&&(0,S.jsx)(`div`,{className:`card-body`,children:(0,S.jsx)(f,{error:c})}),r.length===0?(0,S.jsx)(s,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,S.jsx)(`div`,{className:`dt-wrap`,children:(0,S.jsxs)(`table`,{className:`dt`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{children:`Token`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,S.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,S.jsx)(`th`,{className:`col-actions`,children:(0,S.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,S.jsx)(`tbody`,{children:r.map(r=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`cell-account`,children:[(0,S.jsx)(t,{size:15}),(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsx)(`span`,{children:r.label??`Unlabelled`}),(0,S.jsx)(`small`,{className:`mono`,children:r.hint})]})]})}),(0,S.jsx)(`td`,{className:`nowrap`,children:(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsx)(m,{iso:r.createdAt}),(0,S.jsxs)(`small`,{children:[`by `,r.createdBy]})]})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:r.lastUsedAt===null?`Never`:(0,S.jsxs)(`span`,{className:`cell-stack`,children:[(0,S.jsx)(m,{iso:r.lastUsedAt,display:`relative`}),r.lastUsedIp!==null&&(0,S.jsx)(`small`,{className:`mono`,children:r.lastUsedIp})]})}),(0,S.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,S.jsx)(m,{iso:r.expiresAt,display:`relative`})}),(0,S.jsx)(`td`,{className:`col-actions`,children:(0,S.jsx)(d,{trigger:(0,S.jsxs)(`button`,{className:`act`,disabled:a,children:[(0,S.jsx)(e,{size:13}),`Revoke`]}),title:(0,S.jsxs)(S.Fragment,{children:[`Revoke `,(0,S.jsx)(`span`,{className:`mono`,children:r.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:()=>l(()=>i.tokens.revoke(h(`service`,n),r.id),()=>_.success(`Token revoked`))})})]},r.id))})]})})]})}function T({serviceId:e}){let[t,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)(90),[d,_]=(0,x.useState)(null),y=g(),{pending:b,error:w,setError:T,run:E}=v();function D(){r(!1),_(null),a(``),T(null)}return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>r(!0),children:[(0,S.jsx)(n,{size:14}),`Issue token`]}),(0,S.jsx)(p,{open:t,onOpenChange:e=>e?r(!0):D(),title:d===null?`Issue a token`:`Copy the token now`,children:d===null?(0,S.jsxs)(`form`,{className:`form`,onSubmit:t=>{t.preventDefault(),E(()=>y.tokens.issue(h(`service`,e),{label:i.trim()===``?null:i.trim(),expiresInDays:o}),e=>_(e))},children:[(0,S.jsxs)(`div`,{className:`form-row`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{className:`label`,children:`Label`}),(0,S.jsx)(`input`,{className:`input`,value:i,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>a(e.target.value)})]}),(0,S.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,S.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,S.jsx)(`select`,{className:`select`,value:o,onChange:e=>s(Number(e.target.value)),children:C.map(e=>(0,S.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,S.jsx)(f,{error:w}),(0,S.jsxs)(`div`,{className:`dialog-actions`,children:[(0,S.jsx)(`button`,{className:`btn`,type:`button`,onClick:D,children:`Cancel`}),(0,S.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:b,children:[b&&(0,S.jsx)(u,{}),`Issue token`]})]})]}):(0,S.jsxs)(`div`,{className:`form`,children:[(0,S.jsxs)(c,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,S.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,S.jsxs)(`div`,{className:`token-once`,children:[(0,S.jsx)(`code`,{className:`mono`,children:d.token}),(0,S.jsx)(l,{value:d.token,label:`Copy token`})]}),(0,S.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,S.jsx)(m,{iso:d.expiresAt}),`. Send it as`,` `,(0,S.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,S.jsx)(`div`,{className:`dialog-actions`,children:(0,S.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:D,children:`Done`})})]})})]})}function E(){let{token:e}=b.useParams(),{page:t,credentials:n}=b.useLoaderData(),r=t.report?.ok===!0&&t.report.report?.status===`active`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(y,{principalType:`service`,principalId:e,data:t}),r&&n?.ok===!0&&(0,S.jsx)(w,{serviceId:e,tokens:n.tokens})]})}export{E as component};
@@ -1 +1 @@
1
- import{C as e,ct as t,i as n,n as r}from"./page-BxW2MwaX.js";import{n as i,t as a}from"./directory-C2Ou4SQv.js";import{t as o}from"./tokens.index-BdKE2Jv8.js";import{n as s}from"./offboarding-DOLJQcXU.js";var c=t();function l(){let t=o.useLoaderData();if(!t.ok)return(0,c.jsx)(r,{icon:(0,c.jsx)(e,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:t.error});let l=t.principals.filter(e=>e.principalType===`service`);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{title:`Tokens`,actions:(0,c.jsx)(a,{principalType:`service`})}),(0,c.jsx)(i,{principalType:`service`,principals:l,hasRemoved:t.removed.some(e=>e.principalType===`service`)}),(0,c.jsx)(s,{principalType:`service`,removed:t.removed})]})}export{l as component};
1
+ import{C as e,ct as t,i as n,n as r}from"./page-DbSS7pYH.js";import{n as i,t as a}from"./directory--9Q70fmm.js";import{t as o}from"./tokens.index-T5bax16J.js";import{n as s}from"./offboarding-BmFuQEv1.js";var c=t();function l(){let t=o.useLoaderData();if(!t.ok)return(0,c.jsx)(r,{icon:(0,c.jsx)(e,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:t.error});let l=t.principals.filter(e=>e.principalType===`service`);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{title:`Tokens`,actions:(0,c.jsx)(a,{principalType:`service`})}),(0,c.jsx)(i,{principalType:`service`,principals:l,hasRemoved:t.removed.some(e=>e.principalType===`service`)}),(0,c.jsx)(s,{principalType:`service`,removed:t.removed})]})}export{l as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens.index-Cl6jAaG1.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/directory--9Q70fmm.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/offboarding-BmFuQEv1.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./directory--9Q70fmm.js";var i=e(`/tokens/`)({loader:async({context:{client:e},parentMatchPromise:t})=>r(e,(await t).loaderData?.capabilities.canManageGrants??!1),component:n(()=>t(()=>import(`./tokens.index-Cl6jAaG1.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
@@ -1 +1 @@
1
- import{Z as e,ct as t,n,tt as r}from"./page-BxW2MwaX.js";var i=t();function a(){let{principal:t,accessTampered:a}=r({from:`__root__`});return a?(0,i.jsxs)(n,{icon:(0,i.jsx)(e,{size:18}),label:`Integrity check failed`,title:`Your access is on hold`,children:[(0,i.jsxs)(`p`,{children:[`Your access record`,t!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:t.id}),`)`]}),` `,`was changed outside coffre, so its vault refuses it until someone looks. Nothing you held is available meanwhile.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner to remove you under Users and add you again, which starts your access over.`})]}):(0,i.jsxs)(n,{icon:(0,i.jsx)(e,{size:18}),label:`Registration required`,title:`You are not a member yet`,children:[(0,i.jsxs)(`p`,{children:[`Cloudflare Access knows who you are`,t!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:t.id}),`)`]}),`, but this coffre instance has not registered that identity. Until it does, no projects, secrets, audit entries or API operations are available to you.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner or root admin to add your Access email under Users.`})]})}export{a as component};
1
+ import{X as e,ct as t,n,tt as r}from"./page-DbSS7pYH.js";var i=t();function a(){let{principal:t,accessTampered:a}=r({from:`__root__`});return a?(0,i.jsxs)(n,{icon:(0,i.jsx)(e,{size:18}),label:`Integrity check failed`,title:`Your access is on hold`,children:[(0,i.jsxs)(`p`,{children:[`Your access record`,t!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:t.id}),`)`]}),` `,`was changed outside coffre, so its vault refuses it until someone looks. Nothing you held is available meanwhile.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner to remove you under Users and add you again, which starts your access over.`})]}):(0,i.jsxs)(n,{icon:(0,i.jsx)(e,{size:18}),label:`Registration required`,title:`You are not a member yet`,children:[(0,i.jsxs)(`p`,{children:[`Cloudflare Access knows who you are`,t!==null&&(0,i.jsxs)(i.Fragment,{children:[` `,`(`,(0,i.jsx)(`span`,{className:`mono`,children:t.id}),`)`]}),`, but this coffre instance has not registered that identity. Until it does, no projects, secrets, audit entries or API operations are available to you.`]}),(0,i.jsx)(`p`,{children:`Ask a coffre owner or root admin to add your Access email under Users.`})]})}export{a as component};
@@ -1 +1 @@
1
- import{Ot as e,Tt as t,ot as n}from"./page-BxW2MwaX.js";import{Q as r}from"./preload-helper-BHuP8_FL.js";import{n as i}from"./coffre-C7qL3HGR.js";var a=e(t(),1),o=e(r(),1);function s(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var c=e=>{switch(e){case`success`:return u;case`info`:return f;case`warning`:return d;case`error`:return p;default:return null}},l=Array(12).fill(0),ee=({visible:e,className:t})=>a.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},a.createElement(`div`,{className:`sonner-spinner`},l.map((e,t)=>a.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),u=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),d=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),f=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),p=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),m=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},a.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),a.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),te=()=>{let[e,t]=a.useState(document.hidden);return a.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},h=1,g=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:h++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,o,s=r.then(async e=>{if(o=[`resolve`,e],a.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(v(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,o=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:o,...s})}}).catch(async e=>{if(o=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),c=()=>new Promise((e,t)=>s.then(()=>o[0]===`reject`?t(o[1]):e(o[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||h++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},_=(e,t)=>{let n=t?.id||h++;return g.addToast({title:e,...t,id:n}),n},v=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,y=Object.assign(_,{success:g.success,info:g.info,warning:g.warning,error:g.error,custom:g.custom,message:g.message,promise:g.promise,dismiss:g.dismiss,loading:g.loading},{getHistory:()=>g.toasts,getToasts:()=>g.getActiveToasts()});s(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function b(e){return e.label!==void 0}var ne=3,x=`24px`,S=`16px`,C=4e3,w=356,re=14,T=45,ie=200;function E(...e){return e.filter(Boolean).join(` `)}function D(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var O=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:o,visibleToasts:s,heights:l,index:u,toasts:d,expanded:f,removeToast:p,defaultRichColors:h,closeButton:g,style:_,cancelButtonStyle:v,actionButtonStyle:y,className:ne=``,descriptionClassName:x=``,duration:S,position:w,gap:re,expandByDefault:O,classNames:k,icons:A,closeButtonAriaLabel:j=`Close toast`}=e,[M,N]=a.useState(null),[P,ae]=a.useState(null),[F,I]=a.useState(!1),[L,R]=a.useState(!1),[z,B]=a.useState(!1),[oe,se]=a.useState(!1),[ce,le]=a.useState(!1),[ue,V]=a.useState(0),[de,H]=a.useState(0),U=a.useRef(n.duration||S||C),fe=a.useRef(null),W=a.useRef(null),pe=u===0,me=u+1<=s,G=n.type,K=n.dismissible!==!1,he=n.className||``,ge=n.descriptionClassName||``,q=a.useMemo(()=>l.findIndex(e=>e.toastId===n.id)||0,[l,n.id]),_e=a.useMemo(()=>n.closeButton??g,[n.closeButton,g]),ve=a.useMemo(()=>n.duration||S||C,[n.duration,S]),J=a.useRef(0),Y=a.useRef(0),X=a.useRef(0),Z=a.useRef(null),[ye,be]=w.split(`-`),xe=a.useMemo(()=>l.reduce((e,t,n)=>n>=q?e:e+t.height,0),[l,q]),Se=te(),Ce=n.invert||t,Q=G===`loading`;Y.current=a.useMemo(()=>q*re+xe,[q,xe]),a.useEffect(()=>{U.current=ve},[ve]),a.useEffect(()=>{I(!0)},[]),a.useEffect(()=>{let e=W.current;if(e){let t=e.getBoundingClientRect().height;return H(t),o(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>o(e=>e.filter(e=>e.toastId!==n.id))}},[o,n.id]),a.useLayoutEffect(()=>{if(!F)return;let e=W.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),o(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[F,n.title,n.description,o,n.id,n.jsx,n.action,n.cancel]);let $=a.useCallback(()=>{R(!0),V(Y.current),o(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{p(n)},ie)},[n,p,o,Y]);a.useEffect(()=>{if(n.promise&&G===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return f||i||Se?(()=>{if(X.current<J.current){let e=new Date().getTime()-J.current;U.current-=e}X.current=new Date().getTime()})():U.current!==1/0&&(J.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},U.current)),()=>clearTimeout(e)},[f,i,n,G,Se,$]),a.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return A?.loading?a.createElement(`div`,{className:E(k?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":G===`loading`},A.loading):a.createElement(ee,{className:E(k?.loader,n?.classNames?.loader),visible:G===`loading`})}let Te=n.icon||A?.[G]||c(G);return a.createElement(`li`,{tabIndex:0,ref:W,className:E(ne,he,k?.toast,n?.classNames?.toast,k?.default,k?.[G],n?.classNames?.[G]),"data-sonner-toast":``,"data-rich-colors":n.richColors??h,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":F,"data-promise":!!n.promise,"data-swiped":ce,"data-removed":L,"data-visible":me,"data-y-position":ye,"data-x-position":be,"data-index":u,"data-front":pe,"data-swiping":z,"data-dismissible":K,"data-type":G,"data-invert":Ce,"data-swipe-out":oe,"data-swipe-direction":P,"data-expanded":!!(f||O&&F),"data-testid":n.testId,style:{"--index":u,"--toasts-before":u,"--z-index":d.length-u,"--offset":`${L?ue:Y.current}px`,"--initial-height":O?`auto`:`${de}px`,..._,...n.style},onDragEnd:()=>{B(!1),N(null),Z.current=null},onPointerDown:e=>{e.button!==2&&(Q||!K||(fe.current=new Date,V(Y.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(B(!0),Z.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(oe||!K)return;Z.current=null;let e=Number(W.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(W.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-fe.current?.getTime(),i=M===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=T||a>.11){V(Y.current),n.onDismiss==null||n.onDismiss.call(n,n),ae(M===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),se(!0);return}else{var o,s;(o=W.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=W.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}le(!1),B(!1),N(null)},onPointerMove:t=>{var n,r;if(!Z.current||!K||window.getSelection()?.toString().length>0)return;let i=t.clientY-Z.current.y,a=t.clientX-Z.current.x,o=e.swipeDirections??D(w);!M&&(Math.abs(a)>1||Math.abs(i)>1)&&N(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(M===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(M===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&le(!0),(n=W.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=W.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx&&G!==`loading`?a.createElement(`button`,{"aria-label":j,"data-disabled":Q,"data-close-button":!0,onClick:Q||!K?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:E(k?.closeButton,n?.classNames?.closeButton)},A?.close??m):null,(G||n.icon||n.promise)&&n.icon!==null&&(A?.[G]!==null||n.icon)?a.createElement(`div`,{"data-icon":``,className:E(k?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,a.createElement(`div`,{"data-content":``,className:E(k?.content,n?.classNames?.content)},a.createElement(`div`,{"data-title":``,className:E(k?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?a.createElement(`div`,{"data-description":``,className:E(x,ge,k?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),a.isValidElement(n.cancel)?n.cancel:n.cancel&&b(n.cancel)?a.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||v,onClick:e=>{b(n.cancel)&&K&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:E(k?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,a.isValidElement(n.action)?n.action:n.action&&b(n.action)?a.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||y,onClick:e=>{b(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:E(k?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function k(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function A(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?S:x;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var j=a.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:s=[`altKey`,`KeyT`],expand:c,closeButton:l,className:ee,offset:u,mobileOffset:d,theme:f=`light`,richColors:p,duration:m,style:te,visibleToasts:h=ne,toastOptions:_,dir:v=k(),gap:y=re,icons:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=a.useState([]),T=a.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),ie=a.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[E,D]=a.useState([]),[j,M]=a.useState(!1),[N,P]=a.useState(!1),[ae,F]=a.useState(f===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f),I=a.useRef(null),L=s.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),R=a.useRef(null),z=a.useRef(!1),B=a.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||g.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return a.useEffect(()=>g.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{o.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),a.useEffect(()=>{if(f!==`system`){F(f);return}if(f===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?F(`dark`):F(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{F(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{F(e?`dark`:`light`)}catch(e){console.error(e)}})}},[f]),a.useEffect(()=>{S.length<=1&&M(!1)},[S]),a.useEffect(()=>{let e=e=>{if(s.every(t=>e[t]||e.code===t)){var t;M(!0),(t=I.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===I.current||I.current?.contains(document.activeElement))&&M(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s]),a.useEffect(()=>{if(I.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,z.current=!1)}},[I.current]),a.createElement(`section`,{ref:t,"aria-label":`${x} ${L}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},ie.map((t,n)=>{let[i,o]=t.split(`-`);return T.length?a.createElement(`ol`,{key:t,dir:v===`auto`?k():v,tabIndex:-1,ref:I,className:ee,"data-sonner-toaster":!0,"data-sonner-theme":ae,"data-y-position":i,"data-x-position":o,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${w}px`,"--gap":`${y}px`,...te,...A(u,d)},onBlur:e=>{z.current&&!e.currentTarget.contains(e.relatedTarget)&&(z.current=!1,R.current&&=(R.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||z.current||(z.current=!0,R.current=e.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{N||M(!1)},onDragEnd:()=>M(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||P(!0)},onPointerUp:()=>P(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>a.createElement(O,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:p,duration:_?.duration??m,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:r,visibleToasts:h,closeButton:_?.closeButton??l,interacting:N,position:t,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:B,toasts:T.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:c,gap:y,expanded:j,swipeDirections:e.swipeDirections}))):null}))});function M(){let e=n(),[t,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)(null);async function c(t,n){r(!0);let a;try{a=await t()}catch(e){s(i(e)),r(!1);return}s(null);try{await e.invalidate(),await n?.(a)}catch{s(`The change was saved, but the page could not refresh. Reload before you retry.`)}r(!1)}return{pending:t,error:o,setError:s,run:c}}export{j as n,y as r,M as t};
1
+ import{Ot as e,Tt as t,ot as n}from"./page-DbSS7pYH.js";import{Q as r}from"./preload-helper-DduCCcmc.js";import{n as i}from"./coffre-B0SRYkyG.js";var a=e(t(),1),o=e(r(),1);function s(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var c=e=>{switch(e){case`success`:return u;case`info`:return f;case`warning`:return d;case`error`:return p;default:return null}},l=Array(12).fill(0),ee=({visible:e,className:t})=>a.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},a.createElement(`div`,{className:`sonner-spinner`},l.map((e,t)=>a.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),u=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),d=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),f=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),p=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},a.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),m=a.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},a.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),a.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),te=()=>{let[e,t]=a.useState(document.hidden);return a.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},h=1,g=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:h++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,o,s=r.then(async e=>{if(o=[`resolve`,e],a.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(v(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,o=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:o,...s})}}).catch(async e=>{if(o=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,o=typeof t.description==`function`?await t.description(e):t.description,s=typeof r==`object`&&!a.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:o,...s})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),c=()=>new Promise((e,t)=>s.then(()=>o[0]===`reject`?t(o[1]):e(o[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,t)=>{let n=t?.id||h++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},_=(e,t)=>{let n=t?.id||h++;return g.addToast({title:e,...t,id:n}),n},v=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,y=Object.assign(_,{success:g.success,info:g.info,warning:g.warning,error:g.error,custom:g.custom,message:g.message,promise:g.promise,dismiss:g.dismiss,loading:g.loading},{getHistory:()=>g.toasts,getToasts:()=>g.getActiveToasts()});s(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function b(e){return e.label!==void 0}var ne=3,x=`24px`,S=`16px`,C=4e3,w=356,re=14,T=45,ie=200;function E(...e){return e.filter(Boolean).join(` `)}function D(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var O=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:o,visibleToasts:s,heights:l,index:u,toasts:d,expanded:f,removeToast:p,defaultRichColors:h,closeButton:g,style:_,cancelButtonStyle:v,actionButtonStyle:y,className:ne=``,descriptionClassName:x=``,duration:S,position:w,gap:re,expandByDefault:O,classNames:k,icons:A,closeButtonAriaLabel:j=`Close toast`}=e,[M,N]=a.useState(null),[P,ae]=a.useState(null),[F,I]=a.useState(!1),[L,R]=a.useState(!1),[z,B]=a.useState(!1),[oe,se]=a.useState(!1),[ce,le]=a.useState(!1),[ue,V]=a.useState(0),[de,H]=a.useState(0),U=a.useRef(n.duration||S||C),fe=a.useRef(null),W=a.useRef(null),pe=u===0,me=u+1<=s,G=n.type,K=n.dismissible!==!1,he=n.className||``,ge=n.descriptionClassName||``,q=a.useMemo(()=>l.findIndex(e=>e.toastId===n.id)||0,[l,n.id]),_e=a.useMemo(()=>n.closeButton??g,[n.closeButton,g]),ve=a.useMemo(()=>n.duration||S||C,[n.duration,S]),J=a.useRef(0),Y=a.useRef(0),X=a.useRef(0),Z=a.useRef(null),[ye,be]=w.split(`-`),xe=a.useMemo(()=>l.reduce((e,t,n)=>n>=q?e:e+t.height,0),[l,q]),Se=te(),Ce=n.invert||t,Q=G===`loading`;Y.current=a.useMemo(()=>q*re+xe,[q,xe]),a.useEffect(()=>{U.current=ve},[ve]),a.useEffect(()=>{I(!0)},[]),a.useEffect(()=>{let e=W.current;if(e){let t=e.getBoundingClientRect().height;return H(t),o(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>o(e=>e.filter(e=>e.toastId!==n.id))}},[o,n.id]),a.useLayoutEffect(()=>{if(!F)return;let e=W.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,H(r),o(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[F,n.title,n.description,o,n.id,n.jsx,n.action,n.cancel]);let $=a.useCallback(()=>{R(!0),V(Y.current),o(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{p(n)},ie)},[n,p,o,Y]);a.useEffect(()=>{if(n.promise&&G===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return f||i||Se?(()=>{if(X.current<J.current){let e=new Date().getTime()-J.current;U.current-=e}X.current=new Date().getTime()})():U.current!==1/0&&(J.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},U.current)),()=>clearTimeout(e)},[f,i,n,G,Se,$]),a.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return A?.loading?a.createElement(`div`,{className:E(k?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":G===`loading`},A.loading):a.createElement(ee,{className:E(k?.loader,n?.classNames?.loader),visible:G===`loading`})}let Te=n.icon||A?.[G]||c(G);return a.createElement(`li`,{tabIndex:0,ref:W,className:E(ne,he,k?.toast,n?.classNames?.toast,k?.default,k?.[G],n?.classNames?.[G]),"data-sonner-toast":``,"data-rich-colors":n.richColors??h,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":F,"data-promise":!!n.promise,"data-swiped":ce,"data-removed":L,"data-visible":me,"data-y-position":ye,"data-x-position":be,"data-index":u,"data-front":pe,"data-swiping":z,"data-dismissible":K,"data-type":G,"data-invert":Ce,"data-swipe-out":oe,"data-swipe-direction":P,"data-expanded":!!(f||O&&F),"data-testid":n.testId,style:{"--index":u,"--toasts-before":u,"--z-index":d.length-u,"--offset":`${L?ue:Y.current}px`,"--initial-height":O?`auto`:`${de}px`,..._,...n.style},onDragEnd:()=>{B(!1),N(null),Z.current=null},onPointerDown:e=>{e.button!==2&&(Q||!K||(fe.current=new Date,V(Y.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(B(!0),Z.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(oe||!K)return;Z.current=null;let e=Number(W.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(W.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-fe.current?.getTime(),i=M===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=T||a>.11){V(Y.current),n.onDismiss==null||n.onDismiss.call(n,n),ae(M===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),se(!0);return}else{var o,s;(o=W.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=W.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}le(!1),B(!1),N(null)},onPointerMove:t=>{var n,r;if(!Z.current||!K||window.getSelection()?.toString().length>0)return;let i=t.clientY-Z.current.y,a=t.clientX-Z.current.x,o=e.swipeDirections??D(w);!M&&(Math.abs(a)>1||Math.abs(i)>1)&&N(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(M===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(M===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&le(!0),(n=W.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=W.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx&&G!==`loading`?a.createElement(`button`,{"aria-label":j,"data-disabled":Q,"data-close-button":!0,onClick:Q||!K?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:E(k?.closeButton,n?.classNames?.closeButton)},A?.close??m):null,(G||n.icon||n.promise)&&n.icon!==null&&(A?.[G]!==null||n.icon)?a.createElement(`div`,{"data-icon":``,className:E(k?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,a.createElement(`div`,{"data-content":``,className:E(k?.content,n?.classNames?.content)},a.createElement(`div`,{"data-title":``,className:E(k?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?a.createElement(`div`,{"data-description":``,className:E(x,ge,k?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),a.isValidElement(n.cancel)?n.cancel:n.cancel&&b(n.cancel)?a.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||v,onClick:e=>{b(n.cancel)&&K&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:E(k?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,a.isValidElement(n.action)?n.action:n.action&&b(n.action)?a.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||y,onClick:e=>{b(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:E(k?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function k(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function A(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?S:x;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var j=a.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:s=[`altKey`,`KeyT`],expand:c,closeButton:l,className:ee,offset:u,mobileOffset:d,theme:f=`light`,richColors:p,duration:m,style:te,visibleToasts:h=ne,toastOptions:_,dir:v=k(),gap:y=re,icons:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=a.useState([]),T=a.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),ie=a.useMemo(()=>Array.from(new Set([i].concat(T.filter(e=>e.position).map(e=>e.position)))),[T,i]),[E,D]=a.useState([]),[j,M]=a.useState(!1),[N,P]=a.useState(!1),[ae,F]=a.useState(f===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:f),I=a.useRef(null),L=s.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),R=a.useRef(null),z=a.useRef(!1),B=a.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||g.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return a.useEffect(()=>g.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{o.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[S]),a.useEffect(()=>{if(f!==`system`){F(f);return}if(f===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?F(`dark`):F(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{F(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{F(e?`dark`:`light`)}catch(e){console.error(e)}})}},[f]),a.useEffect(()=>{S.length<=1&&M(!1)},[S]),a.useEffect(()=>{let e=e=>{if(s.every(t=>e[t]||e.code===t)){var t;M(!0),(t=I.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===I.current||I.current?.contains(document.activeElement))&&M(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s]),a.useEffect(()=>{if(I.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,z.current=!1)}},[I.current]),a.createElement(`section`,{ref:t,"aria-label":`${x} ${L}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},ie.map((t,n)=>{let[i,o]=t.split(`-`);return T.length?a.createElement(`ol`,{key:t,dir:v===`auto`?k():v,tabIndex:-1,ref:I,className:ee,"data-sonner-toaster":!0,"data-sonner-theme":ae,"data-y-position":i,"data-x-position":o,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${w}px`,"--gap":`${y}px`,...te,...A(u,d)},onBlur:e=>{z.current&&!e.currentTarget.contains(e.relatedTarget)&&(z.current=!1,R.current&&=(R.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||z.current||(z.current=!0,R.current=e.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{N||M(!1)},onDragEnd:()=>M(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||P(!0)},onPointerUp:()=>P(!1)},T.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>a.createElement(O,{key:n.id,icons:b,index:i,toast:n,defaultRichColors:p,duration:_?.duration??m,className:_?.className,descriptionClassName:_?.descriptionClassName,invert:r,visibleToasts:h,closeButton:_?.closeButton??l,interacting:N,position:t,style:_?.style,unstyled:_?.unstyled,classNames:_?.classNames,cancelButtonStyle:_?.cancelButtonStyle,actionButtonStyle:_?.actionButtonStyle,closeButtonAriaLabel:_?.closeButtonAriaLabel,removeToast:B,toasts:T.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:c,gap:y,expanded:j,swipeDirections:e.swipeDirections}))):null}))});function M(){let e=n(),[t,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)(null);async function c(t,n){r(!0);let a;try{a=await t()}catch(e){s(i(e)),r(!1);return}s(null);try{await e.invalidate(),await n?.(a)}catch{s(`The change was saved, but the page could not refresh. Reload before you retry.`)}r(!1)}return{pending:t,error:o,setError:s,run:c}}export{j as n,y as r,M as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users._user-Dd--epXf.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/principal-page-CaAlOB_1.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-B0SRYkyG.js","_coffre/assets/use-action-LiHC8kKH.js","_coffre/assets/directory--9Q70fmm.js","_coffre/assets/grants-BxXkQT0q.js","_coffre/assets/offboarding-BmFuQEv1.js"])))=>i.map(i=>d[i]);
2
+ import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{n as r}from"./principal-page-CaAlOB_1.js";var i=e(`/users/$user`)({loader:async({context:{client:e},params:t,parentMatchPromise:n})=>r(e,`user`,t.user,(await n).loaderData),component:n(()=>t(()=>import(`./users._user-Dd--epXf.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
@@ -0,0 +1 @@
1
+ import{ct as e}from"./page-DbSS7pYH.js";import{t}from"./principal-page-CaAlOB_1.js";import{t as n}from"./users._user-5op2n3T0.js";var r=e();function i(){let{user:e}=n.useParams();return(0,r.jsx)(t,{principalType:`user`,principalId:e,data:n.useLoaderData()})}export{i as component};