@snagset/server 0.1.41 → 0.1.42

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 (76) hide show
  1. package/dist/routes/invites.js +19 -7
  2. package/dist/routes/invites.js.map +1 -1
  3. package/package.json +1 -1
  4. package/static/dashboard/assets/{CompositeItem-B_Ebe9qQ.js → CompositeItem-LCGvVtac.js} +1 -1
  5. package/static/dashboard/assets/{CompositeList-CDAPQTbv.js → CompositeList-Cty0rzq_.js} +1 -1
  6. package/static/dashboard/assets/{ConfirmDialog-D1II2uNE.js → ConfirmDialog-DIwxuqY9.js} +1 -1
  7. package/static/dashboard/assets/{CopyButton-qbA2ZHWn.js → CopyButton-DDGcA3Xd.js} +1 -1
  8. package/static/dashboard/assets/{FieldItemContext-BM_KzVUj.js → FieldItemContext-EmJLiYBJ.js} +1 -1
  9. package/static/dashboard/assets/{InstallTag-DTpNoMn9.js → InstallTag-DnVvf8zx.js} +1 -1
  10. package/static/dashboard/assets/{InstanceRows-B1z-L92-.js → InstanceRows-376JOINE.js} +1 -1
  11. package/static/dashboard/assets/{McpTokens-DE2t0iiS.js → McpTokens-C6CW9eYK.js} +1 -1
  12. package/static/dashboard/assets/{SaveState-QQHqDSgx.js → SaveState-R4390int.js} +1 -1
  13. package/static/dashboard/assets/{_app-CaDt6CPJ.js → _app-CAb1BtpQ.js} +1 -1
  14. package/static/dashboard/assets/{_app-B_DiSFIt.js → _app-DaKVP1n8.js} +13 -13
  15. package/static/dashboard/assets/activity-rK4Sf6B2.js +1 -0
  16. package/static/dashboard/assets/{arrow-left-RqdORgcq.js → arrow-left-6KOxG0mI.js} +1 -1
  17. package/static/dashboard/assets/{avatar-D8S5EME4.js → avatar-BHXI3Cxz.js} +1 -1
  18. package/static/dashboard/assets/{badge-anHWhPFa.js → badge-BVeGUvW4.js} +1 -1
  19. package/static/dashboard/assets/{card-C01exIzZ.js → card-CQykn6b-.js} +1 -1
  20. package/static/dashboard/assets/{check-Gm9Xu4rH.js → check-C5gLbOCB.js} +1 -1
  21. package/static/dashboard/assets/{chevron-down-C-pVPOKU.js → chevron-down-CNIHPCcw.js} +1 -1
  22. package/static/dashboard/assets/{chevron-right-BQmYcugl.js → chevron-right-voH028MP.js} +1 -1
  23. package/static/dashboard/assets/{copy-Ckk__4oN.js → copy-2WiQI5_8.js} +1 -1
  24. package/static/dashboard/assets/{dialog-D5G50pSW.js → dialog-I_D8p4LG.js} +1 -1
  25. package/static/dashboard/assets/{dropdown-menu-Bm_opJ2p.js → dropdown-menu-BD3iKpyK.js} +1 -1
  26. package/static/dashboard/assets/{forgot-R7JqXxs5.js → forgot-Buk2U0Iq.js} +1 -1
  27. package/static/dashboard/assets/{image-off-BtbHLgOM.js → image-off-pz0vPmjw.js} +1 -1
  28. package/static/dashboard/assets/{index-p-qD6BlY.js → index-DGJgBiEe.js} +15 -15
  29. package/static/dashboard/assets/invite-8sNxyTpF.js +1 -0
  30. package/static/dashboard/assets/{label-CuvYMIVd.js → label-ClUOe0Qf.js} +1 -1
  31. package/static/dashboard/assets/{labels-DLMjYGNJ.js → labels-ToSuNGQl.js} +1 -1
  32. package/static/dashboard/assets/{layout-grid-D5ek58h7.js → layout-grid-DLRb1zmb.js} +1 -1
  33. package/static/dashboard/assets/{parts-CN1uQywE.js → parts-CeW0gqpG.js} +1 -1
  34. package/static/dashboard/assets/{plus-BsxOLtMA.js → plus-DMA0pE49.js} +1 -1
  35. package/static/dashboard/assets/reset-citpUr97.js +1 -0
  36. package/static/dashboard/assets/s._site-BVRYrqWc.js +1 -0
  37. package/static/dashboard/assets/{s._site.comments-DmrtKLHb.js → s._site.comments-CupTJMag.js} +1 -1
  38. package/static/dashboard/assets/{s._site.reviewers-CGKj-NQo.js → s._site.reviewers-CgBIszUX.js} +1 -1
  39. package/static/dashboard/assets/{s._site.settings-DvWbfMac.js → s._site.settings-CEuj_wJ1.js} +1 -1
  40. package/static/dashboard/assets/{setup-BDZJmgIB.js → setup-otr5LUWS.js} +1 -1
  41. package/static/dashboard/assets/{sign-in-BmweKwDv.js → sign-in-BRpUPHbi.js} +1 -1
  42. package/static/dashboard/assets/{sign-up-C06mQl-c.js → sign-up-sC_IfvbO.js} +1 -1
  43. package/static/dashboard/assets/sites-D52Ciw1e.js +1 -0
  44. package/static/dashboard/assets/studio-0_bXXp2K.js +1 -0
  45. package/static/dashboard/assets/{studio-BHpeuJSq.js → studio-B02T4EY4.js} +1 -1
  46. package/static/dashboard/assets/studio.index-gCE2490t.js +1 -0
  47. package/static/dashboard/assets/studio.integrations-BrvDZjmR.js +1 -0
  48. package/static/dashboard/assets/{studio.members-CEKrbJHp.js → studio.members-CWZNCLCY.js} +2 -2
  49. package/static/dashboard/assets/{studio.plan-CkOzUaJM.js → studio.plan-Bwz6dizT.js} +1 -1
  50. package/static/dashboard/assets/{sun-DXwtJyi5.js → sun-CgLdWf2g.js} +1 -1
  51. package/static/dashboard/assets/{switch-cgJL6ATv.js → switch-BZw_bqWh.js} +1 -1
  52. package/static/dashboard/assets/{table-B8VTYpZO.js → table-t_7248Aq.js} +1 -1
  53. package/static/dashboard/assets/{useAriaLabelledBy-BT5NtL2E.js → useAriaLabelledBy-BSClfAH5.js} +1 -1
  54. package/static/dashboard/assets/{useBaseQuery-DaFWLbWu.js → useBaseQuery-BzwsA17g.js} +1 -1
  55. package/static/dashboard/assets/useQuery-dbNRhTlt.js +1 -0
  56. package/static/dashboard/assets/useRender-BJVEua-j.js +1 -0
  57. package/static/dashboard/assets/{useValueChanged-cwqHWzY1.js → useValueChanged-CEh0b15T.js} +1 -1
  58. package/static/dashboard/assets/{users-CGY0g3mg.js → users-DLfPGZtA.js} +1 -1
  59. package/static/dashboard/assets/{welcome-CNtwDQMd.js → welcome-qvhXOg78.js} +3 -3
  60. package/static/dashboard/assets/{widget-signin-BOUMPGXt.js → widget-signin-CB_pBDz0.js} +1 -1
  61. package/static/dashboard/assets/{you-DH4QMiND.js → you-0VVZ27jc.js} +1 -1
  62. package/static/dashboard/assets/{zod-DfHlfdUJ.js → zod-DrXRVGy0.js} +1 -1
  63. package/static/dashboard/index.html +1 -1
  64. package/static/widget/build.json +2 -2
  65. package/static/widget/snag.js +1 -1
  66. package/static/widget/snag.runtime.js +1 -1
  67. package/static/dashboard/assets/activity-CzEy_J8-.js +0 -1
  68. package/static/dashboard/assets/invite-9eotNL9V.js +0 -1
  69. package/static/dashboard/assets/reset-8K76tpdp.js +0 -1
  70. package/static/dashboard/assets/s._site-egkPDOj9.js +0 -1
  71. package/static/dashboard/assets/sites-CkGgns1o.js +0 -1
  72. package/static/dashboard/assets/studio-CG1QMBSK.js +0 -1
  73. package/static/dashboard/assets/studio.index-BOkmM7I5.js +0 -1
  74. package/static/dashboard/assets/studio.integrations-BBik3DdK.js +0 -1
  75. package/static/dashboard/assets/useQuery-D-9vXtOo.js +0 -1
  76. package/static/dashboard/assets/useRender-BBzDGtxq.js +0 -1
