@snagset/server 0.1.62 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/integrations/jira.js +22 -0
  2. package/dist/integrations/jira.js.map +1 -1
  3. package/dist/integrations/linear.js +17 -0
  4. package/dist/integrations/linear.js.map +1 -1
  5. package/dist/routes/integrations.js +44 -6
  6. package/dist/routes/integrations.js.map +1 -1
  7. package/package.json +1 -1
  8. package/static/dashboard/assets/{CompositeItem-CkiEeVQd.js → CompositeItem-CNlNRLwm.js} +1 -1
  9. package/static/dashboard/assets/{CompositeList-OHWH8W1h.js → CompositeList-CDfO6SCy.js} +1 -1
  10. package/static/dashboard/assets/{ConfirmDialog-Db4AvUN5.js → ConfirmDialog-B5-FUf01.js} +1 -1
  11. package/static/dashboard/assets/{CopyButton-r38fWUwx.js → CopyButton-CDVY09FZ.js} +1 -1
  12. package/static/dashboard/assets/{FieldItemContext-qjC5pLGs.js → FieldItemContext-D_hbvXzX.js} +1 -1
  13. package/static/dashboard/assets/{InstallTag-DYeR38Ex.js → InstallTag-DutQruP1.js} +1 -1
  14. package/static/dashboard/assets/InstanceRows-BrXrOXxa.js +1 -0
  15. package/static/dashboard/assets/McpTokens-BnhNB_C0.js +1 -0
  16. package/static/dashboard/assets/{Picker-95_pkfVu.js → Picker-BvdKGeU8.js} +2 -2
  17. package/static/dashboard/assets/{SaveState-DmbisglJ.js → SaveState-DrWU77oO.js} +1 -1
  18. package/static/dashboard/assets/_-DwwKoA7B.js +1 -0
  19. package/static/dashboard/assets/_app-CYfFCBBL.js +1 -0
  20. package/static/dashboard/assets/{_app-BjmAfJVc.js → _app-DalVfhNg.js} +1 -1
  21. package/static/dashboard/assets/{_app-BB6wQ2Q0.js → _app-MqqZ5rHF.js} +2 -2
  22. package/static/dashboard/assets/activity-B1fOkSrs.js +1 -0
  23. package/static/dashboard/assets/{arrow-left-Bw5uUs0F.js → arrow-left-B4-bJVcO.js} +1 -1
  24. package/static/dashboard/assets/{avatar-C6Rr20S0.js → avatar-B-4Lv0hf.js} +1 -1
  25. package/static/dashboard/assets/{badge-CicACH6l.js → badge-Cwf-GPv8.js} +1 -1
  26. package/static/dashboard/assets/{check-BlRwZrSR.js → check-26YOtWVN.js} +1 -1
  27. package/static/dashboard/assets/{chevron-down-865lxBex.js → chevron-down-OinKSKsq.js} +1 -1
  28. package/static/dashboard/assets/{chevron-right-2YkP20tJ.js → chevron-right-Dh7TD2kW.js} +1 -1
  29. package/static/dashboard/assets/{copy-DSJQda7h.js → copy-DqhiNOHN.js} +1 -1
  30. package/static/dashboard/assets/{createBaseUIEventDetails-CTYgZt5m.js → createBaseUIEventDetails-BlUeVOHL.js} +1 -1
  31. package/static/dashboard/assets/{dialog-DZbUuBSr.js → dialog-CjX41K4h.js} +2 -2
  32. package/static/dashboard/assets/{dropdown-menu-By49qibi.js → dropdown-menu-BejmUTVa.js} +2 -2
  33. package/static/dashboard/assets/{forgot-C-nxI2th.js → forgot-Cv_EPbZy.js} +1 -1
  34. package/static/dashboard/assets/{getPseudoElementBounds-CFaDUKhY.js → getPseudoElementBounds-087ogDm1.js} +1 -1
  35. package/static/dashboard/assets/{image-off-u_JoVfOy.js → image-off-BsOmKpjU.js} +1 -1
  36. package/static/dashboard/assets/index-CUBD0DcL.js +172 -0
  37. package/static/dashboard/assets/{inertValue-CLaAaX62.js → inertValue-BxLh7N1J.js} +1 -1
  38. package/static/dashboard/assets/invite-DrxWT0UW.js +1 -0
  39. package/static/dashboard/assets/{label-8lYoT07T.js → label-BoGrNcZ0.js} +1 -1
  40. package/static/dashboard/assets/{layout-grid-C-a8O8B6.js → layout-grid-D1FcD4G3.js} +1 -1
  41. package/static/dashboard/assets/me-DeblO6Os.js +1 -0
  42. package/static/dashboard/assets/{plus-CS6tYH0S.js → plus-ChodljzA.js} +1 -1
  43. package/static/dashboard/assets/{reset-Cga9iuj2.js → reset-DoB5fAkF.js} +1 -1
  44. package/static/dashboard/assets/{s._site-SxnfgkOI.js → s._site-Xu1MbYF_.js} +1 -1
  45. package/static/dashboard/assets/{s._site.comments-B9MVihwE.js → s._site.comments-63OF736E.js} +8 -8
  46. package/static/dashboard/assets/s._site.reviewers-BZ6tbe9V.js +1 -0
  47. package/static/dashboard/assets/s._site.settings-Bx21kvsO.js +1 -0
  48. package/static/dashboard/assets/{setup-Duptw7Cj.js → setup-AHjI1DnF.js} +1 -1
  49. package/static/dashboard/assets/{sign-in-zTZ603o2.js → sign-in-D-Y_lran.js} +1 -1
  50. package/static/dashboard/assets/{sign-up-CmHICQCh.js → sign-up-B8RiXKrs.js} +1 -1
  51. package/static/dashboard/assets/sites-BcEIT4Tw.js +1 -0
  52. package/static/dashboard/assets/studio-BxUhJp0u.js +1 -0
  53. package/static/dashboard/assets/{studio-pFbLfSmh.js → studio-Dg6dFTZ5.js} +1 -1
  54. package/static/dashboard/assets/studio.index-N5sIdor3.js +1 -0
  55. package/static/dashboard/assets/studio.integrations-ZAlVFGVw.js +16 -0
  56. package/static/dashboard/assets/studio.members-r1I_P9vv.js +6 -0
  57. package/static/dashboard/assets/studio.plan-B5CWlvB1.js +1 -0
  58. package/static/dashboard/assets/{sun-CK52_1CD.js → sun-B2KoVsUv.js} +1 -1
  59. package/static/dashboard/assets/{switch-CHmJ_Ipt.js → switch-DmO3bJxP.js} +1 -1
  60. package/static/dashboard/assets/{table-DoCG5L_o.js → table-D3lWzaas.js} +1 -1
  61. package/static/dashboard/assets/{useAriaLabelledBy-DcwFG0Pf.js → useAriaLabelledBy-BVVmb5Zj.js} +1 -1
  62. package/static/dashboard/assets/{useBaseQuery-C_54ul4D.js → useBaseQuery-BBU42uTr.js} +1 -1
  63. package/static/dashboard/assets/{useCompositeItem-6LQEohxr.js → useCompositeItem-BZX9S0sx.js} +1 -1
  64. package/static/dashboard/assets/useQuery-CGx36E5q.js +1 -0
  65. package/static/dashboard/assets/useRender-CNreHlDo.js +1 -0
  66. package/static/dashboard/assets/useScrollLock-DV4rQnvf.js +1 -0
  67. package/static/dashboard/assets/{useValueChanged-BuDWW6rb.js → useValueChanged-BcwdNwDJ.js} +1 -1
  68. package/static/dashboard/assets/{users-BkLZaCQc.js → users-BxyUqa0S.js} +1 -1
  69. package/static/dashboard/assets/{welcome-C-lgK9ve.js → welcome-9qfwvdaq.js} +3 -3
  70. package/static/dashboard/assets/widget-signin-x6glMrne.js +1 -0
  71. package/static/dashboard/assets/you-C3HTpoDt.js +1 -0
  72. package/static/dashboard/assets/{zod-D1EnJi4o.js → zod-qyf6R6J-.js} +1 -1
  73. package/static/dashboard/index.html +1 -1
  74. package/static/widget/build.json +2 -2
  75. package/static/widget/snag.js +1 -1
  76. package/static/widget/snag.runtime.js +1 -1
  77. package/static/dashboard/assets/InstanceRows-DnLIQuI5.js +0 -1
  78. package/static/dashboard/assets/McpTokens-BmJUgHlN.js +0 -1
  79. package/static/dashboard/assets/activity-DNpom_Jb.js +0 -1
  80. package/static/dashboard/assets/card-CzVTF25b.js +0 -1
  81. package/static/dashboard/assets/index-X11XkRkb.js +0 -162
  82. package/static/dashboard/assets/invite-Dn8Q_z-a.js +0 -1
  83. package/static/dashboard/assets/me-DnLqgT3l.js +0 -1
  84. package/static/dashboard/assets/parts-DVVBI72d.js +0 -6
  85. package/static/dashboard/assets/s._site.reviewers-BavfDGJ3.js +0 -1
  86. package/static/dashboard/assets/s._site.settings-CSqVsJgO.js +0 -1
  87. package/static/dashboard/assets/sites-Ba4z7pZr.js +0 -1
  88. package/static/dashboard/assets/studio-BJqd3NIo.js +0 -1
  89. package/static/dashboard/assets/studio.index-C3Q-z9vR.js +0 -1
  90. package/static/dashboard/assets/studio.integrations-DNCgc9H5.js +0 -16
  91. package/static/dashboard/assets/studio.members-BmKyP0gU.js +0 -6
  92. package/static/dashboard/assets/studio.plan-CrdqMbik.js +0 -1
  93. package/static/dashboard/assets/useQuery-CCJBm2EJ.js +0 -1
  94. package/static/dashboard/assets/useRender-BZe0PUs7.js +0 -1
  95. package/static/dashboard/assets/useScrollLock-DDlrhOw8.js +0 -1
  96. package/static/dashboard/assets/widget-signin-DiXUP4GV.js +0 -1
  97. package/static/dashboard/assets/you-BHn-aWRM.js +0 -1
