@snagset/server 0.1.53 → 0.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/package.json +1 -1
  2. package/static/dashboard/assets/{CompositeItem-BOk-i3nR.js → CompositeItem-D7Q5QVvi.js} +1 -1
  3. package/static/dashboard/assets/{CompositeList-CizhTu5k.js → CompositeList-w7YcjHbo.js} +1 -1
  4. package/static/dashboard/assets/ConfirmDialog-CHiXSDkR.js +1 -0
  5. package/static/dashboard/assets/{CopyButton-Cc6bLGfR.js → CopyButton-DkXHOvAs.js} +1 -1
  6. package/static/dashboard/assets/{FieldItemContext-BYUTQ-zN.js → FieldItemContext-BWEjbC5Z.js} +1 -1
  7. package/static/dashboard/assets/InstallTag-DlqXIhqI.js +17 -0
  8. package/static/dashboard/assets/InstanceRows-DwXLnXU2.js +1 -0
  9. package/static/dashboard/assets/McpTokens-BvQnjHcP.js +1 -0
  10. package/static/dashboard/assets/Picker-CtjWzkpT.js +1 -0
  11. package/static/dashboard/assets/{SaveState-DzF8ZaPe.js → SaveState-DzX_pKjo.js} +1 -1
  12. package/static/dashboard/assets/{_app-1rENGvme.js → _app-B-X6wLWA.js} +1 -1
  13. package/static/dashboard/assets/{_app-ClXa_BSX.js → _app-DW5KDMy_.js} +3 -3
  14. package/static/dashboard/assets/activity-C8vHHVVs.js +1 -0
  15. package/static/dashboard/assets/{arrow-left-DDim6ZAR.js → arrow-left-DbWDuhAv.js} +1 -1
  16. package/static/dashboard/assets/avatar-BL6yPDkc.js +1 -0
  17. package/static/dashboard/assets/{badge-CCBUSB_y.js → badge-Dybw0_bq.js} +1 -1
  18. package/static/dashboard/assets/{card-CBSSmpT3.js → card-DwOk-mSd.js} +1 -1
  19. package/static/dashboard/assets/{check-DJgo7I6A.js → check-Dfkv0gma.js} +1 -1
  20. package/static/dashboard/assets/{chevron-down-60UlZ0Ky.js → chevron-down-BFQamcZy.js} +1 -1
  21. package/static/dashboard/assets/{chevron-right-B5sFu-7i.js → chevron-right-v0My-Qwf.js} +1 -1
  22. package/static/dashboard/assets/{copy-BVdfZXH-.js → copy-Bnl05Zl3.js} +1 -1
  23. package/static/dashboard/assets/createBaseUIEventDetails-DviWdj-N.js +1 -0
  24. package/static/dashboard/assets/dialog-B1TvUOp8.js +6 -0
  25. package/static/dashboard/assets/{dropdown-menu-DBe6PomQ.js → dropdown-menu-DQDS-MXM.js} +3 -3
  26. package/static/dashboard/assets/forgot-B13MZpbf.js +1 -0
  27. package/static/dashboard/assets/getPseudoElementBounds-Bv3Ra6Wj.js +1 -0
  28. package/static/dashboard/assets/{image-off-CMJxtYwl.js → image-off-4dn7EbeZ.js} +1 -1
  29. package/static/dashboard/assets/index-PP-fkxl1.css +1 -0
  30. package/static/dashboard/assets/{index-DXj5DU-z.js → index-_7kIe8FW.js} +3 -3
  31. package/static/dashboard/assets/{inertValue-Bju6oxRr.js → inertValue-BSe8K39O.js} +1 -1
  32. package/static/dashboard/assets/invite-nV6ykkp0.js +1 -0
  33. package/static/dashboard/assets/label-BkHFb2_L.js +1 -0
  34. package/static/dashboard/assets/{layout-grid-DkVlSz3z.js → layout-grid-Dt1Q4YQ_.js} +1 -1
  35. package/static/dashboard/assets/me-BDpKAhA-.js +1 -0
  36. package/static/dashboard/assets/{parts-DUFMukrB.js → parts-DGVjMHe8.js} +1 -1
  37. package/static/dashboard/assets/{plus-1z8Ku-LH.js → plus-hkwBCzos.js} +1 -1
  38. package/static/dashboard/assets/reset-BNNJmqWL.js +1 -0
  39. package/static/dashboard/assets/{s._site-CtQgYzLV.js → s._site-MSdo-oKn.js} +1 -1
  40. package/static/dashboard/assets/{s._site.comments-WC9g6KEV.js → s._site.comments-0jkl72Ja.js} +3 -3
  41. package/static/dashboard/assets/s._site.reviewers-BWi4M9dg.js +1 -0
  42. package/static/dashboard/assets/{s._site.settings-BBmpjCXH.js → s._site.settings-_fxdLl8T.js} +1 -1
  43. package/static/dashboard/assets/select-DjpYopV7.js +6 -0
  44. package/static/dashboard/assets/setup-Ccth7CNk.js +1 -0
  45. package/static/dashboard/assets/sign-in-BeNKRQ7N.js +1 -0
  46. package/static/dashboard/assets/sign-up-B8239y6x.js +1 -0
  47. package/static/dashboard/assets/sites-CekL50U1.js +1 -0
  48. package/static/dashboard/assets/studio-5pj2ZjeU.js +1 -0
  49. package/static/dashboard/assets/{studio-C6rKaKyK.js → studio-pysRGF6Z.js} +1 -1
  50. package/static/dashboard/assets/studio.index-D1Utbxqz.js +1 -0
  51. package/static/dashboard/assets/studio.integrations-M2aLKrz5.js +1 -0
  52. package/static/dashboard/assets/studio.members-C9Gigy9Y.js +6 -0
  53. package/static/dashboard/assets/studio.plan-CVZcQmU2.js +1 -0
  54. package/static/dashboard/assets/{sun-BHujGXQB.js → sun-Ciy3ROc0.js} +1 -1
  55. package/static/dashboard/assets/switch-wRlAfGsi.js +1 -0
  56. package/static/dashboard/assets/{table-DCkeQpxm.js → table-Bd53YpCs.js} +1 -1
  57. package/static/dashboard/assets/useAriaLabelledBy-Dt1pmXDF.js +1 -0
  58. package/static/dashboard/assets/{useBaseQuery-Dl2qdxNT.js → useBaseQuery-DVrotnH-.js} +1 -1
  59. package/static/dashboard/assets/{useCompositeItem-eZ3mWAYz.js → useCompositeItem-fDEe_Juq.js} +1 -1
  60. package/static/dashboard/assets/useQuery-ClGlUO36.js +1 -0
  61. package/static/dashboard/assets/useRender-BO4-nlty.js +1 -0
  62. package/static/dashboard/assets/useScrollLock-DdWilGdG.js +1 -0
  63. package/static/dashboard/assets/{useValueChanged-D634YMNF.js → useValueChanged-Cm4_pRNG.js} +1 -1
  64. package/static/dashboard/assets/{users-kg2hhvKi.js → users-BDCRp6bm.js} +1 -1
  65. package/static/dashboard/assets/{welcome-BjaK019o.js → welcome-CcxTkiVu.js} +2 -2
  66. package/static/dashboard/assets/{widget-signin-D4ZH3Oaw.js → widget-signin-CpAmvjAU.js} +1 -1
  67. package/static/dashboard/assets/you-guotGi3r.js +1 -0
  68. package/static/dashboard/assets/{zod-DrSDAsp7.js → zod-Q9KJcyiZ.js} +1 -1
  69. package/static/dashboard/index.html +2 -2
  70. package/static/widget/build.json +2 -2
  71. package/static/widget/snag.js +1 -1
  72. package/static/widget/snag.runtime.js +1 -1
  73. package/static/dashboard/assets/ConfirmDialog-CUQ3wyl0.js +0 -1
  74. package/static/dashboard/assets/InstallTag-BkUjzO7Q.js +0 -17
  75. package/static/dashboard/assets/InstanceRows-S3bDqoib.js +0 -1
  76. package/static/dashboard/assets/McpTokens-Bj04Bv7o.js +0 -1
  77. package/static/dashboard/assets/activity-yg3O3FDe.js +0 -1
  78. package/static/dashboard/assets/avatar-CE2TkZa-.js +0 -1
  79. package/static/dashboard/assets/dialog-zaKAKGow.js +0 -6
  80. package/static/dashboard/assets/forgot-BYMFyxwU.js +0 -1
  81. package/static/dashboard/assets/index-DVRHlt-r.css +0 -1
  82. package/static/dashboard/assets/invite-DH6dh7D-.js +0 -1
  83. package/static/dashboard/assets/label-BNpdN3Cg.js +0 -1
  84. package/static/dashboard/assets/labels--UUyt9uB.js +0 -1
  85. package/static/dashboard/assets/me-DRWJq-k_.js +0 -1
  86. package/static/dashboard/assets/reset-QshsZ8Pi.js +0 -1
  87. package/static/dashboard/assets/s._site.reviewers-B1wTd7uh.js +0 -1
  88. package/static/dashboard/assets/setup-COktVcsh.js +0 -1
  89. package/static/dashboard/assets/sign-in-D2MXhZPE.js +0 -1
  90. package/static/dashboard/assets/sign-up-DwpcLIA4.js +0 -1
  91. package/static/dashboard/assets/sites-BPdqrX1-.js +0 -1
  92. package/static/dashboard/assets/studio-BGRf9vPd.js +0 -1
  93. package/static/dashboard/assets/studio.index-BWRigBYG.js +0 -1
  94. package/static/dashboard/assets/studio.integrations-CzF2zxXk.js +0 -1
  95. package/static/dashboard/assets/studio.members-C-a4YKia.js +0 -11
  96. package/static/dashboard/assets/studio.plan-BntVcF5I.js +0 -1
  97. package/static/dashboard/assets/switch-DxJ9TWjl.js +0 -1
  98. package/static/dashboard/assets/useAriaLabelledBy-Cx69TO6K.js +0 -1
  99. package/static/dashboard/assets/useQuery-BO7PrbuY.js +0 -1
  100. package/static/dashboard/assets/useRender-0SJIdv0u.js +0 -1
  101. package/static/dashboard/assets/you-2qQEJT_G.js +0 -1