@@ -0,0 +1 @@
1
+ import{R as A,r as u,j as e,H as J,G as b,L as B,p as v,I as y,B as N,s as C,z as S,J as k,C as f,D as I,F as g}from"./index-DGJgBiEe.js";import{u as L,a as E}from"./zod-DrXRVGy0.js";import{L as j,I as w}from"./label-ClUOe0Qf.js";function D(){const s=A.useLoaderData(),[t,o]=u.useState(!1);return s.ok?!!s.me&&(!s.invite.email||s.invite.email.toLowerCase()===s.me.toLowerCase())&&!t?e.jsx(F,{token:s.token,invite:s.invite,me:s.me,onOther:()=>o(!0)}):e.jsx($,{token:s.token,invite:s.invite}):e.jsx(Y,{code:s.code,message:s.message})}function F({token:s,invite:t,me:o,onOther:i}){const d=v(),[r,x]=u.useState(""),[n,p]=u.useState(!1),a=t.org.name||"a studio",c=async()=>{x(""),p(!0);try{await C.acceptInvite({token:s,email:o}),S("in"),k.clear(),d({to:"/sites",replace:!0})}catch(l){if(l instanceof f&&l.code==="account_exists")return i();x(l instanceof f?l.message:"Could not reach the server. Try again."),p(!1)}};return e.jsx(b,{width:400,children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:["Join ",a]}),e.jsxs("p",{className:"m-0 mt-1.5 text-muted-foreground",children:[t.invitedBy?`${t.invitedBy} invited you`:"You were invited"," to join ",a," as ",y(t.role),". You are signed in as"," ",e.jsx("span",{className:"break-all text-foreground",children:o}),"."]})]}),r&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),e.jsx(N,{type:"button",size:"lg",loading:n,onClick:c,children:n?"Joining…":`Join ${a}`}),!t.email&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx("button",{type:"button",onClick:i,className:"cursor-pointer border-0 bg-transparent p-0 text-foreground underline underline-offset-4",children:"Join with another address"})})]})})}function Y({code:s,message:t}){const{title:o,signIn:i}=J(s);return e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:o}),e.jsx("p",{role:"alert",className:"m-0 text-muted-foreground",children:t}),i&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx(B,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})})]})})}const R=I({name:g().trim().max(120).optional(),email:g().trim().email("An email address"),password:g().min(1,"A password")});function $({token:s,invite:t}){const o=v(),[i,d]=u.useState(""),[r,x]=u.useState(!1),{register:n,handleSubmit:p,formState:a}=L({resolver:E(R),defaultValues:{email:t.email??"",name:""}}),c=t.org.name||"a studio",l=p(async m=>{if(d(""),!r&&m.password.length<12){d("The password must be at least 12 characters. A short phrase of real words is fine.");return}try{await C.acceptInvite({token:s,password:m.password,...m.name?{name:m.name}:{},...t.email?{}:{email:m.email}}),S("in"),k.clear(),o({to:"/sites",replace:!0})}catch(h){h instanceof f&&h.code==="account_exists"&&x(!0),d(h instanceof f?h.message:"Could not reach the server. Try again.")}});return e.jsx(b,{width:400,children:e.jsxs("form",{onSubmit:l,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:["Join ",c]}),e.jsxs("p",{className:"m-0 mt-1.5 text-muted-foreground",children:[t.invitedBy?`${t.invitedBy} invited you`:"You were invited"," to join ",c," as ",y(t.role),".",r?" Sign in with the account you already have here.":" Choose your password and you're in."]})]}),i&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:i}),e.jsxs("fieldset",{disabled:a.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(j,{htmlFor:"email",children:"Email"}),e.jsx(w,{id:"email",type:"email",autoComplete:"username",readOnly:!!t.email,"aria-invalid":!!a.errors.email,...n("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),!r&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(j,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(w,{id:"name",autoComplete:"name",...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(j,{htmlFor:"password",children:r?"Your password":"Choose a password"}),e.jsx(w,{id:"password",type:"password",autoComplete:r?"current-password":"new-password","aria-invalid":!!a.errors.password,...n("password")}),!r&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsx(N,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Joining…":`Join ${c}`})]})]})})}export{D as component};
@@ -1 +1 @@
1
- import{r as o,aj as l,i as J,E as V,b8 as W,a8 as A,f as M,e as v,l as X,b3 as Q,k as Z,j as w,h as _}from"./index-p-qD6BlY.js";function ee(t){return t?.ownerDocument||document}const te={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ne={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},se={disabled:!1,...ne},ae={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},re={invalid:void 0,name:void 0,validityData:{state:te,errors:[],error:"",value:"",initialValue:null},setValidityData:l,disabled:void 0,setTouched:l,setDirty:l,setFilled:l,setFocused:l,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:se,registerFieldControl:l,validation:{getValidationProps:(t,e=V)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:l,getInputControl:()=>null,commit:async()=>{},change:l}},oe=o.createContext(re);function N(t=!0){const e=o.useContext(oe);if(e.setValidityData===l&&!t)throw new Error(J(28));return e}const ie=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function le(){return o.useContext(ie)}let S=0;function ue(t,e="mui"){const[n,s]=o.useState(t),u=t||n;return o.useEffect(()=>{n==null&&(S+=1,s(`${e}-${S}`))},[n,e]),u}const L=W.useId;function de(t,e){if(L!==void 0){const n=L();return t??(e?`${e}-${n}`:n)}return ue(t,e)}function ce(t){return de(t,"base-ui")}const fe=o.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:t=>t});function U(){return o.useContext(fe)}function ge(t={}){const{id:e,implicit:n=!1,controlRef:s}=t,{controlId:u,registerControlId:i}=U(),a=ce(e),r=n?u:void 0,c=A(()=>Symbol()),p=o.useRef(!1),b=o.useRef(e!=null),f=M(()=>{!p.current||i===l||(p.current=!1,i(c.current,void 0))});return v(()=>{if(i===l)return;let m;if(n){const I=s?.current;X(I)&&I.closest("label")!=null?m=e??null:m=r??a}else if(e!=null)b.current=!0,m=e;else if(b.current)m=a;else{f();return}if(m===void 0){f();return}p.current=!0,i(c.current,m)},[e,s,r,i,n,a,c,f]),o.useEffect(()=>f,[f]),u??a}function pe(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function he(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Q(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function we(t){return"composedPath"in t?t.composedPath()[0]:t.target}function me({controlled:t,default:e,name:n,state:s="value"}){const{current:u}=o.useRef(t!==void 0),[i,a]=o.useState(e),r=u?t:i,c=o.useCallback(p=>{u||a(p)},[]);return[r,c]}function be(t,e,n,s,u=!0,i){const{registerFieldControl:a}=N(),r=A(()=>Symbol());v(()=>{const c=r.current;if(!u){a(c,void 0);return}a(c,{controlRef:t,getValue:s,id:e,name:i,value:n})},[t,u,s,e,i,a,r,n]),v(()=>{const c=r.current;return()=>{a(c,void 0)}},[a,r])}const ve="none",Te="trigger-press",ye="trigger-hover",Fe="trigger-focus",De="outside-press",Pe="item-press",Se="close-press",Le="focus-out",Ve="escape-key",Ae="list-navigation",Me="cancel-open",_e="sibling-open",Ne="disabled",Ue="imperative-action",ke="window-resize";function Ie(t,e,n,s){let u=!1,i=!1;const a=s??V;return{reason:t,event:e??new Event("base-ui"),cancel(){u=!0},allowPropagation(){i=!0},get isCanceled(){return u},get isPropagationAllowed(){return i},trigger:n,...a}}const Ee=o.forwardRef(function(e,n){const{render:s,className:u,id:i,name:a,value:r,disabled:c=!1,onValueChange:p,defaultValue:b,autoFocus:f=!1,style:m,...I}=e,{state:k,name:O,disabled:j,setTouched:T,setDirty:B,validityData:$,setFocused:E,setFilled:R,validationMode:z,validation:g}=N(),{clearErrors:K}=le(),C=j||c,y=O??a,Y={...k,disabled:C},{labelId:q}=U(),F=ge({id:i});v(()=>{const d=r!=null;g.inputRef.current?.value||d&&r!==""?R(!0):d&&r===""&&R(!1)},[g.inputRef,R,r]);const h=o.useRef(null);v(()=>{f&&h.current===pe(ee(h.current))&&E(!0)},[f,E]);const[G]=me({controlled:r,default:b,name:"FieldControl",state:"value"}),D=r!==void 0,P=D?G:void 0,H=M(()=>g.inputRef.current?.value);return be(g.inputRef,F,P,H,!C,a),Z("input",e,{ref:[n,h],state:Y,props:[{id:F,disabled:C,name:y,ref:g.inputRef,"aria-labelledby":q,autoFocus:f,...D?{value:P}:{defaultValue:b},onChange(d){const x=d.currentTarget.value;p?.(x,Ie(ve,d.nativeEvent)),B(x!==($.initialValue??"")),R(x!==""),d.nativeEvent.defaultPrevented||(K(y),g.change(x))},onFocus(){E(!0)},onBlur(d){T(!0),E(!1),z==="onBlur"&&g.commit(d.currentTarget.value)},onKeyDown(d){d.currentTarget.tagName==="INPUT"&&d.key==="Enter"&&(T(!0),g.commit(d.currentTarget.value))}},I,d=>g.getValidationProps(C,d)],stateAttributesMapping:ae})}),Re=o.forwardRef(function(e,n){return w.jsx(Ee,{ref:n,...e})});function Oe({className:t,type:e,...n}){return w.jsx(Re,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...n})}function je({className:t,...e}){return w.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{_e as A,Ae as B,Se as C,Oe as I,je as L,he as a,ye as b,Ie as c,Ne as d,de as e,le as f,we as g,N as h,Ue as i,ge as j,me as k,be as l,Le as m,ve as n,De as o,U as p,ae as q,ee as r,Me as s,Te as t,ce as u,Pe as v,ke as w,pe as x,Fe as y,Ve as z};
1
+ import{r as o,aj as l,i as J,E as V,b8 as W,a8 as A,f as M,e as v,l as X,b3 as Q,k as Z,j as w,h as _}from"./index-DGJgBiEe.js";function ee(t){return t?.ownerDocument||document}const te={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},ne={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},se={disabled:!1,...ne},ae={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},re={invalid:void 0,name:void 0,validityData:{state:te,errors:[],error:"",value:"",initialValue:null},setValidityData:l,disabled:void 0,setTouched:l,setDirty:l,setFilled:l,setFocused:l,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:se,registerFieldControl:l,validation:{getValidationProps:(t,e=V)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:l,getInputControl:()=>null,commit:async()=>{},change:l}},oe=o.createContext(re);function N(t=!0){const e=o.useContext(oe);if(e.setValidityData===l&&!t)throw new Error(J(28));return e}const ie=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function le(){return o.useContext(ie)}let S=0;function ue(t,e="mui"){const[n,s]=o.useState(t),u=t||n;return o.useEffect(()=>{n==null&&(S+=1,s(`${e}-${S}`))},[n,e]),u}const L=W.useId;function de(t,e){if(L!==void 0){const n=L();return t??(e?`${e}-${n}`:n)}return ue(t,e)}function ce(t){return de(t,"base-ui")}const fe=o.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:t=>t});function U(){return o.useContext(fe)}function ge(t={}){const{id:e,implicit:n=!1,controlRef:s}=t,{controlId:u,registerControlId:i}=U(),a=ce(e),r=n?u:void 0,c=A(()=>Symbol()),p=o.useRef(!1),b=o.useRef(e!=null),f=M(()=>{!p.current||i===l||(p.current=!1,i(c.current,void 0))});return v(()=>{if(i===l)return;let m;if(n){const I=s?.current;X(I)&&I.closest("label")!=null?m=e??null:m=r??a}else if(e!=null)b.current=!0,m=e;else if(b.current)m=a;else{f();return}if(m===void 0){f();return}p.current=!0,i(c.current,m)},[e,s,r,i,n,a,c,f]),o.useEffect(()=>f,[f]),u??a}function pe(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function he(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&Q(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function we(t){return"composedPath"in t?t.composedPath()[0]:t.target}function me({controlled:t,default:e,name:n,state:s="value"}){const{current:u}=o.useRef(t!==void 0),[i,a]=o.useState(e),r=u?t:i,c=o.useCallback(p=>{u||a(p)},[]);return[r,c]}function be(t,e,n,s,u=!0,i){const{registerFieldControl:a}=N(),r=A(()=>Symbol());v(()=>{const c=r.current;if(!u){a(c,void 0);return}a(c,{controlRef:t,getValue:s,id:e,name:i,value:n})},[t,u,s,e,i,a,r,n]),v(()=>{const c=r.current;return()=>{a(c,void 0)}},[a,r])}const ve="none",Te="trigger-press",ye="trigger-hover",Fe="trigger-focus",De="outside-press",Pe="item-press",Se="close-press",Le="focus-out",Ve="escape-key",Ae="list-navigation",Me="cancel-open",_e="sibling-open",Ne="disabled",Ue="imperative-action",ke="window-resize";function Ie(t,e,n,s){let u=!1,i=!1;const a=s??V;return{reason:t,event:e??new Event("base-ui"),cancel(){u=!0},allowPropagation(){i=!0},get isCanceled(){return u},get isPropagationAllowed(){return i},trigger:n,...a}}const Ee=o.forwardRef(function(e,n){const{render:s,className:u,id:i,name:a,value:r,disabled:c=!1,onValueChange:p,defaultValue:b,autoFocus:f=!1,style:m,...I}=e,{state:k,name:O,disabled:j,setTouched:T,setDirty:B,validityData:$,setFocused:E,setFilled:R,validationMode:z,validation:g}=N(),{clearErrors:K}=le(),C=j||c,y=O??a,Y={...k,disabled:C},{labelId:q}=U(),F=ge({id:i});v(()=>{const d=r!=null;g.inputRef.current?.value||d&&r!==""?R(!0):d&&r===""&&R(!1)},[g.inputRef,R,r]);const h=o.useRef(null);v(()=>{f&&h.current===pe(ee(h.current))&&E(!0)},[f,E]);const[G]=me({controlled:r,default:b,name:"FieldControl",state:"value"}),D=r!==void 0,P=D?G:void 0,H=M(()=>g.inputRef.current?.value);return be(g.inputRef,F,P,H,!C,a),Z("input",e,{ref:[n,h],state:Y,props:[{id:F,disabled:C,name:y,ref:g.inputRef,"aria-labelledby":q,autoFocus:f,...D?{value:P}:{defaultValue:b},onChange(d){const x=d.currentTarget.value;p?.(x,Ie(ve,d.nativeEvent)),B(x!==($.initialValue??"")),R(x!==""),d.nativeEvent.defaultPrevented||(K(y),g.change(x))},onFocus(){E(!0)},onBlur(d){T(!0),E(!1),z==="onBlur"&&g.commit(d.currentTarget.value)},onKeyDown(d){d.currentTarget.tagName==="INPUT"&&d.key==="Enter"&&(T(!0),g.commit(d.currentTarget.value))}},I,d=>g.getValidationProps(C,d)],stateAttributesMapping:ae})}),Re=o.forwardRef(function(e,n){return w.jsx(Ee,{ref:n,...e})});function Oe({className:t,type:e,...n}){return w.jsx(Re,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...n})}function je({className:t,...e}){return w.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{_e as A,Ae as B,Se as C,Oe as I,je as L,he as a,ye as b,Ie as c,Ne as d,de as e,le as f,we as g,N as h,Ue as i,ge as j,me as k,be as l,Le as m,ve as n,De as o,U as p,ae as q,ee as r,Me as s,Te as t,ce as u,Pe as v,ke as w,pe as x,Fe as y,Ve as z};
@@ -1 +1 @@
1
- import{u as s,Q as n,d as o}from"./useBaseQuery-DaFWLbWu.js";import{z as a}from"./index-p-qD6BlY.js";function u(r,t){return s({...r,enabled:!0,suspense:!0,throwOnError:o,placeholderData:void 0},n)}function f(){return u(a.me()).data}const i=["open","progress","review","resolved"],c={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},d={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function g(r){return i.includes(r)}function h(r,t=Date.now()){if(!r)return"";const e=Math.max(0,(t-new Date(r).getTime())/1e3);return e<60?"now":e<3600?`${Math.floor(e/60)} min`:e<86400?`${Math.floor(e/3600)} h`:e<86400*30?`${Math.floor(e/86400)} d`:new Date(r).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function v(r,t=""){const e=r.trim().split(/\s+/).filter(Boolean);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():e.length===1&&e[0].length>0?e[0].slice(0,2).toUpperCase():(t[0]??"?").toUpperCase()}export{c as S,v as a,h as b,i as c,d,g as i,f as u};
1
+ import{u as s,Q as n,d as o}from"./useBaseQuery-BzwsA17g.js";import{A as a}from"./index-DGJgBiEe.js";function u(r,t){return s({...r,enabled:!0,suspense:!0,throwOnError:o,placeholderData:void 0},n)}function f(){return u(a.me()).data}const i=["open","progress","review","resolved"],c={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},d={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function g(r){return i.includes(r)}function h(r,t=Date.now()){if(!r)return"";const e=Math.max(0,(t-new Date(r).getTime())/1e3);return e<60?"now":e<3600?`${Math.floor(e/60)} min`:e<86400?`${Math.floor(e/3600)} h`:e<86400*30?`${Math.floor(e/86400)} d`:new Date(r).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function v(r,t=""){const e=r.trim().split(/\s+/).filter(Boolean);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():e.length===1&&e[0].length>0?e[0].slice(0,2).toUpperCase():(t[0]??"?").toUpperCase()}export{c as S,v as a,h as b,i as c,d,g as i,f as u};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-p-qD6BlY.js";/**
1
+ import{c as t}from"./index-DGJgBiEe.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c,j as e,h as i}from"./index-p-qD6BlY.js";import{C as m}from"./card-C01exIzZ.js";import{S as x,d as l,i as d}from"./labels-DLMjYGNJ.js";/**
1
+ import{c,j as e,h as i}from"./index-DGJgBiEe.js";import{C as m}from"./card-CQykn6b-.js";import{S as x,d as l,i as d}from"./labels-ToSuNGQl.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-p-qD6BlY.js";/**
1
+ import{c as e}from"./index-DGJgBiEe.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{u as c,a as g,b as j,K as b,r as m,j as e,N as w,p as N,s as v,z as S,J as y,C as L,G as u,B as C,P as E,L as k,Q as A,D as F,F as R}from"./index-DGJgBiEe.js";import{u as P,a as B}from"./zod-DrXRVGy0.js";import{L as l,I as d}from"./label-ClUOe0Qf.js";function z(s){const t=c();return g(t.stores.location,j(s,t))}function K(){const s=b.useLoaderData(),t=c(),a=z({select:r=>w(r.hash)});return m.useEffect(()=>{a!==s.hash&&t.invalidate()},[a,s.hash,t]),s.ok?e.jsx(I,{token:s.token,email:s.email}):e.jsx(D,{code:s.code,message:s.message})}function D({code:s,message:t}){const{title:a,next:r}=E(s);return e.jsx(u,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:a}),e.jsx("p",{role:"alert",className:"m-0 text-muted-foreground",children:t}),e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:e.jsx(k,{to:r==="sign-in"?"/sign-in":"/forgot",className:"text-foreground underline underline-offset-4",children:A[r]})})]})})}const G=F({password:R().min(12,"At least 12 characters")});function I({token:s,email:t}){const a=N(),[r,i]=m.useState(""),{register:x,handleSubmit:h,formState:o}=P({resolver:B(G)}),p=h(async({password:f})=>{i("");try{await v.confirmReset(s,f),S("in"),y.clear(),a({to:"/sites",replace:!0})}catch(n){i(n instanceof L?n.message:"Could not reach the server. Try again.")}});return e.jsx(u,{children:e.jsxs("form",{onSubmit:p,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:"Choose a new password"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Setting it signs you in here, and signs you out everywhere the old one was used."})]}),r&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),e.jsxs("fieldset",{disabled:o.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(l,{htmlFor:"email",children:"Email"}),e.jsx(d,{id:"email",type:"email",autoComplete:"username",readOnly:!0,value:t})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(l,{htmlFor:"password",children:"New password"}),e.jsx(d,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!o.errors.password,...x("password")}),o.errors.password?e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:o.errors.password.message}):e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsx(C,{type:"submit",size:"lg",loading:o.isSubmitting,children:o.isSubmitting?"Setting…":"Set the password and sign in"})]})]})})}export{K as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-DGJgBiEe.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1,4 +1,4 @@
1
- import{c as re,r as x,i as Is,a8 as Bs,ab as Ps,e as Qe,aj as Xe,aa as _s,m as Fs,E as Ls,k as os,j as e,ak as Os,g as Vs,h as A,B as $,al as is,am as qs,a6 as Ze,an as Ye,a5 as ls,A as Us,ao as es,p as Ks,ap as Hs,aq as ss,ar as Ws,as as Gs,at as Js,au as Qs,av as Xs,aw as Zs,ax as Ys,ay as et,az as st,aA as tt,q as Re,aB as Ne,L as ds,C as nt,af as ts,D as pe,aC as at,z as Te}from"./index-p-qD6BlY.js";import{u as we}from"./useQuery-D-9vXtOo.js";import{C as cs}from"./check-Gm9Xu4rH.js";import{q as rt,f as ot,h as it,p as lt,u as ns,k as dt,l as ct,c as ut,n as mt,L as Ke,I as Be}from"./label-CuvYMIVd.js";import{Q as ht,S as xt,N as pt,A as ft,a2 as gt,E as us,G as ms,I as hs,H as xs,J as ps,K as fs,X as bt}from"./dialog-D5G50pSW.js";import{u as jt}from"./FieldItemContext-BM_KzVUj.js";import{u as vt}from"./useAriaLabelledBy-BT5NtL2E.js";import{u as yt}from"./useValueChanged-cwqHWzY1.js";import{D as te,e as ne,f as ae,h as he,i as $e,j as H,k as gs,E as as,l as Ee,m as J,S as kt}from"./dropdown-menu-Bm_opJ2p.js";import{A as fe,b as ge}from"./avatar-D8S5EME4.js";import{C as bs}from"./ConfirmDialog-D1II2uNE.js";import{b as He,S as js,E as qe}from"./parts-CN1uQywE.js";import{C as Ce}from"./chevron-down-C-pVPOKU.js";import{S as be,i as Nt,b as Pe,c as Ie,a as Me,u as wt}from"./labels-DLMjYGNJ.js";import{C as Ct}from"./copy-Ckk__4oN.js";import{I as St}from"./image-off-BtbHLgOM.js";import{C as $t}from"./chevron-right-BQmYcugl.js";import{I as Mt}from"./InstallTag-DTpNoMn9.js";import{A as At}from"./arrow-left-RqdORgcq.js";import"./useBaseQuery-DaFWLbWu.js";import"./CompositeList-CDAPQTbv.js";import"./CompositeItem-B_Ebe9qQ.js";import"./card-C01exIzZ.js";/**
1
+ import{c as re,r as x,i as Is,a8 as Bs,ab as Ps,e as Qe,aj as Xe,aa as _s,m as Fs,E as Ls,k as os,j as e,ak as Os,g as Vs,h as A,B as $,al as is,am as qs,a6 as Ze,an as Ye,a5 as ls,C as Us,ao as es,p as Ks,ap as Hs,aq as ss,ar as Ws,as as Gs,at as Js,au as Qs,av as Xs,aw as Zs,ax as Ys,ay as et,az as st,aA as tt,q as Re,aB as Ne,L as ds,D as nt,af as ts,F as pe,aC as at,A as Te}from"./index-DGJgBiEe.js";import{u as we}from"./useQuery-dbNRhTlt.js";import{C as cs}from"./check-C5gLbOCB.js";import{q as rt,f as ot,h as it,p as lt,u as ns,k as dt,l as ct,c as ut,n as mt,L as Ke,I as Be}from"./label-ClUOe0Qf.js";import{Q as ht,S as xt,N as pt,A as ft,a2 as gt,E as us,G as ms,I as hs,H as xs,J as ps,K as fs,X as bt}from"./dialog-I_D8p4LG.js";import{u as jt}from"./FieldItemContext-EmJLiYBJ.js";import{u as vt}from"./useAriaLabelledBy-BSClfAH5.js";import{u as yt}from"./useValueChanged-CEh0b15T.js";import{D as te,e as ne,f as ae,h as he,i as $e,j as H,k as gs,E as as,l as Ee,m as J,S as kt}from"./dropdown-menu-BD3iKpyK.js";import{A as fe,b as ge}from"./avatar-BHXI3Cxz.js";import{C as bs}from"./ConfirmDialog-DIwxuqY9.js";import{b as He,S as js,E as qe}from"./parts-CeW0gqpG.js";import{C as Ce}from"./chevron-down-CNIHPCcw.js";import{S as be,i as Nt,b as Pe,c as Ie,a as Me,u as wt}from"./labels-ToSuNGQl.js";import{C as Ct}from"./copy-2WiQI5_8.js";import{I as St}from"./image-off-pz0vPmjw.js";import{C as $t}from"./chevron-right-voH028MP.js";import{I as Mt}from"./InstallTag-DnVvf8zx.js";import{A as At}from"./arrow-left-6KOxG0mI.js";import"./useBaseQuery-BzwsA17g.js";import"./CompositeList-Cty0rzq_.js";import"./CompositeItem-LCGvVtac.js";import"./card-CQykn6b-.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{aT as A,r as f,j as e,B as g,aU as S,q as E,h as I,aV as L,z as N,a1 as M,C as P,D as y}from"./index-p-qD6BlY.js";import{u as C}from"./useQuery-D-9vXtOo.js";import{u as U,a as F}from"./zod-DfHlfdUJ.js";import{C as R}from"./card-C01exIzZ.js";import{X as $,E as z,G as B,I as H,H as V,J as q,K}from"./dialog-D5G50pSW.js";import{L as k,I as Y}from"./label-CuvYMIVd.js";import{T as G,a as J,b as D,c as p,d as O,e as j}from"./table-B8VTYpZO.js";import{C as Q}from"./ConfirmDialog-D1II2uNE.js";import{C as X}from"./CopyButton-qbA2ZHWn.js";import{P as W,E as Z}from"./parts-CN1uQywE.js";import{u as _,b as T}from"./labels-DLMjYGNJ.js";import{C as ee}from"./check-Gm9Xu4rH.js";import{U as se}from"./users-CGY0g3mg.js";import{P as ne}from"./plus-BsxOLtMA.js";import"./useBaseQuery-DaFWLbWu.js";import"./copy-Ckk__4oN.js";function ye(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),i=C(N.links(s)),c=C(N.origins(s)),[m,o]=f.useState(!1),[t,n]=f.useState(null);f.useEffect(()=>n(null),[s]);const a=i.data?.data??[],x=c.data?.origins[0]?.replace(/\/+$/,"")??"",r=t?`${x}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>o(!0),children:[e.jsx(ne,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(W,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(ee,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:r}),e.jsx(X,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>n(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(D,{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(te,{link:u,uid:s,onRevoked:()=>n(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:n})]})}function te({link:s,uid:l,onRevoked:i}){const c=S(l),m=E(_().user.role,"settings"),[o,t]=f.useState(!1),n=!!s.revokedAt,a=!n&&new Date(s.expiresAt).getTime()<=Date.now(),x=n||a,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:I(x&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:n?e.jsxs("span",{children:["Revoked ",T(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?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!n&&m&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>t(!0),children:"Revoke"}),e.jsx(Q,{open:o,onOpenChange:t,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:c.isPending,onConfirm:()=>{t(!1),i(),c.mutate(s.id)}})]})]})}const ae=P({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function re({uid:s,open:l,onOpenChange:i,onMinted:c}){const m=L(s),o=C({...N.rounds(s),enabled:l}),[t,n]=f.useState(""),{register:a,handleSubmit:x,formState:r,reset:v}=U({resolver:F(ae),defaultValues:{days:"14",roundId:""}}),u=x(async d=>{n("");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){n(M(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(z,{open:l,onOpenChange:i,children:e.jsx(B,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(H,{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."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(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{ye as component};
1
+ import{aT as A,r as f,j as e,B as g,aU as S,q as E,h as I,aV as F,A as N,a2 as L,D as M,F as y}from"./index-DGJgBiEe.js";import{u as C}from"./useQuery-dbNRhTlt.js";import{u as P,a as U}from"./zod-DrXRVGy0.js";import{C as R}from"./card-CQykn6b-.js";import{X as $,E as B,G as H,I as z,H as V,J as q,K}from"./dialog-I_D8p4LG.js";import{L as k,I as Y}from"./label-ClUOe0Qf.js";import{T as G,a as J,b as D,c as p,d as O,e as j}from"./table-t_7248Aq.js";import{C as Q}from"./ConfirmDialog-DIwxuqY9.js";import{C as X}from"./CopyButton-DDGcA3Xd.js";import{P as W,E as Z}from"./parts-CeW0gqpG.js";import{u as _,b as T}from"./labels-ToSuNGQl.js";import{C as ee}from"./check-C5gLbOCB.js";import{U as se}from"./users-DLfPGZtA.js";import{P as ne}from"./plus-DMA0pE49.js";import"./useBaseQuery-BzwsA17g.js";import"./copy-2WiQI5_8.js";function ye(){const{site:s}=A.useParams(),{site:l}=A.useRouteContext(),i=C(N.links(s)),c=C(N.origins(s)),[m,o]=f.useState(!1),[t,n]=f.useState(null);f.useEffect(()=>n(null),[s]);const a=i.data?.data??[],x=c.data?.origins[0]?.replace(/\/+$/,"")??"",r=t?`${x}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>o(!0),children:[e.jsx(ne,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(W,{title:"Reviewers",sub:`Each reviewer gets their own link to ${l.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(ee,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:r}),e.jsx(X,{text:r,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>n(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(D,{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(te,{link:u,uid:s,onRevoked:()=>n(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:n})]})}function te({link:s,uid:l,onRevoked:i}){const c=S(l),m=E(_().user.role,"settings"),[o,t]=f.useState(!1),n=!!s.revokedAt,a=!n&&new Date(s.expiresAt).getTime()<=Date.now(),x=n||a,r=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(D,{className:I(x&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:n?e.jsxs("span",{children:["Revoked ",T(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?T(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!n&&m&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>t(!0),children:"Revoke"}),e.jsx(Q,{open:o,onOpenChange:t,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:c.isPending,onConfirm:()=>{t(!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}),[t,n]=f.useState(""),{register:a,handleSubmit:x,formState:r,reset:v}=P({resolver:U(ae),defaultValues:{days:"14",roundId:""}}),u=x(async d=>{n("");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){n(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."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(k,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(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{ye as component};
@@ -1 +1 @@
1
- import{r as l,i as Me,aj as de,aa as Fe,e as ue,ab as Ye,E as me,k as he,j as e,ak as Ue,f as Q,a9 as je,aX as Qe,h as pe,q as ge,aY as Xe,aZ as Je,B as V,z as Te,a_ as Ze,a$ as et,p as tt,b0 as st}from"./index-p-qD6BlY.js";import{u as Le}from"./useQuery-D-9vXtOo.js";import{q as Ve,h as Ke,p as He,u as ze,j as nt,c as at,n as ot,g as Re,f as it,k as rt,l as dt,a as lt,I as ae,L as q}from"./label-CuvYMIVd.js";import{a2 as ct,Q as ut,S as mt,N as ft,A as ht,aN as Ce,aI as Ie,aC as le,ay as ce,aO as we,aP as ke,a3 as pt,aQ as Ne,az as gt,aA as xt,aR as Se,aS as Ee,aT as Pe,aU as De,aV as bt,aW as vt,X as yt}from"./dialog-D5G50pSW.js";import{u as jt,C as Rt}from"./CompositeList-CDAPQTbv.js";import{s as Ct,i as It}from"./serializeValue-DRMAHja_.js";import{u as wt}from"./useValueChanged-cwqHWzY1.js";import{C as kt}from"./CompositeItem-B_Ebe9qQ.js";import{u as Nt}from"./FieldItemContext-BM_KzVUj.js";import{u as St}from"./useAriaLabelledBy-BT5NtL2E.js";import{C as Be}from"./ConfirmDialog-D1II2uNE.js";import{C as Et}from"./CopyButton-qbA2ZHWn.js";import{I as Pt}from"./InstallTag-DTpNoMn9.js";import{B as Dt}from"./badge-anHWhPFa.js";import{a as ne,A as At,P as Ot}from"./parts-CN1uQywE.js";import{u as xe}from"./labels-DLMjYGNJ.js";import{S as Ae}from"./switch-cgJL6ATv.js";import{S as Mt}from"./SaveState-QQHqDSgx.js";import{P as Ft}from"./plus-BsxOLtMA.js";import"./useBaseQuery-DaFWLbWu.js";import"./check-Gm9Xu4rH.js";import"./copy-Ckk__4oN.js";import"./useRender-BBzDGtxq.js";import"./card-C01exIzZ.js";const Tt=l.createContext(void 0);function Lt(s=!1){const t=l.useContext(Tt);if(!t&&!s)throw new Error(Me(86));return t}function Vt(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":""}},...ct,...Ve},Ge="data-composite-item-active",We=l.createContext(void 0);function Kt(){return l.useContext(We)}const $e=l.createContext(void 0);function Ht(){const s=l.useContext($e);if(s===void 0)throw new Error(Me(52));return s}const zt=l.forwardRef(function(t,n){const{render:d,className:i,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:o,inputRef:T,nativeButton:h=!1,id:O,style:y,...j}=t,I=Kt(),{disabled:E,readOnly:_,required:b,form:z,checkedValue:R,touched:M=!1,validation:B,name:w,setCheckedValue:$=de,setTouched:Y=de,registerInputRef:a=de}=I??{},{setTouched:g,setFilled:v,state:k,disabled:P}=Ke(),D=Nt(),{labelId:K,getDescriptionProps:X}=He(),m=P||D.disabled||E||c,f=_||r,L=b||p,H=z,N=I?R===o:o==="",F=l.useRef(null),S=l.useRef(null),G=B?.registerInput,W=l.useCallback(C=>G?.(C,{controlRef:F,value:void 0}),[G]),J=Fe(T,S,a,W);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){a(null);return}a(S.current)}},[N,m,a]);const ee=ze(),te=nt({id:O,implicit:!1,controlRef:F}),se=h?void 0:te,oe=St(x,K,S,!h,se),ie={role:"radio","aria-checked":N,"aria-labelledby":oe,[Ge]:N?"":void 0,id:h?te:ee,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||!M||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=Ye({disabled:m,native:h,composite:!1}),A={type:"radio",ref:J,form:H,id:se,name:w,tabIndex:-1,style:w?ut:mt,"aria-hidden":!0,...o!==void 0?{value:Ct(o)}:me,disabled:m,checked:N,required:L,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||o===void 0)return;const Z=at(ot,C.nativeEvent);$(o,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){F.current?.focus()}},U=l.useMemo(()=>({...k,required:L,disabled:m,readOnly:f,checked:N}),[k,m,f,N,L]),qe=U,be=I!==void 0,ve=[n,F,u],ye=[ie,j,re,X,B?C=>B.getValidationProps(m,C):me],_e=he("span",t,{enabled:!be,state:U,ref:ve,props:ye,stateAttributesMapping:fe});return e.jsxs($e.Provider,{value:qe,children:[be?e.jsx(kt,{tag:"span",render:d,className:i,style:y,state:U,refs:ve,props:ye,stateAttributesMapping:fe}):_e,e.jsx("input",{...A,suppressHydrationWarning:!0})]})}),Bt=l.forwardRef(function(t,n){const{render:d,className:i,style:c,keepMounted:r=!1,...p}=t,x=Ht(),o=x.checked,{mounted:T,transitionStatus:h,setMounted:O}=ft(o),y={...x,transitionStatus:h},j=l.useRef(null),I=r||T,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return ht({open:o,ref:j,onComplete(){o||O(!1)}}),I?E:null}),Gt=[];function Wt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:i,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:o=!1,stopEventPropagation:T,disabledIndices:h,modifierKeys:O=Gt}=s,[y,j]=l.useState(0),I=d!=null,E=l.useRef(null),_=Fe(E,x),b=l.useRef([]),z=l.useRef(!1),R=r??y,M=Q((a,g=!1)=>{if((p??j)(a),g){const v=b.current[a];Ce(E.current,v,c,n)}}),B=Q(a=>{if(a.size===0||z.current)return;z.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(Ge))??null,k=v?a.get(v)?.index??-1:-1;if(k!==-1)M(k);else if(Ie(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||M(P)}Ce(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!z.current)return;const a=b.current;if(Ie(a,R,h)){const g=le(a,{disabledIndices:h});ce(a,g)||M(g)}},[h,r,R,b,M]);const w=Q((a,g,v)=>i?i(a,g,v,b):v),$=Q(a=>{const g=a.key===we||a.key===ke;if(!pt.has(a.key)||!o&&g||$t(a,O)||!E.current)return;const k=c==="rtl",P=k?Pe:De,D=k?De:Pe,K=n==="vertical"?Se:P,X=n==="vertical"?Ee:D,m=Re(a.nativeEvent);if(m!=null&&Ne(m)&&!It(m)){const S=m.selectionStart,G=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==G||a.key!==X&&S<W.length||a.key!==K&&S>0)return}let f=R;const L=gt(b,h),H=xt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:a,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:L,onLoop:w,orientation:n,rtl:k}));const N=n!=="vertical"&&a.key===P||n!=="horizontal"&&a.key===Se,F=n!=="vertical"&&a.key===D||n!=="horizontal"&&a.key===Ee;o&&(a.key===we?f=L:a.key===ke&&(f=H)),f===R&&(N||F)&&(t&&f===H&&N?(f=L,i&&(f=i(a,R,f,b))):t&&f===L&&F?(f=H,i&&(f=i(a,R,f,b))):f=le(b.current,{startingIndex:f,decrement:F,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(T&&a.stopPropagation(),(I||g||N||F)&&a.preventDefault(),M(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(a){const g=E.current,v=Re(a.nativeEvent);!g||v==null||!Ne(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:$},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:b,onMapChange:B,relayKeyboardEvent:$}}function $t(s,t){for(const n of bt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function qt(s){const{render:t,className:n,style:d,refs:i=je,props:c=je,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:o,orientation:T,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:I,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:z,highlightItemOnHover:R=!1,tag:M="div",...B}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=Wt({grid:h,loopFocus:O,onLoop:y,orientation:T,highlightedIndex:x,onHighlightedIndexChange:o,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:w,disabledIndices:b,modifierKeys:z}),P=he(M,s,{state:r,ref:i,props:[$,...c,B],stateAttributesMapping:p}),D=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:a,highlightItemOnHover:R,relayKeyboardEvent:k}),[Y,a,R,k]);return e.jsx(Qe.Provider,{value:D,children:e.jsx(Rt,{elementsRef:g,onMapChange:K=>{I?.(K),v(K)},children:P})})}const _t=[vt],Yt=l.forwardRef(function(t,n){const{render:d,className:i,disabled:c,readOnly:r,required:p,onValueChange:x,value:o,defaultValue:T,form:h,name:O,inputRef:y,id:j,style:I,...E}=t,{setTouched:_,setFocused:b,validationMode:z,name:R,disabled:M,state:B,validation:w,setDirty:$,setFilled:Y,validityData:a}=Ke(),{labelId:g}=He(),{clearErrors:v,elementRef:k}=it(),P=Lt(!0),D=M||c,K=R??O,X=ze(j),[m,f]=rt({controlled:o,default:T,name:"RadioGroup",state:"value"}),[L,H]=l.useState(!1),N=Q((u,A)=>{x?.(u,A),!A.isCanceled&&f(u)}),F=w.getInputControl,S=l.useMemo(()=>({get current(){return F()}}),[F]),G=l.useRef(null),W=l.useRef(null);function J(u){let A;return y&&(typeof y=="function"?A=y(u):y.current=u),G.current=u,A}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const A=G.current,U=u.checked||A==null||A.disabled?J(u):void 0;return()=>{W.current===u&&(W.current=null),G.current===u?U?(U(),G.current=null):J(null):U?.()}}),te=Q(()=>{const u=k.current;if(!u)return m??null;for(const A of w.registeredInputs.keys())if(A.checked&&Vt(A,u))return m??null;return null});dt(S,X,m??null,te,!D,O),wt(m,()=>{v(K),$(m!==a.initialValue),Y(m!=null),w.change(m);const u=W.current;m==null&&u&&!u.disabled&&J(u)});const se=g??P?.legendId,oe={...B,disabled:D??!1,required:p??!1,readOnly:r??!1},ie=l.useMemo(()=>({checkedValue:m,disabled:D,form:h,validation:w,name:K,readOnly:r,registerInputRef:ee,required:p,setCheckedValue:N,setTouched:H,touched:L}),[m,D,h,w,K,r,ee,p,N,H,L]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":D||void 0,"aria-readonly":r||void 0,"aria-labelledby":se,onFocus(){b(!0)},onBlur(u){lt(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),z==="onBlur"&&w.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(We.Provider,{value:ie,children:e.jsx(qt,{render:d,className:i,style:I,state:oe,props:[re,E,u=>w.getValidationProps(D??!1,u)],refs:[n],stateAttributesMapping:Ve,enableHomeAndEndKeys:!1,modifierKeys:_t})})});function Ut({className:s,...t}){return e.jsx(Yt,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Qt({className:s,...t}){return e.jsx(zt,{"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(Bt,{"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"),i=n.data?.data??[],c=i.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ne,{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:[i.map(r=>e.jsx(Jt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&i.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 Jt({uid:s,round:t,manager:n,last:d}){const i=Xe(s),c=Je(s),[r,p]=l.useState(!1),[x,o]=l.useState(t.name),[T,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=i.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const I=x.trim();if(!I||I===t.name)return p(!1);i.mutate({id:t.id,name:I},{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(V,{type:"submit",size:"sm",disabled:!x.trim()||i.isPending,children:"Save"}),e.jsx(V,{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(V,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{o(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>i.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>i.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(V,{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:T,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 Zt=[{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 es(){const{site:s}=Ze.useParams(),t=xe(),n=t.projects.find(o=>o.uid===s),d=ge(t.user.role,"settings"),i=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(Ot,{title:"Settings",sub:n.name,actions:e.jsx(Mt,{saving:c.isPending,savedAt:r})}),e.jsxs(ne,{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(Et,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(ts,{name:n.name,onSave:o=>x({name:o})}),e.jsx(ss,{domain:i.data?.domain??null,loaded:i.isSuccess,onSave:o=>x({domain:o})}),e.jsx(ns,{list:i.data?.origins??[],loaded:i.isSuccess,hasDomain:!!i.data?.domain,onChange:o=>x({origins:o})})]}),e.jsxs(ne,{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(Ae,{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(Ae,{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(Ut,{value:n.writeMode,onValueChange:o=>x({writeMode:String(o)}),className:"gap-2",children:Zt.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(Qt,{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(Pt,{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(as,{uid:s,name:n.name})]})}function ts({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const i=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),i&&t(n.trim())},children:[e.jsx(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)}),i&&e.jsx(V,{type:"submit",variant:"outline",children:"Save"})]})]})}function ss({domain:s,loaded:t,onSave:n}){const[d,i]=l.useState(s??"");l.useEffect(()=>i(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=>i(r.target.value),disabled:!t}),c&&e.jsx(V,{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 ns({list:s,loaded:t,hasDomain:n,onChange:d}){const[i,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(V,{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(yt,{})})]},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=i.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:i,onChange:r=>c(r.target.value)}),e.jsxs(V,{type:"submit",variant:"outline",disabled:!i.trim(),children:[e.jsx(Ft,{}),"Add"]})]})]})}function as({uid:s,name:t}){const[n,d]=l.useState(!1),i=tt(),c=st(s);return e.jsxs(ne,{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(V,{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),i({to:"/sites"})}})})]})}const Es=()=>ge(xe().user.role,"settings")?e.jsx(es,{}):e.jsx(At,{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{Es as component};
1
+ import{r as l,i as Me,aj as de,aa as Fe,e as ue,ab as Ye,E as me,k as he,j as e,ak as Ue,f as Q,a9 as je,aX as Qe,h as pe,q as ge,aY as Xe,aZ as Je,B as V,A as Te,a_ as Ze,a$ as et,p as tt,b0 as st}from"./index-DGJgBiEe.js";import{u as Le}from"./useQuery-dbNRhTlt.js";import{q as Ve,h as Ke,p as He,u as Be,j as nt,c as at,n as ot,g as Re,f as it,k as rt,l as dt,a as lt,I as ae,L as q}from"./label-ClUOe0Qf.js";import{a2 as ct,Q as ut,S as mt,N as ft,A as ht,aN as Ce,aI as Ie,aC as le,ay as ce,aO as we,aP as ke,a3 as pt,aQ as Ne,az as gt,aA as xt,aR as Se,aS as Ee,aT as Pe,aU as De,aV as bt,aW as vt,X as yt}from"./dialog-I_D8p4LG.js";import{u as jt,C as Rt}from"./CompositeList-Cty0rzq_.js";import{s as Ct,i as It}from"./serializeValue-DRMAHja_.js";import{u as wt}from"./useValueChanged-CEh0b15T.js";import{C as kt}from"./CompositeItem-LCGvVtac.js";import{u as Nt}from"./FieldItemContext-EmJLiYBJ.js";import{u as St}from"./useAriaLabelledBy-BSClfAH5.js";import{C as ze}from"./ConfirmDialog-DIwxuqY9.js";import{C as Et}from"./CopyButton-DDGcA3Xd.js";import{I as Pt}from"./InstallTag-DnVvf8zx.js";import{B as Dt}from"./badge-BVeGUvW4.js";import{a as ne,A as At,P as Ot}from"./parts-CeW0gqpG.js";import{u as xe}from"./labels-ToSuNGQl.js";import{S as Ae}from"./switch-BZw_bqWh.js";import{S as Mt}from"./SaveState-R4390int.js";import{P as Ft}from"./plus-DMA0pE49.js";import"./useBaseQuery-BzwsA17g.js";import"./check-C5gLbOCB.js";import"./copy-2WiQI5_8.js";import"./useRender-BJVEua-j.js";import"./card-CQykn6b-.js";const Tt=l.createContext(void 0);function Lt(s=!1){const t=l.useContext(Tt);if(!t&&!s)throw new Error(Me(86));return t}function Vt(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":""}},...ct,...Ve},Ge="data-composite-item-active",We=l.createContext(void 0);function Kt(){return l.useContext(We)}const $e=l.createContext(void 0);function Ht(){const s=l.useContext($e);if(s===void 0)throw new Error(Me(52));return s}const Bt=l.forwardRef(function(t,n){const{render:d,className:i,disabled:c=!1,readOnly:r=!1,required:p=!1,"aria-labelledby":x,value:o,inputRef:T,nativeButton:h=!1,id:O,style:y,...j}=t,I=Kt(),{disabled:E,readOnly:_,required:b,form:B,checkedValue:R,touched:M=!1,validation:z,name:w,setCheckedValue:$=de,setTouched:Y=de,registerInputRef:a=de}=I??{},{setTouched:g,setFilled:v,state:k,disabled:P}=Ke(),D=Nt(),{labelId:K,getDescriptionProps:X}=He(),m=P||D.disabled||E||c,f=_||r,L=b||p,H=B,N=I?R===o:o==="",F=l.useRef(null),S=l.useRef(null),G=z?.registerInput,W=l.useCallback(C=>G?.(C,{controlRef:F,value:void 0}),[G]),J=Fe(T,S,a,W);ue(()=>{S.current?.checked&&v(!0)},[v]),ue(()=>{if(S.current){if(m&&N){a(null);return}a(S.current)}},[N,m,a]);const ee=Be(),te=nt({id:O,implicit:!1,controlRef:F}),se=h?void 0:te,oe=St(x,K,S,!h,se),ie={role:"radio","aria-checked":N,"aria-labelledby":oe,[Ge]:N?"":void 0,id:h?te:ee,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||!M||(S.current?.click(),Y(!1))}},{getButtonProps:re,buttonRef:u}=Ye({disabled:m,native:h,composite:!1}),A={type:"radio",ref:J,form:H,id:se,name:w,tabIndex:-1,style:w?ut:mt,"aria-hidden":!0,...o!==void 0?{value:Ct(o)}:me,disabled:m,checked:N,required:L,readOnly:f,onChange(C){if(C.nativeEvent.defaultPrevented||m||f||o===void 0)return;const Z=at(ot,C.nativeEvent);$(o,Z),!Z.isCanceled&&g(!0)},onClick(C){C.stopPropagation()},onFocus(){F.current?.focus()}},U=l.useMemo(()=>({...k,required:L,disabled:m,readOnly:f,checked:N}),[k,m,f,N,L]),qe=U,be=I!==void 0,ve=[n,F,u],ye=[ie,j,re,X,z?C=>z.getValidationProps(m,C):me],_e=he("span",t,{enabled:!be,state:U,ref:ve,props:ye,stateAttributesMapping:fe});return e.jsxs($e.Provider,{value:qe,children:[be?e.jsx(kt,{tag:"span",render:d,className:i,style:y,state:U,refs:ve,props:ye,stateAttributesMapping:fe}):_e,e.jsx("input",{...A,suppressHydrationWarning:!0})]})}),zt=l.forwardRef(function(t,n){const{render:d,className:i,style:c,keepMounted:r=!1,...p}=t,x=Ht(),o=x.checked,{mounted:T,transitionStatus:h,setMounted:O}=ft(o),y={...x,transitionStatus:h},j=l.useRef(null),I=r||T,E=he("span",t,{ref:[n,j],state:y,props:p,stateAttributesMapping:fe});return ht({open:o,ref:j,onComplete(){o||O(!1)}}),I?E:null}),Gt=[];function Wt(s){const{loopFocus:t=!0,orientation:n="both",grid:d,onLoop:i,direction:c,highlightedIndex:r,onHighlightedIndexChange:p,rootRef:x,enableHomeAndEndKeys:o=!1,stopEventPropagation:T,disabledIndices:h,modifierKeys:O=Gt}=s,[y,j]=l.useState(0),I=d!=null,E=l.useRef(null),_=Fe(E,x),b=l.useRef([]),B=l.useRef(!1),R=r??y,M=Q((a,g=!1)=>{if((p??j)(a),g){const v=b.current[a];Ce(E.current,v,c,n)}}),z=Q(a=>{if(a.size===0||B.current)return;B.current=!0;const g=Array.from(a.keys()),v=g.find(P=>P?.hasAttribute(Ge))??null,k=v?a.get(v)?.index??-1:-1;if(k!==-1)M(k);else if(Ie(g,R,h)){const P=le(g,{disabledIndices:h});ce(g,P)||M(P)}Ce(E.current,v,c,n)});ue(()=>{if(h==null||r!=null||!B.current)return;const a=b.current;if(Ie(a,R,h)){const g=le(a,{disabledIndices:h});ce(a,g)||M(g)}},[h,r,R,b,M]);const w=Q((a,g,v)=>i?i(a,g,v,b):v),$=Q(a=>{const g=a.key===we||a.key===ke;if(!pt.has(a.key)||!o&&g||$t(a,O)||!E.current)return;const k=c==="rtl",P=k?Pe:De,D=k?De:Pe,K=n==="vertical"?Se:P,X=n==="vertical"?Ee:D,m=Re(a.nativeEvent);if(m!=null&&Ne(m)&&!It(m)){const S=m.selectionStart,G=m.selectionEnd,W=m.value;if(S==null||a.shiftKey||S!==G||a.key!==X&&S<W.length||a.key!==K&&S>0)return}let f=R;const L=gt(b,h),H=xt(b,h);d!=null&&(f=d({disabledIndices:h,elementsRef:b,event:a,highlightedIndex:R,loopFocus:t,maxIndex:H,minIndex:L,onLoop:w,orientation:n,rtl:k}));const N=n!=="vertical"&&a.key===P||n!=="horizontal"&&a.key===Se,F=n!=="vertical"&&a.key===D||n!=="horizontal"&&a.key===Ee;o&&(a.key===we?f=L:a.key===ke&&(f=H)),f===R&&(N||F)&&(t&&f===H&&N?(f=L,i&&(f=i(a,R,f,b))):t&&f===L&&F?(f=H,i&&(f=i(a,R,f,b))):f=le(b.current,{startingIndex:f,decrement:F,disabledIndices:h})),f!==R&&!ce(b.current,f)&&(T&&a.stopPropagation(),(I||g||N||F)&&a.preventDefault(),M(f,!0),queueMicrotask(()=>{b.current[f]?.focus()}))});return{props:{ref:_,onFocus(a){const g=E.current,v=Re(a.nativeEvent);!g||v==null||!Ne(v)||v.setSelectionRange(0,v.value.length)},onKeyDown:$},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:b,onMapChange:z,relayKeyboardEvent:$}}function $t(s,t){for(const n of bt)if(!t.includes(n)&&s.getModifierState(n))return!0;return!1}function qt(s){const{render:t,className:n,style:d,refs:i=je,props:c=je,state:r=me,stateAttributesMapping:p,highlightedIndex:x,onHighlightedIndexChange:o,orientation:T,grid:h,loopFocus:O,onLoop:y,enableHomeAndEndKeys:j,onMapChange:I,stopEventPropagation:E=!0,rootRef:_,disabledIndices:b,modifierKeys:B,highlightItemOnHover:R=!1,tag:M="div",...z}=s,w=jt(),{props:$,highlightedIndex:Y,onHighlightedIndexChange:a,elementsRef:g,onMapChange:v,relayKeyboardEvent:k}=Wt({grid:h,loopFocus:O,onLoop:y,orientation:T,highlightedIndex:x,onHighlightedIndexChange:o,rootRef:_,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:w,disabledIndices:b,modifierKeys:B}),P=he(M,s,{state:r,ref:i,props:[$,...c,z],stateAttributesMapping:p}),D=l.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:a,highlightItemOnHover:R,relayKeyboardEvent:k}),[Y,a,R,k]);return e.jsx(Qe.Provider,{value:D,children:e.jsx(Rt,{elementsRef:g,onMapChange:K=>{I?.(K),v(K)},children:P})})}const _t=[vt],Yt=l.forwardRef(function(t,n){const{render:d,className:i,disabled:c,readOnly:r,required:p,onValueChange:x,value:o,defaultValue:T,form:h,name:O,inputRef:y,id:j,style:I,...E}=t,{setTouched:_,setFocused:b,validationMode:B,name:R,disabled:M,state:z,validation:w,setDirty:$,setFilled:Y,validityData:a}=Ke(),{labelId:g}=He(),{clearErrors:v,elementRef:k}=it(),P=Lt(!0),D=M||c,K=R??O,X=Be(j),[m,f]=rt({controlled:o,default:T,name:"RadioGroup",state:"value"}),[L,H]=l.useState(!1),N=Q((u,A)=>{x?.(u,A),!A.isCanceled&&f(u)}),F=w.getInputControl,S=l.useMemo(()=>({get current(){return F()}}),[F]),G=l.useRef(null),W=l.useRef(null);function J(u){let A;return y&&(typeof y=="function"?A=y(u):y.current=u),G.current=u,A}const ee=Q(u=>{if(!u||u.disabled)return;W.current||(W.current=u);const A=G.current,U=u.checked||A==null||A.disabled?J(u):void 0;return()=>{W.current===u&&(W.current=null),G.current===u?U?(U(),G.current=null):J(null):U?.()}}),te=Q(()=>{const u=k.current;if(!u)return m??null;for(const A of w.registeredInputs.keys())if(A.checked&&Vt(A,u))return m??null;return null});dt(S,X,m??null,te,!D,O),wt(m,()=>{v(K),$(m!==a.initialValue),Y(m!=null),w.change(m);const u=W.current;m==null&&u&&!u.disabled&&J(u)});const se=g??P?.legendId,oe={...z,disabled:D??!1,required:p??!1,readOnly:r??!1},ie=l.useMemo(()=>({checkedValue:m,disabled:D,form:h,validation:w,name:K,readOnly:r,registerInputRef:ee,required:p,setCheckedValue:N,setTouched:H,touched:L}),[m,D,h,w,K,r,ee,p,N,H,L]),re={id:j,role:"radiogroup","aria-required":p||void 0,"aria-disabled":D||void 0,"aria-readonly":r||void 0,"aria-labelledby":se,onFocus(){b(!0)},onBlur(u){lt(u.currentTarget,u.relatedTarget)||(_(!0),b(!1),B==="onBlur"&&w.commit(m))},onKeyDownCapture(u){u.key.startsWith("Arrow")&&(H(!0),b(!0))}};return e.jsx(We.Provider,{value:ie,children:e.jsx(qt,{render:d,className:i,style:I,state:oe,props:[re,E,u=>w.getValidationProps(D??!1,u)],refs:[n],stateAttributesMapping:Ve,enableHomeAndEndKeys:!1,modifierKeys:_t})})});function Ut({className:s,...t}){return e.jsx(Yt,{"data-slot":"radio-group",className:pe("grid w-full gap-2",s),...t})}function Qt({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"),i=n.data?.data??[],c=i.filter(r=>!r.closed&&!r.archived).length;return e.jsxs(ne,{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:[i.map(r=>e.jsx(Jt,{uid:s,round:r,manager:d,last:!r.closed&&!r.archived&&c===1},r.id)),n.isSuccess&&i.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 Jt({uid:s,round:t,manager:n,last:d}){const i=Xe(s),c=Je(s),[r,p]=l.useState(!1),[x,o]=l.useState(t.name),[T,h]=l.useState(!1),O=t.archived?"archived":t.closed?"closed":"open",y=i.isPending||c.isPending;return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 py-2.5 first:pt-0 last:pb-0",children:[r?e.jsxs("form",{className:"flex min-w-0 flex-1 items-center gap-2",onSubmit:j=>{j.preventDefault();const I=x.trim();if(!I||I===t.name)return p(!1);i.mutate({id:t.id,name:I},{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(V,{type:"submit",size:"sm",disabled:!x.trim()||i.isPending,children:"Save"}),e.jsx(V,{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(V,{size:"sm",variant:"ghost","aria-label":`Rename ${t.name}`,disabled:y,onClick:()=>{o(t.name),p(!0)},children:"Rename"}),!t.archived&&e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.closed?"Reopen":"Close"} ${t.name}`,disabled:y||d,onClick:()=>i.mutate({id:t.id,closed:!t.closed}),children:t.closed?"Reopen":"Close"}),e.jsx(V,{size:"sm",variant:"ghost","aria-label":`${t.archived?"Restore":"Archive"} ${t.name}`,disabled:y||d,onClick:()=>i.mutate({id:t.id,archived:!t.archived}),children:t.archived?"Restore":"Archive"}),e.jsx(V,{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(ze,{open:T,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 Zt=[{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 es(){const{site:s}=Ze.useParams(),t=xe(),n=t.projects.find(o=>o.uid===s),d=ge(t.user.role,"settings"),i=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(Ot,{title:"Settings",sub:n.name,actions:e.jsx(Mt,{saving:c.isPending,savedAt:r})}),e.jsxs(ne,{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(Et,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(ts,{name:n.name,onSave:o=>x({name:o})}),e.jsx(ss,{domain:i.data?.domain??null,loaded:i.isSuccess,onSave:o=>x({domain:o})}),e.jsx(ns,{list:i.data?.origins??[],loaded:i.isSuccess,hasDomain:!!i.data?.domain,onChange:o=>x({origins:o})})]}),e.jsxs(ne,{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(Ae,{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(Ae,{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(Ut,{value:n.writeMode,onValueChange:o=>x({writeMode:String(o)}),className:"gap-2",children:Zt.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(Qt,{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(Pt,{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(as,{uid:s,name:n.name})]})}function ts({name:s,onSave:t}){const[n,d]=l.useState(s);l.useEffect(()=>d(s),[s]);const i=n.trim().length>0&&n.trim()!==s;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:c=>{c.preventDefault(),i&&t(n.trim())},children:[e.jsx(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)}),i&&e.jsx(V,{type:"submit",variant:"outline",children:"Save"})]})]})}function ss({domain:s,loaded:t,onSave:n}){const[d,i]=l.useState(s??"");l.useEffect(()=>i(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=>i(r.target.value),disabled:!t}),c&&e.jsx(V,{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 ns({list:s,loaded:t,hasDomain:n,onChange:d}){const[i,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(V,{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(yt,{})})]},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=i.trim();p&&(d([...s,p]),c(""))},children:[e.jsx(ae,{id:"site-origin-add",placeholder:"https://staging.example.com",value:i,onChange:r=>c(r.target.value)}),e.jsxs(V,{type:"submit",variant:"outline",disabled:!i.trim(),children:[e.jsx(Ft,{}),"Add"]})]})]})}function as({uid:s,name:t}){const[n,d]=l.useState(!1),i=tt(),c=st(s);return e.jsxs(ne,{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(V,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>d(!0),children:["Delete ",t,"…"]})]}),e.jsx(ze,{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),i({to:"/sites"})}})})]})}const Es=()=>ge(xe().user.role,"settings")?e.jsx(es,{}):e.jsx(At,{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{Es 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-DGJgBiEe.js";import{u as v,a as F}from"./zod-DrXRVGy0.js";import{L as i,I as o}from"./label-ClUOe0Qf.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-DGJgBiEe.js";import{u as x}from"./useQuery-dbNRhTlt.js";import{u as z,a as A}from"./zod-DrXRVGy0.js";import{L as p,I as h}from"./label-ClUOe0Qf.js";import{C as I}from"./chevron-right-voH028MP.js";import"./useBaseQuery-BzwsA17g.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-DGJgBiEe.js";import{u as b,a as S}from"./zod-DrXRVGy0.js";import{L as i,I as o}from"./label-ClUOe0Qf.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 v,a1 as N,r as u,j as e,B as c,L as w,p as y,d as A,s as S,C as $,D as k,F as h}from"./index-DGJgBiEe.js";import{u as C,a as _}from"./zod-DrXRVGy0.js";import{C as D}from"./card-CQykn6b-.js";import{E,G as F,I,H as L,J as P,K as z}from"./dialog-I_D8p4LG.js";import{L as g,I as j}from"./label-ClUOe0Qf.js";import{P as q,E as H}from"./parts-CeW0gqpG.js";import{u as K,b as T}from"./labels-ToSuNGQl.js";import{P as f}from"./plus-DMA0pE49.js";import{L as B}from"./layout-grid-DLRb1zmb.js";import{I as G}from"./image-off-pz0vPmjw.js";import"./useBaseQuery-BzwsA17g.js";function te(){const t=K(),a=v(t.user.role,"settings"),{add:o}=N.useSearch(),[m,r]=u.useState(!!o&&a);u.useEffect(()=>{o&&a&&r(!0)},[o,a]);const n=t.projects.reduce((s,x)=>s+x.unresolved,0),i=t.limits.projects.limit,d=i!==null&&t.projects.length>=i;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:t.projects.length?`${t.projects.length}${i!==null?` of ${i}`:""} site${t.projects.length===1&&i===null?"":"s"} · ${n} open`:i!==null?`0 of ${i} sites`:void 0,actions:a?e.jsxs(c,{onClick:()=>r(!0),disabled:d,title:d?`This studio's plan allows ${i} sites.`:void 0,children:[e.jsx(f,{}),"Add a site"]}):void 0}),t.projects.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:a?e.jsxs(c,{onClick:()=>r(!0),children:[e.jsx(f,{}),"Add a site"]}):void 0,children:a?"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:t.projects.map(s=>e.jsxs(w,{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",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}),s.status==="paused"&&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:"Paused"})]}),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?` · ${T(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(R,{open:m,onOpenChange:r})]})}const Q=k({name:h().trim().min(1,"A name"),domain:h().trim().min(1,"Its domain")});function R({open:t,onOpenChange:a}){const o=y(),m=A(),[r,n]=u.useState(""),{register:i,handleSubmit:d,formState:s,reset:x}=C({resolver:_(Q)}),b=d(async p=>{n("");try{const l=await S.createProject(p.name,"",p.domain);await m.invalidateQueries({queryKey:["me"]}),x(),a(!1),o({to:"/s/$site/comments",params:{site:l.uid}})}catch(l){n(l instanceof $?l.message:"Could not add the site.")}});return e.jsx(E,{open:t,onOpenChange:a,children:e.jsx(F,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(L,{children:"Add a site"}),e.jsx(P,{children:"One client website. The tag it needs is shown right after."})]}),r&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:r}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(g,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!s.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(g,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!s.errors.domain,...i("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(c,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(c,{type:"submit",loading:s.isSubmitting,children:s.isSubmitting?"Adding…":"Add site"})]})]})})})}export{te as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-DGJgBiEe.js";const n=()=>t.jsx(o,{});export{n 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,a4 as u,s as i,a5 as y,a2 as c}from"./index-DGJgBiEe.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{q as N,j as e,w as k,a3 as w,r as d,B as p,S as A,d as C,a4 as F,a2 as E,A as m,a5 as R,s as D}from"./index-DGJgBiEe.js";import{u as h}from"./useQuery-dbNRhTlt.js";import{L as O,I as v}from"./label-ClUOe0Qf.js";import{I as P,S as q}from"./InstanceRows-376JOINE.js";import{A as z,P as G,a as g}from"./parts-CeW0gqpG.js";import{u as S}from"./labels-ToSuNGQl.js";import{S as I}from"./SaveState-R4390int.js";import{b as L}from"./studio-B02T4EY4.js";import{c as T}from"./update-duXzIzFS.js";import"./useBaseQuery-BzwsA17g.js";import"./dialog-I_D8p4LG.js";import"./ConfirmDialog-DIwxuqY9.js";import"./card-CQykn6b-.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 te=()=>N(S().user.role,"settings")?e.jsx(U,{}):e.jsx(z,{title:"General"});export{te 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,a4 as F,a5 as I,a2 as M,s as T,a6 as D,$ as ne,B as y,C as K,A as oe}from"./index-DGJgBiEe.js";import{u as q}from"./useQuery-dbNRhTlt.js";import{B as _}from"./badge-BVeGUvW4.js";import{E,G as O,I as W,H as R,J,K as H}from"./dialog-I_D8p4LG.js";import{L as C,I as A}from"./label-ClUOe0Qf.js";import{C as ae}from"./ConfirmDialog-DIwxuqY9.js";import{A as re,P as ie,a as ce}from"./parts-CeW0gqpG.js";import{u as z,b as le}from"./labels-ToSuNGQl.js";import{C as B}from"./CopyButton-DDGcA3Xd.js";import{M as de}from"./McpTokens-C6CW9eYK.js";import"./useBaseQuery-BzwsA17g.js";import"./useRender-BJVEua-j.js";import"./card-CQykn6b-.js";import"./check-C5gLbOCB.js";import"./copy-2WiQI5_8.js";import"./switch-BZw_bqWh.js";import"./useAriaLabelledBy-BSClfAH5.js";import"./useValueChanged-CEh0b15T.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 Oe=()=>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{Oe as component};