@aidotnet/server-win32-x64 0.14.3105 → 0.14.3107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/astra-server.exe +2 -2
- package/bin/wwwroot/assets/{ClientsPage-COC8lfKF.js → ClientsPage-G2RzDwxF.js} +2 -2
- package/bin/wwwroot/assets/{KeyPage-usImCI1l.js → KeyPage-B5yEJIx1.js} +1 -1
- package/bin/wwwroot/assets/{McpPage-D_uvPjF5.js → McpPage-Cqa0o8pN.js} +1 -1
- package/bin/wwwroot/assets/{ModelDetailPage-CSgyizzq.js → ModelDetailPage-7guGX9zo.js} +1 -1
- package/bin/wwwroot/assets/{ModelsPage-B13qOMuJ.js → ModelsPage-BDyBn2ka.js} +1 -1
- package/bin/wwwroot/assets/{PluginsPage-BigxbbK6.js → PluginsPage-DIXK68XW.js} +1 -1
- package/bin/wwwroot/assets/{PrivacyPage-CaUXn9Pj.js → PrivacyPage-BXSsUc19.js} +1 -1
- package/bin/wwwroot/assets/{ProviderDetailPage-bmjEJLMl.js → ProviderDetailPage-ZAGqduuj.js} +1 -1
- package/bin/wwwroot/assets/{ProvidersPage-B1FxC5kV.js → ProvidersPage-BtVpzabI.js} +1 -1
- package/bin/wwwroot/assets/{SettingsPage-DKCf-Kn7.js → SettingsPage-PTbLN9Jh.js} +1 -1
- package/bin/wwwroot/assets/{SkillsPage-DEMkjIab.js → SkillsPage-CX6F2OHt.js} +1 -1
- package/bin/wwwroot/assets/{SmartRoutingPage-udRjsK4H.js → SmartRoutingPage-Xs6563FH.js} +1 -1
- package/bin/wwwroot/assets/{TokenDetailPage-DmvgGiZM.js → TokenDetailPage-BCsrS5MY.js} +1 -1
- package/bin/wwwroot/assets/{TokenPoolEditor-thPAci_g.js → TokenPoolEditor-yKDplMAk.js} +1 -1
- package/bin/wwwroot/assets/{TokensPage-BN1h_nhM.js → TokensPage-CovQvxys.js} +1 -1
- package/bin/wwwroot/assets/{TracesPage-gKbBBrq3.js → TracesPage-nE3zf5Pt.js} +1 -1
- package/bin/wwwroot/assets/{TrayPanelPage-Cigljgtp.js → TrayPanelPage-NhkC5uY7.js} +1 -1
- package/bin/wwwroot/assets/{TrayPanelView-CN6A6AKW.js → TrayPanelView-DsZLtFjY.js} +1 -1
- package/bin/wwwroot/assets/{TrayTitleSource-Vrhk5544.js → TrayTitleSource-U2fI0rGJ.js} +1 -1
- package/bin/wwwroot/assets/{checkbox-DGDdtEgb.js → checkbox-C7ORfHsK.js} +1 -1
- package/bin/wwwroot/assets/{confirm-morph-QxrTkHxo.js → confirm-morph-Cm30hox1.js} +1 -1
- package/bin/wwwroot/assets/{format-xhi4nXQn.js → format-hEAJVPjJ.js} +2 -2
- package/bin/wwwroot/assets/{index-ug2mwIxe.js → index-CUXoLKaW.js} +3 -3
- package/bin/wwwroot/assets/{radio-cards-C8S87Euv.js → radio-cards-B9j0qfgH.js} +1 -1
- package/bin/wwwroot/assets/{sortable.esm-CgiwIVTR.js → sortable.esm-CiuAGjJv.js} +1 -1
- package/bin/wwwroot/assets/{use-transform-DZtiZX0A.js → use-transform-DS7fo517.js} +1 -1
- package/bin/wwwroot/index.html +4 -4
- package/package.json +1 -1
|
@@ -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-xhi4nXQn.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-Vrhk5544.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-ug2mwIxe.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{C as n,H as r,To as i,c as a,j as o,u as s,ut as c}from"./format-hEAJVPjJ.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-U2fI0rGJ.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-CUXoLKaW.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,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$ as n,$a as r,C as i,D as a,En as o,Fa as s,K as c,La as l,Ma as u,Na as d,Pa as f,Q as p,Qa as m,Ra as h,Sa as g,Ta as _,To as v,X as y,Xa as b,Ya as x,Z as S,Za as C,_o as w,at as T,ct as E,do as D,eo as O,et as k,ht as A,io as j,it as M,ja as N,lo as P,lt as F,no as I,nt as L,oo as R,ot as z,p as ee,q as te,ro as B,rt as V,to as ne,tt as re,u as ie,ut as ae,va as oe,w as se,wo as ce,x as le,xa as ue,xo as de,yo as fe}from"./format-xhi4nXQn.js";import{t as pe}from"./check-DKfsh0bQ.js";import{t as me}from"./chevron-down-CQQqnJvT.js";import{t as he}from"./chevron-up-BNvDpRa-.js";import{t as ge}from"./search-NI5nOaOz.js";import{t as _e}from"./x-AFrW8zH7.js";function ve(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var ye=class extends D{#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,P.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||!de(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ve(e,n).forEach(e=>{e.destroy()}),ve(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=fe(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 R(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)&&P.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(t(),1);function be({queries:e,...t},n){let i=ce(n),a=j(),o=B(),s=t.subscribed!==!1,c=H.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:s?`optimistic`:void 0,t}),[e,i,a,s]);c.forEach(e=>{C(e);let t=i.getQueryCache().get(e.queryHash);O(e,o,t)}),I(o);let[l]=H.useState(()=>new ye(i,c,t)),[u,d,f]=l.getOptimisticResult(c,t.combine),p=!a&&s;H.useSyncExternalStore(H.useCallback(e=>p?l.subscribe(P.batchCalls(e)):w,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),H.useEffect(()=>{l.setQueries(c,t)},[c,t,l]);let h=u.some((e,t)=>r(c[t],e))?u.flatMap((e,t)=>{let n=c[t];if(n&&r(n,e)){let e=new R(i,n);return m(n,e,o)}return[]}):[];if(h.length>0)throw Promise.all(h);let g=u.find((e,t)=>{let n=c[t];return n&&ne({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(g)throw g.error;return d(f())}var U={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`},W=v();function xe({children:e,reduceMotion:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)(`auto`);return(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(()=>i(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),(0,W.jsx)(u.div,{className:U.autoHeight,initial:!1,animate:{height:r},transition:t?{duration:0}:y.spring.smooth,children:(0,W.jsx)(`div`,{ref:n,children:e})})}var Se=(0,H.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:p,disabled:m,onFocus:h,...g},_){let v=(0,H.useId)(),b=c??v,x=`${b}-listbox`,S=a?`${b}-description`:void 0,C=(0,H.useRef)(null),w=(0,H.useRef)(null),T=(0,H.useRef)({}),E=f(),[D,O]=(0,H.useState)(r),[k,A]=(0,H.useState)(!1),[j,M]=(0,H.useState)(``),[N,P]=(0,H.useState)(-1),F=n??D,I=t.find(e=>e.value===F);(0,H.useImperativeHandle)(_,()=>w.current);let L=(0,H.useRef)(F);(0,H.useEffect)(()=>{if(L.current===F)return;L.current=F;let e=w.current;if(!e||E||F&&k)return;let t=F?d(e,{opacity:[0,1],y:[`0.35em`,`0em`],filter:[`blur(${y.blur.soft}px)`,`blur(0px)`]},{duration:y.duration.standard,ease:[...y.ease.enter]}):d(e,{opacity:[0,1]},{duration:y.duration.fast,ease:[...y.ease.enter]});return()=>t.complete()},[F,E,k]);let R=(0,H.useMemo)(()=>{let e=j.trim().toLocaleLowerCase();return e?t.filter(t=>[t.label,...t.keywords??[]].some(t=>t.toLocaleLowerCase().includes(e))):t},[t,j]),z=R.reduce((e,t,n)=>(t.disabled||e.push(n),e),[]);(0,H.useEffect)(()=>{if(!k)return;let e=N>=0?R[N]:void 0,t=e?T.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)}},[N,R,k]),(0,H.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&(A(!1),M(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let ee=e=>{e.disabled||(O(e.value),i?.(e.value),M(``),A(!1),w.current?.focus())},te=e=>{e.preventDefault(),O(``),i?.(``),M(``),A(!0),w.current?.focus()},B=()=>{m||(A(!0),M(``),P(-1))},V=e=>{if(!m){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!k){B();return}if(!z.length)return;let t=z.indexOf(N),n=e.key===`ArrowDown`?(t+1)%z.length:(t-1+z.length)%z.length;P(z[n]);return}if(e.key===`Enter`&&k&&N>=0){e.preventDefault();let t=R[N];t&&ee(t);return}if(e.key===`Escape`&&k){e.preventDefault(),A(!1),M(``);return}}},ne=k?j:I?.label??``,re=N>=0?R[N]:void 0;return(0,W.jsxs)(`div`,{ref:C,className:U.field,children:[(0,W.jsx)(`label`,{htmlFor:b,children:e}),(0,W.jsxs)(`div`,{className:[U.control,k?U.open:``,m?U.disabled:``,p??``].filter(Boolean).join(` `),children:[(0,W.jsx)(ge,{className:U.searchIcon,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,W.jsx)(`input`,{...g,ref:w,id:b,type:`text`,role:`combobox`,value:ne,placeholder:I?.label??o,disabled:m,"aria-describedby":S,"aria-expanded":k,"aria-controls":k?x:void 0,"aria-autocomplete":`list`,"aria-activedescendant":k&&re?`${b}-option-${re.value}`:void 0,onFocus:e=>{h?.(e),B()},onClick:B,onChange:e=>{M(e.target.value),A(!0),P(-1)},onKeyDown:V}),(0,W.jsx)(l,{initial:!1,children:I&&!m&&(0,W.jsx)(u.button,{type:`button`,className:U.clear,"aria-label":`Clear selection`,onMouseDown:e=>e.preventDefault(),onClick:te,initial:E?{opacity:0}:{opacity:0,scale:.6,filter:`blur(${y.blur.subtle}px)`},animate:{opacity:1,scale:1,filter:`blur(0px)`,transition:E?{duration:y.duration.instant}:{...y.spring.snappy,opacity:{duration:y.duration.fast}}},exit:{opacity:0,...E?{}:{scale:.6,filter:`blur(${y.blur.subtle}px)`},transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},whileTap:{scale:E?1:.96,transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},children:(0,W.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})}),(0,W.jsx)(me,{className:U.chevron,size:16,strokeWidth:1.75,"aria-hidden":`true`})]}),a&&(0,W.jsx)(`span`,{id:S,className:U.hint,children:a}),(0,W.jsx)(l,{initial:!1,children:k&&(0,W.jsx)(u.div,{className:U.popover,initial:E?{opacity:0}:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1,transition:E?{duration:y.duration.instant}:{...y.spring.snappy,opacity:{duration:y.duration.fast,ease:[...y.ease.enter]}}},exit:{opacity:0,...E?{}:{y:-4,scale:.98},transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},role:`presentation`,children:(0,W.jsx)(xe,{reduceMotion:E,children:(0,W.jsx)(`div`,{id:x,className:U.listbox,role:`listbox`,"aria-label":`${e} options`,children:R.length?R.map((e,t)=>(0,W.jsxs)(`div`,{ref:t=>{T.current[e.value]=t},id:`${b}-option-${e.value}`,className:U.option,"data-active":t===N?`true`:void 0,"data-disabled":e.disabled?`true`:void 0,role:`option`,"aria-selected":e.value===F,"aria-disabled":e.disabled||void 0,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>!e.disabled&&P(t),onClick:()=>ee(e),children:[(0,W.jsx)(`span`,{children:e.label}),e.value===F&&(0,W.jsx)(pe,{className:U.check,size:16,strokeWidth:1.75,"aria-hidden":`true`})]},e.value)):(0,W.jsx)(u.div,{className:U.empty,role:`status`,initial:!E&&{opacity:0,y:4,filter:`blur(${y.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},transition:{duration:y.duration.standard,ease:[...y.ease.enter]},children:s})})})})})]})});Se.displayName=`Combobox`;var Ce=Object.defineProperty,we=(e,t)=>Ce(e,`name`,{value:t,configurable:!0});function G(e){let t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>((...e)=>t.current?.(...e)),[])}we(G,`useCallbackRef`);var Te=Object.defineProperty,K=(e,t)=>Te(e,`name`,{value:t,configurable:!0}),Ee=`dismissableLayer.update`,De=`dismissableLayer.pointerDownOutside`,Oe=`dismissableLayer.focusOutside`,ke,Ae=H.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),je=H.forwardRef(K(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=H.useContext(Ae),[d,f]=H.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=H.useState({}),h=E(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=H.useRef(!1),C=Pe(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:H.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Fe(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,D=G(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return H.useEffect(()=>{if(T)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,T,D]),H.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ke=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ie(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ke))}},[d,p,n,u]),H.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ie())},[d,u]),H.useEffect(()=>{let e=K(()=>m({}),`handleUpdate`);return document.addEventListener(Ee,e),()=>document.removeEventListener(Ee,e)},[]),(0,W.jsx)(k.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:M(e.onFocusCapture,w.onFocusCapture),onBlurCapture:M(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:M(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function Me(){let e=H.useContext(Ae),[t,n]=H.useState(null);return H.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}K(Me,`useDismissableLayerSurface`);var Ne=K(()=>!0,`IS_TRUE`);function Pe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ne}=t,s=G(e),c=H.useRef(!1),l=H.useRef(!1),u=H.useRef(new Map),d=H.useRef(()=>{});return H.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}K(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}K(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)}K(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}K(p,`handleInteractionBubble`);let m=K(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Le(De,s,p,{discrete:!0})};if(K(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:K(()=>c.current=!0,`onPointerDownCapture`)}}K(Pe,`usePointerDownOutside`);function Fe(e,t=globalThis?.document){let n=G(e),r=H.useRef(!1);return H.useEffect(()=>{let e=K(e=>{e.target&&!r.current&&Le(Oe,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:K(()=>r.current=!0,`onFocusCapture`),onBlurCapture:K(()=>r.current=!1,`onBlurCapture`)}}K(Fe,`useFocusOutside`);function Ie(){let e=new CustomEvent(Ee);document.dispatchEvent(e)}K(Ie,`dispatchUpdate`);function Le(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?re(i,a):i.dispatchEvent(a)}K(Le,`handleAndDispatchCustomEvent`);var Re=Object.defineProperty,q=(e,t)=>Re(e,`name`,{value:t,configurable:!0}),ze=`focusScope.autoFocusOnMount`,Be=`focusScope.autoFocusOnUnmount`,Ve={bubbles:!1,cancelable:!0},He=H.forwardRef(q(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=H.useState(null),u=G(a),d=G(o),f=H.useRef(null),p=E(t,l),m=H.useRef(i);H.useEffect(()=>{m.current=i});let h=H.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=H.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;H.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:$e(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||$e(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&$e(c)};q(e,`handleFocusIn`),q(t,`handleFocusOut`),q(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]),H.useEffect(()=>{if(c){et.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(ze,Ve);c.addEventListener(ze,u),c.dispatchEvent(t),t.defaultPrevented||(qe(rt(Ye(c)),{select:!0}),document.activeElement===e&&$e(c))}return()=>{c.removeEventListener(ze,u),setTimeout(()=>{let t=new CustomEvent(Be,Ve);c.addEventListener(Be,d),c.dispatchEvent(t),t.defaultPrevented||$e(e??document.body,{select:!0}),c.removeEventListener(Be,d),et.remove(g)},0)}}},[c,u,d,g]);let _=H.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]=Je(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&$e(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&$e(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,W.jsx)(k.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Ue=H.createContext(null);function We({registry:e,children:t}){return e?(0,W.jsx)(Ue.Provider,{value:e,children:t}):t}q(We,`FocusScopeBranchProvider`);function Ge(){let[e,t]=H.useState([]);return{nodes:e,registry:H.useMemo(()=>({add:q(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:q(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}q(Ge,`useFocusScopeBranchRegistry`);function Ke(e){let t=H.useContext(Ue);H.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}q(Ke,`useFocusScopeBranch`);function qe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if($e(r,{select:t}),document.activeElement!==n)return}q(qe,`focusFirst`);function Je(e){let t=Ye(e);return[Xe(t,e),Xe(t.reverse(),e)]}q(Je,`getTabbableEdges`);function Ye(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:q(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}q(Ye,`getTabbableCandidates`);function Xe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ze(r,{upTo:t})))return r}q(Xe,`findVisible`);function Ze(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}q(Ze,`isHidden`);function Qe(e){return e instanceof HTMLInputElement&&`select`in e}q(Qe,`isSelectableInput`);function $e(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Qe(e)&&t&&e.select()}}q($e,`focus`);var et=tt();function tt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=nt(e,t),e.unshift(t)},remove(t){e=nt(e,t),e[0]?.resume()}}}q(tt,`createFocusScopesStack`);function nt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}q(nt,`arrayRemove`);function rt(e){return e.filter(e=>e.tagName!==`A`)}q(rt,`removeLinks`);var it=e(N(),1),at=Object.defineProperty,ot=H.forwardRef(((e,t)=>at(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=H.useState(!1);V(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?it.createPortal((0,W.jsx)(k.div,{...r,ref:t}),o):null},`Portal`)),st=Object.defineProperty,ct=(e,t)=>st(e,`name`,{value:t,configurable:!0}),lt=0,ut=null;function dt(e){return ft(),e.children}ct(dt,`FocusGuards`);function ft(){H.useEffect(()=>{ut||={start:pt(),end:pt()};let{start:e,end:t}=ut;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),lt++,()=>{lt===1&&(ut?.start.remove(),ut?.end.remove(),ut=null),lt=Math.max(0,lt-1)}},[])}ct(ft,`useFocusGuards`);function pt(){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}ct(pt,`createFocusGuard`);var mt=function(){return mt=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},mt.apply(this,arguments)};function ht(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 gt(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 _t=`right-scroll-bar-position`,vt=`width-before-scroll-bar`,yt=`with-scroll-bars-hidden`,bt=`--removed-body-scroll-bar-size`;function xt(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function St(e,t){var n=(0,H.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 Ct=typeof window<`u`?H.useLayoutEffect:H.useEffect,wt=new WeakMap;function Tt(e,t){var n=St(t||null,function(t){return e.forEach(function(e){return xt(e,t)})});return Ct(function(){var t=wt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||xt(e,null)}),i.forEach(function(e){r.has(e)||xt(e,a)})}wt.set(n,e)},[e]),n}function Et(e){return e}function Dt(e,t){t===void 0&&(t=Et);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 Ot(e){e===void 0&&(e={});var t=Dt(null);return t.options=mt({async:!0,ssr:!1},e),t}var kt=function(e){var t=e.sideCar,n=ht(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 H.createElement(r,mt({},n))};kt.isSideCarExport=!0;function At(e,t){return e.useMedium(t),kt}var jt=Ot(),Mt=function(){},Nt=H.forwardRef(function(e,t){var n=H.useRef(null),r=H.useState({onScrollCapture:Mt,onWheelCapture:Mt,onTouchMoveCapture:Mt}),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=ht(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Tt([n,t]),C=mt(mt({},b),i);return H.createElement(H.Fragment,null,u&&H.createElement(x,{sideCar:jt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?H.cloneElement(H.Children.only(s),mt(mt({},C),{ref:S})):H.createElement(v,mt({},C,{className:c,ref:S}),s))});Nt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Nt.classNames={fullWidth:vt,zeroRight:_t};var Pt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ft(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Pt();return t&&e.setAttribute(`nonce`,t),e}function It(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Rt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ft())&&(It(t,n),Lt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zt=function(){var e=Rt();return function(t,n){H.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Bt=function(){var e=zt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Vt={left:0,top:0,right:0,gap:0},Ht=function(e){return parseInt(e||``,10)||0},Ut=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[Ht(n),Ht(r),Ht(i)]},Wt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Vt;var t=Ut(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])}},Gt=Bt(),Kt=`data-scroll-locked`,qt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$ as n,$a as r,C as i,D as a,En as o,Fa as s,K as c,La as l,Ma as u,Na as d,Pa as f,Q as p,Qa as m,Ra as h,Sa as g,Ta as _,To as v,X as y,Xa as b,Ya as x,Z as S,Za as C,_o as w,at as T,ct as E,do as D,eo as O,et as k,ht as A,io as j,it as M,ja as N,lo as P,lt as F,no as I,nt as L,oo as R,ot as z,p as ee,q as te,ro as B,rt as V,to as ne,tt as re,u as ie,ut as ae,va as oe,w as se,wo as ce,x as le,xa as ue,xo as de,yo as fe}from"./format-hEAJVPjJ.js";import{t as pe}from"./check-DKfsh0bQ.js";import{t as me}from"./chevron-down-CQQqnJvT.js";import{t as he}from"./chevron-up-BNvDpRa-.js";import{t as ge}from"./search-NI5nOaOz.js";import{t as _e}from"./x-AFrW8zH7.js";function ve(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var ye=class extends D{#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,P.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||!de(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ve(e,n).forEach(e=>{e.destroy()}),ve(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=fe(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 R(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)&&P.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(t(),1);function be({queries:e,...t},n){let i=ce(n),a=j(),o=B(),s=t.subscribed!==!1,c=H.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:s?`optimistic`:void 0,t}),[e,i,a,s]);c.forEach(e=>{C(e);let t=i.getQueryCache().get(e.queryHash);O(e,o,t)}),I(o);let[l]=H.useState(()=>new ye(i,c,t)),[u,d,f]=l.getOptimisticResult(c,t.combine),p=!a&&s;H.useSyncExternalStore(H.useCallback(e=>p?l.subscribe(P.batchCalls(e)):w,[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),H.useEffect(()=>{l.setQueries(c,t)},[c,t,l]);let h=u.some((e,t)=>r(c[t],e))?u.flatMap((e,t)=>{let n=c[t];if(n&&r(n,e)){let e=new R(i,n);return m(n,e,o)}return[]}):[];if(h.length>0)throw Promise.all(h);let g=u.find((e,t)=>{let n=c[t];return n&&ne({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(g)throw g.error;return d(f())}var U={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`},W=v();function xe({children:e,reduceMotion:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)(`auto`);return(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(()=>i(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),(0,W.jsx)(u.div,{className:U.autoHeight,initial:!1,animate:{height:r},transition:t?{duration:0}:y.spring.smooth,children:(0,W.jsx)(`div`,{ref:n,children:e})})}var Se=(0,H.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:p,disabled:m,onFocus:h,...g},_){let v=(0,H.useId)(),b=c??v,x=`${b}-listbox`,S=a?`${b}-description`:void 0,C=(0,H.useRef)(null),w=(0,H.useRef)(null),T=(0,H.useRef)({}),E=f(),[D,O]=(0,H.useState)(r),[k,A]=(0,H.useState)(!1),[j,M]=(0,H.useState)(``),[N,P]=(0,H.useState)(-1),F=n??D,I=t.find(e=>e.value===F);(0,H.useImperativeHandle)(_,()=>w.current);let L=(0,H.useRef)(F);(0,H.useEffect)(()=>{if(L.current===F)return;L.current=F;let e=w.current;if(!e||E||F&&k)return;let t=F?d(e,{opacity:[0,1],y:[`0.35em`,`0em`],filter:[`blur(${y.blur.soft}px)`,`blur(0px)`]},{duration:y.duration.standard,ease:[...y.ease.enter]}):d(e,{opacity:[0,1]},{duration:y.duration.fast,ease:[...y.ease.enter]});return()=>t.complete()},[F,E,k]);let R=(0,H.useMemo)(()=>{let e=j.trim().toLocaleLowerCase();return e?t.filter(t=>[t.label,...t.keywords??[]].some(t=>t.toLocaleLowerCase().includes(e))):t},[t,j]),z=R.reduce((e,t,n)=>(t.disabled||e.push(n),e),[]);(0,H.useEffect)(()=>{if(!k)return;let e=N>=0?R[N]:void 0,t=e?T.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)}},[N,R,k]),(0,H.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&(A(!1),M(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let ee=e=>{e.disabled||(O(e.value),i?.(e.value),M(``),A(!1),w.current?.focus())},te=e=>{e.preventDefault(),O(``),i?.(``),M(``),A(!0),w.current?.focus()},B=()=>{m||(A(!0),M(``),P(-1))},V=e=>{if(!m){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!k){B();return}if(!z.length)return;let t=z.indexOf(N),n=e.key===`ArrowDown`?(t+1)%z.length:(t-1+z.length)%z.length;P(z[n]);return}if(e.key===`Enter`&&k&&N>=0){e.preventDefault();let t=R[N];t&&ee(t);return}if(e.key===`Escape`&&k){e.preventDefault(),A(!1),M(``);return}}},ne=k?j:I?.label??``,re=N>=0?R[N]:void 0;return(0,W.jsxs)(`div`,{ref:C,className:U.field,children:[(0,W.jsx)(`label`,{htmlFor:b,children:e}),(0,W.jsxs)(`div`,{className:[U.control,k?U.open:``,m?U.disabled:``,p??``].filter(Boolean).join(` `),children:[(0,W.jsx)(ge,{className:U.searchIcon,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,W.jsx)(`input`,{...g,ref:w,id:b,type:`text`,role:`combobox`,value:ne,placeholder:I?.label??o,disabled:m,"aria-describedby":S,"aria-expanded":k,"aria-controls":k?x:void 0,"aria-autocomplete":`list`,"aria-activedescendant":k&&re?`${b}-option-${re.value}`:void 0,onFocus:e=>{h?.(e),B()},onClick:B,onChange:e=>{M(e.target.value),A(!0),P(-1)},onKeyDown:V}),(0,W.jsx)(l,{initial:!1,children:I&&!m&&(0,W.jsx)(u.button,{type:`button`,className:U.clear,"aria-label":`Clear selection`,onMouseDown:e=>e.preventDefault(),onClick:te,initial:E?{opacity:0}:{opacity:0,scale:.6,filter:`blur(${y.blur.subtle}px)`},animate:{opacity:1,scale:1,filter:`blur(0px)`,transition:E?{duration:y.duration.instant}:{...y.spring.snappy,opacity:{duration:y.duration.fast}}},exit:{opacity:0,...E?{}:{scale:.6,filter:`blur(${y.blur.subtle}px)`},transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},whileTap:{scale:E?1:.96,transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},children:(0,W.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})}),(0,W.jsx)(me,{className:U.chevron,size:16,strokeWidth:1.75,"aria-hidden":`true`})]}),a&&(0,W.jsx)(`span`,{id:S,className:U.hint,children:a}),(0,W.jsx)(l,{initial:!1,children:k&&(0,W.jsx)(u.div,{className:U.popover,initial:E?{opacity:0}:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1,transition:E?{duration:y.duration.instant}:{...y.spring.snappy,opacity:{duration:y.duration.fast,ease:[...y.ease.enter]}}},exit:{opacity:0,...E?{}:{y:-4,scale:.98},transition:{duration:y.duration.instant,ease:[...y.ease.standard]}},role:`presentation`,children:(0,W.jsx)(xe,{reduceMotion:E,children:(0,W.jsx)(`div`,{id:x,className:U.listbox,role:`listbox`,"aria-label":`${e} options`,children:R.length?R.map((e,t)=>(0,W.jsxs)(`div`,{ref:t=>{T.current[e.value]=t},id:`${b}-option-${e.value}`,className:U.option,"data-active":t===N?`true`:void 0,"data-disabled":e.disabled?`true`:void 0,role:`option`,"aria-selected":e.value===F,"aria-disabled":e.disabled||void 0,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>!e.disabled&&P(t),onClick:()=>ee(e),children:[(0,W.jsx)(`span`,{children:e.label}),e.value===F&&(0,W.jsx)(pe,{className:U.check,size:16,strokeWidth:1.75,"aria-hidden":`true`})]},e.value)):(0,W.jsx)(u.div,{className:U.empty,role:`status`,initial:!E&&{opacity:0,y:4,filter:`blur(${y.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},transition:{duration:y.duration.standard,ease:[...y.ease.enter]},children:s})})})})})]})});Se.displayName=`Combobox`;var Ce=Object.defineProperty,we=(e,t)=>Ce(e,`name`,{value:t,configurable:!0});function G(e){let t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>((...e)=>t.current?.(...e)),[])}we(G,`useCallbackRef`);var Te=Object.defineProperty,K=(e,t)=>Te(e,`name`,{value:t,configurable:!0}),Ee=`dismissableLayer.update`,De=`dismissableLayer.pointerDownOutside`,Oe=`dismissableLayer.focusOutside`,ke,Ae=H.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),je=H.forwardRef(K(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=H.useContext(Ae),[d,f]=H.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=H.useState({}),h=E(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=H.useRef(!1),C=Pe(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:H.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Fe(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,D=G(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return H.useEffect(()=>{if(T)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,T,D]),H.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ke=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ie(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ke))}},[d,p,n,u]),H.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ie())},[d,u]),H.useEffect(()=>{let e=K(()=>m({}),`handleUpdate`);return document.addEventListener(Ee,e),()=>document.removeEventListener(Ee,e)},[]),(0,W.jsx)(k.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:M(e.onFocusCapture,w.onFocusCapture),onBlurCapture:M(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:M(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function Me(){let e=H.useContext(Ae),[t,n]=H.useState(null);return H.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}K(Me,`useDismissableLayerSurface`);var Ne=K(()=>!0,`IS_TRUE`);function Pe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ne}=t,s=G(e),c=H.useRef(!1),l=H.useRef(!1),u=H.useRef(new Map),d=H.useRef(()=>{});return H.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}K(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}K(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)}K(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}K(p,`handleInteractionBubble`);let m=K(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Le(De,s,p,{discrete:!0})};if(K(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:K(()=>c.current=!0,`onPointerDownCapture`)}}K(Pe,`usePointerDownOutside`);function Fe(e,t=globalThis?.document){let n=G(e),r=H.useRef(!1);return H.useEffect(()=>{let e=K(e=>{e.target&&!r.current&&Le(Oe,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:K(()=>r.current=!0,`onFocusCapture`),onBlurCapture:K(()=>r.current=!1,`onBlurCapture`)}}K(Fe,`useFocusOutside`);function Ie(){let e=new CustomEvent(Ee);document.dispatchEvent(e)}K(Ie,`dispatchUpdate`);function Le(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?re(i,a):i.dispatchEvent(a)}K(Le,`handleAndDispatchCustomEvent`);var Re=Object.defineProperty,q=(e,t)=>Re(e,`name`,{value:t,configurable:!0}),ze=`focusScope.autoFocusOnMount`,Be=`focusScope.autoFocusOnUnmount`,Ve={bubbles:!1,cancelable:!0},He=H.forwardRef(q(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=H.useState(null),u=G(a),d=G(o),f=H.useRef(null),p=E(t,l),m=H.useRef(i);H.useEffect(()=>{m.current=i});let h=H.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=H.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;H.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:$e(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||$e(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&$e(c)};q(e,`handleFocusIn`),q(t,`handleFocusOut`),q(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]),H.useEffect(()=>{if(c){et.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(ze,Ve);c.addEventListener(ze,u),c.dispatchEvent(t),t.defaultPrevented||(qe(rt(Ye(c)),{select:!0}),document.activeElement===e&&$e(c))}return()=>{c.removeEventListener(ze,u),setTimeout(()=>{let t=new CustomEvent(Be,Ve);c.addEventListener(Be,d),c.dispatchEvent(t),t.defaultPrevented||$e(e??document.body,{select:!0}),c.removeEventListener(Be,d),et.remove(g)},0)}}},[c,u,d,g]);let _=H.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]=Je(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&$e(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&$e(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,W.jsx)(k.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Ue=H.createContext(null);function We({registry:e,children:t}){return e?(0,W.jsx)(Ue.Provider,{value:e,children:t}):t}q(We,`FocusScopeBranchProvider`);function Ge(){let[e,t]=H.useState([]);return{nodes:e,registry:H.useMemo(()=>({add:q(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:q(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}q(Ge,`useFocusScopeBranchRegistry`);function Ke(e){let t=H.useContext(Ue);H.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}q(Ke,`useFocusScopeBranch`);function qe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if($e(r,{select:t}),document.activeElement!==n)return}q(qe,`focusFirst`);function Je(e){let t=Ye(e);return[Xe(t,e),Xe(t.reverse(),e)]}q(Je,`getTabbableEdges`);function Ye(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:q(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}q(Ye,`getTabbableCandidates`);function Xe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ze(r,{upTo:t})))return r}q(Xe,`findVisible`);function Ze(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}q(Ze,`isHidden`);function Qe(e){return e instanceof HTMLInputElement&&`select`in e}q(Qe,`isSelectableInput`);function $e(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Qe(e)&&t&&e.select()}}q($e,`focus`);var et=tt();function tt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=nt(e,t),e.unshift(t)},remove(t){e=nt(e,t),e[0]?.resume()}}}q(tt,`createFocusScopesStack`);function nt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}q(nt,`arrayRemove`);function rt(e){return e.filter(e=>e.tagName!==`A`)}q(rt,`removeLinks`);var it=e(N(),1),at=Object.defineProperty,ot=H.forwardRef(((e,t)=>at(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=H.useState(!1);V(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?it.createPortal((0,W.jsx)(k.div,{...r,ref:t}),o):null},`Portal`)),st=Object.defineProperty,ct=(e,t)=>st(e,`name`,{value:t,configurable:!0}),lt=0,ut=null;function dt(e){return ft(),e.children}ct(dt,`FocusGuards`);function ft(){H.useEffect(()=>{ut||={start:pt(),end:pt()};let{start:e,end:t}=ut;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),lt++,()=>{lt===1&&(ut?.start.remove(),ut?.end.remove(),ut=null),lt=Math.max(0,lt-1)}},[])}ct(ft,`useFocusGuards`);function pt(){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}ct(pt,`createFocusGuard`);var mt=function(){return mt=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},mt.apply(this,arguments)};function ht(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 gt(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 _t=`right-scroll-bar-position`,vt=`width-before-scroll-bar`,yt=`with-scroll-bars-hidden`,bt=`--removed-body-scroll-bar-size`;function xt(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function St(e,t){var n=(0,H.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 Ct=typeof window<`u`?H.useLayoutEffect:H.useEffect,wt=new WeakMap;function Tt(e,t){var n=St(t||null,function(t){return e.forEach(function(e){return xt(e,t)})});return Ct(function(){var t=wt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||xt(e,null)}),i.forEach(function(e){r.has(e)||xt(e,a)})}wt.set(n,e)},[e]),n}function Et(e){return e}function Dt(e,t){t===void 0&&(t=Et);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 Ot(e){e===void 0&&(e={});var t=Dt(null);return t.options=mt({async:!0,ssr:!1},e),t}var kt=function(e){var t=e.sideCar,n=ht(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 H.createElement(r,mt({},n))};kt.isSideCarExport=!0;function At(e,t){return e.useMedium(t),kt}var jt=Ot(),Mt=function(){},Nt=H.forwardRef(function(e,t){var n=H.useRef(null),r=H.useState({onScrollCapture:Mt,onWheelCapture:Mt,onTouchMoveCapture:Mt}),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=ht(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Tt([n,t]),C=mt(mt({},b),i);return H.createElement(H.Fragment,null,u&&H.createElement(x,{sideCar:jt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?H.cloneElement(H.Children.only(s),mt(mt({},C),{ref:S})):H.createElement(v,mt({},C,{className:c,ref:S}),s))});Nt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Nt.classNames={fullWidth:vt,zeroRight:_t};var Pt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ft(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Pt();return t&&e.setAttribute(`nonce`,t),e}function It(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Rt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ft())&&(It(t,n),Lt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zt=function(){var e=Rt();return function(t,n){H.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Bt=function(){var e=zt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Vt={left:0,top:0,right:0,gap:0},Ht=function(e){return parseInt(e||``,10)||0},Ut=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[Ht(n),Ht(r),Ht(i)]},Wt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Vt;var t=Ut(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])}},Gt=Bt(),Kt=`data-scroll-locked`,qt=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
2
|
.${yt} {
|
|
3
3
|
overflow: hidden ${r};
|
|
4
4
|
padding-right: ${s}px ${r};
|
|
@@ -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-
|
|
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-hEAJVPjJ.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 +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-
|
|
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-hEAJVPjJ.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};
|