@snagset/server 0.1.41 → 0.1.43

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 (107) hide show
  1. package/dist/app.js +35 -2
  2. package/dist/app.js.map +1 -1
  3. package/dist/db/migrations/0015_site_archive.sql +15 -0
  4. package/dist/holds.js +29 -0
  5. package/dist/holds.js.map +1 -0
  6. package/dist/mail/smtp.js +17 -7
  7. package/dist/mail/smtp.js.map +1 -1
  8. package/dist/plan.js +2 -2
  9. package/dist/plan.js.map +1 -1
  10. package/dist/projectCache.js +1 -1
  11. package/dist/projectCache.js.map +1 -1
  12. package/dist/routes/bodyLimit.js +13 -11
  13. package/dist/routes/bodyLimit.js.map +1 -1
  14. package/dist/routes/comments.js +7 -0
  15. package/dist/routes/comments.js.map +1 -1
  16. package/dist/routes/invites.js +19 -7
  17. package/dist/routes/invites.js.map +1 -1
  18. package/dist/routes/owner.js +8 -4
  19. package/dist/routes/owner.js.map +1 -1
  20. package/dist/routes/sites.js +46 -0
  21. package/dist/routes/sites.js.map +1 -1
  22. package/dist/routes/threads.js +6 -3
  23. package/dist/routes/threads.js.map +1 -1
  24. package/package.json +1 -1
  25. package/static/dashboard/assets/{CompositeItem-B_Ebe9qQ.js → CompositeItem-DqkA27tC.js} +1 -1
  26. package/static/dashboard/assets/{CompositeList-CDAPQTbv.js → CompositeList-DrnyFTB0.js} +1 -1
  27. package/static/dashboard/assets/{ConfirmDialog-D1II2uNE.js → ConfirmDialog-CLal40kk.js} +1 -1
  28. package/static/dashboard/assets/{CopyButton-qbA2ZHWn.js → CopyButton-D_EAOrl1.js} +1 -1
  29. package/static/dashboard/assets/{FieldItemContext-BM_KzVUj.js → FieldItemContext-Dvh77l6C.js} +1 -1
  30. package/static/dashboard/assets/{InstallTag-DTpNoMn9.js → InstallTag-Cld-E0Bc.js} +1 -1
  31. package/static/dashboard/assets/InstanceRows-DexbQngM.js +1 -0
  32. package/static/dashboard/assets/{McpTokens-DE2t0iiS.js → McpTokens-CIjBwfT0.js} +1 -1
  33. package/static/dashboard/assets/{SaveState-QQHqDSgx.js → SaveState-BiYh2KgZ.js} +1 -1
  34. package/static/dashboard/assets/_app-BSxQmm69.js +61 -0
  35. package/static/dashboard/assets/{_app-CaDt6CPJ.js → _app-CrFQJNrf.js} +1 -1
  36. package/static/dashboard/assets/activity-BUIv_tqh.js +1 -0
  37. package/static/dashboard/assets/{arrow-left-RqdORgcq.js → arrow-left-B6jSSfnu.js} +1 -1
  38. package/static/dashboard/assets/{avatar-D8S5EME4.js → avatar-CPcL_-iV.js} +1 -1
  39. package/static/dashboard/assets/{badge-anHWhPFa.js → badge-DBzqpvfR.js} +1 -1
  40. package/static/dashboard/assets/{card-C01exIzZ.js → card-B5svGaqA.js} +1 -1
  41. package/static/dashboard/assets/{check-Gm9Xu4rH.js → check-C21x2mpF.js} +1 -1
  42. package/static/dashboard/assets/{chevron-down-C-pVPOKU.js → chevron-down-qCyXHfGI.js} +1 -1
  43. package/static/dashboard/assets/{chevron-right-BQmYcugl.js → chevron-right-ZLZCd12m.js} +1 -1
  44. package/static/dashboard/assets/{copy-Ckk__4oN.js → copy-Bik19B-3.js} +1 -1
  45. package/static/dashboard/assets/{dialog-D5G50pSW.js → dialog-qbXy4GE2.js} +1 -1
  46. package/static/dashboard/assets/{dropdown-menu-Bm_opJ2p.js → dropdown-menu-_DGLxfga.js} +1 -1
  47. package/static/dashboard/assets/{forgot-R7JqXxs5.js → forgot-BJwCHsE9.js} +1 -1
  48. package/static/dashboard/assets/{image-off-BtbHLgOM.js → image-off-DkzQHm8a.js} +1 -1
  49. package/static/dashboard/assets/{index-p-qD6BlY.js → index-CHi2CcHb.js} +20 -20
  50. package/static/dashboard/assets/index-Ie8QH3El.css +1 -0
  51. package/static/dashboard/assets/invite-BRZIE9ij.js +1 -0
  52. package/static/dashboard/assets/{label-CuvYMIVd.js → label-Dff2Zjcb.js} +1 -1
  53. package/static/dashboard/assets/labels--UUyt9uB.js +1 -0
  54. package/static/dashboard/assets/{layout-grid-D5ek58h7.js → layout-grid-C3Koxvvp.js} +1 -1
  55. package/static/dashboard/assets/me-XTwFHhR6.js +1 -0
  56. package/static/dashboard/assets/{parts-CN1uQywE.js → parts-CK9SS76R.js} +1 -1
  57. package/static/dashboard/assets/{plus-BsxOLtMA.js → plus-4APMJ4TC.js} +1 -1
  58. package/static/dashboard/assets/reset-BakGFWJY.js +1 -0
  59. package/static/dashboard/assets/s._site-z1oyWNQY.js +1 -0
  60. package/static/dashboard/assets/{s._site.comments-DmrtKLHb.js → s._site.comments-C3V2hEnX.js} +2 -2
  61. package/static/dashboard/assets/s._site.reviewers-BWO0DRhU.js +1 -0
  62. package/static/dashboard/assets/s._site.settings-Brm50esb.js +1 -0
  63. package/static/dashboard/assets/{setup-BDZJmgIB.js → setup-B1bevXbJ.js} +1 -1
  64. package/static/dashboard/assets/{sign-in-BmweKwDv.js → sign-in-DxO2Kh8j.js} +1 -1
  65. package/static/dashboard/assets/{sign-up-C06mQl-c.js → sign-up-B8c2f4uf.js} +1 -1
  66. package/static/dashboard/assets/sites-BzBdEUAz.js +1 -0
  67. package/static/dashboard/assets/{studio-BHpeuJSq.js → studio-BtXg0XzE.js} +1 -1
  68. package/static/dashboard/assets/studio-CD5SiuzI.js +1 -0
  69. package/static/dashboard/assets/studio.index-r91Elth-.js +1 -0
  70. package/static/dashboard/assets/studio.integrations-Df0aQQaP.js +1 -0
  71. package/static/dashboard/assets/{studio.members-CEKrbJHp.js → studio.members-BAJ3beQC.js} +2 -2
  72. package/static/dashboard/assets/studio.plan-CcdSeq5g.js +1 -0
  73. package/static/dashboard/assets/{sun-DXwtJyi5.js → sun-BwWiB8wj.js} +1 -1
  74. package/static/dashboard/assets/{switch-cgJL6ATv.js → switch-b0ERMUSk.js} +1 -1
  75. package/static/dashboard/assets/{table-B8VTYpZO.js → table-HuNaCQBJ.js} +1 -1
  76. package/static/dashboard/assets/{useAriaLabelledBy-BT5NtL2E.js → useAriaLabelledBy-B3107P7l.js} +1 -1
  77. package/static/dashboard/assets/{useBaseQuery-DaFWLbWu.js → useBaseQuery-DI4GfUK8.js} +1 -1
  78. package/static/dashboard/assets/useQuery-U2FOgJPB.js +1 -0
  79. package/static/dashboard/assets/useRender-B8Yivtih.js +1 -0
  80. package/static/dashboard/assets/{useValueChanged-cwqHWzY1.js → useValueChanged-RTamjQR3.js} +1 -1
  81. package/static/dashboard/assets/{users-CGY0g3mg.js → users--4QPa7AS.js} +1 -1
  82. package/static/dashboard/assets/{welcome-CNtwDQMd.js → welcome-UZyMZNzL.js} +3 -3
  83. package/static/dashboard/assets/{widget-signin-BOUMPGXt.js → widget-signin-DXyh_-_V.js} +1 -1
  84. package/static/dashboard/assets/you-DSHNqgeU.js +1 -0
  85. package/static/dashboard/assets/{zod-DfHlfdUJ.js → zod-dogyqr67.js} +1 -1
  86. package/static/dashboard/index.html +2 -2
  87. package/static/widget/build.json +2 -2
  88. package/static/widget/snag.js +1 -1
  89. package/static/widget/snag.runtime.js +2 -2
  90. package/static/dashboard/assets/InstanceRows-B1z-L92-.js +0 -1
  91. package/static/dashboard/assets/_app-B_DiSFIt.js +0 -61
  92. package/static/dashboard/assets/activity-CzEy_J8-.js +0 -1
  93. package/static/dashboard/assets/index-CoiIx5MR.css +0 -1
  94. package/static/dashboard/assets/invite-9eotNL9V.js +0 -1
  95. package/static/dashboard/assets/labels-DLMjYGNJ.js +0 -1
  96. package/static/dashboard/assets/reset-8K76tpdp.js +0 -1
  97. package/static/dashboard/assets/s._site-egkPDOj9.js +0 -1
  98. package/static/dashboard/assets/s._site.reviewers-CGKj-NQo.js +0 -1
  99. package/static/dashboard/assets/s._site.settings-DvWbfMac.js +0 -1
  100. package/static/dashboard/assets/sites-CkGgns1o.js +0 -1
  101. package/static/dashboard/assets/studio-CG1QMBSK.js +0 -1
  102. package/static/dashboard/assets/studio.index-BOkmM7I5.js +0 -1
  103. package/static/dashboard/assets/studio.integrations-BBik3DdK.js +0 -1
  104. package/static/dashboard/assets/studio.plan-CkOzUaJM.js +0 -1
  105. package/static/dashboard/assets/useQuery-D-9vXtOo.js +0 -1
  106. package/static/dashboard/assets/useRender-BBzDGtxq.js +0 -1
  107. package/static/dashboard/assets/you-DH4QMiND.js +0 -1
