@qredence/fleet 0.5.0 → 0.5.5

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 (122) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +8 -1
  3. package/bin/fleet-prime.mjs +6 -0
  4. package/dist/web/client/assets/action-swap-roll-DX5o_33Q.js +1 -0
  5. package/dist/web/client/assets/artifacts-panel-C3yewUBP.js +1 -0
  6. package/dist/web/client/assets/artifacts-utils-N_kUFbz2.js +1 -0
  7. package/dist/web/client/assets/bot-Bs7QWJ2q.js +1 -0
  8. package/dist/web/client/assets/{chat-C64Sv6V-.js → chat-W-yOMyG_.js} +5 -5
  9. package/dist/web/client/assets/chat-command-palette-D0xDK1j4.js +1 -0
  10. package/dist/web/client/assets/command-CQzrtjyj.js +2 -0
  11. package/dist/web/client/assets/ease-vFBiNFNK.js +9 -0
  12. package/dist/web/client/assets/{fleet-pi-tool-renderer-ZKiX6Ob_.js → fleet-pi-tool-renderer-B0Y7ou0U.js} +28 -30
  13. package/dist/web/client/assets/generative-text-renderer-SS9c1kNX.js +6 -0
  14. package/dist/web/client/assets/globals-D_Hy9bT1.css +2 -0
  15. package/dist/web/client/assets/horizontal-resize-C1TpRLNC.js +1 -0
  16. package/dist/web/client/assets/index-C9FloFgj.js +12 -0
  17. package/dist/web/client/assets/{input-Clyn18XG.js → input-CqC82Agz.js} +1 -1
  18. package/dist/web/client/assets/{input-group-MxDAWX3j.js → input-group-H0TG-mkU.js} +1 -1
  19. package/dist/web/client/assets/ipython-tool-BrMePqD-.js +3 -0
  20. package/dist/web/client/assets/markdown-DG7pUdsX.js +2 -0
  21. package/dist/web/client/assets/{markdown-code-pIaEVDUU.js → markdown-code-BgMzpy7O.js} +1 -1
  22. package/dist/web/client/assets/notify-Duj26eeZ.js +1 -0
  23. package/dist/web/client/assets/{openui-renderer-NLUpAS3h.js → openui-renderer-CCfQqUfE.js} +5 -5
  24. package/dist/web/client/assets/openui-utils-DawGoQNp.js +1 -0
  25. package/dist/web/client/assets/prime-agent-artifacts-C-g1VPiW.js +5 -0
  26. package/dist/web/client/assets/{provider-catalog-Gx9qaHBM.js → provider-catalog-BZhZuKSz.js} +1 -1
  27. package/dist/web/client/assets/provider-label-jKm8v18u.js +1 -0
  28. package/dist/web/client/assets/range-65lubOFp.js +2 -0
  29. package/dist/web/client/assets/repl-panel-CCh4ly7J.js +1 -0
  30. package/dist/web/client/assets/resource-helpers-ULlyU8qK.js +2 -0
  31. package/dist/web/client/assets/resources-panel-DSU7VGX2.js +1 -0
  32. package/dist/web/client/assets/routes-DSTyx_J0.js +16 -0
  33. package/dist/web/client/assets/session-insights-panel-CQdT90Op.js +1 -0
  34. package/dist/web/client/assets/settings-dialog-CkfpTKfM.js +1 -0
  35. package/dist/web/client/assets/skeleton-loaders-fStjEeRP.js +1 -0
  36. package/dist/web/client/assets/square-terminal-BYTN_I86.js +1 -0
  37. package/dist/web/client/assets/subagent-chat-panel-D-qw4uWb.js +1 -0
  38. package/dist/web/client/assets/subagent-transcript-C7oRwEEP.js +1 -0
  39. package/dist/web/client/assets/subagents-panel-aSMWZP9p.js +1 -0
  40. package/dist/web/client/assets/{switch-ojzdMno9.js → switch-BFEBpUEU.js} +1 -1
  41. package/dist/web/client/assets/{tool-result-QvhjpNGX.js → tool-result-C2NvnN32.js} +3 -3
  42. package/dist/web/client/assets/ui-preferences-DUEFuJFj.js +1 -0
  43. package/dist/web/client/assets/workspace-panel-CjdXlEvd.js +1 -0
  44. package/dist/web/client/assets/workspace-path-nav-C0AQNZyy.js +1 -0
  45. package/dist/web/server/{_tanstack-start-manifest_v-uZddQetG-MNZGQOSA.js → _tanstack-start-manifest_v-DZc7dwm7-6ZQLGXB7.js} +23 -16
  46. package/dist/web/server/{artifacts-panel-knpQvJ-q-WJLZ76QB.js → artifacts-panel-Bt7YUzm4-NCBMXJ25.js} +39 -72
  47. package/dist/web/server/{chat-command-palette-CPv5GmGJ-22J32S6P.js → chat-command-palette-Co1L3rUY-RQLNME4T.js} +43 -20
  48. package/dist/web/server/{chunk-5277VI3D.js → chunk-2V6B62OF.js} +213 -275
  49. package/dist/web/server/{chunk-W7LNJCRJ.js → chunk-3HUI75QM.js} +75 -67
  50. package/dist/web/server/{chunk-I3FDTJFO.js → chunk-46VQY7SG.js} +6 -87
  51. package/dist/web/server/{chunk-PRT4QYOB.js → chunk-4UBOIY2S.js} +2 -35
  52. package/dist/web/server/{chunk-WTYNN6EV.js → chunk-54II5QXQ.js} +23 -1
  53. package/dist/web/server/chunk-56HSKUBD.js +1805 -0
  54. package/dist/web/server/{chunk-RPROZ2JC.js → chunk-5RQ6QAZX.js} +133 -133
  55. package/dist/web/server/{chunk-APN3LVRT.js → chunk-6D524OCJ.js} +201 -204
  56. package/dist/web/server/chunk-6GMKRR3C.js +161 -0
  57. package/dist/web/server/chunk-74QOI457.js +45 -0
  58. package/dist/web/server/{chunk-UBUXV2TW.js → chunk-AECEK3K7.js} +8 -8
  59. package/dist/web/server/chunk-AQ66E5OW.js +33 -0
  60. package/dist/web/server/{chunk-JD6EWZCU.js → chunk-AWFOBHH4.js} +50 -50
  61. package/dist/web/server/{chunk-MK3P3OBZ.js → chunk-BEMDNODD.js} +5 -5
  62. package/dist/web/server/{chunk-X2TUFLTP.js → chunk-BLVCDQ7E.js} +438 -438
  63. package/dist/web/server/chunk-FZRBAPUM.js +48 -0
  64. package/dist/web/server/chunk-G5BCQQ5N.js +34 -0
  65. package/dist/web/server/chunk-KOIPYBJF.js +3773 -0
  66. package/dist/web/server/{chunk-XYYNYFFD.js → chunk-LSIHVSUT.js} +2 -2
  67. package/dist/web/server/{chunk-KVHPE5XH.js → chunk-MDYA4NXK.js} +22 -8
  68. package/dist/web/server/chunk-NFRJDPB3.js +52 -0
  69. package/dist/web/server/chunk-P66QQWUM.js +67 -0
  70. package/dist/web/server/{chunk-4KFMONRT.js → chunk-PDRD2X5G.js} +9 -9
  71. package/dist/web/server/{chunk-XXNFEXDU.js → chunk-QJBEWT4E.js} +2 -70
  72. package/dist/web/server/{chunk-AQWTGP35.js → chunk-RX62LUDV.js} +8 -8
  73. package/dist/web/server/chunk-SR65ARVS.js +192 -0
  74. package/dist/web/server/{chunk-WK7CQS2N.js → chunk-SZ65K4CO.js} +48 -48
  75. package/dist/web/server/{chunk-C7EKOPZU.js → chunk-TO3YPLNZ.js} +89 -89
  76. package/dist/web/server/{chunk-IFV5M33X.js → chunk-UKINNXJY.js} +12 -26
  77. package/dist/web/server/chunk-VGDP4YDU.js +401 -0
  78. package/dist/web/server/{fleet-pi-tool-renderer-5vYFNeZS-IHKMLT7W.js → chunk-VRLTWOVJ.js} +46 -393
  79. package/dist/web/server/{chunk-KDSISV4P.js → chunk-WN77JNYY.js} +2 -50
  80. package/dist/web/server/{chunk-OADQILSQ.js → chunk-WZNZQNI4.js} +267 -3667
  81. package/dist/web/server/{chunk-KAWYGHDN.js → chunk-XFVL5ITL.js} +2354 -2314
  82. package/dist/web/server/{chunk-ZX3XOSYO.js → chunk-XLCTCC4W.js} +3 -3
  83. package/dist/web/server/{chunk-TTQ75CXC.js → chunk-Y4MHIA7B.js} +97 -40
  84. package/dist/web/server/fleet-pi-tool-renderer-CE45vM6T-2UQN6RJM.js +37 -0
  85. package/dist/web/server/{fork-picker-dialog-BZzfxdQd-C6SPHFAW.js → fork-picker-dialog-DCzuGelH-TN2Q5OXI.js} +5 -5
  86. package/dist/web/server/{markdown-Ct_q4D-z-VFWZRBTY.js → markdown-Boni3lHk-AZGKDNAR.js} +1 -1
  87. package/dist/web/server/{markdown-code-C_ih1bX1-5CIWT3CH.js → markdown-code-BrWukbg3-D2GN4Y77.js} +2 -2
  88. package/dist/web/server/{openui-renderer-BT5jL0Yf-XYLLN5U6.js → openui-renderer-c36_GYes-HX46N4M5.js} +14 -13
  89. package/dist/web/server/repl-panel-D9E8nkQy-L45ZNG2V.js +118 -0
  90. package/dist/web/server/{resources-panel-DNCVHTIg-PJYMXVGE.js → resources-panel-CwKh4U9f-D3VDEMDW.js} +6 -6
  91. package/dist/web/server/{router-DDxOMz3K-HRBXILHM.js → router-_ZpegqiQ-QIE44PIB.js} +1811 -1334
  92. package/dist/web/server/{routes-BX4Tv-6R-FHIZYUWW.js → routes-Ct81-8Tq-LHRMOS7R.js} +3958 -4534
  93. package/dist/web/server/server.js +3 -3
  94. package/dist/web/server/{session-insights-panel-gYkkAE8H-W4O74Z7H.js → session-insights-panel-BHZyKDTo-LRMAMA3O.js} +5 -3
  95. package/dist/web/server/{settings-dialog-BTBFLQ1P-ZENQ4KWK.js → settings-dialog-B4uUS6f--AZ4I4ZOT.js} +179 -193
  96. package/dist/web/server/{start-CLAD7RcD-56S4BWMM.js → start-BYVnok_H-IA6TWGA3.js} +1 -1
  97. package/dist/web/server/subagent-chat-panel-C97S3WID-DLOAD5TG.js +63 -0
  98. package/dist/web/server/subagents-panel-iHpvMIZy-LI6XK66M.js +181 -0
  99. package/dist/web/server/{chunk-5SZXUN3Y.js → workspace-panel-CHPoiXEo-YB4WS3MK.js} +29 -16
  100. package/package.json +15 -7
  101. package/dist/web/client/assets/artifacts-panel-8TyrNBM_.js +0 -1
  102. package/dist/web/client/assets/chat-command-palette-HpsmKfLO.js +0 -1
  103. package/dist/web/client/assets/collapsible-WCSnxhr2.js +0 -1
  104. package/dist/web/client/assets/command-DgfiCKcY.js +0 -2
  105. package/dist/web/client/assets/globals-BmxtUHFx.css +0 -2
  106. package/dist/web/client/assets/horizontal-resize-B76jjn5v.js +0 -1
  107. package/dist/web/client/assets/index-0pBr_bKy.js +0 -12
  108. package/dist/web/client/assets/markdown-BXWmNJo7.js +0 -2
  109. package/dist/web/client/assets/prime-agent-artifacts-k9JiTDZM.js +0 -5
  110. package/dist/web/client/assets/provider-brand-icon-VCebsuTD.js +0 -1
  111. package/dist/web/client/assets/range-KAaLzImH.js +0 -2
  112. package/dist/web/client/assets/resources-panel-BWuKeyrb.js +0 -1
  113. package/dist/web/client/assets/routes-BPRw0UzV.js +0 -20
  114. package/dist/web/client/assets/session-insights-panel-CPymkzZT.js +0 -1
  115. package/dist/web/client/assets/settings-dialog-6p8mjg8t.js +0 -1
  116. package/dist/web/client/assets/shared-DAI9OAw0.js +0 -2
  117. package/dist/web/client/assets/skeleton-loaders-qxIkJKCA.js +0 -1
  118. package/dist/web/client/assets/workspace-panel-C67-fqw4.js +0 -1
  119. package/dist/web/client/assets/workspace-path-nav-BrQHo6es.js +0 -9
  120. package/dist/web/server/chunk-KJ4UUAEU.js +0 -83
  121. package/dist/web/server/chunk-NGI44XRR.js +0 -334
  122. package/dist/web/server/workspace-panel-BNAXF57q-EQCBPEG4.js +0 -28