@@ -1 +0,0 @@
1
- import{aV as A,r as f,j as e,B as g,aW as S,q as E,h as I,aX as F,A as N,a2 as L,D as M,F as y}from"./index-DXj5DU-z.js";import{u as C}from"./useQuery-BO7PrbuY.js";import{u as P,a as U}from"./zod-DrSDAsp7.js";import{C as R}from"./card-CBSSmpT3.js";import{X as $,C as B,E as H,H as z,G as V,I as q,J as X}from"./dialog-zaKAKGow.js";import{L as k,I as Y}from"./label-BNpdN3Cg.js";import{T as G,a as J,b as T,c as p,d as K,e as j}from"./table-DCkeQpxm.js";import{C as O}from"./ConfirmDialog-CUQ3wyl0.js";import{C as Q}from"./CopyButton-Cc6bLGfR.js";import{P as W,E as Z}from"./parts-DUFMukrB.js";import{b as D}from"./labels--UUyt9uB.js";import{u as _}from"./me-DRWJq-k_.js";import{C as ee}from"./check-DJgo7I6A.js";import{U as se}from"./users-kg2hhvKi.js";import{P as te}from"./plus-1z8Ku-LH.js";import"./useBaseQuery-Dl2qdxNT.js";import"./inertValue-Bju6oxRr.js";import"./copy-BVdfZXH-.js";function Ne(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),i=C(N.links(s)),c=C(N.origins(s)),[m,o]=f.useState(!1),[n,t]=f.useState(null);f.useEffect(()=>t(null),[s]);const a=i.data?.data??[],x=c.data?.origins[0]?.replace(/\/+$/,"")??"",r=n?`${x}/${n.fragment}`:"",v=e.jsxs(g,{onClick:()=>o(!0),children:[e.jsx(te,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(W,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),n&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(ee,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[n.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:r}),e.jsx(Q,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>t(null),children:e.jsx($,{})})]}),i.isSuccess&&a.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(Z,{icon:e.jsx(se,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(G,{children:[e.jsx(J,{children:e.jsxs(T,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(K,{children:a.map(u=>e.jsx(ne,{link:u,uid:s,onRevoked:()=>t(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(re,{uid:s,open:m,onOpenChange:o,onMinted:t})]})}function ne({link:s,uid:l,onRevoked:i}){const c=S(l),m=E(_().user.role,"settings"),[o,n]=f.useState(!1),t=!!s.revokedAt,a=!t&&new Date(s.expiresAt).getTime()<=Date.now(),x=t||a,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(T,{className:I(x&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",D(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",r," day",r===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?D(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&m&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(O,{open:o,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:c.isPending,onConfirm:()=>{n(!1),i(),c.mutate(s.id)}})]})]})}const ae=M({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function re({uid:s,open:l,onOpenChange:i,onMinted:c}){const m=F(s),o=C({...N.rounds(s),enabled:l}),[n,t]=f.useState(""),{register:a,handleSubmit:x,formState:r,reset:v}=P({resolver:U(ae),defaultValues:{days:"14",roundId:""}}),u=x(async d=>{t("");const b=Number(d.days);try{const w=await m.mutateAsync({name:d.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...d.roundId?{roundId:d.roundId}:{}});c(w),v(),i(!1)}catch(w){t(L(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx(B,{open:l,onOpenChange:i,children:e.jsx(H,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(z,{children:[e.jsx(V,{children:"New reviewer"}),e.jsx(q,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Y,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!r.errors.name,...a("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...a("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),o.data&&o.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...a("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),o.data.data.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id))]})]}),e.jsxs(X,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:r.isSubmitting,children:r.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{Ne as component};
@@ -1 +0,0 @@
1
- import{T as x,p as h,r as g,s as f,z as j,J as N,C as w,j as e,G as b,B as y,D as S,F as r}from"./index-DXj5DU-z.js";import{u as v,a as F}from"./zod-DrSDAsp7.js";import{L as i,I as o}from"./label-BNpdN3Cg.js";const A=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:F(A)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
@@ -1 +0,0 @@
1
- import{U as N,p as y,r as l,A as m,s as S,z as C,C as F,j as e,G as k,B as E,L as c,h as L,D as R,F as u}from"./index-DXj5DU-z.js";import{u as x}from"./useQuery-BO7PrbuY.js";import{u as z,a as A}from"./zod-DrSDAsp7.js";import{L as p,I as h}from"./label-BNpdN3Cg.js";import{C as I}from"./chevron-right-B5sFu-7i.js";import"./useBaseQuery-Dl2qdxNT.js";const U=R({email:u().trim().min(1,"Your email"),password:u().min(1,"Your password")});function P(){const{redirect:f}=N.useSearch(),a=y(),[o,i]=l.useState(""),[s,g]=l.useState(!1),{register:n,handleSubmit:j,formState:r}=z({resolver:A(U)});x({...m.claimed(),enabled:!0}).data===!1&&a({to:"/setup",replace:!0});const t=x(m.setupState()),b=j(async({email:v,password:w})=>{i("");try{await S.login(v,w),C("in"),a({to:f??"/sites",replace:!0})}catch(d){i(d instanceof F?d.message:"Could not reach the server.")}});return e.jsx(k,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...n("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...n("password")})]}),e.jsx(E,{type:"submit",size:"lg",loading:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),t.data?.mail?e.jsx("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:e.jsx(c,{to:"/forgot",className:"text-foreground underline underline-offset-4",children:"Forgot your password?"})}):e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>g(!s),children:[e.jsx(I,{className:L("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),t.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",t.data.signupUrl?e.jsx("a",{href:t.data.signupUrl,className:"text-foreground underline underline-offset-4",children:"Create a studio"}):e.jsx(c,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&!t.data?.mail&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"This instance has no mail set up, so there's no reset email — and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{P as component};
@@ -1 +0,0 @@
1
- import{p,r as u,s as h,z as g,J as f,C as j,j as e,G as N,B as w,L as v,D as y,F as t}from"./index-DXj5DU-z.js";import{u as b,a as S}from"./zod-DrSDAsp7.js";import{L as i,I as o}from"./label-BNpdN3Cg.js";const C=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(C)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
@@ -1 +0,0 @@
1
- import{q as w,a1 as y,r as p,j as e,B as m,L as N,p as A,d as S,s as $,C as k,D as C,F as g}from"./index-DXj5DU-z.js";import{u as E,a as _}from"./zod-DrSDAsp7.js";import{C as D}from"./card-CBSSmpT3.js";import{C as F,E as I,H as L,G as P,I as T,J as z}from"./dialog-zaKAKGow.js";import{L as f,I as j}from"./label-BNpdN3Cg.js";import{P as q,E as H}from"./parts-DUFMukrB.js";import{b as R}from"./labels--UUyt9uB.js";import{u as B}from"./me-DRWJq-k_.js";import{P as b}from"./plus-1z8Ku-LH.js";import{L as G}from"./layout-grid-DkVlSz3z.js";import{I as K}from"./image-off-CMJxtYwl.js";import"./inertValue-Bju6oxRr.js";import"./useBaseQuery-Dl2qdxNT.js";function re(){const s=B(),i=w(s.user.role,"settings"),{add:d}=y.useSearch(),[x,n]=p.useState(!!d&&i);p.useEffect(()=>{d&&i&&n(!0)},[d,i]);const a=s.projects.filter(r=>!r.archived),l=s.projects.filter(r=>r.archived),h=a.reduce((r,o)=>r+o.unresolved,0),t=s.limits.projects.limit,c=t!==null&&a.length>=t,u=t!==null&&a.length>t;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:a.length?`${a.length}${t!==null?` of ${t}`:""} site${a.length===1&&t===null?"":"s"} · ${h} open`:t!==null?`0 of ${t} sites`:void 0,actions:i?e.jsxs(m,{onClick:()=>n(!0),disabled:c,title:c?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(b,{}),"Add a site"]}):void 0}),u&&e.jsxs("div",{role:"status",className:"mb-5 max-w-[1100px] rounded-md border border-border bg-warn-soft px-4 py-3 text-[13px]",children:["This studio has ",a.length," sites and its plan includes ",t,". The newest ",a.length-t," ",a.length-t===1?"is":"are"," ","read-only: comments can be read, nothing new comes in."," ",i?"Archive a site you have finished with, or move to a plan with more.":"An owner or an admin can archive a site or change the plan."]}),a.length===0?e.jsx(D,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(G,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(b,{}),"Add a site"]}):void 0,children:i?"A site is one client website. Add it, paste the tag, and comments start arriving here.":"A site is one client website. An owner or an admin adds it, and its comments appear here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:a.map(r=>e.jsx(v,{p:r},r.uid))}),l.length>0&&e.jsxs("section",{className:"mt-10 max-w-[1100px]","aria-labelledby":"archived-sites",children:[e.jsx("h2",{id:"archived-sites",className:"m-0 mb-1 text-[14px] font-semibold",children:"Archived"}),e.jsx("p",{className:"m-0 mb-4 text-[12.5px] text-muted-foreground",children:"Finished or put away. Every comment is kept and can be read; nothing new comes in, and they do not count toward the plan."}),e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:l.map(r=>e.jsx(v,{p:r},r.uid))})]}),e.jsx(U,{open:x,onOpenChange:n})]})}function v({p:s}){const i=s.archived?"Archived":s.locked?"Read-only":s.status==="paused"?"Paused":null;return e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:`flex h-[150px] items-center justify-center border-b border-border bg-background${s.archived?" opacity-70 grayscale":""}`,children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(K,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),i&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:i})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${R(s.lastActivityAt)}`:""}`})]})]})}const Q=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function U({open:s,onOpenChange:i}){const d=A(),x=S(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=E({resolver:_(Q)}),u=h(async r=>{a("");try{const o=await $.createProject(r.name,"",r.domain);await x.invalidateQueries({queryKey:["me"]}),c(),i(!1),d({to:"/s/$site/comments",params:{site:o.uid}})}catch(o){a(o instanceof k?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(I,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(L,{children:[e.jsx(P,{children:"Add a site"}),e.jsx(T,{children:"One client website. The tag it needs is shown right after."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!t.errors.name,...l("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!t.errors.domain,...l("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(m,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(m,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add site"})]})]})})})}export{re as component};
@@ -1 +0,0 @@
1
- import{j as t,O as o}from"./index-DXj5DU-z.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +0,0 @@
1
- import{q as y,j as e,t as C,a4 as k,r as c,B as x,S as A,d as E,a5 as F,a2 as O,A as h,a6 as R,s as D,a7 as I}from"./index-DXj5DU-z.js";import{u as p}from"./useQuery-BO7PrbuY.js";import{L as P,I as N}from"./label-BNpdN3Cg.js";import{I as U,S as L}from"./InstanceRows-S3bDqoib.js";import{A as T,P as q,a as f}from"./parts-DUFMukrB.js";import{u as S}from"./me-DRWJq-k_.js";import{S as z}from"./SaveState-DzF8ZaPe.js";import{C as B}from"./ConfirmDialog-CUQ3wyl0.js";import{b as _}from"./studio-C6rKaKyK.js";import{c as M}from"./update-duXzIzFS.js";import"./useBaseQuery-Dl2qdxNT.js";import"./dialog-zaKAKGow.js";import"./inertValue-Bju6oxRr.js";import"./labels--UUyt9uB.js";import"./card-CBSSmpT3.js";import"./check-DJgo7I6A.js";import"./copy-BVdfZXH-.js";function Q(){const t=S(),s=p(h.meta()),o=p(h.members()),a=_(),r=y(t.user.role,"studio"),u=C(t),m=k(t),i=p(h.setupState()),l=!i.data?.billingUrl,d=t.user.role==="owner"?i.data?.closeUrl??null:null,[n,j]=c.useState(t.org.name),[b,w]=c.useState(null);c.useEffect(()=>j(t.org.name),[t.org.name]);const v=r&&n.trim().length>0&&n.trim()!==t.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(q,{title:"Studio settings",sub:t.org.name,actions:e.jsx(z,{saving:a.isPending,savedAt:b})}),e.jsx(f,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:g=>{g.preventDefault(),v&&a.mutate(n.trim(),{onSuccess:()=>w(Date.now())})},children:[e.jsx(P,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{id:"studio-name",value:n,readOnly:!r,onChange:g=>j(g.target.value)}),v&&e.jsx(x,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:r?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(f,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(G,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(H,{owner:r})}),s.data?.commit&&s.data.commit!=="unknown"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[t.projects.length," · ",o.data?.data.length??"—"]})]})]})}):l?e.jsx(f,{title:"This studio",description:"What is in it.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites"}),e.jsx("dd",{className:"m-0",children:t.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:o.data?.data.length??"—"})]})}):null,m==="instance"?e.jsx(U,{owner:r}):m==="usage"?e.jsx(L,{}):null,d&&e.jsx(W,{url:d,name:t.org.name})]})}function W({url:t,name:s}){const[o,a]=c.useState(!1),[r,u]=c.useState(!1),m=()=>{u(!0);const i=document.createElement("form");i.method="post",i.action=t;for(const[l,d]of[["csrf",I()],["confirm",s]]){const n=document.createElement("input");n.type="hidden",n.name=l,n.value=d,i.append(n)}document.body.append(i),i.submit()};return e.jsxs(f,{danger:!0,title:"Close this studio",description:"Its sites stop, and after a grace period it is erased with everything in it.",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-4",children:e.jsxs(x,{variant:"outline",className:"border-destructive text-destructive",onClick:()=>a(!0),children:["Close ",s,"…"]})}),e.jsx(B,{open:o,onOpenChange:a,title:`Close ${s}`,description:"Closing stops the studio now and erases it thirty days later.",confirmLabel:"Close this studio",confirmWord:s,busy:r,onConfirm:m,children:e.jsxs("ul",{className:"m-0 flex list-disc flex-col gap-1.5 pl-5 text-[13px] text-ink-soft",children:[e.jsx("li",{children:"Every site stops at once: the widget leaves your clients' pages, nobody can comment, and the dashboard closes for everyone in the studio."}),e.jsx("li",{children:"If the studio pays for a plan, it is cancelled now, with no refund for the rest of the period."}),e.jsx("li",{children:"For thirty days you can reopen it, with every site as it was."}),e.jsx("li",{children:"After that it is erased for good: its sites, threads, comments and screenshots. People who belong to no other studio lose their account with it."})]})})]})}function G({version:t}){const[s,o]=c.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{o({s:"checking"}),M(t).then(a=>o({s:"done",r:a})).catch(()=>o({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function H({owner:t}){const s=E(),o=p(h.instance()),[a,r]=c.useState(null),[u,m]=c.useState(""),i=F({mutationFn:n=>D.setAddress(n),onSuccess:n=>{s.setQueryData(h.instance().queryKey,n),r(null),m(""),R.success("Address saved — every new link is built from it")},onError:n=>m(O(n))}),l=o.data?.address;if(!l)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const d=l.source==="env";return a===null||!t||d?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:l.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:d?"· set by the environment (SNAGSET_BASE_URL)":l.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),t&&!d&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>r(l.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:n=>{n.preventDefault(),i.mutate(a.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(N,{"aria-label":"Address",value:a,onChange:n=>r(n.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(x,{type:"submit",size:"sm",loading:i.isPending,disabled:!a.trim(),children:i.isPending?"Saving…":"Save"}),e.jsx(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(null),children:"Cancel"})]}),u&&e.jsx("span",{className:"text-[12px] text-destructive",children:u}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const ce=()=>y(S().user.role,"settings")?e.jsx(Q,{}):e.jsx(T,{title:"Studio settings"});export{ce as component};
@@ -1 +0,0 @@
1
- import{q as K,j as e,L as U,t as _,d as se,r as i,a5 as P,a6 as T,a2 as M,s as F,a8 as D,B as x,$ as ne,C as G,A as oe}from"./index-DXj5DU-z.js";import{u as V}from"./useQuery-BO7PrbuY.js";import{B}from"./badge-CCBUSB_y.js";import{C as E,E as O,H as R,G as W,I as J,J as H}from"./dialog-zaKAKGow.js";import{L as S,I}from"./label-BNpdN3Cg.js";import{C as ae}from"./ConfirmDialog-CUQ3wyl0.js";import{A as re,P as ie,a as ce}from"./parts-DUFMukrB.js";import{u as Q}from"./me-DRWJq-k_.js";import{C as q}from"./CopyButton-Cc6bLGfR.js";import{b as le}from"./labels--UUyt9uB.js";import{M as de}from"./McpTokens-Bj04Bv7o.js";import"./useBaseQuery-Dl2qdxNT.js";import"./useRender-0SJIdv0u.js";import"./inertValue-Bju6oxRr.js";import"./check-DJgo7I6A.js";import"./copy-BVdfZXH-.js";import"./card-CBSSmpT3.js";import"./switch-DxJ9TWjl.js";import"./useAriaLabelledBy-Cx69TO6K.js";import"./useValueChanged-D634YMNF.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=Q(),l=K(o.user.role,"settings"),f=K(o.user.role,"studio")&&_(o),j=V(oe.integrations()),A=se(),N=()=>A.invalidateQueries({queryKey:["integrations"]}),[d,g]=i.useState(null),[c,b]=i.useState(null),[k,u]=i.useState(null),v=P({mutationFn:t=>F.regenerateGitHubWebhook(t),onSuccess:({webhook:t},r)=>u({site:r,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(M(t))}),C=P({mutationFn:({uid:t,provider:r})=>F.testTracker(t,r).then(L=>({...L,provider:r})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),N()},onError:t=>T.error(M(t))}),y=P({mutationFn:({uid:t,provider:r})=>F.disconnectTracker(t,r),onSuccess:()=>{b(null),N()},onError:t=>T.error(M(t))}),w=j.data?.data??[],m=t=>w.filter(r=>r.provider===t),p=o.projects.filter(t=>!t.archived&&!t.locked),a=t=>p.filter(r=>!m(t).some(L=>L.site===r.uid)),s=l?o.limits.integrations?p.length===0?"site":null:"plan":null;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),s&&e.jsxs("div",{role:"note",className:"flex max-w-[1040px] flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-border bg-muted/40 px-4 py-3 text-[13px]",children:[e.jsx("span",{className:"min-w-0 flex-1",children:s==="plan"?o.user.role==="owner"?"This studio's plan does not include integrations. A plan that does lets you connect each site to GitHub, Linear, Jira and Slack.":"This studio's plan does not include integrations. An owner can change the plan.":o.projects.length===0?"An integration connects one site to one repository, team, project or channel. Add a site first, then connect it here.":"An integration connects one site at a time, and every site here is archived or read-only. Restore one, or add a site, then connect it here."}),s==="plan"?o.user.role==="owner"&&e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/studio/plan"}),children:"See plans"}):e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(U,{to:"/sites"}),children:"Go to Sites"})]}),["github","linear","jira","slack"].map(t=>{const r=m(t),L=a(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[j.isPending&&e.jsx(ne,{rows:2}),j.isSuccess&&r.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(B,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),r.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:r.map(n=>{const h=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(B,{variant:"outline",className:h.tone==="ok"?"border-ok text-ok":h.tone==="bad"?"border-destructive text-destructive":"",children:h.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),l&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(x,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(x,{variant:"ghost",size:"sm",loading:C.isPending,onClick:()=>C.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>b(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),l&&!s&&L.length>0&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",onClick:()=>g(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:l,instanceOwner:f,operator:_(o),sites:o.projects}),e.jsx(ue,{open:d==="github",onOpenChange:t=>!t&&g(null),sites:a("github"),onDone:(t,r)=>{N(),r&&u({site:t,provider:"github",hook:r,fresh:!0})}}),e.jsx(xe,{open:d==="linear",onOpenChange:t=>!t&&g(null),sites:a("linear"),onDone:(t,r)=>{N(),u({site:t,provider:"linear",hook:r,fresh:!0})}}),e.jsx(ge,{open:d==="jira",onOpenChange:t=>!t&&g(null),sites:a("jira"),onDone:(t,r)=>{N(),u({site:t,provider:"jira",hook:r,fresh:!0})}}),e.jsx(fe,{open:d==="slack",onOpenChange:t=>!t&&g(null),sites:a("slack"),onDone:()=>void N()}),e.jsx(pe,{state:k,onClose:()=>u(null),siteName:t=>w.find(r=>r.site===t)?.siteName??"the site"}),e.jsx(ae,{open:c!==null,onOpenChange:t=>!t&&b(null),title:`Disconnect ${c?.siteName??"this site"} from ${c?D[c.provider]:"the tracker"}?`,description:c?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:y.isPending,onConfirm:async()=>{c&&await y.mutateAsync({uid:c.site,provider:c.provider})}})]})}function ue({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"github",{repository:d.trim(),token:c.trim(),labels:k,createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook&&"secret"in t.webhook?t.webhook:void 0),T.success("GitHub connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(I,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-token",children:"Token"}),e.jsx(I,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(I,{id:"gh-labels",placeholder:"review, bug",value:k,onChange:s=>u(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:l,siteName:f}){const j=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:A=>!A&&l(),children:e.jsxs(O,{children:[e.jsxs(R,{children:[e.jsx(W,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?f(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(q,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),j&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:j}),e.jsx(q,{text:j,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(x,{type:"button",onClick:l,children:"Done"})})]})})}function xe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(!1),[y,w]=i.useState(""),m=P({mutationFn:s=>F.connectTracker(s,"linear",{team:d.trim(),apiKey:c.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:v?"thread.created":"manual"})}),p=A||f[0]?.uid||"",a=async s=>{s.preventDefault(),w("");try{const t=await m.mutateAsync(p);g(""),b(""),u(""),C(!1),l(!1),j(p,t.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(t){w(t instanceof G?t.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:p,onChange:s=>N(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-team",children:"Team key"}),e.jsx(I,{id:"ln-team",placeholder:"ENG",value:d,onChange:s=>g(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-key",children:"API key"}),e.jsx(I,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:c,onChange:s=>b(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(I,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:k,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:s=>C(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:m.isPending,disabled:!d.trim()||!c.trim()||!p,children:m.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(""),[v,C]=i.useState(""),[y,w]=i.useState(""),[m,p]=i.useState(!1),[a,s]=i.useState(""),t=P({mutationFn:h=>F.connectTracker(h,"jira",{siteUrl:d.trim(),project:c.trim(),email:k.trim(),apiToken:v.trim(),...y.trim()?{webhookSecret:y.trim()}:{},createOn:m?"thread.created":"manual"})}),r=A||f[0]?.uid||"",L=async h=>{h.preventDefault(),s("");try{const $=await t.mutateAsync(r);b(""),C(""),w(""),p(!1),l(!1),j(r,$.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch($){s($ instanceof G?$.message:"Could not reach the server.")}},n=(h,$,Y,X,Z,ee="text",z)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:`jr-${h}`,children:$}),e.jsx(I,{id:`jr-${h}`,type:ee,placeholder:Z,value:Y,onChange:te=>X(te.target.value),autoComplete:"off"}),z&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:z})]});return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:h=>void L(h),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:r,onChange:h=>N(h.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(h=>e.jsx("option",{value:h.uid,children:h.name},h.uid))})]}),n("url","Jira site",d,g,"https://kilnwork.atlassian.net"),n("project","Project key",c,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),n("email","Account email",k,u,"you@kilnwork.studio","email"),n("token","API token",v,C,"","password"),n("secret","Webhook secret",y,w,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m,onChange:h=>p(h.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:t.isPending,disabled:!d.trim()||!c.trim()||!k.trim()||!v.trim()||!r,children:t.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:l,sites:f,onDone:j}){const[A,N]=i.useState(""),[d,g]=i.useState(""),[c,b]=i.useState(""),[k,u]=i.useState(!0),[v,C]=i.useState(""),y=V({queryKey:["integrations","slack","manifest"],queryFn:()=>F.slackManifest(),enabled:o,staleTime:1/0}),w=P({mutationFn:a=>F.connectTracker(a,"slack",{channel:d.trim(),token:c.trim(),createOn:k?"thread.created":"manual"})}),m=A||f[0]?.uid||"",p=async a=>{a.preventDefault(),C("");try{await w.mutateAsync(m),g(""),b(""),u(!0),l(!1),j(m),T.success("Slack connected")}catch(s){C(s instanceof G?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:l,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:a=>void p(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:m,onChange:a=>N(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:f.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:!y.data,render:e.jsx("a",{href:y.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(I,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:c,onChange:a=>b(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(I,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:a=>g(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:a=>u(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:w.isPending,disabled:!d.trim()||!c.trim()||!m,children:w.isPending?"Checking…":"Connect"})]})]})})})}const We=()=>K(Q().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(U,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{We as component};
@@ -1,11 +0,0 @@
1
- import{c as Wt,aa as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,ab as Vt,f as Fe,m as St,E as bn,ac as vn,ad as Gt,k as Ce,g as bt,q as Xt,ae as yn,B as He,af as it,ag as Kt,a2 as kt,I as Sn,D as wn,ah as Rn,ai as In,aj as jn,F as Tn,A as Lt}from"./index-DXj5DU-z.js";import{u as Ot}from"./useQuery-BO7PrbuY.js";import{u as Cn,a as An}from"./zod-DrSDAsp7.js";import{c as Mn,d as En,e as Pn,f as Nn,i as Vn,h as kn,u as Ln,a as On,j as Dn,p as Fn,r as Hn,g as Bn,A as Un,b as _n}from"./avatar-CE2TkZa-.js";import{B as zn}from"./badge-CCBUSB_y.js";import{C as Jt}from"./card-CBSSmpT3.js";import{K as $n,L as qn,P as Wn,R as Yn,M as p,v as Qt,q as Gn,F as Xn,N as Kn,O as Jn,w as rt,Q as Qn,S as Zn,x as es,U as ts,V as ns,W as ss,Y as os,a as rs,Z as ls,B as is,_ as as,X as cs,C as us,E as ds,H as Dt,G as Ft,I as Ht,J as Bt}from"./dialog-zaKAKGow.js";import{e as fs,f as ps,h as Zt,j as en,k as Ut,l as ms,m as gs,o as hs,c as Te,n as at,p as xs,q as bs,r as wt,a as vt,s as vs,w as ys,v as yt,L as _t,I as Ss}from"./label-BNpdN3Cg.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-DCkeQpxm.js";import{C as ws}from"./ConfirmDialog-CUQ3wyl0.js";import{C as Rs}from"./CopyButton-Cc6bLGfR.js";import{C as on}from"./chevron-down-60UlZ0Ky.js";import{C as Is}from"./check-DJgo7I6A.js";import{i as js}from"./isElementDisabled-CwHw_lZC.js";import{a as Tt,u as pt,i as Ts,b as Cs,t as Ct,C as As}from"./inertValue-Bju6oxRr.js";import{s as Rt}from"./serializeValue-B8e3iXO-.js";import{u as Ms}from"./useValueChanged-D634YMNF.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-CizhTu5k.js";import{A as Vs,P as ks,b as Ls}from"./parts-DUFMukrB.js";import{u as rn}from"./me-DRWJq-k_.js";import{a as Os}from"./labels--UUyt9uB.js";import{c as Ds,d as Fs,e as Hs,f as Bs,g as Us}from"./studio-C6rKaKyK.js";import{P as _s}from"./plus-1z8Ku-LH.js";import"./useBaseQuery-Dl2qdxNT.js";import"./useRender-0SJIdv0u.js";import"./copy-BVdfZXH-.js";/**
2
- * @license lucide-react v1.39.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const zs=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$s=Wt("chevron-up",zs);/**
7
- * @license lucide-react v1.39.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const qs=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ws=Wt("mail",qs);function Ys(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,i=fs(),f=$n()!=null,r=Yt(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Wn,floatingId:i,syncOnly:!1,nested:f})).current;return xe(()=>{const u={open:t,floatingId:i};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=xn(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),r.update(u)},[t,i,o.reference,o.floating,r]),r.context.onOpenChange=s,r.context.nested=f,r}function Gs(e){const[t,s]=l.useState({current:e,previous:null});return Object.is(e,t.current)||s({current:e,previous:t.current}),t.previous}const Xs=l.createContext(void 0),Ks={disableStyleElements:!1};function Js(){return l.useContext(Xs)??Ks}function Qs({className:e,...t}){return n.jsx("select",{className:Be("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function Zs(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const ln=l.createContext(null);function be(){const e=l.useContext(ln);if(e===null)throw new Error(jt(60));return e}const eo=(e,t)=>Object.is(e,t);function Ye(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function lt(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,s))}function to(e,t,s){return e.filter(o=>!Ye(t,o,s))}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function no(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function cn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Rt(e)}function We(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Rt(e.value):Rt(e)}function un(e,t,s){function o(){return cn(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const i=t,f=an(i)?i.flatMap(r=>r.items):i;if(e==null||typeof e!="object"){const r=f.find(u=>u.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=f.find(u=>u&&u.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function so(e,t,s){return e.reduce((o,i,f)=>(f>0&&o.push(", "),o.push(n.jsx(l.Fragment,{children:un(i,t,s)},f)),o),[])}const d={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:We(t,o)!==""},hasNullItemLabel:(e,t)=>t?no(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>Ye(t,i,s)):Ye(t,o,s)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function oo(e,t,s=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>s(o,t[i]))}function Ke(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const me=1;function At(e,t){return Math.max(0,e-t)}function ut(e,t){if(t<=0)return 0;const s=Ke(e,0,t),o=s,i=t-s,f=o<=me,r=i<=me;return f&&r?o<=i?0:t:f?0:r?t:s}function ro(e){const{id:t,value:s,defaultValue:o=null,onValueChange:i,open:f,defaultOpen:r=!1,onOpenChange:u,name:c,form:m,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:R=!1,modal:v=!0,actionsRef:D,inputRef:S,onOpenChangeComplete:_,items:N,multiple:I=!1,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w=eo,highlightItemOnHover:k=!0,children:W}=e,{clearErrors:O}=ps(),{setDirty:ue,setTouched:Y,setFocused:le,validityData:K,setFilled:F,name:L,disabled:J,validation:C,validationMode:ne}=Zt(),z=en({id:t}),P=J||b,a=L??c,[h,Q]=Ut({controlled:s,default:I?o??Vt:o,name:"Select",state:"value"}),[H,se]=Ut({controlled:f,default:r,name:"Select",state:"open"}),g=l.useRef([]),T=l.useRef([]),B=l.useRef(null),ee=l.useRef(null),ve=l.useRef(0),M=l.useRef(null),G=l.useRef([]),$=l.useRef(!1),de=l.useRef(null),Z=l.useRef(null),oe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=l.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=Tt(H),{openMethod:X,triggerProps:ae}=Mn(H),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:H,mounted:ie,transitionStatus:q,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=p(E,d.activeIndex),ye=p(E,d.selectedIndex),Se=p(E,d.triggerElement),ce=p(E,d.positionerElement),ke=Gs(X),Le=X??ke,te=l.useMemo(()=>I?"":We(h,V),[I,h,V]),mt=l.useMemo(()=>I&&Array.isArray(h)?h.map(A=>We(A,V)):We(h,V),[I,h,V]),Qe=Qt(Se),we=Fe(()=>mt);ms(Qe,z,h,we,!P,c);const gt=l.useRef(h),Ge=I?Array.isArray(h)&&h.length>0:h!=null&&te!=="";xe(()=>{F(Ge)},[Ge,F]),xe(function(){let U=h,Re=!1;if(I){const De=Array.isArray(h)?h:[];Re=De.length===0,U=De[De.length-1]}const Ne=Re?-1:lt(G.current,U,w),Ve=Ne===-1?null:Ne;Ve===null&&(Z.current=null),!H&&E.set("selectedIndex",Ve)},[I,H,h,w,E]);function ge(A){const U=K.initialValue;return Array.isArray(A)&&Array.isArray(U)?!oo(A,U,(Re,Ne)=>Ye(Re,Ne,w)):A!==U}Ms(h,()=>{O(a),ue(ge(h)),C.change(h)});const Ue=Fe((A,U)=>{u?.(A,U),!U.isCanceled&&(se(A),!A&&(U.reason===gs||U.reason===hs)&&(Y(!0),le(!1),ne==="onBlur"&&C.commit(h)))}),_e=Fe(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:H,ref:B,onComplete(){H||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=Fe((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=Fe(A=>{const U=At(A.scrollHeight,A.clientHeight),Re=ut(A.scrollTop,U),Ne=Re>0,Ve=Re<U;E.set("scrollUpArrowVisible",Ne),E.set("scrollDownArrowVisible",Ve)}),Ee=Ys({open:H,onOpenChange:Ue,elements:{reference:Se,floating:ce}}),ze=En(Ee,{enabled:!y&&!P,event:"mousedown"}),$e=Gn(Ee),Pe=Pn(Ee,{enabled:!y&&!P,listRef:g,activeIndex:Ae,selectedIndex:ye,disabledIndices:Vt,onNavigate(A){A===null&&!H||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(H||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>js(g.current[A]),onMatch(A){H?E.set("activeIndex",A):Me(G.current[A],Te(at))},onTyping(A){$.current=A}}),Ze=l.useMemo(()=>St(Oe.reference,Pe.reference,$e.reference,ze.reference,ae),[ze.reference,Oe.reference,Pe.reference,$e.reference,ae]),et=l.useMemo(()=>St(Xn,Oe.floating,Pe.floating,$e.floating),[Oe.floating,Pe.floating,$e.floating]),tt=Pe.item??bn;Zs(()=>{E.update({popupProps:et,triggerProps:Ze})}),E.useSyncedValues({id:z,modal:v,multiple:I,value:h,open:H,mounted:ie,transitionStatus:q,popupProps:et,triggerProps:Ze,items:N,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,openMethod:Le});const pe=l.useMemo(()=>({store:E,floatingContext:Ee,required:R,disabled:P,readOnly:y,multiple:I,highlightItemOnHover:k,setValue:Me,setOpen:Ue,listRef:g,popupRef:B,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:ve,itemProps:tt,valueRef:M,valuesRef:G,labelsRef:T,typingRef:$,selectionRef:oe,firstItemTextRef:de,selectedItemTextRef:Z,validation:C,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:re,initialValueRef:gt}),[E,Ee,R,P,y,I,k,Me,Ue,tt,C,_,he]),qe=vn(S,C.inputRef),Xe=I?void 0:a,ht=l.useMemo(()=>!I||!Array.isArray(h)||!a?null:h.map(A=>{const U=We(A,V);return n.jsx("input",{type:"hidden",form:m,name:a,value:U,disabled:P},U)}),[I,h,m,a,V,P]);return n.jsxs(ln.Provider,{value:pe,children:[W,n.jsx("input",{...C.getValidationProps(P,{onFocus(){E.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||P||y)return;const U=A.currentTarget.value,Re=Te(at,A.nativeEvent);function Ne(){if(I)return;const Ve=U.toLowerCase();let De=G.current.findIndex(xt=>We(xt,V).toLowerCase()===Ve||cn(xt,j).toLowerCase()===Ve);De===-1&&(De=G.current.findIndex((xt,hn)=>{const Nt=T.current[hn];return Nt!=null&&Nt.toLowerCase()===Ve}));const Pt=G.current[De];Pt!=null&&Me(Pt,Re)}E.set("forceMount",!0),queueMicrotask(Ne)}}),id:z&&Xe==null?`${z}-hidden-input`:void 0,form:m,name:Xe,autoComplete:x,value:te,disabled:P,required:R&&!(I&&Ge),readOnly:y,ref:qe,style:a?Kn:Jn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function lo(e,t){return e??t}const io=400,ao={...Zn,...bs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},co=l.forwardRef(function(t,s){const{render:o,className:i,id:f,disabled:r=!1,nativeButton:u=!0,style:c,...m}=t,{setTouched:x,setFocused:b,validationMode:y,state:R,disabled:v}=Zt(),{labelId:D}=xs(),{store:S,setOpen:_,selectionRef:N,validation:I,readOnly:j,required:V,alignItemWithTriggerActiveRef:w,disabled:k}=be(),W=v||k||r,O=p(S,d.open),ue=p(S,d.mounted),Y=p(S,d.value),le=p(S,d.triggerProps),K=p(S,d.positionerElement),F=p(S,d.listElement),L=p(S,d.popupSide),J=p(S,d.id),C=p(S,d.labelId),ne=p(S,d.hasSelectedValue),z=ue&&K?L:null,P=f??J,a=lo(D,C);en({id:P});const h=Qt(K),Q=l.useRef(null),{getButtonProps:H,buttonRef:se}=Gt({disabled:W,native:u}),g=S.useStateSetter("triggerElement"),T=rt(),B=rt(),ee=rt();l.useEffect(()=>{if(O)return ee.start(io,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[O,N,B,ee]);const ve=St(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?F?.id??Qn(K)?.id:void 0,"aria-labelledby":a,"aria-readonly":j||void 0,"aria-required":V||void 0,tabIndex:W?-1:0,onFocus($){b(!0),O&&w.current&&_(!1,Te(at,$.nativeEvent)),T.start(0,()=>{S.set("forceMount",!0)})},onBlur($){vt(K,$.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&I.commit(Y))},onMouseDown($){if(O)return;const de=wt($.currentTarget);function Z(oe){if(!Q.current)return;const re=oe.target;vt(Q.current,re)||vt(h.current,re)||Vn(oe,Q.current)||_(!1,Te(vs,oe))}B.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},m,H),M=I.getValidationProps(W,ve);M.role="combobox";const G={...R,open:O,disabled:W,value:Y,readOnly:j,popupSide:z,placeholder:!ne};return Ce("button",t,{ref:[s,Q,se,g],state:G,stateAttributesMapping:ao,props:M})}),uo={value:()=>null},fo=l.forwardRef(function(t,s){const{className:o,render:i,children:f,placeholder:r,style:u,...c}=t,{store:m,valueRef:x}=be(),b=p(m,d.value),y=p(m,d.items),R=p(m,d.itemToStringLabel),v=p(m,d.hasSelectedValue),D=!v&&r!=null&&f==null,S=p(m,d.hasNullItemLabel,D),_={value:b,placeholder:!v};let N=null;return typeof f=="function"?N=f(b):f!=null?N=f:D&&!S?N=r:Array.isArray(b)?N=so(b,y,R):N=un(b,y,R),Ce("span",t,{state:_,ref:[s,x],props:[{children:N},c],stateAttributesMapping:uo})}),po=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u}=be(),m={open:p(u,d.open)};return Ce("span",t,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:es})}),mo=l.forwardRef(function(t,s){const{store:o}=be(),i=p(o,d.mounted),f=p(o,d.forceMount);return i||f?n.jsx(ts,{ref:s,...t}):null}),dn=l.createContext(void 0);function Mt(){const e=l.useContext(dn);if(!e)throw new Error(jt(59));return e}function dt(e,t){e&&Object.assign(e.style,t)}const fn={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},go={position:"fixed"},ho=l.forwardRef(function(t,s){const{anchor:o,className:i,render:f,positionMethod:r,side:u,align:c,sideOffset:m,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:R,sticky:v,disableAnchorTracking:D,alignItemWithTrigger:S=!0,collisionAvoidance:_=ns,style:N,...I}=t,{store:j,listRef:V,labelsRef:w,alignItemWithTriggerActiveRef:k,selectedItemTextRef:W,valuesRef:O,initialValueRef:ue,popupRef:Y,setValue:le,floatingContext:K}=be(),F=p(j,d.open),L=p(j,d.mounted),J=p(j,d.modal),C=p(j,d.value),ne=p(j,d.openMethod),z=p(j,d.positionerElement),P=p(j,d.triggerElement),a=p(j,d.isItemEqualToValue),h=p(j,d.transitionStatus),Q=l.useRef(null),H=l.useRef(null),[se,g]=l.useState(S),T=L&&se&&ne!=="touch";!L&&se!==S&&g(S),l.useImperativeHandle(k,()=>T),kn((T||J)&&F,ne==="touch",z,P);const B=Ln({anchor:o,floatingRootContext:K,positionMethod:r,mounted:L,side:u,sideOffset:m,align:c,alignOffset:x,arrowPadding:R,collisionBoundary:b,collisionPadding:y,sticky:v,disableAnchorTracking:D??T,collisionAvoidance:_,keepMounted:!0}),ee=T?"none":B.side,ve=T?go:B.positionerStyles,M={open:F,side:ee,align:B.align,anchorHidden:B.anchorHidden};xe(()=>{j.set("popupSide",B.side)},[j,B.side]);const G=j.useStateSetter("positionerElement"),$=On(t,M,{styles:ve,transitionStatus:h,props:I,refs:[s,G],hidden:!L,inert:!F}),de=l.useRef(0),Z=Fe(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Te(at);if(ie!==0&&!j.state.multiple&&C!==null&&lt(O.current,C,a)===-1){const X=ue.current,E=X!=null&&lt(O.current,X,a)!==-1?X:null;le(E,fe),E===null&&(j.set("selectedIndex",null),W.current=null)}if(ie!==0&&j.state.multiple&&Array.isArray(C)){const q=C.filter(X=>lt(O.current,X,a)!==-1);q.length!==C.length&&(le(q,fe),q.length===0&&(j.set("selectedIndex",null),W.current=null))}if(F&&T){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};dt(z,q),dt(Y.current,q)}}),oe=l.useMemo(()=>({...B,side:ee,alignItemWithTriggerActive:T,setControlledAlignItemWithTrigger:g,scrollUpArrowRef:Q,scrollDownArrowRef:H}),[B,ee,T,g]);return n.jsx(Es,{elementsRef:V,labelsRef:w,onMapChange:Z,children:n.jsxs(dn.Provider,{value:oe,children:[L&&J&&n.jsx(ss,{inert:Ts(!F),cutout:P}),$]})})}),nt="base-ui-disable-scrollbar",It={className:nt,getElement(e){return n.jsx("style",{nonce:e,href:nt,precedence:"base-ui:low",children:`.${nt}{scrollbar-width:none}.${nt}::-webkit-scrollbar{display:none}`})}},xo={...is,...Ct},bo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,finalFocus:r,...u}=t,{store:c,popupRef:m,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:R,selectedItemTextRef:v,multiple:D,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:N,highlightItemOnHover:I,floatingContext:j}=be(),{side:V,align:w,alignItemWithTriggerActive:k,isPositioned:W,setControlledAlignItemWithTrigger:O}=Mt(),ue=Dn()!=null,Y=Ps(),{nonce:le,disableStyleElements:K}=Js(),F=p(c,d.id),L=p(c,d.open),J=p(c,d.openMethod),C=p(c,d.mounted),ne=p(c,d.popupProps),z=p(c,d.transitionStatus),P=p(c,d.triggerElement),a=p(c,d.positionerElement),h=p(c,d.listElement),Q=l.useRef(!1),H=l.useRef(!1),se=l.useRef({}),g=Cs(),T=Fe(M=>{if(!a||!m.current||!H.current)return;const G=a.style.top==="0px",$=a.style.bottom==="0px";if(Q.current||!k||!G&&!$){S(M);return}const de=$t(a),Z=Je(a.getBoundingClientRect().height,"y",de),oe=wt(a),re=bt(a),ie=re.getComputedStyle(a),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),X=zt(re.getComputedStyle(m.current)),ae=Math.min(oe.documentElement.clientHeight-fe-q,X),E=M.scrollTop,Ae=st(M);let ye=null;const Se=te=>{a.style.height=`${te}px`},ce=G?Ae-E:E,ke=Math.min(Z+ce,ae);if(ce<=me){const te=Ke(ce,0,ae-Z);te>0&&Se(Z+te),M.scrollTop=G?Ae:0,ae-(Z+te)<=me&&(Q.current=!0),S(M);return}if(ae-ke>me)ye=G?1/0:0;else if($&&E<Ae){const te=Z+ce-ae;ye=E-(ce-te)}const Le=Math.ceil(ke);if(Le!==0&&Se(Le),ye!=null){const te=Ke(ye,0,st(M));Math.abs(M.scrollTop-te)>me&&(M.scrollTop=te)}Le>=ae-me&&(Q.current=!0),S(M)});l.useImperativeHandle(_,()=>T,[T]),pt({open:L,ref:m,onComplete(){L&&x?.(!0)}});const B={open:L,transitionStatus:z,side:V,align:w};xe(()=>{!a||!m.current||Object.keys(se.current).length||(se.current={top:a.style.top||"0",left:a.style.left||"0",right:a.style.right,height:a.style.height,bottom:a.style.bottom,minHeight:a.style.minHeight,maxHeight:a.style.maxHeight,marginTop:a.style.marginTop,marginBottom:a.style.marginBottom})},[m,a]),xe(()=>{L||k||(H.current=!1,Q.current=!1,dt(a,se.current))},[L,k,a,m]),xe(()=>{const M=m.current;if(!L||!P||!a||!M||k&&!W||c.state.transitionStatus==="ending")return;if(H.current=!0,M.style.removeProperty("--transform-origin"),!k){g.request(()=>S(h||M));return}const G=vo(M);try{let $=v.current;$?.isConnected||($=!d.hasSelectedValue(c.state)&&R.current?.isConnected?R.current:null);const de=y.current,Z=bt(a),oe=Z.getComputedStyle(a),re=Z.getComputedStyle(M),ie=wt(P),fe=$t(P),q=ot(P.getBoundingClientRect(),fe),X=ot(a.getBoundingClientRect(),fe),ae=q.height,E=h||M,Ae=E.scrollHeight,ye=parseFloat(re.borderBottomWidth),Se=parseFloat(oe.marginTop)||10,ce=parseFloat(oe.marginBottom)||10,ke=parseFloat(oe.minHeight)||100,Le=zt(re),te=5,mt=5,Qe=20,we=ie.documentElement.clientHeight-Se-ce,gt=ie.documentElement.clientWidth,Ge=we-q.bottom+ae;let ge,Ue=Y==="rtl"?q.right-X.width:q.left,_e=0;if($&&de){const pe=ot(de.getBoundingClientRect(),fe);ge=ot($.getBoundingClientRect(),fe),Ue=X.left+(Y==="rtl"?pe.right-ge.right:pe.left-ge.left);const qe=pe.top-q.top+pe.height/2;_e=ge.top-X.top+ge.height/2-qe}const Me=Ge+_e+ce+ye;let he=Math.min(we,Me);const Ee=we-Se-ce,ze=Me-he,$e=gt-mt;a.style.left=`${Ke(Ue,te,$e-X.width)}px`,a.style.height=`${he}px`,a.style.maxHeight="none",a.style.marginTop=`${Se}px`,a.style.marginBottom=`${ce}px`,M.style.height="100%";const Pe=st(E),Oe=ze>=Pe-me;Oe&&(he=Math.min(we,X.height)-(ze-Pe));const Ze=q.top<Qe||q.bottom>we-Qe||Math.ceil(he)+me<Math.min(Ae,ke),et=(Z.visualViewport?.scale??1)!==1&&os;if(Ze||et){dt(a,se.current),O(!1);return}const tt=Math.max(ke,he);if(Oe){const pe=Math.max(0,we-Me);a.style.top=X.height>=Ee?"0":`${pe}px`,a.style.height=`${he}px`,E.scrollTop=st(E)}else a.style.bottom="0",E.scrollTop=ze;if(ge){const pe=X.top,qe=X.height,Xe=ge.top+ge.height/2,ht=Ke(qe>0?(Xe-pe)/qe*100:50,0,100);M.style.setProperty("--transform-origin",`50% ${ht}%`)}(tt===we||he>=Le)&&(Q.current=!0),S(E),I&&c.state.selectedIndex===null&&c.state.activeIndex===null&&N.current[0]!=null&&c.set("activeIndex",0)}finally{G()}},[c,L,a,P,y,R,v,m,S,k,O,g,h,N,I,Y,W]),l.useEffect(()=>{if(!k||!a||!L)return;const M=bt(a);function G($){b(!1,Te(ys,$))}return rs(M,"resize",G)},[b,k,a,L]);const ee={...h?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":D||void 0,id:`${F}-list`},onKeyDown(M){ue&&As.has(M.key)&&M.stopPropagation()},onScroll(M){h||T(M.currentTarget)},...k&&{style:h?{height:"100%"}:fn},className:!h&&k?It.className:void 0},ve=Ce("div",t,{ref:[s,m],state:B,stateAttributesMapping:xo,props:[ne,ee,Bn(z),u]});return n.jsxs(l.Fragment,{children:[!K&&It.getElement(le),n.jsx(ls,{context:j,modal:!1,disabled:!C,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:ve})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function st(e){return At(e.scrollHeight,e.clientHeight)}function $t(e){return Fn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Hn({x:Je(e.x,"x",t),y:Je(e.y,"y",t),width:Je(e.width,"x",t),height:Je(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function vo(e){const{style:t}=e,s={};for(const[o,i]of qt)s[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of qt){const i=s[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const yo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u,scrollHandlerRef:c,multiple:m}=be(),{alignItemWithTriggerActive:x}=Mt(),b=p(u,d.hasScrollArrows),y=p(u,d.openMethod),v={id:`${p(u,d.id)}-list`,role:"listbox","aria-multiselectable":m||void 0,onScroll(S){c.current?.(S.currentTarget)},...x&&{style:fn},className:b&&y!=="touch"?It.className:void 0},D=u.useStateSetter("listElement");return Ce("div",t,{ref:[s,D],props:[v,r]})}),pn=l.createContext(void 0);function Et(){const e=l.useContext(pn);if(!e)throw new Error(jt(57));return e}const So=l.memo(l.forwardRef(function(t,s){const{render:o,className:i,style:f,value:r=null,label:u,disabled:c=!1,nativeButton:m=!1,...x}=t,b=l.useRef(null),y=Ns({guess:!0,label:u,textRef:b}),{store:R,itemProps:v,setOpen:D,setValue:S,selectionRef:_,typingRef:N,valuesRef:I,multiple:j,selectedItemTextRef:V,disabled:w,readOnly:k}=be(),W=w||c,O=p(R,d.isActive,y.index),ue=p(R,d.open),Y=p(R,d.isSelected,r),le=p(R,d.isSelectedByFocus,y.index),K=p(R,d.isItemEqualToValue),F=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[F]=r,()=>{delete g[F]}},[F,r,I]),xe(()=>{const g=R.state.value;let T=g;j&&Array.isArray(g)&&(T=g.length>0?g[g.length-1]:void 0),T!==void 0&&Ye(r,T,K)&&(R.set("selectedIndex",F),b.current&&(V.current=b.current))},[F,j,K,R,r,V]);const J=l.useRef("mouse"),C=l.useRef(!1),{getButtonProps:ne,buttonRef:z}=Gt({disabled:W,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:W,selected:Y,highlighted:O};function a(g){if(w||k)return;const T=R.state.value;if(j){const B=Array.isArray(T)?T:[],ee=Y?to(B,r,K):[...B,r];S(ee,Te(yt,g))}else S(r,Te(yt,g)),D(!1,Te(yt,g))}function h(){_.current.dragY=0}const Q={role:"option","aria-selected":Y,tabIndex:ue&&O?0:-1,onKeyDown(g){R.set("activeIndex",F),g.key===" "&&N.current&&g.preventDefault()},onClick(g){const T=J.current!=="touch",B=g.nativeEvent.pointerType,ee=T&&as(g.nativeEvent)&&(B!==void 0||O),ve=T&&!ee&&!C.current;C.current=!1,!(W||ve)&&a(g.nativeEvent)},onPointerEnter(g){J.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const T=_.current;T.dragY+=g.movementY,T.dragY**2>=64&&(T.allowUnselectedMouseUp=!0)}},onPointerDown(g){J.current=g.pointerType,C.current=!0,h()},onMouseUp(){if(h(),W||J.current==="touch"||C.current)return;const g=!_.current.allowSelectedMouseUp&&Y,T=!_.current.allowUnselectedMouseUp&&!Y;g||T||(C.current=!0,L.current?.click(),C.current=!1)}},H=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:F,textRef:b,selectedByFocus:le}),[Y,F,b,le]);return n.jsx(pn.Provider,{value:se,children:H})})),wo=l.forwardRef(function(t,s){const{selected:o}=Et();return t.keepMounted||o?n.jsx(Ro,{...t,ref:s}):null}),Ro=l.memo(l.forwardRef((e,t)=>{const{render:s,className:o,style:i,keepMounted:f,...r}=e,{selected:u}=Et(),c=l.useRef(null),{transitionStatus:m,setMounted:x}=Tt(u),y=Ce("span",e,{ref:[t,c],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Ct});return pt({open:u,ref:c,onComplete(){u||x(!1)}}),y})),Io=l.memo(l.forwardRef(function(t,s){const{index:o,textRef:i,selectedByFocus:f}=Et(),{firstItemTextRef:r,selectedItemTextRef:u}=be(),{render:c,className:m,style:x,...b}=t,y=l.useCallback(v=>{v&&(o===0&&(r.current=v),f&&(u.current=v))},[r,u,o,f]);return Ce("div",t,{ref:[y,s,i],props:b})})),mn=l.forwardRef(function(t,s){const{render:o,className:i,style:f,direction:r,keepMounted:u,...c}=t,m=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:R,scrollArrowsMountedCountRef:v}=be(),{side:D,scrollDownArrowRef:S,scrollUpArrowRef:_}=Mt(),N=m?d.scrollUpArrowVisible:d.scrollDownArrowVisible,I=p(x,N),j=p(x,d.openMethod),V=I&&j!=="touch",w=rt(),k=m?_:S,{mounted:W,transitionStatus:O,setMounted:ue}=Tt(V);xe(()=>(v.current+=1,x.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&x.set("hasScrollArrows",!1)}),[x,v]),pt({open:V,ref:k,onComplete(){V||ue(!1)}});const K=Ce("div",t,{ref:[s,k],state:{direction:r,visible:V,side:D,transitionStatus:O},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||w.isStarted())return;x.set("activeIndex",null);function J(){const C=x.state.listElement??b.current;if(!C)return;x.set("activeIndex",null),R(C);const ne=At(C.scrollHeight,C.clientHeight),z=ut(C.scrollTop,ne),P=z===(m?0:ne),a=y.current;if(z!==C.scrollTop&&(C.scrollTop=z),P){w.clear();return}if(a.length>0){const h=k.current?.offsetHeight||0;C.scrollTop=jo(a,m,z,C.clientHeight,h,ne)}w.start(40,J)}w.start(40,J)},onMouseLeave(){w.clear()}},c],stateAttributesMapping:Ct});return W||u?K:null});function jo(e,t,s,o,i,f){if(t){let x=0;const b=s+i-me;for(let v=0;v<e.length;v+=1){const D=e[v];if(D&&D.offsetTop>=b){x=v;break}}const y=Math.max(0,x-1),R=e[y];return y<x&&R?ut(R.offsetTop-i,f):0}let r=e.length-1;const u=s+o-i+me;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>u){r=Math.max(0,x-1);break}}const c=Math.min(e.length-1,r+1),m=e[c];return c>r&&m?ut(m.offsetTop+m.offsetHeight-o+i,f):f}const To=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"down"})}),Co=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"up"})}),Ao=ro;function Mo({className:e,...t}){return n.jsx(fo,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function Eo({className:e,size:t="default",children:s,...o}){return n.jsxs(co,{"data-slot":"select-trigger","data-size":t,className:Be("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,n.jsx(po,{render:n.jsx(on,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Po({className:e,children:t,side:s="bottom",sideOffset:o=4,align:i="center",alignOffset:f=0,alignItemWithTrigger:r=!0,...u}){return n.jsx(mo,{children:n.jsx(ho,{side:s,sideOffset:o,align:i,alignOffset:f,alignItemWithTrigger:r,className:"isolate z-50",children:n.jsxs(bo,{"data-slot":"select-content","data-align-trigger":r,className:Be("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[n.jsx(Vo,{}),n.jsx(yo,{children:t}),n.jsx(ko,{})]})})})}function No({className:e,children:t,...s}){return n.jsxs(So,{"data-slot":"select-item",className:Be("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[n.jsx(Io,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(wo,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Is,{className:"pointer-events-none"})})]})}function Vo({className:e,...t}){return n.jsx(Co,{"data-slot":"select-scroll-up-button",className:Be("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx($s,{})})}function ko({className:e,...t}){return n.jsx(To,{"data-slot":"select-scroll-down-button",className:Be("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(on,{})})}function Lo(){const e=rn(),t=Xt(e.user.role,"people"),s=yn(e.user.role),o=Ot(Lt.members()),i=Ot(Lt.invites()),[f,r]=l.useState(!1),u=e.limits.members.limit,c=u!==null&&e.limits.members.used>=u;return n.jsxs("div",{className:"p-7",children:[n.jsx(ks,{title:"Members",sub:`${t?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${u!==null?` ${e.limits.members.used} of ${u} members.`:""}`,actions:s.length?n.jsxs(He,{onClick:()=>r(!0),disabled:c,title:c?`This studio's plan allows ${u} members.`:void 0,children:[n.jsx(_s,{}),"Invite"]}):void 0}),n.jsx(Jt,{className:"max-w-[1040px] overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"Name"}),n.jsx(Ie,{children:"Email"}),n.jsx(Ie,{children:"Role"}),t&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:(o.data?.data??[]).map(m=>n.jsx(Fo,{m,owner:t},m.email))})]})}),n.jsx(Oo,{}),(i.data?.data.length??0)>0&&n.jsx(Do,{invites:i.data.data,roles:s}),n.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",n.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),s.length>0&&n.jsx(Bo,{open:f,onOpenChange:r,mail:i.data?.mail??!1,roles:s})]})}const gn=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"}),ft={owner:"Owner",admin:"Admin",member:"Member"};function Oo(){return n.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:it.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"font-medium",children:ft[e]}),n.jsx("dd",{className:"m-0 text-muted-foreground",children:Kt[e]})]},e))})}function Do({invites:e,roles:t}){const s=Hs(),o=t.length>0;return n.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[n.jsx("div",{id:"pending-invites",className:"mb-2",children:n.jsx(Ls,{children:"Pending invites"})}),n.jsx(Jt,{className:"overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"For"}),n.jsx(Ie,{children:"Role"}),n.jsx(Ie,{children:"Invited by"}),n.jsx(Ie,{children:"Expires"}),o&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:e.map(i=>n.jsxs(ct,{children:[n.jsx(je,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),n.jsx(je,{className:"capitalize",children:i.role}),n.jsx(je,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),n.jsx(je,{className:"text-muted-foreground",children:gn(i.expiresAt)}),o&&n.jsx(je,{className:"text-right",children:t.includes(i.role)&&n.jsx(He,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:s.isPending&&s.variables===i.id,onClick:()=>s.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function Fo({m:e,owner:t}){const s=Ds(),o=Fs(),[i,f]=l.useState(!1);return n.jsxs(ct,{children:[n.jsx(je,{children:n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx(Un,{className:"size-6",children:n.jsx(_n,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Os(e.name,e.email)})}),n.jsx("span",{className:"font-medium",children:e.name||e.email}),e.you&&n.jsx(zn,{variant:"outline",className:"text-[11px]",children:"you"})]})}),n.jsx(je,{className:"text-muted-foreground",children:e.email}),n.jsx(je,{children:t?n.jsxs(Ao,{items:it.map(r=>({value:r,label:ft[r]})),value:e.role,onValueChange:r=>r&&r!==e.role&&s.mutate({email:e.email,role:r}),children:[n.jsx(Eo,{size:"sm","aria-label":`Role for ${e.email}`,className:"min-w-[104px] bg-card",children:n.jsx(Mo,{})}),n.jsx(Po,{children:it.map(r=>n.jsx(No,{value:r,children:ft[r]},r))})]}):n.jsx("span",{className:"capitalize",children:e.role})}),t&&n.jsxs(je,{className:"text-right",children:[!e.you&&n.jsx(He,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${e.email}`,onClick:()=>f(!0),children:n.jsx(cs,{})}),n.jsx(ws,{open:i,onOpenChange:f,title:`Remove ${e.name||e.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:o.isPending,onConfirm:()=>{f(!1),o.mutate(e.email)}})]})]})}const Ho=wn({email:In([jn(""),Tn().trim().email("An email address, or leave it empty")]),role:Rn(it)});function Bo({open:e,onOpenChange:t,mail:s,roles:o}){const i=Bs(),f=Us(),[r,u]=l.useState(""),[c,m]=l.useState(null),[x,b]=l.useState(null),{register:y,handleSubmit:R,formState:v,reset:D,watch:S}=Cn({resolver:An(Ho),defaultValues:{role:"member",email:""}}),_=S("role"),N=w=>{t(w),w||(m(null),b(null),u(""),f.reset(),D())},I=R(async w=>{u("");try{m(await i.mutateAsync({role:w.role,...w.email?{email:w.email}:{}}))}catch(k){u(kt(k))}}),j=async()=>{if(c){u("");try{b((await f.mutateAsync({id:c.invite.id,token:c.token})).to)}catch(w){u(kt(w))}}},V=(c?.mail??s)&&!!c?.invite.email;return n.jsx(us,{open:e,onOpenChange:N,children:n.jsx(ds,{children:c?n.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite link"}),n.jsxs(Ht,{children:[c.invite.email?`${c.invite.email} can`:"Anyone with this link can"," join as ",Sn(c.invite.role)," ","until ",gn(c.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:c.url}),n.jsx(Rs,{text:c.url,label:"Copy link",withText:!0})]}),V&&(x?n.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",x,"."]}):n.jsxs(He,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:c.invite.email?`Send by email to ${c.invite.email}`:void 0,loading:f.isPending,onClick:()=>void j(),children:[n.jsx(Ws,{}),n.jsx("span",{className:"min-w-0 truncate",children:f.isPending?"Sending…":`Send by email to ${c.invite.email}`})]})),n.jsx(Bt,{children:n.jsx(He,{type:"button",onClick:()=>N(!1),children:"Done"})})]}):n.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4",noValidate:!0,children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite someone"}),n.jsx(Ht,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("fieldset",{disabled:v.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(_t,{htmlFor:"invite-role",children:"Role"}),n.jsx(Qs,{id:"invite-role",className:"w-full",...y("role"),children:["member","admin","owner"].filter(w=>o.includes(w)).map(w=>n.jsx("option",{value:w,children:ft[w]},w))}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:Kt[_]??""})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs(_t,{htmlFor:"invite-email",children:["Email ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),n.jsx(Ss,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!v.errors.email,...y("email")}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:v.errors.email?.message??(s?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),n.jsxs(Bt,{children:[n.jsx(He,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(He,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const pr=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{pr as component};
@@ -1 +0,0 @@
1
- import{j as e,ak as Y,r as d,p as M,d as A,A as $,S as B,h as m,B as P}from"./index-DXj5DU-z.js";import{u as _}from"./useQuery-BO7PrbuY.js";import{b as j}from"./InstanceRows-S3bDqoib.js";import{A as D,P as K}from"./parts-DUFMukrB.js";import{u as y}from"./me-DRWJq-k_.js";import{C as U}from"./check-DJgo7I6A.js";import"./useBaseQuery-Dl2qdxNT.js";import"./dialog-zaKAKGow.js";import"./label-BNpdN3Cg.js";import"./inertValue-Bju6oxRr.js";import"./ConfirmDialog-CUQ3wyl0.js";import"./copy-BVdfZXH-.js";import"./labels--UUyt9uB.js";import"./card-CBSSmpT3.js";function L(){const s=y(),{said:r}=Y.useSearch(),[a,o]=d.useState(r),[c]=d.useState(()=>Date.now()),u=M(),p=A();d.useEffect(()=>{r&&u({to:"/studio/plan",search:{},replace:!0})},[r,u]);const w=_($.setupState()),i=w.data?.billingUrl??null,v=_({queryKey:["plan-state",i],enabled:!!i,refetchInterval:()=>a&&Date.now()-c<3e4?3e3:!1,queryFn:async()=>{const t=await fetch(`${i.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)throw new Error(String(t.status));return await t.json()}}),n=v.data,b=d.useRef(null),f=n?.current?.name??null;d.useEffect(()=>{f&&(b.current===null?b.current=f:f!==b.current&&(o(void 0),p.invalidateQueries({queryKey:$.me().queryKey})))},[f,p]);const[h,R]=d.useState(!1),q=!!n?.plans.some(t=>t.yearly),k=n?.plans.find(t=>t.current);return e.jsxs("div",{className:"flex flex-col gap-8 p-7",children:[e.jsx(K,{title:"Plan & billing",sub:s.org.name}),a&&e.jsx("p",{role:"status",className:"m-0 max-w-[1040px] rounded-md border border-border bg-card px-3 py-2 text-[13px]",children:a}),w.isSuccess&&!i?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):v.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n?e.jsxs("div",{className:"flex max-w-[1040px] flex-col",children:[e.jsxs("section",{"aria-label":"Your plan",className:"grid grid-cols-1 gap-5 rounded-xl border border-border bg-card px-6 py-5 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"m-0 text-[11.5px] font-medium uppercase tracking-wider text-muted-foreground",children:"Your plan"}),e.jsxs("p",{className:"m-0 mt-1 text-[28px] font-bold leading-tight",children:[n.current?.name??k?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:n.current?.price??k?.price})]}),n.current?.period&&e.jsx("p",{className:"m-0 mt-1 text-[13px] text-ink-soft",children:n.current.period})]}),n.manage&&e.jsx("div",{children:e.jsx(g,{base:i,form:n.manage})}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Q,{})}),n.current?.warning&&e.jsx("p",{role:"status",className:"m-0 rounded-md bg-warn-soft px-3.5 py-2.5 text-[13px] sm:col-span-2",children:n.current.warning}),n.nudge&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg bg-brand-soft px-3.5 py-2.5 sm:col-span-2",children:[e.jsx("p",{className:"m-0 min-w-[220px] flex-1 text-[13px]",children:n.nudge.text}),e.jsx(g,{base:i,form:n.nudge.action})]})]}),e.jsxs("div",{className:"mb-4 mt-9 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{id:"compare",className:"m-0 text-[17px] font-semibold",children:"Compare plans"}),q&&e.jsx("div",{role:"radiogroup","aria-label":"Billing period",className:"inline-flex rounded-full border border-border bg-card p-0.5",children:[!1,!0].map(t=>e.jsx("button",{type:"button",role:"radio","aria-checked":h===t,onClick:()=>R(t),className:m("rounded-full px-3.5 py-1 text-[13px]",h===t?"bg-foreground text-background":"text-ink-soft"),children:t?e.jsxs(e.Fragment,{children:["Yearly ",e.jsx("span",{className:m("font-medium",h?"opacity-80":"text-brand"),children:"2 months free"})]}):"Monthly"},String(t)))})]}),e.jsx("div",{"aria-labelledby":"compare",className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:n.plans.map(t=>{const x=h&&t.yearly?t.yearly:null,S=x?x.actions:t.actions,E=t.relation==="downgrade";return e.jsxs("div",{className:m("relative flex min-w-0 flex-col gap-4 rounded-xl border bg-card p-5",t.recommended?"border-brand shadow-[0_0_0_1px_var(--color-brand),0_10px_30px_rgb(61_97_217/.12)]":"border-border"),children:[(t.current||t.recommended)&&e.jsx("span",{className:m("absolute -top-2.5 left-5 rounded-full px-2.5 py-px text-[11.5px] font-semibold",t.current?"bg-foreground text-background":"bg-brand text-white"),children:t.current?"Your plan":"Recommended"}),e.jsxs("div",{children:[e.jsx("h3",{className:"m-0 text-[16px] font-semibold",children:t.name}),t.pitch&&e.jsx("p",{className:"m-0 mt-0.5 text-[13px] text-muted-foreground",children:t.pitch})]}),e.jsxs("p",{className:"m-0 text-[34px] font-bold leading-none tracking-tight",children:[x?.amount??t.amount??t.price,(x?.unit??t.unit)&&e.jsx("span",{className:"ml-1 text-[13px] font-normal tracking-normal text-muted-foreground",children:x?.unit??t.unit})]}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-col gap-2 p-0",children:t.features.map(l=>e.jsxs("li",{className:m("flex gap-2 text-[13.5px]",t.added?.includes(l)&&"font-semibold"),children:[e.jsx(U,{className:"mt-0.5 size-4 shrink-0 text-ok","aria-hidden":!0}),l]},l))}),t.current?e.jsx(P,{type:"button",variant:"outline",disabled:!0,className:"w-full",children:"Current plan"}):E?S.map(l=>e.jsx(O,{base:i,form:l,warning:t.warning??null},l.label)):S.map(l=>e.jsx(g,{base:i,form:{...l,primary:!!t.recommended||l.primary},wide:!0},l.label))]},t.id)})}),e.jsxs("p",{className:"m-0 mt-5 text-center text-[13px] text-muted-foreground",children:[n.footer?e.jsxs("b",{className:"font-semibold text-foreground",children:[n.footer.split(". ")[0],"."]}):n.intro," ",n.footer?.split(". ").slice(1).join(". ")]}),n.notes.length>0&&e.jsx("p",{className:"m-0 mt-1.5 text-center text-[12px] text-muted-foreground",children:n.notes.join(" ")})]}):e.jsx(B,{})]})}function O({base:s,form:r,warning:a}){const[o,c]=d.useState(!1);return a&&o?e.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-warn-soft px-3 py-2.5 text-[12.5px]",children:[e.jsx("p",{className:"m-0",children:a}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{base:s,form:{...r,label:"Downgrade anyway",primary:!1}}),e.jsx("button",{type:"button",className:"text-[13px] text-muted-foreground underline underline-offset-2",onClick:()=>c(!1),children:"Keep my plan"})]})]}):a?e.jsx("button",{type:"button",className:"self-center text-[13px] text-muted-foreground underline underline-offset-[3px]",onClick:()=>c(!0),children:r.label}):e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0 self-center",children:[Object.entries(r.fields).map(([u,p])=>e.jsx("input",{type:"hidden",name:u,value:p},u)),e.jsx("button",{type:"submit",className:"text-[13px] text-muted-foreground underline underline-offset-[3px]",children:r.label})]})}function g({base:s,form:r,wide:a}){return e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0",children:[Object.entries(r.fields).map(([o,c])=>e.jsx("input",{type:"hidden",name:o,value:c},o)),e.jsx(P,{type:"submit",variant:r.primary?"default":"outline",className:a?"w-full":void 0,children:r.label})]})}function Q(){const{limits:s}=y(),r=[{label:"Sites",text:C(s.projects.used,s.projects.limit,"site","sites"),share:N(s.projects.used,s.projects.limit)},{label:"Members",text:C(s.members.used,s.members.limit,"member","members"),share:N(s.members.used,s.members.limit)},{label:"Screenshots",text:s.screenshots?s.storage.limit===null?`${j(s.storage.used)} used`:`${j(s.storage.used)} of ${j(s.storage.limit)}`:"Not on this plan",share:s.screenshots?N(s.storage.used,s.storage.limit):null}];return e.jsx("dl",{className:"m-0 grid grid-cols-1 gap-5 border-t border-border pt-4 sm:grid-cols-3",children:r.map(a=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("dt",{className:"text-[12px] text-muted-foreground",children:a.label}),e.jsx("dd",{className:"m-0 text-[13px]",children:a.text}),a.share!==null&&e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:m("h-full rounded-full",a.share>=1?"bg-destructive":"bg-brand"),style:{width:`${Math.min(100,Math.round(a.share*100))}%`}})})]},a.label))})}const N=(s,r)=>r===null||r===0?null:s/r,C=(s,r,a,o)=>r===null?`${s} ${s===1?a:o}, unlimited`:`${s} of ${r} ${r===1?a:o}`,re=()=>y().user.role==="owner"?e.jsx(L,{}):e.jsx(D,{title:"Plan & billing"});export{re as component};
@@ -1 +0,0 @@
1
- import{r as i,i as ae,ac as re,e as se,ad as ie,E as ne,k as j,j as f,am as oe,h as de}from"./index-DXj5DU-z.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as me,c as ge,n as ve}from"./label-BNpdN3Cg.js";import{N as ke,O as xe}from"./dialog-zaKAKGow.js";import{u as we}from"./useAriaLabelledBy-Cx69TO6K.js";import{u as ye}from"./useValueChanged-D634YMNF.js";const M=i.createContext(void 0);function Ce(){const r=i.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":g,form:p,id:L,inputRef:N,name:w,nativeButton:h=!1,onCheckedChange:T,readOnly:d=!1,required:b=!1,disabled:V=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=s,{clearErrors:H}=le(),{state:R,setTouched:O,setDirty:A,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:U,name:Y,validation:c}=ue(),{labelId:_}=fe(),t=U||V,l=Y??w,n=i.useRef(null),G=re(n,N,c.inputRef),m=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:m}),B=h?void 0:E,[a,K]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});me(m,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),A(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:Q,buttonRef:X}=ie({disabled:t,native:h}),Z=we(g,_,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(O(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=ge(ve,e.nativeEvent);T?.(u,S),!S.isCanceled&&K(u)},onClick(e){e.stopPropagation()},onFocus(){m.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",s,{state:I,ref:[o,m,X],props:[$,q,Q,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...g}=s,p=Ce();return j("span",s,{state:p,ref:o,stateAttributesMapping:D,props:g})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
@@ -1 +0,0 @@
1
- import{r as u,e as l}from"./index-DXj5DU-z.js";import{u as c}from"./label-BNpdN3Cg.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
@@ -1 +0,0 @@
1
- import{u as r,Q as u}from"./useBaseQuery-Dl2qdxNT.js";function a(e,s){return r(e,u)}export{a as u};
@@ -1 +0,0 @@
1
- import{k as n}from"./index-DXj5DU-z.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
@@ -1 +0,0 @@
1
- import{r,x as b,j as e,h as y,y as N,B as j,q as f,t as S,a2 as C}from"./index-DXj5DU-z.js";import{L as c,I as d}from"./label-BNpdN3Cg.js";import{P,a as h}from"./parts-DUFMukrB.js";import{S as A}from"./SaveState-DzF8ZaPe.js";import{M as k}from"./McpTokens-Bj04Bv7o.js";import{u as M}from"./me-DRWJq-k_.js";import{u as F,a as E}from"./studio-C6rKaKyK.js";import{M as T,S as D,a as z}from"./sun-BHujGXQB.js";import"./card-CBSSmpT3.js";import"./labels--UUyt9uB.js";import"./useQuery-BO7PrbuY.js";import"./useBaseQuery-Dl2qdxNT.js";import"./badge-CCBUSB_y.js";import"./useRender-0SJIdv0u.js";import"./dialog-zaKAKGow.js";import"./inertValue-Bju6oxRr.js";import"./switch-DxJ9TWjl.js";import"./useAriaLabelledBy-Cx69TO6K.js";import"./useValueChanged-D634YMNF.js";import"./ConfirmDialog-CUQ3wyl0.js";import"./check-DJgo7I6A.js";import"./copy-BVdfZXH-.js";import"./CopyButton-Cc6bLGfR.js";function H({items:s}){const[a,o]=r.useState(b);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:s.map(t=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===t.value,onClick:()=>{N(t.value),o(t.value)},className:y("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===t.value&&"border-line-strong bg-muted text-foreground"),children:[t.icon,t.label]},t.value))})}function ne(){const s=M(),a=F(),[o,t]=r.useState(s.user.name),[u,i]=r.useState(null);r.useEffect(()=>t(s.user.name),[s.user.name]);const m=o.trim()!==s.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(P,{title:"You",sub:"Your own account on this studio",actions:e.jsx(A,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:l=>{l.preventDefault(),m&&a.mutate(o.trim(),{onSuccess:()=>i(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"your-name",value:o,onChange:l=>t(l.target.value)}),m&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(d,{id:"your-email",value:s.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(L,{})}),!f(s.user.role,"settings")&&f(s.user.role,"review")&&e.jsx(k,{owner:!0,mine:!0,instanceOwner:!1,operator:S(s),sites:s.projects}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(H,{items:[{value:"system",label:"System",icon:e.jsx(T,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(D,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(z,{className:"size-3.5"})}]})})]})}function L(){const s=E(),[a,o]=r.useState(""),[t,u]=r.useState(""),[i,m]=r.useState(""),[l,g]=r.useState(""),[v,p]=r.useState(!1),x=a.length>0&&t.length>=12&&t===i;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async n=>{if(n.preventDefault(),!(!x||s.isPending)){g("");try{await s.mutateAsync({current:a,next:t}),o(""),u(""),m(""),p(!0)}catch(w){g(C(w))}}},children:[l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(d,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:n=>{o(n.target.value),p(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(d,{id:"pw-next",type:"password",autoComplete:"new-password",value:t,onChange:n=>{u(n.target.value),p(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(d,{id:"pw-again",type:"password",autoComplete:"new-password",value:i,onChange:n=>{m(n.target.value),p(!1)}}),i.length>0&&t!==i&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"submit",loading:s.isPending,disabled:!x,children:s.isPending?"Changing…":v&&!x?"Changed":"Change password"})})]})}export{ne as component};