@snagset/server 0.1.53 → 0.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-BOk-i3nR.js → CompositeItem-D7Q5QVvi.js} +1 -1
- package/static/dashboard/assets/{CompositeList-CizhTu5k.js → CompositeList-w7YcjHbo.js} +1 -1
- package/static/dashboard/assets/ConfirmDialog-CHiXSDkR.js +1 -0
- package/static/dashboard/assets/{CopyButton-Cc6bLGfR.js → CopyButton-DkXHOvAs.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-BYUTQ-zN.js → FieldItemContext-BWEjbC5Z.js} +1 -1
- package/static/dashboard/assets/InstallTag-DlqXIhqI.js +17 -0
- package/static/dashboard/assets/InstanceRows-DwXLnXU2.js +1 -0
- package/static/dashboard/assets/McpTokens-BvQnjHcP.js +1 -0
- package/static/dashboard/assets/Picker-CtjWzkpT.js +1 -0
- package/static/dashboard/assets/{SaveState-DzF8ZaPe.js → SaveState-DzX_pKjo.js} +1 -1
- package/static/dashboard/assets/{_app-1rENGvme.js → _app-B-X6wLWA.js} +1 -1
- package/static/dashboard/assets/{_app-ClXa_BSX.js → _app-DW5KDMy_.js} +3 -3
- package/static/dashboard/assets/activity-C8vHHVVs.js +1 -0
- package/static/dashboard/assets/{arrow-left-DDim6ZAR.js → arrow-left-DbWDuhAv.js} +1 -1
- package/static/dashboard/assets/avatar-BL6yPDkc.js +1 -0
- package/static/dashboard/assets/{badge-CCBUSB_y.js → badge-Dybw0_bq.js} +1 -1
- package/static/dashboard/assets/{card-CBSSmpT3.js → card-DwOk-mSd.js} +1 -1
- package/static/dashboard/assets/{check-DJgo7I6A.js → check-Dfkv0gma.js} +1 -1
- package/static/dashboard/assets/{chevron-down-60UlZ0Ky.js → chevron-down-BFQamcZy.js} +1 -1
- package/static/dashboard/assets/{chevron-right-B5sFu-7i.js → chevron-right-v0My-Qwf.js} +1 -1
- package/static/dashboard/assets/{copy-BVdfZXH-.js → copy-Bnl05Zl3.js} +1 -1
- package/static/dashboard/assets/createBaseUIEventDetails-DviWdj-N.js +1 -0
- package/static/dashboard/assets/dialog-B1TvUOp8.js +6 -0
- package/static/dashboard/assets/{dropdown-menu-DBe6PomQ.js → dropdown-menu-DQDS-MXM.js} +3 -3
- package/static/dashboard/assets/forgot-B13MZpbf.js +1 -0
- package/static/dashboard/assets/getPseudoElementBounds-Bv3Ra6Wj.js +1 -0
- package/static/dashboard/assets/{image-off-CMJxtYwl.js → image-off-4dn7EbeZ.js} +1 -1
- package/static/dashboard/assets/index-PP-fkxl1.css +1 -0
- package/static/dashboard/assets/{index-DXj5DU-z.js → index-_7kIe8FW.js} +3 -3
- package/static/dashboard/assets/{inertValue-Bju6oxRr.js → inertValue-BSe8K39O.js} +1 -1
- package/static/dashboard/assets/invite-nV6ykkp0.js +1 -0
- package/static/dashboard/assets/label-BkHFb2_L.js +1 -0
- package/static/dashboard/assets/{layout-grid-DkVlSz3z.js → layout-grid-Dt1Q4YQ_.js} +1 -1
- package/static/dashboard/assets/me-BDpKAhA-.js +1 -0
- package/static/dashboard/assets/{parts-DUFMukrB.js → parts-DGVjMHe8.js} +1 -1
- package/static/dashboard/assets/{plus-1z8Ku-LH.js → plus-hkwBCzos.js} +1 -1
- package/static/dashboard/assets/reset-BNNJmqWL.js +1 -0
- package/static/dashboard/assets/{s._site-CtQgYzLV.js → s._site-MSdo-oKn.js} +1 -1
- package/static/dashboard/assets/{s._site.comments-WC9g6KEV.js → s._site.comments-0jkl72Ja.js} +3 -3
- package/static/dashboard/assets/s._site.reviewers-BWi4M9dg.js +1 -0
- package/static/dashboard/assets/{s._site.settings-BBmpjCXH.js → s._site.settings-_fxdLl8T.js} +1 -1
- package/static/dashboard/assets/select-DjpYopV7.js +6 -0
- package/static/dashboard/assets/setup-Ccth7CNk.js +1 -0
- package/static/dashboard/assets/sign-in-BeNKRQ7N.js +1 -0
- package/static/dashboard/assets/sign-up-B8239y6x.js +1 -0
- package/static/dashboard/assets/sites-CekL50U1.js +1 -0
- package/static/dashboard/assets/studio-5pj2ZjeU.js +1 -0
- package/static/dashboard/assets/{studio-C6rKaKyK.js → studio-pysRGF6Z.js} +1 -1
- package/static/dashboard/assets/studio.index-D1Utbxqz.js +1 -0
- package/static/dashboard/assets/studio.integrations-M2aLKrz5.js +1 -0
- package/static/dashboard/assets/studio.members-C9Gigy9Y.js +6 -0
- package/static/dashboard/assets/studio.plan-CVZcQmU2.js +1 -0
- package/static/dashboard/assets/{sun-BHujGXQB.js → sun-Ciy3ROc0.js} +1 -1
- package/static/dashboard/assets/switch-wRlAfGsi.js +1 -0
- package/static/dashboard/assets/{table-DCkeQpxm.js → table-Bd53YpCs.js} +1 -1
- package/static/dashboard/assets/useAriaLabelledBy-Dt1pmXDF.js +1 -0
- package/static/dashboard/assets/{useBaseQuery-Dl2qdxNT.js → useBaseQuery-DVrotnH-.js} +1 -1
- package/static/dashboard/assets/{useCompositeItem-eZ3mWAYz.js → useCompositeItem-fDEe_Juq.js} +1 -1
- package/static/dashboard/assets/useQuery-ClGlUO36.js +1 -0
- package/static/dashboard/assets/useRender-BO4-nlty.js +1 -0
- package/static/dashboard/assets/useScrollLock-DdWilGdG.js +1 -0
- package/static/dashboard/assets/{useValueChanged-D634YMNF.js → useValueChanged-Cm4_pRNG.js} +1 -1
- package/static/dashboard/assets/{users-kg2hhvKi.js → users-BDCRp6bm.js} +1 -1
- package/static/dashboard/assets/{welcome-BjaK019o.js → welcome-CcxTkiVu.js} +2 -2
- package/static/dashboard/assets/{widget-signin-D4ZH3Oaw.js → widget-signin-CpAmvjAU.js} +1 -1
- package/static/dashboard/assets/you-guotGi3r.js +1 -0
- package/static/dashboard/assets/{zod-DrSDAsp7.js → zod-Q9KJcyiZ.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +1 -1
- package/static/dashboard/assets/ConfirmDialog-CUQ3wyl0.js +0 -1
- package/static/dashboard/assets/InstallTag-BkUjzO7Q.js +0 -17
- package/static/dashboard/assets/InstanceRows-S3bDqoib.js +0 -1
- package/static/dashboard/assets/McpTokens-Bj04Bv7o.js +0 -1
- package/static/dashboard/assets/activity-yg3O3FDe.js +0 -1
- package/static/dashboard/assets/avatar-CE2TkZa-.js +0 -1
- package/static/dashboard/assets/dialog-zaKAKGow.js +0 -6
- package/static/dashboard/assets/forgot-BYMFyxwU.js +0 -1
- package/static/dashboard/assets/index-DVRHlt-r.css +0 -1
- package/static/dashboard/assets/invite-DH6dh7D-.js +0 -1
- package/static/dashboard/assets/label-BNpdN3Cg.js +0 -1
- package/static/dashboard/assets/labels--UUyt9uB.js +0 -1
- package/static/dashboard/assets/me-DRWJq-k_.js +0 -1
- package/static/dashboard/assets/reset-QshsZ8Pi.js +0 -1
- package/static/dashboard/assets/s._site.reviewers-B1wTd7uh.js +0 -1
- package/static/dashboard/assets/setup-COktVcsh.js +0 -1
- package/static/dashboard/assets/sign-in-D2MXhZPE.js +0 -1
- package/static/dashboard/assets/sign-up-DwpcLIA4.js +0 -1
- package/static/dashboard/assets/sites-BPdqrX1-.js +0 -1
- package/static/dashboard/assets/studio-BGRf9vPd.js +0 -1
- package/static/dashboard/assets/studio.index-BWRigBYG.js +0 -1
- package/static/dashboard/assets/studio.integrations-CzF2zxXk.js +0 -1
- package/static/dashboard/assets/studio.members-C-a4YKia.js +0 -11
- package/static/dashboard/assets/studio.plan-BntVcF5I.js +0 -1
- package/static/dashboard/assets/switch-DxJ9TWjl.js +0 -1
- package/static/dashboard/assets/useAriaLabelledBy-Cx69TO6K.js +0 -1
- package/static/dashboard/assets/useQuery-BO7PrbuY.js +0 -1
- package/static/dashboard/assets/useRender-0SJIdv0u.js +0 -1
- package/static/dashboard/assets/you-2qQEJT_G.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as $t,ag as Lt,e as xe,l as Xt,r as s,i as St,j as y,ah as Et,f as He,m as mt,E as Gt,ai as Kt,aj as Ot,k as Te,g as ft,h as qe}from"./index-_7kIe8FW.js";import{C as Nt}from"./chevron-down-BFQamcZy.js";import{C as Jt}from"./check-Dfkv0gma.js";import{x as Zt,y as Qt,P as en,R as tn,z as a,l as jt,g as nn,F as on,A as sn,B as rn,m as nt,C as ln,D as an,t as cn,E as un,G as dn,I as fn,H as pn,a as gn,J as mn,q as hn,K as xn}from"./useScrollLock-DdWilGdG.js";import{i as bn}from"./isElementDisabled-CwHw_lZC.js";import{e as Sn,f as yn,h as Ht,j as Ft,k as At,l as vn,m as Rn,o as In,c as we,n as st,p as wn,q as Tn,r as ht,a as pt,s as Mn,w as En,v as gt}from"./createBaseUIEventDetails-DviWdj-N.js";import{a as yt,u as it,i as An,b as Cn,t as vt,C as Pn}from"./inertValue-BSe8K39O.js";import{s as xt}from"./serializeValue-B8e3iXO-.js";import{u as Vn}from"./useValueChanged-Cm4_pRNG.js";import{b as Ln,c as On,d as Nn,e as jn,i as Hn,f as Fn,u as Dn,a as Un,h as kn,p as Bn,r as zn,g as _n}from"./getPseudoElementBounds-Bv3Ra6Wj.js";import{C as qn,u as Wn,a as Yn}from"./CompositeList-w7YcjHbo.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const $n=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Xn=$t("chevron-up",$n);function Gn(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,c=Sn(),g=Zt()!=null,r=Lt(()=>new Qt({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new en,floatingId:c,syncOnly:!1,nested:g})).current;return xe(()=>{const f={open:t,floatingId:c};o.reference!==void 0&&(f.referenceElement=o.reference,f.domReferenceElement=Xt(o.reference)?o.reference:null),o.floating!==void 0&&(f.floatingElement=o.floating),r.update(f)},[t,c,o.reference,o.floating,r]),r.context.onOpenChange=n,r.context.nested=g,r}function Kn(e){const[t,n]=s.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const Jn=s.createContext(void 0),Zn={disableStyleElements:!1};function Qn(){return s.useContext(Jn)??Zn}function eo(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const Dt=s.createContext(null);function be(){const e=s.useContext(Dt);if(e===null)throw new Error(St(60));return e}const to=(e,t)=>Object.is(e,t);function _e(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:_e(o,t,n))}function no(e,t,n){return e.filter(o=>!_e(t,o,n))}function Ut(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function oo(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ut(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function kt(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return xt(e)}function ze(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?xt(e.value):xt(e)}function Bt(e,t,n){function o(){return kt(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const c=t,g=Ut(c)?c.flatMap(r=>r.items):c;if(e==null||typeof e!="object"){const r=g.find(f=>f.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=g.find(f=>f&&f.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function so(e,t,n){return e.reduce((o,c,g)=>(g>0&&o.push(", "),o.push(y.jsx(s.Fragment,{children:Bt(c,t,n)},g)),o),[])}const i={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ze(t,o)!==""},hasNullItemLabel:(e,t)=>t?oo(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(c=>_e(t,c,n)):_e(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function ro(e,t,n=(o,c)=>o===c){return e.length===t.length&&e.every((o,c)=>n(o,t[c]))}function $e(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const ge=1;function Rt(e,t){return Math.max(0,e-t)}function rt(e,t){if(t<=0)return 0;const n=$e(e,0,t),o=n,c=t-n,g=o<=ge,r=c<=ge;return g&&r?o<=c?0:t:g?0:r?t:n}function lo(e){const{id:t,value:n,defaultValue:o=null,onValueChange:c,open:g,defaultOpen:r=!1,onOpenChange:f,name:m,form:u,autoComplete:h,disabled:x=!1,readOnly:v=!1,required:w=!1,modal:C=!0,actionsRef:k,inputRef:b,onOpenChangeComplete:W,items:j,multiple:T=!1,itemToStringLabel:M,itemToStringValue:L,isItemEqualToValue:B=to,highlightItemOnHover:O=!0,children:Y}=e,{clearErrors:N}=yn(),{setDirty:ue,setTouched:$,setFocused:le,validityData:K,setFilled:H,name:V,disabled:J,validation:R,validationMode:ne}=Ht(),z=Ft({id:t}),P=J||x,l=V??m,[p,Z]=At({controlled:n,default:T?o??Et:o,name:"Select",state:"value"}),[F,oe]=At({controlled:g,default:r,name:"Select",state:"open"}),d=s.useRef([]),S=s.useRef([]),D=s.useRef(null),ee=s.useRef(null),Se=s.useRef(0),E=s.useRef(null),X=s.useRef([]),_=s.useRef(!1),de=s.useRef(null),Q=s.useRef(null),se=s.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=s.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:q}=yt(F),{openMethod:G,triggerProps:ae}=Ln(F),A=Lt(()=>new tn({id:z,labelId:void 0,modal:C,multiple:T,itemToStringLabel:M,itemToStringValue:L,isItemEqualToValue:B,value:p,open:F,mounted:ie,transitionStatus:q,items:j,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Me=a(A,i.activeIndex),ye=a(A,i.selectedIndex),ve=a(A,i.triggerElement),ce=a(A,i.positionerElement),Le=Kn(G),Oe=G??Le,te=s.useMemo(()=>T?"":ze(p,L),[T,p,L]),at=s.useMemo(()=>T&&Array.isArray(p)?p.map(I=>ze(I,L)):ze(p,L),[T,p,L]),Ge=jt(ve),Re=He(()=>at);vn(Ge,z,p,Re,!P,m);const ct=s.useRef(p),We=T?Array.isArray(p)&&p.length>0:p!=null&&te!=="";xe(()=>{H(We)},[We,H]),xe(function(){let U=p,Ie=!1;if(T){const je=Array.isArray(p)?p:[];Ie=je.length===0,U=je[je.length-1]}const Pe=Ie?-1:ot(X.current,U,B),Ve=Pe===-1?null:Pe;Ve===null&&(Q.current=null),!F&&A.set("selectedIndex",Ve)},[T,F,p,B,A]);function me(I){const U=K.initialValue;return Array.isArray(I)&&Array.isArray(U)?!ro(I,U,(Ie,Pe)=>_e(Ie,Pe,B)):I!==U}Vn(p,()=>{N(l),ue(me(p)),R.change(p)});const Fe=He((I,U)=>{f?.(I,U),!U.isCanceled&&(oe(I),!I&&(U.reason===Rn||U.reason===In)&&($(!0),le(!1),ne==="onBlur"&&R.commit(p)))}),De=He(()=>{fe(!1),A.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),W?.(!1)});it({enabled:!k,open:F,ref:D,onComplete(){F||De()}}),s.useImperativeHandle(k,()=>({unmount:De}),[De]);const Ee=He((I,U)=>{c?.(I,U),!U.isCanceled&&Z(I)}),he=He(I=>{const U=Rt(I.scrollHeight,I.clientHeight),Ie=rt(I.scrollTop,U),Pe=Ie>0,Ve=Ie<U;A.set("scrollUpArrowVisible",Pe),A.set("scrollDownArrowVisible",Ve)}),Ae=Gn({open:F,onOpenChange:Fe,elements:{reference:ve,floating:ce}}),Ue=On(Ae,{enabled:!v&&!P,event:"mousedown"}),ke=nn(Ae),Ce=Nn(Ae,{enabled:!v&&!P,listRef:d,activeIndex:Me,selectedIndex:ye,disabledIndices:Et,onNavigate(I){I===null&&!F||A.set("activeIndex",I)},focusItemOnHover:O}),Ne=jn(Ae,{enabled:!v&&!P&&(F||!T),listRef:S,activeIndex:Me,selectedIndex:ye,disabledIndices:I=>bn(d.current[I]),onMatch(I){F?A.set("activeIndex",I):Ee(X.current[I],we(st))},onTyping(I){_.current=I}}),Ke=s.useMemo(()=>mt(Ne.reference,Ce.reference,ke.reference,Ue.reference,ae),[Ue.reference,Ne.reference,Ce.reference,ke.reference,ae]),Je=s.useMemo(()=>mt(on,Ne.floating,Ce.floating,ke.floating),[Ne.floating,Ce.floating,ke.floating]),Ze=Ce.item??Gt;eo(()=>{A.update({popupProps:Je,triggerProps:Ke})}),A.useSyncedValues({id:z,modal:C,multiple:T,value:p,open:F,mounted:ie,transitionStatus:q,popupProps:Je,triggerProps:Ke,items:j,itemToStringLabel:M,itemToStringValue:L,isItemEqualToValue:B,openMethod:Oe});const pe=s.useMemo(()=>({store:A,floatingContext:Ae,required:w,disabled:P,readOnly:v,multiple:T,highlightItemOnHover:O,setValue:Ee,setOpen:Fe,listRef:d,popupRef:D,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:Se,itemProps:Ze,valueRef:E,valuesRef:X,labelsRef:S,typingRef:_,selectionRef:se,firstItemTextRef:de,selectedItemTextRef:Q,validation:R,onOpenChangeComplete:W,alignItemWithTriggerActiveRef:re,initialValueRef:ct}),[A,Ae,w,P,v,T,O,Ee,Fe,Ze,R,W,he]),Be=Kt(b,R.inputRef),Ye=T?void 0:l,ut=s.useMemo(()=>!T||!Array.isArray(p)||!l?null:p.map(I=>{const U=ze(I,L);return y.jsx("input",{type:"hidden",form:u,name:l,value:U,disabled:P},U)}),[T,p,u,l,L,P]);return y.jsxs(Dt.Provider,{value:pe,children:[Y,y.jsx("input",{...R.getValidationProps(P,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(I){if(I.nativeEvent.defaultPrevented||P||v)return;const U=I.currentTarget.value,Ie=we(st,I.nativeEvent);function Pe(){if(T)return;const Ve=U.toLowerCase();let je=X.current.findIndex(dt=>ze(dt,L).toLowerCase()===Ve||kt(dt,M).toLowerCase()===Ve);je===-1&&(je=X.current.findIndex((dt,Yt)=>{const Mt=S.current[Yt];return Mt!=null&&Mt.toLowerCase()===Ve}));const Tt=X.current[je];Tt!=null&&Ee(Tt,Ie)}A.set("forceMount",!0),queueMicrotask(Pe)}}),id:z&&Ye==null?`${z}-hidden-input`:void 0,form:u,name:Ye,autoComplete:h,value:te,disabled:P,required:w&&!(T&&We),readOnly:v,ref:Be,style:l?sn:rn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ut]})}function io(e,t){return e??t}const ao=400,co={...an,...Tn,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},uo=s.forwardRef(function(t,n){const{render:o,className:c,id:g,disabled:r=!1,nativeButton:f=!0,style:m,...u}=t,{setTouched:h,setFocused:x,validationMode:v,state:w,disabled:C}=Ht(),{labelId:k}=wn(),{store:b,setOpen:W,selectionRef:j,validation:T,readOnly:M,required:L,alignItemWithTriggerActiveRef:B,disabled:O}=be(),Y=C||O||r,N=a(b,i.open),ue=a(b,i.mounted),$=a(b,i.value),le=a(b,i.triggerProps),K=a(b,i.positionerElement),H=a(b,i.listElement),V=a(b,i.popupSide),J=a(b,i.id),R=a(b,i.labelId),ne=a(b,i.hasSelectedValue),z=ue&&K?V:null,P=g??J,l=io(k,R);Ft({id:P});const p=jt(K),Z=s.useRef(null),{getButtonProps:F,buttonRef:oe}=Ot({disabled:Y,native:f}),d=b.useStateSetter("triggerElement"),S=nt(),D=nt(),ee=nt();s.useEffect(()=>{if(N)return ee.start(ao,()=>{j.current.allowUnselectedMouseUp=!0,j.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};j.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},D.clear()},[N,j,D,ee]);const Se=mt(le,{id:P,role:"combobox","aria-expanded":N,"aria-haspopup":"listbox","aria-controls":N?H?.id??ln(K)?.id:void 0,"aria-labelledby":l,"aria-readonly":M||void 0,"aria-required":L||void 0,tabIndex:Y?-1:0,onFocus(_){x(!0),N&&B.current&&W(!1,we(st,_.nativeEvent)),S.start(0,()=>{b.set("forceMount",!0)})},onBlur(_){pt(K,_.relatedTarget)||(h(!0),x(!1),v==="onBlur"&&T.commit($))},onMouseDown(_){if(N)return;const de=ht(_.currentTarget);function Q(se){if(!Z.current)return;const re=se.target;pt(Z.current,re)||pt(p.current,re)||Hn(se,Z.current)||W(!1,we(Mn,se))}D.start(0,()=>{de.addEventListener("mouseup",Q,{once:!0})})}},u,F),E=T.getValidationProps(Y,Se);E.role="combobox";const X={...w,open:N,disabled:Y,value:$,readOnly:M,popupSide:z,placeholder:!ne};return Te("button",t,{ref:[n,Z,oe,d],state:X,stateAttributesMapping:co,props:E})}),fo={value:()=>null},po=s.forwardRef(function(t,n){const{className:o,render:c,children:g,placeholder:r,style:f,...m}=t,{store:u,valueRef:h}=be(),x=a(u,i.value),v=a(u,i.items),w=a(u,i.itemToStringLabel),C=a(u,i.hasSelectedValue),k=!C&&r!=null&&g==null,b=a(u,i.hasNullItemLabel,k),W={value:x,placeholder:!C};let j=null;return typeof g=="function"?j=g(x):g!=null?j=g:k&&!b?j=r:Array.isArray(x)?j=so(x,v,w):j=Bt(x,v,w),Te("span",t,{state:W,ref:[n,h],props:[{children:j},m],stateAttributesMapping:fo})}),go=s.forwardRef(function(t,n){const{render:o,className:c,style:g,...r}=t,{store:f}=be(),u={open:a(f,i.open)};return Te("span",t,{state:u,ref:n,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:cn})}),mo=s.forwardRef(function(t,n){const{store:o}=be(),c=a(o,i.mounted),g=a(o,i.forceMount);return c||g?y.jsx(un,{ref:n,...t}):null}),zt=s.createContext(void 0);function It(){const e=s.useContext(zt);if(!e)throw new Error(St(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const _t={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ho={position:"fixed"},xo=s.forwardRef(function(t,n){const{anchor:o,className:c,render:g,positionMethod:r,side:f,align:m,sideOffset:u,alignOffset:h,collisionBoundary:x="clipping-ancestors",collisionPadding:v,arrowPadding:w,sticky:C,disableAnchorTracking:k,alignItemWithTrigger:b=!0,collisionAvoidance:W=dn,style:j,...T}=t,{store:M,listRef:L,labelsRef:B,alignItemWithTriggerActiveRef:O,selectedItemTextRef:Y,valuesRef:N,initialValueRef:ue,popupRef:$,setValue:le,floatingContext:K}=be(),H=a(M,i.open),V=a(M,i.mounted),J=a(M,i.modal),R=a(M,i.value),ne=a(M,i.openMethod),z=a(M,i.positionerElement),P=a(M,i.triggerElement),l=a(M,i.isItemEqualToValue),p=a(M,i.transitionStatus),Z=s.useRef(null),F=s.useRef(null),[oe,d]=s.useState(b),S=V&&oe&&ne!=="touch";!V&&oe!==b&&d(b),s.useImperativeHandle(O,()=>S),Fn((S||J)&&H,ne==="touch",z,P);const D=Dn({anchor:o,floatingRootContext:K,positionMethod:r,mounted:V,side:f,sideOffset:u,align:m,alignOffset:h,arrowPadding:w,collisionBoundary:x,collisionPadding:v,sticky:C,disableAnchorTracking:k??S,collisionAvoidance:W,keepMounted:!0}),ee=S?"none":D.side,Se=S?ho:D.positionerStyles,E={open:H,side:ee,align:D.align,anchorHidden:D.anchorHidden};xe(()=>{M.set("popupSide",D.side)},[M,D.side]);const X=M.useStateSetter("positionerElement"),_=Un(t,E,{styles:Se,transitionStatus:p,props:T,refs:[n,X],hidden:!V,inert:!H}),de=s.useRef(0),Q=He(re=>{if(N.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=we(st);if(ie!==0&&!M.state.multiple&&R!==null&&ot(N.current,R,l)===-1){const G=ue.current,A=G!=null&&ot(N.current,G,l)!==-1?G:null;le(A,fe),A===null&&(M.set("selectedIndex",null),Y.current=null)}if(ie!==0&&M.state.multiple&&Array.isArray(R)){const q=R.filter(G=>ot(N.current,G,l)!==-1);q.length!==R.length&&(le(q,fe),q.length===0&&(M.set("selectedIndex",null),Y.current=null))}if(H&&S){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const q={height:""};lt(z,q),lt($.current,q)}}),se=s.useMemo(()=>({...D,side:ee,alignItemWithTriggerActive:S,setControlledAlignItemWithTrigger:d,scrollUpArrowRef:Z,scrollDownArrowRef:F}),[D,ee,S,d]);return y.jsx(qn,{elementsRef:L,labelsRef:B,onMapChange:Q,children:y.jsxs(zt.Provider,{value:se,children:[V&&J&&y.jsx(fn,{inert:An(!H),cutout:P}),_]})})}),Qe="base-ui-disable-scrollbar",bt={className:Qe,getElement(e){return y.jsx("style",{nonce:e,href:Qe,precedence:"base-ui:low",children:`.${Qe}{scrollbar-width:none}.${Qe}::-webkit-scrollbar{display:none}`})}},bo={...hn,...vt},So=s.forwardRef(function(t,n){const{render:o,className:c,style:g,finalFocus:r,...f}=t,{store:m,popupRef:u,onOpenChangeComplete:h,setOpen:x,valueRef:v,firstItemTextRef:w,selectedItemTextRef:C,multiple:k,handleScrollArrowVisibility:b,scrollHandlerRef:W,listRef:j,highlightItemOnHover:T,floatingContext:M}=be(),{side:L,align:B,alignItemWithTriggerActive:O,isPositioned:Y,setControlledAlignItemWithTrigger:N}=It(),ue=kn()!=null,$=Wn(),{nonce:le,disableStyleElements:K}=Qn(),H=a(m,i.id),V=a(m,i.open),J=a(m,i.openMethod),R=a(m,i.mounted),ne=a(m,i.popupProps),z=a(m,i.transitionStatus),P=a(m,i.triggerElement),l=a(m,i.positionerElement),p=a(m,i.listElement),Z=s.useRef(!1),F=s.useRef(!1),oe=s.useRef({}),d=Cn(),S=He(E=>{if(!l||!u.current||!F.current)return;const X=l.style.top==="0px",_=l.style.bottom==="0px";if(Z.current||!O||!X&&!_){b(E);return}const de=Pt(l),Q=Xe(l.getBoundingClientRect().height,"y",de),se=ht(l),re=ft(l),ie=re.getComputedStyle(l),fe=parseFloat(ie.marginTop),q=parseFloat(ie.marginBottom),G=Ct(re.getComputedStyle(u.current)),ae=Math.min(se.documentElement.clientHeight-fe-q,G),A=E.scrollTop,Me=et(E);let ye=null;const ve=te=>{l.style.height=`${te}px`},ce=X?Me-A:A,Le=Math.min(Q+ce,ae);if(ce<=ge){const te=$e(ce,0,ae-Q);te>0&&ve(Q+te),E.scrollTop=X?Me:0,ae-(Q+te)<=ge&&(Z.current=!0),b(E);return}if(ae-Le>ge)ye=X?1/0:0;else if(_&&A<Me){const te=Q+ce-ae;ye=A-(ce-te)}const Oe=Math.ceil(Le);if(Oe!==0&&ve(Oe),ye!=null){const te=$e(ye,0,et(E));Math.abs(E.scrollTop-te)>ge&&(E.scrollTop=te)}Oe>=ae-ge&&(Z.current=!0),b(E)});s.useImperativeHandle(W,()=>S,[S]),it({open:V,ref:u,onComplete(){V&&h?.(!0)}});const D={open:V,transitionStatus:z,side:L,align:B};xe(()=>{!l||!u.current||Object.keys(oe.current).length||(oe.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[u,l]),xe(()=>{V||O||(F.current=!1,Z.current=!1,lt(l,oe.current))},[V,O,l,u]),xe(()=>{const E=u.current;if(!V||!P||!l||!E||O&&!Y||m.state.transitionStatus==="ending")return;if(F.current=!0,E.style.removeProperty("--transform-origin"),!O){d.request(()=>b(p||E));return}const X=yo(E);try{let _=C.current;_?.isConnected||(_=!i.hasSelectedValue(m.state)&&w.current?.isConnected?w.current:null);const de=v.current,Q=ft(l),se=Q.getComputedStyle(l),re=Q.getComputedStyle(E),ie=ht(P),fe=Pt(P),q=tt(P.getBoundingClientRect(),fe),G=tt(l.getBoundingClientRect(),fe),ae=q.height,A=p||E,Me=A.scrollHeight,ye=parseFloat(re.borderBottomWidth),ve=parseFloat(se.marginTop)||10,ce=parseFloat(se.marginBottom)||10,Le=parseFloat(se.minHeight)||100,Oe=Ct(re),te=5,at=5,Ge=20,Re=ie.documentElement.clientHeight-ve-ce,ct=ie.documentElement.clientWidth,We=Re-q.bottom+ae;let me,Fe=$==="rtl"?q.right-G.width:q.left,De=0;if(_&&de){const pe=tt(de.getBoundingClientRect(),fe);me=tt(_.getBoundingClientRect(),fe),Fe=G.left+($==="rtl"?pe.right-me.right:pe.left-me.left);const Be=pe.top-q.top+pe.height/2;De=me.top-G.top+me.height/2-Be}const Ee=We+De+ce+ye;let he=Math.min(Re,Ee);const Ae=Re-ve-ce,Ue=Ee-he,ke=ct-at;l.style.left=`${$e(Fe,te,ke-G.width)}px`,l.style.height=`${he}px`,l.style.maxHeight="none",l.style.marginTop=`${ve}px`,l.style.marginBottom=`${ce}px`,E.style.height="100%";const Ce=et(A),Ne=Ue>=Ce-ge;Ne&&(he=Math.min(Re,G.height)-(Ue-Ce));const Ke=q.top<Ge||q.bottom>Re-Ge||Math.ceil(he)+ge<Math.min(Me,Le),Je=(Q.visualViewport?.scale??1)!==1&&pn;if(Ke||Je){lt(l,oe.current),N(!1);return}const Ze=Math.max(Le,he);if(Ne){const pe=Math.max(0,Re-Ee);l.style.top=G.height>=Ae?"0":`${pe}px`,l.style.height=`${he}px`,A.scrollTop=et(A)}else l.style.bottom="0",A.scrollTop=Ue;if(me){const pe=G.top,Be=G.height,Ye=me.top+me.height/2,ut=$e(Be>0?(Ye-pe)/Be*100:50,0,100);E.style.setProperty("--transform-origin",`50% ${ut}%`)}(Ze===Re||he>=Oe)&&(Z.current=!0),b(A),T&&m.state.selectedIndex===null&&m.state.activeIndex===null&&j.current[0]!=null&&m.set("activeIndex",0)}finally{X()}},[m,V,l,P,v,w,C,u,b,O,N,d,p,j,T,$,Y]),s.useEffect(()=>{if(!O||!l||!V)return;const E=ft(l);function X(_){x(!1,we(En,_))}return gn(E,"resize",X)},[x,O,l,V]);const ee={...p?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":k||void 0,id:`${H}-list`},onKeyDown(E){ue&&Pn.has(E.key)&&E.stopPropagation()},onScroll(E){p||S(E.currentTarget)},...O&&{style:p?{height:"100%"}:_t},className:!p&&O?bt.className:void 0},Se=Te("div",t,{ref:[n,u],state:D,stateAttributesMapping:bo,props:[ne,ee,_n(z),f]});return y.jsxs(s.Fragment,{children:[!K&&bt.getElement(le),y.jsx(mn,{context:M,modal:!1,disabled:!R,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:Se})]})});function Ct(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function et(e){return Rt(e.scrollHeight,e.clientHeight)}function Pt(e){return Bn.getScale(e)}function Xe(e,t,n){return e/n[t]}function tt(e,t){return zn({x:Xe(e.x,"x",t),y:Xe(e.y,"y",t),width:Xe(e.width,"x",t),height:Xe(e.height,"y",t)})}const Vt=[["transform","none"],["scale","1"],["translate","0 0"]];function yo(e){const{style:t}=e,n={};for(const[o,c]of Vt)n[o]=t.getPropertyValue(o),t.setProperty(o,c,"important");return()=>{for(const[o]of Vt){const c=n[o];c?t.setProperty(o,c):t.removeProperty(o)}}}const vo=s.forwardRef(function(t,n){const{render:o,className:c,style:g,...r}=t,{store:f,scrollHandlerRef:m,multiple:u}=be(),{alignItemWithTriggerActive:h}=It(),x=a(f,i.hasScrollArrows),v=a(f,i.openMethod),C={id:`${a(f,i.id)}-list`,role:"listbox","aria-multiselectable":u||void 0,onScroll(b){m.current?.(b.currentTarget)},...h&&{style:_t},className:x&&v!=="touch"?bt.className:void 0},k=f.useStateSetter("listElement");return Te("div",t,{ref:[n,k],props:[C,r]})}),qt=s.createContext(void 0);function wt(){const e=s.useContext(qt);if(!e)throw new Error(St(57));return e}const Ro=s.memo(s.forwardRef(function(t,n){const{render:o,className:c,style:g,value:r=null,label:f,disabled:m=!1,nativeButton:u=!1,...h}=t,x=s.useRef(null),v=Yn({guess:!0,label:f,textRef:x}),{store:w,itemProps:C,setOpen:k,setValue:b,selectionRef:W,typingRef:j,valuesRef:T,multiple:M,selectedItemTextRef:L,disabled:B,readOnly:O}=be(),Y=B||m,N=a(w,i.isActive,v.index),ue=a(w,i.open),$=a(w,i.isSelected,r),le=a(w,i.isSelectedByFocus,v.index),K=a(w,i.isItemEqualToValue),H=v.index,V=s.useRef(null);xe(()=>{const d=T.current;return d[H]=r,()=>{delete d[H]}},[H,r,T]),xe(()=>{const d=w.state.value;let S=d;M&&Array.isArray(d)&&(S=d.length>0?d[d.length-1]:void 0),S!==void 0&&_e(r,S,K)&&(w.set("selectedIndex",H),x.current&&(L.current=x.current))},[H,M,K,w,r,L]);const J=s.useRef("mouse"),R=s.useRef(!1),{getButtonProps:ne,buttonRef:z}=Ot({disabled:Y,focusableWhenDisabled:!0,native:u,composite:!0}),P={disabled:Y,selected:$,highlighted:N};function l(d){if(B||O)return;const S=w.state.value;if(M){const D=Array.isArray(S)?S:[],ee=$?no(D,r,K):[...D,r];b(ee,we(gt,d))}else b(r,we(gt,d)),k(!1,we(gt,d))}function p(){W.current.dragY=0}const Z={role:"option","aria-selected":$,tabIndex:ue&&N?0:-1,onKeyDown(d){w.set("activeIndex",H),d.key===" "&&j.current&&d.preventDefault()},onClick(d){const S=J.current!=="touch",D=d.nativeEvent.pointerType,ee=S&&xn(d.nativeEvent)&&(D!==void 0||N),Se=S&&!ee&&!R.current;R.current=!1,!(Y||Se)&&l(d.nativeEvent)},onPointerEnter(d){J.current=d.pointerType},onPointerMove(d){if(d.pointerType==="mouse"&&d.buttons===1){const S=W.current;S.dragY+=d.movementY,S.dragY**2>=64&&(S.allowUnselectedMouseUp=!0)}},onPointerDown(d){J.current=d.pointerType,R.current=!0,p()},onMouseUp(){if(p(),Y||J.current==="touch"||R.current)return;const d=!W.current.allowSelectedMouseUp&&$,S=!W.current.allowUnselectedMouseUp&&!$;d||S||(R.current=!0,V.current?.click(),R.current=!1)}},F=Te("div",t,{ref:[z,n,v.ref,V],state:P,props:[C,Z,h,ne]}),oe=s.useMemo(()=>({selected:$,index:H,textRef:x,selectedByFocus:le}),[$,H,x,le]);return y.jsx(qt.Provider,{value:oe,children:F})})),Io=s.forwardRef(function(t,n){const{selected:o}=wt();return t.keepMounted||o?y.jsx(wo,{...t,ref:n}):null}),wo=s.memo(s.forwardRef((e,t)=>{const{render:n,className:o,style:c,keepMounted:g,...r}=e,{selected:f}=wt(),m=s.useRef(null),{transitionStatus:u,setMounted:h}=yt(f),v=Te("span",e,{ref:[t,m],state:{selected:f,transitionStatus:u},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:vt});return it({open:f,ref:m,onComplete(){f||h(!1)}}),v})),To=s.memo(s.forwardRef(function(t,n){const{index:o,textRef:c,selectedByFocus:g}=wt(),{firstItemTextRef:r,selectedItemTextRef:f}=be(),{render:m,className:u,style:h,...x}=t,v=s.useCallback(C=>{C&&(o===0&&(r.current=C),g&&(f.current=C))},[r,f,o,g]);return Te("div",t,{ref:[v,n,c],props:x})})),Wt=s.forwardRef(function(t,n){const{render:o,className:c,style:g,direction:r,keepMounted:f,...m}=t,u=r==="up",{store:h,popupRef:x,listRef:v,handleScrollArrowVisibility:w,scrollArrowsMountedCountRef:C}=be(),{side:k,scrollDownArrowRef:b,scrollUpArrowRef:W}=It(),j=u?i.scrollUpArrowVisible:i.scrollDownArrowVisible,T=a(h,j),M=a(h,i.openMethod),L=T&&M!=="touch",B=nt(),O=u?W:b,{mounted:Y,transitionStatus:N,setMounted:ue}=yt(L);xe(()=>(C.current+=1,h.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&h.set("hasScrollArrows",!1)}),[h,C]),it({open:L,ref:O,onComplete(){L||ue(!1)}});const K=Te("div",t,{ref:[n,O],state:{direction:r,visible:L,side:k,transitionStatus:N},props:[{"aria-hidden":!0,children:u?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||B.isStarted())return;h.set("activeIndex",null);function J(){const R=h.state.listElement??x.current;if(!R)return;h.set("activeIndex",null),w(R);const ne=Rt(R.scrollHeight,R.clientHeight),z=rt(R.scrollTop,ne),P=z===(u?0:ne),l=v.current;if(z!==R.scrollTop&&(R.scrollTop=z),P){B.clear();return}if(l.length>0){const p=O.current?.offsetHeight||0;R.scrollTop=Mo(l,u,z,R.clientHeight,p,ne)}B.start(40,J)}B.start(40,J)},onMouseLeave(){B.clear()}},m],stateAttributesMapping:vt});return Y||f?K:null});function Mo(e,t,n,o,c,g){if(t){let h=0;const x=n+c-ge;for(let C=0;C<e.length;C+=1){const k=e[C];if(k&&k.offsetTop>=x){h=C;break}}const v=Math.max(0,h-1),w=e[v];return v<h&&w?rt(w.offsetTop-c,g):0}let r=e.length-1;const f=n+o-c+ge;for(let h=0;h<e.length;h+=1){const x=e[h];if(x&&x.offsetTop+x.offsetHeight>f){r=Math.max(0,h-1);break}}const m=Math.min(e.length-1,r+1),u=e[m];return m>r&&u?rt(u.offsetTop+u.offsetHeight-o+c,g):g}const Eo=s.forwardRef(function(t,n){return y.jsx(Wt,{...t,ref:n,direction:"down"})}),Ao=s.forwardRef(function(t,n){return y.jsx(Wt,{...t,ref:n,direction:"up"})}),zo=lo;function _o({className:e,...t}){return y.jsx(po,{"data-slot":"select-value",className:qe("flex flex-1 text-left",e),...t})}function qo({className:e,size:t="default",children:n,...o}){return y.jsxs(uo,{"data-slot":"select-trigger","data-size":t,className:qe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,y.jsx(go,{render:y.jsx(Nt,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Wo({className:e,children:t,side:n="bottom",sideOffset:o=4,align:c="center",alignOffset:g=0,alignItemWithTrigger:r=!0,...f}){return y.jsx(mo,{children:y.jsx(xo,{side:n,sideOffset:o,align:c,alignOffset:g,alignItemWithTrigger:r,className:"isolate z-50",children:y.jsxs(So,{"data-slot":"select-content","data-align-trigger":r,className:qe("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[y.jsx(Co,{}),y.jsx(vo,{children:t}),y.jsx(Po,{})]})})})}function Yo({className:e,children:t,...n}){return y.jsxs(Ro,{"data-slot":"select-item",className:qe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[y.jsx(To,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),y.jsx(Io,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:y.jsx(Jt,{className:"pointer-events-none"})})]})}function Co({className:e,...t}){return y.jsx(Ao,{"data-slot":"select-scroll-up-button",className:qe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:y.jsx(Xn,{})})}function Po({className:e,...t}){return y.jsx(Eo,{"data-slot":"select-scroll-down-button",className:qe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:y.jsx(Nt,{})})}export{zo as S,qo as a,_o as b,Wo as c,Yo as d};
|
|
@@ -0,0 +1 @@
|
|
|
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-_7kIe8FW.js";import{u as v,a as F}from"./zod-Q9KJcyiZ.js";import{L as i,I as o}from"./label-BkHFb2_L.js";import"./createBaseUIEventDetails-DviWdj-N.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 z(){const{claim:d}=x.useSearch(),c=h(),[l,m]=g.useState(""),{register:a,handleSubmit:p,formState:s}=v({resolver:F(A)}),u=p(async t=>{m("");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(n){m(n instanceof w?n.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{z as component};
|
|
@@ -0,0 +1 @@
|
|
|
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-_7kIe8FW.js";import{u as x}from"./useQuery-ClGlUO36.js";import{u as z,a as A}from"./zod-Q9KJcyiZ.js";import{L as p,I as h}from"./label-BkHFb2_L.js";import{C as I}from"./chevron-right-v0My-Qwf.js";import"./useBaseQuery-DVrotnH-.js";import"./createBaseUIEventDetails-DviWdj-N.js";const U=R({email:u().trim().min(1,"Your email"),password:u().min(1,"Your password")});function Q(){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{Q as component};
|
|
@@ -0,0 +1 @@
|
|
|
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-_7kIe8FW.js";import{u as b,a as S}from"./zod-Q9KJcyiZ.js";import{L as i,I as o}from"./label-BkHFb2_L.js";import"./createBaseUIEventDetails-DviWdj-N.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 E(){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{E as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as w,a1 as y,r as p,j as e,B as m,L as N,p as A,d as k,s as S,C as $,D as C,F as g}from"./index-_7kIe8FW.js";import{u as _,a as D}from"./zod-Q9KJcyiZ.js";import{C as E}from"./card-DwOk-mSd.js";import{i as F,j as L,l as P,k as I,m as T,n as z}from"./dialog-B1TvUOp8.js";import{L as f,I as j}from"./label-BkHFb2_L.js";import{P as q,E as R}from"./parts-DGVjMHe8.js";import{v as B}from"./useScrollLock-DdWilGdG.js";import{u as H}from"./me-BDpKAhA-.js";import{P as v}from"./plus-hkwBCzos.js";import{L as K}from"./layout-grid-Dt1Q4YQ_.js";import{I as Q}from"./image-off-4dn7EbeZ.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./inertValue-BSe8K39O.js";import"./useBaseQuery-DVrotnH-.js";function ne(){const s=H(),i=w(s.user.role,"settings"),{add:d}=y.useSearch(),[x,n]=p.useState(!!d&&i);p.useEffect(()=>{d&&i&&n(!0)},[d,i]);const a=s.projects.filter(r=>!r.archived),l=s.projects.filter(r=>r.archived),h=a.reduce((r,o)=>r+o.unresolved,0),t=s.limits.projects.limit,c=t!==null&&a.length>=t,u=t!==null&&a.length>t;return e.jsxs("div",{className:"p-7",children:[e.jsx(q,{title:"Sites",sub:a.length?`${a.length}${t!==null?` of ${t}`:""} site${a.length===1&&t===null?"":"s"} · ${h} open`:t!==null?`0 of ${t} sites`:void 0,actions:i?e.jsxs(m,{onClick:()=>n(!0),disabled:c,title:c?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(v,{}),"Add a site"]}):void 0}),u&&e.jsxs("div",{role:"status",className:"mb-5 max-w-[1100px] rounded-md border border-border bg-warn-soft px-4 py-3 text-[13px]",children:["This studio has ",a.length," sites and its plan includes ",t,". The newest ",a.length-t," ",a.length-t===1?"is":"are"," ","read-only: comments can be read, nothing new comes in."," ",i?"Archive a site you have finished with, or move to a plan with more.":"An owner or an admin can archive a site or change the plan."]}),a.length===0?e.jsx(E,{className:"max-w-[1100px]",children:e.jsx(R,{icon:e.jsx(K,{className:"size-5"}),title:"No sites yet",action:i?e.jsxs(m,{onClick:()=>n(!0),children:[e.jsx(v,{}),"Add a site"]}):void 0,children:i?"A site is one client website. Add it, paste the tag, and comments start arriving here.":"A site is one client website. An owner or an admin adds it, and its comments appear here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:a.map(r=>e.jsx(b,{p:r},r.uid))}),l.length>0&&e.jsxs("section",{className:"mt-10 max-w-[1100px]","aria-labelledby":"archived-sites",children:[e.jsx("h2",{id:"archived-sites",className:"m-0 mb-1 text-[14px] font-semibold",children:"Archived"}),e.jsx("p",{className:"m-0 mb-4 text-[12.5px] text-muted-foreground",children:"Finished or put away. Every comment is kept and can be read; nothing new comes in, and they do not count toward the plan."}),e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:l.map(r=>e.jsx(b,{p:r},r.uid))})]}),e.jsx(G,{open:x,onOpenChange:n})]})}function b({p:s}){const i=s.archived?"Archived":s.locked?"Read-only":s.status==="paused"?"Paused":null;return e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:`flex h-[150px] items-center justify-center border-b border-border bg-background${s.archived?" opacity-70 grayscale":""}`,children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(Q,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),i&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:i})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${B(s.lastActivityAt)}`:""}`})]})]})}const U=C({name:g().trim().min(1,"A name"),domain:g().trim().min(1,"Its domain")});function G({open:s,onOpenChange:i}){const d=A(),x=k(),[n,a]=p.useState(""),{register:l,handleSubmit:h,formState:t,reset:c}=_({resolver:D(U)}),u=h(async r=>{a("");try{const o=await S.createProject(r.name,"",r.domain);await x.invalidateQueries({queryKey:["me"]}),c(),i(!1),d({to:"/s/$site/comments",params:{site:o.uid}})}catch(o){a(o instanceof $?o.message:"Could not add the site.")}});return e.jsx(F,{open:s,onOpenChange:i,children:e.jsx(L,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(P,{children:[e.jsx(I,{children:"Add a site"}),e.jsx(T,{children:"One client website. The tag it needs is shown right after."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-name",children:"Name"}),e.jsx(j,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!t.errors.name,...l("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(f,{htmlFor:"site-domain",children:"Domain"}),e.jsx(j,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!t.errors.domain,...l("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(z,{children:[e.jsx(m,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(m,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add site"})]})]})})})}export{ne as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-_7kIe8FW.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-
|
|
1
|
+
import{d as o,A as s,a5 as u,s as i,a6 as y,a2 as c}from"./index-_7kIe8FW.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 y,j as e,t as C,a4 as k,r as c,B as x,S as A,d as E,a5 as F,a2 as O,A as h,a6 as R,s as D,a7 as I}from"./index-_7kIe8FW.js";import{u as p}from"./useQuery-ClGlUO36.js";import{L as P,I as N}from"./label-BkHFb2_L.js";import{I as U,S as L}from"./InstanceRows-DwXLnXU2.js";import{A as T,P as q,a as f}from"./parts-DGVjMHe8.js";import{u as S}from"./me-BDpKAhA-.js";import{S as z}from"./SaveState-DzX_pKjo.js";import{C as B}from"./ConfirmDialog-CHiXSDkR.js";import{b as _}from"./studio-pysRGF6Z.js";import{c as M}from"./update-duXzIzFS.js";import"./useBaseQuery-DVrotnH-.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./dialog-B1TvUOp8.js";import"./useScrollLock-DdWilGdG.js";import"./inertValue-BSe8K39O.js";import"./card-DwOk-mSd.js";import"./check-Dfkv0gma.js";import"./copy-Bnl05Zl3.js";function Q(){const t=S(),s=p(h.meta()),o=p(h.members()),a=_(),r=y(t.user.role,"studio"),u=C(t),m=k(t),i=p(h.setupState()),l=!i.data?.billingUrl,d=t.user.role==="owner"?i.data?.closeUrl??null:null,[n,j]=c.useState(t.org.name),[b,w]=c.useState(null);c.useEffect(()=>j(t.org.name),[t.org.name]);const v=r&&n.trim().length>0&&n.trim()!==t.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(q,{title:"Studio settings",sub:t.org.name,actions:e.jsx(z,{saving:a.isPending,savedAt:b})}),e.jsx(f,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:g=>{g.preventDefault(),v&&a.mutate(n.trim(),{onSuccess:()=>w(Date.now())})},children:[e.jsx(P,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{id:"studio-name",value:n,readOnly:!r,onChange:g=>j(g.target.value)}),v&&e.jsx(x,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:r?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),u?e.jsx(f,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(G,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(H,{owner:r})}),s.data?.commit&&s.data.commit!=="unknown"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[t.projects.length," · ",o.data?.data.length??"—"]})]})]})}):l?e.jsx(f,{title:"This studio",description:"What is in it.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Sites"}),e.jsx("dd",{className:"m-0",children:t.projects.length}),e.jsx("dt",{className:"text-muted-foreground",children:"Members"}),e.jsx("dd",{className:"m-0",children:o.data?.data.length??"—"})]})}):null,m==="instance"?e.jsx(U,{owner:r}):m==="usage"?e.jsx(L,{}):null,d&&e.jsx(W,{url:d,name:t.org.name})]})}function W({url:t,name:s}){const[o,a]=c.useState(!1),[r,u]=c.useState(!1),m=()=>{u(!0);const i=document.createElement("form");i.method="post",i.action=t;for(const[l,d]of[["csrf",I()],["confirm",s]]){const n=document.createElement("input");n.type="hidden",n.name=l,n.value=d,i.append(n)}document.body.append(i),i.submit()};return e.jsxs(f,{danger:!0,title:"Close this studio",description:"Its sites stop, and after a grace period it is erased with everything in it.",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-4",children:e.jsxs(x,{variant:"outline",className:"border-destructive text-destructive",onClick:()=>a(!0),children:["Close ",s,"…"]})}),e.jsx(B,{open:o,onOpenChange:a,title:`Close ${s}`,description:"Closing stops the studio now and erases it thirty days later.",confirmLabel:"Close this studio",confirmWord:s,busy:r,onConfirm:m,children:e.jsxs("ul",{className:"m-0 flex list-disc flex-col gap-1.5 pl-5 text-[13px] text-ink-soft",children:[e.jsx("li",{children:"Every site stops at once: the widget leaves your clients' pages, nobody can comment, and the dashboard closes for everyone in the studio."}),e.jsx("li",{children:"If the studio pays for a plan, it is cancelled now, with no refund for the rest of the period."}),e.jsx("li",{children:"For thirty days you can reopen it, with every site as it was."}),e.jsx("li",{children:"After that it is erased for good: its sites, threads, comments and screenshots. People who belong to no other studio lose their account with it."})]})})]})}function G({version:t}){const[s,o]=c.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{o({s:"checking"}),M(t).then(a=>o({s:"done",r:a})).catch(()=>o({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:["· ",e.jsx(A,{className:"size-3"})," checking…"]}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function H({owner:t}){const s=E(),o=p(h.instance()),[a,r]=c.useState(null),[u,m]=c.useState(""),i=F({mutationFn:n=>D.setAddress(n),onSuccess:n=>{s.setQueryData(h.instance().queryKey,n),r(null),m(""),R.success("Address saved — every new link is built from it")},onError:n=>m(O(n))}),l=o.data?.address;if(!l)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const d=l.source==="env";return a===null||!t||d?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:l.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:d?"· set by the environment (SNAGSET_BASE_URL)":l.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),t&&!d&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>r(l.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:n=>{n.preventDefault(),i.mutate(a.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(N,{"aria-label":"Address",value:a,onChange:n=>r(n.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(x,{type:"submit",size:"sm",loading:i.isPending,disabled:!a.trim(),children:i.isPending?"Saving…":"Save"}),e.jsx(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(null),children:"Cancel"})]}),u&&e.jsx("span",{className:"text-[12px] text-destructive",children:u}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}const me=()=>y(S().user.role,"settings")?e.jsx(Q,{}):e.jsx(T,{title:"Studio settings"});export{me as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as U,j as e,L as z,t as B,d as ne,r,a5 as P,a6 as T,a2 as K,s as F,a8 as D,B as x,$ as oe,C as M,A as ae}from"./index-_7kIe8FW.js";import{P as G}from"./Picker-CtjWzkpT.js";import{u as Q}from"./useQuery-ClGlUO36.js";import{B as q}from"./badge-Dybw0_bq.js";import{i as O,j as E,l as R,k as W,m as J,n as H}from"./dialog-B1TvUOp8.js";import{L as S,I}from"./label-BkHFb2_L.js";import{C as re}from"./ConfirmDialog-CHiXSDkR.js";import{A as ie,P as le,a as ce}from"./parts-DGVjMHe8.js";import{u as Y}from"./me-BDpKAhA-.js";import{C as V}from"./CopyButton-DkXHOvAs.js";import{v as de}from"./useScrollLock-DdWilGdG.js";import{M as he}from"./McpTokens-BvQnjHcP.js";import"./select-DjpYopV7.js";import"./chevron-down-BFQamcZy.js";import"./check-Dfkv0gma.js";import"./isElementDisabled-CwHw_lZC.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./inertValue-BSe8K39O.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-Cm4_pRNG.js";import"./getPseudoElementBounds-Bv3Ra6Wj.js";import"./CompositeList-w7YcjHbo.js";import"./useBaseQuery-DVrotnH-.js";import"./useRender-BO4-nlty.js";import"./copy-Bnl05Zl3.js";import"./card-DwOk-mSd.js";import"./switch-wRlAfGsi.js";import"./useAriaLabelledBy-Dt1pmXDF.js";const me={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function ue(){const o=Y(),c=U(o.user.role,"settings"),g=U(o.user.role,"studio")&&B(o),j=Q(ae.integrations()),A=ne(),N=()=>A.invalidateQueries({queryKey:["integrations"]}),[d,f]=r.useState(null),[l,b]=r.useState(null),[k,m]=r.useState(null),v=P({mutationFn:t=>F.regenerateGitHubWebhook(t),onSuccess:({webhook:t},a)=>m({site:a,provider:"github",hook:t,fresh:!1}),onError:t=>T.error(K(t))}),C=P({mutationFn:({uid:t,provider:a})=>F.testTracker(t,a).then(L=>({...L,provider:a})),onSuccess:t=>{T[t.ok?"success":"error"](t.ok?`${D[t.provider]} can see ${t.target}`:t.detail??`${D[t.provider]} refused the token`),N()},onError:t=>T.error(K(t))}),y=P({mutationFn:({uid:t,provider:a})=>F.disconnectTracker(t,a),onSuccess:()=>{b(null),N()},onError:t=>T.error(K(t))}),w=j.data?.data??[],h=t=>w.filter(a=>a.provider===t),u=o.projects.filter(t=>!t.archived&&!t.locked),i=t=>u.filter(a=>!h(t).some(L=>L.site===a.uid)),n=c?o.limits.integrations?u.length===0?"site":null:"plan":null;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(le,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),n&&e.jsxs("div",{role:"note",className:"flex max-w-[1040px] flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-border bg-muted/40 px-4 py-3 text-[13px]",children:[e.jsx("span",{className:"min-w-0 flex-1",children:n==="plan"?o.user.role==="owner"?"This studio's plan does not include integrations. A plan that does lets you connect each site to GitHub, Linear, Jira and Slack.":"This studio's plan does not include integrations. An owner can change the plan.":o.projects.length===0?"An integration connects one site to one repository, team, project or channel. Add a site first, then connect it here.":"An integration connects one site at a time, and every site here is archived or read-only. Restore one, or add a site, then connect it here."}),n==="plan"?o.user.role==="owner"&&e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(z,{to:"/studio/plan"}),children:"See plans"}):e.jsx(x,{variant:"outline",size:"sm",render:e.jsx(z,{to:"/sites"}),children:"Go to Sites"})]}),["github","linear","jira","slack"].map(t=>{const a=h(t),L=i(t);return e.jsxs(ce,{title:D[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[j.isPending&&e.jsx(oe,{rows:2}),j.isSuccess&&a.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{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."})]}),a.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:a.map(s=>{const p=me[s.health]??{label:s.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:s.siteName??s.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:s.provider==="github"?`${s.owner}/${s.repo}`:s.provider==="linear"?`${s.teamKey} · ${s.teamName}`:s.provider==="jira"?`${s.projectKey} · ${s.projectName}`:`#${s.channelName} · ${s.teamName}`}),e.jsx(q,{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:[s.provider==="slack"?s.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":s.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",s.provider==="github"&&s.labels.length?` · labels ${s.labels.join(", ")}`:"",s.provider!=="github"&&s.provider!=="slack"&&!s.hasWebhookSecret?` · no webhook secret yet, so ${D[s.provider]} cannot move comments here`:""," · ",de(s.updatedAt)]}),s.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:s.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[s.provider==="github"?e.jsx(x,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate(s.site),children:"Webhook…"}):s.provider==="slack"?null:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>m({site:s.site,provider:s.provider,hook:{url:`${location.origin}/api/v1/integrations/${s.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(x,{variant:"ghost",size:"sm",loading:C.isPending,onClick:()=>C.mutate({uid:s.site,provider:s.provider}),children:"Test"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>b(s),children:"Disconnect"})]})]},`${s.provider}:${s.site}`)})}),c&&!n&&L.length>0&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",onClick:()=>f(t),children:"Connect a site…"})})]},t)}),e.jsx(he,{owner:c,instanceOwner:g,operator:B(o),sites:o.projects}),e.jsx(pe,{open:d==="github",onOpenChange:t=>!t&&f(null),sites:i("github"),onDone:(t,a)=>{N(),a&&m({site:t,provider:"github",hook:a,fresh:!0})}}),e.jsx(fe,{open:d==="linear",onOpenChange:t=>!t&&f(null),sites:i("linear"),onDone:(t,a)=>{N(),m({site:t,provider:"linear",hook:a,fresh:!0})}}),e.jsx(ge,{open:d==="jira",onOpenChange:t=>!t&&f(null),sites:i("jira"),onDone:(t,a)=>{N(),m({site:t,provider:"jira",hook:a,fresh:!0})}}),e.jsx(je,{open:d==="slack",onOpenChange:t=>!t&&f(null),sites:i("slack"),onDone:()=>void N()}),e.jsx(xe,{state:k,onClose:()=>m(null),siteName:t=>w.find(a=>a.site===t)?.siteName??"the site"}),e.jsx(re,{open:l!==null,onOpenChange:t=>!t&&b(null),title:`Disconnect ${l?.siteName??"this site"} from ${l?D[l.provider]:"the tracker"}?`,description:l?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:y.isPending,onConfirm:async()=>{l&&await y.mutateAsync({uid:l.site,provider:l.provider})}})]})}function pe({open:o,onOpenChange:c,sites:g,onDone:j}){const[A,N]=r.useState(""),[d,f]=r.useState(""),[l,b]=r.useState(""),[k,m]=r.useState(""),[v,C]=r.useState(!1),[y,w]=r.useState(""),h=P({mutationFn:n=>F.connectTracker(n,"github",{repository:d.trim(),token:l.trim(),labels:k,createOn:v?"thread.created":"manual"})}),u=A||g[0]?.uid||"",i=async n=>{n.preventDefault(),w("");try{const t=await h.mutateAsync(u);f(""),b(""),m(""),C(!1),c(!1),j(u,t.webhook&&"secret"in t.webhook?t.webhook:void 0),T.success("GitHub connected")}catch(t){w(t instanceof M?t.message:"Could not reach the server.")}};return e.jsx(O,{open:o,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:n=>void i(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to GitHub"}),e.jsxs(J,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-site",children:"Site"}),e.jsx(G,{id:"gh-site",value:u,onChange:N,options:g.map(n=>({value:n.uid,label:n.name}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(I,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:n=>f(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-token",children:"Token"}),e.jsx(I,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:l,onChange:n=>b(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(I,{id:"gh-labels",placeholder:"review, bug",value:k,onChange:n=>m(n.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:n=>C(n.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:h.isPending,disabled:!d.trim()||!l.trim()||!u,children:h.isPending?"Checking…":"Connect"})]})]})})})}function xe({state:o,onClose:c,siteName:g}){const j=o&&"secret"in o.hook?o.hook.secret:null;return e.jsx(O,{open:o!==null,onOpenChange:A=>!A&&c(),children:e.jsxs(E,{children:[e.jsxs(R,{children:[e.jsx(W,{children:o?.fresh?"Connected — now the webhook":"Webhook for "+(o?g(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_minmax(0,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 min-w-0 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(V,{text:o.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),j&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex min-w-0 items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:j}),e.jsx(V,{text:j,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:o.provider==="linear"?"Issues":o.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(H,{children:e.jsx(x,{type:"button",onClick:c,children:"Done"})})]})})}function fe({open:o,onOpenChange:c,sites:g,onDone:j}){const[A,N]=r.useState(""),[d,f]=r.useState(""),[l,b]=r.useState(""),[k,m]=r.useState(""),[v,C]=r.useState(!1),[y,w]=r.useState(""),h=P({mutationFn:n=>F.connectTracker(n,"linear",{team:d.trim(),apiKey:l.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:v?"thread.created":"manual"})}),u=A||g[0]?.uid||"",i=async n=>{n.preventDefault(),w("");try{const t=await h.mutateAsync(u);f(""),b(""),m(""),C(!1),c(!1),j(u,t.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),T.success("Linear connected")}catch(t){w(t instanceof M?t.message:"Could not reach the server.")}};return e.jsx(O,{open:o,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:n=>void i(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Linear"}),e.jsx(J,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-site",children:"Site"}),e.jsx(G,{id:"ln-site",value:u,onChange:N,options:g.map(n=>({value:n.uid,label:n.name}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-team",children:"Team key"}),e.jsx(I,{id:"ln-team",placeholder:"ENG",value:d,onChange:n=>f(n.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-key",children:"API key"}),e.jsx(I,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:l,onChange:n=>b(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(I,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:k,onChange:n=>m(n.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:n=>C(n.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:h.isPending,disabled:!d.trim()||!l.trim()||!u,children:h.isPending?"Checking…":"Connect"})]})]})})})}function ge({open:o,onOpenChange:c,sites:g,onDone:j}){const[A,N]=r.useState(""),[d,f]=r.useState(""),[l,b]=r.useState(""),[k,m]=r.useState(""),[v,C]=r.useState(""),[y,w]=r.useState(""),[h,u]=r.useState(!1),[i,n]=r.useState(""),t=P({mutationFn:p=>F.connectTracker(p,"jira",{siteUrl:d.trim(),project:l.trim(),email:k.trim(),apiToken:v.trim(),...y.trim()?{webhookSecret:y.trim()}:{},createOn:h?"thread.created":"manual"})}),a=A||g[0]?.uid||"",L=async p=>{p.preventDefault(),n("");try{const $=await t.mutateAsync(a);b(""),C(""),w(""),u(!1),c(!1),j(a,$.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),T.success("Jira connected")}catch($){n($ instanceof M?$.message:"Could not reach the server.")}},s=(p,$,X,Z,ee,te="text",_)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:`jr-${p}`,children:$}),e.jsx(I,{id:`jr-${p}`,type:te,placeholder:ee,value:X,onChange:se=>Z(se.target.value),autoComplete:"off"}),_&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:_})]});return e.jsx(O,{open:o,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:p=>void L(p),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Jira"}),e.jsx(J,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),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("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"jr-site",children:"Site"}),e.jsx(G,{id:"jr-site",value:a,onChange:N,options:g.map(p=>({value:p.uid,label:p.name}))})]}),s("url","Jira site",d,f,"https://kilnwork.atlassian.net"),s("project","Project key",l,b,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),s("email","Account email",k,m,"you@kilnwork.studio","email"),s("token","API token",v,C,"","password"),s("secret","Webhook secret",y,w,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:h,onChange:p=>u(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(x,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:t.isPending,disabled:!d.trim()||!l.trim()||!k.trim()||!v.trim()||!a,children:t.isPending?"Checking…":"Connect"})]})]})})})}function je({open:o,onOpenChange:c,sites:g,onDone:j}){const[A,N]=r.useState(""),[d,f]=r.useState(""),[l,b]=r.useState(""),[k,m]=r.useState(!0),[v,C]=r.useState(""),y=Q({queryKey:["integrations","slack","manifest"],queryFn:()=>F.slackManifest(),enabled:o,staleTime:1/0}),w=P({mutationFn:i=>F.connectTracker(i,"slack",{channel:d.trim(),token:l.trim(),createOn:k?"thread.created":"manual"})}),h=A||g[0]?.uid||"",u=async i=>{i.preventDefault(),C("");try{await w.mutateAsync(h),f(""),b(""),m(!0),c(!1),j(h),T.success("Slack connected")}catch(n){C(n instanceof M?n.message:"Could not reach the server.")}};return e.jsx(O,{open:o,onOpenChange:c,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:i=>void u(i),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(W,{children:"Connect a site to Slack"}),e.jsx(J,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-site",children:"Site"}),e.jsx(G,{id:"sl-site",value:h,onChange:N,options:g.map(i=>({value:i.uid,label:i.name}))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:!y.data,render:e.jsx("a",{href:y.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(I,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:l,onChange:i=>b(i.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(S,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(I,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:i=>f(i.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:i=>m(i.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(H,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:w.isPending,disabled:!d.trim()||!l.trim()||!h,children:w.isPending?"Checking…":"Connect"})]})]})})})}const Be=()=>U(Y().user.role,"settings")?e.jsx(ue,{}):e.jsx(ie,{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(z,{to:"/you",className:"text-brand hover:underline",children:"You"}),"."]})});export{Be as component};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as U,j as e,h as W,q as M,aa as X,r as j,B as h,ab as f,ac as E,a2 as S,I as J,D as K,ad as Z,ae as ee,af as se,F as te,A as k}from"./index-_7kIe8FW.js";import{u as C}from"./useQuery-ClGlUO36.js";import{u as ie,a as ae}from"./zod-Q9KJcyiZ.js";import{A as ne,a as le}from"./avatar-BL6yPDkc.js";import{B as re}from"./badge-Dybw0_bq.js";import{C as T}from"./card-DwOk-mSd.js";import{X as oe,i as me,j as de,l as R,k as A,m as I,n as D}from"./dialog-B1TvUOp8.js";import{L,I as ce}from"./label-BkHFb2_L.js";import{T as $,a as B,b as g,c,d as P,e as x}from"./table-Bd53YpCs.js";import{C as xe}from"./ConfirmDialog-CHiXSDkR.js";import{C as he}from"./CopyButton-DkXHOvAs.js";import{S as ue,a as pe,b as je,c as fe,d as ge}from"./select-DjpYopV7.js";import{A as ve,P as be,b as ye}from"./parts-DGVjMHe8.js";import{u as O}from"./me-BDpKAhA-.js";import{s as we}from"./useScrollLock-DdWilGdG.js";import{c as Ne,d as Se,e as ke,f as Ce,g as Re}from"./studio-pysRGF6Z.js";import{P as Ae}from"./plus-hkwBCzos.js";import"./useBaseQuery-DVrotnH-.js";import"./useRender-BO4-nlty.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./inertValue-BSe8K39O.js";import"./check-Dfkv0gma.js";import"./copy-Bnl05Zl3.js";import"./chevron-down-BFQamcZy.js";import"./isElementDisabled-CwHw_lZC.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-Cm4_pRNG.js";import"./getPseudoElementBounds-Bv3Ra6Wj.js";import"./CompositeList-w7YcjHbo.js";/**
|
|
2
|
+
* @license lucide-react v1.39.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ie=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],De=U("mail",Ie);function Le({className:s,...l}){return e.jsx("select",{className:W("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",s),...l})}function Me(){const s=O(),l=M(s.user.role,"people"),r=X(s.user.role),d=C(k.members()),t=C(k.invites()),[m,i]=j.useState(!1),o=s.limits.members.limit,a=o!==null&&s.limits.members.used>=o;return e.jsxs("div",{className:"p-7",children:[e.jsx(be,{title:"Members",sub:`${l?"Only owners change roles or remove people.":"Admins invite members. Ask an owner to change a role or remove someone."}${o!==null?` ${s.limits.members.used} of ${o} members.`:""}`,actions:r.length?e.jsxs(h,{onClick:()=>i(!0),disabled:a,title:a?`This studio's plan allows ${o} members.`:void 0,children:[e.jsx(Ae,{}),"Invite"]}):void 0}),e.jsx(T,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs($,{children:[e.jsx(B,{children:e.jsxs(g,{children:[e.jsx(c,{children:"Name"}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Role"}),l&&e.jsx(c,{className:"w-0"})]})}),e.jsx(P,{children:(d.data?.data??[]).map(u=>e.jsx($e,{m:u,owner:l},u.email))})]})}),e.jsx(Ee,{}),(t.data?.data.length??0)>0&&e.jsx(Te,{invites:t.data.data,roles:r}),e.jsxs("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:["People join through an invite link and choose their own password. A forgotten one is reset on the server with ",e.jsx("code",{className:"font-mono text-[12px]",children:"snagset passwd"}),"."]}),r.length>0&&e.jsx(Pe,{open:m,onOpenChange:i,mail:t.data?.mail??!1,roles:r})]})}const z=s=>new Date(s).toLocaleDateString(void 0,{day:"numeric",month:"short"}),v={owner:"Owner",admin:"Admin",member:"Member"};function Ee(){return e.jsx("dl",{className:"m-0 mt-3 grid max-w-[1040px] grid-cols-[70px_1fr] gap-x-3 gap-y-1 text-[12.5px]","aria-label":"Roles",children:f.map(s=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"font-medium",children:v[s]}),e.jsx("dd",{className:"m-0 text-muted-foreground",children:E[s]})]},s))})}function Te({invites:s,roles:l}){const r=ke(),d=l.length>0;return e.jsxs("section",{className:"mt-6 max-w-[1040px]","aria-labelledby":"pending-invites",children:[e.jsx("div",{id:"pending-invites",className:"mb-2",children:e.jsx(ye,{children:"Pending invites"})}),e.jsx(T,{className:"overflow-hidden py-0",children:e.jsxs($,{children:[e.jsx(B,{children:e.jsxs(g,{children:[e.jsx(c,{children:"For"}),e.jsx(c,{children:"Role"}),e.jsx(c,{children:"Invited by"}),e.jsx(c,{children:"Expires"}),d&&e.jsx(c,{className:"w-0"})]})}),e.jsx(P,{children:s.map(t=>e.jsxs(g,{children:[e.jsx(x,{className:t.email?"":"text-muted-foreground",children:t.email??"Anyone with the link"}),e.jsx(x,{className:"capitalize",children:t.role}),e.jsx(x,{className:"text-muted-foreground",children:t.createdBy?t.createdBy.name||t.createdBy.email:"—"}),e.jsx(x,{className:"text-muted-foreground",children:z(t.expiresAt)}),d&&e.jsx(x,{className:"text-right",children:l.includes(t.role)&&e.jsx(h,{variant:"ghost",size:"sm","aria-label":`Revoke the invite for ${t.email??"anyone with the link"}`,disabled:r.isPending&&r.variables===t.id,onClick:()=>r.mutate(t.id),children:"Revoke"})})]},t.id))})]})})]})}function $e({m:s,owner:l}){const r=Ne(),d=Se(),[t,m]=j.useState(!1);return e.jsxs(g,{children:[e.jsx(x,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(ne,{className:"size-6",children:e.jsx(le,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:we(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(re,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(x,{className:"text-muted-foreground",children:s.email}),e.jsx(x,{children:l?e.jsxs(ue,{items:f.map(i=>({value:i,label:v[i]})),value:s.role,onValueChange:i=>i&&i!==s.role&&r.mutate({email:s.email,role:i}),children:[e.jsx(pe,{size:"sm","aria-label":`Role for ${s.email}`,className:"min-w-[104px] bg-card",children:e.jsx(je,{})}),e.jsx(fe,{children:f.map(i=>e.jsx(ge,{value:i,children:v[i]},i))})]}):e.jsx("span",{className:"capitalize",children:s.role})}),l&&e.jsxs(x,{className:"text-right",children:[!s.you&&e.jsx(h,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>m(!0),children:e.jsx(oe,{})}),e.jsx(xe,{open:t,onOpenChange:m,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:d.isPending,onConfirm:()=>{m(!1),d.mutate(s.email)}})]})]})}const Be=K({email:ee([se(""),te().trim().email("An email address, or leave it empty")]),role:Z(f)});function Pe({open:s,onOpenChange:l,mail:r,roles:d}){const t=Ce(),m=Re(),[i,o]=j.useState(""),[a,u]=j.useState(null),[y,w]=j.useState(null),{register:N,handleSubmit:F,formState:p,reset:_,watch:q}=ie({resolver:ae(Be),defaultValues:{role:"member",email:""}}),H=q("role"),b=n=>{l(n),n||(u(null),w(null),o(""),m.reset(),_())},V=F(async n=>{o("");try{u(await t.mutateAsync({role:n.role,...n.email?{email:n.email}:{}}))}catch(Q){o(S(Q))}}),G=async()=>{if(a){o("");try{w((await m.mutateAsync({id:a.invite.id,token:a.token})).to)}catch(n){o(S(n))}}},Y=(a?.mail??r)&&!!a?.invite.email;return e.jsx(me,{open:s,onOpenChange:b,children:e.jsx(de,{children:a?e.jsxs("div",{className:"flex min-w-0 flex-col gap-4",children:[e.jsxs(R,{children:[e.jsx(A,{children:"Invite link"}),e.jsxs(I,{children:[a.invite.email?`${a.invite.email} can`:"Anyone with this link can"," join as ",J(a.invite.role)," ","until ",z(a.invite.expiresAt),". It works once, and this is the only time it is shown."]})]}),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("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"invite-url",children:a.url}),e.jsx(he,{text:a.url,label:"Copy link",withText:!0})]}),Y&&(y?e.jsxs("p",{role:"status",className:"m-0 text-[13px] [overflow-wrap:anywhere] text-muted-foreground",children:["Sent to ",y,"."]}):e.jsxs(h,{type:"button",variant:"outline",className:"max-w-full min-w-0 self-start",title:a.invite.email?`Send by email to ${a.invite.email}`:void 0,loading:m.isPending,onClick:()=>void G(),children:[e.jsx(De,{}),e.jsx("span",{className:"min-w-0 truncate",children:m.isPending?"Sending…":`Send by email to ${a.invite.email}`})]})),e.jsx(D,{children:e.jsx(h,{type:"button",onClick:()=>b(!1),children:"Done"})})]}):e.jsxs("form",{onSubmit:V,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(A,{children:"Invite someone"}),e.jsx(I,{children:"You get a link to send them. Whoever opens it chooses their own name and password, and is signed in. It works once and lasts seven days."})]}),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:p.isSubmitting,className:"m-0 flex min-w-0 flex-col gap-4 border-0 p-0",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(L,{htmlFor:"invite-role",children:"Role"}),e.jsx(Le,{id:"invite-role",className:"w-full",...N("role"),children:["member","admin","owner"].filter(n=>d.includes(n)).map(n=>e.jsx("option",{value:n,children:v[n]},n))}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground","data-testid":"invite-role-summary",children:E[H]??""})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(L,{htmlFor:"invite-email",children:["Email ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(ce,{id:"invite-email",type:"email",autoComplete:"off","aria-invalid":!!p.errors.email,...N("email")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:p.errors.email?.message??(r?"Given, only that address can use the link, and you can mail it to them.":"Given, only that address can use the link.")})]}),e.jsxs(D,{children:[e.jsx(h,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(h,{type:"submit",loading:p.isSubmitting,children:p.isSubmitting?"Creating…":"Create invite"})]})]})]})})})}const hs=()=>M(O().user.role,"settings")?e.jsx(Me,{}):e.jsx(ve,{title:"Members"});export{hs as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,ak as Y,r as d,p as M,d as A,A as $,S as B,h as m,B as P}from"./index-_7kIe8FW.js";import{u as _}from"./useQuery-ClGlUO36.js";import{b as j}from"./InstanceRows-DwXLnXU2.js";import{A as D,P as K}from"./parts-DGVjMHe8.js";import{u as y}from"./me-BDpKAhA-.js";import{C as U}from"./check-Dfkv0gma.js";import"./useBaseQuery-DVrotnH-.js";import"./dialog-B1TvUOp8.js";import"./useScrollLock-DdWilGdG.js";import"./inertValue-BSe8K39O.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./label-BkHFb2_L.js";import"./ConfirmDialog-CHiXSDkR.js";import"./copy-Bnl05Zl3.js";import"./card-DwOk-mSd.js";function L(){const s=y(),{said:r}=Y.useSearch(),[a,o]=d.useState(r),[c]=d.useState(()=>Date.now()),u=M(),p=A();d.useEffect(()=>{r&&u({to:"/studio/plan",search:{},replace:!0})},[r,u]);const w=_($.setupState()),i=w.data?.billingUrl??null,v=_({queryKey:["plan-state",i],enabled:!!i,refetchInterval:()=>a&&Date.now()-c<3e4?3e3:!1,queryFn:async()=>{const t=await fetch(`${i.replace(/\/+$/,"")}/state`,{credentials:"include",headers:{accept:"application/json"}});if(!t.ok)throw new Error(String(t.status));return await t.json()}}),n=v.data,b=d.useRef(null),f=n?.current?.name??null;d.useEffect(()=>{f&&(b.current===null?b.current=f:f!==b.current&&(o(void 0),p.invalidateQueries({queryKey:$.me().queryKey})))},[f,p]);const[h,R]=d.useState(!1),q=!!n?.plans.some(t=>t.yearly),k=n?.plans.find(t=>t.current);return e.jsxs("div",{className:"flex flex-col gap-8 p-7",children:[e.jsx(K,{title:"Plan & billing",sub:s.org.name}),a&&e.jsx("p",{role:"status",className:"m-0 max-w-[1040px] rounded-md border border-border bg-card px-3 py-2 text-[13px]",children:a}),w.isSuccess&&!i?e.jsx("p",{className:"m-0 text-muted-foreground",children:"This instance has no plans: everything is included."}):v.isError?e.jsx("p",{className:"m-0 text-muted-foreground",children:"The plans could not be loaded. Reload to try again."}):n?e.jsxs("div",{className:"flex max-w-[1040px] flex-col",children:[e.jsxs("section",{"aria-label":"Your plan",className:"grid grid-cols-1 gap-5 rounded-xl border border-border bg-card px-6 py-5 sm:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"m-0 text-[11.5px] font-medium uppercase tracking-wider text-muted-foreground",children:"Your plan"}),e.jsxs("p",{className:"m-0 mt-1 text-[28px] font-bold leading-tight",children:[n.current?.name??k?.name,e.jsx("span",{className:"ml-2 text-[15px] font-normal text-muted-foreground",children:n.current?.price??k?.price})]}),n.current?.period&&e.jsx("p",{className:"m-0 mt-1 text-[13px] text-ink-soft",children:n.current.period})]}),n.manage&&e.jsx("div",{children:e.jsx(g,{base:i,form:n.manage})}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Q,{})}),n.current?.warning&&e.jsx("p",{role:"status",className:"m-0 rounded-md bg-warn-soft px-3.5 py-2.5 text-[13px] sm:col-span-2",children:n.current.warning}),n.nudge&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-lg bg-brand-soft px-3.5 py-2.5 sm:col-span-2",children:[e.jsx("p",{className:"m-0 min-w-[220px] flex-1 text-[13px]",children:n.nudge.text}),e.jsx(g,{base:i,form:n.nudge.action})]})]}),e.jsxs("div",{className:"mb-4 mt-9 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("h2",{id:"compare",className:"m-0 text-[17px] font-semibold",children:"Compare plans"}),q&&e.jsx("div",{role:"radiogroup","aria-label":"Billing period",className:"inline-flex rounded-full border border-border bg-card p-0.5",children:[!1,!0].map(t=>e.jsx("button",{type:"button",role:"radio","aria-checked":h===t,onClick:()=>R(t),className:m("rounded-full px-3.5 py-1 text-[13px]",h===t?"bg-foreground text-background":"text-ink-soft"),children:t?e.jsxs(e.Fragment,{children:["Yearly ",e.jsx("span",{className:m("font-medium",h?"opacity-80":"text-brand"),children:"2 months free"})]}):"Monthly"},String(t)))})]}),e.jsx("div",{"aria-labelledby":"compare",className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:n.plans.map(t=>{const x=h&&t.yearly?t.yearly:null,S=x?x.actions:t.actions,E=t.relation==="downgrade";return e.jsxs("div",{className:m("relative flex min-w-0 flex-col gap-4 rounded-xl border bg-card p-5",t.recommended?"border-brand shadow-[0_0_0_1px_var(--color-brand),0_10px_30px_rgb(61_97_217/.12)]":"border-border"),children:[(t.current||t.recommended)&&e.jsx("span",{className:m("absolute -top-2.5 left-5 rounded-full px-2.5 py-px text-[11.5px] font-semibold",t.current?"bg-foreground text-background":"bg-brand text-white"),children:t.current?"Your plan":"Recommended"}),e.jsxs("div",{children:[e.jsx("h3",{className:"m-0 text-[16px] font-semibold",children:t.name}),t.pitch&&e.jsx("p",{className:"m-0 mt-0.5 text-[13px] text-muted-foreground",children:t.pitch})]}),e.jsxs("p",{className:"m-0 text-[34px] font-bold leading-none tracking-tight",children:[x?.amount??t.amount??t.price,(x?.unit??t.unit)&&e.jsx("span",{className:"ml-1 text-[13px] font-normal tracking-normal text-muted-foreground",children:x?.unit??t.unit})]}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-col gap-2 p-0",children:t.features.map(l=>e.jsxs("li",{className:m("flex gap-2 text-[13.5px]",t.added?.includes(l)&&"font-semibold"),children:[e.jsx(U,{className:"mt-0.5 size-4 shrink-0 text-ok","aria-hidden":!0}),l]},l))}),t.current?e.jsx(P,{type:"button",variant:"outline",disabled:!0,className:"w-full",children:"Current plan"}):E?S.map(l=>e.jsx(O,{base:i,form:l,warning:t.warning??null},l.label)):S.map(l=>e.jsx(g,{base:i,form:{...l,primary:!!t.recommended||l.primary},wide:!0},l.label))]},t.id)})}),e.jsxs("p",{className:"m-0 mt-5 text-center text-[13px] text-muted-foreground",children:[n.footer?e.jsxs("b",{className:"font-semibold text-foreground",children:[n.footer.split(". ")[0],"."]}):n.intro," ",n.footer?.split(". ").slice(1).join(". ")]}),n.notes.length>0&&e.jsx("p",{className:"m-0 mt-1.5 text-center text-[12px] text-muted-foreground",children:n.notes.join(" ")})]}):e.jsx(B,{})]})}function O({base:s,form:r,warning:a}){const[o,c]=d.useState(!1);return a&&o?e.jsxs("div",{className:"flex flex-col gap-2 rounded-md bg-warn-soft px-3 py-2.5 text-[12.5px]",children:[e.jsx("p",{className:"m-0",children:a}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{base:s,form:{...r,label:"Downgrade anyway",primary:!1}}),e.jsx("button",{type:"button",className:"text-[13px] text-muted-foreground underline underline-offset-2",onClick:()=>c(!1),children:"Keep my plan"})]})]}):a?e.jsx("button",{type:"button",className:"self-center text-[13px] text-muted-foreground underline underline-offset-[3px]",onClick:()=>c(!0),children:r.label}):e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0 self-center",children:[Object.entries(r.fields).map(([u,p])=>e.jsx("input",{type:"hidden",name:u,value:p},u)),e.jsx("button",{type:"submit",className:"text-[13px] text-muted-foreground underline underline-offset-[3px]",children:r.label})]})}function g({base:s,form:r,wide:a}){return e.jsxs("form",{method:"post",action:new URL(r.action,s).toString(),className:"m-0",children:[Object.entries(r.fields).map(([o,c])=>e.jsx("input",{type:"hidden",name:o,value:c},o)),e.jsx(P,{type:"submit",variant:r.primary?"default":"outline",className:a?"w-full":void 0,children:r.label})]})}function Q(){const{limits:s}=y(),r=[{label:"Sites",text:C(s.projects.used,s.projects.limit,"site","sites"),share:N(s.projects.used,s.projects.limit)},{label:"Members",text:C(s.members.used,s.members.limit,"member","members"),share:N(s.members.used,s.members.limit)},{label:"Screenshots",text:s.screenshots?s.storage.limit===null?`${j(s.storage.used)} used`:`${j(s.storage.used)} of ${j(s.storage.limit)}`:"Not on this plan",share:s.screenshots?N(s.storage.used,s.storage.limit):null}];return e.jsx("dl",{className:"m-0 grid grid-cols-1 gap-5 border-t border-border pt-4 sm:grid-cols-3",children:r.map(a=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("dt",{className:"text-[12px] text-muted-foreground",children:a.label}),e.jsx("dd",{className:"m-0 text-[13px]",children:a.text}),a.share!==null&&e.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:m("h-full rounded-full",a.share>=1?"bg-destructive":"bg-brand"),style:{width:`${Math.min(100,Math.round(a.share*100))}%`}})})]},a.label))})}const N=(s,r)=>r===null||r===0?null:s/r,C=(s,r,a,o)=>r===null?`${s} ${s===1?a:o}, unlimited`:`${s} of ${r} ${r===1?a:o}`,ne=()=>y().user.role==="owner"?e.jsx(L,{}):e.jsx(D,{title:"Plan & billing"});export{ne as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,i as ae,ai as re,e as ie,aj as se,E as ne,k as j,j as f,am as oe,h as de}from"./index-_7kIe8FW.js";import{q as ce,f as le,h as ue,p as fe,u as pe,j as he,k as be,l as me,c as ge,n as ve}from"./createBaseUIEventDetails-DviWdj-N.js";import{A as ke,B as xe}from"./useScrollLock-DdWilGdG.js";import{u as we}from"./useAriaLabelledBy-Dt1pmXDF.js";import{u as ye}from"./useValueChanged-Cm4_pRNG.js";const M=s.createContext(void 0);function Ce(){const r=s.useContext(M);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=s.forwardRef(function(i,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":g,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...q}=i,{clearErrors:A}=le(),{state:R,setTouched:H,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:J,disabled:U,name:Y,validation:c}=ue(),{labelId:_}=fe(),t=U||N,l=Y??w,n=s.useRef(null),G=re(n,T,c.inputRef),m=s.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:m}),B=h?void 0:E,[a,K]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});me(m,z,a,void 0,!t,w),ie(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{A(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:Q,buttonRef:X}=se({disabled:t,native:h}),Z=we(g,_,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(H(!0),P(!1),J==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:G,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=ge(ve,e.nativeEvent);V?.(u,S),!S.isCanceled&&K(u)},onClick(e){e.stopPropagation()},onFocus(){m.current?.focus()},...C!==void 0?{value:C}:ne},I=s.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=j("span",i,{state:I,ref:[o,m,X],props:[$,q,Q,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(M.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=s.forwardRef(function(i,o){const{render:k,className:F,style:x,...g}=i,p=Ce();return j("span",i,{state:p,ref:o,stateAttributesMapping:D,props:g})});function De({className:r,size:i="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":i,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,h as l}from"./index-
|
|
1
|
+
import{j as t,h as l}from"./index-_7kIe8FW.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as u,e as l}from"./index-_7kIe8FW.js";import{u as c}from"./createBaseUIEventDetails-DviWdj-N.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bc as N,bd as h,be as O,bf as U,bg as k,bh as B,bi as A,bj as y,bk as H,bl as V,bm as M,bn as x,r as p,bo as F,d as j}from"./index-
|
|
1
|
+
import{bc as N,bd as h,be as O,bf as U,bg as k,bh as B,bi as A,bj as y,bk as H,bl as V,bm as M,bn as x,r as p,bo as F,d as j}from"./index-_7kIe8FW.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#n;#c;#i;#p;#u;#l;#a;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Q(this.#t,this.options)?this.#h():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#S(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(a=>{r=a,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),a(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const a=this.createResult(s,e);return r?.(a),a}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#S();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#a=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#m(){this.#R(),this.#y(this.#v())}#S(){this.#a!==void 0&&(y.clearTimeout(this.#a),this.#a=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#n,a=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let n={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&Q(t,e),L=f&&P(t,s,e,i);(D||L)&&(n={...n,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=n;o=n.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=M(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=M(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const m=n.fetchStatus==="fetching",S=b==="pending",g=b==="error",T=S&&m,w=o!==void 0;return{status:b,fetchStatus:n.fetchStatus,isPending:S,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:n.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:n.dataUpdateCount>u.dataUpdateCount||n.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!S,isLoadingError:g&&!w,isPaused:n.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&w,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#c=this.options,this.#n.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const a=new Set(c??this.#d);return this.options.throwOnError&&a.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&a.has(l)})})();x.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}};function W(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function Q(t,e){return W(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const _=p.createContext(!1),z=()=>p.useContext(_);_.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const G=p.createContext(K()),J=()=>p.useContext(G),X=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?F(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},Y=t=>{p.useEffect(()=>{t.clearReset()},[t])},Z=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||F(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,$=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=J(),c=j(),a=c.defaultQueryOptions(t),u=c.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=i?"isRestoring":l?"optimistic":void 0,$(a),X(a,r,u),Y(r);const[n]=p.useState(()=>new e(c,a)),d=n.getOptimisticResult(a),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?n.subscribe(x.batchCalls(R)):U;return n.updateResult(),v},[n,o]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),p.useEffect(()=>{n.setOptions(a)},[a,n]),q(a,d))throw tt(a,n,r);if(Z({result:d,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw d.error;return a.notifyOnChangeProps?d:n.trackResult(d)}export{st as Q,it as d,rt as u};
|
package/static/dashboard/assets/{useCompositeItem-eZ3mWAYz.js → useCompositeItem-fDEe_Juq.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aI as d,r as f,
|
|
1
|
+
import{aI as d,r as f,ai as h}from"./index-_7kIe8FW.js";import{a as p}from"./CompositeList-w7YcjHbo.js";function I(i={}){const{highlightItemOnHover:n,highlightedIndex:r,onHighlightedIndexChange:a}=d(),{ref:c,index:t}=p(i),o=r===t,s=f.useRef(null),m=h(c,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){a(t)},onMouseMove(){const e=s.current;if(!n||!e)return;const u=e.hasAttribute("disabled")||e.ariaDisabled==="true";!o&&!u&&e.focus()}},compositeRef:m,index:t}}export{I as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u}from"./useBaseQuery-DVrotnH-.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{k as n}from"./index-_7kIe8FW.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as Dt,c as Tn,T as bt,t as Rn,b as vn,r as he,a as xn,u as Cn,p as In}from"./inertValue-BSe8K39O.js";import{aF as te,l as ve,aP as se,b6 as ct,aK as Ht,ag as De,e as D,r as a,j as ne,al as Wt,n as ut,E as Be,f as G,b7 as On,k as wn,ai as mt,g as Ge,aG as qe,aH as Pn,b8 as kn,b9 as An,ba as Fn,aQ as Mn}from"./index-_7kIe8FW.js";import{a as w,r as _,x as pe,c as xe,m as _t,e as at,b as Vt,o as Bt,g as Se,t as Ut,z as Yt,n as Nn,y as Ln}from"./createBaseUIEventDetails-DviWdj-N.js";const Dn=["open","progress","review","resolved"],Kr={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"},$r={open:"bg-status-open text-white",progress:"bg-status-progress text-[#16161a]",review:"bg-status-review text-white",resolved:"bg-status-resolved text-[#16161a]"};function qr(e){return Dn.includes(e)}function zr(e,t=Date.now()){if(!e)return"";const n=Math.max(0,(t-new Date(e).getTime())/1e3);return n<60?"now":n<3600?`${Math.floor(n/60)} min`:n<86400?`${Math.floor(n/3600)} h`:n<86400*30?`${Math.floor(n/86400)} d`:new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short"})}function Jr(e,t=""){const n=e.trim().split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():n.length===1&&n[0].length>0?n[0].slice(0,2).toUpperCase():(t[0]??"?").toUpperCase()}function Hn(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Wn,platform:_n,maxTouchPoints:Vn}=Hn(),Xe=Wn.toLowerCase(),Ne=_n.toLowerCase(),lt=/^i(os$|p)/.test(Ne)||Ne==="macintel"&&Vn>1,yt="android",tt=Ne===yt||Xe.includes(yt),Bn=!lt&&Ne.startsWith("mac");Ne.startsWith("win");const Un=Bn||lt,Ie=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Ie&&Xe.includes("firefox");!Ie&&Xe.includes("chrom");const Yn=Un,jt=/jsdom|happydom/.test(Xe),nt="data-base-ui-focusable",Gt="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Qr="ArrowLeft",Zr="ArrowRight",es="ArrowUp",ts="ArrowDown";function ns(e,t){if(!ve(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(w(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function ze(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function jn(e){return e.matches("html,body")}function Xt(e){return te(e)&&e.matches(Gt)}function rs(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Gt}`)!=null}function Et(e){return e?e.getAttribute("role")==="combobox"&&Xt(e):!1}function ss(e){if(!e||jt)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function St(e){return e?e.hasAttribute(nt)?e:e.querySelector(`[${nt}]`)||e:null}function Le(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Le(e,s.id,n)])}function Tt(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Gn(e){e.preventDefault(),e.stopPropagation()}function Xn(e){return"nativeEvent"in e}function Kn(e){return e.pointerType===""&&e.isTrusted?!0:tt&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $n(e){return jt?!1:!tt&&e.width===0&&e.height===0||tt&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function os(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function qn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const zn='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function Jn(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return ct(n)?n.host:null}function rt(e){for(const t of Array.from(e.children))if(se(t)==="summary")return t;return null}function Qn(e,t){const n=rt(t);return!!n&&(e===n||w(n,e))}function Kt(e){const t=e?se(e):"";return e!=null&&e.matches(zn)&&(t!=="summary"||e.parentElement!=null&&se(e.parentElement)==="details"&&rt(e.parentElement)===e)&&(t!=="details"||rt(e)==null)&&(t!=="input"||e.type!=="hidden")}function $t(e){if(!Kt(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=Jn(t)){const n=t!==e,r=se(t)==="slot";if(t.hasAttribute("inert")||n&&se(t)==="details"&&!t.open&&!Qn(e,t)||t.hasAttribute("hidden")||!r&&!Zn(t,n))return!1}return!0}function Zn(e,t){const n=Ht(e);return t?n.display!=="none":Dt(e,n)}function qt(e){const t=e.tabIndex;if(t<0){const n=se(e);if(n==="details"||n==="audio"||n==="video"||te(e)&&e.isContentEditable)return 0}return t}function Je(e){if(se(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function er(e,t){const n=Je(e);if(!n)return!0;const r=t.find(s=>{const o=Je(s);return o?.name===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=Je(s);return o?.name===n.name&&o.form===n.form})===n}function zt(e){if(te(e)&&se(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return te(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Jt(e,t){zt(e).forEach(n=>{Kt(n)&&t.push(n),Jt(n,t)})}function Qt(e,t,n){zt(e).forEach(r=>{te(r)&&r.matches(t)&&n.push(r),Qt(r,t,n)})}function ft(e){return $t(e)&&qt(e)>=0}function Zt(e){const t=[];return Jt(e,t),t.filter($t)}function He(e){const t=Zt(e);return t.filter(n=>qt(n)>=0&&er(n,t))}function en(e,t){const n=He(e),r=n.length;if(r===0)return;const s=pe(_(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function tn(e){return en(_(e).body,1)||e}function nn(e){return en(_(e).body,-1)||e}function rn(e,t){if(!e)return null;const n=He(_(e).body),r=n.length;if(r===0)return null;const s=n.indexOf(e);if(s===-1)return null;const o=(s+t+r)%r;return n[o]}function is(e){return rn(e,1)}function cs(e){return rn(e,-1)}function Me(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!w(n,r)}function tr(e){He(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Rt(e){const t=[];Qt(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Ae=0;class Te{static create(){return new Te}currentId=Ae;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ae,n()},t)}isStarted(){return this.currentId!==Ae}clear=()=>{this.currentId!==Ae&&(clearTimeout(this.currentId),this.currentId=Ae)};disposeEffect=()=>this.clear}function Ue(){const e=De(Te.create).current;return Tn(e.disposeEffect),e}(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=bt.startingStyle]="startingStyle",e[e.endingStyle=bt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const nr={"data-popup-open":""},rr={"data-popup-open":"","data-pressed":""},sr={"data-open":""},or={"data-closed":""},ir={"data-anchor-hidden":""},us={open(e){return e?nr:null}},as={open(e){return e?rr:null}},cr={open(e){return e?sr:or},anchorHidden(e){return e?ir:null}},ls={...cr,...Rn};function P(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ce(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function _e(e){const t=De(ur,e).current;return t.next=e,D(t.effect),t}function ur(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const sn={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ar={...sn,position:"fixed",top:0,left:0},fs={...sn,position:"absolute"},Ye=a.forwardRef(function(t,n){const[r,s]=a.useState();D(()=>{Yn&&Ie&&s("button")},[]);const o={tabIndex:0,role:r};return ne.jsx("span",{...t,ref:n,style:ar,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})});function je(e){return`data-base-ui-${e}`}let Ve=0;function Qe(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ve);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),Wt;const i=requestAnimationFrame(o);return Ve=i,()=>{Ve===i&&(cancelAnimationFrame(i),Ve=0)}}const Ze={inert:new WeakMap,"aria-hidden":new WeakMap},vt="data-base-ui-inert",st={inert:new WeakSet,"aria-hidden":new WeakSet};let Fe=new WeakMap,et=0;function lr(e){return st[e]}function on(e){return e?ct(e)?e.host:on(e.parentNode):null}const xt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=on(n);return e.contains(r)?r:null}).filter(n=>n!=null),Ct=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},It=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{se(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function fr(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const p=xt(t,e),c=s?It(t,Ct(p),new Set(p)):[],y=[],C=[];if(o){const d=Ze[o],g=lr(o);u=g,i=d;const v=xt(t,Array.from(t.querySelectorAll("[aria-live]"))),k=p.concat(v);It(t,Ct(k),new Set(k)).forEach(R=>{const b=R.getAttribute(o),q=b!==null&&b!=="false",W=(d.get(R)||0)+1;d.set(R,W),y.push(R),W===1&&q&&g.add(R),q||R.setAttribute(o,o==="inert"?"":"true")})}return s&&c.forEach(d=>{const g=(Fe.get(d)||0)+1;Fe.set(d,g),C.push(d),g===1&&d.setAttribute(vt,"")}),et+=1,()=>{i&&y.forEach(d=>{const v=(i.get(d)||0)-1;i.set(d,v),v||(!u?.has(d)&&o&&d.removeAttribute(o),u?.delete(d))}),s&&C.forEach(d=>{const g=(Fe.get(d)||0)-1;Fe.set(d,g),g||d.removeAttribute(vt)}),et-=1,et||(Ze.inert=new WeakMap,Ze["aria-hidden"]=new WeakMap,st.inert=new WeakSet,st["aria-hidden"]=new WeakSet,Fe=new WeakMap)}}function Ot(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=_(e[0]).body;return fr(e,o,n,r,{mark:s})}const ds=500,ps=500,gs={style:{transition:"none"}},dr="data-base-ui-click-trigger",hs={fallbackAxisSide:"none"},bs={fallbackAxisSide:"end"},pr={clipPath:"inset(50%)",position:"fixed",top:0,left:0},cn=a.createContext(null),un=()=>a.useContext(cn),gr=je("portal");function hr(e={}){const{ref:t,container:n,componentProps:r=Be,elementProps:s}=e,o=at(),u=un()?.portalNode,[p,c]=a.useState(null),[y,C]=a.useState(null),d=G(S=>{S!==null&&C(S)}),g=a.useRef(null);D(()=>{if(n===null){g.current&&(g.current=null,C(null),c(null));return}const S=(n&&(On(n)?n:n.current))??u??document.body;if(S==null){g.current&&(g.current=null,C(null),c(null));return}g.current!==S&&(g.current=S,C(null),c(S))},[n,u]);const v=wn("div",r,{ref:[t,d],props:[{id:o,[gr]:""},s]}),k=p&&v?ut.createPortal(v,p):null;return{node:y,nodeId:a.isValidElement(v)?v.props.id:void 0,subtree:k}}const ms=a.forwardRef(function(t,n){const{render:r,className:s,style:o,children:i,container:u,...p}=t,{node:c,nodeId:y,subtree:C}=hr({container:u,ref:n,componentProps:t,elementProps:p}),d=a.useRef(null),g=a.useRef(null),v=a.useRef(null),k=a.useRef(null),[S,R]=a.useState(null),b=a.useRef(!1),q=S?.modal,W=S?.open,Y=!!S&&!S.modal&&S.open&&!!c;a.useEffect(()=>{if(!c||q)return;function A(j){c&&j.relatedTarget&&Me(j)&&(j.type==="focusin"?b.current&&(Rt(c),b.current=!1):(tr(c),b.current=!0))}return Ce(P(c,"focusin",A,!0),P(c,"focusout",A,!0))},[c,q]),D(()=>{!c||W!==!0||!b.current||(Rt(c),b.current=!1)},[W,c]);const z=a.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:g,beforeInsideRef:v,afterInsideRef:k,portalNode:c,setFocusManagerState:R}),[c]);return ne.jsxs(a.Fragment,{children:[C,ne.jsxs(cn.Provider,{value:z,children:[Y&&c&&ne.jsx(Ye,{"data-type":"outside",ref:d,onFocus:A=>{if(Me(A,c))v.current?.focus();else{const j=S?S.domReference:null;nn(j)?.focus()}}}),Y&&c&&ne.jsx("span",{"aria-owns":y,style:pr}),c&&ut.createPortal(i,c),Y&&c&&ne.jsx(Ye,{"data-type":"outside",ref:g,onFocus:A=>{if(Me(A,c))k.current?.focus();else{const j=S?S.domReference:null;tn(j)?.focus(),S?.closeOnFocusOut&&S?.onOpenChange(!1,xe(_t,A.nativeEvent))}}})]})]})});function an(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class br{nodesRef={current:[]};events=an();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const ln=a.createContext(null),fn=a.createContext(null),dt=()=>a.useContext(ln)?.id||null,pt=e=>{const t=a.useContext(fn);return e??t};function ys(e){const t=at(),n=pt(e),r=dt();return D(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Es(e){const{children:t,id:n}=e,r=dt();return ne.jsx(ln.Provider,{value:a.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Ss(e){const{children:t,externalTree:n}=e,r=De(()=>n??new br).current;return ne.jsx(fn.Provider,{value:r,children:t})}function mr(e,t){const n=Ge(Se(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const wt=20;let be=[];function gt(){be=be.filter(e=>e.deref()?.isConnected)}function Pt(e){gt(),e&&se(e)!=="body"&&(be.push(new WeakRef(e)),be.length>wt&&(be=be.slice(-wt)))}function kt(){return gt(),be[be.length-1]?.deref()}function yr(e){return e?ft(e)?e:He(e)[0]||e:null}function At(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=Zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return ft(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Ts(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:p=!0,openInteractionType:c="",nextFocusableElement:y,previousFocusableElement:C,beforeContentFocusGuardRef:d,externalTree:g,getInsideElements:v}=e,k="rootStore"in t?t.rootStore:t,S=k.useState("open"),R=k.useState("domReferenceElement"),b=k.useState("floatingElement"),{events:q,dataRef:W}=k.context,Y=G(()=>W.current.floatingContext?.nodeId),z=s===!1,A=Et(R)&&z,j=_e(s),M=_e(o),J=_e(c),Oe=_e(S),V=pt(g),x=un(),U=a.useRef(!1),ae=a.useRef(!1),oe=a.useRef(!1),ie=a.useRef(null),me=a.useRef(""),ge=a.useRef(""),ye=a.useRef(null),Re=a.useRef(null),I=mt(ye,d,x?.beforeInsideRef),Q=mt(Re,x?.afterInsideRef),le=Ue(),fe=Ue(),we=vn(),We=x!=null,E=St(b),ce=G((T=E)=>T?He(T):[]),re=G(()=>v?.().filter(T=>T!=null)??[]);a.useEffect(()=>{if(r||!u)return;function T(B){B.key==="Tab"&&w(E,pe(_(E)))&&ce().length===0&&!A&&Gn(B)}const L=_(E);return P(L,"keydown",T)},[r,E,u,A,ce]),a.useEffect(()=>{if(r||!S)return;const T=_(E);function L(){oe.current=!1}function B(Z){const m=Se(Z),F=re(),h=w(b,m)||w(R,m)||w(x?.portalNode,m)||F.some(H=>H===m||w(H,m));oe.current=!h,ge.current=Z.pointerType||"keyboard",m?.closest(`[${dr}]`)&&(ae.current=!0,fe.start(0,()=>{ae.current=!1}))}function X(){ge.current="keyboard"}return Ce(P(T,"pointerdown",B,!0),P(T,"pointerup",L,!0),P(T,"pointercancel",L,!0),P(T,"keydown",X,!0),L)},[r,b,R,E,S,x,fe,re]),a.useEffect(()=>{if(r||!p)return;const T=_(E);function L(){ae.current=!0,fe.start(0,()=>{ae.current=!1})}function B(F){const h=Se(F);ft(h)&&(ie.current=h)}function X(F){const h=F.relatedTarget,H=F.currentTarget,K=Se(F);u&&h==null&&K!=null&&w(b,K)&&Pt(K),queueMicrotask(()=>{const N=Y(),ee=k.context.triggerElements,l=re(),f=h?.hasAttribute(je("focus-guard"))&&[ye.current,Re.current,x?.beforeInsideRef.current,x?.afterInsideRef.current,x?.beforeOutsideRef.current,x?.afterOutsideRef.current,he(C),he(y)].includes(h),$=!(w(R,h)||w(b,h)||w(h,b)||w(x?.portalNode,h)||l.some(O=>O===h||w(O,h))||ee.hasMatchingElement(O=>w(O,h))||f||V&&(Le(V.nodesRef.current,N).find(O=>w(O.context?.elements.floating,h)||w(O.context?.elements.domReference,h))||Tt(V.nodesRef.current,N).find(O=>[O.context?.elements.floating,St(O.context?.elements.floating)].includes(h)||O.context?.elements.domReference===h)));if(H===R&&E&&At(E),i&&H!==R&&!Dt(K)&&pe(T)===T.body){if(te(E)&&(E.focus(),i==="popup")){we.request(()=>{E.focus()});return}const O=ce(),de=ie.current,Pe=(de&&O.includes(de)?de:null)||O[O.length-1]||E;te(Pe)&&Pe.focus()}if(W.current.insideReactTree){W.current.insideReactTree=!1;return}(A||!u)&&h&&$&&!ae.current&&(A||h!==kt())&&(U.current=!0,k.setOpen(!1,xe(_t,F)))})}function Z(){oe.current||(W.current.insideReactTree=!0,le.start(0,()=>{W.current.insideReactTree=!1}))}const m=te(R)?R:null;if(!(!b&&!m))return Ce(m&&P(m,"focusout",X),m&&P(m,"pointerdown",L),b&&P(b,"focusin",B),b&&P(b,"focusout",X),b&&x&&P(b,"focusout",Z,!0))},[r,R,b,E,u,V,x,k,p,i,ce,A,Y,W,le,fe,we,y,C,re]),a.useEffect(()=>{if(r||!b||!S)return;const T=Array.from(x?.portalNode?.querySelectorAll(`[${je("portal")}]`)||[]),B=(V?Tt(V.nodesRef.current,Y()):[]).find(H=>Et(H.context?.elements.domReference||null))?.context?.elements.domReference,Z=[...[b,...T,ye.current,Re.current,x?.beforeOutsideRef.current,x?.afterOutsideRef.current,...re()],B,he(C),he(y),A?R:null].filter(H=>H!=null),m=Ot(Z,{ariaHidden:u||A,mark:!1}),F=[b,...T].filter(H=>H!=null),h=Ot(F);return()=>{h(),m()}},[S,r,R,b,u,x,A,V,Y,y,C,re]),D(()=>{if(!S||r||!te(E))return;me.current="",ge.current="";const T=_(E),L=pe(T);queueMicrotask(()=>{const B=j.current,X=typeof B=="function"?B(J.current||""):B;if(X===void 0||X===!1||w(E,L))return;let m=null;const F=()=>(m==null&&(m=ce(E)),m[0]||E);let h;X===!0||X===null?h=F():h=he(X),h=h||F();const H=w(E,pe(T));Qe(h,{preventScroll:h===E,shouldFocus(){if(!Oe.current)return!1;if(H)return!0;const K=pe(T);return!(K!==h&&w(E,K))}})})},[r,S,E,ce,j,J,Oe]),D(()=>{if(r||!E)return;const T=_(E),L=pe(T),B=J.current==null;Pt(L);function X(m){if(m.open||(me.current=mr(m.nativeEvent,ge.current)),m.reason===Vt&&m.nativeEvent.type==="mouseleave"&&(U.current=!0),m.reason===Bt)if(m.nested)U.current=!1;else if(Kn(m.nativeEvent)||$n(m.nativeEvent))U.current=!1;else{let F=!1;_(E).createElement("div").focus({get preventScroll(){return F=!0,!1}}),F?U.current=!1:U.current=!0}}q.on("openchange",X);function Z(m){const F=M.current;let h=typeof F=="function"?F(m):F;if(h===void 0||h===!1)return null;h===null&&(h=!0);const H=R?.isConnected?R:null,K=L?.isConnected&&se(L)!=="body"?L:null;let N=B?K||H:H||K;return N||(N=kt()||null),typeof h=="boolean"?N:he(h)||N||null}return()=>{q.off("openchange",X);const m=pe(T),F=re(),h=w(b,m)||F.some(ee=>ee===m||w(ee,m))||V&&Le(V.nodesRef.current,Y(),!1).some(ee=>w(ee.context?.elements.floating,m)),H=M.current,K=me.current,N=Z(K);queueMicrotask(()=>{const ee=yr(N),l=typeof H!="boolean";if(H&&!U.current&&te(ee)&&(!(!l&&ee!==m&&m!==T.body)||h)){const f={preventScroll:!0};K==="keyboard"&&(f.focusVisible=!0),ee.focus(f)}U.current=!1})}},[r,b,E,M,J,q,V,R,Y,re]),D(()=>{if(!Ie||S||!b)return;const T=pe(_(b));!te(T)||!Xt(T)||w(b,T)&&T.blur()},[S,b]),D(()=>{if(!(r||!x))return x.setFocusManagerState({modal:u,closeOnFocusOut:p,open:S,onOpenChange:k.setOpen,domReference:R}),()=>{x.setFocusManagerState(null)}},[r,x,u,S,k,p,R]),D(()=>{if(!(r||!E))return At(E),()=>{queueMicrotask(gt)}},[r,E]);const Ee=!r&&(u?!A:!0)&&(We||u);return ne.jsxs(a.Fragment,{children:[Ee&&ne.jsx(Ye,{"data-type":"inside",ref:I,onFocus:T=>{if(u){const L=ce();Qe(L[L.length-1])}else x?.portalNode&&(U.current=!1,Me(T,x.portalNode)?tn(R)?.focus():he(C??x.beforeOutsideRef)?.focus())}}),n,Ee&&ne.jsx(Ye,{"data-type":"inside",ref:Q,onFocus:T=>{u?Qe(ce()[0]):x?.portalNode&&(p&&(U.current=!0),Me(T,x.portalNode)?nn(R)?.focus():he(y??x.afterOutsideRef)?.focus())}})]})}function Er(){return!1}function Sr(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Rs(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=Er,bubbles:u,externalTree:p}=t,c="rootStore"in e?e.rootStore:e,y=c.useState("open"),C=c.useState("floatingElement"),{dataRef:d}=c.context,g=pt(p),v=G(typeof s=="function"?s:()=>!1),k=typeof s=="function"?v:s,S=k!==!1,R=G(()=>o),{escapeKey:b,outsidePress:q}=Sr(u),W=a.useRef(!1),Y=a.useRef(!1),z=a.useRef(!1),A=a.useRef(!1),j=a.useRef(""),M=a.useRef(null),J=Ue(),Oe=Ue(),V=G(()=>{Oe.clear(),d.current.insideReactTree=!1}),x=G(I=>{const Q=d.current.floatingContext?.nodeId;return(g?Le(g.nodesRef.current,Q):[]).some(fe=>fe.context?.open&&!fe.context.dataRef.current[I])}),U=G(I=>ze(I,c.select("floatingElement"))||ze(I,c.select("domReferenceElement"))),ae=G(I=>{i()&&c.setOpen(!1,xe(Ut,I.nativeEvent))}),oe=G(I=>{if(!y||!n||!r||I.key!=="Escape"||A.current||!b&&x("__escapeKeyBubbles"))return;const Q=Xn(I)?I.nativeEvent:I,le=xe(Yt,Q);c.setOpen(!1,le),le.isCanceled||I.preventDefault(),!b&&!le.isPropagationAllowed&&I.stopPropagation()}),ie=G(()=>{d.current.insideReactTree=!0,Oe.start(0,V)}),me=G(I=>{if(!y||!n||I.button!==0)return;const Q=Se(I.nativeEvent);w(c.select("floatingElement"),Q)&&(W.current||(W.current=!0,Y.current=!1))}),ge=G(I=>{!y||!n||(I.defaultPrevented||I.nativeEvent.defaultPrevented)&&W.current&&(Y.current=!0)});a.useEffect(()=>{if(!y||!n)return V;d.current.__escapeKeyBubbles=b,d.current.__outsidePressBubbles=q;const I=new Te,Q=new Te;function le(){I.clear(),A.current=!0}function fe(){I.start(Ie?5:0,()=>{A.current=!1})}function we(){z.current=!0,Q.start(0,()=>{z.current=!1})}function We(){W.current=!1,Y.current=!1}function E(){const l=j.current,f=l==="pen"||!l?"mouse":l,$=R(),O=typeof $=="function"?$():$;return typeof O=="string"?O:O[f]}function ce(l){const f=E();return f==="intentional"&&l.type!=="click"||f==="sloppy"&&l.type==="click"}function re(l){const f=d.current.floatingContext?.nodeId,$=g&&Le(g.nodesRef.current,f).some(O=>ze(l,O.context?.elements.floating));return U(l)||$}function Ee(l){if(ce(l)){l.type!=="click"&&!U(l)&&(Q.clear(),z.current=!1),V();return}if(d.current.insideReactTree){V();return}const f=Se(l),$=`[${je("inert")}]`,O=ve(f)?f.getRootNode():null,de=Array.from((ct(O)?O:_(c.select("floatingElement"))).querySelectorAll($)),Pe=c.context.triggerElements;if(f&&(Pe.hasElement(f)||Pe.hasMatchingElement(ue=>w(ue,f))))return;let ke=ve(f)?f:null;for(;ke&&!qe(ke);){const ue=Pn(ke);if(qe(ue)||!ve(ue))break;ke=ue}if(!(de.length&&ve(f)&&!jn(f)&&!w(f,c.select("floatingElement"))&&de.every(ue=>!w(ke,ue)))){if(te(f)&&!("touches"in l)){const ue=qe(f),$e=Ht(f),ht=/auto|scroll/,gn=ue||ht.test($e.overflowX),hn=ue||ht.test($e.overflowY),bn=gn&&f.clientWidth>0&&f.scrollWidth>f.clientWidth,mn=hn&&f.clientHeight>0&&f.scrollHeight>f.clientHeight,yn=$e.direction==="rtl",En=mn&&(yn?l.offsetX<=f.offsetWidth-f.clientWidth:l.offsetX>f.clientWidth),Sn=bn&&l.offsetY>f.clientHeight;if(En||Sn)return}if(!re(l)){if(E()==="intentional"&&z.current){Q.clear(),z.current=!1;return}typeof k=="function"&&!k(l)||x("__outsidePressBubbles")||(c.setOpen(!1,xe(Bt,l)),V())}}}function T(l){E()!=="sloppy"||l.pointerType==="touch"||!c.select("open")||!n||U(l)||Ee(l)}function L(l){if(E()!=="sloppy"||!c.select("open")||!n||U(l))return;const f=l.touches[0];f&&(M.current={startTime:Date.now(),startX:f.clientX,startY:f.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},J.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}function B(l,f){const $=Se(l);if(!$)return;const O=P($,l.type,()=>{f(l),O()})}function X(l){j.current="touch",B(l,L)}function Z(l){J.clear(),l.type==="pointerdown"&&(j.current=l.pointerType),!(l.type==="mousedown"&&M.current&&!M.current.dismissOnMouseDown)&&B(l,f=>{f.type==="pointerdown"?T(f):Ee(f)})}function m(l){if(!W.current)return;const f=Y.current;if(We(),E()==="intentional"){if(l.type==="pointercancel"){f&&we();return}if(!re(l)){if(f){we();return}typeof k=="function"&&!k(l)||(Q.clear(),z.current=!0,V())}}}function F(l){if(E()!=="sloppy"||!M.current||U(l))return;const f=l.touches[0];if(!f)return;const $=Math.abs(f.clientX-M.current.startX),O=Math.abs(f.clientY-M.current.startY),de=Math.sqrt($*$+O*O);de>5&&(M.current.dismissOnTouchEnd=!0),de>10&&(Ee(l),J.clear(),M.current=null)}function h(l){B(l,F)}function H(l){E()!=="sloppy"||!M.current||U(l)||(M.current.dismissOnTouchEnd&&Ee(l),J.clear(),M.current=null)}function K(l){B(l,H)}const N=_(C),ee=Ce(r&&Ce(P(N,"keydown",oe),P(N,"compositionstart",le),P(N,"compositionend",fe)),S&&Ce(P(N,"click",Z,!0),P(N,"pointerdown",Z,!0),P(N,"pointerup",m,!0),P(N,"pointercancel",m,!0),P(N,"mousedown",Z,!0),P(N,"mouseup",m,!0),P(N,"touchstart",X,!0),P(N,"touchmove",h,!0),P(N,"touchend",K,!0)));return()=>{ee(),I.clear(),Q.clear(),We(),z.current=!1,V()}},[d,C,r,S,k,y,n,b,q,oe,V,R,x,U,g,c,J]);const ye=a.useMemo(()=>({onKeyDown:oe,onPointerDown:ae,onClick:ae}),[oe,ae]),Re=a.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:ie,onMouseDownCapture(I){ie(),me(I)},onPointerDownCapture(I){ie(),me(I)},onMouseUpCapture:ie,onTouchEndCapture:ie,onTouchMoveCapture:ie}),[oe,ie,me,ge]);return a.useMemo(()=>n?{reference:ye,floating:Re,trigger:ye}:{},[n,ye,Re])}var dn=kn();const ot=[];let it;function Tr(){return it}function Rr(e){ot.push(e)}function vr(e){const t=(n,r)=>{const s=De(xr).current;let o;try{it=s;for(const i of ot)i.before(s);o=e(n,r);for(const i of ot)i.after(s);s.didInitialize=!0}finally{it=void 0}return o};return t.displayName=e.displayName||e.name,t}function vs(e){return a.forwardRef(vr(e))}function xr(){return{didInitialize:!1}}const Cr=An(19),Ir=Cr?wr:Pr;function pn(e,t,n,r,s){return Ir(e,t,n,r,s)}function Or(e,t,n,r,s){const o=a.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return dn.useSyncExternalStore(e.subscribe,o,o)}Rr({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],s=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,s)||(t=!0,r.value=s)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const s of e.syncHooks)n.add(s.store);const r=[];for(const s of n)r.push(s.subscribe(t));return()=>{for(const s of r)s()}}),dn.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function wr(e,t,n,r,s){const o=Tr();if(!o)return Or(e,t,n,r,s);const i=o.syncIndex;o.syncIndex+=1;let u;return o.didInitialize?(u=o.syncHooks[i],(u.store!==e||u.selector!==t||!Object.is(u.a1,n)||!Object.is(u.a2,r)||!Object.is(u.a3,s))&&(u.store!==e&&(o.didChangeStore=!0),u.store=e,u.selector=t,u.a1=n,u.a2=r,u.a3=s,u.value=t(e.getSnapshot(),n,r,s))):(u={store:e,selector:t,a1:n,a2:r,a3:s,value:t(e.getSnapshot(),n,r,s)},o.syncHooks.push(u)),u.value}function Pr(e,t,n,r,s){return Fn.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class kr{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return pn(this,t,n,r,s)}}class Ar extends kr{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){a.useDebugValue(t);const r=this;D(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;D(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);D(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){a.useDebugValue(t);const r=this,s=n!==void 0;D(()=>{s&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,s])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return a.useDebugValue(t),pn(this,this.selectors[t],n,r,s)}useContextCallback(t,n){a.useDebugValue(t);const r=G(n??Wt);this.context[t]=r}useStateSetter(t){const n=a.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const u=s;s=i,n(i,u,this)}})}}const Fr={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Mr extends Ar{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:an(),nested:r,triggerElements:o},Fr),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&qn(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function Nr(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),p=t.useState("activeTriggerElement"),c=t.useState(n?"popupElement":"positionerElement"),y=t.context.triggerElements,C=i,d=a.useRef(null);r===void 0&&d.current===null&&(d.current=new Mr({open:u,transitionStatus:void 0,referenceElement:p,floatingElement:c,triggerElements:y,onOpenChange:C,floatingId:s,syncOnly:!0,nested:o}));const g=r??d.current;return t.useSyncedValue("floatingId",s),D(()=>{const v={open:u,floatingId:s,referenceElement:p,floatingElement:c};ve(p)&&(v.domReferenceElement=p),g.state.positionReference===g.state.referenceElement&&(v.positionReference=p),g.update(v)},[u,s,p,c,g]),g.context.onOpenChange=C,g.context.nested=o,g}const xs={tabIndex:-1,[nt]:""};function Cs(e){return t=>t==="touch"?e.current:!0}function Is(e,t=!1){const n=at(),r=dt()!=null,s=De(()=>e(n,r)).current;return Nr({popupStore:s,treatPopupAsFloatingElement:t,floatingRootContext:s.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:s.setOpen}),s}function Os({handle:e,store:t}){return D(()=>e.attachStore(t),[e,t]),null}function Lr(e,t){const n=a.useRef(null),r=a.useRef(null);return a.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,p=t.context.triggerElements.getById(i);u&&p===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function Dr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function Hr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function ws(e,t,n,r={}){const s=n.reason,o=s===Vt,i=t&&s===Ln,u=!t&&(s===Ut||s===Yt),p=Hr(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);const c=()=>{const y={...r.extraState,open:t};i?y.instantType="focus":u?y.instantType="dismiss":o&&(y.instantType=void 0),Dr(y,t,n.trigger,p()),e.update(y)};o?ut.flushSync(c):c()}function Ps(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Lr(e,n),i=G(p=>{const c=n.select("open"),y=n.select("activeTriggerId");if(y===e){n.update({activeTriggerElement:p,...c?r:null});return}y==null&&c&&n.update({activeTriggerId:e,activeTriggerElement:p,...r})}),u=a.useCallback(p=>{o(p),p&&i(p)},[o,i]);return D(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:u,isMountedByThisTrigger:s}}function ks(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=a.useRef(null),s=e.useState("open"),o=e.useState("triggerCount"),i=e.useState("activeTriggerId"),u=e.useState("activeTriggerElement");D(()=>{if(!s){r.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const p=e.context.triggerElements.size,c={};e.state.triggerCount!==p&&(c.triggerCount=p);const y=e.select("activeTriggerId");let C=null;if(y){const d=e.context.triggerElements.getById(y);if(d)r.current=y,d!==e.state.activeTriggerElement&&(c.activeTriggerElement=d);else{for(const[g,v]of e.context.triggerElements.entries())if(v===e.state.activeTriggerElement){c.activeTriggerId=g,c.activeTriggerElement=v,r.current=g;break}c.activeTriggerId===void 0&&(r.current===y?C=y:r.current=null)}}else r.current=null;if(!C&&!y&&p===1){const d=e.context.triggerElements.entries().next();if(!d.done){const[g,v]=d.value;c.activeTriggerId=g,c.activeTriggerElement=v,r.current=g}}(c.triggerCount!==void 0||c.activeTriggerId!==void 0||c.activeTriggerElement!==void 0)&&e.update(c),C&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===C&&!e.context.triggerElements.getById(C)){const d=xe(Nn);e.setOpen(!1,d),d.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[s,e,o,i,u,n])}function As(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=xn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const p=G(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return Cn({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||p()}}),{forceUnmount:p,transitionStatus:o}}function Fs(e,t){e.useSyncedValues(t),D(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function Ms(e,t){D(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),D(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Ns{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}const Ls=a.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Ft={},Mt={},Nt="";function Ke(e,t){return Mn(e)?e:t}function Lt(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Ke(t,n)).overflowY)}function Wr(e){if(typeof document>"u")return!1;const t=_(e);return Ge(t).innerWidth-t.documentElement.clientWidth>0}function _r(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=_(e),r=n.documentElement,s=n.body,o=Ke(r,s),i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const p=o.offsetWidth;o.style.overflowY="hidden";const c=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,p===c}function Vr(e){const t=_(e),n=t.documentElement,r=t.body,s=Ke(n,r),o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Br(e){const t=_(e),n=t.documentElement,r=t.body,s=Ge(n);let o=0,i=0,u=!1;const p=In.create();if(Ie&&(s.visualViewport?.scale??1)!==1)return()=>{};function c(){const g=s.getComputedStyle(n),v=s.getComputedStyle(r),R=(g.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Ft={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Nt=n.style.scrollBehavior,Mt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,q=n.scrollWidth>n.clientWidth,W=g.overflowY==="scroll"||v.overflowY==="scroll",Y=g.overflowX==="scroll"||v.overflowX==="scroll",z=Math.max(0,s.innerWidth-r.clientWidth),A=Math.max(0,s.innerHeight-r.clientHeight),j=parseFloat(v.marginTop)+parseFloat(v.marginBottom),M=parseFloat(v.marginLeft)+parseFloat(v.marginRight),J=Ke(n,r);if(u=_r(e),u){n.style.scrollbarGutter=R,J.style.overflowY="hidden",J.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(b||W)&&(n.style.overflowY="scroll"),(q||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:j||A?`calc(100dvh - ${j+A}px)`:"100dvh",width:M||z?`calc(100vw - ${M+z}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function y(){Object.assign(n.style,Ft),Object.assign(r.style,Mt),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Nt)}function C(){y(),p.request(c)}c();const d=P(s,"resize",C);return()=>{p.cancel(),y(),typeof s.removeEventListener=="function"&&d()}}class Ur{lockCount=0;restore=null;timeoutLock=Te.create();timeoutUnlock=Te.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=_(t),r=n.documentElement,s=n.body,o=Ge(r);if(Lt(o,r,s)){const u=new o.MutationObserver(()=>{Lt(o,r,s)||(u.disconnect(),this.restore=null,this.lock(t))}),p={attributes:!0};u.observe(r,p),u.observe(s,p),this.restore=()=>u.disconnect();return}const i=lt||!Wr(t);this.restore=i?Vr(t):Br(t)}}const Yr=new Ur;function Ds(e=!0,t=null){D(()=>{if(e)return Yr.acquire(t)},[e,t])}export{ys as $,fs as A,ar as B,St as C,as as D,ms as E,xs as F,hs as G,Ie as H,Ls as I,Ts as J,Kn as K,dn as L,Ce as M,Bn as N,je as O,Ns as P,ns as Q,Ar as R,Kr as S,Te as T,Xt as U,ss as V,pt as W,rs as X,Le as Y,Es as Z,br as _,P as a,Hr as a0,Dr as a1,Nr as a2,ds as a3,Ss as a4,Me as a5,is as a6,tn as a7,cs as a8,Ye as a9,ps as aa,$n as ab,Et as ac,Qe as ad,Gn as ae,Qr as af,Zr as ag,es as ah,ts as ai,lt as aj,gs as ak,Ds as al,jt as am,Cs as an,Ms as ao,$r as ap,ws as b,ks as c,As as d,Os as e,vr as f,Rs as g,Fs as h,os as i,vs as j,Ps as k,_e as l,Ue as m,hr as n,bs as o,ls as p,cr as q,qr as r,Jr as s,us as t,Is as u,zr as v,Dn as w,dt as x,Mr as y,pn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,f as c,e as n}from"./index-
|
|
1
|
+
import{r as s,f as c,e as n}from"./index-_7kIe8FW.js";function u(e,r){const t=s.useRef(e),a=c(r);n(()=>{t.current!==e&&a(t.current),t.current=e},[e,a])}export{u};
|