@@ -0,0 +1 @@
1
+ import{d as Q,r as p,ah as P,j as e,ac as H,a5 as J,a7 as K,B as b,ai as A,ad as D,F as M,v as R,am as z,H as G}from"./index-CUBD0DcL.js";import{P as E}from"./Picker-BvdKGeU8.js";import{u as W}from"./useQuery-CGx36E5q.js";import{B as O}from"./badge-Cwf-GPv8.js";import{i as F,j as _,l as B,k as $,m as I,n as q}from"./dialog-CjX41K4h.js";import{L as C,I as U}from"./label-BoGrNcZ0.js";import{S as Y}from"./switch-DmO3bJxP.js";import{C as V}from"./ConfirmDialog-B5-FUf01.js";import{C as w}from"./CopyButton-CDVY09FZ.js";function ce({owner:n,instanceOwner:i,operator:g,sites:v,mine:h=!1}){const o=Q(),a=W(M.mcpTokens()),[x,u]=p.useState(!1),[l,m]=p.useState(null),[c,j]=p.useState(null),k=P({mutationFn:t=>R.revokeMcpToken(t),onSuccess:()=>{j(null),o.invalidateQueries({queryKey:["mcp-tokens"]})},onError:t=>A.error(D(t))}),f=a.data?.data??[],N=f.filter(t=>!t.revokedAt),d=a.data?.http??null,y=P({mutationFn:t=>R.setMcpHttp(t),onSuccess:(t,s)=>{o.setQueryData(M.instance().queryKey,t),o.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(s?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:t=>A.error(D(t))}),S=t=>{const s=new Set(t),r=s.has("comments:write")||s.has("threads:write");return!r&&!s.has("context:read")?"Read-only":r?`Writes: ${[s.has("comments:write")?"reply":"",s.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(H,{title:h?"Your agent tokens":"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[a.isPending&&e.jsx(J,{rows:2}),d&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[d.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),d.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":i?"":g?" Only an owner can switch it.":" Only whoever runs this server can switch it."]})]}),e.jsx(Y,{id:"mcp-http-on","aria-label":"Remote transport",checked:d.enabled,disabled:!i||d.source==="env"||y.isPending,onCheckedChange:t=>y.mutate(t)})]}),a.isSuccess&&N.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{variant:"outline",children:f.length>0?"No active tokens":"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:h?"You have no agent tokens yet.":"No agent can read this studio yet."})]}),f.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:f.map(t=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${t.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[t.prefix,"…"]}),e.jsx(O,{variant:"outline",className:t.revokedAt?"":"border-ok text-ok",children:t.revokedAt?"Revoked":S(t.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[t.site?t.site.name:"All sites"," · ",t.lastUsedAt?`last used ${K(t.lastUsedAt)}`:"never used",t.expiresAt&&!t.revokedAt?` · expires ${new Date(t.expiresAt).toLocaleDateString()}`:"",t.createdBy?` · by ${t.createdBy}`:""]}),t.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>j(t),children:"Revoke"})})]},t.id))}),n&&e.jsx("div",{children:e.jsx(b,{variant:"outline",size:"sm",onClick:()=>u(!0),children:"New token…"})}),e.jsx(X,{open:x,onOpenChange:u,sites:v,http:a.data?.http??null,onDone:t=>{o.invalidateQueries({queryKey:["mcp-tokens"]}),m(t)}}),e.jsx(Z,{state:l,http:a.data?.http??null,onClose:()=>m(null)}),e.jsx(V,{open:c!==null,onOpenChange:t=>!t&&j(null),title:`Revoke “${c?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:k.isPending,onConfirm:async()=>{c&&await k.mutateAsync(c.id)}})]})}function X({open:n,onOpenChange:i,sites:g,http:v,onDone:h}){const[o,a]=p.useState(""),[x,u]=p.useState(""),[l,m]=p.useState(["threads:read","source:map"]),[c,j]=p.useState(""),[k,f]=p.useState(!1),[N,d]=p.useState(""),y=P({mutationFn:()=>R.mintMcpToken({name:o.trim(),...x?{site:x}:{},scopes:l,...c?{expiresInDays:Number(c)}:{},...k?{allowRemoteWrites:!0}:{}})}),S=(s,r)=>m(T=>r?[...new Set([...T,s])]:T.filter(L=>L!==s)),t=async s=>{s.preventDefault(),d("");try{const r=await y.mutateAsync();a(""),u(""),m(["threads:read","source:map"]),j(""),f(!1),i(!1),h(r)}catch(r){d(r instanceof G?r.message:"Could not reach the server.")}};return e.jsx(F,{open:n,onOpenChange:i,children:e.jsx(_,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx($,{children:"New agent token"}),e.jsx(I,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),N&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:N}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(U,{id:"mcp-name",placeholder:"Claude Code",value:o,onChange:s=>a(s.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsx(E,{id:"mcp-site",value:x,onChange:u,options:[{value:"",label:"All sites"},...g.map(s=>({value:s.uid,label:s.name}))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),z.map(s=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l.includes(s.scope),onChange:r=>S(s.scope,r.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s.hint})]})]},s.scope))]}),v?.enabled&&(l.includes("comments:write")||l.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:s=>f(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsx(E,{id:"mcp-expires",value:c,onChange:j,options:[{value:"",label:"Never"},{value:"30",label:"In 30 days"},{value:"90",label:"In 90 days"},{value:"365",label:"In a year"}]})]}),e.jsxs(q,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(b,{type:"submit",loading:y.isPending,disabled:!o.trim()||l.length===0,children:y.isPending?"Minting…":"Create token"})]})]})})})}function Z({state:n,http:i,onClose:g}){const v=typeof location<"u"?location.origin:"",h={SNAGSET_MCP_TOKEN:n?.secret??"",SNAGSET_MCP_HOST:v,...n?.token.site?{SNAGSET_MCP_PROJECT:n.token.site.uid}:{}},o=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:h}}},null,2),a=["claude mcp add snagset",...Object.entries(h).map(([m,c])=>`-e ${m}=${c}`),"--","npx -y @snagset/mcp"].join(" "),x=`Bearer ${n?.secret??""}`,u=["claude mcp add","--transport http","snagset",i?.url??"",`--header "Authorization: ${x}"`].join(" "),l=JSON.stringify({mcpServers:{snagset:{type:"http",url:i?.url??"",headers:{Authorization:x}}}},null,2);return e.jsx(F,{open:n!==null,onOpenChange:m=>!m&&g(),children:e.jsxs(_,{className:"sm:max-w-xl",children:[e.jsxs(B,{children:[e.jsxs($,{children:["Token for “",n?.token.name??"","”"]}),e.jsx(I,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),n&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:n.secret}),e.jsx(w,{text:n.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(w,{text:a,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:a})]}),i?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(w,{text:l,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:u}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(w,{text:o,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:o}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(q,{children:e.jsx(b,{type:"button",onClick:g,children:"Done"})})]})})}export{ce as M};
@@ -1,6 +1,6 @@
1
- import{c as Xt,ai as Nt,e as xe,l as Gt,r as s,i as vt,j as h,aG as At,f as He,m as ht,E as Kt,al as Jt,aj as Ot,k as Te,g as ft,h as Fe}from"./index-X11XkRkb.js";import{C as Lt}from"./chevron-down-865lxBex.js";import{C as Qt}from"./check-BlRwZrSR.js";import{J as Zt,a7 as en,P as tn,R as nn,a8 as c,l as Ht,g as on,F as sn,x as rn,y as ln,m as nt,a9 as an,a4 as cn,t as un,N as dn,O as fn,Q as pn,C as gn,a as mn,M as hn,q as xn,aa as bn}from"./useScrollLock-DDlrhOw8.js";import{i as Sn}from"./isElementDisabled-CwHw_lZC.js";import{w as vn,e as yn,h as Ft,A as Dt,k as Ct,l as Rn,x as wn,s as In,c as Ie,n as st,j as Tn,f as Mn,o as xt,a as pt,z as En,B as An,r as gt}from"./createBaseUIEventDetails-CTYgZt5m.js";import{a as yt,u as it,i as Cn,d as Pn,t as Rt,C as Vn}from"./inertValue-CLaAaX62.js";import{s as bt}from"./serializeValue-B8e3iXO-.js";import{u as jn}from"./useValueChanged-BuDWW6rb.js";import{d as Nn,h as On,e as Ln,f as Hn,i as Fn,c as Dn,u as kn,a as Un,b as Bn,p as _n,r as zn,g as Wn}from"./getPseudoElementBounds-CFaDUKhY.js";import{C as Yn,a as qn,u as $n}from"./CompositeList-OHWH8W1h.js";/**
1
+ import{c as Xt,av as Lt,e as xe,l as Gt,r as s,i as vt,j as h,aT as At,f as He,m as ht,E as Kt,ay as Jt,aw as Nt,k as Te,g as ft,h as Fe}from"./index-CUBD0DcL.js";import{C as Ot}from"./chevron-down-OinKSKsq.js";import{C as Zt}from"./check-26YOtWVN.js";import{E as Qt,a2 as en,P as tn,R as nn,a3 as c,l as Ht,g as on,F as sn,v as rn,r as ln,m as nt,a4 as an,$ as cn,t as un,J as dn,K as fn,L as pn,y as gn,a as mn,I as hn,q as xn,a5 as bn}from"./useScrollLock-DV4rQnvf.js";import{i as Sn}from"./isElementDisabled-CwHw_lZC.js";import{w as vn,e as yn,h as Ft,A as Dt,k as Ct,l as Rn,x as wn,s as In,c as Ie,n as st,j as Tn,f as Mn,o as xt,a as pt,z as En,B as An,r as gt}from"./createBaseUIEventDetails-BlUeVOHL.js";import{a as yt,u as it,i as Cn,d as Pn,t as Rt,C as Vn}from"./inertValue-BxLh7N1J.js";import{s as bt}from"./serializeValue-B8e3iXO-.js";import{u as jn}from"./useValueChanged-BcwdNwDJ.js";import{d as Ln,h as Nn,e as On,f as Hn,i as Fn,c as Dn,u as kn,a as Un,b as Bn,p as _n,r as zn,g as Wn}from"./getPseudoElementBounds-087ogDm1.js";import{C as Yn,a as $n,u as qn}from"./CompositeList-CDfO6SCy.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Xn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gn=Xt("chevron-up",Xn);function Kn(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,u=vn(),p=Zt()!=null,r=Nt(()=>new en({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new tn,floatingId:u,syncOnly:!1,nested:p})).current;return xe(()=>{const d={open:t,floatingId:u};o.reference!==void 0&&(d.referenceElement=o.reference,d.domReferenceElement=Gt(o.reference)?o.reference:null),o.floating!==void 0&&(d.floatingElement=o.floating),r.update(d)},[t,u,o.reference,o.floating,r]),r.context.onOpenChange=n,r.context.nested=p,r}function Jn(e){const[t,n]=s.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const Qn=s.createContext(void 0),Zn={disableStyleElements:!1};function eo(){return s.useContext(Qn)??Zn}function to(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const kt=s.createContext(null);function be(){const e=s.useContext(kt);if(e===null)throw new Error(vt(60));return e}const no=(e,t)=>Object.is(e,t);function We(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:We(o,t,n))}function oo(e,t,n){return e.filter(o=>!We(t,o,n))}function Ut(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function so(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ut(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Bt(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return bt(e)}function ze(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?bt(e.value):bt(e)}function _t(e,t,n){function o(){return Bt(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const u=t,p=Ut(u)?u.flatMap(r=>r.items):u;if(e==null||typeof e!="object"){const r=p.find(d=>d.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=p.find(d=>d&&d.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function ro(e,t,n){return e.reduce((o,u,p)=>(p>0&&o.push(", "),o.push(h.jsx(s.Fragment,{children:_t(u,t,n)},p)),o),[])}const a={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ze(t,o)!==""},hasNullItemLabel:(e,t)=>t?so(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(u=>We(t,u,n)):We(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function lo(e,t,n=(o,u)=>o===u){return e.length===t.length&&e.every((o,u)=>n(o,t[u]))}function $e(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const ge=1;function wt(e,t){return Math.max(0,e-t)}function rt(e,t){if(t<=0)return 0;const n=$e(e,0,t),o=n,u=t-n,p=o<=ge,r=u<=ge;return p&&r?o<=u?0:t:p?0:r?t:n}function io(e){const{id:t,value:n,defaultValue:o=null,onValueChange:u,open:p,defaultOpen:r=!1,onOpenChange:d,name:g,form:i,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:I=!1,modal:C=!0,actionsRef:U,inputRef:S,onOpenChangeComplete:Y,items:L,multiple:T=!1,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B=no,highlightItemOnHover:N=!0,children:q}=e,{clearErrors:O}=yn(),{setDirty:ue,setTouched:$,setFocused:le,validityData:K,setFilled:H,name:V,disabled:J,validation:R,validationMode:ne}=Ft(),_=Dt({id:t}),P=J||b,l=V??g,[m,Q]=Ct({controlled:n,default:T?o??At:o,name:"Select",state:"value"}),[F,oe]=Ct({controlled:p,default:r,name:"Select",state:"open"}),f=s.useRef([]),v=s.useRef([]),D=s.useRef(null),ee=s.useRef(null),Se=s.useRef(0),E=s.useRef(null),X=s.useRef([]),z=s.useRef(!1),de=s.useRef(null),Z=s.useRef(null),se=s.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=s.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:W}=yt(F),{openMethod:G,triggerProps:ae}=Nn(F),A=Nt(()=>new nn({id:_,labelId:void 0,modal:C,multiple:T,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,value:m,open:F,mounted:ie,transitionStatus:W,items:L,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Me=c(A,a.activeIndex),ve=c(A,a.selectedIndex),ye=c(A,a.triggerElement),ce=c(A,a.positionerElement),je=Jn(G),Ne=G??je,te=s.useMemo(()=>T?"":ze(m,j),[T,m,j]),at=s.useMemo(()=>T&&Array.isArray(m)?m.map(w=>ze(w,j)):ze(m,j),[T,m,j]),Ge=Ht(ye),Re=He(()=>at);Rn(Ge,_,m,Re,!P,g);const ct=s.useRef(m),Ye=T?Array.isArray(m)&&m.length>0:m!=null&&te!=="";xe(()=>{H(Ye)},[Ye,H]),xe(function(){let k=m,we=!1;if(T){const Le=Array.isArray(m)?m:[];we=Le.length===0,k=Le[Le.length-1]}const Pe=we?-1:ot(X.current,k,B),Ve=Pe===-1?null:Pe;Ve===null&&(Z.current=null),!F&&A.set("selectedIndex",Ve)},[T,F,m,B,A]);function me(w){const k=K.initialValue;return Array.isArray(w)&&Array.isArray(k)?!lo(w,k,(we,Pe)=>We(we,Pe,B)):w!==k}jn(m,()=>{O(l),ue(me(m)),R.change(m)});const De=He((w,k)=>{d?.(w,k),!k.isCanceled&&(oe(w),!w&&(k.reason===wn||k.reason===In)&&($(!0),le(!1),ne==="onBlur"&&R.commit(m)))}),ke=He(()=>{fe(!1),A.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),Y?.(!1)});it({enabled:!U,open:F,ref:D,onComplete(){F||ke()}}),s.useImperativeHandle(U,()=>({unmount:ke}),[ke]);const Ee=He((w,k)=>{u?.(w,k),!k.isCanceled&&Q(w)}),he=He(w=>{const k=wt(w.scrollHeight,w.clientHeight),we=rt(w.scrollTop,k),Pe=we>0,Ve=we<k;A.set("scrollUpArrowVisible",Pe),A.set("scrollDownArrowVisible",Ve)}),Ae=Kn({open:F,onOpenChange:De,elements:{reference:ye,floating:ce}}),Ue=On(Ae,{enabled:!y&&!P,event:"mousedown"}),Be=on(Ae),Ce=Ln(Ae,{enabled:!y&&!P,listRef:f,activeIndex:Me,selectedIndex:ve,disabledIndices:At,onNavigate(w){w===null&&!F||A.set("activeIndex",w)},focusItemOnHover:N}),Oe=Hn(Ae,{enabled:!y&&!P&&(F||!T),listRef:v,activeIndex:Me,selectedIndex:ve,disabledIndices:w=>Sn(f.current[w]),onMatch(w){F?A.set("activeIndex",w):Ee(X.current[w],Ie(st))},onTyping(w){z.current=w}}),Ke=s.useMemo(()=>ht(Oe.reference,Ce.reference,Be.reference,Ue.reference,ae),[Ue.reference,Oe.reference,Ce.reference,Be.reference,ae]),Je=s.useMemo(()=>ht(sn,Oe.floating,Ce.floating,Be.floating),[Oe.floating,Ce.floating,Be.floating]),Qe=Ce.item??Kt;to(()=>{A.update({popupProps:Je,triggerProps:Ke})}),A.useSyncedValues({id:_,modal:C,multiple:T,value:m,open:F,mounted:ie,transitionStatus:W,popupProps:Je,triggerProps:Ke,items:L,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,openMethod:Ne});const pe=s.useMemo(()=>({store:A,floatingContext:Ae,required:I,disabled:P,readOnly:y,multiple:T,highlightItemOnHover:N,setValue:Ee,setOpen:De,listRef:f,popupRef:D,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:Se,itemProps:Qe,valueRef:E,valuesRef:X,labelsRef:v,typingRef:z,selectionRef:se,firstItemTextRef:de,selectedItemTextRef:Z,validation:R,onOpenChangeComplete:Y,alignItemWithTriggerActiveRef:re,initialValueRef:ct}),[A,Ae,I,P,y,T,N,Ee,De,Qe,R,Y,he]),_e=Jt(S,R.inputRef),qe=T?void 0:l,ut=s.useMemo(()=>!T||!Array.isArray(m)||!l?null:m.map(w=>{const k=ze(w,j);return h.jsx("input",{type:"hidden",form:i,name:l,value:k,disabled:P},k)}),[T,m,i,l,j,P]);return h.jsxs(kt.Provider,{value:pe,children:[q,h.jsx("input",{...R.getValidationProps(P,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(w){if(w.nativeEvent.defaultPrevented||P||y)return;const k=w.currentTarget.value,we=Ie(st,w.nativeEvent);function Pe(){if(T)return;const Ve=k.toLowerCase();let Le=X.current.findIndex(dt=>ze(dt,j).toLowerCase()===Ve||Bt(dt,M).toLowerCase()===Ve);Le===-1&&(Le=X.current.findIndex((dt,$t)=>{const Et=v.current[$t];return Et!=null&&Et.toLowerCase()===Ve}));const Mt=X.current[Le];Mt!=null&&Ee(Mt,we)}A.set("forceMount",!0),queueMicrotask(Pe)}}),id:_&&qe==null?`${_}-hidden-input`:void 0,form:i,name:qe,autoComplete:x,value:te,disabled:P,required:I&&!(T&&Ye),readOnly:y,ref:_e,style:l?rn:ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ut]})}function ao(e,t){return e??t}const co=400,uo={...cn,...Mn,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},fo=s.forwardRef(function(t,n){const{render:o,className:u,id:p,disabled:r=!1,nativeButton:d=!0,style:g,...i}=t,{setTouched:x,setFocused:b,validationMode:y,state:I,disabled:C}=Ft(),{labelId:U}=Tn(),{store:S,setOpen:Y,selectionRef:L,validation:T,readOnly:M,required:j,alignItemWithTriggerActiveRef:B,disabled:N}=be(),q=C||N||r,O=c(S,a.open),ue=c(S,a.mounted),$=c(S,a.value),le=c(S,a.triggerProps),K=c(S,a.positionerElement),H=c(S,a.listElement),V=c(S,a.popupSide),J=c(S,a.id),R=c(S,a.labelId),ne=c(S,a.hasSelectedValue),_=ue&&K?V:null,P=p??J,l=ao(U,R);Dt({id:P});const m=Ht(K),Q=s.useRef(null),{getButtonProps:F,buttonRef:oe}=Ot({disabled:q,native:d}),f=S.useStateSetter("triggerElement"),v=nt(),D=nt(),ee=nt();s.useEffect(()=>{if(O)return ee.start(co,()=>{L.current.allowUnselectedMouseUp=!0,L.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};L.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},D.clear()},[O,L,D,ee]);const Se=ht(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?H?.id??an(K)?.id:void 0,"aria-labelledby":l,"aria-readonly":M||void 0,"aria-required":j||void 0,tabIndex:q?-1:0,onFocus(z){b(!0),O&&B.current&&Y(!1,Ie(st,z.nativeEvent)),v.start(0,()=>{S.set("forceMount",!0)})},onBlur(z){pt(K,z.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&T.commit($))},onMouseDown(z){if(O)return;const de=xt(z.currentTarget);function Z(se){if(!Q.current)return;const re=se.target;pt(Q.current,re)||pt(m.current,re)||Fn(se,Q.current)||Y(!1,Ie(En,se))}D.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},i,F),E=T.getValidationProps(q,Se);E.role="combobox";const X={...I,open:O,disabled:q,value:$,readOnly:M,popupSide:_,placeholder:!ne};return Te("button",t,{ref:[n,Q,oe,f],state:X,stateAttributesMapping:uo,props:E})}),po={value:()=>null},go=s.forwardRef(function(t,n){const{className:o,render:u,children:p,placeholder:r,style:d,...g}=t,{store:i,valueRef:x}=be(),b=c(i,a.value),y=c(i,a.items),I=c(i,a.itemToStringLabel),C=c(i,a.hasSelectedValue),U=!C&&r!=null&&p==null,S=c(i,a.hasNullItemLabel,U),Y={value:b,placeholder:!C};let L=null;return typeof p=="function"?L=p(b):p!=null?L=p:U&&!S?L=r:Array.isArray(b)?L=ro(b,y,I):L=_t(b,y,I),Te("span",t,{state:Y,ref:[n,x],props:[{children:L},g],stateAttributesMapping:po})}),mo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d}=be(),i={open:c(d,a.open)};return Te("span",t,{state:i,ref:n,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:un})}),ho=s.forwardRef(function(t,n){const{store:o}=be(),u=c(o,a.mounted),p=c(o,a.forceMount);return u||p?h.jsx(dn,{ref:n,...t}):null}),zt=s.createContext(void 0);function It(){const e=s.useContext(zt);if(!e)throw new Error(vt(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const Wt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},xo={position:"fixed"},bo=s.forwardRef(function(t,n){const{anchor:o,className:u,render:p,positionMethod:r,side:d,align:g,sideOffset:i,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:I,sticky:C,disableAnchorTracking:U,alignItemWithTrigger:S=!0,collisionAvoidance:Y=fn,style:L,...T}=t,{store:M,listRef:j,labelsRef:B,alignItemWithTriggerActiveRef:N,selectedItemTextRef:q,valuesRef:O,initialValueRef:ue,popupRef:$,setValue:le,floatingContext:K}=be(),H=c(M,a.open),V=c(M,a.mounted),J=c(M,a.modal),R=c(M,a.value),ne=c(M,a.openMethod),_=c(M,a.positionerElement),P=c(M,a.triggerElement),l=c(M,a.isItemEqualToValue),m=c(M,a.transitionStatus),Q=s.useRef(null),F=s.useRef(null),[oe,f]=s.useState(S),v=V&&oe&&ne!=="touch";!V&&oe!==S&&f(S),s.useImperativeHandle(N,()=>v),Dn((v||J)&&H,ne==="touch",_,P);const D=kn({anchor:o,floatingRootContext:K,positionMethod:r,mounted:V,side:d,sideOffset:i,align:g,alignOffset:x,arrowPadding:I,collisionBoundary:b,collisionPadding:y,sticky:C,disableAnchorTracking:U??v,collisionAvoidance:Y,keepMounted:!0}),ee=v?"none":D.side,Se=v?xo:D.positionerStyles,E={open:H,side:ee,align:D.align,anchorHidden:D.anchorHidden};xe(()=>{M.set("popupSide",D.side)},[M,D.side]);const X=M.useStateSetter("positionerElement"),z=Un(t,E,{styles:Se,transitionStatus:m,props:T,refs:[n,X],hidden:!V,inert:!H}),de=s.useRef(0),Z=He(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Ie(st);if(ie!==0&&!M.state.multiple&&R!==null&&ot(O.current,R,l)===-1){const G=ue.current,A=G!=null&&ot(O.current,G,l)!==-1?G:null;le(A,fe),A===null&&(M.set("selectedIndex",null),q.current=null)}if(ie!==0&&M.state.multiple&&Array.isArray(R)){const W=R.filter(G=>ot(O.current,G,l)!==-1);W.length!==R.length&&(le(W,fe),W.length===0&&(M.set("selectedIndex",null),q.current=null))}if(H&&v){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const W={height:""};lt(_,W),lt($.current,W)}}),se=s.useMemo(()=>({...D,side:ee,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:f,scrollUpArrowRef:Q,scrollDownArrowRef:F}),[D,ee,v,f]);return h.jsx(Yn,{elementsRef:j,labelsRef:B,onMapChange:Z,children:h.jsxs(zt.Provider,{value:se,children:[V&&J&&h.jsx(pn,{inert:Cn(!H),cutout:P}),z]})})}),Ze="base-ui-disable-scrollbar",St={className:Ze,getElement(e){return h.jsx("style",{nonce:e,href:Ze,precedence:"base-ui:low",children:`.${Ze}{scrollbar-width:none}.${Ze}::-webkit-scrollbar{display:none}`})}},So={...xn,...Rt},vo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,finalFocus:r,...d}=t,{store:g,popupRef:i,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:I,selectedItemTextRef:C,multiple:U,handleScrollArrowVisibility:S,scrollHandlerRef:Y,listRef:L,highlightItemOnHover:T,floatingContext:M}=be(),{side:j,align:B,alignItemWithTriggerActive:N,isPositioned:q,setControlledAlignItemWithTrigger:O}=It(),ue=Bn()!=null,$=qn(),{nonce:le,disableStyleElements:K}=eo(),H=c(g,a.id),V=c(g,a.open),J=c(g,a.openMethod),R=c(g,a.mounted),ne=c(g,a.popupProps),_=c(g,a.transitionStatus),P=c(g,a.triggerElement),l=c(g,a.positionerElement),m=c(g,a.listElement),Q=s.useRef(!1),F=s.useRef(!1),oe=s.useRef({}),f=Pn(),v=He(E=>{if(!l||!i.current||!F.current)return;const X=l.style.top==="0px",z=l.style.bottom==="0px";if(Q.current||!N||!X&&!z){S(E);return}const de=Vt(l),Z=Xe(l.getBoundingClientRect().height,"y",de),se=xt(l),re=ft(l),ie=re.getComputedStyle(l),fe=parseFloat(ie.marginTop),W=parseFloat(ie.marginBottom),G=Pt(re.getComputedStyle(i.current)),ae=Math.min(se.documentElement.clientHeight-fe-W,G),A=E.scrollTop,Me=et(E);let ve=null;const ye=te=>{l.style.height=`${te}px`},ce=X?Me-A:A,je=Math.min(Z+ce,ae);if(ce<=ge){const te=$e(ce,0,ae-Z);te>0&&ye(Z+te),E.scrollTop=X?Me:0,ae-(Z+te)<=ge&&(Q.current=!0),S(E);return}if(ae-je>ge)ve=X?1/0:0;else if(z&&A<Me){const te=Z+ce-ae;ve=A-(ce-te)}const Ne=Math.ceil(je);if(Ne!==0&&ye(Ne),ve!=null){const te=$e(ve,0,et(E));Math.abs(E.scrollTop-te)>ge&&(E.scrollTop=te)}Ne>=ae-ge&&(Q.current=!0),S(E)});s.useImperativeHandle(Y,()=>v,[v]),it({open:V,ref:i,onComplete(){V&&x?.(!0)}});const D={open:V,transitionStatus:_,side:j,align:B};xe(()=>{!l||!i.current||Object.keys(oe.current).length||(oe.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[i,l]),xe(()=>{V||N||(F.current=!1,Q.current=!1,lt(l,oe.current))},[V,N,l,i]),xe(()=>{const E=i.current;if(!V||!P||!l||!E||N&&!q||g.state.transitionStatus==="ending")return;if(F.current=!0,E.style.removeProperty("--transform-origin"),!N){f.request(()=>S(m||E));return}const X=yo(E);try{let z=C.current;z?.isConnected||(z=!a.hasSelectedValue(g.state)&&I.current?.isConnected?I.current:null);const de=y.current,Z=ft(l),se=Z.getComputedStyle(l),re=Z.getComputedStyle(E),ie=xt(P),fe=Vt(P),W=tt(P.getBoundingClientRect(),fe),G=tt(l.getBoundingClientRect(),fe),ae=W.height,A=m||E,Me=A.scrollHeight,ve=parseFloat(re.borderBottomWidth),ye=parseFloat(se.marginTop)||10,ce=parseFloat(se.marginBottom)||10,je=parseFloat(se.minHeight)||100,Ne=Pt(re),te=5,at=5,Ge=20,Re=ie.documentElement.clientHeight-ye-ce,ct=ie.documentElement.clientWidth,Ye=Re-W.bottom+ae;let me,De=$==="rtl"?W.right-G.width:W.left,ke=0;if(z&&de){const pe=tt(de.getBoundingClientRect(),fe);me=tt(z.getBoundingClientRect(),fe),De=G.left+($==="rtl"?pe.right-me.right:pe.left-me.left);const _e=pe.top-W.top+pe.height/2;ke=me.top-G.top+me.height/2-_e}const Ee=Ye+ke+ce+ve;let he=Math.min(Re,Ee);const Ae=Re-ye-ce,Ue=Ee-he,Be=ct-at;l.style.left=`${$e(De,te,Be-G.width)}px`,l.style.height=`${he}px`,l.style.maxHeight="none",l.style.marginTop=`${ye}px`,l.style.marginBottom=`${ce}px`,E.style.height="100%";const Ce=et(A),Oe=Ue>=Ce-ge;Oe&&(he=Math.min(Re,G.height)-(Ue-Ce));const Ke=W.top<Ge||W.bottom>Re-Ge||Math.ceil(he)+ge<Math.min(Me,je),Je=(Z.visualViewport?.scale??1)!==1&&gn;if(Ke||Je){lt(l,oe.current),O(!1);return}const Qe=Math.max(je,he);if(Oe){const pe=Math.max(0,Re-Ee);l.style.top=G.height>=Ae?"0":`${pe}px`,l.style.height=`${he}px`,A.scrollTop=et(A)}else l.style.bottom="0",A.scrollTop=Ue;if(me){const pe=G.top,_e=G.height,qe=me.top+me.height/2,ut=$e(_e>0?(qe-pe)/_e*100:50,0,100);E.style.setProperty("--transform-origin",`50% ${ut}%`)}(Qe===Re||he>=Ne)&&(Q.current=!0),S(A),T&&g.state.selectedIndex===null&&g.state.activeIndex===null&&L.current[0]!=null&&g.set("activeIndex",0)}finally{X()}},[g,V,l,P,y,I,C,i,S,N,O,f,m,L,T,$,q]),s.useEffect(()=>{if(!N||!l||!V)return;const E=ft(l);function X(z){b(!1,Ie(An,z))}return mn(E,"resize",X)},[b,N,l,V]);const ee={...m?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${H}-list`},onKeyDown(E){ue&&Vn.has(E.key)&&E.stopPropagation()},onScroll(E){m||v(E.currentTarget)},...N&&{style:m?{height:"100%"}:Wt},className:!m&&N?St.className:void 0},Se=Te("div",t,{ref:[n,i],state:D,stateAttributesMapping:So,props:[ne,ee,Wn(_),d]});return h.jsxs(s.Fragment,{children:[!K&&St.getElement(le),h.jsx(hn,{context:M,modal:!1,disabled:!R,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:Se})]})});function Pt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function et(e){return wt(e.scrollHeight,e.clientHeight)}function Vt(e){return _n.getScale(e)}function Xe(e,t,n){return e/n[t]}function tt(e,t){return zn({x:Xe(e.x,"x",t),y:Xe(e.y,"y",t),width:Xe(e.width,"x",t),height:Xe(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function yo(e){const{style:t}=e,n={};for(const[o,u]of jt)n[o]=t.getPropertyValue(o),t.setProperty(o,u,"important");return()=>{for(const[o]of jt){const u=n[o];u?t.setProperty(o,u):t.removeProperty(o)}}}const Ro=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d,scrollHandlerRef:g,multiple:i}=be(),{alignItemWithTriggerActive:x}=It(),b=c(d,a.hasScrollArrows),y=c(d,a.openMethod),C={id:`${c(d,a.id)}-list`,role:"listbox","aria-multiselectable":i||void 0,onScroll(S){g.current?.(S.currentTarget)},...x&&{style:Wt},className:b&&y!=="touch"?St.className:void 0},U=d.useStateSetter("listElement");return Te("div",t,{ref:[n,U],props:[C,r]})}),Yt=s.createContext(void 0);function Tt(){const e=s.useContext(Yt);if(!e)throw new Error(vt(57));return e}const wo=s.memo(s.forwardRef(function(t,n){const{render:o,className:u,style:p,value:r=null,label:d,disabled:g=!1,nativeButton:i=!1,...x}=t,b=s.useRef(null),y=$n({guess:!0,label:d,textRef:b}),{store:I,itemProps:C,setOpen:U,setValue:S,selectionRef:Y,typingRef:L,valuesRef:T,multiple:M,selectedItemTextRef:j,disabled:B,readOnly:N}=be(),q=B||g,O=c(I,a.isActive,y.index),ue=c(I,a.open),$=c(I,a.isSelected,r),le=c(I,a.isSelectedByFocus,y.index),K=c(I,a.isItemEqualToValue),H=y.index,V=s.useRef(null);xe(()=>{const f=T.current;return f[H]=r,()=>{delete f[H]}},[H,r,T]),xe(()=>{const f=I.state.value;let v=f;M&&Array.isArray(f)&&(v=f.length>0?f[f.length-1]:void 0),v!==void 0&&We(r,v,K)&&(I.set("selectedIndex",H),b.current&&(j.current=b.current))},[H,M,K,I,r,j]);const J=s.useRef("mouse"),R=s.useRef(!1),{getButtonProps:ne,buttonRef:_}=Ot({disabled:q,focusableWhenDisabled:!0,native:i,composite:!0}),P={disabled:q,selected:$,highlighted:O};function l(f){if(B||N)return;const v=I.state.value;if(M){const D=Array.isArray(v)?v:[],ee=$?oo(D,r,K):[...D,r];S(ee,Ie(gt,f))}else S(r,Ie(gt,f)),U(!1,Ie(gt,f))}function m(){Y.current.dragY=0}const Q={role:"option","aria-selected":$,tabIndex:ue&&O?0:-1,onKeyDown(f){I.set("activeIndex",H),f.key===" "&&L.current&&f.preventDefault()},onClick(f){const v=J.current!=="touch",D=f.nativeEvent.pointerType,ee=v&&bn(f.nativeEvent)&&(D!==void 0||O),Se=v&&!ee&&!R.current;R.current=!1,!(q||Se)&&l(f.nativeEvent)},onPointerEnter(f){J.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const v=Y.current;v.dragY+=f.movementY,v.dragY**2>=64&&(v.allowUnselectedMouseUp=!0)}},onPointerDown(f){J.current=f.pointerType,R.current=!0,m()},onMouseUp(){if(m(),q||J.current==="touch"||R.current)return;const f=!Y.current.allowSelectedMouseUp&&$,v=!Y.current.allowUnselectedMouseUp&&!$;f||v||(R.current=!0,V.current?.click(),R.current=!1)}},F=Te("div",t,{ref:[_,n,y.ref,V],state:P,props:[C,Q,x,ne]}),oe=s.useMemo(()=>({selected:$,index:H,textRef:b,selectedByFocus:le}),[$,H,b,le]);return h.jsx(Yt.Provider,{value:oe,children:F})})),Io=s.forwardRef(function(t,n){const{selected:o}=Tt();return t.keepMounted||o?h.jsx(To,{...t,ref:n}):null}),To=s.memo(s.forwardRef((e,t)=>{const{render:n,className:o,style:u,keepMounted:p,...r}=e,{selected:d}=Tt(),g=s.useRef(null),{transitionStatus:i,setMounted:x}=yt(d),y=Te("span",e,{ref:[t,g],state:{selected:d,transitionStatus:i},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Rt});return it({open:d,ref:g,onComplete(){d||x(!1)}}),y})),Mo=s.memo(s.forwardRef(function(t,n){const{index:o,textRef:u,selectedByFocus:p}=Tt(),{firstItemTextRef:r,selectedItemTextRef:d}=be(),{render:g,className:i,style:x,...b}=t,y=s.useCallback(C=>{C&&(o===0&&(r.current=C),p&&(d.current=C))},[r,d,o,p]);return Te("div",t,{ref:[y,n,u],props:b})})),qt=s.forwardRef(function(t,n){const{render:o,className:u,style:p,direction:r,keepMounted:d,...g}=t,i=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=be(),{side:U,scrollDownArrowRef:S,scrollUpArrowRef:Y}=It(),L=i?a.scrollUpArrowVisible:a.scrollDownArrowVisible,T=c(x,L),M=c(x,a.openMethod),j=T&&M!=="touch",B=nt(),N=i?Y:S,{mounted:q,transitionStatus:O,setMounted:ue}=yt(j);xe(()=>(C.current+=1,x.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&x.set("hasScrollArrows",!1)}),[x,C]),it({open:j,ref:N,onComplete(){j||ue(!1)}});const K=Te("div",t,{ref:[n,N],state:{direction:r,visible:j,side:U,transitionStatus:O},props:[{"aria-hidden":!0,children:i?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||B.isStarted())return;x.set("activeIndex",null);function J(){const R=x.state.listElement??b.current;if(!R)return;x.set("activeIndex",null),I(R);const ne=wt(R.scrollHeight,R.clientHeight),_=rt(R.scrollTop,ne),P=_===(i?0:ne),l=y.current;if(_!==R.scrollTop&&(R.scrollTop=_),P){B.clear();return}if(l.length>0){const m=N.current?.offsetHeight||0;R.scrollTop=Eo(l,i,_,R.clientHeight,m,ne)}B.start(40,J)}B.start(40,J)},onMouseLeave(){B.clear()}},g],stateAttributesMapping:Rt});return q||d?K:null});function Eo(e,t,n,o,u,p){if(t){let x=0;const b=n+u-ge;for(let C=0;C<e.length;C+=1){const U=e[C];if(U&&U.offsetTop>=b){x=C;break}}const y=Math.max(0,x-1),I=e[y];return y<x&&I?rt(I.offsetTop-u,p):0}let r=e.length-1;const d=n+o-u+ge;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>d){r=Math.max(0,x-1);break}}const g=Math.min(e.length-1,r+1),i=e[g];return g>r&&i?rt(i.offsetTop+i.offsetHeight-o+u,p):p}const Ao=s.forwardRef(function(t,n){return h.jsx(qt,{...t,ref:n,direction:"down"})}),Co=s.forwardRef(function(t,n){return h.jsx(qt,{...t,ref:n,direction:"up"})}),Po=io;function Vo({className:e,...t}){return h.jsx(go,{"data-slot":"select-value",className:Fe("flex flex-1 text-left",e),...t})}function jo({className:e,size:t="default",children:n,...o}){return h.jsxs(fo,{"data-slot":"select-trigger","data-size":t,className:Fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,h.jsx(mo,{render:h.jsx(Lt,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function No({className:e,children:t,side:n="bottom",sideOffset:o=4,align:u="center",alignOffset:p=0,alignItemWithTrigger:r=!0,...d}){return h.jsx(ho,{children:h.jsx(bo,{side:n,sideOffset:o,align:u,alignOffset:p,alignItemWithTrigger:r,className:"isolate z-50",children:h.jsxs(vo,{"data-slot":"select-content","data-align-trigger":r,className:Fe("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[h.jsx(Lo,{}),h.jsx(Ro,{children:t}),h.jsx(Ho,{})]})})})}function Oo({className:e,children:t,...n}){return h.jsxs(wo,{"data-slot":"select-item",className:Fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx(Mo,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),h.jsx(Io,{render:h.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:h.jsx(Qt,{className:"pointer-events-none"})})]})}function Lo({className:e,...t}){return h.jsx(Co,{"data-slot":"select-scroll-up-button",className:Fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Gn,{})})}function Ho({className:e,...t}){return h.jsx(Ao,{"data-slot":"select-scroll-down-button",className:Fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Lt,{})})}const mt="__none__";function Xo({id:e,value:t,onChange:n,options:o,className:u,size:p="default","aria-label":r,placeholder:d="Choose…"}){const g=o.map(i=>({value:i.value===""?mt:i.value,label:i.label}));return h.jsxs(Po,{items:g,value:t===""?mt:t,onValueChange:i=>i!=null&&n(i===mt?"":String(i)),children:[h.jsx(jo,{id:e,size:p,"aria-label":r,className:Fe("w-full bg-card",u),children:h.jsx(Vo,{children:i=>{const x=g.find(b=>b.value===i);return x?x.label:h.jsx("span",{className:"text-muted-foreground",children:d})}})}),h.jsx(No,{children:g.map(i=>h.jsx(Oo,{value:i.value,children:i.label},i.value))})]})}export{Xo as P,Po as S,jo as a,Vo as b,No as c,Oo as d};
6
+ */const Xn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gn=Xt("chevron-up",Xn);function Kn(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,u=vn(),p=Qt()!=null,r=Lt(()=>new en({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new tn,floatingId:u,syncOnly:!1,nested:p})).current;return xe(()=>{const d={open:t,floatingId:u};o.reference!==void 0&&(d.referenceElement=o.reference,d.domReferenceElement=Gt(o.reference)?o.reference:null),o.floating!==void 0&&(d.floatingElement=o.floating),r.update(d)},[t,u,o.reference,o.floating,r]),r.context.onOpenChange=n,r.context.nested=p,r}function Jn(e){const[t,n]=s.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const Zn=s.createContext(void 0),Qn={disableStyleElements:!1};function eo(){return s.useContext(Zn)??Qn}function to(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const kt=s.createContext(null);function be(){const e=s.useContext(kt);if(e===null)throw new Error(vt(60));return e}const no=(e,t)=>Object.is(e,t);function We(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:We(o,t,n))}function oo(e,t,n){return e.filter(o=>!We(t,o,n))}function Ut(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function so(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ut(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Bt(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return bt(e)}function ze(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?bt(e.value):bt(e)}function _t(e,t,n){function o(){return Bt(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const u=t,p=Ut(u)?u.flatMap(r=>r.items):u;if(e==null||typeof e!="object"){const r=p.find(d=>d.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=p.find(d=>d&&d.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function ro(e,t,n){return e.reduce((o,u,p)=>(p>0&&o.push(", "),o.push(h.jsx(s.Fragment,{children:_t(u,t,n)},p)),o),[])}const a={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ze(t,o)!==""},hasNullItemLabel:(e,t)=>t?so(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(u=>We(t,u,n)):We(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function lo(e,t,n=(o,u)=>o===u){return e.length===t.length&&e.every((o,u)=>n(o,t[u]))}function qe(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const ge=1;function wt(e,t){return Math.max(0,e-t)}function rt(e,t){if(t<=0)return 0;const n=qe(e,0,t),o=n,u=t-n,p=o<=ge,r=u<=ge;return p&&r?o<=u?0:t:p?0:r?t:n}function io(e){const{id:t,value:n,defaultValue:o=null,onValueChange:u,open:p,defaultOpen:r=!1,onOpenChange:d,name:g,form:i,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:I=!1,modal:C=!0,actionsRef:U,inputRef:S,onOpenChangeComplete:Y,items:O,multiple:T=!1,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B=no,highlightItemOnHover:L=!0,children:$}=e,{clearErrors:N}=yn(),{setDirty:ue,setTouched:q,setFocused:le,validityData:K,setFilled:H,name:V,disabled:J,validation:R,validationMode:ne}=Ft(),_=Dt({id:t}),P=J||b,l=V??g,[m,Z]=Ct({controlled:n,default:T?o??At:o,name:"Select",state:"value"}),[F,oe]=Ct({controlled:p,default:r,name:"Select",state:"open"}),f=s.useRef([]),v=s.useRef([]),D=s.useRef(null),ee=s.useRef(null),Se=s.useRef(0),E=s.useRef(null),X=s.useRef([]),z=s.useRef(!1),de=s.useRef(null),Q=s.useRef(null),se=s.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=s.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:W}=yt(F),{openMethod:G,triggerProps:ae}=Ln(F),A=Lt(()=>new nn({id:_,labelId:void 0,modal:C,multiple:T,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,value:m,open:F,mounted:ie,transitionStatus:W,items:O,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Me=c(A,a.activeIndex),ve=c(A,a.selectedIndex),ye=c(A,a.triggerElement),ce=c(A,a.positionerElement),je=Jn(G),Le=G??je,te=s.useMemo(()=>T?"":ze(m,j),[T,m,j]),at=s.useMemo(()=>T&&Array.isArray(m)?m.map(w=>ze(w,j)):ze(m,j),[T,m,j]),Ge=Ht(ye),Re=He(()=>at);Rn(Ge,_,m,Re,!P,g);const ct=s.useRef(m),Ye=T?Array.isArray(m)&&m.length>0:m!=null&&te!=="";xe(()=>{H(Ye)},[Ye,H]),xe(function(){let k=m,we=!1;if(T){const Oe=Array.isArray(m)?m:[];we=Oe.length===0,k=Oe[Oe.length-1]}const Pe=we?-1:ot(X.current,k,B),Ve=Pe===-1?null:Pe;Ve===null&&(Q.current=null),!F&&A.set("selectedIndex",Ve)},[T,F,m,B,A]);function me(w){const k=K.initialValue;return Array.isArray(w)&&Array.isArray(k)?!lo(w,k,(we,Pe)=>We(we,Pe,B)):w!==k}jn(m,()=>{N(l),ue(me(m)),R.change(m)});const De=He((w,k)=>{d?.(w,k),!k.isCanceled&&(oe(w),!w&&(k.reason===wn||k.reason===In)&&(q(!0),le(!1),ne==="onBlur"&&R.commit(m)))}),ke=He(()=>{fe(!1),A.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),Y?.(!1)});it({enabled:!U,open:F,ref:D,onComplete(){F||ke()}}),s.useImperativeHandle(U,()=>({unmount:ke}),[ke]);const Ee=He((w,k)=>{u?.(w,k),!k.isCanceled&&Z(w)}),he=He(w=>{const k=wt(w.scrollHeight,w.clientHeight),we=rt(w.scrollTop,k),Pe=we>0,Ve=we<k;A.set("scrollUpArrowVisible",Pe),A.set("scrollDownArrowVisible",Ve)}),Ae=Kn({open:F,onOpenChange:De,elements:{reference:ye,floating:ce}}),Ue=Nn(Ae,{enabled:!y&&!P,event:"mousedown"}),Be=on(Ae),Ce=On(Ae,{enabled:!y&&!P,listRef:f,activeIndex:Me,selectedIndex:ve,disabledIndices:At,onNavigate(w){w===null&&!F||A.set("activeIndex",w)},focusItemOnHover:L}),Ne=Hn(Ae,{enabled:!y&&!P&&(F||!T),listRef:v,activeIndex:Me,selectedIndex:ve,disabledIndices:w=>Sn(f.current[w]),onMatch(w){F?A.set("activeIndex",w):Ee(X.current[w],Ie(st))},onTyping(w){z.current=w}}),Ke=s.useMemo(()=>ht(Ne.reference,Ce.reference,Be.reference,Ue.reference,ae),[Ue.reference,Ne.reference,Ce.reference,Be.reference,ae]),Je=s.useMemo(()=>ht(sn,Ne.floating,Ce.floating,Be.floating),[Ne.floating,Ce.floating,Be.floating]),Ze=Ce.item??Kt;to(()=>{A.update({popupProps:Je,triggerProps:Ke})}),A.useSyncedValues({id:_,modal:C,multiple:T,value:m,open:F,mounted:ie,transitionStatus:W,popupProps:Je,triggerProps:Ke,items:O,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,openMethod:Le});const pe=s.useMemo(()=>({store:A,floatingContext:Ae,required:I,disabled:P,readOnly:y,multiple:T,highlightItemOnHover:L,setValue:Ee,setOpen:De,listRef:f,popupRef:D,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:Se,itemProps:Ze,valueRef:E,valuesRef:X,labelsRef:v,typingRef:z,selectionRef:se,firstItemTextRef:de,selectedItemTextRef:Q,validation:R,onOpenChangeComplete:Y,alignItemWithTriggerActiveRef:re,initialValueRef:ct}),[A,Ae,I,P,y,T,L,Ee,De,Ze,R,Y,he]),_e=Jt(S,R.inputRef),$e=T?void 0:l,ut=s.useMemo(()=>!T||!Array.isArray(m)||!l?null:m.map(w=>{const k=ze(w,j);return h.jsx("input",{type:"hidden",form:i,name:l,value:k,disabled:P},k)}),[T,m,i,l,j,P]);return h.jsxs(kt.Provider,{value:pe,children:[$,h.jsx("input",{...R.getValidationProps(P,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(w){if(w.nativeEvent.defaultPrevented||P||y)return;const k=w.currentTarget.value,we=Ie(st,w.nativeEvent);function Pe(){if(T)return;const Ve=k.toLowerCase();let Oe=X.current.findIndex(dt=>ze(dt,j).toLowerCase()===Ve||Bt(dt,M).toLowerCase()===Ve);Oe===-1&&(Oe=X.current.findIndex((dt,qt)=>{const Et=v.current[qt];return Et!=null&&Et.toLowerCase()===Ve}));const Mt=X.current[Oe];Mt!=null&&Ee(Mt,we)}A.set("forceMount",!0),queueMicrotask(Pe)}}),id:_&&$e==null?`${_}-hidden-input`:void 0,form:i,name:$e,autoComplete:x,value:te,disabled:P,required:I&&!(T&&Ye),readOnly:y,ref:_e,style:l?rn:ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ut]})}function ao(e,t){return e??t}const co=400,uo={...cn,...Mn,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},fo=s.forwardRef(function(t,n){const{render:o,className:u,id:p,disabled:r=!1,nativeButton:d=!0,style:g,...i}=t,{setTouched:x,setFocused:b,validationMode:y,state:I,disabled:C}=Ft(),{labelId:U}=Tn(),{store:S,setOpen:Y,selectionRef:O,validation:T,readOnly:M,required:j,alignItemWithTriggerActiveRef:B,disabled:L}=be(),$=C||L||r,N=c(S,a.open),ue=c(S,a.mounted),q=c(S,a.value),le=c(S,a.triggerProps),K=c(S,a.positionerElement),H=c(S,a.listElement),V=c(S,a.popupSide),J=c(S,a.id),R=c(S,a.labelId),ne=c(S,a.hasSelectedValue),_=ue&&K?V:null,P=p??J,l=ao(U,R);Dt({id:P});const m=Ht(K),Z=s.useRef(null),{getButtonProps:F,buttonRef:oe}=Nt({disabled:$,native:d}),f=S.useStateSetter("triggerElement"),v=nt(),D=nt(),ee=nt();s.useEffect(()=>{if(N)return ee.start(co,()=>{O.current.allowUnselectedMouseUp=!0,O.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};O.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},D.clear()},[N,O,D,ee]);const Se=ht(le,{id:P,role:"combobox","aria-expanded":N,"aria-haspopup":"listbox","aria-controls":N?H?.id??an(K)?.id:void 0,"aria-labelledby":l,"aria-readonly":M||void 0,"aria-required":j||void 0,tabIndex:$?-1:0,onFocus(z){b(!0),N&&B.current&&Y(!1,Ie(st,z.nativeEvent)),v.start(0,()=>{S.set("forceMount",!0)})},onBlur(z){pt(K,z.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&T.commit(q))},onMouseDown(z){if(N)return;const de=xt(z.currentTarget);function Q(se){if(!Z.current)return;const re=se.target;pt(Z.current,re)||pt(m.current,re)||Fn(se,Z.current)||Y(!1,Ie(En,se))}D.start(0,()=>{de.addEventListener("mouseup",Q,{once:!0})})}},i,F),E=T.getValidationProps($,Se);E.role="combobox";const X={...I,open:N,disabled:$,value:q,readOnly:M,popupSide:_,placeholder:!ne};return Te("button",t,{ref:[n,Z,oe,f],state:X,stateAttributesMapping:uo,props:E})}),po={value:()=>null},go=s.forwardRef(function(t,n){const{className:o,render:u,children:p,placeholder:r,style:d,...g}=t,{store:i,valueRef:x}=be(),b=c(i,a.value),y=c(i,a.items),I=c(i,a.itemToStringLabel),C=c(i,a.hasSelectedValue),U=!C&&r!=null&&p==null,S=c(i,a.hasNullItemLabel,U),Y={value:b,placeholder:!C};let O=null;return typeof p=="function"?O=p(b):p!=null?O=p:U&&!S?O=r:Array.isArray(b)?O=ro(b,y,I):O=_t(b,y,I),Te("span",t,{state:Y,ref:[n,x],props:[{children:O},g],stateAttributesMapping:po})}),mo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d}=be(),i={open:c(d,a.open)};return Te("span",t,{state:i,ref:n,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:un})}),ho=s.forwardRef(function(t,n){const{store:o}=be(),u=c(o,a.mounted),p=c(o,a.forceMount);return u||p?h.jsx(dn,{ref:n,...t}):null}),zt=s.createContext(void 0);function It(){const e=s.useContext(zt);if(!e)throw new Error(vt(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const Wt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},xo={position:"fixed"},bo=s.forwardRef(function(t,n){const{anchor:o,className:u,render:p,positionMethod:r,side:d,align:g,sideOffset:i,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:I,sticky:C,disableAnchorTracking:U,alignItemWithTrigger:S=!0,collisionAvoidance:Y=fn,style:O,...T}=t,{store:M,listRef:j,labelsRef:B,alignItemWithTriggerActiveRef:L,selectedItemTextRef:$,valuesRef:N,initialValueRef:ue,popupRef:q,setValue:le,floatingContext:K}=be(),H=c(M,a.open),V=c(M,a.mounted),J=c(M,a.modal),R=c(M,a.value),ne=c(M,a.openMethod),_=c(M,a.positionerElement),P=c(M,a.triggerElement),l=c(M,a.isItemEqualToValue),m=c(M,a.transitionStatus),Z=s.useRef(null),F=s.useRef(null),[oe,f]=s.useState(S),v=V&&oe&&ne!=="touch";!V&&oe!==S&&f(S),s.useImperativeHandle(L,()=>v),Dn((v||J)&&H,ne==="touch",_,P);const D=kn({anchor:o,floatingRootContext:K,positionMethod:r,mounted:V,side:d,sideOffset:i,align:g,alignOffset:x,arrowPadding:I,collisionBoundary:b,collisionPadding:y,sticky:C,disableAnchorTracking:U??v,collisionAvoidance:Y,keepMounted:!0}),ee=v?"none":D.side,Se=v?xo:D.positionerStyles,E={open:H,side:ee,align:D.align,anchorHidden:D.anchorHidden};xe(()=>{M.set("popupSide",D.side)},[M,D.side]);const X=M.useStateSetter("positionerElement"),z=Un(t,E,{styles:Se,transitionStatus:m,props:T,refs:[n,X],hidden:!V,inert:!H}),de=s.useRef(0),Q=He(re=>{if(N.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Ie(st);if(ie!==0&&!M.state.multiple&&R!==null&&ot(N.current,R,l)===-1){const G=ue.current,A=G!=null&&ot(N.current,G,l)!==-1?G:null;le(A,fe),A===null&&(M.set("selectedIndex",null),$.current=null)}if(ie!==0&&M.state.multiple&&Array.isArray(R)){const W=R.filter(G=>ot(N.current,G,l)!==-1);W.length!==R.length&&(le(W,fe),W.length===0&&(M.set("selectedIndex",null),$.current=null))}if(H&&v){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const W={height:""};lt(_,W),lt(q.current,W)}}),se=s.useMemo(()=>({...D,side:ee,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:f,scrollUpArrowRef:Z,scrollDownArrowRef:F}),[D,ee,v,f]);return h.jsx(Yn,{elementsRef:j,labelsRef:B,onMapChange:Q,children:h.jsxs(zt.Provider,{value:se,children:[V&&J&&h.jsx(pn,{inert:Cn(!H),cutout:P}),z]})})}),Qe="base-ui-disable-scrollbar",St={className:Qe,getElement(e){return h.jsx("style",{nonce:e,href:Qe,precedence:"base-ui:low",children:`.${Qe}{scrollbar-width:none}.${Qe}::-webkit-scrollbar{display:none}`})}},So={...xn,...Rt},vo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,finalFocus:r,...d}=t,{store:g,popupRef:i,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:I,selectedItemTextRef:C,multiple:U,handleScrollArrowVisibility:S,scrollHandlerRef:Y,listRef:O,highlightItemOnHover:T,floatingContext:M}=be(),{side:j,align:B,alignItemWithTriggerActive:L,isPositioned:$,setControlledAlignItemWithTrigger:N}=It(),ue=Bn()!=null,q=$n(),{nonce:le,disableStyleElements:K}=eo(),H=c(g,a.id),V=c(g,a.open),J=c(g,a.openMethod),R=c(g,a.mounted),ne=c(g,a.popupProps),_=c(g,a.transitionStatus),P=c(g,a.triggerElement),l=c(g,a.positionerElement),m=c(g,a.listElement),Z=s.useRef(!1),F=s.useRef(!1),oe=s.useRef({}),f=Pn(),v=He(E=>{if(!l||!i.current||!F.current)return;const X=l.style.top==="0px",z=l.style.bottom==="0px";if(Z.current||!L||!X&&!z){S(E);return}const de=Vt(l),Q=Xe(l.getBoundingClientRect().height,"y",de),se=xt(l),re=ft(l),ie=re.getComputedStyle(l),fe=parseFloat(ie.marginTop),W=parseFloat(ie.marginBottom),G=Pt(re.getComputedStyle(i.current)),ae=Math.min(se.documentElement.clientHeight-fe-W,G),A=E.scrollTop,Me=et(E);let ve=null;const ye=te=>{l.style.height=`${te}px`},ce=X?Me-A:A,je=Math.min(Q+ce,ae);if(ce<=ge){const te=qe(ce,0,ae-Q);te>0&&ye(Q+te),E.scrollTop=X?Me:0,ae-(Q+te)<=ge&&(Z.current=!0),S(E);return}if(ae-je>ge)ve=X?1/0:0;else if(z&&A<Me){const te=Q+ce-ae;ve=A-(ce-te)}const Le=Math.ceil(je);if(Le!==0&&ye(Le),ve!=null){const te=qe(ve,0,et(E));Math.abs(E.scrollTop-te)>ge&&(E.scrollTop=te)}Le>=ae-ge&&(Z.current=!0),S(E)});s.useImperativeHandle(Y,()=>v,[v]),it({open:V,ref:i,onComplete(){V&&x?.(!0)}});const D={open:V,transitionStatus:_,side:j,align:B};xe(()=>{!l||!i.current||Object.keys(oe.current).length||(oe.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[i,l]),xe(()=>{V||L||(F.current=!1,Z.current=!1,lt(l,oe.current))},[V,L,l,i]),xe(()=>{const E=i.current;if(!V||!P||!l||!E||L&&!$||g.state.transitionStatus==="ending")return;if(F.current=!0,E.style.removeProperty("--transform-origin"),!L){f.request(()=>S(m||E));return}const X=yo(E);try{let z=C.current;z?.isConnected||(z=!a.hasSelectedValue(g.state)&&I.current?.isConnected?I.current:null);const de=y.current,Q=ft(l),se=Q.getComputedStyle(l),re=Q.getComputedStyle(E),ie=xt(P),fe=Vt(P),W=tt(P.getBoundingClientRect(),fe),G=tt(l.getBoundingClientRect(),fe),ae=W.height,A=m||E,Me=A.scrollHeight,ve=parseFloat(re.borderBottomWidth),ye=parseFloat(se.marginTop)||10,ce=parseFloat(se.marginBottom)||10,je=parseFloat(se.minHeight)||100,Le=Pt(re),te=5,at=5,Ge=20,Re=ie.documentElement.clientHeight-ye-ce,ct=ie.documentElement.clientWidth,Ye=Re-W.bottom+ae;let me,De=q==="rtl"?W.right-G.width:W.left,ke=0;if(z&&de){const pe=tt(de.getBoundingClientRect(),fe);me=tt(z.getBoundingClientRect(),fe),De=G.left+(q==="rtl"?pe.right-me.right:pe.left-me.left);const _e=pe.top-W.top+pe.height/2;ke=me.top-G.top+me.height/2-_e}const Ee=Ye+ke+ce+ve;let he=Math.min(Re,Ee);const Ae=Re-ye-ce,Ue=Ee-he,Be=ct-at;l.style.left=`${qe(De,te,Be-G.width)}px`,l.style.height=`${he}px`,l.style.maxHeight="none",l.style.marginTop=`${ye}px`,l.style.marginBottom=`${ce}px`,E.style.height="100%";const Ce=et(A),Ne=Ue>=Ce-ge;Ne&&(he=Math.min(Re,G.height)-(Ue-Ce));const Ke=W.top<Ge||W.bottom>Re-Ge||Math.ceil(he)+ge<Math.min(Me,je),Je=(Q.visualViewport?.scale??1)!==1&&gn;if(Ke||Je){lt(l,oe.current),N(!1);return}const Ze=Math.max(je,he);if(Ne){const pe=Math.max(0,Re-Ee);l.style.top=G.height>=Ae?"0":`${pe}px`,l.style.height=`${he}px`,A.scrollTop=et(A)}else l.style.bottom="0",A.scrollTop=Ue;if(me){const pe=G.top,_e=G.height,$e=me.top+me.height/2,ut=qe(_e>0?($e-pe)/_e*100:50,0,100);E.style.setProperty("--transform-origin",`50% ${ut}%`)}(Ze===Re||he>=Le)&&(Z.current=!0),S(A),T&&g.state.selectedIndex===null&&g.state.activeIndex===null&&O.current[0]!=null&&g.set("activeIndex",0)}finally{X()}},[g,V,l,P,y,I,C,i,S,L,N,f,m,O,T,q,$]),s.useEffect(()=>{if(!L||!l||!V)return;const E=ft(l);function X(z){b(!1,Ie(An,z))}return mn(E,"resize",X)},[b,L,l,V]);const ee={...m?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${H}-list`},onKeyDown(E){ue&&Vn.has(E.key)&&E.stopPropagation()},onScroll(E){m||v(E.currentTarget)},...L&&{style:m?{height:"100%"}:Wt},className:!m&&L?St.className:void 0},Se=Te("div",t,{ref:[n,i],state:D,stateAttributesMapping:So,props:[ne,ee,Wn(_),d]});return h.jsxs(s.Fragment,{children:[!K&&St.getElement(le),h.jsx(hn,{context:M,modal:!1,disabled:!R,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:Se})]})});function Pt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function et(e){return wt(e.scrollHeight,e.clientHeight)}function Vt(e){return _n.getScale(e)}function Xe(e,t,n){return e/n[t]}function tt(e,t){return zn({x:Xe(e.x,"x",t),y:Xe(e.y,"y",t),width:Xe(e.width,"x",t),height:Xe(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function yo(e){const{style:t}=e,n={};for(const[o,u]of jt)n[o]=t.getPropertyValue(o),t.setProperty(o,u,"important");return()=>{for(const[o]of jt){const u=n[o];u?t.setProperty(o,u):t.removeProperty(o)}}}const Ro=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d,scrollHandlerRef:g,multiple:i}=be(),{alignItemWithTriggerActive:x}=It(),b=c(d,a.hasScrollArrows),y=c(d,a.openMethod),C={id:`${c(d,a.id)}-list`,role:"listbox","aria-multiselectable":i||void 0,onScroll(S){g.current?.(S.currentTarget)},...x&&{style:Wt},className:b&&y!=="touch"?St.className:void 0},U=d.useStateSetter("listElement");return Te("div",t,{ref:[n,U],props:[C,r]})}),Yt=s.createContext(void 0);function Tt(){const e=s.useContext(Yt);if(!e)throw new Error(vt(57));return e}const wo=s.memo(s.forwardRef(function(t,n){const{render:o,className:u,style:p,value:r=null,label:d,disabled:g=!1,nativeButton:i=!1,...x}=t,b=s.useRef(null),y=qn({guess:!0,label:d,textRef:b}),{store:I,itemProps:C,setOpen:U,setValue:S,selectionRef:Y,typingRef:O,valuesRef:T,multiple:M,selectedItemTextRef:j,disabled:B,readOnly:L}=be(),$=B||g,N=c(I,a.isActive,y.index),ue=c(I,a.open),q=c(I,a.isSelected,r),le=c(I,a.isSelectedByFocus,y.index),K=c(I,a.isItemEqualToValue),H=y.index,V=s.useRef(null);xe(()=>{const f=T.current;return f[H]=r,()=>{delete f[H]}},[H,r,T]),xe(()=>{const f=I.state.value;let v=f;M&&Array.isArray(f)&&(v=f.length>0?f[f.length-1]:void 0),v!==void 0&&We(r,v,K)&&(I.set("selectedIndex",H),b.current&&(j.current=b.current))},[H,M,K,I,r,j]);const J=s.useRef("mouse"),R=s.useRef(!1),{getButtonProps:ne,buttonRef:_}=Nt({disabled:$,focusableWhenDisabled:!0,native:i,composite:!0}),P={disabled:$,selected:q,highlighted:N};function l(f){if(B||L)return;const v=I.state.value;if(M){const D=Array.isArray(v)?v:[],ee=q?oo(D,r,K):[...D,r];S(ee,Ie(gt,f))}else S(r,Ie(gt,f)),U(!1,Ie(gt,f))}function m(){Y.current.dragY=0}const Z={role:"option","aria-selected":q,tabIndex:ue&&N?0:-1,onKeyDown(f){I.set("activeIndex",H),f.key===" "&&O.current&&f.preventDefault()},onClick(f){const v=J.current!=="touch",D=f.nativeEvent.pointerType,ee=v&&bn(f.nativeEvent)&&(D!==void 0||N),Se=v&&!ee&&!R.current;R.current=!1,!($||Se)&&l(f.nativeEvent)},onPointerEnter(f){J.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const v=Y.current;v.dragY+=f.movementY,v.dragY**2>=64&&(v.allowUnselectedMouseUp=!0)}},onPointerDown(f){J.current=f.pointerType,R.current=!0,m()},onMouseUp(){if(m(),$||J.current==="touch"||R.current)return;const f=!Y.current.allowSelectedMouseUp&&q,v=!Y.current.allowUnselectedMouseUp&&!q;f||v||(R.current=!0,V.current?.click(),R.current=!1)}},F=Te("div",t,{ref:[_,n,y.ref,V],state:P,props:[C,Z,x,ne]}),oe=s.useMemo(()=>({selected:q,index:H,textRef:b,selectedByFocus:le}),[q,H,b,le]);return h.jsx(Yt.Provider,{value:oe,children:F})})),Io=s.forwardRef(function(t,n){const{selected:o}=Tt();return t.keepMounted||o?h.jsx(To,{...t,ref:n}):null}),To=s.memo(s.forwardRef((e,t)=>{const{render:n,className:o,style:u,keepMounted:p,...r}=e,{selected:d}=Tt(),g=s.useRef(null),{transitionStatus:i,setMounted:x}=yt(d),y=Te("span",e,{ref:[t,g],state:{selected:d,transitionStatus:i},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Rt});return it({open:d,ref:g,onComplete(){d||x(!1)}}),y})),Mo=s.memo(s.forwardRef(function(t,n){const{index:o,textRef:u,selectedByFocus:p}=Tt(),{firstItemTextRef:r,selectedItemTextRef:d}=be(),{render:g,className:i,style:x,...b}=t,y=s.useCallback(C=>{C&&(o===0&&(r.current=C),p&&(d.current=C))},[r,d,o,p]);return Te("div",t,{ref:[y,n,u],props:b})})),$t=s.forwardRef(function(t,n){const{render:o,className:u,style:p,direction:r,keepMounted:d,...g}=t,i=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=be(),{side:U,scrollDownArrowRef:S,scrollUpArrowRef:Y}=It(),O=i?a.scrollUpArrowVisible:a.scrollDownArrowVisible,T=c(x,O),M=c(x,a.openMethod),j=T&&M!=="touch",B=nt(),L=i?Y:S,{mounted:$,transitionStatus:N,setMounted:ue}=yt(j);xe(()=>(C.current+=1,x.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&x.set("hasScrollArrows",!1)}),[x,C]),it({open:j,ref:L,onComplete(){j||ue(!1)}});const K=Te("div",t,{ref:[n,L],state:{direction:r,visible:j,side:U,transitionStatus:N},props:[{"aria-hidden":!0,children:i?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||B.isStarted())return;x.set("activeIndex",null);function J(){const R=x.state.listElement??b.current;if(!R)return;x.set("activeIndex",null),I(R);const ne=wt(R.scrollHeight,R.clientHeight),_=rt(R.scrollTop,ne),P=_===(i?0:ne),l=y.current;if(_!==R.scrollTop&&(R.scrollTop=_),P){B.clear();return}if(l.length>0){const m=L.current?.offsetHeight||0;R.scrollTop=Eo(l,i,_,R.clientHeight,m,ne)}B.start(40,J)}B.start(40,J)},onMouseLeave(){B.clear()}},g],stateAttributesMapping:Rt});return $||d?K:null});function Eo(e,t,n,o,u,p){if(t){let x=0;const b=n+u-ge;for(let C=0;C<e.length;C+=1){const U=e[C];if(U&&U.offsetTop>=b){x=C;break}}const y=Math.max(0,x-1),I=e[y];return y<x&&I?rt(I.offsetTop-u,p):0}let r=e.length-1;const d=n+o-u+ge;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>d){r=Math.max(0,x-1);break}}const g=Math.min(e.length-1,r+1),i=e[g];return g>r&&i?rt(i.offsetTop+i.offsetHeight-o+u,p):p}const Ao=s.forwardRef(function(t,n){return h.jsx($t,{...t,ref:n,direction:"down"})}),Co=s.forwardRef(function(t,n){return h.jsx($t,{...t,ref:n,direction:"up"})}),Po=io;function Vo({className:e,...t}){return h.jsx(go,{"data-slot":"select-value",className:Fe("flex flex-1 text-left",e),...t})}function jo({className:e,size:t="default",children:n,...o}){return h.jsxs(fo,{"data-slot":"select-trigger","data-size":t,className:Fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,h.jsx(mo,{render:h.jsx(Ot,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Lo({className:e,children:t,side:n="bottom",sideOffset:o=4,align:u="center",alignOffset:p=0,alignItemWithTrigger:r=!0,...d}){return h.jsx(ho,{children:h.jsx(bo,{side:n,sideOffset:o,align:u,alignOffset:p,alignItemWithTrigger:r,className:"isolate z-50",children:h.jsxs(vo,{"data-slot":"select-content","data-align-trigger":r,className:Fe("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[h.jsx(Oo,{}),h.jsx(Ro,{children:t}),h.jsx(Ho,{})]})})})}function No({className:e,children:t,...n}){return h.jsxs(wo,{"data-slot":"select-item",className:Fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx(Mo,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),h.jsx(Io,{render:h.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:h.jsx(Zt,{className:"pointer-events-none"})})]})}function Oo({className:e,...t}){return h.jsx(Co,{"data-slot":"select-scroll-up-button",className:Fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Gn,{})})}function Ho({className:e,...t}){return h.jsx(Ao,{"data-slot":"select-scroll-down-button",className:Fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Ot,{})})}const mt="__none__";function Xo({id:e,value:t,onChange:n,options:o,className:u,size:p="default","aria-label":r,placeholder:d="Choose…"}){const g=o.map(i=>({value:i.value===""?mt:i.value,label:i.label}));return h.jsxs(Po,{items:g,value:t===""?mt:t,onValueChange:i=>i!=null&&n(i===mt?"":String(i)),children:[h.jsx(jo,{id:e,size:p,"aria-label":r,className:Fe("w-full bg-card",u),children:h.jsx(Vo,{children:i=>{const x=g.find(b=>b.value===i);return x?x.label:h.jsx("span",{className:"text-muted-foreground",children:d})}})}),h.jsx(Lo,{children:g.map(i=>h.jsx(No,{value:i.value,children:i.label},i.value))})]})}export{Xo as P,Po as S,jo as a,Vo as b,Lo as c,No as d};
@@ -1 +1 @@
1
- import{r,j as e,a9 as o}from"./index-X11XkRkb.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
1
+ import{r,j as e,al as o}from"./index-CUBD0DcL.js";function u({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{u as S};
@@ -0,0 +1 @@
1
+ import{N as o}from"./index-CUBD0DcL.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{N as o}from"./index-CUBD0DcL.js";const t=o;export{t as notFoundComponent};
@@ -1 +1 @@
1
- import{j as e,u as n,G as a,B as r}from"./index-X11XkRkb.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
1
+ import{j as e,u as n,G as a,B as r}from"./index-CUBD0DcL.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
@@ -1,4 +1,4 @@
1
- import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as e,B as Z,h as w,i as ne,m as ye,E as vt,k as Se,l as fe,n as jt,o as yt,p as ae,q as K,S as St,s as ee,t as $e,v as wt,L as _,w as Nt,M as Ct,x as kt,y as Tt,z as Pt,A as Be,O as Rt}from"./index-X11XkRkb.js";import{u as we}from"./useQuery-CCJBm2EJ.js";import{D as Mt,a as Et,b as Ot,X as Dt,c as It,d as At,e as _t,f as zt,p as Ht,g as Lt,h as $t,i as Fe,j as Ue,k as qe,l as Bt,m as Ft,n as Ut}from"./dialog-DZbUuBSr.js";import{T as qt,i as Ve,a as Vt,R as Gt,b as Kt,P as Yt,f as Wt,u as Xt,c as Qt,d as Jt,e as Zt,g as es,h as ts,j as ss,k as ns,l as as,m as rs,t as os,n as is,o as ls,F as ds,p as cs,q as us,S as ps,r as gs,s as hs}from"./useScrollLock-DDlrhOw8.js";import{c as B,n as Ge,g as fs,a as xe,t as xs,d as ms,i as bs,u as vs,b as ue}from"./createBaseUIEventDetails-CTYgZt5m.js";import{g as me,u as js,a as ys,b as Ss,s as ws,c as Ns,d as Cs,S as Ke,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as G,l as ks,m as pe}from"./dropdown-menu-By49qibi.js";import{u as Ts,a as Ps,g as Rs}from"./getPseudoElementBounds-CFaDUKhY.js";import{u as Ms}from"./inertValue-CLaAaX62.js";import{u as Ye}from"./useRender-BZe0PUs7.js";import{A as Es,a as Os}from"./avatar-C6Rr20S0.js";import{L as Ds,I as Is}from"./label-8lYoT07T.js";import{u as le}from"./me-DnLqgT3l.js";import{L as se}from"./layout-grid-C-a8O8B6.js";import{U as be}from"./users-BkLZaCQc.js";import{c as As}from"./update-duXzIzFS.js";import{P as We}from"./plus-CS6tYH0S.js";import{M as _s,S as zs,a as Hs}from"./sun-CK52_1CD.js";import"./useBaseQuery-C_54ul4D.js";import"./check-BlRwZrSR.js";import"./CompositeList-OHWH8W1h.js";import"./CompositeItem-CkiEeVQd.js";import"./useCompositeItem-6LQEohxr.js";import"./useValueChanged-BuDWW6rb.js";function Ls(t){const s=ft({warn:t?.router===void 0}),n=t?.router||s;return xt(n.stores.__store,mt(t,n))}/**
1
+ import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as e,B as Z,h as w,i as ne,m as ye,E as vt,k as Se,l as fe,n as jt,o as yt,p as ae,q as K,S as St,s as wt,t as Nt,v as ee,w as $e,x as Ct,L as _,y as kt,M as Tt,z as Pt,A as Rt,C as Mt,D as Et,F as Be,O as Ot}from"./index-CUBD0DcL.js";import{u as we}from"./useQuery-CGx36E5q.js";import{D as Dt,a as It,b as At,X as _t,c as zt,d as Ht,e as Lt,f as $t,p as Bt,g as Ft,h as Ut,i as Fe,j as Ue,k as qe,l as qt,m as Vt,n as Gt}from"./dialog-CjX41K4h.js";import{T as Kt,i as Ve,a as Yt,R as Wt,b as Xt,P as Qt,f as Jt,u as Zt,c as es,d as ts,e as ss,g as ns,h as as,j as rs,k as os,l as is,m as ls,t as ds,n as cs,o as us,F as ps,p as gs,q as hs}from"./useScrollLock-DV4rQnvf.js";import{c as B,n as Ge,g as fs,a as xe,t as xs,d as ms,i as bs,u as vs,b as ue}from"./createBaseUIEventDetails-BlUeVOHL.js";import{g as me,u as js,a as ys,b as Ss,s as ws,c as Ns,d as Cs,S as Ke,E as J,D as re,e as oe,f as ie,h as Ne,i as te,j as I,k as G,l as ks,m as pe}from"./dropdown-menu-BejmUTVa.js";import{u as Ts,a as Ps,g as Rs}from"./getPseudoElementBounds-087ogDm1.js";import{u as Ms}from"./inertValue-BxLh7N1J.js";import{u as Ye}from"./useRender-CNreHlDo.js";import{A as Es,a as Os}from"./avatar-B-4Lv0hf.js";import{L as Ds,I as Is}from"./label-BoGrNcZ0.js";import{u as le}from"./me-DeblO6Os.js";import{L as se}from"./layout-grid-D1FcD4G3.js";import{U as be}from"./users-BxyUqa0S.js";import{c as As}from"./update-duXzIzFS.js";import{P as We}from"./plus-ChodljzA.js";import{M as _s,S as zs,a as Hs}from"./sun-B2KoVsUv.js";import"./useBaseQuery-BBU42uTr.js";import"./check-26YOtWVN.js";import"./CompositeList-CDfO6SCy.js";import"./CompositeItem-CNlNRLwm.js";import"./useCompositeItem-BZX9S0sx.js";import"./useValueChanged-BcwdNwDJ.js";function Ls(t){const s=ft({warn:t?.router===void 0}),n=t?.router||s;return xt(n.stores.__store,mt(t,n))}/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -58,4 +58,4 @@ import{u as ft,a as xt,b as mt,c as O,d as je,r as o,e as L,f as ce,g as bt,j as
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const tn=[["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"}]],et=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new qt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),u=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:f}=u,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function h(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,f.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return f.start(x,()=>{a.select("open")||d.current&&d.current!==m||h()}),()=>{(S.current||d.current!==m)&&f.clear()}}h()}},[n,r,d,i,x,c,g,f,a]),L(()=>{if(!n)return;const h=g.current,m=d.current;f.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),h?.setIsInstantPhase(!0),h?.onOpenChange(!1,B(Ge))):(l(!1),h?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,f]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),f.clear()}},[g,d,i,r,c,f]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const u=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=u.width,g=u.height,b=u.x,f=u.y;return n==null&&s.x&&d&&(n=u.x-s.x),a==null&&s.y&&i&&(a=u.y-s.y),b-=n||0,f-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?u.width:0,g=s.axis==="x"?u.height:0,b=d&&s.x!=null?s.x:b,f=i&&s.y!=null?s.y:f):r&&!x&&(g=s.axis==="x"?u.height:g,c=s.axis==="y"?u.width:c),r=!0,{width:c,height:g,x:b,y:f,top:f,right:b+c,bottom:f+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,u=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,f]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),h=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{u?g.current||(h(v.clientX,v.clientY,v.currentTarget),l([])):h(v.clientX,v.clientY,v.currentTarget)}),C=Ve(b)?d:u;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=bt(d);function R(P){const p=fs(P);xe(d,p)?v():h(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Vt(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,h,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&u&&(c.current=!0)},[n,u]);const N=o.useMemo(()=>{function v(y){f(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Mt,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(_t,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx(zt,{"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 hn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(Et,{"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),...r,children:[s,a&&e.jsxs(Ot,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(Dt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(It,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(At,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const tt=o.createContext(void 0);function Y(t){const s=o.useContext(tt);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Ht,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 vn extends Gt{constructor(s,n,a){const r=new Yt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Kt(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(xs,s))}}function jn(t,s,n,a=!1){const r={...Lt(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=$t(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Wt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:u=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:f=null,children:j}=s,l=Xt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:f,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),h=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:u,disabled:n}),Qt(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=Jt(h,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),p=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(ms))},[S,n,l]),L(()=>{y==="ending"&&p===Ge||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,p,P,l]),L(()=>{h&&m==null&&l.set("payload",void 0)},[l,m,h]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(bs))}),[v,l]);const A=h||C||!n&&d!=="none";return e.jsxs(tt.Provider,{value:l,children:[g&&e.jsx(Zt,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=es(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),u=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(u.reference,r.reference),[u.reference,r.reference]);return ts(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??vt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,st="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(fe(r))return r}}const s=t.target;return fe(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${st}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&fe(a.host)?a.host:null}return null}const Tn=ss(function(s,n){const{render:a,className:r,style:u,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:f,...j}=s,l=Y(!0),h=js(d)??l;if(!h)throw new Error(ne(82));const m=vs(f),C=h.useState("isTriggerActive",m),N=h.useState("isOpenedByTrigger",m),v=h.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:p,isMountedByThisTrigger:k}=ns(m,y,h,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=ys(v);h.useSyncedValue("isInstantPhase",F);const de=h.useState("disabled"),q=x??de,Pe=as(q),Re=h.useState("trackCursorAxis"),lt=h.useState("disableHoverablePopup"),V=o.useRef(!1),W=rs(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function dt(T){const z=Ee(T);return V.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const ct=Ss(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!lt&&Re!=="both"?ws():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>h.select("transitionStatus")==="ending",shouldOpen(){return!V.current}}),ut=Ns(v,{enabled:!q}).reference,pt=T=>{const z=V.current,H=ze(T),Oe=dt(H),Q=y.current,ht=Q&&H&&xe(Q,H);if(Oe&&h.select("open")&&h.select("lastOpenChangeReason")===ue){h.setOpen(!1,B(ue,T));return}if(z&&!Oe&&ht&&!Pe.current&&!h.select("open")&&Q&&Ve(X.current)){const De=()=>{!V.current&&!Pe.current&&!h.select("open")&&h.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},gt=h.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,p,y],props:[ct,ut,k||Re!=="none"?gt:void 0,{onMouseOver(T){pt(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){V.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,h.set("closeOnClick",g),g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[st]:q?void 0:""},j],stateAttributesMapping:os})}),nt=o.createContext(void 0);function Pn(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:u,render:d,style:i,...x}=s,{node:c,subtree:g}=is({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&jt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(nt.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),at=o.createContext(void 0);function rt(){const t=o.useContext(at);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:u,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:f=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:h=ls,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),p=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=Ts({anchor:u,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:f,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ps(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||p});return e.jsx(at.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{side:x,align:c}=rt(),g=i.useState("open"),b=i.useState("instantType"),f=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),h=i.useState("closeDelay");Ms({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Cs(l,{enabled:!S,closeDelay:h});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:f},ref:[n,i.context.popupRef,m],props:[ds,j,Rs(f),d],stateAttributesMapping:cs})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:f}=rt(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:f,"aria-hidden":!0},d],stateAttributesMapping:us})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:u,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"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:[u,e.jsx(Dn,{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 zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",ot=o.createContext(null);function Te(){const t=o.useContext(ot);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:u,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),f=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(f):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,f]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=f?"expanded":"collapsed",h=o.useMemo(()=>({state:S,open:f,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,f,j,i,x,c,l]);return e.jsx(ot.Provider,{value:h,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:u})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:u,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();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:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(hn,{dir:u,"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":$n},side:t,children:[e.jsxs(fn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="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:r})})]})}function Vn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Gn({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 Kn({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 Yn({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 Wn({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 He({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 Xn({className:t,render:s,...n}){return Ye({defaultTagName:"div",props:ye({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 Le({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 he({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 M({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 Qn=yt("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 E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:u,...d}){const{isMobile:i,state:x}=Te(),c=Ye({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),u)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({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 Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,u]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const p=setTimeout(()=>b(c),180);return()=>clearTimeout(p)},[c]);const f=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(u(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Qe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(et,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(p=>({id:`p:${p.uid}`,label:p.name,hint:p.unresolved>0?`${p.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.uid}})})),[n.projects,a]),h=p=>!c||p.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(p=>h(p.label)),N=l.filter(p=>h(p.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(f.data?.data??[]).map(p=>({id:`t:${p.id}`,label:p.latest?.body?.trim()||p.route,hint:`${p.site.name} · ${gs(p.status)?ps[p.status]:p.status} · ${p.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.site.uid},search:{thread:p.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(p=>p.items),R=Math.min(d,Math.max(0,y.length-1)),P=p=>{p&&(s(!1),p.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Fe,{open:t,onOpenChange:s,children:e.jsxs(Ue,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(qe,{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(Ke,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:p=>{u(p.target.value),i(0)},onKeyDown:p=>{p.key==="ArrowDown"?(p.preventDefault(),i(k=>Math.min(k+1,y.length-1))):p.key==="ArrowUp"?(p.preventDefault(),i(k=>Math.max(k-1,0))):p.key==="Enter"&&(p.preventDefault(),P(y[R]))},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:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:f.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(p=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:p.title}),p.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},p.title)),f.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(St,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const it="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=$e(s),a=wt(s),[r,u]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:a}),e.jsxs(Gn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>u(!0)}),n&&e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),n&&s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:r,onOpenChange:u})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),u=we(Be.setupState()),d=t.user.role==="owner"?u.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-2 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(he,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Ze,{}),e.jsx("span",{children:"Site settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(he,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"Studio settings"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(he,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[u,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Ct,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",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})]})]}),f=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return f?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md border border-transparent px-2.5 py-1 text-foreground transition-colors hover:border-border hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 border border-transparent px-2.5 py-1 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md border border-transparent px-2.5 py-1 text-foreground transition-colors hover:border-border hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(f||t.signupOpen)&&e.jsx(G,{}),f&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Ze,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(We,{}),"New studio…"]})]})]}),e.jsx(Fe,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(Ue,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(u.trim()||"My studio"))},children:[e.jsxs(Bt,{children:[e.jsx(qe,{children:"New studio"}),e.jsx(Ft,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ds,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(Is,{id:"new-studio-name",value:u,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(Ut,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{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 transition-colors hover:bg-sidebar-accent","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),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(G,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(We,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=$e(le()),s=we(Be.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),u=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Gs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(G,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void u(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(kt),u=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Pt("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Es,{className:"size-8 rounded-full",children:e.jsx(Os,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:hs(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:u}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:u}),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(G,{}),e.jsxs(ks,{value:a,onValueChange:x=>{const c=x;Tt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(G,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(et,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=Nt().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(Vn,{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,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),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(Ke,{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 Ha=()=>e.jsx(na,{children:e.jsx(Rt,{})});export{Ha as component};
61
+ */const tn=[["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"}]],et=O("user",tn),sn=[["mcp-tokens"],["instance"],["integrations"],["invites"],["members"]];function nn(){const t=le().user.role,s=je(),n=o.useRef(t);o.useEffect(()=>{if(n.current!==t){n.current=t;for(const a of sn)s.resetQueries({queryKey:a})}},[t,s])}const ge=768;function an(){const[t,s]=o.useState(void 0);return o.useEffect(()=>{const n=window.matchMedia(`(max-width: ${ge-1}px)`),a=()=>{s(window.innerWidth<ge)};return n.addEventListener("change",a),s(window.innerWidth<ge),()=>n.removeEventListener("change",a)},[]),!!t}const rn=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Kt,currentIdRef:{current:null},currentContextRef:{current:null}});function on(t,s){t.current=s.current}function ln(t,s={open:!1}){const{open:n}=s,a="rootStore"in t?t.rootStore:t,r=a.useState("floatingId"),u=o.useContext(rn),{currentIdRef:d,delayRef:i,timeoutMs:x,initialDelayRef:c,currentContextRef:g,hasProvider:b,timeout:f}=u,[j,l]=o.useState(!1),S=o.useRef(n);return L(()=>{S.current=n},[n]),L(()=>{function h(){g.current?.setIsInstantPhase(!1),d.current=null,g.current=null,i.current=c.current,f.clear()}if(d.current&&!n&&d.current===r){if(l(!1),x){const m=r;return f.start(x,()=>{a.select("open")||d.current&&d.current!==m||h()}),()=>{(S.current||d.current!==m)&&f.clear()}}h()}},[n,r,d,i,x,c,g,f,a]),L(()=>{if(!n)return;const h=g.current,m=d.current;f.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:l},d.current=r,i.current={open:0,close:me(c.current,"close")},m!==null&&m!==r?(l(!0),h?.setIsInstantPhase(!0),h?.onOpenChange(!1,B(Ge))):(l(!1),h?.setIsInstantPhase(!1))},[n,r,a,d,i,c,g,f]),L(()=>()=>{if(d.current===r){if(g.current=null,!S.current)return;d.current=null,on(i,c),f.clear()}},[g,d,i,r,c,f]),o.useMemo(()=>({hasProvider:b,delayRef:i,isInstantPhase:j}),[b,i,j])}function dn(t,s){let n=null,a=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const u=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=s.axis==="x"||s.axis==="both",i=s.axis==="y"||s.axis==="both",x=["mouseenter","mousemove"].includes(s.dataRef.current.openEvent?.type||"")&&s.pointerType!=="touch";let c=u.width,g=u.height,b=u.x,f=u.y;return n==null&&s.x&&d&&(n=u.x-s.x),a==null&&s.y&&i&&(a=u.y-s.y),b-=n||0,f-=a||0,c=0,g=0,!r||x?(c=s.axis==="y"?u.width:0,g=s.axis==="x"?u.height:0,b=d&&s.x!=null?s.x:b,f=i&&s.y!=null?s.y:f):r&&!x&&(g=s.axis==="x"?u.height:g,c=s.axis==="y"?u.width:c),r=!0,{width:c,height:g,x:b,y:f,top:f,right:b+c,bottom:f+g,left:b}}}}function Ae(t){return t!=null&&t.clientX!=null}function cn(t,s={}){const{enabled:n=!0,axis:a="both"}=s,r="rootStore"in t?t.rootStore:t,u=r.useState("open"),d=r.useState("floatingElement"),i=r.useState("domReferenceElement"),x=r.context.dataRef,c=o.useRef(!1),g=o.useRef(null),[b,f]=o.useState(),[j,l]=o.useState([]),S=ce(v=>{r.set("positionReference",v)}),h=ce((v,y,R)=>{c.current||x.current.openEvent&&!Ae(x.current.openEvent)||r.set("positionReference",dn(R??i,{x:v,y,axis:a,dataRef:x,pointerType:b}))}),m=ce(v=>{u?g.current||(h(v.clientX,v.clientY,v.currentTarget),l([])):h(v.clientX,v.clientY,v.currentTarget)}),C=Ve(b)?d:u;o.useEffect(()=>{if(!n){S(i);return}if(!C)return;function v(){g.current?.(),g.current=null}const y=bt(d);function R(P){const p=fs(P);xe(d,p)?v():h(P.clientX,P.clientY)}return!x.current.openEvent||Ae(x.current.openEvent)?g.current=Yt(y,"mousemove",R):S(i),v},[C,n,d,x,i,r,h,S,j]),o.useEffect(()=>()=>{r.set("positionReference",null)},[r]),o.useEffect(()=>{n&&!d&&(c.current=!1)},[n,d]),o.useEffect(()=>{!n&&u&&(c.current=!0)},[n,u]);const N=o.useMemo(()=>{function v(y){f(y.pointerType)}return{onPointerDown:v,onPointerEnter:v,onMouseMove:m,onMouseEnter:m}},[m]);return o.useMemo(()=>n?{reference:N,trigger:N}:{},[n,N])}function un({...t}){return e.jsx(Dt,{"data-slot":"sheet",...t})}function pn({...t}){return e.jsx(Lt,{"data-slot":"sheet-portal",...t})}function gn({className:t,...s}){return e.jsx($t,{"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 hn({className:t,children:s,side:n="right",showCloseButton:a=!0,...r}){return e.jsxs(pn,{children:[e.jsx(gn,{}),e.jsxs(It,{"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),...r,children:[s,a&&e.jsxs(At,{"data-slot":"sheet-close",render:e.jsx(Z,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[e.jsx(_t,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function fn({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:w("flex flex-col gap-0.5 p-4",t),...s})}function xn({className:t,...s}){return e.jsx(zt,{"data-slot":"sheet-title",className:w("font-heading text-base font-medium text-foreground",t),...s})}function mn({className:t,...s}){return e.jsx(Ht,{"data-slot":"sheet-description",className:w("text-sm text-muted-foreground",t),...s})}const tt=o.createContext(void 0);function Y(t){const s=o.useContext(tt);if(s===void 0&&!t)throw new Error(ne(72));return s}const bn={...Bt,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 vn extends Wt{constructor(s,n,a){const r=new Qt;super(jn(s,r,n,a),yn(r),bn)}setOpen=(s,n)=>{Xt(this,s,n,{extraState:{openChangeReason:n.reason}})};cancelPendingOpen(s){this.state.floatingRootContext.dispatchOpenChange(!1,B(xs,s))}}function jn(t,s,n,a=!1){const r={...Ft(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...t};return r.floatingRootContext=Ut(s,n,a),r}function yn(t){return{popupRef:o.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:t}}const Sn=Jt(function(s){const{disabled:n=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:u=!1,trackCursorAxis:d="none",actionsRef:i,onOpenChange:x,onOpenChangeComplete:c,handle:g,triggerId:b,defaultTriggerId:f=null,children:j}=s,l=Zt(($,F)=>new vn({open:a,openProp:r,activeTriggerId:f,triggerIdProp:b},$,F));l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",b),l.useContextCallback("onOpenChange",x),l.useContextCallback("onOpenChangeComplete",c);const S=l.useState("open"),h=!n&&S,m=l.useState("activeTriggerId"),C=l.useState("mounted"),N=l.useState("payload");l.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:u,disabled:n}),es(l,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:v,transitionStatus:y}=ts(h,l),R=l.useState("isInstantPhase"),P=l.useState("instantType"),p=l.useState("lastOpenChangeReason"),k=o.useRef(null);L(()=>{S&&n&&l.setOpen(!1,B(ms))},[S,n,l]),L(()=>{y==="ending"&&p===Ge||y!=="ending"&&R?(P!=="delay"&&(k.current=P),l.set("instantType","delay")):k.current!==null&&(l.set("instantType",k.current),k.current=null)},[y,R,p,P,l]),L(()=>{h&&m==null&&l.set("payload",void 0)},[l,m,h]),o.useImperativeHandle(i,()=>({unmount:v,close:()=>l.setOpen(!1,B(bs))}),[v,l]);const A=h||C||!n&&d!=="none";return e.jsxs(tt.Provider,{value:l,children:[g&&e.jsx(ss,{handle:g,store:l}),A&&e.jsx(wn,{store:l,disabled:n,trackCursorAxis:d}),typeof j=="function"?j({payload:N}):j]})});function wn({store:t,disabled:s,trackCursorAxis:n}){const a=t.useState("floatingRootContext"),r=ns(a,{enabled:!s,referencePress:()=>t.select("closeOnClick")}),u=cn(a,{enabled:!s&&n!=="none",axis:n==="none"?void 0:n}),d=o.useMemo(()=>ye(u.reference,r.reference),[u.reference,r.reference]);return as(t,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:r.floating??vt}),null}const Nn=o.createContext(void 0);function Cn(){return o.useContext(Nn)}const _e=600,st="data-base-ui-tooltip-trigger";function ze(t){if("composedPath"in t){const n=t.composedPath();for(let a=0;a<n.length;a+=1){const r=n[a];if(fe(r))return r}}const s=t.target;return fe(s)?s:null}function kn(t){let s=t;for(;s;){const n=s.closest(`[${st}]`);if(n)return n;const a=s.getRootNode();s="host"in a&&fe(a.host)?a.host:null}return null}const Tn=rs(function(s,n){const{render:a,className:r,style:u,handle:d,payload:i,disabled:x,delay:c,closeOnClick:g=!0,closeDelay:b,id:f,...j}=s,l=Y(!0),h=js(d)??l;if(!h)throw new Error(ne(82));const m=vs(f),C=h.useState("isTriggerActive",m),N=h.useState("isOpenedByTrigger",m),v=h.useState("floatingRootContext"),y=o.useRef(null),R=c??_e,P=b??0,{registerTrigger:p,isMountedByThisTrigger:k}=os(m,y,h,{payload:i,closeOnClick:g,closeDelay:P}),A=Cn(),{delayRef:$,isInstantPhase:F,hasProvider:D}=ln(v,{open:N}),U=ys(v);h.useSyncedValue("isInstantPhase",F);const de=h.useState("disabled"),q=x??de,Pe=is(q),Re=h.useState("trackCursorAxis"),lt=h.useState("disableHoverablePopup"),V=o.useRef(!1),W=ls(),X=o.useRef(void 0);function Me(){return D?me($.current,"open")===0?0:c??A??_e:R}function Ee(T){const z=y.current;if(!z||!T)return!1;const H=kn(T);return H!==null&&H!==z&&xe(z,H)}function dt(T){const z=Ee(T);return V.current=z,z&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,W.clear()),z}const ct=Ss(v,{enabled:!q,mouseOnly:!0,move:!1,handleClose:!lt&&Re!=="both"?ws():null,restMs:Me,delay(){return b==null&&D?{close:me($.current,"close")}:{close:P}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>h.select("transitionStatus")==="ending",shouldOpen(){return!V.current}}),ut=Ns(v,{enabled:!q}).reference,pt=T=>{const z=V.current,H=ze(T),Oe=dt(H),Q=y.current,ht=Q&&H&&xe(Q,H);if(Oe&&h.select("open")&&h.select("lastOpenChangeReason")===ue){h.setOpen(!1,B(ue,T));return}if(z&&!Oe&&ht&&!Pe.current&&!h.select("open")&&Q&&Ve(X.current)){const De=()=>{!V.current&&!Pe.current&&!h.select("open")&&h.setOpen(!0,B(ue,T,Q))},Ie=Me();Ie===0?(W.clear(),De()):W.start(Ie,De)}},gt=h.useState("triggerProps",k);return Se("button",s,{state:{open:N},ref:[n,p,y],props:[ct,ut,k||Re!=="none"?gt:void 0,{onMouseOver(T){pt(T.nativeEvent)},onFocus(T){Ee(ze(T.nativeEvent))&&T.preventBaseUIHandler()},onMouseLeave(){V.current=!1,W.clear(),X.current=void 0},onPointerEnter(T){X.current=T.pointerType},onPointerDown(T){X.current=T.pointerType,h.set("closeOnClick",g),g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},onClick(T){g&&!h.select("open")&&h.cancelPendingOpen(T.nativeEvent)},id:m,"data-trigger-disabled":q?"":void 0,[st]:q?void 0:""},j],stateAttributesMapping:ds})}),nt=o.createContext(void 0);function Pn(){const t=o.useContext(nt);if(t===void 0)throw new Error(ne(70));return t}const Rn=o.forwardRef(function(s,n){const{children:a,container:r,className:u,render:d,style:i,...x}=s,{node:c,subtree:g}=cs({container:r,ref:n,componentProps:s,elementProps:x});return!g&&!c?null:e.jsxs(o.Fragment,{children:[g,c&&jt.createPortal(a,c)]})}),Mn=o.forwardRef(function(s,n){const{keepMounted:a=!1,...r}=s;return Y().useState("mounted")||a?e.jsx(nt.Provider,{value:a,children:e.jsx(Rn,{ref:n,...r})}):null}),at=o.createContext(void 0);function rt(){const t=o.useContext(at);if(t===void 0)throw new Error(ne(71));return t}const En=o.forwardRef(function(s,n){const{render:a,className:r,anchor:u,positionMethod:d="absolute",side:i="top",align:x="center",sideOffset:c=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:f=5,arrowPadding:j=5,sticky:l=!1,disableAnchorTracking:S=!1,collisionAvoidance:h=us,style:m,...C}=s,N=Y(),v=Pn(),y=N.useState("open"),R=N.useState("mounted"),P=N.useState("trackCursorAxis"),p=N.useState("disableHoverablePopup"),k=N.useState("floatingRootContext"),A=N.useState("instantType"),$=N.useState("transitionStatus"),F=N.useState("adaptiveOrigin"),D=Ts({anchor:u,positionMethod:d,floatingRootContext:k,mounted:R,side:i,sideOffset:c,align:x,alignOffset:g,collisionBoundary:b,collisionPadding:f,sticky:l,arrowPadding:j,disableAnchorTracking:S,keepMounted:v,collisionAvoidance:h,adaptiveOrigin:F}),U=o.useMemo(()=>({open:y,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:P!=="none"?"tracking-cursor":A}),[y,D.side,D.align,D.anchorHidden,P,A]),de=Ps(s,U,{styles:D.positionerStyles,transitionStatus:$,props:C,refs:[n,N.useStateSetter("positionerElement")],hidden:!R,inert:!y||P==="both"||p});return e.jsx(at.Provider,{value:D,children:de})}),On=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{side:x,align:c}=rt(),g=i.useState("open"),b=i.useState("instantType"),f=i.useState("transitionStatus"),j=i.useState("popupProps"),l=i.useState("floatingRootContext"),S=i.useState("disabled"),h=i.useState("closeDelay");Ms({open:g,ref:i.context.popupRef,onComplete(){g&&i.context.onOpenChangeComplete?.(!0)}}),Cs(l,{enabled:!S,closeDelay:h});const m=i.useStateSetter("popupElement");return Se("div",s,{state:{open:g,side:x,align:c,instant:b,transitionStatus:f},ref:[n,i.context.popupRef,m],props:[ps,j,Rs(f),d],stateAttributesMapping:gs})}),Dn=o.forwardRef(function(s,n){const{render:a,className:r,style:u,...d}=s,i=Y(),{arrowRef:x,side:c,align:g,arrowUncentered:b,arrowStyles:f}=rt(),j=i.useState("open"),l=i.useState("instantType");return Se("div",s,{state:{open:j,side:c,align:g,uncentered:b,instant:l},ref:[n,x],props:[{style:f,"aria-hidden":!0},d],stateAttributesMapping:hs})});function In({...t}){return e.jsx(Sn,{"data-slot":"tooltip",...t})}function An({...t}){return e.jsx(Tn,{"data-slot":"tooltip-trigger",...t})}function _n({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:u,...d}){return e.jsx(Mn,{children:e.jsx(En,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(On,{"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:[u,e.jsx(Dn,{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 zn="sidebar_state",Hn=3600*24*7,Ln="16rem",$n="18rem",Bn="3rem",Fn="b",ot=o.createContext(null);function Te(){const t=o.useContext(ot);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Un({defaultOpen:t=!0,open:s,onOpenChange:n,className:a,style:r,children:u,...d}){const i=an(),[x,c]=o.useState(!1),[g,b]=o.useState(t),f=s??g,j=o.useCallback(m=>{const C=typeof m=="function"?m(f):m;n?n(C):b(C),document.cookie=`${zn}=${C}; path=/; max-age=${Hn}`},[n,f]),l=o.useCallback(()=>i?c(m=>!m):j(m=>!m),[i,j,c]);o.useEffect(()=>{const m=C=>{C.key===Fn&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),l())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l]);const S=f?"expanded":"collapsed",h=o.useMemo(()=>({state:S,open:f,setOpen:j,isMobile:i,openMobile:x,setOpenMobile:c,toggleSidebar:l}),[S,f,j,i,x,c,l]);return e.jsx(ot.Provider,{value:h,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ln,"--sidebar-width-icon":Bn,...r},className:w("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...d,children:u})})}function qn({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:a,children:r,dir:u,...d}){const{isMobile:i,state:x,openMobile:c,setOpenMobile:g}=Te();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:r}):i?e.jsx(un,{open:c,onOpenChange:g,...d,children:e.jsxs(hn,{dir:u,"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":$n},side:t,children:[e.jsxs(fn,{className:"sr-only",children:[e.jsx(xn,{children:"Sidebar"}),e.jsx(mn,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:r})]})}):e.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":x,"data-collapsible":x==="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:r})})]})}function Vn({className:t,onClick:s,...n}){const{toggleSidebar:a}=Te();return e.jsxs(Z,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:w(t),onClick:r=>{s?.(r),a()},...n,children:[e.jsx(Zs,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Gn({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 Kn({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 Yn({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 Wn({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 He({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 Xn({className:t,render:s,...n}){return Ye({defaultTagName:"div",props:ye({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 Le({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 he({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 M({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 Qn=yt("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 E({render:t,isActive:s=!1,variant:n="default",size:a="default",tooltip:r,className:u,...d}){const{isMobile:i,state:x}=Te(),c=Ye({defaultTagName:"button",props:ye({className:w(Qn({variant:n,size:a}),u)},d),render:r?e.jsx(An,{render:t}):t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:s}});return r?(typeof r=="string"&&(r={children:r}),e.jsxs(In,{children:[c,e.jsx(_n,{side:"right",align:"center",hidden:x!=="collapsed"||i,...r})]})):c}function Jn({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 Zn({open:t,onOpenChange:s}){const n=le(),a=ae(),[r,u]=o.useState(""),[d,i]=o.useState(0),x=o.useRef(null),c=r.trim(),[g,b]=o.useState("");o.useEffect(()=>{const p=setTimeout(()=>b(c),180);return()=>clearTimeout(p)},[c]);const f=we({queryKey:["activity","search",g],queryFn:()=>ee.activity({q:g,status:"all",limit:8}),enabled:t&&g.length>=2,staleTime:3e4});o.useEffect(()=>{t||(u(""),i(0))},[t]);const j=K(n.user.role,"settings"),l=o.useMemo(()=>[{id:"s:sites",label:"Sites",icon:e.jsx(se,{className:"size-4"}),go:()=>void a({to:"/sites"})},{id:"s:activity",label:"Activity",hint:"every site, newest first",icon:e.jsx(Xe,{className:"size-4"}),go:()=>void a({to:"/activity"})},...j?[{id:"s:members",label:"Members",icon:e.jsx(be,{className:"size-4"}),go:()=>void a({to:"/studio/members"})},{id:"s:integrations",label:"Integrations",icon:e.jsx(Qe,{className:"size-4"}),go:()=>void a({to:"/studio/integrations"})},{id:"s:studio",label:"Studio settings",icon:e.jsx(Ce,{className:"size-4"}),go:()=>void a({to:"/studio"})}]:[],{id:"s:you",label:"You",icon:e.jsx(et,{className:"size-4"}),go:()=>void a({to:"/you"})}],[a,j]),S=o.useMemo(()=>n.projects.map(p=>({id:`p:${p.uid}`,label:p.name,hint:p.unresolved>0?`${p.unresolved} open`:"nothing open",icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.uid}})})),[n.projects,a]),h=p=>!c||p.toLowerCase().includes(c.toLowerCase()),m=[],C=S.filter(p=>h(p.label)),N=l.filter(p=>h(p.label));C.length&&m.push({title:"Sites",items:C}),N.length&&m.push({title:"Go to",items:N});const v=(f.data?.data??[]).map(p=>({id:`t:${p.id}`,label:p.latest?.body?.trim()||p.route,hint:`${p.site.name} · ${wt(p.status)?St[p.status]:p.status} · ${p.key}`,icon:e.jsx(ve,{className:"size-4"}),go:()=>void a({to:"/s/$site/comments",params:{site:p.site.uid},search:{thread:p.key}})}));v.length&&m.push({title:"Comments",items:v});const y=m.flatMap(p=>p.items),R=Math.min(d,Math.max(0,y.length-1)),P=p=>{p&&(s(!1),p.go())};return o.useEffect(()=>{x.current?.querySelector(`[data-at="${R}"]`)?.scrollIntoView({block:"nearest"})},[R]),e.jsx(Fe,{open:t,onOpenChange:s,children:e.jsxs(Ue,{showCloseButton:!1,className:"top-[15%] max-h-[70dvh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg",children:[e.jsx(qe,{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(Ke,{className:"size-4 shrink-0 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:r,onChange:p=>{u(p.target.value),i(0)},onKeyDown:p=>{p.key==="ArrowDown"?(p.preventDefault(),i(k=>Math.min(k+1,y.length-1))):p.key==="ArrowUp"?(p.preventDefault(),i(k=>Math.max(k-1,0))):p.key==="Enter"&&(p.preventDefault(),P(y[R]))},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:x,className:"min-h-0 flex-1 overflow-auto py-1.5",children:[y.length===0&&e.jsx("p",{className:"m-0 px-3 py-6 text-center text-[13px] text-muted-foreground",children:f.isFetching?"Looking…":c?`Nothing matches “${c}”.`:"Nothing here."}),m.map(p=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:p.title}),p.items.map(k=>{const A=y.indexOf(k);return e.jsxs("button",{type:"button","data-at":A,onMouseMove:()=>i(A),onClick:()=>P(k),className:w("flex w-full items-center gap-2.5 border-0 bg-transparent px-3 py-2 text-left text-[13px] text-foreground",A===R&&"bg-muted"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:k.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),k.hint&&e.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:k.hint})]},k.id)})]},p.title)),f.isFetching&&y.length>0&&e.jsxs("p",{className:"m-0 flex items-center gap-1.5 px-3 py-1.5 text-[12px] text-muted-foreground",children:[e.jsx(Nt,{className:"size-3"}),"Searching every site…"]})]})]})})}function ea(){const[t,s]=o.useState(!1);return o.useEffect(()=>{const n=a=>{a.key.toLowerCase()!=="k"||!(a.metaKey||a.ctrlKey)||(a.preventDefault(),s(r=>!r))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),[t,s]}const it="https://snagset.com/docs/",ta="https://www.npmjs.com/package/@snagset/server?activeTab=versions",sa="https://snagset.com/docs/self-hosting/#upgrade";function na({children:t}){const s=le(),n=$e(s),a=Ct(s),[r,u]=ea();return nn(),e.jsxs(Un,{children:[e.jsx(oa,{me:s,site:a}),e.jsxs(Gn,{className:"min-w-0",children:[e.jsx(ua,{onSearch:()=>u(!0)}),n&&e.jsx(aa,{names:s.pendingMigrations??[],owner:s.user.role==="owner"}),n&&s.regionMismatch&&K(s.user.role,"settings")&&e.jsx(ra,{...s.regionMismatch}),e.jsx("div",{className:"min-h-0 flex-1",children:t})]}),e.jsx(Zn,{open:r,onOpenChange:u})]})}function aa({names:t,owner:s}){return t.length?e.jsxs("div",{role:"alert",className:"mx-7 mt-4 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:[e.jsxs("p",{className:"m-0 font-medium",children:["The database needs an update for this version (",t.length," ",t.length===1?"migration":"migrations",")."]}),e.jsx("p",{className:"m-0 mt-0.5",children:s?e.jsxs(e.Fragment,{children:["Run ",e.jsx("code",{className:"font-mono",children:"snagset migrate"})," with this instance's ",e.jsx("code",{className:"font-mono",children:"DATABASE_URL"})," — from the project, ",e.jsx("code",{className:"font-mono",children:"pnpm migrate"}),". Until then, parts of this version may fail."]}):"Ask the studio's owner to run snagset migrate. Until then, parts of this version may fail."})]}):null}function ra({functions:t,database:s,suggest:n}){return e.jsxs("div",{role:"status",className:"mx-7 mt-4 rounded-md border border-border bg-warn-soft px-3 py-2 text-[13px]",children:[e.jsxs("p",{className:"m-0 font-medium",children:["This server runs in ",t,", but its database is in ",s," — every page waits on that distance."]}),e.jsx("p",{className:"m-0 mt-0.5 text-muted-foreground",children:n?e.jsxs(e.Fragment,{children:["Add ",e.jsxs("code",{className:"font-mono",children:['"regions": ["',n,'"]']})," to ",e.jsx("code",{className:"font-mono",children:"vercel.json"})," and redeploy."]}):"Run the server in the same region as the database."})]})}function oa({me:t,site:s}){const n=Ls({select:i=>i.location.pathname}),a=i=>n===i||n.startsWith(i+"/"),r=K(t.user.role,"settings"),u=we(Be.setupState()),d=t.user.role==="owner"?u.data?.billingUrl:null;return e.jsxs(qn,{children:[e.jsx(Kn,{className:"px-2 pb-1 pt-3",children:e.jsx(ia,{me:t})}),e.jsxs(Wn,{children:[e.jsxs(He,{children:[e.jsx(la,{me:t,site:s}),s&&e.jsx(Le,{children:e.jsxs(he,{children:[e.jsxs(M,{children:[e.jsxs(E,{isActive:a(`/s/${s.uid}/comments`),render:e.jsx(_,{to:"/s/$site/comments",params:{site:s.uid}}),children:[e.jsx(ve,{}),e.jsx("span",{children:"Comments"})]}),s.unresolved>0&&e.jsx(Jn,{children:s.unresolved})]}),e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/reviewers`),render:e.jsx(_,{to:"/s/$site/reviewers",params:{site:s.uid}}),children:[e.jsx(be,{}),e.jsx("span",{children:"Reviewers"})]})}),r&&e.jsx(M,{children:e.jsxs(E,{isActive:a(`/s/${s.uid}/settings`),render:e.jsx(_,{to:"/s/$site/settings",params:{site:s.uid}}),children:[e.jsx(Ze,{}),e.jsx("span",{children:"Site settings"})]})})]})})]}),e.jsxs(He,{children:[e.jsx(Xn,{children:"Studio"}),e.jsx(Le,{children:e.jsxs(he,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/sites"),render:e.jsx(_,{to:"/sites"}),children:[e.jsx(se,{}),e.jsx("span",{children:"Sites"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/activity"),render:e.jsx(_,{to:"/activity"}),children:[e.jsx(Xe,{}),e.jsx("span",{children:"Activity"})]})}),r&&e.jsxs(e.Fragment,{children:[e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/members"),render:e.jsx(_,{to:"/studio/members"}),children:[e.jsx(be,{}),e.jsx("span",{children:"Members"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/integrations"),render:e.jsx(_,{to:"/studio/integrations"}),children:[e.jsx(Qe,{}),e.jsx("span",{children:"Integrations"})]})}),e.jsx(M,{children:e.jsxs(E,{isActive:n==="/studio",render:e.jsx(_,{to:"/studio"}),children:[e.jsx(Ce,{}),e.jsx("span",{children:"Studio settings"})]})})]})]})})]})]}),e.jsx(Yn,{children:e.jsxs(he,{children:[d&&e.jsx(M,{children:e.jsxs(E,{isActive:a("/studio/plan"),render:e.jsx(_,{to:"/studio/plan"}),children:[e.jsx(Ys,{}),e.jsx("span",{children:"Plan & billing"})]})}),e.jsx(M,{children:e.jsxs(E,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),e.jsx("span",{children:"Docs"}),e.jsx(J,{className:"ml-auto size-3.5 text-muted-foreground"})]})}),e.jsx(M,{children:e.jsx(da,{})}),e.jsx(M,{children:e.jsx(ca,{me:t})})]})})]})}function ia({me:t}){const s=ae(),n=je(),[a,r]=o.useState(!1),[u,d]=o.useState(""),[i,x]=o.useState(""),[c,g]=o.useState(!1),b=e.jsxs(e.Fragment,{children:[e.jsx(Tt,{size:20}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",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})]})]}),f=K(t.user.role,"settings");if(t.orgs.length<=1&&!t.signupOpen)return f?e.jsx(_,{to:"/studio",className:"flex items-center gap-2.5 rounded-md border border-transparent px-2.5 py-1 text-foreground transition-colors hover:border-border hover:bg-sidebar-accent","aria-label":`${t.org.name} — studio settings`,children:b}):e.jsx("div",{className:"flex items-center gap-2.5 border border-transparent px-2.5 py-1 text-foreground",children:b});const j=async l=>{g(!0),x("");try{await l(),n.clear(),r(!1),d(""),s({to:"/sites",replace:!0})}catch(S){x(S instanceof Error?S.message:"Something went wrong. Try again.")}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md border border-transparent px-2.5 py-1 text-foreground transition-colors hover:border-border hover:bg-sidebar-accent","aria-label":"Switch studio"}),children:[b,e.jsx(ke,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Studios"}),t.orgs.map(l=>e.jsxs(I,{disabled:l.current,onClick:()=>void j(()=>ee.switchOrg(l.slug)),children:[e.jsx(Ce,{}),e.jsx("span",{className:"truncate",children:l.name}),l.current&&e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"current"})]},l.slug))]}),(f||t.signupOpen)&&e.jsx(G,{}),f&&e.jsxs(I,{onClick:()=>void s({to:"/studio"}),children:[e.jsx(Ze,{}),"Studio settings"]}),t.signupOpen&&e.jsxs(I,{onClick:()=>r(!0),children:[e.jsx(We,{}),"New studio…"]})]})]}),e.jsx(Fe,{open:a,onOpenChange:l=>!c&&r(l),children:e.jsx(Ue,{className:"sm:max-w-[420px]",children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:l=>{l.preventDefault(),j(()=>ee.createOrg(u.trim()||"My studio"))},children:[e.jsxs(qt,{children:[e.jsx(qe,{children:"New studio"}),e.jsx(Vt,{children:"Its own sites, members and settings. You are its owner, and you move to it now — this one stays in the menu."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ds,{htmlFor:"new-studio-name",children:"Studio name"}),e.jsx(Is,{id:"new-studio-name",value:u,onChange:l=>d(l.target.value),placeholder:"My studio",autoFocus:!0})]}),i&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:i}),e.jsxs(Gt,{children:[e.jsx(Z,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:c,children:"Cancel"}),e.jsx(Z,{type:"submit",loading:c,children:c?"Creating…":"Create studio"})]})]})})})]})}function la({me:t,site:s}){const n=ae();return e.jsxs(re,{children:[e.jsxs(oe,{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 transition-colors hover:bg-sidebar-accent","aria-label":"Switch site"}),children:[e.jsx("span",{className:"truncate",children:s?.name??"No sites yet"}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",className:"w-[240px]",children:[e.jsxs(Ne,{children:[e.jsx(te,{children:"Sites"}),t.projects.filter(a=>!a.archived||a.uid===s?.uid).map(a=>e.jsxs(I,{onClick:()=>void n({to:"/s/$site/comments",params:{site:a.uid}}),children:[e.jsx(se,{}),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(G,{}),K(t.user.role,"settings")&&e.jsxs(I,{onClick:()=>void n({to:"/sites",search:{add:!0}}),children:[e.jsx(We,{}),"Add a site"]}),e.jsxs(I,{onClick:()=>void n({to:"/sites"}),children:[e.jsx(se,{}),"All sites"]})]})]})}function da(){const t=$e(le()),s=we(Be.meta()),n=s.data?.version??"",[a,r]=o.useState({state:"idle"}),u=async()=>{r({state:"checking"});try{r({state:"done",result:await As(n)})}catch{r({state:"failed"})}};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{}),children:[e.jsx(Gs,{}),e.jsx("span",{children:"Help"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[240px]",children:[e.jsxs(I,{render:e.jsx("a",{href:it,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Je,{}),"Docs",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsxs(I,{render:e.jsx("a",{href:ta,target:"_blank",rel:"noreferrer"}),children:["Changelog",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),s.data?.sourceUrl&&e.jsxs(I,{render:e.jsx("a",{href:s.data.sourceUrl,target:"_blank",rel:"noreferrer"}),children:["Source · AGPL",e.jsx(J,{className:"ml-auto size-3 text-muted-foreground"})]}),e.jsx(G,{}),e.jsxs("div",{className:"px-2 py-1.5 text-[12px] text-muted-foreground",children:["Snagset ",n||"—",t&&a.state==="idle"&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>void u(),children:"Check for updates"})]}),a.state==="checking"&&" · checking…",a.state==="failed"&&" · could not reach npm",a.state==="done"&&a.result&&e.jsxs(e.Fragment,{children:[" · ",a.result.newer?e.jsxs("a",{href:sa,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:[a.result.latest," is out — how to upgrade"]}):"up to date"]})]})]})]})}function ca({me:t}){const s=ae(),n=je(),[a,r]=o.useState(Pt),u=t.user.name||t.user.email,d=t.user.name?t.user.email:t.user.role,i=async()=>{await ee.logout().catch(()=>{}),Et("out"),n.clear(),s({to:"/sign-in",replace:!0})};return e.jsxs(re,{children:[e.jsxs(oe,{render:e.jsx(E,{size:"lg"}),children:[e.jsx(Es,{className:"size-8 rounded-full",children:e.jsx(Os,{className:"bg-primary text-[12px] font-semibold text-primary-foreground",children:Rt(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:u}),e.jsx("div",{className:"truncate text-[11.5px] text-muted-foreground",children:d})]}),e.jsx(ke,{className:"size-3.5 text-muted-foreground"})]}),e.jsxs(ie,{align:"start",side:"top",className:"w-[250px]",children:[e.jsx(Ne,{children:e.jsxs(te,{className:"flex flex-col",children:[e.jsx("span",{className:"text-[13px] font-semibold",children:u}),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(G,{}),e.jsxs(ks,{value:a,onValueChange:x=>{const c=x;Mt(c),r(c)},children:[e.jsx(te,{children:"Theme"}),e.jsxs(pe,{value:"system",children:[e.jsx(_s,{}),"System"]}),e.jsxs(pe,{value:"light",children:[e.jsx(zs,{}),"Light"]}),e.jsxs(pe,{value:"dark",children:[e.jsx(Hs,{}),"Dark"]})]}),e.jsx(G,{}),e.jsxs(I,{onClick:()=>void s({to:"/you"}),children:[e.jsx(et,{}),"You"]}),e.jsxs(I,{onClick:()=>void i(),children:[e.jsx(Xs,{}),"Sign out"]})]})]})}function ua({onSearch:t}){const n=kt().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(Vn,{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,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-line-strong",children:"/"}),e.jsx("span",{className:r===n.length-1?"text-foreground":void 0,children:a})]},r))}),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(Ke,{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 Ha=()=>e.jsx(na,{children:e.jsx(Ot,{})});export{Ha as component};
@@ -0,0 +1 @@
1
+ import{a1 as p,a2 as g,a3 as f,p as v,j as e,a4 as N,B as x,a5 as P,L as j,a6 as y,a7 as b,a8 as w,a9 as R,S}from"./index-CUBD0DcL.js";import{P as E}from"./Picker-BvdKGeU8.js";import{Q as k,u as F}from"./useBaseQuery-BBU42uTr.js";import{u as M}from"./me-DeblO6Os.js";import"./chevron-down-OinKSKsq.js";import"./check-26YOtWVN.js";import"./useScrollLock-DV4rQnvf.js";import"./inertValue-BxLh7N1J.js";import"./createBaseUIEventDetails-BlUeVOHL.js";import"./isElementDisabled-CwHw_lZC.js";import"./serializeValue-B8e3iXO-.js";import"./useValueChanged-BcwdNwDJ.js";import"./getPseudoElementBounds-087ogDm1.js";import"./CompositeList-CDfO6SCy.js";var A=class extends k{constructor(s,n){super(s,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,n){const{state:r}=s,l=super.createResult(s,n),{isFetching:o,isRefetching:i,isError:u,isRefetchError:d}=l,t=r.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",m=u&&t==="backward",h=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:g(n,r.data),hasPreviousPage:p(n,r.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:m,isFetchingPreviousPage:h,isRefetchError:d&&!c&&!m,isRefetching:i&&!a&&!h}}};function C(s,n){return F(s,A)}const D=[{value:"unresolved",label:"Needs attention"},...R.map(s=>({value:s,label:S[s]})),{value:"all",label:"Everything"}];function L(s,n=new Date){const r=new Date(s),l=i=>new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),o=Math.round((l(n)-l(r))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?r.toLocaleDateString(void 0,{weekday:"long"}):r.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function K(){const s=M(),{status:n="unresolved",site:r}=f.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),i=C(w(n,r)),u=i.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=L(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(N,{title:"Activity",sub:`Every site, newest first${r?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[D.map(t=>e.jsx(x,{size:"sm",variant:n===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsx(E,{"aria-label":"Site",size:"sm",className:"w-auto min-w-40 text-foreground",value:r??"",onChange:t=>o({site:t||void 0}),options:[{value:"",label:"All sites"},...s.projects.map(t=>({value:t.uid,label:t.name}))]})]})]}),i.isPending&&e.jsx(P,{rows:4}),i.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),i.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:n==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":n==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(j,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(y,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:b(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),i.hasNextPage&&e.jsx("div",{children:e.jsx(x,{variant:"outline",size:"sm",disabled:i.isFetchingNextPage,onClick:()=>void i.fetchNextPage(),children:i.isFetchingNextPage?"Reading…":"Show older"})})]})}export{K as component};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-X11XkRkb.js";/**
1
+ import{c as o}from"./index-CUBD0DcL.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as a,i as b,k as f,j as d,h as m}from"./index-X11XkRkb.js";import{m as A}from"./useScrollLock-DDlrhOw8.js";const x=a.createContext(void 0);function k(){const e=a.useContext(x);if(e===void 0)throw new Error(b(13));return e}const g={imageLoadingStatus:()=>null},z=a.forwardRef(function(t,r){const{className:v,render:p,style:s,...c}=t,[n,o]=a.useState("idle"),i={imageLoadingStatus:n},u=a.useMemo(()=>({imageLoadingStatus:n,setImageLoadingStatus:o}),[n,o]),l=f("span",t,{state:i,ref:r,props:c,stateAttributesMapping:g});return d.jsx(x.Provider,{value:u,children:l})}),R=a.forwardRef(function(t,r){const{className:v,render:p,delay:s=0,style:c,...n}=t,{imageLoadingStatus:o}=k(),[i,u]=a.useState(s===0),l=A();return a.useEffect(()=>(s>0?l.start(s,()=>u(!0)):u(!0),l.clear),[l,s]),f("span",t,{state:{imageLoadingStatus:o},ref:r,props:n,stateAttributesMapping:g,enabled:o!=="loaded"&&(s===0||i)})});function h({className:e,size:t="default",...r}){return d.jsx(z,{"data-slot":"avatar","data-size":t,className:m("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...r})}function M({className:e,...t}){return d.jsx(R,{"data-slot":"avatar-fallback",className:m("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{h as A,M as a};
1
+ import{r as a,i as b,k as f,j as d,h as m}from"./index-CUBD0DcL.js";import{m as A}from"./useScrollLock-DV4rQnvf.js";const x=a.createContext(void 0);function k(){const e=a.useContext(x);if(e===void 0)throw new Error(b(13));return e}const g={imageLoadingStatus:()=>null},z=a.forwardRef(function(t,r){const{className:v,render:p,style:s,...c}=t,[n,o]=a.useState("idle"),i={imageLoadingStatus:n},u=a.useMemo(()=>({imageLoadingStatus:n,setImageLoadingStatus:o}),[n,o]),l=f("span",t,{state:i,ref:r,props:c,stateAttributesMapping:g});return d.jsx(x.Provider,{value:u,children:l})}),R=a.forwardRef(function(t,r){const{className:v,render:p,delay:s=0,style:c,...n}=t,{imageLoadingStatus:o}=k(),[i,u]=a.useState(s===0),l=A();return a.useEffect(()=>(s>0?l.start(s,()=>u(!0)):u(!0),l.clear),[l,s]),f("span",t,{state:{imageLoadingStatus:o},ref:r,props:n,stateAttributesMapping:g,enabled:o!=="loaded"&&(s===0||i)})});function h({className:e,size:t="default",...r}){return d.jsx(z,{"data-slot":"avatar","data-size":t,className:m("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...r})}function M({className:e,...t}){return d.jsx(R,{"data-slot":"avatar-fallback",className:m("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{h as A,M as a};
@@ -1 +1 @@
1
- import{m as a,h as n,o}from"./index-X11XkRkb.js";import{u as d}from"./useRender-BZe0PUs7.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
1
+ import{m as a,h as n,o}from"./index-CUBD0DcL.js";import{u as d}from"./useRender-CNreHlDo.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-X11XkRkb.js";/**
1
+ import{c}from"./index-CUBD0DcL.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-X11XkRkb.js";/**
1
+ import{c as o}from"./index-CUBD0DcL.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-X11XkRkb.js";/**
1
+ import{c as o}from"./index-CUBD0DcL.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-X11XkRkb.js";/**
1
+ import{c}from"./index-CUBD0DcL.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r,ak as o,i as R,E as v,bb as w,ai as C,f as T,e as m,l as h,b6 as D}from"./index-X11XkRkb.js";function k(e){return e?.ownerDocument||document}const F={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},x={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},S={disabled:!1,...x},B={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},y={invalid:void 0,name:void 0,validityData:{state:F,errors:[],error:"",value:"",initialValue:null},setValidityData:o,disabled:void 0,setTouched:o,setDirty:o,setFilled:o,setFocused:o,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:S,registerFieldControl:o,validation:{getValidationProps:(e,t=v)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:o,getInputControl:()=>null,commit:async()=>{},change:o}},L=r.createContext(y);function A(e=!0){const t=r.useContext(L);if(t.setValidityData===o&&!e)throw new Error(R(28));return t}const P=r.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:o,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function $(){return r.useContext(P)}let b=0;function _(e,t="mui"){const[n,s]=r.useState(e),i=e||n;return r.useEffect(()=>{n==null&&(b+=1,s(`${t}-${b}`))},[n,t]),i}const E=w.useId;function M(e,t){if(E!==void 0){const n=E();return e??(t?`${t}-${n}`:n)}return _(e,t)}function O(e){return M(e,"base-ui")}const U=r.createContext({controlId:void 0,registerControlId:o,labelId:void 0,setLabelId:o,messageIds:[],setMessageIds:o,getDescriptionProps:e=>e});function V(){return r.useContext(U)}function z(e={}){const{id:t,implicit:n=!1,controlRef:s}=e,{controlId:i,registerControlId:l}=V(),a=O(t),u=n?i:void 0,c=C(()=>Symbol()),d=r.useRef(!1),I=r.useRef(t!=null),g=T(()=>{!d.current||l===o||(d.current=!1,l(c.current,void 0))});return m(()=>{if(l===o)return;let f;if(n){const p=s?.current;h(p)&&p.closest("label")!=null?f=t??null:f=u??a}else if(t!=null)I.current=!0,f=t;else if(I.current)f=a;else{g();return}if(f===void 0){g();return}d.current=!0,l(c.current,f)},[t,s,u,l,n,a,c,g]),r.useEffect(()=>g,[g]),i??a}function Y(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function j(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&D(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function q(e){return"composedPath"in e?e.composedPath()[0]:e.target}function G({controlled:e,default:t,name:n,state:s="value"}){const{current:i}=r.useRef(e!==void 0),[l,a]=r.useState(t),u=i?e:l,c=r.useCallback(d=>{i||a(d)},[]);return[u,c]}function H(e,t,n,s,i=!0,l){const{registerFieldControl:a}=A(),u=C(()=>Symbol());m(()=>{const c=u.current;if(!i){a(c,void 0);return}a(c,{controlRef:e,getValue:s,id:t,name:l,value:n})},[e,i,s,t,l,a,u,n]),m(()=>{const c=u.current;return()=>{a(c,void 0)}},[a,u])}const J="none",K="trigger-press",W="trigger-hover",X="trigger-focus",Q="outside-press",Z="item-press",ee="close-press",te="focus-out",ne="escape-key",se="list-navigation",oe="cancel-open",ae="sibling-open",re="disabled",ie="missing",le="initial",ue="imperative-action",ce="window-resize";function de(e,t,n,s){let i=!1,l=!1;const a=s??v;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:n,...a}}export{z as A,ce as B,le as C,ie as D,ee as E,j as a,W as b,de as c,re as d,$ as e,B as f,q as g,A as h,ue as i,V as j,G as k,H as l,Y as m,J as n,k as o,X as p,ne as q,Z as r,Q as s,K as t,O as u,ae as v,M as w,te as x,se as y,oe as z};
1
+ import{r,ax as o,i as R,E as v,bo as w,av as C,f as T,e as m,l as h,bj as D}from"./index-CUBD0DcL.js";function k(e){return e?.ownerDocument||document}const x={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},F={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},S={disabled:!1,...F},B={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},y={invalid:void 0,name:void 0,validityData:{state:x,errors:[],error:"",value:"",initialValue:null},setValidityData:o,disabled:void 0,setTouched:o,setDirty:o,setFilled:o,setFocused:o,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:S,registerFieldControl:o,validation:{getValidationProps:(e,t=v)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:o,getInputControl:()=>null,commit:async()=>{},change:o}},L=r.createContext(y);function A(e=!0){const t=r.useContext(L);if(t.setValidityData===o&&!e)throw new Error(R(28));return t}const P=r.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:o,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function $(){return r.useContext(P)}let E=0;function _(e,t="mui"){const[n,s]=r.useState(e),i=e||n;return r.useEffect(()=>{n==null&&(E+=1,s(`${t}-${E}`))},[n,t]),i}const b=w.useId;function M(e,t){if(b!==void 0){const n=b();return e??(t?`${t}-${n}`:n)}return _(e,t)}function O(e){return M(e,"base-ui")}const U=r.createContext({controlId:void 0,registerControlId:o,labelId:void 0,setLabelId:o,messageIds:[],setMessageIds:o,getDescriptionProps:e=>e});function V(){return r.useContext(U)}function z(e={}){const{id:t,implicit:n=!1,controlRef:s}=e,{controlId:i,registerControlId:l}=V(),a=O(t),u=n?i:void 0,c=C(()=>Symbol()),d=r.useRef(!1),I=r.useRef(t!=null),g=T(()=>{!d.current||l===o||(d.current=!1,l(c.current,void 0))});return m(()=>{if(l===o)return;let f;if(n){const p=s?.current;h(p)&&p.closest("label")!=null?f=t??null:f=u??a}else if(t!=null)I.current=!0,f=t;else if(I.current)f=a;else{g();return}if(f===void 0){g();return}d.current=!0,l(c.current,f)},[t,s,u,l,n,a,c,g]),r.useEffect(()=>g,[g]),i??a}function j(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Y(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&D(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function q(e){return"composedPath"in e?e.composedPath()[0]:e.target}function G({controlled:e,default:t,name:n,state:s="value"}){const{current:i}=r.useRef(e!==void 0),[l,a]=r.useState(t),u=i?e:l,c=r.useCallback(d=>{i||a(d)},[]);return[u,c]}function H(e,t,n,s,i=!0,l){const{registerFieldControl:a}=A(),u=C(()=>Symbol());m(()=>{const c=u.current;if(!i){a(c,void 0);return}a(c,{controlRef:e,getValue:s,id:t,name:l,value:n})},[e,i,s,t,l,a,u,n]),m(()=>{const c=u.current;return()=>{a(c,void 0)}},[a,u])}const J="none",K="trigger-press",W="trigger-hover",X="trigger-focus",Q="outside-press",Z="item-press",ee="close-press",te="focus-out",ne="escape-key",se="list-navigation",oe="cancel-open",ae="sibling-open",re="disabled",ie="missing",le="initial",ue="imperative-action",ce="window-resize";function de(e,t,n,s){let i=!1,l=!1;const a=s??v;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){l=!0},get isCanceled(){return i},get isPropagationAllowed(){return l},trigger:n,...a}}export{z as A,ce as B,le as C,ie as D,ee as E,Y as a,W as b,de as c,re as d,$ as e,B as f,q as g,A as h,ue as i,V as j,G as k,H as l,j as m,J as n,k as o,X as p,ne as q,Z as r,Q as s,K as t,O as u,ae as v,M as w,te as x,se as y,oe as z};