@snagset/server 0.1.62 → 0.1.64

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 (97) hide show
  1. package/dist/integrations/jira.js +22 -0
  2. package/dist/integrations/jira.js.map +1 -1
  3. package/dist/integrations/linear.js +17 -0
  4. package/dist/integrations/linear.js.map +1 -1
  5. package/dist/routes/integrations.js +44 -6
  6. package/dist/routes/integrations.js.map +1 -1
  7. package/package.json +1 -1
  8. package/static/dashboard/assets/{CompositeItem-CkiEeVQd.js → CompositeItem-CNlNRLwm.js} +1 -1
  9. package/static/dashboard/assets/{CompositeList-OHWH8W1h.js → CompositeList-CDfO6SCy.js} +1 -1
  10. package/static/dashboard/assets/{ConfirmDialog-Db4AvUN5.js → ConfirmDialog-B5-FUf01.js} +1 -1
  11. package/static/dashboard/assets/{CopyButton-r38fWUwx.js → CopyButton-CDVY09FZ.js} +1 -1
  12. package/static/dashboard/assets/{FieldItemContext-qjC5pLGs.js → FieldItemContext-D_hbvXzX.js} +1 -1
  13. package/static/dashboard/assets/{InstallTag-DYeR38Ex.js → InstallTag-DutQruP1.js} +1 -1
  14. package/static/dashboard/assets/InstanceRows-BrXrOXxa.js +1 -0
  15. package/static/dashboard/assets/McpTokens-BnhNB_C0.js +1 -0
  16. package/static/dashboard/assets/{Picker-95_pkfVu.js → Picker-BvdKGeU8.js} +2 -2
  17. package/static/dashboard/assets/{SaveState-DmbisglJ.js → SaveState-DrWU77oO.js} +1 -1
  18. package/static/dashboard/assets/_-DwwKoA7B.js +1 -0
  19. package/static/dashboard/assets/_app-CYfFCBBL.js +1 -0
  20. package/static/dashboard/assets/{_app-BjmAfJVc.js → _app-DalVfhNg.js} +1 -1
  21. package/static/dashboard/assets/{_app-BB6wQ2Q0.js → _app-MqqZ5rHF.js} +2 -2
  22. package/static/dashboard/assets/activity-B1fOkSrs.js +1 -0
  23. package/static/dashboard/assets/{arrow-left-Bw5uUs0F.js → arrow-left-B4-bJVcO.js} +1 -1
  24. package/static/dashboard/assets/{avatar-C6Rr20S0.js → avatar-B-4Lv0hf.js} +1 -1
  25. package/static/dashboard/assets/{badge-CicACH6l.js → badge-Cwf-GPv8.js} +1 -1
  26. package/static/dashboard/assets/{check-BlRwZrSR.js → check-26YOtWVN.js} +1 -1
  27. package/static/dashboard/assets/{chevron-down-865lxBex.js → chevron-down-OinKSKsq.js} +1 -1
  28. package/static/dashboard/assets/{chevron-right-2YkP20tJ.js → chevron-right-Dh7TD2kW.js} +1 -1
  29. package/static/dashboard/assets/{copy-DSJQda7h.js → copy-DqhiNOHN.js} +1 -1
  30. package/static/dashboard/assets/{createBaseUIEventDetails-CTYgZt5m.js → createBaseUIEventDetails-BlUeVOHL.js} +1 -1
  31. package/static/dashboard/assets/{dialog-DZbUuBSr.js → dialog-CjX41K4h.js} +2 -2
  32. package/static/dashboard/assets/{dropdown-menu-By49qibi.js → dropdown-menu-BejmUTVa.js} +2 -2
  33. package/static/dashboard/assets/{forgot-C-nxI2th.js → forgot-Cv_EPbZy.js} +1 -1
  34. package/static/dashboard/assets/{getPseudoElementBounds-CFaDUKhY.js → getPseudoElementBounds-087ogDm1.js} +1 -1
  35. package/static/dashboard/assets/{image-off-u_JoVfOy.js → image-off-BsOmKpjU.js} +1 -1
  36. package/static/dashboard/assets/index-CUBD0DcL.js +172 -0
  37. package/static/dashboard/assets/{inertValue-CLaAaX62.js → inertValue-BxLh7N1J.js} +1 -1
  38. package/static/dashboard/assets/invite-DrxWT0UW.js +1 -0
  39. package/static/dashboard/assets/{label-8lYoT07T.js → label-BoGrNcZ0.js} +1 -1
  40. package/static/dashboard/assets/{layout-grid-C-a8O8B6.js → layout-grid-D1FcD4G3.js} +1 -1
  41. package/static/dashboard/assets/me-DeblO6Os.js +1 -0
  42. package/static/dashboard/assets/{plus-CS6tYH0S.js → plus-ChodljzA.js} +1 -1
  43. package/static/dashboard/assets/{reset-Cga9iuj2.js → reset-DoB5fAkF.js} +1 -1
  44. package/static/dashboard/assets/{s._site-SxnfgkOI.js → s._site-Xu1MbYF_.js} +1 -1
  45. package/static/dashboard/assets/{s._site.comments-B9MVihwE.js → s._site.comments-63OF736E.js} +8 -8
  46. package/static/dashboard/assets/s._site.reviewers-BZ6tbe9V.js +1 -0
  47. package/static/dashboard/assets/s._site.settings-Bx21kvsO.js +1 -0
  48. package/static/dashboard/assets/{setup-Duptw7Cj.js → setup-AHjI1DnF.js} +1 -1
  49. package/static/dashboard/assets/{sign-in-zTZ603o2.js → sign-in-D-Y_lran.js} +1 -1
  50. package/static/dashboard/assets/{sign-up-CmHICQCh.js → sign-up-B8RiXKrs.js} +1 -1
  51. package/static/dashboard/assets/sites-BcEIT4Tw.js +1 -0
  52. package/static/dashboard/assets/studio-BxUhJp0u.js +1 -0
  53. package/static/dashboard/assets/{studio-pFbLfSmh.js → studio-Dg6dFTZ5.js} +1 -1
  54. package/static/dashboard/assets/studio.index-N5sIdor3.js +1 -0
  55. package/static/dashboard/assets/studio.integrations-ZAlVFGVw.js +16 -0
  56. package/static/dashboard/assets/studio.members-r1I_P9vv.js +6 -0
  57. package/static/dashboard/assets/studio.plan-B5CWlvB1.js +1 -0
  58. package/static/dashboard/assets/{sun-CK52_1CD.js → sun-B2KoVsUv.js} +1 -1
  59. package/static/dashboard/assets/{switch-CHmJ_Ipt.js → switch-DmO3bJxP.js} +1 -1
  60. package/static/dashboard/assets/{table-DoCG5L_o.js → table-D3lWzaas.js} +1 -1
  61. package/static/dashboard/assets/{useAriaLabelledBy-DcwFG0Pf.js → useAriaLabelledBy-BVVmb5Zj.js} +1 -1
  62. package/static/dashboard/assets/{useBaseQuery-C_54ul4D.js → useBaseQuery-BBU42uTr.js} +1 -1
  63. package/static/dashboard/assets/{useCompositeItem-6LQEohxr.js → useCompositeItem-BZX9S0sx.js} +1 -1
  64. package/static/dashboard/assets/useQuery-CGx36E5q.js +1 -0
  65. package/static/dashboard/assets/useRender-CNreHlDo.js +1 -0
  66. package/static/dashboard/assets/useScrollLock-DV4rQnvf.js +1 -0
  67. package/static/dashboard/assets/{useValueChanged-BuDWW6rb.js → useValueChanged-BcwdNwDJ.js} +1 -1
  68. package/static/dashboard/assets/{users-BkLZaCQc.js → users-BxyUqa0S.js} +1 -1
  69. package/static/dashboard/assets/{welcome-C-lgK9ve.js → welcome-9qfwvdaq.js} +3 -3
  70. package/static/dashboard/assets/widget-signin-x6glMrne.js +1 -0
  71. package/static/dashboard/assets/you-C3HTpoDt.js +1 -0
  72. package/static/dashboard/assets/{zod-D1EnJi4o.js → zod-qyf6R6J-.js} +1 -1
  73. package/static/dashboard/index.html +1 -1
  74. package/static/widget/build.json +2 -2
  75. package/static/widget/snag.js +1 -1
  76. package/static/widget/snag.runtime.js +1 -1
  77. package/static/dashboard/assets/InstanceRows-DnLIQuI5.js +0 -1
  78. package/static/dashboard/assets/McpTokens-BmJUgHlN.js +0 -1
  79. package/static/dashboard/assets/activity-DNpom_Jb.js +0 -1
  80. package/static/dashboard/assets/card-CzVTF25b.js +0 -1
  81. package/static/dashboard/assets/index-X11XkRkb.js +0 -162
  82. package/static/dashboard/assets/invite-Dn8Q_z-a.js +0 -1
  83. package/static/dashboard/assets/me-DnLqgT3l.js +0 -1
  84. package/static/dashboard/assets/parts-DVVBI72d.js +0 -6
  85. package/static/dashboard/assets/s._site.reviewers-BavfDGJ3.js +0 -1
  86. package/static/dashboard/assets/s._site.settings-CSqVsJgO.js +0 -1
  87. package/static/dashboard/assets/sites-Ba4z7pZr.js +0 -1
  88. package/static/dashboard/assets/studio-BJqd3NIo.js +0 -1
  89. package/static/dashboard/assets/studio.index-C3Q-z9vR.js +0 -1
  90. package/static/dashboard/assets/studio.integrations-DNCgc9H5.js +0 -16
  91. package/static/dashboard/assets/studio.members-BmKyP0gU.js +0 -6
  92. package/static/dashboard/assets/studio.plan-CrdqMbik.js +0 -1
  93. package/static/dashboard/assets/useQuery-CCJBm2EJ.js +0 -1
  94. package/static/dashboard/assets/useRender-BZe0PUs7.js +0 -1
  95. package/static/dashboard/assets/useScrollLock-DDlrhOw8.js +0 -1
  96. package/static/dashboard/assets/widget-signin-DiXUP4GV.js +0 -1
  97. package/static/dashboard/assets/you-BHn-aWRM.js +0 -1
