@aidotnet/server-darwin-arm64 0.14.3101 → 0.14.3103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/bin/astra-server +2 -2
  2. package/bin/wwwroot/assets/ClientsPage-CbisrdvY.js +9 -0
  3. package/bin/wwwroot/assets/KeyPage-BJkqoRws.js +1 -0
  4. package/bin/wwwroot/assets/McpPage-lDbAQFBD.js +3 -0
  5. package/bin/wwwroot/assets/ModelDetailPage-2SDue3md.js +1 -0
  6. package/bin/wwwroot/assets/ModelsPage-Djwi1_69.js +1 -0
  7. package/bin/wwwroot/assets/PluginsPage-Cr3_QueY.js +2 -0
  8. package/bin/wwwroot/assets/PrivacyPage-K20lHsrR.js +1 -0
  9. package/bin/wwwroot/assets/ProviderDetailPage-dCLgz9IA.js +3 -0
  10. package/bin/wwwroot/assets/ProvidersPage-B3UD_FXO.js +3 -0
  11. package/bin/wwwroot/assets/SettingsPage-BOv88_uQ.js +2 -0
  12. package/bin/wwwroot/assets/SmartRoutingPage-DUdAF-mO.js +2 -0
  13. package/bin/wwwroot/assets/TokenDetailPage-DAFuMypb.js +1 -0
  14. package/bin/wwwroot/assets/{TokenPoolEditor-DfmDnnxw.js → TokenPoolEditor-CGc4q0xj.js} +1 -1
  15. package/bin/wwwroot/assets/TokensPage-BAszgNt-.js +1 -0
  16. package/bin/wwwroot/assets/TracesPage-zR4Nhppl.js +8 -0
  17. package/bin/wwwroot/assets/{TrayPanelPage-xke1V9tu.js → TrayPanelPage-BzWJbHrV.js} +1 -1
  18. package/bin/wwwroot/assets/TrayPanelView-C8TTq4KZ.js +1 -0
  19. package/bin/wwwroot/assets/alert-BKRTQ9va.js +15 -0
  20. package/bin/wwwroot/assets/{arrow-down-DeIGdMUk.js → arrow-down-4QyszMPK.js} +1 -1
  21. package/bin/wwwroot/assets/{arrow-left-DX1c-nYY.js → arrow-left-CgusYKe5.js} +1 -1
  22. package/bin/wwwroot/assets/{arrow-up-right-D--u8dK5.js → arrow-up-right-CgKLuRMO.js} +1 -1
  23. package/bin/wwwroot/assets/{chart-column-zt3ZRFLH.js → chart-column-DrO0zSNb.js} +1 -1
  24. package/bin/wwwroot/assets/{checkbox-BJe8ekJy.js → checkbox-JghCvxwP.js} +1 -1
  25. package/bin/wwwroot/assets/{cloud-download-DWw6s5ag.js → cloud-download-Cq6X58YR.js} +1 -1
  26. package/bin/wwwroot/assets/confirm-morph-bdMiffHC.js +1 -0
  27. package/bin/wwwroot/assets/{ellipsis-BH_FL485.js → ellipsis-C09AxsS6.js} +1 -1
  28. package/bin/wwwroot/assets/{external-link-Bb6sx3jt.js → external-link-B54WZqyE.js} +1 -1
  29. package/bin/wwwroot/assets/{folder-open-Bcx5mAII.js → folder-open-DbnPnrzj.js} +1 -1
  30. package/bin/wwwroot/assets/index-8z9hfQDF.css +1 -0
  31. package/bin/wwwroot/assets/index-Cj8lNw6g.js +120 -0
  32. package/bin/wwwroot/assets/{log-out-Ch09k2bC.js → log-out-ZnLW7wzx.js} +1 -1
  33. package/bin/wwwroot/assets/minus-DosBdkUl.js +1 -0
  34. package/bin/wwwroot/assets/overlays-CizKmvVN.js +41 -0
  35. package/bin/wwwroot/assets/{pencil-fY6CohHT.js → pencil-BuVygJ9-.js} +1 -1
  36. package/bin/wwwroot/assets/{power-B9MMcl6Y.js → power-CfEiSxDi.js} +1 -1
  37. package/bin/wwwroot/assets/radio-cards-6WsHN05O.js +1 -0
  38. package/bin/wwwroot/assets/{rotate-ccw-DsmSscuv.js → rotate-ccw-BhDSBCvo.js} +1 -1
  39. package/bin/wwwroot/assets/{sortable.esm-CO34h2h7.js → sortable.esm-4hCCGHPl.js} +1 -1
  40. package/bin/wwwroot/index.html +4 -4
  41. package/package.json +1 -1
  42. package/bin/wwwroot/assets/ClientsPage-BsCvaS4d.js +0 -9
  43. package/bin/wwwroot/assets/KeyPage-bkK0B_mk.js +0 -1
  44. package/bin/wwwroot/assets/ModelDetailPage-BEVSPYM6.js +0 -1
  45. package/bin/wwwroot/assets/ModelsPage-BGij6zvC.js +0 -1
  46. package/bin/wwwroot/assets/PluginsPage-dVUvE8Lf.js +0 -2
  47. package/bin/wwwroot/assets/PrivacyPage-B-YBfQ6J.js +0 -1
  48. package/bin/wwwroot/assets/ProviderDetailPage-CQQdpDSf.js +0 -3
  49. package/bin/wwwroot/assets/ProvidersPage-BwigLnKs.js +0 -3
  50. package/bin/wwwroot/assets/SettingsPage-CvpROKS2.js +0 -2
  51. package/bin/wwwroot/assets/SmartRoutingPage-CYh7mRot.js +0 -2
  52. package/bin/wwwroot/assets/TokenDetailPage-GwSz8QI6.js +0 -1
  53. package/bin/wwwroot/assets/TokensPage-0hOOzLVU.js +0 -1
  54. package/bin/wwwroot/assets/TracesPage-A45sREZP.js +0 -8
  55. package/bin/wwwroot/assets/TrayPanelView-CHh9-E76.js +0 -1
  56. package/bin/wwwroot/assets/alert-CuKAE1Sv.js +0 -15
  57. package/bin/wwwroot/assets/confirm-morph-DGAHV4QP.js +0 -1
  58. package/bin/wwwroot/assets/download-DR9BLMVt.js +0 -1
  59. package/bin/wwwroot/assets/index-CKrvKDIJ.js +0 -17
  60. package/bin/wwwroot/assets/index-CpGX4nAj.css +0 -1
  61. package/bin/wwwroot/assets/minus-UfPYsFrp.js +0 -1
  62. package/bin/wwwroot/assets/overlays-DeHu6TU_.js +0 -41
  63. package/bin/wwwroot/assets/radio-cards-Rq9vGqnw.js +0 -1
