@aidotnet/server-win32-x64 0.14.3110 → 0.14.3112

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 (65) hide show
  1. package/bin/astra-server.exe +2 -2
  2. package/bin/wwwroot/assets/ClientsPage-CE9QdKbh.js +11 -0
  3. package/bin/wwwroot/assets/KeyPage-Db9tYWgA.js +1 -0
  4. package/bin/wwwroot/assets/LibraryPage-Djro5zZa.js +2 -0
  5. package/bin/wwwroot/assets/McpPage-BJ7D5vt6.js +9 -0
  6. package/bin/wwwroot/assets/ModelDetailPage-DuyD1_Ei.js +1 -0
  7. package/bin/wwwroot/assets/ModelsPage-Dc1KK7-3.js +1 -0
  8. package/bin/wwwroot/assets/PluginsPage-Dn1IYmlm.js +2 -0
  9. package/bin/wwwroot/assets/PrivacyPage-Dsaaw5Ko.js +1 -0
  10. package/bin/wwwroot/assets/ProviderDetailPage-C5YbB46r.js +3 -0
  11. package/bin/wwwroot/assets/ProvidersPage-BzICHtxh.js +3 -0
  12. package/bin/wwwroot/assets/RoutingGroupsPage-B-7FNn_B.js +3 -0
  13. package/bin/wwwroot/assets/SettingsPage-CCOHxf9s.js +2 -0
  14. package/bin/wwwroot/assets/SkillsPage-BdZSd_hw.js +1 -0
  15. package/bin/wwwroot/assets/SmartRoutingPage-DIkU4HND.js +2 -0
  16. package/bin/wwwroot/assets/TokenDetailPage-DA6q9gbd.js +1 -0
  17. package/bin/wwwroot/assets/TokenPoolEditor-CISTyNzC.js +1 -0
  18. package/bin/wwwroot/assets/TokensPage-CUJXAz7I.js +1 -0
  19. package/bin/wwwroot/assets/ToolsPage-DOHJoH86.js +1 -0
  20. package/bin/wwwroot/assets/TracesPage-f3hY7JcZ.js +8 -0
  21. package/bin/wwwroot/assets/{TrayPanelPage-CackS8OH.js → TrayPanelPage-HGV5ST-e.js} +1 -1
  22. package/bin/wwwroot/assets/{TrayPanelView-Cj0Pwm7y.js → TrayPanelView-BhyK24F_.js} +1 -1
  23. package/bin/wwwroot/assets/TrayTitleSource-DN10ruw2.js +41 -0
  24. package/bin/wwwroot/assets/{checkbox-DFbPH3ZB.js → checkbox-CZ-rG7I2.js} +1 -1
  25. package/bin/wwwroot/assets/clientNames-Bskc9G1M.js +1 -0
  26. package/bin/wwwroot/assets/{confirm-morph-Cu1awcrW.js → confirm-morph-Cakq9Lho.js} +1 -1
  27. package/bin/wwwroot/assets/file-up-BZh1Gcck.js +1 -0
  28. package/bin/wwwroot/assets/flame-BPbKoD7V.js +1 -0
  29. package/bin/wwwroot/assets/format-CmXxTS5M.js +15 -0
  30. package/bin/wwwroot/assets/index-BW8keTkg.js +124 -0
  31. package/bin/wwwroot/assets/index-WJKZ_ywJ.css +1 -0
  32. package/bin/wwwroot/assets/layers-lBgMUT4n.js +1 -0
  33. package/bin/wwwroot/assets/library-BUD1zsIb.js +1 -0
  34. package/bin/wwwroot/assets/{radio-cards-C0nGl7Px.js → radio-cards-BTn8kpAx.js} +1 -1
  35. package/bin/wwwroot/assets/{sortable.esm-KYAcfdq_.js → sortable.esm-Cj5-STJU.js} +1 -1
  36. package/bin/wwwroot/assets/use-transform-BcmlojQJ.js +1 -0
  37. package/bin/wwwroot/assets/wrench-gp64nTHm.js +1 -0
  38. package/bin/wwwroot/index.html +8 -5
  39. package/package.json +1 -1
  40. package/bin/wwwroot/assets/ClientsPage-DF3rflag.js +0 -9
  41. package/bin/wwwroot/assets/KeyPage-B7_1Yr16.js +0 -1
  42. package/bin/wwwroot/assets/McpPage-CvN5NYlZ.js +0 -9
  43. package/bin/wwwroot/assets/ModelDetailPage-CyE8Xpqg.js +0 -1
  44. package/bin/wwwroot/assets/ModelsPage-Cct68Oc8.js +0 -1
  45. package/bin/wwwroot/assets/PluginsPage-DiMYLnBv.js +0 -2
  46. package/bin/wwwroot/assets/PrivacyPage-Bdyo4YN_.js +0 -1
  47. package/bin/wwwroot/assets/ProviderDetailPage-CZLD3Mo2.js +0 -3
  48. package/bin/wwwroot/assets/ProvidersPage-DhvpZLqS.js +0 -3
  49. package/bin/wwwroot/assets/SettingsPage-QVURVf8n.js +0 -2
  50. package/bin/wwwroot/assets/SkillsPage-DUAhBBjy.js +0 -1
  51. package/bin/wwwroot/assets/SmartRoutingPage-yxPbwM3u.js +0 -2
  52. package/bin/wwwroot/assets/TokenDetailPage-jvkJ9wIf.js +0 -1
  53. package/bin/wwwroot/assets/TokenPoolEditor-eWoOGd9t.js +0 -1
  54. package/bin/wwwroot/assets/TokensPage-BTnINKwi.js +0 -1
  55. package/bin/wwwroot/assets/TracesPage-CGAcVl3u.js +0 -8
  56. package/bin/wwwroot/assets/TrayTitleSource-EINzpQeQ.js +0 -41
  57. package/bin/wwwroot/assets/file-up-mqWdjdlX.js +0 -1
  58. package/bin/wwwroot/assets/flame-DLlSOIlR.js +0 -1
  59. package/bin/wwwroot/assets/format-Bw-mDeuE.js +0 -15
  60. package/bin/wwwroot/assets/index-D2hgi2oA.js +0 -122
  61. package/bin/wwwroot/assets/index-D74BlcEH.css +0 -1
  62. package/bin/wwwroot/assets/layers-Dzm_l0k4.js +0 -1
  63. package/bin/wwwroot/assets/library-CQ0z7xCA.js +0 -1
  64. package/bin/wwwroot/assets/use-transform-BEsJGrlr.js +0 -1
  65. package/bin/wwwroot/assets/wrench-DVonHu-a.js +0 -1