@@ -0,0 +1 @@
1
+ import{aU as A,r as f,j as e,B as g,aV as S,q as E,h as I,aW as F,A as N,a2 as L,D as M,F as y}from"./index-CHi2CcHb.js";import{u as C}from"./useQuery-U2FOgJPB.js";import{u as P,a as U}from"./zod-dogyqr67.js";import{C as R}from"./card-B5svGaqA.js";import{X as $,E as B,G as H,I as z,H as V,J as q,K}from"./dialog-qbXy4GE2.js";import{L as k,I as Y}from"./label-Dff2Zjcb.js";import{T as G,a as J,b as T,c as p,d as O,e as j}from"./table-HuNaCQBJ.js";import{C as Q}from"./ConfirmDialog-CLal40kk.js";import{C as W}from"./CopyButton-D_EAOrl1.js";import{P as X,E as Z}from"./parts-CK9SS76R.js";import{b as D}from"./labels--UUyt9uB.js";import{u as _}from"./me-XTwFHhR6.js";import{C as ee}from"./check-C21x2mpF.js";import{U as se}from"./users--4QPa7AS.js";import{P as te}from"./plus-4APMJ4TC.js";import"./useBaseQuery-DI4GfUK8.js";import"./copy-Bik19B-3.js";function ke(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),i=C(N.links(s)),c=C(N.origins(s)),[m,o]=f.useState(!1),[n,t]=f.useState(null);f.useEffect(()=>t(null),[s]);const a=i.data?.data??[],x=c.data?.origins[0]?.replace(/\/+$/,"")??"",r=n?`${x}/${n.fragment}`:"",v=e.jsxs(g,{onClick:()=>o(!0),children:[e.jsx(te,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),n&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(ee,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[n.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:r}),e.jsx(W,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>t(null),children:e.jsx($,{})})]}),i.isSuccess&&a.length===0?e.jsx(R,{className:"max-w-[1040px]",children:e.jsx(Z,{icon:e.jsx(se,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(R,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(G,{children:[e.jsx(J,{children:e.jsxs(T,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(O,{children:a.map(u=>e.jsx(ne,{link:u,uid:s,onRevoked:()=>t(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(re,{uid:s,open:m,onOpenChange:o,onMinted:t})]})}function ne({link:s,uid:l,onRevoked:i}){const c=S(l),m=E(_().user.role,"settings"),[o,n]=f.useState(!1),t=!!s.revokedAt,a=!t&&new Date(s.expiresAt).getTime()<=Date.now(),x=t||a,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(T,{className:I(x&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",D(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",r," day",r===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?D(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&m&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(Q,{open:o,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:c.isPending,onConfirm:()=>{n(!1),i(),c.mutate(s.id)}})]})]})}const ae=M({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function re({uid:s,open:l,onOpenChange:i,onMinted:c}){const m=F(s),o=C({...N.rounds(s),enabled:l}),[n,t]=f.useState(""),{register:a,handleSubmit:x,formState:r,reset:v}=P({resolver:U(ae),defaultValues:{days:"14",roundId:""}}),u=x(async d=>{t("");const b=Number(d.days);try{const w=await m.mutateAsync({name:d.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...d.roundId?{roundId:d.roundId}:{}});c(w),v(),i(!1)}catch(w){t(L(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx(B,{open:l,onOpenChange:i,children:e.jsx(H,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(z,{children:[e.jsx(V,{children:"New reviewer"}),e.jsx(q,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Y,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!r.errors.name,...a("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...a("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),o.data&&o.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...a("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),o.data.data.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id))]})]}),e.jsxs(K,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:r.isSubmitting,children:r.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{ke as component};
@@ -0,0 +1 @@
1
+ import{r as l,i as Fe,ak as de,ab as Me,e as ue,ac as Ye,E as me,k as he,j as e,al as Ue,f as Q,aa as je,aY as Qe,h as pe,q as ge,aZ as Je,a_ as Xe,B as T,A as Te,a$ as Ze,b0 as et,b1 as tt,p as st,b2 as nt}from"./index-CHi2CcHb.js";import{u as Le}from"./useQuery-U2FOgJPB.js";import{q as Ve,h as Ke,p as He,u as $e,j as at,c as it,n as ot,g as Re,f as rt,k as dt,l as lt,a as ct,I as ae,L as q}from"./label-Dff2Zjcb.js";import{a2 as ut,Q as mt,S as ft,N as ht,A as pt,aN as Ce,aI as we,aC as le,ay as ce,aO as ke,aP as Ie,a3 as gt,aQ as Ne,az as xt,aA as bt,aR as Se,aS as Ee,aT as Pe,aU as Ae,aV as vt,aW as yt,X as jt}from"./dialog-qbXy4GE2.js";import{u as Rt,C as Ct}from"./CompositeList-DrnyFTB0.js";import{s as wt,i as kt}from"./serializeValue-DRMAHja_.js";import{u as It}from"./useValueChanged-RTamjQR3.js";import{C as Nt}from"./CompositeItem-DqkA27tC.js";import{u as St}from"./FieldItemContext-Dvh77l6C.js";import{u as Et}from"./useAriaLabelledBy-B3107P7l.js";import{C as Be}from"./ConfirmDialog-CLal40kk.js";import{C as Pt}from"./CopyButton-D_EAOrl1.js";import{I as At}from"./InstallTag-Cld-E0Bc.js";import{B as Dt}from"./badge-DBzqpvfR.js";import{a as ee,A as Ot,P as Ft}from"./parts-CK9SS76R.js";import{u as xe}from"./me-XTwFHhR6.js";import{S as De}from"./switch-b0ERMUSk.js";import{S as Mt}from"./SaveState-BiYh2KgZ.js";import{P as Tt}from"./plus-4APMJ4TC.js";import"./useBaseQuery-DI4GfUK8.js";import"./check-C21x2mpF.js";import"./copy-Bik19B-3.js";import"./useRender-B8Yivtih.js";import"./card-B5svGaqA.js";import"./labels--UUyt9uB.js";const Lt=l.createContext(void 0);function Vt(s=!1){const t=l.useContext(Lt);if(!t&&!s)throw new Error(Fe(86));return t}function Kt(s,t){return s.matches(":disabled")?!1:!t||s.form===t?!0:s.form===null&&!s.hasAttribute("form")}const fe={checked(s){return s?{"data-checked":""}:{"data-unchecked":""}},...ut,...Ve},ze="data-composite-item-active",Ge=l.createContext(void 0);function Ht(){return l.useContext(Ge)}const We=l.createContext(void 0);function $t(){const s=l.useContext(We);if(s===void 0)throw new Error(Fe(52));return s}const Bt=l.forwardRef(function(t,n){const{render:d,className:a,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:o,inputRef:L,nativeButton:h=!1,id:O,style:y,...j}=t,w=Ht(),{disabled:E,readOnly:_,required:b,form:$,checkedValue:R,touched:F=!1,validation:B,name:k,setCheckedValue:W=de,setTouched:Y=de,registerInputRef:i=de}=w??{},{setTouched:g,setFilled:v,state:I,disabled:P}=Ke(),A=St(),{labelId:K,getDescriptionProps:J}=He(),m=P||A.disabled||E||c,f=_||r,V=b||p,H=$,N=w?R===o:o==="",M=l.useRef(null),S=l.useRef(null),z=B?.registerInput,G=l.useCallback(C=>z?.(C,{controlRef:M,value:void 0}),[z]),X=Me(L,S,i,G);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){i(null);return}i(S.current)}},[N,m,i]);const te=$e(),se=at({id:O,implicit:!1,controlRef:M}),ne=h?void 0:se,ie=Et(x,K,S,!h,ne),oe={role:"radio","aria-checked":N,"aria-labelledby":ie,[ze]:N?"":void 0,id:h?se:te,onKeyDown(C){C.key==="Enter"&&C.preventDefault()},onClick(C){if(C.defaultPrevented||m||f)return;C.preventDefault();const Z=S.current;Z&&Ue(Z,C)},onFocus(C){C.defaultPrevented||m||f||!F||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=Ye({disabled:m,native:h,composite:!1}),D={type:"radio",ref:X,form:H,id:ne,name:k,tabIndex:-1,style:k?mt:ft,"aria-hidden":!0,...o!==void 0?{value:wt(o)}:me,disabled:m,checked:N,required:V,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||o===void 0)return;const Z=it(ot,C.nativeEvent);W(o,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){M.current?.focus()}},U=l.useMemo(()=>({...I,required:V,disabled:m,readOnly:f,checked:N}),[I,m,f,N,V]),qe=U,be=w!==void 0,ve=[n,M,u],ye=[oe,j,re,J,B?C=>B.getValidationProps(m,C):me],_e=he("span",t,{enabled:!be,state:U,ref:ve,props:ye,stateAttributesMapping:fe});return e.jsxs(We.Provider,{value:qe,children:[be?e.jsx(Nt,{tag:"span",render:d,className:a,style:y,state:U,refs:ve,props:ye,stateAttributesMapping:fe}):_e,e.jsx("input",{...D,suppressHydrationWarning:!0})]})}),zt=l.forwardRef(function(t,n){const{render:d,className:a,style:c,keepMounted:r=!1,...p}=t,x=$t(),o=x.checked,{mounted:L,transitionStatus:h,setMounted:O}=ht(o),y={...x,transitionStatus:h},j=l.useRef(null),w=r||L,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return pt({open:o,ref:j,onComplete(){o||O(!1)}}),w?E:null}),Gt=[];function Wt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:a,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:o=!1,stopEventPropagation:L,disabledIndices:h,modifierKeys:O=Gt}=s,[y,j]=l.useState(0),w=d!=null,E=l.useRef(null),_=Me(E,x),b=l.useRef([]),$=l.useRef(!1),R=r??y,F=Q((i,g=!1)=>{if((p??j)(i),g){const v=b.current[i];Ce(E.current,v,c,n)}}),B=Q(i=>{if(i.size===0||$.current)return;$.current=!0;const g=Array.from(i.keys()),v=g.find(P=>P?.hasAttribute(ze))??null,I=v?i.get(v)?.index??-1:-1;if(I!==-1)F(I);else if(we(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||F(P)}Ce(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!$.current)return;const i=b.current;if(we(i,R,h)){const g=le(i,{disabledIndices:h});ce(i,g)||F(g)}},[h,r,R,b,F]);const k=Q((i,g,v)=>a?a(i,g,v,b):v),W=Q(i=>{const g=i.key===ke||i.key===Ie;if(!gt.has(i.key)||!o&&g||qt(i,O)||!E.current)return;const I=c==="rtl",P=I?Pe:Ae,A=I?Ae:Pe,K=n==="vertical"?Se:P,J=n==="vertical"?Ee:A,m=Re(i.nativeEvent);if(m!=null&&Ne(m)&&!kt(m)){const S=m.selectionStart,z=m.selectionEnd,G=m.value;if(S==null||i.shiftKey||S!==z||i.key!==J&&S<G.length||i.key!==K&&S>0)return}let f=R;const V=xt(b,h),H=bt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:i,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:V,onLoop:k,orientation:n,rtl:I}));const N=n!=="vertical"&&i.key===P||n!=="horizontal"&&i.key===Se,M=n!=="vertical"&&i.key===A||n!=="horizontal"&&i.key===Ee;o&&(i.key===ke?f=V:i.key===Ie&&(f=H)),f===R&&(N||M)&&(t&&f===H&&N?(f=V,a&&(f=a(i,R,f,b))):t&&f===V&&M?(f=H,a&&(f=a(i,R,f,b))):f=le(b.current,{startingIndex:f,decrement:M,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(L&&i.stopPropagation(),(w||g||N||M)&&i.preventDefault(),F(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(i){const g=E.current,v=Re(i.nativeEvent);!g||v==null||!Ne(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:W},highlightedIndex:R,onHighlightedIndexChange:F,elementsRef:b,onMapChange:B,relayKeyboardEvent:W}}function qt(s,t){for(const n of vt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function _t(s){const{render:t,className:n,style:d,refs:a=je,props:c=je,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:o,orientation:L,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:w,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:$,highlightItemOnHover:R=!1,tag:F="div",...B}=s,k=Rt(),{props:W,highlightedIndex:Y,onHighlightedIndexChange:i,elementsRef:g,onMapChange:v,relayKeyboardEvent:I}=Wt({grid:h,loopFocus:O,onLoop:y,orientation:L,highlightedIndex:x,onHighlightedIndexChange:o,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:k,disabledIndices:b,modifierKeys:$}),P=he(F,s,{state:r,ref:a,props:[W,...c,B],stateAttributesMapping:p}),A=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:i,highlightItemOnHover:R,relayKeyboardEvent:I}),[Y,i,R,I]);return e.jsx(Qe.Provider,{value:A,children:e.jsx(Ct,{elementsRef:g,onMapChange:K=>{w?.(K),v(K)},children:P})})}const Yt=[yt],Ut=l.forwardRef(function(t,n){const{render:d,className:a,disabled:c,readOnly:r,required:p,onValueChange:x,value:o,defaultValue:L,form:h,name:O,inputRef:y,id:j,style:w,...E}=t,{setTouched:_,setFocused:b,validationMode:$,name:R,disabled:F,state:B,validation:k,setDirty:W,setFilled:Y,validityData:i}=Ke(),{labelId:g}=He(),{clearErrors:v,elementRef:I}=rt(),P=Vt(!0),A=F||c,K=R??O,J=$e(j),[m,f]=dt({controlled:o,default:L,name:"RadioGroup",state:"value"}),[V,H]=l.useState(!1),N=Q((u,D)=>{x?.(u,D),!D.isCanceled&&f(u)}),M=k.getInputControl,S=l.useMemo(()=>({get current(){return M()}}),[M]),z=l.useRef(null),G=l.useRef(null);function X(u){let D;return y&&(typeof y=="function"?D=y(u):y.current=u),z.current=u,D}const te=Q(u=>{if(!u||u.disabled)return;G.current||(G.current=u);const D=z.current,U=u.checked||D==null||D.disabled?X(u):void 0;return()=>{G.current===u&&(G.current=null),z.current===u?U?(U(),z.current=null):X(null):U?.()}}),se=Q(()=>{const u=I.current;if(!u)return m??null;for(const D of k.registeredInputs.keys())if(D.checked&&Kt(D,u))return m??null;return null});lt(S,J,m??null,se,!A,O),It(m,()=>{v(K),W(m!==i.initialValue),Y(m!=null),k.change(m);const u=G.current;m==null&&u&&!u.disabled&&X(u)});const ne=g??P?.legendId,ie={...B,disabled:A??!1,required:p??!1,readOnly:r??!1},oe=l.useMemo(()=>({checkedValue:m,disabled:A,form:h,validation:k,name:K,readOnly:r,registerInputRef:te,required:p,setCheckedValue:N,setTouched:H,touched:V}),[m,A,h,k,K,r,te,p,N,H,V]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":A||void 0,"aria-readonly":r||void 0,"aria-labelledby":ne,onFocus(){b(!0)},onBlur(u){ct(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),$==="onBlur"&&k.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(Ge.Provider,{value:oe,children:e.jsx(_t,{render:d,className:a,style:w,state:ie,props:[re,E,u=>k.getValidationProps(A??!1,u)],refs:[n],stateAttributesMapping:Ve,enableHomeAndEndKeys:!1,modifierKeys:Yt})})});function Qt({className:s,...t}){return e.jsx(Ut,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Jt({className:s,...t}){return e.jsx(Bt,{"data-slot":"radio-group-item",className:pe("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(zt,{"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 Xt({uid:s}){const t=xe(),n=Le(Te.rounds(s)),d=ge(t.user.role,"settings"),a=n.data?.data??[],c=a.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ee,{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:[!d&&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:[a.map(r=>e.jsx(Zt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&a.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:"No rounds yet."})]})]})}const Oe="Open another round first — new comments need somewhere to go.";function Zt({uid:s,round:t,manager:n,last:d}){const a=Je(s),c=Xe(s),[r,p]=l.useState(!1),[x,o]=l.useState(t.name),[L,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=a.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:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const w=x.trim();if(!w||w===t.name)return p(!1);a.mutate({id:t.id,name:w},{onSuccess:()=>p(!1)})},children:[e.jsx(ae,{"aria-label":`New name for ${t.name}`,value:x,maxLength:80,autoFocus:!0,onChange:j=>o(j.target.value),onKeyDown:j=>j.key==="Escape"&&p(!1)}),e.jsx(T,{type:"submit",size:"sm",disabled:!x.trim()||a.isPending,children:"Save"}),e.jsx(T,{type:"button",size:"sm",variant:"ghost",onClick:()=>p(!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(Dt,{variant:"outline",className:"text-[11px]",children:O})]}),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&&!r&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1",title:d?Oe:void 0,children:[e.jsx(T,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{o(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(T,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>a.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(T,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>a.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(T,{size:"sm",variant:"ghost",className:"text-destructive","aria-label":`Delete ${t.name}`,disabled:y||d,onClick:()=>h(!0),children:"Delete…"})]}),n&&d&&!r&&e.jsx("p",{className:"m-0 w-full text-[12px] text-muted-foreground",children:Oe}),e.jsx(Be,{open:L,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 es=[{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 ts(){const{site:s}=Ze.useParams(),t=xe(),n=t.projects.find(o=>o.uid===s),d=ge(t.user.role,"settings"),a=Le(Te.origins(s)),c=et(s),[r,p]=l.useState(null),x=o=>c.mutate(o,{onSuccess:()=>p(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(Ft,{title:"Settings",sub:n.name,actions:e.jsx(Mt,{saving:c.isPending,savedAt:r})}),e.jsxs(ee,{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(q,{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(Pt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(ss,{name:n.name,onSave:o=>x({name:o})}),e.jsx(ns,{domain:a.data?.domain??null,loaded:a.isSuccess,onSave:o=>x({domain:o})}),e.jsx(as,{list:a.data?.origins??[],loaded:a.isSuccess,hasDomain:!!a.data?.domain,onChange:o=>x({origins:o})})]}),e.jsxs(ee,{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(q,{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(De,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:o=>x({status:o?"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(q,{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.",!d&&" Only an owner or an admin can change this."]})]}),e.jsx(De,{id:"guests-status","aria-label":"Guests can change status",checked:n.guestsCanChangeStatus!==!1,disabled:!d,onCheckedChange:o=>x({guestsCanChangeStatus:o})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{children:"Who can comment"}),e.jsx(Qt,{value:n.writeMode,onValueChange:o=>x({writeMode:String(o)}),className:"gap-2",children:es.map(o=>e.jsxs("label",{className:pe("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===o.id&&"border-brand bg-brand-soft"),children:[e.jsx(Jt,{value:o.id,className:"mt-0.5","aria-label":o.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:o.note})]})]},o.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{children:"The tag"}),e.jsx(At,{uid:n.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx(Xt,{uid:s}),e.jsx(is,{uid:s,name:n.name,archived:!!n.archived,locked:!!n.locked}),e.jsx(os,{uid:s,name:n.name})]})}function ss({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const a=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),a&&t(n.trim())},children:[e.jsx(q,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-name",value:n,onChange:c=>d(c.target.value)}),a&&e.jsx(T,{type:"submit",variant:"outline",children:"Save"})]})]})}function ns({domain:s,loaded:t,onSave:n}){const[d,a]=l.useState(s??"");l.useEffect(()=>a(s??""),[s]);const c=d.trim()!==(s??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:r=>{r.preventDefault(),c&&n(d.trim()||null)},children:[e.jsx(q,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ae,{id:"site-domain",placeholder:"kilnwork.studio",value:d,onChange:r=>a(r.target.value),disabled:!t}),c&&e.jsx(T,{type:"submit",variant:"outline",children:d.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 as({list:s,loaded:t,hasDomain:n,onChange:d}){const[a,c]=l.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(q,{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(r=>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:r}),e.jsx(T,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r}`,disabled:s.length<=1&&!n,onClick:()=>d(s.filter(p=>p!==r)),children:e.jsx(jt,{})})]},r)),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:r=>{r.preventDefault();const p=a.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:a,onChange:r=>c(r.target.value)}),e.jsxs(T,{type:"submit",variant:"outline",disabled:!a.trim(),children:[e.jsx(Tt,{}),"Add"]})]})]})}function is({uid:s,name:t,archived:n,locked:d}){const a=tt(s);return e.jsx(ee,{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.`:d?`${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(T,{type:"button",variant:"outline",loading:a.isPending,onClick:()=>a.mutate(n?"restore":"archive"),children:n?`Restore ${t}`:`Archive ${t}`})]})})}function os({uid:s,name:t}){const[n,d]=l.useState(!1),a=st(),c=nt(s);return e.jsxs(ee,{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."]}),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(T,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(Be,{open:n,onOpenChange:d,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.",confirmLabel:"Delete",confirmWord:t,busy:c.isPending,onConfirm:()=>c.mutate(void 0,{onSuccess:()=>{d(!1),a({to:"/sites"})}})})]})}const Ds=()=>ge(xe().user.role,"settings")?e.jsx(ts,{}):e.jsx(Ot,{title:"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{Ds as component};
@@ -1 +1 @@
1
- import{Q as x,p as h,r as g,s as f,y as j,F as N,A as w,j as e,G as b,B as y,C as S,D as r}from"./index-p-qD6BlY.js";import{u as v,a as A}from"./zod-DfHlfdUJ.js";import{L as i,I as o}from"./label-CuvYMIVd.js";const F=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:A(F)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
1
+ import{T as x,p as h,r as g,s as f,z as j,J as N,C as w,j as e,G as b,B as y,D as S,F as r}from"./index-CHi2CcHb.js";import{u as v,a as F}from"./zod-dogyqr67.js";import{L as i,I as o}from"./label-Dff2Zjcb.js";const A=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:d}=x.useSearch(),c=h(),[l,n]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:F(A)}),u=p(async t=>{n("");try{await f.setup({token:d??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),c({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("fieldset",{disabled:s.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!s.errors.email,...a("email")}),s.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:s.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!s.errors.password,...a("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...a("orgName")})]}),e.jsx(y,{type:"submit",size:"lg",loading:s.isSubmitting,children:s.isSubmitting?"Setting up…":"Create my account"})]})]})})}export{E as component};
@@ -1 +1 @@
1
- import{T as N,p as y,r as l,z as m,s as S,y as C,A as k,j as e,G as F,B as E,L as c,h as L,C as R,D as u}from"./index-p-qD6BlY.js";import{u as x}from"./useQuery-D-9vXtOo.js";import{u as z,a as A}from"./zod-DfHlfdUJ.js";import{L as p,I as h}from"./label-CuvYMIVd.js";import{C as I}from"./chevron-right-BQmYcugl.js";import"./useBaseQuery-DaFWLbWu.js";const T=R({email:u().trim().min(1,"Your email"),password:u().min(1,"Your password")});function P(){const{redirect:f}=N.useSearch(),a=y(),[o,i]=l.useState(""),[s,g]=l.useState(!1),{register:n,handleSubmit:j,formState:r}=z({resolver:A(T)});x({...m.claimed(),enabled:!0}).data===!1&&a({to:"/setup",replace:!0});const t=x(m.setupState()),b=j(async({email:v,password:w})=>{i("");try{await S.login(v,w),C("in"),a({to:f??"/sites",replace:!0})}catch(d){i(d instanceof k?d.message:"Could not reach the server.")}});return e.jsx(F,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...n("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...n("password")})]}),e.jsx(E,{type:"submit",size:"lg",loading:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),t.data?.mail?e.jsx("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:e.jsx(c,{to:"/forgot",className:"text-foreground underline underline-offset-4",children:"Forgot your password?"})}):e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>g(!s),children:[e.jsx(I,{className:L("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),t.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",t.data.signupUrl?e.jsx("a",{href:t.data.signupUrl,className:"text-foreground underline underline-offset-4",children:"Create a studio"}):e.jsx(c,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&!t.data?.mail&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"This instance has no mail set up, so there's no reset email — and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{P as component};
1
+ import{U as N,p as y,r as l,A as m,s as S,z as C,C as F,j as e,G as k,B as E,L as c,h as L,D as R,F as u}from"./index-CHi2CcHb.js";import{u as x}from"./useQuery-U2FOgJPB.js";import{u as z,a as A}from"./zod-dogyqr67.js";import{L as p,I as h}from"./label-Dff2Zjcb.js";import{C as I}from"./chevron-right-ZLZCd12m.js";import"./useBaseQuery-DI4GfUK8.js";const U=R({email:u().trim().min(1,"Your email"),password:u().min(1,"Your password")});function P(){const{redirect:f}=N.useSearch(),a=y(),[o,i]=l.useState(""),[s,g]=l.useState(!1),{register:n,handleSubmit:j,formState:r}=z({resolver:A(U)});x({...m.claimed(),enabled:!0}).data===!1&&a({to:"/setup",replace:!0});const t=x(m.setupState()),b=j(async({email:v,password:w})=>{i("");try{await S.login(v,w),C("in"),a({to:f??"/sites",replace:!0})}catch(d){i(d instanceof F?d.message:"Could not reach the server.")}});return e.jsx(k,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsx(h,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!r.errors.email,...n("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!r.errors.password,...n("password")})]}),e.jsx(E,{type:"submit",size:"lg",loading:r.isSubmitting,children:r.isSubmitting?"Signing in…":"Sign in"}),t.data?.mail?e.jsx("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:e.jsx(c,{to:"/forgot",className:"text-foreground underline underline-offset-4",children:"Forgot your password?"})}):e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>g(!s),children:[e.jsx(I,{className:L("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),t.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",t.data.signupUrl?e.jsx("a",{href:t.data.signupUrl,className:"text-foreground underline underline-offset-4",children:"Create a studio"}):e.jsx(c,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&!t.data?.mail&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"This instance has no mail set up, so there's no reset email — and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{P as component};
@@ -1 +1 @@
1
- import{p,r as u,s as h,y as g,F as f,A as j,j as e,G as N,B as w,L as y,C as v,D as t}from"./index-p-qD6BlY.js";import{u as b,a as S}from"./zod-DfHlfdUJ.js";import{L as i,I as o}from"./label-CuvYMIVd.js";const A=v({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(A)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(y,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
1
+ import{p,r as u,s as h,z as g,J as f,C as j,j as e,G as N,B as w,L as v,D as y,F as t}from"./index-CHi2CcHb.js";import{u as b,a as S}from"./zod-dogyqr67.js";import{L as i,I as o}from"./label-Dff2Zjcb.js";const C=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(C)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"email",children:"Your email"}),e.jsx(o,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(i,{htmlFor:"password",children:"Password"}),e.jsx(o,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(i,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(o,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
@@ -0,0 +1 @@
1
+ import{q as w,a1 as y,r as p,j as e,B as m,L as N,p as A,d as S,s as $,C as k,D as C,F as g}from"./index-CHi2CcHb.js";import{u as E,a as _}from"./zod-dogyqr67.js";import{C as D}from"./card-B5svGaqA.js";import{E as F,G as I,I as L,H as P,J as T,K as z}from"./dialog-qbXy4GE2.js";import{L as f,I as j}from"./label-Dff2Zjcb.js";import{P as q,E as H}from"./parts-CK9SS76R.js";import{b as K}from"./labels--UUyt9uB.js";import{u as R}from"./me-XTwFHhR6.js";import{P as b}from"./plus-4APMJ4TC.js";import{L as B}from"./layout-grid-C3Koxvvp.js";import{I as G}from"./image-off-DkzQHm8a.js";import"./useBaseQuery-DI4GfUK8.js";function ae(){const s=R(),i=w(s.user.role,"settings"),{add:d}=y.useSearch(),[x,n]=p.useState(!!d&&i);p.useEffect(()=>{d&&i&&n(!0)},[d,i]);const a=s.projects.filter(r=>!r.archived),l=s.projects.filter(r=>r.archived),h=a.reduce((r,o)=>r+o.unresolved,0),t=s.limits.projects.limit,c=t!==null&&a.length>=t,u=t!==null&&a.length>t;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:a.length?`${a.length}${t!==null?` of ${t}`:""} site${a.length===1&&t===null?"":"s"} · ${h} open`:t!==null?`0 of ${t} sites`:void 0,actions:i?e.jsxs(m,{onClick:()=>n(!0),disabled:c,title:c?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(b,{}),"Add a site"]}):void 0}),u&&e.jsxs("div",{role:"status",className:"mb-5 max-w-[1100px] rounded-md border border-border bg-warn-soft px-4 py-3 text-[13px]",children:["This studio has ",a.length," sites and its plan includes ",t,". The newest ",a.length-t," ",a.length-t===1?"is":"are"," ","read-only: comments can be read, nothing new comes in."," ",i?"Archive a site you have finished with, or move to a plan with more.":"An owner or an admin can archive a site or change the plan."]}),a.length===0?e.jsx(D,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(B,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(b,{}),"Add a site"]}):void 0,children:i?"A site is one client website. Add it, paste the tag, and comments start arriving here.":"A site is one client website. An owner or an admin adds it, and its comments appear here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:a.map(r=>e.jsx(v,{p:r},r.uid))}),l.length>0&&e.jsxs("section",{className:"mt-10 max-w-[1100px]","aria-labelledby":"archived-sites",children:[e.jsx("h2",{id:"archived-sites",className:"m-0 mb-1 text-[14px] font-semibold",children:"Archived"}),e.jsx("p",{className:"m-0 mb-4 text-[12.5px] text-muted-foreground",children:"Finished or put away. Every comment is kept and can be read; nothing new comes in, and they do not count toward the plan."}),e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:l.map(r=>e.jsx(v,{p:r},r.uid))})]}),e.jsx(U,{open:x,onOpenChange:n})]})}function v({p:s}){const i=s.archived?"Archived":s.locked?"Read-only":s.status==="paused"?"Paused":null;return e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:`flex h-[150px] items-center justify-center border-b border-border bg-background${s.archived?" opacity-70 grayscale":""}`,children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(G,{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?` · ${K(s.lastActivityAt)}`:""}`})]})]})}const Q=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function U({open:s,onOpenChange:i}){const d=A(),x=S(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=E({resolver:_(Q)}),u=h(async r=>{a("");try{const o=await $.createProject(r.name,"",r.domain);await x.invalidateQueries({queryKey:["me"]}),c(),i(!1),d({to:"/s/$site/comments",params:{site:o.uid}})}catch(o){a(o instanceof k?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(I,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(L,{children:[e.jsx(P,{children:"Add a site"}),e.jsx(T,{children:"One client website. The tag it needs is shown right after."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!t.errors.name,...l("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!t.errors.domain,...l("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(m,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(m,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add site"})]})]})})})}export{ae as component};
@@ -1 +1 @@
1
- import{d as o,z as s,a4 as u,s as i,a5 as y,a1 as c}from"./index-p-qD6BlY.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
1
+ import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-CHi2CcHb.js";function Q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,org:{...r.org,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function q(){const e=o(),t=s.me().queryKey;return u({mutationFn:a=>i.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,user:{...r.user,name:a}}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:t}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>i.changePassword(e.current,e.next)})}function l(){const e=o();return u({mutationFn:t=>i.createInvite(t),onSuccess:()=>void e.invalidateQueries({queryKey:s.invites().queryKey})})}function w(){const e=o(),t=s.invites().queryKey;return u({mutationFn:a=>i.revokeInvite(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{...r,data:r.data.filter(n=>n.id!==a)}),{was:r}},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:t})})}function v(){return u({mutationFn:e=>i.sendInvite(e.id,e.token)})}function K(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.setMemberRole(a.email,a.role),onMutate:async({email:a,role:r})=>{await e.cancelQueries({queryKey:t});const n=e.getQueryData(t);return n&&e.setQueryData(t,{data:n.data.map(m=>m.email===a?{...m,role:r}:m)}),{was:n}},onSuccess:(a,{email:r})=>{e.setQueryData(t,a),a.data.find(n=>n.email===r)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}function D(){const e=o(),t=s.members().queryKey;return u({mutationFn:a=>i.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:t});const r=e.getQueryData(t);return r&&e.setQueryData(t,{data:r.data.filter(n=>n.email!==a)}),{was:r}},onSuccess:a=>e.setQueryData(t,a),onError:(a,r,n)=>{n?.was&&e.setQueryData(t,n.was),y.error(c(a))}})}export{f as a,Q as b,K as c,D as d,w as e,l as f,v as g,q as u};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-CHi2CcHb.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{q as N,j as e,w as k,a4 as w,r as d,B as p,S as A,d as C,a5 as F,a2 as E,A as m,a6 as R,s as D}from"./index-CHi2CcHb.js";import{u as h}from"./useQuery-U2FOgJPB.js";import{L as O,I as v}from"./label-Dff2Zjcb.js";import{I as P,S as q}from"./InstanceRows-DexbQngM.js";import{A as z,P as G,a as g}from"./parts-CK9SS76R.js";import{u as S}from"./me-XTwFHhR6.js";import{S as I}from"./SaveState-BiYh2KgZ.js";import{b as L}from"./studio-BtXg0XzE.js";import{c as T}from"./update-duXzIzFS.js";import"./useBaseQuery-DI4GfUK8.js";import"./dialog-qbXy4GE2.js";import"./ConfirmDialog-CLal40kk.js";import"./labels--UUyt9uB.js";import"./card-B5svGaqA.js";function U(){const s=S(),t=h(m.meta()),i=h(m.members()),r=L(),n=N(s.user.role,"studio"),u=k(s),c=w(s),o=!h(m.setupState()).data?.billingUrl,[l,a]=d.useState(s.org.name),[b,y]=d.useState(null);d.useEffect(()=>a(s.org.name),[s.org.name]);const j=n&&l.trim().length>0&&l.trim()!==s.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:s.org.name,actions:e.jsx(I,{saving:r.isPending,savedAt:b})}),e.jsx(g,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:f=>{f.preventDefault(),j&&r.mutate(l.trim(),{onSuccess:()=>y(Date.now())})},children:[e.jsx(O,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{id:"studio-name",value:l,readOnly:!n,onChange:f=>a(f.target.value)}),j&&e.jsx(p,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:n?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(g,{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:[t.data?.version??"—"," ",e.jsx(_,{version:t.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(B,{owner:n})}),t.data?.commit&&t.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:[t.data.commit.slice(0,12),t.data.modified?" · modified":""]})]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[s.projects.length," · ",i.data?.data.length??"—"]})]})]})}):o?e.jsx(g,{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:s.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:i.data?.data.length??"—"})]})}):null,c==="instance"?e.jsx(P,{owner:n}):c==="usage"?e.jsx(q,{}):null]})}function _({version:s}){const[t,i]=d.useState({s:"idle"});return t.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),T(s).then(r=>i({s:"done",r})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):t.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," checking…"]}):t.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:t.r?.newer?`· ${t.r.latest} is out`:"· up to date"})}function B({owner:s}){const t=C(),i=h(m.instance()),[r,n]=d.useState(null),[u,c]=d.useState(""),x=F({mutationFn:a=>D.setAddress(a),onSuccess:a=>{t.setQueryData(m.instance().queryKey,a),n(null),c(""),R.success("Address saved — every new link is built from it")},onError:a=>c(E(a))}),o=i.data?.address;if(!o)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const l=o.source==="env";return r===null||!s||l?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:o.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:l?"· set by the environment (SNAGSET_BASE_URL)":o.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),s&&!l&&e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>n(o.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(r.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(v,{"aria-label":"Address",value:r,onChange:a=>n(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(p,{type:"submit",size:"sm",loading:x.isPending,disabled:!r.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(p,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(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 ae=()=>N(S().user.role,"settings")?e.jsx(U,{}):e.jsx(z,{title:"General"});export{ae as component};
@@ -0,0 +1 @@
1
+ import{q as U,j as e,L as ee,w as te,d as se,r as a,a5 as F,a6 as I,a2 as M,s as T,a7 as D,$ as ne,B as y,C as K,A as oe}from"./index-CHi2CcHb.js";import{u as q}from"./useQuery-U2FOgJPB.js";import{B as _}from"./badge-DBzqpvfR.js";import{E,G as O,I as W,H as R,J,K as H}from"./dialog-qbXy4GE2.js";import{L as C,I as A}from"./label-Dff2Zjcb.js";import{C as ae}from"./ConfirmDialog-CLal40kk.js";import{A as re,P as ie,a as ce}from"./parts-CK9SS76R.js";import{u as z}from"./me-XTwFHhR6.js";import{C as B}from"./CopyButton-D_EAOrl1.js";import{b as le}from"./labels--UUyt9uB.js";import{M as de}from"./McpTokens-CIjBwfT0.js";import"./useBaseQuery-DI4GfUK8.js";import"./useRender-B8Yivtih.js";import"./card-B5svGaqA.js";import"./check-C21x2mpF.js";import"./copy-Bik19B-3.js";import"./switch-b0ERMUSk.js";import"./useAriaLabelledBy-B3107P7l.js";import"./useValueChanged-RTamjQR3.js";const he={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function me(){const o=z(),i=U(o.user.role,"settings"),x=U(o.user.role,"studio")&&te(o),f=q(oe.integrations()),S=se(),w=()=>S.invalidateQueries({queryKey:["integrations"]}),[l,u]=a.useState(null),[r,g]=a.useState(null),[j,m]=a.useState(null),b=F({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},s)=>m({site:s,provider:"github",hook:t,fresh:!1}),onError:t=>I.error(M(t))}),N=F({mutationFn:({uid:t,provider:s})=>T.testTracker(t,s).then(c=>({...c,provider:s})),onSuccess:t=>{I[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),w()},onError:t=>I.error(M(t))}),k=F({mutationFn:({uid:t,provider:s})=>T.disconnectTracker(t,s),onSuccess:()=>{g(null),w()},onError:t=>I.error(M(t))}),v=f.data?.data??[],h=t=>v.filter(s=>s.provider===t),d=t=>o.projects.filter(s=>!h(t).some(c=>c.site===s.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ie,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const s=h(t),c=d(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[f.isPending&&e.jsx(ne,{rows:2}),f.isSuccess&&s.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),s.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:s.map(n=>{const P=he[n.health]??{label:n.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:n.siteName??n.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:n.provider==="github"?`${n.owner}/${n.repo}`:n.provider==="linear"?`${n.teamKey} · ${n.teamName}`:n.provider==="jira"?`${n.projectKey} · ${n.projectName}`:`#${n.channelName} · ${n.teamName}`}),e.jsx(_,{variant:"outline",className:P.tone==="ok"?"border-ok text-ok":P.tone==="bad"?"border-destructive text-destructive":"",children:P.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.provider==="slack"?n.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":n.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",n.provider==="github"&&n.labels.length?` · labels ${n.labels.join(", ")}`:"",n.provider!=="github"&&n.provider!=="slack"&&!n.hasWebhookSecret?` · no webhook secret yet, so ${D[n.provider]} cannot move comments here`:""," · ",le(n.updatedAt)]}),n.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:n.lastError}),i&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[n.provider==="github"?e.jsx(y,{variant:"ghost",size:"sm",loading:b.isPending,onClick:()=>b.mutate(n.site),children:"Webhook…"}):n.provider==="slack"?null:e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>m({site:n.site,provider:n.provider,hook:{url:`${location.origin}/api/v1/integrations/${n.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(y,{variant:"ghost",size:"sm",loading:N.isPending,onClick:()=>N.mutate({uid:n.site,provider:n.provider}),children:"Test"}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>g(n),children:"Disconnect"})]})]},`${n.provider}:${n.site}`)})}),i&&c.length>0&&e.jsx("div",{children:e.jsx(y,{variant:"outline",size:"sm",onClick:()=>u(t),children:"Connect a site…"})})]},t)}),e.jsx(de,{owner:i,instanceOwner:x,sites:o.projects}),e.jsx(ue,{open:l==="github",onOpenChange:t=>!t&&u(null),sites:d("github"),onDone:(t,s)=>{w(),s&&m({site:t,provider:"github",hook:s,fresh:!0})}}),e.jsx(xe,{open:l==="linear",onOpenChange:t=>!t&&u(null),sites:d("linear"),onDone:(t,s)=>{w(),m({site:t,provider:"linear",hook:s,fresh:!0})}}),e.jsx(fe,{open:l==="jira",onOpenChange:t=>!t&&u(null),sites:d("jira"),onDone:(t,s)=>{w(),m({site:t,provider:"jira",hook:s,fresh:!0})}}),e.jsx(ge,{open:l==="slack",onOpenChange:t=>!t&&u(null),sites:d("slack"),onDone:()=>void w()}),e.jsx(pe,{state:j,onClose:()=>m(null),siteName:t=>v.find(s=>s.site===t)?.siteName??"the site"}),e.jsx(ae,{open:r!==null,onOpenChange:t=>!t&&g(null),title:`Disconnect ${r?.siteName??"this site"} from ${r?D[r.provider]:"the tracker"}?`,description:r?.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:k.isPending,onConfirm:async()=>{r&&await k.mutateAsync({uid:r.site,provider:r.provider})}})]})}function ue({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"github",{repository:l.trim(),token:r.trim(),labels:j,createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook&&"secret"in c.webhook?c.webhook:void 0),I.success("GitHub connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),k&&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:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(A,{id:"gh-repo",placeholder:"kilnwork/site",value:l,onChange:s=>u(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(A,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(A,{id:"gh-labels",placeholder:"review, bug",value:j,onChange:s=>m(s.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function pe({state:o,onClose:i,siteName:x}){const f=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(E,{open:o!==null,onOpenChange:S=>!S&&i(),children:e.jsxs(O,{children:[e.jsxs(W,{children:[e.jsx(R,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?x(o.site):"")}),e.jsx(J,{children:o?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":o?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${o?.fresh?"":", and the previous one has stopped working"}.`})]}),o&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:o.hook.url}),e.jsx(B,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(B,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(y,{type:"button",onClick:i,children:"Done"})})]})})}function xe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(!1),[k,v]=a.useState(""),h=F({mutationFn:s=>T.connectTracker(s,"linear",{team:l.trim(),apiKey:r.trim(),...j.trim()?{webhookSecret:j.trim()}:{},createOn:b?"thread.created":"manual"})}),d=S||x[0]?.uid||"",t=async s=>{s.preventDefault(),v("");try{const c=await h.mutateAsync(d);u(""),g(""),m(""),N(!1),i(!1),f(d,c.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),I.success("Linear connected")}catch(c){v(c instanceof K?c.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),k&&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:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:d,onChange:s=>w(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(A,{id:"ln-team",placeholder:"ENG",value:l,onChange:s=>u(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(A,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:r,onChange:s=>g(s.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(A,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:j,onChange:s=>m(s.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:b,onChange:s=>N(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:h.isPending,disabled:!l.trim()||!r.trim()||!d,children:h.isPending?"Checking…":"Connect"})]})]})})})}function fe({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(""),[b,N]=a.useState(""),[k,v]=a.useState(""),[h,d]=a.useState(!1),[t,s]=a.useState(""),c=F({mutationFn:p=>T.connectTracker(p,"jira",{siteUrl:l.trim(),project:r.trim(),email:j.trim(),apiToken:b.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:h?"thread.created":"manual"})}),n=S||x[0]?.uid||"",P=async p=>{p.preventDefault(),s("");try{const L=await c.mutateAsync(n);g(""),N(""),v(""),d(!1),i(!1),f(n,L.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),I.success("Jira connected")}catch(L){s(L instanceof K?L.message:"Could not reach the server.")}},$=(p,L,V,Q,Y,X="text",G)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${p}`,children:L}),e.jsx(A,{id:`jr-${p}`,type:X,placeholder:Y,value:V,onChange:Z=>Q(Z.target.value),autoComplete:"off"}),G&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:G})]});return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:p=>void P(p),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),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(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:n,onChange:p=>w(p.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(p=>e.jsx("option",{value:p.uid,children:p.name},p.uid))})]}),$("url","Jira site",l,u,"https://kilnwork.atlassian.net"),$("project","Project key",r,g,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),$("email","Account email",j,m,"you@kilnwork.studio","email"),$("token","API token",b,N,"","password"),$("secret","Webhook secret",k,v,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:p=>d(p.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:c.isPending,disabled:!l.trim()||!r.trim()||!j.trim()||!b.trim()||!n,children:c.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:i,sites:x,onDone:f}){const[S,w]=a.useState(""),[l,u]=a.useState(""),[r,g]=a.useState(""),[j,m]=a.useState(!0),[b,N]=a.useState(""),k=q({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:o,staleTime:1/0}),v=F({mutationFn:t=>T.connectTracker(t,"slack",{channel:l.trim(),token:r.trim(),createOn:j?"thread.created":"manual"})}),h=S||x[0]?.uid||"",d=async t=>{t.preventDefault(),N("");try{await v.mutateAsync(h),u(""),g(""),m(!0),i(!1),f(h),I.success("Slack connected")}catch(s){N(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx(E,{open:o,onOpenChange:i,children:e.jsx(O,{children:e.jsxs("form",{onSubmit:t=>void d(t),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(W,{children:[e.jsx(R,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),b&&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:b}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:h,onChange:t=>w(t.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:x.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:!k.data,render:e.jsx("a",{href:k.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(A,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:r,onChange:t=>g(t.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(A,{id:"sl-channel",placeholder:"#reviews",value:l,onChange:t=>u(t.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:j,onChange:t=>m(t.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(y,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(y,{type:"submit",loading:v.isPending,disabled:!l.trim()||!r.trim()||!h,children:v.isPending?"Checking…":"Connect"})]})]})})})}const We=()=>U(z().user.role,"settings")?e.jsx(me,{}):e.jsx(re,{title:"Integrations",children:e.jsxs("p",{className:"m-0",children:["Connecting a site to GitHub, Linear, Jira or Slack is done by an owner or an admin. Your own agent tokens are on"," ",e.jsx(ee,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{We as component};
@@ -1,4 +1,4 @@
1
- import{c as Wt,a8 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,a9 as Vt,f as He,m as St,E as bn,aa as vn,ab as Gt,k as Ce,g as bt,q as Xt,ac as yn,B as Fe,ad as it,ae as Kt,a1 as kt,H as Sn,C as wn,af as Rn,ag as In,ah as jn,D as Tn,z as Lt}from"./index-p-qD6BlY.js";import{u as Ot}from"./useQuery-D-9vXtOo.js";import{u as Cn,a as An}from"./zod-DfHlfdUJ.js";import{c as Mn,d as En,e as Pn,f as Nn,i as Vn,h as kn,u as Ln,a as On,j as Dn,p as Hn,r as Fn,g as Bn,A as Un,b as _n}from"./avatar-D8S5EME4.js";import{B as zn}from"./badge-anHWhPFa.js";import{C as Jt}from"./card-C01exIzZ.js";import{L as $n,M as qn,P as Wn,N as Tt,R as Yn,O as p,v as Qt,A as pt,q as Gn,F as Xn,Q as Kn,S as Jn,w as rt,U as Qn,V as Zn,x as es,W as ts,Y as ns,Z as ss,_ as os,$ as rs,a0 as ls,a as is,a1 as as,a2 as Ct,C as cs,a3 as us,a4 as ds,X as fs,E as ps,G as ms,I as Dt,H as Ht,J as Ft,K as Bt}from"./dialog-D5G50pSW.js";import{e as gs,f as hs,h as Zt,j as en,k as Ut,l as xs,m as bs,o as vs,c as Te,n as at,p as ys,q as Ss,r as wt,a as vt,s as ws,w as Rs,v as yt,L as _t,I as Is}from"./label-CuvYMIVd.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-B8VTYpZO.js";import{C as js}from"./ConfirmDialog-D1II2uNE.js";import{C as Ts}from"./CopyButton-qbA2ZHWn.js";import{C as on}from"./chevron-down-C-pVPOKU.js";import{C as Cs}from"./check-Gm9Xu4rH.js";import{s as Rt,i as As}from"./serializeValue-DRMAHja_.js";import{u as Ms}from"./useValueChanged-cwqHWzY1.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-CDAPQTbv.js";import{A as Vs,P as ks,b as Ls}from"./parts-CN1uQywE.js";import{u as rn,a as Os}from"./labels-DLMjYGNJ.js";import{c as Ds,d as Hs,e as Fs,f as Bs,g as Us}from"./studio-BHpeuJSq.js";import{P as _s}from"./plus-BsxOLtMA.js";import"./useBaseQuery-DaFWLbWu.js";import"./useRender-BBzDGtxq.js";import"./copy-Ckk__4oN.js";/**
1
+ import{c as Wt,a9 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,aa as Vt,f as Fe,m as St,E as bn,ab as vn,ac as Gt,k as Ce,g as bt,q as Xt,ad as yn,B as He,ae as it,af as Kt,a2 as kt,I as Sn,D as wn,ag as Rn,ah as In,ai as jn,F as Tn,A as Lt}from"./index-CHi2CcHb.js";import{u as Ot}from"./useQuery-U2FOgJPB.js";import{u as Cn,a as An}from"./zod-dogyqr67.js";import{c as Mn,d as En,e as Pn,f as Nn,i as Vn,h as kn,u as Ln,a as On,j as Dn,p as Fn,r as Hn,g as Bn,A as Un,b as _n}from"./avatar-CPcL_-iV.js";import{B as zn}from"./badge-DBzqpvfR.js";import{C as Jt}from"./card-B5svGaqA.js";import{L as $n,M as qn,P as Wn,N as Tt,R as Yn,O as p,v as Qt,A as pt,q as Gn,F as Xn,Q as Kn,S as Jn,w as rt,U as Qn,V as Zn,x as es,W as ts,Y as ns,Z as ss,_ as os,$ as rs,a0 as ls,a as is,a1 as as,a2 as Ct,C as cs,a3 as us,a4 as ds,X as fs,E as ps,G as ms,I as Dt,H as Ft,J as Ht,K as Bt}from"./dialog-qbXy4GE2.js";import{e as gs,f as hs,h as Zt,j as en,k as Ut,l as xs,m as bs,o as vs,c as Te,n as at,p as ys,q as Ss,r as wt,a as vt,s as ws,w as Rs,v as yt,L as _t,I as Is}from"./label-Dff2Zjcb.js";import{T as tn,a as nn,b as ct,c as Ie,d as sn,e as je}from"./table-HuNaCQBJ.js";import{C as js}from"./ConfirmDialog-CLal40kk.js";import{C as Ts}from"./CopyButton-D_EAOrl1.js";import{C as on}from"./chevron-down-qCyXHfGI.js";import{C as Cs}from"./check-C21x2mpF.js";import{s as Rt,i as As}from"./serializeValue-DRMAHja_.js";import{u as Ms}from"./useValueChanged-RTamjQR3.js";import{C as Es,u as Ps,a as Ns}from"./CompositeList-DrnyFTB0.js";import{A as Vs,P as ks,b as Ls}from"./parts-CK9SS76R.js";import{u as rn}from"./me-XTwFHhR6.js";import{a as Os}from"./labels--UUyt9uB.js";import{c as Ds,d as Fs,e as Hs,f as Bs,g as Us}from"./studio-BtXg0XzE.js";import{P as _s}from"./plus-4APMJ4TC.js";import"./useBaseQuery-DI4GfUK8.js";import"./useRender-B8Yivtih.js";import"./copy-Bik19B-3.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,4 +8,4 @@ import{c as Wt,a8 as Yt,e as xe,l as xn,r as l,j as n,h as Be,i as jt,a9 as Vt,f
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const qs=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ws=Wt("mail",qs);function Ys(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,i=gs(),f=$n()!=null,r=Yt(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Wn,floatingId:i,syncOnly:!1,nested:f})).current;return xe(()=>{const u={open:t,floatingId:i};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=xn(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),r.update(u)},[t,i,o.reference,o.floating,r]),r.context.onOpenChange=s,r.context.nested=f,r}function Gs(e){const[t,s]=l.useState({current:e,previous:null});return Object.is(e,t.current)||s({current:e,previous:t.current}),t.previous}function Xs({className:e,...t}){return n.jsx("select",{className:Be("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function Ks(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const ln=l.createContext(null);function be(){const e=l.useContext(ln);if(e===null)throw new Error(jt(60));return e}const Js=(e,t)=>Object.is(e,t);function Ye(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function lt(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,s))}function Qs(e,t,s){return e.filter(o=>!Ye(t,o,s))}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Zs(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function cn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Rt(e)}function We(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Rt(e.value):Rt(e)}function un(e,t,s){function o(){return cn(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const i=t,f=an(i)?i.flatMap(r=>r.items):i;if(e==null||typeof e!="object"){const r=f.find(u=>u.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=f.find(u=>u&&u.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function eo(e,t,s){return e.reduce((o,i,f)=>(f>0&&o.push(", "),o.push(n.jsx(l.Fragment,{children:un(i,t,s)},f)),o),[])}const d={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:We(t,o)!==""},hasNullItemLabel:(e,t)=>t?Zs(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>Ye(t,i,s)):Ye(t,o,s)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function to(e,t,s=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>s(o,t[i]))}function Ke(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const me=1;function At(e,t){return Math.max(0,e-t)}function ut(e,t){if(t<=0)return 0;const s=Ke(e,0,t),o=s,i=t-s,f=o<=me,r=i<=me;return f&&r?o<=i?0:t:f?0:r?t:s}function no(e){const{id:t,value:s,defaultValue:o=null,onValueChange:i,open:f,defaultOpen:r=!1,onOpenChange:u,name:c,form:m,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:R=!1,modal:v=!0,actionsRef:D,inputRef:S,onOpenChangeComplete:_,items:N,multiple:I=!1,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w=Js,highlightItemOnHover:k=!0,children:W}=e,{clearErrors:O}=hs(),{setDirty:ue,setTouched:Y,setFocused:le,validityData:K,setFilled:H,name:L,disabled:J,validation:C,validationMode:ne}=Zt(),z=en({id:t}),P=J||b,a=L??c,[h,Q]=Ut({controlled:s,default:I?o??Vt:o,name:"Select",state:"value"}),[F,se]=Ut({controlled:f,default:r,name:"Select",state:"open"}),g=l.useRef([]),T=l.useRef([]),B=l.useRef(null),ee=l.useRef(null),ve=l.useRef(0),M=l.useRef(null),G=l.useRef([]),$=l.useRef(!1),de=l.useRef(null),Z=l.useRef(null),oe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=l.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=Tt(F),{openMethod:X,triggerProps:ae}=Mn(F),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:F,mounted:ie,transitionStatus:q,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=p(E,d.activeIndex),ye=p(E,d.selectedIndex),Se=p(E,d.triggerElement),ce=p(E,d.positionerElement),ke=Gs(X),Le=X??ke,te=l.useMemo(()=>I?"":We(h,V),[I,h,V]),mt=l.useMemo(()=>I&&Array.isArray(h)?h.map(A=>We(A,V)):We(h,V),[I,h,V]),Qe=Qt(Se),we=He(()=>mt);xs(Qe,z,h,we,!P,c);const gt=l.useRef(h),Ge=I?Array.isArray(h)&&h.length>0:h!=null&&te!=="";xe(()=>{H(Ge)},[Ge,H]),xe(function(){let U=h,Re=!1;if(I){const De=Array.isArray(h)?h:[];Re=De.length===0,U=De[De.length-1]}const Ne=Re?-1:lt(G.current,U,w),Ve=Ne===-1?null:Ne;Ve===null&&(Z.current=null),!F&&E.set("selectedIndex",Ve)},[I,F,h,w,E]);function ge(A){const U=K.initialValue;return Array.isArray(A)&&Array.isArray(U)?!to(A,U,(Re,Ne)=>Ye(Re,Ne,w)):A!==U}Ms(h,()=>{O(a),ue(ge(h)),C.change(h)});const Ue=He((A,U)=>{u?.(A,U),!U.isCanceled&&(se(A),!A&&(U.reason===bs||U.reason===vs)&&(Y(!0),le(!1),ne==="onBlur"&&C.commit(h)))}),_e=He(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:F,ref:B,onComplete(){F||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=He((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=He(A=>{const U=At(A.scrollHeight,A.clientHeight),Re=ut(A.scrollTop,U),Ne=Re>0,Ve=Re<U;E.set("scrollUpArrowVisible",Ne),E.set("scrollDownArrowVisible",Ve)}),Ee=Ys({open:F,onOpenChange:Ue,elements:{reference:Se,floating:ce}}),ze=En(Ee,{enabled:!y&&!P,event:"mousedown"}),$e=Gn(Ee),Pe=Pn(Ee,{enabled:!y&&!P,listRef:g,activeIndex:Ae,selectedIndex:ye,disabledIndices:Vt,onNavigate(A){A===null&&!F||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(F||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>As(g.current[A]),onMatch(A){F?E.set("activeIndex",A):Me(G.current[A],Te(at))},onTyping(A){$.current=A}}),Ze=l.useMemo(()=>St(Oe.reference,Pe.reference,$e.reference,ze.reference,ae),[ze.reference,Oe.reference,Pe.reference,$e.reference,ae]),et=l.useMemo(()=>St(Xn,Oe.floating,Pe.floating,$e.floating),[Oe.floating,Pe.floating,$e.floating]),tt=Pe.item??bn;Ks(()=>{E.update({popupProps:et,triggerProps:Ze})}),E.useSyncedValues({id:z,modal:v,multiple:I,value:h,open:F,mounted:ie,transitionStatus:q,popupProps:et,triggerProps:Ze,items:N,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,openMethod:Le});const pe=l.useMemo(()=>({store:E,floatingContext:Ee,required:R,disabled:P,readOnly:y,multiple:I,highlightItemOnHover:k,setValue:Me,setOpen:Ue,listRef:g,popupRef:B,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:ve,itemProps:tt,valueRef:M,valuesRef:G,labelsRef:T,typingRef:$,selectionRef:oe,firstItemTextRef:de,selectedItemTextRef:Z,validation:C,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:re,initialValueRef:gt}),[E,Ee,R,P,y,I,k,Me,Ue,tt,C,_,he]),qe=vn(S,C.inputRef),Xe=I?void 0:a,ht=l.useMemo(()=>!I||!Array.isArray(h)||!a?null:h.map(A=>{const U=We(A,V);return n.jsx("input",{type:"hidden",form:m,name:a,value:U,disabled:P},U)}),[I,h,m,a,V,P]);return n.jsxs(ln.Provider,{value:pe,children:[W,n.jsx("input",{...C.getValidationProps(P,{onFocus(){E.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||P||y)return;const U=A.currentTarget.value,Re=Te(at,A.nativeEvent);function Ne(){if(I)return;const Ve=U.toLowerCase();let De=G.current.findIndex(xt=>We(xt,V).toLowerCase()===Ve||cn(xt,j).toLowerCase()===Ve);De===-1&&(De=G.current.findIndex((xt,hn)=>{const Nt=T.current[hn];return Nt!=null&&Nt.toLowerCase()===Ve}));const Pt=G.current[De];Pt!=null&&Me(Pt,Re)}E.set("forceMount",!0),queueMicrotask(Ne)}}),id:z&&Xe==null?`${z}-hidden-input`:void 0,form:m,name:Xe,autoComplete:x,value:te,disabled:P,required:R&&!(I&&Ge),readOnly:y,ref:qe,style:a?Kn:Jn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function so(e,t){return e??t}const oo=400,ro={...Zn,...Ss,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},lo=l.forwardRef(function(t,s){const{render:o,className:i,id:f,disabled:r=!1,nativeButton:u=!0,style:c,...m}=t,{setTouched:x,setFocused:b,validationMode:y,state:R,disabled:v}=Zt(),{labelId:D}=ys(),{store:S,setOpen:_,selectionRef:N,validation:I,readOnly:j,required:V,alignItemWithTriggerActiveRef:w,disabled:k}=be(),W=v||k||r,O=p(S,d.open),ue=p(S,d.mounted),Y=p(S,d.value),le=p(S,d.triggerProps),K=p(S,d.positionerElement),H=p(S,d.listElement),L=p(S,d.popupSide),J=p(S,d.id),C=p(S,d.labelId),ne=p(S,d.hasSelectedValue),z=ue&&K?L:null,P=f??J,a=so(D,C);en({id:P});const h=Qt(K),Q=l.useRef(null),{getButtonProps:F,buttonRef:se}=Gt({disabled:W,native:u}),g=S.useStateSetter("triggerElement"),T=rt(),B=rt(),ee=rt();l.useEffect(()=>{if(O)return ee.start(oo,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[O,N,B,ee]);const ve=St(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?H?.id??Qn(K)?.id:void 0,"aria-labelledby":a,"aria-readonly":j||void 0,"aria-required":V||void 0,tabIndex:W?-1:0,onFocus($){b(!0),O&&w.current&&_(!1,Te(at,$.nativeEvent)),T.start(0,()=>{S.set("forceMount",!0)})},onBlur($){vt(K,$.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&I.commit(Y))},onMouseDown($){if(O)return;const de=wt($.currentTarget);function Z(oe){if(!Q.current)return;const re=oe.target;vt(Q.current,re)||vt(h.current,re)||Vn(oe,Q.current)||_(!1,Te(ws,oe))}B.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},m,F),M=I.getValidationProps(W,ve);M.role="combobox";const G={...R,open:O,disabled:W,value:Y,readOnly:j,popupSide:z,placeholder:!ne};return Ce("button",t,{ref:[s,Q,se,g],state:G,stateAttributesMapping:ro,props:M})}),io={value:()=>null},ao=l.forwardRef(function(t,s){const{className:o,render:i,children:f,placeholder:r,style:u,...c}=t,{store:m,valueRef:x}=be(),b=p(m,d.value),y=p(m,d.items),R=p(m,d.itemToStringLabel),v=p(m,d.hasSelectedValue),D=!v&&r!=null&&f==null,S=p(m,d.hasNullItemLabel,D),_={value:b,placeholder:!v};let N=null;return typeof f=="function"?N=f(b):f!=null?N=f:D&&!S?N=r:Array.isArray(b)?N=eo(b,y,R):N=un(b,y,R),Ce("span",t,{state:_,ref:[s,x],props:[{children:N},c],stateAttributesMapping:io})}),co=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u}=be(),m={open:p(u,d.open)};return Ce("span",t,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:es})}),uo=l.forwardRef(function(t,s){const{store:o}=be(),i=p(o,d.mounted),f=p(o,d.forceMount);return i||f?n.jsx(ts,{ref:s,...t}):null}),dn=l.createContext(void 0);function Mt(){const e=l.useContext(dn);if(!e)throw new Error(jt(59));return e}function dt(e,t){e&&Object.assign(e.style,t)}const fn={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},fo={position:"fixed"},po=l.forwardRef(function(t,s){const{anchor:o,className:i,render:f,positionMethod:r,side:u,align:c,sideOffset:m,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:R,sticky:v,disableAnchorTracking:D,alignItemWithTrigger:S=!0,collisionAvoidance:_=ns,style:N,...I}=t,{store:j,listRef:V,labelsRef:w,alignItemWithTriggerActiveRef:k,selectedItemTextRef:W,valuesRef:O,initialValueRef:ue,popupRef:Y,setValue:le,floatingContext:K}=be(),H=p(j,d.open),L=p(j,d.mounted),J=p(j,d.modal),C=p(j,d.value),ne=p(j,d.openMethod),z=p(j,d.positionerElement),P=p(j,d.triggerElement),a=p(j,d.isItemEqualToValue),h=p(j,d.transitionStatus),Q=l.useRef(null),F=l.useRef(null),[se,g]=l.useState(S),T=L&&se&&ne!=="touch";!L&&se!==S&&g(S),l.useImperativeHandle(k,()=>T),kn((T||J)&&H,ne==="touch",z,P);const B=Ln({anchor:o,floatingRootContext:K,positionMethod:r,mounted:L,side:u,sideOffset:m,align:c,alignOffset:x,arrowPadding:R,collisionBoundary:b,collisionPadding:y,sticky:v,disableAnchorTracking:D??T,collisionAvoidance:_,keepMounted:!0}),ee=T?"none":B.side,ve=T?fo:B.positionerStyles,M={open:H,side:ee,align:B.align,anchorHidden:B.anchorHidden};xe(()=>{j.set("popupSide",B.side)},[j,B.side]);const G=j.useStateSetter("positionerElement"),$=On(t,M,{styles:ve,transitionStatus:h,props:I,refs:[s,G],hidden:!L,inert:!H}),de=l.useRef(0),Z=He(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Te(at);if(ie!==0&&!j.state.multiple&&C!==null&&lt(O.current,C,a)===-1){const X=ue.current,E=X!=null&&lt(O.current,X,a)!==-1?X:null;le(E,fe),E===null&&(j.set("selectedIndex",null),W.current=null)}if(ie!==0&&j.state.multiple&&Array.isArray(C)){const q=C.filter(X=>lt(O.current,X,a)!==-1);q.length!==C.length&&(le(q,fe),q.length===0&&(j.set("selectedIndex",null),W.current=null))}if(H&&T){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};dt(z,q),dt(Y.current,q)}}),oe=l.useMemo(()=>({...B,side:ee,alignItemWithTriggerActive:T,setControlledAlignItemWithTrigger:g,scrollUpArrowRef:Q,scrollDownArrowRef:F}),[B,ee,T,g]);return n.jsx(Es,{elementsRef:V,labelsRef:w,onMapChange:Z,children:n.jsxs(dn.Provider,{value:oe,children:[L&&J&&n.jsx(ss,{inert:os(!H),cutout:P}),$]})})}),nt="base-ui-disable-scrollbar",It={className:nt,getElement(e){return n.jsx("style",{nonce:e,href:nt,precedence:"base-ui:low",children:`.${nt}{scrollbar-width:none}.${nt}::-webkit-scrollbar{display:none}`})}},mo=l.createContext(void 0),go={disableStyleElements:!1};function ho(){return l.useContext(mo)??go}const xo={...cs,...Ct},bo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,finalFocus:r,...u}=t,{store:c,popupRef:m,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:R,selectedItemTextRef:v,multiple:D,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:N,highlightItemOnHover:I,floatingContext:j}=be(),{side:V,align:w,alignItemWithTriggerActive:k,isPositioned:W,setControlledAlignItemWithTrigger:O}=Mt(),ue=Dn()!=null,Y=Ps(),{nonce:le,disableStyleElements:K}=ho(),H=p(c,d.id),L=p(c,d.open),J=p(c,d.openMethod),C=p(c,d.mounted),ne=p(c,d.popupProps),z=p(c,d.transitionStatus),P=p(c,d.triggerElement),a=p(c,d.positionerElement),h=p(c,d.listElement),Q=l.useRef(!1),F=l.useRef(!1),se=l.useRef({}),g=rs(),T=He(M=>{if(!a||!m.current||!F.current)return;const G=a.style.top==="0px",$=a.style.bottom==="0px";if(Q.current||!k||!G&&!$){S(M);return}const de=$t(a),Z=Je(a.getBoundingClientRect().height,"y",de),oe=wt(a),re=bt(a),ie=re.getComputedStyle(a),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),X=zt(re.getComputedStyle(m.current)),ae=Math.min(oe.documentElement.clientHeight-fe-q,X),E=M.scrollTop,Ae=st(M);let ye=null;const Se=te=>{a.style.height=`${te}px`},ce=G?Ae-E:E,ke=Math.min(Z+ce,ae);if(ce<=me){const te=Ke(ce,0,ae-Z);te>0&&Se(Z+te),M.scrollTop=G?Ae:0,ae-(Z+te)<=me&&(Q.current=!0),S(M);return}if(ae-ke>me)ye=G?1/0:0;else if($&&E<Ae){const te=Z+ce-ae;ye=E-(ce-te)}const Le=Math.ceil(ke);if(Le!==0&&Se(Le),ye!=null){const te=Ke(ye,0,st(M));Math.abs(M.scrollTop-te)>me&&(M.scrollTop=te)}Le>=ae-me&&(Q.current=!0),S(M)});l.useImperativeHandle(_,()=>T,[T]),pt({open:L,ref:m,onComplete(){L&&x?.(!0)}});const B={open:L,transitionStatus:z,side:V,align:w};xe(()=>{!a||!m.current||Object.keys(se.current).length||(se.current={top:a.style.top||"0",left:a.style.left||"0",right:a.style.right,height:a.style.height,bottom:a.style.bottom,minHeight:a.style.minHeight,maxHeight:a.style.maxHeight,marginTop:a.style.marginTop,marginBottom:a.style.marginBottom})},[m,a]),xe(()=>{L||k||(F.current=!1,Q.current=!1,dt(a,se.current))},[L,k,a,m]),xe(()=>{const M=m.current;if(!L||!P||!a||!M||k&&!W||c.state.transitionStatus==="ending")return;if(F.current=!0,M.style.removeProperty("--transform-origin"),!k){g.request(()=>S(h||M));return}const G=vo(M);try{let $=v.current;$?.isConnected||($=!d.hasSelectedValue(c.state)&&R.current?.isConnected?R.current:null);const de=y.current,Z=bt(a),oe=Z.getComputedStyle(a),re=Z.getComputedStyle(M),ie=wt(P),fe=$t(P),q=ot(P.getBoundingClientRect(),fe),X=ot(a.getBoundingClientRect(),fe),ae=q.height,E=h||M,Ae=E.scrollHeight,ye=parseFloat(re.borderBottomWidth),Se=parseFloat(oe.marginTop)||10,ce=parseFloat(oe.marginBottom)||10,ke=parseFloat(oe.minHeight)||100,Le=zt(re),te=5,mt=5,Qe=20,we=ie.documentElement.clientHeight-Se-ce,gt=ie.documentElement.clientWidth,Ge=we-q.bottom+ae;let ge,Ue=Y==="rtl"?q.right-X.width:q.left,_e=0;if($&&de){const pe=ot(de.getBoundingClientRect(),fe);ge=ot($.getBoundingClientRect(),fe),Ue=X.left+(Y==="rtl"?pe.right-ge.right:pe.left-ge.left);const qe=pe.top-q.top+pe.height/2;_e=ge.top-X.top+ge.height/2-qe}const Me=Ge+_e+ce+ye;let he=Math.min(we,Me);const Ee=we-Se-ce,ze=Me-he,$e=gt-mt;a.style.left=`${Ke(Ue,te,$e-X.width)}px`,a.style.height=`${he}px`,a.style.maxHeight="none",a.style.marginTop=`${Se}px`,a.style.marginBottom=`${ce}px`,M.style.height="100%";const Pe=st(E),Oe=ze>=Pe-me;Oe&&(he=Math.min(we,X.height)-(ze-Pe));const Ze=q.top<Qe||q.bottom>we-Qe||Math.ceil(he)+me<Math.min(Ae,ke),et=(Z.visualViewport?.scale??1)!==1&&ls;if(Ze||et){dt(a,se.current),O(!1);return}const tt=Math.max(ke,he);if(Oe){const pe=Math.max(0,we-Me);a.style.top=X.height>=Ee?"0":`${pe}px`,a.style.height=`${he}px`,E.scrollTop=st(E)}else a.style.bottom="0",E.scrollTop=ze;if(ge){const pe=X.top,qe=X.height,Xe=ge.top+ge.height/2,ht=Ke(qe>0?(Xe-pe)/qe*100:50,0,100);M.style.setProperty("--transform-origin",`50% ${ht}%`)}(tt===we||he>=Le)&&(Q.current=!0),S(E),I&&c.state.selectedIndex===null&&c.state.activeIndex===null&&N.current[0]!=null&&c.set("activeIndex",0)}finally{G()}},[c,L,a,P,y,R,v,m,S,k,O,g,h,N,I,Y,W]),l.useEffect(()=>{if(!k||!a||!L)return;const M=bt(a);function G($){b(!1,Te(Rs,$))}return is(M,"resize",G)},[b,k,a,L]);const ee={...h?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":D||void 0,id:`${H}-list`},onKeyDown(M){ue&&us.has(M.key)&&M.stopPropagation()},onScroll(M){h||T(M.currentTarget)},...k&&{style:h?{height:"100%"}:fn},className:!h&&k?It.className:void 0},ve=Ce("div",t,{ref:[s,m],state:B,stateAttributesMapping:xo,props:[ne,ee,Bn(z),u]});return n.jsxs(l.Fragment,{children:[!K&&It.getElement(le),n.jsx(as,{context:j,modal:!1,disabled:!C,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:ve})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function st(e){return At(e.scrollHeight,e.clientHeight)}function $t(e){return Hn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Fn({x:Je(e.x,"x",t),y:Je(e.y,"y",t),width:Je(e.width,"x",t),height:Je(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function vo(e){const{style:t}=e,s={};for(const[o,i]of qt)s[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of qt){const i=s[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const yo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u,scrollHandlerRef:c,multiple:m}=be(),{alignItemWithTriggerActive:x}=Mt(),b=p(u,d.hasScrollArrows),y=p(u,d.openMethod),v={id:`${p(u,d.id)}-list`,role:"listbox","aria-multiselectable":m||void 0,onScroll(S){c.current?.(S.currentTarget)},...x&&{style:fn},className:b&&y!=="touch"?It.className:void 0},D=u.useStateSetter("listElement");return Ce("div",t,{ref:[s,D],props:[v,r]})}),pn=l.createContext(void 0);function Et(){const e=l.useContext(pn);if(!e)throw new Error(jt(57));return e}const So=l.memo(l.forwardRef(function(t,s){const{render:o,className:i,style:f,value:r=null,label:u,disabled:c=!1,nativeButton:m=!1,...x}=t,b=l.useRef(null),y=Ns({guess:!0,label:u,textRef:b}),{store:R,itemProps:v,setOpen:D,setValue:S,selectionRef:_,typingRef:N,valuesRef:I,multiple:j,selectedItemTextRef:V,disabled:w,readOnly:k}=be(),W=w||c,O=p(R,d.isActive,y.index),ue=p(R,d.open),Y=p(R,d.isSelected,r),le=p(R,d.isSelectedByFocus,y.index),K=p(R,d.isItemEqualToValue),H=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[H]=r,()=>{delete g[H]}},[H,r,I]),xe(()=>{const g=R.state.value;let T=g;j&&Array.isArray(g)&&(T=g.length>0?g[g.length-1]:void 0),T!==void 0&&Ye(r,T,K)&&(R.set("selectedIndex",H),b.current&&(V.current=b.current))},[H,j,K,R,r,V]);const J=l.useRef("mouse"),C=l.useRef(!1),{getButtonProps:ne,buttonRef:z}=Gt({disabled:W,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:W,selected:Y,highlighted:O};function a(g){if(w||k)return;const T=R.state.value;if(j){const B=Array.isArray(T)?T:[],ee=Y?Qs(B,r,K):[...B,r];S(ee,Te(yt,g))}else S(r,Te(yt,g)),D(!1,Te(yt,g))}function h(){_.current.dragY=0}const Q={role:"option","aria-selected":Y,tabIndex:ue&&O?0:-1,onKeyDown(g){R.set("activeIndex",H),g.key===" "&&N.current&&g.preventDefault()},onClick(g){const T=J.current!=="touch",B=g.nativeEvent.pointerType,ee=T&&ds(g.nativeEvent)&&(B!==void 0||O),ve=T&&!ee&&!C.current;C.current=!1,!(W||ve)&&a(g.nativeEvent)},onPointerEnter(g){J.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const T=_.current;T.dragY+=g.movementY,T.dragY**2>=64&&(T.allowUnselectedMouseUp=!0)}},onPointerDown(g){J.current=g.pointerType,C.current=!0,h()},onMouseUp(){if(h(),W||J.current==="touch"||C.current)return;const g=!_.current.allowSelectedMouseUp&&Y,T=!_.current.allowUnselectedMouseUp&&!Y;g||T||(C.current=!0,L.current?.click(),C.current=!1)}},F=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:H,textRef:b,selectedByFocus:le}),[Y,H,b,le]);return n.jsx(pn.Provider,{value:se,children:F})})),wo=l.forwardRef(function(t,s){const{selected:o}=Et();return t.keepMounted||o?n.jsx(Ro,{...t,ref:s}):null}),Ro=l.memo(l.forwardRef((e,t)=>{const{render:s,className:o,style:i,keepMounted:f,...r}=e,{selected:u}=Et(),c=l.useRef(null),{transitionStatus:m,setMounted:x}=Tt(u),y=Ce("span",e,{ref:[t,c],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Ct});return pt({open:u,ref:c,onComplete(){u||x(!1)}}),y})),Io=l.memo(l.forwardRef(function(t,s){const{index:o,textRef:i,selectedByFocus:f}=Et(),{firstItemTextRef:r,selectedItemTextRef:u}=be(),{render:c,className:m,style:x,...b}=t,y=l.useCallback(v=>{v&&(o===0&&(r.current=v),f&&(u.current=v))},[r,u,o,f]);return Ce("div",t,{ref:[y,s,i],props:b})})),mn=l.forwardRef(function(t,s){const{render:o,className:i,style:f,direction:r,keepMounted:u,...c}=t,m=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:R,scrollArrowsMountedCountRef:v}=be(),{side:D,scrollDownArrowRef:S,scrollUpArrowRef:_}=Mt(),N=m?d.scrollUpArrowVisible:d.scrollDownArrowVisible,I=p(x,N),j=p(x,d.openMethod),V=I&&j!=="touch",w=rt(),k=m?_:S,{mounted:W,transitionStatus:O,setMounted:ue}=Tt(V);xe(()=>(v.current+=1,x.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&x.set("hasScrollArrows",!1)}),[x,v]),pt({open:V,ref:k,onComplete(){V||ue(!1)}});const K=Ce("div",t,{ref:[s,k],state:{direction:r,visible:V,side:D,transitionStatus:O},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||w.isStarted())return;x.set("activeIndex",null);function J(){const C=x.state.listElement??b.current;if(!C)return;x.set("activeIndex",null),R(C);const ne=At(C.scrollHeight,C.clientHeight),z=ut(C.scrollTop,ne),P=z===(m?0:ne),a=y.current;if(z!==C.scrollTop&&(C.scrollTop=z),P){w.clear();return}if(a.length>0){const h=k.current?.offsetHeight||0;C.scrollTop=jo(a,m,z,C.clientHeight,h,ne)}w.start(40,J)}w.start(40,J)},onMouseLeave(){w.clear()}},c],stateAttributesMapping:Ct});return W||u?K:null});function jo(e,t,s,o,i,f){if(t){let x=0;const b=s+i-me;for(let v=0;v<e.length;v+=1){const D=e[v];if(D&&D.offsetTop>=b){x=v;break}}const y=Math.max(0,x-1),R=e[y];return y<x&&R?ut(R.offsetTop-i,f):0}let r=e.length-1;const u=s+o-i+me;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>u){r=Math.max(0,x-1);break}}const c=Math.min(e.length-1,r+1),m=e[c];return c>r&&m?ut(m.offsetTop+m.offsetHeight-o+i,f):f}const To=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"down"})}),Co=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"up"})}),Ao=no;function Mo({className:e,...t}){return n.jsx(ao,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function Eo({className:e,size:t="default",children:s,...o}){return n.jsxs(lo,{"data-slot":"select-trigger","data-size":t,className:Be("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,n.jsx(co,{render:n.jsx(on,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Po({className:e,children:t,side:s="bottom",sideOffset:o=4,align:i="center",alignOffset:f=0,alignItemWithTrigger:r=!0,...u}){return n.jsx(uo,{children:n.jsx(po,{side:s,sideOffset:o,align:i,alignOffset:f,alignItemWithTrigger:r,className:"isolate z-50",children:n.jsxs(bo,{"data-slot":"select-content","data-align-trigger":r,className:Be("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[n.jsx(Vo,{}),n.jsx(yo,{children:t}),n.jsx(ko,{})]})})})}function No({className:e,children:t,...s}){return n.jsxs(So,{"data-slot":"select-item",className:Be("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[n.jsx(Io,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(wo,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Cs,{className:"pointer-events-none"})})]})}function Vo({className:e,...t}){return n.jsx(Co,{"data-slot":"select-scroll-up-button",className:Be("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx($s,{})})}function ko({className:e,...t}){return n.jsx(To,{"data-slot":"select-scroll-down-button",className:Be("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(on,{})})}function Lo(){const e=rn(),t=Xt(e.user.role,"people"),s=yn(e.user.role),o=Ot(Lt.members()),i=Ot(Lt.invites()),[f,r]=l.useState(!1),u=e.limits.members.limit,c=u!==null&&e.limits.members.used>=u;return n.jsxs("div",{className:"p-7",children:[n.jsx(ks,{title:"Members",sub:`${t?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${u!==null?` ${e.limits.members.used} of ${u} members.`:""}`,actions:s.length?n.jsxs(Fe,{onClick:()=>r(!0),disabled:c,title:c?`This studio's plan allows ${u} members.`:void 0,children:[n.jsx(_s,{}),"Invite"]}):void 0}),n.jsx(Jt,{className:"max-w-[1040px] overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"Name"}),n.jsx(Ie,{children:"Email"}),n.jsx(Ie,{children:"Role"}),t&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:(o.data?.data??[]).map(m=>n.jsx(Ho,{m,owner:t},m.email))})]})}),n.jsx(Oo,{}),(i.data?.data.length??0)>0&&n.jsx(Do,{invites:i.data.data,roles:s}),n.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",n.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),s.length>0&&n.jsx(Bo,{open:f,onOpenChange:r,mail:i.data?.mail??!1,roles:s})]})}const gn=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"}),ft={owner:"Owner",admin:"Admin",member:"Member"};function Oo(){return n.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:it.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"font-medium",children:ft[e]}),n.jsx("dd",{className:"m-0 text-muted-foreground",children:Kt[e]})]},e))})}function Do({invites:e,roles:t}){const s=Fs(),o=t.length>0;return n.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[n.jsx("div",{id:"pending-invites",className:"mb-2",children:n.jsx(Ls,{children:"Pending invites"})}),n.jsx(Jt,{className:"overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"For"}),n.jsx(Ie,{children:"Role"}),n.jsx(Ie,{children:"Invited by"}),n.jsx(Ie,{children:"Expires"}),o&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:e.map(i=>n.jsxs(ct,{children:[n.jsx(je,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),n.jsx(je,{className:"capitalize",children:i.role}),n.jsx(je,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),n.jsx(je,{className:"text-muted-foreground",children:gn(i.expiresAt)}),o&&n.jsx(je,{className:"text-right",children:t.includes(i.role)&&n.jsx(Fe,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:s.isPending&&s.variables===i.id,onClick:()=>s.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function Ho({m:e,owner:t}){const s=Ds(),o=Hs(),[i,f]=l.useState(!1);return n.jsxs(ct,{children:[n.jsx(je,{children:n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx(Un,{className:"size-6",children:n.jsx(_n,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Os(e.name,e.email)})}),n.jsx("span",{className:"font-medium",children:e.name||e.email}),e.you&&n.jsx(zn,{variant:"outline",className:"text-[11px]",children:"you"})]})}),n.jsx(je,{className:"text-muted-foreground",children:e.email}),n.jsx(je,{children:t?n.jsxs(Ao,{items:it.map(r=>({value:r,label:ft[r]})),value:e.role,onValueChange:r=>r&&r!==e.role&&s.mutate({email:e.email,role:r}),children:[n.jsx(Eo,{size:"sm","aria-label":`Role for ${e.email}`,className:"min-w-[104px] bg-card",children:n.jsx(Mo,{})}),n.jsx(Po,{children:it.map(r=>n.jsx(No,{value:r,children:ft[r]},r))})]}):n.jsx("span",{className:"capitalize",children:e.role})}),t&&n.jsxs(je,{className:"text-right",children:[!e.you&&n.jsx(Fe,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${e.email}`,onClick:()=>f(!0),children:n.jsx(fs,{})}),n.jsx(js,{open:i,onOpenChange:f,title:`Remove ${e.name||e.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:o.isPending,onConfirm:()=>{f(!1),o.mutate(e.email)}})]})]})}const Fo=wn({email:In([jn(""),Tn().trim().email("An email address, or leave it empty")]),role:Rn(it)});function Bo({open:e,onOpenChange:t,mail:s,roles:o}){const i=Bs(),f=Us(),[r,u]=l.useState(""),[c,m]=l.useState(null),[x,b]=l.useState(null),{register:y,handleSubmit:R,formState:v,reset:D,watch:S}=Cn({resolver:An(Fo),defaultValues:{role:"member",email:""}}),_=S("role"),N=w=>{t(w),w||(m(null),b(null),u(""),f.reset(),D())},I=R(async w=>{u("");try{m(await i.mutateAsync({role:w.role,...w.email?{email:w.email}:{}}))}catch(k){u(kt(k))}}),j=async()=>{if(c){u("");try{b((await f.mutateAsync({id:c.invite.id,token:c.token})).to)}catch(w){u(kt(w))}}},V=(c?.mail??s)&&!!c?.invite.email;return n.jsx(ps,{open:e,onOpenChange:N,children:n.jsx(ms,{children:c?n.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[n.jsxs(Dt,{children:[n.jsx(Ht,{children:"Invite link"}),n.jsxs(Ft,{children:[c.invite.email?`${c.invite.email} can`:"Anyone with this link can"," join as ",Sn(c.invite.role)," ","until ",gn(c.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:c.url}),n.jsx(Ts,{text:c.url,label:"Copy link",withText:!0})]}),V&&(x?n.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",x,"."]}):n.jsxs(Fe,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:c.invite.email?`Send by email to ${c.invite.email}`:void 0,loading:f.isPending,onClick:()=>void j(),children:[n.jsx(Ws,{}),n.jsx("span",{className:"min-w-0 truncate",children:f.isPending?"Sending…":`Send by email to ${c.invite.email}`})]})),n.jsx(Bt,{children:n.jsx(Fe,{type:"button",onClick:()=>N(!1),children:"Done"})})]}):n.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4",noValidate:!0,children:[n.jsxs(Dt,{children:[n.jsx(Ht,{children:"Invite someone"}),n.jsx(Ft,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("fieldset",{disabled:v.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(_t,{htmlFor:"invite-role",children:"Role"}),n.jsx(Xs,{id:"invite-role",className:"w-full",...y("role"),children:["member","admin","owner"].filter(w=>o.includes(w)).map(w=>n.jsx("option",{value:w,children:ft[w]},w))}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:Kt[_]??""})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs(_t,{htmlFor:"invite-email",children:["Email ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),n.jsx(Is,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!v.errors.email,...y("email")}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:v.errors.email?.message??(s?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),n.jsxs(Bt,{children:[n.jsx(Fe,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(Fe,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const ur=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{ur as component};
11
+ */const qs=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Ws=Wt("mail",qs);function Ys(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,i=gs(),f=$n()!=null,r=Yt(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Wn,floatingId:i,syncOnly:!1,nested:f})).current;return xe(()=>{const u={open:t,floatingId:i};o.reference!==void 0&&(u.referenceElement=o.reference,u.domReferenceElement=xn(o.reference)?o.reference:null),o.floating!==void 0&&(u.floatingElement=o.floating),r.update(u)},[t,i,o.reference,o.floating,r]),r.context.onOpenChange=s,r.context.nested=f,r}function Gs(e){const[t,s]=l.useState({current:e,previous:null});return Object.is(e,t.current)||s({current:e,previous:t.current}),t.previous}function Xs({className:e,...t}){return n.jsx("select",{className:Be("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",e),...t})}function Ks(e){const t=l.useRef(!0);t.current&&(t.current=!1,e())}const ln=l.createContext(null);function be(){const e=l.useContext(ln);if(e===null)throw new Error(jt(60));return e}const Js=(e,t)=>Object.is(e,t);function Ye(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function lt(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,s))}function Qs(e,t,s){return e.filter(o=>!Ye(t,o,s))}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Zs(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function cn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Rt(e)}function We(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Rt(e.value):Rt(e)}function un(e,t,s){function o(){return cn(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const i=t,f=an(i)?i.flatMap(r=>r.items):i;if(e==null||typeof e!="object"){const r=f.find(u=>u.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=f.find(u=>u&&u.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function eo(e,t,s){return e.reduce((o,i,f)=>(f>0&&o.push(", "),o.push(n.jsx(l.Fragment,{children:un(i,t,s)},f)),o),[])}const d={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:We(t,o)!==""},hasNullItemLabel:(e,t)=>t?Zs(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>Ye(t,i,s)):Ye(t,o,s)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function to(e,t,s=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>s(o,t[i]))}function Ke(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const me=1;function At(e,t){return Math.max(0,e-t)}function ut(e,t){if(t<=0)return 0;const s=Ke(e,0,t),o=s,i=t-s,f=o<=me,r=i<=me;return f&&r?o<=i?0:t:f?0:r?t:s}function no(e){const{id:t,value:s,defaultValue:o=null,onValueChange:i,open:f,defaultOpen:r=!1,onOpenChange:u,name:c,form:m,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:R=!1,modal:v=!0,actionsRef:D,inputRef:S,onOpenChangeComplete:_,items:N,multiple:I=!1,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w=Js,highlightItemOnHover:k=!0,children:W}=e,{clearErrors:O}=hs(),{setDirty:ue,setTouched:Y,setFocused:le,validityData:K,setFilled:F,name:L,disabled:J,validation:C,validationMode:ne}=Zt(),z=en({id:t}),P=J||b,a=L??c,[h,Q]=Ut({controlled:s,default:I?o??Vt:o,name:"Select",state:"value"}),[H,se]=Ut({controlled:f,default:r,name:"Select",state:"open"}),g=l.useRef([]),T=l.useRef([]),B=l.useRef(null),ee=l.useRef(null),ve=l.useRef(0),M=l.useRef(null),G=l.useRef([]),$=l.useRef(!1),de=l.useRef(null),Z=l.useRef(null),oe=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=l.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=Tt(H),{openMethod:X,triggerProps:ae}=Mn(H),E=Yt(()=>new Yn({id:z,labelId:void 0,modal:v,multiple:I,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,value:h,open:H,mounted:ie,transitionStatus:q,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ae=p(E,d.activeIndex),ye=p(E,d.selectedIndex),Se=p(E,d.triggerElement),ce=p(E,d.positionerElement),ke=Gs(X),Le=X??ke,te=l.useMemo(()=>I?"":We(h,V),[I,h,V]),mt=l.useMemo(()=>I&&Array.isArray(h)?h.map(A=>We(A,V)):We(h,V),[I,h,V]),Qe=Qt(Se),we=Fe(()=>mt);xs(Qe,z,h,we,!P,c);const gt=l.useRef(h),Ge=I?Array.isArray(h)&&h.length>0:h!=null&&te!=="";xe(()=>{F(Ge)},[Ge,F]),xe(function(){let U=h,Re=!1;if(I){const De=Array.isArray(h)?h:[];Re=De.length===0,U=De[De.length-1]}const Ne=Re?-1:lt(G.current,U,w),Ve=Ne===-1?null:Ne;Ve===null&&(Z.current=null),!H&&E.set("selectedIndex",Ve)},[I,H,h,w,E]);function ge(A){const U=K.initialValue;return Array.isArray(A)&&Array.isArray(U)?!to(A,U,(Re,Ne)=>Ye(Re,Ne,w)):A!==U}Ms(h,()=>{O(a),ue(ge(h)),C.change(h)});const Ue=Fe((A,U)=>{u?.(A,U),!U.isCanceled&&(se(A),!A&&(U.reason===bs||U.reason===vs)&&(Y(!0),le(!1),ne==="onBlur"&&C.commit(h)))}),_e=Fe(()=>{fe(!1),E.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});pt({enabled:!D,open:H,ref:B,onComplete(){H||_e()}}),l.useImperativeHandle(D,()=>({unmount:_e}),[_e]);const Me=Fe((A,U)=>{i?.(A,U),!U.isCanceled&&Q(A)}),he=Fe(A=>{const U=At(A.scrollHeight,A.clientHeight),Re=ut(A.scrollTop,U),Ne=Re>0,Ve=Re<U;E.set("scrollUpArrowVisible",Ne),E.set("scrollDownArrowVisible",Ve)}),Ee=Ys({open:H,onOpenChange:Ue,elements:{reference:Se,floating:ce}}),ze=En(Ee,{enabled:!y&&!P,event:"mousedown"}),$e=Gn(Ee),Pe=Pn(Ee,{enabled:!y&&!P,listRef:g,activeIndex:Ae,selectedIndex:ye,disabledIndices:Vt,onNavigate(A){A===null&&!H||E.set("activeIndex",A)},focusItemOnHover:k}),Oe=Nn(Ee,{enabled:!y&&!P&&(H||!I),listRef:T,activeIndex:Ae,selectedIndex:ye,disabledIndices:A=>As(g.current[A]),onMatch(A){H?E.set("activeIndex",A):Me(G.current[A],Te(at))},onTyping(A){$.current=A}}),Ze=l.useMemo(()=>St(Oe.reference,Pe.reference,$e.reference,ze.reference,ae),[ze.reference,Oe.reference,Pe.reference,$e.reference,ae]),et=l.useMemo(()=>St(Xn,Oe.floating,Pe.floating,$e.floating),[Oe.floating,Pe.floating,$e.floating]),tt=Pe.item??bn;Ks(()=>{E.update({popupProps:et,triggerProps:Ze})}),E.useSyncedValues({id:z,modal:v,multiple:I,value:h,open:H,mounted:ie,transitionStatus:q,popupProps:et,triggerProps:Ze,items:N,itemToStringLabel:j,itemToStringValue:V,isItemEqualToValue:w,openMethod:Le});const pe=l.useMemo(()=>({store:E,floatingContext:Ee,required:R,disabled:P,readOnly:y,multiple:I,highlightItemOnHover:k,setValue:Me,setOpen:Ue,listRef:g,popupRef:B,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:ve,itemProps:tt,valueRef:M,valuesRef:G,labelsRef:T,typingRef:$,selectionRef:oe,firstItemTextRef:de,selectedItemTextRef:Z,validation:C,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:re,initialValueRef:gt}),[E,Ee,R,P,y,I,k,Me,Ue,tt,C,_,he]),qe=vn(S,C.inputRef),Xe=I?void 0:a,ht=l.useMemo(()=>!I||!Array.isArray(h)||!a?null:h.map(A=>{const U=We(A,V);return n.jsx("input",{type:"hidden",form:m,name:a,value:U,disabled:P},U)}),[I,h,m,a,V,P]);return n.jsxs(ln.Provider,{value:pe,children:[W,n.jsx("input",{...C.getValidationProps(P,{onFocus(){E.state.triggerElement?.focus({focusVisible:!0})},onChange(A){if(A.nativeEvent.defaultPrevented||P||y)return;const U=A.currentTarget.value,Re=Te(at,A.nativeEvent);function Ne(){if(I)return;const Ve=U.toLowerCase();let De=G.current.findIndex(xt=>We(xt,V).toLowerCase()===Ve||cn(xt,j).toLowerCase()===Ve);De===-1&&(De=G.current.findIndex((xt,hn)=>{const Nt=T.current[hn];return Nt!=null&&Nt.toLowerCase()===Ve}));const Pt=G.current[De];Pt!=null&&Me(Pt,Re)}E.set("forceMount",!0),queueMicrotask(Ne)}}),id:z&&Xe==null?`${z}-hidden-input`:void 0,form:m,name:Xe,autoComplete:x,value:te,disabled:P,required:R&&!(I&&Ge),readOnly:y,ref:qe,style:a?Kn:Jn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ht]})}function so(e,t){return e??t}const oo=400,ro={...Zn,...Ss,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},lo=l.forwardRef(function(t,s){const{render:o,className:i,id:f,disabled:r=!1,nativeButton:u=!0,style:c,...m}=t,{setTouched:x,setFocused:b,validationMode:y,state:R,disabled:v}=Zt(),{labelId:D}=ys(),{store:S,setOpen:_,selectionRef:N,validation:I,readOnly:j,required:V,alignItemWithTriggerActiveRef:w,disabled:k}=be(),W=v||k||r,O=p(S,d.open),ue=p(S,d.mounted),Y=p(S,d.value),le=p(S,d.triggerProps),K=p(S,d.positionerElement),F=p(S,d.listElement),L=p(S,d.popupSide),J=p(S,d.id),C=p(S,d.labelId),ne=p(S,d.hasSelectedValue),z=ue&&K?L:null,P=f??J,a=so(D,C);en({id:P});const h=Qt(K),Q=l.useRef(null),{getButtonProps:H,buttonRef:se}=Gt({disabled:W,native:u}),g=S.useStateSetter("triggerElement"),T=rt(),B=rt(),ee=rt();l.useEffect(()=>{if(O)return ee.start(oo,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},B.clear()},[O,N,B,ee]);const ve=St(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?F?.id??Qn(K)?.id:void 0,"aria-labelledby":a,"aria-readonly":j||void 0,"aria-required":V||void 0,tabIndex:W?-1:0,onFocus($){b(!0),O&&w.current&&_(!1,Te(at,$.nativeEvent)),T.start(0,()=>{S.set("forceMount",!0)})},onBlur($){vt(K,$.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&I.commit(Y))},onMouseDown($){if(O)return;const de=wt($.currentTarget);function Z(oe){if(!Q.current)return;const re=oe.target;vt(Q.current,re)||vt(h.current,re)||Vn(oe,Q.current)||_(!1,Te(ws,oe))}B.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},m,H),M=I.getValidationProps(W,ve);M.role="combobox";const G={...R,open:O,disabled:W,value:Y,readOnly:j,popupSide:z,placeholder:!ne};return Ce("button",t,{ref:[s,Q,se,g],state:G,stateAttributesMapping:ro,props:M})}),io={value:()=>null},ao=l.forwardRef(function(t,s){const{className:o,render:i,children:f,placeholder:r,style:u,...c}=t,{store:m,valueRef:x}=be(),b=p(m,d.value),y=p(m,d.items),R=p(m,d.itemToStringLabel),v=p(m,d.hasSelectedValue),D=!v&&r!=null&&f==null,S=p(m,d.hasNullItemLabel,D),_={value:b,placeholder:!v};let N=null;return typeof f=="function"?N=f(b):f!=null?N=f:D&&!S?N=r:Array.isArray(b)?N=eo(b,y,R):N=un(b,y,R),Ce("span",t,{state:_,ref:[s,x],props:[{children:N},c],stateAttributesMapping:io})}),co=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u}=be(),m={open:p(u,d.open)};return Ce("span",t,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:es})}),uo=l.forwardRef(function(t,s){const{store:o}=be(),i=p(o,d.mounted),f=p(o,d.forceMount);return i||f?n.jsx(ts,{ref:s,...t}):null}),dn=l.createContext(void 0);function Mt(){const e=l.useContext(dn);if(!e)throw new Error(jt(59));return e}function dt(e,t){e&&Object.assign(e.style,t)}const fn={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},fo={position:"fixed"},po=l.forwardRef(function(t,s){const{anchor:o,className:i,render:f,positionMethod:r,side:u,align:c,sideOffset:m,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:R,sticky:v,disableAnchorTracking:D,alignItemWithTrigger:S=!0,collisionAvoidance:_=ns,style:N,...I}=t,{store:j,listRef:V,labelsRef:w,alignItemWithTriggerActiveRef:k,selectedItemTextRef:W,valuesRef:O,initialValueRef:ue,popupRef:Y,setValue:le,floatingContext:K}=be(),F=p(j,d.open),L=p(j,d.mounted),J=p(j,d.modal),C=p(j,d.value),ne=p(j,d.openMethod),z=p(j,d.positionerElement),P=p(j,d.triggerElement),a=p(j,d.isItemEqualToValue),h=p(j,d.transitionStatus),Q=l.useRef(null),H=l.useRef(null),[se,g]=l.useState(S),T=L&&se&&ne!=="touch";!L&&se!==S&&g(S),l.useImperativeHandle(k,()=>T),kn((T||J)&&F,ne==="touch",z,P);const B=Ln({anchor:o,floatingRootContext:K,positionMethod:r,mounted:L,side:u,sideOffset:m,align:c,alignOffset:x,arrowPadding:R,collisionBoundary:b,collisionPadding:y,sticky:v,disableAnchorTracking:D??T,collisionAvoidance:_,keepMounted:!0}),ee=T?"none":B.side,ve=T?fo:B.positionerStyles,M={open:F,side:ee,align:B.align,anchorHidden:B.anchorHidden};xe(()=>{j.set("popupSide",B.side)},[j,B.side]);const G=j.useStateSetter("positionerElement"),$=On(t,M,{styles:ve,transitionStatus:h,props:I,refs:[s,G],hidden:!L,inert:!F}),de=l.useRef(0),Z=Fe(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Te(at);if(ie!==0&&!j.state.multiple&&C!==null&&lt(O.current,C,a)===-1){const X=ue.current,E=X!=null&&lt(O.current,X,a)!==-1?X:null;le(E,fe),E===null&&(j.set("selectedIndex",null),W.current=null)}if(ie!==0&&j.state.multiple&&Array.isArray(C)){const q=C.filter(X=>lt(O.current,X,a)!==-1);q.length!==C.length&&(le(q,fe),q.length===0&&(j.set("selectedIndex",null),W.current=null))}if(F&&T){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};dt(z,q),dt(Y.current,q)}}),oe=l.useMemo(()=>({...B,side:ee,alignItemWithTriggerActive:T,setControlledAlignItemWithTrigger:g,scrollUpArrowRef:Q,scrollDownArrowRef:H}),[B,ee,T,g]);return n.jsx(Es,{elementsRef:V,labelsRef:w,onMapChange:Z,children:n.jsxs(dn.Provider,{value:oe,children:[L&&J&&n.jsx(ss,{inert:os(!F),cutout:P}),$]})})}),nt="base-ui-disable-scrollbar",It={className:nt,getElement(e){return n.jsx("style",{nonce:e,href:nt,precedence:"base-ui:low",children:`.${nt}{scrollbar-width:none}.${nt}::-webkit-scrollbar{display:none}`})}},mo=l.createContext(void 0),go={disableStyleElements:!1};function ho(){return l.useContext(mo)??go}const xo={...cs,...Ct},bo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,finalFocus:r,...u}=t,{store:c,popupRef:m,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:R,selectedItemTextRef:v,multiple:D,handleScrollArrowVisibility:S,scrollHandlerRef:_,listRef:N,highlightItemOnHover:I,floatingContext:j}=be(),{side:V,align:w,alignItemWithTriggerActive:k,isPositioned:W,setControlledAlignItemWithTrigger:O}=Mt(),ue=Dn()!=null,Y=Ps(),{nonce:le,disableStyleElements:K}=ho(),F=p(c,d.id),L=p(c,d.open),J=p(c,d.openMethod),C=p(c,d.mounted),ne=p(c,d.popupProps),z=p(c,d.transitionStatus),P=p(c,d.triggerElement),a=p(c,d.positionerElement),h=p(c,d.listElement),Q=l.useRef(!1),H=l.useRef(!1),se=l.useRef({}),g=rs(),T=Fe(M=>{if(!a||!m.current||!H.current)return;const G=a.style.top==="0px",$=a.style.bottom==="0px";if(Q.current||!k||!G&&!$){S(M);return}const de=$t(a),Z=Je(a.getBoundingClientRect().height,"y",de),oe=wt(a),re=bt(a),ie=re.getComputedStyle(a),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),X=zt(re.getComputedStyle(m.current)),ae=Math.min(oe.documentElement.clientHeight-fe-q,X),E=M.scrollTop,Ae=st(M);let ye=null;const Se=te=>{a.style.height=`${te}px`},ce=G?Ae-E:E,ke=Math.min(Z+ce,ae);if(ce<=me){const te=Ke(ce,0,ae-Z);te>0&&Se(Z+te),M.scrollTop=G?Ae:0,ae-(Z+te)<=me&&(Q.current=!0),S(M);return}if(ae-ke>me)ye=G?1/0:0;else if($&&E<Ae){const te=Z+ce-ae;ye=E-(ce-te)}const Le=Math.ceil(ke);if(Le!==0&&Se(Le),ye!=null){const te=Ke(ye,0,st(M));Math.abs(M.scrollTop-te)>me&&(M.scrollTop=te)}Le>=ae-me&&(Q.current=!0),S(M)});l.useImperativeHandle(_,()=>T,[T]),pt({open:L,ref:m,onComplete(){L&&x?.(!0)}});const B={open:L,transitionStatus:z,side:V,align:w};xe(()=>{!a||!m.current||Object.keys(se.current).length||(se.current={top:a.style.top||"0",left:a.style.left||"0",right:a.style.right,height:a.style.height,bottom:a.style.bottom,minHeight:a.style.minHeight,maxHeight:a.style.maxHeight,marginTop:a.style.marginTop,marginBottom:a.style.marginBottom})},[m,a]),xe(()=>{L||k||(H.current=!1,Q.current=!1,dt(a,se.current))},[L,k,a,m]),xe(()=>{const M=m.current;if(!L||!P||!a||!M||k&&!W||c.state.transitionStatus==="ending")return;if(H.current=!0,M.style.removeProperty("--transform-origin"),!k){g.request(()=>S(h||M));return}const G=vo(M);try{let $=v.current;$?.isConnected||($=!d.hasSelectedValue(c.state)&&R.current?.isConnected?R.current:null);const de=y.current,Z=bt(a),oe=Z.getComputedStyle(a),re=Z.getComputedStyle(M),ie=wt(P),fe=$t(P),q=ot(P.getBoundingClientRect(),fe),X=ot(a.getBoundingClientRect(),fe),ae=q.height,E=h||M,Ae=E.scrollHeight,ye=parseFloat(re.borderBottomWidth),Se=parseFloat(oe.marginTop)||10,ce=parseFloat(oe.marginBottom)||10,ke=parseFloat(oe.minHeight)||100,Le=zt(re),te=5,mt=5,Qe=20,we=ie.documentElement.clientHeight-Se-ce,gt=ie.documentElement.clientWidth,Ge=we-q.bottom+ae;let ge,Ue=Y==="rtl"?q.right-X.width:q.left,_e=0;if($&&de){const pe=ot(de.getBoundingClientRect(),fe);ge=ot($.getBoundingClientRect(),fe),Ue=X.left+(Y==="rtl"?pe.right-ge.right:pe.left-ge.left);const qe=pe.top-q.top+pe.height/2;_e=ge.top-X.top+ge.height/2-qe}const Me=Ge+_e+ce+ye;let he=Math.min(we,Me);const Ee=we-Se-ce,ze=Me-he,$e=gt-mt;a.style.left=`${Ke(Ue,te,$e-X.width)}px`,a.style.height=`${he}px`,a.style.maxHeight="none",a.style.marginTop=`${Se}px`,a.style.marginBottom=`${ce}px`,M.style.height="100%";const Pe=st(E),Oe=ze>=Pe-me;Oe&&(he=Math.min(we,X.height)-(ze-Pe));const Ze=q.top<Qe||q.bottom>we-Qe||Math.ceil(he)+me<Math.min(Ae,ke),et=(Z.visualViewport?.scale??1)!==1&&ls;if(Ze||et){dt(a,se.current),O(!1);return}const tt=Math.max(ke,he);if(Oe){const pe=Math.max(0,we-Me);a.style.top=X.height>=Ee?"0":`${pe}px`,a.style.height=`${he}px`,E.scrollTop=st(E)}else a.style.bottom="0",E.scrollTop=ze;if(ge){const pe=X.top,qe=X.height,Xe=ge.top+ge.height/2,ht=Ke(qe>0?(Xe-pe)/qe*100:50,0,100);M.style.setProperty("--transform-origin",`50% ${ht}%`)}(tt===we||he>=Le)&&(Q.current=!0),S(E),I&&c.state.selectedIndex===null&&c.state.activeIndex===null&&N.current[0]!=null&&c.set("activeIndex",0)}finally{G()}},[c,L,a,P,y,R,v,m,S,k,O,g,h,N,I,Y,W]),l.useEffect(()=>{if(!k||!a||!L)return;const M=bt(a);function G($){b(!1,Te(Rs,$))}return is(M,"resize",G)},[b,k,a,L]);const ee={...h?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":D||void 0,id:`${F}-list`},onKeyDown(M){ue&&us.has(M.key)&&M.stopPropagation()},onScroll(M){h||T(M.currentTarget)},...k&&{style:h?{height:"100%"}:fn},className:!h&&k?It.className:void 0},ve=Ce("div",t,{ref:[s,m],state:B,stateAttributesMapping:xo,props:[ne,ee,Bn(z),u]});return n.jsxs(l.Fragment,{children:[!K&&It.getElement(le),n.jsx(as,{context:j,modal:!1,disabled:!C,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:ve})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function st(e){return At(e.scrollHeight,e.clientHeight)}function $t(e){return Fn.getScale(e)}function Je(e,t,s){return e/s[t]}function ot(e,t){return Hn({x:Je(e.x,"x",t),y:Je(e.y,"y",t),width:Je(e.width,"x",t),height:Je(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function vo(e){const{style:t}=e,s={};for(const[o,i]of qt)s[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of qt){const i=s[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const yo=l.forwardRef(function(t,s){const{render:o,className:i,style:f,...r}=t,{store:u,scrollHandlerRef:c,multiple:m}=be(),{alignItemWithTriggerActive:x}=Mt(),b=p(u,d.hasScrollArrows),y=p(u,d.openMethod),v={id:`${p(u,d.id)}-list`,role:"listbox","aria-multiselectable":m||void 0,onScroll(S){c.current?.(S.currentTarget)},...x&&{style:fn},className:b&&y!=="touch"?It.className:void 0},D=u.useStateSetter("listElement");return Ce("div",t,{ref:[s,D],props:[v,r]})}),pn=l.createContext(void 0);function Et(){const e=l.useContext(pn);if(!e)throw new Error(jt(57));return e}const So=l.memo(l.forwardRef(function(t,s){const{render:o,className:i,style:f,value:r=null,label:u,disabled:c=!1,nativeButton:m=!1,...x}=t,b=l.useRef(null),y=Ns({guess:!0,label:u,textRef:b}),{store:R,itemProps:v,setOpen:D,setValue:S,selectionRef:_,typingRef:N,valuesRef:I,multiple:j,selectedItemTextRef:V,disabled:w,readOnly:k}=be(),W=w||c,O=p(R,d.isActive,y.index),ue=p(R,d.open),Y=p(R,d.isSelected,r),le=p(R,d.isSelectedByFocus,y.index),K=p(R,d.isItemEqualToValue),F=y.index,L=l.useRef(null);xe(()=>{const g=I.current;return g[F]=r,()=>{delete g[F]}},[F,r,I]),xe(()=>{const g=R.state.value;let T=g;j&&Array.isArray(g)&&(T=g.length>0?g[g.length-1]:void 0),T!==void 0&&Ye(r,T,K)&&(R.set("selectedIndex",F),b.current&&(V.current=b.current))},[F,j,K,R,r,V]);const J=l.useRef("mouse"),C=l.useRef(!1),{getButtonProps:ne,buttonRef:z}=Gt({disabled:W,focusableWhenDisabled:!0,native:m,composite:!0}),P={disabled:W,selected:Y,highlighted:O};function a(g){if(w||k)return;const T=R.state.value;if(j){const B=Array.isArray(T)?T:[],ee=Y?Qs(B,r,K):[...B,r];S(ee,Te(yt,g))}else S(r,Te(yt,g)),D(!1,Te(yt,g))}function h(){_.current.dragY=0}const Q={role:"option","aria-selected":Y,tabIndex:ue&&O?0:-1,onKeyDown(g){R.set("activeIndex",F),g.key===" "&&N.current&&g.preventDefault()},onClick(g){const T=J.current!=="touch",B=g.nativeEvent.pointerType,ee=T&&ds(g.nativeEvent)&&(B!==void 0||O),ve=T&&!ee&&!C.current;C.current=!1,!(W||ve)&&a(g.nativeEvent)},onPointerEnter(g){J.current=g.pointerType},onPointerMove(g){if(g.pointerType==="mouse"&&g.buttons===1){const T=_.current;T.dragY+=g.movementY,T.dragY**2>=64&&(T.allowUnselectedMouseUp=!0)}},onPointerDown(g){J.current=g.pointerType,C.current=!0,h()},onMouseUp(){if(h(),W||J.current==="touch"||C.current)return;const g=!_.current.allowSelectedMouseUp&&Y,T=!_.current.allowUnselectedMouseUp&&!Y;g||T||(C.current=!0,L.current?.click(),C.current=!1)}},H=Ce("div",t,{ref:[z,s,y.ref,L],state:P,props:[v,Q,x,ne]}),se=l.useMemo(()=>({selected:Y,index:F,textRef:b,selectedByFocus:le}),[Y,F,b,le]);return n.jsx(pn.Provider,{value:se,children:H})})),wo=l.forwardRef(function(t,s){const{selected:o}=Et();return t.keepMounted||o?n.jsx(Ro,{...t,ref:s}):null}),Ro=l.memo(l.forwardRef((e,t)=>{const{render:s,className:o,style:i,keepMounted:f,...r}=e,{selected:u}=Et(),c=l.useRef(null),{transitionStatus:m,setMounted:x}=Tt(u),y=Ce("span",e,{ref:[t,c],state:{selected:u,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Ct});return pt({open:u,ref:c,onComplete(){u||x(!1)}}),y})),Io=l.memo(l.forwardRef(function(t,s){const{index:o,textRef:i,selectedByFocus:f}=Et(),{firstItemTextRef:r,selectedItemTextRef:u}=be(),{render:c,className:m,style:x,...b}=t,y=l.useCallback(v=>{v&&(o===0&&(r.current=v),f&&(u.current=v))},[r,u,o,f]);return Ce("div",t,{ref:[y,s,i],props:b})})),mn=l.forwardRef(function(t,s){const{render:o,className:i,style:f,direction:r,keepMounted:u,...c}=t,m=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:R,scrollArrowsMountedCountRef:v}=be(),{side:D,scrollDownArrowRef:S,scrollUpArrowRef:_}=Mt(),N=m?d.scrollUpArrowVisible:d.scrollDownArrowVisible,I=p(x,N),j=p(x,d.openMethod),V=I&&j!=="touch",w=rt(),k=m?_:S,{mounted:W,transitionStatus:O,setMounted:ue}=Tt(V);xe(()=>(v.current+=1,x.set("hasScrollArrows",!0),()=>{v.current=Math.max(0,v.current-1),v.current===0&&x.set("hasScrollArrows",!1)}),[x,v]),pt({open:V,ref:k,onComplete(){V||ue(!1)}});const K=Ce("div",t,{ref:[s,k],state:{direction:r,visible:V,side:D,transitionStatus:O},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||w.isStarted())return;x.set("activeIndex",null);function J(){const C=x.state.listElement??b.current;if(!C)return;x.set("activeIndex",null),R(C);const ne=At(C.scrollHeight,C.clientHeight),z=ut(C.scrollTop,ne),P=z===(m?0:ne),a=y.current;if(z!==C.scrollTop&&(C.scrollTop=z),P){w.clear();return}if(a.length>0){const h=k.current?.offsetHeight||0;C.scrollTop=jo(a,m,z,C.clientHeight,h,ne)}w.start(40,J)}w.start(40,J)},onMouseLeave(){w.clear()}},c],stateAttributesMapping:Ct});return W||u?K:null});function jo(e,t,s,o,i,f){if(t){let x=0;const b=s+i-me;for(let v=0;v<e.length;v+=1){const D=e[v];if(D&&D.offsetTop>=b){x=v;break}}const y=Math.max(0,x-1),R=e[y];return y<x&&R?ut(R.offsetTop-i,f):0}let r=e.length-1;const u=s+o-i+me;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>u){r=Math.max(0,x-1);break}}const c=Math.min(e.length-1,r+1),m=e[c];return c>r&&m?ut(m.offsetTop+m.offsetHeight-o+i,f):f}const To=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"down"})}),Co=l.forwardRef(function(t,s){return n.jsx(mn,{...t,ref:s,direction:"up"})}),Ao=no;function Mo({className:e,...t}){return n.jsx(ao,{"data-slot":"select-value",className:Be("flex flex-1 text-left",e),...t})}function Eo({className:e,size:t="default",children:s,...o}){return n.jsxs(lo,{"data-slot":"select-trigger","data-size":t,className:Be("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,n.jsx(co,{render:n.jsx(on,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Po({className:e,children:t,side:s="bottom",sideOffset:o=4,align:i="center",alignOffset:f=0,alignItemWithTrigger:r=!0,...u}){return n.jsx(uo,{children:n.jsx(po,{side:s,sideOffset:o,align:i,alignOffset:f,alignItemWithTrigger:r,className:"isolate z-50",children:n.jsxs(bo,{"data-slot":"select-content","data-align-trigger":r,className:Be("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[n.jsx(Vo,{}),n.jsx(yo,{children:t}),n.jsx(ko,{})]})})})}function No({className:e,children:t,...s}){return n.jsxs(So,{"data-slot":"select-item",className:Be("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[n.jsx(Io,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),n.jsx(wo,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Cs,{className:"pointer-events-none"})})]})}function Vo({className:e,...t}){return n.jsx(Co,{"data-slot":"select-scroll-up-button",className:Be("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx($s,{})})}function ko({className:e,...t}){return n.jsx(To,{"data-slot":"select-scroll-down-button",className:Be("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:n.jsx(on,{})})}function Lo(){const e=rn(),t=Xt(e.user.role,"people"),s=yn(e.user.role),o=Ot(Lt.members()),i=Ot(Lt.invites()),[f,r]=l.useState(!1),u=e.limits.members.limit,c=u!==null&&e.limits.members.used>=u;return n.jsxs("div",{className:"p-7",children:[n.jsx(ks,{title:"Members",sub:`${t?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${u!==null?` ${e.limits.members.used} of ${u} members.`:""}`,actions:s.length?n.jsxs(He,{onClick:()=>r(!0),disabled:c,title:c?`This studio's plan allows ${u} members.`:void 0,children:[n.jsx(_s,{}),"Invite"]}):void 0}),n.jsx(Jt,{className:"max-w-[1040px] overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"Name"}),n.jsx(Ie,{children:"Email"}),n.jsx(Ie,{children:"Role"}),t&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:(o.data?.data??[]).map(m=>n.jsx(Fo,{m,owner:t},m.email))})]})}),n.jsx(Oo,{}),(i.data?.data.length??0)>0&&n.jsx(Do,{invites:i.data.data,roles:s}),n.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",n.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),s.length>0&&n.jsx(Bo,{open:f,onOpenChange:r,mail:i.data?.mail??!1,roles:s})]})}const gn=e=>new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"}),ft={owner:"Owner",admin:"Admin",member:"Member"};function Oo(){return n.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:it.map(e=>n.jsxs("div",{className:"contents",children:[n.jsx("dt",{className:"font-medium",children:ft[e]}),n.jsx("dd",{className:"m-0 text-muted-foreground",children:Kt[e]})]},e))})}function Do({invites:e,roles:t}){const s=Hs(),o=t.length>0;return n.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[n.jsx("div",{id:"pending-invites",className:"mb-2",children:n.jsx(Ls,{children:"Pending invites"})}),n.jsx(Jt,{className:"overflow-hidden py-0",children:n.jsxs(tn,{children:[n.jsx(nn,{children:n.jsxs(ct,{children:[n.jsx(Ie,{children:"For"}),n.jsx(Ie,{children:"Role"}),n.jsx(Ie,{children:"Invited by"}),n.jsx(Ie,{children:"Expires"}),o&&n.jsx(Ie,{className:"w-0"})]})}),n.jsx(sn,{children:e.map(i=>n.jsxs(ct,{children:[n.jsx(je,{className:i.email?"":"text-muted-foreground",children:i.email??"Anyone with the link"}),n.jsx(je,{className:"capitalize",children:i.role}),n.jsx(je,{className:"text-muted-foreground",children:i.createdBy?i.createdBy.name||i.createdBy.email:"—"}),n.jsx(je,{className:"text-muted-foreground",children:gn(i.expiresAt)}),o&&n.jsx(je,{className:"text-right",children:t.includes(i.role)&&n.jsx(He,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${i.email??"anyone with the link"}`,disabled:s.isPending&&s.variables===i.id,onClick:()=>s.mutate(i.id),children:"Revoke"})})]},i.id))})]})})]})}function Fo({m:e,owner:t}){const s=Ds(),o=Fs(),[i,f]=l.useState(!1);return n.jsxs(ct,{children:[n.jsx(je,{children:n.jsxs("span",{className:"flex items-center gap-2.5",children:[n.jsx(Un,{className:"size-6",children:n.jsx(_n,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:Os(e.name,e.email)})}),n.jsx("span",{className:"font-medium",children:e.name||e.email}),e.you&&n.jsx(zn,{variant:"outline",className:"text-[11px]",children:"you"})]})}),n.jsx(je,{className:"text-muted-foreground",children:e.email}),n.jsx(je,{children:t?n.jsxs(Ao,{items:it.map(r=>({value:r,label:ft[r]})),value:e.role,onValueChange:r=>r&&r!==e.role&&s.mutate({email:e.email,role:r}),children:[n.jsx(Eo,{size:"sm","aria-label":`Role for ${e.email}`,className:"min-w-[104px] bg-card",children:n.jsx(Mo,{})}),n.jsx(Po,{children:it.map(r=>n.jsx(No,{value:r,children:ft[r]},r))})]}):n.jsx("span",{className:"capitalize",children:e.role})}),t&&n.jsxs(je,{className:"text-right",children:[!e.you&&n.jsx(He,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${e.email}`,onClick:()=>f(!0),children:n.jsx(fs,{})}),n.jsx(js,{open:i,onOpenChange:f,title:`Remove ${e.name||e.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:o.isPending,onConfirm:()=>{f(!1),o.mutate(e.email)}})]})]})}const Ho=wn({email:In([jn(""),Tn().trim().email("An email address, or leave it empty")]),role:Rn(it)});function Bo({open:e,onOpenChange:t,mail:s,roles:o}){const i=Bs(),f=Us(),[r,u]=l.useState(""),[c,m]=l.useState(null),[x,b]=l.useState(null),{register:y,handleSubmit:R,formState:v,reset:D,watch:S}=Cn({resolver:An(Ho),defaultValues:{role:"member",email:""}}),_=S("role"),N=w=>{t(w),w||(m(null),b(null),u(""),f.reset(),D())},I=R(async w=>{u("");try{m(await i.mutateAsync({role:w.role,...w.email?{email:w.email}:{}}))}catch(k){u(kt(k))}}),j=async()=>{if(c){u("");try{b((await f.mutateAsync({id:c.invite.id,token:c.token})).to)}catch(w){u(kt(w))}}},V=(c?.mail??s)&&!!c?.invite.email;return n.jsx(ps,{open:e,onOpenChange:N,children:n.jsx(ms,{children:c?n.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite link"}),n.jsxs(Ht,{children:[c.invite.email?`${c.invite.email} can`:"Anyone with this link can"," join as ",Sn(c.invite.role)," ","until ",gn(c.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:c.url}),n.jsx(Ts,{text:c.url,label:"Copy link",withText:!0})]}),V&&(x?n.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",x,"."]}):n.jsxs(He,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:c.invite.email?`Send by email to ${c.invite.email}`:void 0,loading:f.isPending,onClick:()=>void j(),children:[n.jsx(Ws,{}),n.jsx("span",{className:"min-w-0 truncate",children:f.isPending?"Sending…":`Send by email to ${c.invite.email}`})]})),n.jsx(Bt,{children:n.jsx(He,{type:"button",onClick:()=>N(!1),children:"Done"})})]}):n.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4",noValidate:!0,children:[n.jsxs(Dt,{children:[n.jsx(Ft,{children:"Invite someone"}),n.jsx(Ht,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),r&&n.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),n.jsxs("fieldset",{disabled:v.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(_t,{htmlFor:"invite-role",children:"Role"}),n.jsx(Xs,{id:"invite-role",className:"w-full",...y("role"),children:["member","admin","owner"].filter(w=>o.includes(w)).map(w=>n.jsx("option",{value:w,children:ft[w]},w))}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:Kt[_]??""})]}),n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs(_t,{htmlFor:"invite-email",children:["Email ",n.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),n.jsx(Is,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!v.errors.email,...y("email")}),n.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:v.errors.email?.message??(s?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),n.jsxs(Bt,{children:[n.jsx(He,{type:"button",variant:"outline",onClick:()=>N(!1),children:"Cancel"}),n.jsx(He,{type:"submit",loading:v.isSubmitting,children:v.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const dr=()=>Xt(rn().user.role,"settings")?n.jsx(Lo,{}):n.jsx(Vs,{title:"Members"});export{dr as component};
@@ -0,0 +1 @@
1
+ import{j as e,aj as S,r as N,S as $,h as c,B as y,A as _}from"./index-CHi2CcHb.js";import{u as b}from"./useQuery-U2FOgJPB.js";import{b as u}from"./InstanceRows-DexbQngM.js";import{A as C,P}from"./parts-CK9SS76R.js";import{u as f}from"./me-XTwFHhR6.js";import{C as R}from"./check-C21x2mpF.js";import"./useBaseQuery-DI4GfUK8.js";import"./dialog-qbXy4GE2.js";import"./label-Dff2Zjcb.js";import"./ConfirmDialog-CLal40kk.js";import"./labels--UUyt9uB.js";import"./card-B5svGaqA.js";function Y(){const s=f(),{said:n}=S.useSearch(),a=b(_.setupState()),l=a.data?.billingUrl??null,i=b({queryKey:["plan-state",l],enabled:!!l,queryFn:async()=>{const t=await fetch(`${l.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)throw new Error(String(t.status));return await t.json()}}),r=i.data,[d,w]=N.useState(!1),v=!!r?.plans.some(t=>t.yearly),h=r?.plans.find(t=>t.current);return e.jsxs("div",{className:"flex flex-col gap-8 p-7",children:[e.jsx(P,{title:"Plan & billing",sub:s.org.name}),n&&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:n}),a.isSuccess&&!l?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):i.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):r?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:[r.current?.name??h?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:r.current?.price??h?.price})]}),r.current?.period&&e.jsx("p",{className:"m-0 mt-1 text-[13px] text-ink-soft",children:r.current.period})]}),r.manage&&e.jsx("div",{children:e.jsx(x,{base:l,form:r.manage})}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(A,{})}),r.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:r.current.warning}),r.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:r.nudge.text}),e.jsx(x,{base:l,form:r.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"}),v&&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":d===t,onClick:()=>w(t),className:c("rounded-full px-3.5 py-1 text-[13px]",d===t?"bg-foreground text-background":"text-ink-soft"),children:t?e.jsxs(e.Fragment,{children:["Yearly ",e.jsx("span",{className:c("font-medium",d?"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:r.plans.map(t=>{const m=d&&t.yearly?t.yearly:null,g=m?m.actions:t.actions,k=t.relation==="downgrade";return e.jsxs("div",{className:c("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:c("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:[m?.amount??t.amount??t.price,(m?.unit??t.unit)&&e.jsx("span",{className:"ml-1 text-[13px] font-normal tracking-normal text-muted-foreground",children:m?.unit??t.unit})]}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-col gap-2 p-0",children:t.features.map(o=>e.jsxs("li",{className:c("flex gap-2 text-[13.5px]",t.added?.includes(o)&&"font-semibold"),children:[e.jsx(R,{className:"mt-0.5 size-4 shrink-0 text-ok","aria-hidden":!0}),o]},o))}),t.current?e.jsx(y,{type:"button",variant:"outline",disabled:!0,className:"w-full",children:"Current plan"}):k?g.map(o=>e.jsx(M,{base:l,form:o,warning:t.warning??null},o.label)):g.map(o=>e.jsx(x,{base:l,form:{...o,primary:!!t.recommended||o.primary},wide:!0},o.label))]},t.id)})}),e.jsxs("p",{className:"m-0 mt-5 text-center text-[13px] text-muted-foreground",children:[r.footer?e.jsxs("b",{className:"font-semibold text-foreground",children:[r.footer.split(". ")[0],"."]}):r.intro," ",r.footer?.split(". ").slice(1).join(". ")]}),r.notes.length>0&&e.jsx("p",{className:"m-0 mt-1.5 text-center text-[12px] text-muted-foreground",children:r.notes.join(" ")})]}):e.jsx($,{})]})}function M({base:s,form:n,warning:a}){const[l,i]=N.useState(!1);return a&&l?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(x,{base:s,form:{...n,label:"Downgrade anyway",primary:!1}}),e.jsx("button",{type:"button",className:"text-[13px] text-muted-foreground underline underline-offset-2",onClick:()=>i(!1),children:"Keep my plan"})]})]}):a?e.jsx("button",{type:"button",className:"self-center text-[13px] text-muted-foreground underline underline-offset-[3px]",onClick:()=>i(!0),children:n.label}):e.jsxs("form",{method:"post",action:new URL(n.action,s).toString(),className:"m-0 self-center",children:[Object.entries(n.fields).map(([r,d])=>e.jsx("input",{type:"hidden",name:r,value:d},r)),e.jsx("button",{type:"submit",className:"text-[13px] text-muted-foreground underline underline-offset-[3px]",children:n.label})]})}function x({base:s,form:n,wide:a}){return e.jsxs("form",{method:"post",action:new URL(n.action,s).toString(),className:"m-0",children:[Object.entries(n.fields).map(([l,i])=>e.jsx("input",{type:"hidden",name:l,value:i},l)),e.jsx(y,{type:"submit",variant:n.primary?"default":"outline",className:a?"w-full":void 0,children:n.label})]})}function A(){const{limits:s}=f(),n=[{label:"Sites",text:j(s.projects.used,s.projects.limit,"site","sites"),share:p(s.projects.used,s.projects.limit)},{label:"Members",text:j(s.members.used,s.members.limit,"member","members"),share:p(s.members.used,s.members.limit)},{label:"Screenshots",text:s.screenshots?s.storage.limit===null?`${u(s.storage.used)} used`:`${u(s.storage.used)} of ${u(s.storage.limit)}`:"Not on this plan",share:s.screenshots?p(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:n.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:c("h-full rounded-full",a.share>=1?"bg-destructive":"bg-brand"),style:{width:`${Math.min(100,Math.round(a.share*100))}%`}})})]},a.label))})}const p=(s,n)=>n===null||n===0?null:s/n,j=(s,n,a,l)=>n===null?`${s} ${s===1?a:l}, unlimited`:`${s} of ${n} ${n===1?a:l}`,Q=()=>f().user.role==="owner"?e.jsx(Y,{}):e.jsx(C,{title:"Plan & billing"});export{Q as component};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-p-qD6BlY.js";/**
1
+ import{c as t}from"./index-CHi2CcHb.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as i,i as ae,aa as re,e as se,ab as ie,E as ne,k as j,j as f,ak as oe,h as de}from"./index-p-qD6BlY.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as ge,c as me,n as ke}from"./label-CuvYMIVd.js";import{Q as ve,S as xe}from"./dialog-D5G50pSW.js";import{u as we}from"./useAriaLabelledBy-BT5NtL2E.js";import{u as ye}from"./useValueChanged-cwqHWzY1.js";const M=i.createContext(void 0);function Ce(){const r=i.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:v,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=s,{clearErrors:H}=le(),{state:R,setTouched:A,setDirty:O,validityData:W,setFilled:k,setFocused:P,validationMode:J,disabled:Q,name:U,validation:c}=ue(),{labelId:Y}=fe(),t=Q||N,l=U??w,n=i.useRef(null),_=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),S=h?void 0:E,[a,G]=be({controlled:v,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&k(n.current.checked)},[k]),ye(a,()=>{H(l),O(a!==W.initialValue),k(a),c.change(a)});const{getButtonProps:K,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,Y,n,!h,S),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(A(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:S,name:l,required:b,style:l?ve:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:_,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,I=me(ke,e.nativeEvent);V?.(u,I),!I.isCanceled&&G(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},B=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",s,{state:B,ref:[o,g,X],props:[$,q,K,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:B,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:v,className:F,style:x,...m}=s,p=Ce();return j("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
1
+ import{r as i,i as ae,ab as re,e as se,ac as ie,E as ne,k as j,j as f,al as oe,h as de}from"./index-CHi2CcHb.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as ge,c as me,n as ve}from"./label-Dff2Zjcb.js";import{Q as ke,S as xe}from"./dialog-qbXy4GE2.js";import{u as we}from"./useAriaLabelledBy-B3107P7l.js";import{u as ye}from"./useValueChanged-RTamjQR3.js";const M=i.createContext(void 0);function Ce(){const r=i.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=s,{clearErrors:H}=le(),{state:R,setTouched:A,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:Q,name:U,validation:c}=ue(),{labelId:Y}=fe(),t=Q||N,l=U??w,n=i.useRef(null),_=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),S=h?void 0:E,[a,G]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:K,buttonRef:X}=ie({disabled:t,native:h}),Z=we(m,Y,n,!h,S),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(A(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:S,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:_,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,I=me(ve,e.nativeEvent);V?.(u,I),!I.isCanceled&&G(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},B=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",s,{state:B,ref:[o,g,X],props:[$,q,K,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:B,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return j("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
@@ -1 +1 @@
1
- import{j as t,h as l}from"./index-p-qD6BlY.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
1
+ import{j as t,h as l}from"./index-CHi2CcHb.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
@@ -1 +1 @@
1
- import{r as u,e as l}from"./index-p-qD6BlY.js";import{u as c}from"./label-CuvYMIVd.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
1
+ import{r as u,e as l}from"./index-CHi2CcHb.js";import{u as c}from"./label-Dff2Zjcb.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};