@@ -1 +0,0 @@
1
- import{R as A,r as u,j as e,H as J,G as b,L as B,p as v,I as y,B as N,s as C,z as S,J as k,C as f,D as I,F as g}from"./index-X11XkRkb.js";import{u as L,a as E}from"./zod-D1EnJi4o.js";import{L as j,I as w}from"./label-8lYoT07T.js";import"./createBaseUIEventDetails-CTYgZt5m.js";function G(){const s=A.useLoaderData(),[t,o]=u.useState(!1);return s.ok?!!s.me&&(!s.invite.email||s.invite.email.toLowerCase()===s.me.toLowerCase())&&!t?e.jsx(F,{token:s.token,invite:s.invite,me:s.me,onOther:()=>o(!0)}):e.jsx($,{token:s.token,invite:s.invite}):e.jsx(Y,{code:s.code,message:s.message})}function F({token:s,invite:t,me:o,onOther:i}){const d=v(),[r,x]=u.useState(""),[n,p]=u.useState(!1),a=t.org.name||"a studio",c=async()=>{x(""),p(!0);try{await C.acceptInvite({token:s,email:o}),S("in"),k.clear(),d({to:"/sites",replace:!0})}catch(l){if(l instanceof f&&l.code==="account_exists")return i();x(l instanceof f?l.message:"Could not reach the server. Try again."),p(!1)}};return e.jsx(b,{width:400,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:["Join ",a]}),e.jsxs("p",{className:"m-0 mt-1.5 text-muted-foreground",children:[t.invitedBy?`${t.invitedBy} invited you`:"You were invited"," to join ",a," as ",y(t.role),". You are signed in as"," ",e.jsx("span",{className:"break-all text-foreground",children:o}),"."]})]}),r&&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:r}),e.jsx(N,{type:"button",size:"lg",loading:n,onClick:c,children:n?"Joining…":`Join ${a}`}),!t.email&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx("button",{type:"button",onClick:i,className:"cursor-pointer border-0 bg-transparent p-0 text-foreground underline underline-offset-4",children:"Join with another address"})})]})})}function Y({code:s,message:t}){const{title:o,signIn:i}=J(s);return e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),e.jsx("p",{role:"alert",className:"m-0 text-muted-foreground",children:t}),i&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx(B,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})})]})})}const R=I({name:g().trim().max(120).optional(),email:g().trim().email("An email address"),password:g().min(1,"A password")});function $({token:s,invite:t}){const o=v(),[i,d]=u.useState(""),[r,x]=u.useState(!1),{register:n,handleSubmit:p,formState:a}=L({resolver:E(R),defaultValues:{email:t.email??"",name:""}}),c=t.org.name||"a studio",l=p(async m=>{if(d(""),!r&&m.password.length<12){d("The password must be at least 12 characters. A short phrase of real words is fine.");return}try{await C.acceptInvite({token:s,password:m.password,...m.name?{name:m.name}:{},...t.email?{}:{email:m.email}}),S("in"),k.clear(),o({to:"/sites",replace:!0})}catch(h){h instanceof f&&h.code==="account_exists"&&x(!0),d(h instanceof f?h.message:"Could not reach the server. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:l,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:["Join ",c]}),e.jsxs("p",{className:"m-0 mt-1.5 text-muted-foreground",children:[t.invitedBy?`${t.invitedBy} invited you`:"You were invited"," to join ",c," as ",y(t.role),".",r?" Sign in with the account you already have here.":" Choose your password and you're in."]})]}),i&&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:i}),e.jsxs("fieldset",{disabled:a.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(j,{htmlFor:"email",children:"Email"}),e.jsx(w,{id:"email",type:"email",autoComplete:"username",readOnly:!!t.email,"aria-invalid":!!a.errors.email,...n("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),!r&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(j,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(w,{id:"name",autoComplete:"name",...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(j,{htmlFor:"password",children:r?"Your password":"Choose a password"}),e.jsx(w,{id:"password",type:"password",autoComplete:r?"current-password":"new-password","aria-invalid":!!a.errors.password,...n("password")}),!r&&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.jsx(N,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Joining…":`Join ${c}`})]})]})})}export{G as component};
@@ -1 +0,0 @@
1
- import{u as r,Q as u,d as s}from"./useBaseQuery-C_54ul4D.js";import{A as t}from"./index-X11XkRkb.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
@@ -1,6 +0,0 @@
1
- import{c,j as e,h as a}from"./index-X11XkRkb.js";import{C as m}from"./card-CzVTF25b.js";import{S as l,ap as x,r as d}from"./useScrollLock-DDlrhOw8.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 o=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],f=c("lock",o);function p({title:s,sub:t,actions:n}){return e.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-baseline gap-3",children:[e.jsx("h1",{className:"m-0 text-xl font-semibold tracking-tight",children:s}),t&&e.jsx("p",{className:"m-0 min-w-0 text-muted-foreground",children:t})]}),n]})}function N({title:s,description:t,children:n,danger:i,cardClassName:r}){return e.jsxs("section",{className:"grid max-w-[1040px] grid-cols-1 gap-4 lg:grid-cols-[minmax(220px,1fr)_2fr] lg:gap-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:a("m-0 mb-1.5 text-[15.5px] font-semibold tracking-tight",i&&"text-destructive"),children:s}),t&&e.jsx("p",{className:"m-0 text-[13px] leading-normal text-muted-foreground",children:t})]}),e.jsx(m,{className:a("flex max-w-[640px] flex-col gap-4 p-5",i&&"border-destructive",r),children:n})]})}function u({icon:s,title:t,children:n,action:i,className:r}){return e.jsxs("div",{className:a("flex flex-col items-center gap-2 px-6 py-16 text-center",r),children:[s&&e.jsx("div",{className:"mb-1.5 flex size-11 items-center justify-center rounded-[10px] bg-muted text-ink-soft",children:s}),e.jsx("h3",{className:"m-0 text-[15px] font-semibold",children:t}),n&&e.jsx("div",{className:"m-0 max-w-[360px] text-muted-foreground",children:n}),i&&e.jsx("div",{className:"mt-2",children:i})]})}function w({status:s,className:t}){const n=d(s);return e.jsx("span",{className:a("inline-flex h-5 items-center whitespace-nowrap rounded-full px-2 text-[11.5px] font-medium leading-none",n?x[s]:"bg-muted text-muted-foreground",t),children:n?l[s]:s})}function v({children:s}){return e.jsx("div",{className:"text-[11.5px] font-medium uppercase tracking-wide text-muted-foreground",children:s})}function S({title:s,children:t}){return e.jsxs("div",{className:"flex flex-col p-7",children:[e.jsx(p,{title:s}),e.jsx(u,{icon:e.jsx(f,{className:"size-5"}),title:"Only admins can change this",children:t??e.jsx("p",{className:"m-0",children:"Ask an owner or an admin of the studio if something here needs changing."})})]})}export{S as A,u as E,p as P,w as S,N as a,v as b};
@@ -1 +0,0 @@
1
- import{aK as A,r as f,j as e,B as g,aL as I,q as P,h as L,aM as M,A as N,a2 as F,D as U,F as y}from"./index-X11XkRkb.js";import{u as C}from"./useQuery-CCJBm2EJ.js";import{u as $,a as B,C as R}from"./zod-D1EnJi4o.js";import{P as D}from"./Picker-95_pkfVu.js";import{C as S}from"./card-CzVTF25b.js";import{X as z,i as H,j as q,l as K,k as V,m as Y,n as O}from"./dialog-DZbUuBSr.js";import{L as k,I as Q}from"./label-8lYoT07T.js";import{T as X,a as G,b as E,c as p,d as J,e as j}from"./table-DoCG5L_o.js";import{C as W}from"./ConfirmDialog-Db4AvUN5.js";import{C as Z}from"./CopyButton-r38fWUwx.js";import{P as _,E as ee}from"./parts-DVVBI72d.js";import{v as T}from"./useScrollLock-DDlrhOw8.js";import{u as se}from"./me-DnLqgT3l.js";import{C as ae}from"./check-BlRwZrSR.js";import{U as te}from"./users-BkLZaCQc.js";import{P as ne}from"./plus-CS6tYH0S.js";import"./useBaseQuery-C_54ul4D.js";import"./chevron-down-865lxBex.js";import"./isElementDisabled-CwHw_lZC.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./inertValue-CLaAaX62.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-BuDWW6rb.js";import"./getPseudoElementBounds-CFaDUKhY.js";import"./CompositeList-OHWH8W1h.js";import"./copy-DSJQda7h.js";function Le(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),o=C(N.links(s)),m=C(N.origins(s)),[u,i]=f.useState(!1),[t,a]=f.useState(null);f.useEffect(()=>a(null),[s]);const d=o.data?.data??[],h=m.data?.origins[0]?.replace(/\/+$/,"")??"",r=t?`${h}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>i(!0),children:[e.jsx(ne,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(_,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),t&&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(ae,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.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(Z,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>a(null),children:e.jsx(z,{})})]}),o.isSuccess&&d.length===0?e.jsx(S,{className:"max-w-[1040px]",children:e.jsx(ee,{icon:e.jsx(te,{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(S,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(X,{children:[e.jsx(G,{children:e.jsxs(E,{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(J,{children:d.map(c=>e.jsx(re,{link:c,uid:s,onRevoked:()=>a(b=>b?.id===c.id?null:b)},c.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(ie,{uid:s,open:u,onOpenChange:i,onMinted:a})]})}function re({link:s,uid:l,onRevoked:o}){const m=I(l),u=P(se().user.role,"settings"),[i,t]=f.useState(!1),a=!!s.revokedAt,d=!a&&new Date(s.expiresAt).getTime()<=Date.now(),h=a||d,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(E,{className:L(h&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:a?e.jsxs("span",{children:["Revoked ",T(s.revokedAt)]}):d?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?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!a&&u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>t(!0),children:"Revoke"}),e.jsx(W,{open:i,onOpenChange:t,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:m.isPending,onConfirm:()=>{t(!1),o(),m.mutate(s.id)}})]})]})}const oe=U({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function ie({uid:s,open:l,onOpenChange:o,onMinted:m}){const u=M(s),i=C({...N.rounds(s),enabled:l}),[t,a]=f.useState(""),{register:d,handleSubmit:h,formState:r,reset:v,control:c}=$({resolver:B(oe),defaultValues:{days:"14",roundId:""}}),b=h(async n=>{a("");const x=Number(n.days);try{const w=await u.mutateAsync({name:n.name,...Number.isFinite(x)&&x>0?{expiresAt:new Date(Date.now()+x*864e5).toISOString()}:{},...n.roundId?{roundId:n.roundId}:{}});m(w),v(),o(!1)}catch(w){a(F(w))}});return e.jsx(H,{open:l,onOpenChange:o,children:e.jsx(q,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(K,{children:[e.jsx(V,{children:"New reviewer"}),e.jsx(Y,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),t&&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:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Q,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!r.errors.name,...d("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsx(R,{control:c,name:"days",render:({field:n})=>e.jsx(D,{id:"reviewer-days",value:String(n.value),onChange:n.onChange,options:[{value:"7",label:"7 days"},{value:"14",label:"14 days"},{value:"30",label:"30 days"},{value:"90",label:"90 days"}]})}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),i.data&&i.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.jsx(R,{control:c,name:"roundId",render:({field:n})=>e.jsx(D,{id:"reviewer-round",value:n.value??"",onChange:n.onChange,options:[{value:"",label:"Any round"},...i.data.data.map(x=>({value:x.id,label:x.name}))]})})]}),e.jsxs(O,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:r.isSubmitting,children:r.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{Le as component};
@@ -1 +0,0 @@
1
- import{r as l,i as je,ak as re,al as Ae,e as xe,aj as Oe,E as ge,k as ye,j as e,am as Te,f as de,h as ce,q as ue,a_ as Ve,a$ as Me,B as b,A as Ce,b0 as $e,b1 as Be,b2 as Ge,p as Le,b3 as qe}from"./index-X11XkRkb.js";import{u as we}from"./useQuery-CCJBm2EJ.js";import{I as Y,L as S}from"./label-8lYoT07T.js";import{f as Re,h as ke,j as Ne,u as Se,A as ze,c as We,n as He,e as Ke,k as Ue,l as Ye,a as _e}from"./createBaseUIEventDetails-CTYgZt5m.js";import{t as Qe,a as Je,u as Xe,S as Ze}from"./inertValue-CLaAaX62.js";import{A as et,C as tt,I as st}from"./InstallTag-DYeR38Ex.js";import{u as nt}from"./useValueChanged-BuDWW6rb.js";import{x as at,y as it}from"./useScrollLock-DDlrhOw8.js";import{C as ot}from"./CompositeItem-CkiEeVQd.js";import{u as rt}from"./FieldItemContext-qjC5pLGs.js";import{u as dt}from"./useAriaLabelledBy-DcwFG0Pf.js";import{s as lt}from"./serializeValue-B8e3iXO-.js";import{C as Ie}from"./ConfirmDialog-Db4AvUN5.js";import{C as ct}from"./CopyButton-r38fWUwx.js";import{B as ut}from"./badge-CicACH6l.js";import{a as q,A as mt,P as ft}from"./parts-DVVBI72d.js";import{u as me}from"./me-DnLqgT3l.js";import{S as ve}from"./switch-CHmJ_Ipt.js";import{S as pt}from"./SaveState-DmbisglJ.js";import{X as ht}from"./dialog-DZbUuBSr.js";import{P as xt}from"./plus-CS6tYH0S.js";import"./useBaseQuery-C_54ul4D.js";import"./CompositeList-OHWH8W1h.js";import"./isElementDisabled-CwHw_lZC.js";import"./useCompositeItem-6LQEohxr.js";import"./check-BlRwZrSR.js";import"./copy-DSJQda7h.js";import"./useRender-BZe0PUs7.js";import"./card-CzVTF25b.js";const gt=l.createContext(void 0);function vt(s=!1){const t=l.useContext(gt);if(!t&&!s)throw new Error(je(86));return t}function bt(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}const le={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...Qe,...Re},Pe=l.createContext(void 0);function jt(){return l.useContext(Pe)}const De=l.createContext(void 0);function yt(){const s=l.useContext(De);if(s===void 0)throw new Error(je(52));return s}const Ct=l.forwardRef(function(t,n){const{render:r,className:i,disabled:c=!1,readOnly:o=!1,required:m=!1,"aria-labelledby":f,value:a,inputRef:I,nativeButton:h=!1,id:R,style:x,...g}=t,j=jt(),{disabled:T,readOnly:_,required:V,form:Q,checkedValue:J,touched:X=!1,validation:M,name:y,setCheckedValue:Z=re,setTouched:ee=re,registerInputRef:A=re}=j??{},{setTouched:te,setFilled:z,state:W,disabled:se}=ke(),k=rt(),{labelId:$,getDescriptionProps:ne}=Ne(),u=se||k.disabled||T||c,N=_||o,O=V||m,B=Q,C=j?J===a:a==="",P=l.useRef(null),w=l.useRef(null),D=M?.registerInput,E=l.useCallback(p=>D?.(p,{controlRef:P,value:void 0}),[D]),G=Ae(I,w,A,E);xe(()=>{w.current?.checked&&z(!0)},[z]),xe(()=>{if(w.current){if(u&&C){A(null);return}A(w.current)}},[C,u,A]);const H=Se(),K=ze({id:R,implicit:!1,controlRef:P}),U=h?void 0:K,ae=dt(f,$,w,!h,U),ie={role:"radio","aria-checked":C,"aria-labelledby":ae,[et]:C?"":void 0,id:h?K:H,onKeyDown(p){p.key==="Enter"&&p.preventDefault()},onClick(p){if(p.defaultPrevented||u||N)return;p.preventDefault();const L=w.current;L&&Te(L,p)},onFocus(p){p.defaultPrevented||u||N||!X||(w.current?.click(),ee(!1))}},{getButtonProps:oe,buttonRef:d}=Oe({disabled:u,native:h,composite:!1}),v={type:"radio",ref:G,form:B,id:U,name:y,tabIndex:-1,style:y?at:it,"aria-hidden":!0,...a!==void 0?{value:lt(a)}:ge,disabled:u,checked:C,required:O,readOnly:N,onChange(p){if(p.nativeEvent.defaultPrevented||u||N||a===void 0)return;const L=We(He,p.nativeEvent);Z(a,L),!L.isCanceled&&te(!0)},onClick(p){p.stopPropagation()},onFocus(){P.current?.focus()}},F=l.useMemo(()=>({...W,required:O,disabled:u,readOnly:N,checked:C}),[W,u,N,C,O]),Ee=F,fe=j!==void 0,pe=[n,P,d],he=[ie,g,oe,ne,M?p=>M.getValidationProps(u,p):ge],Fe=ye("span",t,{enabled:!fe,state:F,ref:pe,props:he,stateAttributesMapping:le});return e.jsxs(De.Provider,{value:Ee,children:[fe?e.jsx(ot,{tag:"span",render:r,className:i,style:x,state:F,refs:pe,props:he,stateAttributesMapping:le}):Fe,e.jsx("input",{...v,suppressHydrationWarning:!0})]})}),wt=l.forwardRef(function(t,n){const{render:r,className:i,style:c,keepMounted:o=!1,...m}=t,f=yt(),a=f.checked,{mounted:I,transitionStatus:h,setMounted:R}=Je(a),x={...f,transitionStatus:h},g=l.useRef(null),j=o||I,T=ye("span",t,{ref:[n,g],state:x,props:m,stateAttributesMapping:le});return Xe({open:a,ref:g,onComplete(){a||R(!1)}}),j?T:null}),Rt=[Ze],kt=l.forwardRef(function(t,n){const{render:r,className:i,disabled:c,readOnly:o,required:m,onValueChange:f,value:a,defaultValue:I,form:h,name:R,inputRef:x,id:g,style:j,...T}=t,{setTouched:_,setFocused:V,validationMode:Q,name:J,disabled:X,state:M,validation:y,setDirty:Z,setFilled:ee,validityData:A}=ke(),{labelId:te}=Ne(),{clearErrors:z,elementRef:W}=Ke(),se=vt(!0),k=X||c,$=J??R,ne=Se(g),[u,N]=Ue({controlled:a,default:I,name:"RadioGroup",state:"value"}),[O,B]=l.useState(!1),C=de((d,v)=>{f?.(d,v),!v.isCanceled&&N(d)}),P=y.getInputControl,w=l.useMemo(()=>({get current(){return P()}}),[P]),D=l.useRef(null),E=l.useRef(null);function G(d){let v;return x&&(typeof x=="function"?v=x(d):x.current=d),D.current=d,v}const H=de(d=>{if(!d||d.disabled)return;E.current||(E.current=d);const v=D.current,F=d.checked||v==null||v.disabled?G(d):void 0;return()=>{E.current===d&&(E.current=null),D.current===d?F?(F(),D.current=null):G(null):F?.()}}),K=de(()=>{const d=W.current;if(!d)return u??null;for(const v of y.registeredInputs.keys())if(v.checked&&bt(v,d))return u??null;return null});Ye(w,ne,u??null,K,!k,R),nt(u,()=>{z($),Z(u!==A.initialValue),ee(u!=null),y.change(u);const d=E.current;u==null&&d&&!d.disabled&&G(d)});const U=te??se?.legendId,ae={...M,disabled:k??!1,required:m??!1,readOnly:o??!1},ie=l.useMemo(()=>({checkedValue:u,disabled:k,form:h,validation:y,name:$,readOnly:o,registerInputRef:H,required:m,setCheckedValue:C,setTouched:B,touched:O}),[u,k,h,y,$,o,H,m,C,B,O]),oe={id:g,role:"radiogroup","aria-required":m||void 0,"aria-disabled":k||void 0,"aria-readonly":o||void 0,"aria-labelledby":U,onFocus(){V(!0)},onBlur(d){_e(d.currentTarget,d.relatedTarget)||(_(!0),V(!1),Q==="onBlur"&&y.commit(u))},onKeyDownCapture(d){d.key.startsWith("Arrow")&&(B(!0),V(!0))}};return e.jsx(Pe.Provider,{value:ie,children:e.jsx(tt,{render:r,className:i,style:j,state:ae,props:[oe,T,d=>y.getValidationProps(k??!1,d)],refs:[n],stateAttributesMapping:Re,enableHomeAndEndKeys:!1,modifierKeys:Rt})})});function Nt({className:s,...t}){return e.jsx(kt,{"data-slot":"radio-group",className:ce("grid w-full gap-2",s),...t})}function St({className:s,...t}){return e.jsx(Ct,{"data-slot":"radio-group-item",className:ce("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 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 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...t,children:e.jsx(wt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}function It({uid:s}){const t=me(),n=we(Ce.rounds(s)),r=ue(t.user.role,"settings"),i=n.data?.data??[],c=i.filter(o=>!o.closed&&!o.archived).length;return e.jsxs(q,{title:"Rounds",description:e.jsx(e.Fragment,{children:"One pass of feedback each, and several can run at once — your own QA beside the client's. A new comment goes to the round its reviewer is looking at. Archive a finished round to put it away; delete removes its comments too."}),children:[!r&&e.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:"Only an owner or an admin can change rounds."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col divide-y divide-border p-0","aria-label":"Rounds",children:[i.map(o=>e.jsx(Pt,{uid:s,round:o,manager:r,last:!o.closed&&!o.archived&&c===1},o.id)),n.isSuccess&&i.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const be="Open another round first — new comments need somewhere to go.";function Pt({uid:s,round:t,manager:n,last:r}){const i=Ve(s),c=Me(s),[o,m]=l.useState(!1),[f,a]=l.useState(t.name),[I,h]=l.useState(!1),R=t.archived?"archived":t.closed?"closed":"open",x=i.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[o?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:g=>{g.preventDefault();const j=f.trim();if(!j||j===t.name)return m(!1);i.mutate({id:t.id,name:j},{onSuccess:()=>m(!1)})},children:[e.jsx(Y,{"aria-label":`New name for ${t.name}`,value:f,maxLength:80,autoFocus:!0,onChange:g=>a(g.target.value),onKeyDown:g=>g.key==="Escape"&&m(!1)}),e.jsx(b,{type:"submit",size:"sm",disabled:!f.trim()||i.isPending,children:"Save"}),e.jsx(b,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(!1),children:"Cancel"})]}):e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13.5px] font-medium",children:t.name}),e.jsx(ut,{variant:"outline",className:"text-[11px]",children:R})]}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] text-muted-foreground",children:["Round ",t.number," · ",t.threads," ",t.threads===1?"comment":"comments",t.unresolved>0?` · ${t.unresolved} unresolved`:""]})]}),n&&!o&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",title:r?be:void 0,children:[e.jsx(b,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:x,onClick:()=>{a(t.name),m(!0)},children:"Rename"}),!t.archived&&e.jsx(b,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:x||r,onClick:()=>i.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(b,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:x||r,onClick:()=>i.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(b,{size:"sm",variant:"ghost",className:"text-destructive","aria-label":`Delete ${t.name}`,disabled:x||r,onClick:()=>h(!0),children:"Delete…"})]}),n&&r&&!o&&e.jsx("p",{className:"m-0 w-full text-[12px] text-muted-foreground",children:be}),e.jsx(Ie,{open:I,onOpenChange:h,title:`Delete ${t.name}?`,description:t.threads>0?e.jsxs(e.Fragment,{children:["This deletes the round and"," ",e.jsxs("b",{className:"font-semibold text-foreground",children:[t.threads," ",t.threads===1?"comment":"comments"," and their screenshots"]}),". Reviewers stop seeing them straight away. To keep them out of sight instead, archive the round."]}):e.jsxs(e.Fragment,{children:["This round has no comments. Its number, Round ",t.number,", is not used again."]}),confirmLabel:"Delete round",confirmWord:t.name,busy:c.isPending,onConfirm:()=>c.mutate({id:t.id,confirm:t.name},{onSuccess:()=>h(!1)})})]})}const Dt=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function Et(){const{site:s}=$e.useParams(),t=me(),n=t.projects.find(a=>a.uid===s),r=ue(t.user.role,"settings"),i=we(Ce.origins(s)),c=Be(s),[o,m]=l.useState(null),f=a=>c.mutate(a,{onSuccess:()=>m(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ft,{title:"Site settings",sub:n.name,actions:e.jsx(pt,{saving:c.isPending,savedAt:o})}),e.jsxs(q,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:n.uid}),e.jsx(ct,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Ft,{name:n.name,onSave:a=>f({name:a})}),e.jsx(At,{domain:i.data?.domain??null,loaded:i.isSuccess,onSave:a=>f({domain:a})}),e.jsx(Ot,{list:i.data?.origins??[],loaded:i.isSuccess,hasDomain:!!i.data?.domain,onChange:a=>f({origins:a})})]}),e.jsxs(q,{title:"Widget",description:"Whether it runs, who the toolbar appears for, what guests may do, and the tag itself.",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx(ve,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:a=>f({status:a?"active":"paused"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"guests-status",className:"text-[13px] font-medium",children:"Guests can change status"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:["People who comment without an account or a review link can move a comment between Open, In progress, In review and Resolved.",!r&&" Only an owner or an admin can change this."]})]}),e.jsx(ve,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!r,onCheckedChange:a=>f({guestsCanChangeStatus:a})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(S,{children:"Who can comment"}),e.jsx(Nt,{value:n.writeMode,onValueChange:a=>f({writeMode:String(a)}),className:"gap-2",children:Dt.map(a=>e.jsxs("label",{className:ce("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===a.id&&"border-brand bg-brand-soft"),children:[e.jsx(St,{value:a.id,className:"mt-0.5","aria-label":a.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:a.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:a.note})]})]},a.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{children:"Install"}),e.jsx(st,{uid:n.uid})]})]}),e.jsx(It,{uid:s}),e.jsx(Tt,{uid:s,name:n.name,archived:!!n.archived,locked:!!n.locked}),e.jsx(Vt,{uid:s,name:n.name})]})}function Ft({name:s,onSave:t}){const[n,r]=l.useState(s);l.useEffect(()=>r(s),[s]);const i=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),i&&t(n.trim())},children:[e.jsx(S,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Y,{id:"site-name",value:n,onChange:c=>r(c.target.value)}),i&&e.jsx(b,{type:"submit",variant:"outline",children:"Save"})]})]})}function At({domain:s,loaded:t,onSave:n}){const[r,i]=l.useState(s??"");l.useEffect(()=>i(s??""),[s]);const c=r.trim()!==(s??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:o=>{o.preventDefault(),c&&n(r.trim()||null)},children:[e.jsx(S,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Y,{id:"site-domain",placeholder:"kilnwork.studio",value:r,onChange:o=>i(o.target.value),disabled:!t}),c&&e.jsx(b,{type:"submit",variant:"outline",children:r.trim()?"Save domain":"Clear 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."})]})}function Ot({list:s,loaded:t,hasDomain:n,onChange:r}){const[i,c]=l.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[s.map(o=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:o}),e.jsx(b,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${o}`,disabled:s.length<=1&&!n,onClick:()=>r(s.filter(m=>m!==o)),children:e.jsx(ht,{})})]},o)),t&&s.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:o=>{o.preventDefault();const m=i.trim();m&&(r([...s,m]),c(""))},children:[e.jsx(Y,{id:"site-origin-add",placeholder:"https://staging.example.com",value:i,onChange:o=>c(o.target.value)}),e.jsxs(b,{type:"submit",variant:"outline",disabled:!i.trim(),children:[e.jsx(xt,{}),"Add"]})]})]})}function Tt({uid:s,name:t,archived:n,locked:r}){const i=Ge(s);return e.jsx(q,{title:n?"Restore this site":"Archive this site",description:n?"Its widget takes comments again and it counts toward the plan. Restoring needs room on the plan.":"For a site you have finished with. Every comment is kept and can be read, the widget stops taking new ones, and the site no longer counts toward the plan.",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:n?`${t} is archived.`:r?`${t} is read-only because the studio is over its plan. Archiving another site frees a place.`:"You can restore it at any time."}),e.jsx(b,{type:"button",variant:"outline",loading:i.isPending,onClick:()=>i.mutate(n?"restore":"archive"),children:n?`Restore ${t}`:`Archive ${t}`})]})})}function Vt({uid:s,name:t}){const[n,r]=l.useState(!1),i=Le(),c=qe(s);return e.jsxs(q,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable. Its screenshots are kept for 30 days and then removed."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(b,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>r(!0),children:["Delete ",t,"…"]})]}),e.jsx(Ie,{open:n,onOpenChange:r,title:`Delete ${t}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database. Its screenshots are kept for 30 days and then removed.",confirmLabel:"Delete",confirmWord:t,busy:c.isPending,onConfirm:()=>c.mutate(void 0,{onSuccess:()=>{r(!1),i({to:"/sites"})}})})]})}const ms=()=>ue(me().user.role,"settings")?e.jsx(Et,{}):e.jsx(mt,{title:"Site settings",children:e.jsx("p",{className:"m-0",children:"A site's addresses, who may comment, the widget and its rounds are set by an owner or an admin of the studio."})});export{ms 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 k,s as S,C as $,D as C,F as g}from"./index-X11XkRkb.js";import{u as _,a as D}from"./zod-D1EnJi4o.js";import{C as E}from"./card-CzVTF25b.js";import{i as F,j as L,l as P,k as I,m as T,n as z}from"./dialog-DZbUuBSr.js";import{L as f,I as j}from"./label-8lYoT07T.js";import{P as q,E as R}from"./parts-DVVBI72d.js";import{v as B}from"./useScrollLock-DDlrhOw8.js";import{u as H}from"./me-DnLqgT3l.js";import{P as v}from"./plus-CS6tYH0S.js";import{L as K}from"./layout-grid-C-a8O8B6.js";import{I as Q}from"./image-off-u_JoVfOy.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./inertValue-CLaAaX62.js";import"./useBaseQuery-C_54ul4D.js";function ne(){const s=H(),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(v,{}),"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(E,{className:"max-w-[1100px]",children:e.jsx(R,{icon:e.jsx(K,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(v,{}),"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(b,{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(b,{p:r},r.uid))})]}),e.jsx(G,{open:x,onOpenChange:n})]})}function b({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(Q,{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?` · ${B(s.lastActivityAt)}`:""}`})]})]})}const U=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function G({open:s,onOpenChange:i}){const d=A(),x=k(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=_({resolver:D(U)}),u=h(async r=>{a("");try{const o=await S.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 $?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(L,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(P,{children:[e.jsx(I,{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{ne as component};
@@ -1 +0,0 @@
1
- import{j as t,O as o}from"./index-X11XkRkb.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-X11XkRkb.js";import{u as p}from"./useQuery-CCJBm2EJ.js";import{L as P,I as N}from"./label-8lYoT07T.js";import{I as U,S as L}from"./InstanceRows-DnLIQuI5.js";import{A as T,P as q,a as f}from"./parts-DVVBI72d.js";import{u as S}from"./me-DnLqgT3l.js";import{S as z}from"./SaveState-DmbisglJ.js";import{C as B}from"./ConfirmDialog-Db4AvUN5.js";import{b as _}from"./studio-pFbLfSmh.js";import{c as M}from"./update-duXzIzFS.js";import"./useBaseQuery-C_54ul4D.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./dialog-DZbUuBSr.js";import"./useScrollLock-DDlrhOw8.js";import"./inertValue-CLaAaX62.js";import"./card-CzVTF25b.js";import"./check-BlRwZrSR.js";import"./copy-DSJQda7h.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 me=()=>y(S().user.role,"settings")?e.jsx(Q,{}):e.jsx(T,{title:"Studio settings"});export{me as component};
@@ -1,16 +0,0 @@
1
- import{c as le,d as ce,r,a5 as L,s as C,a6 as M,a8 as A,j as e,B as b,C as Re,h as De,A as Ee,a9 as Ge,q as re,L as ie,t as Te,a2 as $e,$ as Qe}from"./index-X11XkRkb.js";import{P as Q}from"./Picker-95_pkfVu.js";import{u as de}from"./useQuery-CCJBm2EJ.js";import{B as Pe}from"./badge-CicACH6l.js";import{i as he,j as me,l as ue,k as pe,m as xe,n as ge}from"./dialog-DZbUuBSr.js";import{I as E,L as Y}from"./label-8lYoT07T.js";import{C as Ye}from"./ConfirmDialog-Db4AvUN5.js";import{A as Ve,P as Xe,a as Ze}from"./parts-DVVBI72d.js";import{u as Le}from"./me-DnLqgT3l.js";import{v as B}from"./useScrollLock-DDlrhOw8.js";import{M as et}from"./McpTokens-BmJUgHlN.js";import{C as Fe}from"./CopyButton-r38fWUwx.js";import{C as We}from"./check-BlRwZrSR.js";import"./chevron-down-865lxBex.js";import"./isElementDisabled-CwHw_lZC.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./inertValue-CLaAaX62.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-BuDWW6rb.js";import"./getPseudoElementBounds-CFaDUKhY.js";import"./CompositeList-OHWH8W1h.js";import"./useBaseQuery-C_54ul4D.js";import"./useRender-BZe0PUs7.js";import"./copy-DSJQda7h.js";import"./card-CzVTF25b.js";import"./switch-CHmJ_Ipt.js";import"./useAriaLabelledBy-DcwFG0Pf.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 tt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],st=le("circle-alert",tt);/**
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 nt=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],at=le("eye-off",nt);/**
12
- * @license lucide-react v1.39.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ot=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],rt=le("eye",ot),_e="https://snagset.com/docs/integrations/",Oe={github:"Repository",linear:"Team",jira:"Project",trello:"Board"},oe="__new_board__",it=t=>`https://trello.com/1/authorize?expiration=never&scope=read,write&response_type=token&name=Snagset&key=${encodeURIComponent(t.trim())}`;function Ie(t){const i=h=>t.find(d=>h.test(d.label))?.value,l=i(/^(to ?do|backlog|open|new|inbox)/i)??t[0]?.value??"",o=i(/^(done|complete|resolved|shipped|fixed)/i)??t[t.length-1]?.value??"",p=i(/(doing|progress|review|working)/i)??t.find(h=>h.value!==l&&h.value!==o)?.value??"";return{open:l,progress:p,resolved:o}}function fe({id:t,value:i,onChange:l,placeholder:o,disabled:p}){const[h,d]=r.useState(!1);return e.jsxs("div",{className:"relative",children:[e.jsx(E,{id:t,type:h?"text":"password",placeholder:o,value:i,onChange:k=>l(k.target.value),disabled:p,autoComplete:"off",spellCheck:!1,className:"pr-9 font-mono text-[12.5px]"}),e.jsx("button",{type:"button",onClick:()=>d(k=>!k),"aria-label":h?"Hide":"Show","aria-pressed":h,className:"absolute inset-y-0 right-0 flex w-9 items-center justify-center rounded-r-md text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring",children:h?e.jsx(at,{className:"size-4"}):e.jsx(rt,{className:"size-4"})})]})}function lt({at:t}){const i=["Access","Connect","Way back"];return e.jsx("ol",{className:"m-0 flex list-none items-center gap-2 p-0 text-[12px]","aria-label":"Steps",children:i.map((l,o)=>{const p=o+1;return e.jsxs("li",{"aria-current":p===t?"step":void 0,className:"flex items-center gap-2",children:[e.jsx("span",{className:De("flex size-5 items-center justify-center rounded-full border text-[11px] tabular-nums",p<t&&"border-transparent bg-primary text-primary-foreground",p===t&&"border-primary text-foreground",p>t&&"border-border text-muted-foreground"),children:p<t?e.jsx(We,{className:"size-3"}):p}),e.jsx("span",{className:p===t?"font-medium text-foreground":"text-muted-foreground",children:l}),o<i.length-1&&e.jsx("span",{className:"h-px w-5 bg-border","aria-hidden":!0})]},l)})})}function P({id:t,label:i,hint:l,children:o}){return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Y,{htmlFor:t,children:i}),o,l&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:l})]})}function ze({children:t}){return 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:t})}function F({href:t,children:i}){return e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-foreground underline underline-offset-2",children:i})}const H=t=>t instanceof Re?t.message:"Could not reach the server.";function ct({provider:t,jiraSite:i,trelloKey:l=""}){const o=t==="trello"?[e.jsxs(e.Fragment,{children:["Open ",e.jsx(F,{href:"https://trello.com/power-ups/admin",children:"Trello › Power-Ups admin"})," › New. Name it Snagset, any workspace, and tick that it does not use Power-Up capabilities. Skip the OAuth 2.0 page."]}),e.jsx(e.Fragment,{children:"Open its API key tab, generate a key, and paste the key below."}),e.jsxs(e.Fragment,{children:["On that same page, click the Token link beside the key",l.trim()?e.jsxs(e.Fragment,{children:[" ","(or ",e.jsx(F,{href:it(l),children:"this one"}),")"]}):null,": Allow, then copy the whole token (it starts ATTA) and paste it below."]})]:t==="github"?[e.jsxs(e.Fragment,{children:["Open ",e.jsx(F,{href:"https://github.com/settings/personal-access-tokens/new",children:"GitHub › Fine-grained tokens › Generate new token"}),"."]}),e.jsx(e.Fragment,{children:"Repository access: only the site's repository. Permissions › Issues: Read and write."}),e.jsx(e.Fragment,{children:"Generate, copy the token, paste it below."})]:t==="linear"?[e.jsxs(e.Fragment,{children:["Open ",e.jsx(F,{href:"https://linear.app/settings/account/security",children:"Linear › Settings › Security & access"}),"."]}),e.jsx(e.Fragment,{children:"Under Personal API keys, make a new key. It acts as you, so you must be in the team."}),e.jsx(e.Fragment,{children:"Copy the key, paste it below."})]:[e.jsxs(e.Fragment,{children:["Open ",e.jsx(F,{href:"https://id.atlassian.com/manage-profile/security/api-tokens",children:"Atlassian account › Security › API tokens"}),"."]}),e.jsx(e.Fragment,{children:'Create API token — the plain one, not "with scopes". Name it Snagset.'}),e.jsxs(e.Fragment,{children:["Copy it, paste it below with the email you sign in to ",i?i.replace(/^https?:\/\//,""):"Jira"," with."]})];return e.jsx("ol",{className:"m-0 flex list-decimal flex-col gap-1 pl-5 text-[13px] text-muted-foreground",children:o.map((p,h)=>e.jsx("li",{children:p},h))})}function Be({provider:t,site:i,shownSecret:l,target:o,onSecret:p}){const h=ce(),d=`${location.origin}/api/v1/integrations/${t}/inbound`,[k]=r.useState(()=>Date.now()),[f,N]=r.useState(""),[g,S]=r.useState(""),[T,O]=r.useState(!1),[w,$]=r.useState(null),x=de({...Ee.integrations(),refetchInterval:3e3}).data?.data.find(y=>y.site===i&&y.provider===t),u=L({mutationFn:y=>C.setWebhookSecret(i,t,y),onSuccess:y=>{S(""),N(""),O(!0),$(y.check??null),p(y.webhook.secret??null),h.invalidateQueries({queryKey:["integrations"]}),M.success(t==="linear"?"Signing secret saved":t==="trello"?"Secret saved":"New secret made — the old one has stopped working")},onError:y=>S(H(y))}),a=x?.lastDeliveryAt?Date.parse(x.lastDeliveryAt):0,c=x?.lastRefusedAt?Date.parse(x.lastRefusedAt):0,m=(t==="linear"||t==="trello")&&x&&!x.hasWebhookSecret?"nosecret":a?"ok":c?"refused":"waiting",n=m==="ok"&&c>a,R=t==="linear"||t==="trello",W=t==="trello"&&!!w?.sent&&m==="waiting",[K,U]=r.useState(!1),_=R&&(m!=="ok"||K),v=t==="github"?"GitHub sends a test delivery the moment the webhook is saved.":t==="trello"?w?.sent?`Snagset made a check card on ${o.label} and deleted it again; Trello's delivery for it confirms the secret in a moment.`:w?`Snagset could not make its check card (${w.detail}). Move any card on ${o.label} to another list once instead.`:`Saving the secret makes a check card on ${o.label} and deletes it again; Trello's delivery for it confirms the secret.`:t==="linear"?`Then move any issue in ${o.label} to another status once.`:`Then move any issue in ${o.label} once.`;return e.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[g&&e.jsx(ze,{children:g}),e.jsx("ol",{className:"m-0 flex list-decimal flex-col gap-1 pl-5 text-[13px] text-muted-foreground",children:t==="github"?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Open"," ",e.jsx(F,{href:o.repo?`https://github.com/${o.repo}/settings/hooks/new`:"https://github.com",children:"the repository's Settings › Webhooks › Add webhook"}),"."]}),e.jsx("li",{children:"Paste the address and the secret below; content type application/json."}),e.jsx("li",{children:'"Let me select individual events" → tick Issues only. Add webhook.'})]}):t==="trello"?e.jsxs(e.Fragment,{children:[e.jsx("li",{children:x&&!x.webhookRegistered?`Snagset could not register the webhook on ${o.label}${o.trelloNote?`: ${o.trelloNote}`:""}. Trello must be able to reach this server's address; connect again once it can.`:`Snagset registered the webhook on ${o.label} for you: nothing to set up in Trello.`}),_&&e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Trello signs each delivery with your Power-Up's secret. Open ",e.jsx(F,{href:"https://trello.com/power-ups/admin",children:"Trello › Power-Ups admin"}),", your Power-Up's API key tab, and copy the Secret."]}),e.jsx("li",{children:"Paste it below."})]})]}):t==="linear"?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Open ",e.jsx(F,{href:"https://linear.app/settings/api",children:"Linear › Settings › API"}),", then Webhooks › New webhook."]}),e.jsxs("li",{children:["Paste the address; pick the team ",o.label,"; under data change events tick Issues. Create."]}),_&&e.jsx("li",{children:"Linear shows a signing secret: copy it and paste it below."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Open"," ",e.jsx(F,{href:o.jiraSite?`${o.jiraSite}/plugins/servlet/webhooks`:"https://admin.atlassian.com",children:"Jira › Settings › System › WebHooks"})," ","› Create a WebHook. It needs a Jira admin."]}),e.jsx("li",{children:"Paste the address and the secret below."}),e.jsx("li",{children:"Under Issue, tick updated and deleted. Create."})]})}),e.jsxs("dl",{className:"m-0 grid grid-cols-[88px_minmax(0,1fr)] items-center gap-x-3 gap-y-2.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsxs("dd",{className:"m-0 flex min-w-0 items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-url",children:d}),e.jsx(Fe,{text:d,label:"Copy the address"})]}),t!=="linear"&&t!=="trello"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsx("dd",{className:"m-0 flex min-w-0 items-center gap-2",children:l?e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:l}),e.jsx(Fe,{text:l,label:"Copy the secret"})]}):e.jsxs("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-muted-foreground",children:["Shown once, when it was made.",e.jsx(b,{type:"button",size:"sm",variant:"outline",loading:u.isPending,onClick:()=>u.mutate(void 0),children:"Make a new secret"})]})})]}),t==="github"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0 font-mono text-[12px]",children:"application/json"})]})]}),l&&e.jsx("p",{className:"m-0 -mt-2 text-[12px] text-muted-foreground",children:"Copy it now: it is not shown again. A new one can be made here any time."}),_&&e.jsx(P,{id:"wb-secret",label:t==="linear"?"Signing secret":"Power-Up secret",hint:W?"Checking it with Trello…":m==="refused"?`That secret did not match. Copy the Secret from the ${t==="linear"?"webhook in Linear":"Power-Up's API key tab"} again and paste it here.`:T||x?.hasWebhookSecret?"Saved. Paste a new one to replace it.":t==="linear"?"From the webhook Linear just made.":"Next to the API key in Trello.",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(fe,{id:"wb-secret",value:f,onChange:N,placeholder:t==="linear"?"lin_wh_…":"",disabled:W})}),e.jsx(b,{type:"button",variant:"outline",disabled:!f.trim()||W,loading:u.isPending||W,onClick:()=>{U(!1),u.mutate(f.trim())},children:"Save"})]})}),e.jsxs("div",{role:"status","aria-live":"polite","data-testid":"webhook-check","data-state":m,className:De("flex items-start gap-2.5 rounded-md border px-3 py-2.5 text-[13px]",m==="ok"&&"border-emerald-500/40 bg-emerald-500/10",m==="refused"&&"border-destructive/40 bg-warn-soft",(m==="waiting"||m==="nosecret")&&"border-border bg-muted/40"),children:[m==="ok"?e.jsx(We,{className:"mt-0.5 size-4 shrink-0 text-emerald-600"}):m==="refused"?e.jsx(st,{className:"mt-0.5 size-4 shrink-0 text-destructive"}):e.jsx(Ge,{className:"mt-0.5 size-4 shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none"}),e.jsx("span",{className:"min-w-0",children:m==="ok"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"The webhook works."})," Last delivery ",a>=k?"just now":B(x.lastDeliveryAt),".",R&&!K&&e.jsx("button",{type:"button",className:"ml-1 underline underline-offset-2 text-muted-foreground hover:text-foreground",onClick:()=>U(!0),children:"Replace the secret…"}),n&&e.jsxs("span",{className:"mt-1 block text-muted-foreground",children:["A later delivery was refused (",B(x.lastRefusedAt),"): ",x.lastRefusedError," If you did not change the secret, it may not have come from ",A[t],"."]})]}):m==="refused"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"A delivery arrived and was refused"})," (",B(x.lastRefusedAt),"). ",x.lastRefusedError,e.jsxs("span",{className:"mt-1 block text-muted-foreground",children:["A refused delivery is unsigned, so it may not be from ",A[t],". Check the delivery log on ",A[t],"'s webhook before changing anything."]})]}):m==="nosecret"?e.jsxs(e.Fragment,{children:["Waiting for the ",t==="linear"?"signing secret":"Power-Up's secret",". Without it, ",A[t],"'s deliveries are refused."]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:t==="trello"&&w?.sent?"Checking the secret…":"Waiting for the first delivery."})," ",v]})})]})]})}function dt({provider:t,open:i,onOpenChange:l,sites:o}){const p=ce(),h=A[t],[d,k]=r.useState(1),[f,N]=r.useState(""),[g,S]=r.useState(""),[T,O]=r.useState(""),[w,$]=r.useState(""),[j,x]=r.useState(""),[u,a]=r.useState([]),[c,m]=r.useState({open:"",progress:"",resolved:""}),[n,R]=r.useState(""),[W,K]=r.useState(""),[U,_]=r.useState([]),[v,y]=r.useState(""),[be,ke]=r.useState(""),[je,ye]=r.useState(!1),[Ue,V]=r.useState(null),[Me,we]=r.useState(""),[ve,D]=r.useState("");r.useEffect(()=>{i||(k(1),N(""),S(""),O(""),$(""),x(""),a([]),m({open:"",progress:"",resolved:""}),R(""),K(""),_([]),y(""),ke(""),ye(!1),V(null),we(""),D(""))},[i]);const z=f||o[0]?.uid||"",J=T.trim().replace(/\/+$/,"").replace(/^(?!https?:\/\/)/,"https://"),Ke=t==="github"?{token:g.trim()}:t==="linear"?{apiKey:g.trim()}:t==="trello"?{apiKey:j.trim(),token:g.trim()}:{siteUrl:J,email:w.trim(),apiToken:g.trim()},q=r.useRef(""),X=L({mutationFn:s=>C.discoverTracker("trello",{apiKey:j.trim(),token:g.trim(),boardId:s}),onSuccess:(s,I)=>{I===q.current&&(D(""),a(s.options),m(Ie(s.options)))},onError:(s,I)=>{I===q.current&&D(H(s))}}),[G,Z]=r.useState(!1),[ee,He]=r.useState("Snagset feedback"),Ne=L({mutationFn:s=>C.discoverTracker("trello",{apiKey:j.trim(),token:g.trim(),newBoard:s}),onSuccess:s=>{s.board&&(D(""),Z(!1),_(I=>[...I,s.board]),q.current=s.board.value,y(s.board.value),a(s.options),m(Ie(s.options)))},onError:s=>D(H(s))}),Se=s=>{if(s===oe){Z(!0);return}Z(!1),q.current=s,y(s),a([]),m({open:"",progress:"",resolved:""}),s&&X.mutate(s)},te=L({mutationFn:()=>C.discoverTracker(t,Ke),onSuccess:s=>{D(""),K(s.who),_(s.options);const I=s.options.find(ae=>ae.canWrite!==!1)?.value??s.options[0]?.value??"";t==="trello"?Se(I):y(I),k(2)},onError:s=>D(H(s))}),se=L({mutationFn:()=>{const s=je?"thread.created":"manual";return t==="github"?C.connectTracker(z,"github",{repository:v.trim(),token:g.trim(),labels:be.trim(),createOn:s}):t==="linear"?C.connectTracker(z,"linear",{team:v.trim(),apiKey:g.trim(),createOn:s}):t==="trello"?C.connectTracker(z,"trello",{apiKey:j.trim(),token:g.trim(),boardId:v,openList:c.open,progressList:c.progress,resolvedList:c.resolved,createOn:s}):C.connectTracker(z,"jira",{siteUrl:J,project:v.trim(),email:w.trim(),apiToken:g.trim(),createOn:s})},onSuccess:s=>{D(""),S(""),V(s.webhook?.secret??null),R(s.webhook?.error??""),we(z),p.invalidateQueries({queryKey:["integrations"]}),M.success(`${h} connected`),k(3)},onError:s=>D(H(s))}),Ce=!!z&&!!g.trim()&&(t!=="jira"||!!T.trim()&&!!w.trim())&&(t!=="trello"||!!j.trim()),ne=t!=="trello"||!G&&!!c.open&&!!c.progress&&!!c.resolved&&new Set([c.open,c.progress,c.resolved]).size===3,Ae=U.find(s=>s.value===v),Je=Ae?.label??v;return e.jsx(he,{open:i,onOpenChange:l,children:e.jsx(me,{className:"sm:max-w-[560px]",children:e.jsxs("form",{className:"flex min-w-0 flex-col gap-4",noValidate:!0,onSubmit:s=>{s.preventDefault(),d===1&&Ce?te.mutate():d===2&&v.trim()&&ne?se.mutate():d===3&&l(!1)},children:[e.jsxs(ue,{children:[e.jsxs(pe,{children:["Connect a site to ",h]}),e.jsxs(xe,{children:[d===1?`Give Snagset access to ${h}. The key is checked now and stored encrypted with this instance's secret key.`:d===2?`Signed in to ${h}${W?` as ${W}`:""}. Choose where this site's comments go.`:`Connected. Now the way back: a webhook, so that moving ${t==="trello"?"a card":"an issue"} in ${h} moves the comment here.`," ",e.jsx(F,{href:`${_e}#${t}`,children:"Step-by-step guide"})]})]}),e.jsx(lt,{at:d}),ve&&d!==3&&e.jsx(ze,{children:ve}),d===1&&e.jsxs(e.Fragment,{children:[e.jsx(P,{id:"ct-site",label:"Site",children:e.jsx(Q,{id:"ct-site",value:z,onChange:N,options:o.map(s=>({value:s.uid,label:s.name}))})}),e.jsx(ct,{provider:t,jiraSite:J,trelloKey:j}),t==="trello"&&e.jsx(P,{id:"ct-trello-key",label:"API key",children:e.jsx(E,{id:"ct-trello-key",value:j,onChange:s=>x(s.target.value),autoComplete:"off",spellCheck:!1})}),t==="jira"&&e.jsxs(e.Fragment,{children:[e.jsx(P,{id:"ct-jira-site",label:"Jira site",hint:"The address you open Jira at.",children:e.jsx(E,{id:"ct-jira-site",placeholder:"https://kilnwork.atlassian.net",value:T,onChange:s=>O(s.target.value),autoComplete:"off"})}),e.jsx(P,{id:"ct-email",label:"Account email",children:e.jsx(E,{id:"ct-email",type:"email",placeholder:"you@kilnwork.studio",value:w,onChange:s=>$(s.target.value),autoComplete:"off"})})]}),e.jsx(P,{id:"ct-token",label:t==="github"||t==="trello"?"Token":t==="linear"?"API key":"API token",children:e.jsx(fe,{id:"ct-token",value:g,onChange:S,placeholder:t==="github"?"github_pat_…":t==="linear"?"lin_api_…":""})})]}),d===2&&e.jsxs(e.Fragment,{children:[U.length>0||t==="trello"?e.jsx(P,{id:"ct-target",label:Oe[t],hint:Ae?.canWrite===!1?"This token can only read that repository: give it Issues › Read and write, or pick another.":t==="jira"?"Jira calls these spaces; the key in brackets is the prefix on its issues.":void 0,children:e.jsx(Q,{id:"ct-target",value:G?oe:v,onChange:t==="trello"?Se:y,options:[...U.map(s=>({value:s.value,label:s.label})),...t==="trello"?[{value:oe,label:"New board…"}]:[]]})}):e.jsx(P,{id:"ct-target",label:Oe[t],hint:`${h} listed nothing this key can see. Type it instead: ${t==="github"?"owner/name":"the prefix on its issues, like ENG"}.`,children:e.jsx(E,{id:"ct-target",value:v,onChange:s=>y(s.target.value),autoComplete:"off"})}),t==="trello"&&G&&e.jsx(P,{id:"ct-new-board",label:"Board name",hint:"Snagset makes it, private to you, with three lists: To do, Doing and Done.",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(E,{id:"ct-new-board",value:ee,onChange:s=>He(s.target.value),autoComplete:"off",className:"min-w-0 flex-1"}),e.jsx(b,{type:"button",variant:"outline",disabled:!ee.trim(),loading:Ne.isPending,onClick:()=>Ne.mutate(ee.trim()),children:"Make board"})]})}),t==="trello"&&!G&&(X.isPending?e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading the board's lists…"}):u.length>0?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"A card's list is its status. Moving a card between these three moves the comment here, and back."}),[["open","Open"],["progress","In progress"],["resolved","Resolved"]].map(([s,I])=>e.jsx(P,{id:`ct-list-${s}`,label:I,children:e.jsx(Q,{id:`ct-list-${s}`,value:c[s],onChange:ae=>m(qe=>({...qe,[s]:ae})),options:u})},s)),!ne&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:"Pick three different lists."})]}):v?e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"This board has no open lists. Add three in Trello (for example To do, Doing, Done), then pick it again."}):null),t==="github"&&e.jsx(P,{id:"ct-labels",label:"Labels",hint:"Optional, comma-separated. Put on every issue Snagset opens.",children:e.jsx(E,{id:"ct-labels",placeholder:"review",value:be,onChange:s=>ke(s.target.value),autoComplete:"off"})}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:je,onChange:s=>ye(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:t==="trello"?"A card for every new comment":"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:t==="trello"?"Off: you make a card from a comment's brief when you mean it. On: every new comment makes one.":"Off: you make an issue from a comment's brief when you mean it. On: every new comment opens one."})]})]})]}),d===3&&e.jsx(Be,{provider:t,site:Me,shownSecret:Ue,onSecret:V,target:{label:Je,...t==="jira"?{jiraSite:J}:{},...t==="github"?{repo:v}:{},...t==="trello"&&n?{trelloNote:n}:{}}}),e.jsxs(ge,{children:[d===1&&e.jsxs(e.Fragment,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(b,{type:"submit",loading:te.isPending,disabled:!Ce,children:te.isPending?"Checking…":"Check access"})]}),d===2&&e.jsxs(e.Fragment,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>k(1),children:"Back"}),e.jsx(b,{type:"submit",loading:se.isPending,disabled:!v.trim()||!ne||X.isPending,children:se.isPending?"Connecting…":"Connect"})]}),d===3&&e.jsx(b,{type:"submit",children:"Done"})]})]})})})}function ht({state:t,onClose:i}){const[l,o]=r.useState(null);return r.useEffect(()=>{t||o(null)},[t]),e.jsx(he,{open:t!==null,onOpenChange:p=>!p&&i(),children:e.jsx(me,{className:"sm:max-w-[560px]",children:t&&e.jsxs(e.Fragment,{children:[e.jsxs(ue,{children:[e.jsxs(pe,{children:[A[t.provider]," webhook for ",t.siteName]}),e.jsxs(xe,{children:["The way back: moving ",t.provider==="trello"?"a card":"an issue"," in ",A[t.provider]," moves the comment here. ",e.jsx(F,{href:`${_e}#${t.provider}`,children:"Step-by-step guide"})]})]}),e.jsx(Be,{provider:t.provider,site:t.site,shownSecret:l,onSecret:o,target:t.target}),e.jsx(ge,{children:e.jsx(b,{type:"button",onClick:i,children:"Done"})})]})})})}const mt={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function ut(){const t=Le(),i=re(t.user.role,"settings"),l=re(t.user.role,"studio")&&Te(t),o=de(Ee.integrations()),p=ce(),h=()=>p.invalidateQueries({queryKey:["integrations"]}),[d,k]=r.useState(null),[f,N]=r.useState(null),[g,S]=r.useState(null),T=L({mutationFn:({uid:a,provider:c})=>C.testTracker(a,c).then(m=>({...m,provider:c})),onSuccess:a=>{M[a.ok?"success":"error"](a.ok?`${A[a.provider]} can see ${a.target}`:a.detail??`${A[a.provider]} refused the token`),h()},onError:a=>M.error($e(a))}),O=L({mutationFn:({uid:a,provider:c})=>C.disconnectTracker(a,c),onSuccess:()=>{N(null),h()},onError:a=>M.error($e(a))}),w=o.data?.data??[],$=a=>w.filter(c=>c.provider===a),j=t.projects.filter(a=>!a.archived&&!a.locked),x=a=>j.filter(c=>!$(a).some(m=>m.site===c.uid)),u=i?t.limits.integrations?j.length===0?"site":null:"plan":null;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Xe,{title:"Integrations",sub:"Your coding agent first, then the trackers that mirror a comment's status, then Slack, which only announces"}),e.jsx(et,{owner:i,instanceOwner:l,operator:Te(t),sites:t.projects}),u&&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:u==="plan"?t.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.":t.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."}),u==="plan"?t.user.role==="owner"&&e.jsx(b,{variant:"outline",size:"sm",render:e.jsx(ie,{to:"/studio/plan"}),children:"See plans"}):e.jsx(b,{variant:"outline",size:"sm",render:e.jsx(ie,{to:"/sites"}),children:"Go to Sites"})]}),["github","linear","jira","trello","slack"].map(a=>{const c=$(a),m=x(a);return e.jsxs(Ze,{title:A[a],description:a==="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.":a==="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.":a==="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.":a==="trello"?"A comment becomes a card on the site's board, with the brief as its description. A card's list is its status: our status moves it between the three lists you pick, and moving it there moves the comment here. An API key and token from your own Power-Up; Snagset sets up the webhook.":"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:[o.isPending&&e.jsx(Qe,{rows:2}),o.isSuccess&&c.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pe,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:a==="github"?"No site is connected to a repository yet.":a==="linear"?"No site is connected to a team yet.":a==="jira"?"No site is connected to a project yet.":a==="trello"?"No site is connected to a board yet.":"No site is connected to a channel yet."})]}),c.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:c.map(n=>{const R=mt[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.provider==="trello"?`${n.boardName} · ${n.listNames.open} / ${n.listNames.progress} / ${n.listNames.resolved}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(Pe,{variant:"outline",className:R.tone==="ok"?"border-ok text-ok":R.tone==="bad"?"border-destructive text-destructive":"",children:R.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.provider==="trello"?n.createOn==="thread.created"?"A card for every new comment":"Cards 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(", ")}`:""," · ",B(n.updatedAt)]}),n.provider!=="slack"&&e.jsx(xt,{r:n}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),i&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider!=="slack"&&e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>S({provider:n.provider,site:n.site,siteName:n.siteName??n.site,target:n.provider==="github"?{label:`${n.owner}/${n.repo}`,repo:`${n.owner}/${n.repo}`}:n.provider==="linear"?{label:n.teamName}:n.provider==="trello"?{label:n.boardName}:{label:n.projectName,jiraSite:n.siteUrl}}),children:"Webhook…"}),e.jsx(b,{variant:"ghost",size:"sm",loading:T.isPending,onClick:()=>T.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>N(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),i&&!u&&m.length>0&&e.jsx("div",{children:e.jsx(b,{variant:"outline",size:"sm",onClick:()=>k(a),children:"Connect a site…"})})]},a)}),["github","linear","jira","trello"].map(a=>e.jsx(dt,{provider:a,open:d===a,onOpenChange:c=>!c&&k(null),sites:x(a)},a)),e.jsx(pt,{open:d==="slack",onOpenChange:a=>!a&&k(null),sites:x("slack"),onDone:()=>void h()}),e.jsx(ht,{state:g,onClose:()=>S(null)}),e.jsx(Ye,{open:f!==null,onOpenChange:a=>!a&&N(null),title:`Disconnect ${f?.siteName??"this site"} from ${f?A[f.provider]:"the tracker"}?`,description:f?.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:O.isPending,onConfirm:async()=>{f&&await O.mutateAsync({uid:f.site,provider:f.provider})}})]})}function pt({open:t,onOpenChange:i,sites:l,onDone:o}){const[p,h]=r.useState(""),[d,k]=r.useState(""),[f,N]=r.useState(""),[g,S]=r.useState(!0),[T,O]=r.useState(""),w=de({queryKey:["integrations","slack","manifest"],queryFn:()=>C.slackManifest(),enabled:t,staleTime:1/0}),$=L({mutationFn:u=>C.connectTracker(u,"slack",{channel:d.trim(),token:f.trim(),createOn:g?"thread.created":"manual"})}),j=p||l[0]?.uid||"",x=async u=>{u.preventDefault(),O("");try{await $.mutateAsync(j),k(""),N(""),S(!0),i(!1),o(j),M.success("Slack connected")}catch(a){O(a instanceof Re?a.message:"Could not reach the server.")}};return e.jsx(he,{open:t,onOpenChange:i,children:e.jsx(me,{children:e.jsxs("form",{onSubmit:u=>void x(u),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(ue,{children:[e.jsx(pe,{children:"Connect a site to Slack"}),e.jsx(xe,{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."})]}),T&&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:T}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Y,{htmlFor:"sl-site",children:"Site"}),e.jsx(Q,{id:"sl-site",value:j,onChange:h,options:l.map(u=>({value:u.uid,label:u.name}))})]}),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(b,{type:"button",variant:"outline",size:"sm",disabled:!w.data,render:e.jsx("a",{href:w.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Y,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(fe,{id:"sl-token",placeholder:"xoxb-…",value:f,onChange:N}),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(Y,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(E,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:u=>k(u.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:g,onChange:u=>S(u.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(ge,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(b,{type:"submit",loading:$.isPending,disabled:!d.trim()||!f.trim()||!j,children:$.isPending?"Checking…":"Connect"})]})]})})})}function xt({r:t}){const i=A[t.provider];if(t.lastDeliveryAt){const l=t.lastRefusedAt&&Date.parse(t.lastRefusedAt)>Date.parse(t.lastDeliveryAt);return e.jsxs("span",{className:"basis-full text-[12px] text-muted-foreground",children:["Webhook works · last delivery ",B(t.lastDeliveryAt),l?` · a later one was refused ${B(t.lastRefusedAt)}`:""]})}return t.lastRefusedAt?e.jsxs("span",{className:"basis-full text-[12px] text-destructive",children:["Webhook refused ",B(t.lastRefusedAt),": ",t.lastRefusedError," Unsigned, so check ",i,"'s webhook log first."]}):t.provider==="trello"&&!t.webhookRegistered?e.jsxs("span",{className:"basis-full text-[12px] text-destructive",children:["Snagset could not register the webhook on ",t.boardName,": Trello must reach this server's address. Connect again once it can."]}):(t.provider==="linear"||t.provider==="trello")&&!t.hasWebhookSecret?e.jsxs("span",{className:"basis-full text-[12px] text-muted-foreground",children:["No webhook yet, so ",i," cannot move comments here. Webhook… sets it up."]}):e.jsx("span",{className:"basis-full text-[12px] text-muted-foreground",children:"No webhook delivery seen yet. Webhook… shows how to set it up."})}const Mt=()=>re(Le().user.role,"settings")?e.jsx(ut,{}):e.jsx(Ve,{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(ie,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{Mt as component};
@@ -1,6 +0,0 @@
1
- import{c as W,q as M,j as e,ab as X,r as f,B as h,ac as g,ad as P,a2 as C,I as J,D as K,ae as Z,af as ee,ag as se,F as te,A as S}from"./index-X11XkRkb.js";import{u as k}from"./useQuery-CCJBm2EJ.js";import{u as ae,a as ie,C as ne}from"./zod-D1EnJi4o.js";import{S as le,a as re,b as oe,c as me,d as de,P as ce}from"./Picker-95_pkfVu.js";import{A as xe,a as he}from"./avatar-C6Rr20S0.js";import{B as ue}from"./badge-CicACH6l.js";import{C as E}from"./card-CzVTF25b.js";import{X as pe,i as je,j as fe,l as R,k as A,m as I,n as D}from"./dialog-DZbUuBSr.js";import{L,I as ge}from"./label-8lYoT07T.js";import{T,a as $,b as v,c,d as B,e as x}from"./table-DoCG5L_o.js";import{C as ve}from"./ConfirmDialog-Db4AvUN5.js";import{C as be}from"./CopyButton-r38fWUwx.js";import{A as ye,P as we,b as Ne}from"./parts-DVVBI72d.js";import{u as O}from"./me-DnLqgT3l.js";import{s as Ce}from"./useScrollLock-DDlrhOw8.js";import{c as Se,d as ke,e as Re,f as Ae,g as Ie}from"./studio-pFbLfSmh.js";import{P as De}from"./plus-CS6tYH0S.js";import"./useBaseQuery-C_54ul4D.js";import"./chevron-down-865lxBex.js";import"./check-BlRwZrSR.js";import"./isElementDisabled-CwHw_lZC.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./inertValue-CLaAaX62.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-BuDWW6rb.js";import"./getPseudoElementBounds-CFaDUKhY.js";import"./CompositeList-OHWH8W1h.js";import"./useRender-BZe0PUs7.js";import"./copy-DSJQda7h.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 Le=[["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"}]],Me=W("mail",Le);function Pe(){const s=O(),l=M(s.user.role,"people"),n=X(s.user.role),d=k(S.members()),t=k(S.invites()),[m,a]=f.useState(!1),r=s.limits.members.limit,i=r!==null&&s.limits.members.used>=r;return e.jsxs("div",{className:"p-7",children:[e.jsx(we,{title:"Members",sub:`${l?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${r!==null?` ${s.limits.members.used} of ${r} members.`:""}`,actions:n.length?e.jsxs(h,{onClick:()=>a(!0),disabled:i,title:i?`This studio's plan allows ${r} members.`:void 0,children:[e.jsx(De,{}),"Invite"]}):void 0}),e.jsx(E,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(T,{children:[e.jsx($,{children:e.jsxs(v,{children:[e.jsx(c,{children:"Name"}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Role"}),l&&e.jsx(c,{className:"w-0"})]})}),e.jsx(B,{children:(d.data?.data??[]).map(p=>e.jsx($e,{m:p,owner:l},p.email))})]})}),e.jsx(Ee,{}),(t.data?.data.length??0)>0&&e.jsx(Te,{invites:t.data.data,roles:n}),e.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 ",e.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),n.length>0&&e.jsx(Oe,{open:m,onOpenChange:a,mail:t.data?.mail??!1,roles:n})]})}const z=s=>new Date(s).toLocaleDateString(void 0,{day:"numeric",month:"short"}),b={owner:"Owner",admin:"Admin",member:"Member"};function Ee(){return e.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:g.map(s=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"font-medium",children:b[s]}),e.jsx("dd",{className:"m-0 text-muted-foreground",children:P[s]})]},s))})}function Te({invites:s,roles:l}){const n=Re(),d=l.length>0;return e.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[e.jsx("div",{id:"pending-invites",className:"mb-2",children:e.jsx(Ne,{children:"Pending invites"})}),e.jsx(E,{className:"overflow-hidden py-0",children:e.jsxs(T,{children:[e.jsx($,{children:e.jsxs(v,{children:[e.jsx(c,{children:"For"}),e.jsx(c,{children:"Role"}),e.jsx(c,{children:"Invited by"}),e.jsx(c,{children:"Expires"}),d&&e.jsx(c,{className:"w-0"})]})}),e.jsx(B,{children:s.map(t=>e.jsxs(v,{children:[e.jsx(x,{className:t.email?"":"text-muted-foreground",children:t.email??"Anyone with the link"}),e.jsx(x,{className:"capitalize",children:t.role}),e.jsx(x,{className:"text-muted-foreground",children:t.createdBy?t.createdBy.name||t.createdBy.email:"—"}),e.jsx(x,{className:"text-muted-foreground",children:z(t.expiresAt)}),d&&e.jsx(x,{className:"text-right",children:l.includes(t.role)&&e.jsx(h,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${t.email??"anyone with the link"}`,disabled:n.isPending&&n.variables===t.id,onClick:()=>n.mutate(t.id),children:"Revoke"})})]},t.id))})]})})]})}function $e({m:s,owner:l}){const n=Se(),d=ke(),[t,m]=f.useState(!1);return e.jsxs(v,{children:[e.jsx(x,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(xe,{className:"size-6",children:e.jsx(he,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Ce(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(ue,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(x,{className:"text-muted-foreground",children:s.email}),e.jsx(x,{children:l?e.jsxs(le,{items:g.map(a=>({value:a,label:b[a]})),value:s.role,onValueChange:a=>a&&a!==s.role&&n.mutate({email:s.email,role:a}),children:[e.jsx(re,{size:"sm","aria-label":`Role for ${s.email}`,className:"min-w-[104px] bg-card",children:e.jsx(oe,{})}),e.jsx(me,{children:g.map(a=>e.jsx(de,{value:a,children:b[a]},a))})]}):e.jsx("span",{className:"capitalize",children:s.role})}),l&&e.jsxs(x,{className:"text-right",children:[!s.you&&e.jsx(h,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>m(!0),children:e.jsx(pe,{})}),e.jsx(ve,{open:t,onOpenChange:m,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:d.isPending,onConfirm:()=>{m(!1),d.mutate(s.email)}})]})]})}const Be=K({email:ee([se(""),te().trim().email("An email address, or leave it empty")]),role:Z(g)});function Oe({open:s,onOpenChange:l,mail:n,roles:d}){const t=Ae(),m=Ie(),[a,r]=f.useState(""),[i,p]=f.useState(null),[w,N]=f.useState(null),{register:F,handleSubmit:_,formState:j,reset:q,watch:H,control:V}=ae({resolver:ie(Be),defaultValues:{role:"member",email:""}}),G=H("role"),y=o=>{l(o),o||(p(null),N(null),r(""),m.reset(),q())},Y=_(async o=>{r("");try{p(await t.mutateAsync({role:o.role,...o.email?{email:o.email}:{}}))}catch(u){r(C(u))}}),Q=async()=>{if(i){r("");try{N((await m.mutateAsync({id:i.invite.id,token:i.token})).to)}catch(o){r(C(o))}}},U=(i?.mail??n)&&!!i?.invite.email;return e.jsx(je,{open:s,onOpenChange:y,children:e.jsx(fe,{children:i?e.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[e.jsxs(R,{children:[e.jsx(A,{children:"Invite link"}),e.jsxs(I,{children:[i.invite.email?`${i.invite.email} can`:"Anyone with this link can"," join as ",J(i.invite.role)," ","until ",z(i.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),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 items-center gap-2",children:[e.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:i.url}),e.jsx(be,{text:i.url,label:"Copy link",withText:!0})]}),U&&(w?e.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",w,"."]}):e.jsxs(h,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:i.invite.email?`Send by email to ${i.invite.email}`:void 0,loading:m.isPending,onClick:()=>void Q(),children:[e.jsx(Me,{}),e.jsx("span",{className:"min-w-0 truncate",children:m.isPending?"Sending…":`Send by email to ${i.invite.email}`})]})),e.jsx(D,{children:e.jsx(h,{type:"button",onClick:()=>y(!1),children:"Done"})})]}):e.jsxs("form",{onSubmit:Y,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(A,{children:"Invite someone"}),e.jsx(I,{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."})]}),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("fieldset",{disabled:j.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(L,{htmlFor:"invite-role",children:"Role"}),e.jsx(ne,{control:V,name:"role",render:({field:o})=>e.jsx(ce,{id:"invite-role",value:o.value,onChange:o.onChange,options:["member","admin","owner"].filter(u=>d.includes(u)).map(u=>({value:u,label:b[u]}))})}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:P[G]??""})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(L,{htmlFor:"invite-email",children:["Email ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(ge,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!j.errors.email,...F("email")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:j.errors.email?.message??(n?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),e.jsxs(D,{children:[e.jsx(h,{type:"button",variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(h,{type:"submit",loading:j.isSubmitting,children:j.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const us=()=>M(O().user.role,"settings")?e.jsx(Pe,{}):e.jsx(ye,{title:"Members"});export{us as component};
@@ -1 +0,0 @@
1
- import{j as e,ah as Y,r as d,p as M,d as A,A as $,S as B,h as m,B as P}from"./index-X11XkRkb.js";import{u as _}from"./useQuery-CCJBm2EJ.js";import{b as j}from"./InstanceRows-DnLIQuI5.js";import{A as D,P as K}from"./parts-DVVBI72d.js";import{u as y}from"./me-DnLqgT3l.js";import{C as U}from"./check-BlRwZrSR.js";import"./useBaseQuery-C_54ul4D.js";import"./dialog-DZbUuBSr.js";import"./useScrollLock-DDlrhOw8.js";import"./inertValue-CLaAaX62.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./label-8lYoT07T.js";import"./ConfirmDialog-Db4AvUN5.js";import"./copy-DSJQda7h.js";import"./card-CzVTF25b.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),S=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??S?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:n.current?.price??S?.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,k=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?k.map(l=>e.jsx(O,{base:i,form:l,warning:t.warning??null},l.label)):k.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}`,ne=()=>y().user.role==="owner"?e.jsx(L,{}):e.jsx(D,{title:"Plan & billing"});export{ne as component};
@@ -1 +0,0 @@
1
- import{u as r,Q as u}from"./useBaseQuery-C_54ul4D.js";function a(e,s){return r(e,u)}export{a as u};
@@ -1 +0,0 @@
1
- import{k as n}from"./index-X11XkRkb.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
@@ -1 +0,0 @@
1
- import{j as Dt,b as Tn,T as bt,t as Rn,d as vn,r as he,a as xn,u as Cn,p as In}from"./inertValue-CLaAaX62.js";import{aF as te,l as ve,aU as se,b6 as ct,aP as Ht,ai as De,e as D,r as a,j as ne,ak as Vt,n as ut,E as Be,f as G,b7 as On,k as wn,al as mt,g as Ge,aH as qe,aI as Pn,b8 as kn,b9 as An,ba as Fn,aV as Mn}from"./index-X11XkRkb.js";import{a as w,o as W,m as pe,c as xe,x as Wt,w as at,b as _t,s as Bt,g as Se,t as Ut,q as Yt,n as Nn,p as Ln}from"./createBaseUIEventDetails-CTYgZt5m.js";const Dn=["open","progress","review","resolved"],Kr={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},$r={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function qr(e){return Dn.includes(e)}function zr(e,t=Date.now()){if(!e)return"";const n=Math.max(0,(t-new Date(e).getTime())/1e3);return n<60?"now":n<3600?`${Math.floor(n/60)} min`:n<86400?`${Math.floor(n/3600)} h`:n<86400*30?`${Math.floor(n/86400)} d`:new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function Jr(e,t=""){const n=e.trim().split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():n.length===1&&n[0].length>0?n[0].slice(0,2).toUpperCase():(t[0]??"?").toUpperCase()}function Hn(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Vn,platform:Wn,maxTouchPoints:_n}=Hn(),Xe=Vn.toLowerCase(),Ne=Wn.toLowerCase(),lt=/^i(os$|p)/.test(Ne)||Ne==="macintel"&&_n>1,yt="android",tt=Ne===yt||Xe.includes(yt),Bn=!lt&&Ne.startsWith("mac");Ne.startsWith("win");const Un=Bn||lt,Ie=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Ie&&Xe.includes("firefox");!Ie&&Xe.includes("chrom");const Yn=Un,jt=/jsdom|happydom/.test(Xe),nt="data-base-ui-focusable",Gt="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Qr="ArrowLeft",Zr="ArrowRight",es="ArrowUp",ts="ArrowDown";function ns(e,t){if(!ve(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(w(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function ze(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function jn(e){return e.matches("html,body")}function Xt(e){return te(e)&&e.matches(Gt)}function rs(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Gt}`)!=null}function Et(e){return e?e.getAttribute("role")==="combobox"&&Xt(e):!1}function ss(e){if(!e||jt)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function St(e){return e?e.hasAttribute(nt)?e:e.querySelector(`[${nt}]`)||e:null}function Le(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Le(e,s.id,n)])}function Tt(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Gn(e){e.preventDefault(),e.stopPropagation()}function Xn(e){return"nativeEvent"in e}function Kn(e){return e.pointerType===""&&e.isTrusted?!0:tt&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $n(e){return jt?!1:!tt&&e.width===0&&e.height===0||tt&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function os(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function qn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const zn='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Jn(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return ct(n)?n.host:null}function rt(e){for(const t of Array.from(e.children))if(se(t)==="summary")return t;return null}function Qn(e,t){const n=rt(t);return!!n&&(e===n||w(n,e))}function Kt(e){const t=e?se(e):"";return e!=null&&e.matches(zn)&&(t!=="summary"||e.parentElement!=null&&se(e.parentElement)==="details"&&rt(e.parentElement)===e)&&(t!=="details"||rt(e)==null)&&(t!=="input"||e.type!=="hidden")}function $t(e){if(!Kt(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Jn(t)){const n=t!==e,r=se(t)==="slot";if(t.hasAttribute("inert")||n&&se(t)==="details"&&!t.open&&!Qn(e,t)||t.hasAttribute("hidden")||!r&&!Zn(t,n))return!1}return!0}function Zn(e,t){const n=Ht(e);return t?n.display!=="none":Dt(e,n)}function qt(e){const t=e.tabIndex;if(t<0){const n=se(e);if(n==="details"||n==="audio"||n==="video"||te(e)&&e.isContentEditable)return 0}return t}function Je(e){if(se(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function er(e,t){const n=Je(e);if(!n)return!0;const r=t.find(s=>{const o=Je(s);return o?.name===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=Je(s);return o?.name===n.name&&o.form===n.form})===n}function zt(e){if(te(e)&&se(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return te(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Jt(e,t){zt(e).forEach(n=>{Kt(n)&&t.push(n),Jt(n,t)})}function Qt(e,t,n){zt(e).forEach(r=>{te(r)&&r.matches(t)&&n.push(r),Qt(r,t,n)})}function ft(e){return $t(e)&&qt(e)>=0}function Zt(e){const t=[];return Jt(e,t),t.filter($t)}function He(e){const t=Zt(e);return t.filter(n=>qt(n)>=0&&er(n,t))}function en(e,t){const n=He(e),r=n.length;if(r===0)return;const s=pe(W(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function tn(e){return en(W(e).body,1)||e}function nn(e){return en(W(e).body,-1)||e}function rn(e,t){if(!e)return null;const n=He(W(e).body),r=n.length;if(r===0)return null;const s=n.indexOf(e);if(s===-1)return null;const o=(s+t+r)%r;return n[o]}function is(e){return rn(e,1)}function cs(e){return rn(e,-1)}function Me(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!w(n,r)}function tr(e){He(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Rt(e){const t=[];Qt(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Ae=0;class Te{static create(){return new Te}currentId=Ae;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ae,n()},t)}isStarted(){return this.currentId!==Ae}clear=()=>{this.currentId!==Ae&&(clearTimeout(this.currentId),this.currentId=Ae)};disposeEffect=()=>this.clear}function Ue(){const e=De(Te.create).current;return Tn(e.disposeEffect),e}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=bt.startingStyle]="startingStyle",e[e.endingStyle=bt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const nr={"data-popup-open":""},rr={"data-popup-open":"","data-pressed":""},sr={"data-open":""},or={"data-closed":""},ir={"data-anchor-hidden":""},us={open(e){return e?nr:null}},as={open(e){return e?rr:null}},cr={open(e){return e?sr:or},anchorHidden(e){return e?ir:null}},ls={...cr,...Rn};function P(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ce(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function We(e){const t=De(ur,e).current;return t.next=e,D(t.effect),t}function ur(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const sn={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ar={...sn,position:"fixed",top:0,left:0},fs={...sn,position:"absolute"},Ye=a.forwardRef(function(t,n){const[r,s]=a.useState();D(()=>{Yn&&Ie&&s("button")},[]);const o={tabIndex:0,role:r};return ne.jsx("span",{...t,ref:n,style:ar,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})});function je(e){return`data-base-ui-${e}`}let _e=0;function Qe(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(_e);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),Vt;const i=requestAnimationFrame(o);return _e=i,()=>{_e===i&&(cancelAnimationFrame(i),_e=0)}}const Ze={inert:new WeakMap,"aria-hidden":new WeakMap},vt="data-base-ui-inert",st={inert:new WeakSet,"aria-hidden":new WeakSet};let Fe=new WeakMap,et=0;function lr(e){return st[e]}function on(e){return e?ct(e)?e.host:on(e.parentNode):null}const xt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=on(n);return e.contains(r)?r:null}).filter(n=>n!=null),Ct=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},It=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{se(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function fr(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const p=xt(t,e),c=s?It(t,Ct(p),new Set(p)):[],y=[],C=[];if(o){const d=Ze[o],g=lr(o);u=g,i=d;const v=xt(t,Array.from(t.querySelectorAll("[aria-live]"))),k=p.concat(v);It(t,Ct(k),new Set(k)).forEach(R=>{const b=R.getAttribute(o),q=b!==null&&b!=="false",V=(d.get(R)||0)+1;d.set(R,V),y.push(R),V===1&&q&&g.add(R),q||R.setAttribute(o,o==="inert"?"":"true")})}return s&&c.forEach(d=>{const g=(Fe.get(d)||0)+1;Fe.set(d,g),C.push(d),g===1&&d.setAttribute(vt,"")}),et+=1,()=>{i&&y.forEach(d=>{const v=(i.get(d)||0)-1;i.set(d,v),v||(!u?.has(d)&&o&&d.removeAttribute(o),u?.delete(d))}),s&&C.forEach(d=>{const g=(Fe.get(d)||0)-1;Fe.set(d,g),g||d.removeAttribute(vt)}),et-=1,et||(Ze.inert=new WeakMap,Ze["aria-hidden"]=new WeakMap,st.inert=new WeakSet,st["aria-hidden"]=new WeakSet,Fe=new WeakMap)}}function Ot(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=W(e[0]).body;return fr(e,o,n,r,{mark:s})}const ds=500,ps=500,gs={style:{transition:"none"}},dr="data-base-ui-click-trigger",hs={fallbackAxisSide:"none"},bs={fallbackAxisSide:"end"},pr={clipPath:"inset(50%)",position:"fixed",top:0,left:0},cn=a.createContext(null),un=()=>a.useContext(cn),gr=je("portal");function hr(e={}){const{ref:t,container:n,componentProps:r=Be,elementProps:s}=e,o=at(),u=un()?.portalNode,[p,c]=a.useState(null),[y,C]=a.useState(null),d=G(S=>{S!==null&&C(S)}),g=a.useRef(null);D(()=>{if(n===null){g.current&&(g.current=null,C(null),c(null));return}const S=(n&&(On(n)?n:n.current))??u??document.body;if(S==null){g.current&&(g.current=null,C(null),c(null));return}g.current!==S&&(g.current=S,C(null),c(S))},[n,u]);const v=wn("div",r,{ref:[t,d],props:[{id:o,[gr]:""},s]}),k=p&&v?ut.createPortal(v,p):null;return{node:y,nodeId:a.isValidElement(v)?v.props.id:void 0,subtree:k}}const ms=a.forwardRef(function(t,n){const{render:r,className:s,style:o,children:i,container:u,...p}=t,{node:c,nodeId:y,subtree:C}=hr({container:u,ref:n,componentProps:t,elementProps:p}),d=a.useRef(null),g=a.useRef(null),v=a.useRef(null),k=a.useRef(null),[S,R]=a.useState(null),b=a.useRef(!1),q=S?.modal,V=S?.open,Y=!!S&&!S.modal&&S.open&&!!c;a.useEffect(()=>{if(!c||q)return;function A(j){c&&j.relatedTarget&&Me(j)&&(j.type==="focusin"?b.current&&(Rt(c),b.current=!1):(tr(c),b.current=!0))}return Ce(P(c,"focusin",A,!0),P(c,"focusout",A,!0))},[c,q]),D(()=>{!c||V!==!0||!b.current||(Rt(c),b.current=!1)},[V,c]);const z=a.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:g,beforeInsideRef:v,afterInsideRef:k,portalNode:c,setFocusManagerState:R}),[c]);return ne.jsxs(a.Fragment,{children:[C,ne.jsxs(cn.Provider,{value:z,children:[Y&&c&&ne.jsx(Ye,{"data-type":"outside",ref:d,onFocus:A=>{if(Me(A,c))v.current?.focus();else{const j=S?S.domReference:null;nn(j)?.focus()}}}),Y&&c&&ne.jsx("span",{"aria-owns":y,style:pr}),c&&ut.createPortal(i,c),Y&&c&&ne.jsx(Ye,{"data-type":"outside",ref:g,onFocus:A=>{if(Me(A,c))k.current?.focus();else{const j=S?S.domReference:null;tn(j)?.focus(),S?.closeOnFocusOut&&S?.onOpenChange(!1,xe(Wt,A.nativeEvent))}}})]})]})});function an(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class br{nodesRef={current:[]};events=an();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const ln=a.createContext(null),fn=a.createContext(null),dt=()=>a.useContext(ln)?.id||null,pt=e=>{const t=a.useContext(fn);return e??t};function ys(e){const t=at(),n=pt(e),r=dt();return D(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Es(e){const{children:t,id:n}=e,r=dt();return ne.jsx(ln.Provider,{value:a.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Ss(e){const{children:t,externalTree:n}=e,r=De(()=>n??new br).current;return ne.jsx(fn.Provider,{value:r,children:t})}function mr(e,t){const n=Ge(Se(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const wt=20;let be=[];function gt(){be=be.filter(e=>e.deref()?.isConnected)}function Pt(e){gt(),e&&se(e)!=="body"&&(be.push(new WeakRef(e)),be.length>wt&&(be=be.slice(-wt)))}function kt(){return gt(),be[be.length-1]?.deref()}function yr(e){return e?ft(e)?e:He(e)[0]||e:null}function At(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return ft(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Ts(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:p=!0,openInteractionType:c="",nextFocusableElement:y,previousFocusableElement:C,beforeContentFocusGuardRef:d,externalTree:g,getInsideElements:v}=e,k="rootStore"in t?t.rootStore:t,S=k.useState("open"),R=k.useState("domReferenceElement"),b=k.useState("floatingElement"),{events:q,dataRef:V}=k.context,Y=G(()=>V.current.floatingContext?.nodeId),z=s===!1,A=Et(R)&&z,j=We(s),M=We(o),J=We(c),Oe=We(S),_=pt(g),x=un(),U=a.useRef(!1),ae=a.useRef(!1),oe=a.useRef(!1),ie=a.useRef(null),me=a.useRef(""),ge=a.useRef(""),ye=a.useRef(null),Re=a.useRef(null),I=mt(ye,d,x?.beforeInsideRef),Q=mt(Re,x?.afterInsideRef),le=Ue(),fe=Ue(),we=vn(),Ve=x!=null,E=St(b),ce=G((T=E)=>T?He(T):[]),re=G(()=>v?.().filter(T=>T!=null)??[]);a.useEffect(()=>{if(r||!u)return;function T(B){B.key==="Tab"&&w(E,pe(W(E)))&&ce().length===0&&!A&&Gn(B)}const L=W(E);return P(L,"keydown",T)},[r,E,u,A,ce]),a.useEffect(()=>{if(r||!S)return;const T=W(E);function L(){oe.current=!1}function B(Z){const m=Se(Z),F=re(),h=w(b,m)||w(R,m)||w(x?.portalNode,m)||F.some(H=>H===m||w(H,m));oe.current=!h,ge.current=Z.pointerType||"keyboard",m?.closest(`[${dr}]`)&&(ae.current=!0,fe.start(0,()=>{ae.current=!1}))}function X(){ge.current="keyboard"}return Ce(P(T,"pointerdown",B,!0),P(T,"pointerup",L,!0),P(T,"pointercancel",L,!0),P(T,"keydown",X,!0),L)},[r,b,R,E,S,x,fe,re]),a.useEffect(()=>{if(r||!p)return;const T=W(E);function L(){ae.current=!0,fe.start(0,()=>{ae.current=!1})}function B(F){const h=Se(F);ft(h)&&(ie.current=h)}function X(F){const h=F.relatedTarget,H=F.currentTarget,K=Se(F);u&&h==null&&K!=null&&w(b,K)&&Pt(K),queueMicrotask(()=>{const N=Y(),ee=k.context.triggerElements,l=re(),f=h?.hasAttribute(je("focus-guard"))&&[ye.current,Re.current,x?.beforeInsideRef.current,x?.afterInsideRef.current,x?.beforeOutsideRef.current,x?.afterOutsideRef.current,he(C),he(y)].includes(h),$=!(w(R,h)||w(b,h)||w(h,b)||w(x?.portalNode,h)||l.some(O=>O===h||w(O,h))||ee.hasMatchingElement(O=>w(O,h))||f||_&&(Le(_.nodesRef.current,N).find(O=>w(O.context?.elements.floating,h)||w(O.context?.elements.domReference,h))||Tt(_.nodesRef.current,N).find(O=>[O.context?.elements.floating,St(O.context?.elements.floating)].includes(h)||O.context?.elements.domReference===h)));if(H===R&&E&&At(E),i&&H!==R&&!Dt(K)&&pe(T)===T.body){if(te(E)&&(E.focus(),i==="popup")){we.request(()=>{E.focus()});return}const O=ce(),de=ie.current,Pe=(de&&O.includes(de)?de:null)||O[O.length-1]||E;te(Pe)&&Pe.focus()}if(V.current.insideReactTree){V.current.insideReactTree=!1;return}(A||!u)&&h&&$&&!ae.current&&(A||h!==kt())&&(U.current=!0,k.setOpen(!1,xe(Wt,F)))})}function Z(){oe.current||(V.current.insideReactTree=!0,le.start(0,()=>{V.current.insideReactTree=!1}))}const m=te(R)?R:null;if(!(!b&&!m))return Ce(m&&P(m,"focusout",X),m&&P(m,"pointerdown",L),b&&P(b,"focusin",B),b&&P(b,"focusout",X),b&&x&&P(b,"focusout",Z,!0))},[r,R,b,E,u,_,x,k,p,i,ce,A,Y,V,le,fe,we,y,C,re]),a.useEffect(()=>{if(r||!b||!S)return;const T=Array.from(x?.portalNode?.querySelectorAll(`[${je("portal")}]`)||[]),B=(_?Tt(_.nodesRef.current,Y()):[]).find(H=>Et(H.context?.elements.domReference||null))?.context?.elements.domReference,Z=[...[b,...T,ye.current,Re.current,x?.beforeOutsideRef.current,x?.afterOutsideRef.current,...re()],B,he(C),he(y),A?R:null].filter(H=>H!=null),m=Ot(Z,{ariaHidden:u||A,mark:!1}),F=[b,...T].filter(H=>H!=null),h=Ot(F);return()=>{h(),m()}},[S,r,R,b,u,x,A,_,Y,y,C,re]),D(()=>{if(!S||r||!te(E))return;me.current="",ge.current="";const T=W(E),L=pe(T);queueMicrotask(()=>{const B=j.current,X=typeof B=="function"?B(J.current||""):B;if(X===void 0||X===!1||w(E,L))return;let m=null;const F=()=>(m==null&&(m=ce(E)),m[0]||E);let h;X===!0||X===null?h=F():h=he(X),h=h||F();const H=w(E,pe(T));Qe(h,{preventScroll:h===E,shouldFocus(){if(!Oe.current)return!1;if(H)return!0;const K=pe(T);return!(K!==h&&w(E,K))}})})},[r,S,E,ce,j,J,Oe]),D(()=>{if(r||!E)return;const T=W(E),L=pe(T),B=J.current==null;Pt(L);function X(m){if(m.open||(me.current=mr(m.nativeEvent,ge.current)),m.reason===_t&&m.nativeEvent.type==="mouseleave"&&(U.current=!0),m.reason===Bt)if(m.nested)U.current=!1;else if(Kn(m.nativeEvent)||$n(m.nativeEvent))U.current=!1;else{let F=!1;W(E).createElement("div").focus({get preventScroll(){return F=!0,!1}}),F?U.current=!1:U.current=!0}}q.on("openchange",X);function Z(m){const F=M.current;let h=typeof F=="function"?F(m):F;if(h===void 0||h===!1)return null;h===null&&(h=!0);const H=R?.isConnected?R:null,K=L?.isConnected&&se(L)!=="body"?L:null;let N=B?K||H:H||K;return N||(N=kt()||null),typeof h=="boolean"?N:he(h)||N||null}return()=>{q.off("openchange",X);const m=pe(T),F=re(),h=w(b,m)||F.some(ee=>ee===m||w(ee,m))||_&&Le(_.nodesRef.current,Y(),!1).some(ee=>w(ee.context?.elements.floating,m)),H=M.current,K=me.current,N=Z(K);queueMicrotask(()=>{const ee=yr(N),l=typeof H!="boolean";if(H&&!U.current&&te(ee)&&(!(!l&&ee!==m&&m!==T.body)||h)){const f={preventScroll:!0};K==="keyboard"&&(f.focusVisible=!0),ee.focus(f)}U.current=!1})}},[r,b,E,M,J,q,_,R,Y,re]),D(()=>{if(!Ie||S||!b)return;const T=pe(W(b));!te(T)||!Xt(T)||w(b,T)&&T.blur()},[S,b]),D(()=>{if(!(r||!x))return x.setFocusManagerState({modal:u,closeOnFocusOut:p,open:S,onOpenChange:k.setOpen,domReference:R}),()=>{x.setFocusManagerState(null)}},[r,x,u,S,k,p,R]),D(()=>{if(!(r||!E))return At(E),()=>{queueMicrotask(gt)}},[r,E]);const Ee=!r&&(u?!A:!0)&&(Ve||u);return ne.jsxs(a.Fragment,{children:[Ee&&ne.jsx(Ye,{"data-type":"inside",ref:I,onFocus:T=>{if(u){const L=ce();Qe(L[L.length-1])}else x?.portalNode&&(U.current=!1,Me(T,x.portalNode)?tn(R)?.focus():he(C??x.beforeOutsideRef)?.focus())}}),n,Ee&&ne.jsx(Ye,{"data-type":"inside",ref:Q,onFocus:T=>{u?Qe(ce()[0]):x?.portalNode&&(p&&(U.current=!0),Me(T,x.portalNode)?nn(R)?.focus():he(y??x.afterOutsideRef)?.focus())}})]})}function Er(){return!1}function Sr(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Rs(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=Er,bubbles:u,externalTree:p}=t,c="rootStore"in e?e.rootStore:e,y=c.useState("open"),C=c.useState("floatingElement"),{dataRef:d}=c.context,g=pt(p),v=G(typeof s=="function"?s:()=>!1),k=typeof s=="function"?v:s,S=k!==!1,R=G(()=>o),{escapeKey:b,outsidePress:q}=Sr(u),V=a.useRef(!1),Y=a.useRef(!1),z=a.useRef(!1),A=a.useRef(!1),j=a.useRef(""),M=a.useRef(null),J=Ue(),Oe=Ue(),_=G(()=>{Oe.clear(),d.current.insideReactTree=!1}),x=G(I=>{const Q=d.current.floatingContext?.nodeId;return(g?Le(g.nodesRef.current,Q):[]).some(fe=>fe.context?.open&&!fe.context.dataRef.current[I])}),U=G(I=>ze(I,c.select("floatingElement"))||ze(I,c.select("domReferenceElement"))),ae=G(I=>{i()&&c.setOpen(!1,xe(Ut,I.nativeEvent))}),oe=G(I=>{if(!y||!n||!r||I.key!=="Escape"||A.current||!b&&x("__escapeKeyBubbles"))return;const Q=Xn(I)?I.nativeEvent:I,le=xe(Yt,Q);c.setOpen(!1,le),le.isCanceled||I.preventDefault(),!b&&!le.isPropagationAllowed&&I.stopPropagation()}),ie=G(()=>{d.current.insideReactTree=!0,Oe.start(0,_)}),me=G(I=>{if(!y||!n||I.button!==0)return;const Q=Se(I.nativeEvent);w(c.select("floatingElement"),Q)&&(V.current||(V.current=!0,Y.current=!1))}),ge=G(I=>{!y||!n||(I.defaultPrevented||I.nativeEvent.defaultPrevented)&&V.current&&(Y.current=!0)});a.useEffect(()=>{if(!y||!n)return _;d.current.__escapeKeyBubbles=b,d.current.__outsidePressBubbles=q;const I=new Te,Q=new Te;function le(){I.clear(),A.current=!0}function fe(){I.start(Ie?5:0,()=>{A.current=!1})}function we(){z.current=!0,Q.start(0,()=>{z.current=!1})}function Ve(){V.current=!1,Y.current=!1}function E(){const l=j.current,f=l==="pen"||!l?"mouse":l,$=R(),O=typeof $=="function"?$():$;return typeof O=="string"?O:O[f]}function ce(l){const f=E();return f==="intentional"&&l.type!=="click"||f==="sloppy"&&l.type==="click"}function re(l){const f=d.current.floatingContext?.nodeId,$=g&&Le(g.nodesRef.current,f).some(O=>ze(l,O.context?.elements.floating));return U(l)||$}function Ee(l){if(ce(l)){l.type!=="click"&&!U(l)&&(Q.clear(),z.current=!1),_();return}if(d.current.insideReactTree){_();return}const f=Se(l),$=`[${je("inert")}]`,O=ve(f)?f.getRootNode():null,de=Array.from((ct(O)?O:W(c.select("floatingElement"))).querySelectorAll($)),Pe=c.context.triggerElements;if(f&&(Pe.hasElement(f)||Pe.hasMatchingElement(ue=>w(ue,f))))return;let ke=ve(f)?f:null;for(;ke&&!qe(ke);){const ue=Pn(ke);if(qe(ue)||!ve(ue))break;ke=ue}if(!(de.length&&ve(f)&&!jn(f)&&!w(f,c.select("floatingElement"))&&de.every(ue=>!w(ke,ue)))){if(te(f)&&!("touches"in l)){const ue=qe(f),$e=Ht(f),ht=/auto|scroll/,gn=ue||ht.test($e.overflowX),hn=ue||ht.test($e.overflowY),bn=gn&&f.clientWidth>0&&f.scrollWidth>f.clientWidth,mn=hn&&f.clientHeight>0&&f.scrollHeight>f.clientHeight,yn=$e.direction==="rtl",En=mn&&(yn?l.offsetX<=f.offsetWidth-f.clientWidth:l.offsetX>f.clientWidth),Sn=bn&&l.offsetY>f.clientHeight;if(En||Sn)return}if(!re(l)){if(E()==="intentional"&&z.current){Q.clear(),z.current=!1;return}typeof k=="function"&&!k(l)||x("__outsidePressBubbles")||(c.setOpen(!1,xe(Bt,l)),_())}}}function T(l){E()!=="sloppy"||l.pointerType==="touch"||!c.select("open")||!n||U(l)||Ee(l)}function L(l){if(E()!=="sloppy"||!c.select("open")||!n||U(l))return;const f=l.touches[0];f&&(M.current={startTime:Date.now(),startX:f.clientX,startY:f.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},J.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}function B(l,f){const $=Se(l);if(!$)return;const O=P($,l.type,()=>{f(l),O()})}function X(l){j.current="touch",B(l,L)}function Z(l){J.clear(),l.type==="pointerdown"&&(j.current=l.pointerType),!(l.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)&&B(l,f=>{f.type==="pointerdown"?T(f):Ee(f)})}function m(l){if(!V.current)return;const f=Y.current;if(Ve(),E()==="intentional"){if(l.type==="pointercancel"){f&&we();return}if(!re(l)){if(f){we();return}typeof k=="function"&&!k(l)||(Q.clear(),z.current=!0,_())}}}function F(l){if(E()!=="sloppy"||!M.current||U(l))return;const f=l.touches[0];if(!f)return;const $=Math.abs(f.clientX-M.current.startX),O=Math.abs(f.clientY-M.current.startY),de=Math.sqrt($*$+O*O);de>5&&(M.current.dismissOnTouchEnd=!0),de>10&&(Ee(l),J.clear(),M.current=null)}function h(l){B(l,F)}function H(l){E()!=="sloppy"||!M.current||U(l)||(M.current.dismissOnTouchEnd&&Ee(l),J.clear(),M.current=null)}function K(l){B(l,H)}const N=W(C),ee=Ce(r&&Ce(P(N,"keydown",oe),P(N,"compositionstart",le),P(N,"compositionend",fe)),S&&Ce(P(N,"click",Z,!0),P(N,"pointerdown",Z,!0),P(N,"pointerup",m,!0),P(N,"pointercancel",m,!0),P(N,"mousedown",Z,!0),P(N,"mouseup",m,!0),P(N,"touchstart",X,!0),P(N,"touchmove",h,!0),P(N,"touchend",K,!0)));return()=>{ee(),I.clear(),Q.clear(),Ve(),z.current=!1,_()}},[d,C,r,S,k,y,n,b,q,oe,_,R,x,U,g,c,J]);const ye=a.useMemo(()=>({onKeyDown:oe,onPointerDown:ae,onClick:ae}),[oe,ae]),Re=a.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:ie,onMouseDownCapture(I){ie(),me(I)},onPointerDownCapture(I){ie(),me(I)},onMouseUpCapture:ie,onTouchEndCapture:ie,onTouchMoveCapture:ie}),[oe,ie,me,ge]);return a.useMemo(()=>n?{reference:ye,floating:Re,trigger:ye}:{},[n,ye,Re])}var dn=kn();const ot=[];let it;function Tr(){return it}function Rr(e){ot.push(e)}function vr(e){const t=(n,r)=>{const s=De(xr).current;let o;try{it=s;for(const i of ot)i.before(s);o=e(n,r);for(const i of ot)i.after(s);s.didInitialize=!0}finally{it=void 0}return o};return t.displayName=e.displayName||e.name,t}function vs(e){return a.forwardRef(vr(e))}function xr(){return{didInitialize:!1}}const Cr=An(19),Ir=Cr?wr:Pr;function pn(e,t,n,r,s){return Ir(e,t,n,r,s)}function Or(e,t,n,r,s){const o=a.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return dn.useSyncExternalStore(e.subscribe,o,o)}Rr({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],s=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,s)||(t=!0,r.value=s)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const s of e.syncHooks)n.add(s.store);const r=[];for(const s of n)r.push(s.subscribe(t));return()=>{for(const s of r)s()}}),dn.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function wr(e,t,n,r,s){const o=Tr();if(!o)return Or(e,t,n,r,s);const i=o.syncIndex;o.syncIndex+=1;let u;return o.didInitialize?(u=o.syncHooks[i],(u.store!==e||u.selector!==t||!Object.is(u.a1,n)||!Object.is(u.a2,r)||!Object.is(u.a3,s))&&(u.store!==e&&(o.didChangeStore=!0),u.store=e,u.selector=t,u.a1=n,u.a2=r,u.a3=s,u.value=t(e.getSnapshot(),n,r,s))):(u={store:e,selector:t,a1:n,a2:r,a3:s,value:t(e.getSnapshot(),n,r,s)},o.syncHooks.push(u)),u.value}function Pr(e,t,n,r,s){return Fn.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class kr{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return pn(this,t,n,r,s)}}class Ar extends kr{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){a.useDebugValue(t);const r=this;D(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;D(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);D(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){a.useDebugValue(t);const r=this,s=n!==void 0;D(()=>{s&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,s])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return a.useDebugValue(t),pn(this,this.selectors[t],n,r,s)}useContextCallback(t,n){a.useDebugValue(t);const r=G(n??Vt);this.context[t]=r}useStateSetter(t){const n=a.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const u=s;s=i,n(i,u,this)}})}}const Fr={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Mr extends Ar{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:an(),nested:r,triggerElements:o},Fr),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&qn(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function Nr(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),p=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),y=t.context.triggerElements,C=i,d=a.useRef(null);r===void 0&&d.current===null&&(d.current=new Mr({open:u,transitionStatus:void 0,referenceElement:p,floatingElement:c,triggerElements:y,onOpenChange:C,floatingId:s,syncOnly:!0,nested:o}));const g=r??d.current;return t.useSyncedValue("floatingId",s),D(()=>{const v={open:u,floatingId:s,referenceElement:p,floatingElement:c};ve(p)&&(v.domReferenceElement=p),g.state.positionReference===g.state.referenceElement&&(v.positionReference=p),g.update(v)},[u,s,p,c,g]),g.context.onOpenChange=C,g.context.nested=o,g}const xs={tabIndex:-1,[nt]:""};function Cs(e){return t=>t==="touch"?e.current:!0}function Is(e,t=!1){const n=at(),r=dt()!=null,s=De(()=>e(n,r)).current;return Nr({popupStore:s,treatPopupAsFloatingElement:t,floatingRootContext:s.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:s.setOpen}),s}function Os({handle:e,store:t}){return D(()=>e.attachStore(t),[e,t]),null}function Lr(e,t){const n=a.useRef(null),r=a.useRef(null);return a.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,p=t.context.triggerElements.getById(i);u&&p===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function Dr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function Hr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function ws(e,t,n,r={}){const s=n.reason,o=s===_t,i=t&&s===Ln,u=!t&&(s===Ut||s===Yt),p=Hr(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const c=()=>{const y={...r.extraState,open:t};i?y.instantType="focus":u?y.instantType="dismiss":o&&(y.instantType=void 0),Dr(y,t,n.trigger,p()),e.update(y)};o?ut.flushSync(c):c()}function Ps(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Lr(e,n),i=G(p=>{const c=n.select("open"),y=n.select("activeTriggerId");if(y===e){n.update({activeTriggerElement:p,...c?r:null});return}y==null&&c&&n.update({activeTriggerId:e,activeTriggerElement:p,...r})}),u=a.useCallback(p=>{o(p),p&&i(p)},[o,i]);return D(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:u,isMountedByThisTrigger:s}}function ks(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=a.useRef(null),s=e.useState("open"),o=e.useState("triggerCount"),i=e.useState("activeTriggerId"),u=e.useState("activeTriggerElement");D(()=>{if(!s){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const p=e.context.triggerElements.size,c={};e.state.triggerCount!==p&&(c.triggerCount=p);const y=e.select("activeTriggerId");let C=null;if(y){const d=e.context.triggerElements.getById(y);if(d)r.current=y,d!==e.state.activeTriggerElement&&(c.activeTriggerElement=d);else{for(const[g,v]of e.context.triggerElements.entries())if(v===e.state.activeTriggerElement){c.activeTriggerId=g,c.activeTriggerElement=v,r.current=g;break}c.activeTriggerId===void 0&&(r.current===y?C=y:r.current=null)}}else r.current=null;if(!C&&!y&&p===1){const d=e.context.triggerElements.entries().next();if(!d.done){const[g,v]=d.value;c.activeTriggerId=g,c.activeTriggerElement=v,r.current=g}}(c.triggerCount!==void 0||c.activeTriggerId!==void 0||c.activeTriggerElement!==void 0)&&e.update(c),C&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===C&&!e.context.triggerElements.getById(C)){const d=xe(Nn);e.setOpen(!1,d),d.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[s,e,o,i,u,n])}function As(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=xn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const p=G(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Cn({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||p()}}),{forceUnmount:p,transitionStatus:o}}function Fs(e,t){e.useSyncedValues(t),D(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function Ms(e,t){D(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),D(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Ns{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}const Ls=a.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Ft={},Mt={},Nt="";function Ke(e,t){return Mn(e)?e:t}function Lt(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Ke(t,n)).overflowY)}function Vr(e){if(typeof document>"u")return!1;const t=W(e);return Ge(t).innerWidth-t.documentElement.clientWidth>0}function Wr(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=W(e),r=n.documentElement,s=n.body,o=Ke(r,s),i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const p=o.offsetWidth;o.style.overflowY="hidden";const c=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,p===c}function _r(e){const t=W(e),n=t.documentElement,r=t.body,s=Ke(n,r),o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Br(e){const t=W(e),n=t.documentElement,r=t.body,s=Ge(n);let o=0,i=0,u=!1;const p=In.create();if(Ie&&(s.visualViewport?.scale??1)!==1)return()=>{};function c(){const g=s.getComputedStyle(n),v=s.getComputedStyle(r),R=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Ft={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Nt=n.style.scrollBehavior,Mt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,q=n.scrollWidth>n.clientWidth,V=g.overflowY==="scroll"||v.overflowY==="scroll",Y=g.overflowX==="scroll"||v.overflowX==="scroll",z=Math.max(0,s.innerWidth-r.clientWidth),A=Math.max(0,s.innerHeight-r.clientHeight),j=parseFloat(v.marginTop)+parseFloat(v.marginBottom),M=parseFloat(v.marginLeft)+parseFloat(v.marginRight),J=Ke(n,r);if(u=Wr(e),u){n.style.scrollbarGutter=R,J.style.overflowY="hidden",J.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(b||V)&&(n.style.overflowY="scroll"),(q||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:j||A?`calc(100dvh - ${j+A}px)`:"100dvh",width:M||z?`calc(100vw - ${M+z}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function y(){Object.assign(n.style,Ft),Object.assign(r.style,Mt),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Nt)}function C(){y(),p.request(c)}c();const d=P(s,"resize",C);return()=>{p.cancel(),y(),typeof s.removeEventListener=="function"&&d()}}class Ur{lockCount=0;restore=null;timeoutLock=Te.create();timeoutUnlock=Te.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=W(t),r=n.documentElement,s=n.body,o=Ge(r);if(Lt(o,r,s)){const u=new o.MutationObserver(()=>{Lt(o,r,s)||(u.disconnect(),this.restore=null,this.lock(t))}),p={attributes:!0};u.observe(r,p),u.observe(s,p),this.restore=()=>u.disconnect();return}const i=lt||!Vr(t);this.restore=i?_r(t):Br(t)}}const Yr=new Ur;function Ds(e=!0,t=null){D(()=>{if(e)return Yr.acquire(t)},[e,t])}export{Ss as $,Ce as A,Bn as B,Ie as C,je as D,ns as E,xs as F,Xt as G,ss as H,pt as I,dt as J,rs as K,Le as L,Ts as M,ms as N,hs as O,Ns as P,Ls as Q,Ar as R,Kr as S,Te as T,Es as U,br as V,ys as W,Hr as X,Dr as Y,Nr as Z,ds as _,P as a,Me as a0,is as a1,tn as a2,cs as a3,as as a4,Ye as a5,ps as a6,Mr as a7,pn as a8,St as a9,Kn as aa,$n as ab,Et as ac,Qe as ad,Gn as ae,Qr as af,Zr as ag,es as ah,ts as ai,lt as aj,gs as ak,Ds as al,jt as am,Cs as an,Ms as ao,$r as ap,ws as b,ks as c,As as d,Os as e,vr as f,Rs as g,Fs as h,os as i,vs as j,Ps as k,We as l,Ue as m,hr as n,bs as o,ls as p,cr as q,qr as r,Jr as s,us as t,Is as u,zr as v,Dn as w,fs as x,ar as y,dn as z};
@@ -1 +0,0 @@
1
- import{W as h,r as x,j as e,B as a,G as N,s as y,X as b}from"./index-X11XkRkb.js";const S=`${b}session`;function E(){const{project:o,origin:t,env:g}=h.useSearch(),{me:n}=h.useRouteContext(),[l,d]=x.useState(""),[f,u]=x.useState(!1),i=n.projects.find(s=>s.uid===o),m=typeof window<"u"?window.opener:null,r=()=>window.close();if(!o||!t||!m)return e.jsx(c,{title:"Nothing to sign in to",children:e.jsxs("p",{className:"m-0 text-muted-foreground",children:["This window is opened by the comment box on a site you are reviewing. Open it from there — choose"," ",e.jsx("em",{children:"Studio member? Sign in"})," — and it will ask you here."]})});if(!i)return e.jsxs(c,{title:"Not one of this studio's sites",children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["You are signed in to ",n.org.name,", and that site is not one of its sites. If it belongs to another studio you are in, switch to it in the dashboard and try again."]}),e.jsx(a,{variant:"outline",onClick:r,children:"Close"})]});const p=async()=>{d(""),u(!0);try{const s=await y.memberSession(i.uid,t,g);if(s.origin!==t)throw new Error("The address changed while signing in. Try again from the site.");const{origin:j,...w}=s;m.postMessage({type:S,session:w},j),r()}catch(s){d(s instanceof Error?s.message:"Could not reach the server."),u(!1)}};return e.jsxs(c,{title:`Sign in to ${i.name}`,children:[e.jsxs("p",{className:"m-0 text-muted-foreground",children:["Comment on ",e.jsx("span",{className:"font-medium text-foreground",children:t})," as"," ",e.jsx("span",{className:"font-medium text-foreground",children:n.user.name||n.user.email}),", from ",n.org.name,". Your comments there and your replies here will be one author."]}),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 gap-2",children:[e.jsx(a,{size:"lg",className:"flex-1",loading:f,onClick:()=>void p(),children:"Continue"}),e.jsx(a,{size:"lg",variant:"outline",onClick:r,children:"Cancel"})]})]})}function c({title:o,children:t}){return e.jsx(N,{children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),t]})})}export{E as component};
@@ -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-X11XkRkb.js";import{L as c,I as d}from"./label-8lYoT07T.js";import{P,a as h}from"./parts-DVVBI72d.js";import{S as A}from"./SaveState-DmbisglJ.js";import{M as k}from"./McpTokens-BmJUgHlN.js";import{u as M}from"./me-DnLqgT3l.js";import{u as F,a as E}from"./studio-pFbLfSmh.js";import{M as T,S as D,a as z}from"./sun-CK52_1CD.js";import"./createBaseUIEventDetails-CTYgZt5m.js";import"./card-CzVTF25b.js";import"./useScrollLock-DDlrhOw8.js";import"./inertValue-CLaAaX62.js";import"./Picker-95_pkfVu.js";import"./chevron-down-865lxBex.js";import"./check-BlRwZrSR.js";import"./isElementDisabled-CwHw_lZC.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-BuDWW6rb.js";import"./getPseudoElementBounds-CFaDUKhY.js";import"./CompositeList-OHWH8W1h.js";import"./useQuery-CCJBm2EJ.js";import"./useBaseQuery-C_54ul4D.js";import"./badge-CicACH6l.js";import"./useRender-BZe0PUs7.js";import"./dialog-DZbUuBSr.js";import"./switch-CHmJ_Ipt.js";import"./useAriaLabelledBy-DcwFG0Pf.js";import"./ConfirmDialog-Db4AvUN5.js";import"./copy-DSJQda7h.js";import"./CopyButton-r38fWUwx.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 pe(){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{pe as component};