@coffre/ui 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/_coffre/assets/account-CyJDFhek.js +2 -0
- package/dist/client/_coffre/assets/account-DHSs5h2f.js +1 -0
- package/dist/client/_coffre/assets/affordances-BQD5B421.js +1 -0
- package/dist/client/_coffre/assets/audit-Bcyp_dU1.js +2 -0
- package/dist/client/_coffre/assets/audit-rMy9mU9Q.js +1 -0
- package/dist/client/_coffre/assets/auth.device-DuvaComb.js +1 -0
- package/dist/client/_coffre/assets/auth.device-yBt_sLZW.js +2 -0
- package/dist/client/_coffre/assets/directory-C4BMGC7-.js +1 -0
- package/dist/client/_coffre/assets/dist-BNkBTkxj.js +1 -0
- package/dist/client/_coffre/assets/globals-BJkzu6T5.css +1 -0
- package/dist/client/_coffre/assets/grants-CyDW25eX.js +1 -0
- package/dist/client/_coffre/assets/icons-BRl8DlXW.js +1 -0
- package/dist/client/_coffre/assets/index-CA1mtrIx.js +12 -0
- package/dist/client/_coffre/assets/link-CqlAJWBd.js +1 -0
- package/dist/client/_coffre/assets/login-B73b6bsJ.js +1 -0
- package/dist/client/_coffre/assets/login-BO1KAGPU.js +2 -0
- package/dist/client/_coffre/assets/offboarding--5vSKNHv.js +1 -0
- package/dist/client/_coffre/assets/page-Dngv8FMr.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-DBha3tys.js +1 -0
- package/dist/client/_coffre/assets/principal-page-C4qDD-d8.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-eBKxOZ0_.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-or_AX6o5.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-DHdXfEh-.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-iynQgenH.js +1 -0
- package/dist/client/_coffre/assets/projects.index-CGW8mRil.js +1 -0
- package/dist/client/_coffre/assets/row-state-BlarvG7E.js +1 -0
- package/dist/client/_coffre/assets/settings-D-7RJIDf.js +1 -0
- package/dist/client/_coffre/assets/suspense-q_eJaZ18.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-0u7midqA.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-C53NqScg.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-DBZTLnbi.js +1 -0
- package/dist/client/_coffre/assets/ui-BPWFJNz7.js +46 -0
- package/dist/client/_coffre/assets/unregistered-CLhgtwUt.js +1 -0
- package/dist/client/_coffre/assets/use-action-LULgF26O.js +1 -0
- package/dist/client/_coffre/assets/use-change-Bd6NZJj9.js +1 -0
- package/dist/client/_coffre/assets/use-shell-Dx92Huhb.js +1 -0
- package/dist/client/_coffre/assets/useQuery-BIIZz1CB.js +1 -0
- package/dist/client/_coffre/assets/useSuspenseQuery-tP9HFZ8w.js +1 -0
- package/dist/client/_coffre/assets/users._user-BXtaL8Ee.js +2 -0
- package/dist/client/_coffre/assets/users._user-CNYVkXaY.js +1 -0
- package/dist/client/_coffre/assets/users.index-Cs9tibIv.js +1 -0
- package/dist/server/.vite/manifest.json +342 -246
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-T9tMsCwo.js +162 -0
- package/dist/server/_coffre/assets/{account-CUQYGCYh.js → account-BUhhOS5-.js} +150 -117
- package/dist/server/_coffre/assets/{account-DMlUoBxQ.js → account-B_h55GCs.js} +10 -24
- package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
- package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
- package/dist/server/_coffre/assets/{audit-CCdSLmvK.js → audit-B8Ck358-.js} +46 -16
- package/dist/server/_coffre/assets/audit-DFsXfeAQ.js +31 -0
- package/dist/server/_coffre/assets/{auth.device-BoFM1jcf.js → auth.device-BXf_JjT7.js} +5 -5
- package/dist/server/_coffre/assets/{auth.device-C05u5ROO.js → auth.device-cqjWACvB.js} +7 -5
- package/dist/server/_coffre/assets/{directory-GsnYkse0.js → directory-C9SfNgpM.js} +87 -112
- package/dist/server/_coffre/assets/{use-action-DwEmf58L.js → dist-CnnV3t2g.js} +3 -48
- package/dist/server/_coffre/assets/globals-BJkzu6T5.css +1 -0
- package/dist/server/_coffre/assets/grants--315KmXu.js +158 -0
- package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-CWsTEfpn.js} +125 -436
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
- package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-CQSkYW_D.js} +7 -5
- package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-LBpXXfsQ.js} +2 -2
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
- package/dist/server/_coffre/assets/{offboarding-8yMa7ViM.js → offboarding-CykelNis.js} +11 -79
- package/dist/server/_coffre/assets/page-BGeDoQO5.js +3531 -0
- package/dist/server/_coffre/assets/{principal-page-B8zPcS2b.js → principal-page-CRdoAQOq.js} +51 -42
- package/dist/server/_coffre/assets/{projects._project._environment-DdIOc7wx.js → projects._project._environment-BXU1Mee5.js} +4 -11
- package/dist/server/_coffre/assets/{projects._project._environment-BZ5Z80V8.js → projects._project._environment-BrDqn8kW.js} +129 -748
- package/dist/server/_coffre/assets/{projects._project.index-CuEAUwGn.js → projects._project.index-CAxBU4tY.js} +134 -96
- package/dist/server/_coffre/assets/{projects._project.index-DvbcU1kh.js → projects._project.index-CYyUVTCl.js} +5 -4
- package/dist/server/_coffre/assets/{projects.index-5HI0wOuG.js → projects.index-D6ZoDE_0.js} +57 -55
- package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
- package/dist/server/_coffre/assets/{router-CQDoql8s.js → router-Bu2qtyqw.js} +376 -92
- package/dist/server/_coffre/assets/row-state-CAItu3n_.js +117 -0
- package/dist/server/_coffre/assets/{settings-BVz78wjP.js → settings-ByeF6hBa.js} +8 -6
- package/dist/server/_coffre/assets/suspense-beD01bb8.js +602 -0
- package/dist/server/_coffre/assets/tokens._token-CM01QPCq.js +10 -0
- package/dist/server/_coffre/assets/{tokens._token-CWs3Mtki.js → tokens._token-D2E4P3Qc.js} +97 -79
- package/dist/server/_coffre/assets/{tokens.index-Ck0LN7aC.js → tokens.index-Cmrgn3mU.js} +9 -6
- package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-DvlGkmaH.js} +7 -836
- package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-DSArejP9.js} +5 -3
- package/dist/server/_coffre/assets/use-action-C2wz34kq.js +47 -0
- package/dist/server/_coffre/assets/use-change-CJpGSNIq.js +1212 -0
- package/dist/server/_coffre/assets/use-shell-C3iYcyP1.js +462 -0
- package/dist/server/_coffre/assets/useQuery-ChxaQ4Cb.js +8 -0
- package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
- package/dist/server/_coffre/assets/useSuspenseQuery-BjAmlGZl.js +117 -0
- package/dist/server/_coffre/assets/users._user-BVeR9fZP.js +10 -0
- package/dist/server/_coffre/assets/{users._user-CMwj-VI9.js → users._user-Cih2Etf4.js} +4 -5
- package/dist/server/_coffre/assets/{users.index-fWHv6A30.js → users.index-Bo2_a95G.js} +9 -6
- package/dist/server/index.js +6 -5
- package/package.json +5 -3
- package/src/components/directory.tsx +75 -104
- package/src/components/grants.tsx +60 -112
- package/src/components/icons.tsx +0 -34
- package/src/components/offboarding.tsx +1 -52
- package/src/components/principal-page.tsx +54 -67
- package/src/components/principal-picker.tsx +7 -16
- package/src/components/row-state.tsx +95 -0
- package/src/components/service-tokens.tsx +75 -64
- package/src/components/shell.tsx +1 -1
- package/src/lib/announce.ts +36 -0
- package/src/lib/changes.ts +498 -0
- package/src/lib/coffre.ts +1 -1
- package/src/lib/optimistic.ts +233 -0
- package/src/lib/queries.ts +385 -0
- package/src/lib/use-action.ts +20 -15
- package/src/lib/use-change.ts +42 -0
- package/src/lib/use-shell.ts +17 -0
- package/src/router.tsx +17 -9
- package/src/routes/__root.tsx +8 -38
- package/src/routes/account.tsx +163 -154
- package/src/routes/audit.tsx +51 -72
- package/src/routes/auth.device.tsx +4 -2
- package/src/routes/login.tsx +3 -2
- package/src/routes/projects.$project.$environment.tsx +223 -238
- package/src/routes/projects.$project.index.tsx +136 -118
- package/src/routes/projects.index.tsx +117 -145
- package/src/routes/settings.tsx +7 -7
- package/src/routes/tokens.$token.tsx +14 -17
- package/src/routes/tokens.index.tsx +8 -4
- package/src/routes/unregistered.tsx +3 -2
- package/src/routes/users.$user.tsx +4 -4
- package/src/routes/users.index.tsx +8 -4
- package/src/shared/models.ts +1 -5
- package/src/styles/globals.css +80 -50
- package/dist/client/_coffre/assets/account-B48wuSF8.js +0 -1
- package/dist/client/_coffre/assets/account-BkNyIDT7.js +0 -2
- package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
- package/dist/client/_coffre/assets/audit-BvwKYb-5.js +0 -2
- package/dist/client/_coffre/assets/audit-D02H-zxS.js +0 -1
- package/dist/client/_coffre/assets/auth.device-BP5FY0K1.js +0 -1
- package/dist/client/_coffre/assets/auth.device-DYOONgFF.js +0 -2
- package/dist/client/_coffre/assets/coffre-BBp7cKVa.js +0 -1
- package/dist/client/_coffre/assets/directory-Bu0EIxqI.js +0 -1
- package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/client/_coffre/assets/grants-DavcwofW.js +0 -1
- package/dist/client/_coffre/assets/index-CDPlq5rM.js +0 -12
- package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
- package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
- package/dist/client/_coffre/assets/offboarding-DWsE2FSa.js +0 -1
- package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
- package/dist/client/_coffre/assets/principal-page-Bp_iwuSd.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-BMeX_B8l.js +0 -2
- package/dist/client/_coffre/assets/projects._project._environment-CT0A-hIU.js +0 -3
- package/dist/client/_coffre/assets/projects._project.index-C_xYOGLT.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-Chcf-cUd.js +0 -1
- package/dist/client/_coffre/assets/projects.index-CfOtb1X5.js +0 -2
- package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +0 -1
- package/dist/client/_coffre/assets/settings-BC9cUJNK.js +0 -1
- package/dist/client/_coffre/assets/settings-Bkj_E21y.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-BA0KqvaW.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CHueIAv1.js +0 -1
- package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
- package/dist/client/_coffre/assets/use-action-l__xZDYY.js +0 -1
- package/dist/client/_coffre/assets/users._user-Dwqa0gv5.js +0 -1
- package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +0 -2
- package/dist/client/_coffre/assets/users.index-BJoF-L37.js +0 -2
- package/dist/client/_coffre/assets/users.index-YUjtbTGy.js +0 -1
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-BKg2AlPu.js +0 -133
- package/dist/server/_coffre/assets/audit-CThXn2v7.js +0 -74
- package/dist/server/_coffre/assets/coffre-C2ANsTAz.js +0 -281
- package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/server/_coffre/assets/grants-B6k4Fu9z.js +0 -243
- package/dist/server/_coffre/assets/projects.index-uiomWX_l.js +0 -54
- package/dist/server/_coffre/assets/settings-4oRyDizv.js +0 -18
- package/dist/server/_coffre/assets/tokens._token-CF_deAwq.js +0 -18
- package/dist/server/_coffre/assets/tokens.index-DF_07KEe.js +0 -10
- package/dist/server/_coffre/assets/users._user-DUzwkSKT.js +0 -10
- package/dist/server/_coffre/assets/users.index-BbuweTwH.js +0 -10
- package/src/components/syncs.tsx +0 -581
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,C as t,F as n,Ot as r,Q as i,Tt as a,a as o,ct as s,i as c,m as l,n as u,ot as d,tt as f,v as p}from"./page-DbSS7pYH.js";import{D as m,a as h,c as g,l as _,o as v,s as y}from"./preload-helper-DduCCcmc.js";import{i as b,o as x,r as S,s as C}from"./coffre-BBp7cKVa.js";import{r as w,t as T}from"./use-action-l__xZDYY.js";import{a as E,i as D,r as O,s as k}from"./directory-Bu0EIxqI.js";import{i as A,n as j,o as M,t as N}from"./grants-DavcwofW.js";import{r as P,t as F}from"./offboarding-DWsE2FSa.js";var I=r(a(),1);function L(e,t){return Object.hasOwn(e.environments,t)?e.environments[t]:null}function R(e,t){if(e.length===0)return{level:`none`,expiresAt:null,environments:{}};let[n]=e;if(e.length===1&&n.environmentSlug===null&&(n.role===`owner`||n.role===`viewer`||n.role===`developer`))return{level:n.role,expiresAt:n.expiresAt,environments:{}};let r={};for(let n of e){let e=n.environmentSlug;if(e===null||!t.includes(e)||Object.hasOwn(r,e)||n.role!==`viewer`&&n.role!==`developer`)return{level:`custom`,expiresAt:null,environments:{}};r[e]={role:n.role,expiresAt:n.expiresAt}}return{level:`env`,expiresAt:null,environments:r}}function z(e,t,n){if(t===`env`&&(e.level===`viewer`||e.level===`developer`)&&Object.keys(e.environments).length===0){let r={role:e.level,expiresAt:e.expiresAt};return{...e,level:t,environments:Object.fromEntries(n.map(e=>[e,r]))}}return{...e,level:t}}function B(e,t,n){let r={...e.environments};return n===null?delete r[t]:r[t]=n,{...e,environments:r}}function V(e){switch(e.level){case`none`:case`custom`:return[];case`owner`:case`viewer`:case`developer`:return[{role:e.level,environmentSlug:null,expiresAt:e.expiresAt}];case`env`:return Object.entries(e.environments).map(([e,t])=>({environmentSlug:e,...t}))}}function H(e,t){return e===t||e!==null&&t!==null&&Date.parse(e)===Date.parse(t)}function U(e,t){if(t.level===`custom`)return[];let n=e=>`${e.role}@${e.environmentSlug??``}`,r=new Map(V(t).map(e=>[n(e),e])),i=new Map(e.map(e=>[n(e),e])),a=[];for(let[e,t]of r)i.has(e)||a.push({kind:`create`,...t});for(let[e,t]of i){let n=r.get(e);n!==void 0&&!H(t.expiresAt,n.expiresAt)&&a.push({kind:`expiry`,grant:t,expiresAt:n.expiresAt})}for(let[e,t]of i)r.has(e)||a.push({kind:`revoke`,grant:t});return a}function W(e,t){let n=t=>t===null?e:`${e}/${t}`,r=(e,t)=>t===null?e:{role:e,until:t},i={};for(let e of t)e.kind===`revoke`&&(i[n(e.grant.environmentSlug)]=null);for(let e of t)e.kind===`expiry`&&(i[n(e.grant.environmentSlug)]=r(e.grant.role,e.expiresAt)),e.kind===`create`&&(i[n(e.environmentSlug)]=r(e.role,e.expiresAt));return i}function G(e){return e===``?null:new Date(`${e}T23:59:59Z`).toISOString()}function K(e){return e===null?``:e.slice(0,10)}var q=s();async function J(e,t,n,r){let i=(r?.projects??[]).filter(e=>e.permissions.includes(`grant.manage`)),[a,o]=await Promise.all([r?.capabilities.canManageGrants?x(async()=>{try{return{report:await e.members.get(S(t,n))}}catch(e){if(b(e)===404)return{report:null};throw e}}):Promise.resolve(null),Promise.all(i.map(t=>A(e,t.slug)))]);return{report:a,access:o.flatMap(e=>e.ok?[{project:e.project,grants:e.grants.filter(e=>e.principalType===t&&e.principalId===n),grantsError:e.grantsError}]:[])}}function Y({principalType:e,principalId:n,data:r}){let a=d(),{instanceRole:s}=f({from:`__root__`}),{report:l,access:_}=r,v=D[e],y=e===`user`,b=y?`/users`:`/tokens`,x=l?.ok===!0?l.report:null,S=x?.status===`removed`,C=x!==null&&!S?{principalType:e,principalId:n,instanceRole:x.instanceRole,isRootAdmin:x.isRootAdmin,tampered:x.status===`tampered`}:void 0;if(l?.ok===!0&&x===null||l===null&&_.length===0)return(0,q.jsx)(u,{icon:y?(0,q.jsx)(i,{size:18}):(0,q.jsx)(t,{size:18}),label:(0,q.jsx)(`span`,{className:`mono`,children:n}),title:y?`No such user for you`:`No such token for you`,actions:(0,q.jsxs)(m,{className:`btn`,to:b,children:[`All `,y?`users`:`tokens`]}),children:l===null?`A ${v}'s page lists its access to the projects where you manage access, and you manage none.`:`No ${v} by that name has ever been registered here.`});let w=_.flatMap(({project:e,grants:t})=>t.map(t=>({project:e,grant:t}))),T=_.filter(e=>e.grantsError!==null),A=S?[]:_.filter(({project:e,grantsError:t})=>e.archivedAt===null&&t===null);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c,{lead:(0,q.jsx)(k,{type:e,id:n,size:`lg`}),title:n,meta:S?(0,q.jsx)(`span`,{className:`tag tag-red`,children:`Removed`}):C?.principalType===`user`&&(0,q.jsx)(O,{principal:C}),actions:(A.length>0||C!==void 0)&&(0,q.jsxs)(q.Fragment,{children:[A.length>0&&(0,q.jsx)(X,{principalType:e,principalId:n,access:A}),C!==void 0&&(0,q.jsx)(E,{principal:C,trigger:`btn btn-icon`,onRemoved:()=>a.invalidate()})]})}),l?.ok===!1&&(0,q.jsx)(`div`,{className:`report-notice`,children:(0,q.jsx)(g,{tone:`bad`,children:l.error})}),S&&x!==null&&(0,q.jsx)(P,{report:x}),!S&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{className:`section-title`,children:`Project access`}),T.map(({project:e,grantsError:t})=>(0,q.jsx)(`div`,{style:{marginBottom:`0.75rem`},children:(0,q.jsxs)(g,{tone:`bad`,children:[(0,q.jsx)(`span`,{className:`mono`,children:e.slug}),`: `,t]})},e.slug)),(0,q.jsx)(`section`,{className:`card`,"aria-label":`Project access`,children:w.length===0?(0,q.jsx)(h,{title:`No project access yet`,children:A.length>0?`Edit access gives this ${v} access to several projects at once.`:`None of the projects where you manage access has a grant for this ${v}.`}):(0,q.jsx)(j,{lead:(0,q.jsxs)(`span`,{className:`th`,children:[(0,q.jsx)(p,{size:14}),`Project`]}),children:w.map(({project:e,grant:t},n)=>(0,q.jsx)(N,{number:n+1,project:e.slug,grant:t,leadLabel:`Project`,lead:(0,q.jsxs)(`span`,{className:`cell-project`,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsx)(m,{className:`cell-link`,to:`/projects/$project`,params:{project:e.slug},search:{tab:y?`users`:`tokens`},children:e.name}),e.archivedAt!==null&&(0,q.jsx)(`span`,{className:`tag tag-red`,children:`archived`})]})},t.id))})}),s!==`root-admin`&&(0,q.jsx)(`p`,{className:`hint section-foot`,children:`Only projects where you manage access are listed.`})]}),x!==null&&(0,q.jsx)(F,{report:x})]})}function X({principalType:e,principalId:t,access:r}){let i=C(),[a,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)({}),{pending:u,error:d,setError:f,run:p}=T(),m=D[e],h=r.map(({project:e,grants:t})=>{let n=e.environments.filter(e=>e.details!==null&&e.details.archivedAt===null).map(e=>e.slug),r=R(t,n),i=Object.hasOwn(c,e.slug)?c[e.slug]:r;return{project:e,grants:t,environments:n,held:r,plan:i,changes:U(t,i)}}),g=h.filter(e=>e.changes.length>0);function b(){s(!1),l({}),f(null)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>s(!0),children:[(0,q.jsx)(n,{size:14}),`Edit access`]}),(0,q.jsx)(y,{open:a,onOpenChange:e=>e?s(!0):b(),title:(0,q.jsxs)(q.Fragment,{children:[`Edit access for `,(0,q.jsx)(`span`,{className:`mono`,children:t})]}),description:`Set what this ${m} can reach on each project you manage, and until when. Saving applies only what you changed.`,wide:!0,children:(0,q.jsxs)(`form`,{className:`form`,onSubmit:n=>{n.preventDefault(),p(()=>i.access.set(S(e,t),Object.assign({},...g.map(({project:e,changes:t})=>W(e.slug,t)))),()=>{w.success(`Updated ${t}’s access on ${g.length} project${g.length===1?``:`s`}`),b()})},children:[(0,q.jsxs)(`ul`,{className:`plan-list`,children:[(0,q.jsxs)(`li`,{className:`plan-head`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{children:`Project`}),(0,q.jsx)(`span`,{children:`Access`}),(0,q.jsx)(`span`,{children:`Expires`})]}),h.map(({project:e,grants:t,environments:n,held:r,plan:i,changes:a})=>{let s=`plan-${e.slug}`,c=t=>l(n=>({...n,[e.slug]:t}));return(0,q.jsxs)(`li`,{className:`plan-row${a.length>0?` is-changed`:``}`,children:[(0,q.jsxs)(`label`,{className:`plan-project`,htmlFor:s,children:[(0,q.jsx)(o,{name:e.slug}),(0,q.jsxs)(`span`,{className:`plan-project-text`,children:[(0,q.jsx)(`span`,{className:`plan-project-name`,children:e.name}),r.level===`custom`&&(0,q.jsxs)(`span`,{className:`plan-project-held`,children:[`Holds `,t.map(e=>M(e)).join(`, `)]})]})]}),(0,q.jsxs)(`select`,{id:s,className:`select select-sm`,value:i.level,onChange:e=>c(z(i,e.target.value,n)),children:[r.level===`custom`&&(0,q.jsx)(`option`,{value:`custom`,children:`Keep as is`}),(0,q.jsx)(`option`,{value:`none`,children:`No access`}),(0,q.jsx)(`option`,{value:`owner`,children:`Owner`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read: all`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write: all`}),n.length>0&&(0,q.jsx)(`option`,{value:`env`,children:`Per environment…`})]}),(i.level===`owner`||i.level===`viewer`||i.level===`developer`)&&(0,q.jsx)(Z,{label:`${e.name} expires`,expiresAt:i.expiresAt,onChange:e=>c({...i,expiresAt:e})}),i.level===`env`&&(0,q.jsx)(`ul`,{className:`plan-envs`,"aria-label":`Environments of ${e.name}`,children:n.map(t=>{let n=L(i,t);return(0,q.jsxs)(`li`,{className:`plan-env`,children:[(0,q.jsx)(`label`,{className:`mono`,htmlFor:`${s}-${t}`,children:t}),(0,q.jsxs)(`select`,{id:`${s}-${t}`,className:`select select-sm`,value:n?.role??``,onChange:e=>{let r=e.target.value;c(B(i,t,r===`viewer`||r===`developer`?{role:r,expiresAt:n?.expiresAt??null}:null))},children:[(0,q.jsx)(`option`,{value:``,children:`No access`}),(0,q.jsx)(`option`,{value:`viewer`,children:`Read`}),(0,q.jsx)(`option`,{value:`developer`,children:`Write`})]}),n!==null&&(0,q.jsx)(Z,{label:`${t} of ${e.name} expires`,expiresAt:n.expiresAt,onChange:e=>c(B(i,t,{...n,expiresAt:e}))})]},t)})}),a.length>0&&(0,q.jsx)(`ul`,{className:`plan-changes`,"aria-label":`Changes to ${e.name}`,children:a.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsx)(Q,{change:e})},e.kind===`create`?`+${e.role}@${e.environmentSlug??``}`:e.grant.id))})]},e.slug)})]}),(0,q.jsx)(v,{error:d}),(0,q.jsxs)(`div`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:u||g.length===0,children:[u&&(0,q.jsx)(_,{}),`Save changes`]})]})]})})]})}function Z({label:t,expiresAt:n,onChange:r}){let i=K(n);return(0,q.jsxs)(`span`,{className:`expiry${i===``?` is-never`:``}`,children:[(0,q.jsx)(`input`,{className:`input select-sm`,type:`date`,"aria-label":t,min:new Date().toISOString().slice(0,10),value:i,onChange:e=>r(G(e.target.value))}),(0,q.jsx)(`span`,{className:`expiry-never`,"aria-hidden":`true`,children:`Never`}),(0,q.jsx)(`button`,{className:`btn btn-quiet btn-sm btn-icon`,type:`button`,"aria-label":`${t}: never`,title:`Never expires`,onClick:()=>r(null),children:(0,q.jsx)(e,{size:12})})]})}function Q({change:e}){let t=e=>e===null?``:` until ${K(e)}`;switch(e.kind){case`create`:return(0,q.jsxs)(`span`,{className:`tag tag-green`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Adds`}),M({...e,roleName:e.role}),t(e.expiresAt)]});case`expiry`:return(0,q.jsxs)(`span`,{className:`tag tag-blue`,children:[(0,q.jsx)(l,{size:12}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Moves the expiry of`}),M(e.grant),e.expiresAt===null?`, no expiry`:t(e.expiresAt)]});case`revoke`:return(0,q.jsxs)(`span`,{className:`tag tag-red`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`−`}),(0,q.jsx)(`span`,{className:`visually-hidden`,children:`Removes`}),M(e.grant)]})}}export{J as n,Y as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project._environment-CT0A-hIU.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./coffre-BBp7cKVa.js";var i=e(`/projects/$project/$environment`)({validateSearch:e=>({filter:typeof e.filter==`string`&&e.filter!==``?e.filter:void 0}),loader:async({context:{client:e},params:t})=>{let n=`${t.project}/${t.environment}`,[i,a]=await Promise.all([r(()=>e.secrets.list(n)),r(()=>e.syncs.list(n))]);return{keys:i,syncs:a}},component:n(()=>t(()=>import(`./projects._project._environment-CT0A-hIU.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,C as n,D as r,F as i,I as a,J as o,K as s,L as c,M as l,Ot as u,P as d,Tt as f,Y as p,_ as m,b as h,c as g,ct as _,g as v,i as y,l as b,m as x,n as S,ot as C,q as w,s as ee,t as T,tt as E,x as D,z as O}from"./page-DbSS7pYH.js";import{D as te,a as ne,c as k,d as A,f as j,g as M,i as re,l as N,m as P,n as F,o as I,r as L,s as R,u as z}from"./preload-helper-DduCCcmc.js";import{c as ie,d as ae,f as B,l as V,m as H,n as U,o as W,p as G,s as K,t as q}from"./coffre-BBp7cKVa.js";import{r as J,t as Y}from"./use-action-l__xZDYY.js";import{i as X,o as oe}from"./affordances-CmoY-8Xf.js";import{t as se}from"./projects._project._environment-BMeX_B8l.js";import{t as ce}from"./validation-9Cl_XS-l.js";var le=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/;function ue(e){let t=[],n=[],r=new Set,i=e.split(/\r\n|\n|\r/);for(let e=0;e<i.length;e++){let a=e+1,o=i[e].trim();if(o===``||o.startsWith(`#`))continue;let s=o.startsWith(`export `)?o.slice(7).trim():o,c=s.indexOf(`=`);if(c===-1){n.push({line:a,text:o,reason:`no "=" on this line`});continue}let l=s.slice(0,c).trim();if(!le.test(l)){n.push({line:a,text:l,reason:`key must match ^[A-Za-z_][A-Za-z0-9_]*$`});continue}let u=s.slice(c+1).trim(),d;if(u.startsWith(`"`)){let e=fe(u,`"`);if(e===-1){n.push({line:a,text:l,reason:`unterminated double quote (multi-line values are not supported)`});continue}if(d=pe(u.slice(1,e)),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else if(u.startsWith(`'`)){let e=u.indexOf(`'`,1);if(e===-1){n.push({line:a,text:l,reason:`unterminated single quote (multi-line values are not supported)`});continue}if(d=u.slice(1,e),de(u.slice(e+1))){n.push({line:a,text:l,reason:`unexpected text after the closing quote`});continue}}else{let e=u.indexOf(` #`);e!==-1&&(u=u.slice(0,e)),d=u.trim()}if(d.includes(`\0`)){n.push({line:a,text:l,reason:`value contains a NUL byte, which cannot be passed in an environment`});continue}if(r.has(l)){n.push({line:a,text:l,reason:`duplicate key in this file`});continue}r.add(l),t.push({key:l,value:d,line:a})}return{entries:t,problems:n}}function de(e){let t=e.trim();return t!==``&&!t.startsWith(`#`)}function fe(e,t){for(let n=1;n<e.length;n++){if(e[n]===`\\`){n++;continue}if(e[n]===t)return n}return-1}function pe(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case`n`:return`
|
|
2
|
-
`;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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects._project.index-Chcf-cUd.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/project-environments-CfIH5kFM.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/grants-DavcwofW.js","_coffre/assets/validation-9Cl_XS-l.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{i as r}from"./grants-DavcwofW.js";var i=e(`/projects/$project/`)({validateSearch:e=>({tab:e.tab===`users`||e.tab===`tokens`||e.tab===`settings`?e.tab:void 0}),loader:({context:{client:e},params:t})=>r(e,t.project),component:n(()=>t(()=>import(`./projects._project.index-Chcf-cUd.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
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-BBp7cKVa.js";import{r as j,t as M}from"./use-action-l__xZDYY.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-Bu0EIxqI.js";import{a as R,n as z,o as B,r as V,s as H,t as U}from"./grants-DavcwofW.js";import{t as W}from"./projects._project.index-C_xYOGLT.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/projects.index-DSjOhLDh.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/affordances-CmoY-8Xf.js","_coffre/assets/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-BBp7cKVa.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-DSjOhLDh.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 +0,0 @@
|
|
|
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,ot as l,v as u,w as d}from"./page-DbSS7pYH.js";import{D as f,a as p,l as m,o as h,s as g}from"./preload-helper-DduCCcmc.js";import{s as _,t as v}from"./coffre-BBp7cKVa.js";import{r as y,t as b}from"./use-action-l__xZDYY.js";import{n as x,r as S}from"./affordances-CmoY-8Xf.js";import{n as C}from"./project-environments-CfIH5kFM.js";import{t as w}from"./projects.index-CfOtb1X5.js";import{n as T}from"./validation-9Cl_XS-l.js";var E=t(n()),D=o();function O(){let{result:e,secrets:t}=w.useLoaderData(),n=l();if(!e.ok)return(0,D.jsx)(c,{icon:(0,D.jsx)(a,{size:18}),title:`Projects could not be listed`,actions:e.signedOut?(0,D.jsx)(f,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,D.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n.invalidate(),children:`Try again`}),children:e.error});let r=e.projects.filter(e=>e.archivedAt===null),i=e.projects.filter(e=>e.archivedAt!==null);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{title:`Projects`,actions:(0,D.jsx)(S,{capabilities:e.capabilities,children:(0,D.jsx)(j,{})})}),r.length===0?(0,D.jsx)(`div`,{className:`card`,children:(0,D.jsx)(p,{title:`Nothing here for you yet`,children:(0,D.jsx)(x,{capabilities:e.capabilities,hasArchivedProjects:i.length>0})})}):(0,D.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,D.jsx)(k,{projects:r,secrets:t})}),i.length>0&&(0,D.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,D.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,D.jsx)(`div`,{className:`card`,children:(0,D.jsx)(k,{projects:i,secrets:t})})]})]})}function k({projects:e,secrets:t}){return(0,D.jsx)(`div`,{className:`dt-wrap`,children:(0,D.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{className:`n`,children:`#`}),(0,D.jsx)(`th`,{className:`col-project`,children:(0,D.jsxs)(`span`,{className:`th`,children:[(0,D.jsx)(u,{size:14}),`Project`]})}),(0,D.jsx)(`th`,{children:(0,D.jsxs)(`span`,{className:`th`,children:[(0,D.jsx)(d,{size:14}),`Environments`]})}),(0,D.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,D.jsxs)(`span`,{className:`th`,children:[(0,D.jsx)(i,{size:14}),`Secrets`]})})]})}),(0,D.jsx)(`tbody`,{children:e.map((e,n)=>(0,D.jsx)(A,{number:n+1,project:e,secrets:t[e.slug]??null},e.slug))})]})})}function A({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,D.jsxs)(`tr`,{className:`row-link`,children:[(0,D.jsx)(`td`,{className:`n`,children:e}),(0,D.jsx)(`td`,{className:`col-project`,children:(0,D.jsxs)(`span`,{className:`cell-project`,children:[(0,D.jsx)(r,{name:t.slug}),(0,D.jsxs)(`span`,{className:`cell-stack`,children:[(0,D.jsx)(f,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,D.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,D.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:i||a.length===0?(0,D.jsx)(`span`,{className:`cell-muted`,children:a.length===0?`No environments yet`:`${a.length} environment${a.length===1?``:`s`}`}):(0,D.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:a.map(e=>C(e)?(0,D.jsxs)(f,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,D.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,D.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,D.jsx)(`td`,{className:`col-secrets num nowrap`,children:n!==null&&!i?(0,D.jsxs)(D.Fragment,{children:[n,(0,D.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,n===1?``:`s`]})]}):(0,D.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]})}function j(){let[t,n]=(0,E.useState)(``),[r,i]=(0,E.useState)(``),[a,o]=(0,E.useState)(!1),s=_(),{pending:c,error:l,setError:u,run:d}=b(),f=t===``?null:T(t);function p(){o(!1),u(null)}return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,D.jsx)(e,{size:14}),`New project`]}),(0,D.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):p(),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,D.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),d(async()=>{let{created:e}=await s.projects.create(t,{name:r});if(!e)throw new v(`A project named "${t}" already exists.`)},()=>{y.success(`Project ${t} created`),n(``),i(``),o(!1)})},children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{className:`label`,children:`Slug`}),(0,D.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,D.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,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{className:`label`,children:`Display name`}),(0,D.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,D.jsx)(h,{error:l}),(0,D.jsxs)(`div`,{className:`dialog-actions`,children:[(0,D.jsx)(`button`,{className:`btn`,type:`button`,onClick:p,children:`Cancel`}),(0,D.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c||t===``||f!==null||r.trim()===``,children:[c&&(0,D.jsx)(m,{}),`Create project`]})]})]})})]})}export{O as component};
|
|
@@ -1 +0,0 @@
|
|
|
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-Bkj_E21y.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,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/settings-BC9cUJNK.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-Bu0EIxqI.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-BC9cUJNK.js`),__vite__mapDeps([0,1,2])),`component`)});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
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-BBp7cKVa.js";import{r as _,t as v}from"./use-action-l__xZDYY.js";import{t as y}from"./principal-page-Bp_iwuSd.js";import{t as b}from"./tokens._token-Dh9jLOkm.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,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-BA0KqvaW.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/principal-page-Bp_iwuSd.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/grants-DavcwofW.js","_coffre/assets/offboarding-DWsE2FSa.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-BBp7cKVa.js";import{n as a}from"./principal-page-Bp_iwuSd.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-BA0KqvaW.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{o as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens.index-CHueIAv1.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/offboarding-DWsE2FSa.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-Bu0EIxqI.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-CHueIAv1.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
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-Bu0EIxqI.js";import{t as o}from"./tokens.index-BgAMWkHT.js";import{n as s}from"./offboarding-DWsE2FSa.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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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-BBp7cKVa.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 +0,0 @@
|
|
|
1
|
-
import{ct as e}from"./page-DbSS7pYH.js";import{t}from"./principal-page-Bp_iwuSd.js";import{t as n}from"./users._user-xJAb3T6Y.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users._user-Dwqa0gv5.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/principal-page-Bp_iwuSd.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/grants-DavcwofW.js","_coffre/assets/offboarding-DWsE2FSa.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-Bp_iwuSd.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-Dwqa0gv5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users.index-YUjtbTGy.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/directory-Bu0EIxqI.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-BBp7cKVa.js","_coffre/assets/use-action-l__xZDYY.js","_coffre/assets/offboarding-DWsE2FSa.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-Bu0EIxqI.js";var i=e(`/users/`)({loader:async({context:{client:e},parentMatchPromise:t})=>r(e,(await t).loaderData?.capabilities.canManageGrants??!1),component:n(()=>t(()=>import(`./users.index-YUjtbTGy.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as e,ct as t,i as n,n as r}from"./page-DbSS7pYH.js";import{n as i,t as a}from"./directory-Bu0EIxqI.js";import{n as o}from"./offboarding-DWsE2FSa.js";import{t as s}from"./users.index-BJoF-L37.js";var c=t();function l(){let t=s.useLoaderData();if(!t.ok)return(0,c.jsx)(r,{icon:(0,c.jsx)(e,{size:18}),label:`Users`,title:`Users are closed to you`,children:t.error});let l=t.principals.filter(e=>e.principalType===`user`);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n,{title:`Users`,actions:(0,c.jsx)(a,{principalType:`user`})}),(0,c.jsx)(i,{principalType:`user`,principals:l,hasRemoved:t.removed.some(e=>e.principalType===`user`)}),(0,c.jsx)(o,{principalType:`user`,removed:t.removed})]})}export{l as component};
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
//#region \0tanstack-start-manifest:v
|
|
2
|
-
var tsrStartManifest = () => ({ routes: {
|
|
3
|
-
__root__: {
|
|
4
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/__root.tsx",
|
|
5
|
-
children: [
|
|
6
|
-
"/",
|
|
7
|
-
"/access",
|
|
8
|
-
"/account",
|
|
9
|
-
"/audit",
|
|
10
|
-
"/login",
|
|
11
|
-
"/settings",
|
|
12
|
-
"/unregistered",
|
|
13
|
-
"/auth/device",
|
|
14
|
-
"/tokens/$token",
|
|
15
|
-
"/users/$user",
|
|
16
|
-
"/projects/",
|
|
17
|
-
"/tokens/",
|
|
18
|
-
"/users/",
|
|
19
|
-
"/projects/$project/$environment",
|
|
20
|
-
"/projects/$project/"
|
|
21
|
-
],
|
|
22
|
-
preloads: [
|
|
23
|
-
"/_coffre/assets/index-CDPlq5rM.js",
|
|
24
|
-
"/_coffre/assets/page-DbSS7pYH.js",
|
|
25
|
-
"/_coffre/assets/preload-helper-DduCCcmc.js",
|
|
26
|
-
"/_coffre/assets/coffre-BBp7cKVa.js",
|
|
27
|
-
"/_coffre/assets/use-action-l__xZDYY.js",
|
|
28
|
-
"/_coffre/assets/affordances-CmoY-8Xf.js",
|
|
29
|
-
"/_coffre/assets/project-environments-CfIH5kFM.js",
|
|
30
|
-
"/_coffre/assets/account-BkNyIDT7.js",
|
|
31
|
-
"/_coffre/assets/audit-BvwKYb-5.js",
|
|
32
|
-
"/_coffre/assets/login-C-wTm_t1.js",
|
|
33
|
-
"/_coffre/assets/settings-Bkj_E21y.js",
|
|
34
|
-
"/_coffre/assets/auth.device-DYOONgFF.js",
|
|
35
|
-
"/_coffre/assets/projects.index-CfOtb1X5.js",
|
|
36
|
-
"/_coffre/assets/tokens.index-BgAMWkHT.js",
|
|
37
|
-
"/_coffre/assets/tokens._token-Dh9jLOkm.js",
|
|
38
|
-
"/_coffre/assets/users.index-BJoF-L37.js",
|
|
39
|
-
"/_coffre/assets/users._user-xJAb3T6Y.js",
|
|
40
|
-
"/_coffre/assets/projects._project.index-C_xYOGLT.js",
|
|
41
|
-
"/_coffre/assets/projects._project._environment-BMeX_B8l.js"
|
|
42
|
-
],
|
|
43
|
-
scripts: [{ attrs: {
|
|
44
|
-
type: "module",
|
|
45
|
-
async: !0,
|
|
46
|
-
src: "/_coffre/assets/index-CDPlq5rM.js"
|
|
47
|
-
} }]
|
|
48
|
-
},
|
|
49
|
-
"/account": {
|
|
50
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/account.tsx",
|
|
51
|
-
children: void 0,
|
|
52
|
-
preloads: [
|
|
53
|
-
"/_coffre/assets/account-B48wuSF8.js",
|
|
54
|
-
"/_coffre/assets/directory-Bu0EIxqI.js",
|
|
55
|
-
"/_coffre/assets/signin-errors-CroZWZgm.js"
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
"/audit": {
|
|
59
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/audit.tsx",
|
|
60
|
-
children: void 0,
|
|
61
|
-
preloads: ["/_coffre/assets/audit-D02H-zxS.js"]
|
|
62
|
-
},
|
|
63
|
-
"/login": {
|
|
64
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/login.tsx",
|
|
65
|
-
children: void 0,
|
|
66
|
-
preloads: ["/_coffre/assets/login-CLLv1om9.js", "/_coffre/assets/signin-errors-CroZWZgm.js"]
|
|
67
|
-
},
|
|
68
|
-
"/settings": {
|
|
69
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/settings.tsx",
|
|
70
|
-
children: void 0,
|
|
71
|
-
preloads: ["/_coffre/assets/settings-BC9cUJNK.js"]
|
|
72
|
-
},
|
|
73
|
-
"/unregistered": {
|
|
74
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/unregistered.tsx",
|
|
75
|
-
children: void 0,
|
|
76
|
-
preloads: ["/_coffre/assets/unregistered-D5go1AfR.js"]
|
|
77
|
-
},
|
|
78
|
-
"/auth/device": {
|
|
79
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/auth.device.tsx",
|
|
80
|
-
children: void 0,
|
|
81
|
-
preloads: ["/_coffre/assets/auth.device-BP5FY0K1.js"]
|
|
82
|
-
},
|
|
83
|
-
"/tokens/$token": {
|
|
84
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.$token.tsx",
|
|
85
|
-
children: void 0,
|
|
86
|
-
preloads: ["/_coffre/assets/tokens._token-BA0KqvaW.js", "/_coffre/assets/principal-page-Bp_iwuSd.js"]
|
|
87
|
-
},
|
|
88
|
-
"/users/$user": {
|
|
89
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.$user.tsx",
|
|
90
|
-
children: void 0,
|
|
91
|
-
preloads: ["/_coffre/assets/users._user-Dwqa0gv5.js", "/_coffre/assets/principal-page-Bp_iwuSd.js"]
|
|
92
|
-
},
|
|
93
|
-
"/projects/": {
|
|
94
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.index.tsx",
|
|
95
|
-
children: void 0,
|
|
96
|
-
preloads: ["/_coffre/assets/projects.index-DSjOhLDh.js", "/_coffre/assets/validation-9Cl_XS-l.js"]
|
|
97
|
-
},
|
|
98
|
-
"/tokens/": {
|
|
99
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/tokens.index.tsx",
|
|
100
|
-
children: void 0,
|
|
101
|
-
preloads: [
|
|
102
|
-
"/_coffre/assets/tokens.index-CHueIAv1.js",
|
|
103
|
-
"/_coffre/assets/directory-Bu0EIxqI.js",
|
|
104
|
-
"/_coffre/assets/offboarding-DWsE2FSa.js"
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
"/users/": {
|
|
108
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/users.index.tsx",
|
|
109
|
-
children: void 0,
|
|
110
|
-
preloads: [
|
|
111
|
-
"/_coffre/assets/users.index-YUjtbTGy.js",
|
|
112
|
-
"/_coffre/assets/directory-Bu0EIxqI.js",
|
|
113
|
-
"/_coffre/assets/offboarding-DWsE2FSa.js"
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
"/projects/$project/$environment": {
|
|
117
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.$environment.tsx",
|
|
118
|
-
children: void 0,
|
|
119
|
-
preloads: ["/_coffre/assets/projects._project._environment-CT0A-hIU.js", "/_coffre/assets/validation-9Cl_XS-l.js"]
|
|
120
|
-
},
|
|
121
|
-
"/projects/$project/": {
|
|
122
|
-
filePath: "/home/runner/work/coffre/coffre/packages/ui/src/routes/projects.$project.index.tsx",
|
|
123
|
-
children: void 0,
|
|
124
|
-
preloads: [
|
|
125
|
-
"/_coffre/assets/projects._project.index-Chcf-cUd.js",
|
|
126
|
-
"/_coffre/assets/directory-Bu0EIxqI.js",
|
|
127
|
-
"/_coffre/assets/grants-DavcwofW.js",
|
|
128
|
-
"/_coffre/assets/validation-9Cl_XS-l.js"
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
} });
|
|
132
|
-
//#endregion
|
|
133
|
-
export { tsrStartManifest };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { C as lazyRouteComponent, w as createFileRoute } from "./ui-D_slKpSF.js";
|
|
2
|
-
import { i as statusOf, o as uiResult } from "./coffre-C2ANsTAz.js";
|
|
3
|
-
//#region src/routes/audit.tsx
|
|
4
|
-
var $$splitComponentImporter = () => import("./audit-CCdSLmvK.js");
|
|
5
|
-
var PAGE_SIZE = 200;
|
|
6
|
-
var Route = createFileRoute("/audit")({
|
|
7
|
-
validateSearch: (search) => ({
|
|
8
|
-
decision: search.decision === "deny" ? "deny" : void 0,
|
|
9
|
-
actorId: typeof search.actorId === "string" && search.actorId !== "" ? search.actorId : void 0,
|
|
10
|
-
detail: search.detail === "1" || search.detail === 1 ? "1" : void 0
|
|
11
|
-
}),
|
|
12
|
-
loaderDeps: ({ search }) => search,
|
|
13
|
-
loader: async ({ context: { client }, deps }) => {
|
|
14
|
-
const [entries, chain] = await Promise.all([listEntries(client, deps), verifyChain(client)]);
|
|
15
|
-
return {
|
|
16
|
-
entries,
|
|
17
|
-
chain
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
21
|
-
});
|
|
22
|
-
function listEntries(client, search) {
|
|
23
|
-
return uiResult(async () => {
|
|
24
|
-
return client.audit.list({
|
|
25
|
-
limit: PAGE_SIZE,
|
|
26
|
-
decision: search.decision,
|
|
27
|
-
actor: search.actorId,
|
|
28
|
-
detail: search.detail
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Whether the log holds, or why that is not known. Verifying is for owners:
|
|
34
|
-
* anyone else reads their projects' part of the log, and a part cannot be
|
|
35
|
-
* checked as a chain, so for them it is a fact about the page, not a fault.
|
|
36
|
-
*/
|
|
37
|
-
async function verifyChain(client) {
|
|
38
|
-
try {
|
|
39
|
-
const result = await client.audit.verify();
|
|
40
|
-
return result.ok ? {
|
|
41
|
-
integrity: "intact",
|
|
42
|
-
through: result.through,
|
|
43
|
-
entries: result.entries,
|
|
44
|
-
checkpoint: result.checkpoint,
|
|
45
|
-
pending: result.pending ?? 0
|
|
46
|
-
} : {
|
|
47
|
-
integrity: "broken",
|
|
48
|
-
through: result.through,
|
|
49
|
-
failedAtSeq: result.failedAtSeq,
|
|
50
|
-
author: result.author,
|
|
51
|
-
reason: result.reason
|
|
52
|
-
};
|
|
53
|
-
} catch (error) {
|
|
54
|
-
const status = statusOf(error);
|
|
55
|
-
if (status === 403) return { integrity: "owners-only" };
|
|
56
|
-
return {
|
|
57
|
-
integrity: "unknown",
|
|
58
|
-
problem: status === void 0 ? "the request never got an answer" : `the request failed with HTTP ${status}`
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** One action: an entry, or a batch of them under one operation, which opens to each. */
|
|
63
|
-
/** A sentence, its people and places links to their pages. */
|
|
64
|
-
/** The entry the log breaks at, said in words as well as in red. */
|
|
65
|
-
/**
|
|
66
|
-
* Whether the log still verifies, beside the title.
|
|
67
|
-
*
|
|
68
|
-
* This replaced a card with a "Verify chain" button on it. A green result you
|
|
69
|
-
* have to ask for is reassurance rather than evidence: it is checked when
|
|
70
|
-
* someone is already feeling confident, and not on the morning it would have
|
|
71
|
-
* mattered. Recomputing on load makes the claim continuous.
|
|
72
|
-
*/
|
|
73
|
-
//#endregion
|
|
74
|
-
export { Route as t };
|