@snagset/server 0.1.54 → 0.1.56
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/dist/app.js +8 -0
- package/dist/app.js.map +1 -1
- package/dist/config.generated.js +3 -1
- package/dist/config.generated.js.map +1 -1
- package/dist/db/migrations/0018_integration_inbound.sql +24 -0
- package/dist/db/migrations/0019_trello_provider.no-txn.sql +11 -0
- package/dist/integrations/github.js +17 -0
- package/dist/integrations/github.js.map +1 -1
- package/dist/integrations/inbound.js +2 -0
- package/dist/integrations/inbound.js.map +1 -1
- package/dist/integrations/jira.js +17 -1
- package/dist/integrations/jira.js.map +1 -1
- package/dist/integrations/linear.js +10 -0
- package/dist/integrations/linear.js.map +1 -1
- package/dist/integrations/outbox.js +24 -5
- package/dist/integrations/outbox.js.map +1 -1
- package/dist/integrations/store.js +53 -4
- package/dist/integrations/store.js.map +1 -1
- package/dist/integrations/trello.js +147 -0
- package/dist/integrations/trello.js.map +1 -0
- package/dist/jobs/set.js +3 -0
- package/dist/jobs/set.js.map +1 -1
- package/dist/net/publicFetch.js +144 -5
- package/dist/net/publicFetch.js.map +1 -1
- package/dist/routes/integrations.js +327 -41
- package/dist/routes/integrations.js.map +1 -1
- package/dist/routes/threads.js.map +1 -1
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-D7Q5QVvi.js → CompositeItem-B0Gv-UGy.js} +1 -1
- package/static/dashboard/assets/{CompositeList-w7YcjHbo.js → CompositeList-DJzkqbsI.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-CHiXSDkR.js → ConfirmDialog-DrJjmykZ.js} +1 -1
- package/static/dashboard/assets/{CopyButton-DkXHOvAs.js → CopyButton-N4ZGq5sM.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-BWEjbC5Z.js → FieldItemContext-Btlb65DI.js} +1 -1
- package/static/dashboard/assets/{InstallTag-DlqXIhqI.js → InstallTag-ErmrqxJG.js} +1 -1
- package/static/dashboard/assets/{InstanceRows-DwXLnXU2.js → InstanceRows-qItZIB6E.js} +1 -1
- package/static/dashboard/assets/McpTokens-BANlGby-.js +1 -0
- package/static/dashboard/assets/Picker-BGDXZjRG.js +6 -0
- package/static/dashboard/assets/{SaveState-DzX_pKjo.js → SaveState-C5sUD5wu.js} +1 -1
- package/static/dashboard/assets/{_app-DW5KDMy_.js → _app-Bskz-yjz.js} +2 -2
- package/static/dashboard/assets/{_app-B-X6wLWA.js → _app-QhVaTUQt.js} +1 -1
- package/static/dashboard/assets/activity-RabDpuwi.js +1 -0
- package/static/dashboard/assets/{arrow-left-DbWDuhAv.js → arrow-left-DJWxyBo6.js} +1 -1
- package/static/dashboard/assets/{avatar-BL6yPDkc.js → avatar-CN3-8DpI.js} +1 -1
- package/static/dashboard/assets/{badge-Dybw0_bq.js → badge-C54dE8rx.js} +1 -1
- package/static/dashboard/assets/{card-DwOk-mSd.js → card-Dxk95cVf.js} +1 -1
- package/static/dashboard/assets/{check-Dfkv0gma.js → check-CK4ao5He.js} +1 -1
- package/static/dashboard/assets/{chevron-down-BFQamcZy.js → chevron-down-OtEbsKDP.js} +1 -1
- package/static/dashboard/assets/{chevron-right-v0My-Qwf.js → chevron-right-DsIeYYan.js} +1 -1
- package/static/dashboard/assets/{copy-Bnl05Zl3.js → copy-oQJtUs23.js} +1 -1
- package/static/dashboard/assets/{createBaseUIEventDetails-DviWdj-N.js → createBaseUIEventDetails-CtitjO53.js} +1 -1
- package/static/dashboard/assets/{dialog-B1TvUOp8.js → dialog-PoGeAS0T.js} +2 -2
- package/static/dashboard/assets/{dropdown-menu-DQDS-MXM.js → dropdown-menu-CnT2RuY9.js} +2 -2
- package/static/dashboard/assets/{forgot-B13MZpbf.js → forgot-C2yLPZRe.js} +1 -1
- package/static/dashboard/assets/getPseudoElementBounds-1HRS6at-.js +1 -0
- package/static/dashboard/assets/{image-off-4dn7EbeZ.js → image-off-DUeMoP3X.js} +1 -1
- package/static/dashboard/assets/index-BQBdFBZG.css +1 -0
- package/static/dashboard/assets/{index-_7kIe8FW.js → index-DCtWnS4U.js} +3 -3
- package/static/dashboard/assets/{inertValue-BSe8K39O.js → inertValue-DvQ1EW5I.js} +1 -1
- package/static/dashboard/assets/{invite-nV6ykkp0.js → invite-CGRft1Wf.js} +1 -1
- package/static/dashboard/assets/{label-BkHFb2_L.js → label-Br7CuW71.js} +1 -1
- package/static/dashboard/assets/{layout-grid-Dt1Q4YQ_.js → layout-grid-D8FSCXx_.js} +1 -1
- package/static/dashboard/assets/me-Bz7e5FMG.js +1 -0
- package/static/dashboard/assets/{parts-DGVjMHe8.js → parts-BE9o8mAH.js} +1 -1
- package/static/dashboard/assets/{plus-hkwBCzos.js → plus-CZbLvWG1.js} +1 -1
- package/static/dashboard/assets/{reset-BNNJmqWL.js → reset-ZYeb2Axs.js} +1 -1
- package/static/dashboard/assets/{s._site-MSdo-oKn.js → s._site-DT0FXe9C.js} +1 -1
- package/static/dashboard/assets/s._site.comments-Ci3k9e5e.js +49 -0
- package/static/dashboard/assets/s._site.reviewers-CMYsq2DL.js +1 -0
- package/static/dashboard/assets/{s._site.settings-_fxdLl8T.js → s._site.settings-CWNTmj8T.js} +1 -1
- package/static/dashboard/assets/{setup-Ccth7CNk.js → setup-C7sY4SXb.js} +1 -1
- package/static/dashboard/assets/{sign-in-BeNKRQ7N.js → sign-in-DzeEwdj0.js} +1 -1
- package/static/dashboard/assets/{sign-up-B8239y6x.js → sign-up-iJvFq_R3.js} +1 -1
- package/static/dashboard/assets/{sites-CekL50U1.js → sites-DiBJvBBN.js} +1 -1
- package/static/dashboard/assets/studio-CK_HRLS5.js +1 -0
- package/static/dashboard/assets/{studio-pysRGF6Z.js → studio-QR3vjisG.js} +1 -1
- package/static/dashboard/assets/{studio.index-D1Utbxqz.js → studio.index-B2WSVF56.js} +1 -1
- package/static/dashboard/assets/studio.integrations-BYz4cDCb.js +16 -0
- package/static/dashboard/assets/studio.members-DPqoth_D.js +6 -0
- package/static/dashboard/assets/{studio.plan-CVZcQmU2.js → studio.plan-C3t2S9GZ.js} +1 -1
- package/static/dashboard/assets/{sun-Ciy3ROc0.js → sun-ChMFVIDA.js} +1 -1
- package/static/dashboard/assets/{switch-wRlAfGsi.js → switch-D0flLg1r.js} +1 -1
- package/static/dashboard/assets/{table-Bd53YpCs.js → table-PCTyuzaU.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-Dt1pmXDF.js → useAriaLabelledBy-Bu-GFL0B.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-DVrotnH-.js → useBaseQuery-Cw1dAAOb.js} +1 -1
- package/static/dashboard/assets/useCompositeItem-CHXWc-fj.js +1 -0
- package/static/dashboard/assets/useQuery-B9Vos2vJ.js +1 -0
- package/static/dashboard/assets/useRender-BJibc2kV.js +1 -0
- package/static/dashboard/assets/{useScrollLock-DdWilGdG.js → useScrollLock-d8peZTpK.js} +1 -1
- package/static/dashboard/assets/{useValueChanged-Cm4_pRNG.js → useValueChanged-CEhqkcjS.js} +1 -1
- package/static/dashboard/assets/{users-BDCRp6bm.js → users-DGXcs62X.js} +1 -1
- package/static/dashboard/assets/{welcome-CcxTkiVu.js → welcome-FVEqWF-E.js} +1 -1
- package/static/dashboard/assets/{widget-signin-CpAmvjAU.js → widget-signin-CDnZ1WcR.js} +1 -1
- package/static/dashboard/assets/you-DaUXbySS.js +1 -0
- package/static/dashboard/assets/zod-Cs-QZqu7.js +1 -0
- package/static/dashboard/index.html +2 -2
- package/static/widget/build.json +2 -2
- package/static/widget/snag.capture.js +3 -3
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +1 -1
- package/static/dashboard/assets/McpTokens-BvQnjHcP.js +0 -1
- package/static/dashboard/assets/Picker-CtjWzkpT.js +0 -1
- package/static/dashboard/assets/activity-C8vHHVVs.js +0 -1
- package/static/dashboard/assets/getPseudoElementBounds-Bv3Ra6Wj.js +0 -1
- package/static/dashboard/assets/index-PP-fkxl1.css +0 -1
- package/static/dashboard/assets/me-BDpKAhA-.js +0 -1
- package/static/dashboard/assets/s._site.comments-0jkl72Ja.js +0 -49
- package/static/dashboard/assets/s._site.reviewers-BWi4M9dg.js +0 -1
- package/static/dashboard/assets/select-DjpYopV7.js +0 -6
- package/static/dashboard/assets/studio-5pj2ZjeU.js +0 -1
- package/static/dashboard/assets/studio.integrations-M2aLKrz5.js +0 -1
- package/static/dashboard/assets/studio.members-C9Gigy9Y.js +0 -6
- package/static/dashboard/assets/useCompositeItem-fDEe_Juq.js +0 -1
- package/static/dashboard/assets/useQuery-ClGlUO36.js +0 -1
- package/static/dashboard/assets/useRender-BO4-nlty.js +0 -1
- package/static/dashboard/assets/you-guotGi3r.js +0 -1
- package/static/dashboard/assets/zod-Q9KJcyiZ.js +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-_7kIe8FW.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,6 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u}from"./useBaseQuery-DVrotnH-.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as n}from"./index-_7kIe8FW.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,x as b,j as e,h as y,y as N,B as j,q as f,t as S,a2 as C}from"./index-_7kIe8FW.js";import{L as c,I as d}from"./label-BkHFb2_L.js";import{P,a as h}from"./parts-DGVjMHe8.js";import{S as A}from"./SaveState-DzX_pKjo.js";import{M as k}from"./McpTokens-BvQnjHcP.js";import{u as M}from"./me-BDpKAhA-.js";import{u as F,a as E}from"./studio-pysRGF6Z.js";import{M as T,S as D,a as z}from"./sun-Ciy3ROc0.js";import"./createBaseUIEventDetails-DviWdj-N.js";import"./card-DwOk-mSd.js";import"./useScrollLock-DdWilGdG.js";import"./inertValue-BSe8K39O.js";import"./Picker-CtjWzkpT.js";import"./select-DjpYopV7.js";import"./chevron-down-BFQamcZy.js";import"./check-Dfkv0gma.js";import"./isElementDisabled-CwHw_lZC.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-Cm4_pRNG.js";import"./getPseudoElementBounds-Bv3Ra6Wj.js";import"./CompositeList-w7YcjHbo.js";import"./useQuery-ClGlUO36.js";import"./useBaseQuery-DVrotnH-.js";import"./badge-Dybw0_bq.js";import"./useRender-BO4-nlty.js";import"./dialog-B1TvUOp8.js";import"./switch-wRlAfGsi.js";import"./useAriaLabelledBy-Dt1pmXDF.js";import"./ConfirmDialog-CHiXSDkR.js";import"./copy-Bnl05Zl3.js";import"./CopyButton-DkXHOvAs.js";function H({items:s}){const[a,o]=r.useState(b);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:s.map(t=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===t.value,onClick:()=>{N(t.value),o(t.value)},className:y("inline-flex h-7 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",a===t.value&&"border-line-strong bg-muted text-foreground"),children:[t.icon,t.label]},t.value))})}function xe(){const s=M(),a=F(),[o,t]=r.useState(s.user.name),[u,i]=r.useState(null);r.useEffect(()=>t(s.user.name),[s.user.name]);const m=o.trim()!==s.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(P,{title:"You",sub:"Your own account on this studio",actions:e.jsx(A,{saving:a.isPending,savedAt:u})}),e.jsxs(h,{title:"Profile",description:"How you appear on replies and in the members list.",children:[e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:l=>{l.preventDefault(),m&&a.mutate(o.trim(),{onSuccess:()=>i(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"your-name",value:o,onChange:l=>t(l.target.value)}),m&&e.jsx(j,{type:"submit",variant:"outline",children:"Save"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"your-email",children:"Email"}),e.jsx(d,{id:"your-email",value:s.user.email,readOnly:!0,className:"bg-muted text-ink-soft"}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["How you sign in, and how the server finds you. An owner changes it with"," ",e.jsx("code",{className:"font-mono",children:"snagset passwd"}),"."]})]})]}),e.jsx(h,{title:"Password",description:"Changing it keeps this session and ends every other one.",children:e.jsx(L,{})}),!f(s.user.role,"settings")&&f(s.user.role,"review")&&e.jsx(k,{owner:!0,mine:!0,instanceOwner:!1,operator:S(s),sites:s.projects}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(H,{items:[{value:"system",label:"System",icon:e.jsx(T,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(D,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(z,{className:"size-3.5"})}]})})]})}function L(){const s=E(),[a,o]=r.useState(""),[t,u]=r.useState(""),[i,m]=r.useState(""),[l,g]=r.useState(""),[v,p]=r.useState(!1),x=a.length>0&&t.length>=12&&t===i;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async n=>{if(n.preventDefault(),!(!x||s.isPending)){g("");try{await s.mutateAsync({current:a,next:t}),o(""),u(""),m(""),p(!0)}catch(w){g(C(w))}}},children:[l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(d,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:n=>{o(n.target.value),p(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(d,{id:"pw-next",type:"password",autoComplete:"new-password",value:t,onChange:n=>{u(n.target.value),p(!1)}}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. No composition rules — length is what matters."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-again",children:"Confirm new password"}),e.jsx(d,{id:"pw-again",type:"password",autoComplete:"new-password",value:i,onChange:n=>{m(n.target.value),p(!1)}}),i.length>0&&t!==i&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Those do not match yet."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"submit",loading:s.isPending,disabled:!x,children:s.isPending?"Changing…":v&&!x?"Changed":"Change password"})})]})}export{xe as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aY as I}from"./index-_7kIe8FW.js";var me=e=>e.type==="checkbox",Se=e=>e.type==="file",te=e=>e instanceof Date,p=e=>e==null;const He=e=>typeof e=="object";var N=e=>!p(e)&&!Array.isArray(e)&&He(e)&&!te(e),Gr=e=>N(e)&&e.target?me(e.target)?e.target.checked:Se(e.target)?e.target.files:e.target.value:e;const Kr=/[.[\]'"]/;var ue=e=>e.split(Kr).filter(Boolean),Zr=(e,s)=>s.split(".").some((r,i,l)=>!isNaN(Number(r))&&e.has(l.slice(0,i).join("."))),Te=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function C(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Te&&(e instanceof Blob||s))return e;const r=Array.isArray(e);if(!r&&e.constructor!==Object)return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const l in e)Object.prototype.hasOwnProperty.call(e,l)&&(i[l]=C(e[l]));return i}const oe={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},X={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},J={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Dr="root",je=["__proto__","constructor","prototype"],Jr=/^\w*$/;var ne=e=>Jr.test(e),O=e=>e===void 0,v=(e,s,r)=>{if(!s||!N(e))return r;const i=ne(s)?[s]:ue(s);if(i.some(u=>je.includes(u)))return r;const l=i.reduce((u,o)=>p(u)?void 0:u[o],e);return O(l)||l===e?O(e[s])?r:e[s]:l},re=e=>typeof e=="boolean",G=e=>typeof e=="function",k=(e,s,r)=>{let i=-1;const l=ne(s)?[s]:ue(s),u=l.length,o=u-1;for(;++i<u;){const c=l[i];let m=r;if(i!==o){const E=e[c];m=N(E)||Array.isArray(E)?E:isNaN(+l[i+1])?{}:[]}if(je.includes(c))return;e[c]=m,e=e[c]}};const Qr=I.createContext(null);Qr.displayName="HookFormControlContext";var Xr=(e,s,r,i=!0)=>{const l={};for(const u in e)Object.defineProperty(l,u,{get:()=>{const o=u;return s._proxyFormState[o]!==X.all&&(s._proxyFormState[o]=!i||X.all),e[o]}});return l};const et=Te?I.useLayoutEffect:I.useEffect;var rt=e=>{const s=e.constructor&&e.constructor.prototype;return N(s)&&s.hasOwnProperty("isPrototypeOf")},Me=e=>p(e)||!He(e);const lr=(e,s)=>s.length===0&&!Array.isArray(e)&&!rt(e);function Q(e,s,r=new WeakMap){if(e===s)return!0;if(Me(e)||Me(s))return Object.is(e,s);if(te(e)&&te(s))return Object.is(e.getTime(),s.getTime());const i=Object.keys(e),l=Object.keys(s);if(i.length!==l.length)return!1;if(lr(e,i)||lr(s,l))return Object.is(e,s);if(!i.length&&Array.isArray(e)!==Array.isArray(s))return!1;const u=r.get(e);if(u&&u.has(s))return!0;if(u)u.add(s);else{const o=new WeakSet;o.add(s),r.set(e,o)}for(const o of i){const c=e[o];if(!(o in s))return!1;if(o!=="ref"){const m=s[o];if(te(c)&&te(m)||(N(c)||Array.isArray(c))&&(N(m)||Array.isArray(m))?!Q(c,m,r):!Object.is(c,m))return!1}}return!0}function tt(e){const s=I.useRef(!1),r=I.useRef(!1),i=I.useRef(void 0),l=I.useRef(0);l.current++,r.current;const u=I.useCallback((c,m,E)=>{if(c&&(s.current||r.current&&l.current>1)){const T=m();Q(i.current,T)||E(T)}s.current=!0},[]),o=I.useCallback((c,m)=>{c&&(i.current=C(m()))},[]);return{resyncIfNeeded:u,snapshot:o}}var M=e=>typeof e=="string",st=(e,s,r,i,l)=>M(e)?(i&&s.watch.add(e),v(r,e,l)):Array.isArray(e)?e.map(u=>(i&&s.watch.add(u),v(r,u,v(l,u)))):(i&&(s.watchAll=!0),r),De=e=>({isOnSubmit:!e||e===X.onSubmit,isOnBlur:e===X.onBlur,isOnChange:e===X.onChange,isOnAll:e===X.all,isOnTouch:e===X.onTouched}),Ue=(e,s,r)=>{if(r)return!1;if(s.watchAll||s.watch.has(e))return!0;for(const i of s.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const Ve=(e,s,r,i)=>{for(const l of r||Object.keys(e)){if(l==="_f")continue;const u=r?v(e,l):e[l];if(u){const{_f:o}=u;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],l)&&!i)return!0;if(o.ref&&s(o.ref,o.name)&&!i)return!0;if(Ve(u,s))break}else if((N(u)||Array.isArray(u))&&Ve(u,s))break}}};var ur=(e,s,r)=>{const i=v(e,r),l=Array.isArray(i)?i:[];return k(l,Dr,s[r]),k(e,r,l),e},B=e=>N(e)&&!Object.keys(e).length,ke=e=>{if(!Te)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},Ye=e=>e.type==="radio",Oe=e=>e instanceof RegExp,ze=(e,s,r,i,l)=>s?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:l||!0}}:{};const fr={value:!1,isValid:!1},cr={value:!0,isValid:!0};var xr=e=>{if(!Array.isArray(e))return fr;if(e.length>1){const r=e.filter(i=>i&&i.checked&&!i.disabled).map(i=>i.value);return{value:r,isValid:!!r.length}}const s=e[0];return!s||!s.checked||s.disabled?fr:!s.attributes||!("value"in s.attributes)||O(s.value)||s.value===""?cr:{value:s.value,isValid:!0}};const dr={isValid:!1,value:null};var kr=e=>Array.isArray(e)?e.reduce((s,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:s,dr):dr;function yr(e,s,r="validate"){if(M(e)||Array.isArray(e)&&e.every(M)||re(e)&&!e)return{type:r,message:M(e)?e:"",ref:s}}var le=e=>N(e)&&!Oe(e)?e:{value:e,message:""},hr=async(e,s,r,i,l,u)=>{const{ref:o,refs:c,required:m,maxLength:E,minLength:T,min:H,max:j,pattern:$,validate:A,name:F,valueAsNumber:b,mount:fe}=e._f,w=v(r,F);if(!fe||s.has(F))return{};const ee=c?c[0]:o,P=D=>{if(l&&ee.reportValidity){const x=re(D)?"":D||"";c?c.forEach(R=>R.setCustomValidity(x)):ee.setCustomValidity(x),ee.reportValidity()}},S={},ce=Ye(o),be=me(o),Ae=ce||be,ae=(b||Se(o))&&O(o.value)&&O(w)||ke(o)&&o.value===""||w===""||Array.isArray(w)&&!w.length,se=ze.bind(null,F,i,S),Fe=(D,x,R,W=J.maxLength,K=J.minLength)=>{const q=D?x:R;S[F]={type:D?W:K,message:q,ref:o,...se(D?W:K,q)}};if(u?!Array.isArray(w)||!w.length:m&&(!Ae&&(ae||p(w))||re(w)&&!w||be&&!xr(c).isValid||ce&&!kr(c).isValid)){const{value:D,message:x}=M(m)?{value:!!m,message:m}:le(m);if(D&&(S[F]={type:J.required,message:x,ref:ee,...se(J.required,x)},!i))return P(x),S}if(!ae&&(!p(H)||!p(j))){let D,x;const R=le(j),W=le(H);if(!p(w)&&!te(w)&&!isNaN(w)){const K=o.valueAsNumber||w&&+w;p(R.value)||(D=K>R.value),p(W.value)||(x=K<W.value)}else{const K=o.valueAsDate||new Date(w),q=ye=>new Date(new Date().toDateString()+" "+ye),we=o.type=="time",z=o.type=="week";M(R.value)&&w&&(D=we?q(w)>q(R.value):z?w>R.value:K>new Date(R.value)),M(W.value)&&w&&(x=we?q(w)<q(W.value):z?w<W.value:K<new Date(W.value))}if((D||x)&&(Fe(!!D,R.message,W.message,J.max,J.min),!i))return P(S[F].message),S}if((E||T)&&!ae&&(M(w)||u&&Array.isArray(w))){const D=le(E),x=le(T),R=!p(D.value)&&w.length>+D.value,W=!p(x.value)&&w.length<+x.value;if((R||W)&&(Fe(R,D.message,x.message),!i))return P(S[F].message),S}if($&&!ae&&M(w)){const{value:D,message:x}=le($);if(Oe(D)&&!w.match(D)&&(S[F]={type:J.pattern,message:x,ref:o,...se(J.pattern,x)},!i))return P(x),S}if(A){if(G(A)){const D=await A(w,r),x=yr(D,ee);if(x&&(S[F]={...x,...se(J.validate,x.message)},!i))return P(x.message),S}else if(N(A)){let D={};for(const x in A){if(!B(D)&&!i)break;const R=yr(await A[x](w,r),ee,x);R&&(D={...R,...se(x,R.message)},P(R.message),i&&(S[F]=D))}if(!B(D)&&(S[F]={ref:ee,...D},!i))return S}}const de=S[F];return P(de?de.message:!0),S},xe=e=>Array.isArray(e)?e:[e],Or=e=>Array.isArray(e)?e.filter(Boolean):[];function it(e,s){const r=s.length-1;let i=0;for(;i<r;){if(p(e)){e=void 0;break}e=e[s[i]],i++}return e}function nt(e){for(const s in e)if(e.hasOwnProperty(s)&&!O(e[s]))return!1;return!0}function U(e,s){if(M(s)&&Object.prototype.hasOwnProperty.call(e,s))return delete e[s],e;const r=Array.isArray(s)?s:ne(s)?[s]:ue(s);if(r.some(o=>je.includes(String(o))))return e;const i=r.length===1?e:it(e,r),l=r.length-1,u=r[l];return i&&delete i[u],l!==0&&(N(i)&&B(i)||Array.isArray(i)&&nt(i))&&U(e,r.slice(0,-1)),e}const at=I.createContext(null);at.displayName="HookFormContext";var gr=()=>{let e=[];return{get observers(){return e},next:l=>{for(const u of e)u.next&&u.next(l)},subscribe:l=>(e.push(l),{unsubscribe:()=>{e=e.filter(u=>u!==l)}}),unsubscribe:()=>{e=[]}}};function Sr(e,s){const r={};for(const i in e)if(e.hasOwnProperty(i)){const l=e[i],u=s[i];if(l&&N(l)&&u){const o=Sr(l,u);N(o)&&(r[i]=o)}else e[i]&&(r[i]=u)}return r}const vr=(e,s)=>e!==null&&He(e)&&Object.prototype.hasOwnProperty.call(e,s);var ot=(e,s)=>{if(!s)return!1;let r=e;for(const i of ne(s)?[s]:ue(s)){if(!vr(r,i))return vr(e,s);r=r[i]}return!0},Tr=e=>e.type==="select-multiple",lt=e=>Ye(e)||me(e),Pe=e=>ke(e)&&e.isConnected;function _r(e){return Array.isArray(e)||N(e)}function Rr(e,s,r="",i=[]){for(const l in e){const u=r?`${r}.${l}`:l,o=e[l];_r(o)&&_r(v(s,u))?Rr(o,s,u,i):i.push(u)}return i}var ut=e=>{for(const s in e)if(G(e[s]))return!0;return!1};function Cr(e){return Array.isArray(e)||N(e)&&!ut(e)}function Lr(e){return!!(e&&"_f"in e)}function Ir(e){return Array.isArray(e)?!e.some(s=>!O(s)):!Object.keys(e).length}function Be(e,s){Array.isArray(e)?e[s]=void 0:delete e[s]}function $e(e,s={},r){for(const i in e){const l=e[i],u=r&&r[i];Cr(l)&&(!Array.isArray(l)||!Lr(u))?(s[i]=Array.isArray(l)?[]:{},$e(l,s[i],u),Ir(s[i])&&Be(s,i)):O(l)||(s[i]=!0)}return s}function ie(e,s,r,i){r||(r=$e(s,{},i));for(const l in e){const u=e[l],o=i&&i[l];Cr(u)&&(!Array.isArray(u)||!Lr(o))?(O(s)||Me(r[l])?r[l]=$e(u,Array.isArray(u)?[]:{},o):ie(u,p(s)?{}:s[l],r[l],o),Ir(r[l])&&Be(r,l)):Q(u,s[l])?Be(r,l):r[l]=!0}return r}var ft=(e,s)=>{const r=s.split("."),i=[];let l=r[0];for(let u=1;u<r.length;l+="."+r[u++])!isNaN(+r[u])&&e.has(l)&&i.push(`${l}.${r[u]}`);return i},Nr=(e,{valueAsNumber:s,valueAsDate:r,setValueAs:i})=>O(e)?e:s?e===""?NaN:e&&+e:r&&M(e)?new Date(e):i?i(e):e;function Vr(e){const s=e.ref;return Se(s)?s.files:Ye(s)?kr(e.refs).value:Tr(s)?[...s.selectedOptions].map(({value:r})=>r):me(s)?xr(e.refs).value:Nr(s.value,e)}var ct=(e,s,r,i)=>{const l={};for(const u of e){const o=v(s,u);o&&k(l,u,o._f)}return{criteriaMode:r,names:[...e],fields:l,shouldUseNativeValidation:i}},_e=e=>O(e)?e:Oe(e)?e.source:N(e)?Oe(e.value)?e.value.source:e.value:e;const mr="AsyncFunction";var dt=e=>{if(!e||!e.validate)return!1;if(G(e.validate))return e.validate.constructor.name===mr;if(N(e.validate)){for(const s in e.validate)if(e.validate[s].constructor.name===mr)return!0}return!1},yt=e=>e.mount&&(e.required||!O(e.required)&&e.required!==!1||!O(e.min)||!O(e.max)||!O(e.maxLength)||!O(e.minLength)||e.pattern||e.validate);function br(e,s,r){const i=v(e,r);if(i||ne(r))return{error:i,name:r};const l=r.split(".");for(;l.length;){const u=l.join("."),o=v(s,u),c=v(e,u);if(o&&!Array.isArray(o)&&r!==u)return{name:r};if(c&&c.type)return{name:u,error:c};if(c&&c.root&&c.root.type)return{name:`${u}.root`,error:c.root};l.pop()}return{name:r}}var ht=(e,s,r,i)=>{r(e);const l=Object.keys(e).filter(u=>u!=="name");return!l.length||i&&l.length>=Object.keys(s).length||l.find(u=>s[u]===(!i||X.all))},gt=(e,s,r)=>!e||!s||e===s||xe(e).some(i=>i&&(r?i===s||i.startsWith(s+"."):i.startsWith(s)||s.startsWith(i))),vt=(e,s,r,i,l)=>l.isOnAll?!1:!r&&l.isOnTouch?!(s||e):(r?i.isOnBlur:l.isOnBlur)?!e:(r?i.isOnChange:l.isOnChange)?e:!0,_t=(e,s)=>{const r=v(e,s);!Or(r).length&&!r?.root&&U(e,s)};const Vt={mode:X.onSubmit,reValidateMode:X.onChange,shouldFocusError:!0},pe="form",mt=(e,s)=>{for(const r in e)r in s||delete e[r];Object.assign(e,s)},Ur={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function bt(e={}){let s={...Vt,...e},r={...C(Ur),isLoading:G(s.defaultValues),errors:s.errors||{},disabled:s.disabled||!1},i={},l=N(s.defaultValues)||N(s.values)?C(s.defaultValues||s.values)||{}:{},u=s.shouldUnregister?{}:C(l),o={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const m={},E={};let T=0,H=De(s.mode),j=De(s.reValidateMode);const $={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},A={...$};let F={...A};const b={array:gr(),state:gr()};let fe=0;const w=s.criteriaMode===X.all,ee=(t,a)=>n=>{clearTimeout(E[t]),E[t]=setTimeout(a,n)},P=async t=>{if(!o.keepIsValid&&!s.disabled&&(A.isValid||F.isValid||t)){const a=++fe;let n;s.resolver?(n=B((await R()).errors),a===fe&&S()):n=await q({fields:i,onlyCheckValid:!0,eventType:oe.VALID}),a===fe&&n!==r.isValid&&b.state.next({isValid:n})}},S=(t,a)=>{!s.disabled&&(A.isValidating||A.validatingFields||F.isValidating||F.validatingFields)&&((t||c.mount).forEach(n=>{n&&(a?k(r.validatingFields,n,a):U(r.validatingFields,n))}),b.state.next({validatingFields:r.validatingFields,isValidating:!B(r.validatingFields)}))},ce=()=>{r.dirtyFields=ie(l,u,void 0,i)},be=(t,a=[],n,f,d=!0,y=!0)=>{if(f&&n&&!s.disabled){o.action=!0;const h=v(i,t);if(o.actionArrayLengths.has(t)||o.actionArrayLengths.set(t,Array.isArray(h)?h.length:0),y&&Array.isArray(h)){const V=n(h,f.argA,f.argB);d&&k(i,t,V)}const g=v(r.errors,t);if(y&&Array.isArray(g)){const V=g.root,L=n(g,f.argA,f.argB)||g;V&&(L.root=V),d&&k(r.errors,t,L),_t(r.errors,t)}const _=v(r.touchedFields,t);if((A.touchedFields||F.touchedFields)&&y&&Array.isArray(_)){const V=n(_,f.argA,f.argB);d&&k(r.touchedFields,t,V)}(A.dirtyFields||F.dirtyFields)&&ce(),b.state.next({name:t,isDirty:z(t,a),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else k(u,t,a)},Ae=(t,a)=>{k(r.errors,t,a),r.errors={...r.errors},b.state.next({errors:r.errors})},ae=t=>{r.errors=t,b.state.next({errors:r.errors,isValid:!1})},se=t=>{const a=ne(t)?[t]:ue(t);let n=u,f=l;for(let d=0;d<a.length-1;d++){const y=a[d];if(n=p(n)?n:n[y],f=p(f)?f:f[y],n===null&&f!==null)return!0}return!1},Fe=t=>{if(!o.actionArrayLengths.size)return!1;const a=ne(t)?[t]:ue(t);let n=u,f="",d=-1,y=0;for(let h=0;h<a.length;h++){if(p(n))return!1;const g=a[h];if(f=f?`${f}.${g}`:g,Array.isArray(n)&&+g>=n.length)return d===-1?!1:h===d?+g<y:!0;o.actionArrayLengths.has(f)&&(d=h+1,y=o.actionArrayLengths.get(f)),n=n[g]}return!1},de=(t,a,n,f)=>{const d=v(i,t);if(d){if(se(t)||Fe(t))return;const y=O(v(u,t)),h=v(u,t,O(n)?v(l,t):n);O(h)||f&&f.defaultChecked||a?k(u,t,a?h:Vr(d._f)):Re(t,h),o.mount&&!o.action&&(P(),y&&r.isDirty&&(A.isDirty||F.isDirty)&&(z()||(r.isDirty=!1,b.state.next({...r}))),e.shouldUnregister&&y&&!O(v(u,t))&&Ue(t,c)&&(o.watch=!0))}},D=(t,a,n,f,d)=>{let y=!1,h=!1;const g={name:t};if(!s.disabled||f===!0){if(!n||f){const _=Q(v(l,t),a);(A.isDirty||F.isDirty)&&(h=r.isDirty,r.isDirty=g.isDirty=!_||z(),y=h!==g.isDirty),h=!!v(r.dirtyFields,t),_!==r.isDirty?mt(r.dirtyFields,ie(l,u,void 0,i)):_?U(r.dirtyFields,t):k(r.dirtyFields,t,!0),g.dirtyFields=r.dirtyFields,y=y||(A.dirtyFields||F.dirtyFields)&&h!==!_}if(n){const _=v(r.touchedFields,t);_||(k(r.touchedFields,t,n),g.touchedFields=r.touchedFields,y=y||(A.touchedFields||F.touchedFields)&&_!==n)}y&&d&&b.state.next(g)}return y?g:{}},x=(t,a,n,f)=>{const d=v(r.errors,t),y=(A.isValid||F.isValid)&&re(a)&&r.isValid!==a;if(s.delayError&&n?(m[t]=ee(t,()=>Ae(t,n)),m[t](s.delayError)):(clearTimeout(E[t]),delete m[t],n?k(r.errors,t,n):U(r.errors,t),r.errors={...r.errors}),(n?!Q(d,n):d)||!B(f)||y){const h={...f,...y&&re(a)?{isValid:a}:{},errors:r.errors,name:t};b.state.next(h)}},R=async t=>(S(t,!0),await s.resolver(u,s.context,ct(t||c.mount,i,s.criteriaMode,s.shouldUseNativeValidation))),W=async t=>{const{errors:a}=await R(t);if(S(t),t){for(const n of t){const f=v(a,n);f?c.array.has(n)&&N(f)&&!Object.keys(f).some(d=>!Number.isNaN(Number(d)))?ur(r.errors,{[n]:f},n):k(r.errors,n,f):U(r.errors,n)}r.errors={...r.errors}}else r.errors=a;return a},K=async({name:t,eventType:a})=>{if(e.validate){const n=await e.validate({formValues:u,formState:r,name:t,eventType:a});if(N(n))for(const f in n){const d=n[f];d&&Ee(`${pe}.${f}`,{message:M(d.message)?d.message:"",type:d.type||J.validate})}else M(n)||!n?Ee(pe,{message:n||"",type:J.validate}):Xe(pe);return n}return!0},q=async({fields:t,onlyCheckValid:a,name:n,eventType:f,context:d={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(d.runRootValidation=!0,!await K({name:n,eventType:f})&&(d.valid=!1,a)))return d.valid;for(const y in t){const h=t[y];if(h){const{_f:g,..._}=h;if(g){const V=c.array.has(g.name),L=h._f&&dt(h._f),Y=A.validatingFields||A.isValidating||F.validatingFields||F.isValidating;L&&Y&&S([g.name],!0);const Z=await hr(h,c.disabled,u,w,s.shouldUseNativeValidation&&!a,V);if(L&&Y&&S([g.name]),Z[g.name]&&(d.valid=!1,a)||(!a&&(v(Z,g.name)?V?ur(r.errors,Z,g.name):k(r.errors,g.name,Z[g.name]):U(r.errors,g.name)),e.shouldUseNativeValidation&&Z[g.name]))break}!B(_)&&await q({context:d,onlyCheckValid:a,fields:_,name:y,eventType:f})}}return d.valid},we=()=>{for(const t of c.unMount){const a=v(i,t);a&&(a._f.refs?a._f.refs.every(n=>!Pe(n)):!Pe(a._f.ref))&&Le(t)}c.unMount=new Set},z=(t,a)=>(t&&a&&k(u,t,a),!Q(o.mount?u:l,l)),ye=(t,a,n)=>st(t,c,{...o.mount?u:O(a)||M(t)?l:a},n,a),Pr=t=>Or(v(o.mount?u:l,t,s.shouldUnregister?v(l,t,[]):[])),Re=(t,a,n={},f=!1,d=!1,y=!1)=>{const h=v(i,t);let g=a;if(h){const _=h._f;_&&(!_.disabled&&k(u,t,Nr(a,_)),g=ke(_.ref)&&p(a)?"":a,Tr(_.ref)?[..._.ref.options].forEach(V=>V.selected=g.includes(V.value)):_.refs?me(_.ref)?_.refs.forEach(V=>{(!V.defaultChecked||!V.disabled)&&(Array.isArray(g)?V.checked=!!g.find(L=>L===V.value):V.checked=g===V.value||!!g)}):_.refs.forEach(V=>V.checked=V.value===g):Se(_.ref)?_.ref.value="":(_.ref.value=g,!_.ref.type&&!d&&!y&&b.state.next({name:t,values:f?u:C(u)})))}(n.shouldDirty||n.shouldTouch)&&D(t,g,n.shouldTouch,n.shouldDirty,!d),n.shouldValidate&&Ce(t,{delayError:n.delayError})},Ge=(t,a,n,f=!1,d=!1,y=!1)=>{c.array.has(t)&&b.array.next({name:t,values:f?u:C(u)});for(const h in a){if(!a.hasOwnProperty(h))continue;const g=a[h],_=t+"."+h,V=v(i,_);(c.array.has(t)||N(g)||V&&!V._f)&&!te(g)?Ge(_,g,n,f,d,y):Re(_,g,n,f,d,y)}},Ke=(t,a,n,f,d=!1)=>{const y=v(i,t),h=c.array.has(t),g=f?a:C(a),_=v(u,t),V=Q(_,g);if(V||k(u,t,g),h)b.array.next({name:t,values:f?u:C(u)}),(A.isDirty||A.dirtyFields||F.isDirty||F.dirtyFields)&&n.shouldDirty&&(ce(),d||b.state.next({name:t,dirtyFields:r.dirtyFields,isDirty:z(t,g)}));else{const L=Array.isArray(g)&&!g.length||B(g),Y=!V&&!d;!y||y._f||p(g)||L?Re(t,g,n,f,d,Y):Ge(t,g,n,f,d,Y)}if(!V&&!d){const L=Ue(t,c),Y=f?u:C(u);if(b.state.next({...L&&r,name:o.mount||L?t:void 0,values:Y}),!h)for(const Z of ft(c.array,t))b.state.next({name:Z,values:Y})}},he=(t,a,n={})=>Ke(t,a,n,!1),pr=(t,a={})=>{const n=G(t)?t(u):t;if(!Q(u,n)){u={...u,...n};for(const f of c.mount)ot(n,f)&&Ke(f,v(n,f),a,!0,!0);b.state.next({...r,name:void 0,type:void 0,...T?{values:u}:{}}),a.shouldValidate&&P()}},Ze=async t=>{o.mount=!0;const a=t.target;let n=a.name,f=!0;const d=v(i,n),y=h=>{f=Number.isNaN(h)||te(h)&&isNaN(h.getTime())||Q(h,v(u,n,h))};if(d){let h,g;const _=a.type?Vr(d._f):Gr(t),V=t.type===oe.BLUR||t.type===oe.FOCUS_OUT,L=!yt(d._f)&&!e.validate&&!s.resolver&&!v(r.errors,n)&&!d._f.deps,Y=L||vt(V,v(r.touchedFields,n),r.isSubmitted,j,H),Z=Ue(n,c,V);if(k(u,n,C(_)),V){if(!a||!a.readOnly){d._f.onBlur&&d._f.onBlur(t);const ve=m[n];ve&&ve(0)}}else d._f.onChange&&d._f.onChange(t);const ge=D(n,_,V),Yr=!B(ge)||Z;if(!V&&b.state.next({name:n,type:t.type,...T?{values:C(u)}:{}}),Y)return(!L||!r.isValid)&&(A.isValid||F.isValid)&&(s.mode==="onBlur"?V&&P():V||P()),Yr&&b.state.next({name:n,...Z?{}:ge});if(!s.resolver&&e.validate&&await K({name:n,eventType:t.type}),!V&&Z&&b.state.next({...r}),s.resolver){const{errors:ve}=await R([n]);if(S([n]),y(_),!f){!B(ge)&&b.state.next(ge);return}const zr=br(r.errors,i,n),or=br(ve,i,zr.name||n);h=or.error,n=or.name,g=B(ve)}else S([n],!0),h=(await hr(d,c.disabled,u,w,s.shouldUseNativeValidation))[n],S([n]),y(_),f&&(h?g=!1:(A.isValid||F.isValid)&&(g=await q({fields:i,onlyCheckValid:!0,name:n,eventType:t.type})));f&&(d._f.deps&&(!Array.isArray(d._f.deps)||d._f.deps.length>0)&&Ce(d._f.deps),x(n,g,h,ge))}},Je=(t,a)=>{if(v(r.errors,a)&&t.focus)return t.focus(),1},Ce=async(t,a={})=>{let n,f;const d=xe(t);if(s.resolver){const y=await W(O(t)?t:d);n=B(y),f=t?!d.some(h=>v(y,h)):n}else t?(f=(await Promise.all(d.map(async y=>{const h=v(i,y);return await q({fields:h&&h._f?{[y]:h}:h,eventType:oe.TRIGGER})}))).every(Boolean),!(!f&&!r.isValid)&&P()):f=n=await q({fields:i,name:t,eventType:oe.TRIGGER});if(a.delayError&&s.delayError&&M(t)){const y=v(r.errors,t);y?(U(r.errors,t),m[t]=ee(t,()=>Ae(t,y)),m[t](s.delayError)):(clearTimeout(E[t]),delete m[t])}if(a.shouldTouch)for(const y of t?d:c.mount)!c.array.has(y)&&k(r.touchedFields,y,!0);return b.state.next({...!M(t)||(A.isValid||F.isValid)&&n!==r.isValid?{}:{name:t},...s.resolver||!t?{isValid:n}:{},...a.shouldTouch&&(A.touchedFields||F.touchedFields)?{touchedFields:r.touchedFields}:{},errors:r.errors}),a.shouldFocus&&!f&&Ve(i,Je,t?d:c.mount),f},Mr=(t,a)=>{let n={...o.mount?u:l};return a&&(n=Sr(a.dirtyFields?r.dirtyFields:r.touchedFields,n)),O(t)?n:M(t)?v(n,t):t.map(f=>v(n,f))},Br=t=>O(t)?{...r.errors}:M(t)?v(r.errors,t):t.map(a=>v(r.errors,a)),Qe=(t,a)=>{const n=a||r,f=v(n.errors,t);return{invalid:!!f,isDirty:!!v(n.dirtyFields,t),error:f,isValidating:!!v(r.validatingFields,t),isTouched:!!v(n.touchedFields,t)}},Xe=t=>{const a=t?xe(t):void 0;a?.forEach(n=>U(r.errors,n)),a?a.forEach(n=>{b.state.next({name:n,errors:r.errors})}):(r.errors={},b.state.next({errors:r.errors}))},Ee=(t,a,n)=>{const f=(v(i,t,{_f:{}})._f||{}).ref,d=v(r.errors,t)||{},{ref:y,message:h,type:g,..._}=d;k(r.errors,t,{..._,...a,ref:f}),b.state.next({name:t,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&f&&f.focus&&f.focus()},$r=(t,a)=>{if(G(t)){T++;const{unsubscribe:n}=b.state.subscribe({next:d=>"values"in d&&t(d.values||ye(void 0,a),d)});let f=!1;return{unsubscribe:()=>{f||(f=!0,T--,n())}}}return ye(t,a,!0)},er=t=>{var a;const n=!!(!((a=t.formState)===null||a===void 0)&&a.values);n&&T++;const{unsubscribe:f}=b.state.subscribe({next:y=>{if(gt(t.name,y.name,t.exact)&&ht(y,t.formState||A,nr,t.reRenderRoot)){const h={...u};t.callback({values:h,...r,...y,defaultValues:l})}}});if(!n)return f;let d=!1;return()=>{d||(d=!0,T--,f())}},Wr=t=>(o.mount=!0,F={...F,...t.formState},er({...t,formState:{...$,...t.formState}})),Le=(t,a={})=>{for(const n of t?xe(t):c.mount)c.mount.delete(n),c.array.delete(n),a.keepValue||(U(i,n),U(u,n)),!a.keepError&&U(r.errors,n),!a.keepDirty&&U(r.dirtyFields,n),!a.keepTouched&&U(r.touchedFields,n),!a.keepIsValidating&&U(r.validatingFields,n),!s.shouldUnregister&&!a.keepDefaultValue&&U(l,n);T&&b.state.next({values:C(u)}),b.state.next({...r,...a.keepDirty?{}:{isDirty:z()}}),!a.keepIsValid&&P()},rr=({disabled:t,name:a})=>{if(re(t)&&o.mount||t||c.disabled.has(a)){const d=c.disabled.has(a)!==!!t;t?c.disabled.add(a):c.disabled.delete(a),d&&o.mount&&!o.action&&P()}},Ie=(t,a={})=>{let n=v(i,t);const f=re(a.disabled)||re(s.disabled),d=!c.registerName.has(t)&&n&&n._f&&!n._f.mount;return k(i,t,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:t}},name:t,mount:!0,...a}}),c.mount.add(t),n&&!d?rr({disabled:re(a.disabled)?a.disabled:s.disabled,name:t}):de(t,!0,a.value),{...f?{disabled:a.disabled||s.disabled}:{},...s.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:t,onChange:Ze,onBlur:Ze,ref:y=>{if(y){c.registerName.add(t),Ie(t,a),c.registerName.delete(t),n=v(i,t);const h=O(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,g=lt(h),_=n._f.refs||[];if(g?_.find(L=>L===h):h===n._f.ref)return;const V={...n._f};g?(V.refs=[..._.filter(Pe),h,...Array.isArray(v(l,t))?[{}]:[]],V.ref={type:h.type,name:t}):(V.ref=h,delete V.refs),k(i,t,{_f:V}),de(t,!1,void 0,h)}else n=v(i,t,{}),n._f&&(n._f.mount=!1),(s.shouldUnregister||a.shouldUnregister)&&!(Zr(c.array,t)&&o.action)&&c.unMount.add(t)}}},Ne=()=>s.shouldFocusError&&!s.shouldUseNativeValidation&&Ve(i,Je,c.mount),qr=t=>{re(t)&&(b.state.next({disabled:t}),Ve(i,(a,n)=>{const f=v(i,n);f&&(a.disabled=f._f.disabled||t,Array.isArray(f._f.refs)&&f._f.refs.forEach(d=>{d.disabled=f._f.disabled||t}))},0,!1))},tr=(t,a)=>async n=>{let f,d;n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist());let y=C(u);if(b.state.next({isSubmitting:!0}),s.resolver){const{errors:h,values:g}=await R();S(),r.errors=h,y=C(g)}else await q({fields:i,eventType:oe.SUBMIT});if(c.disabled.size)for(const h of c.disabled)U(y,h);if(U(r.errors,Dr),B(r.errors)){b.state.next({errors:{}});try{f=await t(y,n)}catch(h){d=h}}else a&&await a({...r.errors},n),Ne(),setTimeout(Ne);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:B(r.errors)&&!d,submitCount:r.submitCount+1,errors:r.errors}),d)throw d;return f},Hr=(t,a={})=>{v(i,t)&&(O(a.defaultValue)?he(t,C(v(l,t))):(he(t,a.defaultValue),k(l,t,C(a.defaultValue))),a.keepTouched||U(r.touchedFields,t),a.keepDirty||(U(r.dirtyFields,t),r.isDirty=a.defaultValue?z(t,C(v(l,t))):z()),a.keepError||(U(r.errors,t),P()),b.state.next({...r}))},sr=(t,a={})=>{const n=t?C(t):l,f=C(n),d=B(t),y=f,h=i;if(a.keepDefaultValues||(l=n),!a.keepValues){if(a.keepDirtyValues){const g=new Set([...c.mount,...Rr(ie(l,u,void 0,h),r.dirtyFields)]);for(const _ of g){const V=v(r.dirtyFields,_),L=v(u,_),Y=v(y,_);V&&!O(L)?k(y,_,L):!V&&!O(Y)&&he(_,Y)}}else{if(Te&&O(t))for(const g of c.mount){const _=v(i,g);if(_&&_._f){const V=Array.isArray(_._f.refs)?_._f.refs[0]:_._f.ref;if(ke(V)){const L=V.closest("form");if(L){L.reset();break}}}}if(a.keepFieldsRef)for(const g of c.mount)he(g,v(y,g));else i={}}if(s.shouldUnregister){if(u=a.keepDefaultValues?C(l):{},a.keepFieldsRef)for(const g of c.mount)k(u,g,v(y,g))}else u=C(y);b.array.next({values:{...y}}),b.state.next({name:void 0,type:void 0,values:{...y}})}c={mount:a.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!A.isValid||!!a.keepIsValid||!!a.keepDirtyValues||!s.shouldUnregister&&!B(y),o.watch=!!s.shouldUnregister,o.keepIsValid=!!a.keepIsValid,o.action=!1,o.actionArrayLengths.clear(),a.keepErrors||(r.errors={}),b.state.next({submitCount:a.keepSubmitCount?r.submitCount:0,isDirty:d?!1:a.keepDirty?r.isDirty:a.keepValues?z():!!(a.keepDefaultValues&&!Q(t,l)),isSubmitted:a.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:d?{}:a.keepDirtyValues?a.keepDefaultValues&&u?ie(l,u,void 0,h):r.dirtyFields:a.keepDefaultValues&&t?ie(l,t,void 0,h):a.keepDirty?r.dirtyFields:{},touchedFields:a.keepTouched?r.touchedFields:{},errors:a.keepErrors?r.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:l})},ir=(t,a)=>sr(G(t)?t(u):t,{...s.resetOptions,...a}),jr=(t,a={})=>{const n=v(i,t),f=n&&n._f;if(f){const d=f.refs?f.refs[0]:f.ref;d.focus&&setTimeout(()=>{d.focus(),a.shouldSelect&&G(d.select)&&d.select()})}},nr=t=>{const{name:a,type:n,values:f,...d}=t;r={...r,...d}};b.state.subscribe({next:nr});const ar={control:{register:Ie,unregister:Le,getFieldState:Qe,handleSubmit:tr,setError:Ee,_subscribe:er,_runSchema:R,_updateIsValidating:S,_focusError:Ne,_getWatch:ye,_getDirty:z,_setValid:P,_setFieldArray:be,_setDisabledField:rr,_setErrors:ae,_getFieldArray:Pr,_reset:sr,_resetDefaultValues:()=>G(s.defaultValues)&&s.defaultValues().then(t=>{ir(t,s.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:we,_disableForm:qr,_subjects:b,_proxyFormState:A,get _fields(){return i},get _formValues(){return u},get _state(){return o},set _state(t){o=t},get _defaultValues(){return l},get _names(){return c},set _names(t){c=t},get _formState(){return r},get _options(){return s},set _options(t){s={...s,...t},H=De(s.mode),j=De(s.reValidateMode)}},subscribe:Wr,trigger:Ce,register:Ie,handleSubmit:tr,watch:$r,setValue:he,setValues:pr,getValues:Mr,getErrors:Br,reset:ir,resetField:Hr,resetDefaultValues:(t,a={})=>{if(l=C(t),!a.keepDirty){const n=ie(l,u,void 0,i);r.dirtyFields=n,r.isDirty=!B(n)}a.keepIsValid||P(),b.state.next({...r,defaultValues:l})},clearErrors:Xe,unregister:Le,setError:Ee,setFocus:jr,getFieldState:Qe};return{...ar,formControl:ar}}function kt(e={}){const s=I.useRef(void 0),r=I.useRef(void 0),i=I.useRef(e.formControl),[l,u]=I.useState(()=>({...C(Ur),isLoading:G(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:G(e.defaultValues)?void 0:e.defaultValues}));if(!s.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)s.current={...e.formControl,formState:l},e.defaultValues&&!G(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:E,...T}=bt(e);s.current={...T,formState:l}}const o=s.current.control;o._options=e;const{resyncIfNeeded:c,snapshot:m}=tt();return et(()=>{const E=()=>({...o._formState,defaultValues:o._defaultValues});c(!0,E,u);const T=o._subscribe({formState:o._proxyFormState,callback:()=>u({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return u(H=>({...H,isReady:!0})),o._formState.isReady=!0,()=>{T(),m(!0,E)}},[o,c,m]),I.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),I.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),I.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),I.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),I.useEffect(()=>{if(o._proxyFormState.isDirty){const E=o._getDirty();E!==l.isDirty&&o._subjects.state.next({isDirty:E})}},[o,l.isDirty]),I.useEffect(()=>{var E;e.values&&!Q(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((E=o._options.resetOptions)===null||E===void 0)&&E.keepIsValid||o._setValid(),r.current=e.values,u(T=>({...T}))):o._resetDefaultValues()},[o,e.values]),I.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),s.current.formState=I.useMemo(()=>Xr(l,o),[o,l]),s.current}const Ar=(e,s,r)=>{if(e&&"reportValidity"in e){const i=v(r,s);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},We=(e,s)=>{for(const r in s.fields){const i=s.fields[r];i&&i.ref&&"reportValidity"in i.ref?Ar(i.ref,r,e):i&&i.refs&&i.refs.forEach(l=>Ar(l,r,e))}},Fr=(e,s)=>{s.shouldUseNativeValidation&&We(e,s);const r={};for(const i in e){const l=v(s.fields,i),u=Object.assign(e[i]||{},{ref:l&&l.refs?l.refs[0]:l&&l.ref});if(At(s.names||Object.keys(e),i)){const o=Object.assign({},v(r,i));k(o,"root",u),k(r,i,o)}else k(r,i,u)}return r},At=(e,s)=>{const r=wr(s).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>wr(i).match(`^${r}\\.\\d+`))};function wr(e){return e.replace(/\[(\d+)]/g,".$1").replace(/[[\]]/g,"")}function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var r=arguments[s];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},qe.apply(null,arguments)}function Er(e,s){try{var r=e()}catch(i){return s(i)}return r&&r.then?r.then(void 0,s):r}function Ft(e,s){for(var r=Object.create(null);e.length;){var i=e[0],l=i.code,u=i.message,o=i.path.join(".");if(!r[o])if("unionErrors"in i){var c,m,E=i.unionErrors.reduce(function(j,$){return $.errors.length<j.errors.length?$:j}).errors[0];r[o]={message:(c=E?.message)!=null?c:u,type:(m=E?.code)!=null?m:l}}else r[o]={message:u,type:l};if("unionErrors"in i&&i.unionErrors.forEach(function(j){return j.errors.forEach(function($){return e.push($)})}),s){var T=r[o].types,H=T&&T[i.code];r[o]=ze(o,s,r,l,H?[].concat(H,i.message):i.message)}e.shift()}return r}function wt(e,s){for(var r=Object.create(null),i=function(){var l=e[0],u=l.code,o=l.message,c=l.path.join(".");if(!r[c])if(l.code==="invalid_union"&&l.errors.length>0){var m,E,T=l.errors.reduce(function($,A){return A.length<$.length?A:$})[0];r[c]={message:(m=T?.message)!=null?m:o,type:(E=T?.code)!=null?E:u}}else r[c]={message:o,type:u};if(l.code==="invalid_union"&&l.errors.forEach(function($){return $.forEach(function(A){return e.push(qe({},A,{path:[].concat(l.path,A.path)}))})}),s){var H=r[c].types,j=H&&H[l.code];r[c]=ze(c,s,r,u,j?[].concat(j,l.message):l.message)}e.shift()};e.length;)i();return r}function Ot(e,s,r){if(r===void 0&&(r={}),(function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,l,u){try{return Promise.resolve(Er(function(){function o(m){return u.shouldUseNativeValidation&&We({},u),{errors:{},values:r.raw?Object.assign({},i):m}}var c=e;return r.mode==="sync"?o(c.parse(i,s)):Promise.resolve(c.parseAsync(i,s)).then(o)},function(o){if((function(c){var m;return!(c==null||(m=c._zod)==null||(m=m.traits)==null||!m.has("$ZodError"))})(o))return{values:{},errors:Fr(wt(o.issues,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw o}))}catch(o){return Promise.reject(o)}};if((function(i){return"_def"in i&&typeof i._def=="object"})(e))return function(i,l,u){try{return Promise.resolve(Er(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,s)).then(function(o){return u.shouldUseNativeValidation&&We({},u),{errors:{},values:r.raw?Object.assign({},i):o}})},function(o){if((function(c){return Array.isArray(c?.issues)})(o))return{values:{},errors:Fr(Ft(o.errors,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}export{Ot as a,kt as u};
|