@@ -1 +1 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{C as n,Ta as r,To as i,ci as a,ht as o,wo as s}from"./format-Bw-mDeuE.js";import{R as c,U as l,W as u,n as d,o as f,r as p,s as m}from"./TrayTitleSource-EINzpQeQ.js";import{t as h}from"./TrayPanelView-Cj0Pwm7y.js";var g=e(t(),1),_=i(),v=new Set([`astra.theme`,`astra.accent`,`astra.locale`]);function y(){let{t:e}=n(),t=s(),{toast:i}=u(),y=r(),[b]=f(),x=m(),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(`overview`),E=p(b,{enabled:x.running,background:!0,live:S}),D=a(),O=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=document.documentElement;e.dataset.view=`tray`,e.style.background=`transparent`,document.body.style.background=`transparent`},[]);let k=(0,g.useCallback)(()=>{t.invalidateQueries({queryKey:[`stats`]}),t.invalidateQueries({queryKey:o.providers}),t.invalidateQueries({queryKey:o.clients}),t.invalidateQueries({queryKey:[`provider-accounts`]})},[t]);(0,g.useEffect)(()=>y?.tray.onVisibilityChanged(e=>{C(e),e&&(T(`overview`),k())}),[y,k]),(0,g.useEffect)(()=>{x.running&&k()},[x.running,k]),(0,g.useEffect)(()=>{let e=e=>{e.key&&v.has(e.key)&&window.location.reload()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y?.tray.command(`hide`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,g.useLayoutEffect)(()=>{let e=O.current;if(!e||!y)return;let t=[`header`,`tabs`,`body`,`footer`].map(t=>e.querySelector(`[data-tray-part="${t}"]`)),n=()=>{let n=e.offsetHeight-e.clientHeight,r=t.reduce((e,t)=>e+(t?.offsetHeight??0),0)+n;y.tray.resize(r)},r=new ResizeObserver(n);for(let e of t)e&&r.observe(e);return n(),()=>r.disconnect()},[y]),d(b,x,E.summary,E.plans);let A=e=>void y?.tray.command(e),j=async()=>{E.settings&&await c.copy(`${E.settings.gatewayBaseUrl}/v1`)&&i(e(`common.copied`))},M=async t=>{let n=E.providers;if(n.length===0)return;let r=await c.contextMenu(n.map(n=>({id:n.id,label:n.enabled?n.name:e(`tray.disabledProvider`,{name:n.name}),type:`checkbox`,checked:n.id===t.providerId})));r&&r!==t.providerId&&D.mutate({kind:t.kind,providerId:r},{onError:e=>i(l(e),`error`)})};return(0,_.jsx)(`div`,{className:`h-full`,children:(0,_.jsx)(h,{ref:O,className:`h-full`,prefs:b,state:x,data:E,tab:w,onTabChange:T,onCommand:A,onRefresh:k,onCopyAddress:()=>void j(),onSwitchClient:e=>void M(e)})})}export{y as TrayPanelPage};
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Ct as n,Qo as r,Qs as i,Zs as a,ca as o,w as s}from"./format-CmXxTS5M.js";import{R as c,U as l,W as u,n as d,o as f,r as p,s as m}from"./TrayTitleSource-DN10ruw2.js";import{t as h}from"./TrayPanelView-BhyK24F_.js";var g=e(t(),1),_=i(),v=new Set([`astra.theme`,`astra.accent`,`astra.locale`]);function y(){let{t:e}=s(),t=a(),{toast:i}=u(),y=r(),[b]=f(),x=m(),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(`overview`),E=p(b,{enabled:x.running,background:!0,live:S}),D=o(),O=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=document.documentElement;e.dataset.view=`tray`,e.style.background=`transparent`,document.body.style.background=`transparent`},[]);let k=(0,g.useCallback)(()=>{t.invalidateQueries({queryKey:[`stats`]}),t.invalidateQueries({queryKey:n.providers}),t.invalidateQueries({queryKey:n.clients}),t.invalidateQueries({queryKey:[`provider-accounts`]})},[t]);(0,g.useEffect)(()=>y?.tray.onVisibilityChanged(e=>{C(e),e&&(T(`overview`),k())}),[y,k]),(0,g.useEffect)(()=>{x.running&&k()},[x.running,k]),(0,g.useEffect)(()=>{let e=e=>{e.key&&v.has(e.key)&&window.location.reload()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y?.tray.command(`hide`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,g.useLayoutEffect)(()=>{let e=O.current;if(!e||!y)return;let t=[`header`,`tabs`,`body`,`footer`].map(t=>e.querySelector(`[data-tray-part="${t}"]`)),n=()=>{let n=e.offsetHeight-e.clientHeight,r=t.reduce((e,t)=>e+(t?.offsetHeight??0),0)+n;y.tray.resize(r)},r=new ResizeObserver(n);for(let e of t)e&&r.observe(e);return n(),()=>r.disconnect()},[y]),d(b,x,E.summary,E.plans);let A=e=>void y?.tray.command(e),j=async()=>{E.settings&&await c.copy(`${E.settings.gatewayBaseUrl}/v1`)&&i(e(`common.copied`))},M=async t=>{let n=E.providers;if(n.length===0)return;let r=await c.contextMenu(n.map(n=>({id:n.id,label:n.enabled?n.name:e(`tray.disabledProvider`,{name:n.name}),type:`checkbox`,checked:n.id===t.providerId})));r&&r!==t.providerId&&D.mutate({kind:t.kind,providerId:r},{onError:e=>i(l(e),`error`)})};return(0,_.jsx)(`div`,{className:`h-full`,children:(0,_.jsx)(h,{ref:O,className:`h-full`,prefs:b,state:x,data:E,tab:w,onTabChange:T,onCommand:A,onRefresh:k,onCopyAddress:()=>void j(),onSwitchClient:e=>void M(e)})})}export{y as TrayPanelPage};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{C as n,H as r,To as i,c as a,j as o,u as s,ut as c}from"./format-Bw-mDeuE.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-EINzpQeQ.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-D2hgi2oA.js";var z=e(t(),1),B=i(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:r,onCommand:i,onRefresh:a,onCopyAddress:s,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=n(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>i?.(e),x=[`overview`];e.sections.quota&&(r.plans.length>0||r.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&r.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=r.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:c(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(o,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:s,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:r,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:r,onRefresh:a}),e.sections.quota&&(0,B.jsx)(ne,{data:r,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:r,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:r,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:r}){let{t:i}=n(),a={overview:i(`tray.tab.overview`),quota:i(`tray.tab.quota`),clients:i(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>r(e),className:c(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:a[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:c(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:r}){let{t:i,locale:o}=n(),s=t.summary,c=e.sections.overview&&s?y(s):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!s||c===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c>0&&(0,B.jsx)(W,{tone:`red`,children:i(`tray.alert.failures`,{count:c,share:a(c/s.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:r,children:i(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,i,o),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=n();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:i}){let{t:o,locale:c}=n(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,c,o(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:o(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:o(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:o(`common.refresh`),onClick:i,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:o(`tray.requests`),value:s(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:o(`tray.tokens`),value:s(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:o(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:o(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:o(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:o(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:o(`tray.loadFailed`)}):(0,B.jsx)(r,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:r}=n(),i=f(e.hourly,new Date(t)),a=Math.max(1,...i.map(e=>e.value)),o=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":r(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:i.map((e,t)=>{let n=e.value>0?Math.max(4,Math.round(e.value/a*64)):2;return(0,B.jsx)(`span`,{title:r(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:n,background:t===o?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>o?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:r,locale:i}=n();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:r(`tray.quotaPending`)}):null;let a=p(e.plans,3),o=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:r(`tray.quotaTightest`)}),o>a.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[r(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),a.map(({plan:e,row:t},n)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,r,i)})]}),(0,B.jsx)($,{row:t,locale:i})]},`${e.accountId}-${t.kind}-${n}`))]})}function re({data:e,plain:t}){let{t:r}=n();if(e.plans.length===0&&!e.hasSubscriptions)return null;let i=new Map;for(let t of e.plans)i.set(t.providerId,(i.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:c(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:r(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:r(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:r(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(i.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:r,locale:i}=n();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let n=Q(e,r,i);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:n,children:n}),(0,B.jsx)($,{row:e,locale:i})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:r,plain:i}){let{t:a}=n(),o=e.clients.filter(e=>e.enabled);if(o.length===0)return null;let s=t=>e.providers.find(e=>e.id===t)?.name??a(`tray.unbound`);return(0,B.jsxs)(`section`,{className:c(`flex flex-col gap-1`,!i&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:a(`tray.clients`)}),o.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!r,onClick:()=>r?.(e),"aria-label":a(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:s(e.providerId)}),r&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{M as n,Qs as r,U as i,c as a,d as o,dt as s,w as c}from"./format-CmXxTS5M.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-DN10ruw2.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-BW8keTkg.js";var z=e(t(),1),B=r(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:r,onCommand:i,onRefresh:a,onCopyAddress:o,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=c(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>i?.(e),x=[`overview`];e.sections.quota&&(r.plans.length>0||r.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&r.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=r.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:s(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(n,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:o,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:r,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:r,onRefresh:a}),e.sections.quota&&(0,B.jsx)(ne,{data:r,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:r,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:r,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:n}){let{t:r}=c(),i={overview:r(`tray.tab.overview`),quota:r(`tray.tab.quota`),clients:r(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>n(e),className:s(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:i[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:s(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:n}){let{t:r,locale:i}=c(),o=t.summary,s=e.sections.overview&&o?y(o):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!o||s===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s>0&&(0,B.jsx)(W,{tone:`red`,children:r(`tray.alert.failures`,{count:s,share:a(s/o.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:n,children:r(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,r,i),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:n}){let{t:r,locale:s}=c(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,s,r(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:r(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:r(`common.refresh`),onClick:n,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:r(`tray.requests`),value:o(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:r(`tray.tokens`),value:o(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:r(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:r(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:r(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:r(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:r(`tray.loadFailed`)}):(0,B.jsx)(i,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:n}=c(),r=f(e.hourly,new Date(t)),i=Math.max(1,...r.map(e=>e.value)),a=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":n(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:r.map((e,t)=>{let r=e.value>0?Math.max(4,Math.round(e.value/i*64)):2;return(0,B.jsx)(`span`,{title:n(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:r,background:t===a?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>a?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:n,locale:r}=c();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):null;let i=p(e.plans,3),a=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n(`tray.quotaTightest`)}),a>i.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[n(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),i.map(({plan:e,row:t},i)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,n,r)})]}),(0,B.jsx)($,{row:t,locale:r})]},`${e.accountId}-${t.kind}-${i}`))]})}function re({data:e,plain:t}){let{t:n}=c();if(e.plans.length===0&&!e.hasSubscriptions)return null;let r=new Map;for(let t of e.plans)r.set(t.providerId,(r.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:n(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(r.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:n,locale:r}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let i=Q(e,n,r);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:i,children:i}),(0,B.jsx)($,{row:e,locale:r})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:n,plain:r}){let{t:i}=c(),a=e.clients.filter(e=>e.enabled);if(a.length===0)return null;let o=t=>e.providers.find(e=>e.id===t)?.name??i(`tray.unbound`);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-1`,!r&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:i(`tray.clients`)}),a.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!n,onClick:()=>n?.(e),"aria-label":i(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:o(e.providerId)}),n&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
@@ -0,0 +1,41 @@
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$ as n,As as r,Cs as i,Ct as a,Ds as o,Es as s,Go as c,Is as l,J as u,Jo as d,Js as f,Ks as p,Ns as m,O as h,Os as g,Q as _,Qo as v,Qs as y,Rs as b,S as x,Ss as S,T as C,Ts as w,Ws as T,Yo as E,Z as D,Zs as O,as as k,at as A,cs as j,d as M,ds as N,dt as P,et as F,is as I,it as L,js as ee,ks as te,lt as R,m as ne,nt as z,os as re,ot as ie,pt as ae,q as oe,rr as se,rt as ce,ss as le,st as ue,tt as B,us as de,ut as fe,w as pe,ws as me}from"./format-CmXxTS5M.js";import{t as he}from"./check-DKfsh0bQ.js";import{t as ge}from"./chevron-down-CQQqnJvT.js";import{t as _e}from"./chevron-up-BNvDpRa-.js";import{t as ve}from"./search-NI5nOaOz.js";import{t as ye}from"./x-AFrW8zH7.js";function be(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var xe=class extends b{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,l.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!f(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(be(e,n).forEach(e=>{e.destroy()}),be(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=p(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new m(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&l.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},V=e(t(),1);function Se({queries:e,...t},n){let i=O(n),a=ee(),c=r(),u=t.subscribed!==!1,d=V.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:u?`optimistic`:void 0,t}),[e,i,a,u]);d.forEach(e=>{me(e);let t=i.getQueryCache().get(e.queryHash);o(e,c,t)}),te(c);let[f]=V.useState(()=>new xe(i,d,t)),[p,h,_]=f.getOptimisticResult(d,t.combine),v=!a&&u;V.useSyncExternalStore(V.useCallback(e=>v?f.subscribe(l.batchCalls(e)):T,[f,v]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),V.useEffect(()=>{f.setQueries(d,t)},[d,t,f]);let y=p.some((e,t)=>s(d[t],e))?p.flatMap((e,t)=>{let n=d[t];if(n&&s(n,e)){let e=new m(i,n);return w(n,e,c)}return[]}):[];if(y.length>0)throw Promise.all(y);let b=p.find((e,t)=>{let n=d[t];return n&&g({result:e,errorResetBoundary:c,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(b)throw b.error;return h(_())}var H={field:`_field_qrf34_1`,control:`_control_qrf34_5`,disabled:`_disabled_qrf34_7`,open:`_open_qrf34_11`,searchIcon:`_searchIcon_qrf34_15`,chevron:`_chevron_qrf34_23`,clear:`_clear_qrf34_27`,hint:`_hint_qrf34_33`,popover:`_popover_qrf34_35`,autoHeight:`_autoHeight_qrf34_37`,listbox:`_listbox_qrf34_39`,option:`_option_qrf34_43`,check:`_check_qrf34_51`,empty:`_empty_qrf34_53`},U=y();function Ce({children:e,reduceMotion:t}){let n=(0,V.useRef)(null),[r,i]=(0,V.useState)(`auto`);return(0,V.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(()=>i(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),(0,U.jsx)(k.div,{className:H.autoHeight,initial:!1,animate:{height:r},transition:t?{duration:0}:D.spring.smooth,children:(0,U.jsx)(`div`,{ref:n,children:e})})}var we=(0,V.forwardRef)(function({label:e,options:t,value:n,defaultValue:r=``,onValueChange:i,description:a,placeholder:o=`Search or select…`,emptyMessage:s=`No matches found`,id:c,className:l,disabled:u,onFocus:d,...f},p){let m=(0,V.useId)(),h=c??m,g=`${h}-listbox`,_=a?`${h}-description`:void 0,v=(0,V.useRef)(null),y=(0,V.useRef)(null),b=(0,V.useRef)({}),x=le(),[S,C]=(0,V.useState)(r),[w,T]=(0,V.useState)(!1),[E,O]=(0,V.useState)(``),[A,j]=(0,V.useState)(-1),M=n??S,N=t.find(e=>e.value===M);(0,V.useImperativeHandle)(p,()=>y.current);let P=(0,V.useRef)(M);(0,V.useEffect)(()=>{if(P.current===M)return;P.current=M;let e=y.current;if(!e||x||M&&w)return;let t=M?re(e,{opacity:[0,1],y:[`0.35em`,`0em`],filter:[`blur(${D.blur.soft}px)`,`blur(0px)`]},{duration:D.duration.standard,ease:[...D.ease.enter]}):re(e,{opacity:[0,1]},{duration:D.duration.fast,ease:[...D.ease.enter]});return()=>t.complete()},[M,x,w]);let F=(0,V.useMemo)(()=>{let e=E.trim().toLocaleLowerCase();return e?t.filter(t=>[t.label,...t.keywords??[]].some(t=>t.toLocaleLowerCase().includes(e))):t},[t,E]),I=F.reduce((e,t,n)=>(t.disabled||e.push(n),e),[]);(0,V.useEffect)(()=>{if(!w)return;let e=A>=0?F[A]:void 0,t=e?b.current[e.value]:null,n=t?.parentElement;if(t&&n){let e=t.offsetTop,r=e+t.offsetHeight;e<n.scrollTop?n.scrollTop=e:r>n.scrollTop+n.clientHeight&&(n.scrollTop=r-n.clientHeight)}},[A,F,w]),(0,V.useEffect)(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&(T(!1),O(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let L=e=>{e.disabled||(C(e.value),i?.(e.value),O(``),T(!1),y.current?.focus())},ee=e=>{e.preventDefault(),C(``),i?.(``),O(``),T(!0),y.current?.focus()},te=()=>{u||(T(!0),O(``),j(-1))},R=e=>{if(!u){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!w){te();return}if(!I.length)return;let t=I.indexOf(A),n=e.key===`ArrowDown`?(t+1)%I.length:(t-1+I.length)%I.length;j(I[n]);return}if(e.key===`Enter`&&w&&A>=0){e.preventDefault();let t=F[A];t&&L(t);return}if(e.key===`Escape`&&w){e.preventDefault(),T(!1),O(``);return}}},ne=w?E:N?.label??``,z=A>=0?F[A]:void 0;return(0,U.jsxs)(`div`,{ref:v,className:H.field,children:[(0,U.jsx)(`label`,{htmlFor:h,children:e}),(0,U.jsxs)(`div`,{className:[H.control,w?H.open:``,u?H.disabled:``,l??``].filter(Boolean).join(` `),children:[(0,U.jsx)(ve,{className:H.searchIcon,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,U.jsx)(`input`,{...f,ref:y,id:h,type:`text`,role:`combobox`,value:ne,placeholder:N?.label??o,disabled:u,"aria-describedby":_,"aria-expanded":w,"aria-controls":w?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":w&&z?`${h}-option-${z.value}`:void 0,onFocus:e=>{d?.(e),te()},onClick:te,onChange:e=>{O(e.target.value),T(!0),j(-1)},onKeyDown:R}),(0,U.jsx)(de,{initial:!1,children:N&&!u&&(0,U.jsx)(k.button,{type:`button`,className:H.clear,"aria-label":`Clear selection`,onMouseDown:e=>e.preventDefault(),onClick:ee,initial:x?{opacity:0}:{opacity:0,scale:.6,filter:`blur(${D.blur.subtle}px)`},animate:{opacity:1,scale:1,filter:`blur(0px)`,transition:x?{duration:D.duration.instant}:{...D.spring.snappy,opacity:{duration:D.duration.fast}}},exit:{opacity:0,...x?{}:{scale:.6,filter:`blur(${D.blur.subtle}px)`},transition:{duration:D.duration.instant,ease:[...D.ease.standard]}},whileTap:{scale:x?1:.96,transition:{duration:D.duration.instant,ease:[...D.ease.standard]}},children:(0,U.jsx)(ye,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})}),(0,U.jsx)(ge,{className:H.chevron,size:16,strokeWidth:1.75,"aria-hidden":`true`})]}),a&&(0,U.jsx)(`span`,{id:_,className:H.hint,children:a}),(0,U.jsx)(de,{initial:!1,children:w&&(0,U.jsx)(k.div,{className:H.popover,initial:x?{opacity:0}:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1,transition:x?{duration:D.duration.instant}:{...D.spring.snappy,opacity:{duration:D.duration.fast,ease:[...D.ease.enter]}}},exit:{opacity:0,...x?{}:{y:-4,scale:.98},transition:{duration:D.duration.instant,ease:[...D.ease.standard]}},role:`presentation`,children:(0,U.jsx)(Ce,{reduceMotion:x,children:(0,U.jsx)(`div`,{id:g,className:H.listbox,role:`listbox`,"aria-label":`${e} options`,children:F.length?F.map((e,t)=>(0,U.jsxs)(`div`,{ref:t=>{b.current[e.value]=t},id:`${h}-option-${e.value}`,className:H.option,"data-active":t===A?`true`:void 0,"data-disabled":e.disabled?`true`:void 0,role:`option`,"aria-selected":e.value===M,"aria-disabled":e.disabled||void 0,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>!e.disabled&&j(t),onClick:()=>L(e),children:[(0,U.jsx)(`span`,{children:e.label}),e.value===M&&(0,U.jsx)(he,{className:H.check,size:16,strokeWidth:1.75,"aria-hidden":`true`})]},e.value)):(0,U.jsx)(k.div,{className:H.empty,role:`status`,initial:!x&&{opacity:0,y:4,filter:`blur(${D.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},transition:{duration:D.duration.standard,ease:[...D.ease.enter]},children:s})})})})})]})});we.displayName=`Combobox`;var Te=Object.defineProperty,Ee=(e,t)=>Te(e,`name`,{value:t,configurable:!0});function W(e){let t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ee(W,`useCallbackRef`);var De=Object.defineProperty,G=(e,t)=>De(e,`name`,{value:t,configurable:!0}),Oe=`dismissableLayer.update`,ke=`dismissableLayer.pointerDownOutside`,Ae=`dismissableLayer.focusOutside`,je,Me=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ne=V.forwardRef(G(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=V.useContext(Me),[d,f]=V.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=V.useState({}),h=R(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=V.useRef(!1),C=Ie(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:V.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Le(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=W(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return V.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),V.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(je=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Re(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=je))}},[d,p,n,u]),V.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Re())},[d,u]),V.useEffect(()=>{let e=G(()=>m({}),`handleUpdate`);return document.addEventListener(Oe,e),()=>document.removeEventListener(Oe,e)},[]),(0,U.jsx)(B.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:A(e.onFocusCapture,w.onFocusCapture),onBlurCapture:A(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:A(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function Pe(){let e=V.useContext(Me),[t,n]=V.useState(null);return V.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}G(Pe,`useDismissableLayerSurface`);var Fe=G(()=>!0,`IS_TRUE`);function Ie(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Fe}=t,s=W(e),c=V.useRef(!1),l=V.useRef(!1),u=V.useRef(new Map),d=V.useRef(()=>{});return V.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}G(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}G(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}G(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}G(p,`handleInteractionBubble`);let m=G(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||ze(ke,s,p,{discrete:!0})};if(G(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:G(()=>c.current=!0,`onPointerDownCapture`)}}G(Ie,`usePointerDownOutside`);function Le(e,t=globalThis?.document){let n=W(e),r=V.useRef(!1);return V.useEffect(()=>{let e=G(e=>{e.target&&!r.current&&ze(Ae,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:G(()=>r.current=!0,`onFocusCapture`),onBlurCapture:G(()=>r.current=!1,`onBlurCapture`)}}G(Le,`useFocusOutside`);function Re(){let e=new CustomEvent(Oe);document.dispatchEvent(e)}G(Re,`dispatchUpdate`);function ze(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?z(i,a):i.dispatchEvent(a)}G(ze,`handleAndDispatchCustomEvent`);var Be=Object.defineProperty,K=(e,t)=>Be(e,`name`,{value:t,configurable:!0}),Ve=`focusScope.autoFocusOnMount`,He=`focusScope.autoFocusOnUnmount`,Ue={bubbles:!1,cancelable:!0},We=V.forwardRef(K(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=V.useState(null),u=W(a),d=W(o),f=V.useRef(null),p=R(t,l),m=V.useRef(i);V.useEffect(()=>{m.current=i});let h=V.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:tt(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||tt(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&tt(c)};K(e,`handleFocusIn`),K(t,`handleFocusOut`),K(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),V.useEffect(()=>{if(c){nt.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(Ve,Ue);c.addEventListener(Ve,u),c.dispatchEvent(t),t.defaultPrevented||(Ye(at(Ze(c)),{select:!0}),document.activeElement===e&&tt(c))}return()=>{c.removeEventListener(Ve,u),setTimeout(()=>{let t=new CustomEvent(He,Ue);c.addEventListener(He,d),c.dispatchEvent(t),t.defaultPrevented||tt(e??document.body,{select:!0}),c.removeEventListener(He,d),nt.remove(g)},0)}}},[c,u,d,g]);let _=V.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Xe(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&tt(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&tt(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,U.jsx)(B.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Ge=V.createContext(null);function Ke({registry:e,children:t}){return e?(0,U.jsx)(Ge.Provider,{value:e,children:t}):t}K(Ke,`FocusScopeBranchProvider`);function qe(){let[e,t]=V.useState([]);return{nodes:e,registry:V.useMemo(()=>({add:K(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:K(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}K(qe,`useFocusScopeBranchRegistry`);function Je(e){let t=V.useContext(Ge);V.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}K(Je,`useFocusScopeBranch`);function Ye(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(tt(r,{select:t}),document.activeElement!==n)return}K(Ye,`focusFirst`);function Xe(e){let t=Ze(e);return[Qe(t,e),Qe(t.reverse(),e)]}K(Xe,`getTabbableEdges`);function Ze(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:K(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}K(Ze,`getTabbableCandidates`);function Qe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):$e(r,{upTo:t})))return r}K(Qe,`findVisible`);function $e(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}K($e,`isHidden`);function et(e){return e instanceof HTMLInputElement&&`select`in e}K(et,`isSelectableInput`);function tt(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&et(e)&&t&&e.select()}}K(tt,`focus`);var nt=rt();function rt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=it(e,t),e.unshift(t)},remove(t){e=it(e,t),e[0]?.resume()}}}K(rt,`createFocusScopesStack`);function it(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}K(it,`arrayRemove`);function at(e){return e.filter(e=>e.tagName!==`A`)}K(at,`removeLinks`);var ot=e(I(),1),st=Object.defineProperty,ct=V.forwardRef(((e,t)=>st(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=V.useState(!1);L(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?ot.createPortal((0,U.jsx)(B.div,{...r,ref:t}),o):null},`Portal`)),lt=Object.defineProperty,ut=(e,t)=>lt(e,`name`,{value:t,configurable:!0}),dt=0,ft=null;function pt(e){return mt(),e.children}ut(pt,`FocusGuards`);function mt(){V.useEffect(()=>{ft||={start:ht(),end:ht()};let{start:e,end:t}=ft;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),dt++,()=>{dt===1&&(ft?.start.remove(),ft?.end.remove(),ft=null),dt=Math.max(0,dt-1)}},[])}ut(mt,`useFocusGuards`);function ht(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}ut(ht,`createFocusGuard`);var gt=function(){return gt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gt.apply(this,arguments)};function _t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function vt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var yt=`right-scroll-bar-position`,bt=`width-before-scroll-bar`,xt=`with-scroll-bars-hidden`,St=`--removed-body-scroll-bar-size`;function Ct(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function wt(e,t){var n=(0,V.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Tt=typeof window<`u`?V.useLayoutEffect:V.useEffect,Et=new WeakMap;function Dt(e,t){var n=wt(t||null,function(t){return e.forEach(function(e){return Ct(e,t)})});return Tt(function(){var t=Et.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ct(e,null)}),i.forEach(function(e){r.has(e)||Ct(e,a)})}Et.set(n,e)},[e]),n}function Ot(e){return e}function kt(e,t){t===void 0&&(t=Ot);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function At(e){e===void 0&&(e={});var t=kt(null);return t.options=gt({async:!0,ssr:!1},e),t}var jt=function(e){var t=e.sideCar,n=_t(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return V.createElement(r,gt({},n))};jt.isSideCarExport=!0;function Mt(e,t){return e.useMedium(t),jt}var Nt=At(),Pt=function(){},Ft=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:Pt,onWheelCapture:Pt,onTouchMoveCapture:Pt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=_t(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Dt([n,t]),C=gt(gt({},b),i);return V.createElement(V.Fragment,null,u&&V.createElement(x,{sideCar:Nt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?V.cloneElement(V.Children.only(s),gt(gt({},C),{ref:S})):V.createElement(v,gt({},C,{className:c,ref:S}),s))});Ft.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ft.classNames={fullWidth:bt,zeroRight:yt};var It=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Lt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=It();return t&&e.setAttribute(`nonce`,t),e}function Rt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function zt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Bt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Lt())&&(Rt(t,n),zt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Vt=function(){var e=Bt();return function(t,n){V.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ht=function(){var e=Vt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ut={left:0,top:0,right:0,gap:0},Wt=function(e){return parseInt(e||``,10)||0},Gt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Wt(n),Wt(r),Wt(i)]},Kt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ut;var t=Gt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},qt=Ht(),Jt=`data-scroll-locked`,Yt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${xt} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${Jt}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${yt} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${bt} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${yt} .${yt} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${bt} .${bt} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${Jt}] {
36
+ ${St}: ${s}px;
37
+ }
38
+ `},Xt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Zt=function(){V.useEffect(function(){return document.body.setAttribute(Jt,(Xt()+1).toString()),function(){var e=Xt()-1;e<=0?document.body.removeAttribute(Jt):document.body.setAttribute(Jt,e.toString())}},[])},Qt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Zt();var a=V.useMemo(function(){return Kt(i)},[i]);return V.createElement(qt,{styles:Yt(a,!t,i,n?``:`!important`)})},$t=!1;if(typeof window<`u`)try{var en=Object.defineProperty({},"passive",{get:function(){return $t=!0,!0}});window.addEventListener(`test`,en,en),window.removeEventListener(`test`,en,en)}catch{$t=!1}var tn=$t?{passive:!1}:!1,nn=function(e){return e.tagName===`TEXTAREA`},rn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!nn(e)&&n[t]===`visible`)},an=function(e){return rn(e,`overflowY`)},on=function(e){return rn(e,`overflowX`)},sn=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),un(e,r)){var i=dn(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cn=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ln=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},un=function(e,t){return e===`v`?an(t):on(t)},dn=function(e,t){return e===`v`?cn(t):ln(t)},fn=function(e,t){return e===`h`&&t===`rtl`?-1:1},pn=function(e,t,n,r,i){var a=fn(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=dn(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&un(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},mn=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hn=function(e){return[e.deltaX,e.deltaY]},gn=function(e){return e&&`current`in e?e.current:e},_n=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vn=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},yn=0,bn=[];function xn(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),i=V.useState(yn++)[0],a=V.useState(Ht)[0],o=V.useRef(e);V.useEffect(function(){o.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=vt([e.lockRef.current],(e.shards||[]).map(gn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=V.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=mn(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=sn(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=sn(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return pn(h,t,e,h===`h`?s:c,!0)},[]),c=V.useCallback(function(e){var n=e;if(bn.length&&bn[bn.length-1]===a){var r=`deltaY`in n?hn(n):mn(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&_n(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(gn).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=V.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Sn(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=V.useCallback(function(e){n.current=mn(e),r.current=void 0},[]),d=V.useCallback(function(t){l(t.type,hn(t),t.target,s(t,e.lockRef.current))},[]),f=V.useCallback(function(t){l(t.type,mn(t),t.target,s(t,e.lockRef.current))},[]);V.useEffect(function(){return bn.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,tn),document.addEventListener(`touchmove`,c,tn),document.addEventListener(`touchstart`,u,tn),function(){bn=bn.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,tn),document.removeEventListener(`touchmove`,c,tn),document.removeEventListener(`touchstart`,u,tn)}},[]);var p=e.removeScrollBar,m=e.inert;return V.createElement(V.Fragment,null,m?V.createElement(a,{styles:vn(i)}):null,p?V.createElement(Qt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Sn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Cn=Mt(Nt,xn),wn=V.forwardRef(function(e,t){return V.createElement(Ft,gt({},e,{ref:t,sideCar:Cn}))});wn.classNames=Ft.classNames;var Tn=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},En=new WeakMap,Dn=new WeakMap,On={},kn=0,An=function(e){return e&&(e.host||An(e.parentNode))},jn=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=An(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Mn=function(e,t,n,r){var i=jn(t,Array.isArray(e)?e:[e]);On[n]||(On[n]=new WeakMap);var a=On[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(En.get(e)||0)+1,l=(a.get(e)||0)+1;En.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Dn.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),kn++,function(){o.forEach(function(e){var t=En.get(e)-1,i=a.get(e)-1;En.set(e,t),a.set(e,i),t||(Dn.has(e)||e.removeAttribute(r),Dn.delete(e)),i||e.removeAttribute(n)}),kn--,kn||(En=new WeakMap,En=new WeakMap,Dn=new WeakMap,On={})}},Nn=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Tn(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Mn(r,i,n,`aria-hidden`)):function(){return null}},Pn=Object.defineProperty,q=(e,t)=>Pn(e,`name`,{value:t,configurable:!0}),Fn=`Dialog`,[In,Ln]=fe(Fn),[Rn,zn]=In(Fn),Bn=q(e=>{let{__scopeDialog:t,children:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=V.useRef(null),l=V.useRef(null),{nodes:u,registry:d}=qe(),[f,p]=ce({prop:i,defaultProp:a??!1,onChange:o,caller:Fn}),[m,h]=V.useState(0),[g,_]=V.useState(0);return(0,U.jsx)(Rn,{scope:t,triggerRef:c,contentRef:l,contentId:n(),titleId:n(),descriptionId:n(),titlePresent:m>0,descriptionPresent:g>0,setTitleCount:h,setDescriptionCount:_,open:f,onOpenChange:p,onOpenToggle:V.useCallback(()=>p(e=>!e),[p]),modal:s,branchNodes:u,branchRegistry:d,children:r})},`Dialog`),Vn=`DialogPortal`,[Hn,Un]=In(Vn,{forceMount:void 0}),Wn=q(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=zn(Vn,t);return(0,U.jsx)(Hn,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,U.jsx)(F,{present:n||a.open,children:(0,U.jsx)(ct,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Gn=`DialogOverlay`,Kn=V.forwardRef(q(function(e,t){let n=Un(Gn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=zn(Gn,e.__scopeDialog);return a.modal?(0,U.jsx)(F,{present:r||a.open,children:(0,U.jsx)(Jn,{...i,ref:t})}):null},`DialogOverlay`)),qn=ue(`DialogOverlay.RemoveScroll`),Jn=V.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=zn(Gn,n),a=Pe(),o=R(t,a);return(0,U.jsx)(wn,{as:qn,allowPinchZoom:!0,shards:V.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,U.jsx)(B.div,{"data-state":ar(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Yn=`DialogContent`,Xn=V.forwardRef(q(function(e,t){let n=Un(Yn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=zn(Yn,e.__scopeDialog);return(0,U.jsx)(F,{present:r||a.open,children:a.modal?(0,U.jsx)(Zn,{...i,ref:t}):(0,U.jsx)(Qn,{...i,ref:t})})},`DialogContent`)),Zn=V.forwardRef(q(function(e,t){let n=zn(Yn,e.__scopeDialog),r=V.useRef(null),i=R(t,n.contentRef,r);return V.useEffect(()=>{let e=r.current;if(e)return Nn(e)},[]),(0,U.jsx)($n,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:A(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Qn=V.forwardRef(q(function(e,t){let n=zn(Yn,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,U.jsx)($n,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),$n=V.forwardRef(q(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=zn(Yn,n);return mt(),(0,U.jsx)(Ke,{registry:l.branchRegistry,children:(0,U.jsx)(We,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(Ne,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?ir(o,l.descriptionId):o,"data-state":ar(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),er=V.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=zn(`DialogTitle`,n),{setTitleCount:a}=i;return L(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(B.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),tr=V.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=zn(`DialogDescription`,n),{setDescriptionCount:a}=i;return L(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,U.jsx)(B.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),nr=`DialogClose`,rr=V.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=zn(nr,n);return(0,U.jsx)(B.button,{type:`button`,...r,ref:t,onClick:A(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ir(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}q(ir,`concatAriaDescribedby`);function ar(e){return e?`open`:`closed`}q(ar,`getState`);var J={overlay:`_overlay_1yxsw_1`,content:`_content_1yxsw_9`,keyframes:`_keyframes_1yxsw_17`,"overlay-in":`_overlay-in_1yxsw_1`,"overlay-out":`_overlay-out_1yxsw_1`,"content-fade-in":`_content-fade-in_1yxsw_1`,"content-rise-in":`_content-rise-in_1yxsw_1`,"content-out":`_content-out_1yxsw_1`,header:`_header_1yxsw_31`,title:`_title_1yxsw_33`,description:`_description_1yxsw_35`,swap:`_swap_1yxsw_39`,close:`_close_1yxsw_47`,body:`_body_1yxsw_53`,"content-fade-out":`_content-fade-out_1yxsw_1`},or=(0,V.createContext)(null);function sr({open:e,defaultOpen:t=!1,onOpenChange:n,...r}){let[i,a]=(0,V.useState)(t),o=e??i,s=(0,V.useCallback)(t=>{e===void 0&&a(t),n?.(t)},[e,n]);return(0,U.jsx)(or.Provider,{value:o,children:(0,U.jsx)(Bn,{...r,open:o,onOpenChange:s})})}var cr={duration:D.duration.instant},lr={duration:D.duration.fast,ease:[...D.ease.standard]};function ur({text:e}){let t=le();return(0,U.jsx)(de,{mode:`popLayout`,initial:!1,children:(0,U.jsx)(k.span,{className:J.swap,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${D.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${D.blur.subtle}px)`,transition:{duration:D.duration.fast,ease:[...D.ease.standard]}},transition:{duration:D.duration.standard,ease:[...D.ease.enter]},children:e},e)})}function dr({title:e,description:t,children:n,className:r,onPointerDownOutside:i,...a}){let o=(0,V.useContext)(or),s=le(),c=(0,V.useRef)({open:o,at:0});(0,V.useLayoutEffect)(()=>{c.current={open:o,at:performance.now()}},[o]);let l=e=>{i?.(e),o!==null&&(!c.current.open||e.detail.originalEvent.timeStamp<c.current.at)&&e.preventDefault()},u=[J.content,r].filter(Boolean).join(` `),d=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:J.header,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(er,{className:J.title,children:(0,U.jsx)(ur,{text:e})}),t?(0,U.jsx)(tr,{className:J.description,children:(0,U.jsx)(ur,{text:t})}):null]}),(0,U.jsx)(rr,{className:J.close,"aria-label":`Close dialog`,children:(0,U.jsx)(ye,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,U.jsx)(`div`,{className:J.body,children:n})]});return o===null?(0,U.jsxs)(Wn,{children:[(0,U.jsx)(Kn,{className:`${J.overlay} ${J.keyframes}`}),(0,U.jsx)(Xn,{...a,onPointerDownOutside:l,className:`${u} ${J.keyframes}`,children:d})]}):(0,U.jsx)(de,{children:o&&(0,U.jsxs)(Wn,{forceMount:!0,children:[(0,U.jsx)(Kn,{asChild:!0,forceMount:!0,children:(0,U.jsx)(k.div,{className:J.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:s?cr:lr},transition:s?cr:{duration:D.duration.standard,ease:[...D.ease.enter]}})}),(0,U.jsx)(Xn,{...a,onPointerDownOutside:l,asChild:!0,forceMount:!0,children:(0,U.jsx)(k.div,{className:u,initial:s?{opacity:0}:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:s?{opacity:0,transition:cr}:{opacity:0,y:4,scale:.98,transition:lr},transition:s?cr:{default:D.spring.smooth,opacity:{duration:D.duration.fast,ease:[...D.ease.enter]}},children:d})})]},`dialog`)})}var fr=[`top`,`right`,`bottom`,`left`],pr=Math.min,mr=Math.max,hr=Math.round,gr=Math.floor,_r=e=>({x:e,y:e}),vr={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function yr(e,t,n){return mr(e,pr(t,n))}function br(e,t){return typeof e==`function`?e(t):e}function xr(e){return e.split(`-`)[0]}function Sr(e){return e.split(`-`)[1]}function Cr(e){return e===`x`?`y`:`x`}function wr(e){return e===`y`?`height`:`width`}function Tr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Er(e){return Cr(Tr(e))}function Dr(e,t,n){n===void 0&&(n=!1);let r=Sr(e),i=Er(e),a=wr(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ir(o)),[o,Ir(o)]}function Or(e){let t=Ir(e);return[kr(e),t,kr(t)]}function kr(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ar=[`left`,`right`],jr=[`right`,`left`],Mr=[`top`,`bottom`],Nr=[`bottom`,`top`];function Pr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?jr:Ar:t?Ar:jr;case`left`:case`right`:return t?Mr:Nr;default:return[]}}function Fr(e,t,n,r){let i=Sr(e),a=Pr(xr(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(kr)))),a}function Ir(e){let t=xr(e);return vr[t]+e.slice(t.length)}function Lr(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Rr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Lr(e)}function zr(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Br(e,t,n){let{reference:r,floating:i}=e,a=Tr(t),o=Er(t),s=wr(o),c=xr(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Sr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Vr(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=br(t,e),p=Rr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=zr(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=zr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Hr=50,Ur=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Vr},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Br(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Hr&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Br(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Wr=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=br(e,t)||{};if(l==null)return{};let d=Rr(u),f={x:n,y:r},p=Er(i),m=wr(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=pr(d[_],T),D=pr(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=yr(E,k,O),j=!c.arrow&&Sr(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Gr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=br(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=xr(r),_=Tr(o),v=xr(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ir(o)]:Or(o)),x=p!==`none`;!d&&x&&b.push(...Fr(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Dr(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Tr(t)||T.every(e=>Tr(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Tr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Kr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qr(e){return fr.some(t=>e[t]>=0)}var Jr=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=br(e,t);switch(i){case`referenceHidden`:{let e=Kr(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:qr(e)}}}case`escaped`:{let e=Kr(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:qr(e)}}}default:return{}}}}},Yr=new Set([`left`,`top`]);async function Xr(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=xr(n),s=Sr(n),c=Tr(n)===`y`,l=Yr.has(o)?-1:1,u=a&&c?-1:1,d=br(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Zr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Xr(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Qr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=br(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Tr(i),p=Cr(f),m=u[p],h=u[f],g=(e,t)=>yr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},$r=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=br(e,t),u={x:n,y:r},d=Tr(i),f=Cr(d),p=u[f],m=u[d],h=br(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Yr.has(xr(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ei=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=br(e,t),c=await i.detectOverflow(t,s),l=xr(n),u=Sr(n),d=Tr(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=pr(p-c[m],g),y=pr(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*mr(c.left,c.right):S=p-2*mr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function ti(){return typeof window<`u`}function ni(e){return ii(e)?(e.nodeName||``).toLowerCase():`#document`}function Y(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ri(e){return((ii(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ii(e){return ti()?e instanceof Node||e instanceof Y(e).Node:!1}function ai(e){return ti()?e instanceof Element||e instanceof Y(e).Element:!1}function oi(e){return ti()?e instanceof HTMLElement||e instanceof Y(e).HTMLElement:!1}function si(e){return!ti()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Y(e).ShadowRoot}function ci(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=yi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function li(e){return/^(table|td|th)$/.test(ni(e))}function ui(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var di=/transform|translate|scale|rotate|perspective|filter/,fi=/paint|layout|strict|content/,pi=e=>!!e&&e!==`none`,mi;function hi(e){let t=ai(e)?yi(e):e;return pi(t.transform)||pi(t.translate)||pi(t.scale)||pi(t.rotate)||pi(t.perspective)||!_i()&&(pi(t.backdropFilter)||pi(t.filter))||di.test(t.willChange||``)||fi.test(t.contain||``)}function gi(e){let t=xi(e);for(;oi(t)&&!vi(t);){if(hi(t))return t;if(ui(t))return null;t=xi(t)}return null}function _i(){return mi??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),mi}function vi(e){return/^(html|body|#document)$/.test(ni(e))}function yi(e){return Y(e).getComputedStyle(e)}function bi(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xi(e){if(ni(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||si(e)&&e.host||ri(e);return si(t)?t.host:t}function Si(e){let t=xi(e);return vi(t)?(e.ownerDocument||e).body:oi(t)&&ci(t)?t:Si(t)}function Ci(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Si(e),i=r===e.ownerDocument?.body,a=Y(r);if(i){let e=wi(a);return t.concat(a,a.visualViewport||[],ci(r)?r:[],e&&n?Ci(e):[])}return t.concat(r,Ci(r,[],n))}function wi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ti(e){let t=yi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=oi(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=hr(n)!==a||hr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ei(e){return ai(e)?e:e.contextElement}function Di(e){let t=Ei(e);if(!oi(t))return _r(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ti(t),o=(a?hr(n.width):n.width)/r,s=(a?hr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Oi=_r(0);function ki(e){let t=Y(e);return!_i()||!t.visualViewport?Oi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ai(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Y(e)}function ji(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ei(e),o=_r(1);t&&(r?ai(r)&&(o=Di(r)):o=Di(e));let s=Ai(a,n,r)?ki(a):_r(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Y(a),t=ai(r)?Y(r):r,n=e,i=wi(n);for(;i&&t!==n;){let e=Di(i),t=i.getBoundingClientRect(),r=yi(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Y(i),i=wi(n)}}return zr({width:u,height:d,x:c,y:l})}function Mi(e,t){let n=bi(e).scrollLeft;return t?t.left+n:ji(ri(e)).left+n}function Ni(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Mi(e,n),y:n.top+t.scrollTop}}function Pi(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ri(r),s=t?ui(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=_r(1),u=_r(0),d=oi(r);if((d||!a)&&((ni(r)!==`body`||ci(o))&&(c=bi(r)),d)){let e=ji(r);l=Di(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ni(o,c):_r(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Fi(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ii(e){let t=bi(e),n=e.ownerDocument.body,r=mr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=mr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Mi(e),o=-t.scrollTop;return yi(n).direction===`rtl`&&(a+=mr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Li=25;function Ri(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Y(e),a=ri(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!_i()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Mi(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Li&&(s-=o)}return{width:s,height:c,x:l,y:u}}function zi(e,t){let n=ji(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Di(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Bi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ri(e,n,t);else if(t===`document`)r=Ii(ri(e));else if(ai(t))r=zi(t,n);else{let n=ki(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return zr(r)}function Vi(e,t){let n=t.get(e);if(n)return n;let r=Ci(e,[],!1).filter(e=>ai(e)&&ni(e)!==`body`),i=null,a=yi(e).position===`fixed`,o=a?xi(e):e;for(;ai(o)&&!vi(o);){let e=yi(o),t=hi(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=xi(o)}return t.set(e,r),r}function Hi(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ui(t)?[]:Vi(t,this._c):[].concat(n),r],o=Bi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Bi(t,a[e],i);s=mr(n.top,s),c=pr(n.right,c),l=pr(n.bottom,l),u=mr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ui(e){let{width:t,height:n}=Ti(e);return{width:t,height:n}}function Wi(e,t,n){let r=oi(t),i=ri(t),a=n===`fixed`,o=ji(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=_r(0);if((r||!a)&&((ni(t)!==`body`||ci(i))&&(s=bi(t)),r)){let e=ji(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Mi(i));let l=i&&!r&&!a?Ni(i,s):_r(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Gi(e){return yi(e).position===`static`}function Ki(e,t){if(!oi(e)||yi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ri(e)===n&&(n=n.ownerDocument.body),n}function qi(e,t){let n=Y(e);if(ui(e))return n;if(!oi(e)){let t=xi(e);for(;t&&!vi(t);){if(ai(t)&&!Gi(t))return t;t=xi(t)}return n}let r=Ki(e,t);for(;r&&li(r)&&Gi(r);)r=Ki(r,t);return r&&vi(r)&&Gi(r)&&!hi(r)?n:r||gi(e)||n}var Ji=async function(e){let t=this.getOffsetParent||qi,n=this.getDimensions,r=await n(e.floating);return{reference:Wi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Yi(e){return yi(e).direction===`rtl`}var Xi={convertOffsetParentRelativeRectToViewportRelativeRect:Pi,getDocumentElement:ri,getClippingRect:Hi,getOffsetParent:qi,getElementRects:Ji,getClientRects:Fi,getDimensions:Ui,getScale:Di,isElement:ai,isRTL:Yi};function Zi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qi(e,t,n){let r=null,i,a=ri(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=gr(d),h=gr(a.clientWidth-(u+f)),g=gr(a.clientHeight-(d+p)),_=gr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:mr(0,pr(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Zi(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Y(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function $i(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ei(e),u=i||a?[...l?Ci(l):[],...t?Ci(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Qi(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?ji(e):null;c&&g();function g(){let t=ji(e);h&&!Zi(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ea=Zr,ta=Qr,na=Gr,ra=ei,ia=Jr,aa=Wr,oa=$r,sa=(e,t,n)=>{let r=new Map,i=n??{},a={...Xi,...i.platform,_c:r};return Ur(e,t,{...i,platform:a})},ca=typeof document<`u`?V.useLayoutEffect:function(){};function la(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!la(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!la(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ua(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function da(e,t){let n=ua(e);return Math.round(t*n)/n}function fa(e){let t=V.useRef(e);return ca(()=>{t.current=e}),t}function pa(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=V.useState(r);la(f,r)||p(r);let[m,h]=V.useState(null),[g,_]=V.useState(null),v=V.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=V.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=V.useRef(null),C=V.useRef(null),w=V.useRef(u),T=c!=null,E=fa(c),D=fa(i),O=fa(l),k=V.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),sa(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!la(w.current,t)&&(w.current=t,ot.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);ca(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=V.useRef(!1);ca(()=>(A.current=!0,()=>{A.current=!1}),[]),ca(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=V.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=V.useMemo(()=>({reference:b,floating:x}),[b,x]),N=V.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=da(M.floating,u.x),r=da(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ua(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var ma=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:aa({element:r.current,padding:i}).fn(n):r?aa({element:r,padding:i}).fn(n):{}}}},ha=(e,t)=>{let n=ea(e);return{name:n.name,fn:n.fn,options:[e,t]}},ga=(e,t)=>{let n=ta(e);return{name:n.name,fn:n.fn,options:[e,t]}},_a=(e,t)=>({fn:oa(e).fn,options:[e,t]}),va=(e,t)=>{let n=na(e);return{name:n.name,fn:n.fn,options:[e,t]}},ya=(e,t)=>{let n=ra(e);return{name:n.name,fn:n.fn,options:[e,t]}},ba=(e,t)=>{let n=ia(e);return{name:n.name,fn:n.fn,options:[e,t]}},xa=(e,t)=>{let n=ma(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sa=Object.defineProperty,Ca=(e,t)=>Sa(e,`name`,{value:t,configurable:!0}),wa={Partial:`partial`,Always:`always`},Ta={Optimized:`optimized`,Always:`always`},Ea=`Popper`,[Da,Oa]=fe(Ea),[ka,Aa]=Da(Ea),ja=Ca(e=>{let{__scopePopper:t,children:n}=e,[r,i]=V.useState(null),[a,o]=V.useState(void 0);return(0,U.jsx)(ka,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Ma=`PopperAnchor`,Na=V.forwardRef(Ca(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Aa(Ma,n),o=V.useRef(null),s=a.onAnchorChange,c=V.useCallback(e=>{o.current=e,e&&s(e)},[s]),l=R(t,c),u=V.useRef(null);V.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&Ba(a.placementState),f=d?.[0],p=d?.[1];return r?null:(0,U.jsx)(B.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:l})},`PopperAnchor`)),Pa=`PopperContent`,[Fa,Ia]=Da(Pa),La=V.forwardRef(Ca(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f=wa.Partial,hideWhenDetached:p=!1,updatePositionStrategy:m=Ta.Optimized,onPlaced:h,...g}=e,_=Aa(Pa,n),[v,y]=V.useState(null),b=R(t,y),[x,S]=V.useState(null),C=u(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Ra),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=pa({strategy:`fixed`,placement:E,whileElementsMounted:Ca((...e)=>$i(...e,{animationFrame:m===Ta.Always}),`whileElementsMounted`),elements:{reference:_.anchor},middleware:[ha({mainAxis:i+T,alignmentAxis:o}),c&&ga({mainAxis:!0,crossAxis:!1,limiter:f===wa.Partial?_a():void 0,...A}),c&&va({...A}),ya({...A,apply:Ca(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),x&&xa({element:x,padding:s}),za({arrowWidth:w,arrowHeight:T}),p&&ba({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=_.setPlacementState;L(()=>(I(N),()=>{I(void 0)}),[N,I]);let[ee,te]=Ba(N),ne=W(h);L(()=>{P&&ne?.()},[P,ne]);let z=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=V.useState();return L(()=>{v&&oe(window.getComputedStyle(v).zIndex)},[v]),(0,U.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,U.jsx)(Fa,{scope:n,placedSide:ee,placedAlign:te,onArrowChange:S,arrowX:z,arrowY:re,shouldHideArrow:ie,children:(0,U.jsx)(B.div,{"data-side":ee,"data-align":te,...g,ref:b,style:{...g.style,animation:P?g.style?.animation:`none`}})})})},`PopperContent`));function Ra(e){return e!==null}Ca(Ra,`isNotNull`);var za=Ca(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Ba(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Ba(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Ca(Ba,`getSideAndAlignFromPlacement`);var Va=Object.defineProperty,Ha=(e,t)=>Va(e,`name`,{value:t,configurable:!0}),Ua=!1;function Wa(){let[e,t]=V.useState(Ua);return V.useEffect(()=>{Ua||(Ua=!0,t(!0))},[]),e}Ha(Wa,`useIsHydrated`);var Ga=V.useSyncExternalStore;function Ka(){return()=>{}}Ha(Ka,`subscribe`);function qa(){return Ga(Ka,()=>!0,()=>!1)}Ha(qa,`useIsHydratedModern`);var Ja=typeof Ga==`function`?qa:Wa,Ya=Object.defineProperty,Xa=(e,t)=>Ya(e,`name`,{value:t,configurable:!0}),Za=`rovingFocusGroup.onEntryFocus`,Qa={bubbles:!1,cancelable:!0},$a=`RovingFocusGroup`,[eo,to,no]=ie($a),[ro,io]=fe($a,[no]),ao={Vertical:`vertical`,Horizontal:`horizontal`},oo={LTR:`ltr`,RTL:`rtl`},[so,co]=ro($a),lo=V.forwardRef(Xa(function(e,t){return(0,U.jsx)(eo.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(eo.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(uo,{...e,ref:t})})})},`RovingFocusGroup`)),uo=V.forwardRef(Xa(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=V.useRef(null),p=R(t,f),m=_(a),[h,g]=ce({prop:o,defaultProp:s??null,onChange:c,caller:$a}),[v,y]=V.useState(!1),b=W(l),x=to(n),S=V.useRef(!1),[C,w]=V.useState(0);return V.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Za,b),()=>e.removeEventListener(Za,b)},[b]),(0,U.jsx)(so,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:V.useCallback(e=>g(e),[g]),onItemShiftTab:V.useCallback(()=>y(!0),[]),onFocusableItemAdd:V.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:V.useCallback(()=>w(e=>e-1),[]),children:(0,U.jsx)(B.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:A(e.onMouseDown,()=>{S.current=!0}),onFocus:A(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Za,Qa);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);_o([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:A(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),fo=`RovingFocusGroupItem`,po=V.forwardRef(Xa(function(e,t){let{__scopeRovingFocusGroup:r,focusable:i=!0,active:a=!1,tabStopId:o,children:s,...c}=e,l=n(),u=o||l,d=co(fo,r),f=d.currentTabStopId===u,p=to(r),{onFocusableItemAdd:m,onFocusableItemRemove:h,currentTabStopId:g}=d,_=Ja();return L(()=>{if(_&&i)return m(),()=>h()},[_,i,m,h]),V.useEffect(()=>{if(!_&&i)return m(),()=>h()},[_,i,m,h]),(0,U.jsx)(eo.ItemSlot,{scope:r,id:u,focusable:i,active:a,children:(0,U.jsx)(B.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:A(e.onMouseDown,e=>{i?d.onItemFocus(u):e.preventDefault()}),onFocus:A(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:A(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=go(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?vo(n,r+1):n.slice(r+1)}setTimeout(()=>_o(n))}}),children:typeof s==`function`?s({isCurrentTabStop:f,hasTabStop:g!=null}):s})})},`RovingFocusGroupItem`)),mo={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ho(e,t){return t===oo.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Xa(ho,`getDirectionAwareKey`);function go(e,t,n){let r=ho(e.key,n);if(!(t===ao.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===ao.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return mo[r]}Xa(go,`getFocusIntent`);function _o(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Xa(_o,`focusFirst`);function vo(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Xa(vo,`wrapArray`);var yo=Object.defineProperty,X=(e,t)=>yo(e,`name`,{value:t,configurable:!0}),bo=[`Enter`,` `],xo=[`ArrowDown`,`PageUp`,`Home`],So=[`ArrowUp`,`PageDown`,`End`],Co=[...xo,...So];[...bo],[...bo];var wo=`Menu`,[To,Eo,Do]=ie(wo),[Oo,ko]=fe(wo,[Do,Oa,io]),Ao=Oa(),jo=io(),[Mo,No]=Oo(wo),[Po,Fo]=Oo(wo),Io=X(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ao(t),[c,l]=V.useState(null),u=V.useRef(!1),d=W(a),f=_(i);return V.useEffect(()=>{let e=X(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=X(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),V.useEffect(()=>{if(!n)return;let e=X(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(ja,{...s,children:(0,U.jsx)(Mo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(Po,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Lo=V.forwardRef(X(function(e,t){let{__scopeMenu:n,...r}=e,i=Ao(n);return(0,U.jsx)(Na,{...i,...r,ref:t})},`MenuAnchor`)),Ro=`MenuPortal`,[zo,Bo]=Oo(Ro,{forceMount:void 0}),Vo=X(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=No(Ro,t);return(0,U.jsx)(zo,{scope:t,forceMount:n,children:(0,U.jsx)(F,{present:n||a.open,children:(0,U.jsx)(ct,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Ho=`MenuContent`,[Uo,Wo]=Oo(Ho),Go=V.forwardRef(X(function(e,t){let n=Bo(Ho,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=No(Ho,e.__scopeMenu),o=Fo(Ho,e.__scopeMenu);return(0,U.jsx)(To.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(F,{present:r||a.open,children:(0,U.jsx)(To.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(Ko,{...i,ref:t}):(0,U.jsx)(qo,{...i,ref:t})})})})},`MenuContent`)),Ko=V.forwardRef(X(function(e,t){let n=No(Ho,e.__scopeMenu),r=V.useRef(null),i=R(t,r);return V.useEffect(()=>{let e=r.current;if(e)return Nn(e)},[]),(0,U.jsx)(Yo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),qo=V.forwardRef(X(function(e,t){let n=No(Ho,e.__scopeMenu);return(0,U.jsx)(Yo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Jo=ue(`MenuContent.ScrollLock`),Yo=V.forwardRef(X(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=No(Ho,n),_=Fo(Ho,n),v=Ao(n),y=jo(n),b=Eo(n),[x,S]=V.useState(null),C=V.useRef(null),[w,T]=V.useState(null);Je(w);let{nodes:E,registry:D}=qe(),O=!!(i||m),k=R(t,C,g.onContentChange,T),j=V.useRef(0),M=V.useRef(``),N=V.useRef(0),P=V.useRef(null),F=V.useRef(`right`),I=V.useRef(0),L=V.useMemo(()=>m?[C,...E.map(e=>({current:e}))]:[],[C,E,m]),ee=m?wn:V.Fragment,te=m?{as:Jo,allowPinchZoom:!0,shards:L}:void 0,ne=X(e=>{let t=M.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=hs(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;X((function e(t){M.current=t,window.clearTimeout(j.current),t!==``&&(j.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);V.useEffect(()=>()=>window.clearTimeout(j.current),[]),mt();let z=V.useCallback(e=>F.current===P.current?.side&&_s(e,P.current?.area),[]);return(0,U.jsx)(Uo,{scope:n,searchRef:M,onItemEnter:V.useCallback(e=>{z(e)&&e.preventDefault()},[z]),onItemLeave:V.useCallback(e=>{z(e)||(C.current?.focus(),S(null))},[z]),onTriggerLeave:V.useCallback(e=>{z(e)&&e.preventDefault()},[z]),pointerGraceTimerRef:N,onPointerGraceIntentChange:V.useCallback(e=>{P.current=e},[]),children:(0,U.jsx)(Ke,{registry:O?D:null,children:(0,U.jsx)(ee,{...te,children:(0,U.jsx)(We,{asChild:!0,trapped:i,branches:E,onMountAutoFocus:A(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(Ne,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(lo,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:A(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(La,{role:`menu`,"aria-orientation":`vertical`,"data-state":us(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:k,style:{outline:`none`,...h.style},onKeyDown:A(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!Co.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);So.includes(e.key)&&a.reverse(),ps(a)}),onBlur:A(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),M.current=``)}),onPointerMove:A(e.onPointerMove,vs(e=>{let t=e.target,n=I.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>I.current?`right`:`left`;F.current=t,I.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Xo=`MenuItem`,Zo=`menu.itemSelect`,Qo=V.forwardRef(X(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=V.useRef(null),o=Fo(Xo,e.__scopeMenu),s=Wo(Xo,e.__scopeMenu),c=R(t,a),l=V.useRef(!1),u=X(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Zo,{bubbles:!0,cancelable:!0});e.addEventListener(Zo,e=>r?.(e),{once:!0}),z(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,U.jsx)($o,{...i,ref:c,disabled:n,onClick:A(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:A(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:A(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&bo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),$o=V.forwardRef(X(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Wo(Xo,n),s=jo(n),c=V.useRef(null),l=R(t,c),[u,d]=V.useState(!1),[f,p]=V.useState(``);return V.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(To.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(po,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(B.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:A(e.onPointerMove,vs(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:A(e.onPointerLeave,vs(e=>o.onItemLeave(e))),onFocus:A(e.onFocus,()=>d(!0)),onBlur:A(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),es=V.forwardRef(X(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,U.jsx)(is,{scope:e.__scopeMenu,checked:n,children:(0,U.jsx)(Qo,{role:`menuitemcheckbox`,"aria-checked":ds(n)?`mixed`:n,...i,ref:t,"data-state":fs(n),onSelect:A(i.onSelect,()=>r?.(ds(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[ts,ns]=Oo(`MenuRadioGroup`,{value:void 0,onValueChange:X(()=>{},`onValueChange`)}),rs=`MenuItemIndicator`,[is,as]=Oo(rs,{checked:!1}),os=V.forwardRef(X(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=as(rs,n);return(0,U.jsx)(F,{present:r||ds(a.checked)||a.checked===!0,children:(0,U.jsx)(B.span,{...i,ref:t,"data-state":fs(a.checked)})})},`MenuItemIndicator`)),ss=V.forwardRef(X(function(e,t){let{__scopeMenu:n,...r}=e;return(0,U.jsx)(B.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[cs,ls]=Oo(`MenuSub`);function us(e){return e?`open`:`closed`}X(us,`getOpenState`);function ds(e){return e===`indeterminate`}X(ds,`isIndeterminate`);function fs(e){return ds(e)?`indeterminate`:e?`checked`:`unchecked`}X(fs,`getCheckedState`);function ps(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}X(ps,`focusFirst`);function ms(e,t){return e.map((n,r)=>e[(t+r)%e.length])}X(ms,`wrapArray`);function hs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ms(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}X(hs,`getNextMatch`);function gs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}X(gs,`isPointInPolygon`);function _s(e,t){return t?gs({x:e.clientX,y:e.clientY},t):!1}X(_s,`isPointerInGraceArea`);function vs(e){return t=>t.pointerType===`mouse`?e(t):void 0}X(vs,`whenMouse`);var ys=Object.defineProperty,bs=(e,t)=>ys(e,`name`,{value:t,configurable:!0}),xs=`DropdownMenu`,[Ss,Cs]=fe(xs,[ko]),ws=ko(),[Ts,Es]=Ss(xs),Ds=bs(e=>{let{__scopeDropdownMenu:t,children:r,dir:i,open:a,defaultOpen:o,onOpenChange:s,modal:c=!0}=e,l=ws(t),u=V.useRef(null),[d,f]=ce({prop:a,defaultProp:o??!1,onChange:s,caller:xs});return(0,U.jsx)(Ts,{scope:t,triggerId:n(),triggerRef:u,contentId:n(),open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,U.jsx)(Io,{...l,open:d,onOpenChange:f,dir:i,modal:c,children:r})})},`DropdownMenu`),Os=`DropdownMenuTrigger`,ks=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Es(Os,n),o=ws(n),s=R(t,a.triggerRef);return(0,U.jsx)(Lo,{asChild:!0,...o,children:(0,U.jsx)(B.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:A(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:A(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),As=bs(e=>{let{__scopeDropdownMenu:t,...n}=e,r=ws(t);return(0,U.jsx)(Vo,{...r,...n})},`DropdownMenuPortal`),js=`DropdownMenuContent`,Ms=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Es(js,n),a=ws(n),o=V.useRef(!1);return(0,U.jsx)(Go,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:A(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Ns=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ws(n);return(0,U.jsx)(Qo,{...i,...r,ref:t})},`DropdownMenuItem`)),Ps=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ws(n);return(0,U.jsx)(es,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),Fs=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ws(n);return(0,U.jsx)(os,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Is=V.forwardRef(bs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=ws(n);return(0,U.jsx)(ss,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Z={trigger:`_trigger_1alav_1`,item:`_item_1alav_13`,triggerIcon:`_triggerIcon_1alav_15`,triggerIconOnly:`_triggerIconOnly_1alav_19`,label:`_label_1alav_21`,labelMeasure:`_labelMeasure_1alav_23`,labelText:`_labelText_1alav_25`,chevron:`_chevron_1alav_27`,menu:`_menu_1alav_35`,"menu-exit":`_menu-exit_1alav_1`,highlight:`_highlight_1alav_55`,icon:`_icon_1alav_61`,separator:`_separator_1alav_63`,destructive:`_destructive_1alav_65`};function Ls({text:e}){let t=le(),n=(0,V.useRef)(null),r=(0,V.useRef)(null),[i,a]=(0,V.useState)({width:`auto`,animate:!1});return(0,V.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([t])=>{let n=e.textContent,i=r.current!==null&&r.current!==n;r.current=n,a({width:Math.ceil(t.borderBoxSize?.[0]?.inlineSize??e.offsetWidth),animate:i})});return t.observe(e),()=>t.disconnect()},[]),(0,U.jsxs)(k.span,{className:Z.label,initial:!1,animate:{width:i.width},transition:i.animate&&!t?D.spring.morph:{duration:0},children:[(0,U.jsx)(`span`,{ref:n,className:Z.labelMeasure,"aria-hidden":`true`,children:e}),(0,U.jsx)(de,{mode:`popLayout`,initial:!1,children:(0,U.jsx)(k.span,{className:Z.labelText,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${D.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${D.blur.subtle}px)`,transition:{duration:D.duration.fast,ease:[...D.ease.standard]}},transition:{duration:D.duration.standard,ease:[...D.ease.enter]},children:e},e)})]})}function Rs({label:e,items:t,icon:n,iconOnly:r}){let i=le(),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(!1),c=(0,V.useRef)(0);(0,V.useEffect)(()=>()=>window.clearTimeout(c.current),[]);function l(e){let t=e.target instanceof HTMLElement?e.target.closest(`[role="menuitem"]`):null;if(window.clearTimeout(c.current),!t){c.current=window.setTimeout(()=>o(null),s.current?70:0);return}let n={top:t.offsetTop,height:t.offsetHeight,danger:t.dataset.tone===`danger`},r=s.current;o(e=>({...n,glide:r&&e!==null}))}return(0,U.jsxs)(Ds,{onOpenChange:e=>{e&&(window.clearTimeout(c.current),o(null))},children:[(0,U.jsxs)(ks,{className:[Z.trigger,r?Z.triggerIconOnly:``].filter(Boolean).join(` `),type:`button`,"aria-label":r?e:void 0,children:[n&&(0,U.jsx)(`span`,{className:Z.triggerIcon,"aria-hidden":`true`,children:n}),!r&&(0,U.jsx)(Ls,{text:e}),!r&&(0,U.jsx)(ge,{className:Z.chevron,size:15,strokeWidth:1.8,"aria-hidden":`true`})]}),(0,U.jsx)(As,{children:(0,U.jsxs)(Ms,{className:Z.menu,sideOffset:6,align:`end`,collisionPadding:12,loop:!0,onFocus:l,onPointerMoveCapture:()=>{s.current=!0},onKeyDownCapture:()=>{s.current=!1},children:[(0,U.jsx)(k.span,{className:Z.highlight,"data-tone":a?.danger?`danger`:void 0,"aria-hidden":`true`,initial:!1,animate:a?{y:a.top,height:a.height,opacity:1}:{opacity:0},transition:{default:a?.glide&&!i?D.spring.snappy:{duration:0},opacity:{duration:i?0:.08}}}),t.map((e,t)=>(0,U.jsxs)(V.Fragment,{children:[e.separatorBefore&&(0,U.jsx)(Is,{className:Z.separator}),(0,U.jsxs)(Ns,{className:[Z.item,e.destructive?Z.destructive:``].filter(Boolean).join(` `),"data-tone":e.destructive?`danger`:void 0,style:{"--i":t},disabled:e.disabled,onSelect:e.onSelect,children:[e.icon&&(0,U.jsx)(`span`,{className:Z.icon,"aria-hidden":`true`,children:e.icon}),e.label]})]},e.label))]})})]})}var zs=Object.defineProperty,Bs=(e,t)=>zs(e,`name`,{value:t,configurable:!0});function Vs(e,[t,n]){return Math.min(n,Math.max(t,e))}Bs(Vs,`clamp`);var Hs=Object.defineProperty,Us=(e,t)=>Hs(e,`name`,{value:t,configurable:!0});function Ws(e){let t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}Us(Ws,`usePrevious`);var Gs=Object.defineProperty,Ks=(e,t)=>Gs(e,`name`,{value:t,configurable:!0}),qs=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Js=V.forwardRef(Ks(function(e,t){return(0,U.jsx)(B.span,{...e,ref:t,style:{...qs,...e.style}})},`VisuallyHidden`)),Ys=Object.defineProperty,Q=(e,t)=>Ys(e,`name`,{value:t,configurable:!0}),Xs={ItemAligned:`item-aligned`,Popper:`popper`},Zs={LTR:`ltr`,RTL:`rtl`},Qs=[` `,`Enter`,`ArrowUp`,`ArrowDown`],$s=[` `,`Enter`],ec=`Select`,[tc,nc,rc]=ie(ec),[ic,ac]=fe(ec,[rc,Oa]),oc=Oa(),[sc,cc]=ic(ec),[lc,uc]=ic(ec);function dc(e){let{__scopeSelect:t,children:r,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,v=oc(t),[y,b]=V.useState(null),[x,S]=V.useState(null),[C,w]=V.useState(!1),T=_(u),[E,D]=ce({prop:i,defaultProp:a??!1,onChange:o,caller:ec}),[O,k]=ce({prop:s,defaultProp:c,onChange:l,caller:ec}),A=V.useRef(null),j=V.useRef(O);V.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=Q(()=>k(j.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,k]);let M=!y||!!h||!!y.closest(`form`),[N,P]=V.useState(new Set),F=n(),I=Array.from(N).map(e=>e.props.value).join(`;`),L=V.useCallback(e=>{P(t=>new Set(t).add(e))},[]),ee=V.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:F,value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:N,nativeSelectKey:I,isFormControl:M};return(0,U.jsx)(ja,{...v,children:(0,U.jsx)(sc,{scope:t,...te,children:(0,U.jsx)(tc.Provider,{scope:t,children:(0,U.jsx)(lc,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:ee,children:Qc(g)?g(te):r})})})})}Q(dc,`SelectProvider`);var fc=Q(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(dc,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Zc,{__scopeSelect:t}):null]})})},`Select`),pc=`SelectTrigger`,mc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=oc(n),o=cc(pc,n),s=o.disabled||r,c=R(t,o.onTriggerChange),l=nc(n),u=V.useRef(`touch`),[d,f,p]=el(e=>{let t=l().filter(e=>!e.disabled),n=tl(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=Q(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,U.jsx)(Na,{asChild:!0,...a,children:(0,U.jsx)(B.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$c(o.value)?``:void 0,...i,ref:c,onClick:A(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:A(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:A(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Qs.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),hc=`SelectValue`,gc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=cc(hc,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=R(t,c.onValueNodeChange);L(()=>{l(u)},[l,u]);let f=$c(c.value);return(0,U.jsx)(B.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(V.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),_c=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(B.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[vc,yc]=ic(`SelectPortal`,{forceMount:void 0}),bc=Q(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(vc,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(ct,{asChild:!0,...r})})},`SelectPortal`),xc=`SelectContent`,Sc=V.forwardRef(Q(function(e,t){let n=yc(xc,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=cc(xc,e.__scopeSelect),[o,s]=V.useState();return L(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(F,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(Oc,{...i,ref:t}):(0,U.jsx)(Cc,{...i,fragment:o})})},`SelectContent`)),Cc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?ot.createPortal((0,U.jsx)(Tc,{scope:n,children:(0,U.jsx)(tc.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),wc=10,[Tc,Ec]=ic(xc),Dc=ue(`SelectContent.RemoveScroll`),Oc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n}=e,{position:r=Xs.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=cc(xc,n),[y,b]=V.useState(null),[x,S]=V.useState(null),C=R(t,b),[w,T]=V.useState(null),[E,D]=V.useState(null),O=nc(n),[k,j]=V.useState(!1),M=V.useRef(!1);V.useEffect(()=>{if(y)return Nn(y)},[y]),mt();let N=V.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),P=V.useCallback(()=>N([w,y]),[N,w,y]);V.useEffect(()=>{k&&P()},[k,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=v;V.useEffect(()=>{if(y){let e={x:0,y:0},t=Q(t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},`handlePointerMove`),n=Q(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null},`handlePointerUp`);return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,F,I]),V.useEffect(()=>{let e=Q(()=>F(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,ee]=el(e=>{let t=O().filter(e=>!e.disabled),n=tl(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=V.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(M.current=!0))},[v.value]),ne=V.useCallback(()=>y?.focus(),[y]),z=V.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),re=r===Xs.Popper?Ac:kc,ie=re===Ac?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(Tc,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:te,selectedItem:w,onItemLeave:ne,itemTextRefCallback:z,focusSelectedItem:P,selectedItemText:E,position:r,isPositioned:k,searchRef:L,children:(0,U.jsx)(wn,{as:Dc,allowPinchZoom:!0,children:(0,U.jsx)(We,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:A(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(Ne,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(re,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ie,onPlaced:()=>j(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:A(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),kc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=cc(xc,n),o=Ec(xc,n),[s,c]=V.useState(null),[l,u]=V.useState(null),d=R(t,u),f=nc(n),p=V.useRef(!1),m=V.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=V.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==Zs.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-wc,d=Vs(a,[wc,Math.max(wc,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-wc,d=Vs(a,[wc,Math.max(wc,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-wc*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-wc,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${wc}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);L(()=>y(),[y]);let[b,x]=V.useState();L(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);let S=V.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]);return(0,U.jsx)(jc,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(B.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),Ac=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=wc,...a}=e,o=oc(n);return(0,U.jsx)(La,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[jc,Mc]=ic(xc,{}),Nc=`SelectViewport`,Pc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Ec(Nc,n),o=Mc(Nc,n),s=R(t,a.onViewportChange),c=V.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(tc.Slot,{scope:n,children:(0,U.jsx)(B.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:A(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-wc*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Fc,Ic]=ic(`SelectGroup`),Lc=`SelectItem`,[Rc,zc]=ic(Lc),Bc=V.forwardRef(Q(function(e,t){let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=cc(Lc,r),l=Ec(Lc,r),u=c.value===i,[d,f]=V.useState(o??``),[p,m]=V.useState(!1),h=W(e=>l.itemRefCallback?.(e,i,a)),g=R(t,h),_=n(),v=V.useRef(`touch`),y=Q(()=>{c.onValueChange(i),c.onOpenChange(!1)},`handleSelect`);return(0,U.jsx)(Rc,{scope:r,value:i,disabled:a,textId:_,isSelected:u,onItemTextChange:V.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(tc.ItemSlot,{scope:r,value:i,disabled:a,textValue:d,children:(0,U.jsx)(B.div,{role:`option`,"aria-labelledby":_,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:g,onFocus:A(s.onFocus,()=>m(!0)),onBlur:A(s.onBlur,()=>m(!1)),onClick:A(s.onClick,()=>{a||v.current!==`mouse`&&y()}),onPointerUp:A(s.onPointerUp,()=>{a||v.current===`mouse`&&y()}),onPointerDown:A(s.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:A(s.onPointerMove,e=>{v.current=e.pointerType,a?l.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:A(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:A(s.onKeyDown,e=>{a||e.target!==e.currentTarget||(l.searchRef?.current===``||e.key!==` `)&&($s.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Vc=`SelectItemText`,Hc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=cc(Vc,n),s=Ec(Vc,n),c=zc(Vc,n),l=uc(Vc,n),[u,d]=V.useState(null),f=W(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=R(t,d,c.onItemTextChange,f),m=u?.textContent,h=V.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return L(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(B.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$c(o.value)?ot.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Uc=`SelectItemIndicator`,Wc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,...r}=e;return zc(Uc,n).isSelected?(0,U.jsx)(B.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Gc=`SelectScrollUpButton`,Kc=V.forwardRef(Q(function(e,t){let n=Ec(Gc,e.__scopeSelect),r=Mc(Gc,e.__scopeSelect),[i,a]=V.useState(!1),o=R(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};Q(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Yc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),qc=`SelectScrollDownButton`,Jc=V.forwardRef(Q(function(e,t){let n=Ec(qc,e.__scopeSelect),r=Mc(qc,e.__scopeSelect),[i,a]=V.useState(!1),o=R(t,r.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};Q(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(Yc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Yc=V.forwardRef(Q(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Ec(`SelectScrollButton`,n),o=V.useRef(null),s=nc(n),c=V.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return V.useEffect(()=>()=>c(),[c]),L(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(B.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:A(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:A(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:A(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),Xc=`SelectBubbleInput`,Zc=V.forwardRef(Q(function({__scopeSelect:e,...t},n){let r=cc(Xc,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=V.useRef(null),m=R(n,p),h=i??``,g=Ws(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return V.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,U.jsxs)(B.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...qs,...t.style},ref:m,defaultValue:h,children:[$c(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function Qc(e){return typeof e==`function`}Q(Qc,`isFunction`);function $c(e){return e===``||e===void 0}Q($c,`shouldShowPlaceholder`);function el(e){let t=W(e),n=V.useRef(``),r=V.useRef(0),i=V.useCallback(e=>{let i=n.current+e;t(i),Q((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=V.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return V.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Q(el,`useTypeaheadSearch`);function tl(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=nl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Q(tl,`findNextItem`);function nl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Q(nl,`wrapArray`);var $={field:`_field_gd579_1`,trigger:`_trigger_gd579_7`,valueText:`_valueText_gd579_17`,srOnly:`_srOnly_gd579_23`,chevron:`_chevron_gd579_25`,hint:`_hint_gd579_29`,content:`_content_gd579_35`,"select-in":`_select-in_gd579_1`,"select-out":`_select-out_gd579_1`,viewport:`_viewport_gd579_45`,item:`_item_gd579_47`,indicator:`_indicator_gd579_53`,"indicator-in":`_indicator-in_gd579_1`,scrollButton:`_scrollButton_gd579_55`,"select-fade":`_select-fade_gd579_1`,"select-fade-out":`_select-fade-out_gd579_1`},rl={enter:e=>({opacity:0,y:`${e*.35}em`,filter:`blur(${D.blur.soft}px)`}),center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:D.duration.standard,ease:[...D.ease.enter]}},exit:e=>({opacity:0,y:`${e*-.3}em`,filter:`blur(${D.blur.subtle}px)`,transition:{duration:D.duration.fast,ease:[...D.ease.standard]}})},il={enter:{opacity:0},center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:D.duration.instant}},exit:{opacity:0,transition:{duration:D.duration.instant}}},al=(0,V.forwardRef)(function({label:e,description:t,placeholder:n=`Select an option`,options:r,id:i,className:a,disabled:o,onValueChange:s,...c},l){let u=(0,V.useId)(),d=i??u,f=t?`${d}-description`:void 0,p=le(),[m,h]=(0,V.useState)(c.defaultValue??``),g=c.value??m,_=r.findIndex(e=>e.value===g),v=g?r[_]?.label??``:n,[y,b]=(0,V.useState)(_),[x,S]=(0,V.useState)(1);return y!==_&&(b(_),S(_>y?1:-1)),(0,U.jsxs)(`div`,{className:$.field,children:[(0,U.jsx)(`label`,{htmlFor:d,children:e}),(0,U.jsxs)(fc,{...c,disabled:o,onValueChange:e=>{h(e),s?.(e)},children:[(0,U.jsxs)(mc,{ref:l,id:d,"aria-describedby":f,className:[$.trigger,a].filter(Boolean).join(` `),children:[(0,U.jsx)(`span`,{className:$.srOnly,children:(0,U.jsx)(gc,{placeholder:n})}),(0,U.jsx)(`span`,{className:$.valueText,"aria-hidden":`true`,children:(0,U.jsx)(de,{initial:!1,custom:x,children:(0,U.jsx)(k.span,{"data-placeholder":g?void 0:``,custom:x,variants:p?il:rl,initial:`enter`,animate:`center`,exit:`exit`,children:v},g?`value-${g}`:`placeholder`)})}),(0,U.jsx)(_c,{className:$.chevron,children:(0,U.jsx)(ge,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,U.jsx)(bc,{children:(0,U.jsxs)(Sc,{className:$.content,position:`popper`,sideOffset:4,collisionPadding:12,children:[(0,U.jsx)(Kc,{className:$.scrollButton,children:(0,U.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})}),(0,U.jsx)(Pc,{className:$.viewport,children:r.map(e=>(0,U.jsxs)(Bc,{value:e.value,disabled:e.disabled,className:$.item,children:[(0,U.jsx)(Hc,{children:e.label}),(0,U.jsx)(Wc,{className:$.indicator,children:(0,U.jsx)(he,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]},e.value))}),(0,U.jsx)(Jc,{className:$.scrollButton,children:(0,U.jsx)(ge,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]})})]}),t&&(0,U.jsx)(`span`,{id:f,className:$.hint,children:t})]})}),ol={toast:`_toast_y83pf_1`,icon:`_icon_y83pf_31`,frame:`_frame_y83pf_55`,copy:`_copy_y83pf_67`,title:`_title_y83pf_85`,line:`_line_y83pf_103`,description:`_description_y83pf_117`,close:`_close_y83pf_131`},sl=()=>()=>{},cl={duration:D.duration.fast,ease:[...D.ease.standard]},ll={duration:D.duration.standard,ease:[...D.ease.enter]},ul={opacity:0,y:`0.3em`,filter:`blur(${D.blur.soft}px)`},dl={opacity:0,y:`-0.3em`,filter:`blur(${D.blur.subtle}px)`,transition:cl},fl={opacity:1,y:`0em`,filter:`blur(0px)`},pl={opacity:0,transition:{duration:D.duration.instant}},ml={distance:80,velocity:480};function hl(e){let t=N();return(0,U.jsx)(k.span,{...e,"aria-hidden":!t||e[`aria-hidden`]})}function gl({reduce:e,morphKey:t,children:n}){let r=(0,V.useRef)(null),i=(0,V.useRef)(null),a=j(`auto`),o=(0,V.useRef)(0);return(0,V.useLayoutEffect)(()=>{o.current=performance.now()},[t]),(0,V.useEffect)(()=>{let t=i.current;if(!t||typeof ResizeObserver>`u`)return;let n,s,c=()=>{a.jump(`auto`),r.current&&Object.assign(r.current.style,{overflow:``,height:`auto`})},l=new ResizeObserver(([i])=>{let l=i.borderBoxSize?.[0]?.blockSize??t.offsetHeight,u=a.get(),d=typeof u==`number`?u:n;if(n=l,s?.stop(),e||d===void 0||d===l||performance.now()-o.current>120)return c();r.current&&Object.assign(r.current.style,{overflow:`hidden`,height:`${d}px`}),s=re(a,[d,l],{...D.spring.smooth,onComplete:c})});return l.observe(t),()=>{l.disconnect(),s?.stop()}},[a,e]),(0,U.jsx)(k.div,{ref:r,className:ol.frame,style:{height:a},children:(0,U.jsx)(`div`,{ref:i,className:ol.copy,children:n})})}function _l({title:e,description:t,open:n=!0,onOpenChange:r,duration:i=4500}){let a=le(),o=(0,V.useSyncExternalStore)(sl,()=>!0,()=>!1),[s]=(0,V.useState)(o),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),[f,p]=(0,V.useState)(n);n!==f&&(p(n),n&&(l(!1),d(0)));let m=n&&!c,h=(0,V.useRef)(null),g=j(0),_=(0,V.useRef)(0);function v(e){d(e),l(!0),r?.(!1)}(0,V.useEffect)(()=>{if(!m||!r||i<=0)return;let e=window.setTimeout(()=>{d(0),l(!0),r(!1)},i);return()=>window.clearTimeout(e)},[m,r,i]);function y(e,t){let n=Math.sign(t.offset.x||t.velocity.x);if(Math.abs(t.offset.x)<ml.distance&&Math.abs(t.velocity.x)<ml.velocity){re(g,0,{...D.spring.snappy,velocity:t.velocity.x});return}_.current=t.velocity.x,v(n*((h.current?.offsetWidth??320)+48))}let b=a?{hidden:{opacity:0},shown:{opacity:1,transition:{duration:D.duration.instant}},exit:pl}:{hidden:{opacity:0,x:0,y:16,scale:.96},shown:{opacity:1,x:0,y:0,scale:1,transition:{...D.spring.morph,opacity:ll}},exit:e=>e?{x:e,opacity:0,transition:{x:{type:`spring`,visualDuration:.3,bounce:0,velocity:_.current,restDelta:2,restSpeed:40},opacity:{duration:D.duration.exit}}}:{opacity:0,y:8,scale:.97,transition:{duration:D.duration.exit,ease:[...D.ease.standard]}}},x={initial:a?{opacity:0}:ul,animate:fl,exit:a?pl:dl,transition:a?{duration:D.duration.instant}:ll};return(0,U.jsx)(de,{initial:s,custom:u,children:m&&(0,U.jsxs)(k.div,{ref:h,className:ol.toast,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,custom:u,variants:b,initial:`hidden`,animate:`shown`,exit:`exit`,style:{x:g},drag:a&&o?!1:`x`,dragMomentum:!1,onDragEnd:y,children:[(0,U.jsx)(`span`,{className:ol.icon,"aria-hidden":`true`,children:(0,U.jsx)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.25,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(k.path,{d:`M4 12.5l5 5L20 6.5`,initial:!a&&{pathLength:0},animate:{pathLength:1},transition:{duration:D.duration.standard,ease:[...D.ease.enter],delay:.12}})})}),(0,U.jsxs)(gl,{reduce:a,morphKey:`${e}\n${t??``}`,children:[(0,U.jsx)(`strong`,{className:ol.title,children:(0,U.jsx)(de,{mode:`popLayout`,initial:!1,children:(0,U.jsx)(hl,{className:ol.line,...x,children:e},e)})}),(0,U.jsx)(de,{mode:`popLayout`,initial:!1,children:t?(0,U.jsx)(hl,{className:ol.description,...x,children:t},t):null})]}),(0,U.jsx)(`button`,{className:ol.close,type:`button`,"aria-label":`Dismiss notification`,onClick:()=>v(0),children:(0,U.jsx)(ye,{width:16,height:16,strokeWidth:2,"aria-hidden":`true`})})]},`toast`)})}function vl({open:e,onOpenChange:t,title:n,description:r,children:i,footer:a,width:o=460}){return(0,U.jsx)(sr,{open:e,onOpenChange:t,children:(0,U.jsxs)(dr,{title:n,description:r,style:{width:`min(calc(100vw - 2rem), ${o}px)`},children:[i,a&&(0,U.jsx)(`div`,{className:P(`flex flex-wrap items-center justify-end gap-2`,i!==void 0&&`mt-6`),children:a})]})})}function yl({label:e,icon:t,items:n,iconOnly:r}){return(0,U.jsx)(Rs,{label:e,icon:t,iconOnly:r,items:n.map(e=>({label:e.label,icon:e.icon,destructive:e.destructive,disabled:e.disabled,separatorBefore:e.separatorBefore,onSelect:e.onSelect}))})}var bl=`__astra_empty__`,xl=e=>e===``?bl:e,Sl=e=>e===bl?``:e,Cl=12;function wl({value:e,onChange:t,options:n,placeholder:r,className:i,disabled:a,label:o,ariaLabel:s}){let c=C(),l=n.find(t=>t.value===e),u=oe(o,s??r??l?.label),d=P(`min-w-0`,u.hidden&&`astra-label-hidden`,i);return n.length>Cl?(0,U.jsx)(`div`,{className:d,children:(0,U.jsx)(we,{label:u.label,description:u.field?.description,placeholder:r??c(`common.search`),emptyMessage:c(`common.noResults`),value:e==null?``:xl(e),onValueChange:e=>t(Sl(e)),options:n.map(e=>({value:xl(e.value),label:e.detail&&e.detail!==e.label?`${e.label} · ${e.detail}`:e.label,disabled:e.disabled,keywords:e.detail?[e.detail]:void 0}))})}):(0,U.jsx)(`div`,{className:d,children:(0,U.jsx)(al,{label:u.label,description:u.field?.description,placeholder:r??c(`common.select`),disabled:a,value:e==null||e===``&&!l?``:xl(e),onValueChange:e=>t(Sl(e)),options:n.map(e=>({value:xl(e.value),label:e.label,disabled:e.disabled}))})})}var Tl=(0,V.createContext)(null);function El({children:e}){let t=C(),[n,r]=(0,V.useState)([]),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(0),s=(0,V.useCallback)(e=>r(t=>t.filter(t=>t.id!==e)),[]),c=(0,V.useCallback)((e,t=`info`)=>{let n=++o.current;r(r=>[...r.slice(-2),{id:n,tone:t,text:e}]),t===`error`&&setTimeout(()=>s(n),8e3)},[s]),l=(0,V.useCallback)(e=>new Promise(t=>a({...e,resolve:t})),[]),u=e=>{i?.resolve(e),a(null)};return(0,U.jsxs)(Tl.Provider,{value:{toast:c,confirm:l},children:[e,(0,U.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-5 z-[95] flex flex-col items-center gap-2 px-4`,children:n.map(e=>e.tone===`error`?(0,U.jsx)(`div`,{className:`pointer-events-auto w-[min(100%,26rem)] selectable`,children:(0,U.jsx)(x,{tone:`danger`,title:t(`common.error`),onDismiss:()=>s(e.id),children:e.text})},e.id):(0,U.jsx)(`div`,{className:`pointer-events-auto flex w-full justify-center`,children:(0,U.jsx)(_l,{title:e.text,open:!0,onOpenChange:t=>!t&&s(e.id)})},e.id))}),(0,U.jsx)(vl,{open:i!==null,onOpenChange:e=>!e&&u(!1),title:i?.title??``,description:i?.detail,width:420,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(h,{onClick:()=>u(!1),children:t(`common.cancel`)}),(0,U.jsx)(h,{variant:i?.destructive?`destructive`:`primary`,onClick:()=>u(!0),autoFocus:!0,children:i?.confirmLabel??t(`common.confirm`)})]})})]})}function Dl(){let e=(0,V.useContext)(Tl);if(!e)throw Error(`useFeedback outside FeedbackProvider`);return e}function Ol(e){return e instanceof Error?e.message:String(e)}var kl={canOpenPaths:!!v(),async openPath(e){let t=v();return t?t.openPath(e):!1},async revealLogs(){return await v()?.revealLogs()??!1},async copy(e){if(window.isSecureContext&&navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}return jl(e)},async contextMenu(e){let t=v();if(t)return t.showContextMenu(e)},async startService(){let e=v();return e?e.startService():null},async restartService(){let e=v();return e?e.restartService():null}};function Al(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>0?e.slice(0,t):e}function jl(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:0;left:0;opacity:0;pointer-events:none`;let n=document.activeElement;document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t),n?.focus?.()}}var Ml={config:`providers.quota.error.config`,no_key:`providers.quota.error.no_key`,unauthorized:`providers.quota.error.unauthorized`,no_endpoint:`providers.quota.error.no_endpoint`,rate_limited:`providers.quota.error.rate_limited`,upstream:`providers.quota.error.upstream`,timeout:`providers.quota.error.timeout`,network:`providers.quota.error.network`,not_json:`providers.quota.error.not_json`,too_large:`providers.quota.error.too_large`,empty:`providers.quota.error.empty`},Nl=/^[A-Z]{3}$/;function Pl(e,t,n){let r=n===`zh`?`zh-CN`:`en-US`;if(t&&Nl.test(t))try{let n=e!==0&&Math.abs(e)<1;return new Intl.NumberFormat(r,{style:`currency`,currency:t,minimumFractionDigits:2,maximumFractionDigits:n?4:2}).format(e)}catch{}let i=new Intl.NumberFormat(r,{maximumFractionDigits:2}).format(e);return t?`${i} ${t}`:i}var Fl=e=>e.windowMinutes!=null&&e.usedPercent!=null;function Il(e){return e.usedPercent!=null&&Number.isFinite(e.usedPercent)?Math.min(100,Math.max(0,e.usedPercent)):e.used!=null&&e.total!=null&&e.total>0?Math.min(100,Math.max(0,e.used/e.total*100)):null}function Ll(e){return!e?.error||e.fetchedAtUtc&&e.errorAtUtc&&new Date(e.errorAtUtc).getTime()<new Date(e.fetchedAtUtc).getTime()?null:{code:e.errorCode??null,message:e.error}}function Rl(e,t){return e.code?t(Ml[e.code]):e.message}function zl(e,t,n){let r=Il(e);if(Fl(e))return t(`providers.quota.window`,{window:_u(e.windowMinutes,n),percent:Math.round(r??0)});if(e.remaining!=null){let i=t(`providers.quota.balance`,{amount:Pl(e.remaining,e.unit,n)});return r==null?i:`${i} · ${t(`providers.quota.usedPercent`,{percent:Math.round(r)})}`}return r==null?e.used!=null&&e.total!=null?t(`providers.quota.totalUsed`,{used:Pl(e.used,e.unit,n),total:Pl(e.total,e.unit,n)}):null:t(`providers.quota.usedPercent`,{percent:Math.round(r)})}function Bl(e,t,n){let r=vu(e.resetsAtUtc??null,n);return r?t(`providers.quota.resets`,{time:r}):null}function Vl(e,t,n){let r=(e?.plans??[]).map(e=>zl(e,t,n)).filter(e=>!!e);return e?.isValid===!1&&r.unshift(t(`providers.quota.invalid`)),r.length?r.join(` · `):null}var Hl=e=>e.authScheme!==`oauth-subscription`&&!!e.quotaConfig?.enabled;function Ul(e,t){let n=new Map;for(let r of e)n.set(r.bucket,(n.get(r.bucket)??0)+r[t]);return[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({bucket:e,value:t}))}var Wl=e=>String(e).padStart(2,`0`),Gl=e=>`${e.getFullYear()}-${Wl(e.getMonth()+1)}-${Wl(e.getDate())}`,Kl={"7d":7,"30d":30,"90d":90};function ql(e,t=new Date){if(e===`today`)return new Date(t.getFullYear(),t.getMonth(),t.getDate());let n=Kl[e];return n?new Date(t.getFullYear(),t.getMonth(),t.getDate()-(n-1)):null}function Jl(e=365,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(e-1)),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+(6-(n.getDay()+6)%7)),o=[];for(let e=i;e<=a;e=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))o.push(Gl(e));let s=[],c=[];for(let e=0;e<o.length;e+=7)s.push(Array.from({length:7},(t,n)=>e+n)),c.push({index:s.length-1,month:Number(o[e].slice(5,7)),year:Number(o[e].slice(0,4))});return{days:o,weeks:s,months:s.flatMap((e,t)=>{let n=e.find(e=>o[e].slice(8)===`01`);return n===void 0?[]:[{index:t,label:Number(o[n].slice(5,7))}]}),monthLabels:c}}function Yl(e,t){return e<=0?0:t<=0?1:Math.min(4,Math.max(1,Math.ceil(e/t*4)))}function Xl(e,t=new Date){if(e===`today`){let e=Gl(t);return Array.from({length:24},(t,n)=>`${e}T${Wl(n)}:00`)}let n=ql(e,t),r=Kl[e]??0;return n?Array.from({length:r},(e,t)=>Gl(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t))):[]}function Zl(e,t){if(t.length===0)return e;let n=new Map(e.map(e=>[e.bucket,e.value]));return t.map(e=>({bucket:e,value:n.get(e)??0}))}var Ql=e=>`${e.slice(5,7)}/${e.slice(8,10)}`,$l=e=>e.includes(`T`)?e.slice(11,16):Ql(e),eu=e=>e.includes(`T`)?`${Ql(e)} ${e.slice(11,16)}`:Ql(e);function tu(e){let t=new Map;for(let n of e){let e=t.get(n.key)??{key:n.key,requests:0,tokens:0,costUsd:0};e.requests+=n.requests,e.tokens+=n.tokens,e.costUsd+=n.costUsd,t.set(n.key,e)}let n=[...t.values()],r=n.reduce((e,t)=>e+t.costUsd,0),i=n.reduce((e,t)=>e+t.requests,0);return n.map(e=>({...e,share:r>0?e.costUsd/r:i>0?e.requests/i:0}))}function nu(e){return Math.max(0,Math.round(e.requests*(1-e.successRate)))}function ru(e){let t=ae();if(!Number.isFinite(e)||e<=0)return`${t.symbol}0`;let n=e*t.rate;return n<.01?`${t.symbol}<0.01`:n<1e3?`${t.symbol}${n.toFixed(t.decimals)}`:ne(e,{compact:!0})}function iu(e,t=new Date){return Zl(Ul(e,`requests`),Xl(`today`,t))}var au=e=>String(e).padStart(2,`0`);function ou(e,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1),r=`${n.getFullYear()}-${au(n.getMonth()+1)}-${au(n.getDate())}`;return e.filter(e=>e.bucket===r).reduce((e,t)=>e+t.tokens,0)}function su(e,t){return t<=0?null:(e-t)/t}function cu(e,t){let n=[...e].sort((e,t)=>t.tokens-e.tokens)[0];return!n||n.tokens<=0?null:{model:n.model,share:t>0?Math.min(1,n.tokens/t):1}}var lu={session:300,weekly:10080};function uu(e){return e==null||!Number.isFinite(e)?null:Math.min(100,Math.max(0,100-e))}function du(e,t){let n=uu(t?.usedPercent);return n===null?null:{kind:e,windowMinutes:t?.windowMinutes??lu[e],remaining:n,resetsAt:t?.resetsAtUtc??null}}function fu(e){let t=[];for(let{provider:n,account:r}of e){if(r.status!==`active`||!r.quota)continue;let e=r.quota,i=[du(`session`,e.session),du(`weekly`,e.weekly)].filter(e=>e!==null),a=uu(e.credits?.usedPercent);a!==null&&i.push({kind:`credits`,windowMinutes:null,remaining:a,resetsAt:null}),i.length!==0&&t.push({accountId:r.id,providerId:n.id,providerName:e.planLabel||n.name,providerIcon:n.icon??null,accountName:r.displayName||r.accountEmail||r.id,rows:i})}return t}function pu(e){let t=[];for(let n of e){if(!n.enabled||!Hl(n)||n.quota?.isValid===!1)continue;let e=[];for(let t of n.quota?.plans??[]){let n=Il(t);Fl(t)?e.push({kind:`window`,windowMinutes:t.windowMinutes??null,remaining:100-(n??0),resetsAt:t.resetsAtUtc??null}):(t.remaining!=null||n!=null)&&e.push({kind:`balance`,windowMinutes:null,remaining:n==null?null:100-n,resetsAt:t.resetsAtUtc??null,amount:t.remaining==null?null:{value:t.remaining,unit:t.unit??null},label:t.name??null})}e.length!==0&&t.push({accountId:`provider:${n.id}`,providerId:n.id,providerName:n.name,providerIcon:n.icon??null,accountName:``,rows:e})}return t}function mu(e){let t=null;for(let n of e)for(let e of n.rows)e.remaining!==null&&(!t||e.remaining<t.row.remaining)&&(t={plan:n,row:{...e,remaining:e.remaining}});return t}function hu(e,t){let n=[];for(let t of e)for(let e of t.rows)e.remaining!==null&&n.push({plan:t,row:{...e,remaining:e.remaining}});return n.sort((e,t)=>e.row.remaining-t.row.remaining).slice(0,t)}function gu(e){return e<10?`red`:e<30?`orange`:`green`}function _u(e,t){let n=(e,n)=>new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{style:`unit`,unit:n,unitDisplay:t===`zh`?`long`:`narrow`}).format(e);return e>=1440&&e%1440==0?n(e/1440,`day`):e>=60?n(Math.round(e/60),`hour`):n(e,`minute`)}function vu(e,t,n=Date.now()){if(!e)return null;let r=new Date(e).getTime()-n;if(!Number.isFinite(r)||r<=0)return null;let i=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`}),a=r/36e5;return a>=48?i.format(Math.round(a/24),`day`):a>=1?i.format(Math.round(a),`hour`):i.format(Math.max(1,Math.round(r/6e4)),`minute`)}function yu(e,t,n,r=Date.now()){if(!e)return null;let i=Math.max(0,(r-e)/1e3),a=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`});return i<60?n:i<3600?a.format(-Math.round(i/60),`minute`):a.format(-Math.round(i/3600),`hour`)}function bu(e,t,n){let r={title:``,detail:``};if(e===`none`)return r;if(e===`alerts`){if(!t.running)return{title:`!`,detail:n.stopped};let e=t.summary?nu(t.summary):0;if(e>0)return{title:`⚠ ${e}`,detail:n.failures(e)};let i=mu(t.plans);if(i&&i.row.remaining<10){let e=`${Math.round(i.row.remaining)}%`;return{title:`⚠ ${e}`,detail:n.quota(i.plan.providerName,n.windowName(i.row),e)}}return r}if(e===`quota`){let e=mu(t.plans);if(!e)return r;let i=`${Math.round(e.row.remaining)}%`;return{title:i,detail:n.quota(e.plan.providerName,n.windowName(e.row),i)}}let i=t.summary;if(!i||!t.running)return r;switch(e){case`requests`:{let e=M(i.requests,!0);return{title:e,detail:n.requests(e)}}case`tokens`:{let e=M(i.inputTokens+i.outputTokens,!0);return{title:e,detail:n.tokens(e)}}case`cost`:{let e=ru(i.costUsd);return{title:e,detail:n.cost(e)}}}}var xu={title:`requests`,sections:{overview:!0,cost:!0,chart:!0,topModel:!0,compareYesterday:!1,cacheHitRate:!1,quota:!0,clients:!1}},Su=()=>!!v()?.tray;function Cu(){let[e,t]=(0,V.useState)(xu),[n,r]=(0,V.useState)(!v()?.tray);return(0,V.useEffect)(()=>{let e=v()?.tray;if(!e)return;let n=!0;e.getPrefs().then(e=>{n&&(t(e),r(!0))});let i=e.onPrefsChanged(t);return()=>{n=!1,i()}},[]),[e,(0,V.useCallback)(e=>{t(e);let n=v()?.tray;n&&n.setPrefs(e).then(t)},[]),n]}function wu(){let e=se(),[t,n]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let e=v()?.tray;if(!e)return;let t=!0;e.getState().then(e=>{t&&n(e)});let r=e.onStateChanged(n);return()=>{t=!1,r()}},[]),t??{running:e.isSuccess,port:null,activity:null,apiVersionMismatch:!1,updateAvailable:null}}function Tu(e,t,n){return{...e,sections:{...e.sections,[t]:n}}}var Eu=3e5,Du=new Map,Ou=()=>-new Date().getTimezoneOffset(),ku=Object.fromEntries(E.map(e=>[e,!1]));function Au(e,t){let n=O(),{enabled:r,background:o}=t,s=t.titleOnly?ku:e.sections,l=e.title!==`none`&&e.title!==`quota`,u=e.title===`quota`||e.title===`alerts`,f={refetchInterval:15e3,refetchIntervalInBackground:!1},p=s.quota||u,m=i({queryKey:a.settings,queryFn:()=>c(`GET`,`/api/settings`),enabled:r}),h=i({queryKey:a.stats(`summary`,`today`,``,``),queryFn:()=>c(`GET`,`/api/stats/summary?range=today`),enabled:r,...f,refetchIntervalInBackground:o&&l}),g=i({queryKey:a.stats(`timeseries`,`today`,`hour`,`provider`,``,``,Ou()),queryFn:()=>c(`GET`,`/api/stats/timeseries?range=today&groupBy=hour&by=provider&tzOffset=${Ou()}`),enabled:r&&s.chart,...f,refetchInterval:3e4}),_=i({queryKey:a.stats(`timeseries`,`7d`,`day`,`provider`,``,``,Ou()),queryFn:()=>c(`GET`,`/api/stats/timeseries?range=7d&groupBy=day&by=provider&tzOffset=${Ou()}`),enabled:r&&s.compareYesterday,...f,refetchInterval:6e4}),v=i({queryKey:a.stats(`top`,`today`,``,3,``),queryFn:()=>c(`GET`,`/api/stats/top-models?range=today&limit=3`),enabled:r&&s.topModel,...f,refetchInterval:3e4}),y=i({queryKey:a.providers,queryFn:()=>c(`GET`,`/api/providers`),enabled:r&&(p||s.clients),...f,refetchInterval:6e4,refetchIntervalInBackground:o&&u}),b=i({queryKey:a.clients,queryFn:()=>c(`GET`,`/api/clients`),enabled:r&&s.clients,...f,refetchInterval:3e4}),x=(0,V.useMemo)(()=>(y.data??[]).filter(e=>e.enabled&&e.authScheme===`oauth-subscription`),[y.data]),C=Se({queries:x.map(e=>({queryKey:a.providerAccounts(e.id),queryFn:()=>c(`GET`,`/api/providers/${d(e.id)}/accounts`),enabled:r&&p,...f,refetchInterval:6e4,refetchIntervalInBackground:o&&u}))}),w=x.flatMap((e,t)=>(C[t]?.data??[]).map(t=>({provider:e,account:t}))),T=w.map(e=>`${e.account.id}:${e.account.status}:${e.account.quota?.fetchedAtUtc??``}`).join(`|`),E=S({mutationFn:e=>c(`POST`,`/api/provider-accounts/${d(e)}/quota`),onSettled:e=>{e&&n.invalidateQueries({queryKey:a.providerAccounts(e.providerId)})}}),D=r&&p&&(t.live||e.title===`quota`||e.title===`alerts`);(0,V.useEffect)(()=>{if(!D)return;let e=Date.now();for(let{account:t}of w){if(t.status!==`active`)continue;let n=t.quota?.fetchedAtUtc?new Date(t.quota.fetchedAtUtc).getTime():0;Number.isFinite(n)&&e-n<Eu||e-(Du.get(t.id)??0)<Eu||(Du.set(t.id,e),E.mutate(t.id,{onError:()=>{}}))}},[D,T]);let k=[...fu(w),...pu(y.data??[])];return{settings:m.data,summary:h.data,hourly:g.data??[],daily:_.data??[],top:v.data??[],plans:k,hasSubscriptions:w.some(e=>e.account.status===`active`),clients:b.data??[],providers:y.data??[],updatedAt:h.dataUpdatedAt,loading:h.isLoading,error:h.isError}}function ju(e,t,n,r){let{t:i,locale:a}=pe(),o=v(),s=(0,V.useMemo)(()=>({requests:e=>i(`tray.title.requests`,{count:e}),tokens:e=>i(`tray.title.tokens`,{count:e}),cost:e=>i(`tray.title.cost`,{amount:e}),quota:(e,t,n)=>i(`tray.title.quota`,{plan:e,window:t,remaining:n}),failures:e=>i(`tray.title.failures`,{count:e}),stopped:i(`tray.status.stopped`),windowName:e=>e.kind===`balance`?e.label??i(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?i(`tray.quotaCredits`):_u(e.windowMinutes,a)}),[i,a]),c=bu(e.title,{running:t.running,summary:n,plans:r},s);(0,V.useEffect)(()=>{o?.tray.setTitle(c.title,c.detail)},[o,c.title,c.detail])}function Mu(){let[e]=Cu(),t=wu(),n=Au(e,{enabled:t.running,background:!0,live:!1,titleOnly:!0});return ju(e,t,n.summary,n.plans),null}export{ks as $,Rl as A,yl as B,tu as C,Zl as D,Ul as E,Ll as F,Js as G,vl as H,Vl as I,Ms as J,Ds as K,Al as L,zl as M,Bl as N,Xl as O,Hl as P,Is as Q,kl as R,Yl as S,eu as T,Ol as U,wl as V,Dl as W,Fs as X,Ns as Y,As as Z,cu as _,Su as a,La as at,ou as b,Tu as c,dr as ct,ru as d,Se as dt,lo as et,iu as f,hu as g,mu as h,xu as i,Na as it,Pl as j,ql as k,su as l,ct as lt,vu as m,ju as n,io as nt,Cu as o,Oa as ot,gu as p,Ps as q,Au as r,ja as rt,wu as s,sr as st,Mu as t,po as tt,nu as u,Ne as ut,yu as v,$l as w,Jl as x,_u as y,El as z};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Ma as n,Pa as r,To as i,X as a,ct as o,et as s,it as c,lt as l,nt as u,q as d}from"./format-Bw-mDeuE.js";var f=e(t(),1),p=i(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Checkbox`,[_,v]=l(g),[y,b]=_(g);function x(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:d=`on`,internal_do_not_use_render:m}=e,[h,_]=u({prop:n,defaultProp:i??!1,onChange:c,caller:g}),[v,b]=f.useState(null),[x,S]=f.useState(null),C=f.useRef(!1),[w,T]=f.useReducer(e=>e+1,0),E=!v||!!o||!!v.closest(`form`),k={checked:h,disabled:a,setChecked:_,control:v,setControl:b,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:l,defaultChecked:!O(i)&&i,isFormControl:E,bubbleInput:x,setBubbleInput:S};return(0,p.jsx)(y,{scope:t,...k,children:D(m)?m(k):r})}h(x,`CheckboxProvider`);var S=`CheckboxTrigger`,C=f.forwardRef(h(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:l,disabled:u,checked:d,required:m,setControl:g,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:x,bubbleInput:C}=b(S,e),w=o(i,g),T=f.useRef(d);return f.useEffect(()=>{let e=a?.form;if(e){let t=h(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,_]),(0,p.jsx)(s.button,{type:`button`,role:`checkbox`,"aria-checked":O(d)?`mixed`:d,"aria-required":m,"data-state":k(d),"data-disabled":u?``:void 0,disabled:u,value:l,...r,ref:w,onKeyDown:c(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:c(n,e=>{y(),_(e=>O(e)?!0:!e),C&&x&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`CheckboxTrigger`)),w=f.forwardRef(h(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(x,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(C,{...d,ref:t,__scopeCheckbox:n}),e&&(0,p.jsx)(E,{__scopeCheckbox:n})]})})},`Checkbox`)),T=`CheckboxBubbleInput`,E=f.forwardRef(h(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:u,defaultChecked:m,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:x,setBubbleInput:S}=b(T,e),C=o(r,S),w=d(i),E=f.useRef(!1),D=f.useRef(u),k=f.useRef(l);f.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=l!==k.current;k.current=l;let i=D.current!==u;D.current=u;let o=!(r&&a.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:o});e.indeterminate=O(u),n.call(e,!O(u)&&u),e.dispatchEvent(t),E.current=!1}},[x,u,a,l]);let A=f.useRef(!O(u)&&u);return(0,p.jsx)(s.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:g,name:_,value:v,form:y,...n,tabIndex:-1,ref:C,onClick:c(t,e=>{E.current&&e.stopPropagation()}),style:{...n.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function D(e){return typeof e==`function`}h(D,`isFunction`);function O(e){return e===`indeterminate`}h(O,`isIndeterminate`);function k(e){return O(e)?`indeterminate`:e?`checked`:`unchecked`}h(k,`getState`);var A={field:`_field_1yczx_1`,box:`_box_1yczx_3`,visual:`_visual_1yczx_7`,fill:`_fill_1yczx_9`,mark:`_mark_1yczx_11`,copy:`_copy_1yczx_23`},j=`M4.25 9.25 L7.25 12.25 L13.75 5.75`,M=`M4.75 9 L9 9 L13.25 9`,N=(0,f.forwardRef)(function({label:e,description:t,id:i,className:o,checked:s,defaultChecked:c,onCheckedChange:l,...u},d){let m=(0,f.useId)(),h=i??m,g=r(),[_,v]=(0,f.useState)(c??!1),y=s??_,b=y!==!1,x=e=>{s===void 0&&v(e),l?.(e)},S={duration:b?a.duration.instant:a.duration.fast,ease:[...a.ease.standard]};return(0,p.jsxs)(`div`,{className:A.field,children:[(0,p.jsx)(w,{...u,id:h,ref:d,checked:y,onCheckedChange:x,className:[A.box,o].filter(Boolean).join(` `),"aria-describedby":t?`${h}-description`:void 0,"aria-label":u[`aria-label`]??(e?void 0:`Checkbox`),children:(0,p.jsxs)(`span`,{className:A.visual,"aria-hidden":`true`,children:[(0,p.jsx)(n.span,{className:A.fill,initial:!1,animate:{opacity:+!!b,scale:b?1:.6},transition:g?{duration:0}:{scale:a.spring.snappy,opacity:S}}),(0,p.jsx)(`svg`,{className:A.mark,viewBox:`0 0 18 18`,fill:`none`,focusable:`false`,children:(0,p.jsx)(n.path,{initial:!1,animate:{d:y===`indeterminate`?M:j,pathLength:+!!b,opacity:+!!b},transition:g?{duration:0}:{d:a.spring.morph,pathLength:a.spring.snappy,opacity:S},stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}),e||t?(0,p.jsxs)(`div`,{className:A.copy,children:[e?(0,p.jsx)(`label`,{htmlFor:h,children:e}):null,t?(0,p.jsx)(`span`,{id:`${h}-description`,children:t}):null]}):null]})});N.displayName=`Checkbox`;export{N as t};
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{J as n,Qs as r,Z as i,as as a,at as o,lt as s,rt as c,ss as l,tt as u,ut as d}from"./format-CmXxTS5M.js";var f=e(t(),1),p=r(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Checkbox`,[_,v]=d(g),[y,b]=_(g);function x(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:m}=e,[h,_]=c({prop:n,defaultProp:i??!1,onChange:l,caller:g}),[v,b]=f.useState(null),[x,S]=f.useState(null),C=f.useRef(!1),[w,T]=f.useReducer(e=>e+1,0),E=!v||!!o||!!v.closest(`form`),k={checked:h,disabled:a,setChecked:_,control:v,setControl:b,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:u,defaultChecked:!O(i)&&i,isFormControl:E,bubbleInput:x,setBubbleInput:S};return(0,p.jsx)(y,{scope:t,...k,children:D(m)?m(k):r})}h(x,`CheckboxProvider`);var S=`CheckboxTrigger`,C=f.forwardRef(h(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:c,disabled:l,checked:d,required:m,setControl:g,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:x,bubbleInput:C}=b(S,e),w=s(i,g),T=f.useRef(d);return f.useEffect(()=>{let e=a?.form;if(e){let t=h(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,_]),(0,p.jsx)(u.button,{type:`button`,role:`checkbox`,"aria-checked":O(d)?`mixed`:d,"aria-required":m,"data-state":k(d),"data-disabled":l?``:void 0,disabled:l,value:c,...r,ref:w,onKeyDown:o(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:o(n,e=>{y(),_(e=>O(e)?!0:!e),C&&x&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`CheckboxTrigger`)),w=f.forwardRef(h(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(x,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(C,{...d,ref:t,__scopeCheckbox:n}),e&&(0,p.jsx)(E,{__scopeCheckbox:n})]})})},`Checkbox`)),T=`CheckboxBubbleInput`,E=f.forwardRef(h(function({__scopeCheckbox:e,onClick:t,...r},i){let{control:a,hasConsumerStoppedPropagationRef:c,userInteractionCount:l,checked:d,defaultChecked:m,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:x,setBubbleInput:S}=b(T,e),C=s(i,S),w=n(a),E=f.useRef(!1),D=f.useRef(d),k=f.useRef(l);f.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=l!==k.current;k.current=l;let i=D.current!==d;D.current=d;let a=!(r&&c.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:a});e.indeterminate=O(d),n.call(e,!O(d)&&d),e.dispatchEvent(t),E.current=!1}},[x,d,c,l]);let A=f.useRef(!O(d)&&d);return(0,p.jsx)(u.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:g,name:_,value:v,form:y,...r,tabIndex:-1,ref:C,onClick:o(t,e=>{E.current&&e.stopPropagation()}),style:{...r.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function D(e){return typeof e==`function`}h(D,`isFunction`);function O(e){return e===`indeterminate`}h(O,`isIndeterminate`);function k(e){return O(e)?`indeterminate`:e?`checked`:`unchecked`}h(k,`getState`);var A={field:`_field_1yczx_1`,box:`_box_1yczx_3`,visual:`_visual_1yczx_7`,fill:`_fill_1yczx_9`,mark:`_mark_1yczx_11`,copy:`_copy_1yczx_23`},j=`M4.25 9.25 L7.25 12.25 L13.75 5.75`,M=`M4.75 9 L9 9 L13.25 9`,N=(0,f.forwardRef)(function({label:e,description:t,id:n,className:r,checked:o,defaultChecked:s,onCheckedChange:c,...u},d){let m=(0,f.useId)(),h=n??m,g=l(),[_,v]=(0,f.useState)(s??!1),y=o??_,b=y!==!1,x=e=>{o===void 0&&v(e),c?.(e)},S={duration:b?i.duration.instant:i.duration.fast,ease:[...i.ease.standard]};return(0,p.jsxs)(`div`,{className:A.field,children:[(0,p.jsx)(w,{...u,id:h,ref:d,checked:y,onCheckedChange:x,className:[A.box,r].filter(Boolean).join(` `),"aria-describedby":t?`${h}-description`:void 0,"aria-label":u[`aria-label`]??(e?void 0:`Checkbox`),children:(0,p.jsxs)(`span`,{className:A.visual,"aria-hidden":`true`,children:[(0,p.jsx)(a.span,{className:A.fill,initial:!1,animate:{opacity:+!!b,scale:b?1:.6},transition:g?{duration:0}:{scale:i.spring.snappy,opacity:S}}),(0,p.jsx)(`svg`,{className:A.mark,viewBox:`0 0 18 18`,fill:`none`,focusable:`false`,children:(0,p.jsx)(a.path,{initial:!1,animate:{d:y===`indeterminate`?M:j,pathLength:+!!b,opacity:+!!b},transition:g?{duration:0}:{d:i.spring.morph,pathLength:i.spring.snappy,opacity:S},stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}),e||t?(0,p.jsxs)(`div`,{className:A.copy,children:[e?(0,p.jsx)(`label`,{htmlFor:h,children:e}):null,t?(0,p.jsx)(`span`,{id:`${h}-description`,children:t}):null]}):null]})});N.displayName=`Checkbox`;export{N as t};
@@ -0,0 +1 @@
1
+ var e={"claude-code":`Claude Code`,codex:`Codex`,"gemini-cli":`Gemini CLI`,opencode:`OpenCode`,"copilot-cli":`Copilot CLI`,droid:`Droid`,"grok-build":`Grok Build`,"qwen-code":`Qwen Code`,pi:`Pi`,omp:`oh-my-pi`,"minimax-code":`MiniMax Code`,"hermes-agent":`Hermes Agent`,"deepseek-harness":`DeepSeek Harness`,"command-code":`Command Code`,crush:`Crush`,zcode:`ZCode`,"antigravity-cli":`Antigravity CLI`,goose:`Goose`},t=t=>e[t]??t;export{t};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Fa as n,La as r,Ma as i,Na as a,Pa as o,Ra as s,To as c,X as l}from"./format-Bw-mDeuE.js";import{t as ee}from"./circle-alert-B2ow_KNW.js";import{t as u}from"./loader-circle-D-RkwQwX.js";var d=e(t(),1),f={root:`_root_154xn_1`,surface:`_surface_154xn_31`,trigger:`_trigger_154xn_77`,face:`_face_154xn_81`,icon:`_icon_154xn_127`,prompt:`_prompt_154xn_135`,secondary:`_secondary_154xn_139`,primary:`_primary_154xn_141`,status:`_status_154xn_179`,statusText:`_statusText_154xn_189`,check:`_check_154xn_193`,checkDisc:`_checkDisc_154xn_195`,checkTick:`_checkTick_154xn_197`,spinner:`_spinner_154xn_199`,spin:`_spin_154xn_199`,srOnly:`_srOnly_154xn_205`},p=c(),m=12,{blur:h}=l,g=[...l.ease.enter],_=[...l.ease.standard],v=(e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}},y=v(.44,.18),b=v(.34,0),x=v(.36,.06),S=()=>()=>{};function te(){let e=(0,d.useSyncExternalStore)(S,()=>!0,()=>!1);return!!o()&&e}var C={hidden:e=>({opacity:0,x:e*m,filter:`blur(${h.soft}px)`}),shown:{opacity:1,x:0,filter:`blur(0px)`,transition:{x,opacity:{duration:.2,ease:g,delay:.04},filter:{duration:.22,ease:g,delay:.04}}},gone:e=>({opacity:0,x:e*-12*.6,filter:`blur(${h.soft}px)`,transition:{x,opacity:{duration:.12,ease:_},filter:{duration:.12,ease:_}}})},w={hidden:{opacity:0},shown:{opacity:1,transition:{duration:.14}},gone:{opacity:0,transition:{duration:.1}}};function ne({id:e,direction:t,reduced:n,onSize:r,children:a,labelledBy:o}){let c=(0,d.useRef)(null),l=s();return(0,d.useLayoutEffect)(()=>{let t=c.current;if(!t||!l)return;let n=()=>{let n=t.style.flex;t.style.flex=`none`;let i=t.offsetWidth;t.style.flex=n,r(e,i)};if(n(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(n);return i.observe(t),()=>i.disconnect()},[e,r,l]),(0,p.jsx)(i.div,{ref:c,className:f.face,"data-face":e,custom:t,role:o?`group`:void 0,"aria-labelledby":o,variants:n?w:C,initial:`hidden`,animate:`shown`,exit:`gone`,inert:!l||void 0,children:a})}function re({reduced:e}){return(0,p.jsxs)(`svg`,{className:f.check,viewBox:`0 0 18 18`,fill:`none`,"aria-hidden":`true`,children:[(0,p.jsx)(i.circle,{className:f.checkDisc,cx:`9`,cy:`9`,r:`8`,style:{transformOrigin:`9px 9px`},initial:!e&&{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{scale:v(.34,.3),opacity:{duration:.12}}}),(0,p.jsx)(i.path,{className:f.checkTick,d:`M5.6 9.3 7.8 11.4 12.4 6.7`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!e&&{pathLength:0},animate:{pathLength:1},transition:{duration:.28,ease:g,delay:.12}})]})}function T({label:e,icon:t,prompt:o,confirmLabel:s=`Delete`,cancelLabel:c=`Cancel`,pendingLabel:l=`Deleting`,doneLabel:m=`Deleted`,errorLabel:h=`Couldn’t finish`,retryLabel:g=`Retry`,undoLabel:_=`Undo`,undoingLabel:v=`Restoring`,tone:x=`danger`,onConfirm:S,onUndo:C,onCancel:w,state:T,defaultState:ie=`idle`,onStateChange:E,confirmTimeout:ae=6e3,resultTimeout:oe=5e3,cancelOnOutsidePress:D=!0,disabled:O=!1,className:se,ref:ce}){let k=te(),A=`${(0,d.useId)()}-prompt`,j=(0,d.useRef)(null);(0,d.useImperativeHandle)(ce,()=>j.current,[]);let[le,ue]=(0,d.useState)(ie),M=T??le,[N,P]=(0,d.useState)(1),[F,de]=(0,d.useState)(`confirm`),[fe,I]=(0,d.useState)(``),L=(0,d.useRef)({state:M,onStateChange:E,controlled:T!==void 0});(0,d.useLayoutEffect)(()=>{L.current={state:M,onStateChange:E,controlled:T!==void 0}});let R=(0,d.useRef)(!1),z=(0,d.useRef)(0),B=(0,d.useCallback)(e=>{if(e===L.current.state)return;let t=j.current;R.current=!!t&&(t.contains(document.activeElement)||document.activeElement===document.body),P(e===`idle`?-1:1),L.current.controlled||ue(e),L.current.state=e,L.current.onStateChange?.(e)},[]),V=(0,d.useCallback)(()=>{z.current++,B(`idle`)},[B]),H=(0,d.useCallback)(async e=>{let t=e===`confirm`?S:C,n=++z.current;de(e);let r;try{r=t?.()}catch{B(`error`),I(h);return}if(r&&typeof r.then==`function`){B(`pending`),I(e===`confirm`?l:v);try{await r}catch{if(n!==z.current)return;B(`error`),I(h);return}if(n!==z.current)return}if(e===`undo`){B(`idle`),I(`Undone`);return}B(`done`),I(C?`${m}. ${_} is available.`:m)},[m,h,B,S,C,l,_,v]),U=(0,d.useCallback)(()=>{w?.(),V(),I(`Cancelled`)},[w,V]),W=(0,d.useRef)(()=>{});(0,d.useLayoutEffect)(()=>{W.current=()=>{L.current.state===`confirming`?U():V()}});let G=n(`auto`),K=(0,d.useRef)(0),q=(0,d.useRef)(0),pe=(0,d.useCallback)((e,t)=>{if(e!==L.current.state||Math.abs(t-K.current)<.5)return;let n=K.current;if(K.current=t,!n||k){G.jump(`auto`);return}G.get()===`auto`&&G.jump(n);let r=++q.current;a(G,t,t>n?y:b).then(()=>{r===q.current&&G.jump(`auto`)})},[k,G]),J=n(1),Y=(0,d.useRef)(null),X=(0,d.useRef)({hover:!1,hidden:!1}),Z=M===`confirming`?ae:M===`done`||M===`error`?oe:0,Q=(0,d.useCallback)(()=>{let e=Y.current;e&&(X.current.hover||X.current.hidden?e.pause():e.play())},[]);(0,d.useEffect)(()=>{if(!Z)return;J.jump(1);let e=a(J,0,{duration:Z/1e3,ease:`linear`});return Y.current=e,e.then(()=>{Y.current===e&&(Y.current=null,W.current())}),Q(),()=>{Y.current===e&&(Y.current=null),e.stop()}},[J,M,Q,Z]),(0,d.useEffect)(()=>{let e=()=>{X.current.hidden=document.hidden,Q()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[Q]),(0,d.useEffect)(()=>{if(M!==`confirming`||!D)return;let e=e=>{j.current?.contains(e.target)||U()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[U,D,M]),(0,d.useLayoutEffect)(()=>{if(!R.current)return;R.current=!1;let e=j.current;e&&(e.querySelector(`[data-face="${M}"]`)?.querySelector(`[data-autofocus]:not(:disabled)`)??e).focus({preventScroll:!0})},[M]);let me=e=>{e.key===`Escape`&&(M===`confirming`?(e.preventDefault(),e.stopPropagation(),U()):(M===`done`||M===`error`)&&(e.preventDefault(),e.stopPropagation(),V()))},$=o??(0,p.jsxs)(p.Fragment,{children:[e,`?`]}),he=(()=>{switch(M){case`confirming`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{id:A,className:f.prompt,children:$}),(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:U,children:c}),(0,p.jsx)(`button`,{type:`button`,className:f.primary,onClick:()=>void H(`confirm`),children:s})]});case`pending`:return(0,p.jsxs)(`span`,{className:f.status,children:[(0,p.jsx)(u,{className:f.spinner,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{children:F===`undo`?v:l})]});case`done`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:f.status,"data-tone":`success`,children:[(0,p.jsx)(re,{reduced:k}),(0,p.jsx)(`span`,{className:f.statusText,children:m})]}),C&&(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:()=>void H(`undo`),children:_})]});case`error`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:f.status,"data-tone":`danger`,children:[(0,p.jsx)(ee,{size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:f.statusText,children:h})]}),(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:()=>void H(F),children:g})]});default:return(0,p.jsxs)(`button`,{type:`button`,className:f.trigger,"data-autofocus":!0,disabled:O,onClick:()=>{I(typeof $==`string`?$:``),B(`confirming`)},children:[t&&(0,p.jsx)(`span`,{className:f.icon,"aria-hidden":`true`,children:t}),(0,p.jsx)(`span`,{children:e})]})}})();return(0,p.jsxs)(`div`,{ref:j,className:[f.root,se].filter(Boolean).join(` `),"data-state":M,"data-tone":x,"data-disabled":O||void 0,tabIndex:-1,onKeyDown:me,"aria-busy":M===`pending`||void 0,onPointerEnter:()=>{X.current.hover=!0,Q()},onPointerLeave:()=>{X.current.hover=!1,Q()},onPointerCancel:()=>{X.current.hover=!1,Q()},children:[(0,p.jsx)(i.div,{className:f.surface,style:{width:G},children:(0,p.jsx)(r,{initial:!1,custom:N,children:(0,p.jsx)(ne,{id:M,direction:N,reduced:k,onSize:pe,labelledBy:M===`confirming`?A:void 0,children:he},M)})}),(0,p.jsx)(`span`,{className:f.srOnly,role:`status`,"aria-live":`polite`,children:fe})]})}export{T as t};
1
+ import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Qs as n,Z as r,as as i,cs as a,ds as o,os as s,ss as c,us as l}from"./format-CmXxTS5M.js";import{t as ee}from"./circle-alert-B2ow_KNW.js";import{t as u}from"./loader-circle-D-RkwQwX.js";var d=e(t(),1),f={root:`_root_154xn_1`,surface:`_surface_154xn_31`,trigger:`_trigger_154xn_77`,face:`_face_154xn_81`,icon:`_icon_154xn_127`,prompt:`_prompt_154xn_135`,secondary:`_secondary_154xn_139`,primary:`_primary_154xn_141`,status:`_status_154xn_179`,statusText:`_statusText_154xn_189`,check:`_check_154xn_193`,checkDisc:`_checkDisc_154xn_195`,checkTick:`_checkTick_154xn_197`,spinner:`_spinner_154xn_199`,spin:`_spin_154xn_199`,srOnly:`_srOnly_154xn_205`},p=n(),m=12,{blur:h}=r,g=[...r.ease.enter],_=[...r.ease.standard],v=(e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}},y=v(.44,.18),b=v(.34,0),x=v(.36,.06),S=()=>()=>{};function te(){let e=(0,d.useSyncExternalStore)(S,()=>!0,()=>!1);return!!c()&&e}var C={hidden:e=>({opacity:0,x:e*m,filter:`blur(${h.soft}px)`}),shown:{opacity:1,x:0,filter:`blur(0px)`,transition:{x,opacity:{duration:.2,ease:g,delay:.04},filter:{duration:.22,ease:g,delay:.04}}},gone:e=>({opacity:0,x:e*-12*.6,filter:`blur(${h.soft}px)`,transition:{x,opacity:{duration:.12,ease:_},filter:{duration:.12,ease:_}}})},w={hidden:{opacity:0},shown:{opacity:1,transition:{duration:.14}},gone:{opacity:0,transition:{duration:.1}}};function ne({id:e,direction:t,reduced:n,onSize:r,children:a,labelledBy:s}){let c=(0,d.useRef)(null),l=o();return(0,d.useLayoutEffect)(()=>{let t=c.current;if(!t||!l)return;let n=()=>{let n=t.style.flex;t.style.flex=`none`;let i=t.offsetWidth;t.style.flex=n,r(e,i)};if(n(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(n);return i.observe(t),()=>i.disconnect()},[e,r,l]),(0,p.jsx)(i.div,{ref:c,className:f.face,"data-face":e,custom:t,role:s?`group`:void 0,"aria-labelledby":s,variants:n?w:C,initial:`hidden`,animate:`shown`,exit:`gone`,inert:!l||void 0,children:a})}function re({reduced:e}){return(0,p.jsxs)(`svg`,{className:f.check,viewBox:`0 0 18 18`,fill:`none`,"aria-hidden":`true`,children:[(0,p.jsx)(i.circle,{className:f.checkDisc,cx:`9`,cy:`9`,r:`8`,style:{transformOrigin:`9px 9px`},initial:!e&&{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{scale:v(.34,.3),opacity:{duration:.12}}}),(0,p.jsx)(i.path,{className:f.checkTick,d:`M5.6 9.3 7.8 11.4 12.4 6.7`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!e&&{pathLength:0},animate:{pathLength:1},transition:{duration:.28,ease:g,delay:.12}})]})}function T({label:e,icon:t,prompt:n,confirmLabel:r=`Delete`,cancelLabel:o=`Cancel`,pendingLabel:c=`Deleting`,doneLabel:m=`Deleted`,errorLabel:h=`Couldn’t finish`,retryLabel:g=`Retry`,undoLabel:_=`Undo`,undoingLabel:v=`Restoring`,tone:x=`danger`,onConfirm:S,onUndo:C,onCancel:w,state:T,defaultState:ie=`idle`,onStateChange:E,confirmTimeout:ae=6e3,resultTimeout:oe=5e3,cancelOnOutsidePress:D=!0,disabled:O=!1,className:se,ref:ce}){let k=te(),A=`${(0,d.useId)()}-prompt`,j=(0,d.useRef)(null);(0,d.useImperativeHandle)(ce,()=>j.current,[]);let[le,ue]=(0,d.useState)(ie),M=T??le,[N,P]=(0,d.useState)(1),[F,de]=(0,d.useState)(`confirm`),[fe,I]=(0,d.useState)(``),L=(0,d.useRef)({state:M,onStateChange:E,controlled:T!==void 0});(0,d.useLayoutEffect)(()=>{L.current={state:M,onStateChange:E,controlled:T!==void 0}});let R=(0,d.useRef)(!1),z=(0,d.useRef)(0),B=(0,d.useCallback)(e=>{if(e===L.current.state)return;let t=j.current;R.current=!!t&&(t.contains(document.activeElement)||document.activeElement===document.body),P(e===`idle`?-1:1),L.current.controlled||ue(e),L.current.state=e,L.current.onStateChange?.(e)},[]),V=(0,d.useCallback)(()=>{z.current++,B(`idle`)},[B]),H=(0,d.useCallback)(async e=>{let t=e===`confirm`?S:C,n=++z.current;de(e);let r;try{r=t?.()}catch{B(`error`),I(h);return}if(r&&typeof r.then==`function`){B(`pending`),I(e===`confirm`?c:v);try{await r}catch{if(n!==z.current)return;B(`error`),I(h);return}if(n!==z.current)return}if(e===`undo`){B(`idle`),I(`Undone`);return}B(`done`),I(C?`${m}. ${_} is available.`:m)},[m,h,B,S,C,c,_,v]),U=(0,d.useCallback)(()=>{w?.(),V(),I(`Cancelled`)},[w,V]),W=(0,d.useRef)(()=>{});(0,d.useLayoutEffect)(()=>{W.current=()=>{L.current.state===`confirming`?U():V()}});let G=a(`auto`),K=(0,d.useRef)(0),q=(0,d.useRef)(0),pe=(0,d.useCallback)((e,t)=>{if(e!==L.current.state||Math.abs(t-K.current)<.5)return;let n=K.current;if(K.current=t,!n||k){G.jump(`auto`);return}G.get()===`auto`&&G.jump(n);let r=++q.current;s(G,t,t>n?y:b).then(()=>{r===q.current&&G.jump(`auto`)})},[k,G]),J=a(1),Y=(0,d.useRef)(null),X=(0,d.useRef)({hover:!1,hidden:!1}),Z=M===`confirming`?ae:M===`done`||M===`error`?oe:0,Q=(0,d.useCallback)(()=>{let e=Y.current;e&&(X.current.hover||X.current.hidden?e.pause():e.play())},[]);(0,d.useEffect)(()=>{if(!Z)return;J.jump(1);let e=s(J,0,{duration:Z/1e3,ease:`linear`});return Y.current=e,e.then(()=>{Y.current===e&&(Y.current=null,W.current())}),Q(),()=>{Y.current===e&&(Y.current=null),e.stop()}},[J,M,Q,Z]),(0,d.useEffect)(()=>{let e=()=>{X.current.hidden=document.hidden,Q()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[Q]),(0,d.useEffect)(()=>{if(M!==`confirming`||!D)return;let e=e=>{j.current?.contains(e.target)||U()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[U,D,M]),(0,d.useLayoutEffect)(()=>{if(!R.current)return;R.current=!1;let e=j.current;e&&(e.querySelector(`[data-face="${M}"]`)?.querySelector(`[data-autofocus]:not(:disabled)`)??e).focus({preventScroll:!0})},[M]);let me=e=>{e.key===`Escape`&&(M===`confirming`?(e.preventDefault(),e.stopPropagation(),U()):(M===`done`||M===`error`)&&(e.preventDefault(),e.stopPropagation(),V()))},$=n??(0,p.jsxs)(p.Fragment,{children:[e,`?`]}),he=(()=>{switch(M){case`confirming`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{id:A,className:f.prompt,children:$}),(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:U,children:o}),(0,p.jsx)(`button`,{type:`button`,className:f.primary,onClick:()=>void H(`confirm`),children:r})]});case`pending`:return(0,p.jsxs)(`span`,{className:f.status,children:[(0,p.jsx)(u,{className:f.spinner,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{children:F===`undo`?v:c})]});case`done`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:f.status,"data-tone":`success`,children:[(0,p.jsx)(re,{reduced:k}),(0,p.jsx)(`span`,{className:f.statusText,children:m})]}),C&&(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:()=>void H(`undo`),children:_})]});case`error`:return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:f.status,"data-tone":`danger`,children:[(0,p.jsx)(ee,{size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:f.statusText,children:h})]}),(0,p.jsx)(`button`,{type:`button`,className:f.secondary,"data-autofocus":!0,onClick:()=>void H(F),children:g})]});default:return(0,p.jsxs)(`button`,{type:`button`,className:f.trigger,"data-autofocus":!0,disabled:O,onClick:()=>{I(typeof $==`string`?$:``),B(`confirming`)},children:[t&&(0,p.jsx)(`span`,{className:f.icon,"aria-hidden":`true`,children:t}),(0,p.jsx)(`span`,{children:e})]})}})();return(0,p.jsxs)(`div`,{ref:j,className:[f.root,se].filter(Boolean).join(` `),"data-state":M,"data-tone":x,"data-disabled":O||void 0,tabIndex:-1,onKeyDown:me,"aria-busy":M===`pending`||void 0,onPointerEnter:()=>{X.current.hover=!0,Q()},onPointerLeave:()=>{X.current.hover=!1,Q()},onPointerCancel:()=>{X.current.hover=!1,Q()},children:[(0,p.jsx)(i.div,{className:f.surface,style:{width:G},children:(0,p.jsx)(l,{initial:!1,custom:N,children:(0,p.jsx)(ne,{id:M,direction:N,reduced:k,onSize:pe,labelledBy:M===`confirming`?A:void 0,children:he},M)})}),(0,p.jsx)(`span`,{className:f.srOnly,role:`status`,"aria-live":`polite`,children:fe})]})}export{T as t};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./createLucideIcon-7fjTeqBK.js";var n=e({__iconData:()=>r,default:()=>i}),r={name:`file-up`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]};r.node;var i=t(r);export{n,i as t};
@@ -0,0 +1 @@
1
+ import{a as e,t}from"./createLucideIcon-7fjTeqBK.js";var n=e({__iconData:()=>r,default:()=>i}),r={name:`flame`,size:24,node:[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]};r.node;var i=t(r);export{n,i as t};