@snagset/server 0.1.2 → 0.1.4
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 +45 -6
- package/dist/app.js.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/db/scope.js +23 -0
- package/dist/db/scope.js.map +1 -0
- package/dist/instance/mcpHttp.js +42 -0
- package/dist/instance/mcpHttp.js.map +1 -0
- package/dist/mail/unsubscribe.js +5 -4
- package/dist/mail/unsubscribe.js.map +1 -1
- package/dist/orgs.js +87 -0
- package/dist/orgs.js.map +1 -0
- package/dist/plan.js +82 -0
- package/dist/plan.js.map +1 -0
- package/dist/projectCache.js +3 -2
- package/dist/projectCache.js.map +1 -1
- package/dist/reviewerCache.js +3 -2
- package/dist/reviewerCache.js.map +1 -1
- package/dist/routes/account.js +5 -4
- package/dist/routes/account.js.map +1 -1
- package/dist/routes/anchorReports.js +3 -2
- package/dist/routes/anchorReports.js.map +1 -1
- package/dist/routes/attachments.js +17 -6
- package/dist/routes/attachments.js.map +1 -1
- package/dist/routes/commentEdit.js +3 -2
- package/dist/routes/commentEdit.js.map +1 -1
- package/dist/routes/comments.js +7 -6
- package/dist/routes/comments.js.map +1 -1
- package/dist/routes/cors.js +5 -4
- package/dist/routes/cors.js.map +1 -1
- package/dist/routes/instance.js +29 -0
- package/dist/routes/instance.js.map +1 -1
- package/dist/routes/integrations.js +10 -5
- package/dist/routes/integrations.js.map +1 -1
- package/dist/routes/mcp.js +45 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/mcpAuth.js +59 -3
- package/dist/routes/mcpAuth.js.map +1 -1
- package/dist/routes/mcpToken.js +10 -9
- package/dist/routes/mcpToken.js.map +1 -1
- package/dist/routes/mcpTokens.js +10 -3
- package/dist/routes/mcpTokens.js.map +1 -1
- package/dist/routes/members.js +11 -0
- package/dist/routes/members.js.map +1 -1
- package/dist/routes/orgs.js +128 -0
- package/dist/routes/orgs.js.map +1 -0
- package/dist/routes/owner.js +34 -12
- package/dist/routes/owner.js.map +1 -1
- package/dist/routes/reviewLinks.js +11 -10
- package/dist/routes/reviewLinks.js.map +1 -1
- package/dist/routes/rounds.js +7 -6
- package/dist/routes/rounds.js.map +1 -1
- package/dist/routes/sessions.js +16 -15
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/sites.js +45 -26
- package/dist/routes/sites.js.map +1 -1
- package/dist/routes/threads.js +7 -11
- package/dist/routes/threads.js.map +1 -1
- package/dist/serverless.js +86 -120
- package/dist/serverless.js.map +1 -1
- package/dist/storage/settings.js +8 -7
- package/dist/storage/settings.js.map +1 -1
- package/dist/vendor/mcp/bin.js +72 -0
- package/dist/vendor/mcp/client.js +107 -0
- package/dist/vendor/mcp/server.js +242 -0
- package/dist/vendor/mcp/source.js +284 -0
- package/dist/vendor/mcp/view.js +199 -0
- package/dist/vendor/types/names.js +1 -0
- package/package.json +4 -2
- package/static/dashboard/assets/CompositeItem-DooiJvYh.js +1 -0
- package/static/dashboard/assets/{ConfirmDialog-CfUnmf4e.js → ConfirmDialog-B5Kq--VU.js} +1 -1
- package/static/dashboard/assets/{CopyButton-0ANrU8mS.js → CopyButton-BX1ldjjz.js} +1 -1
- package/static/dashboard/assets/FieldItemContext-DkOlIwHg.js +1 -0
- package/static/dashboard/assets/{InstallTag-CFvRuiwX.js → InstallTag-DahspVU0.js} +1 -1
- package/static/dashboard/assets/{SaveState-RDbpfaEm.js → SaveState-Q9xJjbqL.js} +1 -1
- package/static/dashboard/assets/_app-CRQzX614.js +56 -0
- package/static/dashboard/assets/{_app-DpPrYyh8.js → _app-Cd9_WR6L.js} +1 -1
- package/static/dashboard/assets/{activity-DwTWlcUi.js → activity-B-59HYua.js} +1 -1
- package/static/dashboard/assets/{arrow-left-2PKG3ITQ.js → arrow-left-aeWIKOlS.js} +1 -1
- package/static/dashboard/assets/{avatar-AfucjvZ4.js → avatar-KLKmXBKs.js} +1 -1
- package/static/dashboard/assets/{badge-CErha5Qd.js → badge-Dly0Vqky.js} +1 -1
- package/static/dashboard/assets/{card-DxFqxFQf.js → card-D3S4369l.js} +1 -1
- package/static/dashboard/assets/{check-Yc6VFTfm.js → check-CjehM7M4.js} +1 -1
- package/static/dashboard/assets/{chevron-right-Go23FN_b.js → chevron-right-CtWPB3ox.js} +1 -1
- package/static/dashboard/assets/{copy-BjvQHEe0.js → copy-DbrG17rp.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-DwbZIZsa.js → createLucideIcon-CJO80vPf.js} +1 -1
- package/static/dashboard/assets/{dialog-CgkCHO0g.js → dialog-GyPeOagK.js} +1 -1
- package/static/dashboard/assets/{dropdown-menu-DRa3ikv4.js → dropdown-menu-BOoXJZ3W.js} +3 -3
- package/static/dashboard/assets/{image-off-ByN_ZOK_.js → image-off-BYE-vNh9.js} +1 -1
- package/static/dashboard/assets/{index-BRTBtV91.css → index-BR4Mnw-o.css} +1 -1
- package/static/dashboard/assets/{index-DG2IWFx-.js → index-D4yHhKPM.js} +30 -30
- package/static/dashboard/assets/label-BGuYH_Ll.js +1 -0
- package/static/dashboard/assets/{layout-grid-Dj0cm_PO.js → layout-grid-DJ_OjGVc.js} +1 -1
- package/static/dashboard/assets/me-B-0XXdLF.js +1 -0
- package/static/dashboard/assets/{parts-B3hL1LIW.js → parts-DJaBw8EG.js} +1 -1
- package/static/dashboard/assets/{plus-CRLkl9fr.js → plus-x0wkLget.js} +1 -1
- package/static/dashboard/assets/s._site-s4IRnE6u.js +1 -0
- package/static/dashboard/assets/{s._site.comments-DCpM8f18.js → s._site.comments-Bt0AsQ8j.js} +3 -3
- package/static/dashboard/assets/s._site.reviewers-BzJsotII.js +1 -0
- package/static/dashboard/assets/s._site.settings-C6ei77kQ.js +1 -0
- package/static/dashboard/assets/setup-DTi8FBnt.js +1 -0
- package/static/dashboard/assets/sign-in-CGOMDkYg.js +1 -0
- package/static/dashboard/assets/sign-up-CfU4RCfo.js +1 -0
- package/static/dashboard/assets/sites-zZ5gTDCZ.js +1 -0
- package/static/dashboard/assets/studio-DaMq1jOg.js +1 -0
- package/static/dashboard/assets/{studio-BIDpGywS.js → studio-r6xIIciH.js} +1 -1
- package/static/dashboard/assets/studio.index-CsF3xaoh.js +1 -0
- package/static/dashboard/assets/studio.integrations-BnPEkEA3.js +1 -0
- package/static/dashboard/assets/studio.members-DegH-I8c.js +1 -0
- package/static/dashboard/assets/{sun-CyU37by7.js → sun-BLhaKyhb.js} +1 -1
- package/static/dashboard/assets/switch-En3PhTzh.js +1 -0
- package/static/dashboard/assets/{table-DEYsEr1D.js → table-DuU_ZP-u.js} +1 -1
- package/static/dashboard/assets/useAriaLabelledBy-C3DXCwhM.js +1 -0
- package/static/dashboard/assets/{useBaseQuery-Cyp8ADaN.js → useBaseQuery-B_iu1J2b.js} +1 -1
- package/static/dashboard/assets/useQuery-yeUPHKKg.js +1 -0
- package/static/dashboard/assets/useRender-Bl1M9SFS.js +1 -0
- package/static/dashboard/assets/useValueChanged-BwMBSSVy.js +1 -0
- package/static/dashboard/assets/{users-CcRaZGiI.js → users-c6wDSgLD.js} +1 -1
- package/static/dashboard/assets/{welcome-DFcmcB5m.js → welcome-Ddm5B8Xh.js} +2 -2
- package/static/dashboard/assets/you-BmjZYMtz.js +1 -0
- package/static/dashboard/assets/{zod-qEjeM9Eg.js → zod-CBoGbUzv.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/dashboard/assets/CompositeItem-CrOf38Oz.js +0 -1
- package/static/dashboard/assets/FieldItemContext-CFDZff0c.js +0 -1
- package/static/dashboard/assets/_app-CyFpAeiD.js +0 -56
- package/static/dashboard/assets/createBaseUIEventDetails-BWJgXhnd.js +0 -1
- package/static/dashboard/assets/label-Bombrpc6.js +0 -1
- package/static/dashboard/assets/me-Bno2H07j.js +0 -1
- package/static/dashboard/assets/s._site-CP12hsxz.js +0 -1
- package/static/dashboard/assets/s._site.reviewers-WT9D4fr3.js +0 -1
- package/static/dashboard/assets/s._site.settings-DaxVWDmT.js +0 -1
- package/static/dashboard/assets/setup-Ch-Vt7_T.js +0 -1
- package/static/dashboard/assets/sign-in-CdGjL0Ha.js +0 -1
- package/static/dashboard/assets/sites-8S1PAUfv.js +0 -1
- package/static/dashboard/assets/studio-DREMbrco.js +0 -1
- package/static/dashboard/assets/studio.index-B4-MAfEP.js +0 -1
- package/static/dashboard/assets/studio.integrations-D1bP5fqp.js +0 -1
- package/static/dashboard/assets/studio.members-DKl8oRd9.js +0 -1
- package/static/dashboard/assets/useQuery-DuAHuwx9.js +0 -1
- package/static/dashboard/assets/useRender-BCvsiXRL.js +0 -1
- package/static/dashboard/assets/you-ClBoja9X.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,e as y,r as f,B as u,N,z as A,C as h,_ as C,x as R}from"./index-D4yHhKPM.js";import{u as T}from"./useQuery-yeUPHKKg.js";import{u as S,a as D}from"./zod-CBoGbUzv.js";import{A as M,a as $}from"./avatar-KLKmXBKs.js";import{B as E}from"./badge-Dly0Vqky.js";import{C as F}from"./card-D3S4369l.js";import{X as k,E as B,G as H,I as P,H as z,J as I,K as O}from"./dialog-GyPeOagK.js";import{L as d,I as p}from"./label-BGuYH_Ll.js";import{T as L,a as V,b,c,d as _,e as x}from"./table-DuU_ZP-u.js";import{C as q}from"./ConfirmDialog-B5Kq--VU.js";import{P as G}from"./parts-DJaBw8EG.js";import{a as J}from"./labels--UUyt9uB.js";import{u as K}from"./me-B-0XXdLF.js";import{c as Q,d as X,e as Y}from"./studio-r6xIIciH.js";import{P as U}from"./plus-x0wkLget.js";import"./useBaseQuery-B_iu1J2b.js";import"./useRender-Bl1M9SFS.js";import"./createLucideIcon-CJO80vPf.js";function j({className:s,...a}){return e.jsx("select",{className:y("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),...a})}function ge(){const s=K(),a=s.user.role==="owner",n=T(R.members()),[i,o]=f.useState(!1),r=s.limits.members.limit,l=r!==null&&s.limits.members.used>=r;return e.jsxs("div",{className:"p-7",children:[e.jsx(G,{title:"Members",sub:`${a?"Owners and admins can do everything; only owners change this list.":"Owners and admins can do everything. Ask an owner to change this list."}${r!==null?` ${s.limits.members.used} of ${r} members.`:""}`,actions:a?e.jsxs(u,{onClick:()=>o(!0),disabled:l,title:l?`This studio's plan allows ${r} members.`:void 0,children:[e.jsx(U,{}),"Add member"]}):void 0}),e.jsx(F,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(L,{children:[e.jsx(V,{children:e.jsxs(b,{children:[e.jsx(c,{children:"Name"}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Role"}),a&&e.jsx(c,{className:"w-0"})]})}),e.jsx(_,{children:(n.data?.data??[]).map(t=>e.jsx(W,{m:t,owner:a},t.email))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"There is no invitation mail: an owner sets an initial password and hands it over, and the person changes it under You."}),a&&e.jsx(ee,{open:i,onOpenChange:o})]})}function W({m:s,owner:a}){const n=Q(),i=X(),[o,r]=f.useState(!1);return e.jsxs(b,{children:[e.jsx(x,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(M,{className:"size-6",children:e.jsx($,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:J(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(E,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(x,{className:"text-muted-foreground",children:s.email}),e.jsx(x,{children:a?e.jsxs(j,{"aria-label":`Role for ${s.email}`,value:s.role,onChange:l=>n.mutate({email:s.email,role:l.target.value}),children:[e.jsx("option",{value:"owner",children:"Owner"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx("span",{className:"capitalize",children:s.role})}),a&&e.jsxs(x,{className:"text-right",children:[!s.you&&e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>r(!0),children:e.jsx(k,{})}),e.jsx(q,{open:o,onOpenChange:r,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:i.isPending,onConfirm:()=>{r(!1),i.mutate(s.email)}})]})]})}const Z=A({email:h().trim().email("An email address"),name:h().trim().max(120).optional(),role:C(["owner","admin"]),password:h().min(12,"At least 12 characters")});function ee({open:s,onOpenChange:a}){const n=Y(),[i,o]=f.useState(""),{register:r,handleSubmit:l,formState:t,reset:g}=S({resolver:D(Z),defaultValues:{role:"admin"}}),w=l(async m=>{o("");try{await n.mutateAsync({email:m.email,name:m.name??"",role:m.role,password:m.password}),g(),a(!1)}catch(v){o(N(v))}});return e.jsx(B,{open:s,onOpenChange:a,children:e.jsx(H,{children:e.jsxs("form",{onSubmit:w,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(P,{children:[e.jsx(z,{children:"Add a member"}),e.jsx(I,{children:"They sign in with this email and the password you set; there is no invitation mail, so you tell them the password yourself."})]}),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(d,{htmlFor:"member-email",children:"Email"}),e.jsx(p,{id:"member-email",type:"email",autoComplete:"off","aria-invalid":!!t.errors.email,...r("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-name",children:"Name"}),e.jsx(p,{id:"member-name",autoComplete:"off",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-role",children:"Role"}),e.jsxs(j,{id:"member-role",className:"w-full",...r("role"),children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"owner",children:"Owner"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-password",children:"Initial password"}),e.jsx(p,{id:"member-password",type:"text",autoComplete:"off","aria-invalid":!!t.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters — a short phrase of real words is fine. They can change it afterwards."})]}),e.jsxs(O,{children:[e.jsx(u,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(u,{type:"submit",disabled:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add"})]})]})})})}export{ge as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,f as ae,X as re,c as se,V as ie,E as ne,h as M,j as f,Y as oe,e as de}from"./index-D4yHhKPM.js";import{f as ce,e as le,h as ue,j as fe,u as pe,A as he,k as be,l as ge,c as me,n as ve}from"./label-BGuYH_Ll.js";import{L as ke,M as xe}from"./dialog-GyPeOagK.js";import{u as we}from"./useAriaLabelledBy-C3DXCwhM.js";import{u as ye}from"./useValueChanged-BwMBSSVy.js";const j=i.createContext(void 0);function Ce(){const r=i.useContext(j);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:V,name:w,nativeButton:h=!1,onCheckedChange:T,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...A}=s,{clearErrors:H}=le(),{state:R,setTouched:q,setDirty:O,validityData:W,setFilled:v,setFocused:P,validationMode:Y,disabled:J,name:U,validation:c}=ue(),{labelId:X}=fe(),t=J||N,l=U??w,n=i.useRef(null),_=re(n,V,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),B=h?void 0:E,[a,G]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),O(a!==W.initialValue),v(a),c.change(a)});const{getButtonProps:K,buttonRef:Q}=ie({disabled:t,native:h}),Z=we(m,X,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":Z,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(q(!0),P(!1),Y==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:_,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=me(ve,e.nativeEvent);T?.(u,S),!S.isCanceled&&G(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=M("span",s,{state:I,ref:[o,g,Q],props:[$,A,K,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(j.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return M("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,e as l}from"./index-
|
|
1
|
+
import{j as t,e as l}from"./index-D4yHhKPM.js";function o({className:a,...e}){return t.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:t.jsx("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",a),...e})})}function r({className:a,...e}){return t.jsx("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",a),...e})}function d({className:a,...e}){return t.jsx("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",a),...e})}function n({className:a,...e}){return t.jsx("tr",{"data-slot":"table-row",className:l("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",a),...e})}function b({className:a,...e}){return t.jsx("th",{"data-slot":"table-head",className:l("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",a),...e})}function c({className:a,...e}){return t.jsx("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",a),...e})}export{o as T,r as a,n as b,b as c,d,c as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as u,c as l}from"./index-D4yHhKPM.js";import{u as c}from"./label-BGuYH_Ll.js";function y(e,n,t,r=!0,i){const[a,d]=u.useState(),f=c(i?`${i}-label`:void 0),o=e??n??a;return l(()=>{const s=e||n||!r?void 0:L(t.current,f);a!==s&&d(s)}),o}function L(e,n){const t=b(e);if(t)return!t.id&&n&&(t.id=n),t.id||void 0}function b(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const t=e.id;if(t){const i=e.nextElementSibling;if(i&&i.htmlFor===t)return i}const r=e.labels;return r&&r[0]}export{y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aF as N,aG as h,aH as O,aI as U,aJ as k,aK as B,aL as A,aM as y,aN as H,aO as V,aP as Q,aQ as F,r as p,aR as x,s as W}from"./index-
|
|
1
|
+
import{aF as N,aG as h,aH as O,aI as U,aJ as k,aK as B,aL as A,aM as y,aN as H,aO as V,aP as Q,aQ as F,r as p,aR as x,s as W}from"./index-D4yHhKPM.js";var st=class extends N{#e;#t=void 0;#f=void 0;#s=void 0;#a;#c;#i;#p;#u;#l;#n;#o;#r;#d=new Set;constructor(t,e){super(),this.options=e,this.#e=t,this.#i=null,this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),w(this.#t,this.options)?this.#h():this.updateResult(),this.#S())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return E(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return E(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#m(),this.#g(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof h(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!O(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&P(this.#t,s,this.options,e)&&this.#h(),this.updateResult(),i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||h(this.options.staleTime,this.#t)!==h(e.staleTime,this.#t))&&this.#R();const r=this.#v();i&&(this.#t!==s||h(this.options.enabled,this.#t)!==h(e.enabled,this.#t)||r!==this.#r)&&this.#y(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),s=this.createResult(e,t);return O(this.getCurrentResult(),s)||(this.#s=s,this.#c=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#s}trackResult(t,e){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),e?.(i),Reflect.get(s,i))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),s=this.#e.getQueryCache().build(this.#e,e);let i=()=>{},r;const c=new Promise(n=>{r=n,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===s.queryHash&&s.state.data!==void 0&&(i(),n(this.createResult(s,e)))})});return Promise.race([s.fetch().then(()=>{const n=this.createResult(s,e);return r?.(n),n}).finally(()=>{i()}),c])}fetch(t){return this.#h({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#h(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(U)),e}#b(t){return!k()&&h(this.options.enabled,this.#t)!==!1&&B(t)}#R(){this.#m();const t=h(this.options.staleTime,this.#t);if(this.#s.isStale||!this.#b(t))return;const e=A(this.#s.dataUpdatedAt,t)+1;this.#n=y.setTimeout(()=>{this.#s.isStale||this.updateResult()},e)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(t){this.#g(),this.#r=t,!(this.#r===0||!this.#b(this.#r))&&(this.#o=y.setInterval(()=>{(this.options.refetchIntervalInBackground||H.isFocused())&&this.#h()},this.#r))}#S(){this.#R(),this.#y(this.#v())}#m(){this.#n!==void 0&&(y.clearTimeout(this.#n),this.#n=void 0)}#g(){this.#o!==void 0&&(y.clearInterval(this.#o),this.#o=void 0)}createResult(t,e){const s=this.#t,i=this.options,r=this.#s,c=this.#a,n=this.#c,u=t!==s?t.state:this.#f,{state:l}=t;let a={...l},d=!1,o;if(e._optimisticResults){const f=this.hasListeners(),D=!f&&w(t,e),L=f&&P(t,s,e,i);(D||L)&&(a={...a,...V(l.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:R,errorUpdatedAt:v,status:b}=a;o=a.data;let I=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let f;r?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(f=r.data,I=!0):f=typeof e.placeholderData=="function"?e.placeholderData(this.#l?.state.data,this.#l):e.placeholderData,f!==void 0&&(b="success",o=Q(r?.data,f,e),d=!0)}if(e.select&&o!==void 0&&!I)if(r&&o===c?.data&&e.select===this.#p)o=this.#u;else try{this.#p=e.select,o=e.select(o),o=Q(r?.data,o,e),this.#u=o,this.#i=null}catch(f){this.#i=f}else o===void 0&&(this.#i=null);this.#i&&(R=this.#i,o=this.#u,v=Date.now(),b="error",d=!1);const S=a.fetchStatus==="fetching",m=b==="pending",g=b==="error",T=m&&S,M=o!==void 0;return{status:b,fetchStatus:a.fetchStatus,isPending:m,isSuccess:b==="success",isError:g,isInitialLoading:T,isLoading:T,data:o,dataUpdatedAt:a.dataUpdatedAt,error:R,errorUpdatedAt:v,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>u.dataUpdateCount||a.errorUpdateCount>u.errorUpdateCount,isFetching:S,isRefetching:S&&!m,isLoadingError:g&&!M,isPaused:a.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:g&&M,isStale:C(t,e),refetch:this.refetch,isEnabled:h(e.enabled,t)!==!1}}updateResult(){const t=this.#s,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#c=this.options,this.#a.data!==void 0&&(this.#l=this.#t),O(e,t))return;this.#s=e;const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,c=typeof r=="function"?r():r;if(c==="all"||!c&&!this.#d.size)return!0;const n=new Set(c??this.#d);return this.options.throwOnError&&n.add("error"),Object.keys(this.#s).some(u=>{const l=u;return this.#s[l]!==t[l]&&n.has(l)})})();F.batch(()=>{i&&this.listeners.forEach(r=>{r(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#O(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#f=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#S()}};function j(t,e){return h(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&h(e.retryOnMount,t)===!1)}function w(t,e){return j(t,e)||t.state.data!==void 0&&E(t,e,e.refetchOnMount)}function E(t,e,s){if(h(e.enabled,t)!==!1&&h(e.staleTime,t)!=="static"){const i=typeof s=="function"?s(t):s;return i==="always"||i!==!1&&C(t,e)}return!1}function P(t,e,s,i){return(t!==e||h(i.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&C(t,s)}function C(t,e){return h(e.enabled,t)!==!1&&t.isStaleByTime(h(e.staleTime,t))}const _=p.createContext(!1),z=()=>p.useContext(_);_.Provider;function K(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const G=p.createContext(K()),J=()=>p.useContext(G),X=(t,e,s)=>{const i=s?.state.error&&typeof t.throwOnError=="function"?x(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||i)&&(e.isReset()||(t.retryOnMount=!1))},Y=t=>{p.useEffect(()=>{t.clearReset()},[t])},Z=({result:t,errorResetBoundary:e,throwOnError:s,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||x(s,[t.error,i])),it=(t,e)=>e.state.data===void 0,$=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>s(i(...r)):s(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},q=(t,e)=>t?.suspense&&e.isPending,tt=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function rt(t,e,s){const i=z(),r=J(),c=W(),n=c.defaultQueryOptions(t),u=c.getQueryCache().get(n.queryHash),l=t.subscribed!==!1;n._optimisticResults=i?"isRestoring":l?"optimistic":void 0,$(n),X(n,r,u),Y(r);const[a]=p.useState(()=>new e(c,n)),d=a.getOptimisticResult(n),o=!i&&l;if(p.useSyncExternalStore(p.useCallback(R=>{const v=o?a.subscribe(F.batchCalls(R)):U;return a.updateResult(),v},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setOptions(n)},[n,a]),q(n,d))throw tt(n,a,r);if(Z({result:d,errorResetBoundary:r,throwOnError:n.throwOnError,query:u,suspense:n.suspense}))throw d.error;return n.notifyOnChangeProps?d:a.trackResult(d)}export{st as Q,it as d,rt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as r,Q as u}from"./useBaseQuery-B_iu1J2b.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as n}from"./index-D4yHhKPM.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,d as c,c as n}from"./index-D4yHhKPM.js";function u(e,r){const t=s.useRef(e),a=c(r);n(()=>{t.current!==e&&a(t.current),t.current=e},[e,a])}export{u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{F as z,n as D,s as F,r as l,j as e,G as M,e as y,B as o,o as E,x as p,A as B}from"./index-
|
|
1
|
+
import{F as z,n as D,s as F,r as l,j as e,G as M,e as y,B as o,o as E,x as p,A as B}from"./index-D4yHhKPM.js";import{C as x}from"./card-D3S4369l.js";import{L as v,I as N}from"./label-BGuYH_Ll.js";import{I as L}from"./InstallTag-DahspVU0.js";import{C as K}from"./check-CjehM7M4.js";import{c as S}from"./createLucideIcon-CJO80vPf.js";import{A as k}from"./arrow-left-aeWIKOlS.js";import"./copy-DbrG17rp.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{F as z,n as D,s as F,r as l,j as e,G as M,e as y,B as o,o as E,x as p,A a
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Q=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],R=S("party-popper",Q),w=["Site","Address","Install"];function
|
|
11
|
+
*/const Q=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],R=S("party-popper",Q),w=["Site","Address","Install"];function V(){const{me:C,site:r}=z.useRouteContext(),A=D(),u=F(),[a,d]=l.useState(0),[n,I]=l.useState(r.name==="First project"?"":r.name),[c,q]=l.useState(""),[i,g]=l.useState(!1),[f,j]=l.useState(""),b=async(t,s)=>{g(!0),j("");try{await E.editSite(r.uid,t),t.domain&&u.setQueryData(p.origins(r.uid).queryKey,{domain:t.domain,origins:[]}),await u.invalidateQueries({queryKey:p.me().queryKey}),await u.fetchQuery(p.me()),s()}catch(m){j(m instanceof B?m.message:"Could not reach the server.")}finally{g(!1)}};return e.jsx("div",{className:"relative min-h-dvh bg-background",children:e.jsxs(M,{width:600,children:[e.jsxs("div",{className:"absolute right-6 top-5 text-[12.5px] text-muted-foreground",children:["Signed in as ",C.user.email]}),a<3&&e.jsx("ol",{className:"m-0 mb-6 flex list-none items-center gap-3.5 p-0","aria-label":"Steps",children:w.map((t,s)=>e.jsxs("li",{className:"flex items-center gap-2.5 text-[13.5px] font-medium",children:[e.jsx("span",{className:y("flex size-7 items-center justify-center rounded-full border-[1.5px] text-[12.5px]",s<a&&"border-brand bg-brand text-brand-foreground",s===a&&"border-brand text-brand ring-[3px] ring-brand-soft",s>a&&"border-line-strong text-muted-foreground"),"aria-current":s===a?"step":void 0,children:s<a?e.jsx(K,{className:"size-3.5"}):s+1}),e.jsx("span",{className:s===a?"text-foreground":"text-muted-foreground",children:t}),s<w.length-1&&e.jsx("span",{className:y("h-px w-[90px]",s<a?"bg-brand":"bg-border")})]},t))}),f&&e.jsx("p",{role:"alert",className:"m-0 mb-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:f}),a===0&&e.jsx(x,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!n.trim()||i)&&b({name:n.trim()},()=>d(1))},children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"What is the site called?"}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"One client website. You can add more from Sites later."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(v,{htmlFor:"first-name",children:"Name"}),e.jsx(N,{id:"first-name",placeholder:"Kilnwork",value:n,onChange:t=>I(t.target.value),autoFocus:!0})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(o,{type:"submit",disabled:!n.trim()||i,children:[i?"Saving…":"Continue",e.jsx(h,{})]})})]})}),a===1&&e.jsx(x,{className:"gap-4 p-7",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:t=>{t.preventDefault(),!(!c.trim()||i)&&b({domain:c.trim()},()=>d(2))},children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:["Where does ",n||r.name," live?"]}),e.jsx("p",{className:"m-0 mt-2 text-muted-foreground",children:"Its domain. Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in the site's settings."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(v,{htmlFor:"first-domain",children:"Domain"}),e.jsx(N,{id:"first-domain",placeholder:"kilnwork.studio",value:c,onChange:t=>q(t.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(o,{type:"button",variant:"ghost",onClick:()=>d(0),children:[e.jsx(k,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(o,{type:"submit",disabled:!c.trim()||i,children:[i?"Saving…":"Continue",e.jsx(h,{})]})]})]})}),a===2&&e.jsxs(x,{className:"gap-4 p-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:"Install the widget"}),e.jsxs("p",{className:"m-0 mt-2 text-muted-foreground",children:["Paste this before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed, and deploy."]})]}),e.jsx(L,{uid:r.uid}),e.jsxs("div",{className:"flex items-center",children:[e.jsxs(o,{type:"button",variant:"ghost",onClick:()=>d(1),children:[e.jsx(k,{}),"Back"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(o,{type:"button",onClick:()=>d(3),children:["Done",e.jsx(h,{})]})]})]}),a===3&&e.jsxs(x,{className:"items-center gap-4 p-8 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-[10px] bg-brand-soft text-brand",children:e.jsx(R,{className:"size-5"})}),e.jsxs("h1",{className:"m-0 text-[21px] font-semibold leading-tight tracking-tight",children:[n||r.name," is set up"]}),e.jsx("p",{className:"m-0 text-muted-foreground",children:"Three things left, in this order."}),e.jsx("ol",{className:"m-0 flex w-full list-none flex-col gap-2 p-0 text-left",children:[["Deploy the site with the tag on every page","Comments start arriving here the moment a page loads it."],["Add a reviewer and send them their link","Your client gets their own link; you can revoke it without touching the site."],["Start the first round","A round is one pass of feedback. Starting the next one closes the last."]].map(([t,s],m)=>e.jsxs("li",{className:"flex gap-3 rounded-md border border-border px-3 py-2.5",children:[e.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-line-strong text-[11px] text-muted-foreground",children:m+1}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:t}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s})]})]},t))}),e.jsxs(o,{size:"lg",className:"mt-2 w-full",onClick:()=>void A({to:"/s/$site/comments",params:{site:r.uid},replace:!0}),children:["Go to Comments",e.jsx(h,{})]})]})]})})}export{V as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,t as w,j as e,e as b,v as y,B as f,N}from"./index-D4yHhKPM.js";import{L as c,I as m}from"./label-BGuYH_Ll.js";import{P as S,a as h}from"./parts-DJaBw8EG.js";import{S as C}from"./SaveState-Q9xJjbqL.js";import{u as P}from"./me-B-0XXdLF.js";import{u as A,a as k}from"./studio-r6xIIciH.js";import{M as F,S as E,a as M}from"./sun-BLhaKyhb.js";import"./card-D3S4369l.js";import"./labels--UUyt9uB.js";import"./createLucideIcon-CJO80vPf.js";import"./useBaseQuery-B_iu1J2b.js";function T({items:t}){const[a,n]=r.useState(w);return e.jsx("div",{className:"flex gap-2",role:"radiogroup","aria-label":"Theme",children:t.map(s=>e.jsxs("button",{type:"button",role:"radio","aria-checked":a===s.value,onClick:()=>{y(s.value),n(s.value)},className:b("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===s.value&&"border-line-strong bg-muted text-foreground"),children:[s.icon,s.label]},s.value))})}function K(){const t=P(),a=A(),[n,s]=r.useState(t.user.name),[u,l]=r.useState(null);r.useEffect(()=>s(t.user.name),[t.user.name]);const d=n.trim()!==t.user.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(S,{title:"You",sub:"Your own account on this studio",actions:e.jsx(C,{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:i=>{i.preventDefault(),d&&a.mutate(n.trim(),{onSuccess:()=>l(Date.now())})},children:[e.jsx(c,{htmlFor:"your-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(m,{id:"your-name",value:n,onChange:i=>s(i.target.value)}),d&&e.jsx(f,{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(m,{id:"your-email",value:t.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(D,{})}),e.jsx(h,{title:"Appearance",description:"Also in your menu at the bottom of the sidebar.",children:e.jsx(T,{items:[{value:"system",label:"System",icon:e.jsx(F,{className:"size-3.5"})},{value:"light",label:"Light",icon:e.jsx(E,{className:"size-3.5"})},{value:"dark",label:"Dark",icon:e.jsx(M,{className:"size-3.5"})}]})})]})}function D(){const t=k(),[a,n]=r.useState(""),[s,u]=r.useState(""),[l,d]=r.useState(""),[i,g]=r.useState(""),[j,x]=r.useState(!1),p=a.length>0&&s.length>=12&&s===l;return e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:async o=>{if(o.preventDefault(),!(!p||t.isPending)){g("");try{await t.mutateAsync({current:a,next:s}),n(""),u(""),d(""),x(!0)}catch(v){g(N(v))}}},children:[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(c,{htmlFor:"pw-current",children:"Current password"}),e.jsx(m,{id:"pw-current",type:"password",autoComplete:"current-password",value:a,onChange:o=>{n(o.target.value),x(!1)}})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(c,{htmlFor:"pw-next",children:"New password"}),e.jsx(m,{id:"pw-next",type:"password",autoComplete:"new-password",value:s,onChange:o=>{u(o.target.value),x(!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(m,{id:"pw-again",type:"password",autoComplete:"new-password",value:l,onChange:o=>{d(o.target.value),x(!1)}}),l.length>0&&s!==l&&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(f,{type:"submit",disabled:!p||t.isPending,children:t.isPending?"Changing…":j&&!p?"Changed":"Change password"})})]})}export{K as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{at as I}from"./index-DG2IWFx-.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)},ze=e=>e.type==="radio",Oe=e=>e instanceof RegExp,Ye=(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=ze(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=Ye.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",Y=o.type=="week";M(R.value)&&w&&(D=we?q(w)>q(R.value):Y?w>R.value:K>new Date(R.value)),M(W.value)&&w&&(x=we?q(w)<q(W.value):Y?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=>ze(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:ze(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:Y(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)&&(Y()||(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=!_||Y(),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),z=A.validatingFields||A.isValidating||F.validatingFields||F.isValidating;L&&z&&S([g.name],!0);const Z=await hr(h,c.disabled,u,w,s.shouldUseNativeValidation&&!a,V);if(L&&z&&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},Y=(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:Y(t,g)}));else{const L=Array.isArray(g)&&!g.length||B(g),z=!V&&!d;!y||y._f||p(g)||L?Re(t,g,n,f,d,z):Ge(t,g,n,f,d,z)}if(!V&&!d){const L=Ue(t,c),z=f?u:C(u);if(b.state.next({...L&&r,name:o.mount||L?t:void 0,values:z}),!h)for(const Z of ft(c.array,t))b.state.next({name:Z,values:z})}},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,z=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),zr=!B(ge)||Z;if(!V&&b.state.next({name:n,type:t.type,...T?{values:C(u)}:{}}),z)return(!L||!r.isValid)&&(A.isValid||F.isValid)&&(s.mode==="onBlur"?V&&P():V||P()),zr&&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 Yr=br(r.errors,i,n),or=br(ve,i,Yr.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:Y()}}),!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?Y(t,C(v(l,t))):Y()),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,_),z=v(y,_);V&&!O(L)?k(y,_,L):!V&&!O(z)&&he(_,z)}}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?Y():!!(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:Y,_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]=Ye(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]=Ye(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};
|
|
1
|
+
import{at as I}from"./index-D4yHhKPM.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)},ze=e=>e.type==="radio",Oe=e=>e instanceof RegExp,Ye=(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=ze(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=Ye.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",Y=o.type=="week";M(R.value)&&w&&(D=we?q(w)>q(R.value):Y?w>R.value:K>new Date(R.value)),M(W.value)&&w&&(x=we?q(w)<q(W.value):Y?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=>ze(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:ze(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:Y(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)&&(Y()||(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=!_||Y(),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),z=A.validatingFields||A.isValidating||F.validatingFields||F.isValidating;L&&z&&S([g.name],!0);const Z=await hr(h,c.disabled,u,w,s.shouldUseNativeValidation&&!a,V);if(L&&z&&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},Y=(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:Y(t,g)}));else{const L=Array.isArray(g)&&!g.length||B(g),z=!V&&!d;!y||y._f||p(g)||L?Re(t,g,n,f,d,z):Ge(t,g,n,f,d,z)}if(!V&&!d){const L=Ue(t,c),z=f?u:C(u);if(b.state.next({...L&&r,name:o.mount||L?t:void 0,values:z}),!h)for(const Z of ft(c.array,t))b.state.next({name:Z,values:z})}},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,z=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),zr=!B(ge)||Z;if(!V&&b.state.next({name:n,type:t.type,...T?{values:C(u)}:{}}),z)return(!L||!r.isValid)&&(A.isValid||F.isValid)&&(s.mode==="onBlur"?V&&P():V||P()),zr&&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 Yr=br(r.errors,i,n),or=br(ve,i,Yr.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:Y()}}),!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?Y(t,C(v(l,t))):Y()),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,_),z=v(y,_);V&&!O(L)?k(y,_,L):!V&&!O(z)&&he(_,z)}}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?Y():!!(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:Y,_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]=Ye(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]=Ye(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};
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
<link rel="icon" href="/mark.svg" type="image/svg+xml" />
|
|
23
23
|
<title>Snagset</title>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-D4yHhKPM.js"></script>
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BR4Mnw-o.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="app"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as f,d as R,c as E,U as w,j as T,ap as k,X as _,E as j,ao as S,h as H}from"./index-DG2IWFx-.js";function q(n,s){const e=f.useRef(n),r=R(s);E(()=>{e.current!==n&&r(e.current),e.current=n},[n,r])}const U=f.createContext(void 0);function K(){return f.useContext(U)?.direction??"ltr"}const y=f.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Y(){return f.useContext(y)}function B(n={}){const{guess:s,label:e,metadata:r,textRef:l,index:t}=n,{register:u,unregister:i,subscribeMapChange:d,nextIndexRef:h}=Y(),c=f.useRef(-1),[g,C]=f.useState(t==null&&s?()=>{if(c.current===-1){const p=h.current;h.current+=1,c.current=p}return c.current}:-1),v=t??g,b=f.useRef(null),O=f.useCallback(p=>{const M=b.current;M&&i(M),b.current=p,p&&u(p,{metadata:r??null,index:t??null,label:e,textRef:l})},[t,u,i,r,e,l]);return E(()=>{if(t==null)return d(p=>{const M=b.current?p.get(b.current)?.index:null;M!=null&&C(M)})},[t,d]),{ref:O,index:v}}function Q(n){const{children:s,elementsRef:e,labelsRef:r,onMapChange:l}=n,t=R(l),[,u]=f.useState(!1),i=w(V).current,d=w(F).current,h=f.useRef(0),c=f.useRef(!0),g=f.useRef([]),C=f.useRef(null),v=R(()=>{c.current||(c.current=!0,u(o=>!o))}),b=R((o,x)=>{d.set(o,x),v()}),O=R(o=>{d.delete(o),v()}),p=R(o=>{const x=new Map;return e.current.length=0,r&&(r.current.length=0),o.forEach(a=>{x.set(a.element,{...a.registration.metadata??{},index:a.index}),e.current[a.index]=a.element,r&&(r.current[a.index]=a.registration.label!==void 0?a.registration.label:a.registration.textRef?.current?.textContent??a.element.textContent)}),h.current=e.current.length,x});function M(o){if(C.current?.disconnect(),C.current=null,typeof MutationObserver!="function"||o.length<2)return;const x=new MutationObserver(m=>{if(!G(m))return;let I=null;for(const L of o)if(L.isConnected){if(I&&D(I,L)>0){x.disconnect(),v();return}I=L}});C.current=x;const a=new Set;for(let m=1;m<o.length;m+=1){const I=z(o[m-1],o[m]);I&&a.add(I)}a.forEach(m=>x.observe(m,{childList:!0}))}const N=R(()=>{const[o,x]=W(d),a=p(o);M(x),g.current=o,c.current=!1,i.forEach(m=>m(a)),t(a)});E(()=>(c.current||p(g.current),()=>{e.current=[],r&&(r.current=[])}),[e,r,p]),E(()=>{c.current&&N()}),E(()=>()=>{C.current?.disconnect(),c.current=!0},[]);const P=R(o=>(i.add(o),()=>{i.delete(o)})),A=f.useMemo(()=>({register:b,unregister:O,subscribeMapChange:P,nextIndexRef:h}),[b,O,P,h]);return T.jsx(y.Provider,{value:A,children:s})}function F(){return new Map}function V(){return new Set}function W(n){const s=new Set,e=[],r=[];n.forEach((t,u)=>{if(!u.isConnected)return;const i=t.index,d={index:i??-1,element:u,registration:t};i===null?r.push(d):i>=0&&(s.add(i),e.push(d))});let l=0;return r.sort((t,u)=>D(t.element,u.element)),r.forEach(t=>{for(;s.has(l);)l+=1;t.index=l,e.push(t),l+=1}),s.size>0&&e.sort((t,u)=>t.index-u.index),[e,r.map(t=>t.element)]}function z(n,s){let e=n.parentElement;for(;e&&!e.contains(s);)e=e.parentElement;return e}function G(n){for(const s of n)for(let e=0;e<s.removedNodes.length;e+=1)if(s.removedNodes[e].isConnected)return!0;return!1}function D(n,s){return n.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function J(n={}){const{highlightItemOnHover:s,highlightedIndex:e,onHighlightedIndexChange:r}=k(),{ref:l,index:t}=B(n),u=e===t,i=f.useRef(null),d=_(l,i);return{compositeProps:{tabIndex:u?0:-1,onFocus(){r(t)},onMouseMove(){const c=i.current;if(!s||!c)return;const g=c.hasAttribute("disabled")||c.ariaDisabled==="true";!u&&!g&&c.focus()}},compositeRef:d,index:t}}function Z(n){const{render:s,className:e,style:r,state:l=j,props:t=S,refs:u=S,metadata:i,stateAttributesMapping:d,tag:h="div",...c}=n,{compositeProps:g,compositeRef:C}=J({metadata:i});return H(h,n,{state:l,ref:[C,...u],props:[g,...t,c],stateAttributesMapping:d})}export{Q as C,K as a,B as b,Z as c,q as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,c}from"./index-DG2IWFx-.js";import{u as l}from"./createBaseUIEventDetails-BWJgXhnd.js";function y(e,t,n,a=!0,i){const[s,d]=r.useState(),f=l(i?`${i}-label`:void 0),u=e??t??s;return c(()=>{const o=e||t||!a?void 0:m(n.current,f);s!==o&&d(o)}),u}function m(e,t){const n=x(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function x(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const i=e.nextElementSibling;if(i&&i.htmlFor===n)return i}const a=e.labels;return a&&a[0]}const b=r.createContext({disabled:!1});function A(){return r.useContext(b)}export{y as a,A as u};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import{u as rt,a as it,b as lt,r,c as z,d as te,g as dt,j as e,B as Ee,e as w,f as Z,m as pe,E as ct,h as fe,i as re,k as ut,l as pt,n as ge,o as Oe,p as ft,L as A,M as gt,q as ht,s as xt,t as mt,v as bt,w as vt,x as jt,O as yt}from"./index-DG2IWFx-.js";import{u as Ie}from"./useQuery-DuAHuwx9.js";import{T as St,i as De,a as wt,D as Ct,b as kt,c as Tt,X as Nt,d as Pt,e as Rt,f as Mt,g as Et,R as Ot,p as It,h as Dt,j as At,k as _t,P as Ht,l as zt,u as Lt,m as $t,n as Bt,o as Ut,q as Ft,r as qt,s as Gt,t as Vt,v as Kt,w as Yt,x as Wt,y as Xt,z as Qt,A as Jt,F as Zt,B as es,C as ts,E as ss,G as ns,H as as}from"./dialog-CgkCHO0g.js";import{c as B,n as Ae,g as os,a as ie,t as rs,d as is,i as ls,u as ds,b as se}from"./createBaseUIEventDetails-BWJgXhnd.js";import{g as le,u as cs,a as us,b as ps,s as fs,c as gs,d as hs,e as xs,f as ms,h as bs,S as _e,E as X,D as he,i as xe,j as me,k as He,l as de,m as _,n as Q,o as vs,p as ne}from"./dropdown-menu-DRa3ikv4.js";import{u as ze}from"./useRender-BCvsiXRL.js";import{c as I}from"./createLucideIcon-DwbZIZsa.js";import{A as js,a as ys}from"./avatar-AfucjvZ4.js";import{S as Ss,i as ws,a as Cs}from"./labels--UUyt9uB.js";import{u as Le}from"./me-Bno2H07j.js";import{L as J}from"./layout-grid-Dj0cm_PO.js";import{U as ce}from"./users-CcRaZGiI.js";import{c as ks}from"./update-duXzIzFS.js";import{P as Ts}from"./plus-CRLkl9fr.js";import{M as Ns,S as Ps,a as Rs}from"./sun-CyU37by7.js";import"./useBaseQuery-Cyp8ADaN.js";import"./check-Yc6VFTfm.js";import"./CompositeItem-CrOf38Oz.js";function Ms(t){const s=rt({warn:t?.router===void 0}),n=t?.router||s;return it(n.stores.__store,lt(t,n))}/**
|
|
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 Es=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],$e=I("activity",Es);/**
|
|
7
|
-
* @license lucide-react v1.39.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Os=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Be=I("blocks",Os);/**
|
|
12
|
-
* @license lucide-react v1.39.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Is=[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]],Ue=I("book-open",Is);/**
|
|
17
|
-
* @license lucide-react v1.39.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Ds=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],Fe=I("building-2",Ds);/**
|
|
22
|
-
* @license lucide-react v1.39.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const As=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],qe=I("chevrons-up-down",As);/**
|
|
27
|
-
* @license lucide-react v1.39.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const _s=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Hs=I("circle-question-mark",_s);/**
|
|
32
|
-
* @license lucide-react v1.39.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const zs=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ls=I("log-out",zs);/**
|
|
37
|
-
* @license lucide-react v1.39.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const $s=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ue=I("message-square",$s);/**
|
|
42
|
-
* @license lucide-react v1.39.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const Bs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Us=I("panel-left",Bs);/**
|
|
47
|
-
* @license lucide-react v1.39.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const Fs=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],qs=I("sliders-horizontal",Fs);/**
|
|
52
|
-
* @license lucide-react v1.39.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const Gs=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ge=I("user",Gs),ae=768;function Vs(){const[t,s]=r.useState(void 0);return r.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ae-1}px)`),a=()=>{s(window.innerWidth<ae)};return n.addEventListener("change",a),s(window.innerWidth<ae),()=>n.removeEventListener("change",a)},[]),!!t}const Ks=r.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new St,currentIdRef:{current:null},currentContextRef:{current:null}});function Ys(t,s){t.current=s.current}function Ws(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,o=a.useState("floatingId"),g=r.useContext(Ks),{currentIdRef:d,delayRef:l,timeoutMs:h,initialDelayRef:c,currentContextRef:f,hasProvider:v,timeout:x}=g,[y,p]=r.useState(!1),S=r.useRef(n);return z(()=>{S.current=n},[n]),z(()=>{function u(){f.current?.setIsInstantPhase(!1),d.current=null,f.current=null,l.current=c.current,x.clear()}if(d.current&&!n&&d.current===o){if(p(!1),h){const m=o;return x.start(h,()=>{a.select("open")||d.current&&d.current!==m||u()}),()=>{(S.current||d.current!==m)&&x.clear()}}u()}},[n,o,d,l,h,c,f,x,a]),z(()=>{if(!n)return;const u=f.current,m=d.current;x.clear(),f.current={onOpenChange:a.setOpen,setIsInstantPhase:p},d.current=o,l.current={open:0,close:le(c.current,"close")},m!==null&&m!==o?(p(!0),u?.setIsInstantPhase(!0),u?.onOpenChange(!1,B(Ae))):(p(!1),u?.setIsInstantPhase(!1))},[n,o,a,d,l,c,f,x]),z(()=>()=>{if(d.current===o){if(f.current=null,!S.current)return;d.current=null,Ys(l,c),x.clear()}},[f,d,l,o,c,x]),r.useMemo(()=>({hasProvider:v,delayRef:l,isInstantPhase:y}),[v,l,y])}function Xs(t,s){let n=null,a=null,o=!1;return{contextElement:t||void 0,getBoundingClientRect(){const g=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",l=s.axis==="y"||s.axis==="both",h=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=g.width,f=g.height,v=g.x,x=g.y;return n==null&&s.x&&d&&(n=g.x-s.x),a==null&&s.y&&l&&(a=g.y-s.y),v-=n||0,x-=a||0,c=0,f=0,!o||h?(c=s.axis==="y"?g.width:0,f=s.axis==="x"?g.height:0,v=d&&s.x!=null?s.x:v,x=l&&s.y!=null?s.y:x):o&&!h&&(f=s.axis==="x"?g.height:f,c=s.axis==="y"?g.width:c),o=!0,{width:c,height:f,x:v,y:x,top:x,right:v+c,bottom:x+f,left:v}}}}function Te(t){return t!=null&&t.clientX!=null}function Qs(t,s={}){const{enabled:n=!0,axis:a="both"}=s,o="rootStore"in t?t.rootStore:t,g=o.useState("open"),d=o.useState("floatingElement"),l=o.useState("domReferenceElement"),h=o.context.dataRef,c=r.useRef(!1),f=r.useRef(null),[v,x]=r.useState(),[y,p]=r.useState([]),S=te(b=>{o.set("positionReference",b)}),u=te((b,j,P)=>{c.current||h.current.openEvent&&!Te(h.current.openEvent)||o.set("positionReference",Xs(P??l,{x:b,y:j,axis:a,dataRef:h,pointerType:v}))}),m=te(b=>{g?f.current||(u(b.clientX,b.clientY,b.currentTarget),p([])):u(b.clientX,b.clientY,b.currentTarget)}),k=De(v)?d:g;r.useEffect(()=>{if(!n){S(l);return}if(!k)return;function b(){f.current?.(),f.current=null}const j=dt(d);function P(i){const T=os(i);ie(d,T)?b():u(i.clientX,i.clientY)}return!h.current.openEvent||Te(h.current.openEvent)?f.current=wt(j,"mousemove",P):S(l),b},[k,n,d,h,l,o,u,S,y]),r.useEffect(()=>()=>{o.set("positionReference",null)},[o]),r.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),r.useEffect(()=>{!n&&g&&(c.current=!0)},[n,g]);const C=r.useMemo(()=>{function b(j){x(j.pointerType)}return{onPointerDown:b,onPointerEnter:b,onMouseMove:m,onMouseEnter:m}},[m]);return r.useMemo(()=>n?{reference:C,trigger:C}:{},[n,C])}function Js({...t}){return e.jsx(Ct,{"data-slot":"sheet",...t})}function Zs({...t}){return e.jsx(Mt,{"data-slot":"sheet-portal",...t})}function en({className:t,...s}){return e.jsx(Et,{"data-slot":"sheet-overlay",className:w("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",t),...s})}function tn({className:t,children:s,side:n="right",showCloseButton:a=!0,...o}){return e.jsxs(Zs,{children:[e.jsx(en,{}),e.jsxs(kt,{"data-slot":"sheet-content","data-side":n,className:w("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...o,children:[s,a&&e.jsxs(Tt,{"data-slot":"sheet-close",render:e.jsx(Ee,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(Nt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function sn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function nn({className:t,...s}){return e.jsx(Pt,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function an({className:t,...s}){return e.jsx(Rt,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const Ve=r.createContext(void 0);function V(t){const s=r.useContext(Ve);if(s===void 0&&!t)throw new Error(Z(72));return s}const on={...It,disabled:t=>t.disabled,instantType:t=>t.instantType,isInstantPhase:t=>t.isInstantPhase,trackCursorAxis:t=>t.trackCursorAxis,disableHoverablePopup:t=>t.disableHoverablePopup,lastOpenChangeReason:t=>t.openChangeReason,closeOnClick:t=>t.closeOnClick,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin};class rn extends Ot{constructor(s,n,a){const o=new Ht;super(ln(s,o,n,a),dn(o),on)}setOpen=(s,n)=>{Dt(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(rs,s))}}function ln(t,s,n,a=!1){const o={...At(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return o.floatingRootContext=_t(s,n,a),o}function dn(t){return{popupRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const cn=zt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:o,disableHoverablePopup:g=!1,trackCursorAxis:d="none",actionsRef:l,onOpenChange:h,onOpenChangeComplete:c,handle:f,triggerId:v,defaultTriggerId:x=null,children:y}=s,p=Lt(($,U)=>new rn({open:a,openProp:o,activeTriggerId:x,triggerIdProp:v},$,U));p.useControlledProp("openProp",o),p.useControlledProp("triggerIdProp",v),p.useContextCallback("onOpenChange",h),p.useContextCallback("onOpenChangeComplete",c);const S=p.useState("open"),u=!n&&S,m=p.useState("activeTriggerId"),k=p.useState("mounted"),C=p.useState("payload");p.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:g,disabled:n}),$t(p,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:b,transitionStatus:j}=Bt(u,p),P=p.useState("isInstantPhase"),i=p.useState("instantType"),T=p.useState("lastOpenChangeReason"),R=r.useRef(null);z(()=>{S&&n&&p.setOpen(!1,B(is))},[S,n,p]),z(()=>{j==="ending"&&T===Ae||j!=="ending"&&P?(i!=="delay"&&(R.current=i),p.set("instantType","delay")):R.current!==null&&(p.set("instantType",R.current),R.current=null)},[j,P,T,i,p]),z(()=>{u&&m==null&&p.set("payload",void 0)},[p,m,u]),r.useImperativeHandle(l,()=>({unmount:b,close:()=>p.setOpen(!1,B(ls))}),[b,p]);const L=u||k||!n&&d!=="none";return e.jsxs(Ve.Provider,{value:p,children:[f&&e.jsx(Ut,{handle:f,store:p}),L&&e.jsx(un,{store:p,disabled:n,trackCursorAxis:d}),typeof y=="function"?y({payload:C}):y]})});function un({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),o=Ft(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),g=Qs(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=r.useMemo(()=>pe(g.reference,o.reference),[g.reference,o.reference]);return qt(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:o.floating??ct}),null}const pn=r.createContext(void 0);function fn(){return r.useContext(pn)}const Ne=600,Ke="data-base-ui-tooltip-trigger";function Pe(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const o=n[a];if(re(o))return o}}const s=t.target;return re(s)?s:null}function gn(t){let s=t;for(;s;){const n=s.closest(`[${Ke}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&re(a.host)?a.host:null}return null}const hn=Gt(function(s,n){const{render:a,className:o,style:g,handle:d,payload:l,disabled:h,delay:c,closeOnClick:f=!0,closeDelay:v,id:x,...y}=s,p=V(!0),u=cs(d)??p;if(!u)throw new Error(Z(82));const m=ds(x),k=u.useState("isTriggerActive",m),C=u.useState("isOpenedByTrigger",m),b=u.useState("floatingRootContext"),j=r.useRef(null),P=c??Ne,i=v??0,{registerTrigger:T,isMountedByThisTrigger:R}=Vt(m,j,u,{payload:l,closeOnClick:f,closeDelay:i}),L=fn(),{delayRef:$,isInstantPhase:U,hasProvider:M}=Ws(b,{open:C}),F=us(b);u.useSyncedValue("isInstantPhase",U);const ee=u.useState("disabled"),q=h??ee,ve=Kt(q),je=u.useState("trackCursorAxis"),Ze=u.useState("disableHoverablePopup"),G=r.useRef(!1),K=Yt(),Y=r.useRef(void 0);function ye(){return M?le($.current,"open")===0?0:c??L??Ne:P}function Se(N){const D=j.current;if(!D||!N)return!1;const H=gn(N);return H!==null&&H!==D&&ie(D,H)}function et(N){const D=Se(N);return G.current=D,D&&(F.openChangeTimeout.clear(),F.restTimeout.clear(),F.restTimeoutPending=!1,K.clear()),D}const tt=ps(b,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!Ze&&je!=="both"?fs():null,restMs:ye,delay(){return v==null&&M?{close:le($.current,"close")}:{close:i}},triggerElementRef:j,isActiveTrigger:k,isClosing:()=>u.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),st=gs(b,{enabled:!q}).reference,nt=N=>{const D=G.current,H=Pe(N),we=et(H),W=j.current,ot=W&&H&&ie(W,H);if(we&&u.select("open")&&u.select("lastOpenChangeReason")===se){u.setOpen(!1,B(se,N));return}if(D&&!we&&ot&&!ve.current&&!u.select("open")&&W&&De(Y.current)){const Ce=()=>{!G.current&&!ve.current&&!u.select("open")&&u.setOpen(!0,B(se,N,W))},ke=ye();ke===0?(K.clear(),Ce()):K.start(ke,Ce)}},at=u.useState("triggerProps",R);return fe("button",s,{state:{open:C},ref:[n,T,j],props:[tt,st,R||je!=="none"?at:void 0,{onMouseOver(N){nt(N.nativeEvent)},onFocus(N){Se(Pe(N.nativeEvent))&&N.preventBaseUIHandler()},onMouseLeave(){G.current=!1,K.clear(),Y.current=void 0},onPointerEnter(N){Y.current=N.pointerType},onPointerDown(N){Y.current=N.pointerType,u.set("closeOnClick",f),f&&!u.select("open")&&u.cancelPendingOpen(N.nativeEvent)},onClick(N){f&&!u.select("open")&&u.cancelPendingOpen(N.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[Ke]:q?void 0:""},y],stateAttributesMapping:Wt})}),Ye=r.createContext(void 0);function xn(){const t=r.useContext(Ye);if(t===void 0)throw new Error(Z(70));return t}const mn=r.forwardRef(function(s,n){const{children:a,container:o,className:g,render:d,style:l,...h}=s,{node:c,subtree:f}=Xt({container:o,ref:n,componentProps:s,elementProps:h});return!f&&!c?null:e.jsxs(r.Fragment,{children:[f,c&&ut.createPortal(a,c)]})}),bn=r.forwardRef(function(s,n){const{keepMounted:a=!1,...o}=s;return V().useState("mounted")||a?e.jsx(Ye.Provider,{value:a,children:e.jsx(mn,{ref:n,...o})}):null}),We=r.createContext(void 0);function Xe(){const t=r.useContext(We);if(t===void 0)throw new Error(Z(71));return t}const vn=r.forwardRef(function(s,n){const{render:a,className:o,anchor:g,positionMethod:d="absolute",side:l="top",align:h="center",sideOffset:c=0,alignOffset:f=0,collisionBoundary:v="clipping-ancestors",collisionPadding:x=5,arrowPadding:y=5,sticky:p=!1,disableAnchorTracking:S=!1,collisionAvoidance:u=Qt,style:m,...k}=s,C=V(),b=xn(),j=C.useState("open"),P=C.useState("mounted"),i=C.useState("trackCursorAxis"),T=C.useState("disableHoverablePopup"),R=C.useState("floatingRootContext"),L=C.useState("instantType"),$=C.useState("transitionStatus"),U=C.useState("adaptiveOrigin"),M=hs({anchor:g,positionMethod:d,floatingRootContext:R,mounted:P,side:l,sideOffset:c,align:h,alignOffset:f,collisionBoundary:v,collisionPadding:x,sticky:p,arrowPadding:y,disableAnchorTracking:S,keepMounted:b,collisionAvoidance:u,adaptiveOrigin:U}),F=r.useMemo(()=>({open:j,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:i!=="none"?"tracking-cursor":L}),[j,M.side,M.align,M.anchorHidden,i,L]),ee=xs(s,F,{styles:M.positionerStyles,transitionStatus:$,props:k,refs:[n,C.useStateSetter("positionerElement")],hidden:!P,inert:!j||i==="both"||T});return e.jsx(We.Provider,{value:M,children:ee})}),jn=r.forwardRef(function(s,n){const{render:a,className:o,style:g,...d}=s,l=V(),{side:h,align:c}=Xe(),f=l.useState("open"),v=l.useState("instantType"),x=l.useState("transitionStatus"),y=l.useState("popupProps"),p=l.useState("floatingRootContext"),S=l.useState("disabled"),u=l.useState("closeDelay");Jt({open:f,ref:l.context.popupRef,onComplete(){f&&l.context.onOpenChangeComplete?.(!0)}}),ms(p,{enabled:!S,closeDelay:u});const m=l.useStateSetter("popupElement");return fe("div",s,{state:{open:f,side:h,align:c,instant:v,transitionStatus:x},ref:[n,l.context.popupRef,m],props:[Zt,y,bs(x),d],stateAttributesMapping:es})}),yn=r.forwardRef(function(s,n){const{render:a,className:o,style:g,...d}=s,l=V(),{arrowRef:h,side:c,align:f,arrowUncentered:v,arrowStyles:x}=Xe(),y=l.useState("open"),p=l.useState("instantType");return fe("div",s,{state:{open:y,side:c,align:f,uncentered:v,instant:p},ref:[n,h],props:[{style:x,"aria-hidden":!0},d],stateAttributesMapping:ts})});function Sn({...t}){return e.jsx(cn,{"data-slot":"tooltip",...t})}function wn({...t}){return e.jsx(hn,{"data-slot":"tooltip-trigger",...t})}function Cn({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:o=0,children:g,...d}){return e.jsx(bn,{children:e.jsx(vn,{align:a,alignOffset:o,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(jn,{"data-slot":"tooltip-content",className:w("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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",t),...d,children:[g,e.jsx(yn,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const kn="sidebar_state",Tn=3600*24*7,Nn="16rem",Pn="18rem",Rn="3rem",Mn="b",Qe=r.createContext(null);function be(){const t=r.useContext(Qe);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function En({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:o,children:g,...d}){const l=Vs(),[h,c]=r.useState(!1),[f,v]=r.useState(t),x=s??f,y=r.useCallback(m=>{const k=typeof m=="function"?m(x):m;n?n(k):v(k),document.cookie=`${kn}=${k}; path=/; max-age=${Tn}`},[n,x]),p=r.useCallback(()=>l?c(m=>!m):y(m=>!m),[l,y,c]);r.useEffect(()=>{const m=k=>{k.key===Mn&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),p())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[p]);const S=x?"expanded":"collapsed",u=r.useMemo(()=>({state:S,open:x,setOpen:y,isMobile:l,openMobile:h,setOpenMobile:c,toggleSidebar:p}),[S,x,y,l,h,c,p]);return e.jsx(Qe.Provider,{value:u,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Nn,"--sidebar-width-icon":Rn,...o},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:g})})}function On({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:o,dir:g,...d}){const{isMobile:l,state:h,openMobile:c,setOpenMobile:f}=be();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:w("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...d,children:o}):l?e.jsx(Js,{open:c,onOpenChange:f,...d,children:e.jsxs(tn,{dir:g,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Pn},side:t,children:[e.jsxs(sn,{className:"sr-only",children:[e.jsx(nn,{children:"Sidebar"}),e.jsx(an,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":h,"data-collapsible":h==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:w("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:w("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...d,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:o})})]})}function In({className:t,onClick:s,...n}){const{toggleSidebar:a}=be();return e.jsxs(Ee,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:o=>{s?.(o),a()},...n,children:[e.jsx(Us,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Dn({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:w("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function An({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:w("flex flex-col gap-2 p-2",t),...s})}function _n({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:w("flex flex-col gap-2 p-2",t),...s})}function Hn({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:w("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function Re({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:w("relative flex w-full min-w-0 flex-col p-2",t),...s})}function zn({className:t,render:s,...n}){return ze({defaultTagName:"div",props:pe({className:w("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",t)},n),render:s,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function Me({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:w("w-full text-sm",t),...s})}function oe({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:w("flex w-full min-w-0 flex-col gap-0",t),...s})}function E({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:w("group/menu-item relative",t),...s})}const Ln=pt("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function O({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:o,className:g,...d}){const{isMobile:l,state:h}=be(),c=ze({defaultTagName:"button",props:pe({className:w(Ln({variant:n,size:a}),g)},d),render:o?e.jsx(wn,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return o?(typeof o=="string"&&(o={children:o}),e.jsxs(Sn,{children:[c,e.jsx(Cn,{side:"right",align:"center",hidden:h!=="collapsed"||l,...o})]})):c}function $n({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:w("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",t),...s})}function Bn({open:t,onOpenChange:s}){const n=Le(),a=ge(),[o,g]=r.useState(""),[d,l]=r.useState(0),h=r.useRef(null),c=o.trim(),[f,v]=r.useState("");r.useEffect(()=>{const i=setTimeout(()=>v(c),180);return()=>clearTimeout(i)},[c]);const x=Ie({queryKey:["activity","search",f],queryFn:()=>Oe.activity({q:f,status:"all",limit:8}),enabled:t&&f.length>=2,staleTime:3e4});r.useEffect(()=>{t||(g(""),l(0))},[t]);const y=r.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(J,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx($e,{className:"size-4"}),go:()=>void a({to:"/activity"})},{id:"s:members",label:"Members",icon:e.jsx(ce,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Be,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Fe,{className:"size-4"}),go:()=>void a({to:"/studio"})},{id:"s:you",label:"You",icon:e.jsx(Ge,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a]),p=r.useMemo(()=>n.projects.map(i=>({id:`p:${i.uid}`,label:i.name,hint:i.unresolved>0?`${i.unresolved} open`:"nothing open",icon:e.jsx(ue,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:i.uid}})})),[n.projects,a]),S=i=>!c||i.toLowerCase().includes(c.toLowerCase()),u=[],m=p.filter(i=>S(i.label)),k=y.filter(i=>S(i.label));m.length&&u.push({title:"Sites",items:m}),k.length&&u.push({title:"Go to",items:k});const C=(x.data?.data??[]).map(i=>({id:`t:${i.id}`,label:i.latest?.body?.trim()||i.route,hint:`${i.site.name} · ${ws(i.status)?Ss[i.status]:i.status} · ${i.key}`,icon:e.jsx(ue,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:i.site.uid},search:{thread:i.key}})}));C.length&&u.push({title:"Comments",items:C});const b=u.flatMap(i=>i.items),j=Math.min(d,Math.max(0,b.length-1)),P=i=>{i&&(s(!1),i.go())};return r.useEffect(()=>{h.current?.querySelector(`[data-at="${j}"]`)?.scrollIntoView({block:"nearest"})},[j]),e.jsx(ss,{open:t,onOpenChange:s,children:e.jsxs(ns,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(as,{className:"sr-only",children:"Search and go"}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[e.jsx(_e,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:o,onChange:i=>{g(i.target.value),l(0)},onKeyDown:i=>{i.key==="ArrowDown"?(i.preventDefault(),l(T=>Math.min(T+1,b.length-1))):i.key==="ArrowUp"?(i.preventDefault(),l(T=>Math.max(T-1,0))):i.key==="Enter"&&(i.preventDefault(),P(b[j]))},placeholder:"Go to a site or a screen, or search every comment…","aria-label":"Search and go",className:"h-11 w-full bg-transparent text-[14px] outline-none placeholder:text-muted-foreground"})]}),e.jsxs("div",{ref:h,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[b.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:x.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),u.map(i=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:i.title}),i.items.map(T=>{const R=b.indexOf(T);return e.jsxs("button",{type:"button","data-at":R,onMouseMove:()=>l(R),onClick:()=>P(T),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",R===j&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:T.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:T.label}),T.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:T.hint})]},T.id)})]},i.title)),x.isFetching&&b.length>0&&e.jsx("p",{className:"m-0 px-3 py-1.5 text-[12px] text-muted-foreground",children:"Searching every site…"})]})]})})}function Un(){const[t,s]=r.useState(!1);return r.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(o=>!o))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const Je="https://snagset.com/docs/",Fn="https://www.npmjs.com/package/@snagset/server?activeTab=versions",qn="https://snagset.com/docs/self-hosting/#upgrade";function Gn({children:t}){const s=Le(),n=ft(s),[a,o]=Un();return e.jsxs(En,{children:[e.jsx(Vn,{me:s,site:n}),e.jsxs(Dn,{className:"min-w-0",children:[e.jsx(Xn,{onSearch:()=>o(!0)}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Bn,{open:a,onOpenChange:o})]})}function Vn({me:t,site:s}){const n=Ms({select:o=>o.location.pathname}),a=o=>n===o||n.startsWith(o+"/");return e.jsxs(On,{children:[e.jsx(An,{className:"px-3 pb-1 pt-3",children:e.jsxs(A,{to:"/studio",className:"flex items-center gap-2.5 rounded-md px-1 py-0.5 text-foreground hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:[e.jsx(gt,{size:20}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[14px] font-semibold leading-tight tracking-tight",children:t.org.name}),e.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:location.host})]})]})}),e.jsxs(Hn,{children:[e.jsxs(Re,{children:[e.jsx(Kn,{me:t,site:s}),s&&e.jsx(Me,{children:e.jsxs(oe,{children:[e.jsxs(E,{children:[e.jsxs(O,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(A,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ue,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx($n,{children:s.unresolved})]}),e.jsx(E,{children:e.jsxs(O,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(A,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(ce,{}),e.jsx("span",{children:"Reviewers"})]})}),e.jsx(E,{children:e.jsxs(O,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(A,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(qs,{}),e.jsx("span",{children:"Settings"})]})})]})})]}),e.jsxs(Re,{children:[e.jsx(zn,{children:"Studio"}),e.jsx(Me,{children:e.jsxs(oe,{children:[e.jsx(E,{children:e.jsxs(O,{isActive:a("/sites"),render:e.jsx(A,{to:"/sites"}),children:[e.jsx(J,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(E,{children:e.jsxs(O,{isActive:a("/activity"),render:e.jsx(A,{to:"/activity"}),children:[e.jsx($e,{}),e.jsx("span",{children:"Activity"})]})}),e.jsx(E,{children:e.jsxs(O,{isActive:a("/studio/members"),render:e.jsx(A,{to:"/studio/members"}),children:[e.jsx(ce,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(E,{children:e.jsxs(O,{isActive:a("/studio/integrations"),render:e.jsx(A,{to:"/studio/integrations"}),children:[e.jsx(Be,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(E,{children:e.jsxs(O,{isActive:n==="/studio",render:e.jsx(A,{to:"/studio"}),children:[e.jsx(Fe,{}),e.jsx("span",{children:"General"})]})})]})})]})]}),e.jsx(_n,{children:e.jsxs(oe,{children:[e.jsx(E,{children:e.jsxs(O,{render:e.jsx("a",{href:Je,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ue,{}),e.jsx("span",{children:"Docs"}),e.jsx(X,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(E,{children:e.jsx(Yn,{})}),e.jsx(E,{children:e.jsx(Wn,{me:t})})]})})]})}function Kn({me:t,site:s}){const n=ge();return e.jsxs(he,{children:[e.jsxs(xe,{render:e.jsx("button",{type:"button",className:"mb-1 flex h-[34px] w-full items-center justify-between rounded-md border border-border bg-card px-2.5 text-[13px] font-semibold text-foreground","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(qe,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(me,{align:"start",className:"w-[240px]",children:[e.jsxs(He,{children:[e.jsx(de,{children:"Sites"}),t.projects.map(a=>e.jsxs(_,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(J,{}),e.jsx("span",{className:"truncate",children:a.name}),a.uid===s?.uid&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},a.uid))]}),e.jsx(Q,{}),e.jsxs(_,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(Ts,{}),"Add a site"]}),e.jsxs(_,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(J,{}),"All sites"]})]})]})}function Yn(){const t=Ie(jt.meta()),s=t.data?.version??"",[n,a]=r.useState({state:"idle"}),o=async()=>{a({state:"checking"});try{a({state:"done",result:await ks(s)})}catch{a({state:"failed"})}};return e.jsxs(he,{children:[e.jsxs(xe,{render:e.jsx(O,{}),children:[e.jsx(Hs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(me,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(_,{render:e.jsx("a",{href:Je,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ue,{}),"Docs",e.jsx(X,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(_,{render:e.jsx("a",{href:Fn,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(X,{className:"ml-auto size-3 text-muted-foreground"})]}),t.data?.sourceUrl&&e.jsxs(_,{render:e.jsx("a",{href:t.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(X,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(Q,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",s||"—",n.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void o(),children:"Check for updates"})]}),n.state==="checking"&&" · checking…",n.state==="failed"&&" · could not reach npm",n.state==="done"&&n.result&&e.jsxs(e.Fragment,{children:[" · ",n.result.newer?e.jsxs("a",{href:qn,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[n.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function Wn({me:t}){const s=ge(),n=xt(),[a,o]=r.useState(mt),g=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,l=async()=>{await Oe.logout().catch(()=>{}),vt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(he,{children:[e.jsxs(xe,{render:e.jsx(O,{size:"lg"}),children:[e.jsx(js,{className:"size-8 rounded-full",children:e.jsx(ys,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:Cs(t.user.name,t.user.email)})}),e.jsxs("div",{className:"min-w-0 flex-1 text-left leading-tight",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold",children:g}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(qe,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(me,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(He,{children:e.jsxs(de,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:g}),e.jsx("span",{className:"text-[11.5px] font-normal text-muted-foreground",children:t.user.name?`${t.user.email} · ${t.user.role}`:t.user.role})]})}),e.jsx(Q,{}),e.jsxs(vs,{value:a,onValueChange:h=>{const c=h;bt(c),o(c)},children:[e.jsx(de,{children:"Theme"}),e.jsxs(ne,{value:"system",children:[e.jsx(Ns,{}),"System"]}),e.jsxs(ne,{value:"light",children:[e.jsx(Ps,{}),"Light"]}),e.jsxs(ne,{value:"dark",children:[e.jsx(Rs,{}),"Dark"]})]}),e.jsx(Q,{}),e.jsxs(_,{onClick:()=>void s({to:"/you"}),children:[e.jsx(Ge,{}),"You"]}),e.jsxs(_,{onClick:()=>void l(),children:[e.jsx(Ls,{}),"Sign out"]})]})]})}function Xn({onSearch:t}){const n=ht().map(a=>a.loaderData?.crumb).filter(a=>typeof a=="string"&&a.length>0);return e.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(In,{className:"-ml-1"}),e.jsx("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-[13.5px] font-medium text-muted-foreground",children:n.map((a,o)=>e.jsxs("span",{className:"flex items-center gap-2",children:[o>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:o===n.length-1?"text-foreground":void 0,children:a})]},o))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",onClick:t,"aria-label":"Search and go",className:"flex h-7 items-center gap-2 rounded-md border border-border bg-card px-2 text-[12.5px] text-muted-foreground",children:[e.jsx(_e,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Search"}),e.jsx("kbd",{className:"hidden rounded border border-border px-1 font-mono text-[11px] sm:inline",children:"⌘K"})]})]})}const ba=()=>e.jsx(Gn,{children:e.jsx(yt,{})});export{ba as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aE as g,r as a,az as m,E as p}from"./index-DG2IWFx-.js";function w(e){return e?.ownerDocument||document}let i=0;function v(e,t="mui"){const[s,n]=a.useState(e),o=e||s;return a.useEffect(()=>{s==null&&(i+=1,n(`${t}-${i}`))},[s,t]),o}const l=g.useId;function E(e,t){if(l!==void 0){const s=l();return e??(t?`${t}-${s}`:s)}return v(e,t)}function I(e){return E(e,"base-ui")}function P(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function h(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&m(s)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function R(e){return"composedPath"in e?e.composedPath()[0]:e.target}function C({controlled:e,default:t,name:s,state:n="value"}){const{current:o}=a.useRef(e!==void 0),[r,c]=a.useState(t),u=o?e:r,f=a.useCallback(d=>{o||c(d)},[]);return[u,f]}const S="none",D="trigger-press",N="trigger-hover",$="trigger-focus",k="outside-press",y="item-press",T="close-press",U="focus-out",A="escape-key",B="list-navigation",O="cancel-open",V="sibling-open",j="disabled",q="imperative-action";function z(e,t,s,n){let o=!1,r=!1;const c=n??p;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){r=!0},get isCanceled(){return o},get isPropagationAllowed(){return r},trigger:s,...c}}export{h as a,N as b,z as c,j as d,C as e,P as f,R as g,$ as h,q as i,A as j,U as k,B as l,y as m,S as n,w as o,k as p,E as q,O as r,V as s,D as t,I as u,T as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,W as n,f as X,E as $,U as M,d as V,c as v,i as q,h as z,j as F,e as _}from"./index-DG2IWFx-.js";import{u as G,f as H,o as Q,e as Z,c as ee,n as te}from"./createBaseUIEventDetails-BWJgXhnd.js";const ne={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},re={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ae={disabled:!1,...re},se={valid(t){return t===null?null:t?{"data-valid":""}:{"data-invalid":""}}},le={invalid:void 0,name:void 0,validityData:{state:ne,errors:[],error:"",value:"",initialValue:null},setValidityData:n,disabled:void 0,setTouched:n,setDirty:n,setFilled:n,setFocused:n,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:ae,registerFieldControl:n,validation:{getValidationProps:(t,e=$)=>e,inputRef:{current:null},registeredInputs:new Map,registerInput:n,getInputControl:()=>null,commit:async()=>{},change:n}},ie=i.createContext(le);function S(t=!0){const e=i.useContext(ie);if(e.setValidityData===n&&!t)throw new Error(X(28));return e}const oe=i.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:n,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function ue(){return i.useContext(oe)}const de=i.createContext({controlId:void 0,registerControlId:n,labelId:void 0,setLabelId:n,messageIds:[],setMessageIds:n,getDescriptionProps:t=>t});function A(){return i.useContext(de)}function ce(t={}){const{id:e,implicit:l=!1,controlRef:p}=t,{controlId:b,registerControlId:o}=A(),s=G(e),r=l?b:void 0,u=M(()=>Symbol()),m=i.useRef(!1),g=i.useRef(e!=null),d=V(()=>{!m.current||o===n||(m.current=!1,o(u.current,void 0))});return v(()=>{if(o===n)return;let f;if(l){const E=p?.current;q(E)&&E.closest("label")!=null?f=e??null:f=r??s}else if(e!=null)g.current=!0,f=e;else if(g.current)f=s;else{d();return}if(f===void 0){d();return}m.current=!0,o(u.current,f)},[e,p,r,o,l,s,u,d]),i.useEffect(()=>d,[d]),b??s}function fe(t,e,l,p,b=!0,o){const{registerFieldControl:s}=S(),r=M(()=>Symbol());v(()=>{const u=r.current;if(!b){s(u,void 0);return}s(u,{controlRef:t,getValue:p,id:e,name:o,value:l})},[t,b,p,e,o,s,r,l]),v(()=>{const u=r.current;return()=>{s(u,void 0)}},[s,r])}const pe=i.forwardRef(function(e,l){const{render:p,className:b,id:o,name:s,value:r,disabled:u=!1,onValueChange:m,defaultValue:g,autoFocus:d=!1,style:f,...E}=e,{state:P,name:U,disabled:O,setTouched:h,setDirty:N,validityData:k,setFocused:I,setFilled:x,validationMode:j,validation:c}=S(),{clearErrors:B}=ue(),C=O||u,y=U??s,W={...P,disabled:C},{labelId:Y}=A(),D=ce({id:o});v(()=>{const a=r!=null;c.inputRef.current?.value||a&&r!==""?x(!0):a&&r===""&&x(!1)},[c.inputRef,x,r]);const T=i.useRef(null);v(()=>{d&&T.current===H(Q(T.current))&&I(!0)},[d,I]);const[J]=Z({controlled:r,default:g,name:"FieldControl",state:"value"}),L=r!==void 0,w=L?J:void 0,K=V(()=>c.inputRef.current?.value);return fe(c.inputRef,D,w,K,!C,s),z("input",e,{ref:[l,T],state:W,props:[{id:D,disabled:C,name:y,ref:c.inputRef,"aria-labelledby":Y,autoFocus:d,...L?{value:w}:{defaultValue:g},onChange(a){const R=a.currentTarget.value;m?.(R,ee(te,a.nativeEvent)),N(R!==(k.initialValue??"")),x(R!==""),a.nativeEvent.defaultPrevented||(B(y),c.change(R))},onFocus(){I(!0)},onBlur(a){h(!0),I(!1),j==="onBlur"&&c.commit(a.currentTarget.value)},onKeyDown(a){a.currentTarget.tagName==="INPUT"&&a.key==="Enter"&&(h(!0),c.commit(a.currentTarget.value))}},E,a=>c.getValidationProps(C,a)],stateAttributesMapping:se})}),be=i.forwardRef(function(e,l){return F.jsx(pe,{ref:l,...e})});function Ee({className:t,type:e,...l}){return F.jsx(be,{type:e,"data-slot":"input",className:_("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...l})}function Ie({className:t,...e}){return F.jsx("label",{"data-slot":"label",className:_("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...e})}export{Ee as I,Ie as L,S as a,A as b,fe as c,ce as d,se as f,ue as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u,d as s}from"./useBaseQuery-Cyp8ADaN.js";import{x as t}from"./index-DG2IWFx-.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-DG2IWFx-.js";const n=()=>t.jsx(o,{});export{n as component};
|