@@ -0,0 +1 @@
1
+ var e=/```(?:openui|openui-lang)(?:[ \t]*\r?\n|[ \t]+)([\s\S]*?)```/gi;function t(e,t,n,r){let i=t[n];t[n]+=1,e.push({content:r,id:`${n}-${i}`,type:n})}function n(t){let n=t.trim(),r=Array.from(n.matchAll(e)),i=r[0];return r.length===1&&i?.index===0&&i[0].length===n.length?i[1].trim():n}function r(e){return n(e).startsWith(`root =`)}function i(i){let a=[],o={markdown:0,openui:0},s=n(i);if(s.startsWith(`root =`))return t(a,o,`openui`,s),a;let c=0;for(let n of i.matchAll(e)){let e=n.index,s=i.slice(c,e);s.trim()&&t(a,o,`markdown`,s);let l=n[1].trim(),u=r(l);t(a,o,u?`openui`:`markdown`,u?l:n[0]),c=e+n[0].length}let l=i.slice(c);return l.trim()&&t(a,o,`markdown`,l),a.length>0||t(a,o,`markdown`,i),a}export{i as t};
@@ -0,0 +1,5 @@
1
+ function e(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.replace(/[^a-zA-Z0-9:_-]+/g,`-`).slice(0,96)}-${(t>>>0).toString(36)}`}function t(e){if(typeof e.createdAt==`number`)return e.createdAt;if(e.createdAt instanceof Date)return e.createdAt.getTime();if(typeof e.createdAt==`string`){let t=Date.parse(e.createdAt);if(Number.isFinite(t))return t}return 0}function n(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function r(e,...t){for(let n of t)if(typeof e?.[n]==`string`)return e[n]}function i(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.flatMap(e=>{let t=n(e);return typeof t?.text==`string`?[t.text]:[]}).join(``)||void 0}function a(e,t,n,r){return n.split(`
2
+ `).map((n,i)=>({id:`${e}-${t}-${r}-${i}`,type:r,content:n}))}function o(e){let t=n(e.input),i=n(e.output);return r(t,`path`,`file_path`,`filePath`)??r(i,`path`,`file_path`,`filePath`)??e.title}function s(e){let t=n(e.input),i=n(e.output),a=n(i?.details);return r(i,`diff`,`patch`)??r(a,`diff`,`patch`)??r(t,`diff`,`patch`)}function c(e){let t=n(e.input),i=n(e.output);return(Array.isArray(t?.edits)?t.edits:Array.isArray(i?.edits)?i.edits:[]).flatMap((t,i)=>{let o=n(t);if(!o)return[];let s=r(o,`oldText`,`old_string`,`before`),c=r(o,`newText`,`new_string`,`after`,`content`);return[...s===void 0?[]:a(e.id,i,s,`removed`),...c===void 0?[]:a(e.id,i,c,`added`)]})}function l(e){let t=s(e);if(t?.trim()){let n=t.split(`
3
+ `).map((t,n)=>({id:`${e.id}-${n}`,type:t.startsWith(`+`)&&!t.startsWith(`+++`)?`added`:t.startsWith(`-`)&&!t.startsWith(`---`)?`removed`:`context`,content:t}));return{file:o(e),lines:n,copyText:t}}let r=c(e);if(r.length>0)return{file:o(e),lines:r,copyText:r.map(e=>`${e.type===`added`?`+`:e.type===`removed`?`-`:` `}${e.content}`).join(`
4
+ `)};let l=n(e.input),u=n(e.output);if(!(e.title.toLowerCase().includes(`write`)||l?.content!==void 0))return;let d=i(l?.content)??i(u?.content);if(d===void 0)return;let f=a(e.id,0,d,`added`);return{file:o(e),lines:f,copyText:f.map(e=>`+${e.content}`).join(`
5
+ `)}}function u(e){let t=e.toLowerCase();if(!(t.includes(`thinking`)||t.includes(`reasoning`)||t.includes(`question`)))return t.includes(`bash`)||t.includes(`shell`)?`bash`:t.includes(`ipython`)||t.includes(`python`)?`ipython`:t.includes(`mcp`)?`mcp`:t.includes(`edit`)||t.includes(`write`)||t.includes(`patch`)?`diff`:`generic`}function d(e,t){let n=typeof e.state==`string`?e.state:void 0;return n===`output-error`||n===`error`?`error`:n===`output-available`||n===`complete`||n===`success`?`success`:n===`cancelled`||n===`canceled`||n===`aborted`||n===`interrupted`?`cancelled`:e.error===void 0?e.output!==void 0||e.result!==void 0?`success`:t===`streaming`?`running`:`cancelled`:`error`}function f(t,n){let r=t.find(e=>e.runId===n.runId);if(!r){t.push({id:e(`artifact-run:${n.runId}`),runId:n.runId,artifacts:[n],startedAt:n.timestamp,...n.status===`running`?{}:{endedAt:n.timestamp}});return}let i=r.artifacts.findIndex(e=>e.id===n.id);i<0?r.artifacts.push(n):r.artifacts[i]=n,n.status!==`running`&&(r.endedAt=n.timestamp)}function p(r,i){let a=[];for(let o of r)for(let[r,s]of o.parts.entries()){let c=n(s);if(!c)continue;let l=c?.type;if(typeof l!=`string`||!l.startsWith(`tool-`))continue;let p=l.slice(5),m=u(p);if(!m)continue;let h=c.input??c.args,g=c.output??c.result;if(h===void 0&&g===void 0)continue;let _=typeof c.toolCallId==`string`&&c.toolCallId?c.toolCallId:`${o.id}:${r}`,v=typeof c.runId==`string`&&c.runId?c.runId:o.id,y=t(o);f(a,{id:e(`${v}:${_}:${m}`),runId:v,sourceMessageId:o.id,...typeof c.toolCallId==`string`?{sourceToolCallId:c.toolCallId}:{},kind:m,title:p,status:d(c,i),...h===void 0?{}:{input:h},...g===void 0?{}:{output:g},...typeof c.backgroundOutput==`string`?{backgroundOutput:c.backgroundOutput}:{},timestamp:y})}return a}function m(e,t,n){let r=(t?.artifactRuns??[]).map(e=>({...e,artifacts:e.artifacts.map(e=>({...e}))}));for(let t of p(e,n))for(let e of t.artifacts)f(r,e);return r}export{l as n,m as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,A as a,B as o,D as s,E as c,G as l,H as u,I as d,J as f,L as p,O as m,T as h,U as g,V as _,W as v,X as y,et as b,g as x,h as S,j as C,k as w,l as T,nt as E,p as D,q as O,r as k,rt as A,u as j,z as M}from"./button-0At5xSyU.js";import{$ as N,A as P,B as F,C as I,F as ee,G as L,H as R,I as z,J as B,K as V,L as H,M as U,O as W,P as G,Q as te,R as K,U as ne,V as re,W as q,X as ie,_ as ae,at as oe,ct as se,d as ce,et as le,it as J,k as ue,n as de,p as fe,q as pe,r as me,rt as he,s as ge,st as _e,tt as Y,u as ve,v as ye,w as be,y as xe,z as Se}from"./x-BgciQ7_C.js";import{I as X,L as Ce,M as we,X as Te,Y as Ee,Z as De,_ as Oe,at as ke,g as Ae,h as je,it as Me,j as Ne,k as Pe,nt as Fe,ot as Ie,rt as Le,st as Re,tt as ze,v as Be,w as Ve,y as He}from"./dialog-DZ44tBtH.js";import{n as Ue,r as We}from"./useBaseUiId-B9f7fokB.js";import{t as Ge}from"./utils-Eg7xtNmV.js";import{n as Ke,t as qe}from"./useControlled-CoY1jSuL.js";import{t as Je}from"./chevron-down-BEVGmnSb.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et}from"./input-Clyn18XG.js";var Z=e(t(),1),Q=r(),tt=[`top`,`right`,`bottom`,`left`],nt=Math.min,rt=Math.max,it=Math.round,at=Math.floor,ot=e=>({x:e,y:e}),st={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ct(e,t,n){return rt(e,nt(t,n))}function lt(e,t){return typeof e==`function`?e(t):e}function ut(e){return e.split(`-`)[0]}function dt(e){return e.split(`-`)[1]}function ft(e){return e===`x`?`y`:`x`}function pt(e){return e===`y`?`height`:`width`}function mt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ht(e){return ft(mt(e))}function gt(e,t,n){n===void 0&&(n=!1);let r=dt(e),i=ht(e),a=pt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Tt(o)),[o,Tt(o)]}function _t(e){let t=Tt(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yt=[`left`,`right`],bt=[`right`,`left`],xt=[`top`,`bottom`],St=[`bottom`,`top`];function Ct(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bt:yt:t?yt:bt;case`left`:case`right`:return t?xt:St;default:return[]}}function wt(e,t,n,r){let i=dt(e),a=Ct(ut(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vt)))),a}function Tt(e){let t=ut(e);return st[t]+e.slice(t.length)}function Et(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Et(e)}function Ot(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 kt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function At(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:a=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=ae}=t,u=`rootStore`in e?e.rootStore:e,d=u.context.dataRef,f=Z.useRef(void 0),m=G(),h=i(),g=Z.useMemo(()=>{function e(e,t,n,r){let i=de(l,t,n);e&&r===`touch`&&c>0?h.start(c,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=d.current.openEvent,i=u.select(`domReferenceElement`)!==t;return e&&i||!e||!a?!0:r&&s?!n(r.type):!1}return{onPointerDown(e){f.current=Me(e.pointerType,!0)&&Ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=f.current,a=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||Me(i,!0)&&o)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),l=_(a);if(p(l)){e(c,a,l,i);return}let d=n.currentTarget;m.request(()=>{e(c,a,d,i)})},onClick(n){if(r===`mousedown-only`)return;let i=f.current;if(r===`mousedown`&&i){f.current=void 0;return}Me(i,!0)&&o||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){f.current=void 0}}},[d,r,o,l,u,s,a,m,h,c]);return Z.useMemo(()=>n?{reference:g}:se,[n,g])}function jt(e,t,n){let{reference:r,floating:i}=e,a=mt(t),o=ht(t),s=pt(o),c=ut(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=dt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mt(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}=lt(t,e),p=Dt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ot(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=Ot(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 Nt=50,Pt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=jt(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<Nt&&(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}=jt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ft=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}=lt(e,t)||{};if(l==null)return{};let d=Dt(u),f={x:n,y:r},p=ht(i),m=pt(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=nt(d[_],T),D=nt(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ct(E,k,O),j=!c.arrow&&dt(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}}}),It=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}=lt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ut(r),_=mt(o),v=ut(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Tt(o)]:_t(o)),x=p!==`none`;!d&&x&&b.push(...wt(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=gt(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`||_===mt(t)||T.every(e=>mt(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=mt(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 Lt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rt(e){return tt.some(t=>e[t]>=0)}var zt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lt(e,t);switch(i){case`referenceHidden`:{let e=Lt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rt(e)}}}case`escaped`:{let e=Lt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rt(e)}}}default:return{}}}}},Bt=new Set([`left`,`top`]);async function Vt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ut(n),s=dt(n),c=mt(n)===`y`,l=Bt.has(o)?-1:1,u=a&&c?-1:1,d=lt(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 Ht=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 Vt(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}}}}},Ut=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}=lt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mt(i),p=ft(f),m=u[p],h=u[f],g=(e,t)=>ct(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}}}}}},Wt=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}=lt(e,t),u={x:n,y:r},d=mt(i),f=ft(d),p=u[f],m=u[d],h=lt(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=Bt.has(ut(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}}}},Gt=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}=lt(e,t),c=await i.detectOverflow(t,s),l=ut(n),u=dt(n),d=mt(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=nt(p-c[m],g),y=nt(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*rt(c.left,c.right):S=p-2*rt(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 Kt(e){let t=z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pe(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=it(n)!==a||it(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qt(e){return V(e)?e:e.contextElement}function Jt(e){let t=qt(e);if(!pe(t))return ot(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Kt(t),o=(a?it(n.width):n.width)/r,s=(a?it(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Yt=ot(0);function Xt(e){let t=q(e);return!le()||!t.visualViewport?Yt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function Qt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qt(e),o=ot(1);t&&(r?V(r)&&(o=Jt(r)):o=Jt(e));let s=Zt(a,n,r)?Xt(a):ot(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=q(a),t=V(r)?q(r):r,n=e,i=Se(n);for(;i&&t!==n;){let e=Jt(i),t=i.getBoundingClientRect(),r=z(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=q(i),i=Se(n)}}return Ot({width:u,height:d,x:c,y:l})}function $t(e,t){let n=re(e).scrollLeft;return t?t.left+n:Qt(K(e)).left+n}function en(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$t(e,n),y:n.top+t.scrollTop}}function tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?N(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ot(1),u=ot(0),d=pe(r);if((d||!a)&&((F(r)!==`body`||ie(o))&&(c=re(r)),d)){let e=Qt(r);l=Jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?en(o,c):ot(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 nn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rn(e){let t=re(e),n=e.ownerDocument.body,r=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$t(e),o=-t.scrollTop;return z(n).direction===`rtl`&&(a+=rt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var an=25;function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=q(e),a=K(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!le()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($t(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<=an&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=Qt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=rn(K(e));else if(V(t))r=sn(t,n);else{let n=Xt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ot(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=R(e,[],!1).filter(e=>V(e)&&F(e)!==`body`),i=null,a=z(e).position===`fixed`,o=a?ne(e):e;for(;V(o)&&!B(o);){let e=z(o),t=L(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ne(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?N(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(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=cn(t,a[e],i);s=rt(n.top,s),c=nt(n.right,c),l=nt(n.bottom,l),u=rt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Kt(e);return{width:t,height:n}}function fn(e,t,n){let r=pe(t),i=K(t),a=n===`fixed`,o=Qt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ot(0);if((r||!a)&&((F(t)!==`body`||ie(i))&&(s=re(t)),r)){let e=Qt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$t(i));let l=i&&!r&&!a?en(i,s):ot(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 pn(e){return z(e).position===`static`}function mn(e,t){if(!pe(e)||z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=q(e);if(N(e))return n;if(!pe(e)){let t=ne(e);for(;t&&!B(t);){if(V(t)&&!pn(t))return t;t=ne(t)}return n}let r=mn(e,t);for(;r&&te(r)&&pn(r);)r=mn(r,t);return r&&B(r)&&pn(r)&&!L(r)?n:r||H(e)||n}var gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return z(e).direction===`rtl`}var vn={convertOffsetParentRelativeRectToViewportRelativeRect:tn,getDocumentElement:K,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:nn,getDimensions:dn,getScale:Jt,isElement:V,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=K(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=at(d),h=at(a.clientWidth-(u+f)),g=at(a.clientHeight-(d+p)),_=at(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:rt(0,nt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(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=q(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(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=qt(e),u=i||a?[...l?R(l):[],...t?R(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(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?Qt(e):null;c&&g();function g(){let t=Qt(e);h&&!yn(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 Sn=Ht,Cn=Ut,wn=It,Tn=Gt,En=zt,Dn=Ft,On=Wt,kn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return Pt(e,t,{...i,platform:a})},An=e(n(),1),jn=typeof document<`u`?Z.useLayoutEffect:function(){};function Mn(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(!Mn(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)&&!Mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Nn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pn(e,t){let n=Nn(e);return Math.round(t*n)/n}function Fn(e){let t=Z.useRef(e);return jn(()=>{t.current=e}),t}function In(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]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Mn(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Fn(c),D=Fn(i),O=Fn(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),kn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Mn(w.current,t)&&(w.current=t,An.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);jn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);jn(()=>(A.current=!0,()=>{A.current=!1}),[]),jn(()=>{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=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Pn(M.floating,u.x),r=Pn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Nn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ln=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?{}:Dn({element:r.current,padding:i}).fn(n):r?Dn({element:r,padding:i}).fn(n):{}}}},Rn=(e,t)=>{let n=Sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},zn=(e,t)=>{let n=Cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bn=(e,t)=>({fn:On(e).fn,options:[e,t]}),Vn=(e,t)=>{let n=wn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>{let n=Tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Un=(e,t)=>{let n=En(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=Ln(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Gn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=I(),a=ze()!=null,o=oe(()=>new Ee({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new X,floatingId:i,syncOnly:!1,nested:a})).current;return J(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=V(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Kn(e){return qn(e,e.rootContext)}function qn(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=Fe(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=In({...e,elements:{..._,...l&&{reference:l}}}),y=V(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=V(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(V(e)||e===null)&&(h.current=e,f(e)),(V(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!V(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return J(()=>{o&&(h.current=o)},[o]),J(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jn=`Escape`;function Yn(e){return f&&e.movementX===0&&e.movementY===0}function Xn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Zn(e,t){return Xn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Qn(e,t,n){return Xn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function $n(e,t,n){return Xn(t,n?e===g:e===v,e===u)}function er(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Jn:Xn(t,n?e===v:e===g,e===l)}function tr(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:l=null,allowEscape:u=!1,loopFocus:f=!1,nested:p=!1,rtl:m=!1,virtual:g=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:T=`vertical`,parentOrientation:E,id:D,resetOnPointerLeave:O=!0,externalTree:k,grid:A}=t,j=A!=null,N=`rootStore`in e?e.rootStore:e,P=N.useState(`open`),F=N.useState(`floatingElement`),I=N.useState(`domReferenceElement`),ee=N.context.dataRef,L=C(F),R=d(I),z=We(L),B=ze(),V=Fe(k),H=Z.useRef(v),U=Z.useRef(l??-1),W=Z.useRef(null),te=Z.useRef(!0),K=Y(e=>{i(U.current===-1?null:U.current,e)}),ne=Z.useRef(!!F),re=Z.useRef(P),q=Z.useRef(!1),ie=Z.useRef(!1),ae=Z.useRef(null),oe=We(S),se=We(P),le=We(l),ue=We(O),fe=G(),me=G(),he=Y(()=>{function e(e){g?V?.events.emit(`virtualfocus`,e):ae.current=Le(e,{sync:q.current,preventScroll:!0})}let t=n.current[U.current],r=ie.current;t&&e(t),(q.current?e=>e():e=>fe.request(e))(()=>{let i=n.current[U.current]||t;i&&(t||e(i),Se&&(r||!te.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});J(()=>{ee.current.orientation=T},[ee,T]),J(()=>{a&&(P&&F?(U.current=l??-1,H.current&&l!=null&&(ie.current=!0,K())):ne.current&&(U.current=-1,K()))},[a,P,F,l,K]),J(()=>{if(a){if(!P){q.current=!1;return}if(F){if(r==null){if(q.current=!1,le.current!=null)return;if(ne.current&&(U.current=-1,he()),(!re.current||!ne.current)&&H.current&&(W.current!=null||H.current===!0&&W.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>me.request(e):queueMicrotask)(t),e+=1):(U.current=W.current==null||Qn(W.current,T,m)||p?s(n):c(n),W.current=null,K())};t()}}else w(n.current,r)||(U.current=r,he(),ie.current=!1)}}},[a,P,F,r,le,p,n,T,m,K,he,me]),J(()=>{if(!a||F||!V||g||!ne.current)return;let e=V.nodesRef.current,t=e.find(e=>e.id===B)?.context?.elements.floating,n=M(b(I??t??null)),r=e.some(e=>e.context&&o(e.context.elements.floating,n));t&&!r&&te.current&&t.focus({preventScroll:!0})},[a,F,I,V,B,g]),J(()=>{re.current=P,ne.current=!!F}),J(()=>{P||(W.current=null,H.current=v)},[P,v]);let _e=r!=null,ve=Y(e=>{if(!se.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(U.current!==t||r!==t)&&(U.current=t,K(e))}),ye=Y(()=>E??V?.nodesRef.current.find(e=>e.id===B)?.context?.dataRef?.current.orientation),be=Y(()=>s(n,oe.current)),xe=Y(e=>{if(te.current=!1,q.current=!0,e.which===229||!se.current&&e.currentTarget===z.current)return;if(p&&er(e.key,T,m,j)){Zn(e.key,ye())||Re(e),N.setOpen(!1,de(ce,e.nativeEvent)),pe(I)&&(g?V?.events.emit(`virtualfocus`,I):I.focus());return}let t=U.current,r=s(n,S),i=c(n,S);if(R||(e.key===`Home`&&(Re(e),U.current=r,K(e)),e.key===`End`&&(Re(e),U.current=i,K(e))),A!=null){let t=A(e,U.current,n,T,f,m,S,r,i);if(t!=null&&(U.current=t,K(e)),T===`both`)return}if(Zn(e.key,T)){if(Re(e),P&&!g&&M(e.currentTarget.ownerDocument)===e.currentTarget){U.current=Qn(e.key,T,m)?r:i,K(e);return}Qn(e.key,T,m)?f?t>=i?u&&t!==n.current.length?U.current=-1:(q.current=!1,U.current=r):U.current=h(n.current,{startingIndex:t,disabledIndices:S}):U.current=Math.min(i,h(n.current,{startingIndex:t,disabledIndices:S})):f?t<=r?u&&t!==-1?U.current=n.current.length:(q.current=!1,U.current=i):U.current=h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S}):U.current=Math.max(r,h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S})),w(n.current,U.current)&&(U.current=-1),K(e)}}),Se=Z.useMemo(()=>({onFocus(e){q.current=!0,ve(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Yn(e)||(q.current=!0,ie.current=!1,y&&ve(e))},onPointerLeave(e){if(!se.current||!te.current||e.pointerType===`touch`)return;q.current=!0;let t=e.relatedTarget;if(!(!y||n.current.includes(t))&&ue.current&&(ae.current?.(),ae.current=null,U.current=-1,K(e),!g)){let e=z.current,t=M(b(e));e&&o(e,t)&&e.focus({preventScroll:!0})}}}),[ve,se,z,y,n,K,ue,g]),X=Z.useMemo(()=>g&&P&&_e&&{"aria-activedescendant":`${D}-${r}`},[g,P,_e,D,r]),Ce=Z.useMemo(()=>({"aria-orientation":T===`both`?void 0:T,...R?{}:X,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&P&&!g){let t=_(e.nativeEvent);if(t&&!o(z.current,t))return;Re(e),N.setOpen(!1,de(ge,e.nativeEvent)),pe(I)&&I.focus();return}xe(e)},onPointerMove(e){Yn(e)||(te.current=!0)}}),[X,xe,z,T,R,N,P,g,I]),we=Z.useMemo(()=>{function e(e){N.setOpen(!0,de(ce,e.nativeEvent,e.currentTarget))}function t(e){v===`auto`&&ke(e.nativeEvent)&&(H.current=!g)}function n(e){H.current=v,v===`auto`&&Ie(e.nativeEvent)&&(H.current=!0)}return{onKeyDown(t){let n=N.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=$n(t.key,ye(),m),a=Zn(t.key,T),o=(p?i:a)||t.key===`Enter`||t.key.trim()===``;if(g&&n)return xe(t);if(!(!n&&!x&&r)){if(o){let e=Zn(t.key,ye());W.current=p&&e?null:t.key}if(p){i&&(Re(t),n?(U.current=be(),K(t)):e(t));return}a&&(le.current!=null&&(U.current=le.current),Re(t),!n&&x?e(t):xe(t),n&&K(t))}},onFocus(e){N.select(`open`)&&!g&&(U.current=-1,K(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[xe,v,be,p,K,N,x,T,ye,m,le,g]),Te=Z.useMemo(()=>({...X,...we}),[X,we]);return Z.useMemo(()=>a?{reference:Te,floating:Ce,item:Se,trigger:we}:{},[a,Te,Ce,we,Se])}function nr(e,t){let{listRef:n,elementsRef:r,activeIndex:s,onMatch:c,disabledIndices:l,onTyping:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,h=`rootStore`in e?e.rootStore:e,g=h.useState(`open`),_=i(),v=Z.useRef(``),y=Z.useRef(p??s??-1),b=Z.useRef(null),x=Y(e=>{function t(e){return r?.current[e]}function i(e){let n=t(e);return n&&!m(n)||n?.matches(`:disabled`)?!1:l==null||!a(_e,e,l)}function o(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,a=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(a)||!i(n)))return n}return-1}let d=n.current;if(v.current.length>0&&e.key===` `&&(Re(e),u?.(!0)),v.current.length>0&&v.current[0]!==` `&&o(d,v.current)===-1&&e.key!==` `&&u?.(!1),d==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;g&&e.key!==` `&&(Re(e),u?.(!0));let h=v.current===``;h&&(y.current=p??s??-1),d.every((e,t)=>e&&i(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&v.current===e.key&&(v.current=``,y.current=b.current),v.current+=e.key,_.start(f,()=>{v.current=``,y.current=b.current,u?.(!1)});let x=((h?p??s??-1:y.current)??0)+1,S=o(d,v.current,x);S===-1?e.key!==` `&&(v.current=``,u?.(!1)):(c?.(S),b.current=S)}),S=Y(e=>{let t=e.relatedTarget,n=h.select(`domReferenceElement`),r=h.select(`floatingElement`);o(n,t)||o(r,t)||(_.clear(),v.current=``,y.current=b.current,u?.(!1))});J(()=>{!g&&p!==null||(_.clear(),b.current=null,v.current!==``&&(v.current=``))},[g,p,_]);let C=Z.useMemo(()=>({onKeyDown:x,onBlur:S}),[x,S]);return Z.useMemo(()=>d?{reference:C,floating:C}:{},[d,C])}var rr=Z.createContext(void 0);function ir(){return Z.useContext(rr)?.direction??`ltr`}var ar=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,offsetParent:d=`real`}=lt(e,t)||{};if(l==null)return{};let f=Dt(u),p={x:n,y:r},m=ht(i),h=pt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ct(k,j,A),N=!c.arrow&&dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),or=(e,t)=>({...ar(e),options:[e,t]}),sr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},cr={sideX:`left`,sideY:`top`},lr=`--available-width`,ur=`--available-height`;function dr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function fr(e,t,n){let{rects:r,placement:i}=e;return{side:dr(t,ut(i),n),align:dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function pr(e){return mr(e,Kn)}function mr(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Z.useState(null);!g&&w!==null&&T(null);let E=_.side||`flip`,D=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=Y(j),N=j?M:n,P=We(n),F=We(g),I=ir()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],L=o===`center`?ee:`${ee}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Z.useRef(null),G=We(a),te=We(s),K=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,re=[];p&&re.push(p),re.push(Rn(e=>{let t=fr(e,i,I),n=typeof G.current==`function`?G.current(t):G.current,r=typeof te.current==`function`?te.current(t):te.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[K,ne,I,i]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||k||E===`shift`),oe=E===`none`?null:Vn({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!k&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O}),se=ie?null:zn({...U,rootBoundary:A,mainAxis:D!==`none`,crossAxis:ae,limiter:u||k?void 0:Bn(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=mt(ut(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,k,A,R,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Hn({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(lr,`${t}px`),i.setProperty(ur,`${n}px`);let a=q(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),or(e=>({element:W.current||b(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=ut(r),l=mt(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(fr(e,i,I)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},sr,x),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ce=Z.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:re,strategy:r,whileElementsMounted:m?void 0:(...e)=>xn(...e,ce),nodeId:y,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||cr,xe=_e?r:`fixed`,Se=Z.useMemo(()=>{let e;return e=_e?x?{position:xe,[ye]:de,[be]:fe}:{...ve,position:xe}:{position:xe,top:0,left:0},e[lr]=`100vw`,e[ur]=`100vh`,_e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),X=Z.useRef(null);J(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(hr(t)?t.current:t)||null;n!==X.current&&(le.setPositionReference(n),X.current=n)},[g,le,N,P]),Z.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&hr(e)&&e.current!==X.current&&(le.setPositionReference(e.current),X.current=e.current)},[g,le,N,P]),Z.useEffect(()=>{if(m&&g&&ue.reference&&ue.floating)return xn(ue.reference,ue.floating,me,ce)},[m,g,ue,me,ce]);let Ce=ut(he),we=dr(i,Ce,I),Te=dt(he)||`center`,Ee=!!pe.hide?.referenceHidden;J(()=>{S&&g&&_e&&Ce!==ee&&T(Ce)},[S,g,_e,Ce,ee]);let De=Z.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),Oe=pe.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Se,arrowStyles:De,arrowRef:W,arrowUncentered:Oe,side:we,align:Te,physicalSide:Ce,anchorHidden:Ee,refs:le,context:ge,isPositioned:_e,update:me}),[Se,De,W,Oe,we,Te,Ce,Ee,le,ge,_e,me])}function hr(e){return e!=null&&`current`in e}function gr(e){return e===`starting`?T:se}function _r(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ue(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},gr(r),i],stateAttributesMapping:Pe})}var vr=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function yr(){return Z.useContext(vr)}function br(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=Z.useState(!1),s=oe(Sr).current,c=oe(xr).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>!e))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Tr(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Er(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wr(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Y(()=>{let[e,t]=Cr(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});J(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Y(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(vr.Provider,{value:b,children:t})}function xr(){return new Map}function Sr(){return new Set}function Cr(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Er(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Tr(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Er(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dr(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=yr(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Or=Z.createContext(void 0),kr={disableStyleElements:!1};function Ar(){return Z.useContext(Or)??kr}function jr(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function Mr(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Nr(e,t){let n=Z.useRef(e),r=Y(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Pr(e,t){let{onClick:n,onPointerDown:r}=Mr(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(y?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Fr(e){let[t,n]=Z.useState(null),r=Pr(e,n);return Nr(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Ir=20;function Lr(e,t,n,r){let[i,a]=Z.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=b(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Ir)},[e,t,n]),Be(e&&(!t||i),r)}var Rr=Z.createContext(void 0);function zr(e){let t=Z.useContext(Rr);if(t===void 0&&!e)throw Error(he(69));return t}function Br(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function Vr(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}var Hr=Z.createContext(null);function Ur(){let e=Z.useContext(Hr);if(e===null)throw Error(he(60));return e}var Wr=(e,t)=>Object.is(e,t);function Gr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Kr(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Gr(e,t,n))}function qr(e,t,n){return e.filter(e=>!Gr(t,e,n))}function Jr(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Yr(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Xr(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Yr(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Zr(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Jr(e)}function Qr(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Jr(e.value):Jr(e)}function $r(e,t,n){function r(){return Zr(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Yr(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function ei(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:$r(r,t,n)},i)),e),[])}var $={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Qr(t,r)!==``},hasNullItemLabel:(e,t)=>t?Xr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Gr(t,e,n)):Gr(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function ti(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function ni(e,t){return Math.max(0,e-t)}function ri(e,t){if(t<=0)return 0;let n=kt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function ii(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w=Wr,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:O}=Ye(),{setDirty:k,setTouched:j,setFocused:M,validityData:N,setFilled:F,name:I,disabled:ee,validation:L,validationMode:R}=Qe(),z=$e({id:t}),B=ee||d,V=I??c,[H,W]=qe({controlled:n,default:y?r??_e:r,name:`Select`,state:`value`}),[G,te]=qe({controlled:a,default:o,name:`Select`,state:`open`}),K=Z.useRef([]),ne=Z.useRef([]),re=Z.useRef(null),q=Z.useRef(null),ie=Z.useRef(0),ae=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),pe=Z.useRef(null),me=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=Z.useRef(!1),{mounted:ge,setMounted:ve,transitionStatus:ye}=Ue(G),{openMethod:xe,triggerProps:Se}=Fr(G),X=oe(()=>new E({id:z,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,value:H,open:G,mounted:ge,transitionStatus:ye,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,we=A(X,$.activeIndex),Ee=A(X,$.selectedIndex),De=A(X,$.triggerElement),Oe=A(X,$.positionerElement),ke=Br(xe),Ae=xe??ke,je=Z.useMemo(()=>y?``:Qr(H,C),[y,H,C]),Me=Z.useMemo(()=>y&&Array.isArray(H)?H.map(e=>Qr(e,C)):Qr(H,C),[y,H,C]),Ne=We(De),Pe=Y(()=>Me);Ze(Ne,z,H,Pe,!B,c);let Fe=Z.useRef(H),Ie=y?Array.isArray(H)&&H.length>0:H!=null&&je!==``;J(()=>{F(Ie)},[Ie,F]),J(function(){let e=H,t=!1;if(y){let n=Array.isArray(H)?H:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Kr(ce.current,e,w),r=n===-1?null:n;r===null&&(pe.current=null),!G&&X.set(`selectedIndex`,r)},[y,G,H,w,X]);function Le(e){let t=N.initialValue;return Array.isArray(e)&&Array.isArray(t)?!ti(e,t,(e,t)=>Gr(e,t,w)):e!==t}Nr(H,()=>{O(V),k(Le(H)),L.change(H)});let Re=Y((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(j(!0),M(!1),R===`onBlur`&&L.commit(H)))}),ze=Y(()=>{ve(!1),X.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});be({enabled:!h,open:G,ref:re,onComplete(){G||ze()}}),Z.useImperativeHandle(h,()=>({unmount:ze}),[ze]);let Be=Y((e,t)=>{i?.(e,t),!t.isCanceled&&W(e)}),Ve=Y(e=>{let t=ni(e.scrollHeight,e.clientHeight),n=ri(e.scrollTop,t),r=n>0,i=n<t;X.set(`scrollUpArrowVisible`,r),X.set(`scrollDownArrowVisible`,i)}),He=Gn({open:G,onOpenChange:Re,elements:{reference:De,floating:Oe}}),Ge=At(He,{enabled:!f&&!B,event:`mousedown`}),Ke=Te(He),Je=tr(He,{enabled:!f&&!B,listRef:K,activeIndex:we,selectedIndex:Ee,disabledIndices:_e,onNavigate(e){e===null&&!G||X.set(`activeIndex`,e)},focusItemOnHover:T}),Xe=nr(He,{enabled:!f&&!B&&(G||!y),listRef:ne,activeIndex:we,selectedIndex:Ee,disabledIndices:e=>jr(K.current[e]),onMatch(e){G?X.set(`activeIndex`,e):Be(ce.current[e],de(fe))},onTyping(e){le.current=e}}),et=Z.useMemo(()=>P(Xe.reference,Je.reference,Ke.reference,Ge.reference,Se),[Ge.reference,Xe.reference,Je.reference,Ke.reference,Se]),tt=Z.useMemo(()=>P(Ce,Xe.floating,Je.floating,Ke.floating),[Xe.floating,Je.floating,Ke.floating]),nt=Je.item??se;Vr(()=>{X.update({popupProps:tt,triggerProps:et})}),X.useSyncedValues({id:z,modal:m,multiple:y,value:H,open:G,mounted:ge,transitionStatus:ye,popupProps:tt,triggerProps:et,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ae});let rt=Z.useMemo(()=>({store:X,floatingContext:He,required:p,disabled:B,readOnly:f,multiple:y,highlightItemOnHover:T,setValue:Be,setOpen:Re,listRef:K,popupRef:re,scrollHandlerRef:q,handleScrollArrowVisibility:Ve,scrollArrowsMountedCountRef:ie,itemProps:nt,valueRef:ae,valuesRef:ce,labelsRef:ne,typingRef:le,selectionRef:me,firstItemTextRef:ue,selectedItemTextRef:pe,validation:L,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:he,initialValueRef:Fe}),[X,He,p,B,f,y,T,Be,Re,nt,L,_,Ve]),it=U(g,L.inputRef),at=y?void 0:V,ot=Z.useMemo(()=>!y||!Array.isArray(H)||!V?null:H.map(e=>{let t=Qr(e,C);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:V,value:t,disabled:B},t)}),[y,H,l,V,C,B]);return(0,Q.jsxs)(Hr.Provider,{value:rt,children:[D,(0,Q.jsx)(`input`,{...L.getValidationProps(B,{onFocus(){X.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||B||f)return;let t=e.currentTarget.value,n=de(fe,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>Qr(t,C).toLowerCase()===e||Zr(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Be(i,n)}X.set(`forceMount`,!0),queueMicrotask(r)}}),id:z&&at==null?`${z}-hidden-input`:void 0,form:l,name:at,autoComplete:u,value:je,disabled:B,required:p&&!(y&&Ie),readOnly:f,ref:it,style:V?x:S,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ot]})}function ai(e,t){return e??t}var oi=5;function si(e,t){let n=ci(t);return e.clientX>=n.left-oi&&e.clientX<=n.right+oi&&e.clientY>=n.top-oi&&e.clientY<=n.bottom+oi}function ci(e){let t=e.getBoundingClientRect(),n=q(e);if(O)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var li=400,ui={...Ne,...et,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},di=Z.forwardRef(function(e,t){let{render:n,className:r,id:a,disabled:s=!1,nativeButton:c=!0,style:l,...u}=e,{setTouched:d,setFocused:f,validationMode:p,state:m,disabled:h}=Qe(),{labelId:g}=Xe(),{store:_,setOpen:v,selectionRef:y,validation:x,readOnly:S,required:w,alignItemWithTriggerActiveRef:T,disabled:E}=Ur(),D=h||E||s,O=A(_,$.open),k=A(_,$.mounted),j=A(_,$.value),M=A(_,$.triggerProps),N=A(_,$.positionerElement),F=A(_,$.listElement),I=A(_,$.popupSide),ee=A(_,$.id),L=A(_,$.labelId),R=A(_,$.hasSelectedValue),z=k&&N?I:null,B=a??ee,V=ai(g,L);$e({id:B});let H=We(N),U=Z.useRef(null),{getButtonProps:W,buttonRef:G}=xe({disabled:D,native:c}),te=_.useStateSetter(`triggerElement`),K=i(),ne=i(),re=i();Z.useEffect(()=>{if(O)return re.start(li,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{re.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ne.clear()},[O,y,ne,re]);let q=P(M,{id:B,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-controls":O?F?.id??C(N)?.id:void 0,"aria-labelledby":V,"aria-readonly":S||void 0,"aria-required":w||void 0,tabIndex:D?-1:0,onFocus(e){f(!0),O&&T.current&&v(!1,de(fe,e.nativeEvent)),K.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){o(N,e.relatedTarget)||(d(!0),f(!1),p===`onBlur`&&x.commit(j))},onMouseDown(e){if(O)return;let t=b(e.currentTarget);function n(e){if(!U.current)return;let t=e.target;o(U.current,t)||o(H.current,t)||si(e,U.current)||v(!1,de(me,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},u,W),ie=x.getValidationProps(D,q);ie.role=`combobox`;let ae={...m,open:O,disabled:D,value:j,readOnly:S,popupSide:z,placeholder:!R};return ue(`button`,e,{ref:[t,U,G,te],state:ae,stateAttributesMapping:ui,props:ie})}),fi={value:()=>null},pi=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Ur(),u=A(c,$.value),d=A(c,$.items),f=A(c,$.itemToStringLabel),p=A(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=A(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?ei(u,d,f):$r(u,d,f)),ue(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:fi})}),mi=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ur(),s={open:A(o,$.open)};return ue(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:we})}),hi=Z.forwardRef(function(e,t){let{store:n}=Ur(),r=A(n,$.mounted),i=A(n,$.forceMount);return r||i?(0,Q.jsx)(k,{ref:t,...e}):null}),gi=Z.createContext(void 0);function _i(){let e=Z.useContext(gi);if(!e)throw Error(he(59));return e}function vi(e,t){e&&Object.assign(e.style,t)}var yi={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},bi={position:`fixed`},xi=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=j,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:O,floatingContext:k}=Ur(),M=A(y,$.open),N=A(y,$.mounted),P=A(y,$.modal),F=A(y,$.value),I=A(y,$.openMethod),ee=A(y,$.positionerElement),L=A(y,$.triggerElement),R=A(y,$.isItemEqualToValue),z=A(y,$.transitionStatus),B=Z.useRef(null),V=Z.useRef(null),[H,U]=Z.useState(h),W=N&&H&&I!==`touch`;!N&&H!==h&&U(h),Z.useImperativeHandle(S,()=>W),Lr((W||P)&&M,I===`touch`,ee,L);let G=pr({anchor:n,floatingRootContext:k,positionMethod:a,mounted:N,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??W,collisionAvoidance:g,keepMounted:!0}),te=W?`none`:G.side,K=W?bi:G.positionerStyles,ne={open:M,side:te,align:G.align,anchorHidden:G.anchorHidden};J(()=>{y.set(`popupSide`,G.side)},[y,G.side]);let re=_r(e,ne,{styles:K,transitionStatus:z,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!N,inert:!M}),q=Z.useRef(0),ie=Y(e=>{if(w.current.length===0)return;let t=q.current;if(q.current=e.size,e.size===t)return;let n=de(fe);if(t!==0&&!y.state.multiple&&F!==null&&Kr(w.current,F,R)===-1){let e=T.current,t=e!=null&&Kr(w.current,e,R)!==-1?e:null;O(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(F)){let e=F.filter(e=>Kr(w.current,e,R)!==-1);e.length!==F.length&&(O(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(M&&W){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};vi(ee,e),vi(E.current,e)}}),ae=Z.useMemo(()=>({...G,side:te,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:U,scrollUpArrowRef:B,scrollDownArrowRef:V}),[G,te,W,U]);return(0,Q.jsx)(br,{elementsRef:b,labelsRef:x,onMapChange:ie,children:(0,Q.jsxs)(gi.Provider,{value:ae,children:[N&&P&&(0,Q.jsx)(He,{inert:D(!M),cutout:L}),re]})})}),Si=`base-ui-disable-scrollbar`,Ci={className:Si,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:Si,precedence:`base-ui:low`,children:`.${Si}{scrollbar-width:none}.${Si}::-webkit-scrollbar{display:none}`})}},wi={...Pe,...W},Ti=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y,floatingContext:x}=Ur(),{side:S,align:C,alignItemWithTriggerActive:w,isPositioned:T,setControlledAlignItemWithTrigger:E}=_i(),D=zr(!0)!=null,O=ir(),{nonce:k,disableStyleElements:j}=Ar(),M=A(s,$.id),N=A(s,$.open),P=A(s,$.openMethod),F=A(s,$.mounted),I=A(s,$.popupProps),L=A(s,$.transitionStatus),R=A(s,$.triggerElement),z=A(s,$.positionerElement),B=A(s,$.listElement),V=Z.useRef(!1),H=Z.useRef(!1),U=Z.useRef({}),W=G(),te=Y(e=>{if(!z||!c.current||!H.current)return;let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(V.current||!w||!t&&!n){g(e);return}let r=Oi(z),i=ki(z.getBoundingClientRect().height,`y`,r),a=b(z),o=q(z),s=o.getComputedStyle(z),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=Ei(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Di(e),h=null,_=e=>{z.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=kt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(V.current=!0),g(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let x=Math.ceil(y);if(x!==0&&_(x),h!=null){let t=kt(h,0,Di(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}x>=f-1&&(V.current=!0),g(e)});Z.useImperativeHandle(_,()=>te,[te]),be({open:N,ref:c,onComplete(){N&&l?.(!0)}});let K={open:N,transitionStatus:L,side:S,align:C};J(()=>{!z||!c.current||Object.keys(U.current).length||(U.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),J(()=>{N||w||(H.current=!1,V.current=!1,vi(z,U.current))},[N,w,z,c]),J(()=>{let e=c.current;if(!N||!R||!z||!e||w&&!T||s.state.transitionStatus===`ending`)return;if(H.current=!0,e.style.removeProperty(`--transform-origin`),!w){W.request(()=>g(B||e));return}let t=Mi(e);try{let t=m.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&p.current?.isConnected?p.current:null);let n=d.current,r=q(z),i=r.getComputedStyle(z),a=r.getComputedStyle(e),o=b(R),c=Oi(R),l=Ai(R.getBoundingClientRect(),c),u=Ai(z.getBoundingClientRect(),c),h=l.height,_=B||e,x=_.scrollHeight,S=parseFloat(a.borderBottomWidth),C=parseFloat(i.marginTop)||10,w=parseFloat(i.marginBottom)||10,T=parseFloat(i.minHeight)||100,D=Ei(a),k=o.documentElement.clientHeight-C-w,A=o.documentElement.clientWidth,j=k-l.bottom+h,M,N=O===`rtl`?l.right-u.width:l.left,P=0;if(t&&n){let e=Ai(n.getBoundingClientRect(),c);M=Ai(t.getBoundingClientRect(),c),N=u.left+(O===`rtl`?e.right-M.right:e.left-M.left);let r=e.top-l.top+e.height/2;P=M.top-u.top+M.height/2-r}let F=j+P+w+S,I=Math.min(k,F),ee=k-C-w,L=F-I,H=A-5;z.style.left=`${kt(N,5,H-u.width)}px`,z.style.height=`${I}px`,z.style.maxHeight=`none`,z.style.marginTop=`${C}px`,z.style.marginBottom=`${w}px`,e.style.height=`100%`;let W=Di(_),G=L>=W-1;G&&(I=Math.min(k,u.height)-(L-W));let te=l.top<20||l.bottom>k-20||Math.ceil(I)+1<Math.min(x,T),K=(r.visualViewport?.scale??1)!==1&&f;if(te||K){vi(z,U.current),E(!1);return}let ne=Math.max(T,I);if(G){let e=Math.max(0,k-F);z.style.top=u.height>=ee?`0`:`${e}px`,z.style.height=`${I}px`,_.scrollTop=Di(_)}else z.style.bottom=`0`,_.scrollTop=L;if(M){let t=u.top,n=u.height,r=M.top+M.height/2,i=kt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===k||I>=D)&&(V.current=!0),g(_),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,N,z,R,d,p,m,c,g,w,E,W,B,v,y,O,T]),Z.useEffect(()=>{if(!w||!z||!N)return;let e=q(z);function t(e){u(!1,de(ye,e))}return ee(e,`resize`,t)},[u,w,z,N]);let ne={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${M}-list`},onKeyDown(e){D&&Ve.has(e.key)&&e.stopPropagation()},onScroll(e){B||te(e.currentTarget)},...w&&{style:B?{height:`100%`}:yi},className:!B&&w?Ci.className:void 0},re=ue(`div`,e,{ref:[t,c],state:K,stateAttributesMapping:wi,props:[I,ne,gr(L),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!j&&Ci.getElement(k),(0,Q.jsx)(De,{context:x,modal:!1,disabled:!F,openInteractionType:P,returnFocus:a,restoreFocus:!0,children:re})]})});function Ei(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Di(e){return ni(e.scrollHeight,e.clientHeight)}function Oi(e){return vn.getScale(e)}function ki(e,t,n){return e/n[t]}function Ai(e,t){return Ot({x:ki(e.x,`x`,t),y:ki(e.y,`y`,t),width:ki(e.width,`x`,t),height:ki(e.height,`y`,t)})}var ji=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mi(e){let{style:t}=e,n={};for(let[e,r]of ji)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of ji){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Ur(),{alignItemWithTriggerActive:l}=_i(),u=A(o,$.hasScrollArrows),d=A(o,$.openMethod),f={id:`${A(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:yi},className:u&&d!==`touch`?Ci.className:void 0},p=o.useStateSetter(`listElement`);return ue(`div`,e,{ref:[t,p],props:[f,a]})}),Pi=Z.createContext(void 0);function Fi(){let e=Z.useContext(Pi);if(!e)throw Error(he(57));return e}var Ii=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Dr({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Ur(),C=x||s,w=A(f,$.isActive,d.index),T=A(f,$.open),E=A(f,$.isSelected,a),D=A(f,$.isSelectedByFocus,d.index),O=A(f,$.isItemEqualToValue),k=d.index,j=Z.useRef(null);J(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),J(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Gr(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let M=Z.useRef(`mouse`),N=Z.useRef(!1),{getButtonProps:P,buttonRef:F}=xe({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),I={disabled:C,selected:E,highlighted:w};function ee(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?qr(n,a,O):[...n,a];h(r,de(ve,e))}else h(a,de(ve,e)),m(!1,de(ve,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ke(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(C||i)&&ee(e.nativeEvent)},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,L()},onMouseUp(){if(L(),C||M.current===`touch`||N.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(N.current=!0,j.current?.click(),N.current=!1)}},z=ue(`div`,e,{ref:[F,t,d.ref,j],state:I,props:[p,R,l,P]}),B=Z.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,Q.jsx)(Pi.Provider,{value:B,children:z})})),Li=Z.forwardRef(function(e,t){let{selected:n}=Fi();return e.keepMounted||n?(0,Q.jsx)(Ri,{...e,ref:t}):null}),Ri=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fi(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Ue(s),d=ue(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:W});return be({open:s,ref:c,onComplete(){s||u(!1)}}),d})),zi=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fi(),{firstItemTextRef:a,selectedItemTextRef:o}=Ur(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return ue(`div`,e,{ref:[d,t,r],props:u})})),Bi=2;function Vi({className:e,onValueChange:t,options:n,placeholder:r,triggerId:i,value:a,...o}){let s=n.find(e=>e.value===a),c=s?.icon,l=Ae(),u=Math.min(l+Bi,8);return(0,Q.jsxs)(ii,{"data-slot":`select`,items:n,onValueChange:e=>{e!==null&&t(e)},value:a,...o,children:[(0,Q.jsxs)(di,{id:i,"aria-label":o[`aria-label`],className:Ge(`group flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 data-placeholder:text-muted-foreground dark:bg-input/30 dark:disabled:bg-input/80`,e),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[c?(0,Q.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`}):null,(0,Q.jsx)(pi,{placeholder:r,children:(0,Q.jsx)(`span`,{className:`truncate`,children:s?.label??r??a??``})})]}),(0,Q.jsx)(mi,{className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(Je,{className:`size-4`})})]}),(0,Q.jsx)(hi,{children:(0,Q.jsx)(xi,{className:`z-[70]`,sideOffset:4,children:(0,Q.jsx)(Ti,{className:Ge(`max-h-72 min-w-(--anchor-width) overflow-y-auto rounded-lg p-1 text-sm text-popover-foreground outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Oe(u,3)),children:(0,Q.jsx)(je,{value:u,children:(0,Q.jsx)(Ni,{children:n.map(e=>{let t=e.icon;return(0,Q.jsxs)(Ii,{className:`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-7 text-sm outline-none select-none data-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50`,disabled:e.disabled,value:e.value,children:[(0,Q.jsx)(Li,{className:`absolute left-2 flex items-center justify-center`,children:(0,Q.jsx)(Ke,{className:`size-3.5`})}),t?(0,Q.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(zi,{children:e.label})]},e.value)})})})})})})]})}var Hi=[{id:`amazon-bedrock`,name:`Amazon Bedrock`,envVarName:`AWS_ACCESS_KEY_ID`},{id:`openai`,name:`OpenAI`,envVarName:`OPENAI_API_KEY`},{id:`openai-chat-completions`,name:`OpenAI Chat Completions`,envVarName:`OPENAI_CHAT_COMPLETIONS_API_KEY`},{id:`openai-chat-completions-base-url`,name:`OpenAI Chat Completions Base URL`,envVarName:`OPENAI_CHAT_COMPLETIONS_BASE_URL`},{id:`openai-chat-completions-model`,name:`OpenAI Chat Completions Model`,envVarName:`OPENAI_CHAT_COMPLETIONS_MODEL`},{id:`anthropic`,name:`Anthropic`,envVarName:`ANTHROPIC_API_KEY`},{id:`google-vertex`,name:`Google Vertex`,envVarName:`GOOGLE_APPLICATION_CREDENTIALS`},{id:`google`,name:`Google Gemini`,envVarName:`GEMINI_API_KEY`},{id:`mistral`,name:`Mistral`,envVarName:`MISTRAL_API_KEY`},{id:`groq`,name:`Groq`,envVarName:`GROQ_API_KEY`},{id:`openrouter`,name:`OpenRouter`,envVarName:`OPENROUTER_API_KEY`},{id:`vercel-ai-gateway`,name:`Vercel AI Gateway`,envVarName:`AI_GATEWAY_API_KEY`},{id:`github-copilot`,name:`GitHub Copilot`,envVarName:`GITHUB_COPILOT_TOKEN`,authType:`oauth`},{id:`ollama`,name:`Ollama`,envVarName:`OLLAMA_BASE_URL`},{id:`daytona`,name:`Daytona`,envVarName:`DAYTONA_API_KEY`},{id:`daytona-target`,name:`Daytona Target`,envVarName:`DAYTONA_TARGET`}],Ui=[`daytona`,`daytona-target`,`openai-chat-completions-base-url`,`openai-chat-completions-model`],Wi=`openai-chat-completions`,Gi=`${Wi}+`,Ki=`custom+`;function qi(e){return e.startsWith(Ki)}function Ji(e){return e===`openai-chat-completions`||e.startsWith(Gi)}function Yi(e){return e.startsWith(Gi)}var Xi=Hi.map(({id:e,name:t,envVarName:n,authType:r})=>({id:e,name:t,envVarName:n,authType:r})),Zi=Xi.flatMap(e=>Ui.includes(e.id)?[]:[e.id]);Xi.filter(e=>!Ui.includes(e.id)&&e.authType!==`oauth`),Array.from(new Set([...Xi.flatMap(e=>Zi.includes(e.id)||e.id===`openai-chat-completions-base-url`||e.id===`openai-chat-completions-model`?[e.envVarName]:[]),`HF_TOKEN`,`ANT_LING_API_KEY`,`AZURE_OPENAI_API_KEY`,`NVIDIA_API_KEY`,`DEEPSEEK_API_KEY`,`GOOGLE_CLOUD_API_KEY`,`CEREBRAS_API_KEY`,`XAI_API_KEY`,`RADIUS_API_KEY`,`ZAI_API_KEY`,`ZAI_CODING_CN_API_KEY`,`MINIMAX_API_KEY`,`MINIMAX_CN_API_KEY`,`MOONSHOT_API_KEY`,`FIREWORKS_API_KEY`,`TOGETHER_API_KEY`,`OPENCODE_API_KEY`,`KIMI_API_KEY`,`CLOUDFLARE_API_KEY`,`CLOUDFLARE_ACCOUNT_ID`,`CLOUDFLARE_GATEWAY_ID`,`XIAOMI_API_KEY`,`XIAOMI_TOKEN_PLAN_CN_API_KEY`,`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_OAUTH_KEY`,`COPILOT_GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`,`AWS_SECRET_ACCESS_KEY`,`AWS_BEARER_TOKEN_BEDROCK`,`AWS_PROFILE`,`AWS_ACCESS_KEY_ID`,`DAYTONA_API_KEY`,`ORG_DAYTONA_API_KEY`,`DAYTONA_TARGET`]));export{At as A,Un as C,Hn as D,zn as E,In as O,Vn as S,Rn as T,_r as _,Ji as a,ir as b,ri as c,Pr as d,Nr as f,br as g,Dr as h,Yi as i,kt as j,xn as k,zr as l,Ar as m,Wi as n,Vi as o,jr as p,qi as r,Ci as s,Xi as t,Lr as u,gr as v,Bn as w,Wn as x,pr as y};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,A as a,B as o,D as s,E as c,G as l,H as u,I as d,J as f,L as p,O as m,T as h,U as g,V as _,W as v,X as y,et as b,g as x,h as S,j as C,k as w,l as T,nt as E,p as D,q as O,r as k,rt as A,u as j,z as M}from"./button-0At5xSyU.js";import{$ as N,A as P,B as F,C as I,F as ee,G as L,H as R,I as z,J as B,K as V,L as H,M as U,O as W,P as G,Q as te,R as K,U as ne,V as re,W as q,X as ie,_ as ae,at as oe,ct as se,d as ce,et as le,it as J,k as ue,n as de,p as fe,q as pe,r as me,rt as he,s as ge,st as _e,tt as Y,u as ve,v as ye,w as be,y as xe,z as Se}from"./x-BgciQ7_C.js";import{I as X,L as Ce,M as we,X as Te,Y as Ee,Z as De,_ as Oe,at as ke,g as Ae,h as je,it as Me,j as Ne,k as Pe,nt as Fe,ot as Ie,rt as Le,st as Re,tt as ze,v as Be,w as Ve,y as He}from"./dialog-DZ44tBtH.js";import{n as Ue,r as We}from"./useBaseUiId-B9f7fokB.js";import{t as Ge}from"./utils-Eg7xtNmV.js";import{n as Ke,t as qe}from"./useControlled-CoY1jSuL.js";import{t as Je}from"./chevron-down-BEVGmnSb.js";import{a as Ye,i as Xe,n as Ze,o as Qe,r as $e,s as et}from"./input-CqC82Agz.js";var Z=e(t(),1),Q=r(),tt=[`top`,`right`,`bottom`,`left`],nt=Math.min,rt=Math.max,it=Math.round,at=Math.floor,ot=e=>({x:e,y:e}),st={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ct(e,t,n){return rt(e,nt(t,n))}function lt(e,t){return typeof e==`function`?e(t):e}function ut(e){return e.split(`-`)[0]}function dt(e){return e.split(`-`)[1]}function ft(e){return e===`x`?`y`:`x`}function pt(e){return e===`y`?`height`:`width`}function mt(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ht(e){return ft(mt(e))}function gt(e,t,n){n===void 0&&(n=!1);let r=dt(e),i=ht(e),a=pt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Tt(o)),[o,Tt(o)]}function _t(e){let t=Tt(e);return[vt(e),t,vt(t)]}function vt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yt=[`left`,`right`],bt=[`right`,`left`],xt=[`top`,`bottom`],St=[`bottom`,`top`];function Ct(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bt:yt:t?yt:bt;case`left`:case`right`:return t?xt:St;default:return[]}}function wt(e,t,n,r){let i=dt(e),a=Ct(ut(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vt)))),a}function Tt(e){let t=ut(e);return st[t]+e.slice(t.length)}function Et(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Dt(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Et(e)}function Ot(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 kt(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function At(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:a=!0,ignoreMouse:o=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=ae}=t,u=`rootStore`in e?e.rootStore:e,d=u.context.dataRef,f=Z.useRef(void 0),m=G(),h=i(),g=Z.useMemo(()=>{function e(e,t,n,r){let i=de(l,t,n);e&&r===`touch`&&c>0?h.start(c,()=>{u.setOpen(!0,i)}):u.setOpen(e,i)}function t(e,t,n){let r=d.current.openEvent,i=u.select(`domReferenceElement`)!==t;return e&&i||!e||!a?!0:r&&s?!n(r.type):!1}return{onPointerDown(e){f.current=Me(e.pointerType,!0)&&Ie(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=f.current,a=n.nativeEvent,s=u.select(`open`);if(n.button!==0||r===`click`||Me(i,!0)&&o)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),l=_(a);if(p(l)){e(c,a,l,i);return}let d=n.currentTarget;m.request(()=>{e(c,a,d,i)})},onClick(n){if(r===`mousedown-only`)return;let i=f.current;if(r===`mousedown`&&i){f.current=void 0;return}Me(i,!0)&&o||e(t(u.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){f.current=void 0}}},[d,r,o,l,u,s,a,m,h,c]);return Z.useMemo(()=>n?{reference:g}:se,[n,g])}function jt(e,t,n){let{reference:r,floating:i}=e,a=mt(t),o=ht(t),s=pt(o),c=ut(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=dt(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mt(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}=lt(t,e),p=Dt(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ot(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=Ot(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 Nt=50,Pt=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mt},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=jt(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<Nt&&(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}=jt(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ft=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}=lt(e,t)||{};if(l==null)return{};let d=Dt(u),f={x:n,y:r},p=ht(i),m=pt(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=nt(d[_],T),D=nt(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=ct(E,k,O),j=!c.arrow&&dt(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}}}),It=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}=lt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ut(r),_=mt(o),v=ut(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Tt(o)]:_t(o)),x=p!==`none`;!d&&x&&b.push(...wt(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=gt(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`||_===mt(t)||T.every(e=>mt(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=mt(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 Lt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rt(e){return tt.some(t=>e[t]>=0)}var zt=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lt(e,t);switch(i){case`referenceHidden`:{let e=Lt(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rt(e)}}}case`escaped`:{let e=Lt(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rt(e)}}}default:return{}}}}},Bt=new Set([`left`,`top`]);async function Vt(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ut(n),s=dt(n),c=mt(n)===`y`,l=Bt.has(o)?-1:1,u=a&&c?-1:1,d=lt(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 Ht=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 Vt(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}}}}},Ut=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}=lt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mt(i),p=ft(f),m=u[p],h=u[f],g=(e,t)=>ct(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}}}}}},Wt=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}=lt(e,t),u={x:n,y:r},d=mt(i),f=ft(d),p=u[f],m=u[d],h=lt(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=Bt.has(ut(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}}}},Gt=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}=lt(e,t),c=await i.detectOverflow(t,s),l=ut(n),u=dt(n),d=mt(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=nt(p-c[m],g),y=nt(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*rt(c.left,c.right):S=p-2*rt(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 Kt(e){let t=z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pe(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=it(n)!==a||it(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function qt(e){return V(e)?e:e.contextElement}function Jt(e){let t=qt(e);if(!pe(t))return ot(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Kt(t),o=(a?it(n.width):n.width)/r,s=(a?it(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Yt=ot(0);function Xt(e){let t=q(e);return!le()||!t.visualViewport?Yt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function Qt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=qt(e),o=ot(1);t&&(r?V(r)&&(o=Jt(r)):o=Jt(e));let s=Zt(a,n,r)?Xt(a):ot(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=q(a),t=V(r)?q(r):r,n=e,i=Se(n);for(;i&&t!==n;){let e=Jt(i),t=i.getBoundingClientRect(),r=z(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=q(i),i=Se(n)}}return Ot({width:u,height:d,x:c,y:l})}function $t(e,t){let n=re(e).scrollLeft;return t?t.left+n:Qt(K(e)).left+n}function en(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$t(e,n),y:n.top+t.scrollTop}}function tn(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=K(r),s=t?N(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=ot(1),u=ot(0),d=pe(r);if((d||!a)&&((F(r)!==`body`||ie(o))&&(c=re(r)),d)){let e=Qt(r);l=Jt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?en(o,c):ot(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 nn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rn(e){let t=re(e),n=e.ownerDocument.body,r=rt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=rt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$t(e),o=-t.scrollTop;return z(n).direction===`rtl`&&(a+=rt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var an=25;function on(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=q(e),a=K(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!le()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($t(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<=an&&(s-=o)}return{width:s,height:c,x:l,y:u}}function sn(e,t){let n=Qt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Jt(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function cn(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=on(e,n,t);else if(t===`document`)r=rn(K(e));else if(V(t))r=sn(t,n);else{let n=Xt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ot(r)}function ln(e,t){let n=t.get(e);if(n)return n;let r=R(e,[],!1).filter(e=>V(e)&&F(e)!==`body`),i=null,a=z(e).position===`fixed`,o=a?ne(e):e;for(;V(o)&&!B(o);){let e=z(o),t=L(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=ne(o)}return t.set(e,r),r}function un(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?N(t)?[]:ln(t,this._c):[].concat(n),r],o=cn(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=cn(t,a[e],i);s=rt(n.top,s),c=nt(n.right,c),l=nt(n.bottom,l),u=rt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function dn(e){let{width:t,height:n}=Kt(e);return{width:t,height:n}}function fn(e,t,n){let r=pe(t),i=K(t),a=n===`fixed`,o=Qt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=ot(0);if((r||!a)&&((F(t)!==`body`||ie(i))&&(s=re(t)),r)){let e=Qt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$t(i));let l=i&&!r&&!a?en(i,s):ot(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 pn(e){return z(e).position===`static`}function mn(e,t){if(!pe(e)||z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return K(e)===n&&(n=n.ownerDocument.body),n}function hn(e,t){let n=q(e);if(N(e))return n;if(!pe(e)){let t=ne(e);for(;t&&!B(t);){if(V(t)&&!pn(t))return t;t=ne(t)}return n}let r=mn(e,t);for(;r&&te(r)&&pn(r);)r=mn(r,t);return r&&B(r)&&pn(r)&&!L(r)?n:r||H(e)||n}var gn=async function(e){let t=this.getOffsetParent||hn,n=this.getDimensions,r=await n(e.floating);return{reference:fn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _n(e){return z(e).direction===`rtl`}var vn={convertOffsetParentRelativeRectToViewportRelativeRect:tn,getDocumentElement:K,getClippingRect:un,getOffsetParent:hn,getElementRects:gn,getClientRects:nn,getDimensions:dn,getScale:Jt,isElement:V,isRTL:_n};function yn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bn(e,t,n){let r=null,i,a=K(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=at(d),h=at(a.clientWidth-(u+f)),g=at(a.clientHeight-(d+p)),_=at(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:rt(0,nt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!yn(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=q(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function xn(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=qt(e),u=i||a?[...l?R(l):[],...t?R(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?bn(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?Qt(e):null;c&&g();function g(){let t=Qt(e);h&&!yn(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 Sn=Ht,Cn=Ut,wn=It,Tn=Gt,En=zt,Dn=Ft,On=Wt,kn=(e,t,n)=>{let r=new Map,i=n??{},a={...vn,...i.platform,_c:r};return Pt(e,t,{...i,platform:a})},An=e(n(),1),jn=typeof document<`u`?Z.useLayoutEffect:function(){};function Mn(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(!Mn(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)&&!Mn(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Nn(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pn(e,t){let n=Nn(e);return Math.round(t*n)/n}function Fn(e){let t=Z.useRef(e);return jn(()=>{t.current=e}),t}function In(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]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Mn(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Fn(c),D=Fn(i),O=Fn(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),kn(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Mn(w.current,t)&&(w.current=t,An.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);jn(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);jn(()=>(A.current=!0,()=>{A.current=!1}),[]),jn(()=>{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=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Pn(M.floating,u.x),r=Pn(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Nn(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ln=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?{}:Dn({element:r.current,padding:i}).fn(n):r?Dn({element:r,padding:i}).fn(n):{}}}},Rn=(e,t)=>{let n=Sn(e);return{name:n.name,fn:n.fn,options:[e,t]}},zn=(e,t)=>{let n=Cn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bn=(e,t)=>({fn:On(e).fn,options:[e,t]}),Vn=(e,t)=>{let n=wn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hn=(e,t)=>{let n=Tn(e);return{name:n.name,fn:n.fn,options:[e,t]}},Un=(e,t)=>{let n=En(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wn=(e,t)=>{let n=Ln(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Gn(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=I(),a=ze()!=null,o=oe(()=>new Ee({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new X,floatingId:i,syncOnly:!1,nested:a})).current;return J(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=V(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Kn(e){return qn(e,e.rootContext)}function qn(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=Fe(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=In({...e,elements:{..._,...l&&{reference:l}}}),y=V(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=V(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(V(e)||e===null)&&(h.current=e,f(e)),(V(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!V(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return J(()=>{o&&(h.current=o)},[o]),J(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Jn=`Escape`;function Yn(e){return f&&e.movementX===0&&e.movementY===0}function Xn(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Zn(e,t){return Xn(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Qn(e,t,n){return Xn(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function $n(e,t,n){return Xn(t,n?e===g:e===v,e===u)}function er(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===Jn:Xn(t,n?e===v:e===g,e===l)}function tr(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:l=null,allowEscape:u=!1,loopFocus:f=!1,nested:p=!1,rtl:m=!1,virtual:g=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:T=`vertical`,parentOrientation:E,id:D,resetOnPointerLeave:O=!0,externalTree:k,grid:A}=t,j=A!=null,N=`rootStore`in e?e.rootStore:e,P=N.useState(`open`),F=N.useState(`floatingElement`),I=N.useState(`domReferenceElement`),ee=N.context.dataRef,L=C(F),R=d(I),z=We(L),B=ze(),V=Fe(k),H=Z.useRef(v),U=Z.useRef(l??-1),W=Z.useRef(null),te=Z.useRef(!0),K=Y(e=>{i(U.current===-1?null:U.current,e)}),ne=Z.useRef(!!F),re=Z.useRef(P),q=Z.useRef(!1),ie=Z.useRef(!1),ae=Z.useRef(null),oe=We(S),se=We(P),le=We(l),ue=We(O),fe=G(),me=G(),he=Y(()=>{function e(e){g?V?.events.emit(`virtualfocus`,e):ae.current=Le(e,{sync:q.current,preventScroll:!0})}let t=n.current[U.current],r=ie.current;t&&e(t),(q.current?e=>e():e=>fe.request(e))(()=>{let i=n.current[U.current]||t;i&&(t||e(i),Se&&(r||!te.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});J(()=>{ee.current.orientation=T},[ee,T]),J(()=>{a&&(P&&F?(U.current=l??-1,H.current&&l!=null&&(ie.current=!0,K())):ne.current&&(U.current=-1,K()))},[a,P,F,l,K]),J(()=>{if(a){if(!P){q.current=!1;return}if(F){if(r==null){if(q.current=!1,le.current!=null)return;if(ne.current&&(U.current=-1,he()),(!re.current||!ne.current)&&H.current&&(W.current!=null||H.current===!0&&W.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>me.request(e):queueMicrotask)(t),e+=1):(U.current=W.current==null||Qn(W.current,T,m)||p?s(n):c(n),W.current=null,K())};t()}}else w(n.current,r)||(U.current=r,he(),ie.current=!1)}}},[a,P,F,r,le,p,n,T,m,K,he,me]),J(()=>{if(!a||F||!V||g||!ne.current)return;let e=V.nodesRef.current,t=e.find(e=>e.id===B)?.context?.elements.floating,n=M(b(I??t??null)),r=e.some(e=>e.context&&o(e.context.elements.floating,n));t&&!r&&te.current&&t.focus({preventScroll:!0})},[a,F,I,V,B,g]),J(()=>{re.current=P,ne.current=!!F}),J(()=>{P||(W.current=null,H.current=v)},[P,v]);let _e=r!=null,ve=Y(e=>{if(!se.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(U.current!==t||r!==t)&&(U.current=t,K(e))}),ye=Y(()=>E??V?.nodesRef.current.find(e=>e.id===B)?.context?.dataRef?.current.orientation),be=Y(()=>s(n,oe.current)),xe=Y(e=>{if(te.current=!1,q.current=!0,e.which===229||!se.current&&e.currentTarget===z.current)return;if(p&&er(e.key,T,m,j)){Zn(e.key,ye())||Re(e),N.setOpen(!1,de(ce,e.nativeEvent)),pe(I)&&(g?V?.events.emit(`virtualfocus`,I):I.focus());return}let t=U.current,r=s(n,S),i=c(n,S);if(R||(e.key===`Home`&&(Re(e),U.current=r,K(e)),e.key===`End`&&(Re(e),U.current=i,K(e))),A!=null){let t=A(e,U.current,n,T,f,m,S,r,i);if(t!=null&&(U.current=t,K(e)),T===`both`)return}if(Zn(e.key,T)){if(Re(e),P&&!g&&M(e.currentTarget.ownerDocument)===e.currentTarget){U.current=Qn(e.key,T,m)?r:i,K(e);return}Qn(e.key,T,m)?f?t>=i?u&&t!==n.current.length?U.current=-1:(q.current=!1,U.current=r):U.current=h(n.current,{startingIndex:t,disabledIndices:S}):U.current=Math.min(i,h(n.current,{startingIndex:t,disabledIndices:S})):f?t<=r?u&&t!==-1?U.current=n.current.length:(q.current=!1,U.current=i):U.current=h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S}):U.current=Math.max(r,h(n.current,{startingIndex:t,decrement:!0,disabledIndices:S})),w(n.current,U.current)&&(U.current=-1),K(e)}}),Se=Z.useMemo(()=>({onFocus(e){q.current=!0,ve(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){Yn(e)||(q.current=!0,ie.current=!1,y&&ve(e))},onPointerLeave(e){if(!se.current||!te.current||e.pointerType===`touch`)return;q.current=!0;let t=e.relatedTarget;if(!(!y||n.current.includes(t))&&ue.current&&(ae.current?.(),ae.current=null,U.current=-1,K(e),!g)){let e=z.current,t=M(b(e));e&&o(e,t)&&e.focus({preventScroll:!0})}}}),[ve,se,z,y,n,K,ue,g]),X=Z.useMemo(()=>g&&P&&_e&&{"aria-activedescendant":`${D}-${r}`},[g,P,_e,D,r]),Ce=Z.useMemo(()=>({"aria-orientation":T===`both`?void 0:T,...R?{}:X,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&P&&!g){let t=_(e.nativeEvent);if(t&&!o(z.current,t))return;Re(e),N.setOpen(!1,de(ge,e.nativeEvent)),pe(I)&&I.focus();return}xe(e)},onPointerMove(e){Yn(e)||(te.current=!0)}}),[X,xe,z,T,R,N,P,g,I]),we=Z.useMemo(()=>{function e(e){N.setOpen(!0,de(ce,e.nativeEvent,e.currentTarget))}function t(e){v===`auto`&&ke(e.nativeEvent)&&(H.current=!g)}function n(e){H.current=v,v===`auto`&&Ie(e.nativeEvent)&&(H.current=!0)}return{onKeyDown(t){let n=N.select(`open`);te.current=!1;let r=t.key.startsWith(`Arrow`),i=$n(t.key,ye(),m),a=Zn(t.key,T),o=(p?i:a)||t.key===`Enter`||t.key.trim()===``;if(g&&n)return xe(t);if(!(!n&&!x&&r)){if(o){let e=Zn(t.key,ye());W.current=p&&e?null:t.key}if(p){i&&(Re(t),n?(U.current=be(),K(t)):e(t));return}a&&(le.current!=null&&(U.current=le.current),Re(t),!n&&x?e(t):xe(t),n&&K(t))}},onFocus(e){N.select(`open`)&&!g&&(U.current=-1,K(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[xe,v,be,p,K,N,x,T,ye,m,le,g]),Te=Z.useMemo(()=>({...X,...we}),[X,we]);return Z.useMemo(()=>a?{reference:Te,floating:Ce,item:Se,trigger:we}:{},[a,Te,Ce,we,Se])}function nr(e,t){let{listRef:n,elementsRef:r,activeIndex:s,onMatch:c,disabledIndices:l,onTyping:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,h=`rootStore`in e?e.rootStore:e,g=h.useState(`open`),_=i(),v=Z.useRef(``),y=Z.useRef(p??s??-1),b=Z.useRef(null),x=Y(e=>{function t(e){return r?.current[e]}function i(e){let n=t(e);return n&&!m(n)||n?.matches(`:disabled`)?!1:l==null||!a(_e,e,l)}function o(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,a=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(a)||!i(n)))return n}return-1}let d=n.current;if(v.current.length>0&&e.key===` `&&(Re(e),u?.(!0)),v.current.length>0&&v.current[0]!==` `&&o(d,v.current)===-1&&e.key!==` `&&u?.(!1),d==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;g&&e.key!==` `&&(Re(e),u?.(!0));let h=v.current===``;h&&(y.current=p??s??-1),d.every((e,t)=>e&&i(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&v.current===e.key&&(v.current=``,y.current=b.current),v.current+=e.key,_.start(f,()=>{v.current=``,y.current=b.current,u?.(!1)});let x=((h?p??s??-1:y.current)??0)+1,S=o(d,v.current,x);S===-1?e.key!==` `&&(v.current=``,u?.(!1)):(c?.(S),b.current=S)}),S=Y(e=>{let t=e.relatedTarget,n=h.select(`domReferenceElement`),r=h.select(`floatingElement`);o(n,t)||o(r,t)||(_.clear(),v.current=``,y.current=b.current,u?.(!1))});J(()=>{!g&&p!==null||(_.clear(),b.current=null,v.current!==``&&(v.current=``))},[g,p,_]);let C=Z.useMemo(()=>({onKeyDown:x,onBlur:S}),[x,S]);return Z.useMemo(()=>d?{reference:C,floating:C}:{},[d,C])}var rr=Z.createContext(void 0);function ir(){return Z.useContext(rr)?.direction??`ltr`}var ar=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,offsetParent:d=`real`}=lt(e,t)||{};if(l==null)return{};let f=Dt(u),p={x:n,y:r},m=ht(i),h=pt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ct(k,j,A),N=!c.arrow&&dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),or=(e,t)=>({...ar(e),options:[e,t]}),sr={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},cr={sideX:`left`,sideY:`top`},lr=`--available-width`,ur=`--available-height`;function dr(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function fr(e,t,n){let{rects:r,placement:i}=e;return{side:dr(t,ut(i),n),align:dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function pr(e){return mr(e,Kn)}function mr(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=Z.useState(null);!g&&w!==null&&T(null);let E=_.side||`flip`,D=_.align||`flip`,O=_.fallbackAxisSide||`end`,k=v?.crossAxis??!1,A=v?.rootBoundary,j=typeof n==`function`?n:void 0,M=Y(j),N=j?M:n,P=We(n),F=We(g),I=ir()===`rtl`,ee=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":I?`left`:`right`,"inline-start":I?`right`:`left`}[i],L=o===`center`?ee:`${ee}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Z.useRef(null),G=We(a),te=We(s),K=typeof a==`function`?0:a,ne=typeof s==`function`?0:s,re=[];p&&re.push(p),re.push(Rn(e=>{let t=fr(e,i,I),n=typeof G.current==`function`?G.current(t):G.current,r=typeof te.current==`function`?te.current(t):te.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[K,ne,I,i]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||k||E===`shift`),oe=E===`none`?null:Vn({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!k&&E===`flip`,crossAxis:D===`flip`&&`alignment`,fallbackAxisSideDirection:O}),se=ie?null:zn({...U,rootBoundary:A,mainAxis:D!==`none`,crossAxis:ae,limiter:u||k?void 0:Bn(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=mt(ut(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,k,A,R,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Hn({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!F.current)return;let i=e.style;i.setProperty(lr,`${t}px`),i.setProperty(ur,`${n}px`);let a=q(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),or(e=>({element:W.current||b(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=ut(r),l=mt(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(fr(e,i,I)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},sr,x),J(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ce=Z.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:re,strategy:r,whileElementsMounted:m?void 0:(...e)=>xn(...e,ce),nodeId:y,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||cr,xe=_e?r:`fixed`,Se=Z.useMemo(()=>{let e;return e=_e?x?{position:xe,[ye]:de,[be]:fe}:{...ve,position:xe}:{position:xe,top:0,left:0},e[lr]=`100vw`,e[ur]=`100vh`,_e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),X=Z.useRef(null);J(()=>{if(!g)return;let e=P.current,t=typeof e==`function`?e():e,n=(hr(t)?t.current:t)||null;n!==X.current&&(le.setPositionReference(n),X.current=n)},[g,le,N,P]),Z.useEffect(()=>{if(!g)return;let e=P.current;typeof e!=`function`&&hr(e)&&e.current!==X.current&&(le.setPositionReference(e.current),X.current=e.current)},[g,le,N,P]),Z.useEffect(()=>{if(m&&g&&ue.reference&&ue.floating)return xn(ue.reference,ue.floating,me,ce)},[m,g,ue,me,ce]);let Ce=ut(he),we=dr(i,Ce,I),Te=dt(he)||`center`,Ee=!!pe.hide?.referenceHidden;J(()=>{S&&g&&_e&&Ce!==ee&&T(Ce)},[S,g,_e,Ce,ee]);let De=Z.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),Oe=pe.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Se,arrowStyles:De,arrowRef:W,arrowUncentered:Oe,side:we,align:Te,physicalSide:Ce,anchorHidden:Ee,refs:le,context:ge,isPositioned:_e,update:me}),[Se,De,W,Oe,we,Te,Ce,Ee,le,ge,_e,me])}function hr(e){return e!=null&&`current`in e}function gr(e){return e===`starting`?T:se}function _r(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ue(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},gr(r),i],stateAttributesMapping:Pe})}var vr=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function yr(){return Z.useContext(vr)}function br(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Y(i),[,o]=Z.useState(!1),s=oe(Sr).current,c=oe(xr).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef([]),f=Z.useRef(null),p=Y(()=>{u.current||(u.current=!0,o(e=>!e))}),m=Y((e,t)=>{c.set(e,t),p()}),h=Y(e=>{c.delete(e),p()}),g=Y(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Tr(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Er(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=wr(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Y(()=>{let[e,t]=Cr(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});J(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),J(()=>{u.current&&v()}),J(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Y(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(vr.Provider,{value:b,children:t})}function xr(){return new Map}function Sr(){return new Set}function Cr(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Er(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function wr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Tr(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Er(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Dr(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=yr(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return J(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Or=Z.createContext(void 0),kr={disableStyleElements:!1};function Ar(){return Z.useContext(Or)??kr}function jr(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function Mr(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}function Nr(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}var Pr=Z.createContext(null);function Fr(){let e=Z.useContext(Pr);if(e===null)throw Error(he(60));return e}var Ir=(e,t)=>Object.is(e,t);function Lr(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Rr(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&Lr(e,t,n))}function zr(e,t,n){return e.filter(e=>!Lr(t,e,n))}function Br(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vr(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Hr(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Vr(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Ur(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Br(e)}function Wr(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Br(e.value):Br(e)}function Gr(e,t,n){function r(){return Ur(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Vr(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Kr(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:Gr(r,t,n)},i)),e),[])}var $={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Wr(t,r)!==``},hasNullItemLabel:(e,t)=>t?Hr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>Lr(t,e,n)):Lr(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function qr(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function Jr(e,t){let n=Z.useRef(e),r=Y(t);J(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Yr(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Xr(e,t){let{onClick:n,onPointerDown:r}=Yr(Y((n,r)=>{(typeof e==`function`?e():e)||t(r||(y?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function Zr(e){let[t,n]=Z.useState(null),r=Xr(e,n);return Jr(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Qr(e,t){return Math.max(0,e-t)}function $r(e,t){if(t<=0)return 0;let n=kt(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function ei(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w=Ir,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:O}=Ze(),{setDirty:k,setTouched:j,setFocused:M,validityData:N,setFilled:F,name:I,disabled:ee,validation:L,validationMode:R}=Qe(),z=$e({id:t}),B=ee||d,V=I??c,[H,W]=qe({controlled:n,default:y?r??_e:r,name:`Select`,state:`value`}),[G,te]=qe({controlled:a,default:o,name:`Select`,state:`open`}),K=Z.useRef([]),ne=Z.useRef([]),re=Z.useRef(null),q=Z.useRef(null),ie=Z.useRef(0),ae=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),pe=Z.useRef(null),me=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=Z.useRef(!1),{mounted:ge,setMounted:ve,transitionStatus:ye}=Ue(G),{openMethod:xe,triggerProps:Se}=Zr(G),X=oe(()=>new E({id:z,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,value:H,open:G,mounted:ge,transitionStatus:ye,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,we=A(X,$.activeIndex),Ee=A(X,$.selectedIndex),De=A(X,$.triggerElement),Oe=A(X,$.positionerElement),ke=Nr(xe),Ae=xe??ke,je=Z.useMemo(()=>y?``:Wr(H,C),[y,H,C]),Me=Z.useMemo(()=>y&&Array.isArray(H)?H.map(e=>Wr(e,C)):Wr(H,C),[y,H,C]),Ne=We(De),Pe=Y(()=>Me);Ye(Ne,z,H,Pe,!B,c);let Fe=Z.useRef(H),Ie=y?Array.isArray(H)&&H.length>0:H!=null&&je!==``;J(()=>{F(Ie)},[Ie,F]),J(function(){let e=H,t=!1;if(y){let n=Array.isArray(H)?H:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:Rr(ce.current,e,w),r=n===-1?null:n;r===null&&(pe.current=null),!G&&X.set(`selectedIndex`,r)},[y,G,H,w,X]);function Le(e){let t=N.initialValue;return Array.isArray(e)&&Array.isArray(t)?!qr(e,t,(e,t)=>Lr(e,t,w)):e!==t}Jr(H,()=>{O(V),k(Le(H)),L.change(H)});let Re=Y((e,t)=>{s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(j(!0),M(!1),R===`onBlur`&&L.commit(H)))}),ze=Y(()=>{ve(!1),X.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});be({enabled:!h,open:G,ref:re,onComplete(){G||ze()}}),Z.useImperativeHandle(h,()=>({unmount:ze}),[ze]);let Be=Y((e,t)=>{i?.(e,t),!t.isCanceled&&W(e)}),Ve=Y(e=>{let t=Qr(e.scrollHeight,e.clientHeight),n=$r(e.scrollTop,t),r=n>0,i=n<t;X.set(`scrollUpArrowVisible`,r),X.set(`scrollDownArrowVisible`,i)}),He=Gn({open:G,onOpenChange:Re,elements:{reference:De,floating:Oe}}),Ge=At(He,{enabled:!f&&!B,event:`mousedown`}),Ke=Te(He),Je=tr(He,{enabled:!f&&!B,listRef:K,activeIndex:we,selectedIndex:Ee,disabledIndices:_e,onNavigate(e){e===null&&!G||X.set(`activeIndex`,e)},focusItemOnHover:T}),Xe=nr(He,{enabled:!f&&!B&&(G||!y),listRef:ne,activeIndex:we,selectedIndex:Ee,disabledIndices:e=>jr(K.current[e]),onMatch(e){G?X.set(`activeIndex`,e):Be(ce.current[e],de(fe))},onTyping(e){le.current=e}}),et=Z.useMemo(()=>P(Xe.reference,Je.reference,Ke.reference,Ge.reference,Se),[Ge.reference,Xe.reference,Je.reference,Ke.reference,Se]),tt=Z.useMemo(()=>P(Ce,Xe.floating,Je.floating,Ke.floating),[Xe.floating,Je.floating,Ke.floating]),nt=Je.item??se;Mr(()=>{X.update({popupProps:tt,triggerProps:et})}),X.useSyncedValues({id:z,modal:m,multiple:y,value:H,open:G,mounted:ge,transitionStatus:ye,popupProps:tt,triggerProps:et,items:v,itemToStringLabel:b,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ae});let rt=Z.useMemo(()=>({store:X,floatingContext:He,required:p,disabled:B,readOnly:f,multiple:y,highlightItemOnHover:T,setValue:Be,setOpen:Re,listRef:K,popupRef:re,scrollHandlerRef:q,handleScrollArrowVisibility:Ve,scrollArrowsMountedCountRef:ie,itemProps:nt,valueRef:ae,valuesRef:ce,labelsRef:ne,typingRef:le,selectionRef:me,firstItemTextRef:ue,selectedItemTextRef:pe,validation:L,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:he,initialValueRef:Fe}),[X,He,p,B,f,y,T,Be,Re,nt,L,_,Ve]),it=U(g,L.inputRef),at=y?void 0:V,ot=Z.useMemo(()=>!y||!Array.isArray(H)||!V?null:H.map(e=>{let t=Wr(e,C);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:V,value:t,disabled:B},t)}),[y,H,l,V,C,B]);return(0,Q.jsxs)(Pr.Provider,{value:rt,children:[D,(0,Q.jsx)(`input`,{...L.getValidationProps(B,{onFocus(){X.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||B||f)return;let t=e.currentTarget.value,n=de(fe,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>Wr(t,C).toLowerCase()===e||Ur(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=ne.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Be(i,n)}X.set(`forceMount`,!0),queueMicrotask(r)}}),id:z&&at==null?`${z}-hidden-input`:void 0,form:l,name:at,autoComplete:u,value:je,disabled:B,required:p&&!(y&&Ie),readOnly:f,ref:it,style:V?x:S,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ot]})}function ti(e,t){return e??t}var ni=5;function ri(e,t){let n=ii(t);return e.clientX>=n.left-ni&&e.clientX<=n.right+ni&&e.clientY>=n.top-ni&&e.clientY<=n.bottom+ni}function ii(e){let t=e.getBoundingClientRect(),n=q(e);if(O)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var ai=400,oi={...Ne,...et,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},si=Z.forwardRef(function(e,t){let{render:n,className:r,id:a,disabled:s=!1,nativeButton:c=!0,style:l,...u}=e,{setTouched:d,setFocused:f,validationMode:p,state:m,disabled:h}=Qe(),{labelId:g}=Xe(),{store:_,setOpen:v,selectionRef:y,validation:x,readOnly:S,required:w,alignItemWithTriggerActiveRef:T,disabled:E}=Fr(),D=h||E||s,O=A(_,$.open),k=A(_,$.mounted),j=A(_,$.value),M=A(_,$.triggerProps),N=A(_,$.positionerElement),F=A(_,$.listElement),I=A(_,$.popupSide),ee=A(_,$.id),L=A(_,$.labelId),R=A(_,$.hasSelectedValue),z=k&&N?I:null,B=a??ee,V=ti(g,L);$e({id:B});let H=We(N),U=Z.useRef(null),{getButtonProps:W,buttonRef:G}=xe({disabled:D,native:c}),te=_.useStateSetter(`triggerElement`),K=i(),ne=i(),re=i();Z.useEffect(()=>{if(O)return re.start(ai,()=>{y.current.allowUnselectedMouseUp=!0,y.current.allowSelectedMouseUp=!0}),()=>{re.clear()};y.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ne.clear()},[O,y,ne,re]);let q=P(M,{id:B,role:`combobox`,"aria-expanded":O,"aria-haspopup":`listbox`,"aria-controls":O?F?.id??C(N)?.id:void 0,"aria-labelledby":V,"aria-readonly":S||void 0,"aria-required":w||void 0,tabIndex:D?-1:0,onFocus(e){f(!0),O&&T.current&&v(!1,de(fe,e.nativeEvent)),K.start(0,()=>{_.set(`forceMount`,!0)})},onBlur(e){o(N,e.relatedTarget)||(d(!0),f(!1),p===`onBlur`&&x.commit(j))},onMouseDown(e){if(O)return;let t=b(e.currentTarget);function n(e){if(!U.current)return;let t=e.target;o(U.current,t)||o(H.current,t)||ri(e,U.current)||v(!1,de(me,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},u,W),ie=x.getValidationProps(D,q);ie.role=`combobox`;let ae={...m,open:O,disabled:D,value:j,readOnly:S,popupSide:z,placeholder:!R};return ue(`button`,e,{ref:[t,U,G,te],state:ae,stateAttributesMapping:oi,props:ie})}),ci={value:()=>null},li=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Fr(),u=A(c,$.value),d=A(c,$.items),f=A(c,$.itemToStringLabel),p=A(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=A(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Kr(u,d,f):Gr(u,d,f)),ue(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:ci})}),ui=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Fr(),s={open:A(o,$.open)};return ue(`span`,e,{state:s,ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:we})}),di=Z.forwardRef(function(e,t){let{store:n}=Fr(),r=A(n,$.mounted),i=A(n,$.forceMount);return r||i?(0,Q.jsx)(k,{ref:t,...e}):null}),fi=Z.createContext(void 0);function pi(){let e=Z.useContext(fi);if(!e)throw Error(he(59));return e}function mi(e,t){e&&Object.assign(e.style,t)}var hi={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},gi=20;function _i(e,t,n,r){let[i,a]=Z.useState(!1);J(()=>{if(!e||!t||n==null){a(!1);return}let r=b(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-gi)},[e,t,n]),Be(e&&(!t||i),r)}var vi={position:`fixed`},yi=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=j,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:O,floatingContext:k}=Fr(),M=A(y,$.open),N=A(y,$.mounted),P=A(y,$.modal),F=A(y,$.value),I=A(y,$.openMethod),ee=A(y,$.positionerElement),L=A(y,$.triggerElement),R=A(y,$.isItemEqualToValue),z=A(y,$.transitionStatus),B=Z.useRef(null),V=Z.useRef(null),[H,U]=Z.useState(h),W=N&&H&&I!==`touch`;!N&&H!==h&&U(h),Z.useImperativeHandle(S,()=>W),_i((W||P)&&M,I===`touch`,ee,L);let G=pr({anchor:n,floatingRootContext:k,positionMethod:a,mounted:N,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??W,collisionAvoidance:g,keepMounted:!0}),te=W?`none`:G.side,K=W?vi:G.positionerStyles,ne={open:M,side:te,align:G.align,anchorHidden:G.anchorHidden};J(()=>{y.set(`popupSide`,G.side)},[y,G.side]);let re=_r(e,ne,{styles:K,transitionStatus:z,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!N,inert:!M}),q=Z.useRef(0),ie=Y(e=>{if(w.current.length===0)return;let t=q.current;if(q.current=e.size,e.size===t)return;let n=de(fe);if(t!==0&&!y.state.multiple&&F!==null&&Rr(w.current,F,R)===-1){let e=T.current,t=e!=null&&Rr(w.current,e,R)!==-1?e:null;O(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(F)){let e=F.filter(e=>Rr(w.current,e,R)!==-1);e.length!==F.length&&(O(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(M&&W){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};mi(ee,e),mi(E.current,e)}}),ae=Z.useMemo(()=>({...G,side:te,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:U,scrollUpArrowRef:B,scrollDownArrowRef:V}),[G,te,W,U]);return(0,Q.jsx)(br,{elementsRef:b,labelsRef:x,onMapChange:ie,children:(0,Q.jsxs)(fi.Provider,{value:ae,children:[N&&P&&(0,Q.jsx)(He,{inert:D(!M),cutout:L}),re]})})}),bi=`base-ui-disable-scrollbar`,xi={className:bi,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:bi,precedence:`base-ui:low`,children:`.${bi}{scrollbar-width:none}.${bi}::-webkit-scrollbar{display:none}`})}},Si=Z.createContext(void 0);function Ci(e){let t=Z.useContext(Si);if(t===void 0&&!e)throw Error(he(69));return t}var wi={...Pe,...W},Ti=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y,floatingContext:x}=Fr(),{side:S,align:C,alignItemWithTriggerActive:w,isPositioned:T,setControlledAlignItemWithTrigger:E}=pi(),D=Ci(!0)!=null,O=ir(),{nonce:k,disableStyleElements:j}=Ar(),M=A(s,$.id),N=A(s,$.open),P=A(s,$.openMethod),F=A(s,$.mounted),I=A(s,$.popupProps),L=A(s,$.transitionStatus),R=A(s,$.triggerElement),z=A(s,$.positionerElement),B=A(s,$.listElement),V=Z.useRef(!1),H=Z.useRef(!1),U=Z.useRef({}),W=G(),te=Y(e=>{if(!z||!c.current||!H.current)return;let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(V.current||!w||!t&&!n){g(e);return}let r=Oi(z),i=ki(z.getBoundingClientRect().height,`y`,r),a=b(z),o=q(z),s=o.getComputedStyle(z),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=Ei(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=Di(e),h=null,_=e=>{z.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=kt(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(V.current=!0),g(e);return}f-y>1?h=t?1/0:0:n&&p<m&&(h=p-(v-(i+v-f)));let x=Math.ceil(y);if(x!==0&&_(x),h!=null){let t=kt(h,0,Di(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}x>=f-1&&(V.current=!0),g(e)});Z.useImperativeHandle(_,()=>te,[te]),be({open:N,ref:c,onComplete(){N&&l?.(!0)}});let K={open:N,transitionStatus:L,side:S,align:C};J(()=>{!z||!c.current||Object.keys(U.current).length||(U.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),J(()=>{N||w||(H.current=!1,V.current=!1,mi(z,U.current))},[N,w,z,c]),J(()=>{let e=c.current;if(!N||!R||!z||!e||w&&!T||s.state.transitionStatus===`ending`)return;if(H.current=!0,e.style.removeProperty(`--transform-origin`),!w){W.request(()=>g(B||e));return}let t=Mi(e);try{let t=m.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&p.current?.isConnected?p.current:null);let n=d.current,r=q(z),i=r.getComputedStyle(z),a=r.getComputedStyle(e),o=b(R),c=Oi(R),l=Ai(R.getBoundingClientRect(),c),u=Ai(z.getBoundingClientRect(),c),h=l.height,_=B||e,x=_.scrollHeight,S=parseFloat(a.borderBottomWidth),C=parseFloat(i.marginTop)||10,w=parseFloat(i.marginBottom)||10,T=parseFloat(i.minHeight)||100,D=Ei(a),k=o.documentElement.clientHeight-C-w,A=o.documentElement.clientWidth,j=k-l.bottom+h,M,N=O===`rtl`?l.right-u.width:l.left,P=0;if(t&&n){let e=Ai(n.getBoundingClientRect(),c);M=Ai(t.getBoundingClientRect(),c),N=u.left+(O===`rtl`?e.right-M.right:e.left-M.left);let r=e.top-l.top+e.height/2;P=M.top-u.top+M.height/2-r}let F=j+P+w+S,I=Math.min(k,F),ee=k-C-w,L=F-I,H=A-5;z.style.left=`${kt(N,5,H-u.width)}px`,z.style.height=`${I}px`,z.style.maxHeight=`none`,z.style.marginTop=`${C}px`,z.style.marginBottom=`${w}px`,e.style.height=`100%`;let W=Di(_),G=L>=W-1;G&&(I=Math.min(k,u.height)-(L-W));let te=l.top<20||l.bottom>k-20||Math.ceil(I)+1<Math.min(x,T),K=(r.visualViewport?.scale??1)!==1&&f;if(te||K){mi(z,U.current),E(!1);return}let ne=Math.max(T,I);if(G){let e=Math.max(0,k-F);z.style.top=u.height>=ee?`0`:`${e}px`,z.style.height=`${I}px`,_.scrollTop=Di(_)}else z.style.bottom=`0`,_.scrollTop=L;if(M){let t=u.top,n=u.height,r=M.top+M.height/2,i=kt(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===k||I>=D)&&(V.current=!0),g(_),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,N,z,R,d,p,m,c,g,w,E,W,B,v,y,O,T]),Z.useEffect(()=>{if(!w||!z||!N)return;let e=q(z);function t(e){u(!1,de(ye,e))}return ee(e,`resize`,t)},[u,w,z,N]);let ne={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${M}-list`},onKeyDown(e){D&&Ve.has(e.key)&&e.stopPropagation()},onScroll(e){B||te(e.currentTarget)},...w&&{style:B?{height:`100%`}:hi},className:!B&&w?xi.className:void 0},re=ue(`div`,e,{ref:[t,c],state:K,stateAttributesMapping:wi,props:[I,ne,gr(L),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!j&&xi.getElement(k),(0,Q.jsx)(De,{context:x,modal:!1,disabled:!F,openInteractionType:P,returnFocus:a,restoreFocus:!0,children:re})]})});function Ei(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Di(e){return Qr(e.scrollHeight,e.clientHeight)}function Oi(e){return vn.getScale(e)}function ki(e,t,n){return e/n[t]}function Ai(e,t){return Ot({x:ki(e.x,`x`,t),y:ki(e.y,`y`,t),width:ki(e.width,`x`,t),height:ki(e.height,`y`,t)})}var ji=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Mi(e){let{style:t}=e,n={};for(let[e,r]of ji)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of ji){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Ni=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=Fr(),{alignItemWithTriggerActive:l}=pi(),u=A(o,$.hasScrollArrows),d=A(o,$.openMethod),f={id:`${A(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:hi},className:u&&d!==`touch`?xi.className:void 0},p=o.useStateSetter(`listElement`);return ue(`div`,e,{ref:[t,p],props:[f,a]})}),Pi=Z.createContext(void 0);function Fi(){let e=Z.useContext(Pi);if(!e)throw Error(he(57));return e}var Ii=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=Dr({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=Fr(),C=x||s,w=A(f,$.isActive,d.index),T=A(f,$.open),E=A(f,$.isSelected,a),D=A(f,$.isSelectedByFocus,d.index),O=A(f,$.isItemEqualToValue),k=d.index,j=Z.useRef(null);J(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),J(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&Lr(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let M=Z.useRef(`mouse`),N=Z.useRef(!1),{getButtonProps:P,buttonRef:F}=xe({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),I={disabled:C,selected:E,highlighted:w};function ee(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?zr(n,a,O):[...n,a];h(r,de(ve,e))}else h(a,de(ve,e)),m(!1,de(ve,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&ke(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(C||i)&&ee(e.nativeEvent)},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,L()},onMouseUp(){if(L(),C||M.current===`touch`||N.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(N.current=!0,j.current?.click(),N.current=!1)}},z=ue(`div`,e,{ref:[F,t,d.ref,j],state:I,props:[p,R,l,P]}),B=Z.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,Q.jsx)(Pi.Provider,{value:B,children:z})})),Li=Z.forwardRef(function(e,t){let{selected:n}=Fi();return e.keepMounted||n?(0,Q.jsx)(Ri,{...e,ref:t}):null}),Ri=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Fi(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=Ue(s),d=ue(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:W});return be({open:s,ref:c,onComplete(){s||u(!1)}}),d})),zi=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=Fi(),{firstItemTextRef:a,selectedItemTextRef:o}=Fr(),{render:s,className:c,style:l,...u}=e,d=Z.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]);return ue(`div`,e,{ref:[d,t,r],props:u})})),Bi=2;function Vi({className:e,onValueChange:t,options:n,placeholder:r,triggerId:i,value:a,...o}){let s=n.find(e=>e.value===a),c=s?.icon,l=Ae(),u=Math.min(l+Bi,8);return(0,Q.jsxs)(ei,{"data-slot":`select`,items:n,onValueChange:e=>{e!==null&&t(e)},value:a,...o,children:[(0,Q.jsxs)(si,{id:i,"aria-label":o[`aria-label`],className:Ge(`group flex h-8 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 data-placeholder:text-muted-foreground dark:bg-input/30 dark:disabled:bg-input/80`,e),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[c?(0,Q.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`}):null,(0,Q.jsx)(li,{placeholder:r,children:(0,Q.jsx)(`span`,{className:`truncate`,children:s?.label??r??a??``})})]}),(0,Q.jsx)(ui,{className:`shrink-0 text-muted-foreground`,children:(0,Q.jsx)(Je,{className:`size-4`})})]}),(0,Q.jsx)(di,{children:(0,Q.jsx)(yi,{className:`z-[70]`,sideOffset:4,children:(0,Q.jsx)(Ti,{className:Ge(`max-h-72 min-w-(--anchor-width) overflow-y-auto rounded-lg p-1 text-sm text-popover-foreground outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,Oe(u,3)),children:(0,Q.jsx)(je,{value:u,children:(0,Q.jsx)(Ni,{children:n.map(e=>{let t=e.icon;return(0,Q.jsxs)(Ii,{className:`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-2 pl-7 text-sm outline-none select-none data-highlighted:bg-muted data-highlighted:text-foreground data-disabled:pointer-events-none data-disabled:opacity-50`,disabled:e.disabled,value:e.value,children:[(0,Q.jsx)(Li,{className:`absolute left-2 flex items-center justify-center`,children:(0,Q.jsx)(Ke,{className:`size-3.5`})}),t?(0,Q.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(zi,{children:e.label})]},e.value)})})})})})})]})}var Hi=[{id:`amazon-bedrock`,name:`Amazon Bedrock`,envVarName:`AWS_ACCESS_KEY_ID`},{id:`openai`,name:`OpenAI`,envVarName:`OPENAI_API_KEY`},{id:`openai-chat-completions`,name:`OpenAI Chat Completions`,envVarName:`OPENAI_CHAT_COMPLETIONS_API_KEY`},{id:`openai-chat-completions-base-url`,name:`OpenAI Chat Completions Base URL`,envVarName:`OPENAI_CHAT_COMPLETIONS_BASE_URL`},{id:`openai-chat-completions-model`,name:`OpenAI Chat Completions Model`,envVarName:`OPENAI_CHAT_COMPLETIONS_MODEL`},{id:`anthropic`,name:`Anthropic`,envVarName:`ANTHROPIC_API_KEY`},{id:`google-vertex`,name:`Google Vertex`,envVarName:`GOOGLE_APPLICATION_CREDENTIALS`},{id:`google`,name:`Google Gemini`,envVarName:`GEMINI_API_KEY`},{id:`mistral`,name:`Mistral`,envVarName:`MISTRAL_API_KEY`},{id:`groq`,name:`Groq`,envVarName:`GROQ_API_KEY`},{id:`openrouter`,name:`OpenRouter`,envVarName:`OPENROUTER_API_KEY`},{id:`vercel-ai-gateway`,name:`Vercel AI Gateway`,envVarName:`AI_GATEWAY_API_KEY`},{id:`github-copilot`,name:`GitHub Copilot`,envVarName:`GITHUB_COPILOT_TOKEN`,authType:`oauth`},{id:`ollama`,name:`Ollama`,envVarName:`OLLAMA_BASE_URL`},{id:`daytona`,name:`Daytona`,envVarName:`DAYTONA_API_KEY`},{id:`daytona-target`,name:`Daytona Target`,envVarName:`DAYTONA_TARGET`}],Ui=[`daytona`,`daytona-target`,`openai-chat-completions-base-url`,`openai-chat-completions-model`],Wi=`openai-chat-completions`,Gi=`${Wi}+`,Ki=`custom+`;function qi(e){return e.startsWith(Ki)}function Ji(e){return e===`openai-chat-completions`||e.startsWith(Gi)}function Yi(e){return e.startsWith(Gi)}var Xi=Hi.map(({id:e,name:t,envVarName:n,authType:r})=>({id:e,name:t,envVarName:n,authType:r})),Zi=Xi.flatMap(e=>Ui.includes(e.id)?[]:[e.id]);Xi.filter(e=>!Ui.includes(e.id)&&e.authType!==`oauth`),Array.from(new Set([...Xi.flatMap(e=>Zi.includes(e.id)||e.id===`openai-chat-completions-base-url`||e.id===`openai-chat-completions-model`?[e.envVarName]:[]),`HF_TOKEN`,`ANT_LING_API_KEY`,`AZURE_OPENAI_API_KEY`,`NVIDIA_API_KEY`,`DEEPSEEK_API_KEY`,`GOOGLE_CLOUD_API_KEY`,`CEREBRAS_API_KEY`,`XAI_API_KEY`,`RADIUS_API_KEY`,`ZAI_API_KEY`,`ZAI_CODING_CN_API_KEY`,`MINIMAX_API_KEY`,`MINIMAX_CN_API_KEY`,`MOONSHOT_API_KEY`,`FIREWORKS_API_KEY`,`TOGETHER_API_KEY`,`OPENCODE_API_KEY`,`KIMI_API_KEY`,`CLOUDFLARE_API_KEY`,`CLOUDFLARE_ACCOUNT_ID`,`CLOUDFLARE_GATEWAY_ID`,`XIAOMI_API_KEY`,`XIAOMI_TOKEN_PLAN_CN_API_KEY`,`XIAOMI_TOKEN_PLAN_AMS_API_KEY`,`XIAOMI_TOKEN_PLAN_SGP_API_KEY`,`ANTHROPIC_OAUTH_TOKEN`,`ANTHROPIC_OAUTH_KEY`,`COPILOT_GITHUB_TOKEN`,`GITHUB_COPILOT_TOKEN`,`AWS_SECRET_ACCESS_KEY`,`AWS_BEARER_TOKEN_BEDROCK`,`AWS_PROFILE`,`AWS_ACCESS_KEY_ID`,`DAYTONA_API_KEY`,`ORG_DAYTONA_API_KEY`,`DAYTONA_TARGET`]));export{At as A,Un as C,Hn as D,zn as E,In as O,Vn as S,Rn as T,_r as _,Ji as a,ir as b,xi as c,Xr as d,Jr as f,br as g,Dr as h,Yi as i,kt as j,xn as k,_i as l,Ar as m,Wi as n,Vi as o,jr as p,qi as r,Ci as s,Xi as t,$r as u,gr as v,Bn as w,Wn as x,pr as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./react-dom-Bwxum3ti.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{$ as i,B as a,F as o,N as s,Q as c,V as l,et as u,n as d,st as f,t as p,tt as m}from"./button-0At5xSyU.js";import{F as h,K as g,at as _,g as v,it as y,lt as b,n as x,ot as S,tt as C}from"./x-BgciQ7_C.js";import{_ as w,ct as T,d as E,f as D,g as O,h as k,it as A,l as j,m as M,nt as N,p as P,s as F,tt as I,u as ee}from"./dialog-DZ44tBtH.js";import{a as te,r as L,t as R}from"./provider-catalog-BZhZuKSz.js";import{r as z}from"./useBaseUiId-B9f7fokB.js";import{t as B}from"./utils-Eg7xtNmV.js";import{t as V}from"./createLucideIcon-DwxZHm0M.js";import{t as H}from"./bot-Bs7QWJ2q.js";import{t as ne}from"./loader-circle-6JG5RwxH.js";import{i as re,n as ie,r as ae,t as U}from"./sparkles-C5H3Jtgf.js";import{t as oe}from"./plug-Dt6VN0zF.js";var W=e(t(),1),se=f();function ce(e,t){return t!=null&&!A(t)?0:typeof e==`function`?e():e}function G(e,t,n){let r=ce(e,n);return typeof r==`number`?r:r?.[t]}function le(e){return typeof e==`function`?e():e}function ue(e,t){return t||e===`click`||e===`mousedown`}function de(e){return e?.includes(`mouse`)&&e!==`mousedown`}function fe(e){let t=W.useCallback(t=>e===void 0?b:e.subscribeStore(t),[e]),n=W.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,se.useSyncExternalStore)(t,n,()=>e?.serverStore)}var pe=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new c,this.restTimeout=new c,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},K=new WeakMap;function q(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&K.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),K.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function me(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=K.get(n);a&&a!==e&&q(a),q(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,K.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function he(e){let t=e.context.dataRef.current,n=_(()=>t.hoverInteractionState??pe.create()).current;return t.hoverInteractionState||=n,S(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function ge(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:c}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=d.useState(`floatingElement`),_=d.useState(`domReferenceElement`),{dataRef:b}=d.context,S=N(),w=I(),E=he(d),D=i(),O=C(()=>ue(b.current.openEvent?.type,E.interactedInside)),k=C(()=>de(b.current.openEvent?.type)),A=C(()=>{q(E)});y(()=>{f||(E.pointerType=void 0,E.restTimeoutPending=!1,E.interactedInside=!1,A())},[f,E,A]),W.useEffect(()=>A,[A]),y(()=>{if(n&&f&&E.handleCloseOptions?.blockPointerEvents&&k()&&g(_)&&p){let e=_,t=p,n=u(p),r=S?.nodesRef.current.find(e=>e.id===w)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=E.pointerEventsScopeElement===t?null:E.pointerEventsScopeElement,a=r===t?null:r,o=E.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return me(E,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{A()}}},[n,f,_,p,E,k,S,w,A]),W.useEffect(()=>{if(!n)return;function e(){return!!(S&&w&&T(S.nodesRef.current,w).length>0)}function t(e){let t=G(r,`close`,E.pointerType),n=()=>{d.setOpen(!1,x(v,e)),S?.events.emit(`floating.closed`,e)};t?E.openChangeTimeout.start(t,n):(E.openChangeTimeout.clear(),n())}function i(e){let t=l(e);if(!s(t)){E.interactedInside=!1;return}E.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function u(){E.openChangeTimeout.clear(),D.clear(),S?.events.off(`floating.closed`,_),A()}function f(n){if(e()&&S){S.events.on(`floating.closed`,_);return}if(o(n.relatedTarget,d.context.triggerElements))return;let r=b.current.floatingContext?.nodeId??c,i=n.relatedTarget;if(!(S&&r&&g(i)&&T(S.nodesRef.current,r,!1).some(e=>a(e.context?.elements.floating,i)))){if(E.handler){E.handler(n);return}A(),k()&&!O()&&t(n)}}function _(t){!S||!w||e()||D.start(0,()=>{S.events.off(`floating.closed`,_),d.setOpen(!1,x(v,t)),S.events.emit(`floating.closed`,t)})}let y=p;return m(y&&h(y,`mouseenter`,u),y&&h(y,`mouseleave`,f),y&&h(y,`pointerdown`,i,!0),()=>{S?.events.off(`floating.closed`,_)})},[n,p,d,b,r,c,k,O,A,E,S,w,D])}var _e=e(n(),1),ve={current:null};function ye(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:s=!1,restMs:c=0,move:d=!0,triggerElementRef:f=ve,externalTree:p,isActiveTrigger:_=!0,getHandleCloseContext:y,isClosing:b,shouldOpen:S,guardStaleOpen:w=!1}=t,T=`rootStore`in e?e.rootStore:e,{dataRef:E,events:D}=T.context,O=N(p),k=he(T),j=W.useRef(!1),M=z(i),P=z(r),F=z(c),I=z(n),ee=z(S),te=z(b),L=C(()=>ue(E.current.openEvent?.type,k.interactedInside)),R=C(()=>ee.current?.()!==!1),B=C((e,t,n)=>{let r=T.context.triggerElements;if(r.hasElement(t))return!e||!a(e,t);if(!g(n))return!1;let i=n;return r.hasMatchingElement(e=>a(e,i))&&(!e||!a(e,i))}),V=C(()=>{k.handler&&=(u(T.select(`domReferenceElement`)).removeEventListener(`mousemove`,k.handler),void 0)}),H=C(()=>{q(k)});return _&&(k.handleCloseOptions=M.current?.__options),W.useEffect(()=>V,[V]),W.useEffect(()=>{if(!n)return;function e(e){e.open?j.current=!1:(j.current=e.reason===v,V(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return D.on(`openchange`,e),()=>{D.off(`openchange`,e)}},[n,D,k,V]),W.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=G(P.current,`close`,k.pointerType);n?k.openChangeTimeout.start(n,()=>{T.setOpen(!1,x(v,e)),O?.events.emit(`floating.closed`,e)}):t&&(k.openChangeTimeout.clear(),T.setOpen(!1,x(v,e)),O?.events.emit(`floating.closed`,e))}let t=f.current??(_?T.select(`domReferenceElement`):null);if(!g(t))return;function r(e){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,s&&!A(k.pointerType))return;let t=le(F.current),n=G(P.current,`open`,k.pointerType),r=l(e),i=e.currentTarget??null,o=T.select(`domReferenceElement`),c=i;if(g(r)&&!T.context.triggerElements.hasElement(r)){for(let e of T.context.triggerElements.elements())if(a(e,r)){c=e;break}}g(i)&&g(o)&&!T.context.triggerElements.hasElement(i)&&a(i,o)&&(c=o);let u=c!=null&&B(o,c,r),d=T.select(`open`),f=te.current?.()??T.select(`transitionStatus`)===`ending`,p=!d&&f&&j.current,m=!u&&g(c)&&g(o)&&a(o,c)&&p,h=t>0&&!n,_=u&&(d||p)||m,y=!d||u;if(_){R()&&T.setOpen(!0,x(v,e,c));return}h||(n?k.openChangeTimeout.start(n,()=>{y&&R()&&T.setOpen(!0,x(v,e,c))}):y&&R()&&T.setOpen(!0,x(v,e,c)))}function i(t){if(L()){H();return}V();let n=T.select(`domReferenceElement`),r=u(n);k.restTimeout.clear(),k.restTimeoutPending=!1;let i=E.current.floatingContext??y?.();if(!o(t.relatedTarget,T.context.triggerElements)){if(M.current&&i){T.select(`open`)||k.openChangeTimeout.clear();let n=f.current;k.handler=M.current({...i,tree:O,x:t.clientX,y:t.clientY,onClose(){H(),V(),I.current&&!L()&&n===T.select(`domReferenceElement`)&&e(t,!0)}}),r.addEventListener(`mousemove`,k.handler),k.handler(t);return}(k.pointerType!==`touch`||!a(T.select(`floatingElement`),t.relatedTarget))&&e(t)}}function c(e){a(t,e.relatedTarget)||(k.openChangeTimeout.clear(),k.restTimeout.clear(),k.restTimeoutPending=!1)}let p=w?h(t,`mouseout`,c):void 0;return d?m(h(t,`mousemove`,r,{once:!0}),h(t,`mouseenter`,r),h(t,`mouseleave`,i),p):m(h(t,`mouseenter`,r),h(t,`mouseleave`,i),p)},[V,H,E,P,T,n,M,k,_,B,L,s,d,F,f,O,I,y,te,R,w]),W.useMemo(()=>{if(!n)return;function e(e){k.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=T.select(`domReferenceElement`),i=T.select(`open`),a=B(r,n,e.target);if(s&&!A(k.pointerType))return;if(i&&a&&k.handleCloseOptions?.blockPointerEvents){let e=T.select(`floatingElement`);if(e){let t=k.handleCloseOptions?.getScope?.()??n.ownerDocument.body;me(k,{scopeElement:t,referenceElement:n,floatingElement:e})}}let o=le(F.current);if(i&&!a||o===0||!a&&k.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;k.restTimeout.clear();function c(){if(k.restTimeoutPending=!1,L())return;let e=T.select(`open`);!k.blockMouseMove&&(!e||a)&&R()&&T.setOpen(!0,x(v,t,n))}k.pointerType===`touch`?_e.flushSync(()=>{c()}):a&&i?c():(k.restTimeoutPending=!0,k.restTimeout.start(o,c))}}},[n,k,L,B,s,T,F,R])}var be=.1,xe=be*be,J=.5;function Y(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function X(e,t,n,r,i,a,o,s,c,l){let u=!1;return Y(e,t,n,r,i,a)&&(u=!u),Y(e,t,i,a,o,s)&&(u=!u),Y(e,t,o,s,c,l)&&(u=!u),Y(e,t,c,l,n,r)&&(u=!u),u}function Se(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Z(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ce(e={}){let{blockPointerEvents:t=!1}=e,n=new c,r=({x:e,y:t,placement:r,elements:i,onClose:o,nodeId:s,tree:c})=>{let u=r?.split(`-`)[0],d=!1,f=null,p=null,m=typeof performance<`u`?performance.now():0;function h(e,t){let n=performance.now(),r=n-m;if(f===null||p===null||r===0)return f=e,p=t,m=n,!1;let i=e-f,a=t-p,o=i*i+a*a,s=r*r*xe;return f=e,p=t,m=n,o<s}function _(){n.clear(),o()}return function(r){n.clear();let o=i.domReference,f=i.floating;if(!o||!f||u==null||e==null||t==null)return;let{clientX:p,clientY:m}=r,v=l(r),y=r.type===`mouseleave`,b=a(f,v),x=a(o,v);if(b&&(d=!0,!y))return;if(x&&(d=!1,!y)){d=!0;return}if(y&&g(r.relatedTarget)&&a(f,r.relatedTarget))return;function S(){return!!(c&&T(c.nodesRef.current,s).length>0)}function C(){S()||_()}if(S())return;let w=o.getBoundingClientRect(),E=f.getBoundingClientRect(),D=e>E.right-E.width/2,O=t>E.bottom-E.height/2,k=E.width>w.width,A=E.height>w.height,j=(k?w:E).left,M=(k?w:E).right,N=(A?w:E).top,P=(A?w:E).bottom;if(u===`top`&&t>=w.bottom-1||u===`bottom`&&t<=w.top+1||u===`left`&&e>=w.right-1||u===`right`&&e<=w.left+1){C();return}let F=!1;switch(u){case`top`:F=Z(p,m,j,w.top+1,M,E.bottom-1);break;case`bottom`:F=Z(p,m,j,E.top+1,M,w.bottom-1);break;case`left`:F=Z(p,m,E.right-1,P,w.left+1,N);break;case`right`:F=Z(p,m,w.right-1,P,E.left+1,N)}if(F)return;if(d&&!Se(p,m,w)){C();return}if(!y&&h(p,m)){C();return}let I=!1;switch(u){case`top`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t+J+1,o=D||k?E.bottom-J:E.top,s=D?k?E.bottom-J:E.top:E.bottom-J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`bottom`:{let n=k?J/2:J*4,r=k||D?e+n:e-n,i=k?e-n:D?e+n:e-n,a=t-J,o=D||k?E.top+J:E.bottom,s=D?k?E.top+J:E.bottom:E.top+J;I=X(p,m,r,a,i,a,E.left,o,E.right,s);break}case`left`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e+J+1,o=O||A?E.right-J:E.left,s=O?A?E.right-J:E.left:E.right-J;I=X(p,m,o,E.top,s,E.bottom,a,r,a,i);break}case`right`:{let n=A?J/2:J*4,r=A||O?t+n:t-n,i=A?t-n:O?t+n:t-n,a=e-J,o=O||A?E.left+J:E.right,s=O?A?E.left+J:E.right:E.left+J;I=X(p,m,a,r,a,i,o,E.top,s,E.bottom);break}}I?d||n.start(40,C):C()}};return r.__options={...e,blockPointerEvents:t},r}var we=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Te=V(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Ee=V(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),De=V(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Oe=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ke=V(`settings`,[[`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`}]]),Ae=V(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),je=V(`wind`,[[`path`,{d:`M12.8 19.6A2 2 0 1 0 14 16H2`,key:`148xed`}],[`path`,{d:`M17.5 8a2.5 2.5 0 1 1 2 4H2`,key:`1u4tom`}],[`path`,{d:`M9.8 4.4A2 2 0 1 1 11 8H2`,key:`75valh`}]]),Me=V(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),Ne=`h-8 shrink-0 cursor-pointer rounded-[7px] border-border/45 bg-background/65 text-[11px] font-semibold text-foreground/75 shadow-sm transition-[background-color,border-color,box-shadow,opacity,transform] duration-150 hover:bg-foreground/5 active:scale-[0.96] disabled:opacity-50`,Pe=`relative after:absolute after:top-1/2 after:left-1/2 after:size-10 after:-translate-x-1/2 after:-translate-y-1/2`,Fe=`relative after:absolute after:inset-x-0 after:-top-1.5 after:-bottom-1.5`,Ie=`relative inline-flex h-9 items-center gap-1.5 rounded-[10px] border border-border/70 px-3 text-label font-medium whitespace-nowrap shadow-sm backdrop-blur transition-colors`,Le=`bg-sidebar text-foreground/55 hover:bg-background hover:text-foreground/75`,Re=`bg-background text-foreground/75`,ze=`${Le} data-[state=inactive]:shadow-sm`,Be=`${Re} data-[state=active]:shadow-sm`,Ve=`relative z-10 overflow-visible`,He=`h-full min-h-0 w-[min(360px,calc(100vw-1.5rem))] overflow-hidden rounded-md border border-border/70 bg-background/95 shadow-lg backdrop-blur`,Ue=d(`flex min-w-0 rounded-[4px] border`,{variants:{tone:{default:`border-border/30 bg-background/30`,muted:`border-border/20 bg-foreground/1.5`,inset:`border-border/60 bg-foreground/2`,dashed:`border-dashed border-border/25 bg-background/10`},padding:{sm:`p-2`,md:`px-2.5 py-2`,lg:`p-2.5`},interactive:{true:`transition-[border-color,background-color,box-shadow] duration-200 hover:border-border/45 hover:bg-foreground/2 hover:shadow-sm`,lift:`transition-[border-color,background-color,box-shadow,transform] duration-200 hover:-translate-y-px hover:border-border/45 hover:bg-foreground/3.5 hover:shadow-sm`,false:``}},defaultVariants:{tone:`default`,padding:`sm`,interactive:!1}}),Q=r();function We({className:e,...t}){return(0,Q.jsx)(ne,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:B(`size-4 animate-spin`,e),...t})}function Ge(e){return j(`alert-dialog`,e)}var Ke=4;function qe({...e}){return(0,Q.jsx)(Ge,{"data-slot":`alert-dialog`,...e})}function Je({...e}){return(0,Q.jsx)(ee,{"data-slot":`alert-dialog-portal`,...e})}function Ye({className:e,...t}){return(0,Q.jsx)(M,{"data-slot":`alert-dialog-backdrop`,className:B(`fixed inset-0 isolate z-[60] bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Xe({className:e,children:t,...n}){let r=O(),i=Math.min(r+Ke,8);return(0,Q.jsxs)(Je,{children:[(0,Q.jsx)(Ye,{}),(0,Q.jsx)(E,{"data-slot":`alert-dialog-content`,className:B(`fixed top-1/2 left-1/2 z-[60] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-6 text-sm text-popover-foreground outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,w(i),e),...n,children:(0,Q.jsx)(k,{value:i,children:t})})]})}function Ze({className:e,...t}){return(0,Q.jsx)(F,{"data-slot":`alert-dialog-title`,className:B(`font-heading text-base leading-none font-medium`,e),...t})}function Qe({className:e,...t}){return(0,Q.jsx)(D,{"data-slot":`alert-dialog-description`,className:B(`text-sm text-pretty text-muted-foreground`,e),...t})}function $e({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function et({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-cancel`,render:(0,Q.jsx)(p,{variant:`outline`}),...e})}function tt({...e}){return(0,Q.jsx)(P,{"data-slot":`alert-dialog-action`,render:(0,Q.jsx)(p,{variant:`destructive`}),...e})}var nt={"amazon-bedrock":{icon:Oe,placeholder:`AKIA... (AWS access key id)`,help:`Amazon Bedrock uses standard AWS credentials (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY) plus AWS_REGION. This field sets AWS_ACCESS_KEY_ID in .env.local.`},openai:{icon:U,placeholder:`sk-proj-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENAI_API_KEY environment variable.`},"openai-chat-completions":{icon:U,placeholder:`sk-... or nvapi-...`,help:`OpenAI-compatible Chat Completions root (e.g. https://opencode.ai/zen/v1). Paste …/chat/completions if you want — it is normalized. Requires API key, base URL, and model name.`},"openai-chat-completions-model":{icon:U,placeholder:`meta/llama-3.1-70b-instruct`,help:`Gateway model name registered when /models is empty or incomplete.`},anthropic:{icon:H,placeholder:`sk-ant-...`,help:`Stored securely in your root .env.local file. Overrides the active ANTHROPIC_API_KEY environment variable.`},"google-vertex":{icon:ie,placeholder:`Path to service account JSON, or credentials text...`,help:`Stored securely in your root .env.local file. Overrides the active GOOGLE_APPLICATION_CREDENTIALS environment variable.`},google:{icon:Te,placeholder:`AIzaSy...`,help:`Stored securely in your root .env.local file. Overrides the active GEMINI_API_KEY environment variable.`},mistral:{icon:je,placeholder:`Your Mistral API key...`,help:`Stored securely in your root .env.local file. Overrides the active MISTRAL_API_KEY environment variable.`},groq:{icon:Me,placeholder:`gsk_...`,help:`Stored securely in your root .env.local file. Overrides the active GROQ_API_KEY environment variable.`},openrouter:{icon:ae,placeholder:`sk-or-...`,help:`Stored securely in your root .env.local file. Overrides the active OPENROUTER_API_KEY environment variable.`},"vercel-ai-gateway":{icon:re,placeholder:`Your AI Gateway API key...`,help:`Stored securely in your root .env.local file. Overrides the active AI_GATEWAY_API_KEY environment variable.`},"github-copilot":{icon:H,placeholder:`OAuth subscription`,help:`GitHub Copilot uses device-code OAuth. Sign in from Settings; credentials are stored in auth.json.`},"openai-codex":{icon:U,placeholder:`OAuth subscription`,help:`OpenAI Codex uses ChatGPT OAuth. Sign in from Settings; credentials are stored in auth.json.`},ollama:{icon:Ee,placeholder:`http://localhost:11434 (default)`,help:`Configure local Ollama execution endpoints. Overrides the active OLLAMA_BASE_URL environment variable.`},custom:{icon:oe,placeholder:`sk-... / provider key`,help:`Register any OpenAI-, Anthropic-, or Google-compatible endpoint through Pi's native custom-provider mechanism. Requires a name, API key, https base URL, API family, and at least one model id. Deployed accounts only.`}},$=`size-4`;function rt({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M22.282 9.821a5.985 5.985 0 0 0-.516-4.91 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073zM13.26 22.43a4.476 4.476 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.795.795 0 0 0 .392-.681v-6.737l2.02 1.168a.071.071 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494zM3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.771.771 0 0 0 .78 0l5.843-3.368v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646zM2.34 7.896a4.485 4.485 0 0 1 2.366-1.973V11.6a.766.766 0 0 0 .388.676l5.814 3.354-2.02 1.168a.076.076 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.076.076 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.079.079 0 0 0-.041-.067zm2.01-3.023l-.141-.085-4.774-2.782a.776.776 0 0 0-.785 0L9.409 9.23V6.897a.066.066 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zM8.306 12.683l-2.02-1.163a.08.08 0 0 1-.038-.057V6.074a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.795.795 0 0 0-.392.681zm1.098-2.016l2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5z`})})}function it({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M17.305 14.256h-3.778l-2.28-7.23h-.005l-2.32 7.23H5.145L9.93 3h4.14l4.235 11.256zm-8.48 2.37h6.37l1.16 3.374h3.465L14.18 3h-4.36L4.15 20h3.465l1.21-3.374z`})})}function at({className:e}){return(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:[(0,Q.jsx)(`path`,{d:`M21.6 12.23c0-.71-.06-1.4-.18-2.05H12v3.87h5.38a4.6 4.6 0 0 1-2 3.02v2.5h3.24c1.89-1.74 2.98-4.3 2.98-7.34z`}),(0,Q.jsx)(`path`,{d:`M12 22c2.7 0 4.96-.89 6.61-2.42l-3.24-2.5c-.9.6-2.04.96-3.37.96-2.59 0-4.78-1.75-5.56-4.1H3.1v2.58A9.99 9.99 0 0 0 12 22z`}),(0,Q.jsx)(`path`,{d:`M6.44 13.94A5.99 5.99 0 0 1 6.12 12c0-.67.12-1.33.32-1.94V7.48H3.1A9.99 9.99 0 0 0 2 12c0 1.61.39 3.14 1.1 4.52l3.34-2.58z`}),(0,Q.jsx)(`path`,{d:`M12 5.96c1.47 0 2.79.5 3.82 1.5l2.87-2.87C16.95 2.99 14.7 2 12 2A9.99 9.99 0 0 0 3.1 7.48l3.34 2.58C7.22 7.71 9.41 5.96 12 5.96z`})]})}function ot({className:e}){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,className:B($,e),fill:`currentColor`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.7.2 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.9 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .3z`})})}function st({provider:e,api:t,className:n}){let r=e.toLowerCase();if(L(r)||r===`custom`)return t===`anthropic-messages`?(0,Q.jsx)(it,{className:n}):t===`google-genai`?(0,Q.jsx)(at,{className:n}):(0,Q.jsx)(rt,{className:n});if(r===`openai`||r===`openai-codex`||te(r))return(0,Q.jsx)(rt,{className:n});if(r===`anthropic`)return(0,Q.jsx)(it,{className:n});if(r===`google`||r===`google-vertex`)return(0,Q.jsx)(at,{className:n});if(r===`github-copilot`||r===`github`)return(0,Q.jsx)(ot,{className:n});let i=e in nt?nt[e].icon:Ee;return(0,Q.jsx)(i,{className:B($,n),"aria-hidden":!0})}function ct(e){return R.find(t=>t.id===e)?.name??e}export{ge as A,Ae as C,we as D,Ee as E,fe as M,G as N,Ce as O,Ue as S,De as T,Be as _,tt as a,Fe as b,Qe as c,We as d,Ve as f,Ne as g,Le as h,qe as i,he as j,ye as k,$e as l,Ie as m,st as n,et as o,Re as p,nt as r,Xe as s,ct as t,Ze as u,ze as v,ke as w,He as x,Pe as y};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-DG7pUdsX.js","assets/rolldown-runtime-hePW80VL.js","assets/bundle-mjs-DKHVkVWu.js","assets/jsx-runtime-NZYk81nU.js","assets/utils-Eg7xtNmV.js","assets/preload-helper-Czpn1I53.js","assets/chunk-BO2N2NFS-BnzHCiyQ.js","assets/react-dom-Bwxum3ti.js","assets/lib-ChrQ49PO.js","assets/cn-C8c0S2mI.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{d as r,m as i,o as a,p as o,r as s,u as c}from"./ease-vFBiNFNK.js";import{t as l}from"./utils-Eg7xtNmV.js";import{t as u}from"./createLucideIcon-DwxZHm0M.js";import{t as d}from"./chevron-down-BEVGmnSb.js";import{t as f}from"./safe-external-url-Bl_78dpZ.js";import{n as p}from"./action-swap-roll-DX5o_33Q.js";import{a as m}from"./sparkles-C5H3Jtgf.js";import{t as h}from"./preload-helper-Czpn1I53.js";var g=u(`book-open-text`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M16 13h2`,key:`weia3s`}],[`path`,{d:`M16 9h2`,key:`1n7gjm`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}],[`path`,{d:`M6 13h2`,key:`1cckiz`}],[`path`,{d:`M6 9h2`,key:`1k7j9f`}]]),_=u(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=u(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),y=u(`log-out`,[[`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`}]]),b=u(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),x=u(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),S=e(t(),1);function C(){let[e,t]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(hover: hover) and (pointer: fine)`),n=()=>t(e.matches);return n(),e.addEventListener?.(`change`,n),()=>e.removeEventListener?.(`change`,n)},[]),e}var w=n(),T=(0,S.lazy)(()=>h(async()=>{let{Markdown:e}=await import(`./markdown-DG7pUdsX.js`).then(e=>e.a);return{Markdown:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(({Markdown:e})=>({default:e})));function E(e){return(0,w.jsx)(S.Suspense,{fallback:(0,w.jsx)(`div`,{className:e.className?`${e.className} whitespace-pre-wrap`:`whitespace-pre-wrap`,children:e.content}),children:(0,w.jsx)(T,{...e})})}var D={};function O(e){try{return new URL(`/favicon.ico`,e).toString()}catch{return null}}function k(e,t){return`${e}-${t.replace(/[^a-zA-Z0-9_-]/g,`-`)}`}function A({url:e,className:t}){let n=e&&f(e)?O(e):null,[r,i]=(0,S.useState)(null);return(0,w.jsx)(`span`,{"aria-hidden":`true`,className:l(`grid size-5 shrink-0 place-items-center text-muted-foreground`,t),children:n&&r!==n?(0,w.jsx)(`img`,{src:n,alt:``,width:16,height:16,referrerPolicy:`no-referrer`,onError:()=>i(n),className:`size-4 rounded-sm object-contain`}):(0,w.jsx)(_,{className:`size-3.5`})})}function j({citations:e,limit:t=3,className:n}){return(0,w.jsx)(`span`,{"aria-hidden":`true`,className:l(`flex -space-x-1.5`,n),children:e.slice(0,t).map(e=>(0,w.jsx)(A,{url:e.url,className:`size-6 rounded-full bg-background ring-2 ring-background`},e.id))})}function M({citation:e,index:t,idPrefix:n}){let r=e.url&&f(e.url)?e.url:void 0,i=(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(A,{url:e.url}),(0,w.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,w.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground/80 transition-colors group-hover/citation:text-foreground`,children:e.title}),e.domain?(0,w.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground/60`,children:e.domain}):null]}),(0,w.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`grid size-5 place-items-center rounded-md bg-foreground/[0.05] text-[10px] font-semibold tabular-nums text-muted-foreground`,children:t}),r?(0,w.jsx)(m,{className:`size-3.5 text-muted-foreground/40 transition-colors group-hover/citation:text-muted-foreground`}):null]})]}),a=`group/citation flex items-center gap-2 rounded-md px-1.5 py-1 outline-none focus-visible:ring-2 focus-visible:ring-ring`,o=k(n,e.id);return r?(0,w.jsx)(`a`,{id:o,href:r,target:`_blank`,rel:`noreferrer noopener`,className:a,children:i}):(0,w.jsx)(`div`,{id:o,className:a,children:i})}function N({citations:e,idPrefix:t,className:n}){let c=o()??!1,u=(0,S.useId)(),d=t??`citation-list-${u.replace(/:/g,``)}`;return(0,w.jsx)(`div`,{className:l(`grid gap-0.5`,n),children:(0,w.jsx)(i,{mode:`popLayout`,children:e.map((e,t)=>(0,w.jsx)(r.div,{layout:`position`,initial:c?{opacity:1}:{opacity:0,y:6},animate:{opacity:1,y:0},exit:c?{opacity:0}:{opacity:0,y:-3},transition:c?{duration:0}:{opacity:{duration:.18,ease:s},y:a,layout:a},children:(0,w.jsx)(M,{citation:e,index:t+1,idPrefix:d})},e.id))})})}function P({citations:e,title:t=`Sources`,open:n,defaultOpen:i=!1,onOpenChange:a,idPrefix:s,className:u}){let f=o()??!1,m=(0,S.useId)(),h=`${m}-content`,_=s??`citation-${m.replace(/:/g,``)}`,[v,y]=(0,S.useState)(i),b=n??v,x=(0,S.useCallback)(e=>{n===void 0&&y(e),a?.(e)},[a,n]);return(0,w.jsxs)(`div`,{className:l(`w-full text-sm`,u),children:[(0,w.jsxs)(`button`,{type:`button`,"aria-expanded":b,"aria-controls":h,onClick:()=>x(!b),className:`group -ml-1 flex min-h-8 items-center gap-2 rounded-lg px-1 text-left text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,w.jsx)(g,{className:`size-4`}),(0,w.jsx)(`span`,{className:`font-medium`,children:t}),(0,w.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold tabular-nums`,children:e.length}),(0,w.jsx)(r.span,{"aria-hidden":`true`,animate:{rotate:b?180:0},transition:f?{duration:0}:c,className:`text-muted-foreground/60`,children:(0,w.jsx)(d,{className:`size-3.5`})})]}),(0,w.jsx)(p,{id:h,open:b,children:(0,w.jsx)(N,{citations:e,idPrefix:_,className:`mt-1`})})]})}var F=`bg-background shadow-[0_1px_2px_rgba(0,0,0,0.04),0_12px_32px_-16px_rgba(0,0,0,0.12)] dark:bg-popover dark:shadow-none`,I=`bg-background shadow-[0_2px_8px_rgba(0,0,0,0.05),0_20px_48px_-16px_rgba(0,0,0,0.18)] dark:bg-popover dark:shadow-[0_20px_48px_-16px_rgba(0,0,0,0.55)]`,L=`bg-foreground/[0.04] dark:bg-foreground/[0.06]`,R=`col-start-1 row-start-1 flex w-max items-center gap-1.5 leading-none transition-[opacity,filter] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none`,z=`opacity-100 blur-none`,B=`pointer-events-none select-none opacity-0 blur-[2px]`,V=`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-[cubic-bezier(0.32,0.72,0,1)] data-[ending-style]:h-0 data-[starting-style]:h-0 motion-reduce:transition-none`,H=`font-mono text-[11px] tracking-tight`;function U({active:e=!0,className:t,...n}){return(0,w.jsx)(`span`,{className:l(e&&`shimmer motion-reduce:animate-none`,t),...n})}function W({active:e,children:t,className:n}){let r=(0,S.useRef)(null),i=(0,S.useRef)(null),[a,o]=(0,S.useState)(null);return(0,S.useLayoutEffect)(()=>{let t=(e===0?r:i).current;if(!t)return;let n=()=>o(Math.ceil(t.getBoundingClientRect().width));n();let a=new ResizeObserver(n);return a.observe(t),()=>a.disconnect()},[e]),(0,w.jsxs)(`span`,{style:a===null?void 0:{width:a},className:l(`grid overflow-x-clip transition-[width] duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none`,n),children:[(0,w.jsx)(`span`,{ref:r,"aria-hidden":e!==0,className:l(R,e===0?z:B),children:t[0]}),(0,w.jsx)(`span`,{ref:i,"aria-hidden":e!==1,className:l(R,e===1?z:B),children:t[1]})]})}function G(e,t,n){return Number.isNaN(e)?t:Math.min(n,Math.max(t,e))}function K(e,t){return e.slice(0,Math.floor(G(t,0,e.length)))}function q(e,t){return t>0?G(e/t*100,0,100):0}function J(e,t){return t>0?Math.floor(G(e,0,t)):0}export{g as S,x as _,W as a,v as b,I as c,N as d,j as f,C as g,E as h,U as i,H as l,D as m,J as n,V as o,P as p,K as r,L as s,q as t,F as u,b as v,_ as x,y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./bundle-mjs-DKHVkVWu.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{o as r,t as i}from"./ipython-tool-BrMePqD-.js";import{t as a}from"./square-terminal-BYTN_I86.js";var o=e(t(),1),s=n(),c={running:{toolState:`input-streaming`,label:`Running`},error:{toolState:`output-error`,label:`Failed`},cancelled:{toolState:`aborted`,label:`Cancelled`},success:{toolState:`output-available`,label:`Completed`}};function l(e){return c[e].toolState}function u(e){return{type:`tool-IPython`,toolCallId:e.sourceToolCallId??e.id,state:l(e.status),input:e.input,output:e.output,backgroundOutput:e.backgroundOutput}}function d(e){return c[e].label}function f({artifact:e,index:t,selected:n}){let a=(0,o.useRef)(null);return(0,o.useEffect)(()=>{n&&requestAnimationFrame(()=>{a.current?.focus({preventScroll:!0}),a.current?.scrollIntoView({block:`nearest`})})},[e.id,n]),(0,s.jsxs)(`article`,{ref:a,tabIndex:-1,className:`overflow-hidden rounded-md border border-border/60 bg-background outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-repl-run-id":e.id,children:[(0,s.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-b border-border/50 px-2.5 py-1.5`,children:[(0,s.jsx)(r,{className:`size-3.5 shrink-0 text-foreground/45`}),(0,s.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium text-foreground/70`,children:[`Cell `,t+1]}),(0,s.jsx)(`span`,{className:`shrink-0 text-[10px] text-foreground/40`,children:d(e.status)})]}),(0,s.jsx)(`div`,{className:`p-2`,children:(0,s.jsx)(i,{part:u(e)})})]})}function p({artifactRuns:e=[],selectedArtifactId:t}){let n=e.flatMap(e=>e.artifacts).filter(e=>e.kind===`ipython`);return(0,s.jsxs)(`section`,{"aria-label":`REPL runs`,className:`space-y-2 pb-1`,children:[(0,s.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-sm bg-foreground/5 px-2 py-1.5`,children:[(0,s.jsx)(a,{className:`size-3.5 shrink-0 text-foreground/45`}),(0,s.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label font-medium text-foreground/70`,children:`IPython cells`}),(0,s.jsx)(`span`,{className:`shrink-0 text-[10px] text-foreground/40`,children:n.length>0?n.length:`none yet`})]}),n.length===0?(0,s.jsx)(`p`,{className:`px-2 text-[11px] leading-4 text-foreground/45`,children:`Executed IPython cells and their output will appear here.`}):(0,s.jsx)(`div`,{className:`space-y-2`,"data-testid":`repl-run-list`,children:n.map((e,n)=>(0,s.jsx)(f,{artifact:e,index:n,selected:e.id===t},e.id))})]})}export{p as ReplPanelContent};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./createLucideIcon-DwxZHm0M.js";import{t}from"./file-text-BhQ0ZnoU.js";import{t as n}from"./package-CdcJFPf2.js";import{t as r}from"./plug-Dt6VN0zF.js";var i=e(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),a=e(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),o=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]);function s(e,s){return[{id:`skills`,label:`Skills`,icon:i,items:p(e?.skills.filter(e=>e.installedInWorkspace)??[],l(s))},{id:`prompts`,label:`Prompts`,icon:t,items:e?.prompts??[]},{id:`extensions`,label:`Extensions`,icon:r,items:e?.extensions??[]},{id:`packages`,label:`Packages`,icon:n,items:e?.packages??[]},{id:`themes`,label:`Themes`,icon:o,items:e?.themes??[]},{id:`agentsFiles`,label:`Context`,icon:a,items:e?.agentsFiles??[]}]}function c(e,t){for(let n of e){if(n.path===t)return n;let e=n.children?c(n.children,t):null;if(e)return e}return null}function l(e){if(!e)return[];let t=c(e.nodes,`agent-workspace/skills`);return t?.children?.length?t.children.flatMap(e=>{if(e.type!==`directory`)return[];let t=e.children?.find(e=>e.type===`file`&&e.name.toLowerCase()===`skill.md`)??null;return t?[{name:e.name,path:t.path,source:`workspace`}]:[]}).sort((e,t)=>e.name.localeCompare(t.name)):[]}function u(e){let t=e.indexOf(`/fleet-pi/`);return t>=0?e.slice(t+10):e}function d(e){return[e.name,e.source?`Source: ${e.source}`:null,e.activationStatus?`Status: ${e.activationStatus}`:null,e.description??null,e.workspacePath?u(e.workspacePath):null,e.path?u(e.path):null].filter(Boolean).join(`
2
+ `)}function f(e){return`${e.source??`resource`}:${e.path??e.name}`}function p(e,t){let n=new Set;return[...e,...t].filter(e=>{let t=`${e.path??e.workspacePath??``}:${e.name}`;return!n.has(t)&&(n.add(t),!0)})}export{f as i,d as n,s as r,c as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-NZYk81nU.js";import{r as t}from"./resource-helpers-ULlyU8qK.js";import{n}from"./file-text-BhQ0ZnoU.js";import{a as r,i,t as a}from"./skeleton-loaders-fStjEeRP.js";var o=e();function s({error:e,loading:s,resources:c,workspace:l}){let u=t(c,l);return(0,o.jsxs)(o.Fragment,{children:[e&&(0,o.jsx)(r,{icon:n,title:`Unable to load resources`,description:e.message}),!e&&s&&!c&&(0,o.jsx)(a,{}),!e&&c&&u.map(e=>(0,o.jsx)(i,{...e},e.id))]})}export{s as ResourcesPanelContent};