@@ -1 +1 @@
1
- import{xt as e}from"./alert-CuKAE1Sv.js";var t={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};t.node;var n=e(t);export{n as t};
1
+ import{xt as e}from"./alert-BKRTQ9va.js";var t={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{xt as e}from"./alert-BKRTQ9va.js";var t={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1,41 @@
1
+ import{A as e,An as t,Ba as n,C as r,D as i,E as a,Et as o,F as s,Fa as c,Ha as l,I as u,Ia as d,La as f,M as p,N as m,Na as h,O as g,P as _,Pa as v,Q as y,R as b,Ra as x,S,Sa as C,Va as w,Wa as T,Y as E,Ya as D,_a as O,aa as k,ao as A,bt as j,co as M,ct as N,dt as ee,ga as P,ha as F,j as I,k as L,la as R,lo as te,lt as ne,oa as z,ot as re,po as ie,pt as ae,qa as oe,r as se,ra as ce,ro as le,t as ue,to as de,uo as fe,va as pe,xa as me,xt as he,ya as ge,yt as _e,z as ve,za as ye}from"./alert-BKRTQ9va.js";function be(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var xe=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,oe.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||!A(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(be(e,n).forEach(e=>{e.destroy()}),be(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=le(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 T(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)&&oe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},B=ie(fe(),1);function Se({queries:e,...t},r){let i=M(r),a=l(),o=w(),s=t.subscribed!==!1,u=B.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=a?`isRestoring`:s?`optimistic`:void 0,t}),[e,i,a,s]);u.forEach(e=>{c(e);let t=i.getQueryCache().get(e.queryHash);x(e,o,t)}),n(o);let[p]=B.useState(()=>new xe(i,u,t)),[m,h,g]=p.getOptimisticResult(u,t.combine),_=!a&&s;B.useSyncExternalStore(B.useCallback(e=>_?p.subscribe(oe.batchCalls(e)):de,[p,_]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),B.useEffect(()=>{p.setQueries(u,t)},[u,t,p]);let v=m.some((e,t)=>f(u[t],e))?m.flatMap((e,t)=>{let n=u[t];if(n&&f(n,e)){let e=new T(i,n);return d(n,e,o)}return[]}):[];if(v.length>0)throw Promise.all(v);let y=m.find((e,t)=>{let n=u[t];return n&&ye({result:e,errorResetBoundary:o,throwOnError:n.throwOnError,query:i.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(y)throw y.error;return h(g())}var Ce={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Ce.node;var we=he(Ce),Te={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Te.node;var Ee=he(Te),De={canOpenPaths:!!R(),async openPath(e){let t=R();return t?t.openPath(e):!1},async revealLogs(){return await R()?.revealLogs()??!1},async copy(e){if(window.isSecureContext&&navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}return ke(e)},async contextMenu(e){let t=R();if(t)return t.showContextMenu(e)},async startService(){let e=R();return e?e.startService():null},async restartService(){let e=R();return e?e.restartService():null}};function Oe(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>0?e.slice(0,t):e}function ke(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:0;left:0;opacity:0;pointer-events:none`;let n=document.activeElement;document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t),n?.focus?.()}}var Ae={config:`providers.quota.error.config`,no_key:`providers.quota.error.no_key`,unauthorized:`providers.quota.error.unauthorized`,no_endpoint:`providers.quota.error.no_endpoint`,rate_limited:`providers.quota.error.rate_limited`,upstream:`providers.quota.error.upstream`,timeout:`providers.quota.error.timeout`,network:`providers.quota.error.network`,not_json:`providers.quota.error.not_json`,too_large:`providers.quota.error.too_large`,empty:`providers.quota.error.empty`},je=/^[A-Z]{3}$/;function Me(e,t,n){let r=n===`zh`?`zh-CN`:`en-US`;if(t&&je.test(t))try{let n=e!==0&&Math.abs(e)<1;return new Intl.NumberFormat(r,{style:`currency`,currency:t,minimumFractionDigits:2,maximumFractionDigits:n?4:2}).format(e)}catch{}let i=new Intl.NumberFormat(r,{maximumFractionDigits:2}).format(e);return t?`${i} ${t}`:i}var Ne=e=>e.windowMinutes!=null&&e.usedPercent!=null;function Pe(e){return e.usedPercent!=null&&Number.isFinite(e.usedPercent)?Math.min(100,Math.max(0,e.usedPercent)):e.used!=null&&e.total!=null&&e.total>0?Math.min(100,Math.max(0,e.used/e.total*100)):null}function Fe(e){return!e?.error||e.fetchedAtUtc&&e.errorAtUtc&&new Date(e.errorAtUtc).getTime()<new Date(e.fetchedAtUtc).getTime()?null:{code:e.errorCode??null,message:e.error}}function Ie(e,t){return e.code?t(Ae[e.code]):e.message}function Le(e,t,n){let r=Pe(e);if(Ne(e))return t(`providers.quota.window`,{window:ht(e.windowMinutes,n),percent:Math.round(r??0)});if(e.remaining!=null){let i=t(`providers.quota.balance`,{amount:Me(e.remaining,e.unit,n)});return r==null?i:`${i} · ${t(`providers.quota.usedPercent`,{percent:Math.round(r)})}`}return r==null?e.used!=null&&e.total!=null?t(`providers.quota.totalUsed`,{used:Me(e.used,e.unit,n),total:Me(e.total,e.unit,n)}):null:t(`providers.quota.usedPercent`,{percent:Math.round(r)})}function Re(e,t,n){let r=gt(e.resetsAtUtc??null,n);return r?t(`providers.quota.resets`,{time:r}):null}function ze(e,t,n){let r=(e?.plans??[]).map(e=>Le(e,t,n)).filter(e=>!!e);return e?.isValid===!1&&r.unshift(t(`providers.quota.invalid`)),r.length?r.join(` · `):null}var Be=e=>e.authScheme!==`oauth-subscription`&&!!e.quotaConfig?.enabled;function Ve(e,t){let n=new Map;for(let r of e)n.set(r.bucket,(n.get(r.bucket)??0)+r[t]);return[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({bucket:e,value:t}))}var He=e=>String(e).padStart(2,`0`),Ue=e=>`${e.getFullYear()}-${He(e.getMonth()+1)}-${He(e.getDate())}`,We={"7d":7,"30d":30,"90d":90};function Ge(e,t=new Date){if(e===`today`)return new Date(t.getFullYear(),t.getMonth(),t.getDate());let n=We[e];return n?new Date(t.getFullYear(),t.getMonth(),t.getDate()-(n-1)):null}function Ke(e=365,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(e-1)),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+(6-(n.getDay()+6)%7)),o=[];for(let e=i;e<=a;e=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))o.push(Ue(e));let s=[],c=[];for(let e=0;e<o.length;e+=7)s.push(Array.from({length:7},(t,n)=>e+n)),c.push({index:s.length-1,month:Number(o[e].slice(5,7)),year:Number(o[e].slice(0,4))});return{days:o,weeks:s,months:s.flatMap((e,t)=>{let n=e.find(e=>o[e].slice(8)===`01`);return n===void 0?[]:[{index:t,label:Number(o[n].slice(5,7))}]}),monthLabels:c}}function qe(e,t){return e<=0?0:t<=0?1:Math.min(4,Math.max(1,Math.ceil(e/t*4)))}function Je(e,t=new Date){if(e===`today`){let e=Ue(t);return Array.from({length:24},(t,n)=>`${e}T${He(n)}:00`)}let n=Ge(e,t),r=We[e]??0;return n?Array.from({length:r},(e,t)=>Ue(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t))):[]}function Ye(e,t){if(t.length===0)return e;let n=new Map(e.map(e=>[e.bucket,e.value]));return t.map(e=>({bucket:e,value:n.get(e)??0}))}var Xe=e=>`${e.slice(5,7)}/${e.slice(8,10)}`,Ze=e=>e.includes(`T`)?e.slice(11,16):Xe(e),Qe=e=>e.includes(`T`)?`${Xe(e)} ${e.slice(11,16)}`:Xe(e);function $e(e){let t=new Map;for(let n of e){let e=t.get(n.key)??{key:n.key,requests:0,tokens:0,costUsd:0};e.requests+=n.requests,e.tokens+=n.tokens,e.costUsd+=n.costUsd,t.set(n.key,e)}let n=[...t.values()],r=n.reduce((e,t)=>e+t.costUsd,0),i=n.reduce((e,t)=>e+t.requests,0);return n.map(e=>({...e,share:r>0?e.costUsd/r:i>0?e.requests/i:0}))}function et(e){return Math.max(0,Math.round(e.requests*(1-e.successRate)))}function tt(e){return!Number.isFinite(e)||e<=0?`$0`:e<.01?`$<0.01`:e<1e3?`$${e.toFixed(2)}`:y(e,{compact:!0})}function nt(e,t=new Date){return Ye(Ve(e,`requests`),Je(`today`,t))}var rt=e=>String(e).padStart(2,`0`);function it(e,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1),r=`${n.getFullYear()}-${rt(n.getMonth()+1)}-${rt(n.getDate())}`;return e.filter(e=>e.bucket===r).reduce((e,t)=>e+t.tokens,0)}function at(e,t){return t<=0?null:(e-t)/t}function ot(e,t){let n=[...e].sort((e,t)=>t.tokens-e.tokens)[0];return!n||n.tokens<=0?null:{model:n.model,share:t>0?Math.min(1,n.tokens/t):1}}var st={session:300,weekly:10080};function ct(e){return e==null||!Number.isFinite(e)?null:Math.min(100,Math.max(0,100-e))}function lt(e,t){let n=ct(t?.usedPercent);return n===null?null:{kind:e,windowMinutes:t?.windowMinutes??st[e],remaining:n,resetsAt:t?.resetsAtUtc??null}}function ut(e){let t=[];for(let{provider:n,account:r}of e){if(r.status!==`active`||!r.quota)continue;let e=r.quota,i=[lt(`session`,e.session),lt(`weekly`,e.weekly)].filter(e=>e!==null),a=ct(e.credits?.usedPercent);a!==null&&i.push({kind:`credits`,windowMinutes:null,remaining:a,resetsAt:null}),i.length!==0&&t.push({accountId:r.id,providerId:n.id,providerName:e.planLabel||n.name,providerIcon:n.icon??null,accountName:r.displayName||r.accountEmail||r.id,rows:i})}return t}function dt(e){let t=[];for(let n of e){if(!n.enabled||!Be(n)||n.quota?.isValid===!1)continue;let e=[];for(let t of n.quota?.plans??[]){let n=Pe(t);Ne(t)?e.push({kind:`window`,windowMinutes:t.windowMinutes??null,remaining:100-(n??0),resetsAt:t.resetsAtUtc??null}):(t.remaining!=null||n!=null)&&e.push({kind:`balance`,windowMinutes:null,remaining:n==null?null:100-n,resetsAt:t.resetsAtUtc??null,amount:t.remaining==null?null:{value:t.remaining,unit:t.unit??null},label:t.name??null})}e.length!==0&&t.push({accountId:`provider:${n.id}`,providerId:n.id,providerName:n.name,providerIcon:n.icon??null,accountName:``,rows:e})}return t}function ft(e){let t=null;for(let n of e)for(let e of n.rows)e.remaining!==null&&(!t||e.remaining<t.row.remaining)&&(t={plan:n,row:{...e,remaining:e.remaining}});return t}function pt(e,t){let n=[];for(let t of e)for(let e of t.rows)e.remaining!==null&&n.push({plan:t,row:{...e,remaining:e.remaining}});return n.sort((e,t)=>e.row.remaining-t.row.remaining).slice(0,t)}function mt(e){return e<10?`red`:e<30?`orange`:`green`}function ht(e,t){let n=(e,n)=>new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{style:`unit`,unit:n,unitDisplay:t===`zh`?`long`:`narrow`}).format(e);return e>=1440&&e%1440==0?n(e/1440,`day`):e>=60?n(Math.round(e/60),`hour`):n(e,`minute`)}function gt(e,t,n=Date.now()){if(!e)return null;let r=new Date(e).getTime()-n;if(!Number.isFinite(r)||r<=0)return null;let i=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`}),a=r/36e5;return a>=48?i.format(Math.round(a/24),`day`):a>=1?i.format(Math.round(a),`hour`):i.format(Math.max(1,Math.round(r/6e4)),`minute`)}function _t(e,t,n,r=Date.now()){if(!e)return null;let i=Math.max(0,(r-e)/1e3),a=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`});return i<60?n:i<3600?a.format(-Math.round(i/60),`minute`):a.format(-Math.round(i/3600),`hour`)}function vt(e,t,n){let r={title:``,detail:``};if(e===`none`)return r;if(e===`alerts`){if(!t.running)return{title:`!`,detail:n.stopped};let e=t.summary?et(t.summary):0;if(e>0)return{title:`⚠ ${e}`,detail:n.failures(e)};let i=ft(t.plans);if(i&&i.row.remaining<10){let e=`${Math.round(i.row.remaining)}%`;return{title:`⚠ ${e}`,detail:n.quota(i.plan.providerName,n.windowName(i.row),e)}}return r}if(e===`quota`){let e=ft(t.plans);if(!e)return r;let i=`${Math.round(e.row.remaining)}%`;return{title:i,detail:n.quota(e.plan.providerName,n.windowName(e.row),i)}}let i=t.summary;if(!i||!t.running)return r;switch(e){case`requests`:{let e=E(i.requests,!0);return{title:e,detail:n.requests(e)}}case`tokens`:{let e=E(i.inputTokens+i.outputTokens,!0);return{title:e,detail:n.tokens(e)}}case`cost`:{let e=tt(i.costUsd);return{title:e,detail:n.cost(e)}}}}var yt={title:`requests`,sections:{overview:!0,cost:!0,chart:!0,topModel:!0,compareYesterday:!1,cacheHitRate:!1,quota:!0,clients:!1}},bt=()=>!!R()?.tray;function xt(){let[e,t]=(0,B.useState)(yt),[n,r]=(0,B.useState)(!R()?.tray);return(0,B.useEffect)(()=>{let e=R()?.tray;if(!e)return;let n=!0;e.getPrefs().then(e=>{n&&(t(e),r(!0))});let i=e.onPrefsChanged(t);return()=>{n=!1,i()}},[]),[e,(0,B.useCallback)(e=>{t(e);let n=R()?.tray;n&&n.setPrefs(e).then(t)},[]),n]}function St(){let e=t(),[n,r]=(0,B.useState)(null);return(0,B.useEffect)(()=>{let e=R()?.tray;if(!e)return;let t=!0;e.getState().then(e=>{t&&r(e)});let n=e.onStateChanged(r);return()=>{t=!1,n()}},[]),n??{running:e.isSuccess,port:null,activity:null,apiVersionMismatch:!1,updateAvailable:null}}function Ct(e,t,n){return{...e,sections:{...e.sections,[t]:n}}}var wt=3e5,Tt=new Map,Et=()=>-new Date().getTimezoneOffset(),Dt=Object.fromEntries(z.map(e=>[e,!1]));function Ot(e,t){let n=M(),{enabled:r,background:i}=t,a=t.titleOnly?Dt:e.sections,s=e.title!==`none`&&e.title!==`quota`,c=e.title===`quota`||e.title===`alerts`,l={refetchInterval:15e3,refetchIntervalInBackground:!1},u=a.quota||c,d=v({queryKey:o.settings,queryFn:()=>ce(`GET`,`/api/settings`),enabled:r}),f=v({queryKey:o.stats(`summary`,`today`,``,``),queryFn:()=>ce(`GET`,`/api/stats/summary?range=today`),enabled:r,...l,refetchIntervalInBackground:i&&s}),p=v({queryKey:o.stats(`timeseries`,`today`,`hour`,`provider`,``,``,Et()),queryFn:()=>ce(`GET`,`/api/stats/timeseries?range=today&groupBy=hour&by=provider&tzOffset=${Et()}`),enabled:r&&a.chart,...l,refetchInterval:3e4}),m=v({queryKey:o.stats(`timeseries`,`7d`,`day`,`provider`,``,``,Et()),queryFn:()=>ce(`GET`,`/api/stats/timeseries?range=7d&groupBy=day&by=provider&tzOffset=${Et()}`),enabled:r&&a.compareYesterday,...l,refetchInterval:6e4}),g=v({queryKey:o.stats(`top`,`today`,``,3,``),queryFn:()=>ce(`GET`,`/api/stats/top-models?range=today&limit=3`),enabled:r&&a.topModel,...l,refetchInterval:3e4}),_=v({queryKey:o.providers,queryFn:()=>ce(`GET`,`/api/providers`),enabled:r&&(u||a.clients),...l,refetchInterval:6e4,refetchIntervalInBackground:i&&c}),y=v({queryKey:o.clients,queryFn:()=>ce(`GET`,`/api/clients`),enabled:r&&a.clients,...l,refetchInterval:3e4}),b=(0,B.useMemo)(()=>(_.data??[]).filter(e=>e.enabled&&e.authScheme===`oauth-subscription`),[_.data]),x=Se({queries:b.map(e=>({queryKey:o.providerAccounts(e.id),queryFn:()=>ce(`GET`,`/api/providers/${k(e.id)}/accounts`),enabled:r&&u,...l,refetchInterval:6e4,refetchIntervalInBackground:i&&c}))}),S=b.flatMap((e,t)=>(x[t]?.data??[]).map(t=>({provider:e,account:t}))),C=S.map(e=>`${e.account.id}:${e.account.status}:${e.account.quota?.fetchedAtUtc??``}`).join(`|`),w=h({mutationFn:e=>ce(`POST`,`/api/provider-accounts/${k(e)}/quota`),onSettled:e=>{e&&n.invalidateQueries({queryKey:o.providerAccounts(e.providerId)})}}),T=r&&u&&(t.live||e.title===`quota`||e.title===`alerts`);(0,B.useEffect)(()=>{if(!T)return;let e=Date.now();for(let{account:t}of S){if(t.status!==`active`)continue;let n=t.quota?.fetchedAtUtc?new Date(t.quota.fetchedAtUtc).getTime():0;Number.isFinite(n)&&e-n<wt||e-(Tt.get(t.id)??0)<wt||(Tt.set(t.id,e),w.mutate(t.id,{onError:()=>{}}))}},[T,C]);let E=[...ut(S),...dt(_.data??[])];return{settings:d.data,summary:f.data,hourly:p.data??[],daily:m.data??[],top:g.data??[],plans:E,hasSubscriptions:S.some(e=>e.account.status===`active`),clients:y.data??[],providers:_.data??[],updatedAt:f.dataUpdatedAt,loading:f.isLoading,error:f.isError}}function kt(e,t,n,r){let{t:i,locale:a}=N(),o=R(),s=(0,B.useMemo)(()=>({requests:e=>i(`tray.title.requests`,{count:e}),tokens:e=>i(`tray.title.tokens`,{count:e}),cost:e=>i(`tray.title.cost`,{amount:e}),quota:(e,t,n)=>i(`tray.title.quota`,{plan:e,window:t,remaining:n}),failures:e=>i(`tray.title.failures`,{count:e}),stopped:i(`tray.status.stopped`),windowName:e=>e.kind===`balance`?e.label??i(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?i(`tray.quotaCredits`):ht(e.windowMinutes,a)}),[i,a]),c=vt(e.title,{running:t.running,summary:n,plans:r},s);(0,B.useEffect)(()=>{o?.tray.setTitle(c.title,c.detail)},[o,c.title,c.detail])}function At(){let[e]=xt(),t=St(),n=Ot(e,{enabled:t.running,background:!0,live:!1,titleOnly:!0});return kt(e,t,n.summary,n.plans),null}var V={field:`_field_6szcl_1`,control:`_control_6szcl_3`,disabled:`_disabled_6szcl_4`,open:`_open_6szcl_6`,searchIcon:`_searchIcon_6szcl_8`,chevron:`_chevron_6szcl_12`,clear:`_clear_6szcl_14`,hint:`_hint_6szcl_17`,popover:`_popover_6szcl_18`,autoHeight:`_autoHeight_6szcl_19`,listbox:`_listbox_6szcl_20`,option:`_option_6szcl_22`,check:`_check_6szcl_26`,empty:`_empty_6szcl_27`},H=te();function jt({children:e,reduceMotion:t}){let n=(0,B.useRef)(null),[r,i]=(0,B.useState)(`auto`);return(0,B.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(()=>i(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),(0,H.jsx)(P.div,{className:V.autoHeight,initial:!1,animate:{height:r},transition:t?{duration:0}:a.spring.smooth,children:(0,H.jsx)(`div`,{ref:n,children:e})})}var Mt=(0,B.forwardRef)(function({label:e,options:t,value:n,defaultValue:r=``,onValueChange:i,description:o,placeholder:s=`Search or select…`,emptyMessage:c=`No matches found`,id:l,className:u,disabled:d,onFocus:f,...p},m){let h=(0,B.useId)(),g=l??h,_=`${g}-listbox`,v=o?`${g}-description`:void 0,y=(0,B.useRef)(null),b=(0,B.useRef)(null),x=(0,B.useRef)({}),S=pe(),[C,w]=(0,B.useState)(r),[T,E]=(0,B.useState)(!1),[D,k]=(0,B.useState)(``),[A,M]=(0,B.useState)(-1),N=n??C,F=t.find(e=>e.value===N);(0,B.useImperativeHandle)(m,()=>b.current);let I=(0,B.useRef)(N);(0,B.useEffect)(()=>{if(I.current===N)return;I.current=N;let e=b.current;if(!e||S||N&&T)return;let t=N?O(e,{opacity:[0,1],y:[`0.35em`,`0em`],filter:[`blur(${a.blur.soft}px)`,`blur(0px)`]},{duration:a.duration.standard,ease:[...a.ease.enter]}):O(e,{opacity:[0,1]},{duration:a.duration.fast,ease:[...a.ease.enter]});return()=>t.complete()},[N,S,T]);let L=(0,B.useMemo)(()=>{let e=D.trim().toLocaleLowerCase();return e?t.filter(t=>[t.label,...t.keywords??[]].some(t=>t.toLocaleLowerCase().includes(e))):t},[t,D]),R=L.reduce((e,t,n)=>(t.disabled||e.push(n),e),[]);(0,B.useEffect)(()=>{if(!T)return;let e=A>=0?L[A]:void 0,t=e?x.current[e.value]:null,n=t?.parentElement;if(t&&n){let e=t.offsetTop,r=e+t.offsetHeight;e<n.scrollTop?n.scrollTop=e:r>n.scrollTop+n.clientHeight&&(n.scrollTop=r-n.clientHeight)}},[A,L,T]),(0,B.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&(E(!1),k(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let te=e=>{e.disabled||(w(e.value),i?.(e.value),k(``),E(!1),b.current?.focus())},ne=e=>{e.preventDefault(),w(``),i?.(``),k(``),E(!0),b.current?.focus()},z=()=>{d||(E(!0),k(``),M(-1))},re=e=>{if(!d){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!T){z();return}if(!R.length)return;let t=R.indexOf(A),n=e.key===`ArrowDown`?(t+1)%R.length:(t-1+R.length)%R.length;M(R[n]);return}if(e.key===`Enter`&&T&&A>=0){e.preventDefault();let t=L[A];t&&te(t);return}if(e.key===`Escape`&&T){e.preventDefault(),E(!1),k(``);return}}},ie=T?D:F?.label??``,oe=A>=0?L[A]:void 0;return(0,H.jsxs)(`div`,{ref:y,className:V.field,children:[(0,H.jsx)(`label`,{htmlFor:g,children:e}),(0,H.jsxs)(`div`,{className:[V.control,T?V.open:``,d?V.disabled:``,u??``].filter(Boolean).join(` `),children:[(0,H.jsx)(ae,{className:V.searchIcon,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,H.jsx)(`input`,{...p,ref:b,id:g,type:`text`,role:`combobox`,value:ie,placeholder:F?.label??s,disabled:d,"aria-describedby":v,"aria-expanded":T,"aria-controls":T?_:void 0,"aria-autocomplete":`list`,"aria-activedescendant":T&&oe?`${g}-option-${oe.value}`:void 0,onFocus:e=>{f?.(e),z()},onClick:z,onChange:e=>{k(e.target.value),E(!0),M(-1)},onKeyDown:re}),(0,H.jsx)(me,{initial:!1,children:F&&!d&&(0,H.jsx)(P.button,{type:`button`,className:V.clear,"aria-label":`Clear selection`,onMouseDown:e=>e.preventDefault(),onClick:ne,initial:S?{opacity:0}:{opacity:0,scale:.6,filter:`blur(${a.blur.subtle}px)`},animate:{opacity:1,scale:1,filter:`blur(0px)`,transition:S?{duration:a.duration.instant}:{...a.spring.snappy,opacity:{duration:a.duration.fast}}},exit:{opacity:0,...S?{}:{scale:.6,filter:`blur(${a.blur.subtle}px)`},transition:{duration:a.duration.instant,ease:[...a.ease.standard]}},whileTap:{scale:S?1:.96,transition:{duration:a.duration.instant,ease:[...a.ease.standard]}},children:(0,H.jsx)(ee,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})}),(0,H.jsx)(_e,{className:V.chevron,size:16,strokeWidth:1.75,"aria-hidden":`true`})]}),o&&(0,H.jsx)(`span`,{id:v,className:V.hint,children:o}),(0,H.jsx)(me,{initial:!1,children:T&&(0,H.jsx)(P.div,{className:V.popover,initial:S?{opacity:0}:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1,transition:S?{duration:a.duration.instant}:{...a.spring.snappy,opacity:{duration:a.duration.fast,ease:[...a.ease.enter]}}},exit:{opacity:0,...S?{}:{y:-4,scale:.98},transition:{duration:a.duration.instant,ease:[...a.ease.standard]}},role:`presentation`,children:(0,H.jsx)(jt,{reduceMotion:S,children:(0,H.jsx)(`div`,{id:_,className:V.listbox,role:`listbox`,"aria-label":`${e} options`,children:L.length?L.map((e,t)=>(0,H.jsxs)(`div`,{ref:t=>{x.current[e.value]=t},id:`${g}-option-${e.value}`,className:V.option,"data-active":t===A?`true`:void 0,"data-disabled":e.disabled?`true`:void 0,role:`option`,"aria-selected":e.value===N,"aria-disabled":e.disabled||void 0,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>!e.disabled&&M(t),onClick:()=>te(e),children:[(0,H.jsx)(`span`,{children:e.label}),e.value===N&&(0,H.jsx)(j,{className:V.check,size:16,strokeWidth:1.75,"aria-hidden":`true`})]},e.value)):(0,H.jsx)(P.div,{className:V.empty,role:`status`,initial:!S&&{opacity:0,y:4,filter:`blur(${a.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},transition:{duration:a.duration.standard,ease:[...a.ease.enter]},children:c})})})})})]})});Mt.displayName=`Combobox`;var Nt=Object.defineProperty,Pt=(e,t)=>Nt(e,`name`,{value:t,configurable:!0});function U(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}Pt(U,`useCallbackRef`);var Ft=Object.defineProperty,W=(e,t)=>Ft(e,`name`,{value:t,configurable:!0}),It=`dismissableLayer.update`,Lt=`dismissableLayer.pointerDownOutside`,Rt=`dismissableLayer.focusOutside`,zt,Bt=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Vt=B.forwardRef(W(function(t,n){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:c,onDismiss:l,...u}=t,d=B.useContext(Bt),[f,p]=B.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=B.useState({}),g=b(n,p),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=y?v.indexOf(y):-1,S=f?v.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,w=S>=x,T=B.useRef(!1),E=Wt(e=>{o?.(e),c?.(e),e.defaultPrevented||l?.()},{ownerDocument:m,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...d.branches].some(t=>t.contains(e));return w&&!t},[d.branches,w])}),D=Gt(e=>{if(i&&T.current)return;let t=e.target;[...d.branches].some(e=>e.contains(t))||(s?.(e),c?.(e),e.defaultPrevented||l?.())},m),O=f?S===v.length-1:!1,k=U(e=>{e.key===`Escape`&&(a?.(e),!e.defaultPrevented&&l&&(e.preventDefault(),l()))});return B.useEffect(()=>{if(O)return m.addEventListener(`keydown`,k,{capture:!0}),()=>m.removeEventListener(`keydown`,k,{capture:!0})},[m,O,k]),B.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(zt=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Kt(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=zt))}},[f,m,r,d]),B.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Kt())},[f,d]),B.useEffect(()=>{let e=W(()=>h({}),`handleUpdate`);return document.addEventListener(It,e),()=>document.removeEventListener(It,e)},[]),(0,H.jsx)(e.div,{...u,ref:g,style:{pointerEvents:C?w?`auto`:`none`:void 0,...t.style},onFocusCapture:_(t.onFocusCapture,D.onFocusCapture),onBlurCapture:_(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:_(t.onPointerDownCapture,E.onPointerDownCapture)})},`DismissableLayer`));function Ht(){let e=B.useContext(Bt),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}W(Ht,`useDismissableLayerSurface`);var Ut=W(()=>!0,`IS_TRUE`);function Wt(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ut}=t,s=U(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}W(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}W(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)}W(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}W(p,`handleInteractionBubble`);let m=W(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||qt(Lt,s,p,{discrete:!0})};if(W(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:W(()=>c.current=!0,`onPointerDownCapture`)}}W(Wt,`usePointerDownOutside`);function Gt(e,t=globalThis?.document){let n=U(e),r=B.useRef(!1);return B.useEffect(()=>{let e=W(e=>{e.target&&!r.current&&qt(Rt,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:W(()=>r.current=!0,`onFocusCapture`),onBlurCapture:W(()=>r.current=!1,`onBlurCapture`)}}W(Gt,`useFocusOutside`);function Kt(){let e=new CustomEvent(It);document.dispatchEvent(e)}W(Kt,`dispatchUpdate`);function qt(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?I(i,a):i.dispatchEvent(a)}W(qt,`handleAndDispatchCustomEvent`);var Jt=Object.defineProperty,G=(e,t)=>Jt(e,`name`,{value:t,configurable:!0}),Yt=`focusScope.autoFocusOnMount`,Xt=`focusScope.autoFocusOnUnmount`,Zt={bubbles:!1,cancelable:!0},Qt=B.forwardRef(G(function(t,n){let{loop:r=!1,trapped:i=!1,branches:a,onMountAutoFocus:o,onUnmountAutoFocus:s,...c}=t,[l,u]=B.useState(null),d=U(o),f=U(s),p=B.useRef(null),m=b(n,u),h=B.useRef(a);B.useEffect(()=>{h.current=a});let g=B.useCallback(e=>e?l?.contains(e)?!0:!!h.current?.some(t=>t.contains(e)):!1,[l]),_=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(i){let e=function(e){if(_.paused||!l)return;let t=e.target;g(t)?p.current=t:un(p.current,{select:!0})},t=function(e){if(_.paused||!l)return;let t=e.relatedTarget;t!==null&&(g(t)||un(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&un(l)};G(e,`handleFocusIn`),G(t,`handleFocusOut`),G(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[i,l,_.paused,g]),B.useEffect(()=>{if(l){dn.add(_);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(Yt,Zt);l.addEventListener(Yt,d),l.dispatchEvent(t),t.defaultPrevented||(rn(mn(on(l)),{select:!0}),document.activeElement===e&&un(l))}return()=>{l.removeEventListener(Yt,d),setTimeout(()=>{let t=new CustomEvent(Xt,Zt);l.addEventListener(Xt,f),l.dispatchEvent(t),t.defaultPrevented||un(e??document.body,{select:!0}),l.removeEventListener(Xt,f),dn.remove(_)},0)}}},[l,d,f,_]);let v=B.useCallback(e=>{if(!r&&!i||_.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){let t=e.currentTarget,[i,a]=an(t);i&&a?!e.shiftKey&&n===a?(e.preventDefault(),r&&un(i,{select:!0})):e.shiftKey&&n===i&&(e.preventDefault(),r&&un(a,{select:!0})):n===t&&e.preventDefault()}},[r,i,_.paused]);return(0,H.jsx)(e.div,{tabIndex:-1,...c,ref:m,onKeyDown:v})},`FocusScope`)),$t=B.createContext(null);function en({registry:e,children:t}){return e?(0,H.jsx)($t.Provider,{value:e,children:t}):t}G(en,`FocusScopeBranchProvider`);function tn(){let[e,t]=B.useState([]);return{nodes:e,registry:B.useMemo(()=>({add:G(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:G(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}G(tn,`useFocusScopeBranchRegistry`);function nn(e){let t=B.useContext($t);B.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}G(nn,`useFocusScopeBranch`);function rn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(un(r,{select:t}),document.activeElement!==n)return}G(rn,`focusFirst`);function an(e){let t=on(e);return[sn(t,e),sn(t.reverse(),e)]}G(an,`getTabbableEdges`);function on(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:G(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}G(on,`getTabbableCandidates`);function sn(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):cn(r,{upTo:t})))return r}G(sn,`findVisible`);function cn(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}G(cn,`isHidden`);function ln(e){return e instanceof HTMLInputElement&&`select`in e}G(ln,`isSelectableInput`);function un(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ln(e)&&t&&e.select()}}G(un,`focus`);var dn=fn();function fn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=pn(e,t),e.unshift(t)},remove(t){e=pn(e,t),e[0]?.resume()}}}G(fn,`createFocusScopesStack`);function pn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}G(pn,`arrayRemove`);function mn(e){return e.filter(e=>e.tagName!==`A`)}G(mn,`removeLinks`);var hn=ie(F(),1),gn=Object.defineProperty,_n=B.forwardRef(((e,t)=>gn(e,`name`,{value:t,configurable:!0}))(function(t,n){let{container:r,...i}=t,[a,o]=B.useState(!1);m(()=>o(!0),[]);let s=r||a&&globalThis?.document?.body;return s?hn.createPortal((0,H.jsx)(e.div,{...i,ref:n}),s):null},`Portal`)),vn=Object.defineProperty,yn=(e,t)=>vn(e,`name`,{value:t,configurable:!0}),bn=0,xn=null;function Sn(e){return Cn(),e.children}yn(Sn,`FocusGuards`);function Cn(){B.useEffect(()=>{xn||={start:wn(),end:wn()};let{start:e,end:t}=xn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),bn++,()=>{bn===1&&(xn?.start.remove(),xn?.end.remove(),xn=null),bn=Math.max(0,bn-1)}},[])}yn(Cn,`useFocusGuards`);function wn(){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}yn(wn,`createFocusGuard`);var Tn=function(){return Tn=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},Tn.apply(this,arguments)};function En(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 Dn(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 On=`right-scroll-bar-position`,kn=`width-before-scroll-bar`,An=`with-scroll-bars-hidden`,jn=`--removed-body-scroll-bar-size`;function Mn(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Nn(e,t){var n=(0,B.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 Pn=typeof window<`u`?B.useLayoutEffect:B.useEffect,Fn=new WeakMap;function In(e,t){var n=Nn(t||null,function(t){return e.forEach(function(e){return Mn(e,t)})});return Pn(function(){var t=Fn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Mn(e,null)}),i.forEach(function(e){r.has(e)||Mn(e,a)})}Fn.set(n,e)},[e]),n}function Ln(e){return e}function Rn(e,t){t===void 0&&(t=Ln);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 zn(e){e===void 0&&(e={});var t=Rn(null);return t.options=Tn({async:!0,ssr:!1},e),t}var Bn=function(e){var t=e.sideCar,n=En(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 B.createElement(r,Tn({},n))};Bn.isSideCarExport=!0;function Vn(e,t){return e.useMedium(t),Bn}var Hn=zn(),Un=function(){},Wn=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:Un,onWheelCapture:Un,onTouchMoveCapture:Un}),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=En(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=In([n,t]),C=Tn(Tn({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:Hn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),Tn(Tn({},C),{ref:S})):B.createElement(v,Tn({},C,{className:c,ref:S}),s))});Wn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Wn.classNames={fullWidth:kn,zeroRight:On};var Gn=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Kn(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Gn();return t&&e.setAttribute(`nonce`,t),e}function qn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Yn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Kn())&&(qn(t,n),Jn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xn=function(){var e=Yn();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Zn=function(){var e=Xn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qn={left:0,top:0,right:0,gap:0},$n=function(e){return parseInt(e||``,10)||0},er=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[$n(n),$n(r),$n(i)]},tr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qn;var t=er(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])}},nr=Zn(),rr=`data-scroll-locked`,ir=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
+ .${An} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${rr}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${On} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${kn} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${On} .${On} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${kn} .${kn} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${rr}] {
36
+ ${jn}: ${s}px;
37
+ }
38
+ `},ar=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},or=function(){B.useEffect(function(){return document.body.setAttribute(rr,(ar()+1).toString()),function(){var e=ar()-1;e<=0?document.body.removeAttribute(rr):document.body.setAttribute(rr,e.toString())}},[])},sr=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;or();var a=B.useMemo(function(){return tr(i)},[i]);return B.createElement(nr,{styles:ir(a,!t,i,n?``:`!important`)})},cr=!1;if(typeof window<`u`)try{var lr=Object.defineProperty({},"passive",{get:function(){return cr=!0,!0}});window.addEventListener(`test`,lr,lr),window.removeEventListener(`test`,lr,lr)}catch{cr=!1}var ur=cr?{passive:!1}:!1,dr=function(e){return e.tagName===`TEXTAREA`},fr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!dr(e)&&n[t]===`visible`)},pr=function(e){return fr(e,`overflowY`)},mr=function(e){return fr(e,`overflowX`)},hr=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),vr(e,r)){var i=yr(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},gr=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},_r=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},vr=function(e,t){return e===`v`?pr(t):mr(t)},yr=function(e,t){return e===`v`?gr(t):_r(t)},br=function(e,t){return e===`h`&&t===`rtl`?-1:1},xr=function(e,t,n,r,i){var a=br(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=yr(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&vr(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Sr=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cr=function(e){return[e.deltaX,e.deltaY]},wr=function(e){return e&&`current`in e?e.current:e},Tr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Er=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},Dr=0,Or=[];function kr(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(Dr++)[0],a=B.useState(Zn)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Dn([e.lockRef.current],(e.shards||[]).map(wr),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Sr(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=hr(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=hr(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return xr(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(Or.length&&Or[Or.length-1]===a){var r=`deltaY`in n?Cr(n):Sr(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Tr(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(wr).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Ar(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=Sr(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,Cr(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,Sr(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return Or.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ur),document.addEventListener(`touchmove`,c,ur),document.addEventListener(`touchstart`,u,ur),function(){Or=Or.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ur),document.removeEventListener(`touchmove`,c,ur),document.removeEventListener(`touchstart`,u,ur)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:Er(i)}):null,p?B.createElement(sr,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ar(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var jr=Vn(Hn,kr),Mr=B.forwardRef(function(e,t){return B.createElement(Wn,Tn({},e,{ref:t,sideCar:jr}))});Mr.classNames=Wn.classNames;var Nr=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pr=new WeakMap,Fr=new WeakMap,Ir={},Lr=0,Rr=function(e){return e&&(e.host||Rr(e.parentNode))},zr=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Rr(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Br=function(e,t,n,r){var i=zr(t,Array.isArray(e)?e:[e]);Ir[n]||(Ir[n]=new WeakMap);var a=Ir[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Pr.get(e)||0)+1,l=(a.get(e)||0)+1;Pr.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Fr.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Lr++,function(){o.forEach(function(e){var t=Pr.get(e)-1,i=a.get(e)-1;Pr.set(e,t),a.set(e,i),t||(Fr.has(e)||e.removeAttribute(r),Fr.delete(e)),i||e.removeAttribute(n)}),Lr--,Lr||(Pr=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,Ir={})}},Vr=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Nr(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Br(r,i,n,`aria-hidden`)):function(){return null}},Hr=Object.defineProperty,K=(e,t)=>Hr(e,`name`,{value:t,configurable:!0}),Ur=`Dialog`,[Wr,Gr]=ve(Ur),[Kr,qr]=Wr(Ur),Jr=K(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),{nodes:l,registry:u}=tn(),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:Ur}),[m,h]=B.useState(0),[_,v]=B.useState(0);return(0,H.jsx)(Kr,{scope:t,triggerRef:s,contentRef:c,contentId:g(),titleId:g(),descriptionId:g(),titlePresent:m>0,descriptionPresent:_>0,setTitleCount:h,setDescriptionCount:v,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),Yr=`DialogPortal`,[Xr,Zr]=Wr(Yr,{forceMount:void 0}),Qr=K(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=qr(Yr,t);return(0,H.jsx)(Xr,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,H.jsx)(L,{present:n||a.open,children:(0,H.jsx)(_n,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),$r=`DialogOverlay`,ei=B.forwardRef(K(function(e,t){let n=Zr($r,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=qr($r,e.__scopeDialog);return a.modal?(0,H.jsx)(L,{present:r||a.open,children:(0,H.jsx)(ni,{...i,ref:t})}):null},`DialogOverlay`)),ti=u(`DialogOverlay.RemoveScroll`),ni=B.forwardRef(K(function(t,n){let{__scopeDialog:r,...i}=t,a=qr($r,r),o=Ht(),s=b(n,o);return(0,H.jsx)(Mr,{as:ti,allowPinchZoom:!0,shards:B.useMemo(()=>[a.contentRef,...a.branchNodes.map(e=>({current:e}))],[a.contentRef,a.branchNodes]),children:(0,H.jsx)(e.div,{"data-state":pi(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})},`DialogOverlayImpl`)),ri=`DialogContent`,ii=B.forwardRef(K(function(e,t){let n=Zr(ri,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=qr(ri,e.__scopeDialog);return(0,H.jsx)(L,{present:r||a.open,children:a.modal?(0,H.jsx)(ai,{...i,ref:t}):(0,H.jsx)(oi,{...i,ref:t})})},`DialogContent`)),ai=B.forwardRef(K(function(e,t){let n=qr(ri,e.__scopeDialog),r=B.useRef(null),i=b(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return Vr(e)},[]),(0,H.jsx)(si,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),oi=B.forwardRef(K(function(e,t){let n=qr(ri,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,H.jsx)(si,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),si=B.forwardRef(K(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=qr(ri,n);return Cn(),(0,H.jsx)(en,{registry:l.branchRegistry,children:(0,H.jsx)(Qt,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Vt,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?fi(o,l.descriptionId):o,"data-state":pi(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),ci=B.forwardRef(K(function(t,n){let{__scopeDialog:r,...i}=t,a=qr(`DialogTitle`,r),{setTitleCount:o}=a;return m(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,H.jsx)(e.h2,{id:a.titleId,...i,ref:n})},`DialogTitle`)),li=B.forwardRef(K(function(t,n){let{__scopeDialog:r,...i}=t,a=qr(`DialogDescription`,r),{setDescriptionCount:o}=a;return m(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,H.jsx)(e.p,{id:a.descriptionId,...i,ref:n})},`DialogDescription`)),ui=`DialogClose`,di=B.forwardRef(K(function(t,n){let{__scopeDialog:r,...i}=t,a=qr(ui,r);return(0,H.jsx)(e.button,{type:`button`,...i,ref:n,onClick:_(t.onClick,()=>a.onOpenChange(!1))})},`DialogClose`));function fi(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}K(fi,`concatAriaDescribedby`);function pi(e){return e?`open`:`closed`}K(pi,`getState`);var q={overlay:`_overlay_1vyy5_1`,content:`_content_1vyy5_5`,keyframes:`_keyframes_1vyy5_9`,"overlay-in":`_overlay-in_1vyy5_1`,"overlay-out":`_overlay-out_1vyy5_1`,"content-fade-in":`_content-fade-in_1vyy5_1`,"content-rise-in":`_content-rise-in_1vyy5_1`,"content-out":`_content-out_1vyy5_1`,header:`_header_1vyy5_16`,title:`_title_1vyy5_17`,description:`_description_1vyy5_18`,swap:`_swap_1vyy5_20`,close:`_close_1vyy5_24`,body:`_body_1vyy5_27`,"content-fade-out":`_content-fade-out_1vyy5_1`},mi=(0,B.createContext)(null);function hi({open:e,defaultOpen:t=!1,onOpenChange:n,...r}){let[i,a]=(0,B.useState)(t),o=e??i,s=(0,B.useCallback)(t=>{e===void 0&&a(t),n?.(t)},[e,n]);return(0,H.jsx)(mi.Provider,{value:o,children:(0,H.jsx)(Jr,{...r,open:o,onOpenChange:s})})}var gi={duration:a.duration.instant},_i={duration:a.duration.fast,ease:[...a.ease.standard]};function vi({text:e}){let t=pe();return(0,H.jsx)(me,{mode:`popLayout`,initial:!1,children:(0,H.jsx)(P.span,{className:q.swap,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${a.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${a.blur.subtle}px)`,transition:{duration:a.duration.fast,ease:[...a.ease.standard]}},transition:{duration:a.duration.standard,ease:[...a.ease.enter]},children:e},e)})}function yi({title:e,description:t,children:n,className:r,onPointerDownOutside:i,...o}){let s=(0,B.useContext)(mi),c=pe(),l=(0,B.useRef)({open:s,at:0});(0,B.useLayoutEffect)(()=>{l.current={open:s,at:performance.now()}},[s]);let u=e=>{i?.(e),s!==null&&(!l.current.open||e.detail.originalEvent.timeStamp<l.current.at)&&e.preventDefault()},d=[q.content,r].filter(Boolean).join(` `),f=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:q.header,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(ci,{className:q.title,children:(0,H.jsx)(vi,{text:e})}),t?(0,H.jsx)(li,{className:q.description,children:(0,H.jsx)(vi,{text:t})}):null]}),(0,H.jsx)(di,{className:q.close,"aria-label":`Close dialog`,children:(0,H.jsx)(ee,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,H.jsx)(`div`,{className:q.body,children:n})]});return s===null?(0,H.jsxs)(Qr,{children:[(0,H.jsx)(ei,{className:`${q.overlay} ${q.keyframes}`}),(0,H.jsx)(ii,{...o,onPointerDownOutside:u,className:`${d} ${q.keyframes}`,children:f})]}):(0,H.jsx)(me,{children:s&&(0,H.jsxs)(Qr,{forceMount:!0,children:[(0,H.jsx)(ei,{asChild:!0,forceMount:!0,children:(0,H.jsx)(P.div,{className:q.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:c?gi:_i},transition:c?gi:{duration:a.duration.standard,ease:[...a.ease.enter]}})}),(0,H.jsx)(ii,{...o,onPointerDownOutside:u,asChild:!0,forceMount:!0,children:(0,H.jsx)(P.div,{className:d,initial:c?{opacity:0}:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:c?{opacity:0,transition:gi}:{opacity:0,y:4,scale:.98,transition:_i},transition:c?gi:{default:a.spring.smooth,opacity:{duration:a.duration.fast,ease:[...a.ease.enter]}},children:f})})]},`dialog`)})}var bi=[`top`,`right`,`bottom`,`left`],xi=Math.min,Si=Math.max,Ci=Math.round,wi=Math.floor,Ti=e=>({x:e,y:e}),Ei={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Di(e,t,n){return Si(e,xi(t,n))}function Oi(e,t){return typeof e==`function`?e(t):e}function ki(e){return e.split(`-`)[0]}function Ai(e){return e.split(`-`)[1]}function ji(e){return e===`x`?`y`:`x`}function Mi(e){return e===`y`?`height`:`width`}function Ni(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Pi(e){return ji(Ni(e))}function Fi(e,t,n){n===void 0&&(n=!1);let r=Ai(e),i=Pi(e),a=Mi(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Wi(o)),[o,Wi(o)]}function Ii(e){let t=Wi(e);return[Li(e),t,Li(t)]}function Li(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ri=[`left`,`right`],zi=[`right`,`left`],Bi=[`top`,`bottom`],Vi=[`bottom`,`top`];function Hi(e,t,n){switch(e){case`top`:case`bottom`:return n?t?zi:Ri:t?Ri:zi;case`left`:case`right`:return t?Bi:Vi;default:return[]}}function Ui(e,t,n,r){let i=Ai(e),a=Hi(ki(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Li)))),a}function Wi(e){let t=ki(e);return Ei[t]+e.slice(t.length)}function Gi(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Ki(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Gi(e)}function qi(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ji(e,t,n){let{reference:r,floating:i}=e,a=Ni(t),o=Pi(t),s=Mi(o),c=ki(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ai(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Yi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Oi(t,e),p=Ki(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=qi(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=qi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Xi=50,Zi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Yi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ji(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Xi&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ji(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Qi=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Oi(e,t)||{};if(l==null)return{};let d=Ki(u),f={x:n,y:r},p=Pi(i),m=Mi(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=xi(d[_],T),D=xi(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Di(E,k,O),j=!c.arrow&&Ai(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),$i=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Oi(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ki(r),_=Ni(o),v=ki(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Wi(o)]:Ii(o)),x=p!==`none`;!d&&x&&b.push(...Ui(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Fi(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Ni(t)||T.every(e=>Ni(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ni(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ta(e){return bi.some(t=>e[t]>=0)}var na=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Oi(e,t);switch(i){case`referenceHidden`:{let e=ea(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ta(e)}}}case`escaped`:{let e=ea(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ta(e)}}}default:return{}}}}},ra=new Set([`left`,`top`]);async function ia(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ki(n),s=Ai(n),c=Ni(n)===`y`,l=ra.has(o)?-1:1,u=a&&c?-1:1,d=Oi(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var aa=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ia(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},oa=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Oi(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ni(i),p=ji(f),m=u[p],h=u[f],g=(e,t)=>Di(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},sa=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Oi(e,t),u={x:n,y:r},d=Ni(i),f=ji(d),p=u[f],m=u[d],h=Oi(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ra.has(ki(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ca=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Oi(e,t),c=await i.detectOverflow(t,s),l=ki(n),u=Ai(n),d=Ni(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=xi(p-c[m],g),y=xi(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Si(c.left,c.right):S=p-2*Si(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function la(){return typeof window<`u`}function ua(e){return fa(e)?(e.nodeName||``).toLowerCase():`#document`}function J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function da(e){return((fa(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fa(e){return la()?e instanceof Node||e instanceof J(e).Node:!1}function pa(e){return la()?e instanceof Element||e instanceof J(e).Element:!1}function ma(e){return la()?e instanceof HTMLElement||e instanceof J(e).HTMLElement:!1}function ha(e){return!la()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof J(e).ShadowRoot}function ga(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Da(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _a(e){return/^(table|td|th)$/.test(ua(e))}function va(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ya=/transform|translate|scale|rotate|perspective|filter/,ba=/paint|layout|strict|content/,xa=e=>!!e&&e!==`none`,Sa;function Ca(e){let t=pa(e)?Da(e):e;return xa(t.transform)||xa(t.translate)||xa(t.scale)||xa(t.rotate)||xa(t.perspective)||!Ta()&&(xa(t.backdropFilter)||xa(t.filter))||ya.test(t.willChange||``)||ba.test(t.contain||``)}function wa(e){let t=ka(e);for(;ma(t)&&!Ea(t);){if(Ca(t))return t;if(va(t))return null;t=ka(t)}return null}function Ta(){return Sa??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sa}function Ea(e){return/^(html|body|#document)$/.test(ua(e))}function Da(e){return J(e).getComputedStyle(e)}function Oa(e){return pa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ka(e){if(ua(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ha(e)&&e.host||da(e);return ha(t)?t.host:t}function Aa(e){let t=ka(e);return Ea(t)?(e.ownerDocument||e).body:ma(t)&&ga(t)?t:Aa(t)}function ja(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Aa(e),i=r===e.ownerDocument?.body,a=J(r);if(i){let e=Ma(a);return t.concat(a,a.visualViewport||[],ga(r)?r:[],e&&n?ja(e):[])}return t.concat(r,ja(r,[],n))}function Ma(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){let t=Da(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ma(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ci(n)!==a||Ci(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Pa(e){return pa(e)?e:e.contextElement}function Fa(e){let t=Pa(e);if(!ma(t))return Ti(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Na(t),o=(a?Ci(n.width):n.width)/r,s=(a?Ci(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ia=Ti(0);function La(e){let t=J(e);return!Ta()||!t.visualViewport?Ia:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ra(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===J(e)}function za(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Pa(e),o=Ti(1);t&&(r?pa(r)&&(o=Fa(r)):o=Fa(e));let s=Ra(a,n,r)?La(a):Ti(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=J(a),t=pa(r)?J(r):r,n=e,i=Ma(n);for(;i&&t!==n;){let e=Fa(i),t=i.getBoundingClientRect(),r=Da(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=J(i),i=Ma(n)}}return qi({width:u,height:d,x:c,y:l})}function Ba(e,t){let n=Oa(e).scrollLeft;return t?t.left+n:za(da(e)).left+n}function Va(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ba(e,n),y:n.top+t.scrollTop}}function Ha(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=da(r),s=t?va(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ti(1),u=Ti(0),d=ma(r);if((d||!a)&&((ua(r)!==`body`||ga(o))&&(c=Oa(r)),d)){let e=za(r);l=Fa(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Va(o,c):Ti(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ua(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wa(e){let t=Oa(e),n=e.ownerDocument.body,r=Si(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Si(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Ba(e),o=-t.scrollTop;return Da(n).direction===`rtl`&&(a+=Si(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ga=25;function Ka(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=J(e),a=da(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ta()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Ba(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Ga&&(s-=o)}return{width:s,height:c,x:l,y:u}}function qa(e,t){let n=za(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Fa(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ja(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Ka(e,n,t);else if(t===`document`)r=Wa(da(e));else if(pa(t))r=qa(t,n);else{let n=La(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qi(r)}function Ya(e,t){let n=t.get(e);if(n)return n;let r=ja(e,[],!1).filter(e=>pa(e)&&ua(e)!==`body`),i=null,a=Da(e).position===`fixed`,o=a?ka(e):e;for(;pa(o)&&!Ea(o);){let e=Da(o),t=Ca(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ka(o)}return t.set(e,r),r}function Xa(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?va(t)?[]:Ya(t,this._c):[].concat(n),r],o=Ja(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ja(t,a[e],i);s=Si(n.top,s),c=xi(n.right,c),l=xi(n.bottom,l),u=Si(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Za(e){let{width:t,height:n}=Na(e);return{width:t,height:n}}function Qa(e,t,n){let r=ma(t),i=da(t),a=n===`fixed`,o=za(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ti(0);if((r||!a)&&((ua(t)!==`body`||ga(i))&&(s=Oa(t)),r)){let e=za(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Ba(i));let l=i&&!r&&!a?Va(i,s):Ti(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function $a(e){return Da(e).position===`static`}function eo(e,t){if(!ma(e)||Da(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return da(e)===n&&(n=n.ownerDocument.body),n}function to(e,t){let n=J(e);if(va(e))return n;if(!ma(e)){let t=ka(e);for(;t&&!Ea(t);){if(pa(t)&&!$a(t))return t;t=ka(t)}return n}let r=eo(e,t);for(;r&&_a(r)&&$a(r);)r=eo(r,t);return r&&Ea(r)&&$a(r)&&!Ca(r)?n:r||wa(e)||n}var no=async function(e){let t=this.getOffsetParent||to,n=this.getDimensions,r=await n(e.floating);return{reference:Qa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ro(e){return Da(e).direction===`rtl`}var io={convertOffsetParentRelativeRectToViewportRelativeRect:Ha,getDocumentElement:da,getClippingRect:Xa,getOffsetParent:to,getElementRects:no,getClientRects:Ua,getDimensions:Za,getScale:Fa,isElement:pa,isRTL:ro};function ao(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function oo(e,t,n){let r=null,i,a=da(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=wi(d),h=wi(a.clientWidth-(u+f)),g=wi(a.clientHeight-(d+p)),_=wi(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Si(0,xi(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!ao(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=J(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function so(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Pa(e),u=i||a?[...l?ja(l):[],...t?ja(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?oo(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?za(e):null;c&&g();function g(){let t=za(e);h&&!ao(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var co=aa,lo=oa,uo=$i,fo=ca,po=na,mo=Qi,ho=sa,go=(e,t,n)=>{let r=new Map,i=n??{},a={...io,...i.platform,_c:r};return Zi(e,t,{...i,platform:a})},_o=typeof document<`u`?B.useLayoutEffect:function(){};function vo(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!vo(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!vo(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function yo(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bo(e,t){let n=yo(e);return Math.round(t*n)/n}function xo(e){let t=B.useRef(e);return _o(()=>{t.current=e}),t}function So(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);vo(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=xo(c),D=xo(i),O=xo(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),go(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!vo(w.current,t)&&(w.current=t,hn.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);_o(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);_o(()=>(A.current=!0,()=>{A.current=!1}),[]),_o(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=bo(M.floating,u.x),r=bo(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...yo(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Co=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:mo({element:r.current,padding:i}).fn(n):r?mo({element:r,padding:i}).fn(n):{}}}},wo=(e,t)=>{let n=co(e);return{name:n.name,fn:n.fn,options:[e,t]}},To=(e,t)=>{let n=lo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Eo=(e,t)=>({fn:ho(e).fn,options:[e,t]}),Do=(e,t)=>{let n=uo(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oo=(e,t)=>{let n=fo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ko=(e,t)=>{let n=po(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ao=(e,t)=>{let n=Co(e);return{name:n.name,fn:n.fn,options:[e,t]}},jo=Object.defineProperty,Mo=(e,t)=>jo(e,`name`,{value:t,configurable:!0}),No={Partial:`partial`,Always:`always`},Po={Optimized:`optimized`,Always:`always`},Fo=`Popper`,[Io,Lo]=ve(Fo),[Ro,zo]=Io(Fo),Bo=Mo(e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,H.jsx)(Ro,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Vo=`PopperAnchor`,Ho=B.forwardRef(Mo(function(t,n){let{__scopePopper:r,virtualRef:i,...a}=t,o=zo(Vo,r),s=B.useRef(null),c=o.onAnchorChange,l=B.useCallback(e=>{s.current=e,e&&c(e)},[c]),u=b(n,l),d=B.useRef(null);B.useEffect(()=>{if(!i)return;let e=d.current;d.current=i.current,e!==d.current&&c(d.current)});let f=o.placementState&&Yo(o.placementState),p=f?.[0],m=f?.[1];return i?null:(0,H.jsx)(e.div,{"data-radix-popper-side":p,"data-radix-popper-align":m,...a,ref:u})},`PopperAnchor`)),Uo=`PopperContent`,[Wo,Go]=Io(Uo),Ko=B.forwardRef(Mo(function(t,n){let{__scopePopper:i,side:a=`bottom`,sideOffset:o=0,align:s=`center`,alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p=No.Partial,hideWhenDetached:h=!1,updatePositionStrategy:g=Po.Optimized,onPlaced:_,...v}=t,y=zo(Uo,i),[x,S]=B.useState(null),C=b(n,S),[w,T]=B.useState(null),E=r(w),D=E?.width??0,O=E?.height??0,k=a+(s===`center`?``:`-`+s),A=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],M=j.length>0,N={padding:A,boundary:j.filter(qo),altBoundary:M},{refs:ee,floatingStyles:P,placement:F,isPositioned:I,middlewareData:L}=So({strategy:`fixed`,placement:k,whileElementsMounted:Mo((...e)=>so(...e,{animationFrame:g===Po.Always}),`whileElementsMounted`),elements:{reference:y.anchor},middleware:[wo({mainAxis:o+O,alignmentAxis:c}),u&&To({mainAxis:!0,crossAxis:!1,limiter:p===No.Partial?Eo():void 0,...N}),u&&Do({...N}),Oo({...N,apply:Mo(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),w&&Ao({element:w,padding:l}),Jo({arrowWidth:D,arrowHeight:O}),h&&ko({strategy:`referenceHidden`,...N,boundary:M?N.boundary:void 0})]}),R=y.setPlacementState;m(()=>(R(F),()=>{R(void 0)}),[F,R]);let[te,ne]=Yo(F),z=U(_);m(()=>{I&&z?.()},[I,z]);let re=L.arrow?.x,ie=L.arrow?.y,ae=L.arrow?.centerOffset!==0,[oe,se]=B.useState();return m(()=>{x&&se(window.getComputedStyle(x).zIndex)},[x]),(0,H.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...P,transform:I?P.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[L.transformOrigin?.x,L.transformOrigin?.y].join(` `),...L.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:t.dir,children:(0,H.jsx)(Wo,{scope:i,placedSide:te,placedAlign:ne,onArrowChange:T,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,H.jsx)(e.div,{"data-side":te,"data-align":ne,...v,ref:C,style:{...v.style,animation:I?v.style?.animation:`none`}})})})},`PopperContent`));function qo(e){return e!==null}Mo(qo,`isNotNull`);var Jo=Mo(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Yo(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Yo(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Mo(Yo,`getSideAndAlignFromPlacement`);var Xo=Object.defineProperty,Zo=(e,t)=>Xo(e,`name`,{value:t,configurable:!0}),Qo=!1;function $o(){let[e,t]=B.useState(Qo);return B.useEffect(()=>{Qo||(Qo=!0,t(!0))},[]),e}Zo($o,`useIsHydrated`);var es=B.useSyncExternalStore;function ts(){return()=>{}}Zo(ts,`subscribe`);function ns(){return es(ts,()=>!0,()=>!1)}Zo(ns,`useIsHydratedModern`);var rs=typeof es==`function`?ns:$o,is=Object.defineProperty,as=(e,t)=>is(e,`name`,{value:t,configurable:!0}),os=`rovingFocusGroup.onEntryFocus`,ss={bubbles:!1,cancelable:!0},cs=`RovingFocusGroup`,[ls,us,ds]=s(cs),[fs,ps]=ve(cs,[ds]),ms={Vertical:`vertical`,Horizontal:`horizontal`},hs={LTR:`ltr`,RTL:`rtl`},[gs,_s]=fs(cs),vs=B.forwardRef(as(function(e,t){return(0,H.jsx)(ls.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(ls.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(ys,{...e,ref:t})})})},`RovingFocusGroup`)),ys=B.forwardRef(as(function(t,n){let{__scopeRovingFocusGroup:r,orientation:a,loop:o=!1,dir:s,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...m}=t,h=B.useRef(null),g=b(n,h),v=i(s),[y,x]=p({prop:c,defaultProp:l??null,onChange:u,caller:cs}),[S,C]=B.useState(!1),w=U(d),T=us(r),E=B.useRef(!1),[D,O]=B.useState(0);return B.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(os,w),()=>e.removeEventListener(os,w)},[w]),(0,H.jsx)(gs,{scope:r,orientation:a,dir:v,loop:o,currentTabStopId:y,onItemFocus:B.useCallback(e=>x(e),[x]),onItemShiftTab:B.useCallback(()=>C(!0),[]),onFocusableItemAdd:B.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>O(e=>e-1),[]),children:(0,H.jsx)(e.div,{tabIndex:S||D===0?-1:0,"data-orientation":a,...m,ref:g,style:{outline:`none`,...t.style},onMouseDown:_(t.onMouseDown,()=>{E.current=!0}),onFocus:_(t.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!S){let t=new CustomEvent(os,ss);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Ts([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),f)}}E.current=!1}),onBlur:_(t.onBlur,()=>C(!1))})})},`RovingFocusGroupImpl`)),bs=`RovingFocusGroupItem`,xs=B.forwardRef(as(function(t,n){let{__scopeRovingFocusGroup:r,focusable:i=!0,active:a=!1,tabStopId:o,children:s,...c}=t,l=g(),u=o||l,d=_s(bs,r),f=d.currentTabStopId===u,p=us(r),{onFocusableItemAdd:h,onFocusableItemRemove:v,currentTabStopId:y}=d,b=rs();return m(()=>{if(b&&i)return h(),()=>v()},[b,i,h,v]),B.useEffect(()=>{if(!b&&i)return h(),()=>v()},[b,i,h,v]),(0,H.jsx)(ls.ItemSlot,{scope:r,id:u,focusable:i,active:a,children:(0,H.jsx)(e.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:n,onMouseDown:_(t.onMouseDown,e=>{i?d.onItemFocus(u):e.preventDefault()}),onFocus:_(t.onFocus,()=>d.onItemFocus(u)),onKeyDown:_(t.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){d.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ws(e,d.orientation,d.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=p().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=d.loop?Es(n,r+1):n.slice(r+1)}setTimeout(()=>Ts(n))}}),children:typeof s==`function`?s({isCurrentTabStop:f,hasTabStop:y!=null}):s})})},`RovingFocusGroupItem`)),Ss={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Cs(e,t){return t===hs.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}as(Cs,`getDirectionAwareKey`);function ws(e,t,n){let r=Cs(e.key,n);if(!(t===ms.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===ms.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Ss[r]}as(ws,`getFocusIntent`);function Ts(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}as(Ts,`focusFirst`);function Es(e,t){return e.map((n,r)=>e[(t+r)%e.length])}as(Es,`wrapArray`);var Ds=Object.defineProperty,Y=(e,t)=>Ds(e,`name`,{value:t,configurable:!0}),Os=[`Enter`,` `],ks=[`ArrowDown`,`PageUp`,`Home`],As=[`ArrowUp`,`PageDown`,`End`],js=[...ks,...As];[...Os],[...Os];var Ms=`Menu`,[Ns,Ps,Fs]=s(Ms),[Is,Ls]=ve(Ms,[Fs,Lo,ps]),Rs=Lo(),zs=ps(),[Bs,Vs]=Is(Ms),[Hs,Us]=Is(Ms),Ws=Y(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:s=!0}=e,c=Rs(t),[l,u]=B.useState(null),d=B.useRef(!1),f=U(o),p=i(a);return B.useEffect(()=>{let e=Y(()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Y(()=>d.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),B.useEffect(()=>{if(!n)return;let e=Y(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,H.jsx)(Bo,{...c,children:(0,H.jsx)(Bs,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:(0,H.jsx)(Hs,{scope:t,onClose:B.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:s,children:r})})})},`Menu`),Gs=B.forwardRef(Y(function(e,t){let{__scopeMenu:n,...r}=e,i=Rs(n);return(0,H.jsx)(Ho,{...i,...r,ref:t})},`MenuAnchor`)),Ks=`MenuPortal`,[qs,Js]=Is(Ks,{forceMount:void 0}),Ys=Y(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Vs(Ks,t);return(0,H.jsx)(qs,{scope:t,forceMount:n,children:(0,H.jsx)(L,{present:n||a.open,children:(0,H.jsx)(_n,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Xs=`MenuContent`,[Zs,Qs]=Is(Xs),$s=B.forwardRef(Y(function(e,t){let n=Js(Xs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Vs(Xs,e.__scopeMenu),o=Us(Xs,e.__scopeMenu);return(0,H.jsx)(Ns.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(L,{present:r||a.open,children:(0,H.jsx)(Ns.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(ec,{...i,ref:t}):(0,H.jsx)(tc,{...i,ref:t})})})})},`MenuContent`)),ec=B.forwardRef(Y(function(e,t){let n=Vs(Xs,e.__scopeMenu),r=B.useRef(null),i=b(t,r);return B.useEffect(()=>{let e=r.current;if(e)return Vr(e)},[]),(0,H.jsx)(rc,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),tc=B.forwardRef(Y(function(e,t){let n=Vs(Xs,e.__scopeMenu);return(0,H.jsx)(rc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),nc=u(`MenuContent.ScrollLock`),rc=B.forwardRef(Y(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Vs(Xs,n),v=Us(Xs,n),y=Rs(n),x=zs(n),S=Ps(n),[C,w]=B.useState(null),T=B.useRef(null),[E,D]=B.useState(null);nn(E);let{nodes:O,registry:k}=tn(),A=!!(i||m),j=b(t,T,g.onContentChange,D),M=B.useRef(0),N=B.useRef(``),ee=B.useRef(0),P=B.useRef(null),F=B.useRef(`right`),I=B.useRef(0),L=B.useMemo(()=>m?[T,...O.map(e=>({current:e}))]:[],[T,O,m]),R=m?Mr:B.Fragment,te=m?{as:nc,allowPinchZoom:!0,shards:L}:void 0,ne=Y(e=>{let t=N.current+e,n=S().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Cc(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Y((function e(t){N.current=t,window.clearTimeout(M.current),t!==``&&(M.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);B.useEffect(()=>()=>window.clearTimeout(M.current),[]),Cn();let z=B.useCallback(e=>F.current===P.current?.side&&Tc(e,P.current?.area),[]);return(0,H.jsx)(Zs,{scope:n,searchRef:N,onItemEnter:B.useCallback(e=>{z(e)&&e.preventDefault()},[z]),onItemLeave:B.useCallback(e=>{z(e)||(T.current?.focus(),w(null))},[z]),onTriggerLeave:B.useCallback(e=>{z(e)&&e.preventDefault()},[z]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:B.useCallback(e=>{P.current=e},[]),children:(0,H.jsx)(en,{registry:A?k:null,children:(0,H.jsx)(R,{...te,children:(0,H.jsx)(Qt,{asChild:!0,trapped:i,branches:O,onMountAutoFocus:_(a,e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(Vt,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,H.jsx)(vs,{asChild:!0,...x,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:C,onCurrentTabStopIdChange:w,onEntryFocus:_(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(Ko,{role:`menu`,"aria-orientation":`vertical`,"data-state":vc(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:j,style:{outline:`none`,...h.style},onKeyDown:_(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=T.current;if(e.target!==i||!js.includes(e.key))return;e.preventDefault();let a=S().filter(e=>!e.disabled).map(e=>e.ref.current);As.includes(e.key)&&a.reverse(),xc(a)}),onBlur:_(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(M.current),N.current=``)}),onPointerMove:_(e.onPointerMove,Ec(e=>{let t=e.target,n=I.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>I.current?`right`:`left`;F.current=t,I.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),ic=`MenuItem`,ac=`menu.itemSelect`,oc=B.forwardRef(Y(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=Us(ic,e.__scopeMenu),s=Qs(ic,e.__scopeMenu),c=b(t,a),l=B.useRef(!1),u=Y(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ac,{bubbles:!0,cancelable:!0});e.addEventListener(ac,e=>r?.(e),{once:!0}),I(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,H.jsx)(sc,{...i,ref:c,disabled:n,onClick:_(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:_(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:_(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Os.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),sc=B.forwardRef(Y(function(t,n){let{__scopeMenu:r,disabled:i=!1,textValue:a,...o}=t,s=Qs(ic,r),c=zs(r),l=B.useRef(null),u=b(n,l),[d,f]=B.useState(!1),[p,m]=B.useState(``);return B.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,H.jsx)(Ns.ItemSlot,{scope:r,disabled:i,textValue:a??p,children:(0,H.jsx)(xs,{asChild:!0,...c,focusable:!i,children:(0,H.jsx)(e.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:_(t.onPointerMove,Ec(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:_(t.onPointerLeave,Ec(e=>s.onItemLeave(e))),onFocus:_(t.onFocus,()=>f(!0)),onBlur:_(t.onBlur,()=>f(!1))})})})},`MenuItemImpl`)),cc=B.forwardRef(Y(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(fc,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(oc,{role:`menuitemcheckbox`,"aria-checked":yc(n)?`mixed`:n,...i,ref:t,"data-state":bc(n),onSelect:_(i.onSelect,()=>r?.(yc(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[lc,uc]=Is(`MenuRadioGroup`,{value:void 0,onValueChange:Y(()=>{},`onValueChange`)}),dc=`MenuItemIndicator`,[fc,pc]=Is(dc,{checked:!1}),mc=B.forwardRef(Y(function(t,n){let{__scopeMenu:r,forceMount:i,...a}=t,o=pc(dc,r);return(0,H.jsx)(L,{present:i||yc(o.checked)||o.checked===!0,children:(0,H.jsx)(e.span,{...a,ref:n,"data-state":bc(o.checked)})})},`MenuItemIndicator`)),hc=B.forwardRef(Y(function(t,n){let{__scopeMenu:r,...i}=t;return(0,H.jsx)(e.div,{role:`separator`,"aria-orientation":`horizontal`,...i,ref:n})},`MenuSeparator`)),[gc,_c]=Is(`MenuSub`);function vc(e){return e?`open`:`closed`}Y(vc,`getOpenState`);function yc(e){return e===`indeterminate`}Y(yc,`isIndeterminate`);function bc(e){return yc(e)?`indeterminate`:e?`checked`:`unchecked`}Y(bc,`getCheckedState`);function xc(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Y(xc,`focusFirst`);function Sc(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Y(Sc,`wrapArray`);function Cc(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Sc(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Y(Cc,`getNextMatch`);function wc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Y(wc,`isPointInPolygon`);function Tc(e,t){return t?wc({x:e.clientX,y:e.clientY},t):!1}Y(Tc,`isPointerInGraceArea`);function Ec(e){return t=>t.pointerType===`mouse`?e(t):void 0}Y(Ec,`whenMouse`);var Dc=Object.defineProperty,Oc=(e,t)=>Dc(e,`name`,{value:t,configurable:!0}),kc=`DropdownMenu`,[Ac,jc]=ve(kc,[Ls]),Mc=Ls(),[Nc,Pc]=Ac(kc),Fc=Oc(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Mc(t),l=B.useRef(null),[u,d]=p({prop:i,defaultProp:a??!1,onChange:o,caller:kc});return(0,H.jsx)(Nc,{scope:t,triggerId:g(),triggerRef:l,contentId:g(),open:u,onOpenChange:d,onOpenToggle:B.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(Ws,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Ic=`DropdownMenuTrigger`,Lc=B.forwardRef(Oc(function(t,n){let{__scopeDropdownMenu:r,disabled:i=!1,...a}=t,o=Pc(Ic,r),s=Mc(r),c=b(n,o.triggerRef);return(0,H.jsx)(Gs,{asChild:!0,...s,children:(0,H.jsx)(e.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:_(t.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:_(t.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Rc=Oc(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Mc(t);return(0,H.jsx)(Ys,{...r,...n})},`DropdownMenuPortal`),zc=`DropdownMenuContent`,Bc=B.forwardRef(Oc(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Pc(zc,n),a=Mc(n),o=B.useRef(!1);return(0,H.jsx)($s,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:_(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Vc=B.forwardRef(Oc(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Mc(n);return(0,H.jsx)(oc,{...i,...r,ref:t})},`DropdownMenuItem`)),Hc=B.forwardRef(Oc(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Mc(n);return(0,H.jsx)(cc,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),Uc=B.forwardRef(Oc(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Mc(n);return(0,H.jsx)(mc,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Wc=B.forwardRef(Oc(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Mc(n);return(0,H.jsx)(hc,{...i,...r,ref:t})},`DropdownMenuSeparator`)),X={trigger:`_trigger_26wmo_1`,item:`_item_26wmo_7`,triggerIcon:`_triggerIcon_26wmo_8`,triggerIconOnly:`_triggerIconOnly_26wmo_10`,label:`_label_26wmo_11`,labelMeasure:`_labelMeasure_26wmo_12`,labelText:`_labelText_26wmo_13`,chevron:`_chevron_26wmo_14`,menu:`_menu_26wmo_18`,"menu-exit":`_menu-exit_26wmo_1`,highlight:`_highlight_26wmo_28`,icon:`_icon_26wmo_31`,separator:`_separator_26wmo_32`,destructive:`_destructive_26wmo_33`};function Gc({text:e}){let t=pe(),n=(0,B.useRef)(null),r=(0,B.useRef)(null),[i,o]=(0,B.useState)({width:`auto`,animate:!1});return(0,B.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([t])=>{let n=e.textContent,i=r.current!==null&&r.current!==n;r.current=n,o({width:Math.ceil(t.borderBoxSize?.[0]?.inlineSize??e.offsetWidth),animate:i})});return t.observe(e),()=>t.disconnect()},[]),(0,H.jsxs)(P.span,{className:X.label,initial:!1,animate:{width:i.width},transition:i.animate&&!t?a.spring.morph:{duration:0},children:[(0,H.jsx)(`span`,{ref:n,className:X.labelMeasure,"aria-hidden":`true`,children:e}),(0,H.jsx)(me,{mode:`popLayout`,initial:!1,children:(0,H.jsx)(P.span,{className:X.labelText,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${a.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${a.blur.subtle}px)`,transition:{duration:a.duration.fast,ease:[...a.ease.standard]}},transition:{duration:a.duration.standard,ease:[...a.ease.enter]},children:e},e)})]})}function Kc({label:e,items:t,icon:n,iconOnly:r}){let i=pe(),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(!1),l=(0,B.useRef)(0);(0,B.useEffect)(()=>()=>window.clearTimeout(l.current),[]);function u(e){let t=e.target instanceof HTMLElement?e.target.closest(`[role="menuitem"]`):null;if(window.clearTimeout(l.current),!t){l.current=window.setTimeout(()=>s(null),c.current?70:0);return}let n={top:t.offsetTop,height:t.offsetHeight,danger:t.dataset.tone===`danger`},r=c.current;s(e=>({...n,glide:r&&e!==null}))}return(0,H.jsxs)(Fc,{onOpenChange:e=>{e&&(window.clearTimeout(l.current),s(null))},children:[(0,H.jsxs)(Lc,{className:[X.trigger,r?X.triggerIconOnly:``].filter(Boolean).join(` `),type:`button`,"aria-label":r?e:void 0,children:[n&&(0,H.jsx)(`span`,{className:X.triggerIcon,"aria-hidden":`true`,children:n}),!r&&(0,H.jsx)(Gc,{text:e}),!r&&(0,H.jsx)(_e,{className:X.chevron,size:15,strokeWidth:1.8,"aria-hidden":`true`})]}),(0,H.jsx)(Rc,{children:(0,H.jsxs)(Bc,{className:X.menu,sideOffset:6,align:`end`,collisionPadding:12,loop:!0,onFocus:u,onPointerMoveCapture:()=>{c.current=!0},onKeyDownCapture:()=>{c.current=!1},children:[(0,H.jsx)(P.span,{className:X.highlight,"data-tone":o?.danger?`danger`:void 0,"aria-hidden":`true`,initial:!1,animate:o?{y:o.top,height:o.height,opacity:1}:{opacity:0},transition:{default:o?.glide&&!i?a.spring.snappy:{duration:0},opacity:{duration:i?0:.08}}}),t.map((e,t)=>(0,H.jsxs)(B.Fragment,{children:[e.separatorBefore&&(0,H.jsx)(Wc,{className:X.separator}),(0,H.jsxs)(Vc,{className:[X.item,e.destructive?X.destructive:``].filter(Boolean).join(` `),"data-tone":e.destructive?`danger`:void 0,style:{"--i":t},disabled:e.disabled,onSelect:e.onSelect,children:[e.icon&&(0,H.jsx)(`span`,{className:X.icon,"aria-hidden":`true`,children:e.icon}),e.label]})]},e.label))]})})]})}var qc=Object.defineProperty,Jc=(e,t)=>qc(e,`name`,{value:t,configurable:!0});function Yc(e,[t,n]){return Math.min(n,Math.max(t,e))}Jc(Yc,`clamp`);var Xc=Object.defineProperty,Zc=(e,t)=>Xc(e,`name`,{value:t,configurable:!0});function Qc(e){let t=B.useRef({value:e,previous:e});return B.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}Zc(Qc,`usePrevious`);var $c=Object.defineProperty,el=(e,t)=>$c(e,`name`,{value:t,configurable:!0}),tl=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),nl=B.forwardRef(el(function(t,n){return(0,H.jsx)(e.span,{...t,ref:n,style:{...tl,...t.style}})},`VisuallyHidden`)),rl=Object.defineProperty,Z=(e,t)=>rl(e,`name`,{value:t,configurable:!0}),il={ItemAligned:`item-aligned`,Popper:`popper`},al={LTR:`ltr`,RTL:`rtl`},ol=[` `,`Enter`,`ArrowUp`,`ArrowDown`],sl=[` `,`Enter`],cl=`Select`,[ll,ul,dl]=s(cl),[fl,pl]=ve(cl,[dl,Lo]),ml=Lo(),[hl,gl]=fl(cl),[_l,vl]=fl(cl);function yl(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:_,internal_do_not_use_render:v}=e,y=ml(t),[b,x]=B.useState(null),[S,C]=B.useState(null),[w,T]=B.useState(!1),E=i(u),[D,O]=p({prop:r,defaultProp:a??!1,onChange:o,caller:cl}),[k,A]=p({prop:s,defaultProp:c,onChange:l,caller:cl}),j=B.useRef(null),M=B.useRef(k);B.useEffect(()=>{let e=_?b?.ownerDocument.getElementById(_):b?.form;if(e instanceof HTMLFormElement){let t=Z(()=>A(M.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[_,b,A]);let N=!b||!!_||!!b.closest(`form`),[ee,P]=B.useState(new Set),F=g(),I=Array.from(ee).map(e=>e.props.value).join(`;`),L=B.useCallback(e=>{P(t=>new Set(t).add(e))},[]),R=B.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:h,trigger:b,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:F,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:j,disabled:m,name:d,autoComplete:f,form:_,nativeOptions:ee,nativeSelectKey:I,isFormControl:N};return(0,H.jsx)(Bo,{...y,children:(0,H.jsx)(hl,{scope:t,...te,children:(0,H.jsx)(ll.Provider,{scope:t,children:(0,H.jsx)(_l,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:R,children:au(v)?v(te):n})})})})}Z(yl,`SelectProvider`);var bl=Z(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,H.jsx)(yl,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,H.jsxs)(H.Fragment,{children:[n,e?(0,H.jsx)(iu,{__scopeSelect:t}):null]})})},`Select`),xl=`SelectTrigger`,Sl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,disabled:i=!1,...a}=t,o=ml(r),s=gl(xl,r),c=s.disabled||i,l=b(n,s.onTriggerChange),u=ul(r),d=B.useRef(`touch`),[f,p,m]=su(e=>{let t=u().filter(e=>!e.disabled),n=cu(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),h=Z(e=>{c||(s.onOpenChange(!0),m()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,H.jsx)(Ho,{asChild:!0,...o,children:(0,H.jsx)(e.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":ou(s.value)?``:void 0,...a,ref:l,onClick:_(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&h(e)}),onPointerDown:_(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:_(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&ol.includes(e.key)&&(h(),e.preventDefault())})})})},`SelectTrigger`)),Cl=`SelectValue`,wl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,className:i,style:a,children:o,placeholder:s=``,...c}=t,l=gl(Cl,r),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=b(n,l.onValueNodeChange);m(()=>{u(d)},[u,d]);let p=ou(l.value);return(0,H.jsx)(e.span,{...c,asChild:!p&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,H.jsx)(B.Fragment,{children:p?s:o},p?`placeholder`:`value`)})},`SelectValue`)),Tl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,children:i,...a}=t;return(0,H.jsx)(e.span,{"aria-hidden":!0,...a,ref:n,children:i||`▼`})},`SelectIcon`)),[El,Dl]=fl(`SelectPortal`,{forceMount:void 0}),Ol=Z(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,H.jsx)(El,{scope:e.__scopeSelect,forceMount:n,children:(0,H.jsx)(_n,{asChild:!0,...r})})},`SelectPortal`),kl=`SelectContent`,Al=B.forwardRef(Z(function(e,t){let n=Dl(kl,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=gl(kl,e.__scopeSelect),[o,s]=B.useState();return m(()=>{s(new DocumentFragment)},[]),(0,H.jsx)(L,{present:r||a.open,children:({present:e})=>e?(0,H.jsx)(Fl,{...i,ref:t}):(0,H.jsx)(jl,{...i,fragment:o})})},`SelectContent`)),jl=B.forwardRef(Z(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?hn.createPortal((0,H.jsx)(Ml,{scope:n,children:(0,H.jsx)(ll.Slot,{scope:n,children:(0,H.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Q=10,[Ml,Nl]=fl(kl),Pl=u(`SelectContent.RemoveScroll`),Fl=B.forwardRef(Z(function(e,t){let{__scopeSelect:n}=e,{position:r=il.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=gl(kl,n),[x,S]=B.useState(null),[C,w]=B.useState(null),T=b(t,S),[E,D]=B.useState(null),[O,k]=B.useState(null),A=ul(n),[j,M]=B.useState(!1),N=B.useRef(!1);B.useEffect(()=>{if(x)return Vr(x)},[x]),Cn();let ee=B.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),P=B.useCallback(()=>ee([E,x]),[ee,E,x]);B.useEffect(()=>{j&&P()},[j,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;B.useEffect(()=>{if(x){let e={x:0,y:0},t=Z(t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},`handlePointerMove`),n=Z(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(x)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null},`handlePointerUp`);return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,F,I]),B.useEffect(()=>{let e=Z(()=>F(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,R]=su(e=>{let t=A().filter(e=>!e.disabled),n=cu(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=B.useCallback((e,t,n)=>{let r=!N.current&&!n;(y.value!==void 0&&y.value===t||r)&&(D(e),r&&(N.current=!0))},[y.value]),ne=B.useCallback(()=>x?.focus(),[x]),z=B.useCallback((e,t,n)=>{let r=!N.current&&!n;(y.value!==void 0&&y.value===t||r)&&k(e)},[y.value]),re=r===il.Popper?Ll:Il,ie=re===Ll?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,H.jsx)(Ml,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:te,selectedItem:E,onItemLeave:ne,itemTextRefCallback:z,focusSelectedItem:P,selectedItemText:O,position:r,isPositioned:j,searchRef:L,children:(0,H.jsx)(Mr,{as:Pl,allowPinchZoom:!0,children:(0,H.jsx)(Qt,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:_(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,H.jsx)(Vt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,H.jsx)(re,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...ie,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:_(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&R(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Il=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,onPlaced:i,...a}=t,o=gl(kl,r),s=Nl(kl,r),[c,l]=B.useState(null),[u,d]=B.useState(null),f=b(n,d),p=ul(r),h=B.useRef(!1),g=B.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=s,S=B.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==al.RTL){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Q,d=Yc(a,[Q,Math.max(Q,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Q,d=Yc(a,[Q,Math.max(Q,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-Q*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+m+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Q,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+m+k,j=x-A;if(A<=E){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${Q}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[p,o.trigger,o.valueNode,c,u,_,v,y,o.dir,i]);m(()=>S(),[S]);let[C,w]=B.useState();m(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]);let T=B.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]);return(0,H.jsx)(Rl,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:T,children:(0,H.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,H.jsx)(e.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})},`SelectItemAlignedPosition`)),Ll=B.forwardRef(Z(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Q,...a}=e,o=ml(n);return(0,H.jsx)(Ko,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[Rl,zl]=fl(kl,{}),Bl=`SelectViewport`,Vl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,nonce:i,...a}=t,o=Nl(Bl,r),s=zl(Bl,r),c=b(n,o.onViewportChange),l=B.useRef(0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,H.jsx)(ll.Slot,{scope:r,children:(0,H.jsx)(e.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:_(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Q*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})},`SelectViewport`)),[Hl,Ul]=fl(`SelectGroup`),Wl=`SelectItem`,[Gl,Kl]=fl(Wl),ql=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=t,c=gl(Wl,r),l=Nl(Wl,r),u=c.value===i,[d,f]=B.useState(o??``),[p,m]=B.useState(!1),h=U(e=>l.itemRefCallback?.(e,i,a)),v=b(n,h),y=g(),x=B.useRef(`touch`),S=Z(()=>{c.onValueChange(i),c.onOpenChange(!1)},`handleSelect`);return(0,H.jsx)(Gl,{scope:r,value:i,disabled:a,textId:y,isSelected:u,onItemTextChange:B.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,H.jsx)(ll.ItemSlot,{scope:r,value:i,disabled:a,textValue:d,children:(0,H.jsx)(e.div,{role:`option`,"aria-labelledby":y,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:_(s.onFocus,()=>m(!0)),onBlur:_(s.onBlur,()=>m(!1)),onClick:_(s.onClick,()=>{a||x.current!==`mouse`&&S()}),onPointerUp:_(s.onPointerUp,()=>{a||x.current===`mouse`&&S()}),onPointerDown:_(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:_(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:_(s.onKeyDown,e=>{a||e.target!==e.currentTarget||(l.searchRef?.current===``||e.key!==` `)&&(sl.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Jl=`SelectItemText`,Yl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,className:i,style:a,...o}=t,s=gl(Jl,r),c=Nl(Jl,r),l=Kl(Jl,r),u=vl(Jl,r),[d,f]=B.useState(null),p=U(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),h=b(n,f,l.onItemTextChange,p),g=d?.textContent,_=B.useMemo(()=>(0,H.jsx)(`option`,{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=u;return m(()=>(v(_),()=>y(_)),[v,y,_]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(e.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!ou(s.value)?hn.createPortal(o.children,s.valueNode):null]})},`SelectItemText`)),Xl=`SelectItemIndicator`,Zl=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,...i}=t;return Kl(Xl,r).isSelected?(0,H.jsx)(e.span,{"aria-hidden":!0,...i,ref:n}):null},`SelectItemIndicator`)),Ql=`SelectScrollUpButton`,$l=B.forwardRef(Z(function(e,t){let n=Nl(Ql,e.__scopeSelect),r=zl(Ql,e.__scopeSelect),[i,a]=B.useState(!1),o=b(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};Z(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(nu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),eu=`SelectScrollDownButton`,tu=B.forwardRef(Z(function(e,t){let n=Nl(eu,e.__scopeSelect),r=zl(eu,e.__scopeSelect),[i,a]=B.useState(!1),o=b(t,r.onScrollButtonChange);return m(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};Z(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,H.jsx)(nu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),nu=B.forwardRef(Z(function(t,n){let{__scopeSelect:r,onAutoScroll:i,...a}=t,o=Nl(`SelectScrollButton`,r),s=B.useRef(null),c=ul(r),l=B.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return B.useEffect(()=>()=>l(),[l]),m(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,H.jsx)(e.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:_(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:_(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:_(a.onPointerLeave,()=>{l()})})},`SelectScrollButtonImpl`)),ru=`SelectBubbleInput`,iu=B.forwardRef(Z(function({__scopeSelect:t,...n},r){let i=gl(ru,t),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=i,{nativeOptions:f,nativeSelectKey:p}=i,m=B.useRef(null),h=b(r,m),g=a??``,_=Qc(g),v=Array.from(f).some(e=>(e.props.value??``)===``);return B.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,H.jsxs)(e.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...n,style:{...tl,...n.style},ref:h,defaultValue:g,children:[ou(a)&&!v?(0,H.jsx)(`option`,{value:``}):null,Array.from(f)]},p)},`SelectBubbleInput`));function au(e){return typeof e==`function`}Z(au,`isFunction`);function ou(e){return e===``||e===void 0}Z(ou,`shouldShowPlaceholder`);function su(e){let t=U(e),n=B.useRef(``),r=B.useRef(0),i=B.useCallback(e=>{let i=n.current+e;t(i),Z((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=B.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return B.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}Z(su,`useTypeaheadSearch`);function cu(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=lu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Z(cu,`findNextItem`);function lu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Z(lu,`wrapArray`);var $={field:`_field_1a9q6_1`,trigger:`_trigger_1a9q6_4`,valueText:`_valueText_1a9q6_9`,srOnly:`_srOnly_1a9q6_12`,chevron:`_chevron_1a9q6_13`,hint:`_hint_1a9q6_15`,content:`_content_1a9q6_18`,"select-in":`_select-in_1a9q6_1`,"select-out":`_select-out_1a9q6_1`,viewport:`_viewport_1a9q6_23`,item:`_item_1a9q6_24`,indicator:`_indicator_1a9q6_27`,"indicator-in":`_indicator-in_1a9q6_1`,scrollButton:`_scrollButton_1a9q6_28`,"select-fade":`_select-fade_1a9q6_1`,"select-fade-out":`_select-fade-out_1a9q6_1`},uu={enter:e=>({opacity:0,y:`${e*.35}em`,filter:`blur(${a.blur.soft}px)`}),center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:a.duration.standard,ease:[...a.ease.enter]}},exit:e=>({opacity:0,y:`${e*-.3}em`,filter:`blur(${a.blur.subtle}px)`,transition:{duration:a.duration.fast,ease:[...a.ease.standard]}})},du={enter:{opacity:0},center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:a.duration.instant}},exit:{opacity:0,transition:{duration:a.duration.instant}}},fu=(0,B.forwardRef)(function({label:e,description:t,placeholder:n=`Select an option`,options:r,id:i,className:a,disabled:o,onValueChange:s,...c},l){let u=(0,B.useId)(),d=i??u,f=t?`${d}-description`:void 0,p=pe(),[m,h]=(0,B.useState)(c.defaultValue??``),g=c.value??m,_=r.findIndex(e=>e.value===g),v=g?r[_]?.label??``:n,[y,b]=(0,B.useState)(_),[x,S]=(0,B.useState)(1);return y!==_&&(b(_),S(_>y?1:-1)),(0,H.jsxs)(`div`,{className:$.field,children:[(0,H.jsx)(`label`,{htmlFor:d,children:e}),(0,H.jsxs)(bl,{...c,disabled:o,onValueChange:e=>{h(e),s?.(e)},children:[(0,H.jsxs)(Sl,{ref:l,id:d,"aria-describedby":f,className:[$.trigger,a].filter(Boolean).join(` `),children:[(0,H.jsx)(`span`,{className:$.srOnly,children:(0,H.jsx)(wl,{placeholder:n})}),(0,H.jsx)(`span`,{className:$.valueText,"aria-hidden":`true`,children:(0,H.jsx)(me,{initial:!1,custom:x,children:(0,H.jsx)(P.span,{"data-placeholder":g?void 0:``,custom:x,variants:p?du:uu,initial:`enter`,animate:`center`,exit:`exit`,children:v},g?`value-${g}`:`placeholder`)})}),(0,H.jsx)(Tl,{className:$.chevron,children:(0,H.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,H.jsx)(Ol,{children:(0,H.jsxs)(Al,{className:$.content,position:`popper`,sideOffset:4,collisionPadding:12,children:[(0,H.jsx)($l,{className:$.scrollButton,children:(0,H.jsx)(we,{size:16,strokeWidth:1.75,"aria-hidden":`true`})}),(0,H.jsx)(Vl,{className:$.viewport,children:r.map(e=>(0,H.jsxs)(ql,{value:e.value,disabled:e.disabled,className:$.item,children:[(0,H.jsx)(Yl,{children:e.label}),(0,H.jsx)(Zl,{className:$.indicator,children:(0,H.jsx)(j,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]},e.value))}),(0,H.jsx)(tu,{className:$.scrollButton,children:(0,H.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]})})]}),t&&(0,H.jsx)(`span`,{id:f,className:$.hint,children:t})]})}),pu={toast:`_toast_c20vg_1`,icon:`_icon_c20vg_16`,frame:`_frame_c20vg_28`,copy:`_copy_c20vg_34`,title:`_title_c20vg_43`,line:`_line_c20vg_52`,description:`_description_c20vg_59`,close:`_close_c20vg_66`},mu=()=>()=>{},hu={duration:a.duration.fast,ease:[...a.ease.standard]},gu={duration:a.duration.standard,ease:[...a.ease.enter]},_u={opacity:0,y:`0.3em`,filter:`blur(${a.blur.soft}px)`},vu={opacity:0,y:`-0.3em`,filter:`blur(${a.blur.subtle}px)`,transition:hu},yu={opacity:1,y:`0em`,filter:`blur(0px)`},bu={opacity:0,transition:{duration:a.duration.instant}},xu={distance:80,velocity:480};function Su(e){let t=C();return(0,H.jsx)(P.span,{...e,"aria-hidden":!t||e[`aria-hidden`]})}function Cu({reduce:e,morphKey:t,children:n}){let r=(0,B.useRef)(null),i=(0,B.useRef)(null),o=ge(`auto`),s=(0,B.useRef)(0);return(0,B.useLayoutEffect)(()=>{s.current=performance.now()},[t]),(0,B.useEffect)(()=>{let t=i.current;if(!t||typeof ResizeObserver>`u`)return;let n,c,l=()=>{o.jump(`auto`),r.current&&Object.assign(r.current.style,{overflow:``,height:`auto`})},u=new ResizeObserver(([i])=>{let u=i.borderBoxSize?.[0]?.blockSize??t.offsetHeight,d=o.get(),f=typeof d==`number`?d:n;if(n=u,c?.stop(),e||f===void 0||f===u||performance.now()-s.current>120)return l();r.current&&Object.assign(r.current.style,{overflow:`hidden`,height:`${f}px`}),c=O(o,[f,u],{...a.spring.smooth,onComplete:l})});return u.observe(t),()=>{u.disconnect(),c?.stop()}},[o,e]),(0,H.jsx)(P.div,{ref:r,className:pu.frame,style:{height:o},children:(0,H.jsx)(`div`,{ref:i,className:pu.copy,children:n})})}function wu({title:e,description:t,open:n=!0,onOpenChange:r,duration:i=4500}){let o=pe(),s=(0,B.useSyncExternalStore)(mu,()=>!0,()=>!1),[c]=(0,B.useState)(s),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(0),[p,m]=(0,B.useState)(n);n!==p&&(m(n),n&&(u(!1),f(0)));let h=n&&!l,g=(0,B.useRef)(null),_=ge(0),v=(0,B.useRef)(0);function y(e){f(e),u(!0),r?.(!1)}(0,B.useEffect)(()=>{if(!h||!r||i<=0)return;let e=window.setTimeout(()=>{f(0),u(!0),r(!1)},i);return()=>window.clearTimeout(e)},[h,r,i]);function b(e,t){let n=Math.sign(t.offset.x||t.velocity.x);if(Math.abs(t.offset.x)<xu.distance&&Math.abs(t.velocity.x)<xu.velocity){O(_,0,{...a.spring.snappy,velocity:t.velocity.x});return}v.current=t.velocity.x,y(n*((g.current?.offsetWidth??320)+48))}let x=o?{hidden:{opacity:0},shown:{opacity:1,transition:{duration:a.duration.instant}},exit:bu}:{hidden:{opacity:0,x:0,y:16,scale:.96},shown:{opacity:1,x:0,y:0,scale:1,transition:{...a.spring.morph,opacity:gu}},exit:e=>e?{x:e,opacity:0,transition:{x:{type:`spring`,visualDuration:.3,bounce:0,velocity:v.current,restDelta:2,restSpeed:40},opacity:{duration:a.duration.exit}}}:{opacity:0,y:8,scale:.97,transition:{duration:a.duration.exit,ease:[...a.ease.standard]}}},S={initial:o?{opacity:0}:_u,animate:yu,exit:o?bu:vu,transition:o?{duration:a.duration.instant}:gu};return(0,H.jsx)(me,{initial:c,custom:d,children:h&&(0,H.jsxs)(P.div,{ref:g,className:pu.toast,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,custom:d,variants:x,initial:`hidden`,animate:`shown`,exit:`exit`,style:{x:_},drag:o&&s?!1:`x`,dragMomentum:!1,onDragEnd:b,children:[(0,H.jsx)(`span`,{className:pu.icon,"aria-hidden":`true`,children:(0,H.jsx)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.25,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,H.jsx)(P.path,{d:`M4 12.5l5 5L20 6.5`,initial:!o&&{pathLength:0},animate:{pathLength:1},transition:{duration:a.duration.standard,ease:[...a.ease.enter],delay:.12}})})}),(0,H.jsxs)(Cu,{reduce:o,morphKey:`${e}\n${t??``}`,children:[(0,H.jsx)(`strong`,{className:pu.title,children:(0,H.jsx)(me,{mode:`popLayout`,initial:!1,children:(0,H.jsx)(Su,{className:pu.line,...S,children:e},e)})}),(0,H.jsx)(me,{mode:`popLayout`,initial:!1,children:t?(0,H.jsx)(Su,{className:pu.description,...S,children:t},t):null})]}),(0,H.jsx)(`button`,{className:pu.close,type:`button`,"aria-label":`Dismiss notification`,onClick:()=>y(0),children:(0,H.jsx)(ee,{width:16,height:16,strokeWidth:2,"aria-hidden":`true`})})]},`toast`)})}function Tu({open:e,onOpenChange:t,title:n,description:r,children:i,footer:a,width:o=460}){return(0,H.jsx)(hi,{open:e,onOpenChange:t,children:(0,H.jsxs)(yi,{title:n,description:r,style:{width:`min(calc(100vw - 2rem), ${o}px)`},children:[i,a&&(0,H.jsx)(`div`,{className:re(`flex flex-wrap items-center justify-end gap-2`,i!==void 0&&`mt-6`),children:a})]})})}function Eu({label:e,icon:t,items:n,iconOnly:r}){return(0,H.jsx)(Kc,{label:e,icon:t,iconOnly:r,items:n.map(e=>({label:e.label,icon:e.icon,destructive:e.destructive,disabled:e.disabled,separatorBefore:e.separatorBefore,onSelect:e.onSelect}))})}var Du=`__astra_empty__`,Ou=e=>e===``?Du:e,ku=e=>e===Du?``:e,Au=12;function ju({value:e,onChange:t,options:n,placeholder:r,className:i,disabled:a,label:o,ariaLabel:s}){let c=ne(),l=n.find(t=>t.value===e),u=S(o,s??r??l?.label),d=re(`min-w-0`,u.hidden&&`astra-label-hidden`,i);return n.length>Au?(0,H.jsx)(`div`,{className:d,children:(0,H.jsx)(Mt,{label:u.label,description:u.field?.description,placeholder:r??c(`common.search`),emptyMessage:c(`common.noResults`),value:e==null?``:Ou(e),onValueChange:e=>t(ku(e)),options:n.map(e=>({value:Ou(e.value),label:e.detail&&e.detail!==e.label?`${e.label} · ${e.detail}`:e.label,disabled:e.disabled,keywords:e.detail?[e.detail]:void 0}))})}):(0,H.jsx)(`div`,{className:d,children:(0,H.jsx)(fu,{label:u.label,description:u.field?.description,placeholder:r??c(`common.select`),disabled:a,value:e==null||e===``&&!l?``:Ou(e),onValueChange:e=>t(ku(e)),options:n.map(e=>({value:Ou(e.value),label:e.label,disabled:e.disabled}))})})}var Mu=(0,B.createContext)(null);function Nu({children:e}){let t=ne(),[n,r]=(0,B.useState)([]),[i,a]=(0,B.useState)(null),o=(0,B.useRef)(0),s=(0,B.useCallback)(e=>r(t=>t.filter(t=>t.id!==e)),[]),c=(0,B.useCallback)((e,t=`info`)=>{let n=++o.current;r(r=>[...r.slice(-2),{id:n,tone:t,text:e}]),t===`error`&&setTimeout(()=>s(n),8e3)},[s]),l=(0,B.useCallback)(e=>new Promise(t=>a({...e,resolve:t})),[]),u=e=>{i?.resolve(e),a(null)};return(0,H.jsxs)(Mu.Provider,{value:{toast:c,confirm:l},children:[e,(0,H.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-5 z-[95] flex flex-col items-center gap-2 px-4`,children:n.map(e=>e.tone===`error`?(0,H.jsx)(`div`,{className:`pointer-events-auto w-[min(100%,26rem)] selectable`,children:(0,H.jsx)(ue,{tone:`danger`,title:t(`common.error`),onDismiss:()=>s(e.id),children:e.text})},e.id):(0,H.jsx)(`div`,{className:`pointer-events-auto flex w-full justify-center`,children:(0,H.jsx)(wu,{title:e.text,open:!0,onOpenChange:t=>!t&&s(e.id)})},e.id))}),(0,H.jsx)(Tu,{open:i!==null,onOpenChange:e=>!e&&u(!1),title:i?.title??``,description:i?.detail,width:420,footer:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(se,{onClick:()=>u(!1),children:t(`common.cancel`)}),(0,H.jsx)(se,{variant:i?.destructive?`destructive`:`primary`,onClick:()=>u(!0),autoFocus:!0,children:i?.confirmLabel??t(`common.confirm`)})]})})]})}function Pu(){let e=(0,B.useContext)(Mu);if(!e)throw Error(`useFeedback outside FeedbackProvider`);return e}function Fu(e){return e instanceof Error?e.message:String(e)}export{Ge as $,xt as A,pt as B,_n as C,Ot as D,kt as E,tt as F,Ke as G,_t as H,nt as I,Ze as J,qe as K,mt as L,Ct as M,at as N,yt as O,et as P,Je as Q,gt as R,Lo as S,At as T,ht as U,ot as V,it as W,Ve as X,Qe as Y,Ye as Z,xs as _,Fu as a,Fe as at,Ho as b,Fc as c,De as ct,Vc as d,Se as dt,Ie as et,Uc as f,vs as g,Lc as h,Tu as i,Be as it,St as j,bt as k,Hc as l,Ee as lt,Wc as m,Eu as n,Le as nt,Pu as o,ze as ot,Rc as p,$e as q,ju as r,Re as rt,nl as s,Oe as st,Nu as t,Me as tt,Bc as u,we as ut,ps as v,Vt as w,Ko as x,Bo as y,ft as z};
@@ -1 +1 @@
1
- import{xt as e}from"./alert-CuKAE1Sv.js";var t={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};t.node;var n=e(t);export{n as t};
1
+ import{xt as e}from"./alert-BKRTQ9va.js";var t={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};t.node;var n=e(t);export{n as t};
@@ -1 +1 @@
1
- import{xt as e}from"./alert-CuKAE1Sv.js";var t={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};t.node;var n=e(t);export{n as t};
1
+ import{xt as e}from"./alert-BKRTQ9va.js";var t={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};t.node;var n=e(t);export{n as t};
@@ -0,0 +1 @@
1
+ import{E as e,_a as t,ga as n,lo as r,po as i,uo as a,va as o,xt as s,ya as c}from"./alert-BKRTQ9va.js";var l={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]};l.node;var u=s(l),d=i(a(),1),f={root:`_root_1ha3b_1`,ring:`_ring_1ha3b_16`,card:`_card_1ha3b_26`,label:`_label_1ha3b_46`,meta:`_meta_1ha3b_46`,indicator:`_indicator_1ha3b_48`,indicatorDot:`_indicatorDot_1ha3b_61`,body:`_body_1ha3b_64`,labelText:`_labelText_1ha3b_66`,icon:`_icon_1ha3b_67`,description:`_description_1ha3b_70`},p=r(),m=[...e.ease.standard],h=((e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}})(.42,.14),g=()=>()=>{};function _(){let e=(0,d.useSyncExternalStore)(g,()=>!0,()=>!1);return!!o()&&e}var v=(0,d.forwardRef)(function({options:r,value:i,defaultValue:a=null,onValueChange:o,layout:s=`grid`,density:l=`default`,minColumnWidth:u=180,name:g,required:v,disabled:y=!1,className:b,style:x,...S},C){let w=l===`compact`,T=_(),E=(0,d.useId)().replace(/[^a-zA-Z0-9_-]/g,``),D=(0,d.useRef)(null);(0,d.useImperativeHandle)(C,()=>D.current);let[O,k]=(0,d.useState)(a),A=i===void 0?O:i,j=r.findIndex(e=>e.value===A),M=e=>!y&&!e.disabled,N=j>=0&&M(r[j])?j:r.findIndex(M),P=e=>{e!==A&&(i===void 0&&k(e),o?.(e))},F=c(0),I=c(0),L=c(0),R=c(0),z=c(0),B=(0,d.useRef)(!1),V=(0,d.useCallback)(n=>{let r=j<0?null:D.current?.querySelector(`[data-card="${j}"]`);if(!r){z.set(0),B.current=!1;return}let i=[r.offsetLeft,r.offsetTop,r.offsetWidth,r.offsetHeight];if(!n||!B.current||T){F.jump(i[0]),I.jump(i[1]),L.jump(i[2]),R.jump(i[3]),!B.current&&!T&&n?(z.jump(0),t(z,1,{duration:e.duration.fast,ease:m})):z.jump(1),B.current=!0;return}t(F,i[0],h),t(I,i[1],h),t(L,i[2],h),t(R,i[3],h),z.set(1)},[R,z,T,j,L,F,I]),H=(0,d.useRef)(V);(0,d.useLayoutEffect)(()=>{H.current=V,V(!0)},[V]),(0,d.useLayoutEffect)(()=>{let e=D.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>H.current(!1));return t.observe(e),()=>t.disconnect()},[]);let U=()=>Array.from(D.current?.querySelectorAll(`[data-card]`)??[]),W=(e,t)=>{let n=e.key===`ArrowRight`||e.key===`ArrowDown`?1:e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:0;if(e.key===` `||e.key===`Enter`){e.preventDefault(),M(r[t])&&P(r[t].value);return}if(!n&&e.key!==`Home`&&e.key!==`End`)return;e.preventDefault();let i=r.length,a=n&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&getComputedStyle(e.currentTarget).direction===`rtl`?-1:1,o=e.key===`Home`?-1:e.key===`End`?i:t,s=e.key===`Home`?1:e.key===`End`?-1:n*a;for(let e=0;e<i;e++)if(o=(o+s+i)%i,M(r[o])){U()[o]?.focus(),P(r[o].value);return}};return(0,p.jsxs)(`div`,{ref:D,role:`radiogroup`,"aria-disabled":y||void 0,"aria-required":v||void 0,className:[f.root,b].filter(Boolean).join(` `),"data-layout":s,"data-density":l,style:{"--min-column":`${u}px`,...x},...S,children:[(0,p.jsx)(n.span,{className:f.ring,style:{x:F,y:I,width:L,height:R,opacity:z},"aria-hidden":`true`}),r.map((t,r)=>{let i=r===j,a=!M(t),o=`${E}-${r}-label`,s=`${E}-${r}-description`,c=a&&t.disabledReason?t.disabledReason:t.description,l=t.icon&&(0,p.jsx)(`span`,{className:f.icon,children:t.icon});return(0,p.jsxs)(`div`,{role:`radio`,"data-card":r,className:f.card,"aria-checked":i,"aria-disabled":a||void 0,"aria-labelledby":o,"aria-describedby":c?s:void 0,tabIndex:r===N?0:-1,"data-checked":i||void 0,onClick:()=>{a||P(t.value)},onKeyDown:e=>W(e,r),children:[w?l:(0,p.jsx)(`span`,{className:f.indicator,"aria-hidden":`true`,children:(0,p.jsx)(n.span,{className:f.indicatorDot,initial:!1,animate:{scale:+!!i},transition:T?{duration:0}:e.spring.snappy})}),(0,p.jsxs)(`span`,{className:f.body,children:[(0,p.jsxs)(`span`,{id:o,className:f.label,children:[!w&&l,(0,p.jsx)(`span`,{className:f.labelText,children:t.label})]}),c&&(0,p.jsx)(`span`,{id:s,className:f.description,children:c})]}),t.meta&&(0,p.jsx)(`span`,{className:f.meta,children:t.meta})]},t.value)}),g&&(0,p.jsx)(`input`,{type:`hidden`,name:g,value:A??``,required:v})]})});export{u as n,v as t};
@@ -1 +1 @@
1
- import{xt as e}from"./alert-CuKAE1Sv.js";var t={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};t.node;var n=e(t);export{n as t};
1
+ import{xt as e}from"./alert-BKRTQ9va.js";var t={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};t.node;var n=e(t);export{n as t};
@@ -1,4 +1,4 @@
1
- import{Ba as e,Gi as t,Ua as n,xt as r}from"./alert-CuKAE1Sv.js";var i={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};i.node;var a=r(i),o=n(t()),s=n(e());function c(){var e=[...arguments];return(0,s.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var l=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function u(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function d(e){return`nodeType`in e}function f(e){return e?u(e)?e:d(e)?e.ownerDocument?.defaultView??window:window:window}function p(e){let{Document:t}=f(e);return e instanceof t}function m(e){return!u(e)&&e instanceof f(e).HTMLElement}function h(e){return e instanceof f(e).SVGElement}function g(e){return e?u(e)?e.document:d(e)?p(e)?e:m(e)||h(e)?e.ownerDocument:document:document:document}var _=l?s.useLayoutEffect:s.useEffect;function v(e){let t=(0,s.useRef)(e);return _(()=>{t.current=e}),(0,s.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function y(){let e=(0,s.useRef)(null);return[(0,s.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,s.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function b(e,t){t===void 0&&(t=[e]);let n=(0,s.useRef)(e);return _(()=>{n.current!==e&&(n.current=e)},t),n}function x(e,t){let n=(0,s.useRef)();return(0,s.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function S(e){let t=v(e),n=(0,s.useRef)(null);return[n,(0,s.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function C(e){let t=(0,s.useRef)();return(0,s.useEffect)(()=>{t.current=e},[e]),t.current}var w={};function T(e,t){return(0,s.useMemo)(()=>{if(t)return t;let n=w[e]==null?0:w[e]+1;return w[e]=n,e+`-`+n},[e,t])}function E(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var D=E(1),O=E(-1);function k(e){return`clientX`in e&&`clientY`in e}function A(e){if(!e)return!1;let{KeyboardEvent:t}=f(e.target);return t&&e instanceof t}function j(e){if(!e)return!1;let{TouchEvent:t}=f(e.target);return t&&e instanceof t}function ee(e){if(j(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return k(e)?{x:e.clientX,y:e.clientY}:null}var te=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[te.Translate.toString(e),te.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ne=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function M(e){return e.matches(ne)?e:e.querySelector(ne)}var re={display:`none`};function N(e){let{id:t,value:n}=e;return s.createElement(`div`,{id:t,style:re},n)}function ie(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return s.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ae(){let[e,t]=(0,s.useState)(``);return{announce:(0,s.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var oe=(0,s.createContext)(null);function P(e){let t=(0,s.useContext)(oe);(0,s.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function F(){let[e]=(0,s.useState)(()=>new Set),t=(0,s.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,s.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var I={draggable:`
1
+ import{ha as e,po as t,uo as n,xt as r}from"./alert-BKRTQ9va.js";var i={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};i.node;var a=r(i),o=t(e()),s=t(n());function c(){var e=[...arguments];return(0,s.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var l=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function u(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function d(e){return`nodeType`in e}function f(e){return e?u(e)?e:d(e)?e.ownerDocument?.defaultView??window:window:window}function p(e){let{Document:t}=f(e);return e instanceof t}function m(e){return!u(e)&&e instanceof f(e).HTMLElement}function h(e){return e instanceof f(e).SVGElement}function g(e){return e?u(e)?e.document:d(e)?p(e)?e:m(e)||h(e)?e.ownerDocument:document:document:document}var _=l?s.useLayoutEffect:s.useEffect;function v(e){let t=(0,s.useRef)(e);return _(()=>{t.current=e}),(0,s.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function y(){let e=(0,s.useRef)(null);return[(0,s.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,s.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function b(e,t){t===void 0&&(t=[e]);let n=(0,s.useRef)(e);return _(()=>{n.current!==e&&(n.current=e)},t),n}function x(e,t){let n=(0,s.useRef)();return(0,s.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function S(e){let t=v(e),n=(0,s.useRef)(null);return[n,(0,s.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function C(e){let t=(0,s.useRef)();return(0,s.useEffect)(()=>{t.current=e},[e]),t.current}var w={};function T(e,t){return(0,s.useMemo)(()=>{if(t)return t;let n=w[e]==null?0:w[e]+1;return w[e]=n,e+`-`+n},[e,t])}function E(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var D=E(1),O=E(-1);function k(e){return`clientX`in e&&`clientY`in e}function A(e){if(!e)return!1;let{KeyboardEvent:t}=f(e.target);return t&&e instanceof t}function j(e){if(!e)return!1;let{TouchEvent:t}=f(e.target);return t&&e instanceof t}function ee(e){if(j(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return k(e)?{x:e.clientX,y:e.clientY}:null}var te=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[te.Translate.toString(e),te.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ne=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function M(e){return e.matches(ne)?e:e.querySelector(ne)}var re={display:`none`};function N(e){let{id:t,value:n}=e;return s.createElement(`div`,{id:t,style:re},n)}function ie(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return s.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ae(){let[e,t]=(0,s.useState)(``);return{announce:(0,s.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var oe=(0,s.createContext)(null);function P(e){let t=(0,s.useContext)(oe);(0,s.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function F(){let[e]=(0,s.useState)(()=>new Set),t=(0,s.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,s.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var I={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -7,12 +7,12 @@
7
7
  <link rel="icon" type="image/png" href="/favicon.png" />
8
8
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
9
9
  <title>Astra</title>
10
- <script type="module" crossorigin src="/assets/index-CKrvKDIJ.js"></script>
11
- <link rel="modulepreload" crossorigin href="/assets/alert-CuKAE1Sv.js">
12
- <link rel="modulepreload" crossorigin href="/assets/overlays-DeHu6TU_.js">
10
+ <script type="module" crossorigin src="/assets/index-Cj8lNw6g.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/assets/alert-BKRTQ9va.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/overlays-CizKmvVN.js">
13
13
  <link rel="stylesheet" crossorigin href="/assets/alert-DwSJjne8.css">
14
14
  <link rel="stylesheet" crossorigin href="/assets/overlays-BJrN5PWt.css">
15
- <link rel="stylesheet" crossorigin href="/assets/index-CpGX4nAj.css">
15
+ <link rel="stylesheet" crossorigin href="/assets/index-8z9hfQDF.css">
16
16
  </head>
17
17
  <body>
18
18
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidotnet/server-darwin-arm64",
3
- "version": "0.14.3101",
3
+ "version": "0.14.3103",
4
4
  "description": "Astra self-contained server binary for macOS (Apple silicon).",
5
5
  "license": "MIT",
6
6
  "os": [
@@ -1,9 +0,0 @@
1
- import{Ba as e,Dr as t,Et as n,Fr as r,G as i,Gt as a,H as o,Ht as s,Ir as c,Jt as l,K as u,Kt as d,Mr as f,Qn as p,Ra as m,Ua as h,Ut as g,Vr as ee,Vt as _,Xt as v,Y as y,Yt as b,_ as x,ai as S,ar as C,bn as te,bt as w,c as T,ct as E,d as ne,dt as D,gn as re,gt as ie,lr as ae,m as O,mn as oe,n as k,ot as A,r as j,s as se,t as M,u as N,v as P,vr as ce,xt as F,y as I,za as L}from"./alert-CuKAE1Sv.js";import{a as R,ct as z,i as le,o as B,r as V,st as ue}from"./overlays-DeHu6TU_.js";import{n as H}from"./ProvidersPage-BwigLnKs.js";import{t as de}from"./download-DR9BLMVt.js";import{t as fe}from"./external-link-Bb6sx3jt.js";import{t as pe}from"./folder-open-Bcx5mAII.js";import{a as me,c as U,d as W,f as he,i as G,l as K,n as ge,o as _e,p as q,r as ve,s as ye,t as be,u as xe}from"./sortable.esm-CO34h2h7.js";import{t as Se}from"./rotate-ccw-DsmSscuv.js";import{$ as Ce,B as we,H as Te,P as Ee,R as J,S as Y,U as De,V as Oe,Z as ke,b as Ae,et as je,h as Me,v as Ne,x as Pe,z as Fe}from"./index-CKrvKDIJ.js";var Ie={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Ie.node;var Le=F(Ie),Re={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Re.node;var ze=F(Re),Be={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};Be.node;var Ve=F(Be),X=h(e(),1),Z=L(),He=`astra claude`;function Ue(e){return e.reduce((e,t)=>({requests:e.requests+1,inputTokens:e.inputTokens+t.inputTokens,totalInputTokens:e.totalInputTokens+t.inputTokens+t.cacheReadTokens+t.cacheCreationTokens,outputTokens:e.outputTokens+t.outputTokens,failed:e.failed+ +(t.status===`error`),estimatedCostNanoUsd:e.estimatedCostNanoUsd+(t.estimatedCostNanoUsd??0)}),{requests:0,inputTokens:0,totalInputTokens:0,outputTokens:0,failed:0,estimatedCostNanoUsd:0})}var We=e=>e.status===`active`&&e.enabled;function Ge(e,t){let n=[e.name||e.id,e.email?`· ${e.email}`:null,e.plan?`· ${e.plan}`:null].filter(Boolean).join(` `);return We(e)?n:`${n} · ${t}`}function Ke({enabled:e,gatewayEnabled:t}){let{t:n}=E(),{toast:r}=B(),i=Ce(),o=a(e),s=f(),[c,l]=(0,X.useState)(null),u=o.data?.mode??`gateway`,p=o.data?.accounts??[],m=o.data?.accountId??null??p.find(We)?.id??null,h=p.find(e=>e.id===m),g=u===`direct`,ee=t&&(g||o.data!=null),_=g&&h?.telemetryEnabled===!0,v=d(_?h?.id:null,_),y=s.isPending,b=e=>s.mutate(e,{onError:e=>r(R(e),`error`)});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:n(`clients.claudeDirect.modeTitle`),footer:n(`clients.claudeDirect.modeFooter`),children:[(0,Z.jsx)(O,{label:n(`clients.claudeDirect.mode`),detail:n(g?`clients.claudeDirect.directDetail`:`clients.claudeDirect.gatewayDetail`),children:(0,Z.jsx)(x,{ariaLabel:n(`clients.claudeDirect.mode`),value:u,onChange:e=>{if(e===u||y||!o.data)return;let t=m??p.find(We)?.id??null;if(e===`direct`&&!t){r(n(`clients.claudeDirect.needAccountToast`),`error`);return}b({mode:e,accountId:t})},items:[{value:`gateway`,label:n(`clients.claudeDirect.gateway`)},{value:`direct`,label:n(`clients.claudeDirect.direct`)}]})}),(0,Z.jsx)(`p`,{className:`px-4 pb-2 text-[11px] text-[var(--text-muted)]`,children:n(`clients.claudeDirect.modeNote`)})]}),o.isLoading&&(0,Z.jsx)(P,{lines:3}),o.isError&&(0,Z.jsx)(`div`,{className:`mb-5`,children:(0,Z.jsx)(M,{tone:`danger`,title:n(`clients.claudeDirect.loadFailed`),children:R(o.error)})}),ee&&(0,Z.jsx)(`div`,{className:`mb-5`,children:(0,Z.jsx)(M,{tone:`warning`,title:n(`clients.claudeDirect.gatewayOnTitle`),children:n(`clients.claudeDirect.gatewayOnDetail`)})}),o.data&&(0,Z.jsx)(N,{title:n(`clients.claudeDirect.accountsTitle`),footer:n(`clients.claudeDirect.accountsFooter`),children:p.length===0?(0,Z.jsx)(T,{title:n(`clients.claudeDirect.noAccount`),detail:n(`clients.claudeDirect.noAccountDetail`),action:(0,Z.jsx)(j,{variant:`primary`,onClick:()=>i(`/providers`),children:n(`clients.claudeDirect.goProviders`)})}):(0,Z.jsx)(O,{label:n(`clients.claudeDirect.account`),children:(0,Z.jsx)(V,{className:`max-w-[300px]`,ariaLabel:n(`clients.claudeDirect.account`),value:m,onChange:e=>{y||e===m||b({mode:u,accountId:e})},options:p.map(e=>({value:e.id,label:Ge(e,n(`clients.claudeDirect.accountDisabledSuffix`,{status:n(`providers.subscription.status.${e.status}`)})),disabled:!We(e)}))})})}),o.data&&g&&h&&(0,Z.jsx)(N,{title:n(`clients.claudeDirect.launchTitle`),footer:n(`clients.claudeDirect.launchNote`),children:(0,Z.jsx)(qe,{command:He,copied:c,onCopy:async e=>{await z.copy(e)&&(l(e),r(n(`common.copied`)))}})}),o.data&&g&&h&&(0,Z.jsxs)(N,{title:n(`clients.claudeDirect.statsTitle`),footer:n(`clients.claudeDirect.statsFooter`),children:[(0,Z.jsx)(O,{label:n(`clients.claudeDirect.statsConsent`),detail:n(`clients.claudeDirect.statsConsentDetail`),children:(0,Z.jsx)(I,{label:n(`clients.claudeDirect.statsConsent`),checked:h.telemetryEnabled,disabled:y,onChange:e=>{h&&!y&&b({mode:u,accountId:h.id,telemetryEnabled:e})}})}),_&&(0,Z.jsx)(Je,{requests:v})]})]})}function qe({command:e,copied:t,onCopy:n}){let{t:r}=E();return(0,Z.jsx)(O,{label:(0,Z.jsx)(`span`,{className:`font-mono text-[12px] break-all selectable`,children:e}),children:(0,Z.jsx)(j,{size:`sm`,icon:(0,Z.jsx)(ie,{className:`size-3`}),variant:t===e?`primary`:`glass`,"aria-label":r(`common.copy`),title:r(`common.copy`),onClick:()=>void n(e),children:r(t===e?`common.copied`:`common.copy`)})})}function Je({requests:e}){let{t,locale:n}=E(),r=e.data??[],a=Ue(r);return e.isLoading?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(P,{lines:3})}):e.isError?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(M,{tone:`danger`,title:t(`clients.claudeDirect.statsFailed`),children:R(e.error)})}):r.length===0?(0,Z.jsx)(T,{icon:(0,Z.jsx)(Te,{className:`size-6`}),title:t(`clients.claudeDirect.statsEmpty`),detail:t(`clients.claudeDirect.statsEmptyDetail`)}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O,{label:t(`clients.claudeDirect.statsTotals`,{count:y(a.requests)}),detail:t(`clients.claudeDirect.statsInDetail`,{input:y(a.totalInputTokens),cache:y(r.reduce((e,t)=>e+t.cacheReadTokens,0)),output:y(a.outputTokens)})}),(0,Z.jsx)(O,{label:t(`clients.claudeDirect.statsCost`),detail:t(`clients.claudeDirect.statsCostDetail`),children:(0,Z.jsx)(`span`,{className:`num text-[13px]`,children:u(r.some(e=>e.estimatedCostNanoUsd!=null)?a.estimatedCostNanoUsd:null)})}),a.failed>0&&(0,Z.jsx)(O,{label:t(`clients.claudeDirect.statsFailedCount`,{count:y(a.failed)}),children:(0,Z.jsx)(k,{tone:`red`,children:t(`clients.claudeDirect.statusError`)})}),r.map(e=>(0,Z.jsx)(O,{label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.model}),e.status===`error`?(0,Z.jsx)(k,{tone:`red`,children:t(`clients.claudeDirect.statusError`)}):(0,Z.jsx)(k,{tone:`green`,children:t(`status.success`)})]}),detail:(0,Z.jsx)(`span`,{className:`num`,children:[o(e.occurredAtUtc,n),t(`clients.claudeDirect.tokensDetail`,{input:y(e.inputTokens),output:y(e.outputTokens)}),e.durationMs==null?null:i(e.durationMs),e.accountUuid??null].filter(Boolean).join(` · `)}),children:(0,Z.jsx)(`span`,{className:`num text-[13px]`,children:u(e.estimatedCostNanoUsd)})},e.id))]})}function Ye({descriptors:e,values:t,onChange:n,enabled:r}){let{t:i}=E(),a=(e,r)=>{let i={...t};r===void 0||r===!1||r===0||r==="default"||r===``?delete i[e]:i[e]=r,n(i)};return(0,Z.jsx)(N,{title:i(`clients.options.title`),footer:i(r?`clients.options.footerEnabled`:`clients.options.footer`),children:e.map(e=>{let n=i(`clients.option.${e.key}`),r=i(`clients.option.${e.key}.hint`),o=t[e.key];return(0,Z.jsxs)(O,{label:n,detail:r,children:[e.type===`bool`&&(0,Z.jsx)(I,{label:n,checked:o===!0,onChange:t=>a(e.key,t)}),e.type===`int`&&(0,Z.jsx)(ne,{className:`w-36`,mono:!0,inputMode:`numeric`,"aria-label":n,placeholder:i(`clients.options.unset`),value:typeof o==`number`?String(o):``,onChange:t=>{let n=Number.parseInt(t.target.value.replace(/\D/g,``),10);a(e.key,Number.isFinite(n)?n:void 0)}}),e.type===`enum`&&(0,Z.jsx)(V,{ariaLabel:n,value:typeof o==`string`?o:`default`,onChange:t=>a(e.key,t),options:(e.choices??[]).map(e=>({value:e,label:i(`clients.optionChoice.${e}`)})),className:`w-36`})]},e.key)})})}var Xe=[`openai-chat`,`openai-responses`,`anthropic`,`gemini`],Ze=e=>typeof e==`string`&&Xe.includes(e);function Qe(e){let t=e?.protocolOverrides,n={};if(!t||typeof t!=`object`)return n;for(let[e,r]of Object.entries(t))Ze(r)&&(n[e]=r);return n}function $e(e){let t=e?.models;if(!t||typeof t!=`object`)return[];let n=[];for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let t=e;typeof t.id==`string`&&t.id&&!n.some(e=>e.id===t.id)&&n.push({id:t.id,name:typeof t.name==`string`&&t.name?t.name:t.id,native:Array.isArray(t.protocols)?t.protocols.filter(Ze):[]})}return n}function et(e,t){let n=e.native.find(e=>t.includes(e));return n?{protocol:n,translated:!1}:{protocol:t[0],translated:!0}}var tt=e=>Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`
2
- `),nt=`auto`,rt=e=>H.find(t=>t.value===e)?.label??e;function it({models:e,supported:t,values:n,onChange:r,enabled:i}){let{t:a}=E(),o=(e,t)=>{let i={...n};t===nt?delete i[e]:i[e]=t,r(i)};return(0,Z.jsx)(N,{title:a(`clients.protocols.title`),footer:a(i?`clients.protocols.footerEnabled`:`clients.protocols.footer`),children:e.map(e=>{let r=et(e,t),i=e.native.filter(e=>t.includes(e));return(0,Z.jsx)(O,{label:e.name,detail:i.length>0?a(`clients.protocols.native`,{protocols:i.map(rt).join(` · `)}):a(`clients.protocols.noNative`),children:(0,Z.jsx)(V,{ariaLabel:e.name,className:`w-60`,value:n[e.id]&&t.includes(n[e.id])?n[e.id]:nt,onChange:t=>o(e.id,t),options:[{value:nt,label:a(r.translated?`clients.protocols.autoTranslated`:`clients.protocols.auto`,{protocol:rt(r.protocol)})},...t.map(e=>({value:e,label:rt(e)}))]})},e.id)})})}function at(e,t){let n=e?.options,r={};if(!n||typeof n!=`object`)return r;for(let e of t??[]){let t=n[e.key];e.type===`bool`&&t===!0?r[e.key]=!0:(e.type===`int`&&typeof t==`number`&&t>0||e.type===`enum`&&typeof t==`string`&&t!=="default"&&e.choices?.includes(t))&&(r[e.key]=t)}return r}var ot=e=>Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`
3
- `),st=[`ANTHROPIC_MODEL`,`ANTHROPIC_DEFAULT_FABLE_MODEL`,`ANTHROPIC_DEFAULT_OPUS_MODEL`,`ANTHROPIC_DEFAULT_SONNET_MODEL`,`ANTHROPIC_DEFAULT_HAIKU_MODEL`];function ct(e){let t=e?.models,n={};if(!t||typeof t!=`object`)return n;for(let e of st){let r=t[e];typeof r==`string`&&r.trim()&&(n[e]=r.trim())}return n}var lt=e=>st.map(t=>e[t]??``).join(`
4
- `),Q=[`sonnet`,`opus`,`haiku`];function ut(e){let t=e?.roleMap,n={};if(!t||typeof t!=`object`)return n;for(let e of Q){let r=t[e];typeof r==`string`&&r.trim()&&(n[e]=r.trim())}return n}var $=e=>Q.map(t=>e[t]??``).join(`
5
- `),dt=/(^|[-_.:/\s])(haiku|flash|mini|lite|nano|small|fast|air)($|[-_.:/\s])/i;function ft(e){if(e.length===0)return{};let t=t=>e.find(e=>e.toLowerCase().includes(t)),n=e.find(e=>!dt.test(e))??e[0],r=e.find(e=>dt.test(e))??n;return{sonnet:t(`sonnet`)??n,opus:t(`opus`)??t(`sonnet`)??n,haiku:t(`haiku`)??r}}function pt(){let{t:e}=E(),t=Ce(),{toast:n}=B(),r=je(),i=v(),a=g(),o=(0,X.useMemo)(()=>new Map((i.data??[]).map(e=>[e.kind,e])),[i.data]),s=ht(i.data).includes(r.kind)?r.kind:`codex`,c=o.get(s);return(0,X.useEffect)(()=>a.mutate(!1),[]),(0,Z.jsx)(Me,{title:e(`nav.clients`),subtitle:e(`clients.subtitle`),actions:(0,Z.jsx)(j,{icon:(0,Z.jsx)(Fe,{className:`size-3.5`}),loading:a.isPending,onClick:()=>a.mutate(!0,{onSuccess:t=>{let r=t.filter(e=>e.install?.updateAvailable&&e.install.blocker!==`shadowed`).length;n(r>0?e(`clients.updatesFound`,{count:r}):e(`clients.allUpToDate`),r>0?void 0:`success`)},onError:e=>n(R(e),`error`)}),children:e(`clients.checkUpdates`)}),children:(0,Z.jsx)(`div`,{className:`@container mx-auto max-w-[1200px]`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start @3xl:gap-5`,children:[(0,Z.jsx)(bt,{clients:i.data,loading:i.isLoading,selected:s,onSelect:e=>t(`/clients/${e}`,{replace:!0})}),(0,Z.jsxs)(`div`,{className:`mx-auto w-full max-w-[760px] min-w-0 flex-1`,children:[i.isLoading&&(0,Z.jsx)(P,{lines:4}),i.isError&&(0,Z.jsx)(M,{tone:`danger`,title:e(`common.error`),children:R(i.error)}),c&&(0,Z.jsx)(wt,{client:c})]})]})})})}var mt=new Set([`opencode`,`pi`,`minimax-code`,`copilot-cli`,`vscode-copilot`,`crush`,`qwen-code`,`droid`,`kimi-code`,`zed`,`vscode-insiders`,`vscodium`,`omp`,`mimo-code`,`deepseek-harness`,`workbuddy`,`workbuddy-ai`,`nextcowork`,`paseo`,`zcode`,`tkcode`,`muse-code`,`codex`,`grok-build`,`hermes-agent`]);function ht(e){let t=(e??[]).filter(e=>!Ne.includes(e.kind)).sort((e,t)=>e.name.localeCompare(t.name));return[...Ne,...t.map(e=>e.kind)]}var gt=[`installed`,`notInstalled`,`comingSoon`],_t=new Set([`notInstalled`]);function vt(e){return e.availability===`coming_soon`?`comingSoon`:e.detection.installed||e.enabled||e.install?.installed?`installed`:`notInstalled`}function yt(e){return e.install?.version??e.detection.version??null}function bt({clients:e,loading:t,selected:n,onSelect:r}){let{t:i}=E(),[a,o]=(0,X.useState)(new Set),s=new Map((e??[]).map(e=>[e.kind,e])),c=gt.map(t=>({group:t,items:ht(e).flatMap(e=>{let n=s.get(e);return n&&vt(n)===t?[n]:[]})})).filter(e=>e.items.length>0);return(0,Z.jsxs)(`nav`,{"aria-label":i(`nav.clients`),className:`card shrink-0 p-1.5 @3xl:sticky @3xl:top-0 @3xl:w-[232px]`,children:[t&&(0,Z.jsx)(P,{lines:6,className:`p-2`}),(0,Z.jsx)(`div`,{className:`flex gap-1 overflow-x-auto @3xl:flex-col @3xl:gap-0 @3xl:overflow-visible`,children:c.map(({group:e,items:t})=>{let s=_t.has(e),c=!s||a.has(e)||t.some(e=>e.kind===n),l=`${i(`clients.group.${e}`)} · ${t.length}`;return(0,Z.jsxs)(`div`,{className:`contents @3xl:block`,children:[s?(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-label":i(c?`clients.group.collapse`:`clients.group.expand`,{group:l}),onClick:()=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),className:`flex shrink-0 items-center gap-1 rounded-[var(--radius-control)] px-2.5 py-1.5 text-[11px] font-medium whitespace-nowrap text-[var(--text-muted)] hover:bg-[var(--surface-muted)] @3xl:w-full @3xl:pt-2 @3xl:pb-1`,children:[(0,Z.jsx)(De,{size:12,className:A(`transition-transform`,c&&`rotate-90`)}),l]}):(0,Z.jsx)(`h3`,{className:`hidden px-2.5 pt-2 pb-1 text-[11px] font-medium text-[var(--text-muted)] @3xl:block`,children:l}),c&&t.map(e=>(0,Z.jsx)(xt,{client:e,active:e.kind===n,onSelect:()=>r(e.kind)},e.kind))]},e)})})]})}function xt({client:e,active:t,onSelect:n}){let{t:r}=E(),i=vt(e)!==`installed`,a=yt(e),o=e.install?.blocker===`shadowed`,s=e.install?.updateAvailable&&!o?e.install.latestVersion:null;return(0,Z.jsxs)(`button`,{type:`button`,"aria-label":Y(e.kind,e.name),"aria-current":t?`page`:void 0,onClick:n,className:A(`flex shrink-0 items-center gap-2.5 rounded-[var(--radius-control)] px-2.5 py-1.5 text-left transition-colors @3xl:w-full`,t?`bg-[var(--accent-subtle)]`:`hover:bg-[var(--surface-muted)]`),children:[(0,Z.jsx)(`span`,{className:A(`inline-flex`,i&&!t&&`opacity-60`),children:(0,Z.jsx)(Ae,{kind:e.kind,size:24})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:A(`block truncate text-[13px] whitespace-nowrap`,t&&`font-medium`),children:Y(e.kind,e.name)}),a&&(0,Z.jsxs)(`span`,{className:`hidden truncate text-[11px] text-[var(--text-secondary)] @3xl:block`,children:[a,s&&(0,Z.jsxs)(`span`,{className:`text-[var(--warning)]`,children:[` → `,s]})]})]}),e.install?.busy&&(0,Z.jsx)(St,{}),s&&!e.install?.busy&&(0,Z.jsx)(k,{tone:`orange`,title:r(`clients.updateTo`,{version:s}),children:r(`clients.updateBadge`)}),o&&!e.install?.busy&&(0,Z.jsx)(k,{tone:`orange`,title:r(`clients.shadowed.title`,{version:e.install?.latestVersion??``}),children:r(`clients.shadowedBadge`)}),e.status===`drifted`?(0,Z.jsx)(`span`,{title:r(`clients.drifted`),"aria-label":r(`clients.drifted`),className:`inline-flex`,children:(0,Z.jsx)(se,{tone:`orange`})}):e.enabled?(0,Z.jsx)(w,{className:`size-3.5 shrink-0 text-[var(--success)]`,strokeWidth:2.5,"aria-label":r(`clients.enabled`)}):null]})}function St(){return(0,Z.jsx)(Oe,{className:`size-3.5 shrink-0 animate-spin text-[var(--text-secondary)] motion-reduce:animate-none`,"aria-hidden":!0})}function Ct(e,t){return e.availability===`coming_soon`?(0,Z.jsx)(k,{children:t(`clients.comingSoon`)}):e.status===`drifted`?(0,Z.jsx)(k,{tone:`orange`,children:t(`clients.drifted`)}):e.enabled?(0,Z.jsx)(k,{tone:`green`,children:t(`clients.enabled`)}):(0,Z.jsx)(k,{children:t(`clients.disabled`)})}function wt({client:e}){let{t,locale:n}=E(),i=Ce(),{toast:s,confirm:c}=B(),l=ae(),u=r(),d=oe(),f=te(),p=ce(),m=S(),h=b(e.kind,!!e.providerId),[g,ee]=(0,X.useState)(e.selectedModel??null),[_,v]=(0,X.useState)(e.accountId??``),y=e.tokenId??`default`,[x,w]=(0,X.useState)(y),T=(m.data??[]).filter(e=>e.enabled||e.id===y).map(e=>({value:e.id,label:e.enabled?e.name:t(`clients.tokenDisabled`,{name:e.name}),disabled:!e.enabled})),[ne,D]=(0,X.useState)(!1),[re,A]=(0,X.useState)(!1),[se,F]=(0,X.useState)(null),I=e.availability===`coming_soon`,L=Y(e.kind,e.name),le=(l.data??[]).filter(e=>e.enabled),H=e.detection.configPaths[0],de=le.find(t=>t.id===e.providerId),fe=de?.authScheme===`oauth-subscription`||de?.authScheme===`plugin`,me=C(de?.id,fe),U=e.kind===`claude-desktop`,W=e.kind===`claude-code`,he=a(W),G=W&&he.data?.mode===`direct`,K=ut(e.extras),[ge,_e]=(0,X.useState)(K),q=Q.some(e=>ge[e]),ve=$(ge)!==$(K),ye=ct(e.extras),[be,xe]=(0,X.useState)(ye),Se=(g??null)!==(e.selectedModel??null)||lt(be)!==lt(ye),we=W?st.filter(e=>e!==`ANTHROPIC_MODEL`):[],Ee=W?e.enabled?t(`clients.modelSlotsFooterEnabled`):t(`clients.modelSlotsFooter`):e.enabled?t(`clients.modelFooterEnabled`):t(`clients.modelFooter`),J=e.options??[],De=at(e.extras,J),[Oe,ke]=(0,X.useState)(De),je=ot(Oe)!==ot(De),Me=e.protocols??[],Ne=Me.length>1?$e(e.extras):[],Pe=Qe(e.extras),[Fe,Ie]=(0,X.useState)(Pe),Re=tt(Fe)!==tt(Pe),ze=U?{...e.extras,roleMap:ge}:W?{...e.extras,models:be,options:Oe}:J.length>0||Me.length>1?{...e.extras,...J.length>0?{options:Oe}:{},...Me.length>1?{protocolOverrides:Fe}:{}}:void 0;(0,X.useEffect)(()=>ee(e.selectedModel??null),[e.kind,e.selectedModel]),(0,X.useEffect)(()=>v(e.accountId??``),[e.kind,e.providerId,e.accountId]),(0,X.useEffect)(()=>w(y),[e.kind,y]),(0,X.useEffect)(()=>_e(ut(e.extras)),[e.kind,$(K)]);let Be=(0,X.useRef)({});(0,X.useEffect)(()=>{if(!U||e.enabled||Q.some(e=>K[e]))return;let t=Be.current,n=ft(h.data??[]);Be.current=n,_e(e=>(!Q.some(t=>e[t])||$(e)===$(t))&&$(e)!==$(n)?n:e)},[e.kind,e.enabled,$(K),(h.data??[]).join(`
6
- `)]),(0,X.useEffect)(()=>xe(ct(e.extras)),[e.kind,lt(ye)]),(0,X.useEffect)(()=>ke(at(e.extras,e.options)),[e.kind,ot(De)]),(0,X.useEffect)(()=>Ie(Qe(e.extras)),[e.kind,tt(Pe)]);let Ve=()=>{e.providerId&&u.mutate({kind:e.kind,providerId:e.providerId,accountId:_},{onSuccess:()=>s(t(`common.saved`),`success`),onError:e=>s(R(e),`error`)})},He=async()=>{await c({title:t(`clients.disableConfirm`,{name:L}),detail:t(`clients.disableDetail`),confirmLabel:t(`clients.disable`)})&&d.mutate(e.kind,{onSuccess:async n=>{if(n.drifted.length===0){s(t(`clients.disabledToast`,{name:L}),`success`);return}await c({title:t(`clients.driftTitle`),detail:t(`clients.driftDetail`,{keys:n.drifted.join(`, `)}),confirmLabel:t(`clients.forceRestore`),destructive:!0})&&f.mutate(e.kind,{onSuccess:()=>s(t(`clients.disabledToast`,{name:L}),`success`),onError:e=>s(R(e),`error`)})},onError:e=>s(R(e),`error`)})},Ue=async()=>{H&&(z.canOpenPaths?await z.openPath(ue(H)):await z.copy(H)&&s(t(`common.copied`)))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{children:[(0,Z.jsxs)(O,{icon:(0,Z.jsx)(Ae,{kind:e.kind,size:36}),label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[15px] font-medium`,children:L}),G?(0,Z.jsx)(k,{children:t(`clients.claudeDirect.direct`)}):Ct(e,t)]}),detail:I?e.availabilityReason??t(`clients.comingSoonDetail`):[vt(e)===`installed`?t(`clients.detected`,{version:yt(e)??``}):t(`clients.notDetected`),G?null:H].filter(Boolean).join(` · `),className:`py-3`,children:[!I&&(0,Z.jsx)(At,{client:e,onOpen:F}),G?(0,Z.jsx)(j,{variant:`primary`,onClick:()=>document.getElementById(Mt)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:t(`clients.claudeDirect.configure`)}):e.enabled?(0,Z.jsx)(j,{onClick:()=>void He(),loading:d.isPending,children:t(`clients.disableRestore`)}):(0,Z.jsx)(j,{variant:`primary`,disabled:I||!e.providerId||U&&!q,onClick:()=>D(!0),title:e.providerId?U&&!q?t(`clients.roleMapRequired`):void 0:t(`clients.pickProviderFirst`),children:t(`clients.enable`)})]}),!G&&e.appliedAt&&(0,Z.jsx)(O,{label:(0,Z.jsx)(`span`,{className:`text-[12px] text-[var(--text-secondary)]`,children:t(`clients.appliedAt`,{time:o(e.appliedAt,n)})})})]}),!I&&!e.enabled&&U&&e.providerId&&!q&&(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col items-start gap-2`,children:[(0,Z.jsx)(M,{tone:`info`,className:`self-stretch`,title:t(`clients.roleMapHint`)}),(0,Z.jsx)(j,{onClick:()=>document.getElementById(Nt)?.scrollIntoView({behavior:`smooth`,block:`start`}),children:t(`clients.roleMapGoto`)})]}),(e.repairs?.length??0)>0&&(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col items-start gap-2`,children:[(0,Z.jsxs)(M,{tone:`danger`,className:`self-stretch`,title:t(`clients.repair.title`,{name:L}),children:[e.repairs?.map(e=>(0,Z.jsxs)(`span`,{className:`block break-all`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.file}),` — `,t(`clients.repair.problem.${e.problem}`,{line:e.line})]},e.file)),(0,Z.jsx)(`span`,{className:`block`,children:t(`clients.repair.hint`)})]}),(0,Z.jsx)(j,{variant:`primary`,loading:p.isPending,onClick:()=>p.mutate(e.kind,{onSuccess:()=>s(t(`clients.repair.done`,{name:L}),`success`),onError:e=>s(R(e),`error`)}),children:t(`clients.repair.action`)})]}),!G&&e.warnings.length>0&&(0,Z.jsx)(`div`,{className:`mb-5 flex flex-col gap-2`,children:e.warnings.map((e,t)=>(0,Z.jsx)(M,{tone:`warning`,title:e},t))}),!G&&(0,Z.jsx)(Ot,{client:e,providers:l.data??[],loading:l.isLoading,soon:I}),!G&&fe&&(0,Z.jsx)(N,{title:t(`clients.accountTitle`),footer:t(`clients.accountFooter`),children:me.isLoading?(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(P,{lines:2})}):(0,Z.jsxs)(O,{label:t(`clients.account`),children:[(0,Z.jsx)(V,{className:`max-w-[300px]`,ariaLabel:t(`clients.account`),value:_,onChange:v,options:[{value:``,label:t(`clients.accountDefault`)},...(me.data??[]).map(e=>({value:e.id,label:(e.displayName||e.id)+(e.status===`active`?``:` · ${t(`providers.subscription.status.${e.status}`)}`)}))]}),_!==(e.accountId??``)&&(0,Z.jsx)(j,{size:`sm`,variant:`primary`,loading:u.isPending,onClick:Ve,children:t(`common.apply`)})]})}),!I&&!G&&(0,Z.jsxs)(N,{title:t(`clients.tokenTitle`),footer:e.enabled?t(`clients.tokenFooterEnabled`):t(`clients.tokenFooter`),children:[(0,Z.jsxs)(O,{label:t(`clients.token`),children:[(0,Z.jsx)(V,{className:`max-w-[300px]`,ariaLabel:t(`clients.token`),value:x,onChange:w,options:T}),e.enabled&&x!==y&&(0,Z.jsx)(j,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})]}),(0,Z.jsx)(O,{icon:(0,Z.jsx)(Te,{className:`size-4 text-[var(--text-secondary)]`}),label:t(`clients.manageTokens`),onClick:()=>i(`/tokens`)})]}),!I&&!G&&e.providerId&&U&&(0,Z.jsx)(`div`,{id:Nt,children:(0,Z.jsxs)(N,{title:t(`clients.roleMapTitle`),footer:e.enabled?t(`clients.roleMapFooterEnabled`):t(`clients.roleMapFooter`),children:[Q.map(e=>(0,Z.jsx)(O,{label:t(`clients.role.${e}`),children:(0,Z.jsx)(V,{ariaLabel:t(`clients.role.${e}`),value:ge[e]??``,onChange:t=>_e(n=>({...n,[e]:t||void 0})),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(h.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})},e)),e.enabled&&ve&&(0,Z.jsx)(O,{label:q?``:(0,Z.jsx)(`span`,{className:`text-[12px] text-[var(--warning)]`,children:t(`clients.roleMapRequired`)}),children:(0,Z.jsx)(j,{size:`sm`,variant:`primary`,disabled:!q,onClick:()=>D(!0),children:t(`common.apply`)})})]})}),!I&&!G&&e.providerId&&!U&&(0,Z.jsxs)(N,{title:t(`clients.modelTitle`),footer:Ee,children:[(0,Z.jsx)(O,{label:t(`clients.defaultModel`),children:(0,Z.jsx)(V,{value:g??``,onChange:e=>ee(e||null),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(h.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})}),we.map(e=>(0,Z.jsx)(O,{label:t(`clients.modelSlot.${e}`),children:(0,Z.jsx)(V,{ariaLabel:t(`clients.modelSlot.${e}`),value:be[e]??``,onChange:t=>xe(n=>({...n,[e]:t||void 0})),placeholder:t(`clients.modelPlaceholder`),options:[{value:``,label:t(`clients.modelUnset`)},...(h.data??[]).map(e=>({value:e,label:e}))],className:`max-w-[300px]`})},e)),e.enabled&&(W?Se:(g??null)!==(e.selectedModel??null))&&(0,Z.jsx)(O,{label:``,children:(0,Z.jsx)(j,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!I&&!G&&J.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ye,{descriptors:J,values:Oe,onChange:ke,enabled:e.enabled}),e.enabled&&je&&(0,Z.jsx)(`div`,{className:`-mt-3 mb-5 flex justify-end`,children:(0,Z.jsx)(j,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!I&&Ne.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(it,{models:Ne,supported:Me,values:Fe,onChange:Ie,enabled:e.enabled}),e.enabled&&Re&&(0,Z.jsx)(`div`,{className:`-mt-3 mb-5 flex justify-end`,children:(0,Z.jsx)(j,{size:`sm`,variant:`primary`,onClick:()=>D(!0),children:t(`common.apply`)})})]}),!I&&e.install&&(0,Z.jsx)(Ft,{client:e,onShowLog:()=>F(`log`),onUninstall:()=>F(`uninstall`)}),W&&(0,Z.jsx)(`div`,{id:Mt,children:(0,Z.jsx)(Ke,{enabled:W,gatewayEnabled:e.enabled})}),!I&&!G&&(0,Z.jsxs)(N,{title:t(`clients.maintenance`),children:[H&&(0,Z.jsx)(O,{icon:z.canOpenPaths?(0,Z.jsx)(pe,{className:`size-4 text-[var(--text-secondary)]`}):(0,Z.jsx)(ie,{className:`size-4 text-[var(--text-secondary)]`}),label:z.canOpenPaths?t(`clients.openConfigDir`):t(`clients.copyConfigPath`),detail:H,onClick:()=>void Ue()}),(0,Z.jsx)(O,{icon:(0,Z.jsx)(Le,{className:`size-4 text-[var(--text-secondary)]`}),label:t(`clients.backups`),detail:t(`clients.backupsDetail`),onClick:()=>A(!0)})]}),(0,Z.jsx)(Lt,{open:ne,onOpenChange:D,client:e,model:g,extras:ze,tokenId:x}),(0,Z.jsx)(Bt,{open:re,onOpenChange:A,client:e}),(0,Z.jsx)(It,{mode:se,onClose:()=>F(null),client:e})]})}var Tt={install:`clients.installTitle`,update:`clients.updateTitle`,uninstall:`clients.uninstallTitle`},Et={install:`clients.installedToast`,update:`clients.updatedToast`,uninstall:`clients.uninstalledToast`};function Dt(e,t){return[e.priceKey??e.templateId,t(`providers.modelCount`,{count:e.modelCount}),e.priceMultiplier===1?null:`×${e.priceMultiplier}`].filter(Boolean).join(` · `)}function Ot({client:e,providers:t,loading:n,soon:r}){let{t:i}=E(),{toast:a}=B(),o=c(),s=(0,X.useMemo)(()=>e.bindings??(e.providerId?[{providerId:e.providerId,accountId:e.accountId}]:[]),[e.bindings,e.providerId,e.accountId]),[l,u]=(0,X.useState)(s);(0,X.useEffect)(()=>u(s),[s]);let d=(0,X.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]),f=l.flatMap(e=>{let t=d.get(e.providerId);return t?[{binding:e,provider:t}]:[]}),p=t.filter(e=>e.enabled&&!l.some(t=>t.providerId===e.id)),m=W(xe(U,{activationConstraint:{distance:4}}),xe(ye,{coordinateGetter:ve})),h=r||o.isPending,g=(t,n)=>{let r=l;u(t),o.mutate({kind:e.kind,bindings:t},{onSuccess:()=>a(mt.has(e.kind)&&e.enabled?i(`clients.providersModelsSynced`,{client:Y(e.kind,e.name)}):n),onError:e=>{u(r),a(R(e),`error`)}})},ee=({active:e,over:t})=>{if(!t||e.id===t.id)return;let n=l.findIndex(t=>t.providerId===e.id),r=l.findIndex(e=>e.providerId===t.id);n<0||r<0||g(ge(l,n,r),i(`clients.providerOrderSaved`))},_=e=>g([...l,{providerId:e.id}],i(`clients.providerAdded`,{provider:e.name})),v=e=>g(l.filter(t=>t.providerId!==e.id),i(`clients.providerRemoved`,{provider:e.name})),y=p.map(e=>(0,Z.jsx)(O,{icon:(0,Z.jsx)(Pe,{name:e.name,icon:e.icon,colorKey:e.templateId,size:24}),label:e.name,detail:Dt(e,i),onClick:h?void 0:()=>_(e),children:!r&&(0,Z.jsx)(we,{className:`size-4 text-[var(--text-secondary)]`,"aria-label":i(`common.add`)})},e.id));return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:i(`clients.providerTitle`),footer:i(`clients.providerFooter`),children:[n&&(0,Z.jsx)(`div`,{className:`p-4`,children:(0,Z.jsx)(P,{lines:2})}),!n&&f.length===0&&p.length===0&&(0,Z.jsx)(T,{title:i(`clients.noProviders`),detail:i(`clients.noProvidersDetail`),action:(0,Z.jsx)(ke,{to:`/providers?new=1`,children:(0,Z.jsx)(j,{variant:`primary`,icon:(0,Z.jsx)(we,{className:`size-3.5`}),children:i(`providers.add`)})})}),f.length>0&&(0,Z.jsx)(_e,{sensors:m,collisionDetection:K,onDragEnd:ee,children:(0,Z.jsx)(be,{items:f.map(e=>e.provider.id),strategy:me,children:f.map(({provider:e},t)=>(0,Z.jsx)(kt,{provider:e,primary:t===0,disabled:h,onRemove:f.length>1?()=>v(e):void 0},e.id))})}),!n&&f.length===0&&y]}),f.length>0&&p.length>0&&(0,Z.jsx)(N,{title:i(`clients.moreProvidersTitle`),children:y})]})}function kt({provider:e,primary:t,disabled:n,onRemove:r}){let{t:i}=E(),{attributes:a,listeners:o,setNodeRef:s,setActivatorNodeRef:c,transform:l,transition:u,isDragging:d}=G({id:e.id,disabled:n});return(0,Z.jsx)(`div`,{ref:s,style:{transform:he.Transform.toString(l),transition:u},className:A(d&&`relative z-10 bg-[var(--surface)] shadow-lg`),children:(0,Z.jsx)(O,{icon:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{ref:c,type:`button`,"aria-label":i(`clients.dragToReorder`,{provider:e.name}),title:i(`clients.dragToReorder`,{provider:e.name}),className:`-ml-1 inline-flex cursor-grab touch-none text-[var(--text-muted)] hover:text-[var(--text-secondary)] active:cursor-grabbing disabled:cursor-default disabled:opacity-50`,...a,...o,children:(0,Z.jsx)(q,{className:`size-4`})}),(0,Z.jsx)(Pe,{name:e.name,icon:e.icon,colorKey:e.templateId,size:24})]}),label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),t&&(0,Z.jsx)(k,{tone:`accent`,children:i(`clients.primaryProvider`)}),!e.enabled&&(0,Z.jsx)(k,{tone:`orange`,children:i(`clients.providerDisabledBadge`)})]}),detail:Dt(e,i),children:r&&(0,Z.jsx)(j,{size:`sm`,variant:`plain`,icon:(0,Z.jsx)(D,{className:`size-3.5`}),"aria-label":i(`clients.removeProvider`,{provider:e.name}),title:i(`clients.removeProvider`,{provider:e.name}),disabled:n,onClick:r})})})}function At({client:e,onOpen:t}){let{t:n}=E(),r=e.install;if(!r)return null;let i=r.needsAdmin?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-[var(--warning)]`,children:[(0,Z.jsx)(Ve,{className:`size-3`,"aria-hidden":!0}),n(`clients.admin.badge`)]}):null,a=r.needsAdmin?n(r.adminAvailable?`clients.admin.tip`:`clients.admin.tipManual`):void 0;return r.busy?(0,Z.jsx)(j,{icon:(0,Z.jsx)(St,{}),onClick:()=>t(`log`),children:n(`clients.installRunning`)}):r.updateAvailable&&r.updateCommand&&r.latestVersion?(0,Z.jsxs)(j,{icon:(0,Z.jsx)(ze,{className:`size-3.5`}),title:a,onClick:()=>t(`update`),children:[n(`clients.updateTo`,{version:r.latestVersion}),i]}):r.updateAvailable&&r.blocker===`shadowed`?(0,Z.jsx)(j,{icon:(0,Z.jsx)(Ve,{className:`size-3.5`}),onClick:()=>document.getElementById(jt)?.scrollIntoView({behavior:`smooth`,block:`center`}),children:n(`clients.shadowedBadge`)}):!r.installed&&r.installCommand?(0,Z.jsxs)(j,{icon:(0,Z.jsx)(de,{className:`size-3.5`}),title:a,onClick:()=>t(`install`),children:[n(`clients.install`),i]}):!r.installed&&r.method===`manual`?(0,Z.jsx)(j,{icon:(0,Z.jsx)(fe,{className:`size-3.5`}),onClick:()=>window.open(r.homepageUrl,`_blank`,`noreferrer`),children:n(`clients.download`)}):null}var jt=`client-shadowed-alert`,Mt=`claude-direct-panel`,Nt=`client-role-map`;function Pt(e,t){return!e.installed||e.uninstallCommand?null:e.method===`npm`?t(`clients.uninstallExternal`,{path:e.executable??``}):e.method===`vscode-extension`?t(`clients.uninstallBuiltIn`):t(`clients.uninstallManual`)}function Ft({client:e,onShowLog:t,onUninstall:n}){let{t:r,locale:i}=E(),a=e.install,s=l(e.kind),c=(e,t=!1)=>(0,Z.jsx)(`span`,{className:A(`text-[13px] tabular-nums selectable`,t&&`text-[var(--text-secondary)]`),children:e}),u=a.blocker===`external-install`?r(`clients.blocker.external-install`,{path:a.executable??``}):a.blocker?r(`clients.blocker.${a.blocker}`):void 0,d=a.otherCopies??[],f=d.find(e=>e.newer);return(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(`div`,{id:jt,className:`mb-3`,children:(0,Z.jsx)(M,{tone:`warning`,title:r(`clients.shadowed.title`,{version:f.version}),children:r(`clients.shadowed.detail`,{path:a.executable??``,version:a.version??``,other:f.path,dir:ue(f.path)})})}),!f&&a.notOnPath&&a.executable&&(0,Z.jsx)(`div`,{className:`mb-3`,children:(0,Z.jsx)(M,{tone:`warning`,title:r(`clients.notOnPath.title`),children:r(`clients.notOnPath.detail`,{dir:ue(a.executable)})})}),(0,Z.jsxs)(N,{title:r(`clients.versionTitle`),footer:u,children:[(0,Z.jsx)(O,{label:r(`clients.currentVersion`),detail:a.installed?a.executable:void 0,children:a.installed?c(a.version??r(`clients.versionUnknown`),!a.version):c(r(`clients.notInstalled`),!0)}),d.map(e=>(0,Z.jsxs)(O,{label:r(`clients.otherCopy`),detail:e.path,children:[e.newer&&(0,Z.jsx)(k,{tone:`orange`,children:r(`clients.otherCopyNewer`)}),c(e.version,!e.newer)]},e.path)),(a.method===`npm`||a.method===`script`)&&(0,Z.jsxs)(O,{label:r(`clients.latestVersion`),detail:a.latestError??(a.latestCheckedAt?r(`clients.checkedAt`,{time:o(a.latestCheckedAt,i)}):void 0),children:[a.updateAvailable&&(0,Z.jsx)(k,{tone:`orange`,children:r(`clients.updateBadge`)}),c(a.latestVersion??r(`clients.latestUnknown`),!a.latestVersion)]}),(0,Z.jsx)(O,{label:r(`clients.installMethod`),detail:r(`clients.method.${a.method}`,{package:a.package??``}),children:(0,Z.jsx)(j,{size:`sm`,variant:`plain`,icon:(0,Z.jsx)(fe,{className:`size-3`}),onClick:()=>window.open(a.homepageUrl,`_blank`,`noreferrer`),children:r(`clients.homepage`)})}),a.installed&&(0,Z.jsx)(O,{label:r(`clients.uninstall`),detail:a.uninstallCommand??Pt(a,r),children:a.uninstallCommand&&(0,Z.jsx)(j,{size:`sm`,variant:`destructive`,icon:(0,Z.jsx)(Ee,{className:`size-3`}),disabled:a.busy,onClick:n,children:r(`clients.uninstall`)})}),s.data&&(0,Z.jsx)(O,{icon:(0,Z.jsx)(J,{className:`size-4 text-[var(--text-secondary)]`}),label:r(`clients.installLog`),detail:`${s.data.command} · ${r(`clients.job.${s.data.state}`)}`,onClick:t})]})]})}function It({mode:e,onClose:t,client:r}){let{t:i}=E(),{toast:a}=B(),o=m(),c=e!==null,u=l(r.kind,c||!!r.install?.busy),d=ee(),f=s(),[p,h]=(0,X.useState)(!1),g=(0,X.useRef)(null),_=(0,X.useRef)(void 0),v=Y(r.kind,r.name),y=r.install,b=e===`log`?null:e,x=b===`install`?y?.installCommand:b===`update`?y?.updateCommand:b===`uninstall`?y?.uninstallCommand:null,S=b===`uninstall`,C=u.data,te=b!==null&&!p&&C?.state!==`running`,w=!!y?.needsAdmin,ne=!!y?.adminAvailable,D=C?.state===`failed`&&C.hint===`permission-denied`&&!C.elevated&&ne;(0,X.useEffect)(()=>{c&&h(!1)},[c,e]),(0,X.useEffect)(()=>{let e=C?.state;_.current===`running`&&e&&e!==`running`&&(o.invalidateQueries({queryKey:n.clients}),e===`succeeded`&&C.hint?a(i(`clients.notEffectiveToast`,{name:v})):e===`succeeded`&&a(i(Et[C.action],{name:v}),`success`)),_.current=e},[C?.state,C?.action,C?.hint,v,o,i,a]),(0,X.useEffect)(()=>{let e=g.current;e&&(e.scrollTop=e.scrollHeight)},[C?.log.length]);let re=(e,t)=>d.mutate({kind:r.kind,action:e,elevated:t},{onSuccess:()=>h(!0),onError:e=>a(R(e),`error`)}),ae=async e=>{await z.copy(e)&&a(i(`common.copied`))},O=i(Tt[b??C?.action??`install`],{name:v}),oe={running:`info`,succeeded:`success`,failed:`danger`,cancelled:`warning`},k=`rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] px-3 py-2 font-mono text-[12px] break-all whitespace-pre-wrap selectable`,se=y?.adminFixCommand?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-secondary)]`,children:i(`clients.admin.fixTip`)}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`pre`,{className:A(k,`min-w-0 flex-1`),children:y.adminFixCommand}),(0,Z.jsx)(j,{size:`sm`,icon:(0,Z.jsx)(ie,{className:`size-3`}),"aria-label":i(`common.copy`),onClick:()=>void ae(y.adminFixCommand)})]})]}):null;return(0,Z.jsx)(le,{open:c,onOpenChange:e=>!e&&t(),width:620,title:O,description:te?i(S?`clients.uninstallRunDetail`:`clients.installRunDetail`):void 0,footer:te?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{onClick:t,children:i(`common.cancel`)}),w&&!ne?(0,Z.jsx)(j,{variant:`primary`,icon:(0,Z.jsx)(ie,{className:`size-3.5`}),disabled:!x,onClick:()=>void ae(`sudo ${x}`),children:i(`clients.admin.copyCommand`)}):(0,Z.jsx)(j,{variant:S?`destructive`:`primary`,icon:w?(0,Z.jsx)(Ve,{className:`size-3.5`}):void 0,disabled:!x,loading:d.isPending,onClick:()=>b&&re(b,w),children:i(w?`clients.admin.start`:S?`clients.uninstall`:`clients.installStart`)})]}):C?.state===`running`?(0,Z.jsxs)(Z.Fragment,{children:[!C.elevated&&(0,Z.jsx)(j,{variant:`destructive`,loading:f.isPending,onClick:()=>f.mutate(r.kind,{onError:e=>a(R(e),`error`)}),children:i(`clients.installStop`)}),(0,Z.jsx)(j,{onClick:t,children:i(`common.close`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{onClick:t,children:i(`common.done`)}),D&&(0,Z.jsx)(j,{variant:`primary`,icon:(0,Z.jsx)(Ve,{className:`size-3.5`}),loading:d.isPending,onClick:()=>re(C.action,!0),children:i(`clients.admin.retry`)})]}),children:te?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[S&&r.enabled&&(0,Z.jsx)(M,{tone:`warning`,title:i(`clients.uninstallRestoreTitle`),children:i(`clients.uninstallRestoreDetail`,{name:v})}),w&&(0,Z.jsx)(M,{tone:`warning`,title:i(`clients.admin.title`),children:i(ne?`clients.admin.prompt`:`clients.admin.manual`)}),x?(0,Z.jsx)(`pre`,{className:k,children:w?`sudo ${x}`:x}):(0,Z.jsx)(M,{tone:`warning`,title:i(`clients.installUnavailable`)}),S?(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:i(`clients.uninstallKeepsData`)}):y?.method===`npm`&&(0,Z.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:i(`clients.installNpmNote`)}),w&&se]}):C?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(M,{tone:C.state===`succeeded`&&C.hint?`warning`:oe[C.state],title:i(C.state===`succeeded`&&C.hint?`clients.job.notEffective`:`clients.job.${C.state}`),children:C.state===`running`&&C.elevated?i(`clients.admin.running`):C.hint?i(`clients.hint.${C.hint}`)+(D?i(`clients.admin.retryHint`):``):void 0}),(0,Z.jsx)(`pre`,{ref:g,className:`scroll max-h-[340px] min-h-[160px] rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] px-3 py-2 font-mono text-[11px] leading-relaxed break-all whitespace-pre-wrap selectable`,children:C.log.join(`
7
- `)}),C.hint===`permission-denied`&&se]}):u.isLoading?(0,Z.jsx)(P,{lines:4}):(0,Z.jsx)(T,{icon:(0,Z.jsx)(J,{className:`size-6`}),title:i(`clients.noInstallLog`)})})}function Lt({open:e,onOpenChange:t,client:n,model:r,extras:i,tokenId:a}){let{t:o}=E(),{toast:s}=B(),c=p(),l=re(),u=Y(n.kind,n.name),d=i?{providerId:n.providerId,model:r,extras:i,tokenId:a}:{providerId:n.providerId,model:r,tokenId:a};return(0,X.useEffect)(()=>{e&&c.mutate({kind:n.kind,req:d})},[e]),(0,Z.jsxs)(le,{open:e,onOpenChange:t,width:620,title:o(`clients.enableTitle`,{name:u}),description:o(`clients.enableDetail`),footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{onClick:()=>t(!1),children:o(`common.cancel`)}),(0,Z.jsx)(j,{variant:`primary`,disabled:!c.data,loading:l.isPending,onClick:()=>l.mutate({kind:n.kind,req:d},{onSuccess:e=>{t(!1),s(e.requiresRestart?o(`clients.enabledRestart`,{name:u}):o(`clients.enabledToast`,{name:u}),`success`)},onError:e=>s(R(e),`error`)}),children:n.enabled?o(`common.apply`):o(`clients.enable`)})]}),children:[c.isPending&&(0,Z.jsx)(P,{lines:4}),c.isError&&(0,Z.jsx)(M,{tone:`danger`,title:o(`common.error`),children:R(c.error)}),c.data&&(0,Z.jsx)(Rt,{preview:c.data})]})}function Rt({preview:e}){let{t}=E();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.warnings.map((e,t)=>(0,Z.jsx)(M,{tone:`warning`,title:e},t)),e.changes.length===0&&(0,Z.jsx)(M,{tone:`info`,title:t(`clients.noChanges`)}),e.diffs.map(e=>(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-2 font-mono text-[11px] text-[var(--text-secondary)]`,children:e.file}),(0,Z.jsx)(zt,{diff:e.unifiedDiff})]},e.file))]})}function zt({diff:e}){return(0,Z.jsx)(`pre`,{className:`scroll max-h-[300px] rounded-[var(--radius-control)] border border-[var(--border)] bg-[var(--surface-muted)] py-2 font-mono text-[11px] leading-relaxed selectable`,children:e.split(`
8
- `).map((e,t)=>(0,Z.jsx)(`div`,{className:A(`px-3 whitespace-pre-wrap break-all`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-[color-mix(in_oklab,var(--success)_12%,transparent)] text-[var(--success)]`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-[color-mix(in_oklab,var(--danger)_10%,transparent)] text-[var(--danger)]`,e.startsWith(`@@`)&&`text-[var(--text-muted)]`),children:e||` `},t))})}function Bt({open:e,onOpenChange:n,client:r}){let{t:i,locale:a}=E(),{toast:s,confirm:c}=B(),l=_(r.kind,e),u=t();return(0,Z.jsxs)(le,{open:e,onOpenChange:n,width:520,title:i(`clients.backups`),description:i(`clients.backupsDetail`),footer:(0,Z.jsx)(j,{onClick:()=>n(!1),children:i(`common.done`)}),children:[l.isLoading&&(0,Z.jsx)(P,{lines:3}),l.isError&&(0,Z.jsx)(M,{tone:`danger`,title:i(`common.error`),children:R(l.error)}),l.data?.length===0&&(0,Z.jsx)(T,{icon:(0,Z.jsx)(Le,{className:`size-6`}),title:i(`clients.noBackups`)}),(0,Z.jsx)(`div`,{className:`card divide-y divide-[var(--border)]`,children:l.data?.map(e=>(0,Z.jsx)(O,{label:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o(e.createdAt,a),e.firstWrite&&(0,Z.jsx)(k,{tone:`accent`,children:i(`clients.firstWrite`)})]}),detail:e.files.join(`, `),children:(0,Z.jsx)(j,{size:`sm`,icon:(0,Z.jsx)(Se,{className:`size-3`}),loading:u.isPending&&u.variables?.id===e.id,onClick:async()=>{await c({title:i(`clients.restoreConfirm`),detail:e.files.join(`
9
- `),destructive:!0,confirmLabel:i(`clients.restore`)})&&u.mutate({kind:r.kind,id:e.id},{onSuccess:()=>s(i(`clients.restored`),`success`),onError:e=>s(R(e),`error`)})},children:i(`clients.restore`)})},e.id))})]})}export{pt as ClientsPage};
@@ -1 +0,0 @@
1
- import{Ba as e,Ct as t,G as n,H as r,J as i,Q as a,St as o,Tt as s,Ua as c,Y as l,_ as u,ct as d,n as f,q as p,r as m,t as h,wt as g,za as _}from"./alert-CuKAE1Sv.js";import{_ as v,j as y,k as b}from"./index-CKrvKDIJ.js";var x=c(e(),1),S=_(),C=`astra.keyLookup`;function w(){try{return sessionStorage.getItem(C)??``}catch{return``}}function T(e){try{e?sessionStorage.setItem(C,e):sessionStorage.removeItem(C)}catch{}}function E(){let{t:e}=d(),[n,r]=(0,x.useState)(``),[i,a]=(0,x.useState)(null),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(null),[f,p]=(0,x.useState)(!1),g=(0,x.useCallback)(async n=>{let r=n.trim();if(r){p(!0),u(null);try{a(await t(r)),c(r),T(r)}catch(t){a(null),T(null),u(t instanceof o&&t.status===401?e(`key.invalid`):e(`key.error`,{error:t.message}))}finally{p(!1)}}},[e]);return(0,x.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`key`);e&&window.history.replaceState(null,``,window.location.pathname);let t=e??w();t&&(r(t),g(t))},[]),(0,S.jsx)(`div`,{className:`wallpaper flex min-h-full justify-center overflow-y-auto p-4 sm:items-start sm:py-12`,children:(0,S.jsxs)(`div`,{className:`flex w-full max-w-[720px] flex-col gap-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(y,{className:`size-10 rounded-[12px]`}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-[17px] font-medium`,children:e(`key.title`)}),(0,S.jsx)(`p`,{className:`text-[13px] text-[var(--text-secondary)]`,children:e(`key.subtitle`)})]})]}),!i&&(0,S.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g(n)},className:`card flex flex-col gap-4 p-5`,children:[(0,S.jsx)(b,{label:e(`key.title`),placeholder:e(`key.placeholder`),autoFocus:!0,autoComplete:`off`,value:n,"aria-invalid":l?!0:void 0,onChange:e=>r(e.target.value)}),l&&(0,S.jsx)(h,{tone:`danger`,title:l}),(0,S.jsx)(m,{type:`submit`,variant:`primary`,loading:f,disabled:!n.trim(),children:e(`key.submit`)})]}),i&&(0,S.jsx)(D,{info:i,apiKey:s,onForget:()=>{T(null),a(null),r(``)}})]})})}function D({info:e,apiKey:t,onForget:n}){let{t:i,locale:o}=d(),[s,c]=(0,x.useState)(`overview`),p=e.allowedClients==null?i(`key.clientsAny`):e.allowedClients.length===0?i(`key.directOnly`):e.allowedClients.map(e=>v[e]?.name??e).join(`, `),h=[[i(`key.today`),e.usage.today],[i(`key.week`),e.usage.week],[i(`key.month`),e.usage.month],[i(`key.total`),e.usage.total]],g=Math.max(...e.daily.map(e=>e.costUsd),0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`section`,{className:`card flex flex-col gap-3 p-5`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`h2`,{className:`text-[15px] font-medium`,children:e.name}),(0,S.jsx)(`code`,{className:`font-mono text-[12px] text-[var(--text-secondary)]`,children:e.keyPrefix}),!e.enabled&&(0,S.jsx)(f,{tone:`orange`,children:i(`key.disabled`)}),(0,S.jsx)(m,{size:`sm`,variant:`plain`,className:`ml-auto`,onClick:n,children:i(`key.forget`)})]}),(0,S.jsxs)(`div`,{className:`text-[12px] text-[var(--text-secondary)]`,children:[i(`key.clients`),`: `,p,` · `,i(`key.timeZone`,{zone:e.timeZone})]}),(0,S.jsx)(u,{ariaLabel:i(`key.title`),value:s,onChange:c,items:[{value:`overview`,label:i(`key.tab.overview`)},{value:`stats`,label:i(`key.tab.stats`)},{value:`requests`,label:i(`key.tab.requests`)}]})]}),s===`stats`&&(0,S.jsx)(k,{apiKey:t}),s===`requests`&&(0,S.jsx)(M,{apiKey:t}),s===`overview`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`section`,{className:`card flex flex-col gap-3 p-5`,children:[(0,S.jsx)(`h3`,{className:`text-[13px] font-medium`,children:i(`key.limits`)}),e.limits.length===0&&e.rpm==null&&(0,S.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:i(`key.unlimited`)}),(0,S.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:e.limits.map(e=>{let t=t=>e.metric===`cost`?a(t):l(t,!0),n=Math.max(0,Math.min(100,Math.round(e.usedPercent))),s=n>=90?`var(--danger)`:n>=70?`var(--warning)`:`var(--accent)`,c=`${i(`tokens.period.${e.period}`)} · ${i(`tokens.metric.${e.metric}`)}`;return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2 text-[12px]`,children:[(0,S.jsx)(`span`,{className:`text-[var(--text-secondary)]`,children:c}),(0,S.jsxs)(`span`,{className:`num`,children:[t(e.used),` / `,t(e.limit)]})]}),(0,S.jsx)(`div`,{role:`progressbar`,"aria-label":c,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,className:`h-1.5 w-full overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,S.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${n}%`,background:s}})}),(0,S.jsxs)(`div`,{className:`mt-1 text-[11px] text-[var(--text-muted)]`,children:[e.exhausted?i(`key.exhausted`):``,e.exhausted&&e.resetsAt?` · `:``,e.resetsAt?i(`key.resets`,{time:r(e.resetsAt,o)}):``]})]},`${e.metric}:${e.period}`)})}),e.rpm&&(0,S.jsx)(`p`,{className:`num text-[12px] text-[var(--text-secondary)]`,children:i(`key.rpm`,{used:e.rpm.used,limit:e.rpm.limit})})]}),(0,S.jsxs)(`section`,{className:`card flex flex-col gap-3 p-5`,children:[(0,S.jsx)(`h3`,{className:`text-[13px] font-medium`,children:i(`key.usage`)}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-[var(--text-muted)]`,children:[(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:i(`key.cost`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:i(`key.requests`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:i(`key.tokens`)})]})}),(0,S.jsx)(`tbody`,{children:h.map(([e,t])=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{scope:`row`,className:`py-1 text-left font-medium text-[var(--text-secondary)]`,children:e}),(0,S.jsx)(`td`,{className:`num py-1 text-right font-semibold`,children:a(t.costUsd)}),(0,S.jsx)(`td`,{className:`num py-1 text-right`,children:l(t.requests)}),(0,S.jsx)(`td`,{className:`num py-1 text-right`,children:l(t.inputTokens+t.outputTokens,!0)})]},e))})]})}),(0,S.jsx)(`h4`,{className:`mt-2 text-[12px] text-[var(--text-muted)]`,children:i(`key.daily`)}),(0,S.jsx)(`div`,{className:`flex h-24 items-end gap-[2px]`,role:`list`,"aria-label":i(`key.daily`),children:e.daily.map(e=>(0,S.jsx)(`div`,{role:`listitem`,title:`${e.day} · ${a(e.costUsd)} · ${l(e.requests)} ${i(`key.requests`)}`,className:`flex-1 rounded-t-[2px] bg-[var(--accent)]`,style:{height:`${g>0?Math.max(2,e.costUsd/g*100):2}%`,opacity:e.costUsd>0?1:.25}},e.day))})]})]})]})}var O=[`today`,`7d`,`30d`,`90d`];function k({apiKey:e}){let{t}=d(),[r,i]=(0,x.useState)(`7d`),[o,c]=(0,x.useState)(null),[m,g]=(0,x.useState)(null);(0,x.useEffect)(()=>{let n=!0;return g(null),s(e,r).then(e=>n&&c(e),e=>n&&g(t(`key.error`,{error:e.message}))),()=>{n=!1}},[e,r,t]);let _=o?.summary,y=Math.max(...(o?.series??[]).map(e=>e.requests),0);return(0,S.jsxs)(`section`,{className:`card flex flex-col gap-4 p-5`,children:[(0,S.jsx)(u,{ariaLabel:t(`overview.range`),value:r,onChange:i,items:O.map(e=>({value:e,label:t(`range.${e}`)}))}),m&&(0,S.jsx)(h,{tone:`danger`,title:m}),!o||!_?!m&&(0,S.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:`…`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,S.jsx)(A,{label:t(`key.stats.requests`),value:l(_.requests)}),(0,S.jsx)(A,{label:t(`key.stats.successRate`),value:_.requests?p(_.successRate):`—`}),(0,S.jsx)(A,{label:t(`key.cost`),value:a(_.costUsd)}),(0,S.jsx)(A,{label:t(`key.stats.avgTtft`),value:n(_.avgTtftMs)})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h4`,{className:`mb-2 text-[12px] text-[var(--text-muted)]`,children:t(`key.stats.trend`)}),(0,S.jsx)(`div`,{className:`flex h-20 items-end gap-[2px]`,role:`list`,"aria-label":t(`key.stats.trend`),children:o.series.map(e=>(0,S.jsx)(`div`,{role:`listitem`,title:`${e.bucket} · ${l(e.requests)} ${t(`key.requests`)} · ${a(e.costUsd)}`,className:`flex-1 rounded-t-[2px] bg-[var(--accent)]`,style:{height:`${y>0?Math.max(2,e.requests/y*100):2}%`}},e.bucket))})]}),(0,S.jsx)(j,{title:t(`key.stats.byModel`),rows:o.models.map(e=>({name:e.model??`—`,...e}))}),(0,S.jsx)(j,{title:t(`key.stats.byClient`),rows:o.clients.map(e=>({name:e.client?v[e.client]?.name??e.client:t(`key.stats.direct`),...e}))}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h4`,{className:`mb-2 text-[12px] text-[var(--text-muted)]`,children:t(`key.stats.errors`)}),o.errors.length===0?(0,S.jsx)(`p`,{className:`text-[12px] text-[var(--text-secondary)]`,children:t(`key.stats.noErrors`)}):(0,S.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:o.errors.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(f,{tone:`orange`,children:[t(`key.category.${e.category}`),` · `,l(e.count)]})},e.category))})]}),o.retentionDays!=null&&(0,S.jsx)(`p`,{className:`text-[11px] text-[var(--text-muted)]`,children:t(`key.stats.retention`,{days:o.retentionDays})})]})]})}function A({label:e,value:t}){return(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`truncate text-[11px] text-[var(--text-muted)]`,children:e}),(0,S.jsx)(`div`,{className:`num truncate text-[17px] font-semibold`,children:t})]})}function j({title:e,rows:t}){let{t:n}=d();return t.length===0?null:(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,S.jsx)(`caption`,{className:`mb-1 text-left text-[12px] text-[var(--text-muted)]`,children:e}),(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-[var(--text-muted)]`,children:[(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:n(`key.requests`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:n(`key.stats.successRate`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:n(`key.tokens`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:n(`key.cost`)})]})}),(0,S.jsx)(`tbody`,{children:t.map(e=>(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{scope:`row`,className:`max-w-[240px] truncate py-1 text-left font-medium text-[var(--text-secondary)]`,children:e.name}),(0,S.jsx)(`td`,{className:`num py-1 text-right`,children:l(e.requests)}),(0,S.jsx)(`td`,{className:`num py-1 text-right`,children:e.requests?p(e.successRequests/e.requests):`—`}),(0,S.jsx)(`td`,{className:`num py-1 text-right`,children:l(e.inputTokens+e.outputTokens,!0)}),(0,S.jsx)(`td`,{className:`num py-1 text-right font-semibold`,children:a(e.costUsd)})]},e.name))})]})})}function M({apiKey:e}){let{t,locale:o}=d(),[s,c]=(0,x.useState)(`all`),[p,_]=(0,x.useState)([]),[y,b]=(0,x.useState)(null),[C,w]=(0,x.useState)(!1),[T,E]=(0,x.useState)(null),D=(0,x.useCallback)(async n=>{w(!0),E(null);try{let t=await g(e,{before:n,status:s===`failed`?N:void 0});_(e=>n?[...e,...t.items]:t.items),b(t.nextBefore??null)}catch(e){E(t(`key.error`,{error:e.message}))}finally{w(!1)}},[e,s,t]);return(0,x.useEffect)(()=>{D(null)},[D]),(0,S.jsxs)(`section`,{className:`card flex flex-col gap-3 p-5`,children:[(0,S.jsx)(u,{ariaLabel:t(`key.requests.status`),value:s,onChange:c,items:[{value:`all`,label:t(`key.requests.all`)},{value:`failed`,label:t(`key.requests.failed`)}]}),T&&(0,S.jsx)(h,{tone:`danger`,title:T}),p.length===0&&!C&&!T&&(0,S.jsx)(`p`,{className:`text-[12px] text-[var(--text-muted)]`,children:t(`key.requests.empty`)}),p.length>0&&(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-[var(--text-muted)]`,children:[(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`,children:t(`key.requests.time`)}),(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`,children:t(`key.requests.model`)}),(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`,children:t(`key.requests.client`)}),(0,S.jsx)(`th`,{className:`py-1 text-left font-normal`,children:t(`key.requests.status`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:t(`key.requests.tokens`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:t(`key.cost`)}),(0,S.jsx)(`th`,{className:`py-1 text-right font-normal`,children:t(`key.requests.latency`)})]})}),(0,S.jsx)(`tbody`,{children:p.map(e=>(0,S.jsxs)(`tr`,{className:`border-t border-[var(--border-subtle)]`,children:[(0,S.jsx)(`td`,{className:`py-1.5 whitespace-nowrap text-[var(--text-secondary)]`,title:r(e.time,o),children:i(e.time,o)}),(0,S.jsx)(`td`,{className:`max-w-[200px] truncate py-1.5 font-mono`,title:e.model??``,children:e.model??`—`}),(0,S.jsx)(`td`,{className:`py-1.5 text-[var(--text-secondary)]`,children:e.client?v[e.client]?.name??e.client:t(`key.stats.direct`)}),(0,S.jsx)(`td`,{className:`py-1.5`,children:e.errorCategory?(0,S.jsx)(f,{tone:`orange`,title:e.httpStatus?`HTTP ${e.httpStatus}`:void 0,children:t(`key.category.${e.errorCategory}`)}):(0,S.jsx)(f,{tone:`green`,children:t(`key.requests.success`)})}),(0,S.jsxs)(`td`,{className:`num py-1.5 text-right`,children:[l(e.inputTokens,!0),` / `,l(e.outputTokens,!0)]}),(0,S.jsx)(`td`,{className:`num py-1.5 text-right font-semibold`,children:a(e.costUsd)}),(0,S.jsxs)(`td`,{className:`num py-1.5 text-right text-[var(--text-secondary)]`,children:[n(e.ttftMs),` / `,n(e.totalMs)]})]},e.id))})]})}),y&&(0,S.jsx)(`div`,{children:(0,S.jsx)(m,{size:`sm`,loading:C,onClick:()=>void D(y),children:t(`key.requests.more`)})})]})}var N=`upstream_error,gateway_error,client_cancelled,blocked`;export{E as KeyPage};