shapewall 0.7.1 → 0.7.2
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/CHANGELOG.md +14 -0
- package/dist/agent/package-lock.json +2 -2
- package/dist/client/assets/{BoardChat-Bv4UDOjO.js → BoardChat-B8ucOOc0.js} +1 -1
- package/dist/client/assets/{ChecksPanel-C6r_Tc9g.js → ChecksPanel-m_9S0BeX.js} +1 -1
- package/dist/client/assets/{History-ajFROfWC.js → History-C3z_y_AC.js} +1 -1
- package/dist/client/assets/{LocalSettings-BSbmmpbN.js → LocalSettings-D_tVfnsp.js} +1 -1
- package/dist/client/assets/{Management-mo8uv2qG.js → Management-zSrx0gXl.js} +1 -1
- package/dist/client/assets/{QuickConnect-DlaijESK.js → QuickConnect-BVLgjq9l.js} +1 -1
- package/dist/client/assets/{app-update-dialog-BHVNR5Cp.js → app-update-dialog-hrSzISKP.js} +1 -1
- package/dist/client/assets/{index-B4AoX3ZW.css → index-C2_XIPRO.css} +1 -1
- package/dist/client/assets/{index-CQeHY7en.js → index-t3fn6ogR.js} +17 -17
- package/dist/client/build-info.json +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +2 -2
- package/dist/console/assets/{LocalAccountsApp-C1sCag6a.js → LocalAccountsApp-BFGZQUvR.js} +1 -1
- package/dist/console/assets/{LocalConsole-LXQmzRFT.js → LocalConsole-BF1NlOmi.js} +1 -1
- package/dist/console/assets/{app-update-dialog-CVniDJKA.js → app-update-dialog-RdHZ7VTX.js} +1 -1
- package/dist/console/assets/app-version-Dt9FxRbR.js +1 -0
- package/dist/console/assets/{console-sMMn_Rwc.css → console-BGRSS8Ru.css} +1 -1
- package/dist/console/assets/{console-CMNNLtFw.js → console-C6pwtJ3X.js} +3 -3
- package/dist/console/assets/{local-agents-DwYJ9cPb.js → local-agents-DUtV5lSR.js} +2 -2
- package/dist/console/assets/{tailnet--wXsG3uh.js → tailnet-D2fRVn68.js} +2 -2
- package/dist/console/assets/{usage-C5CJHejQ.js → usage-CLrlKCWx.js} +1 -1
- package/dist/console/build-info.json +1 -1
- package/dist/console/console.html +5 -5
- package/package.json +1 -1
- package/dist/console/assets/app-version-CTHwlY6g.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usage-
|
|
2
|
-
import{A as e,At as t,C as n,D as r,Dt as i,E as a,F as o,Ft as s,G as c,It as l,J as u,K as d,M as f,Nt as p,O as m,Pt as h,Rt as g,S as _,U as v,Vt as y,W as b,Y as x,_t as S,a as C,c as w,ct as T,d as E,dt as ee,f as D,g as O,h as k,i as te,j as ne,k as re,lt as ie,m as ae,n as oe,o as se,p as A,q as ce,r as le,s as ue,t as de,u as j,w as fe,x as M}from"./ui-DnyJhoQU.js";import{$ as pe,B as me,C as he,D as N,Et as ge,F as P,I as _e,K as ve,M as ye,N as F,O as I,Q as L,S as be,Tt as xe,V as Se,W as Ce,_ as we,_t as Te,a as R,b as Ee,c as z,ct as B,d as V,dt as De,f as H,ft as Oe,g as U,gt as ke,h as Ae,ht as je,it as Me,j as Ne,k as Pe,lt as Fe,m as W,mt as Ie,nt as Le,o as G,ot as Re,p as K,pt as ze,rt as q,s as Be,st as Ve,tt as He,u as Ue,ut as We,v as J,vt as Ge,x as Y,y as Ke,yt as qe,z as Je}from"./theme-CPfJOmcz.js";import{A as Ye,C as Xe,D as Ze,E as Qe,M as $e,N as et,O as tt,S as nt,_ as rt,b as it,c as at,f as ot,g as st,h as ct,j as lt,k as ut,l as dt,m as ft,p as pt,r as mt,s as ht,u as gt,w as _t,x as vt,y as yt}from"./local-agents-DwYJ9cPb.js";import{t as bt}from"./minus-887msXez.js";var xt={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};xt.node;var St=l(xt),Ct={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ct.node;var wt=l(Ct),Tt={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Tt.node;var Et=l(Tt),Dt={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Dt.node;var Ot=l(Dt),kt={name:`door-open`,size:24,node:[[`path`,{d:`M10 21H2`,key:`1sthdo`}],[`path`,{d:`M10 3H7a2 2 0 00-2 2v16`,key:`15gt7x`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z`,key:`tyvg9a`}],[`path`,{d:`M22 21h-3`,key:`1ec3tr`}]]};kt.node;var At=l(kt),jt={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};jt.node;var Mt=l(jt),Nt={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Nt.node;var Pt=l(Nt),Ft={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ft.node;var It=l(Ft),Lt={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Lt.node;var Rt=l(Lt),zt={name:`mail-plus`,size:24,node:[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]};zt.node;var Bt=l(zt),Vt={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Vt.node;var Ht=l(Vt),Ut={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};Ut.node;var Wt=l(Ut),Gt={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};Gt.node;var Kt=l(Gt),qt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};qt.node;var Jt=l(qt),Yt={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Yt.node;var Xt=l(Yt),Zt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Zt.node;var Qt=l(Zt),$t={name:`server-cog`,size:24,node:[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]};$t.node;var en=l($t),tn={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};tn.node;var nn=l(tn),rn={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};rn.node;var an=l(rn),on={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};on.node;var sn=l(on),cn={name:`user-minus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};cn.node;var ln=l(cn),un={name:`user-plus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};un.node;var dn=l(un),fn={name:`user-round-check`,size:24,node:[[`path`,{d:`M2 21a8 8 0 0 1 13.292-6`,key:`bjp14o`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]],aliases:[`user-check-2`]};fn.node;var pn=l(fn),mn={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};mn.node;var hn=l(mn),X=[`viewer`,`member`,`admin`,`owner`],gn=(e,t)=>X.indexOf(e)>=X.indexOf(t)&&X.includes(e),_n={workspace:`viewer`,members:`viewer`,leave:`viewer`,rename:`admin`,settings:`admin`,invites:`admin`,changeRole:`admin`,projects:`admin`,tokens:`admin`,shares:`admin`,access:`admin`,audit:`admin`,export:`admin`,usage:`member`,activity:`viewer`,accessReview:`admin`,usageDefaultLayout:`owner`,deleteWorkspace:`owner`},vn=(e,t)=>gn(e,_n[t]),yn=e=>gn(e,_n.tokens),bn=(e,t)=>yn(e)&&gn(e,t?.approvalChangeRole||`admin`),xn=e=>e===`owner`;function Sn(e,t,n=null){return e===`owner`?!0:e!==`admin`||[`owner`,`admin`].includes(t)?!1:n===null||n!==`owner`}function Cn(e,t){return X.filter(n=>Sn(e,t,n)&&gn(e,`admin`))}var wn=(e,t,{self:n=!1}={})=>n||Sn(e,t),Tn=(e,t)=>vn(e,`invites`)&&X.includes(t)&&(t!==`owner`||e===`owner`),En=e=>X.filter(t=>Tn(e,t)),Z=S();function Dn({demo:e,className:t,children:a,align:o=`start`}){return e.viewAs?(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:a}),(0,Z.jsxs)(fe,{align:o,className:i(`w-64`,t),children:[(0,Z.jsx)(r,{children:`View as (demo)`}),(0,Z.jsx)(m,{value:e.viewAs.value,onValueChange:e.viewAs.onChange,children:e.viewAs.options.map(e=>(0,Z.jsxs)(re,{value:e.id,"data-sw-view-as":e.id,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,Z.jsx)(`span`,{className:`truncate text-xs text-faint`,children:e.hint}):null]},e.id))})]})]}):a}var On=()=>(0,Z.jsxs)(`span`,{className:`inline-flex h-5 shrink-0 items-center gap-1.5 rounded-full bg-accent/12 px-2 text-caption font-semibold text-accent`,children:[(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`,"aria-hidden":`true`}),`Demo`]});function kn({variant:e=`strip`,className:t}){let n=b();return n?e===`chip`?(0,Z.jsxs)(`div`,{className:i(`flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-surface-2/60 p-0.5`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Z.jsx)(Dn,{demo:n,align:`end`,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`h-11 gap-1.5 rounded-full px-2 text-ui text-fg lg:h-8`,"aria-label":`Demo, viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Z.jsx)(On,{}),(0,Z.jsx)(`span`,{className:`hidden max-w-28 truncate font-medium sm:inline`,children:n.roleLabel}),(0,Z.jsx)(p,{size:13,className:`text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsx)(x,{label:`Reset the demo`,size:`icon`,className:`rounded-full text-muted max-lg:hidden lg:h-8 lg:w-8`,onClick:n.reset,"data-sw-demo-reset":!0,children:(0,Z.jsx)(nt,{size:14,"aria-hidden":`true`})}),(0,Z.jsx)(An,{})]}):(0,Z.jsxs)(`div`,{className:i(`flex shrink-0 items-center gap-2 border-b border-line bg-surface px-2 text-ui text-muted sm:px-3 lg:h-9`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Z.jsx)(On,{}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`hidden shrink-0 sm:inline`,children:`Viewing as`}),(0,Z.jsx)(Dn,{demo:n,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`min-w-0 gap-1 px-1.5 text-ui text-fg lg:h-7`,"aria-label":`Viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold`,children:n.roleLabel}),(0,Z.jsxs)(`span`,{className:`hidden truncate font-normal text-muted sm:inline`,children:[`(`,n.personaName,`)`]}),(0,Z.jsx)(p,{size:13,className:`shrink-0 text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsx)(`span`,{className:`hidden truncate text-faint md:inline`,children:`· Changes stay in this browser`})]}),(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`shrink-0 gap-1.5 px-2 text-ui text-muted lg:h-7`,onClick:n.reset,"data-sw-demo-reset":!0,children:[(0,Z.jsx)(nt,{size:13,"aria-hidden":`true`}),` Reset`]}),(0,Z.jsx)(An,{})]}):null}function An(){let e=b();return e?(0,Z.jsx)(f,{open:!!e.resetAsked,onClose:e.cancelReset,title:`Reset the demo?`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:e.cancelReset,className:`lg:h-10`,"data-sw-demo-reset-cancel":!0,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,className:`border-bad/50 bg-bad text-bad-fg hover:bg-bad/90 lg:h-10`,onClick:e.resetNow,"data-sw-demo-reset-confirm":!0,children:[(0,Z.jsx)(nt,{size:14,"aria-hidden":`true`}),` Reset`]})]}),children:(0,Z.jsx)(`p`,{className:`px-5 py-4 text-sm text-muted`,children:`Your comments, invites and changes in this browser go back to the start.`})}):null}var Q=y(g(),1);function jn({notice:e,onSeen:t}){let{run:n,busy:r,error:i}=N(),a=F();return(0,Q.useEffect)(()=>{i&&a(i,`bad`)},[i,a]),(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-security-notice":!0,children:(0,Z.jsxs)(U,{tone:`warn`,title:`Someone signed in to your account with a recovery code`,action:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>me(`/account#activity`),className:`lg:h-8`,children:`Review activity`}),(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:()=>n(async()=>{await L.post(`/auth/security-notice/seen`,{}),await t()}),disabled:r,className:`lg:h-8`,"data-sw-security-notice-dismiss":!0,children:`That was me`})]}),children:[Ie(e.at),e.ip?` from ${e.ip}`:``,`. If that was not you, make new recovery codes and check your passkeys and devices.`]})})}function Mn({passkey:e,onRemoved:t}){let{run:n,busy:r,error:i}=N(),a=F();return(0,Q.useEffect)(()=>{i&&a(i,`bad`)},[i,a]),(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-held-passkey":e.id,children:(0,Z.jsxs)(U,{tone:`warn`,title:`A passkey was added from ${e.device||`a tailnet device`}`,action:e.canRemove?(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>n(async()=>{await L.delete(`/auth/passkeys/${encodeURIComponent(e.id)}`),await t(),a(`Passkey removed. Other devices were signed out.`)}),disabled:r,className:`lg:h-8`,"data-sw-held-passkey-remove":!0,children:`Not you? Remove it`}):null,children:[Ie(e.addedAt),e.nickname?`, named “${e.nickname}”`:``,`. It is your account’s first passkey, added while your tailnet signed you in, so it confirms nothing sensitive until `,Ie(e.onHoldUntil),`.`,` `,e.canRemove?`If you did not add it, remove it now: something on one of your tailnet devices did.`:`If you did not add it, open this server from one of your tailnet devices and remove it there.`]})})}var Nn=(0,Q.createContext)(()=>{});function Pn({label:e,sections:t}){let n=(0,Q.useContext)(Nn),r=t.map(e=>`${e.id}:${+!!e.active}`).join(`,`);return(0,Q.useEffect)(()=>(n({label:e,sections:t}),()=>n(null)),[n,e,r]),null}function Fn({children:t}){let{me:s,refresh:c}=Ne(),l=b(),d=Ce(),f=/^\/w\/(ws_[a-f0-9]{24})/.exec(d)?.[1]||null,p=s.workspaces.find(e=>e.id===f),m=o(`(min-width: 1024px)`),[g,_]=ct(m),[v,y]=(0,Q.useState)(null),x=ft()||(l?`index.html`:null),S=ye(),C=(e,t)=>(0,Z.jsx)(ot,{name:s.user.displayName,avatarUrl:s.user.avatarUrl,detail:`@${s.user.handle}${p?` · ${B[p.role]} in ${p.name}`:``}`,showName:t,side:e?`right`:void 0,triggerClassName:e?t?`w-full justify-start`:`w-10 min-w-10 px-0`:void 0,label:`Account menu`,"data-sw-account-menu":!0,items:[...l?l.consoleItems(f):[],{id:`account`,label:`Account and security`,icon:je,onSelect:()=>Se(`/account`)},...l?[l.resetItem]:[],{id:`sign-out`,label:`Sign out`,icon:tt,onSelect:S,"data-sw-sign-out":!0}],workspaces:{list:s.workspaces.map(e=>({...e,roleLabel:B[e.role]})),current:f,onPick:e=>Se(`/w/${e}`)},viewAs:l?.viewAs||null}),w=[...x?[{id:`board`,label:`Board`,icon:ut,href:x}]:[],{id:`workspace`,label:p?`Workspace: ${p.name}`:`Workspaces`,icon:et,to:p?`/w/${p.id}`:`/`,active:d!==`/account`&&d!==`/device`},{id:`account`,label:`Account and security`,icon:je,to:`/account`,active:d===`/account`}];return(0,Z.jsx)(Nn.Provider,{value:y,children:(0,Z.jsxs)(`div`,{className:`flex min-h-dvh`,children:[m?(0,Z.jsx)(pt,{expanded:g,onToggle:_,homeTo:`/`,homeLabel:`Shapewall, your workspaces`,title:p?.name||`Shapewall`,link:P,logo:(0,Z.jsx)(Ae,{}),items:w,sections:v?.sections||[],sectionsLabel:v?.label,profile:e=>C(!0,e),className:`sticky top-0 h-dvh`}):null,(0,Z.jsxs)(`div`,{className:`flex min-h-dvh min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`header`,{className:`sticky top-0 z-40 border-b border-line bg-surface/95 backdrop-blur`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center gap-2 px-3 sm:px-6`,children:[m?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/`,className:`flex shrink-0 items-center gap-2 rounded-md px-1 py-1 outline-none focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":`Shapewall, your workspaces`,children:[(0,Z.jsx)(Ae,{}),(0,Z.jsx)(`span`,{className:`hidden text-[15px] font-semibold text-fg sm:inline`,children:`Shapewall`})]}),(0,Z.jsx)(`span`,{className:`hidden text-line sm:inline`,"aria-hidden":`true`,children:`/`})]}),(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:i(`min-w-0 shrink gap-2 px-2 text-fg lg:h-9`,m&&`-ml-2`),"data-sw-workspace-switcher":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold`,children:p?p.name:`Workspaces`}),(0,Z.jsx)(Ot,{size:14,className:`shrink-0 text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsxs)(fe,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(r,{children:`Your workspaces`}),s.workspaces.map(e=>(0,Z.jsxs)(a,{onSelect:()=>Se(`/w/${e.id}`),"data-sw-workspace":e.id,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-xs text-faint`,children:B[e.role]}),e.id===f?(0,Z.jsx)(h,{size:14,className:`text-accent`,"aria-hidden":`true`}):null]},e.id)),(0,Z.jsx)(e,{}),(0,Z.jsxs)(a,{onSelect:()=>Se(`/#new`),children:[(0,Z.jsx)(Jt,{size:14,"aria-hidden":`true`}),` New workspace`]})]})]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsx)(kn,{variant:`chip`}),m?null:C(!1,!0)]})}),s.viaRecovery?(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,children:(0,Z.jsx)(U,{tone:`warn`,title:`You signed in with a recovery code`,action:d===`/account`?null:(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>me(`/account#add-passkey`),className:`lg:h-8`,children:`Add a passkey`}),children:`Add a new passkey now. For the next 30 minutes this session can add one, and nothing else that is sensitive.`})}):null,s.securityNotice?(0,Z.jsx)(jn,{notice:s.securityNotice,onSeen:c}):null,(s.heldPasskeys||[]).map(e=>(0,Z.jsx)(Mn,{passkey:e,onRemoved:c},e.id)),l?.storageFull?(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-demo-storage-full":!0,children:(0,Z.jsx)(U,{tone:`warn`,title:`The demo ran out of browser storage`,action:(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:l.reset,className:`lg:h-8`,children:`Reset the demo`}),children:`New changes last only until you leave this page. Resetting the demo frees the space.`})}):null,(0,Z.jsx)(`main`,{className:`mx-auto w-full max-w-6xl flex-1 animate-fade-in px-3 pt-5 pb-10 sm:px-6 sm:pt-8`,id:`main`,children:t}),(0,Z.jsx)(st,{transport:L})]})]})})}function In({children:e,wide:t=!1}){return(0,Z.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center px-4 pt-10 sm:pt-20`,children:[(0,Z.jsxs)(P,{to:`/`,className:`mb-6 flex items-center gap-2 rounded-md outline-none focus-visible:outline-2 focus-visible:outline-accent`,children:[(0,Z.jsx)(Ae,{className:`h-8 w-8`}),(0,Z.jsx)(`span`,{className:`text-lg font-semibold text-fg`,children:`Shapewall`})]}),(0,Z.jsx)(`main`,{className:t?`w-full max-w-lg flex-1 animate-fade-in`:`w-full max-w-md flex-1 animate-fade-in`,id:`main`,children:e}),(0,Z.jsx)(st,{transport:L,className:`px-0 sm:px-0`})]})}function Ln({workspaceId:e,data:t,project:n=null,tokens:r=null,onNewProject:a,onNewToken:o}){let s=!!r?.some(e=>e.status===`active`&&e.scopes.includes(`push`)),c=!!n?.boards.length,l=t.members.length>1||t.invites.length>0,d=[{id:`project`,title:`Create a project`,body:`One per site or app.`,done:!!n||t.projects.length>0,action:a?(0,Z.jsx)(u,{size:`touch`,variant:`default`,onClick:a,className:`lg:h-9`,"data-sw-start-project":!0,children:`New project`}):null},{id:`token`,title:`Make a push token`,body:`A token with the push scope lets the CLI or CI upload captures to this project.`,done:s,action:n&&o?(0,Z.jsx)(u,{size:`touch`,variant:s?`secondary`:`default`,onClick:o,className:`lg:h-9`,"data-sw-start-token":!0,children:`Make a token`}):null},{id:`push`,title:`Push your captures`,body:`From the folder with shapewall.config.json, after a local capture. The token dialog has this command with the token filled in.`,done:c,extra:n?(0,Z.jsx)(Ue,{value:`shapewall push --remote ${Le()}`,testId:`start-push`,className:`mt-2`}):null},{id:`invite`,title:`Invite your team`,body:`Teammates comment on the board; agents pick the comments up.`,done:l,action:(0,Z.jsx)(u,{size:`touch`,variant:l?`secondary`:`default`,onClick:()=>me(`/w/${e}/invites`),className:`lg:h-9`,"data-sw-start-invite":!0,children:`Invite people`})}],f=d.find(e=>!e.done)?.id;return(0,Z.jsxs)(R,{className:`p-4 sm:p-5`,"data-sw-getting-started":!0,children:[(0,Z.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Get started`}),(0,Z.jsx)(`ol`,{className:`mt-3 space-y-3`,children:d.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-3`,"data-sw-start-step":e.id,"data-done":e.done?`true`:`false`,children:[(0,Z.jsx)(`span`,{className:i(`mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold tabular`,e.done?`border-ok bg-ok text-white`:e.id===f?`border-accent text-accent`:`border-line text-muted`),"aria-hidden":`true`,children:e.done?(0,Z.jsx)(h,{size:14}):t+1}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`p`,{className:i(`text-sm font-medium`,e.done?`text-muted line-through`:`text-fg`),children:[e.title,(0,Z.jsx)(`span`,{className:`sr-only`,children:e.done?` (done)`:``})]}),e.done?null:(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:e.body}),!e.done&&e.extra?e.extra:null,!e.done&&e.action?(0,Z.jsx)(`div`,{className:`mt-2`,children:e.action}):null]})]},e.id))})]})}function Rn(){let{data:e,isAdmin:t,workspaceId:n,reload:r}=$(),[i,a]=(0,Q.useState)(!1),o=F();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Projects`,description:`Each project holds the boards you push from your machine or CI, their comments, tokens and share links.`,actions:t?(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>a(!0),className:`lg:h-9`,"data-sw-new-project":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New project`]}):null}),e.projects.length?(0,Z.jsx)(`div`,{className:`grid animate-fade-in gap-4 md:grid-cols-2`,"data-sw-project-grid":!0,children:e.projects.map(e=>(0,Z.jsx)(Bn,{project:e,isAdmin:t,workspaceId:n},e.id))}):t?(0,Z.jsx)(Ln,{workspaceId:n,data:e,onNewProject:()=>a(!0)}):(0,Z.jsx)(R,{children:(0,Z.jsx)(_,{icon:lt,title:`No projects yet`,children:`An admin creates projects. Boards appear here once someone pushes captures.`})}),(0,Z.jsx)(zn,{open:i,onClose:()=>a(!1),workspaceId:n,onCreated:async e=>{await r(),a(!1),o(`Created ${e.name}`),Se(`/w/${n}/projects/${e.id}`)}})]})}function zn({open:e,onClose:t,onCreated:n,workspaceId:r}){let[i,a]=(0,Q.useState)(``),{run:o,busy:s,error:c,setError:l}=N();return(0,Q.useEffect)(()=>{e&&(a(``),l(null))},[e,l]),(0,Z.jsx)(f,{open:e,onClose:()=>s?null:t(),title:`New project`,description:`Usually one per site or app.`,children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o(async()=>{await n((await L.post(q(r,`/projects`),{name:i})).project)})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsx)(V,{label:`Name`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:i,onChange:e=>a(e.target.value),maxLength:80,placeholder:`Marketing site`,"data-sw-project-name":!0})}),(0,Z.jsx)(H,{error:c}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:s,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:s||!i.trim(),className:`lg:h-10`,"data-sw-project-create":!0,children:[s?(0,Z.jsx)(w,{}):null,` Create project`]})]})]})})}function Bn({project:e,isAdmin:t,workspaceId:n}){let r=e.boards.map(e=>e.pushedAt).filter(Boolean).sort().at(-1),i=e.boards.map(e=>e.summary).filter(Boolean),a=i.find(e=>e.thumbnailUrl)?.thumbnailUrl||null,o=e=>i.reduce((t,n)=>t+(Number(n[e])||0),0),s=o(`pages`),c=o(`openComments`),l=o(`needsPerson`),d=e.boards.length>0;return(0,Z.jsxs)(R,{className:`group relative flex flex-col overflow-hidden transition-[box-shadow,border-color,translate] duration-(--motion-fast) ease-standard hover:-translate-y-px hover:border-line-strong hover:shadow-lift focus-within:border-line-strong`,"data-sw-project":e.name,children:[(0,Z.jsx)(`div`,{className:`relative h-36 overflow-hidden border-b border-line bg-surface-2`,"aria-hidden":`true`,children:a?(0,Z.jsx)(`img`,{src:a,alt:``,loading:`lazy`,className:`absolute inset-x-6 top-5 w-[calc(100%-3rem)] rounded-t-md object-cover object-top shadow-pop transition-transform duration-(--motion-base) ease-standard group-hover:-translate-y-0.5`}):(0,Z.jsx)(`div`,{className:`sw-project-cover flex h-full items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`inline-flex h-12 w-12 items-center justify-center rounded-xl border border-line bg-surface text-accent shadow-card`,children:(0,Z.jsx)(lt,{size:22})})})}),(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col p-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`a`,{href:e.boardUrl,className:`flex min-h-11 items-center truncate text-title font-semibold text-fg outline-none lg:min-h-0 after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-accent`,"data-sw-project-link":e.name,children:e.name}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-ui text-muted`,children:d?(0,Z.jsxs)(Z.Fragment,{children:[e.boards.length,` `,e.boards.length===1?`board`:`boards`,s?` · ${s} ${s===1?`page`:`pages`}`:``,r?(0,Z.jsxs)(Z.Fragment,{children:[` · pushed `,(0,Z.jsx)(`span`,{className:`relative z-10`,children:(0,Z.jsx)(Y,{value:r})})]}):null]}):`Nothing pushed yet`})]}),i.length?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,"data-sw-project-stats":!0,children:[(0,Z.jsxs)(T,{tone:c?`accent`:`neutral`,className:`gap-1 tabular-nums`,children:[(0,Z.jsx)(Ht,{size:12,"aria-hidden":`true`}),c?`${c} open ${c===1?`comment`:`comments`}`:`No open comments`]}),l?(0,Z.jsxs)(T,{tone:`warn`,className:`gap-1 tabular-nums`,children:[(0,Z.jsx)(pn,{size:12,"aria-hidden":`true`}),l,` `,l===1?`needs`:`need`,` a person`]}):null]}):null,(0,Z.jsxs)(`div`,{className:`relative z-10 mt-4 flex flex-wrap gap-2 pt-1`,children:[(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`default`,className:`lg:h-9`,children:(0,Z.jsxs)(`a`,{href:e.boardUrl,"data-sw-open-board":e.name,children:[`Open board `,(0,Z.jsx)(ge,{size:15,"aria-hidden":`true`})]})}),t?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsxs)(P,{to:`/w/${n}/projects/${e.id}`,"data-sw-manage-project":e.name,children:[(0,Z.jsx)(nn,{size:15,"aria-hidden":`true`}),` Tokens and sharing`]})}):null]})]})]})}function Vn({mode:e}){return e===`comment`?(0,Z.jsxs)(T,{tone:`accent`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ht,{size:11,"aria-hidden":`true`}),` Guests comment`]}):(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Pt,{size:11,"aria-hidden":`true`}),` View only`]})}function Hn({share:e,projectId:t,onClose:n}){let{workspaceId:r}=$(),i=F(),a=q(r,`/projects/${t}/shares/${e.id}/guests`),o=I(a),s=N(),c=o.data?.guests||[];return(0,Z.jsx)(f,{open:!0,onClose:n,title:`Guests of "${e.name}"`,description:`One row per browser that opened the link`,size:`md`,children:(0,Z.jsxs)(`div`,{className:`px-5 py-4`,"data-sw-guest-list":!0,children:[o.loading&&!o.data?(0,Z.jsx)(W,{}):null,o.error?(0,Z.jsx)(K,{error:o.error,onRetry:o.reload}):null,o.data&&!c.length?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Nobody has opened this link yet.`}):null,c.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:c.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,"data-sw-guest":e.name,"data-sw-guest-status":e.status,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),e.status===`active`?null:(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`ended`?`Ended`:`Expired`})]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[[e.device,e.ipPrefix].filter(Boolean).join(` · `),e.device||e.ipPrefix?` · `:``,`Opened `,(0,Z.jsx)(Y,{value:e.createdAt}),` · Last seen`,` `,(0,Z.jsx)(Y,{value:e.lastSeenAt})]})]}),e.status===`active`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,disabled:s.busy,"data-sw-end-guest":e.name,onClick:()=>s.run(async()=>{await L.delete(`${a}/${e.id}`),i(`Ended ${e.name}`),await o.reload()}),children:`End this guest`}):null]},e.id))}):null,(0,Z.jsx)(H,{error:s.error}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:`Ending a guest signs that browser out at once; their comments stay. They can open the link again while it works: revoke the link to stop everyone.`})]})})}function Un({shares:e,onChanged:t,projectId:n}){let{workspaceId:r,data:i}=$(),a=F(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),d=!!i?.features?.guestSessions,f=N();return e.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-share-list":!0,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-5 md:grid-cols-[1.6fr_1fr_1fr_auto] md:items-center`,"data-sw-share":e.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(Vn,{mode:e.mode}),e.includeChecks?(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:`Checks included`}):null,e.passcode?(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ge,{size:11,"aria-hidden":`true`}),` Passcode`]}):null,e.status===`active`?null:(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`revoked`?`Revoked`:`Expired`})]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-muted`,children:[`By `,e.createdBy?e.createdBy.displayName||`@${e.createdBy.handle}`:`unknown`,` ·`,` `,(0,Z.jsx)(Y,{value:e.createdAt})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Opened `,e.opens,` `,e.opens===1?`time`:`times`]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`Last `,(0,Z.jsx)(Y,{value:e.lastUsedAt,empty:`never`})]})]}),(0,Z.jsx)(`div`,{className:`text-xs text-muted`,children:e.status===`revoked`?(0,Z.jsx)(Y,{value:e.revokedAt,prefix:`Revoked `}):(0,Z.jsx)(Y,{value:e.expiresAt,prefix:e.status===`expired`?`Expired `:`Expires `})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-end`,children:[d&&(n||e.projectId)?(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:()=>l(e),className:`lg:h-8`,"data-sw-share-guests":e.name,children:[(0,Z.jsx)(hn,{size:14,"aria-hidden":`true`}),` Guests`]}):null,e.status===`active`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>s(e),className:`lg:h-8`,"data-sw-revoke-share":e.name,children:`Revoke`}):null]})]},e.id))}),(0,Z.jsx)(z,{open:!!o,onClose:()=>s(null),title:`Revoke "${o?.name}"?`,confirmLabel:`Revoke link`,tone:`danger`,busy:f.busy,error:f.error,onConfirm:()=>f.run(async()=>{await L.delete(q(r,`/projects/${n||o.projectId}/shares/${o.id}`)),s(null),a(`Share link revoked`),await t()}),children:(0,Z.jsx)(`p`,{children:`The link stops working at once, including for anyone who has the board open now. Their comments stay.`})}),c?(0,Z.jsx)(Hn,{share:c,projectId:n||c.projectId,onClose:()=>l(null)}):null]}):(0,Z.jsx)(_,{icon:Rt,title:`No share links`,children:`Share links let people outside the workspace see this project's boards, and comment as guests if you allow it.`})}function Wn({open:e,onClose:t,project:n,onCreated:r}){let{workspaceId:i,data:a}=$(),o=a.features.shareDays,[s,c]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(`view`),[f,p]=(0,Q.useState)(`7`),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),{run:v,busy:y,error:b,setError:x}=N(),[S,C]=he(e,()=>{c(``),d(`view`),p(`7`),h(``),_(!1),x(null)});return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:y,result:S,title:`Share ${n.name}`,resultTitle:`Share link created`,doneProps:{"data-sw-share-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(U,{tone:`warn`,title:`Copy it now: it is shown once`,children:[`Anyone with this link`,e.share.passcode?` and the passcode`:``,` can`,` `,e.share.mode===`comment`?`see and comment on`:`see`,` this project's boards until `,(0,Z.jsx)(Y,{value:e.share.expiresAt}),`.`,e.share.passcode?` Send the passcode separately.`:``]}),(0,Z.jsx)(Ue,{value:e.url,testId:`share`})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v(async()=>{let e=await L.post(q(i,`/projects/${n.id}/shares`),{name:s,mode:l,expiresInDays:Number(f),includeChecks:g,...m?{passcode:m}:{}});C(e),await r?.()})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsx)(V,{label:`Name`,hint:`For you: who it is for. Guests do not see it.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:s,onChange:e=>c(e.target.value),maxLength:60,placeholder:`For the agency`,"data-sw-share-label":!0})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-[13px] font-medium text-fg`,children:`Guests can`}),(0,Z.jsx)(de,{label:`Guests can`,value:l,onChange:d,className:`w-full`,itemClassName:`h-11 px-3 lg:h-9`,options:[{id:`view`,label:`View`},{id:`comment`,label:`View and comment`}]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted`,children:l===`comment`?`Guests add comments and replies, signed "<name> (guest)". They cannot resolve, edit or delete, and their @mentions do nothing.`:`Guests see the boards and comments, and change nothing.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(oe,{size:`touch`,pressed:g,onPressedChange:_,"data-sw-share-checks":!0,children:`Include page checks`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:g?`Guests can read every retained check report in this project, including history, metrics and findings. Revoking this link ends access.`:`Check reports stay private. Turn this on only when guests should see metrics, findings and report history.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Expires after`,children:e=>(0,Z.jsxs)(j,{value:f,onValueChange:p,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-share-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:o.map(e=>(0,Z.jsx)(A,{value:String(e),children:Oe(e)},e))})]})}),(0,Z.jsx)(V,{label:`Passcode (optional)`,hint:`4 to 64 characters.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,type:`password`,value:m,onChange:e=>h(e.target.value),maxLength:64,autoComplete:`new-password`,"data-sw-share-passcode-input":!0})})]}),(0,Z.jsx)(H,{error:b}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:y,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:y||m&&m.length<4,className:`lg:h-10`,"data-sw-share-create":!0,children:[y?(0,Z.jsx)(w,{}):null,` Create link`]})]})]})})}function Gn({isAdmin:e}){let{workspaceId:t}=$();return(0,Z.jsx)(U,{tone:`info`,title:`Share links are off in this workspace`,action:e?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-8`,children:(0,Z.jsx)(P,{to:`/w/${t}/settings`,children:`Settings`})}):null,children:`An admin turns them on in Settings. Then you can share a project with people outside the workspace.`})}var Kn={active:`ok`,inactive:`warn`,revoked:`neutral`,expired:`neutral`},qn={inactive:`Inactive`,revoked:`Revoked`,expired:`Expired`},Jn=[`read`,`reply`,`status`,`resolve`],Yn=[[`never`,`No expiry`,null],[`30`,`30 days`,30],[`90`,`90 days`,90],[`365`,`1 year`,365]];function Xn(){let{workspaceId:e,data:t}=$(),n=I(q(e,`/tokens`)),[r,i]=(0,Q.useState)(`active`),[a,o]=(0,Q.useState)(!1),s=n.data?.tokens||[],c=s.filter(e=>r===`all`?!0:r===`active`?e.status===`active`:e.status!==`active`),l=s.filter(e=>e.status===`inactive`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`API tokens`,description:`Tokens let the CLI, CI and agents push captures and work on comments in one project.`,actions:(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>o(!0),className:`lg:h-9`,disabled:!t.projects.length,"data-sw-new-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New token`]})}),l.length?(0,Z.jsx)(U,{tone:`warn`,className:`mb-4`,title:`${l.length} ${l.length===1?`token stopped`:`tokens stopped`} working`,children:`A token works only while the person who made it is an admin or owner here. These were kept when their maker left or lost the admin role, and work again only if they come back as an admin. Revoke them, and make new ones where needed.`}):null,(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(de,{label:`Show tokens`,value:r,onChange:i,className:`w-full sm:inline-flex sm:w-auto`,itemClassName:`h-11 px-3 lg:h-8`,options:[{id:`active`,label:`Active`,count:s.filter(e=>e.status===`active`).length},{id:`inactive`,label:`Not working`,count:s.filter(e=>e.status!==`active`).length},{id:`all`,label:`All`,count:s.length}]})}),(0,Z.jsxs)(R,{children:[n.loading?(0,Z.jsx)(W,{}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,!n.loading&&!n.error?c.length?(0,Z.jsx)(Qn,{tokens:c,onChanged:n.reload,showProject:!0}):(0,Z.jsx)(_,{icon:qe,title:r===`active`?`No active tokens`:`Nothing here`,children:t.projects.length?`Make a token for a project to push captures or let an agent read comments.`:`Create a project first.`}):null]}),(0,Z.jsx)($n,{open:a,onClose:()=>o(!1),projects:t.projects,onCreated:n.reload})]})}function Zn({scopes:e}){return(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map(e=>(0,Z.jsx)(T,{tone:e===`push`?`warn`:`neutral`,className:`px-1.5 py-0.5 text-[11px]`,children:e},e))})}function Qn({tokens:e,onChanged:t,showProject:n=!1}){let{workspaceId:r}=$(),i=F(),[a,o]=(0,Q.useState)(null),s=N(),[c,l]=(0,Q.useState)(null),d=N(),p=c?.name.trim()||``,m=()=>d.run(async()=>{await L.patch(q(r,`/projects/${c.token.projectId}/tokens/${c.token.id}`),{name:p}),l(null),i(`Token renamed`),await t()});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-token-list":!0,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-5 md:grid-cols-[1.6fr_1fr_1fr_auto] md:items-center`,"data-sw-token":e.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsxs)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 font-mono text-[11px] text-muted`,children:[e.prefix,`…`]}),e.status===`active`?null:(0,Z.jsx)(T,{tone:Kn[e.status],className:`px-2 py-0.5 text-[11px]`,children:qn[e.status]||e.status})]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted`,children:[n?(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.projectName}):null,(0,Z.jsx)(Zn,{scopes:e.scopes})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`By `,e.createdBy?e.createdBy.displayName||`@${e.createdBy.handle}`:`unknown`,` `,e.createdBy?.left?(0,Z.jsxs)(T,{tone:`warn`,className:`ml-1 px-1.5 py-0.5 text-[10.5px]`,"data-sw-token-orphan":!0,children:[(0,Z.jsx)(ke,{size:10,"aria-hidden":`true`}),` Left the workspace`]}):e.status===`inactive`?(0,Z.jsxs)(T,{tone:`warn`,className:`ml-1 px-1.5 py-0.5 text-[10.5px]`,"data-sw-token-orphan":!0,children:[(0,Z.jsx)(ke,{size:10,"aria-hidden":`true`}),` No longer an admin`]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`Made `,(0,Z.jsx)(Y,{value:e.createdAt})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Last used `,(0,Z.jsx)(Y,{value:e.lastUsedAt,empty:`never`})]}),(0,Z.jsx)(`p`,{className:`mt-0.5`,children:e.expiresAt?(0,Z.jsx)(Y,{value:e.expiresAt,prefix:e.status===`expired`?`Expired `:`Expires `}):`No expiry`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 md:justify-end`,children:[e.status===`active`||e.status===`inactive`?(0,Z.jsxs)(u,{size:`touch`,onClick:()=>{d.setError(null),l({token:e,name:e.name})},className:`lg:h-8`,"data-sw-rename-token":e.name,children:[(0,Z.jsx)(_t,{size:13,"aria-hidden":`true`}),` Rename`]}):null,e.status===`active`||e.status===`inactive`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>o(e),className:`lg:h-8`,"data-sw-revoke-token":e.name,children:`Revoke`}):null]})]},e.id))}),(0,Z.jsx)(z,{open:!!a,onClose:()=>o(null),title:`Revoke "${a?.name}"?`,confirmLabel:`Revoke token`,tone:`danger`,busy:s.busy,error:s.error,onConfirm:()=>s.run(async()=>{await L.delete(q(r,`/projects/${a.projectId}/tokens/${a.id}`)),o(null),i(`Token revoked`),await t()}),children:(0,Z.jsx)(`p`,{children:`Anything using it (CI, an agent, a teammate's machine) stops working at once. This cannot be undone.`})}),(0,Z.jsx)(f,{open:!!c,onClose:()=>d.busy?null:l(null),title:`Rename token`,description:`An agent that uses this token signs its replies with this name.`,wrapDescription:!0,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:()=>l(null),disabled:d.busy,children:`Cancel`}),(0,Z.jsx)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:m,disabled:d.busy||!p||p===c?.token.name,"data-sw-rename-token-save":!0,children:d.busy?`Saving...`:`Save`})]}),children:(0,Z.jsxs)(`form`,{className:`space-y-2 p-5`,onSubmit:e=>{e.preventDefault(),p&&p!==c?.token.name&&!d.busy&&m()},children:[(0,Z.jsx)(`label`,{htmlFor:`sw-rename-token`,className:`block text-xs font-medium text-fg`,children:`Name`}),(0,Z.jsx)(M,{id:`sw-rename-token`,size:`touch`,className:`lg:h-9`,value:c?.name||``,maxLength:60,onChange:e=>l(t=>t&&{...t,name:e.target.value}),"data-sw-rename-token-input":!0}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`What it already wrote keeps the old name. The token itself, its scopes and its expiry do not change.`}),d.error?(0,Z.jsx)(`p`,{className:`text-sm text-bad`,role:`alert`,children:d.error}):null]})})]})}function $n({open:e,onClose:t,projects:n,projectId:r=null,onCreated:i,defaultScopes:a=Jn}){let{workspaceId:o}=$(),[s,c]=(0,Q.useState)(r||``),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(a),[m,h]=(0,Q.useState)(`90`),{run:g,busy:_,error:v,setError:y}=N(),[b,x]=he(e,()=>{c(r||n[0]?.id||``),d(``),p(a),h(`90`),y(null)}),S=e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),C=(0,Q.useMemo)(()=>n.find(e=>e.id===s)?.name,[n,s]);return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:_,result:b,title:`New API token`,resultTitle:`Token created`,doneProps:{"data-sw-token-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{tone:`warn`,title:`Copy it now: it is shown once`,children:`Store it as SHAPEWALL_TOKEN in an environment variable or your CI secrets, never in a repository.`}),(0,Z.jsx)(Ue,{value:e.token,testId:`token`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{className:`mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted`,children:[(0,Z.jsx)(it,{size:13,"aria-hidden":`true`}),` Push from your project folder (this command includes the token)`]}),(0,Z.jsx)(Ue,{value:`SHAPEWALL_TOKEN=${e.token} shapewall push --remote ${Le()}`,testId:`token-command`}),(0,Z.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`On your own machine, `,(0,Z.jsxs)(`code`,{className:`font-mono text-fg`,children:[`shapewall login --remote `,Le()]}),` makes and stores a token for you instead.`]})]})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g(async()=>{let e=Yn.find(([e])=>e===m)[2],t=await L.post(q(o,`/projects/${s}/tokens`),{name:l,scopes:f,...e?{expiresInDays:e}:{}});x(t),await i?.()})},className:`space-y-4 px-5 py-4`,children:[r?null:(0,Z.jsx)(V,{label:`Project`,children:e=>(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-token-project":!0,children:(0,Z.jsx)(O,{placeholder:`Pick a project`})}),(0,Z.jsx)(E,{children:n.map(e=>(0,Z.jsx)(A,{value:e.id,children:e.name},e.id))})]})}),(0,Z.jsx)(V,{label:`Name`,hint:`Where it is used, like GitHub Actions or Ada's agent.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:l,onChange:e=>d(e.target.value),maxLength:60,placeholder:`CI`,"data-sw-token-name":!0})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsxs)(`legend`,{className:`mb-1.5 block text-[13px] font-medium text-fg`,children:[`What it can do`,C?` in ${C}`:``]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:We.map(([e,t,n])=>(0,Z.jsxs)(oe,{pressed:f.includes(e),onPressedChange:()=>S(e),size:`touch`,className:`h-auto min-h-11 w-full flex-col items-start justify-center gap-0 px-3 py-2 text-left whitespace-normal`,"data-sw-scope":e,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-muted`,children:n})]},e))})]}),(0,Z.jsx)(V,{label:`Expires`,children:e=>(0,Z.jsxs)(j,{value:m,onValueChange:h,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full sm:w-56`,...e,"data-sw-token-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Yn.map(([e,t])=>(0,Z.jsx)(A,{value:e,children:t},e))})]})}),(0,Z.jsx)(H,{error:v}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:_,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:_||!l.trim()||!f.length||!s,className:`lg:h-10`,"data-sw-token-create":!0,children:[_?(0,Z.jsx)(w,{}):null,` Create token`]})]})]})})}var er=[[`dailyClaims`,`Runs per day (UTC)`,1e4,50],[`maxOpenClaims`,`Runs in progress at once`,100,3],[`dailyTurns`,`Chat turns per day (UTC)`,1e5,200]];function tr({workspaceId:e,projectId:t}){let n=q(e,`/projects/${t}/agent`),r=I(n);return(0,Z.jsxs)(R,{"data-sw-agent-policy":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agent policy`,description:`Who can send comments to an agent in this project, and how much the agent may run.`}),r.loading?(0,Z.jsx)(W,{}):r.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:r.error,onRetry:r.reload})}):r.data?(0,Z.jsx)(nr,{policy:r.data.policy,url:n,onSaved:r.reload},JSON.stringify(r.data.policy)):null]})}function nr({policy:e,url:t,onSaved:n}){let r=F(),[i,a]=(0,Q.useState)(e),[o,s]=(0,Q.useState)(e.trustedHandles.join(`, `)),[l,f]=(0,Q.useState)(()=>Object.fromEntries(er.map(([t,,,n])=>[t,String(e[t]??n)]))),[p,m]=(0,Q.useState)(JSON.stringify(e.boards||{},null,2)),h=N(),g=(e,t)=>a({...i,[e]:t}),_=(e,t)=>{let n=l[e].trim(),r=Number(n);return n!==``&&Number.isInteger(r)&&r>=0&&r<=t?null:`A whole number from 0 to ${t}.`},v=null;try{let e=JSON.parse(p);(!e||typeof e!=`object`||Array.isArray(e))&&(v=`This must be a JSON object, such as {}.`)}catch{v=`This is not valid JSON.`}let y=!!v||er.some(([e,,t])=>_(e,t));return(0,Z.jsxs)(`form`,{className:`space-y-4 px-4 py-4 sm:px-5`,onSubmit:e=>{e.preventDefault(),y||h.run(async()=>{await L.put(t,{...i,...Object.fromEntries(er.map(([e])=>[e,Number(l[e])])),trustedHandles:o.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),boards:JSON.parse(p)}),r(`Agent policy saved`),await n()})},noValidate:!0,children:[(0,Z.jsx)(V,{label:`Trusted handles (comma separated)`,hint:`People whose comments go to the agent, besides the roles below.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:o,onChange:e=>s(e.target.value),autoCapitalize:`none`,spellCheck:!1,placeholder:`ada, sam`})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-ui font-medium text-fg`,children:`Trusted roles`}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`member`,`admin`,`owner`].map(e=>(0,Z.jsx)(Be,{checked:i.trustedRoles.includes(e),onChange:t=>g(`trustedRoles`,t?[...i.trustedRoles,e]:i.trustedRoles.filter(t=>t!==e)),children:B[e]||e},e))})]}),(0,Z.jsx)(`div`,{className:`grid items-start gap-4 sm:grid-cols-2`,children:er.map(([e,t,n])=>(0,Z.jsx)(V,{label:t,hint:e===`dailyTurns`?`0 stops chat with connected agents.`:`0 stops new runs.`,error:_(e,n),children:t=>(0,Z.jsx)(M,{...t,size:`touch`,type:`number`,inputMode:`numeric`,min:`0`,max:n,value:l[e],onChange:t=>f({...l,[e]:t.target.value})})},e))}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Be,{checked:i.onlyMentions,onChange:e=>g(`onlyMentions`,e),children:`Only comments that mention @agent`}),(0,Z.jsx)(Be,{checked:i.approveNonAdmin,onChange:e=>g(`approveNonAdmin`,e),children:`An admin approves runs that other people ask for`})]}),(0,Z.jsxs)(c,{defaultOpen:Object.keys(e.boards||{}).length>0,children:[(0,Z.jsx)(ce,{className:`-mx-2 w-auto`,"data-sw-agent-overrides-toggle":!0,children:`Advanced: different rules for one board`}),(0,Z.jsx)(d,{children:(0,Z.jsx)(`div`,{className:`pt-2`,children:(0,Z.jsx)(V,{label:`Per-board rules (JSON)`,hint:`Keyed by board id. Leave it as {} unless one board needs different rules from the project.`,error:v,children:e=>(0,Z.jsx)(le,{...e,size:`touch`,className:`font-mono lg:text-sm`,rows:4,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})})})})]}),(0,Z.jsx)(U,{children:`The agent never acts on guest comments or its own comments. Editing a comment clears its approval.`}),(0,Z.jsx)(H,{error:h.error}),(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,className:`lg:h-9`,disabled:h.busy||y,children:[h.busy?(0,Z.jsx)(w,{}):null,` Save agent policy`]})})]})}var rr=`https://shapewall.com/docs/hosted#agents-on-a-hosted-board`,ir={online:`Online`,busy:`Working`,offline:`Offline`,revoked:`Revoked`},ar={online:`ok`,busy:`accent`,offline:`neutral`,revoked:`neutral`},or={watcher:`Watcher (shapewall watch)`,claude:`Claude Code`,codex:`Codex`,goose:`goose`,gemini:`Gemini CLI`,custom:`Another program`},sr=[[`owner`,`Only the person who connected it`,`The default for a new agent.`],[`members`,`Named members`,`The person who connected it, and the people you choose.`],[`trusted`,`Everyone this project's agent policy trusts`,`The team case: whoever may send work to an agent here may use this one.`]],cr=[`read`,`reply`,`status`,`claim`],lr=e=>e?.approval?.mode||`none`,ur={none:`reads and answers only (no edits, no commands)`,ask:`makes fixes on a branch, each edit allowed by a person`,auto:`makes fixes on a branch, allowed without asking`},dr={none:`Reads and answers`,ask:`Edits on a branch, asking every time`,auto:`Edits on a branch, allowed without asking`},fr=e=>[e.includes(`edits`)?`edits`:null,e.includes(`commands`)?`the listed commands`:null].filter(Boolean).join(` and `),pr=e=>[`edits`,`commands`].filter(t=>e?.approval?.rules?.[t]===`auto`),mr=e=>e?.approval?.machine?.approvals===`owner`?`Only ${e.createdBy?yr(e.createdBy):`the person who connected it`} answers`:`${B[e?.approval?.answerRole||`admin`]}s and up answer`,hr=`shapewall agent connect --approvals owner --auto edits`;function gr(e){return!e||e.approval.autoAvailable?null:e.link?.connected?e.approval.machine.approvals===`none`?`${e.name}'s machine takes no approvals from the board, so there is nothing to allow. This is switched on on the agent's machine, never from here.`:`${e.name}'s machine did not say anything may go without asking. This is switched on on the agent's machine, never from here.`:`This agent takes comments on its own and asks before each command. Nothing here can go without asking.`}function _r({agent:e}){let t=e.approval.machine,n=[[`Approvals from the board`,t.approvals===`none`?`None. It reads and answers only.`:t.approvals===`owner`?`Only ${e.createdBy?yr(e.createdBy):`the person who connected it`} may answer.`:`Admins of this project may answer.`,`approvals`,t.approvals],[`Commands it may ask to run`,t.commands.length?null:t.approvals===`none`?`None.`:`None. It only asks to edit files.`,`commands`,String(t.commands.length)],[`May go without asking`,t.auto.length?`${fr(t.auto).replace(/^./,e=>e.toUpperCase())}, when the rule below says so.`:`Nothing.`,`auto`,t.auto.join(`,`)||`none`]];return(0,Z.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-machine":t.approvals,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold text-fg`,children:[(0,Z.jsx)(It,{size:13,"aria-hidden":`true`}),` Set on the agent's machine`]}),(0,Z.jsx)(`dl`,{className:`mt-2 space-y-2 text-xs`,children:n.map(([e,n,r,i])=>(0,Z.jsxs)(`div`,{className:`grid gap-x-3 gap-y-0.5 sm:grid-cols-[11rem_1fr]`,"data-sw-agent-machine-fact":r,"data-value":i,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Z.jsxs)(`dd`,{className:`min-w-0 text-fg`,children:[n,r===`commands`&&t.commands.length?(0,Z.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:t.commands.map(e=>(0,Z.jsx)(`li`,{className:`max-w-full`,children:(0,Z.jsx)(`code`,{className:`block truncate rounded border border-line bg-surface px-1.5 py-0.5 font-mono text-[11px]`,children:e})},e))}):null]})]},r))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`These are read from the machine each time it connects. Change them there with`,` `,(0,Z.jsx)(`code`,{className:`font-mono`,children:`shapewall agent connect`}),`; nothing on this page can widen them.`]})]})}function vr({agent:e}){let t=e.link;return t?.connected?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,"data-sw-agent-link":t.connectedAt?`open`:`closed`,children:[(0,Z.jsx)(`span`,{className:`text-fg`,children:`Connected agent.`}),` `,t.chats?`Chats on the board`:`No chat`,`, `,ur[lr(e)],t.connectedAt?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· connected since `,(0,Z.jsx)(`time`,{dateTime:t.connectedAt,children:Ie(t.connectedAt)})]}):` · link closed`,t.version?` · Shapewall ${t.version}`:``,t.policy?.audience===`owner`?` · its machine takes questions from its connector only`:``]}):null}var yr=e=>e?.displayName||(e?.handle?`@${e.handle}`:`someone who left`);function br({agent:e}){return(0,Z.jsx)(T,{tone:ar[e.state]||`neutral`,className:`px-2 py-0.5 text-[11px]`,"data-sw-agent-state":e.state,children:ir[e.state]||e.state})}function xr({agent:e}){return e.state===`online`||e.state===`busy`?(0,Z.jsx)(`span`,{children:`Listening now`}):e.lastSeenAt?(0,Z.jsx)(Y,{value:e.lastSeenAt,prefix:`Last seen `}):(0,Z.jsx)(`span`,{children:`Never connected`})}function Sr({agent:e,size:t=`lg`}){return(0,Z.jsx)(ee,{label:e.name,icon:e.icon,tint:e.tint,logo:e.logo,size:t})}function Cr(){let{workspaceId:e,data:t}=$(),n=I(q(e,`/agents`)),r=(n.data?.agents||[]).filter(e=>e.state!==`revoked`),i=new Set(r.map(e=>e.projectId)),a=t.projects.filter(e=>!i.has(e.id));return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Agents`,description:`Every agent in this workspace, the project each one serves and who may send it work.`}),(0,Z.jsxs)(R,{"data-sw-agents-overview":!0,children:[n.loading?(0,Z.jsx)(W,{}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,n.data&&!n.error?r.length?(0,Z.jsxs)(`div`,{role:`table`,"aria-label":`Agents in this workspace`,children:[(0,Z.jsxs)(`div`,{role:`row`,className:`hidden gap-3 border-b border-line px-5 py-2 text-xs font-medium text-muted md:grid md:grid-cols-[1.5fr_1fr_1fr_1.4fr_1fr_auto]`,children:[(0,Z.jsx)(`span`,{role:`columnheader`,children:`Agent`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Project`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`State`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Who may send it work`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Connected by`}),(0,Z.jsx)(`span`,{role:`columnheader`,className:`w-20 text-right`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Manage`})})]}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:r.map(t=>(0,Z.jsxs)(`li`,{role:`row`,className:`grid gap-2 px-4 py-3 text-sm sm:px-5 md:grid-cols-[1.5fr_1fr_1fr_1.4fr_1fr_auto] md:items-center md:gap-3`,"data-sw-overview-agent":t.name,"data-sw-overview-project":t.projectName,children:[(0,Z.jsxs)(`div`,{role:`cell`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(Sr,{agent:t,size:`md`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:t.name}),t.isDefault?(0,Z.jsx)(T,{tone:`neutral`,className:`shrink-0 px-1.5 py-0.5 text-[10.5px]`,children:`Default`}):null]}),(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted`,"data-sw-overview-kind":t.kind,children:[or[t.kind]||t.kind,t.machine?` on ${t.machine}`:``,t.link?.connected&&t.link.chats?` · chats`:``]})]})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 truncate text-fg`,children:[(0,Z.jsx)(`span`,{className:`mr-1 text-xs text-muted md:hidden`,children:`Project:`}),t.projectName]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted md:block`,children:[(0,Z.jsx)(br,{agent:t}),(0,Z.jsx)(`p`,{className:`md:mt-0.5`,children:t.link?.connectedAt?(0,Z.jsxs)(`span`,{"data-sw-overview-connected":!0,children:[`since `,(0,Z.jsx)(`time`,{dateTime:t.link.connectedAt,children:Ie(t.link.connectedAt)})]}):(0,Z.jsx)(xr,{agent:t})})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 text-xs text-muted`,"data-sw-overview-audience":t.audience.kind,children:[(0,Z.jsx)(`span`,{className:`mr-1 md:hidden`,children:`Takes work from:`}),(0,Z.jsx)(`span`,{className:`text-fg`,children:t.audience.text})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 truncate text-xs text-muted`,children:[(0,Z.jsx)(`span`,{className:`mr-1 md:hidden`,children:`Connected by`}),yr(t.createdBy)]}),(0,Z.jsx)(`div`,{role:`cell`,className:`md:w-20 md:text-right`,children:(0,Z.jsx)(P,{to:`/w/${e}/agents/${t.projectId}`,className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,"aria-label":`Manage ${t.name} in ${t.projectName}`,"data-sw-overview-manage":t.name,children:`Manage`})})]},t.id))})]}):(0,Z.jsx)(_,{icon:s,title:`No agents yet`,children:t.projects.length?`Open a project below to connect a machine that has its code.`:`Create a project first, then connect a machine that has its code.`}):null]}),n.data&&a.length?(0,Z.jsxs)(R,{className:`mt-5`,"data-sw-agents-without":!0,children:[(0,Z.jsx)(G,{icon:Xe,title:`Projects without an agent`,description:`Comments sent to an agent in these projects wait until one is connected.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:a.map(t=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm sm:px-5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:t.name}),(0,Z.jsx)(P,{to:`/w/${e}/agents/${t.id}`,className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,"data-sw-overview-connect":t.name,children:`Connect an agent`})]},t.id))})]}):null]})}function wr({projectId:e}){let{workspaceId:t,data:n,role:r}=$(),i=n.projects.find(t=>t.id===e),a=q(t,`/projects/${e}/agents`),o=I(i?a:null),c=F(),[l,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=N(),S=N();if((0,Q.useEffect)(()=>{let e=window.setInterval(()=>{document.visibilityState===`visible`&&o.reload()},2e4);return()=>window.clearInterval(e)},[o.reload]),!i)return(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Project not found`}),(0,Z.jsx)(P,{to:`/w/${t}/agents`,className:`mt-3 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to agents`})]});let C=o.data?.agents||[],w=C.filter(e=>e.state!==`revoked`),E=C.filter(e=>e.state===`revoked`),ee=n=>x.run(async()=>{await L.put(q(t,`/projects/${e}/default-agent`),{agentId:n?n.id:null}),c(n?`${n.name} is the default agent`:`No default agent: any agent takes new comments`),await o.reload()}),D=n=>q(t,`/projects/${e}/agents/${n.id}`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/w/${t}/agents`,className:`mb-3 inline-flex h-11 items-center gap-1.5 rounded-md text-sm text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent lg:h-8`,children:[(0,Z.jsx)(wt,{size:15,"aria-hidden":`true`}),` All agents`]}),(0,Z.jsx)(we,{title:`Agents of ${i.name}`,description:`The coding agents of this project: the ones members chat with on the board, and the ones that pick up comments. Each runs where the code is; this server never runs an agent.`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,className:`lg:h-9`,children:(0,Z.jsx)(P,{to:`/w/${t}/projects/${e}`,children:`Project page`})})}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[(0,Z.jsxs)(R,{"data-sw-project-agents":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agents`,description:`The default agent is the one Send to agent names, and where a trusted member's new comment goes. Without one, any agent takes it.`}),o.loading?(0,Z.jsx)(W,{}):null,o.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:o.error,onRetry:o.reload})}):null,o.data&&!o.error?w.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:w.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-3 px-4 py-4 sm:px-5`,"data-sw-agent-row":e.name,"data-sw-agent-id":e.id,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Z.jsx)(Sr,{agent:e}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem]`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,Z.jsx)(br,{agent:e}),e.isDefault?(0,Z.jsxs)(T,{tone:`accent`,className:`px-2 py-0.5 text-[11px]`,"data-sw-agent-default":!0,children:[(0,Z.jsx)(sn,{size:10,"aria-hidden":`true`}),` Default`]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[or[e.kind]||e.kind,e.machine?` on ${e.machine}`:``,` · `,(0,Z.jsx)(xr,{agent:e}),` · connected by`,` `,yr(e.createdBy)]}),(0,Z.jsx)(vr,{agent:e}),e.counts.working||e.counts.queued?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,"data-sw-agent-counts":!0,children:[e.counts.working?`working on ${e.counts.working}`:null,e.counts.queued?`${e.counts.queued} waiting for it`:null].filter(Boolean).join(`, `)}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsxs)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>d(e),"data-sw-agent-edit":e.name,children:[(0,Z.jsx)(_t,{size:13,"aria-hidden":`true`}),` Edit`]}),e.isDefault?(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,disabled:x.busy,onClick:()=>ee(null),"data-sw-agent-undefault":e.name,children:`Not the default`}):(0,Z.jsxs)(u,{size:`touch`,className:`lg:h-8`,disabled:x.busy,onClick:()=>ee(e),"data-sw-agent-make-default":e.name,children:[(0,Z.jsx)(sn,{size:13,"aria-hidden":`true`}),` Make default`]}),(0,Z.jsx)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,onClick:()=>{S.setError(null),v(e)},"data-sw-agent-revoke":e.name,children:`Revoke`})]})]}),(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-audience":e.audience.kind,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,Z.jsx)(hn,{size:13,"aria-hidden":`true`}),` `,e.link?.connected?`Who may use it`:`Who may send it work`]}),(0,Z.jsxs)(`dd`,{className:`mt-1 text-muted`,children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[e.audience.text,`.`]}),` `,e.audience.inherited?`Kept from before 0.4.0, when the agent policy alone decided, so nothing changed on upgrade. New agents start with only the person who connected them.`:e.audience.kind===`trusted`?``:`They must also be trusted by this project's agent policy (on the project page).`]}),(0,Z.jsx)(`dd`,{className:`mt-2`,children:(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>p(e),"data-sw-agent-audience-edit":e.name,children:`Change`})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-approval":e.approval.effectiveRule,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,Z.jsx)(Te,{size:13,"aria-hidden":`true`}),` Approvals`]}),(0,Z.jsx)(`dd`,{className:`mt-1 text-muted`,"data-sw-agent-mode":e.link?.connected?lr(e):`watch`,children:e.link?.connected?lr(e)===`none`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.none,`.`]}),` Nothing to approve: its machine takes no edits or commands from the board. That is switched on on the machine itself.`]}):lr(e)===`auto`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.auto,`.`]}),` Applies to `,fr(pr(e)),`. Anything else waits for an answer on the board.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.ask,`.`]}),` `,mr(e),`.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-fg`,children:`Ask every time.`}),` It asks before each command it runs for a comment.`,` `,B[e.approval.answerRole],`s and up answer; `,B[e.approval.changeRole].toLowerCase(),`s and up change this rule.`]})}),(0,Z.jsx)(`dd`,{className:`mt-2`,children:(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>h(e),"data-sw-agent-approval-edit":e.name,children:`Change`})})]})]})]},e.id))}):(0,Z.jsx)(_,{icon:s,title:`No agent is connected to this project`,children:`Comments sent to an agent wait here until one is. Connect one below.`}):null,(0,Z.jsx)(`div`,{className:`px-4 pb-3 sm:px-5`,children:(0,Z.jsx)(H,{error:x.error})})]}),(0,Z.jsx)(Tr,{project:i,onNewToken:()=>b(!0)}),E.length?(0,Z.jsxs)(R,{"data-sw-agents-revoked":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Revoked`,description:`These no longer work. Their replies on threads keep their names.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:E.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(Sr,{agent:e,size:`md`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-xs`,children:(0,Z.jsx)(xr,{agent:e})})]},e.id))})]}):null]}),(0,Z.jsx)(Er,{agent:l,kinds:o.data?.options?.kinds||Object.keys(or),url:l?D(l):null,onClose:()=>d(null),onSaved:async()=>{c(`Agent saved`),await o.reload()}}),(0,Z.jsx)(Dr,{agent:f,members:o.data?.members||[],url:f?`${D(f)}/audience`:null,onClose:()=>p(null),onSaved:async()=>{c(`Audience saved`),await o.reload()}}),(0,Z.jsx)(kr,{agent:m,role:r,url:m?`${D(m)}/approval`:null,onClose:()=>h(null),onSaved:async()=>{c(`Approval settings saved`),await o.reload()}}),(0,Z.jsx)(z,{open:!!g,onClose:()=>v(null),title:`Revoke ${g?.name}?`,confirmLabel:`Revoke agent`,tone:`danger`,busy:S.busy,error:S.error,onConfirm:()=>S.run(async()=>{await L.delete(D(g)),v(null),c(`Agent revoked`),await o.reload()}),children:(0,Z.jsx)(`p`,{children:`Its token stops working at once, so the machine that uses it stops picking up comments. What it was working on and what waited for it go to any agent. This cannot be undone: connect it again with a new token.`})}),(0,Z.jsx)($n,{open:y,onClose:()=>b(!1),projects:n.projects,projectId:e,defaultScopes:cr,onCreated:o.reload})]})}function Tr({project:e,onNewToken:t}){let n=Le(),r=`flex gap-3`,i=`mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-surface-2 text-[11px] font-semibold text-fg`;return(0,Z.jsxs)(R,{"data-sw-connect-agent":!0,children:[(0,Z.jsx)(G,{icon:Xe,title:`Connect an agent`,description:`On a machine that has the code of ${e.name}. The agent runs there; this server only passes messages.`,actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:t,"data-sw-connect-agent-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New agent token`]})}),(0,Z.jsxs)(`div`,{className:`space-y-2 border-b border-line px-4 py-4 text-sm text-muted sm:px-5`,"data-sw-connect-agent-chat":!0,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:`Chat with your coding agent on the board`}),(0,Z.jsxs)(`p`,{children:[`Run this in the project's folder, on the machine that has Claude Code, Codex or goose. It shows a code; approve it on`,` `,(0,Z.jsx)(P,{to:`/device`,className:`font-medium text-accent underline-offset-2 hover:underline`,children:`the approval page`}),`, where you name the agent and choose who may use it.`]}),(0,Z.jsx)(Ue,{value:`shapewall agent connect --remote ${n}`,testId:`connect-agent`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`Members then chat with it from the board's Agents panel. It reads the project and answers; it does not change files or run commands. Leave it running (or run it as a service); Ctrl+C disconnects it.`})]}),(0,Z.jsx)(`p`,{className:`px-4 pt-4 text-sm font-medium text-fg sm:px-5`,children:`An agent that fixes comments`}),(0,Z.jsxs)(`ol`,{className:`space-y-4 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`1`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`Sign the machine in, in the project's folder.`}),(0,Z.jsx)(Ue,{value:`shapewall login --remote ${n}`,testId:`connect-login`}),(0,Z.jsxs)(`p`,{className:`text-xs`,children:[`Approve the code it shows, choose this project and tick `,(0,Z.jsx)(`strong`,{className:`font-medium text-fg`,children:`Take agent work`}),`. Or make a token here with New agent token and set it as SHAPEWALL_TOKEN on that machine.`]})]})]}),(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`2`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`Start watching, with the command that runs your coding agent.`}),(0,Z.jsx)(Ue,{value:`shapewall watch --remote ${n} --exec "<your agent command>"`,testId:`connect-watch`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`It runs your command once for each comment sent to it. Leave it running; Ctrl+C stops it.`})]})]}),(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`3`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`It appears above as online.`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`Give it a name and an icon, and choose who may send it work: a new agent only takes comments from the person who connected it.`})]})]})]}),(0,Z.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-xs text-muted sm:px-5`,children:[(0,Z.jsxs)(`a`,{href:rr,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-accent underline-offset-2 hover:underline`,"data-sw-connect-agent-docs":!0,children:[`Agents on a hosted board `,(0,Z.jsx)(ge,{size:12,"aria-hidden":`true`})]}),` `,`has recipes for Claude Code, Codex and goose, and how to run it as a service.`]})]})}function Er({agent:e,kinds:t,url:n,onClose:r,onSaved:i}){let a=(0,Q.useId)(),[o,s]=(0,Q.useState)({name:``,icon:null,tint:null,png:null}),[c,l]=(0,Q.useState)(`watcher`),d=N();(0,Q.useEffect)(()=>{e&&(s({name:e.name,icon:e.icon||null,tint:e.tint||null,png:null}),l(e.kind),d.setError(null))},[e]);let p=o.name.trim(),m=gt(o.name)||(e&&!p?`Give it a name.`:null),h={claude:`claude`,codex:`openai`,goose:`goose`,gemini:`gemini`}[c]||null,g=e?{...p===e.name?{}:{name:p},...o.icon===(e.icon||null)?{}:{icon:o.icon},...o.tint===(e.tint||null)?{}:{tint:o.tint},...c===e.kind?{}:{kind:c}}:{},_=Object.keys(g).length>0;return(0,Z.jsx)(f,{open:!!e,onClose:()=>d.busy?null:r(),title:`Edit agent`,description:`How it is shown on boards. Its replies are signed with this name from now on; what it already wrote keeps the old one.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:d.busy,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:()=>d.run(async()=>{await L.patch(n,g),await i(),r()}),disabled:d.busy||!_||!!m,"data-sw-agent-edit-save":!0,children:[d.busy?(0,Z.jsx)(w,{}):null,` Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-edit-dialog":!0,children:[(0,Z.jsx)(dt,{id:`${a}-name`,value:o,onChange:s,touch:!0,problem:m,disabled:d.busy,hint:`Shown on boards, in Send to agent and on its replies.`}),(0,Z.jsx)(V,{label:`What runs behind it`,hint:`Only changes the default icon: a known program shows its mark.`,children:e=>(0,Z.jsxs)(j,{value:c,onValueChange:l,disabled:d.busy,children:[(0,Z.jsx)(k,{...e,size:`touch`,className:`w-full lg:h-9`,"data-sw-agent-kind":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:t.map(e=>(0,Z.jsx)(A,{value:e,"data-sw-agent-kind-option":e,children:or[e]||e},e))})]})}),(0,Z.jsx)(at,{value:o,onChange:s,label:p||e?.name||`Agent`,logo:h,upload:!1,disabled:d.busy}),(0,Z.jsx)(H,{error:d.error})]})})}function Dr({agent:e,members:t,url:n,onClose:r,onSaved:i}){let[a,o]=(0,Q.useState)(`owner`),[s,c]=(0,Q.useState)([]),l=N();(0,Q.useEffect)(()=>{e&&(o(e.audience.kind),c(e.audience.users.map(e=>e.userId)),l.setError(null))},[e]);let d=e?.createdBy?.userId||null,p=t.filter(e=>e.userId!==d),m=e=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,Z.jsx)(f,{open:!!e,onClose:()=>l.busy?null:r(),title:`Who may send work to ${e?.name||`this agent`}`,description:`Work sent to an agent runs on the machine of the person who connected it.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:l.busy,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:()=>l.run(async()=>{await L.put(n,{audience:a,users:a===`members`?s:[]}),await i(),r()}),disabled:l.busy,"data-sw-agent-audience-save":!0,children:[l.busy?(0,Z.jsx)(w,{}):null,` Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-audience-dialog":!0,children:[(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Audience`,className:`space-y-2`,children:sr.map(([t,n,r])=>(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a===t,onClick:()=>o(t),disabled:l.busy,className:`flex min-h-11 w-full items-start gap-3 rounded-lg border px-3 py-2.5 text-left text-sm outline-none focus-visible:outline-2 focus-visible:outline-accent ${a===t?`border-accent/50 bg-accent/10`:`border-line hover:bg-surface-2`}`,"data-sw-agent-audience-option":t,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${a===t?`border-accent bg-accent text-accent-fg`:`border-line bg-surface`}`,"aria-hidden":`true`,children:a===t?(0,Z.jsx)(h,{size:11}):null}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-fg`,children:t===`owner`&&e?.createdBy?`Only ${yr(e.createdBy)}`:n}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:r})]})]},t))}),a===`members`?(0,Z.jsxs)(`fieldset`,{"data-sw-agent-audience-members":!0,children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-ui font-medium text-fg`,children:`Members`}),p.length?(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:p.map(e=>(0,Z.jsx)(Be,{checked:s.includes(e.userId),onChange:()=>m(e.userId),children:(0,Z.jsxs)(`span`,{className:`min-w-0`,"data-sw-agent-audience-member":e.handle,children:[(0,Z.jsx)(`span`,{className:`block truncate`,children:e.displayName}),(0,Z.jsxs)(`span`,{className:`block truncate text-xs text-muted`,children:[`@`,e.handle,` · `,B[e.role],e.trusted?``:` · not trusted by the agent policy`]})]})},e.userId))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Nobody else in this workspace can comment yet. Invite a member first.`})]}):null,(0,Z.jsx)(U,{children:`An audience only narrows who may use this agent. The project's agent policy still decides who may send work to an agent at all, and the machine that runs the agent has the last word. It also decides whose replies the agent reads. A comment the agent is already working on stays with it until it is done.`}),(0,Z.jsx)(H,{error:l.error})]})})}function Or({value:e,checked:t,disabled:n,onChoose:r,title:a,children:o,...s}){return(0,Z.jsxs)(`div`,{role:`radio`,"aria-checked":t?`true`:`false`,"aria-disabled":n?`true`:void 0,tabIndex:n?-1:0,onClick:n?void 0:()=>r(e),onKeyDown:n?void 0:t=>{(t.key===` `||t.key===`Enter`)&&(t.preventDefault(),r(e))},className:i(`flex items-start gap-3 rounded-lg border px-3 py-2.5 text-sm outline-none focus-visible:outline-2 focus-visible:outline-accent`,t?`border-accent/50 bg-accent/10`:`border-line`,n?t?``:`bg-surface-2/40`:`cursor-pointer hover:border-accent/50`),"data-sw-agent-approval-option":e,...s,children:[t?(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-accent bg-accent text-accent-fg`,children:(0,Z.jsx)(h,{size:11,"aria-hidden":`true`})}):(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 rounded-full border border-line bg-surface`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:i(`block font-medium`,n&&!t?`text-muted`:`text-fg`),children:a}),o]})]})}function kr({agent:e,role:t,url:n,onClose:r,onSaved:i}){let[a,o]=(0,Q.useState)(`ask`),[s,c]=(0,Q.useState)(`admin`),[l,d]=(0,Q.useState)(`admin`),p=N();(0,Q.useEffect)(()=>{e&&(o(e.approval.effectiveRule),c(e.approval.changeRole),d(e.approval.answerRole),p.setError(null))},[e]);let m=bn(t,e?{approvalChangeRole:e.approval.changeRole,approvalAnswerRole:e.approval.answerRole}:null),h=xn(t),g=gr(e),_=!!e?.link?.connected,v=lr(e),y=!m||p.busy,b=e?a!==e.approval.effectiveRule:!1,x=e?b||s!==e.approval.changeRole||l!==e.approval.answerRole:!1,S=()=>p.run(async()=>{await L.put(n,{...b?{rule:a}:{},...s===e.approval.changeRole?{}:{changeRole:s},...l===e.approval.answerRole?{}:{answerRole:l}}),await i(),r()}),C=(e,t,n)=>r=>(0,Z.jsxs)(j,{value:e,onValueChange:t,disabled:!h||p.busy,children:[(0,Z.jsx)(k,{...r,size:`touch`,className:`w-full lg:h-9`,"data-sw-agent-approval-role":n,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:`admin`,children:`Admins and owners`}),(0,Z.jsx)(A,{value:`owner`,children:`Owners only`})]})]}),T=e?fr(e.approval.machine.auto):``;return(0,Z.jsx)(f,{open:!!e,onClose:()=>p.busy?null:r(),title:`Approvals for ${e?.name||`this agent`}`,description:`Whether what the agent asks to do waits for a person, and who decides.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:p.busy,children:h||m?`Cancel`:`Close`}),h||m?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:S,disabled:p.busy||!x,"data-sw-agent-approval-save":!0,children:[p.busy?(0,Z.jsx)(w,{}):null,` Save`]}):null]}),children:e?(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-approval-dialog":!0,children:[(0,Z.jsxs)(`p`,{className:`flex items-start gap-2 text-sm`,"data-sw-agent-approval-mode":_?v:`watch`,children:[(0,Z.jsx)(Te,{size:15,className:`mt-0.5 shrink-0 text-muted`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:`Now: `}),(0,Z.jsxs)(`span`,{className:`font-medium text-fg`,children:[_?dr[v]:`Asks before each command`,`.`]}),` `,(0,Z.jsx)(`span`,{className:`text-muted`,children:_?v===`none`?`It makes no changes from the board.`:v===`auto`?`A fix is made on a branch on its machine. Without asking: ${fr(pr(e))}.`:`A fix is made on a branch on its machine, and each edit waits for an answer on the board.`:`It takes comments on its own (shapewall watch) and makes its changes where it runs.`})]})]}),_?(0,Z.jsx)(_r,{agent:e}):null,(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Approval rule`,className:`space-y-2`,children:[(0,Z.jsx)(Or,{value:`ask`,checked:a===`ask`,disabled:y,onChoose:o,title:`Ask every time`,children:(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:_&&v===`none`?`Once its machine takes edits from the board, each one waits for a person with the role below.`:e.approval.machine.approvals===`owner`?`Everything the agent asks to do waits for ${e.createdBy?yr(e.createdBy):`the person who connected it`}: its machine takes answers from nobody else.`:`Everything the agent asks to do waits for a person with the role below.`})}),(0,Z.jsx)(Or,{value:`auto`,checked:a===`auto`,disabled:y||!!g,onChoose:o,title:g?`Allow without asking (not available)`:`Allow without asking`,...g?{"data-sw-agent-approval-unavailable":!0}:{},children:g?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,"data-sw-agent-approval-why":!0,children:g}),_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mt-1.5 block text-xs text-muted`,children:`To allow it, run this on the agent's machine, in the project's folder:`}),(0,Z.jsx)(Ue,{value:hr,testId:`approval-auto`,className:`mt-1`})]}):null]}):(0,Z.jsxs)(`span`,{className:`block text-xs text-muted`,"data-sw-agent-approval-applies":!0,children:[`Applies to `,T,`, as its machine allows. Files that run something (settings, scripts, tests, CI) and anything else still wait for an answer. A fix is always made on a branch, and one made without asking is not pushed until someone looks at its whole diff on the board.`,e.approval.autoBy===`owner`?(0,Z.jsxs)(`span`,{className:`mt-1 block`,"data-sw-agent-approval-owner-only":!0,children:[`Only `,e.createdBy?yr(e.createdBy):`the person who connected it`,` can switch this on: its machine takes approvals from them alone.`]}):null]})})]}),m?null:(0,Z.jsxs)(U,{tone:`info`,children:[`Changing this agent's approval rule needs the `,B[e.approval.changeRole||`owner`].toLowerCase(),` role.`]}),(0,Z.jsxs)(`div`,{className:`grid items-start gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Who may answer its approvals`,children:C(l,d,`answer`)}),(0,Z.jsx)(V,{label:`Who may change this rule`,hint:`Only an owner changes these two.`,children:C(s,c,`change`)})]}),(0,Z.jsx)(H,{error:p.error})]}):null})}function Ar({workspaceId:e,projectId:t}){let n=I(q(e,`/projects/${t}/agents`)),r=(n.data?.agents||[]).filter(e=>e.state!==`revoked`);return(0,Z.jsxs)(R,{"data-sw-project-agents-card":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agents`,description:`The machines that pick up comments sent to an agent here: who they are, who may use them, and the default.`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsx)(P,{to:`/w/${e}/agents/${t}`,"data-sw-project-agents-open":!0,children:r.length?`Manage agents`:`Connect an agent`})})}),n.loading?(0,Z.jsx)(W,{rows:1}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,n.data&&!n.error?r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:r.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm sm:px-5`,"data-sw-project-agent":e.name,children:[(0,Z.jsx)(Sr,{agent:e,size:`md`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:e.name}),e.isDefault?(0,Z.jsx)(T,{tone:`neutral`,className:`px-1.5 py-0.5 text-[10.5px]`,children:`Default`}):null,(0,Z.jsx)(br,{agent:e}),(0,Z.jsx)(`span`,{className:`w-full text-xs text-muted sm:w-auto`,children:e.audience.text})]},e.id))}):(0,Z.jsx)(`p`,{className:`px-4 py-4 text-sm text-muted sm:px-5`,children:`No agent is connected. Comments sent to an agent wait until a machine that has the code runs shapewall watch --remote.`}):null]})}function jr({projectId:e}){let{workspaceId:t,data:n,isAdmin:r,isOwner:i,reload:a}=$(),o=N(),s=n.projects.find(t=>t.id===e),c=I(r&&s?q(t,`/projects/${e}/shares`):null),l=I(r&&s?q(t,`/projects/${e}/tokens`):null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=N(),w=N(),T=F();if(!s)return(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Project not found`}),(0,Z.jsx)(P,{to:`/w/${t}`,className:`mt-3 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to projects`})]});let E=n.workspace.settings.shareLinks,ee=r,D=n=>o.run(async()=>{await L.put(q(t,`/projects/${e}/public`),{public:n}),await a(),b(!1),T(n?`This project is public`:`This project is private again. The public URL stopped working.`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/w/${t}`,className:`mb-3 inline-flex h-11 items-center gap-1.5 rounded-md text-sm text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent lg:h-8`,children:[(0,Z.jsx)(wt,{size:15,"aria-hidden":`true`}),` Projects`]}),(0,Z.jsx)(we,{title:s.name,description:`Created ${ze(s.createdAt)}`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`default`,className:`lg:h-9`,children:(0,Z.jsxs)(`a`,{href:s.boardUrl,children:[`Open board `,(0,Z.jsx)(ge,{size:15,"aria-hidden":`true`})]})})}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[r&&!s.boards.length?(0,Z.jsx)(Ln,{workspaceId:t,data:n,project:s,tokens:l.data?.tokens||null,onNewToken:()=>m(!0)}):null,(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:ut,title:`Boards`,description:`Each board is one shapewall.config.json board, updated by every push.`}),s.boards.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:s.boards.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 text-sm sm:px-5`,"data-sw-project-board":e.id,children:[(0,Z.jsx)(`code`,{className:`font-mono text-[13px] text-fg`,children:e.id}),(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[e.pushes,` `,e.pushes===1?`push`:`pushes`,` · last `,(0,Z.jsx)(Y,{value:e.pushedAt})]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(`a`,{href:ve(s.boardUrl,`board`,e.id),className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:[`Open `,(0,Z.jsx)(ge,{size:14,"aria-hidden":`true`})]}),ee?(0,Z.jsxs)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,onClick:()=>{C.setError(null),S(e.id)},"aria-label":`Remove board ${e.id}`,"data-sw-remove-board":e.id,children:[(0,Z.jsx)(yt,{size:15,"aria-hidden":`true`}),` Remove board`]}):null]},e.id))}):(0,Z.jsxs)(_,{icon:ut,title:`Nothing pushed yet`,children:[`Make a token with the push scope below, then run shapewall push --remote `,Le()]})]}),r?(0,Z.jsxs)(R,{"data-sw-project-shares":!0,children:[(0,Z.jsx)(G,{icon:Rt,title:`Share links`,description:`For people outside the workspace: this project only, until the link expires or you revoke it.`,actions:E?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,onClick:()=>f(!0),className:`lg:h-9`,"data-sw-new-share":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New share link`]}):null}),E?null:(0,Z.jsx)(`div`,{className:`p-4 sm:p-5`,children:(0,Z.jsx)(Gn,{isAdmin:r})}),c.loading?(0,Z.jsx)(W,{}):null,c.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:c.error,onRetry:c.reload})}):null,c.data&&(E||c.data.shares.length)?(0,Z.jsx)(Un,{shares:c.data.shares,onChanged:c.reload,projectId:e}):null]}):null,r&&n.features?.publicProjects?(0,Z.jsxs)(R,{"data-sw-project-public":!0,children:[(0,Z.jsx)(G,{icon:Ye,title:`Public`,description:`Anyone with the URL can view this project's boards and comments. They cannot comment or change anything.`,actions:i&&n.workspace.settings.publicProjects||s.public?(0,Z.jsx)(Ee,{checked:!!s.public,label:`Public`,disabled:o.busy||!s.public&&!i,onChange:e=>e?D(!0):b(!0)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-3 px-4 py-4 text-sm text-muted sm:px-5`,children:[s.public?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{value:`${window.location.origin}${s.public.url}`,testId:`public`}),(0,Z.jsxs)(`p`,{children:[`Public since `,(0,Z.jsx)(Y,{value:s.public.since}),`. Making it private stops this URL at once; making it public again gives a new one.`]})]}):n.workspace.settings.publicProjects?i?(0,Z.jsx)(`p`,{children:`Private.`}):(0,Z.jsx)(`p`,{children:`Private. Only an owner can make a project public.`}):(0,Z.jsx)(U,{tone:`info`,children:`Public projects are off in this workspace. An owner turns them on in Settings.`}),y?null:(0,Z.jsx)(H,{error:o.error})]})]}):null,r?(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:qe,title:`API tokens`,description:`For the CLI, CI and agents working in this project.`,actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:()=>m(!0),className:`lg:h-9`,"data-sw-project-new-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New token`]})}),l.loading?(0,Z.jsx)(W,{}):null,l.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:l.error,onRetry:l.reload})}):null,l.data&&!l.error?l.data.tokens.length?(0,Z.jsx)(Qn,{tokens:l.data.tokens,onChanged:l.reload}):(0,Z.jsx)(_,{icon:qe,title:`No tokens yet`}):null]}):null,r&&!v?(0,Z.jsx)(Ar,{workspaceId:t,projectId:e}):null,r?(0,Z.jsx)(tr,{workspaceId:t,projectId:e}):null,r?(0,Z.jsx)(R,{className:`border-bad/30`,children:(0,Z.jsx)(G,{icon:yt,title:`Delete project`,description:`Its boards, captures, comments, tokens and share links go with it.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>g(!0),className:`border border-bad/40 lg:h-9`,"data-sw-delete-project":!0,children:`Delete project`})})}):null]}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wn,{open:d,onClose:()=>f(!1),project:s,onCreated:c.reload}),(0,Z.jsx)($n,{open:p,onClose:()=>m(!1),projects:n.projects,projectId:e,onCreated:l.reload}),(0,Z.jsx)(z,{open:h,onClose:()=>g(!1),title:`Delete ${s.name}?`,confirmLabel:`Delete project`,tone:`danger`,confirmText:s.name,busy:w.busy,error:w.error,onConfirm:()=>w.run(async()=>{await L.delete(q(t,`/projects/${e}`)),T(`Deleted ${s.name}`),Je(`/w/${t}`)}),children:(0,Z.jsx)(`p`,{children:`This deletes every board, capture, comment, token and share link of the project. It cannot be undone.`})}),(0,Z.jsxs)(z,{open:!!x,onClose:()=>S(null),title:`Remove the board ${x||``}?`,confirmLabel:`Remove board`,tone:`danger`,busy:C.busy,error:C.error,onConfirm:()=>C.run(async()=>{await L.delete(q(t,`/projects/${e}/boards/${x}`)),await a(),T(`Removed the board ${x}`),S(null)}),children:[(0,Z.jsxs)(`p`,{"data-sw-remove-board-note":!0,children:[`This deletes the captures, the page history and every comment of `,(0,Z.jsx)(`code`,{className:`font-mono text-fg`,children:x}),` on this server. It cannot be undone. Pushing a board with the same id later brings its captures back, but not the comments.`]}),(0,Z.jsx)(`p`,{className:`mt-2`,children:`The project, its other boards, its tokens and its share links stay.`})]}),(0,Z.jsx)(z,{open:y,onClose:()=>b(!1),title:`Make ${s.name} private?`,confirmLabel:`Make private`,tone:`danger`,busy:o.busy,error:o.error,onConfirm:()=>D(!1),children:(0,Z.jsx)(`p`,{children:`The public URL stops working at once, for everyone you sent it to. Making the project public again gives it a new URL: the old one never comes back.`})})]}):null]})}function Mr(){let{workspaceId:e}=$(),t=I(q(e,`/invites`)),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),o=N(),s=F(),c=t.data?.pending||[],l=t.data?.history||[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Invites`,description:`Each link works once, for one person, until it expires. Whoever opens it first joins with its role.`,actions:(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>r(!0),className:`lg:h-9`,"data-sw-new-invite":!0,children:[(0,Z.jsx)(dn,{size:16,"aria-hidden":`true`}),` New invite`]})}),t.loading?(0,Z.jsx)(W,{}):null,t.error?(0,Z.jsx)(K,{error:t.error,onRetry:t.reload}):null,t.data?(0,Z.jsxs)(te,{defaultValue:`pending`,children:[(0,Z.jsxs)(se,{className:`mb-3 w-full sm:inline-flex sm:w-auto`,children:[(0,Z.jsxs)(ue,{value:`pending`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`pending`,children:[`Pending `,(0,Z.jsx)(`span`,{className:`tabular ml-1 text-faint`,children:c.length})]}),(0,Z.jsxs)(ue,{value:`history`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`history`,children:[`History `,(0,Z.jsx)(`span`,{className:`tabular ml-1 text-faint`,children:l.length})]})]}),(0,Z.jsx)(C,{value:`pending`,children:(0,Z.jsx)(R,{children:c.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-pending-invites":!0,children:c.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-invite":e.id,children:[(0,Z.jsx)(J,{role:e.role}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[e.note?(0,Z.jsx)(`span`,{className:`mr-2 font-medium`,"data-sw-invite-note":!0,children:e.note}):null,e.tailnetLogin?(0,Z.jsxs)(`span`,{"data-sw-invite-tailnet":!0,children:[`For the tailnet login `,e.tailnetLogin]}):e.email?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(Ze,{size:13,"aria-hidden":`true`}),` `,e.email]}):e.note?null:`Link`]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`By `,e.createdBy?.displayName||`someone`,` · `,(0,Z.jsx)(Y,{value:e.createdAt}),` ·`,` `,(0,Z.jsx)(Y,{value:e.expiresAt,prefix:`expires `})]})]}),(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>a(e),className:`lg:h-8`,"data-sw-revoke-invite":!0,children:`Revoke`})]},e.id))}):(0,Z.jsx)(_,{icon:Bt,title:`No pending invites`,children:`New invite links show here until someone uses them or they expire.`})})}),(0,Z.jsx)(C,{value:`history`,children:(0,Z.jsx)(R,{children:l.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-invite-history":!0,children:l.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-invite-status":e.status,children:[(0,Z.jsx)(J,{role:e.role}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[e.status===`used`?`Joined: ${e.usedBy?.displayName||`a deleted account`}${e.usedBy?` (@${e.usedBy.handle})`:``}`:e.note||e.email||`Link`,e.status===`used`&&e.note?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.note]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`By `,e.createdBy?.displayName||`someone`,` · created `,(0,Z.jsx)(Y,{value:e.createdAt}),e.status===`used`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· used `,(0,Z.jsx)(Y,{value:e.usedAt})]}):null,e.status===`revoked`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· revoked `,(0,Z.jsx)(Y,{value:e.revokedAt})]}):null,e.status===`expired`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· expired `,(0,Z.jsx)(Y,{value:e.expiresAt})]}):null]})]}),(0,Z.jsx)(T,{tone:e.status===`used`?`ok`:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`used`?`Used`:e.status===`revoked`?`Revoked`:`Expired`})]},e.id))}):(0,Z.jsx)(_,{icon:Bt,title:`No history yet`,children:`Used, revoked and expired invites show here.`})})})]}):null,(0,Z.jsx)(Nr,{open:n,onClose:()=>r(!1),onCreated:t.reload}),(0,Z.jsx)(z,{open:!!i,onClose:()=>a(null),title:`Revoke this invite?`,confirmLabel:`Revoke invite`,tone:`danger`,busy:o.busy,error:o.error,onConfirm:()=>o.run(async()=>{await L.delete(q(e,`/invites/${i.id}`)),a(null),s(`Invite revoked`),await t.reload()}),children:(0,Z.jsx)(`p`,{children:`The link stops working. Nobody has joined with it yet.`})})]})}function Nr({open:e,onClose:t,onCreated:n}){let{workspaceId:r,data:i,role:a}=$(),o=i.features,[s,c]=(0,Q.useState)(`member`),[l,d]=(0,Q.useState)(`7`),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),{run:y,busy:b,error:x,setError:S}=N(),[C,T]=he(e,()=>{c(`member`),d(`7`),p(``),h(``),_(``),S(null)}),ee=En(a);return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:b,result:C,title:`Invite someone`,resultTitle:`Invite ready`,resultProps:{"data-sw-invite-result":!0},doneProps:{"data-sw-invite-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[e.emailed?.ok?(0,Z.jsx)(U,{tone:`ok`,title:`Emailed to ${e.invite.email}`,children:`You can also send the link yourself.`}):e.emailed?(0,Z.jsxs)(U,{tone:`warn`,title:`The email did not go out`,children:[e.emailed.error,`. Copy the link and send it yourself.`]}):null,e.invite.tailnetLogin?(0,Z.jsxs)(U,{tone:`ok`,title:`${e.invite.tailnetLogin} is invited`,"data-sw-invite-tailnet-result":!0,children:[`They join as `,B[e.invite.role].toLowerCase(),` the next time they open this server through the tailnet (or with shapewall join). Only that tailnet login can use this invite, so the link below is optional.`]}):v?(0,Z.jsxs)(U,{tone:`info`,title:`A sample link`,"data-sw-invite-sample":!0,children:[`The demo has no server, so this link opens nothing. On a real server it makes one `,B[e.invite.role].toLowerCase(),`, works once and expires `,(0,Z.jsx)(Y,{value:e.invite.expiresAt}),`.`]}):(0,Z.jsxs)(U,{tone:`info`,title:`Copy the link now: it is shown once`,children:[`It makes one `,B[e.invite.role].toLowerCase(),` and expires `,(0,Z.jsx)(Y,{value:e.invite.expiresAt}),`. Send it to one person.`]}),(0,Z.jsx)(Ue,{value:e.url,testId:`invite`})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y(async()=>{let e=await L.post(q(r,`/invites`),{role:s,expiresInDays:Number(l),...f.trim()?{email:f.trim()}:{},...m.trim()?{note:m.trim()}:{},...g.trim()?{tailnetLogin:g.trim()}:{}});T(e),await n?.()})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Role`,children:e=>(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-invite-role":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:ee.map(e=>(0,Z.jsx)(A,{value:e,children:B[e]},e))})]})}),(0,Z.jsx)(V,{label:`Link expires after`,children:e=>(0,Z.jsxs)(j,{value:l,onValueChange:d,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-invite-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:o.inviteDays.map(e=>(0,Z.jsx)(A,{value:String(e),children:Oe(e)},e))})]})})]}),(0,Z.jsx)(`p`,{className:`-mt-1 text-xs text-muted`,children:Fe[s]}),(0,Z.jsx)(V,{label:`Who it is for (optional)`,hint:`A note for the pending list, like Ada (design). Only admins see it.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:m,onChange:e=>h(e.target.value),maxLength:80,autoComplete:`off`,placeholder:`Ada (design)`,"data-sw-invite-note-input":!0})}),o.tailnetSignIn?(0,Z.jsx)(V,{label:`Tailnet login (optional)`,hint:`The name they sign in to Tailscale with. Only that login can use the invite, and they need no link.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:g,onChange:e=>_(e.target.value),autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,placeholder:`ada@example.com`,"data-sw-invite-tailnet-login":!0})}):null,o.inviteEmail?(0,Z.jsx)(V,{label:`Email (optional)`,hint:`We email the link to this address. Leave it empty to copy the link yourself.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,type:`email`,value:f,onChange:e=>p(e.target.value),autoComplete:`off`,placeholder:`name@example.com`,"data-sw-invite-email":!0})}):(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`This server does not send email: you copy the link and send it yourself.`}),s===`owner`?(0,Z.jsx)(U,{tone:`warn`,children:`An owner can change or remove anyone, you included. Inviting one always asks you to confirm.`}):null,(0,Z.jsx)(H,{error:x}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:b,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:b,className:`lg:h-10`,"data-sw-invite-create":!0,children:[b?(0,Z.jsx)(w,{}):null,` `,g.trim()?`Invite this login`:f.trim()?`Create and email`:`Create invite link`]})]})]})})}function Pr(){let{data:e,role:t,isAdmin:r,workspaceId:i,reload:o}=$(),{me:s,refresh:c}=Ne(),l=F(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=N(),x=e.members.filter(e=>e.role===`owner`).length,S=!!v&&v.userId!==s.user.id,C=I(r&&S?q(i,`/tokens`):null),w=S?(C.data?.tokens||[]).filter(e=>e.status===`active`&&e.createdBy?.userId===v.userId):[],[T,ee]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{v&&ee(!0)},[v]);let D=(0,Q.useMemo)(()=>{let t=d.trim().toLowerCase(),n={owner:0,admin:1,member:2,viewer:3};return e.members.filter(e=>!t||e.displayName.toLowerCase().includes(t)||e.handle.includes(t)).sort((e,t)=>n[e.role]-n[t.role]||e.displayName.localeCompare(t.displayName))},[e.members,d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Members`,description:`${e.members.length} ${e.members.length===1?`person`:`people`} in ${e.workspace.name}. Roles apply to every project.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[r?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsxs)(P,{to:`/w/${i}/access#roles`,children:[(0,Z.jsx)(Te,{size:15,"aria-hidden":`true`}),` Roles and permissions`]})}):(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:()=>document.getElementById(`roles`)?.scrollIntoView({behavior:`smooth`}),children:[(0,Z.jsx)(Te,{size:15,"aria-hidden":`true`}),` Roles and permissions`]}),r?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,onClick:()=>m(!0),className:`lg:h-9`,"data-sw-invite-people":!0,children:[(0,Z.jsx)(dn,{size:16,"aria-hidden":`true`}),` Invite people`]}):null]})}),r?(0,Z.jsx)(mi,{}):null,(0,Z.jsxs)(R,{children:[(0,Z.jsx)(`div`,{className:`border-b border-line p-3 sm:px-5`,children:(0,Z.jsx)(M,{size:`touch`,icon:Qt,value:d,onChange:e=>f(e.target.value),placeholder:`Search by name or handle`,"aria-label":`Search members`,className:`lg:h-9 lg:text-sm`})}),(0,Z.jsxs)(`div`,{className:`hidden grid-cols-[minmax(0,2fr)_10rem_8rem_8rem_3rem] gap-3 border-b border-line px-5 py-2 text-[11px] font-medium tracking-wide text-faint uppercase md:grid`,children:[(0,Z.jsx)(`span`,{children:`Person`}),(0,Z.jsx)(`span`,{children:`Role`}),(0,Z.jsx)(`span`,{children:`Joined`}),(0,Z.jsx)(`span`,{children:`Last active`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})]}),D.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-members":!0,children:D.map(e=>{let r=e.userId===s.user.id,i=Cn(t,e.role),o=!r&&wn(t,e.role),c=e.role===`owner`&&x<=1;return(0,Z.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3 sm:px-5 md:grid-cols-[minmax(0,2fr)_10rem_8rem_8rem_3rem]`,"data-sw-member":e.handle,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(ie,{name:e.displayName,person:!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate text-sm font-medium text-fg`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.displayName}),r?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-faint`,children:`(you)`}):null]}),(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted`,children:[`@`,e.handle]})]})]}),(0,Z.jsx)(`div`,{className:`col-start-1 row-start-2 md:col-start-auto md:row-start-auto`,children:i.length&&!(c&&r)?(0,Z.jsxs)(j,{value:e.role,onValueChange:t=>t===e.role?null:g({member:e,role:t}),children:[(0,Z.jsx)(k,{size:`touch`,className:`w-36 lg:h-8`,"aria-label":`Role of ${e.displayName}`,"data-sw-role-select":e.handle,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:i.map(e=>(0,Z.jsx)(A,{value:e,disabled:c&&e!==`owner`,children:B[e]},e))})]}):(0,Z.jsx)(J,{role:e.role})}),(0,Z.jsx)(`div`,{className:`hidden text-xs text-muted md:block`,children:(0,Z.jsx)(Y,{value:e.joinedAt})}),(0,Z.jsxs)(`div`,{className:`col-start-1 row-start-3 text-xs text-muted md:col-start-auto md:row-start-auto`,children:[(0,Z.jsx)(`span`,{className:`md:hidden`,children:`Active `}),(0,Z.jsx)(Y,{value:e.lastActiveAt,empty:`Not yet`}),(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` `,`· joined `,(0,Z.jsx)(Y,{value:e.joinedAt})]})]}),(0,Z.jsx)(`div`,{className:`col-start-2 row-span-3 row-start-1 self-start md:col-start-auto md:row-span-1 md:row-start-auto md:self-center`,children:o||r?(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsx)(u,{size:`icon`,variant:`ghost`,className:`lg:h-8 lg:w-8`,"aria-label":`Actions for ${e.displayName}`,"data-sw-member-menu":e.handle,children:(0,Z.jsx)(Mt,{size:16,"aria-hidden":`true`})})}),(0,Z.jsx)(fe,{children:r?(0,Z.jsxs)(a,{tone:`danger`,disabled:c,onSelect:()=>y(e),"data-sw-leave":!0,children:[(0,Z.jsx)(ln,{size:14,"aria-hidden":`true`}),` `,c?`Leave (make another owner first)`:`Leave workspace`]}):(0,Z.jsxs)(a,{tone:`danger`,onSelect:()=>y(e),"data-sw-remove-member":!0,children:[(0,Z.jsx)(ln,{size:14,"aria-hidden":`true`}),` Remove from workspace`]})})]}):null})]},e.userId)})}):(0,Z.jsx)(_,{icon:hn,title:`Nobody matches`,children:`Try another name or handle.`})]}),r?null:(0,Z.jsx)(R,{className:`mt-5`,id:`roles`,children:(0,Z.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Z.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Roles`}),(0,Z.jsx)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:X.map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:e})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:Fe[e]})]},e))})]})}),(0,Z.jsx)(Nr,{open:p,onClose:()=>m(!1)}),(0,Z.jsx)(z,{open:!!h,onClose:()=>g(null),title:h?`Make ${h.member.displayName} ${B[h.role].toLowerCase()}?`:``,confirmLabel:`Change role`,tone:h&&X.indexOf(h.role)<X.indexOf(h.member.role)?`danger`:`default`,busy:b.busy,error:b.error,onConfirm:()=>b.run(async()=>{await L.patch(q(i,`/members/${h.member.userId}`),{role:h.role});let e=h.member.userId===s.user.id;g(null),l(`${h.member.displayName} is now ${B[h.role].toLowerCase()}`),await o(),e&&await c()}),children:h?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-fg`,children:[B[h.role],`:`]}),` `,Fe[h.role]]}),(0,Z.jsxs)(`p`,{children:[`The change applies to every project in the workspace at once`,h.member.userId===s.user.id?`, including for you`:``,`.`]}),[`owner`,`admin`].includes(h.member.role)&&![`owner`,`admin`].includes(h.role)?(0,Z.jsx)(`p`,{children:`Their pending invites, share links and API tokens are revoked.`}):null,h.member.role===`owner`&&h.role===`admin`?(0,Z.jsx)(`p`,{children:`Their pending owner invites are revoked.`}):null,h.role===`owner`||h.member.role===`owner`?(0,Z.jsx)(`p`,{className:`text-xs`,children:`Making, changing or removing an owner always asks you to confirm.`}):null]}):null}),(0,Z.jsx)(z,{open:!!v,onClose:()=>y(null),title:v?.userId===s.user.id?`Leave ${e.workspace.name}?`:`Remove ${v?.displayName}?`,confirmLabel:v?.userId===s.user.id?`Leave workspace`:`Remove`,tone:`danger`,busy:b.busy,error:b.error,onConfirm:()=>b.run(async()=>{let e=v.userId===s.user.id,t=await L.delete(q(i,`/members/${v.userId}`),!e&&w.length&&!T?{revokeTokens:!1}:{});if(e){Je(`/`);return}y(null);let n=t?.revoked?.tokens||0;l(n?`Removed ${v.displayName} and revoked ${n} API ${n===1?`token`:`tokens`}`:`Removed ${v.displayName}`),await o()}),children:v?.userId===s.user.id?(0,Z.jsx)(`p`,{children:`You lose access to every project here, and your pending invites, share links and API tokens are revoked. An admin can invite you again.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`They lose access to every project at once. Their comments stay.`}),[`owner`,`admin`].includes(v?.role)?(0,Z.jsx)(`p`,{children:`Their pending invites and share links are revoked.`}):null,r?C.loading?(0,Z.jsx)(`p`,{children:`Checking their API tokens...`}):C.error?(0,Z.jsxs)(`p`,{className:`text-warn`,"data-sw-remove-tokens-unknown":!0,children:[`Their API tokens could not be checked (`,C.error.message,`). Any that still work are revoked with them.`]}):w.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{checked:T,onChange:ee,id:`remove-revoke-tokens`,children:[`Revoke the `,w.length,` API `,w.length===1?`token`:`tokens`,` they made (`,w.map(e=>e.name).join(`, `),`)`]}),T?null:(0,Z.jsx)(`p`,{className:`text-warn`,children:`Kept tokens stop working anyway while they are not an admin here, and work again if they come back as one.`})]}):(0,Z.jsx)(`p`,{children:`They made no API tokens that still work.`}):null]})})]})}var Fr={own:`solid`,manage:`accent`,comment:`ok`,view:`neutral`};function Ir({level:e}){return(0,Z.jsx)(T,{tone:Fr[e],className:`px-2 py-0.5 text-[11px]`,"data-sw-access":e,children:Me[e]})}var Lr=()=>(0,Z.jsxs)(`span`,{className:`inline-flex h-[22px] items-center align-middle text-faint`,children:[(0,Z.jsx)(`span`,{className:`h-[1.5px] w-2.5 rounded-full bg-current`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`No access`})]});function Rr(){let{workspaceId:e}=$(),t=I(q(e,`/access`)),[n,r]=(0,Q.useState)(()=>_e()===`#roles`?`roles`:`projects`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Access`,description:`Who can reach which project, and with what. People get their role everywhere; tokens and share links reach one project.`}),t.loading?(0,Z.jsx)(W,{}):null,t.error?(0,Z.jsx)(K,{error:t.error,onRetry:t.reload}):null,t.data?(0,Z.jsxs)(te,{value:n,onValueChange:r,children:[(0,Z.jsxs)(se,{className:`mb-4 w-full sm:inline-flex sm:w-auto`,children:[(0,Z.jsx)(ue,{value:`projects`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`projects`,children:`By project`}),(0,Z.jsx)(ue,{value:`people`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`people`,children:`By person`}),(0,Z.jsx)(ue,{value:`roles`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`roles`,children:`Roles`})]}),(0,Z.jsx)(C,{value:`projects`,children:(0,Z.jsx)(zr,{data:t.data})}),(0,Z.jsx)(C,{value:`people`,children:(0,Z.jsx)(Br,{data:t.data})}),(0,Z.jsx)(C,{value:`roles`,children:(0,Z.jsx)(Vr,{})})]}):null]})}function zr({data:e}){let{workspaceId:t}=$(),[n,r]=(0,Q.useState)(e.projects[0]?.id||``);if(!e.projects.length)return(0,Z.jsx)(R,{children:(0,Z.jsx)(_,{icon:Te,title:`No projects yet`,children:`People still have their roles; tokens and share links come with projects.`})});let a=[...e.people.map(e=>({key:e.userId,kind:`person`,label:e.displayName,sub:`@${e.handle}`,badge:(0,Z.jsx)(J,{role:e.role}),reaches:()=>!0,cell:()=>(0,Z.jsx)(Ir,{level:e.access})})),...e.tokens.map(e=>({key:e.id,kind:`token`,label:e.name,sub:`${e.prefix}…${e.createdBy?.left?` · maker left`:``}`,warn:e.createdBy?.left,reaches:t=>t===e.projectId,cell:t=>t===e.projectId?(0,Z.jsx)(Zn,{scopes:e.scopes}):(0,Z.jsx)(Lr,{})})),...e.shares.map(e=>({key:e.id,kind:`share`,label:e.name,sub:`Guests · expires ${ze(e.expiresAt)}`,lock:e.passcode,reaches:t=>t===e.projectId,cell:t=>t===e.projectId?(0,Z.jsx)(Vn,{mode:e.mode}):(0,Z.jsx)(Lr,{})}))],o={person:hn,token:qe,share:Rt},s=e.projects.find(e=>e.id===n),c=Object.values(e.pendingInvites).reduce((e,t)=>e+t,0);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[c?(0,Z.jsxs)(U,{tone:`info`,action:(0,Z.jsx)(P,{to:`/w/${t}/invites`,className:`inline-flex h-11 items-center text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:`Invites`}),children:[c,` pending `,c===1?`invite`:`invites`,` will add`,` `,Object.entries(e.pendingInvites).map(([e,t])=>`${t} ${B[e].toLowerCase()}${t===1?``:`s`}`).join(`, `),` `,`when used.`]}):null,e.shareLinksOn?null:(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Share links are off in this workspace.`}),(0,Z.jsx)(R,{className:`hidden overflow-x-auto md:block`,"data-sw-access-matrix":!0,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-[40rem] border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-line text-left text-[12px] font-medium text-muted`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`sticky left-0 bg-surface px-5 py-2.5 font-medium`,children:`Who`}),e.projects.map(e=>(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2.5 font-medium`,children:e.name},e.id))]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-line`,children:a.map(t=>{let n=o[t.kind];return(0,Z.jsxs)(`tr`,{"data-sw-access-row":t.kind,children:[(0,Z.jsx)(`th`,{scope:`row`,className:`sticky left-0 bg-surface px-5 py-2.5 text-left font-normal`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(n,{size:15,className:`shrink-0 text-faint`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium text-fg`,children:[t.label,t.lock?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:12,className:`text-muted`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`(passcode)`})]}):null]}),(0,Z.jsx)(`p`,{className:i(`truncate text-xs`,t.warn?`text-warn`:`text-muted`),children:t.sub})]}),t.badge?(0,Z.jsx)(`span`,{className:`ml-auto pl-2`,children:t.badge}):null]})}),e.projects.map(e=>(0,Z.jsx)(`td`,{className:`px-3 py-2.5`,children:t.cell(e.id)},e.id))]},t.key)})})]})}),(0,Z.jsxs)(`div`,{className:`space-y-3 md:hidden`,children:[(0,Z.jsx)(V,{label:`Project`,children:t=>(0,Z.jsxs)(j,{value:n,onValueChange:r,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...t,"data-sw-access-project":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:e.projects.map(e=>(0,Z.jsx)(A,{value:e.id,children:e.name},e.id))})]})}),(0,Z.jsx)(R,{children:(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:a.filter(e=>e.reaches(s.id)).map(e=>{let t=o[e.kind];return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Z.jsx)(t,{size:15,className:`shrink-0 text-faint`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),(0,Z.jsx)(`p`,{className:i(`truncate text-xs`,e.warn?`text-warn`:`text-muted`),children:e.sub})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:e.cell(s.id)})]},e.key)})})})]})]})}function Br({data:e}){let[t,n]=(0,Q.useState)(e.people[0]?`person:${e.people[0].userId}`:``),[r,a]=t.split(`:`),o=r===`person`?e.people.find(e=>e.userId===a):null,s=r===`token`?e.tokens.find(e=>e.id===a):null,c=r===`share`?e.shares.find(e=>e.id===a):null,l=t=>e.projects.find(e=>e.id===t)?.name||`a deleted project`;return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(V,{label:`Show access for`,children:r=>(0,Z.jsxs)(j,{value:t,onValueChange:n,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full sm:w-96`,...r,"data-sw-access-person":!0,children:(0,Z.jsx)(O,{placeholder:`Pick someone`})}),(0,Z.jsxs)(E,{children:[(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`People`}),e.people.map(e=>(0,Z.jsxs)(A,{value:`person:${e.userId}`,children:[e.displayName,` (@`,e.handle,`)`]},e.userId))]}),e.tokens.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`API tokens`}),e.tokens.map(e=>(0,Z.jsxs)(A,{value:`token:${e.id}`,children:[e.name,` (`,e.prefix,`…)`]},e.id))]}):null,e.shares.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`Share links`}),e.shares.map(e=>(0,Z.jsx)(A,{value:`share:${e.id}`,children:e.name},e.id))]}):null]})]})}),o?(0,Z.jsxs)(R,{"data-sw-access-detail":`person`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-line px-4 py-4 sm:px-5`,children:[(0,Z.jsx)(ie,{name:o.displayName,person:!0,className:`h-11 w-11 text-sm`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-fg`,children:o.displayName}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted`,children:[`@`,o.handle,` · joined `,(0,Z.jsx)(Y,{value:o.joinedAt}),` · active `,(0,Z.jsx)(Y,{value:o.lastActiveAt,empty:`not yet`})]})]}),(0,Z.jsx)(J,{role:o.role})]}),(0,Z.jsxs)(`div`,{className:`grid gap-5 px-4 py-4 sm:px-5 md:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:`Projects`}),e.projects.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:e.projects.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`truncate text-fg`,children:e.name}),(0,Z.jsx)(Ir,{level:o.access})]},e.id))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No projects yet.`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:[`As `,B[o.role].toLowerCase(),`, they can`]}),(0,Z.jsx)(`ul`,{className:`space-y-1.5 text-sm`,children:Ve.map(([e,t])=>{let n=gn(o.role,t);return(0,Z.jsxs)(`li`,{className:i(`flex items-start gap-2`,n?`text-fg`:`text-faint line-through`),children:[n?(0,Z.jsx)(h,{size:14,className:`mt-0.5 shrink-0 text-ok`,"aria-hidden":`true`}):(0,Z.jsx)(bt,{size:14,className:`mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:n?`Can:`:`Cannot:`}),e]},e)})})]})]}),e.tokens.some(e=>e.createdBy?.userId===o.userId)?(0,Z.jsxs)(`div`,{className:`border-t border-line px-4 py-4 sm:px-5`,children:[(0,Z.jsx)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:`Tokens they made`}),(0,Z.jsx)(`ul`,{className:`space-y-1.5 text-sm`,children:e.tokens.filter(e=>e.createdBy?.userId===o.userId).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(qe,{size:13,className:`text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-fg`,children:e.name}),(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`in `,l(e.projectId)]}),(0,Z.jsx)(Zn,{scopes:e.scopes})]},e.id))})]}):null]}):null,s?(0,Z.jsxs)(R,{"data-sw-access-detail":`token`,children:[(0,Z.jsx)(G,{icon:qe,title:s.name,description:`${s.prefix}… · ${l(s.projectId)} only`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm sm:px-5`,children:[(0,Z.jsx)(Zn,{scopes:s.scopes}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Made by `,s.createdBy?.displayName||`unknown`,` · last used `,(0,Z.jsx)(Y,{value:s.lastUsedAt,empty:`never`}),` ·`,` `,s.expiresAt?(0,Z.jsx)(Y,{value:s.expiresAt,prefix:`expires `}):`no expiry`]}),s.createdBy?.left?(0,Z.jsx)(U,{tone:`warn`,children:`The person who made this token has left the workspace, so it no longer works. Revoke it.`}):null]})]}):null,c?(0,Z.jsxs)(R,{"data-sw-access-detail":`share`,children:[(0,Z.jsx)(G,{icon:Pt,title:c.name,description:`Guests · ${l(c.projectId)} only`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm sm:px-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(Vn,{mode:c.mode}),c.passcode?(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ge,{size:11,"aria-hidden":`true`}),` Passcode`]}):null]}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Opened `,c.opens,` `,c.opens===1?`time`:`times`,` · last `,(0,Z.jsx)(Y,{value:c.lastUsedAt,empty:`never`}),` ·`,` `,(0,Z.jsx)(Y,{value:c.expiresAt,prefix:`expires `})]}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Guests see this project's boards and comments`,c.mode===`comment`?`, and add comments and replies marked as a guest`:``,`. Nothing else in the workspace.`]})]})]}):null]})}function Vr(){return(0,Z.jsxs)(R,{"data-sw-roles-table":!0,children:[(0,Z.jsx)(G,{icon:Te,title:`Roles and permissions`,description:`A role applies to every project in the workspace. Guests come from share links.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line md:hidden`,"data-sw-roles-list":!0,children:Ve.map(([e,t])=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-4 py-2.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 text-fg`,children:e}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-muted`,children:[(0,Z.jsx)(J,{role:t}),t===`owner`?`only`:`and up`]})]},e))}),(0,Z.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-[36rem] border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`px-5 py-2.5 text-left text-[11px] font-medium tracking-wide text-faint uppercase`,children:`Can`}),[...X,`guest`].map(e=>(0,Z.jsx)(`th`,{scope:`col`,className:`px-2 py-2.5 text-center`,children:(0,Z.jsx)(J,{role:e})},e))]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-line`,children:Ve.map(([e,t])=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{scope:`row`,className:`px-5 py-2 text-left font-normal text-fg`,children:e}),X.map(e=>(0,Z.jsxs)(`td`,{className:`px-2 py-2 text-center`,children:[gn(e,t)?(0,Z.jsx)(h,{size:15,className:`mx-auto text-ok`,"aria-hidden":`true`}):(0,Z.jsx)(bt,{size:15,className:`mx-auto text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:gn(e,t)?`Yes`:`No`})]},e)),(0,Z.jsx)(`td`,{className:`px-2 py-2 text-center`,children:t===`viewer`?(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:`One project`}):e.startsWith(`Comment`)?(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:`Comment and reply, on comment links`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{size:15,className:`mx-auto text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`No`})]})})]},e))})]})}),(0,Z.jsxs)(`dl`,{className:`grid gap-2 border-t border-line px-5 py-4 text-sm sm:grid-cols-2`,children:[X.map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:e})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:Fe[e]})]},e)),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:`guest`})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:`Someone with a share link: one project, no account, comments marked as a guest.`})]})]})]})}var Hr={user:je,token:s,guest:Ye,system:en},Ur=`__all__`,Wr=e=>{let t=e.replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)};function Gr(){let{workspaceId:e}=$(),n=I(q(e,`/audit/filters`)),[r,i]=(0,Q.useState)(Ur),[a,o]=(0,Q.useState)(Ur),[s,c]=(0,Q.useState)(`any`),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),m=N();(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>p(l.trim()),300);return()=>window.clearTimeout(e)},[l]);let h=(0,Q.useCallback)(()=>{let e=new URLSearchParams;r!==Ur&&e.set(`actor`,r),a!==Ur&&e.set(`action`,a);let t=Re.find(([e])=>e===s)?.[2];return t&&e.set(`from`,new Date(Date.now()-t*864e5).toISOString()),f&&e.set(`q`,f),e},[r,a,s,f]),g=(0,Q.useCallback)(t=>{let n=h();return n.set(`limit`,`50`),t&&n.set(`before`,String(t)),q(e,`/audit?${n}`)},[h,e]),y=()=>m.run(()=>pe(`GET`,q(e,`/audit/export?${h()}`),void 0,`audit.csv`)),b=Pe(g,`entries`),x=b.items,S=n.data?.actors||[],C=n.data?.actions||[],T=r!==Ur||a!==Ur||s!==`any`||!!f,ee=S.filter(e=>e.type===`user`),te=S.filter(e=>e.type===`token`),ne=S.filter(e=>e.type===`guest`),re=e=>`${e.type===`guest`?`share`:e.type}:${e.id}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Audit log`,description:be(`Membership, invites, projects, tokens, share links, pushes and moderation in this workspace.`),actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:y,disabled:m.busy||v,className:`lg:h-9`,"data-sw-audit-export":!0,children:[m.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)($e,{size:15,"aria-hidden":`true`}),` Export CSV`]})}),(0,Z.jsxs)(R,{className:`mb-4 p-3 sm:p-4`,"data-sw-audit-filters":!0,children:[(0,Z.jsx)(`div`,{className:`mb-2`,children:(0,Z.jsx)(M,{size:`touch`,icon:Qt,value:l,onChange:e=>d(e.target.value),placeholder:`Search names, projects, tokens, links`,"aria-label":`Search the audit log`,className:`lg:h-9`,maxLength:100,"data-sw-audit-search":!0})}),(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,Z.jsxs)(j,{value:r,onValueChange:i,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`Who`,"data-sw-audit-actor":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:Ur,children:`Everyone`}),ee.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`People`}),ee.map(e=>(0,Z.jsxs)(A,{value:re(e),children:[e.label,e.handle?` (@${e.handle})`:``]},e.id))]}):null,te.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`API tokens`}),te.map(e=>(0,Z.jsx)(A,{value:re(e),children:e.label},e.id))]}):null,ne.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`Share link guests`}),ne.map(e=>(0,Z.jsx)(A,{value:re(e),children:e.link},e.id))]}):null]})]}),(0,Z.jsxs)(j,{value:a,onValueChange:o,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`What`,"data-sw-audit-action":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:Ur,children:`All actions`}),C.map(e=>(0,Z.jsx)(A,{value:e,children:Wr(e)},e))]})]}),(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`When`,"data-sw-audit-range":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Re.map(([e,t])=>(0,Z.jsx)(A,{value:e,children:t},e))})]})]}),T?(0,Z.jsxs)(u,{size:`touch`,variant:`ghost`,className:`mt-2 lg:h-8`,onClick:()=>{i(Ur),o(Ur),c(`any`),d(``),p(``)},children:[(0,Z.jsx)(t,{size:14,"aria-hidden":`true`}),` Clear filters`]}):null,(0,Z.jsx)(H,{error:m.error})]}),(0,Z.jsxs)(R,{children:[b.loading?(0,Z.jsx)(W,{}):null,b.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:b.error,onRetry:x.length?b.loadMore:b.reload})}):null,!b.loading&&!b.error&&!x.length?(0,Z.jsx)(_,{icon:Xt,title:T?`Nothing matches these filters`:`No events yet`}):null,!b.loading&&x.length?(0,Z.jsx)(`ol`,{className:`divide-y divide-line`,"data-sw-audit-list":!0,children:x.map(e=>{let t=Hr[e.actor.type]||en;return(0,Z.jsxs)(`li`,{className:`flex gap-3 px-4 py-3 sm:px-5`,"data-sw-audit-entry":e.action,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted`,children:(0,Z.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.actor.label}),e.actor.type===`guest`&&e.actor.named?(0,Z.jsx)(`span`,{className:`text-muted`,children:` (guest)`}):null,e.actor.type===`token`?(0,Z.jsx)(`span`,{className:`text-muted`,children:` (token)`}):null,` `,De(e)]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[(0,Z.jsx)(Y,{value:e.at}),` `,(0,Z.jsxs)(`span`,{className:`text-faint`,children:[`· `,Ie(e.at)]}),e.ip?` · ${e.ip}`:``]})]})]},e.id)})}):null,b.next&&!b.loading?(0,Z.jsx)(`div`,{className:`border-t border-line p-3 text-center`,children:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:b.loadMore,disabled:b.more,className:`lg:h-9`,"data-sw-audit-more":!0,children:[b.more?(0,Z.jsx)(w,{}):null,` Load older events`]})}):null]})]})}var Kr=[`cards`,`agents`,`tokens`,`members`,`data`],qr={cards:`Agent edits and pushes`,agents:`Agents and machines`,tokens:`Tokens and share links`,members:`Members and roles`,data:`Exports and deletes`},Jr={cards:`Allow on an agent's edit or command, Push this fix, approving an agent run or a shell command`,agents:`approving a machine or an agent, who may use an agent, its approval rule, the project agent policy`,tokens:`new API tokens, new share links, turning share links or public projects on, making a project public`,members:`inviting an admin, making someone an admin, changing or removing an admin`,data:`exporting the workspace, deleting a project or a board`},Yr=[5,15,30,60],Xr=[...new Set([{method:`POST`,path:`/auth/passkeys/options`,first:!0,says:`adding or removing a passkey`},{method:`POST`,path:`/auth/passkeys/verify`,first:!0,says:`adding or removing a passkey`},{method:`DELETE`,path:`/auth/passkeys/:id`,held:!0,says:`adding or removing a passkey`},{method:`POST`,path:`/auth/recovery-codes`,says:`new recovery codes`},{method:`POST`,path:`/auth/tailnet/link`,says:`linking or unlinking a tailnet login`},{method:`DELETE`,path:`/auth/tailnet/link`,says:`linking or unlinking a tailnet login`},{method:`DELETE`,path:`/auth/me`,says:`deleting your account`},{method:`DELETE`,path:`/api/workspaces/:ws`,role:`owner`,says:`deleting a workspace`},{inRoute:`console-routes.js roleStepUp`,says:`making someone an owner, changing or removing an owner (leaving as one too), inviting an owner`},{inRoute:`rebind.js POST /auth/rebind/start`,says:`moving your account to the server's new address`},{inRoute:`step-up-settings.js change`,says:`making these settings weaker`}].map(e=>e.says))];Object.freeze({cards:!1,agents:!1,tokens:!1,members:!1,data:!1,adminIdle:!1,cliApproval:!1,windowMinutes:15});var Zr=e=>e===60?`1 hour`:`${e} minutes`,Qr=[`deleting a workspace or your account`,`making, changing or removing an owner`,`inviting an owner`];function $r({id:e,title:t,children:n,control:r}){return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-3 sm:px-5`,"data-sw-step-up-row":e,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-ui text-muted`,children:n})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:r})]})}var ei=({on:e})=>(0,Z.jsx)(`span`,{className:e?`text-ui font-medium text-fg`:`text-ui text-muted`,"data-sw-step-up-state":e?`on`:`off`,children:e?`On`:`Off`});function ti(){let{data:e,isOwner:t,workspaceId:n,reload:r}=$(),i=F(),a=N(),o=e.workspace.settings.stepUp;if(!o)return null;let s=[...Kr.filter(e=>o[e]).map(e=>qr[e]),...o.adminIdle?[`Admin pages after 12 hours away`]:[],...o.cliApproval?[`Approve command line logins in the browser`]:[]];if(e.features?.passkeys===!1)return(0,Z.jsxs)(R,{"data-sw-settings-step-up":`tailnet-only`,children:[(0,Z.jsx)(G,{icon:qe,title:`Confirming changes`,description:`Your Tailscale account is the sign-in on this server, so there is no passkey to ask for again.`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-ui text-muted sm:px-5`,children:[(0,Z.jsxs)(`p`,{children:[`Being signed in with the right role is enough for everything in this workspace. Before `,Qr.join(`; `),`, Shapewall asks you to type the workspace’s name (or your handle) to confirm.`]}),(0,Z.jsx)(`p`,{children:`The tailnet is the boundary: anything running as you on one of your tailnet devices can act as you here. Whoever runs the server can also allow passkeys (shapewall hosted admin passkeys on); then an account that adds one confirms with it, and the switches for asking again appear here.`}),s.length?(0,Z.jsxs)(U,{tone:`warn`,title:`Switched on here, and not asked while this server has passkeys off`,"data-sw-step-up-not-asked":!0,children:[s.join(`; `),`. These were switched on in this workspace when the server had passkeys. They are kept, and asked again when whoever runs the server allows passkeys again.`]}):null]})]});let c=Kr.some(e=>o[e])||o.adminIdle,l=(e,t)=>a.run(async()=>{await L.patch(q(n,`/step-up`),e),await r(),i(t)}),u=(e,n,r,i)=>t?(0,Z.jsx)(Ee,{checked:n,label:i,disabled:a.busy,onChange:e=>l(r(e),`${i}: ${e?`the passkey is asked for again`:`no longer asks for the passkey`}`)}):(0,Z.jsx)(ei,{on:n});return(0,Z.jsxs)(R,{"data-sw-settings-step-up":!0,children:[(0,Z.jsx)(G,{icon:qe,title:`Ask for a passkey again`,description:`Being signed in with the right role is enough for everything in this workspace. Switch on what you want confirmed with a passkey again before it happens.`}),(0,Z.jsxs)(`ul`,{className:`divide-y divide-line`,children:[Kr.map(e=>(0,Z.jsxs)($r,{id:e,title:qr[e],control:u(e,o[e],t=>({group:e,on:t}),qr[e]),children:[`Before: `,Jr[e],`.`]},e)),(0,Z.jsx)($r,{id:`adminIdle`,title:`Admin pages after 12 hours away`,control:u(`adminIdle`,o.adminIdle,e=>({adminIdle:e}),`Admin pages after 12 hours away`),children:`Members, tokens, the audit log and the other admin pages ask once more when you come back after 12 hours without opening one.`}),e.features?.tailnetSignIn?(0,Z.jsx)($r,{id:`cliApproval`,title:`Approve command line logins in the browser`,control:u(`cliApproval`,o.cliApproval,e=>({cliApproval:e}),`Approve command line logins in the browser`),children:`Off: shapewall login and agent connect on a tailnet machine are approved by that machine’s tailnet user, with no code. A tailnet identity is per device, not per person: anything running as you on a tailnet device of yours can act as you here. On: a session that only a tailnet identity stands behind is refused three things, which need a passkey check instead: approving a command line login or an agent, making an API token, and inviting or making an admin (an admin can do the first two). Everything else such a session may do in this workspace stays as it is.`}):null,(0,Z.jsx)($r,{id:`window`,title:`One check counts for`,control:t?(0,Z.jsxs)(j,{value:String(o.windowMinutes),onValueChange:e=>l({windowMinutes:Number(e)},`One passkey check now counts for ${Zr(Number(e))}`),disabled:a.busy,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-36 lg:h-9`,"aria-label":`One check counts for`,"data-sw-step-up-window":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Yr.map(e=>(0,Z.jsx)(A,{value:String(e),children:Zr(e)},e))})]}):(0,Z.jsx)(`span`,{className:`text-ui text-fg`,children:Zr(o.windowMinutes)}),children:c?`After a passkey check, what is switched on above is not asked again for this long.`:`Nothing above is switched on, so nothing here asks yet.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2 border-t border-line px-4 py-3.5 text-ui text-muted sm:px-5`,"data-sw-step-up-always":!0,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:`Always asked, on every server`}),` (once every 10 minutes): `,Xr.join(`; `),`.`]}),(0,Z.jsxs)(`p`,{children:[t?`Switching something on needs nothing more. Switching it off, or a longer time, asks for your passkey.`:`Only an owner changes these.`,` `,`A session that started with a recovery code is always asked.`]}),(0,Z.jsx)(H,{error:a.error})]})]})}function ni(){let{data:e,isAdmin:t,isOwner:n,workspaceId:r,reload:i}=$(),{me:a,refresh:o}=Ne(),s=F(),[c,l]=(0,Q.useState)(e.workspace.name);(0,Q.useEffect)(()=>l(e.workspace.name),[e.workspace.name]);let d=N(),f=N(),p=N(),m=N(),h=N(),g=N(),[_,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),T=e.members.filter(e=>e.role===`owner`).length,E=n&&T<=1,ee=e.workspace.settings.shareLinks,D=!!e.features?.publicProjects,O=!!e.workspace.settings.publicProjects,k=e.features?.deleteWorkspace!==!1,te=e=>f.run(async()=>{await L.patch(q(r,`/settings`),{shareLinks:e}),await i(),C(null),s(e?`Share links are on`:`Share links are off. Every link stopped working.`)}),ne=e=>p.run(async()=>{await L.patch(q(r,`/public-projects`),{enabled:e}),await i(),C(null),s(e?`Public projects are on`:`Public projects are off. Every public URL was cleared.`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Settings`,description:`The workspace name, sharing, what asks you to confirm again, export, and leaving or deleting it.`}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:Kt,title:`Name`,description:`Shown to members, in invites and to guests of share links.`}),(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d.run(async()=>{await L.patch(q(r),{name:c}),await Promise.all([i(),o()]),s(`Workspace renamed`)})},className:`flex flex-col gap-3 px-4 py-4 sm:flex-row sm:items-end sm:px-5`,children:[(0,Z.jsx)(V,{label:`Workspace name`,className:`flex-1`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:c,onChange:e=>l(e.target.value),maxLength:80,disabled:!t,"data-sw-settings-name":!0})}),t?(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`secondary`,disabled:d.busy||!c.trim()||c===e.workspace.name,children:[d.busy?(0,Z.jsx)(w,{}):null,` Save`]}):null]}),d.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:d.error})}):null]}),(0,Z.jsxs)(R,{"data-sw-settings-shares":!0,children:[(0,Z.jsx)(G,{icon:Rt,title:`Share links`,description:`Let admins share a project's boards with people outside the workspace, view-only or with guest comments.`,actions:t?(0,Z.jsx)(Ee,{checked:ee,label:`Share links`,disabled:f.busy,onChange:e=>e?te(!0):C(`shares`)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(`p`,{children:ee?`On. Each link reaches one project, expires, can have a passcode and can be revoked. Turning this off stops every link at once; turning it back on restores the ones that are not revoked or expired.`:t?`Off. No share link works in this workspace.`:`Off. No share link works in this workspace. An admin can turn them on.`}),S===`shares`?null:(0,Z.jsx)(H,{error:f.error})]})]}),D?(0,Z.jsxs)(R,{"data-sw-settings-public":!0,children:[(0,Z.jsx)(G,{icon:Ye,title:`Public projects`,description:`Let the owner put a project on the open web: anyone with its URL can view the boards and comments, and change nothing.`,actions:n||t&&O?(0,Z.jsx)(Ee,{checked:O,label:`Public projects`,disabled:p.busy,onChange:e=>e?ne(!0):C(`public`)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(`p`,{children:O?`On. An owner makes a project public on its page. Public boards are view-only and not indexed. Turning this off clears every public URL for good.`:n?`Off. Each project still stays private until you make it public.`:`Off. Only an owner can turn public projects on.`}),S===`public`?null:(0,Z.jsx)(H,{error:p.error})]})]}):null,(0,Z.jsx)(ti,{}),t?(0,Z.jsxs)(R,{"data-sw-settings-export":!0,children:[(0,Z.jsx)(G,{icon:$e,title:`Export`,description:be(`A zip of the workspace: members, projects, every board's pages and screenshots, comments and the audit log. No secrets.`),actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,disabled:g.busy||v,onClick:()=>g.run(async()=>{let e=await pe(`POST`,q(r,`/export`),{},`shapewall-export.zip`);s(`Saved ${e.name}`)}),className:`lg:h-9`,"data-sw-export":!0,children:[g.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)($e,{size:15,"aria-hidden":`true`}),` Download a copy`]})}),g.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:g.error})}):null]}):null,(0,Z.jsx)(R,{className:`border-bad/30`,children:(0,Z.jsx)(G,{icon:At,title:`Leave workspace`,description:E?`You are the only owner. Make someone else an owner first.`:`You lose access to every project here.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>y(!0),disabled:E,className:`border border-bad/40 lg:h-9`,"data-sw-leave-workspace":!0,children:`Leave`})})}),n?(0,Z.jsxs)(R,{className:`border-bad/30`,children:[(0,Z.jsx)(G,{icon:yt,title:`Delete workspace`,description:k?`Every project, board, capture, comment, token, invite, share link and the audit log are deleted. This cannot be undone.`:`The demo keeps this workspace, so there is always something to look at. On a real server, the owner deletes a workspace here.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,disabled:!k,onClick:()=>x(!0),className:`border border-bad/40 lg:h-9`,"data-sw-delete-workspace":!0,children:`Delete workspace`})}),k?(0,Z.jsx)(`div`,{className:`px-4 py-3 sm:px-5`,children:(0,Z.jsx)(U,{tone:`info`,children:`Download a copy first (Export, above) if you may want any of it later.`})}):null]}):null]}),(0,Z.jsx)(z,{open:_,onClose:()=>y(!1),title:`Leave ${e.workspace.name}?`,confirmLabel:`Leave workspace`,tone:`danger`,busy:m.busy,error:m.error,onConfirm:()=>m.run(async()=>{await L.delete(q(r,`/members/${a.user.id}`)),Je(`/`)}),children:(0,Z.jsx)(`p`,{children:`You lose access to every project here, and your pending invites, share links and API tokens are revoked. An admin can invite you again.`})}),(0,Z.jsx)(z,{open:S===`shares`,onClose:()=>C(null),title:`Turn share links off?`,confirmLabel:`Turn off`,tone:`danger`,busy:f.busy,error:f.error,onConfirm:()=>te(!1),children:(0,Z.jsx)(`p`,{children:`Every share link in this workspace stops working at once, including for guests who have a board open now. Turning this back on restores the links that are not revoked or expired.`})}),(0,Z.jsxs)(z,{open:S===`public`,onClose:()=>C(null),title:`Turn public projects off?`,confirmLabel:`Turn off`,tone:`danger`,busy:p.busy,error:p.error,onConfirm:()=>ne(!1),children:[(0,Z.jsx)(`p`,{children:`Every public URL in this workspace stops working at once, for everyone you sent one to.`}),(0,Z.jsx)(`p`,{className:`text-bad`,children:`This cannot be undone. The public URLs are cleared for good: turning public projects back on publishes nothing, and a project made public again gets a new URL.`})]}),(0,Z.jsx)(z,{open:b,onClose:()=>x(!1),title:`Delete ${e.workspace.name}?`,confirmLabel:`Delete forever`,tone:`danger`,confirmText:e.workspace.name,busy:h.busy,error:h.error,onConfirm:()=>h.run(async()=>{await He(e.workspace.name,()=>L.delete(q(r),{confirm:e.workspace.name})),Je(`/`)}),children:(0,Z.jsxs)(`p`,{children:[e.members.length,` `,e.members.length===1?`person loses`:`people lose`,` access, and `,e.projects.length,` `,e.projects.length===1?`project is`:`projects are`,` deleted with all their boards and comments. API tokens and share links stop working.`]})})]})}var ri=(0,Q.lazy)(()=>rt(()=>import(`./usage-C5CJHejQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),ii=(0,Q.createContext)(null),$=()=>(0,Q.useContext)(ii),ai=[[`projects`,`Projects`,lt,`viewer`],[`members`,`Members`,hn,`viewer`],[`invites`,`Invites`,Bt,`admin`],[`access`,`Access`,Te,`admin`],[`tokens`,`API tokens`,qe,`admin`],[`audit`,`Audit log`,Xt,`admin`],[`agents`,`Agents`,s,v?`viewer`:`admin`],[`usage`,`Usage`,xe,`member`],[`activity`,`Activity`,St,`viewer`],[`feedback`,`Agent feedback`,Qe,`admin`],[`settings`,`Settings`,vt,`viewer`]];function oi({workspaceId:e,section:t,projectId:n,subjectId:r=null}){let a=I(q(e)),s=o(`(min-width: 1024px)`),c=a.data,l=n?c?.projects.find(e=>e.id===n)?.name||`Project`:null,u=n?t===`agents`&&!v?`Agents of ${l}`:l:ai.find(([e])=>e===t)?.[1]||`Projects`,d=c?.workspace.name;if((0,Q.useEffect)(()=>{d&&(document.title=[u,d,`Shapewall`].join(` · `))},[u,d]),a.loading&&!a.data)return(0,Z.jsx)(W,{});if(!a.data)return a.error?.status===404?(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Workspace not found`}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:`It does not exist, or you are not in it.`}),(0,Z.jsx)(P,{to:`/`,className:`mt-4 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to your workspaces`})]}):(0,Z.jsx)(K,{error:a.error,onRetry:a.reload});let f=a.data,p=f.role,m={workspaceId:e,data:f,reload:a.reload,role:p,isAdmin:gn(p,`admin`),isOwner:p===`owner`},h=ai.filter(([e])=>e!==`feedback`||f.features?.agentFeedback),g=h.filter(([,,,e])=>gn(p,e)),_=ai.find(([e])=>e===t&&h.some(([t])=>t===e)&&!g.some(([t])=>t===e)),y=_||g.some(([e])=>e===t)?t:`projects`,b=!!n&&t===`agents`&&!v,x=b?`agents`:n?`projects`:y,S;return S=_?(0,Z.jsx)(ci,{section:_[1],least:_[3],role:p,workspaceId:e}):b?(0,Z.jsx)(wr,{projectId:n},n):n?(0,Z.jsx)(jr,{projectId:n}):y===`members`?(0,Z.jsx)(Pr,{}):y===`invites`?(0,Z.jsx)(Mr,{}):y===`access`?(0,Z.jsx)(Rr,{}):y===`tokens`?(0,Z.jsx)(Xn,{}):y===`audit`?(0,Z.jsx)(Gr,{}):y===`agents`?v?(0,Z.jsx)(mt,{}):(0,Z.jsx)(Cr,{}):y===`usage`||y===`activity`?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(W,{label:`Loading the page`,rows:4}),children:(0,Z.jsx)(ri,{section:y,subjectId:r})}):y===`settings`?(0,Z.jsx)(ni,{}):y===`feedback`?(0,Z.jsx)(ht,{baseUrl:q(e,`/agent-feedback`),get:L.get}):(0,Z.jsx)(Rn,{}),(0,Z.jsxs)(ii.Provider,{value:m,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-2 lg:hidden`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 truncate text-lg font-semibold text-fg`,children:f.workspace.name}),(0,Z.jsx)(J,{role:p})]}),(0,Z.jsx)(Pn,{label:f.workspace.name,sections:g.map(([t,n,r])=>({id:`ws-${t}`,label:n,icon:r,to:t===`projects`?`/w/${e}`:`/w/${e}/${t}`,active:x===t,"data-sw-nav":t}))}),(0,Z.jsxs)(`div`,{children:[s?null:(0,Z.jsx)(`nav`,{"aria-label":`Workspace`,className:`-mx-3 mb-5`,children:(0,Z.jsx)(si,{active:x,children:g.map(([t,n,r])=>(0,Z.jsx)(`li`,{className:`shrink-0`,children:(0,Z.jsxs)(P,{to:t===`projects`?`/w/${e}`:`/w/${e}/${t}`,"aria-current":x===t?`page`:void 0,className:i(`flex h-11 items-center gap-2.5 rounded-full border px-3.5 text-sm font-medium whitespace-nowrap outline-none focus-visible:outline-2 focus-visible:outline-accent`,x===t?`border-accent/40 bg-accent/10 text-fg`:`border-line bg-surface text-muted hover:text-fg`),"data-sw-nav":t,children:[(0,Z.jsx)(r,{size:16,"aria-hidden":`true`,className:x===t?`text-accent`:``}),n]})},t))})}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:S})]})]})}function si({active:e,children:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)({left:!1,right:!1}),a=(0,Q.useCallback)(()=>{let e=n.current;if(!e)return;let t=e.scrollLeft>4,r=e.scrollLeft+e.clientWidth<e.scrollWidth-4;i(e=>e.left===t&&e.right===r?e:{left:t,right:r})},[]);return(0,Q.useEffect)(()=>(n.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}),a(),window.addEventListener(`resize`,a),()=>window.removeEventListener(`resize`,a)),[e,a]),(0,Z.jsxs)(`div`,{className:`relative`,"data-sw-nav-pills":!0,children:[(0,Z.jsx)(`ul`,{ref:n,onScroll:a,className:`sw-scroll-x flex scroll-pr-10 scroll-pl-8 gap-1 overflow-x-auto px-3`,children:t}),r.left?(0,Z.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-0 w-8 sw-nav-fade-left`,"aria-hidden":`true`}):null,r.right?(0,Z.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-0 w-10 sw-nav-fade-right`,"aria-hidden":`true`,"data-sw-nav-more":!0}):null]})}function ci({section:e,least:t,role:n,workspaceId:r}){return(0,Z.jsxs)(R,{className:`p-8 text-center`,"data-sw-needs-role":t,children:[(0,Z.jsx)(`span`,{className:`inline-flex h-11 w-11 items-center justify-center rounded-xl bg-surface-2 text-muted`,children:(0,Z.jsx)(Ge,{size:20,"aria-hidden":`true`})}),(0,Z.jsxs)(`h1`,{className:`mt-4 text-lg font-semibold text-fg`,children:[`This page needs the `,B[t].toLowerCase(),` role`]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[e,` is for `,t===`member`?`members, admins and owners`:`admins and owners`,`. You are a`,` `,B[n].toLowerCase(),` here; ask an admin if you need it.`]}),(0,Z.jsx)(P,{to:`/w/${r}`,className:`mt-4 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to the projects`})]})}var li=e=>`${e===`owner`||e===`admin`?`an`:`a`} ${B[e].toLowerCase()}`,ui=e=>e.map(e=>`${e.workspace} as ${li(e.role)}`).join(`, `);function di({tailnet:e,signup:t,onSignedIn:n,passkeysOff:r=!1}){let[i,a]=(0,Q.useState)(e.suggested?.handle||``),[o,s]=(0,Q.useState)(e.suggested?.displayName||e.name||``),c=N();if(e.state===`self`)return(0,Z.jsxs)(U,{tone:`info`,className:`mt-4`,title:`This is the server’s own machine`,"data-sw-tailnet":`self`,children:[`This server signs tailnet users in, but never from the machine it runs on: any program on this machine could ask the same way.`,` `,r?`Open the server from another of your tailnet devices. On this machine, whoever runs the server uses shapewall hosted admin.`:`Sign in with a passkey here, or open the server from another of your tailnet devices.`]});if(e.state===`changed`)return(0,Z.jsxs)(U,{tone:`warn`,className:`mt-4`,title:`This tailnet login belongs to someone else here`,"data-sw-tailnet":`changed`,children:[`An account on this server is linked to `,e.login,`, but for a different tailnet user than the one your device is signed in as: the name was given to someone else, or your device is shared in from another tailnet.`,` `,r?`If the account is yours, ask whoever runs this server.`:`Sign in with a passkey, or ask whoever runs this server.`,e.fix?(0,Z.jsxs)(`span`,{className:`mt-2 block`,"data-sw-tailnet-fix":!0,children:[`They run, on the server: `,(0,Z.jsx)(`code`,{className:`font-mono text-[12px] break-all text-fg`,children:e.fix})]}):null]});if(e.state===`none`)return(0,Z.jsxs)(U,{tone:`info`,className:`mt-4`,title:`Your tailnet did not say who you are`,"data-sw-tailnet":`none`,children:[`This server signs tailnet users in, but this device is not a person’s (a tagged device, or a node shared in without a user).`,` `,r?`Open it from one of your own tailnet devices.`:`Sign in with a passkey instead.`]});if(e.state===`signed_out`||e.state===`linked`)return(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,"data-sw-tailnet":e.state,children:[e.state===`linked`?(0,Z.jsx)(U,{tone:`info`,title:`You arrive as ${e.login}`,children:`Your tailnet login is linked to an account here. Continue to sign in with it.`}):(0,Z.jsxs)(U,{tone:`info`,title:`You signed out on this browser`,children:[`Your tailnet still says you are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`, and arriving here would sign you straight back in. So this browser stays signed out until you continue.`]}),(0,Z.jsxs)(u,{variant:`default`,size:`touch`,className:`w-full text-[15px]`,disabled:c.busy,onClick:()=>c.run(async()=>n(await L.post(`/auth/tailnet/sign-in`,{}))),"data-sw-tailnet-continue":!0,children:[c.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)(Et,{size:17,"aria-hidden":`true`}),`Continue as `,e.login]}),(0,Z.jsx)(H,{error:c.error})]});let l=e.state===`invited`,d=!l&&t===`open`;return(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,"data-sw-tailnet":e.state,children:[(0,Z.jsx)(U,{tone:l?`ok`:`info`,title:l?`You are invited: ${ui(e.invites)}`:`You arrived as ${e.login}`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[`Your tailnet says you are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`, and that is your sign-in here: no passkey and no password. You can add a passkey later.`]}):d?(0,Z.jsx)(Z.Fragment,{children:`Nobody has invited you to a workspace here yet. You can start a workspace of your own, signed in by your tailnet login.`}):(0,Z.jsxs)(Z.Fragment,{children:[`Your tailnet says who you are, but being on the tailnet does not put you in a workspace: an admin decides who is in, and with which role. Ask an admin of a workspace here to invite `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`. They see that you arrived on their Members page.`]})}),l||d?(0,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),c.run(async()=>n(await L.post(`/auth/tailnet/join`,{handle:i,displayName:o})))},noValidate:!0,children:[(0,Z.jsx)(V,{label:`Your name`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:o,onChange:e=>s(e.target.value),maxLength:60,"data-sw-tailnet-name":!0})}),(0,Z.jsx)(V,{label:`Handle`,hint:`People @mention you with it. Lowercase letters, digits and dashes.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:i,onChange:e=>a(e.target.value.toLowerCase().replace(/\s+/g,`-`)),autoCapitalize:`none`,spellCheck:!1,maxLength:32,"data-sw-tailnet-handle":!0})}),(0,Z.jsx)(H,{error:c.error}),(0,Z.jsxs)(u,{type:`submit`,variant:`default`,size:`touch`,className:`w-full text-[15px]`,disabled:c.busy||!o.trim()||i.length<3,"data-sw-tailnet-join":!0,children:[c.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)(Et,{size:17,"aria-hidden":`true`}),l?`Join`:`Start a workspace`,` as `,e.login]})]}):null]})}function fi(){let{me:e,refresh:t}=Ne(),n=F(),r=N(),[i,a]=(0,Q.useState)(!1),o=e?.tailnet;if(!o)return null;let s=e.via===`tailnet`,c=e.passkeys.length===0;return e.passkeysOff?(0,Z.jsxs)(R,{id:`account-tailnet`,"data-sw-account-tailnet":`only`,children:[(0,Z.jsx)(G,{icon:Wt,title:`Sign-in`,description:`Your Tailscale account is the sign-in on this server.`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsxs)(`p`,{children:[`You are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.linked}),`, on every tailnet device of yours. There is no passkey and no password here.`]}),(0,Z.jsx)(`p`,{children:`The tailnet is the boundary: anything running as you on one of your tailnet devices can act as you here. Lock your devices, and keep the tailnet to people and machines you trust. The few things Shapewall always asks about (deleting a workspace or your account, changing owners) ask you to type a name to confirm.`}),(0,Z.jsx)(`p`,{children:`Signing out keeps this browser signed out until you press Continue on the sign-in page.`})]})]}):(0,Z.jsxs)(R,{id:`account-tailnet`,"data-sw-account-tailnet":!0,children:[(0,Z.jsx)(G,{icon:Wt,title:`Tailnet sign-in`,description:`This server signs you in by your tailnet login when you arrive through the tailnet, with no passkey.`,actions:o.linked?(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:()=>a(!0),"data-sw-tailnet-unlink":!0,children:`Unlink`}):o.here?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,disabled:r.busy,onClick:()=>r.run(async()=>{await L.post(`/auth/tailnet/link`,{}),await t(),n(`Linked to ${o.here}`)}),"data-sw-tailnet-link":!0,children:[r.busy?(0,Z.jsx)(w,{}):null,` Link `,o.here]}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[o.linked?(0,Z.jsxs)(`p`,{children:[`Linked to `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.linked}),o.linkedAt?(0,Z.jsxs)(Z.Fragment,{children:[` `,`since `,(0,Z.jsx)(Y,{value:o.linkedAt})]}):null,`. `,s?`You are signed in that way now.`:`Arriving through the tailnet as that login signs you in.`]}):o.here?(0,Z.jsxs)(`p`,{children:[`You arrive as `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.here}),`. Link it and that login signs you in here from any of your tailnet devices. Linking asks for your passkey, like adding one.`]}):(0,Z.jsx)(`p`,{children:`Not linked. Open this page through the tailnet, from one of your own devices, to link your tailnet login.`}),o.ownMachine?(0,Z.jsx)(U,{tone:`info`,"data-sw-tailnet-own-machine":!0,children:`This browser is on the server’s own machine. Your tailnet identity is never taken from here (any program on this machine could ask the same way), so linking and tailnet sign-in work from your other tailnet devices.`}):null,o.linked&&o.here&&o.here!==o.linked?(0,Z.jsxs)(U,{tone:`warn`,children:[`This device arrives as `,o.here,`, not as the login your account is linked to. Tailnet sign-in will not sign you in from it.`]}):null,s?(0,Z.jsxs)(`p`,{children:[c?`You have no passkey. That is fine for everything in a workspace. A few things always need one: deleting a workspace or your account, changing owners, recovery codes. Add a passkey above before you need them: a first passkey signs in at once, and can confirm those things 24 hours after it is added.`:`A tailnet session works only on requests that arrive as your login: its cookie is worth nothing off the tailnet.`,` `,`Your tailnet identity is per device, not per person: anything running as you on a tailnet device of yours can act as you here. Signing out keeps this browser signed out until you press Continue on the sign-in page.`]}):null,(0,Z.jsx)(H,{error:r.error})]}),(0,Z.jsx)(z,{open:i,onClose:()=>a(!1),title:`Unlink ${o.linked}?`,confirmLabel:`Unlink`,tone:`danger`,busy:r.busy,error:r.error,onConfirm:()=>r.run(async()=>{let e=await L.delete(`/auth/tailnet/link`);if(a(!1),e.signedOut)return window.location.assign(`/signin`);await t(),n(`Unlinked. Your tailnet no longer signs you in here.`)}),children:(0,Z.jsxs)(`p`,{children:[`Your tailnet login stops signing you in, and sessions that came in that way end. You sign in with a passkey from then on.`,c?` You have no passkey yet: add one first, or you would be locked out.`:``,` Unlinking asks for your passkey.`]})})]})}function pi({onJoined:e}){let{me:t,refresh:n}=Ne(),r=N(),i=t?.tailnet?.invites||[];return i.length?(0,Z.jsxs)(U,{tone:`ok`,className:`mb-5`,title:`You are invited: ${ui(i)}`,"data-sw-tailnet-invites":!0,action:(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-8`,disabled:r.busy,onClick:()=>r.run(async()=>{let t=await L.post(`/auth/tailnet/join`,{});await n(),e?.(t)}),"data-sw-tailnet-accept":!0,children:[r.busy?(0,Z.jsx)(w,{}):null,` Join`]}),children:[`An admin invited your tailnet login. `,r.error||``]}):null}function mi({onInvited:e}){let{workspaceId:n,data:r,role:i}=$(),a=F(),o=!!r.features?.tailnetSignIn,s=I(o?q(n,`/tailnet-visitors`):null),c=N(),[l,d]=(0,Q.useState)({}),f=En(i);(0,Q.useEffect)(()=>d({}),[n]);let p=s.data?.visitors||[];if(!o||!p.length)return null;let m=t=>c.run(async()=>{let r=l[t.login]||`member`;await L.post(q(n,`/invites`),{role:r,tailnetLogin:t.login,expiresInDays:7}),await s.reload(),await e?.(),a(`${t.login} can join as ${li(r)} the next time they open this server`)}),h=e=>c.run(async()=>{await L.delete(q(n,`/tailnet-visitors/${encodeURIComponent(e.login)}`)),await s.reload()});return(0,Z.jsxs)(R,{className:`mb-5`,"data-sw-tailnet-visitors":!0,children:[(0,Z.jsx)(G,{icon:Wt,title:`Arrived through the tailnet`,description:`People on your tailnet who opened this server and are in no workspace. Being on the tailnet gives them nothing: invite the ones who belong here, with a role.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:p.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-tailnet-visitor":e.login,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem]`,children:[(0,Z.jsxs)(`p`,{className:`truncate text-sm font-medium text-fg`,children:[e.name||e.login,` `,(0,Z.jsx)(T,{className:`ml-1 px-2 py-0.5 text-[11px]`,children:`not a member`})]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted`,children:[e.login,` · last here `,(0,Z.jsx)(Y,{value:e.lastSeenAt})]})]}),(0,Z.jsxs)(j,{value:l[e.login]||`member`,onValueChange:t=>d(n=>({...n,[e.login]:t})),children:[(0,Z.jsx)(k,{size:`touch`,className:`w-32 lg:h-9`,"aria-label":`Role for ${e.login}`,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:f.map(e=>(0,Z.jsx)(A,{value:e,children:B[e]},e))})]}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,disabled:c.busy,onClick:()=>m(e),"data-sw-tailnet-admit":!0,children:[(0,Z.jsx)(dn,{size:15,"aria-hidden":`true`}),` Invite`]}),(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,className:`lg:h-9`,disabled:c.busy,onClick:()=>h(e),"aria-label":`Take ${e.login} off this list`,title:`Take off this list`,children:(0,Z.jsx)(t,{size:15,"aria-hidden":`true`})})]},e.login))}),c.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:c.error})}):null]})}export{St as S,It as _,$ as a,Et as b,Pn as c,an as d,en as f,Rt as g,Ht as h,oi as i,kn as l,Jt as m,di as n,Fn as o,Qt as p,pi as r,In as s,fi as t,dn as u,Pt as v,wt as x,Mt as y};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usage-CLrlKCWx.js","assets/ui-DnyJhoQU.js","assets/theme-CPfJOmcz.js","assets/local-agents-DUtV5lSR.js","assets/app-version-Dt9FxRbR.js","assets/usage-DjmUlnXL.js","assets/minus-887msXez.js","assets/usage-CIPWnHaS.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{A as e,At as t,C as n,D as r,Dt as i,E as a,F as o,Ft as s,G as c,It as l,J as u,K as d,M as f,Nt as p,O as m,Pt as h,Rt as g,S as _,U as v,Vt as y,W as b,Y as x,_t as S,a as C,c as w,ct as T,d as E,dt as ee,f as D,g as O,h as k,i as te,j as ne,k as re,lt as ie,m as ae,n as oe,o as se,p as A,q as ce,r as le,s as ue,t as de,u as j,w as fe,x as M}from"./ui-DnyJhoQU.js";import{$ as pe,B as me,C as he,D as N,Et as ge,F as P,I as _e,K as ve,M as ye,N as F,O as I,Q as L,S as be,Tt as xe,V as Se,W as Ce,_ as we,_t as Te,a as R,b as Ee,c as z,ct as B,d as V,dt as De,f as H,ft as Oe,g as U,gt as ke,h as Ae,ht as je,it as Me,j as Ne,k as Pe,lt as Fe,m as W,mt as Ie,nt as Le,o as G,ot as Re,p as K,pt as ze,rt as q,s as Be,st as Ve,tt as He,u as Ue,ut as We,v as J,vt as Ge,x as Y,y as Ke,yt as qe,z as Je}from"./theme-CPfJOmcz.js";import{A as Ye,C as Xe,D as Ze,E as Qe,M as $e,N as et,O as tt,S as nt,_ as rt,b as it,c as at,f as ot,g as st,h as ct,j as lt,k as ut,l as dt,m as ft,p as pt,r as mt,s as ht,u as gt,w as _t,x as vt,y as yt}from"./local-agents-DUtV5lSR.js";import{t as bt}from"./minus-887msXez.js";var xt={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};xt.node;var St=l(xt),Ct={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ct.node;var wt=l(Ct),Tt={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Tt.node;var Et=l(Tt),Dt={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};Dt.node;var Ot=l(Dt),kt={name:`door-open`,size:24,node:[[`path`,{d:`M10 21H2`,key:`1sthdo`}],[`path`,{d:`M10 3H7a2 2 0 00-2 2v16`,key:`15gt7x`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z`,key:`tyvg9a`}],[`path`,{d:`M22 21h-3`,key:`1ec3tr`}]]};kt.node;var At=l(kt),jt={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};jt.node;var Mt=l(jt),Nt={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Nt.node;var Pt=l(Nt),Ft={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ft.node;var It=l(Ft),Lt={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Lt.node;var Rt=l(Lt),zt={name:`mail-plus`,size:24,node:[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]};zt.node;var Bt=l(zt),Vt={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Vt.node;var Ht=l(Vt),Ut={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};Ut.node;var Wt=l(Ut),Gt={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};Gt.node;var Kt=l(Gt),qt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};qt.node;var Jt=l(qt),Yt={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Yt.node;var Xt=l(Yt),Zt={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Zt.node;var Qt=l(Zt),$t={name:`server-cog`,size:24,node:[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]};$t.node;var en=l($t),tn={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};tn.node;var nn=l(tn),rn={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};rn.node;var an=l(rn),on={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};on.node;var sn=l(on),cn={name:`user-minus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};cn.node;var ln=l(cn),un={name:`user-plus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};un.node;var dn=l(un),fn={name:`user-round-check`,size:24,node:[[`path`,{d:`M2 21a8 8 0 0 1 13.292-6`,key:`bjp14o`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]],aliases:[`user-check-2`]};fn.node;var pn=l(fn),mn={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};mn.node;var hn=l(mn),X=[`viewer`,`member`,`admin`,`owner`],gn=(e,t)=>X.indexOf(e)>=X.indexOf(t)&&X.includes(e),_n={workspace:`viewer`,members:`viewer`,leave:`viewer`,rename:`admin`,settings:`admin`,invites:`admin`,changeRole:`admin`,projects:`admin`,tokens:`admin`,shares:`admin`,access:`admin`,audit:`admin`,export:`admin`,usage:`member`,activity:`viewer`,accessReview:`admin`,usageDefaultLayout:`owner`,deleteWorkspace:`owner`},vn=(e,t)=>gn(e,_n[t]),yn=e=>gn(e,_n.tokens),bn=(e,t)=>yn(e)&&gn(e,t?.approvalChangeRole||`admin`),xn=e=>e===`owner`;function Sn(e,t,n=null){return e===`owner`?!0:e!==`admin`||[`owner`,`admin`].includes(t)?!1:n===null||n!==`owner`}function Cn(e,t){return X.filter(n=>Sn(e,t,n)&&gn(e,`admin`))}var wn=(e,t,{self:n=!1}={})=>n||Sn(e,t),Tn=(e,t)=>vn(e,`invites`)&&X.includes(t)&&(t!==`owner`||e===`owner`),En=e=>X.filter(t=>Tn(e,t)),Z=S();function Dn({demo:e,className:t,children:a,align:o=`start`}){return e.viewAs?(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:a}),(0,Z.jsxs)(fe,{align:o,className:i(`w-64`,t),children:[(0,Z.jsx)(r,{children:`View as (demo)`}),(0,Z.jsx)(m,{value:e.viewAs.value,onValueChange:e.viewAs.onChange,children:e.viewAs.options.map(e=>(0,Z.jsxs)(re,{value:e.id,"data-sw-view-as":e.id,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,Z.jsx)(`span`,{className:`truncate text-xs text-faint`,children:e.hint}):null]},e.id))})]})]}):a}var On=()=>(0,Z.jsxs)(`span`,{className:`inline-flex h-5 shrink-0 items-center gap-1.5 rounded-full bg-accent/12 px-2 text-caption font-semibold text-accent`,children:[(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`,"aria-hidden":`true`}),`Demo`]});function kn({variant:e=`strip`,className:t}){let n=b();return n?e===`chip`?(0,Z.jsxs)(`div`,{className:i(`flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-surface-2/60 p-0.5`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Z.jsx)(Dn,{demo:n,align:`end`,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`h-11 gap-1.5 rounded-full px-2 text-ui text-fg lg:h-8`,"aria-label":`Demo, viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Z.jsx)(On,{}),(0,Z.jsx)(`span`,{className:`hidden max-w-28 truncate font-medium sm:inline`,children:n.roleLabel}),(0,Z.jsx)(p,{size:13,className:`text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsx)(x,{label:`Reset the demo`,size:`icon`,className:`rounded-full text-muted max-lg:hidden lg:h-8 lg:w-8`,onClick:n.reset,"data-sw-demo-reset":!0,children:(0,Z.jsx)(nt,{size:14,"aria-hidden":`true`})}),(0,Z.jsx)(An,{})]}):(0,Z.jsxs)(`div`,{className:i(`flex shrink-0 items-center gap-2 border-b border-line bg-surface px-2 text-ui text-muted sm:px-3 lg:h-9`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Z.jsx)(On,{}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:`hidden shrink-0 sm:inline`,children:`Viewing as`}),(0,Z.jsx)(Dn,{demo:n,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`min-w-0 gap-1 px-1.5 text-ui text-fg lg:h-7`,"aria-label":`Viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold`,children:n.roleLabel}),(0,Z.jsxs)(`span`,{className:`hidden truncate font-normal text-muted sm:inline`,children:[`(`,n.personaName,`)`]}),(0,Z.jsx)(p,{size:13,className:`shrink-0 text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsx)(`span`,{className:`hidden truncate text-faint md:inline`,children:`· Changes stay in this browser`})]}),(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:`shrink-0 gap-1.5 px-2 text-ui text-muted lg:h-7`,onClick:n.reset,"data-sw-demo-reset":!0,children:[(0,Z.jsx)(nt,{size:13,"aria-hidden":`true`}),` Reset`]}),(0,Z.jsx)(An,{})]}):null}function An(){let e=b();return e?(0,Z.jsx)(f,{open:!!e.resetAsked,onClose:e.cancelReset,title:`Reset the demo?`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:e.cancelReset,className:`lg:h-10`,"data-sw-demo-reset-cancel":!0,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,className:`border-bad/50 bg-bad text-bad-fg hover:bg-bad/90 lg:h-10`,onClick:e.resetNow,"data-sw-demo-reset-confirm":!0,children:[(0,Z.jsx)(nt,{size:14,"aria-hidden":`true`}),` Reset`]})]}),children:(0,Z.jsx)(`p`,{className:`px-5 py-4 text-sm text-muted`,children:`Your comments, invites and changes in this browser go back to the start.`})}):null}var Q=y(g(),1);function jn({notice:e,onSeen:t}){let{run:n,busy:r,error:i}=N(),a=F();return(0,Q.useEffect)(()=>{i&&a(i,`bad`)},[i,a]),(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-security-notice":!0,children:(0,Z.jsxs)(U,{tone:`warn`,title:`Someone signed in to your account with a recovery code`,action:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>me(`/account#activity`),className:`lg:h-8`,children:`Review activity`}),(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:()=>n(async()=>{await L.post(`/auth/security-notice/seen`,{}),await t()}),disabled:r,className:`lg:h-8`,"data-sw-security-notice-dismiss":!0,children:`That was me`})]}),children:[Ie(e.at),e.ip?` from ${e.ip}`:``,`. If that was not you, make new recovery codes and check your passkeys and devices.`]})})}function Mn({passkey:e,onRemoved:t}){let{run:n,busy:r,error:i}=N(),a=F();return(0,Q.useEffect)(()=>{i&&a(i,`bad`)},[i,a]),(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-held-passkey":e.id,children:(0,Z.jsxs)(U,{tone:`warn`,title:`A passkey was added from ${e.device||`a tailnet device`}`,action:e.canRemove?(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>n(async()=>{await L.delete(`/auth/passkeys/${encodeURIComponent(e.id)}`),await t(),a(`Passkey removed. Other devices were signed out.`)}),disabled:r,className:`lg:h-8`,"data-sw-held-passkey-remove":!0,children:`Not you? Remove it`}):null,children:[Ie(e.addedAt),e.nickname?`, named “${e.nickname}”`:``,`. It is your account’s first passkey, added while your tailnet signed you in, so it confirms nothing sensitive until `,Ie(e.onHoldUntil),`.`,` `,e.canRemove?`If you did not add it, remove it now: something on one of your tailnet devices did.`:`If you did not add it, open this server from one of your tailnet devices and remove it there.`]})})}var Nn=(0,Q.createContext)(()=>{});function Pn({label:e,sections:t}){let n=(0,Q.useContext)(Nn),r=t.map(e=>`${e.id}:${+!!e.active}`).join(`,`);return(0,Q.useEffect)(()=>(n({label:e,sections:t}),()=>n(null)),[n,e,r]),null}function Fn({children:t}){let{me:s,refresh:c}=Ne(),l=b(),d=Ce(),f=/^\/w\/(ws_[a-f0-9]{24})/.exec(d)?.[1]||null,p=s.workspaces.find(e=>e.id===f),m=o(`(min-width: 1024px)`),[g,_]=ct(m),[v,y]=(0,Q.useState)(null),x=ft()||(l?`index.html`:null),S=ye(),C=(e,t)=>(0,Z.jsx)(ot,{name:s.user.displayName,avatarUrl:s.user.avatarUrl,detail:`@${s.user.handle}${p?` · ${B[p.role]} in ${p.name}`:``}`,showName:t,side:e?`right`:void 0,triggerClassName:e?t?`w-full justify-start`:`w-10 min-w-10 px-0`:void 0,label:`Account menu`,"data-sw-account-menu":!0,items:[...l?l.consoleItems(f):[],{id:`account`,label:`Account and security`,icon:je,onSelect:()=>Se(`/account`)},...l?[l.resetItem]:[],{id:`sign-out`,label:`Sign out`,icon:tt,onSelect:S,"data-sw-sign-out":!0}],workspaces:{list:s.workspaces.map(e=>({...e,roleLabel:B[e.role]})),current:f,onPick:e=>Se(`/w/${e}`)},viewAs:l?.viewAs||null}),w=[...x?[{id:`board`,label:`Board`,icon:ut,href:x}]:[],{id:`workspace`,label:p?`Workspace: ${p.name}`:`Workspaces`,icon:et,to:p?`/w/${p.id}`:`/`,active:d!==`/account`&&d!==`/device`},{id:`account`,label:`Account and security`,icon:je,to:`/account`,active:d===`/account`}];return(0,Z.jsx)(Nn.Provider,{value:y,children:(0,Z.jsxs)(`div`,{className:`flex min-h-dvh`,children:[m?(0,Z.jsx)(pt,{expanded:g,onToggle:_,homeTo:`/`,homeLabel:`Shapewall, your workspaces`,title:p?.name||`Shapewall`,link:P,logo:(0,Z.jsx)(Ae,{}),items:w,sections:v?.sections||[],sectionsLabel:v?.label,profile:e=>C(!0,e),className:`sticky top-0 h-dvh`}):null,(0,Z.jsxs)(`div`,{className:`flex min-h-dvh min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`header`,{className:`sticky top-0 z-40 border-b border-line bg-surface/95 backdrop-blur`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center gap-2 px-3 sm:px-6`,children:[m?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/`,className:`flex shrink-0 items-center gap-2 rounded-md px-1 py-1 outline-none focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":`Shapewall, your workspaces`,children:[(0,Z.jsx)(Ae,{}),(0,Z.jsx)(`span`,{className:`hidden text-[15px] font-semibold text-fg sm:inline`,children:`Shapewall`})]}),(0,Z.jsx)(`span`,{className:`hidden text-line sm:inline`,"aria-hidden":`true`,children:`/`})]}),(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsxs)(u,{variant:`ghost`,size:`touch`,className:i(`min-w-0 shrink gap-2 px-2 text-fg lg:h-9`,m&&`-ml-2`),"data-sw-workspace-switcher":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold`,children:p?p.name:`Workspaces`}),(0,Z.jsx)(Ot,{size:14,className:`shrink-0 text-faint`,"aria-hidden":`true`})]})}),(0,Z.jsxs)(fe,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(r,{children:`Your workspaces`}),s.workspaces.map(e=>(0,Z.jsxs)(a,{onSelect:()=>Se(`/w/${e.id}`),"data-sw-workspace":e.id,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-xs text-faint`,children:B[e.role]}),e.id===f?(0,Z.jsx)(h,{size:14,className:`text-accent`,"aria-hidden":`true`}):null]},e.id)),(0,Z.jsx)(e,{}),(0,Z.jsxs)(a,{onSelect:()=>Se(`/#new`),children:[(0,Z.jsx)(Jt,{size:14,"aria-hidden":`true`}),` New workspace`]})]})]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsx)(kn,{variant:`chip`}),m?null:C(!1,!0)]})}),s.viaRecovery?(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,children:(0,Z.jsx)(U,{tone:`warn`,title:`You signed in with a recovery code`,action:d===`/account`?null:(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:()=>me(`/account#add-passkey`),className:`lg:h-8`,children:`Add a passkey`}),children:`Add a new passkey now. For the next 30 minutes this session can add one, and nothing else that is sensitive.`})}):null,s.securityNotice?(0,Z.jsx)(jn,{notice:s.securityNotice,onSeen:c}):null,(s.heldPasskeys||[]).map(e=>(0,Z.jsx)(Mn,{passkey:e,onRemoved:c},e.id)),l?.storageFull?(0,Z.jsx)(`div`,{className:`mx-auto max-w-6xl px-3 pt-4 sm:px-6`,"data-sw-demo-storage-full":!0,children:(0,Z.jsx)(U,{tone:`warn`,title:`The demo ran out of browser storage`,action:(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,onClick:l.reset,className:`lg:h-8`,children:`Reset the demo`}),children:`New changes last only until you leave this page. Resetting the demo frees the space.`})}):null,(0,Z.jsx)(`main`,{className:`mx-auto w-full max-w-6xl flex-1 animate-fade-in px-3 pt-5 pb-10 sm:px-6 sm:pt-8`,id:`main`,children:t}),(0,Z.jsx)(st,{transport:L})]})]})})}function In({children:e,wide:t=!1}){return(0,Z.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center px-4 pt-10 sm:pt-20`,children:[(0,Z.jsxs)(P,{to:`/`,className:`mb-6 flex items-center gap-2 rounded-md outline-none focus-visible:outline-2 focus-visible:outline-accent`,children:[(0,Z.jsx)(Ae,{className:`h-8 w-8`}),(0,Z.jsx)(`span`,{className:`text-lg font-semibold text-fg`,children:`Shapewall`})]}),(0,Z.jsx)(`main`,{className:t?`w-full max-w-lg flex-1 animate-fade-in`:`w-full max-w-md flex-1 animate-fade-in`,id:`main`,children:e}),(0,Z.jsx)(st,{transport:L,className:`px-0 sm:px-0`})]})}function Ln({workspaceId:e,data:t,project:n=null,tokens:r=null,onNewProject:a,onNewToken:o}){let s=!!r?.some(e=>e.status===`active`&&e.scopes.includes(`push`)),c=!!n?.boards.length,l=t.members.length>1||t.invites.length>0,d=[{id:`project`,title:`Create a project`,body:`One per site or app.`,done:!!n||t.projects.length>0,action:a?(0,Z.jsx)(u,{size:`touch`,variant:`default`,onClick:a,className:`lg:h-9`,"data-sw-start-project":!0,children:`New project`}):null},{id:`token`,title:`Make a push token`,body:`A token with the push scope lets the CLI or CI upload captures to this project.`,done:s,action:n&&o?(0,Z.jsx)(u,{size:`touch`,variant:s?`secondary`:`default`,onClick:o,className:`lg:h-9`,"data-sw-start-token":!0,children:`Make a token`}):null},{id:`push`,title:`Push your captures`,body:`From the folder with shapewall.config.json, after a local capture. The token dialog has this command with the token filled in.`,done:c,extra:n?(0,Z.jsx)(Ue,{value:`shapewall push --remote ${Le()}`,testId:`start-push`,className:`mt-2`}):null},{id:`invite`,title:`Invite your team`,body:`Teammates comment on the board; agents pick the comments up.`,done:l,action:(0,Z.jsx)(u,{size:`touch`,variant:l?`secondary`:`default`,onClick:()=>me(`/w/${e}/invites`),className:`lg:h-9`,"data-sw-start-invite":!0,children:`Invite people`})}],f=d.find(e=>!e.done)?.id;return(0,Z.jsxs)(R,{className:`p-4 sm:p-5`,"data-sw-getting-started":!0,children:[(0,Z.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Get started`}),(0,Z.jsx)(`ol`,{className:`mt-3 space-y-3`,children:d.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-3`,"data-sw-start-step":e.id,"data-done":e.done?`true`:`false`,children:[(0,Z.jsx)(`span`,{className:i(`mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold tabular`,e.done?`border-ok bg-ok text-white`:e.id===f?`border-accent text-accent`:`border-line text-muted`),"aria-hidden":`true`,children:e.done?(0,Z.jsx)(h,{size:14}):t+1}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`p`,{className:i(`text-sm font-medium`,e.done?`text-muted line-through`:`text-fg`),children:[e.title,(0,Z.jsx)(`span`,{className:`sr-only`,children:e.done?` (done)`:``})]}),e.done?null:(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:e.body}),!e.done&&e.extra?e.extra:null,!e.done&&e.action?(0,Z.jsx)(`div`,{className:`mt-2`,children:e.action}):null]})]},e.id))})]})}function Rn(){let{data:e,isAdmin:t,workspaceId:n,reload:r}=$(),[i,a]=(0,Q.useState)(!1),o=F();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Projects`,description:`Each project holds the boards you push from your machine or CI, their comments, tokens and share links.`,actions:t?(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>a(!0),className:`lg:h-9`,"data-sw-new-project":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New project`]}):null}),e.projects.length?(0,Z.jsx)(`div`,{className:`grid animate-fade-in gap-4 md:grid-cols-2`,"data-sw-project-grid":!0,children:e.projects.map(e=>(0,Z.jsx)(Bn,{project:e,isAdmin:t,workspaceId:n},e.id))}):t?(0,Z.jsx)(Ln,{workspaceId:n,data:e,onNewProject:()=>a(!0)}):(0,Z.jsx)(R,{children:(0,Z.jsx)(_,{icon:lt,title:`No projects yet`,children:`An admin creates projects. Boards appear here once someone pushes captures.`})}),(0,Z.jsx)(zn,{open:i,onClose:()=>a(!1),workspaceId:n,onCreated:async e=>{await r(),a(!1),o(`Created ${e.name}`),Se(`/w/${n}/projects/${e.id}`)}})]})}function zn({open:e,onClose:t,onCreated:n,workspaceId:r}){let[i,a]=(0,Q.useState)(``),{run:o,busy:s,error:c,setError:l}=N();return(0,Q.useEffect)(()=>{e&&(a(``),l(null))},[e,l]),(0,Z.jsx)(f,{open:e,onClose:()=>s?null:t(),title:`New project`,description:`Usually one per site or app.`,children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o(async()=>{await n((await L.post(q(r,`/projects`),{name:i})).project)})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsx)(V,{label:`Name`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:i,onChange:e=>a(e.target.value),maxLength:80,placeholder:`Marketing site`,"data-sw-project-name":!0})}),(0,Z.jsx)(H,{error:c}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:s,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:s||!i.trim(),className:`lg:h-10`,"data-sw-project-create":!0,children:[s?(0,Z.jsx)(w,{}):null,` Create project`]})]})]})})}function Bn({project:e,isAdmin:t,workspaceId:n}){let r=e.boards.map(e=>e.pushedAt).filter(Boolean).sort().at(-1),i=e.boards.map(e=>e.summary).filter(Boolean),a=i.find(e=>e.thumbnailUrl)?.thumbnailUrl||null,o=e=>i.reduce((t,n)=>t+(Number(n[e])||0),0),s=o(`pages`),c=o(`openComments`),l=o(`needsPerson`),d=e.boards.length>0;return(0,Z.jsxs)(R,{className:`group relative flex flex-col overflow-hidden transition-[box-shadow,border-color,translate] duration-(--motion-fast) ease-standard hover:-translate-y-px hover:border-line-strong hover:shadow-lift focus-within:border-line-strong`,"data-sw-project":e.name,children:[(0,Z.jsx)(`div`,{className:`relative h-36 overflow-hidden border-b border-line bg-surface-2`,"aria-hidden":`true`,children:a?(0,Z.jsx)(`img`,{src:a,alt:``,loading:`lazy`,className:`absolute inset-x-6 top-5 w-[calc(100%-3rem)] rounded-t-md object-cover object-top shadow-pop transition-transform duration-(--motion-base) ease-standard group-hover:-translate-y-0.5`}):(0,Z.jsx)(`div`,{className:`sw-project-cover flex h-full items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`inline-flex h-12 w-12 items-center justify-center rounded-xl border border-line bg-surface text-accent shadow-card`,children:(0,Z.jsx)(lt,{size:22})})})}),(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col p-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`a`,{href:e.boardUrl,className:`flex min-h-11 items-center truncate text-title font-semibold text-fg outline-none lg:min-h-0 after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-accent`,"data-sw-project-link":e.name,children:e.name}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-ui text-muted`,children:d?(0,Z.jsxs)(Z.Fragment,{children:[e.boards.length,` `,e.boards.length===1?`board`:`boards`,s?` · ${s} ${s===1?`page`:`pages`}`:``,r?(0,Z.jsxs)(Z.Fragment,{children:[` · pushed `,(0,Z.jsx)(`span`,{className:`relative z-10`,children:(0,Z.jsx)(Y,{value:r})})]}):null]}):`Nothing pushed yet`})]}),i.length?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,"data-sw-project-stats":!0,children:[(0,Z.jsxs)(T,{tone:c?`accent`:`neutral`,className:`gap-1 tabular-nums`,children:[(0,Z.jsx)(Ht,{size:12,"aria-hidden":`true`}),c?`${c} open ${c===1?`comment`:`comments`}`:`No open comments`]}),l?(0,Z.jsxs)(T,{tone:`warn`,className:`gap-1 tabular-nums`,children:[(0,Z.jsx)(pn,{size:12,"aria-hidden":`true`}),l,` `,l===1?`needs`:`need`,` a person`]}):null]}):null,(0,Z.jsxs)(`div`,{className:`relative z-10 mt-4 flex flex-wrap gap-2 pt-1`,children:[(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`default`,className:`lg:h-9`,children:(0,Z.jsxs)(`a`,{href:e.boardUrl,"data-sw-open-board":e.name,children:[`Open board `,(0,Z.jsx)(ge,{size:15,"aria-hidden":`true`})]})}),t?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsxs)(P,{to:`/w/${n}/projects/${e.id}`,"data-sw-manage-project":e.name,children:[(0,Z.jsx)(nn,{size:15,"aria-hidden":`true`}),` Tokens and sharing`]})}):null]})]})]})}function Vn({mode:e}){return e===`comment`?(0,Z.jsxs)(T,{tone:`accent`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ht,{size:11,"aria-hidden":`true`}),` Guests comment`]}):(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Pt,{size:11,"aria-hidden":`true`}),` View only`]})}function Hn({share:e,projectId:t,onClose:n}){let{workspaceId:r}=$(),i=F(),a=q(r,`/projects/${t}/shares/${e.id}/guests`),o=I(a),s=N(),c=o.data?.guests||[];return(0,Z.jsx)(f,{open:!0,onClose:n,title:`Guests of "${e.name}"`,description:`One row per browser that opened the link`,size:`md`,children:(0,Z.jsxs)(`div`,{className:`px-5 py-4`,"data-sw-guest-list":!0,children:[o.loading&&!o.data?(0,Z.jsx)(W,{}):null,o.error?(0,Z.jsx)(K,{error:o.error,onRetry:o.reload}):null,o.data&&!c.length?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Nobody has opened this link yet.`}):null,c.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:c.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,"data-sw-guest":e.name,"data-sw-guest-status":e.status,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),e.status===`active`?null:(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`ended`?`Ended`:`Expired`})]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[[e.device,e.ipPrefix].filter(Boolean).join(` · `),e.device||e.ipPrefix?` · `:``,`Opened `,(0,Z.jsx)(Y,{value:e.createdAt}),` · Last seen`,` `,(0,Z.jsx)(Y,{value:e.lastSeenAt})]})]}),e.status===`active`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,disabled:s.busy,"data-sw-end-guest":e.name,onClick:()=>s.run(async()=>{await L.delete(`${a}/${e.id}`),i(`Ended ${e.name}`),await o.reload()}),children:`End this guest`}):null]},e.id))}):null,(0,Z.jsx)(H,{error:s.error}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted`,children:`Ending a guest signs that browser out at once; their comments stay. They can open the link again while it works: revoke the link to stop everyone.`})]})})}function Un({shares:e,onChanged:t,projectId:n}){let{workspaceId:r,data:i}=$(),a=F(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),d=!!i?.features?.guestSessions,f=N();return e.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-share-list":!0,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-5 md:grid-cols-[1.6fr_1fr_1fr_auto] md:items-center`,"data-sw-share":e.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(Vn,{mode:e.mode}),e.includeChecks?(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:`Checks included`}):null,e.passcode?(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ge,{size:11,"aria-hidden":`true`}),` Passcode`]}):null,e.status===`active`?null:(0,Z.jsx)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`revoked`?`Revoked`:`Expired`})]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-muted`,children:[`By `,e.createdBy?e.createdBy.displayName||`@${e.createdBy.handle}`:`unknown`,` ·`,` `,(0,Z.jsx)(Y,{value:e.createdAt})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Opened `,e.opens,` `,e.opens===1?`time`:`times`]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`Last `,(0,Z.jsx)(Y,{value:e.lastUsedAt,empty:`never`})]})]}),(0,Z.jsx)(`div`,{className:`text-xs text-muted`,children:e.status===`revoked`?(0,Z.jsx)(Y,{value:e.revokedAt,prefix:`Revoked `}):(0,Z.jsx)(Y,{value:e.expiresAt,prefix:e.status===`expired`?`Expired `:`Expires `})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-end`,children:[d&&(n||e.projectId)?(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:()=>l(e),className:`lg:h-8`,"data-sw-share-guests":e.name,children:[(0,Z.jsx)(hn,{size:14,"aria-hidden":`true`}),` Guests`]}):null,e.status===`active`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>s(e),className:`lg:h-8`,"data-sw-revoke-share":e.name,children:`Revoke`}):null]})]},e.id))}),(0,Z.jsx)(z,{open:!!o,onClose:()=>s(null),title:`Revoke "${o?.name}"?`,confirmLabel:`Revoke link`,tone:`danger`,busy:f.busy,error:f.error,onConfirm:()=>f.run(async()=>{await L.delete(q(r,`/projects/${n||o.projectId}/shares/${o.id}`)),s(null),a(`Share link revoked`),await t()}),children:(0,Z.jsx)(`p`,{children:`The link stops working at once, including for anyone who has the board open now. Their comments stay.`})}),c?(0,Z.jsx)(Hn,{share:c,projectId:n||c.projectId,onClose:()=>l(null)}):null]}):(0,Z.jsx)(_,{icon:Rt,title:`No share links`,children:`Share links let people outside the workspace see this project's boards, and comment as guests if you allow it.`})}function Wn({open:e,onClose:t,project:n,onCreated:r}){let{workspaceId:i,data:a}=$(),o=a.features.shareDays,[s,c]=(0,Q.useState)(``),[l,d]=(0,Q.useState)(`view`),[f,p]=(0,Q.useState)(`7`),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),{run:v,busy:y,error:b,setError:x}=N(),[S,C]=he(e,()=>{c(``),d(`view`),p(`7`),h(``),_(!1),x(null)});return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:y,result:S,title:`Share ${n.name}`,resultTitle:`Share link created`,doneProps:{"data-sw-share-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(U,{tone:`warn`,title:`Copy it now: it is shown once`,children:[`Anyone with this link`,e.share.passcode?` and the passcode`:``,` can`,` `,e.share.mode===`comment`?`see and comment on`:`see`,` this project's boards until `,(0,Z.jsx)(Y,{value:e.share.expiresAt}),`.`,e.share.passcode?` Send the passcode separately.`:``]}),(0,Z.jsx)(Ue,{value:e.url,testId:`share`})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v(async()=>{let e=await L.post(q(i,`/projects/${n.id}/shares`),{name:s,mode:l,expiresInDays:Number(f),includeChecks:g,...m?{passcode:m}:{}});C(e),await r?.()})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsx)(V,{label:`Name`,hint:`For you: who it is for. Guests do not see it.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:s,onChange:e=>c(e.target.value),maxLength:60,placeholder:`For the agency`,"data-sw-share-label":!0})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-[13px] font-medium text-fg`,children:`Guests can`}),(0,Z.jsx)(de,{label:`Guests can`,value:l,onChange:d,className:`w-full`,itemClassName:`h-11 px-3 lg:h-9`,options:[{id:`view`,label:`View`},{id:`comment`,label:`View and comment`}]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted`,children:l===`comment`?`Guests add comments and replies, signed "<name> (guest)". They cannot resolve, edit or delete, and their @mentions do nothing.`:`Guests see the boards and comments, and change nothing.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(oe,{size:`touch`,pressed:g,onPressedChange:_,"data-sw-share-checks":!0,children:`Include page checks`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:g?`Guests can read every retained check report in this project, including history, metrics and findings. Revoking this link ends access.`:`Check reports stay private. Turn this on only when guests should see metrics, findings and report history.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Expires after`,children:e=>(0,Z.jsxs)(j,{value:f,onValueChange:p,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-share-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:o.map(e=>(0,Z.jsx)(A,{value:String(e),children:Oe(e)},e))})]})}),(0,Z.jsx)(V,{label:`Passcode (optional)`,hint:`4 to 64 characters.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,type:`password`,value:m,onChange:e=>h(e.target.value),maxLength:64,autoComplete:`new-password`,"data-sw-share-passcode-input":!0})})]}),(0,Z.jsx)(H,{error:b}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:y,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:y||m&&m.length<4,className:`lg:h-10`,"data-sw-share-create":!0,children:[y?(0,Z.jsx)(w,{}):null,` Create link`]})]})]})})}function Gn({isAdmin:e}){let{workspaceId:t}=$();return(0,Z.jsx)(U,{tone:`info`,title:`Share links are off in this workspace`,action:e?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-8`,children:(0,Z.jsx)(P,{to:`/w/${t}/settings`,children:`Settings`})}):null,children:`An admin turns them on in Settings. Then you can share a project with people outside the workspace.`})}var Kn={active:`ok`,inactive:`warn`,revoked:`neutral`,expired:`neutral`},qn={inactive:`Inactive`,revoked:`Revoked`,expired:`Expired`},Jn=[`read`,`reply`,`status`,`resolve`],Yn=[[`never`,`No expiry`,null],[`30`,`30 days`,30],[`90`,`90 days`,90],[`365`,`1 year`,365]];function Xn(){let{workspaceId:e,data:t}=$(),n=I(q(e,`/tokens`)),[r,i]=(0,Q.useState)(`active`),[a,o]=(0,Q.useState)(!1),s=n.data?.tokens||[],c=s.filter(e=>r===`all`?!0:r===`active`?e.status===`active`:e.status!==`active`),l=s.filter(e=>e.status===`inactive`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`API tokens`,description:`Tokens let the CLI, CI and agents push captures and work on comments in one project.`,actions:(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>o(!0),className:`lg:h-9`,disabled:!t.projects.length,"data-sw-new-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New token`]})}),l.length?(0,Z.jsx)(U,{tone:`warn`,className:`mb-4`,title:`${l.length} ${l.length===1?`token stopped`:`tokens stopped`} working`,children:`A token works only while the person who made it is an admin or owner here. These were kept when their maker left or lost the admin role, and work again only if they come back as an admin. Revoke them, and make new ones where needed.`}):null,(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(de,{label:`Show tokens`,value:r,onChange:i,className:`w-full sm:inline-flex sm:w-auto`,itemClassName:`h-11 px-3 lg:h-8`,options:[{id:`active`,label:`Active`,count:s.filter(e=>e.status===`active`).length},{id:`inactive`,label:`Not working`,count:s.filter(e=>e.status!==`active`).length},{id:`all`,label:`All`,count:s.length}]})}),(0,Z.jsxs)(R,{children:[n.loading?(0,Z.jsx)(W,{}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,!n.loading&&!n.error?c.length?(0,Z.jsx)(Qn,{tokens:c,onChanged:n.reload,showProject:!0}):(0,Z.jsx)(_,{icon:qe,title:r===`active`?`No active tokens`:`Nothing here`,children:t.projects.length?`Make a token for a project to push captures or let an agent read comments.`:`Create a project first.`}):null]}),(0,Z.jsx)($n,{open:a,onClose:()=>o(!1),projects:t.projects,onCreated:n.reload})]})}function Zn({scopes:e}){return(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map(e=>(0,Z.jsx)(T,{tone:e===`push`?`warn`:`neutral`,className:`px-1.5 py-0.5 text-[11px]`,children:e},e))})}function Qn({tokens:e,onChanged:t,showProject:n=!1}){let{workspaceId:r}=$(),i=F(),[a,o]=(0,Q.useState)(null),s=N(),[c,l]=(0,Q.useState)(null),d=N(),p=c?.name.trim()||``,m=()=>d.run(async()=>{await L.patch(q(r,`/projects/${c.token.projectId}/tokens/${c.token.id}`),{name:p}),l(null),i(`Token renamed`),await t()});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-token-list":!0,children:e.map(e=>(0,Z.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-5 md:grid-cols-[1.6fr_1fr_1fr_auto] md:items-center`,"data-sw-token":e.name,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsxs)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 font-mono text-[11px] text-muted`,children:[e.prefix,`…`]}),e.status===`active`?null:(0,Z.jsx)(T,{tone:Kn[e.status],className:`px-2 py-0.5 text-[11px]`,children:qn[e.status]||e.status})]}),(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted`,children:[n?(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.projectName}):null,(0,Z.jsx)(Zn,{scopes:e.scopes})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`By `,e.createdBy?e.createdBy.displayName||`@${e.createdBy.handle}`:`unknown`,` `,e.createdBy?.left?(0,Z.jsxs)(T,{tone:`warn`,className:`ml-1 px-1.5 py-0.5 text-[10.5px]`,"data-sw-token-orphan":!0,children:[(0,Z.jsx)(ke,{size:10,"aria-hidden":`true`}),` Left the workspace`]}):e.status===`inactive`?(0,Z.jsxs)(T,{tone:`warn`,className:`ml-1 px-1.5 py-0.5 text-[10.5px]`,"data-sw-token-orphan":!0,children:[(0,Z.jsx)(ke,{size:10,"aria-hidden":`true`}),` No longer an admin`]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`Made `,(0,Z.jsx)(Y,{value:e.createdAt})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{children:[`Last used `,(0,Z.jsx)(Y,{value:e.lastUsedAt,empty:`never`})]}),(0,Z.jsx)(`p`,{className:`mt-0.5`,children:e.expiresAt?(0,Z.jsx)(Y,{value:e.expiresAt,prefix:e.status===`expired`?`Expired `:`Expires `}):`No expiry`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 md:justify-end`,children:[e.status===`active`||e.status===`inactive`?(0,Z.jsxs)(u,{size:`touch`,onClick:()=>{d.setError(null),l({token:e,name:e.name})},className:`lg:h-8`,"data-sw-rename-token":e.name,children:[(0,Z.jsx)(_t,{size:13,"aria-hidden":`true`}),` Rename`]}):null,e.status===`active`||e.status===`inactive`?(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>o(e),className:`lg:h-8`,"data-sw-revoke-token":e.name,children:`Revoke`}):null]})]},e.id))}),(0,Z.jsx)(z,{open:!!a,onClose:()=>o(null),title:`Revoke "${a?.name}"?`,confirmLabel:`Revoke token`,tone:`danger`,busy:s.busy,error:s.error,onConfirm:()=>s.run(async()=>{await L.delete(q(r,`/projects/${a.projectId}/tokens/${a.id}`)),o(null),i(`Token revoked`),await t()}),children:(0,Z.jsx)(`p`,{children:`Anything using it (CI, an agent, a teammate's machine) stops working at once. This cannot be undone.`})}),(0,Z.jsx)(f,{open:!!c,onClose:()=>d.busy?null:l(null),title:`Rename token`,description:`An agent that uses this token signs its replies with this name.`,wrapDescription:!0,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:()=>l(null),disabled:d.busy,children:`Cancel`}),(0,Z.jsx)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:m,disabled:d.busy||!p||p===c?.token.name,"data-sw-rename-token-save":!0,children:d.busy?`Saving...`:`Save`})]}),children:(0,Z.jsxs)(`form`,{className:`space-y-2 p-5`,onSubmit:e=>{e.preventDefault(),p&&p!==c?.token.name&&!d.busy&&m()},children:[(0,Z.jsx)(`label`,{htmlFor:`sw-rename-token`,className:`block text-xs font-medium text-fg`,children:`Name`}),(0,Z.jsx)(M,{id:`sw-rename-token`,size:`touch`,className:`lg:h-9`,value:c?.name||``,maxLength:60,onChange:e=>l(t=>t&&{...t,name:e.target.value}),"data-sw-rename-token-input":!0}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`What it already wrote keeps the old name. The token itself, its scopes and its expiry do not change.`}),d.error?(0,Z.jsx)(`p`,{className:`text-sm text-bad`,role:`alert`,children:d.error}):null]})})]})}function $n({open:e,onClose:t,projects:n,projectId:r=null,onCreated:i,defaultScopes:a=Jn}){let{workspaceId:o}=$(),[s,c]=(0,Q.useState)(r||``),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(a),[m,h]=(0,Q.useState)(`90`),{run:g,busy:_,error:v,setError:y}=N(),[b,x]=he(e,()=>{c(r||n[0]?.id||``),d(``),p(a),h(`90`),y(null)}),S=e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),C=(0,Q.useMemo)(()=>n.find(e=>e.id===s)?.name,[n,s]);return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:_,result:b,title:`New API token`,resultTitle:`Token created`,doneProps:{"data-sw-token-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{tone:`warn`,title:`Copy it now: it is shown once`,children:`Store it as SHAPEWALL_TOKEN in an environment variable or your CI secrets, never in a repository.`}),(0,Z.jsx)(Ue,{value:e.token,testId:`token`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{className:`mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted`,children:[(0,Z.jsx)(it,{size:13,"aria-hidden":`true`}),` Push from your project folder (this command includes the token)`]}),(0,Z.jsx)(Ue,{value:`SHAPEWALL_TOKEN=${e.token} shapewall push --remote ${Le()}`,testId:`token-command`}),(0,Z.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`On your own machine, `,(0,Z.jsxs)(`code`,{className:`font-mono text-fg`,children:[`shapewall login --remote `,Le()]}),` makes and stores a token for you instead.`]})]})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g(async()=>{let e=Yn.find(([e])=>e===m)[2],t=await L.post(q(o,`/projects/${s}/tokens`),{name:l,scopes:f,...e?{expiresInDays:e}:{}});x(t),await i?.()})},className:`space-y-4 px-5 py-4`,children:[r?null:(0,Z.jsx)(V,{label:`Project`,children:e=>(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-token-project":!0,children:(0,Z.jsx)(O,{placeholder:`Pick a project`})}),(0,Z.jsx)(E,{children:n.map(e=>(0,Z.jsx)(A,{value:e.id,children:e.name},e.id))})]})}),(0,Z.jsx)(V,{label:`Name`,hint:`Where it is used, like GitHub Actions or Ada's agent.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:l,onChange:e=>d(e.target.value),maxLength:60,placeholder:`CI`,"data-sw-token-name":!0})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsxs)(`legend`,{className:`mb-1.5 block text-[13px] font-medium text-fg`,children:[`What it can do`,C?` in ${C}`:``]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:We.map(([e,t,n])=>(0,Z.jsxs)(oe,{pressed:f.includes(e),onPressedChange:()=>S(e),size:`touch`,className:`h-auto min-h-11 w-full flex-col items-start justify-center gap-0 px-3 py-2 text-left whitespace-normal`,"data-sw-scope":e,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:t}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-muted`,children:n})]},e))})]}),(0,Z.jsx)(V,{label:`Expires`,children:e=>(0,Z.jsxs)(j,{value:m,onValueChange:h,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full sm:w-56`,...e,"data-sw-token-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Yn.map(([e,t])=>(0,Z.jsx)(A,{value:e,children:t},e))})]})}),(0,Z.jsx)(H,{error:v}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:_,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:_||!l.trim()||!f.length||!s,className:`lg:h-10`,"data-sw-token-create":!0,children:[_?(0,Z.jsx)(w,{}):null,` Create token`]})]})]})})}var er=[[`dailyClaims`,`Runs per day (UTC)`,1e4,50],[`maxOpenClaims`,`Runs in progress at once`,100,3],[`dailyTurns`,`Chat turns per day (UTC)`,1e5,200]];function tr({workspaceId:e,projectId:t}){let n=q(e,`/projects/${t}/agent`),r=I(n);return(0,Z.jsxs)(R,{"data-sw-agent-policy":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agent policy`,description:`Who can send comments to an agent in this project, and how much the agent may run.`}),r.loading?(0,Z.jsx)(W,{}):r.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:r.error,onRetry:r.reload})}):r.data?(0,Z.jsx)(nr,{policy:r.data.policy,url:n,onSaved:r.reload},JSON.stringify(r.data.policy)):null]})}function nr({policy:e,url:t,onSaved:n}){let r=F(),[i,a]=(0,Q.useState)(e),[o,s]=(0,Q.useState)(e.trustedHandles.join(`, `)),[l,f]=(0,Q.useState)(()=>Object.fromEntries(er.map(([t,,,n])=>[t,String(e[t]??n)]))),[p,m]=(0,Q.useState)(JSON.stringify(e.boards||{},null,2)),h=N(),g=(e,t)=>a({...i,[e]:t}),_=(e,t)=>{let n=l[e].trim(),r=Number(n);return n!==``&&Number.isInteger(r)&&r>=0&&r<=t?null:`A whole number from 0 to ${t}.`},v=null;try{let e=JSON.parse(p);(!e||typeof e!=`object`||Array.isArray(e))&&(v=`This must be a JSON object, such as {}.`)}catch{v=`This is not valid JSON.`}let y=!!v||er.some(([e,,t])=>_(e,t));return(0,Z.jsxs)(`form`,{className:`space-y-4 px-4 py-4 sm:px-5`,onSubmit:e=>{e.preventDefault(),y||h.run(async()=>{await L.put(t,{...i,...Object.fromEntries(er.map(([e])=>[e,Number(l[e])])),trustedHandles:o.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),boards:JSON.parse(p)}),r(`Agent policy saved`),await n()})},noValidate:!0,children:[(0,Z.jsx)(V,{label:`Trusted handles (comma separated)`,hint:`People whose comments go to the agent, besides the roles below.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:o,onChange:e=>s(e.target.value),autoCapitalize:`none`,spellCheck:!1,placeholder:`ada, sam`})}),(0,Z.jsxs)(`fieldset`,{children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-ui font-medium text-fg`,children:`Trusted roles`}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`member`,`admin`,`owner`].map(e=>(0,Z.jsx)(Be,{checked:i.trustedRoles.includes(e),onChange:t=>g(`trustedRoles`,t?[...i.trustedRoles,e]:i.trustedRoles.filter(t=>t!==e)),children:B[e]||e},e))})]}),(0,Z.jsx)(`div`,{className:`grid items-start gap-4 sm:grid-cols-2`,children:er.map(([e,t,n])=>(0,Z.jsx)(V,{label:t,hint:e===`dailyTurns`?`0 stops chat with connected agents.`:`0 stops new runs.`,error:_(e,n),children:t=>(0,Z.jsx)(M,{...t,size:`touch`,type:`number`,inputMode:`numeric`,min:`0`,max:n,value:l[e],onChange:t=>f({...l,[e]:t.target.value})})},e))}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Be,{checked:i.onlyMentions,onChange:e=>g(`onlyMentions`,e),children:`Only comments that mention @agent`}),(0,Z.jsx)(Be,{checked:i.approveNonAdmin,onChange:e=>g(`approveNonAdmin`,e),children:`An admin approves runs that other people ask for`})]}),(0,Z.jsxs)(c,{defaultOpen:Object.keys(e.boards||{}).length>0,children:[(0,Z.jsx)(ce,{className:`-mx-2 w-auto`,"data-sw-agent-overrides-toggle":!0,children:`Advanced: different rules for one board`}),(0,Z.jsx)(d,{children:(0,Z.jsx)(`div`,{className:`pt-2`,children:(0,Z.jsx)(V,{label:`Per-board rules (JSON)`,hint:`Keyed by board id. Leave it as {} unless one board needs different rules from the project.`,error:v,children:e=>(0,Z.jsx)(le,{...e,size:`touch`,className:`font-mono lg:text-sm`,rows:4,spellCheck:!1,value:p,onChange:e=>m(e.target.value)})})})})]}),(0,Z.jsx)(U,{children:`The agent never acts on guest comments or its own comments. Editing a comment clears its approval.`}),(0,Z.jsx)(H,{error:h.error}),(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,className:`lg:h-9`,disabled:h.busy||y,children:[h.busy?(0,Z.jsx)(w,{}):null,` Save agent policy`]})})]})}var rr=`https://shapewall.com/docs/hosted#agents-on-a-hosted-board`,ir={online:`Online`,busy:`Working`,offline:`Offline`,revoked:`Revoked`},ar={online:`ok`,busy:`accent`,offline:`neutral`,revoked:`neutral`},or={watcher:`Watcher (shapewall watch)`,claude:`Claude Code`,codex:`Codex`,goose:`goose`,gemini:`Gemini CLI`,custom:`Another program`},sr=[[`owner`,`Only the person who connected it`,`The default for a new agent.`],[`members`,`Named members`,`The person who connected it, and the people you choose.`],[`trusted`,`Everyone this project's agent policy trusts`,`The team case: whoever may send work to an agent here may use this one.`]],cr=[`read`,`reply`,`status`,`claim`],lr=e=>e?.approval?.mode||`none`,ur={none:`reads and answers only (no edits, no commands)`,ask:`makes fixes on a branch, each edit allowed by a person`,auto:`makes fixes on a branch, allowed without asking`},dr={none:`Reads and answers`,ask:`Edits on a branch, asking every time`,auto:`Edits on a branch, allowed without asking`},fr=e=>[e.includes(`edits`)?`edits`:null,e.includes(`commands`)?`the listed commands`:null].filter(Boolean).join(` and `),pr=e=>[`edits`,`commands`].filter(t=>e?.approval?.rules?.[t]===`auto`),mr=e=>e?.approval?.machine?.approvals===`owner`?`Only ${e.createdBy?yr(e.createdBy):`the person who connected it`} answers`:`${B[e?.approval?.answerRole||`admin`]}s and up answer`,hr=`shapewall agent connect --approvals owner --auto edits`;function gr(e){return!e||e.approval.autoAvailable?null:e.link?.connected?e.approval.machine.approvals===`none`?`${e.name}'s machine takes no approvals from the board, so there is nothing to allow. This is switched on on the agent's machine, never from here.`:`${e.name}'s machine did not say anything may go without asking. This is switched on on the agent's machine, never from here.`:`This agent takes comments on its own and asks before each command. Nothing here can go without asking.`}function _r({agent:e}){let t=e.approval.machine,n=[[`Approvals from the board`,t.approvals===`none`?`None. It reads and answers only.`:t.approvals===`owner`?`Only ${e.createdBy?yr(e.createdBy):`the person who connected it`} may answer.`:`Admins of this project may answer.`,`approvals`,t.approvals],[`Commands it may ask to run`,t.commands.length?null:t.approvals===`none`?`None.`:`None. It only asks to edit files.`,`commands`,String(t.commands.length)],[`May go without asking`,t.auto.length?`${fr(t.auto).replace(/^./,e=>e.toUpperCase())}, when the rule below says so.`:`Nothing.`,`auto`,t.auto.join(`,`)||`none`]];return(0,Z.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-machine":t.approvals,children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold text-fg`,children:[(0,Z.jsx)(It,{size:13,"aria-hidden":`true`}),` Set on the agent's machine`]}),(0,Z.jsx)(`dl`,{className:`mt-2 space-y-2 text-xs`,children:n.map(([e,n,r,i])=>(0,Z.jsxs)(`div`,{className:`grid gap-x-3 gap-y-0.5 sm:grid-cols-[11rem_1fr]`,"data-sw-agent-machine-fact":r,"data-value":i,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Z.jsxs)(`dd`,{className:`min-w-0 text-fg`,children:[n,r===`commands`&&t.commands.length?(0,Z.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:t.commands.map(e=>(0,Z.jsx)(`li`,{className:`max-w-full`,children:(0,Z.jsx)(`code`,{className:`block truncate rounded border border-line bg-surface px-1.5 py-0.5 font-mono text-[11px]`,children:e})},e))}):null]})]},r))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-xs text-muted`,children:[`These are read from the machine each time it connects. Change them there with`,` `,(0,Z.jsx)(`code`,{className:`font-mono`,children:`shapewall agent connect`}),`; nothing on this page can widen them.`]})]})}function vr({agent:e}){let t=e.link;return t?.connected?(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,"data-sw-agent-link":t.connectedAt?`open`:`closed`,children:[(0,Z.jsx)(`span`,{className:`text-fg`,children:`Connected agent.`}),` `,t.chats?`Chats on the board`:`No chat`,`, `,ur[lr(e)],t.connectedAt?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· connected since `,(0,Z.jsx)(`time`,{dateTime:t.connectedAt,children:Ie(t.connectedAt)})]}):` · link closed`,t.version?` · Shapewall ${t.version}`:``,t.policy?.audience===`owner`?` · its machine takes questions from its connector only`:``]}):null}var yr=e=>e?.displayName||(e?.handle?`@${e.handle}`:`someone who left`);function br({agent:e}){return(0,Z.jsx)(T,{tone:ar[e.state]||`neutral`,className:`px-2 py-0.5 text-[11px]`,"data-sw-agent-state":e.state,children:ir[e.state]||e.state})}function xr({agent:e}){return e.state===`online`||e.state===`busy`?(0,Z.jsx)(`span`,{children:`Listening now`}):e.lastSeenAt?(0,Z.jsx)(Y,{value:e.lastSeenAt,prefix:`Last seen `}):(0,Z.jsx)(`span`,{children:`Never connected`})}function Sr({agent:e,size:t=`lg`}){return(0,Z.jsx)(ee,{label:e.name,icon:e.icon,tint:e.tint,logo:e.logo,size:t})}function Cr(){let{workspaceId:e,data:t}=$(),n=I(q(e,`/agents`)),r=(n.data?.agents||[]).filter(e=>e.state!==`revoked`),i=new Set(r.map(e=>e.projectId)),a=t.projects.filter(e=>!i.has(e.id));return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Agents`,description:`Every agent in this workspace, the project each one serves and who may send it work.`}),(0,Z.jsxs)(R,{"data-sw-agents-overview":!0,children:[n.loading?(0,Z.jsx)(W,{}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,n.data&&!n.error?r.length?(0,Z.jsxs)(`div`,{role:`table`,"aria-label":`Agents in this workspace`,children:[(0,Z.jsxs)(`div`,{role:`row`,className:`hidden gap-3 border-b border-line px-5 py-2 text-xs font-medium text-muted md:grid md:grid-cols-[1.5fr_1fr_1fr_1.4fr_1fr_auto]`,children:[(0,Z.jsx)(`span`,{role:`columnheader`,children:`Agent`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Project`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`State`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Who may send it work`}),(0,Z.jsx)(`span`,{role:`columnheader`,children:`Connected by`}),(0,Z.jsx)(`span`,{role:`columnheader`,className:`w-20 text-right`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Manage`})})]}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:r.map(t=>(0,Z.jsxs)(`li`,{role:`row`,className:`grid gap-2 px-4 py-3 text-sm sm:px-5 md:grid-cols-[1.5fr_1fr_1fr_1.4fr_1fr_auto] md:items-center md:gap-3`,"data-sw-overview-agent":t.name,"data-sw-overview-project":t.projectName,children:[(0,Z.jsxs)(`div`,{role:`cell`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(Sr,{agent:t,size:`md`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:t.name}),t.isDefault?(0,Z.jsx)(T,{tone:`neutral`,className:`shrink-0 px-1.5 py-0.5 text-[10.5px]`,children:`Default`}):null]}),(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted`,"data-sw-overview-kind":t.kind,children:[or[t.kind]||t.kind,t.machine?` on ${t.machine}`:``,t.link?.connected&&t.link.chats?` · chats`:``]})]})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 truncate text-fg`,children:[(0,Z.jsx)(`span`,{className:`mr-1 text-xs text-muted md:hidden`,children:`Project:`}),t.projectName]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted md:block`,children:[(0,Z.jsx)(br,{agent:t}),(0,Z.jsx)(`p`,{className:`md:mt-0.5`,children:t.link?.connectedAt?(0,Z.jsxs)(`span`,{"data-sw-overview-connected":!0,children:[`since `,(0,Z.jsx)(`time`,{dateTime:t.link.connectedAt,children:Ie(t.link.connectedAt)})]}):(0,Z.jsx)(xr,{agent:t})})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 text-xs text-muted`,"data-sw-overview-audience":t.audience.kind,children:[(0,Z.jsx)(`span`,{className:`mr-1 md:hidden`,children:`Takes work from:`}),(0,Z.jsx)(`span`,{className:`text-fg`,children:t.audience.text})]}),(0,Z.jsxs)(`div`,{role:`cell`,className:`min-w-0 truncate text-xs text-muted`,children:[(0,Z.jsx)(`span`,{className:`mr-1 md:hidden`,children:`Connected by`}),yr(t.createdBy)]}),(0,Z.jsx)(`div`,{role:`cell`,className:`md:w-20 md:text-right`,children:(0,Z.jsx)(P,{to:`/w/${e}/agents/${t.projectId}`,className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,"aria-label":`Manage ${t.name} in ${t.projectName}`,"data-sw-overview-manage":t.name,children:`Manage`})})]},t.id))})]}):(0,Z.jsx)(_,{icon:s,title:`No agents yet`,children:t.projects.length?`Open a project below to connect a machine that has its code.`:`Create a project first, then connect a machine that has its code.`}):null]}),n.data&&a.length?(0,Z.jsxs)(R,{className:`mt-5`,"data-sw-agents-without":!0,children:[(0,Z.jsx)(G,{icon:Xe,title:`Projects without an agent`,description:`Comments sent to an agent in these projects wait until one is connected.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:a.map(t=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm sm:px-5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:t.name}),(0,Z.jsx)(P,{to:`/w/${e}/agents/${t.id}`,className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,"data-sw-overview-connect":t.name,children:`Connect an agent`})]},t.id))})]}):null]})}function wr({projectId:e}){let{workspaceId:t,data:n,role:r}=$(),i=n.projects.find(t=>t.id===e),a=q(t,`/projects/${e}/agents`),o=I(i?a:null),c=F(),[l,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=N(),S=N();if((0,Q.useEffect)(()=>{let e=window.setInterval(()=>{document.visibilityState===`visible`&&o.reload()},2e4);return()=>window.clearInterval(e)},[o.reload]),!i)return(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Project not found`}),(0,Z.jsx)(P,{to:`/w/${t}/agents`,className:`mt-3 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to agents`})]});let C=o.data?.agents||[],w=C.filter(e=>e.state!==`revoked`),E=C.filter(e=>e.state===`revoked`),ee=n=>x.run(async()=>{await L.put(q(t,`/projects/${e}/default-agent`),{agentId:n?n.id:null}),c(n?`${n.name} is the default agent`:`No default agent: any agent takes new comments`),await o.reload()}),D=n=>q(t,`/projects/${e}/agents/${n.id}`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/w/${t}/agents`,className:`mb-3 inline-flex h-11 items-center gap-1.5 rounded-md text-sm text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent lg:h-8`,children:[(0,Z.jsx)(wt,{size:15,"aria-hidden":`true`}),` All agents`]}),(0,Z.jsx)(we,{title:`Agents of ${i.name}`,description:`The coding agents of this project: the ones members chat with on the board, and the ones that pick up comments. Each runs where the code is; this server never runs an agent.`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,className:`lg:h-9`,children:(0,Z.jsx)(P,{to:`/w/${t}/projects/${e}`,children:`Project page`})})}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[(0,Z.jsxs)(R,{"data-sw-project-agents":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agents`,description:`The default agent is the one Send to agent names, and where a trusted member's new comment goes. Without one, any agent takes it.`}),o.loading?(0,Z.jsx)(W,{}):null,o.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:o.error,onRetry:o.reload})}):null,o.data&&!o.error?w.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:w.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-3 px-4 py-4 sm:px-5`,"data-sw-agent-row":e.name,"data-sw-agent-id":e.id,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Z.jsx)(Sr,{agent:e}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem]`,children:[(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:e.name}),(0,Z.jsx)(br,{agent:e}),e.isDefault?(0,Z.jsxs)(T,{tone:`accent`,className:`px-2 py-0.5 text-[11px]`,"data-sw-agent-default":!0,children:[(0,Z.jsx)(sn,{size:10,"aria-hidden":`true`}),` Default`]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[or[e.kind]||e.kind,e.machine?` on ${e.machine}`:``,` · `,(0,Z.jsx)(xr,{agent:e}),` · connected by`,` `,yr(e.createdBy)]}),(0,Z.jsx)(vr,{agent:e}),e.counts.working||e.counts.queued?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,"data-sw-agent-counts":!0,children:[e.counts.working?`working on ${e.counts.working}`:null,e.counts.queued?`${e.counts.queued} waiting for it`:null].filter(Boolean).join(`, `)}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsxs)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>d(e),"data-sw-agent-edit":e.name,children:[(0,Z.jsx)(_t,{size:13,"aria-hidden":`true`}),` Edit`]}),e.isDefault?(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,disabled:x.busy,onClick:()=>ee(null),"data-sw-agent-undefault":e.name,children:`Not the default`}):(0,Z.jsxs)(u,{size:`touch`,className:`lg:h-8`,disabled:x.busy,onClick:()=>ee(e),"data-sw-agent-make-default":e.name,children:[(0,Z.jsx)(sn,{size:13,"aria-hidden":`true`}),` Make default`]}),(0,Z.jsx)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,onClick:()=>{S.setError(null),v(e)},"data-sw-agent-revoke":e.name,children:`Revoke`})]})]}),(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-audience":e.audience.kind,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,Z.jsx)(hn,{size:13,"aria-hidden":`true`}),` `,e.link?.connected?`Who may use it`:`Who may send it work`]}),(0,Z.jsxs)(`dd`,{className:`mt-1 text-muted`,children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[e.audience.text,`.`]}),` `,e.audience.inherited?`Kept from before 0.4.0, when the agent policy alone decided, so nothing changed on upgrade. New agents start with only the person who connected them.`:e.audience.kind===`trusted`?``:`They must also be trusted by this project's agent policy (on the project page).`]}),(0,Z.jsx)(`dd`,{className:`mt-2`,children:(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>p(e),"data-sw-agent-audience-edit":e.name,children:`Change`})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-line bg-surface-2/50 p-3`,"data-sw-agent-approval":e.approval.effectiveRule,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,Z.jsx)(Te,{size:13,"aria-hidden":`true`}),` Approvals`]}),(0,Z.jsx)(`dd`,{className:`mt-1 text-muted`,"data-sw-agent-mode":e.link?.connected?lr(e):`watch`,children:e.link?.connected?lr(e)===`none`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.none,`.`]}),` Nothing to approve: its machine takes no edits or commands from the board. That is switched on on the machine itself.`]}):lr(e)===`auto`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.auto,`.`]}),` Applies to `,fr(pr(e)),`. Anything else waits for an answer on the board.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`text-fg`,children:[dr.ask,`.`]}),` `,mr(e),`.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-fg`,children:`Ask every time.`}),` It asks before each command it runs for a comment.`,` `,B[e.approval.answerRole],`s and up answer; `,B[e.approval.changeRole].toLowerCase(),`s and up change this rule.`]})}),(0,Z.jsx)(`dd`,{className:`mt-2`,children:(0,Z.jsx)(u,{size:`touch`,className:`lg:h-8`,onClick:()=>h(e),"data-sw-agent-approval-edit":e.name,children:`Change`})})]})]})]},e.id))}):(0,Z.jsx)(_,{icon:s,title:`No agent is connected to this project`,children:`Comments sent to an agent wait here until one is. Connect one below.`}):null,(0,Z.jsx)(`div`,{className:`px-4 pb-3 sm:px-5`,children:(0,Z.jsx)(H,{error:x.error})})]}),(0,Z.jsx)(Tr,{project:i,onNewToken:()=>b(!0)}),E.length?(0,Z.jsxs)(R,{"data-sw-agents-revoked":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Revoked`,description:`These no longer work. Their replies on threads keep their names.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:E.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(Sr,{agent:e,size:`md`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-xs`,children:(0,Z.jsx)(xr,{agent:e})})]},e.id))})]}):null]}),(0,Z.jsx)(Er,{agent:l,kinds:o.data?.options?.kinds||Object.keys(or),url:l?D(l):null,onClose:()=>d(null),onSaved:async()=>{c(`Agent saved`),await o.reload()}}),(0,Z.jsx)(Dr,{agent:f,members:o.data?.members||[],url:f?`${D(f)}/audience`:null,onClose:()=>p(null),onSaved:async()=>{c(`Audience saved`),await o.reload()}}),(0,Z.jsx)(kr,{agent:m,role:r,url:m?`${D(m)}/approval`:null,onClose:()=>h(null),onSaved:async()=>{c(`Approval settings saved`),await o.reload()}}),(0,Z.jsx)(z,{open:!!g,onClose:()=>v(null),title:`Revoke ${g?.name}?`,confirmLabel:`Revoke agent`,tone:`danger`,busy:S.busy,error:S.error,onConfirm:()=>S.run(async()=>{await L.delete(D(g)),v(null),c(`Agent revoked`),await o.reload()}),children:(0,Z.jsx)(`p`,{children:`Its token stops working at once, so the machine that uses it stops picking up comments. What it was working on and what waited for it go to any agent. This cannot be undone: connect it again with a new token.`})}),(0,Z.jsx)($n,{open:y,onClose:()=>b(!1),projects:n.projects,projectId:e,defaultScopes:cr,onCreated:o.reload})]})}function Tr({project:e,onNewToken:t}){let n=Le(),r=`flex gap-3`,i=`mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-surface-2 text-[11px] font-semibold text-fg`;return(0,Z.jsxs)(R,{"data-sw-connect-agent":!0,children:[(0,Z.jsx)(G,{icon:Xe,title:`Connect an agent`,description:`On a machine that has the code of ${e.name}. The agent runs there; this server only passes messages.`,actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:t,"data-sw-connect-agent-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New agent token`]})}),(0,Z.jsxs)(`div`,{className:`space-y-2 border-b border-line px-4 py-4 text-sm text-muted sm:px-5`,"data-sw-connect-agent-chat":!0,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:`Chat with your coding agent on the board`}),(0,Z.jsxs)(`p`,{children:[`Run this in the project's folder, on the machine that has Claude Code, Codex or goose. It shows a code; approve it on`,` `,(0,Z.jsx)(P,{to:`/device`,className:`font-medium text-accent underline-offset-2 hover:underline`,children:`the approval page`}),`, where you name the agent and choose who may use it.`]}),(0,Z.jsx)(Ue,{value:`shapewall agent connect --remote ${n}`,testId:`connect-agent`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`Members then chat with it from the board's Agents panel. It reads the project and answers; it does not change files or run commands. Leave it running (or run it as a service); Ctrl+C disconnects it.`})]}),(0,Z.jsx)(`p`,{className:`px-4 pt-4 text-sm font-medium text-fg sm:px-5`,children:`An agent that fixes comments`}),(0,Z.jsxs)(`ol`,{className:`space-y-4 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`1`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`Sign the machine in, in the project's folder.`}),(0,Z.jsx)(Ue,{value:`shapewall login --remote ${n}`,testId:`connect-login`}),(0,Z.jsxs)(`p`,{className:`text-xs`,children:[`Approve the code it shows, choose this project and tick `,(0,Z.jsx)(`strong`,{className:`font-medium text-fg`,children:`Take agent work`}),`. Or make a token here with New agent token and set it as SHAPEWALL_TOKEN on that machine.`]})]})]}),(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`2`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`Start watching, with the command that runs your coding agent.`}),(0,Z.jsx)(Ue,{value:`shapewall watch --remote ${n} --exec "<your agent command>"`,testId:`connect-watch`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`It runs your command once for each comment sent to it. Leave it running; Ctrl+C stops it.`})]})]}),(0,Z.jsxs)(`li`,{className:r,children:[(0,Z.jsx)(`span`,{className:i,children:`3`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,Z.jsx)(`p`,{className:`text-fg`,children:`It appears above as online.`}),(0,Z.jsx)(`p`,{className:`text-xs`,children:`Give it a name and an icon, and choose who may send it work: a new agent only takes comments from the person who connected it.`})]})]})]}),(0,Z.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-xs text-muted sm:px-5`,children:[(0,Z.jsxs)(`a`,{href:rr,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-accent underline-offset-2 hover:underline`,"data-sw-connect-agent-docs":!0,children:[`Agents on a hosted board `,(0,Z.jsx)(ge,{size:12,"aria-hidden":`true`})]}),` `,`has recipes for Claude Code, Codex and goose, and how to run it as a service.`]})]})}function Er({agent:e,kinds:t,url:n,onClose:r,onSaved:i}){let a=(0,Q.useId)(),[o,s]=(0,Q.useState)({name:``,icon:null,tint:null,png:null}),[c,l]=(0,Q.useState)(`watcher`),d=N();(0,Q.useEffect)(()=>{e&&(s({name:e.name,icon:e.icon||null,tint:e.tint||null,png:null}),l(e.kind),d.setError(null))},[e]);let p=o.name.trim(),m=gt(o.name)||(e&&!p?`Give it a name.`:null),h={claude:`claude`,codex:`openai`,goose:`goose`,gemini:`gemini`}[c]||null,g=e?{...p===e.name?{}:{name:p},...o.icon===(e.icon||null)?{}:{icon:o.icon},...o.tint===(e.tint||null)?{}:{tint:o.tint},...c===e.kind?{}:{kind:c}}:{},_=Object.keys(g).length>0;return(0,Z.jsx)(f,{open:!!e,onClose:()=>d.busy?null:r(),title:`Edit agent`,description:`How it is shown on boards. Its replies are signed with this name from now on; what it already wrote keeps the old one.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:d.busy,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:()=>d.run(async()=>{await L.patch(n,g),await i(),r()}),disabled:d.busy||!_||!!m,"data-sw-agent-edit-save":!0,children:[d.busy?(0,Z.jsx)(w,{}):null,` Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-edit-dialog":!0,children:[(0,Z.jsx)(dt,{id:`${a}-name`,value:o,onChange:s,touch:!0,problem:m,disabled:d.busy,hint:`Shown on boards, in Send to agent and on its replies.`}),(0,Z.jsx)(V,{label:`What runs behind it`,hint:`Only changes the default icon: a known program shows its mark.`,children:e=>(0,Z.jsxs)(j,{value:c,onValueChange:l,disabled:d.busy,children:[(0,Z.jsx)(k,{...e,size:`touch`,className:`w-full lg:h-9`,"data-sw-agent-kind":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:t.map(e=>(0,Z.jsx)(A,{value:e,"data-sw-agent-kind-option":e,children:or[e]||e},e))})]})}),(0,Z.jsx)(at,{value:o,onChange:s,label:p||e?.name||`Agent`,logo:h,upload:!1,disabled:d.busy}),(0,Z.jsx)(H,{error:d.error})]})})}function Dr({agent:e,members:t,url:n,onClose:r,onSaved:i}){let[a,o]=(0,Q.useState)(`owner`),[s,c]=(0,Q.useState)([]),l=N();(0,Q.useEffect)(()=>{e&&(o(e.audience.kind),c(e.audience.users.map(e=>e.userId)),l.setError(null))},[e]);let d=e?.createdBy?.userId||null,p=t.filter(e=>e.userId!==d),m=e=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,Z.jsx)(f,{open:!!e,onClose:()=>l.busy?null:r(),title:`Who may send work to ${e?.name||`this agent`}`,description:`Work sent to an agent runs on the machine of the person who connected it.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:l.busy,children:`Cancel`}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:()=>l.run(async()=>{await L.put(n,{audience:a,users:a===`members`?s:[]}),await i(),r()}),disabled:l.busy,"data-sw-agent-audience-save":!0,children:[l.busy?(0,Z.jsx)(w,{}):null,` Save`]})]}),children:(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-audience-dialog":!0,children:[(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":`Audience`,className:`space-y-2`,children:sr.map(([t,n,r])=>(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a===t,onClick:()=>o(t),disabled:l.busy,className:`flex min-h-11 w-full items-start gap-3 rounded-lg border px-3 py-2.5 text-left text-sm outline-none focus-visible:outline-2 focus-visible:outline-accent ${a===t?`border-accent/50 bg-accent/10`:`border-line hover:bg-surface-2`}`,"data-sw-agent-audience-option":t,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${a===t?`border-accent bg-accent text-accent-fg`:`border-line bg-surface`}`,"aria-hidden":`true`,children:a===t?(0,Z.jsx)(h,{size:11}):null}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`block font-medium text-fg`,children:t===`owner`&&e?.createdBy?`Only ${yr(e.createdBy)}`:n}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:r})]})]},t))}),a===`members`?(0,Z.jsxs)(`fieldset`,{"data-sw-agent-audience-members":!0,children:[(0,Z.jsx)(`legend`,{className:`mb-1.5 block text-ui font-medium text-fg`,children:`Members`}),p.length?(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:p.map(e=>(0,Z.jsx)(Be,{checked:s.includes(e.userId),onChange:()=>m(e.userId),children:(0,Z.jsxs)(`span`,{className:`min-w-0`,"data-sw-agent-audience-member":e.handle,children:[(0,Z.jsx)(`span`,{className:`block truncate`,children:e.displayName}),(0,Z.jsxs)(`span`,{className:`block truncate text-xs text-muted`,children:[`@`,e.handle,` · `,B[e.role],e.trusted?``:` · not trusted by the agent policy`]})]})},e.userId))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`Nobody else in this workspace can comment yet. Invite a member first.`})]}):null,(0,Z.jsx)(U,{children:`An audience only narrows who may use this agent. The project's agent policy still decides who may send work to an agent at all, and the machine that runs the agent has the last word. It also decides whose replies the agent reads. A comment the agent is already working on stays with it until it is done.`}),(0,Z.jsx)(H,{error:l.error})]})})}function Or({value:e,checked:t,disabled:n,onChoose:r,title:a,children:o,...s}){return(0,Z.jsxs)(`div`,{role:`radio`,"aria-checked":t?`true`:`false`,"aria-disabled":n?`true`:void 0,tabIndex:n?-1:0,onClick:n?void 0:()=>r(e),onKeyDown:n?void 0:t=>{(t.key===` `||t.key===`Enter`)&&(t.preventDefault(),r(e))},className:i(`flex items-start gap-3 rounded-lg border px-3 py-2.5 text-sm outline-none focus-visible:outline-2 focus-visible:outline-accent`,t?`border-accent/50 bg-accent/10`:`border-line`,n?t?``:`bg-surface-2/40`:`cursor-pointer hover:border-accent/50`),"data-sw-agent-approval-option":e,...s,children:[t?(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-accent bg-accent text-accent-fg`,children:(0,Z.jsx)(h,{size:11,"aria-hidden":`true`})}):(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-4 w-4 shrink-0 rounded-full border border-line bg-surface`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:i(`block font-medium`,n&&!t?`text-muted`:`text-fg`),children:a}),o]})]})}function kr({agent:e,role:t,url:n,onClose:r,onSaved:i}){let[a,o]=(0,Q.useState)(`ask`),[s,c]=(0,Q.useState)(`admin`),[l,d]=(0,Q.useState)(`admin`),p=N();(0,Q.useEffect)(()=>{e&&(o(e.approval.effectiveRule),c(e.approval.changeRole),d(e.approval.answerRole),p.setError(null))},[e]);let m=bn(t,e?{approvalChangeRole:e.approval.changeRole,approvalAnswerRole:e.approval.answerRole}:null),h=xn(t),g=gr(e),_=!!e?.link?.connected,v=lr(e),y=!m||p.busy,b=e?a!==e.approval.effectiveRule:!1,x=e?b||s!==e.approval.changeRole||l!==e.approval.answerRole:!1,S=()=>p.run(async()=>{await L.put(n,{...b?{rule:a}:{},...s===e.approval.changeRole?{}:{changeRole:s},...l===e.approval.answerRole?{}:{answerRole:l}}),await i(),r()}),C=(e,t,n)=>r=>(0,Z.jsxs)(j,{value:e,onValueChange:t,disabled:!h||p.busy,children:[(0,Z.jsx)(k,{...r,size:`touch`,className:`w-full lg:h-9`,"data-sw-agent-approval-role":n,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:`admin`,children:`Admins and owners`}),(0,Z.jsx)(A,{value:`owner`,children:`Owners only`})]})]}),T=e?fr(e.approval.machine.auto):``;return(0,Z.jsx)(f,{open:!!e,onClose:()=>p.busy?null:r(),title:`Approvals for ${e?.name||`this agent`}`,description:`Whether what the agent asks to do waits for a person, and who decides.`,wrapDescription:!0,size:`md`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{size:`touch`,className:`lg:h-9`,onClick:r,disabled:p.busy,children:h||m?`Cancel`:`Close`}),h||m?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,onClick:S,disabled:p.busy||!x,"data-sw-agent-approval-save":!0,children:[p.busy?(0,Z.jsx)(w,{}):null,` Save`]}):null]}),children:e?(0,Z.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-agent-approval-dialog":!0,children:[(0,Z.jsxs)(`p`,{className:`flex items-start gap-2 text-sm`,"data-sw-agent-approval-mode":_?v:`watch`,children:[(0,Z.jsx)(Te,{size:15,className:`mt-0.5 shrink-0 text-muted`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsx)(`span`,{className:`text-muted`,children:`Now: `}),(0,Z.jsxs)(`span`,{className:`font-medium text-fg`,children:[_?dr[v]:`Asks before each command`,`.`]}),` `,(0,Z.jsx)(`span`,{className:`text-muted`,children:_?v===`none`?`It makes no changes from the board.`:v===`auto`?`A fix is made on a branch on its machine. Without asking: ${fr(pr(e))}.`:`A fix is made on a branch on its machine, and each edit waits for an answer on the board.`:`It takes comments on its own (shapewall watch) and makes its changes where it runs.`})]})]}),_?(0,Z.jsx)(_r,{agent:e}):null,(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Approval rule`,className:`space-y-2`,children:[(0,Z.jsx)(Or,{value:`ask`,checked:a===`ask`,disabled:y,onChoose:o,title:`Ask every time`,children:(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,children:_&&v===`none`?`Once its machine takes edits from the board, each one waits for a person with the role below.`:e.approval.machine.approvals===`owner`?`Everything the agent asks to do waits for ${e.createdBy?yr(e.createdBy):`the person who connected it`}: its machine takes answers from nobody else.`:`Everything the agent asks to do waits for a person with the role below.`})}),(0,Z.jsx)(Or,{value:`auto`,checked:a===`auto`,disabled:y||!!g,onChoose:o,title:g?`Allow without asking (not available)`:`Allow without asking`,...g?{"data-sw-agent-approval-unavailable":!0}:{},children:g?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block text-xs text-muted`,"data-sw-agent-approval-why":!0,children:g}),_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`mt-1.5 block text-xs text-muted`,children:`To allow it, run this on the agent's machine, in the project's folder:`}),(0,Z.jsx)(Ue,{value:hr,testId:`approval-auto`,className:`mt-1`})]}):null]}):(0,Z.jsxs)(`span`,{className:`block text-xs text-muted`,"data-sw-agent-approval-applies":!0,children:[`Applies to `,T,`, as its machine allows. Files that run something (settings, scripts, tests, CI) and anything else still wait for an answer. A fix is always made on a branch, and one made without asking is not pushed until someone looks at its whole diff on the board.`,e.approval.autoBy===`owner`?(0,Z.jsxs)(`span`,{className:`mt-1 block`,"data-sw-agent-approval-owner-only":!0,children:[`Only `,e.createdBy?yr(e.createdBy):`the person who connected it`,` can switch this on: its machine takes approvals from them alone.`]}):null]})})]}),m?null:(0,Z.jsxs)(U,{tone:`info`,children:[`Changing this agent's approval rule needs the `,B[e.approval.changeRole||`owner`].toLowerCase(),` role.`]}),(0,Z.jsxs)(`div`,{className:`grid items-start gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Who may answer its approvals`,children:C(l,d,`answer`)}),(0,Z.jsx)(V,{label:`Who may change this rule`,hint:`Only an owner changes these two.`,children:C(s,c,`change`)})]}),(0,Z.jsx)(H,{error:p.error})]}):null})}function Ar({workspaceId:e,projectId:t}){let n=I(q(e,`/projects/${t}/agents`)),r=(n.data?.agents||[]).filter(e=>e.state!==`revoked`);return(0,Z.jsxs)(R,{"data-sw-project-agents-card":!0,children:[(0,Z.jsx)(G,{icon:s,title:`Agents`,description:`The machines that pick up comments sent to an agent here: who they are, who may use them, and the default.`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsx)(P,{to:`/w/${e}/agents/${t}`,"data-sw-project-agents-open":!0,children:r.length?`Manage agents`:`Connect an agent`})})}),n.loading?(0,Z.jsx)(W,{rows:1}):null,n.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:n.error,onRetry:n.reload})}):null,n.data&&!n.error?r.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:r.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-2.5 text-sm sm:px-5`,"data-sw-project-agent":e.name,children:[(0,Z.jsx)(Sr,{agent:e,size:`md`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:e.name}),e.isDefault?(0,Z.jsx)(T,{tone:`neutral`,className:`px-1.5 py-0.5 text-[10.5px]`,children:`Default`}):null,(0,Z.jsx)(br,{agent:e}),(0,Z.jsx)(`span`,{className:`w-full text-xs text-muted sm:w-auto`,children:e.audience.text})]},e.id))}):(0,Z.jsx)(`p`,{className:`px-4 py-4 text-sm text-muted sm:px-5`,children:`No agent is connected. Comments sent to an agent wait until a machine that has the code runs shapewall watch --remote.`}):null]})}function jr({projectId:e}){let{workspaceId:t,data:n,isAdmin:r,isOwner:i,reload:a}=$(),o=N(),s=n.projects.find(t=>t.id===e),c=I(r&&s?q(t,`/projects/${e}/shares`):null),l=I(r&&s?q(t,`/projects/${e}/tokens`):null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=N(),w=N(),T=F();if(!s)return(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Project not found`}),(0,Z.jsx)(P,{to:`/w/${t}`,className:`mt-3 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to projects`})]});let E=n.workspace.settings.shareLinks,ee=r,D=n=>o.run(async()=>{await L.put(q(t,`/projects/${e}/public`),{public:n}),await a(),b(!1),T(n?`This project is public`:`This project is private again. The public URL stopped working.`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(P,{to:`/w/${t}`,className:`mb-3 inline-flex h-11 items-center gap-1.5 rounded-md text-sm text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent lg:h-8`,children:[(0,Z.jsx)(wt,{size:15,"aria-hidden":`true`}),` Projects`]}),(0,Z.jsx)(we,{title:s.name,description:`Created ${ze(s.createdAt)}`,actions:(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`default`,className:`lg:h-9`,children:(0,Z.jsxs)(`a`,{href:s.boardUrl,children:[`Open board `,(0,Z.jsx)(ge,{size:15,"aria-hidden":`true`})]})})}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[r&&!s.boards.length?(0,Z.jsx)(Ln,{workspaceId:t,data:n,project:s,tokens:l.data?.tokens||null,onNewToken:()=>m(!0)}):null,(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:ut,title:`Boards`,description:`Each board is one shapewall.config.json board, updated by every push.`}),s.boards.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:s.boards.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 text-sm sm:px-5`,"data-sw-project-board":e.id,children:[(0,Z.jsx)(`code`,{className:`font-mono text-[13px] text-fg`,children:e.id}),(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[e.pushes,` `,e.pushes===1?`push`:`pushes`,` · last `,(0,Z.jsx)(Y,{value:e.pushedAt})]}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsxs)(`a`,{href:ve(s.boardUrl,`board`,e.id),className:`inline-flex h-11 items-center gap-1 text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:[`Open `,(0,Z.jsx)(ge,{size:14,"aria-hidden":`true`})]}),ee?(0,Z.jsxs)(u,{size:`touch`,variant:`danger`,className:`lg:h-8`,onClick:()=>{C.setError(null),S(e.id)},"aria-label":`Remove board ${e.id}`,"data-sw-remove-board":e.id,children:[(0,Z.jsx)(yt,{size:15,"aria-hidden":`true`}),` Remove board`]}):null]},e.id))}):(0,Z.jsxs)(_,{icon:ut,title:`Nothing pushed yet`,children:[`Make a token with the push scope below, then run shapewall push --remote `,Le()]})]}),r?(0,Z.jsxs)(R,{"data-sw-project-shares":!0,children:[(0,Z.jsx)(G,{icon:Rt,title:`Share links`,description:`For people outside the workspace: this project only, until the link expires or you revoke it.`,actions:E?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,onClick:()=>f(!0),className:`lg:h-9`,"data-sw-new-share":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New share link`]}):null}),E?null:(0,Z.jsx)(`div`,{className:`p-4 sm:p-5`,children:(0,Z.jsx)(Gn,{isAdmin:r})}),c.loading?(0,Z.jsx)(W,{}):null,c.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:c.error,onRetry:c.reload})}):null,c.data&&(E||c.data.shares.length)?(0,Z.jsx)(Un,{shares:c.data.shares,onChanged:c.reload,projectId:e}):null]}):null,r&&n.features?.publicProjects?(0,Z.jsxs)(R,{"data-sw-project-public":!0,children:[(0,Z.jsx)(G,{icon:Ye,title:`Public`,description:`Anyone with the URL can view this project's boards and comments. They cannot comment or change anything.`,actions:i&&n.workspace.settings.publicProjects||s.public?(0,Z.jsx)(Ee,{checked:!!s.public,label:`Public`,disabled:o.busy||!s.public&&!i,onChange:e=>e?D(!0):b(!0)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-3 px-4 py-4 text-sm text-muted sm:px-5`,children:[s.public?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ue,{value:`${window.location.origin}${s.public.url}`,testId:`public`}),(0,Z.jsxs)(`p`,{children:[`Public since `,(0,Z.jsx)(Y,{value:s.public.since}),`. Making it private stops this URL at once; making it public again gives a new one.`]})]}):n.workspace.settings.publicProjects?i?(0,Z.jsx)(`p`,{children:`Private.`}):(0,Z.jsx)(`p`,{children:`Private. Only an owner can make a project public.`}):(0,Z.jsx)(U,{tone:`info`,children:`Public projects are off in this workspace. An owner turns them on in Settings.`}),y?null:(0,Z.jsx)(H,{error:o.error})]})]}):null,r?(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:qe,title:`API tokens`,description:`For the CLI, CI and agents working in this project.`,actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:()=>m(!0),className:`lg:h-9`,"data-sw-project-new-token":!0,children:[(0,Z.jsx)(Jt,{size:16,"aria-hidden":`true`}),` New token`]})}),l.loading?(0,Z.jsx)(W,{}):null,l.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:l.error,onRetry:l.reload})}):null,l.data&&!l.error?l.data.tokens.length?(0,Z.jsx)(Qn,{tokens:l.data.tokens,onChanged:l.reload}):(0,Z.jsx)(_,{icon:qe,title:`No tokens yet`}):null]}):null,r&&!v?(0,Z.jsx)(Ar,{workspaceId:t,projectId:e}):null,r?(0,Z.jsx)(tr,{workspaceId:t,projectId:e}):null,r?(0,Z.jsx)(R,{className:`border-bad/30`,children:(0,Z.jsx)(G,{icon:yt,title:`Delete project`,description:`Its boards, captures, comments, tokens and share links go with it.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>g(!0),className:`border border-bad/40 lg:h-9`,"data-sw-delete-project":!0,children:`Delete project`})})}):null]}),r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wn,{open:d,onClose:()=>f(!1),project:s,onCreated:c.reload}),(0,Z.jsx)($n,{open:p,onClose:()=>m(!1),projects:n.projects,projectId:e,onCreated:l.reload}),(0,Z.jsx)(z,{open:h,onClose:()=>g(!1),title:`Delete ${s.name}?`,confirmLabel:`Delete project`,tone:`danger`,confirmText:s.name,busy:w.busy,error:w.error,onConfirm:()=>w.run(async()=>{await L.delete(q(t,`/projects/${e}`)),T(`Deleted ${s.name}`),Je(`/w/${t}`)}),children:(0,Z.jsx)(`p`,{children:`This deletes every board, capture, comment, token and share link of the project. It cannot be undone.`})}),(0,Z.jsxs)(z,{open:!!x,onClose:()=>S(null),title:`Remove the board ${x||``}?`,confirmLabel:`Remove board`,tone:`danger`,busy:C.busy,error:C.error,onConfirm:()=>C.run(async()=>{await L.delete(q(t,`/projects/${e}/boards/${x}`)),await a(),T(`Removed the board ${x}`),S(null)}),children:[(0,Z.jsxs)(`p`,{"data-sw-remove-board-note":!0,children:[`This deletes the captures, the page history and every comment of `,(0,Z.jsx)(`code`,{className:`font-mono text-fg`,children:x}),` on this server. It cannot be undone. Pushing a board with the same id later brings its captures back, but not the comments.`]}),(0,Z.jsx)(`p`,{className:`mt-2`,children:`The project, its other boards, its tokens and its share links stay.`})]}),(0,Z.jsx)(z,{open:y,onClose:()=>b(!1),title:`Make ${s.name} private?`,confirmLabel:`Make private`,tone:`danger`,busy:o.busy,error:o.error,onConfirm:()=>D(!1),children:(0,Z.jsx)(`p`,{children:`The public URL stops working at once, for everyone you sent it to. Making the project public again gives it a new URL: the old one never comes back.`})})]}):null]})}function Mr(){let{workspaceId:e}=$(),t=I(q(e,`/invites`)),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(null),o=N(),s=F(),c=t.data?.pending||[],l=t.data?.history||[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Invites`,description:`Each link works once, for one person, until it expires. Whoever opens it first joins with its role.`,actions:(0,Z.jsxs)(u,{variant:`default`,size:`touch`,onClick:()=>r(!0),className:`lg:h-9`,"data-sw-new-invite":!0,children:[(0,Z.jsx)(dn,{size:16,"aria-hidden":`true`}),` New invite`]})}),t.loading?(0,Z.jsx)(W,{}):null,t.error?(0,Z.jsx)(K,{error:t.error,onRetry:t.reload}):null,t.data?(0,Z.jsxs)(te,{defaultValue:`pending`,children:[(0,Z.jsxs)(se,{className:`mb-3 w-full sm:inline-flex sm:w-auto`,children:[(0,Z.jsxs)(ue,{value:`pending`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`pending`,children:[`Pending `,(0,Z.jsx)(`span`,{className:`tabular ml-1 text-faint`,children:c.length})]}),(0,Z.jsxs)(ue,{value:`history`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`history`,children:[`History `,(0,Z.jsx)(`span`,{className:`tabular ml-1 text-faint`,children:l.length})]})]}),(0,Z.jsx)(C,{value:`pending`,children:(0,Z.jsx)(R,{children:c.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-pending-invites":!0,children:c.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-invite":e.id,children:[(0,Z.jsx)(J,{role:e.role}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[e.note?(0,Z.jsx)(`span`,{className:`mr-2 font-medium`,"data-sw-invite-note":!0,children:e.note}):null,e.tailnetLogin?(0,Z.jsxs)(`span`,{"data-sw-invite-tailnet":!0,children:[`For the tailnet login `,e.tailnetLogin]}):e.email?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(Ze,{size:13,"aria-hidden":`true`}),` `,e.email]}):e.note?null:`Link`]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`By `,e.createdBy?.displayName||`someone`,` · `,(0,Z.jsx)(Y,{value:e.createdAt}),` ·`,` `,(0,Z.jsx)(Y,{value:e.expiresAt,prefix:`expires `})]})]}),(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>a(e),className:`lg:h-8`,"data-sw-revoke-invite":!0,children:`Revoke`})]},e.id))}):(0,Z.jsx)(_,{icon:Bt,title:`No pending invites`,children:`New invite links show here until someone uses them or they expire.`})})}),(0,Z.jsx)(C,{value:`history`,children:(0,Z.jsx)(R,{children:l.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-invite-history":!0,children:l.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-invite-status":e.status,children:[(0,Z.jsx)(J,{role:e.role}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 text-xs text-muted`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[e.status===`used`?`Joined: ${e.usedBy?.displayName||`a deleted account`}${e.usedBy?` (@${e.usedBy.handle})`:``}`:e.note||e.email||`Link`,e.status===`used`&&e.note?(0,Z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.note]}):null]}),(0,Z.jsxs)(`p`,{className:`mt-0.5`,children:[`By `,e.createdBy?.displayName||`someone`,` · created `,(0,Z.jsx)(Y,{value:e.createdAt}),e.status===`used`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· used `,(0,Z.jsx)(Y,{value:e.usedAt})]}):null,e.status===`revoked`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· revoked `,(0,Z.jsx)(Y,{value:e.revokedAt})]}):null,e.status===`expired`?(0,Z.jsxs)(Z.Fragment,{children:[` `,`· expired `,(0,Z.jsx)(Y,{value:e.expiresAt})]}):null]})]}),(0,Z.jsx)(T,{tone:e.status===`used`?`ok`:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:e.status===`used`?`Used`:e.status===`revoked`?`Revoked`:`Expired`})]},e.id))}):(0,Z.jsx)(_,{icon:Bt,title:`No history yet`,children:`Used, revoked and expired invites show here.`})})})]}):null,(0,Z.jsx)(Nr,{open:n,onClose:()=>r(!1),onCreated:t.reload}),(0,Z.jsx)(z,{open:!!i,onClose:()=>a(null),title:`Revoke this invite?`,confirmLabel:`Revoke invite`,tone:`danger`,busy:o.busy,error:o.error,onConfirm:()=>o.run(async()=>{await L.delete(q(e,`/invites/${i.id}`)),a(null),s(`Invite revoked`),await t.reload()}),children:(0,Z.jsx)(`p`,{children:`The link stops working. Nobody has joined with it yet.`})})]})}function Nr({open:e,onClose:t,onCreated:n}){let{workspaceId:r,data:i,role:a}=$(),o=i.features,[s,c]=(0,Q.useState)(`member`),[l,d]=(0,Q.useState)(`7`),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),{run:y,busy:b,error:x,setError:S}=N(),[C,T]=he(e,()=>{c(`member`),d(`7`),p(``),h(``),_(``),S(null)}),ee=En(a);return(0,Z.jsx)(Ke,{open:e,onClose:t,busy:b,result:C,title:`Invite someone`,resultTitle:`Invite ready`,resultProps:{"data-sw-invite-result":!0},doneProps:{"data-sw-invite-done":!0},renderResult:e=>(0,Z.jsxs)(Z.Fragment,{children:[e.emailed?.ok?(0,Z.jsx)(U,{tone:`ok`,title:`Emailed to ${e.invite.email}`,children:`You can also send the link yourself.`}):e.emailed?(0,Z.jsxs)(U,{tone:`warn`,title:`The email did not go out`,children:[e.emailed.error,`. Copy the link and send it yourself.`]}):null,e.invite.tailnetLogin?(0,Z.jsxs)(U,{tone:`ok`,title:`${e.invite.tailnetLogin} is invited`,"data-sw-invite-tailnet-result":!0,children:[`They join as `,B[e.invite.role].toLowerCase(),` the next time they open this server through the tailnet (or with shapewall join). Only that tailnet login can use this invite, so the link below is optional.`]}):v?(0,Z.jsxs)(U,{tone:`info`,title:`A sample link`,"data-sw-invite-sample":!0,children:[`The demo has no server, so this link opens nothing. On a real server it makes one `,B[e.invite.role].toLowerCase(),`, works once and expires `,(0,Z.jsx)(Y,{value:e.invite.expiresAt}),`.`]}):(0,Z.jsxs)(U,{tone:`info`,title:`Copy the link now: it is shown once`,children:[`It makes one `,B[e.invite.role].toLowerCase(),` and expires `,(0,Z.jsx)(Y,{value:e.invite.expiresAt}),`. Send it to one person.`]}),(0,Z.jsx)(Ue,{value:e.url,testId:`invite`})]}),children:(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),y(async()=>{let e=await L.post(q(r,`/invites`),{role:s,expiresInDays:Number(l),...f.trim()?{email:f.trim()}:{},...m.trim()?{note:m.trim()}:{},...g.trim()?{tailnetLogin:g.trim()}:{}});T(e),await n?.()})},className:`space-y-4 px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(V,{label:`Role`,children:e=>(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-invite-role":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:ee.map(e=>(0,Z.jsx)(A,{value:e,children:B[e]},e))})]})}),(0,Z.jsx)(V,{label:`Link expires after`,children:e=>(0,Z.jsxs)(j,{value:l,onValueChange:d,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...e,"data-sw-invite-expiry":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:o.inviteDays.map(e=>(0,Z.jsx)(A,{value:String(e),children:Oe(e)},e))})]})})]}),(0,Z.jsx)(`p`,{className:`-mt-1 text-xs text-muted`,children:Fe[s]}),(0,Z.jsx)(V,{label:`Who it is for (optional)`,hint:`A note for the pending list, like Ada (design). Only admins see it.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:m,onChange:e=>h(e.target.value),maxLength:80,autoComplete:`off`,placeholder:`Ada (design)`,"data-sw-invite-note-input":!0})}),o.tailnetSignIn?(0,Z.jsx)(V,{label:`Tailnet login (optional)`,hint:`The name they sign in to Tailscale with. Only that login can use the invite, and they need no link.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:g,onChange:e=>_(e.target.value),autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,placeholder:`ada@example.com`,"data-sw-invite-tailnet-login":!0})}):null,o.inviteEmail?(0,Z.jsx)(V,{label:`Email (optional)`,hint:`We email the link to this address. Leave it empty to copy the link yourself.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,type:`email`,value:f,onChange:e=>p(e.target.value),autoComplete:`off`,placeholder:`name@example.com`,"data-sw-invite-email":!0})}):(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`This server does not send email: you copy the link and send it yourself.`}),s===`owner`?(0,Z.jsx)(U,{tone:`warn`,children:`An owner can change or remove anyone, you included. Inviting one always asks you to confirm.`}):null,(0,Z.jsx)(H,{error:x}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,onClick:t,disabled:b,className:`lg:h-10`,children:`Cancel`}),(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`default`,disabled:b,className:`lg:h-10`,"data-sw-invite-create":!0,children:[b?(0,Z.jsx)(w,{}):null,` `,g.trim()?`Invite this login`:f.trim()?`Create and email`:`Create invite link`]})]})]})})}function Pr(){let{data:e,role:t,isAdmin:r,workspaceId:i,reload:o}=$(),{me:s,refresh:c}=Ne(),l=F(),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),b=N(),x=e.members.filter(e=>e.role===`owner`).length,S=!!v&&v.userId!==s.user.id,C=I(r&&S?q(i,`/tokens`):null),w=S?(C.data?.tokens||[]).filter(e=>e.status===`active`&&e.createdBy?.userId===v.userId):[],[T,ee]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{v&&ee(!0)},[v]);let D=(0,Q.useMemo)(()=>{let t=d.trim().toLowerCase(),n={owner:0,admin:1,member:2,viewer:3};return e.members.filter(e=>!t||e.displayName.toLowerCase().includes(t)||e.handle.includes(t)).sort((e,t)=>n[e.role]-n[t.role]||e.displayName.localeCompare(t.displayName))},[e.members,d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Members`,description:`${e.members.length} ${e.members.length===1?`person`:`people`} in ${e.workspace.name}. Roles apply to every project.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[r?(0,Z.jsx)(u,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-9`,children:(0,Z.jsxs)(P,{to:`/w/${i}/access#roles`,children:[(0,Z.jsx)(Te,{size:15,"aria-hidden":`true`}),` Roles and permissions`]})}):(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:()=>document.getElementById(`roles`)?.scrollIntoView({behavior:`smooth`}),children:[(0,Z.jsx)(Te,{size:15,"aria-hidden":`true`}),` Roles and permissions`]}),r?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,onClick:()=>m(!0),className:`lg:h-9`,"data-sw-invite-people":!0,children:[(0,Z.jsx)(dn,{size:16,"aria-hidden":`true`}),` Invite people`]}):null]})}),r?(0,Z.jsx)(mi,{}):null,(0,Z.jsxs)(R,{children:[(0,Z.jsx)(`div`,{className:`border-b border-line p-3 sm:px-5`,children:(0,Z.jsx)(M,{size:`touch`,icon:Qt,value:d,onChange:e=>f(e.target.value),placeholder:`Search by name or handle`,"aria-label":`Search members`,className:`lg:h-9 lg:text-sm`})}),(0,Z.jsxs)(`div`,{className:`hidden grid-cols-[minmax(0,2fr)_10rem_8rem_8rem_3rem] gap-3 border-b border-line px-5 py-2 text-[11px] font-medium tracking-wide text-faint uppercase md:grid`,children:[(0,Z.jsx)(`span`,{children:`Person`}),(0,Z.jsx)(`span`,{children:`Role`}),(0,Z.jsx)(`span`,{children:`Joined`}),(0,Z.jsx)(`span`,{children:`Last active`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})]}),D.length?(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,"data-sw-members":!0,children:D.map(e=>{let r=e.userId===s.user.id,i=Cn(t,e.role),o=!r&&wn(t,e.role),c=e.role===`owner`&&x<=1;return(0,Z.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3 sm:px-5 md:grid-cols-[minmax(0,2fr)_10rem_8rem_8rem_3rem]`,"data-sw-member":e.handle,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(ie,{name:e.displayName,person:!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate text-sm font-medium text-fg`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.displayName}),r?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-faint`,children:`(you)`}):null]}),(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted`,children:[`@`,e.handle]})]})]}),(0,Z.jsx)(`div`,{className:`col-start-1 row-start-2 md:col-start-auto md:row-start-auto`,children:i.length&&!(c&&r)?(0,Z.jsxs)(j,{value:e.role,onValueChange:t=>t===e.role?null:g({member:e,role:t}),children:[(0,Z.jsx)(k,{size:`touch`,className:`w-36 lg:h-8`,"aria-label":`Role of ${e.displayName}`,"data-sw-role-select":e.handle,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:i.map(e=>(0,Z.jsx)(A,{value:e,disabled:c&&e!==`owner`,children:B[e]},e))})]}):(0,Z.jsx)(J,{role:e.role})}),(0,Z.jsx)(`div`,{className:`hidden text-xs text-muted md:block`,children:(0,Z.jsx)(Y,{value:e.joinedAt})}),(0,Z.jsxs)(`div`,{className:`col-start-1 row-start-3 text-xs text-muted md:col-start-auto md:row-start-auto`,children:[(0,Z.jsx)(`span`,{className:`md:hidden`,children:`Active `}),(0,Z.jsx)(Y,{value:e.lastActiveAt,empty:`Not yet`}),(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` `,`· joined `,(0,Z.jsx)(Y,{value:e.joinedAt})]})]}),(0,Z.jsx)(`div`,{className:`col-start-2 row-span-3 row-start-1 self-start md:col-start-auto md:row-span-1 md:row-start-auto md:self-center`,children:o||r?(0,Z.jsxs)(n,{children:[(0,Z.jsx)(ne,{asChild:!0,children:(0,Z.jsx)(u,{size:`icon`,variant:`ghost`,className:`lg:h-8 lg:w-8`,"aria-label":`Actions for ${e.displayName}`,"data-sw-member-menu":e.handle,children:(0,Z.jsx)(Mt,{size:16,"aria-hidden":`true`})})}),(0,Z.jsx)(fe,{children:r?(0,Z.jsxs)(a,{tone:`danger`,disabled:c,onSelect:()=>y(e),"data-sw-leave":!0,children:[(0,Z.jsx)(ln,{size:14,"aria-hidden":`true`}),` `,c?`Leave (make another owner first)`:`Leave workspace`]}):(0,Z.jsxs)(a,{tone:`danger`,onSelect:()=>y(e),"data-sw-remove-member":!0,children:[(0,Z.jsx)(ln,{size:14,"aria-hidden":`true`}),` Remove from workspace`]})})]}):null})]},e.userId)})}):(0,Z.jsx)(_,{icon:hn,title:`Nobody matches`,children:`Try another name or handle.`})]}),r?null:(0,Z.jsx)(R,{className:`mt-5`,id:`roles`,children:(0,Z.jsxs)(`div`,{className:`px-4 py-3.5 sm:px-5`,children:[(0,Z.jsx)(`h2`,{className:`text-[15px] font-semibold text-fg`,children:`Roles`}),(0,Z.jsx)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:X.map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:e})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:Fe[e]})]},e))})]})}),(0,Z.jsx)(Nr,{open:p,onClose:()=>m(!1)}),(0,Z.jsx)(z,{open:!!h,onClose:()=>g(null),title:h?`Make ${h.member.displayName} ${B[h.role].toLowerCase()}?`:``,confirmLabel:`Change role`,tone:h&&X.indexOf(h.role)<X.indexOf(h.member.role)?`danger`:`default`,busy:b.busy,error:b.error,onConfirm:()=>b.run(async()=>{await L.patch(q(i,`/members/${h.member.userId}`),{role:h.role});let e=h.member.userId===s.user.id;g(null),l(`${h.member.displayName} is now ${B[h.role].toLowerCase()}`),await o(),e&&await c()}),children:h?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-fg`,children:[B[h.role],`:`]}),` `,Fe[h.role]]}),(0,Z.jsxs)(`p`,{children:[`The change applies to every project in the workspace at once`,h.member.userId===s.user.id?`, including for you`:``,`.`]}),[`owner`,`admin`].includes(h.member.role)&&![`owner`,`admin`].includes(h.role)?(0,Z.jsx)(`p`,{children:`Their pending invites, share links and API tokens are revoked.`}):null,h.member.role===`owner`&&h.role===`admin`?(0,Z.jsx)(`p`,{children:`Their pending owner invites are revoked.`}):null,h.role===`owner`||h.member.role===`owner`?(0,Z.jsx)(`p`,{className:`text-xs`,children:`Making, changing or removing an owner always asks you to confirm.`}):null]}):null}),(0,Z.jsx)(z,{open:!!v,onClose:()=>y(null),title:v?.userId===s.user.id?`Leave ${e.workspace.name}?`:`Remove ${v?.displayName}?`,confirmLabel:v?.userId===s.user.id?`Leave workspace`:`Remove`,tone:`danger`,busy:b.busy,error:b.error,onConfirm:()=>b.run(async()=>{let e=v.userId===s.user.id,t=await L.delete(q(i,`/members/${v.userId}`),!e&&w.length&&!T?{revokeTokens:!1}:{});if(e){Je(`/`);return}y(null);let n=t?.revoked?.tokens||0;l(n?`Removed ${v.displayName} and revoked ${n} API ${n===1?`token`:`tokens`}`:`Removed ${v.displayName}`),await o()}),children:v?.userId===s.user.id?(0,Z.jsx)(`p`,{children:`You lose access to every project here, and your pending invites, share links and API tokens are revoked. An admin can invite you again.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`They lose access to every project at once. Their comments stay.`}),[`owner`,`admin`].includes(v?.role)?(0,Z.jsx)(`p`,{children:`Their pending invites and share links are revoked.`}):null,r?C.loading?(0,Z.jsx)(`p`,{children:`Checking their API tokens...`}):C.error?(0,Z.jsxs)(`p`,{className:`text-warn`,"data-sw-remove-tokens-unknown":!0,children:[`Their API tokens could not be checked (`,C.error.message,`). Any that still work are revoked with them.`]}):w.length?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{checked:T,onChange:ee,id:`remove-revoke-tokens`,children:[`Revoke the `,w.length,` API `,w.length===1?`token`:`tokens`,` they made (`,w.map(e=>e.name).join(`, `),`)`]}),T?null:(0,Z.jsx)(`p`,{className:`text-warn`,children:`Kept tokens stop working anyway while they are not an admin here, and work again if they come back as one.`})]}):(0,Z.jsx)(`p`,{children:`They made no API tokens that still work.`}):null]})})]})}var Fr={own:`solid`,manage:`accent`,comment:`ok`,view:`neutral`};function Ir({level:e}){return(0,Z.jsx)(T,{tone:Fr[e],className:`px-2 py-0.5 text-[11px]`,"data-sw-access":e,children:Me[e]})}var Lr=()=>(0,Z.jsxs)(`span`,{className:`inline-flex h-[22px] items-center align-middle text-faint`,children:[(0,Z.jsx)(`span`,{className:`h-[1.5px] w-2.5 rounded-full bg-current`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`No access`})]});function Rr(){let{workspaceId:e}=$(),t=I(q(e,`/access`)),[n,r]=(0,Q.useState)(()=>_e()===`#roles`?`roles`:`projects`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Access`,description:`Who can reach which project, and with what. People get their role everywhere; tokens and share links reach one project.`}),t.loading?(0,Z.jsx)(W,{}):null,t.error?(0,Z.jsx)(K,{error:t.error,onRetry:t.reload}):null,t.data?(0,Z.jsxs)(te,{value:n,onValueChange:r,children:[(0,Z.jsxs)(se,{className:`mb-4 w-full sm:inline-flex sm:w-auto`,children:[(0,Z.jsx)(ue,{value:`projects`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`projects`,children:`By project`}),(0,Z.jsx)(ue,{value:`people`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`people`,children:`By person`}),(0,Z.jsx)(ue,{value:`roles`,className:`h-11 px-3 lg:h-8`,"data-sw-tab":`roles`,children:`Roles`})]}),(0,Z.jsx)(C,{value:`projects`,children:(0,Z.jsx)(zr,{data:t.data})}),(0,Z.jsx)(C,{value:`people`,children:(0,Z.jsx)(Br,{data:t.data})}),(0,Z.jsx)(C,{value:`roles`,children:(0,Z.jsx)(Vr,{})})]}):null]})}function zr({data:e}){let{workspaceId:t}=$(),[n,r]=(0,Q.useState)(e.projects[0]?.id||``);if(!e.projects.length)return(0,Z.jsx)(R,{children:(0,Z.jsx)(_,{icon:Te,title:`No projects yet`,children:`People still have their roles; tokens and share links come with projects.`})});let a=[...e.people.map(e=>({key:e.userId,kind:`person`,label:e.displayName,sub:`@${e.handle}`,badge:(0,Z.jsx)(J,{role:e.role}),reaches:()=>!0,cell:()=>(0,Z.jsx)(Ir,{level:e.access})})),...e.tokens.map(e=>({key:e.id,kind:`token`,label:e.name,sub:`${e.prefix}…${e.createdBy?.left?` · maker left`:``}`,warn:e.createdBy?.left,reaches:t=>t===e.projectId,cell:t=>t===e.projectId?(0,Z.jsx)(Zn,{scopes:e.scopes}):(0,Z.jsx)(Lr,{})})),...e.shares.map(e=>({key:e.id,kind:`share`,label:e.name,sub:`Guests · expires ${ze(e.expiresAt)}`,lock:e.passcode,reaches:t=>t===e.projectId,cell:t=>t===e.projectId?(0,Z.jsx)(Vn,{mode:e.mode}):(0,Z.jsx)(Lr,{})}))],o={person:hn,token:qe,share:Rt},s=e.projects.find(e=>e.id===n),c=Object.values(e.pendingInvites).reduce((e,t)=>e+t,0);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[c?(0,Z.jsxs)(U,{tone:`info`,action:(0,Z.jsx)(P,{to:`/w/${t}/invites`,className:`inline-flex h-11 items-center text-sm font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:`Invites`}),children:[c,` pending `,c===1?`invite`:`invites`,` will add`,` `,Object.entries(e.pendingInvites).map(([e,t])=>`${t} ${B[e].toLowerCase()}${t===1?``:`s`}`).join(`, `),` `,`when used.`]}):null,e.shareLinksOn?null:(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Share links are off in this workspace.`}),(0,Z.jsx)(R,{className:`hidden overflow-x-auto md:block`,"data-sw-access-matrix":!0,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-[40rem] border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-line text-left text-[12px] font-medium text-muted`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`sticky left-0 bg-surface px-5 py-2.5 font-medium`,children:`Who`}),e.projects.map(e=>(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2.5 font-medium`,children:e.name},e.id))]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-line`,children:a.map(t=>{let n=o[t.kind];return(0,Z.jsxs)(`tr`,{"data-sw-access-row":t.kind,children:[(0,Z.jsx)(`th`,{scope:`row`,className:`sticky left-0 bg-surface px-5 py-2.5 text-left font-normal`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(n,{size:15,className:`shrink-0 text-faint`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium text-fg`,children:[t.label,t.lock?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ge,{size:12,className:`text-muted`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`(passcode)`})]}):null]}),(0,Z.jsx)(`p`,{className:i(`truncate text-xs`,t.warn?`text-warn`:`text-muted`),children:t.sub})]}),t.badge?(0,Z.jsx)(`span`,{className:`ml-auto pl-2`,children:t.badge}):null]})}),e.projects.map(e=>(0,Z.jsx)(`td`,{className:`px-3 py-2.5`,children:t.cell(e.id)},e.id))]},t.key)})})]})}),(0,Z.jsxs)(`div`,{className:`space-y-3 md:hidden`,children:[(0,Z.jsx)(V,{label:`Project`,children:t=>(0,Z.jsxs)(j,{value:n,onValueChange:r,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full`,...t,"data-sw-access-project":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:e.projects.map(e=>(0,Z.jsx)(A,{value:e.id,children:e.name},e.id))})]})}),(0,Z.jsx)(R,{children:(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:a.filter(e=>e.reaches(s.id)).map(e=>{let t=o[e.kind];return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Z.jsx)(t,{size:15,className:`shrink-0 text-faint`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.label}),(0,Z.jsx)(`p`,{className:i(`truncate text-xs`,e.warn?`text-warn`:`text-muted`),children:e.sub})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:e.cell(s.id)})]},e.key)})})})]})]})}function Br({data:e}){let[t,n]=(0,Q.useState)(e.people[0]?`person:${e.people[0].userId}`:``),[r,a]=t.split(`:`),o=r===`person`?e.people.find(e=>e.userId===a):null,s=r===`token`?e.tokens.find(e=>e.id===a):null,c=r===`share`?e.shares.find(e=>e.id===a):null,l=t=>e.projects.find(e=>e.id===t)?.name||`a deleted project`;return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(V,{label:`Show access for`,children:r=>(0,Z.jsxs)(j,{value:t,onValueChange:n,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full sm:w-96`,...r,"data-sw-access-person":!0,children:(0,Z.jsx)(O,{placeholder:`Pick someone`})}),(0,Z.jsxs)(E,{children:[(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`People`}),e.people.map(e=>(0,Z.jsxs)(A,{value:`person:${e.userId}`,children:[e.displayName,` (@`,e.handle,`)`]},e.userId))]}),e.tokens.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`API tokens`}),e.tokens.map(e=>(0,Z.jsxs)(A,{value:`token:${e.id}`,children:[e.name,` (`,e.prefix,`…)`]},e.id))]}):null,e.shares.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`Share links`}),e.shares.map(e=>(0,Z.jsx)(A,{value:`share:${e.id}`,children:e.name},e.id))]}):null]})]})}),o?(0,Z.jsxs)(R,{"data-sw-access-detail":`person`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-line px-4 py-4 sm:px-5`,children:[(0,Z.jsx)(ie,{name:o.displayName,person:!0,className:`h-11 w-11 text-sm`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-fg`,children:o.displayName}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted`,children:[`@`,o.handle,` · joined `,(0,Z.jsx)(Y,{value:o.joinedAt}),` · active `,(0,Z.jsx)(Y,{value:o.lastActiveAt,empty:`not yet`})]})]}),(0,Z.jsx)(J,{role:o.role})]}),(0,Z.jsxs)(`div`,{className:`grid gap-5 px-4 py-4 sm:px-5 md:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:`Projects`}),e.projects.length?(0,Z.jsx)(`ul`,{className:`space-y-1.5`,children:e.projects.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,Z.jsx)(`span`,{className:`truncate text-fg`,children:e.name}),(0,Z.jsx)(Ir,{level:o.access})]},e.id))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No projects yet.`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:[`As `,B[o.role].toLowerCase(),`, they can`]}),(0,Z.jsx)(`ul`,{className:`space-y-1.5 text-sm`,children:Ve.map(([e,t])=>{let n=gn(o.role,t);return(0,Z.jsxs)(`li`,{className:i(`flex items-start gap-2`,n?`text-fg`:`text-faint line-through`),children:[n?(0,Z.jsx)(h,{size:14,className:`mt-0.5 shrink-0 text-ok`,"aria-hidden":`true`}):(0,Z.jsx)(bt,{size:14,className:`mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:n?`Can:`:`Cannot:`}),e]},e)})})]})]}),e.tokens.some(e=>e.createdBy?.userId===o.userId)?(0,Z.jsxs)(`div`,{className:`border-t border-line px-4 py-4 sm:px-5`,children:[(0,Z.jsx)(`h3`,{className:`mb-2 text-[13px] font-semibold text-fg`,children:`Tokens they made`}),(0,Z.jsx)(`ul`,{className:`space-y-1.5 text-sm`,children:e.tokens.filter(e=>e.createdBy?.userId===o.userId).map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(qe,{size:13,className:`text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-fg`,children:e.name}),(0,Z.jsxs)(`span`,{className:`text-xs text-muted`,children:[`in `,l(e.projectId)]}),(0,Z.jsx)(Zn,{scopes:e.scopes})]},e.id))})]}):null]}):null,s?(0,Z.jsxs)(R,{"data-sw-access-detail":`token`,children:[(0,Z.jsx)(G,{icon:qe,title:s.name,description:`${s.prefix}… · ${l(s.projectId)} only`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm sm:px-5`,children:[(0,Z.jsx)(Zn,{scopes:s.scopes}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Made by `,s.createdBy?.displayName||`unknown`,` · last used `,(0,Z.jsx)(Y,{value:s.lastUsedAt,empty:`never`}),` ·`,` `,s.expiresAt?(0,Z.jsx)(Y,{value:s.expiresAt,prefix:`expires `}):`no expiry`]}),s.createdBy?.left?(0,Z.jsx)(U,{tone:`warn`,children:`The person who made this token has left the workspace, so it no longer works. Revoke it.`}):null]})]}):null,c?(0,Z.jsxs)(R,{"data-sw-access-detail":`share`,children:[(0,Z.jsx)(G,{icon:Pt,title:c.name,description:`Guests · ${l(c.projectId)} only`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm sm:px-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(Vn,{mode:c.mode}),c.passcode?(0,Z.jsxs)(T,{tone:`neutral`,className:`px-2 py-0.5 text-[11px]`,children:[(0,Z.jsx)(Ge,{size:11,"aria-hidden":`true`}),` Passcode`]}):null]}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Opened `,c.opens,` `,c.opens===1?`time`:`times`,` · last `,(0,Z.jsx)(Y,{value:c.lastUsedAt,empty:`never`}),` ·`,` `,(0,Z.jsx)(Y,{value:c.expiresAt,prefix:`expires `})]}),(0,Z.jsxs)(`p`,{className:`text-muted`,children:[`Guests see this project's boards and comments`,c.mode===`comment`?`, and add comments and replies marked as a guest`:``,`. Nothing else in the workspace.`]})]})]}):null]})}function Vr(){return(0,Z.jsxs)(R,{"data-sw-roles-table":!0,children:[(0,Z.jsx)(G,{icon:Te,title:`Roles and permissions`,description:`A role applies to every project in the workspace. Guests come from share links.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line md:hidden`,"data-sw-roles-list":!0,children:Ve.map(([e,t])=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-4 py-2.5 text-sm`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 text-fg`,children:e}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-muted`,children:[(0,Z.jsx)(J,{role:t}),t===`owner`?`only`:`and up`]})]},e))}),(0,Z.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,Z.jsxs)(`table`,{className:`w-full min-w-[36rem] border-collapse text-sm`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-line`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`px-5 py-2.5 text-left text-[11px] font-medium tracking-wide text-faint uppercase`,children:`Can`}),[...X,`guest`].map(e=>(0,Z.jsx)(`th`,{scope:`col`,className:`px-2 py-2.5 text-center`,children:(0,Z.jsx)(J,{role:e})},e))]})}),(0,Z.jsx)(`tbody`,{className:`divide-y divide-line`,children:Ve.map(([e,t])=>(0,Z.jsxs)(`tr`,{children:[(0,Z.jsx)(`th`,{scope:`row`,className:`px-5 py-2 text-left font-normal text-fg`,children:e}),X.map(e=>(0,Z.jsxs)(`td`,{className:`px-2 py-2 text-center`,children:[gn(e,t)?(0,Z.jsx)(h,{size:15,className:`mx-auto text-ok`,"aria-hidden":`true`}):(0,Z.jsx)(bt,{size:15,className:`mx-auto text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:gn(e,t)?`Yes`:`No`})]},e)),(0,Z.jsx)(`td`,{className:`px-2 py-2 text-center`,children:t===`viewer`?(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:`One project`}):e.startsWith(`Comment`)?(0,Z.jsx)(`span`,{className:`text-xs text-muted`,children:`Comment and reply, on comment links`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{size:15,className:`mx-auto text-faint`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`No`})]})})]},e))})]})}),(0,Z.jsxs)(`dl`,{className:`grid gap-2 border-t border-line px-5 py-4 text-sm sm:grid-cols-2`,children:[X.map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:e})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:Fe[e]})]},e)),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(`dt`,{className:`w-16 shrink-0`,children:(0,Z.jsx)(J,{role:`guest`})}),(0,Z.jsx)(`dd`,{className:`text-muted`,children:`Someone with a share link: one project, no account, comments marked as a guest.`})]})]})]})}var Hr={user:je,token:s,guest:Ye,system:en},Ur=`__all__`,Wr=e=>{let t=e.replace(/_/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)};function Gr(){let{workspaceId:e}=$(),n=I(q(e,`/audit/filters`)),[r,i]=(0,Q.useState)(Ur),[a,o]=(0,Q.useState)(Ur),[s,c]=(0,Q.useState)(`any`),[l,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),m=N();(0,Q.useEffect)(()=>{let e=window.setTimeout(()=>p(l.trim()),300);return()=>window.clearTimeout(e)},[l]);let h=(0,Q.useCallback)(()=>{let e=new URLSearchParams;r!==Ur&&e.set(`actor`,r),a!==Ur&&e.set(`action`,a);let t=Re.find(([e])=>e===s)?.[2];return t&&e.set(`from`,new Date(Date.now()-t*864e5).toISOString()),f&&e.set(`q`,f),e},[r,a,s,f]),g=(0,Q.useCallback)(t=>{let n=h();return n.set(`limit`,`50`),t&&n.set(`before`,String(t)),q(e,`/audit?${n}`)},[h,e]),y=()=>m.run(()=>pe(`GET`,q(e,`/audit/export?${h()}`),void 0,`audit.csv`)),b=Pe(g,`entries`),x=b.items,S=n.data?.actors||[],C=n.data?.actions||[],T=r!==Ur||a!==Ur||s!==`any`||!!f,ee=S.filter(e=>e.type===`user`),te=S.filter(e=>e.type===`token`),ne=S.filter(e=>e.type===`guest`),re=e=>`${e.type===`guest`?`share`:e.type}:${e.id}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Audit log`,description:be(`Membership, invites, projects, tokens, share links, pushes and moderation in this workspace.`),actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:y,disabled:m.busy||v,className:`lg:h-9`,"data-sw-audit-export":!0,children:[m.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)($e,{size:15,"aria-hidden":`true`}),` Export CSV`]})}),(0,Z.jsxs)(R,{className:`mb-4 p-3 sm:p-4`,"data-sw-audit-filters":!0,children:[(0,Z.jsx)(`div`,{className:`mb-2`,children:(0,Z.jsx)(M,{size:`touch`,icon:Qt,value:l,onChange:e=>d(e.target.value),placeholder:`Search names, projects, tokens, links`,"aria-label":`Search the audit log`,className:`lg:h-9`,maxLength:100,"data-sw-audit-search":!0})}),(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,Z.jsxs)(j,{value:r,onValueChange:i,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`Who`,"data-sw-audit-actor":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:Ur,children:`Everyone`}),ee.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`People`}),ee.map(e=>(0,Z.jsxs)(A,{value:re(e),children:[e.label,e.handle?` (@${e.handle})`:``]},e.id))]}):null,te.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`API tokens`}),te.map(e=>(0,Z.jsx)(A,{value:re(e),children:e.label},e.id))]}):null,ne.length?(0,Z.jsxs)(D,{children:[(0,Z.jsx)(ae,{children:`Share link guests`}),ne.map(e=>(0,Z.jsx)(A,{value:re(e),children:e.link},e.id))]}):null]})]}),(0,Z.jsxs)(j,{value:a,onValueChange:o,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`What`,"data-sw-audit-action":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(A,{value:Ur,children:`All actions`}),C.map(e=>(0,Z.jsx)(A,{value:e,children:Wr(e)},e))]})]}),(0,Z.jsxs)(j,{value:s,onValueChange:c,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-full lg:h-9`,"aria-label":`When`,"data-sw-audit-range":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Re.map(([e,t])=>(0,Z.jsx)(A,{value:e,children:t},e))})]})]}),T?(0,Z.jsxs)(u,{size:`touch`,variant:`ghost`,className:`mt-2 lg:h-8`,onClick:()=>{i(Ur),o(Ur),c(`any`),d(``),p(``)},children:[(0,Z.jsx)(t,{size:14,"aria-hidden":`true`}),` Clear filters`]}):null,(0,Z.jsx)(H,{error:m.error})]}),(0,Z.jsxs)(R,{children:[b.loading?(0,Z.jsx)(W,{}):null,b.error?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(K,{error:b.error,onRetry:x.length?b.loadMore:b.reload})}):null,!b.loading&&!b.error&&!x.length?(0,Z.jsx)(_,{icon:Xt,title:T?`Nothing matches these filters`:`No events yet`}):null,!b.loading&&x.length?(0,Z.jsx)(`ol`,{className:`divide-y divide-line`,"data-sw-audit-list":!0,children:x.map(e=>{let t=Hr[e.actor.type]||en;return(0,Z.jsxs)(`li`,{className:`flex gap-3 px-4 py-3 sm:px-5`,"data-sw-audit-entry":e.action,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-surface-2 text-muted`,children:(0,Z.jsx)(t,{size:15,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-fg`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.actor.label}),e.actor.type===`guest`&&e.actor.named?(0,Z.jsx)(`span`,{className:`text-muted`,children:` (guest)`}):null,e.actor.type===`token`?(0,Z.jsx)(`span`,{className:`text-muted`,children:` (token)`}):null,` `,De(e)]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[(0,Z.jsx)(Y,{value:e.at}),` `,(0,Z.jsxs)(`span`,{className:`text-faint`,children:[`· `,Ie(e.at)]}),e.ip?` · ${e.ip}`:``]})]})]},e.id)})}):null,b.next&&!b.loading?(0,Z.jsx)(`div`,{className:`border-t border-line p-3 text-center`,children:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,onClick:b.loadMore,disabled:b.more,className:`lg:h-9`,"data-sw-audit-more":!0,children:[b.more?(0,Z.jsx)(w,{}):null,` Load older events`]})}):null]})]})}var Kr=[`cards`,`agents`,`tokens`,`members`,`data`],qr={cards:`Agent edits and pushes`,agents:`Agents and machines`,tokens:`Tokens and share links`,members:`Members and roles`,data:`Exports and deletes`},Jr={cards:`Allow on an agent's edit or command, Push this fix, approving an agent run or a shell command`,agents:`approving a machine or an agent, who may use an agent, its approval rule, the project agent policy`,tokens:`new API tokens, new share links, turning share links or public projects on, making a project public`,members:`inviting an admin, making someone an admin, changing or removing an admin`,data:`exporting the workspace, deleting a project or a board`},Yr=[5,15,30,60],Xr=[...new Set([{method:`POST`,path:`/auth/passkeys/options`,first:!0,says:`adding or removing a passkey`},{method:`POST`,path:`/auth/passkeys/verify`,first:!0,says:`adding or removing a passkey`},{method:`DELETE`,path:`/auth/passkeys/:id`,held:!0,says:`adding or removing a passkey`},{method:`POST`,path:`/auth/recovery-codes`,says:`new recovery codes`},{method:`POST`,path:`/auth/tailnet/link`,says:`linking or unlinking a tailnet login`},{method:`DELETE`,path:`/auth/tailnet/link`,says:`linking or unlinking a tailnet login`},{method:`DELETE`,path:`/auth/me`,says:`deleting your account`},{method:`DELETE`,path:`/api/workspaces/:ws`,role:`owner`,says:`deleting a workspace`},{inRoute:`console-routes.js roleStepUp`,says:`making someone an owner, changing or removing an owner (leaving as one too), inviting an owner`},{inRoute:`rebind.js POST /auth/rebind/start`,says:`moving your account to the server's new address`},{inRoute:`step-up-settings.js change`,says:`making these settings weaker`}].map(e=>e.says))];Object.freeze({cards:!1,agents:!1,tokens:!1,members:!1,data:!1,adminIdle:!1,cliApproval:!1,windowMinutes:15});var Zr=e=>e===60?`1 hour`:`${e} minutes`,Qr=[`deleting a workspace or your account`,`making, changing or removing an owner`,`inviting an owner`];function $r({id:e,title:t,children:n,control:r}){return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-3 sm:px-5`,"data-sw-step-up-row":e,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-ui text-muted`,children:n})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:r})]})}var ei=({on:e})=>(0,Z.jsx)(`span`,{className:e?`text-ui font-medium text-fg`:`text-ui text-muted`,"data-sw-step-up-state":e?`on`:`off`,children:e?`On`:`Off`});function ti(){let{data:e,isOwner:t,workspaceId:n,reload:r}=$(),i=F(),a=N(),o=e.workspace.settings.stepUp;if(!o)return null;let s=[...Kr.filter(e=>o[e]).map(e=>qr[e]),...o.adminIdle?[`Admin pages after 12 hours away`]:[],...o.cliApproval?[`Approve command line logins in the browser`]:[]];if(e.features?.passkeys===!1)return(0,Z.jsxs)(R,{"data-sw-settings-step-up":`tailnet-only`,children:[(0,Z.jsx)(G,{icon:qe,title:`Confirming changes`,description:`Your Tailscale account is the sign-in on this server, so there is no passkey to ask for again.`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-ui text-muted sm:px-5`,children:[(0,Z.jsxs)(`p`,{children:[`Being signed in with the right role is enough for everything in this workspace. Before `,Qr.join(`; `),`, Shapewall asks you to type the workspace’s name (or your handle) to confirm.`]}),(0,Z.jsx)(`p`,{children:`The tailnet is the boundary: anything running as you on one of your tailnet devices can act as you here. Whoever runs the server can also allow passkeys (shapewall hosted admin passkeys on); then an account that adds one confirms with it, and the switches for asking again appear here.`}),s.length?(0,Z.jsxs)(U,{tone:`warn`,title:`Switched on here, and not asked while this server has passkeys off`,"data-sw-step-up-not-asked":!0,children:[s.join(`; `),`. These were switched on in this workspace when the server had passkeys. They are kept, and asked again when whoever runs the server allows passkeys again.`]}):null]})]});let c=Kr.some(e=>o[e])||o.adminIdle,l=(e,t)=>a.run(async()=>{await L.patch(q(n,`/step-up`),e),await r(),i(t)}),u=(e,n,r,i)=>t?(0,Z.jsx)(Ee,{checked:n,label:i,disabled:a.busy,onChange:e=>l(r(e),`${i}: ${e?`the passkey is asked for again`:`no longer asks for the passkey`}`)}):(0,Z.jsx)(ei,{on:n});return(0,Z.jsxs)(R,{"data-sw-settings-step-up":!0,children:[(0,Z.jsx)(G,{icon:qe,title:`Ask for a passkey again`,description:`Being signed in with the right role is enough for everything in this workspace. Switch on what you want confirmed with a passkey again before it happens.`}),(0,Z.jsxs)(`ul`,{className:`divide-y divide-line`,children:[Kr.map(e=>(0,Z.jsxs)($r,{id:e,title:qr[e],control:u(e,o[e],t=>({group:e,on:t}),qr[e]),children:[`Before: `,Jr[e],`.`]},e)),(0,Z.jsx)($r,{id:`adminIdle`,title:`Admin pages after 12 hours away`,control:u(`adminIdle`,o.adminIdle,e=>({adminIdle:e}),`Admin pages after 12 hours away`),children:`Members, tokens, the audit log and the other admin pages ask once more when you come back after 12 hours without opening one.`}),e.features?.tailnetSignIn?(0,Z.jsx)($r,{id:`cliApproval`,title:`Approve command line logins in the browser`,control:u(`cliApproval`,o.cliApproval,e=>({cliApproval:e}),`Approve command line logins in the browser`),children:`Off: shapewall login and agent connect on a tailnet machine are approved by that machine’s tailnet user, with no code. A tailnet identity is per device, not per person: anything running as you on a tailnet device of yours can act as you here. On: a session that only a tailnet identity stands behind is refused three things, which need a passkey check instead: approving a command line login or an agent, making an API token, and inviting or making an admin (an admin can do the first two). Everything else such a session may do in this workspace stays as it is.`}):null,(0,Z.jsx)($r,{id:`window`,title:`One check counts for`,control:t?(0,Z.jsxs)(j,{value:String(o.windowMinutes),onValueChange:e=>l({windowMinutes:Number(e)},`One passkey check now counts for ${Zr(Number(e))}`),disabled:a.busy,children:[(0,Z.jsx)(k,{size:`touch`,className:`w-36 lg:h-9`,"aria-label":`One check counts for`,"data-sw-step-up-window":!0,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:Yr.map(e=>(0,Z.jsx)(A,{value:String(e),children:Zr(e)},e))})]}):(0,Z.jsx)(`span`,{className:`text-ui text-fg`,children:Zr(o.windowMinutes)}),children:c?`After a passkey check, what is switched on above is not asked again for this long.`:`Nothing above is switched on, so nothing here asks yet.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2 border-t border-line px-4 py-3.5 text-ui text-muted sm:px-5`,"data-sw-step-up-always":!0,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:`Always asked, on every server`}),` (once every 10 minutes): `,Xr.join(`; `),`.`]}),(0,Z.jsxs)(`p`,{children:[t?`Switching something on needs nothing more. Switching it off, or a longer time, asks for your passkey.`:`Only an owner changes these.`,` `,`A session that started with a recovery code is always asked.`]}),(0,Z.jsx)(H,{error:a.error})]})]})}function ni(){let{data:e,isAdmin:t,isOwner:n,workspaceId:r,reload:i}=$(),{me:a,refresh:o}=Ne(),s=F(),[c,l]=(0,Q.useState)(e.workspace.name);(0,Q.useEffect)(()=>l(e.workspace.name),[e.workspace.name]);let d=N(),f=N(),p=N(),m=N(),h=N(),g=N(),[_,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),T=e.members.filter(e=>e.role===`owner`).length,E=n&&T<=1,ee=e.workspace.settings.shareLinks,D=!!e.features?.publicProjects,O=!!e.workspace.settings.publicProjects,k=e.features?.deleteWorkspace!==!1,te=e=>f.run(async()=>{await L.patch(q(r,`/settings`),{shareLinks:e}),await i(),C(null),s(e?`Share links are on`:`Share links are off. Every link stopped working.`)}),ne=e=>p.run(async()=>{await L.patch(q(r,`/public-projects`),{enabled:e}),await i(),C(null),s(e?`Public projects are on`:`Public projects are off. Every public URL was cleared.`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{title:`Settings`,description:`The workspace name, sharing, what asks you to confirm again, export, and leaving or deleting it.`}),(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[(0,Z.jsxs)(R,{children:[(0,Z.jsx)(G,{icon:Kt,title:`Name`,description:`Shown to members, in invites and to guests of share links.`}),(0,Z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d.run(async()=>{await L.patch(q(r),{name:c}),await Promise.all([i(),o()]),s(`Workspace renamed`)})},className:`flex flex-col gap-3 px-4 py-4 sm:flex-row sm:items-end sm:px-5`,children:[(0,Z.jsx)(V,{label:`Workspace name`,className:`flex-1`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:c,onChange:e=>l(e.target.value),maxLength:80,disabled:!t,"data-sw-settings-name":!0})}),t?(0,Z.jsxs)(u,{type:`submit`,size:`touch`,variant:`secondary`,disabled:d.busy||!c.trim()||c===e.workspace.name,children:[d.busy?(0,Z.jsx)(w,{}):null,` Save`]}):null]}),d.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:d.error})}):null]}),(0,Z.jsxs)(R,{"data-sw-settings-shares":!0,children:[(0,Z.jsx)(G,{icon:Rt,title:`Share links`,description:`Let admins share a project's boards with people outside the workspace, view-only or with guest comments.`,actions:t?(0,Z.jsx)(Ee,{checked:ee,label:`Share links`,disabled:f.busy,onChange:e=>e?te(!0):C(`shares`)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(`p`,{children:ee?`On. Each link reaches one project, expires, can have a passcode and can be revoked. Turning this off stops every link at once; turning it back on restores the ones that are not revoked or expired.`:t?`Off. No share link works in this workspace.`:`Off. No share link works in this workspace. An admin can turn them on.`}),S===`shares`?null:(0,Z.jsx)(H,{error:f.error})]})]}),D?(0,Z.jsxs)(R,{"data-sw-settings-public":!0,children:[(0,Z.jsx)(G,{icon:Ye,title:`Public projects`,description:`Let the owner put a project on the open web: anyone with its URL can view the boards and comments, and change nothing.`,actions:n||t&&O?(0,Z.jsx)(Ee,{checked:O,label:`Public projects`,disabled:p.busy,onChange:e=>e?ne(!0):C(`public`)}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsx)(`p`,{children:O?`On. An owner makes a project public on its page. Public boards are view-only and not indexed. Turning this off clears every public URL for good.`:n?`Off. Each project still stays private until you make it public.`:`Off. Only an owner can turn public projects on.`}),S===`public`?null:(0,Z.jsx)(H,{error:p.error})]})]}):null,(0,Z.jsx)(ti,{}),t?(0,Z.jsxs)(R,{"data-sw-settings-export":!0,children:[(0,Z.jsx)(G,{icon:$e,title:`Export`,description:be(`A zip of the workspace: members, projects, every board's pages and screenshots, comments and the audit log. No secrets.`),actions:(0,Z.jsxs)(u,{size:`touch`,variant:`secondary`,disabled:g.busy||v,onClick:()=>g.run(async()=>{let e=await pe(`POST`,q(r,`/export`),{},`shapewall-export.zip`);s(`Saved ${e.name}`)}),className:`lg:h-9`,"data-sw-export":!0,children:[g.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)($e,{size:15,"aria-hidden":`true`}),` Download a copy`]})}),g.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:g.error})}):null]}):null,(0,Z.jsx)(R,{className:`border-bad/30`,children:(0,Z.jsx)(G,{icon:At,title:`Leave workspace`,description:E?`You are the only owner. Make someone else an owner first.`:`You lose access to every project here.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,onClick:()=>y(!0),disabled:E,className:`border border-bad/40 lg:h-9`,"data-sw-leave-workspace":!0,children:`Leave`})})}),n?(0,Z.jsxs)(R,{className:`border-bad/30`,children:[(0,Z.jsx)(G,{icon:yt,title:`Delete workspace`,description:k?`Every project, board, capture, comment, token, invite, share link and the audit log are deleted. This cannot be undone.`:`The demo keeps this workspace, so there is always something to look at. On a real server, the owner deletes a workspace here.`,actions:(0,Z.jsx)(u,{size:`touch`,variant:`danger`,disabled:!k,onClick:()=>x(!0),className:`border border-bad/40 lg:h-9`,"data-sw-delete-workspace":!0,children:`Delete workspace`})}),k?(0,Z.jsx)(`div`,{className:`px-4 py-3 sm:px-5`,children:(0,Z.jsx)(U,{tone:`info`,children:`Download a copy first (Export, above) if you may want any of it later.`})}):null]}):null]}),(0,Z.jsx)(z,{open:_,onClose:()=>y(!1),title:`Leave ${e.workspace.name}?`,confirmLabel:`Leave workspace`,tone:`danger`,busy:m.busy,error:m.error,onConfirm:()=>m.run(async()=>{await L.delete(q(r,`/members/${a.user.id}`)),Je(`/`)}),children:(0,Z.jsx)(`p`,{children:`You lose access to every project here, and your pending invites, share links and API tokens are revoked. An admin can invite you again.`})}),(0,Z.jsx)(z,{open:S===`shares`,onClose:()=>C(null),title:`Turn share links off?`,confirmLabel:`Turn off`,tone:`danger`,busy:f.busy,error:f.error,onConfirm:()=>te(!1),children:(0,Z.jsx)(`p`,{children:`Every share link in this workspace stops working at once, including for guests who have a board open now. Turning this back on restores the links that are not revoked or expired.`})}),(0,Z.jsxs)(z,{open:S===`public`,onClose:()=>C(null),title:`Turn public projects off?`,confirmLabel:`Turn off`,tone:`danger`,busy:p.busy,error:p.error,onConfirm:()=>ne(!1),children:[(0,Z.jsx)(`p`,{children:`Every public URL in this workspace stops working at once, for everyone you sent one to.`}),(0,Z.jsx)(`p`,{className:`text-bad`,children:`This cannot be undone. The public URLs are cleared for good: turning public projects back on publishes nothing, and a project made public again gets a new URL.`})]}),(0,Z.jsx)(z,{open:b,onClose:()=>x(!1),title:`Delete ${e.workspace.name}?`,confirmLabel:`Delete forever`,tone:`danger`,confirmText:e.workspace.name,busy:h.busy,error:h.error,onConfirm:()=>h.run(async()=>{await He(e.workspace.name,()=>L.delete(q(r),{confirm:e.workspace.name})),Je(`/`)}),children:(0,Z.jsxs)(`p`,{children:[e.members.length,` `,e.members.length===1?`person loses`:`people lose`,` access, and `,e.projects.length,` `,e.projects.length===1?`project is`:`projects are`,` deleted with all their boards and comments. API tokens and share links stop working.`]})})]})}var ri=(0,Q.lazy)(()=>rt(()=>import(`./usage-CLrlKCWx.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),ii=(0,Q.createContext)(null),$=()=>(0,Q.useContext)(ii),ai=[[`projects`,`Projects`,lt,`viewer`],[`members`,`Members`,hn,`viewer`],[`invites`,`Invites`,Bt,`admin`],[`access`,`Access`,Te,`admin`],[`tokens`,`API tokens`,qe,`admin`],[`audit`,`Audit log`,Xt,`admin`],[`agents`,`Agents`,s,v?`viewer`:`admin`],[`usage`,`Usage`,xe,`member`],[`activity`,`Activity`,St,`viewer`],[`feedback`,`Agent feedback`,Qe,`admin`],[`settings`,`Settings`,vt,`viewer`]];function oi({workspaceId:e,section:t,projectId:n,subjectId:r=null}){let a=I(q(e)),s=o(`(min-width: 1024px)`),c=a.data,l=n?c?.projects.find(e=>e.id===n)?.name||`Project`:null,u=n?t===`agents`&&!v?`Agents of ${l}`:l:ai.find(([e])=>e===t)?.[1]||`Projects`,d=c?.workspace.name;if((0,Q.useEffect)(()=>{d&&(document.title=[u,d,`Shapewall`].join(` · `))},[u,d]),a.loading&&!a.data)return(0,Z.jsx)(W,{});if(!a.data)return a.error?.status===404?(0,Z.jsxs)(R,{className:`p-8 text-center`,children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:`Workspace not found`}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:`It does not exist, or you are not in it.`}),(0,Z.jsx)(P,{to:`/`,className:`mt-4 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to your workspaces`})]}):(0,Z.jsx)(K,{error:a.error,onRetry:a.reload});let f=a.data,p=f.role,m={workspaceId:e,data:f,reload:a.reload,role:p,isAdmin:gn(p,`admin`),isOwner:p===`owner`},h=ai.filter(([e])=>e!==`feedback`||f.features?.agentFeedback),g=h.filter(([,,,e])=>gn(p,e)),_=ai.find(([e])=>e===t&&h.some(([t])=>t===e)&&!g.some(([t])=>t===e)),y=_||g.some(([e])=>e===t)?t:`projects`,b=!!n&&t===`agents`&&!v,x=b?`agents`:n?`projects`:y,S;return S=_?(0,Z.jsx)(ci,{section:_[1],least:_[3],role:p,workspaceId:e}):b?(0,Z.jsx)(wr,{projectId:n},n):n?(0,Z.jsx)(jr,{projectId:n}):y===`members`?(0,Z.jsx)(Pr,{}):y===`invites`?(0,Z.jsx)(Mr,{}):y===`access`?(0,Z.jsx)(Rr,{}):y===`tokens`?(0,Z.jsx)(Xn,{}):y===`audit`?(0,Z.jsx)(Gr,{}):y===`agents`?v?(0,Z.jsx)(mt,{}):(0,Z.jsx)(Cr,{}):y===`usage`||y===`activity`?(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(W,{label:`Loading the page`,rows:4}),children:(0,Z.jsx)(ri,{section:y,subjectId:r})}):y===`settings`?(0,Z.jsx)(ni,{}):y===`feedback`?(0,Z.jsx)(ht,{baseUrl:q(e,`/agent-feedback`),get:L.get}):(0,Z.jsx)(Rn,{}),(0,Z.jsxs)(ii.Provider,{value:m,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-2 lg:hidden`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 truncate text-lg font-semibold text-fg`,children:f.workspace.name}),(0,Z.jsx)(J,{role:p})]}),(0,Z.jsx)(Pn,{label:f.workspace.name,sections:g.map(([t,n,r])=>({id:`ws-${t}`,label:n,icon:r,to:t===`projects`?`/w/${e}`:`/w/${e}/${t}`,active:x===t,"data-sw-nav":t}))}),(0,Z.jsxs)(`div`,{children:[s?null:(0,Z.jsx)(`nav`,{"aria-label":`Workspace`,className:`-mx-3 mb-5`,children:(0,Z.jsx)(si,{active:x,children:g.map(([t,n,r])=>(0,Z.jsx)(`li`,{className:`shrink-0`,children:(0,Z.jsxs)(P,{to:t===`projects`?`/w/${e}`:`/w/${e}/${t}`,"aria-current":x===t?`page`:void 0,className:i(`flex h-11 items-center gap-2.5 rounded-full border px-3.5 text-sm font-medium whitespace-nowrap outline-none focus-visible:outline-2 focus-visible:outline-accent`,x===t?`border-accent/40 bg-accent/10 text-fg`:`border-line bg-surface text-muted hover:text-fg`),"data-sw-nav":t,children:[(0,Z.jsx)(r,{size:16,"aria-hidden":`true`,className:x===t?`text-accent`:``}),n]})},t))})}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:S})]})]})}function si({active:e,children:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)({left:!1,right:!1}),a=(0,Q.useCallback)(()=>{let e=n.current;if(!e)return;let t=e.scrollLeft>4,r=e.scrollLeft+e.clientWidth<e.scrollWidth-4;i(e=>e.left===t&&e.right===r?e:{left:t,right:r})},[]);return(0,Q.useEffect)(()=>(n.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}),a(),window.addEventListener(`resize`,a),()=>window.removeEventListener(`resize`,a)),[e,a]),(0,Z.jsxs)(`div`,{className:`relative`,"data-sw-nav-pills":!0,children:[(0,Z.jsx)(`ul`,{ref:n,onScroll:a,className:`sw-scroll-x flex scroll-pr-10 scroll-pl-8 gap-1 overflow-x-auto px-3`,children:t}),r.left?(0,Z.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-0 w-8 sw-nav-fade-left`,"aria-hidden":`true`}):null,r.right?(0,Z.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-0 w-10 sw-nav-fade-right`,"aria-hidden":`true`,"data-sw-nav-more":!0}):null]})}function ci({section:e,least:t,role:n,workspaceId:r}){return(0,Z.jsxs)(R,{className:`p-8 text-center`,"data-sw-needs-role":t,children:[(0,Z.jsx)(`span`,{className:`inline-flex h-11 w-11 items-center justify-center rounded-xl bg-surface-2 text-muted`,children:(0,Z.jsx)(Ge,{size:20,"aria-hidden":`true`})}),(0,Z.jsxs)(`h1`,{className:`mt-4 text-lg font-semibold text-fg`,children:[`This page needs the `,B[t].toLowerCase(),` role`]}),(0,Z.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[e,` is for `,t===`member`?`members, admins and owners`:`admins and owners`,`. You are a`,` `,B[n].toLowerCase(),` here; ask an admin if you need it.`]}),(0,Z.jsx)(P,{to:`/w/${r}`,className:`mt-4 inline-block text-sm font-medium text-accent underline-offset-2 hover:underline`,children:`Back to the projects`})]})}var li=e=>`${e===`owner`||e===`admin`?`an`:`a`} ${B[e].toLowerCase()}`,ui=e=>e.map(e=>`${e.workspace} as ${li(e.role)}`).join(`, `);function di({tailnet:e,signup:t,onSignedIn:n,passkeysOff:r=!1}){let[i,a]=(0,Q.useState)(e.suggested?.handle||``),[o,s]=(0,Q.useState)(e.suggested?.displayName||e.name||``),c=N();if(e.state===`self`)return(0,Z.jsxs)(U,{tone:`info`,className:`mt-4`,title:`This is the server’s own machine`,"data-sw-tailnet":`self`,children:[`This server signs tailnet users in, but never from the machine it runs on: any program on this machine could ask the same way.`,` `,r?`Open the server from another of your tailnet devices. On this machine, whoever runs the server uses shapewall hosted admin.`:`Sign in with a passkey here, or open the server from another of your tailnet devices.`]});if(e.state===`changed`)return(0,Z.jsxs)(U,{tone:`warn`,className:`mt-4`,title:`This tailnet login belongs to someone else here`,"data-sw-tailnet":`changed`,children:[`An account on this server is linked to `,e.login,`, but for a different tailnet user than the one your device is signed in as: the name was given to someone else, or your device is shared in from another tailnet.`,` `,r?`If the account is yours, ask whoever runs this server.`:`Sign in with a passkey, or ask whoever runs this server.`,e.fix?(0,Z.jsxs)(`span`,{className:`mt-2 block`,"data-sw-tailnet-fix":!0,children:[`They run, on the server: `,(0,Z.jsx)(`code`,{className:`font-mono text-[12px] break-all text-fg`,children:e.fix})]}):null]});if(e.state===`none`)return(0,Z.jsxs)(U,{tone:`info`,className:`mt-4`,title:`Your tailnet did not say who you are`,"data-sw-tailnet":`none`,children:[`This server signs tailnet users in, but this device is not a person’s (a tagged device, or a node shared in without a user).`,` `,r?`Open it from one of your own tailnet devices.`:`Sign in with a passkey instead.`]});if(e.state===`signed_out`||e.state===`linked`)return(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,"data-sw-tailnet":e.state,children:[e.state===`linked`?(0,Z.jsx)(U,{tone:`info`,title:`You arrive as ${e.login}`,children:`Your tailnet login is linked to an account here. Continue to sign in with it.`}):(0,Z.jsxs)(U,{tone:`info`,title:`You signed out on this browser`,children:[`Your tailnet still says you are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`, and arriving here would sign you straight back in. So this browser stays signed out until you continue.`]}),(0,Z.jsxs)(u,{variant:`default`,size:`touch`,className:`w-full text-[15px]`,disabled:c.busy,onClick:()=>c.run(async()=>n(await L.post(`/auth/tailnet/sign-in`,{}))),"data-sw-tailnet-continue":!0,children:[c.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)(Et,{size:17,"aria-hidden":`true`}),`Continue as `,e.login]}),(0,Z.jsx)(H,{error:c.error})]});let l=e.state===`invited`,d=!l&&t===`open`;return(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,"data-sw-tailnet":e.state,children:[(0,Z.jsx)(U,{tone:l?`ok`:`info`,title:l?`You are invited: ${ui(e.invites)}`:`You arrived as ${e.login}`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[`Your tailnet says you are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`, and that is your sign-in here: no passkey and no password. You can add a passkey later.`]}):d?(0,Z.jsx)(Z.Fragment,{children:`Nobody has invited you to a workspace here yet. You can start a workspace of your own, signed in by your tailnet login.`}):(0,Z.jsxs)(Z.Fragment,{children:[`Your tailnet says who you are, but being on the tailnet does not put you in a workspace: an admin decides who is in, and with which role. Ask an admin of a workspace here to invite `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:e.login}),`. They see that you arrived on their Members page.`]})}),l||d?(0,Z.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),c.run(async()=>n(await L.post(`/auth/tailnet/join`,{handle:i,displayName:o})))},noValidate:!0,children:[(0,Z.jsx)(V,{label:`Your name`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:o,onChange:e=>s(e.target.value),maxLength:60,"data-sw-tailnet-name":!0})}),(0,Z.jsx)(V,{label:`Handle`,hint:`People @mention you with it. Lowercase letters, digits and dashes.`,children:e=>(0,Z.jsx)(M,{...e,size:`touch`,value:i,onChange:e=>a(e.target.value.toLowerCase().replace(/\s+/g,`-`)),autoCapitalize:`none`,spellCheck:!1,maxLength:32,"data-sw-tailnet-handle":!0})}),(0,Z.jsx)(H,{error:c.error}),(0,Z.jsxs)(u,{type:`submit`,variant:`default`,size:`touch`,className:`w-full text-[15px]`,disabled:c.busy||!o.trim()||i.length<3,"data-sw-tailnet-join":!0,children:[c.busy?(0,Z.jsx)(w,{}):(0,Z.jsx)(Et,{size:17,"aria-hidden":`true`}),l?`Join`:`Start a workspace`,` as `,e.login]})]}):null]})}function fi(){let{me:e,refresh:t}=Ne(),n=F(),r=N(),[i,a]=(0,Q.useState)(!1),o=e?.tailnet;if(!o)return null;let s=e.via===`tailnet`,c=e.passkeys.length===0;return e.passkeysOff?(0,Z.jsxs)(R,{id:`account-tailnet`,"data-sw-account-tailnet":`only`,children:[(0,Z.jsx)(G,{icon:Wt,title:`Sign-in`,description:`Your Tailscale account is the sign-in on this server.`}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[(0,Z.jsxs)(`p`,{children:[`You are `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.linked}),`, on every tailnet device of yours. There is no passkey and no password here.`]}),(0,Z.jsx)(`p`,{children:`The tailnet is the boundary: anything running as you on one of your tailnet devices can act as you here. Lock your devices, and keep the tailnet to people and machines you trust. The few things Shapewall always asks about (deleting a workspace or your account, changing owners) ask you to type a name to confirm.`}),(0,Z.jsx)(`p`,{children:`Signing out keeps this browser signed out until you press Continue on the sign-in page.`})]})]}):(0,Z.jsxs)(R,{id:`account-tailnet`,"data-sw-account-tailnet":!0,children:[(0,Z.jsx)(G,{icon:Wt,title:`Tailnet sign-in`,description:`This server signs you in by your tailnet login when you arrive through the tailnet, with no passkey.`,actions:o.linked?(0,Z.jsx)(u,{size:`touch`,variant:`secondary`,className:`lg:h-9`,onClick:()=>a(!0),"data-sw-tailnet-unlink":!0,children:`Unlink`}):o.here?(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,disabled:r.busy,onClick:()=>r.run(async()=>{await L.post(`/auth/tailnet/link`,{}),await t(),n(`Linked to ${o.here}`)}),"data-sw-tailnet-link":!0,children:[r.busy?(0,Z.jsx)(w,{}):null,` Link `,o.here]}):null}),(0,Z.jsxs)(`div`,{className:`space-y-2 px-4 py-4 text-sm text-muted sm:px-5`,children:[o.linked?(0,Z.jsxs)(`p`,{children:[`Linked to `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.linked}),o.linkedAt?(0,Z.jsxs)(Z.Fragment,{children:[` `,`since `,(0,Z.jsx)(Y,{value:o.linkedAt})]}):null,`. `,s?`You are signed in that way now.`:`Arriving through the tailnet as that login signs you in.`]}):o.here?(0,Z.jsxs)(`p`,{children:[`You arrive as `,(0,Z.jsx)(`span`,{className:`font-medium text-fg`,children:o.here}),`. Link it and that login signs you in here from any of your tailnet devices. Linking asks for your passkey, like adding one.`]}):(0,Z.jsx)(`p`,{children:`Not linked. Open this page through the tailnet, from one of your own devices, to link your tailnet login.`}),o.ownMachine?(0,Z.jsx)(U,{tone:`info`,"data-sw-tailnet-own-machine":!0,children:`This browser is on the server’s own machine. Your tailnet identity is never taken from here (any program on this machine could ask the same way), so linking and tailnet sign-in work from your other tailnet devices.`}):null,o.linked&&o.here&&o.here!==o.linked?(0,Z.jsxs)(U,{tone:`warn`,children:[`This device arrives as `,o.here,`, not as the login your account is linked to. Tailnet sign-in will not sign you in from it.`]}):null,s?(0,Z.jsxs)(`p`,{children:[c?`You have no passkey. That is fine for everything in a workspace. A few things always need one: deleting a workspace or your account, changing owners, recovery codes. Add a passkey above before you need them: a first passkey signs in at once, and can confirm those things 24 hours after it is added.`:`A tailnet session works only on requests that arrive as your login: its cookie is worth nothing off the tailnet.`,` `,`Your tailnet identity is per device, not per person: anything running as you on a tailnet device of yours can act as you here. Signing out keeps this browser signed out until you press Continue on the sign-in page.`]}):null,(0,Z.jsx)(H,{error:r.error})]}),(0,Z.jsx)(z,{open:i,onClose:()=>a(!1),title:`Unlink ${o.linked}?`,confirmLabel:`Unlink`,tone:`danger`,busy:r.busy,error:r.error,onConfirm:()=>r.run(async()=>{let e=await L.delete(`/auth/tailnet/link`);if(a(!1),e.signedOut)return window.location.assign(`/signin`);await t(),n(`Unlinked. Your tailnet no longer signs you in here.`)}),children:(0,Z.jsxs)(`p`,{children:[`Your tailnet login stops signing you in, and sessions that came in that way end. You sign in with a passkey from then on.`,c?` You have no passkey yet: add one first, or you would be locked out.`:``,` Unlinking asks for your passkey.`]})})]})}function pi({onJoined:e}){let{me:t,refresh:n}=Ne(),r=N(),i=t?.tailnet?.invites||[];return i.length?(0,Z.jsxs)(U,{tone:`ok`,className:`mb-5`,title:`You are invited: ${ui(i)}`,"data-sw-tailnet-invites":!0,action:(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-8`,disabled:r.busy,onClick:()=>r.run(async()=>{let t=await L.post(`/auth/tailnet/join`,{});await n(),e?.(t)}),"data-sw-tailnet-accept":!0,children:[r.busy?(0,Z.jsx)(w,{}):null,` Join`]}),children:[`An admin invited your tailnet login. `,r.error||``]}):null}function mi({onInvited:e}){let{workspaceId:n,data:r,role:i}=$(),a=F(),o=!!r.features?.tailnetSignIn,s=I(o?q(n,`/tailnet-visitors`):null),c=N(),[l,d]=(0,Q.useState)({}),f=En(i);(0,Q.useEffect)(()=>d({}),[n]);let p=s.data?.visitors||[];if(!o||!p.length)return null;let m=t=>c.run(async()=>{let r=l[t.login]||`member`;await L.post(q(n,`/invites`),{role:r,tailnetLogin:t.login,expiresInDays:7}),await s.reload(),await e?.(),a(`${t.login} can join as ${li(r)} the next time they open this server`)}),h=e=>c.run(async()=>{await L.delete(q(n,`/tailnet-visitors/${encodeURIComponent(e.login)}`)),await s.reload()});return(0,Z.jsxs)(R,{className:`mb-5`,"data-sw-tailnet-visitors":!0,children:[(0,Z.jsx)(G,{icon:Wt,title:`Arrived through the tailnet`,description:`People on your tailnet who opened this server and are in no workspace. Being on the tailnet gives them nothing: invite the ones who belong here, with a role.`}),(0,Z.jsx)(`ul`,{className:`divide-y divide-line`,children:p.map(e=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-4 py-3 sm:px-5`,"data-sw-tailnet-visitor":e.login,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-[1_1_14rem]`,children:[(0,Z.jsxs)(`p`,{className:`truncate text-sm font-medium text-fg`,children:[e.name||e.login,` `,(0,Z.jsx)(T,{className:`ml-1 px-2 py-0.5 text-[11px]`,children:`not a member`})]}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted`,children:[e.login,` · last here `,(0,Z.jsx)(Y,{value:e.lastSeenAt})]})]}),(0,Z.jsxs)(j,{value:l[e.login]||`member`,onValueChange:t=>d(n=>({...n,[e.login]:t})),children:[(0,Z.jsx)(k,{size:`touch`,className:`w-32 lg:h-9`,"aria-label":`Role for ${e.login}`,children:(0,Z.jsx)(O,{})}),(0,Z.jsx)(E,{children:f.map(e=>(0,Z.jsx)(A,{value:e,children:B[e]},e))})]}),(0,Z.jsxs)(u,{size:`touch`,variant:`default`,className:`lg:h-9`,disabled:c.busy,onClick:()=>m(e),"data-sw-tailnet-admit":!0,children:[(0,Z.jsx)(dn,{size:15,"aria-hidden":`true`}),` Invite`]}),(0,Z.jsx)(u,{size:`touch`,variant:`ghost`,className:`lg:h-9`,disabled:c.busy,onClick:()=>h(e),"aria-label":`Take ${e.login} off this list`,title:`Take off this list`,children:(0,Z.jsx)(t,{size:15,"aria-hidden":`true`})})]},e.login))}),c.error?(0,Z.jsx)(`div`,{className:`px-4 pb-4 sm:px-5`,children:(0,Z.jsx)(H,{error:c.error})}):null]})}export{St as S,It as _,$ as a,Et as b,Pn as c,an as d,en as f,Rt as g,Ht as h,oi as i,kn as l,Jt as m,di as n,Fn as o,Qt as p,pi as r,In as s,fi as t,dn as u,Pt as v,wt as x,Mt as y};
|