@mcp-use/inspector 20.0.0-beta.1 → 20.0.0-beta.3

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 (196) hide show
  1. package/README.md +5 -0
  2. package/dist/cdn/{AnimatePresence-B4HhIdgq.js → AnimatePresence-Dcw-FOy8.js} +50 -50
  3. package/dist/cdn/ChatTab-BS5Tlm2y.js +6744 -0
  4. package/dist/cdn/{CheckboxIndicator-BF2cKfbA.js → CheckboxIndicator-Bt4IICtv.js} +77 -77
  5. package/dist/cdn/{ConnectionSettingsForm-BNS6bOMD.js → ConnectionSettingsForm-BFsZpwK4.js} +348 -292
  6. package/dist/cdn/ConnectionSettingsTab-DDk06dhT.js +150 -0
  7. package/dist/cdn/{ElicitationTab-upPXq2q7.js → ElicitationTab-CL1KJ0bz.js} +39 -39
  8. package/dist/cdn/{FormContext-Cl51-7O7.js → FormContext-tmgN_Vdr.js} +1 -1
  9. package/dist/cdn/{InspectorContext-DzXtgyTx.js → InspectorContext-UjtEbNod.js} +1 -21
  10. package/dist/cdn/{JSONDisplay-D3RcyO9z.js → JSONDisplay-BFxf5oEu.js} +18 -18
  11. package/dist/cdn/{ListTabHeader-8lULn-90.js → ListTabHeader-Cv-GmtGF.js} +19 -19
  12. package/dist/cdn/{ManufactOAuthCallback-DEM8mhWD.js → ManufactOAuthCallback-B98kSYCj.js} +1 -1
  13. package/dist/cdn/MarkdownRenderer-_aYcof42.js +3610 -0
  14. package/dist/cdn/{NotificationsTab-CWopTIzT.js → NotificationsTab-CeImSrhx.js} +13 -13
  15. package/dist/cdn/{OAuthCallback-k3oeLtIC.js → OAuthCallback-C4n2hqKU.js} +1 -1
  16. package/dist/cdn/PromptsTab-BajHFLa3.js +901 -0
  17. package/dist/cdn/{ResourcesTab-KfamsM6-.js → ResourcesTab-BgeMlTdR.js} +35 -55
  18. package/dist/cdn/{SamplingTab-vcufuK24.js → SamplingTab-CnJB229N.js} +35 -35
  19. package/dist/cdn/{ServerMetadataTab-DS0eiyyD.js → ServerMetadataTab-CvrKX8fz.js} +12 -12
  20. package/dist/cdn/{StatusIcon-BGXOEU2u.js → StatusIcon-D0-ARyOh.js} +6 -6
  21. package/dist/cdn/{ToolsTab-DRjcZnpu.js → ToolsTab-ACLxPxR6.js} +103 -137
  22. package/dist/cdn/{ViewPreview-B_onhcUB.js → ViewPreview-DsPwZAwO.js} +2 -2
  23. package/dist/cdn/{WidgetWrapper-D29YDxIu.js → WidgetWrapper-CwlpDv17.js} +529 -530
  24. package/dist/cdn/card-DgiYnSg-.js +41 -0
  25. package/dist/cdn/{checkbox-B4oUG6Rr.js → checkbox-By0FklhG.js} +6 -6
  26. package/dist/cdn/{dialog-Dnl-pZsY.js → dialog-BsDpuJd3.js} +151 -151
  27. package/dist/cdn/{dist-mRDqCgKU.js → dist-B0eL32Gb.js} +114 -113
  28. package/dist/cdn/{dist-DjXr_YO3.js → dist-DaMB0Su9.js} +1 -1
  29. package/dist/cdn/{index-browser-CVUwR-Bu.js → index-browser-QDjRGsPo.js} +1 -1
  30. package/dist/cdn/{input-BLxOA7V-.js → input-C2OBd4PJ.js} +4787 -2842
  31. package/dist/cdn/inspector.css +1 -1
  32. package/dist/cdn/inspector.js +7419 -7445
  33. package/dist/cdn/{label-CBvG613A.js → label-B9Jmm9be.js} +10 -10
  34. package/dist/cdn/{manufact-auth-0TVxpeTA.js → manufact-auth-BQMHhbLV.js} +142 -106
  35. package/dist/cdn/{not-found-BcNNsTjS.js → not-found-DEtSM_Wd.js} +7 -7
  36. package/dist/cdn/providerMeta-BQIfHuNL.js +379 -0
  37. package/dist/cdn/{react-BxO-uEDZ.js → react-Dn8PWXwP.js} +1 -1
  38. package/dist/cdn/{select-BZ_IoKxg.js → select-DDdiIPR2.js} +726 -726
  39. package/dist/cdn/{shared-uMiV6Fx1.js → shared-DaILIQPP.js} +29 -29
  40. package/dist/cdn/{popover-C_SSrXT0.js → sheet-Br_l2kry.js} +694 -622
  41. package/dist/cdn/{spinner-CWcJhIY_.js → spinner-jQtC7EBj.js} +5 -5
  42. package/dist/cdn/{switch-DtQOLb9R.js → switch-C3IyQuid.js} +104 -104
  43. package/dist/cdn/{tabs-subtle-C5cy35sY.js → tabs-subtle-CkdI6Mac.js} +147 -147
  44. package/dist/cdn/{telemetry-Ct6pVkM1.js → telemetry-gHF-tMli.js} +3 -3
  45. package/dist/cdn/{textarea-Bj-CT7hC.js → textarea-DSbwcFVt.js} +6 -6
  46. package/dist/cdn/{useAriaLabelledBy-Bm9qHGK6.js → useAriaLabelledBy-DqAdnppm.js} +1 -1
  47. package/dist/cdn/{useCompositeItem-CNJ6MXdi.js → useCompositeItem-BRqEzYh-.js} +2 -2
  48. package/dist/cdn/{useConfig-CwxZ6Quj.js → useConfig-BWcNCqwi.js} +73 -46
  49. package/dist/cdn/{useViewHostProps-Dr6W2ooF.js → useViewHostProps-DIIlz3tJ.js} +1 -1
  50. package/dist/cli.js +27 -13
  51. package/dist/client/auth/manufact-auth.d.ts +3 -1
  52. package/dist/client/auth/manufact-auth.d.ts.map +1 -1
  53. package/dist/client/components/ChatTab.d.ts +1 -8
  54. package/dist/client/components/ChatTab.d.ts.map +1 -1
  55. package/dist/client/components/ResourcesTab.d.ts.map +1 -1
  56. package/dist/client/components/chat/ChatHeader.d.ts +7 -2
  57. package/dist/client/components/chat/ChatHeader.d.ts.map +1 -1
  58. package/dist/client/components/chat/ChatLandingForm.d.ts +4 -2
  59. package/dist/client/components/chat/ChatLandingForm.d.ts.map +1 -1
  60. package/dist/client/components/chat/ChatManagedNotice.d.ts +10 -0
  61. package/dist/client/components/chat/ChatManagedNotice.d.ts.map +1 -0
  62. package/dist/client/components/chat/ChatScrollTopFade.d.ts +7 -0
  63. package/dist/client/components/chat/ChatScrollTopFade.d.ts.map +1 -0
  64. package/dist/client/components/chat/ConfigurationDialog.d.ts +11 -9
  65. package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
  66. package/dist/client/components/chat/ConfigureEmptyState.d.ts +1 -6
  67. package/dist/client/components/chat/ConfigureEmptyState.d.ts.map +1 -1
  68. package/dist/client/components/chat/StreamingAssistantContent.d.ts.map +1 -1
  69. package/dist/client/components/chat/chatModeStorage.d.ts +11 -0
  70. package/dist/client/components/chat/chatModeStorage.d.ts.map +1 -0
  71. package/dist/client/components/chat/managedChatNotice.d.ts +16 -0
  72. package/dist/client/components/chat/managedChatNotice.d.ts.map +1 -0
  73. package/dist/client/components/chat/providerMeta.d.ts +11 -0
  74. package/dist/client/components/chat/providerMeta.d.ts.map +1 -1
  75. package/dist/client/components/chat/useChatMessages.d.ts +7 -5
  76. package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
  77. package/dist/client/components/chat/useChatMessagesClientSide.d.ts +4 -6
  78. package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
  79. package/dist/client/components/chat/useChatScrollToBottom.d.ts +1 -0
  80. package/dist/client/components/chat/useChatScrollToBottom.d.ts.map +1 -1
  81. package/dist/client/components/chat/useConfig.d.ts +1 -1
  82. package/dist/client/components/chat/useConfig.d.ts.map +1 -1
  83. package/dist/client/components/chat/useHostedChatMode.d.ts +1 -1
  84. package/dist/client/components/chat/useHostedChatMode.d.ts.map +1 -1
  85. package/dist/client/components/shared/MarkdownRenderer.d.ts +2 -1
  86. package/dist/client/components/shared/MarkdownRenderer.d.ts.map +1 -1
  87. package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
  88. package/dist/client/components/ui/MeshGradientCanvas.d.ts +13 -0
  89. package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -0
  90. package/dist/client/components/ui/chat-message.d.ts +1 -1
  91. package/dist/client/components/ui/chat-message.d.ts.map +1 -1
  92. package/dist/client/components/ui/file-thumbnail.d.ts.map +1 -1
  93. package/dist/client/components/ui/mesh-tab-background.d.ts +3 -1
  94. package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
  95. package/dist/client/context/InspectorContext.d.ts.map +1 -1
  96. package/dist/client/index.js +2577 -2165
  97. package/dist/client/telemetry/utils.d.ts.map +1 -1
  98. package/dist/server/asset-urls.d.ts +4 -0
  99. package/dist/server/asset-urls.d.ts.map +1 -1
  100. package/dist/server/asset-urls.js +7 -3
  101. package/dist/server/cdn-shell.d.ts.map +1 -1
  102. package/dist/server/cdn-shell.js +3 -3
  103. package/dist/server/{chunk-KBVKS4J5.js → chunk-H6ZCIKBS.js} +10 -0
  104. package/dist/server/{chunk-Y2GBQOQW.js → chunk-H7UBATRR.js} +2 -9
  105. package/dist/server/{chunk-VDUV6LR6.js → chunk-HGPQON3P.js} +15 -4
  106. package/dist/server/{chunk-K2V2SDQD.js → chunk-OWR2BIBW.js} +1 -1
  107. package/dist/server/{chunk-5B3SXGZP.js → chunk-UJLXHNQP.js} +1 -1
  108. package/dist/server/{chunk-IXYK6ZOY.js → chunk-W3PVQLOP.js} +2 -2
  109. package/dist/server/{chunk-6XWDZEFF.js → chunk-XCNS5CIW.js} +8 -3
  110. package/dist/server/cli.js +5 -5
  111. package/dist/server/create-dev-api-app.js +3 -3
  112. package/dist/server/dev-callback-redirect.d.ts +3 -0
  113. package/dist/server/dev-callback-redirect.d.ts.map +1 -0
  114. package/dist/server/dev-callback-redirect.js +18 -0
  115. package/dist/server/index.js +6 -6
  116. package/dist/server/middleware.js +6 -6
  117. package/dist/server/proxy/index.js +1 -1
  118. package/dist/server/proxy/mcp-proxy.d.ts +2 -0
  119. package/dist/server/proxy/mcp-proxy.d.ts.map +1 -1
  120. package/dist/server/proxy/mcp-proxy.js +3 -1
  121. package/dist/server/proxy-routes.js +2 -2
  122. package/dist/server/server.js +3 -3
  123. package/dist/server/version.js +1 -1
  124. package/dist/server/vite-dev-api-plugin.js +3 -3
  125. package/dist/web/assets/{AnimatePresence-CthXziG2.js → AnimatePresence-C5p0yiY1.js} +2 -2
  126. package/dist/web/assets/ChatTab-C2FtENBM.js +18 -0
  127. package/dist/web/assets/ConnectionSettingsTab-B2sUjytG.js +1 -0
  128. package/dist/web/assets/ElicitationTab-DwH08kDC.js +1 -0
  129. package/dist/web/assets/{FormContext-Cqc_A12u.js → FormContext-DH2caWKO.js} +1 -1
  130. package/dist/web/assets/ListTabHeader-R17w_JsB.js +1 -0
  131. package/dist/web/assets/{ManufactOAuthCallback-DCLbW-mz.js → ManufactOAuthCallback-Btu4B6u6.js} +1 -1
  132. package/dist/web/assets/MarkdownRenderer-DpIEt9wb.js +47 -0
  133. package/dist/web/assets/{NotificationsTab-JevzvJTg.js → NotificationsTab-CHB8mtSz.js} +1 -1
  134. package/dist/web/assets/{OAuthCallback-BjcRxLh5.js → OAuthCallback-DV4MgX4Z.js} +1 -1
  135. package/dist/web/assets/PromptsTab-0GIapoSs.js +15 -0
  136. package/dist/web/assets/ResourcesTab-N9xjsI_b.js +2 -0
  137. package/dist/web/assets/SamplingTab-Dw0vpi4t.js +1 -0
  138. package/dist/web/assets/ServerMetadataTab-D-eQpLBF.js +1 -0
  139. package/dist/web/assets/ToolsTab-BMrMJ5JV.js +8 -0
  140. package/dist/web/assets/ViewPreview-N_cpEO0W.js +1 -0
  141. package/dist/web/assets/WidgetWrapper-pDgNVq9y.js +34 -0
  142. package/dist/web/assets/checkbox-CrnXSMh2.js +1 -0
  143. package/dist/web/assets/dist-CeWSydFI.js +21 -0
  144. package/dist/web/assets/index-Cfuv_gb3.js +475 -0
  145. package/dist/web/assets/index-fBX3akc8.css +1 -0
  146. package/dist/web/assets/input-CLYhA7PK.js +1 -0
  147. package/dist/web/assets/{label-B5Q_Zr8M.js → label-Cdim77Jw.js} +1 -1
  148. package/dist/web/assets/select-CJ57-Bor.js +1 -0
  149. package/dist/web/assets/shared-B1GD9FMm.js +1 -0
  150. package/dist/web/assets/{tabs-subtle-AkJZvdxS.js → tabs-subtle-CG5cjC_N.js} +1 -1
  151. package/dist/web/assets/textarea-DLAmNVf_.js +1 -0
  152. package/dist/web/assets/useConfig-BTp15Lle.js +1 -0
  153. package/dist/web/assets/{useViewHostProps-DXAD1g7g.js → useViewHostProps-BQlaFC2Q.js} +1 -1
  154. package/dist/web/index.html +8 -9
  155. package/package.json +5 -12
  156. package/dist/cdn/ChatTab-D8uwCHAf.js +0 -13218
  157. package/dist/cdn/ConnectionSettingsTab-B97gPPJW.js +0 -145
  158. package/dist/cdn/PromptsTab-Cspfnl6n.js +0 -4400
  159. package/dist/cdn/bundle-mjs-B0nmHDtp.js +0 -1953
  160. package/dist/cdn/card-DqjqAq0o.js +0 -41
  161. package/dist/cdn/chunk-BO2N2NFS-Cy167e0X.js +0 -17500
  162. package/dist/cdn/highlighted-body-OFNGDK62-CoReNbTX.js +0 -36
  163. package/dist/cdn/mermaid-GHXKKRXX-DgVIbk-D.js +0 -2
  164. package/dist/cdn/pdf-CxFT9FER.js +0 -16291
  165. package/dist/cdn/sheet-CerCdhxz.js +0 -78
  166. package/dist/cdn/useHostedSession-BA39Aegc.js +0 -153
  167. package/dist/cdn/useMCPPrompts-D3_Hla_z.js +0 -104
  168. package/dist/client/components/chat/streamdown-code-slim.d.ts +0 -4
  169. package/dist/client/components/chat/streamdown-code-slim.d.ts.map +0 -1
  170. package/dist/web/assets/ChatTab-Cy8eyFYI.js +0 -460
  171. package/dist/web/assets/ConnectionSettingsTab-sDZGaUJn.js +0 -1
  172. package/dist/web/assets/ElicitationTab-wDKgU1qL.js +0 -1
  173. package/dist/web/assets/ListTabHeader-G-nQX18m.js +0 -1
  174. package/dist/web/assets/PromptsTab-DsQVOjKH.js +0 -61
  175. package/dist/web/assets/ResourcesTab-Bw8_p6M1.js +0 -2
  176. package/dist/web/assets/SamplingTab-BrcF1zJF.js +0 -1
  177. package/dist/web/assets/ServerMetadataTab-Bydeh1Po.js +0 -1
  178. package/dist/web/assets/ToolsTab-DJWF7Q_x.js +0 -8
  179. package/dist/web/assets/ViewPreview-jgeU7bY9.js +0 -1
  180. package/dist/web/assets/WidgetWrapper-B_vJU9uF.js +0 -34
  181. package/dist/web/assets/bundle-mjs-8puS6ou7.js +0 -1
  182. package/dist/web/assets/checkbox-BA-XURSj.js +0 -1
  183. package/dist/web/assets/chunk-BO2N2NFS-CGbd3eLY.js +0 -131
  184. package/dist/web/assets/dist-BcAQZluc.js +0 -21
  185. package/dist/web/assets/highlighted-body-OFNGDK62-BBJFbIMp.js +0 -1
  186. package/dist/web/assets/index-BjH-Qp85.css +0 -1
  187. package/dist/web/assets/index-D2UxaT9v.js +0 -475
  188. package/dist/web/assets/input-CjmxOFr6.js +0 -1
  189. package/dist/web/assets/mermaid-GHXKKRXX-B4MKVODA.js +0 -1
  190. package/dist/web/assets/pdf-CuwKm9zO.js +0 -54
  191. package/dist/web/assets/select-C0xlfLAa.js +0 -1
  192. package/dist/web/assets/shared-DQE60Op-.js +0 -1
  193. package/dist/web/assets/sheet-7TIkLdpr.js +0 -1
  194. package/dist/web/assets/textarea-Ci09-en6.js +0 -1
  195. package/dist/web/assets/useConfig-Qglo4xs1.js +0 -1
  196. package/dist/web/assets/useMCPPrompts-USLYc1I4.js +0 -1
@@ -1,475 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTab-Cy8eyFYI.js","assets/react-CU_d2d5K.js","assets/input-CjmxOFr6.js","assets/bundle-mjs-8puS6ou7.js","assets/createLucideIcon-B3b8EU0b.js","assets/jsx-runtime-Cjj9sGSy.js","assets/FormContext-Cqc_A12u.js","assets/select-C0xlfLAa.js","assets/AnimatePresence-CthXziG2.js","assets/label-B5Q_Zr8M.js","assets/tabs-subtle-AkJZvdxS.js","assets/chunk-BO2N2NFS-CGbd3eLY.js","assets/refresh-cw-C9wQl8_d.js","assets/dist-BcAQZluc.js","assets/useConfig-Qglo4xs1.js","assets/schemaHelpers-DLNTQr_6.js","assets/checkbox-BA-XURSj.js","assets/sheet-7TIkLdpr.js","assets/textarea-Ci09-en6.js","assets/useViewHostProps-DXAD1g7g.js","assets/useMCPPrompts-USLYc1I4.js","assets/ToolsTab-DJWF7Q_x.js","assets/WidgetWrapper-B_vJU9uF.js","assets/maximize-2-BTT9QQU9.js","assets/sparkles-2OAsc1aP.js","assets/zap-Du2Uc5pa.js","assets/code-tME-5H6D.js","assets/shared-DQE60Op-.js","assets/ListTabHeader-G-nQX18m.js","assets/maximize-_O55kFcr.js","assets/save-B-MsgxX9.js","assets/PromptsTab-DsQVOjKH.js","assets/ResourcesTab-Bw8_p6M1.js","assets/brush--0LobUi4.js","assets/SamplingTab-BrcF1zJF.js","assets/ElicitationTab-wDKgU1qL.js","assets/NotificationsTab-JevzvJTg.js","assets/ServerMetadataTab-Bydeh1Po.js","assets/inspector-settings-layout-yjKRJDai.js","assets/ConnectionSettingsTab-sDZGaUJn.js","assets/OAuthCallback-BjcRxLh5.js","assets/ManufactOAuthCallback-DCLbW-mz.js","assets/ViewPreview-jgeU7bY9.js"])))=>i.map(i=>d[i]);
2
- import{a as e,i as t,n,s as r,t as i}from"./react-CU_d2d5K.js";import{r as a}from"./bundle-mjs-8puS6ou7.js";import{t as o}from"./jsx-runtime-Cjj9sGSy.js";import{$ as s,$n as c,A as l,Ar as u,At as d,B as f,Bn as p,Cr as m,Ct as h,D as g,Dn as _,Dr as v,Dt as y,E as b,En as x,Er as S,F as C,Fr as w,G as T,Gt as ee,I as E,Ir as D,It as te,J as ne,K as O,Kn as re,Kt as k,L as ie,Lr as A,Lt as j,M,Mn as ae,Mt as oe,N as se,Nn as N,Nr as P,Nt as ce,O as le,Ot as ue,P as de,Pn as fe,Pr as pe,Pt as me,Q as he,R as ge,Rn as _e,Rt as ve,S as ye,Sr as be,St as F,T as xe,Tn as Se,Tt as Ce,U as we,Un as Te,Ut as Ee,Wn as De,X as Oe,Y as ke,Yn as Ae,Z as je,Zn as Me,_ as Ne,_r as Pe,_t as Fe,a as Ie,an as Le,ar as Re,at as ze,b as Be,br as Ve,c as He,ct as Ue,dr as We,dt as Ge,et as Ke,f as qe,fr as Je,ft as Ye,g as Xe,gr as Ze,gt as Qe,h as $e,hn as et,ht as tt,i as nt,in as rt,ir as it,it as at,j as ot,jt as st,k as ct,kn as lt,kr as ut,kt as dt,lt as ft,m as I,mn as pt,mr as mt,mt as ht,n as gt,nr as _t,o as vt,on as yt,or as bt,ot as xt,pr as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sr as jt,st as Mt,t as Nt,tt as Pt,ut as Ft,v as It,vt as Lt,w as Rt,wn as zt,wr as Bt,wt as Vt,x as Ht,xr as Ut,y as Wt,yr as Gt,yt as Kt,z as qt,zn as Jt}from"./input-CjmxOFr6.js";import{n as Yt,t as Xt}from"./label-B5Q_Zr8M.js";import{b as Zt,l as Qt,r as $t,t as en}from"./AnimatePresence-CthXziG2.js";import{C as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,l as mn,m as hn,n as gn,p as _n,r as vn,t as yn,u as bn,v as xn,w as Sn,x as Cn,y as wn}from"./select-C0xlfLAa.js";import{c as Tn,i as En,l as Dn,o as On,r as kn,t as An}from"./FormContext-Cqc_A12u.js";import{t as L}from"./createLucideIcon-B3b8EU0b.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var jn=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&O(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&O(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var te=new MessageChannel,ne=te.port2;te.port1.onmessage=E,D=function(){ne.postMessage(null)}}else D=function(){_(E,0)};function O(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,O(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Mn=n(((e,t)=>{t.exports=jn()})),Nn=n((e=>{var t=Mn(),n=i(),r=a();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var re=Symbol.for(`react.client.reference`);function k(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?k(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return k(e(t))}catch{}}return null}var ie=Array.isArray,A=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function N(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function P(e,t){oe++,ae[oe]=e.current,e.current=t}var ce=se(null),le=se(null),ue=se(null),de=se(null);function fe(e,t){switch(P(ue,t),P(le,e),P(ce,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ef(t),e=tf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}N(ce),P(ce,e)}function pe(){N(ce),N(le),N(ue)}function me(e){e.memoizedState!==null&&P(de,e);var t=ce.current,n=tf(t,e.type);t!==n&&(P(le,e),P(ce,n))}function he(e){le.current===e&&(N(ce),N(le)),de.current===e&&(N(de),up._currentValue=M)}var ge,_e;function ve(e){if(ge===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ge=t&&t[1]||``,_e=-1<e.stack.indexOf(`
3
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
- `+ge+e+_e}var ye=!1;function be(e,t){if(!e||ye)return``;ye=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
- `),l=s.split(`
6
- `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ye=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ve(n):``}function F(e,t){switch(e.tag){case 26:case 27:case 5:return ve(e.type);case 16:return ve(`Lazy`);case 13:return e.child!==t&&t!==null?ve(`Suspense Fallback`):ve(`Suspense`);case 19:return ve(`SuspenseList`);case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ve(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=F(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
- Error generating stack: `+e.message+`
9
- `+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,Fe=t.unstable_setDisableYieldValue,Ie=null,Le=null;function Re(e){if(typeof Pe==`function`&&Fe(e),Le&&typeof Le.setStrictMode==`function`)try{Le.setStrictMode(Ie,e)}catch{}}var ze=Math.clz32?Math.clz32:He,Be=Math.log,Ve=Math.LN2;function He(e){return e>>>=0,e===0?32:31-(Be(e)/Ve|0)|0}var Ue=256,We=262144,Ge=4194304;function Ke(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function qe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ke(n))):i=Ke(o):i=Ke(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ke(n))):i=Ke(o)):i=Ke(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Je(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ye(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xe(){var e=Ge;return Ge<<=1,!(Ge&62914560)&&(Ge=4194304),e}function Ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $e(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-ze(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&et(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function et(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function tt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function nt(e,t){var n=t&-t;return n=n&42?1:rt(n),(n&(e.suspendedLanes|t))===0?n:0}function rt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function it(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function at(){var e=j.p;return e===0?(e=window.event,e===void 0?32:Cp(e.type)):e}function ot(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var st=Math.random().toString(36).slice(2),ct=`__reactFiber$`+st,lt=`__reactProps$`+st,ut=`__reactContainer$`+st,dt=`__reactEvents$`+st,ft=`__reactListeners$`+st,I=`__reactHandles$`+st,pt=`__reactResources$`+st,mt=`__reactMarker$`+st;function ht(e){delete e[ct],delete e[lt],delete e[dt],delete e[ft],delete e[I]}function gt(e){var t=e[ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ut]||n[ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wf(e);e!==null;){if(n=e[ct])return n;e=wf(e)}return t}e=n,n=e.parentNode}return null}function _t(e){if(e=e[ct]||e[ut]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function vt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function yt(e){var t=e[pt];return t||=e[pt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function bt(e){e[mt]=!0}var xt=new Set,St={};function Ct(e,t){wt(e,t),wt(e+`Capture`,t)}function wt(e,t){for(St[e]=t,e=0;e<t.length;e++)xt.add(t[e])}var Tt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Et={},Dt={};function Ot(e){return Se.call(Dt,e)?!0:Se.call(Et,e)?!1:Tt.test(e)?Dt[e]=!0:(Et[e]=!0,!1)}function kt(e,t,n){if(Ot(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function At(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function jt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Mt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Nt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Pt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ft(e){if(!e._valueTracker){var t=Nt(e)?`checked`:`value`;e._valueTracker=Pt(e,t,``+e[t])}}function It(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Nt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Lt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Rt=/[\n"\\]/g;function zt(e){return e.replace(Rt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Bt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Mt(t)):e.value!==``+Mt(t)&&(e.value=``+Mt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ht(e,o,Mt(n)):Ht(e,o,Mt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Mt(s):e.removeAttribute(`name`)}function Vt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ft(e);return}n=n==null?``:``+Mt(n),t=t==null?n:``+Mt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ft(e)}function Ht(e,t,n){t===`number`&&Lt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ut(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Mt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wt(e,t,n){if(t!=null&&(t=``+Mt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Mt(n)}function Gt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(ie(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=Mt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ft(e)}function Kt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Jt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||qt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Yt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Jt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Jt(e,a,t[a])}function Xt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Zt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Qt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function $t(e){return Qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function en(){}var tn=null;function nn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rn=null,an=null;function on(e){var t=_t(e);if(t&&(e=t.stateNode)){var n=e[lt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Bt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+zt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[lt]||null;if(!i)throw Error(o(90));Bt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&It(r)}break a;case`textarea`:Wt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ut(e,!!n.multiple,t,!1)}}}var sn=!1;function cn(e,t,n){if(sn)return e(t,n);sn=!0;try{return e(t)}finally{if(sn=!1,(rn!==null||an!==null)&&(Au(),rn&&(t=rn,e=an,an=rn=null,on(t),e)))for(t=0;t<e.length;t++)on(e[t])}}function ln(e,t){var n=e.stateNode;if(n===null)return null;var r=n[lt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var un=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),dn=!1;if(un)try{var fn={};Object.defineProperty(fn,"passive",{get:function(){dn=!0}}),window.addEventListener(`test`,fn,fn),window.removeEventListener(`test`,fn,fn)}catch{dn=!1}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return hn=i.slice(e,1<r?1-r:void 0)}function _n(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vn(){return!0}function yn(){return!1}function bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?vn:yn,this.isPropagationStopped=yn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=vn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=vn)},persist:function(){},isPersistent:vn}),t}var xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sn=bn(xn),Cn=m({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=m({},Cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ln,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Dn&&(Dn&&e.type===`mousemove`?(Tn=e.screenX-Dn.screenX,En=e.screenY-Dn.screenY):En=Tn=0,Dn=e),Tn)},movementY:function(e){return`movementY`in e?e.movementY:En}}),kn=bn(On),An=bn(m({},On,{dataTransfer:0})),L=bn(m({},Cn,{relatedTarget:0})),jn=bn(m({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(m({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(m({},xn,{data:0})),R={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function z(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Ln(){return z}var Rn=bn(m({},Cn,{key:function(e){if(e.key){var t=R[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=_n(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ln,charCode:function(e){return e.type===`keypress`?_n(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?_n(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),zn=bn(m({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Bn=bn(m({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ln})),Vn=bn(m({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=bn(m({},On,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Un=bn(m({},xn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=un&&`CompositionEvent`in window,Kn=null;un&&`documentMode`in document&&(Kn=document.documentMode);var qn=un&&`TextEvent`in window&&!Kn,Jn=un&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=gn(),hn=mn=pn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){rn?an?an.push(r):an=[r]:rn=r,t=Rd(t,`onChange`),0<t.length&&(n=new Sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){Ad(e,0)}function cr(e){if(It(vt(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(un){var dr;if(un){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,nn(e)),cn(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function yr(e,t){if(e===`input`||e===`change`)return cr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Se.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Lt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Lt(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=un&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Lt(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Rd(Ar,`onSelect`),0<r.length&&(t=new Sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};un&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),Ct(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-ze(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(e){if(50<xu)throw xu=0,Su=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ai={};function oi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ui(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function di(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=tp(e,n,ce.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=si(31,n,t,i),e.elementType=D,e.lanes=a,e;case v:return fi(n.children,i,a,t);case y:s=8,i|=24;break;case b:return e=si(12,n,t,i|2),e.elementType=b,e.lanes=a,e;case w:return e=si(13,n,t,i),e.elementType=w,e.lanes=a,e;case T:return e=si(19,n,t,i),e.elementType=T,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case ee:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=si(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:xe(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:xe(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-ze(r)-1;r&=~(1<<i),n+=1;var a=32-ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-ze(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,Pi=!1,Fi=null,Ii=!1,Li=Error(o(519));function Ri(e){throw Wi(_i(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ct]=e,t[lt]=r,n){case`dialog`:jd(`cancel`,t),jd(`close`,t);break;case`iframe`:case`object`:case`embed`:jd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Od.length;n++)jd(Od[n],t);break;case`source`:jd(`error`,t);break;case`img`:case`image`:case`link`:jd(`error`,t),jd(`load`,t);break;case`details`:jd(`toggle`,t);break;case`input`:jd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:jd(`invalid`,t);break;case`textarea`:jd(`invalid`,t),Gt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Wd(t.textContent,n)?(r.popover!=null&&(jd(`beforetoggle`,t),jd(`toggle`,t)),r.onScroll!=null&&jd(`scroll`,t),r.onScrollEnd!=null&&jd(`scrollend`,t),r.onClick!=null&&(t.onclick=en),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mi=Mi.return}}function Vi(e){if(e!==Mi)return!1;if(!Pi)return Bi(e),Pi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||nf(e.type,e.memoizedProps)),n=!n),n&&Ni&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ni=Cf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ni=Cf(e)}else t===27?(t=Ni,df(e.type)?(e=Sf,Sf=null,Ni=e):Ni=t):Ni=Mi?xf(e.stateNode.nextSibling):null;return!0}function Hi(){Ni=Mi=null,Pi=!1}function Ui(){var e=Fi;return e!==null&&(su===null?su=e:su.push.apply(su,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=se(null),Ki=null,qi=null;function Ji(e,t,n){P(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,N(Gi)}function Xi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Zi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Xi(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Xi(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Qi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;xr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===de.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[up]:e.push(up))}i=i.return}e!==null&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return ra(Ki,e)}function na(e,t){return Ki===null&&ea(e),ra(e,t)}function ra(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(o(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ia=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},aa=t.unstable_scheduleCallback,oa=t.unstable_NormalPriority,sa={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new ia,data:new Map,refCount:0}}function la(e){e.refCount--,e.refCount===0&&aa(oa,function(){e.controller.abort()})}var ua=null,da=0,fa=0,pa=null;function ma(e,t){if(ua===null){var n=ua=[];da=0,fa=Sd(),pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return da++,t.then(ha,ha),t}function ha(){if(--da===0&&ua!==null){pa!==null&&(pa.status=`fulfilled`);var e=ua;ua=null,fa=0,pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ga(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var _a=A.S;A.S=function(e,t){uu=De(),typeof t==`object`&&t&&typeof t.then==`function`&&ma(e,t),_a!==null&&_a(e,t)};var va=se(null);function ya(){var e=va.current;return e===null?Gl.pooledCache:e}function ba(e,t){t===null?P(va,va.current):P(va,t.pool)}function xa(){var e=ya();return e===null?null:{parent:sa._currentValue,pool:e}}var Sa=Error(o(460)),Ca=Error(o(474)),wa=Error(o(542)),Ta={then:function(){}};function Ea(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Da(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(en,en),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then(en,en);else{if(e=Gl,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e}throw ka=t,Sa}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ka=e,Sa):e}}var ka=null;function Aa(){if(ka===null)throw Error(o(459));var e=ka;return ka=null,e}function ja(e){if(e===Sa||e===wa)throw Error(o(483))}var Ma=null,Na=0;function Pa(e){var t=Na;return Na+=1,Ma===null&&(Ma=[]),Da(Ma,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ia(e,t){throw t.$$typeof===h?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function La(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=li(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=pi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===E&&Oa(a)===t.type)?(t=i(t,n.props),Fa(t,n),t.return=e,t):(t=di(n.type,n.key,n.props,null,e.mode,r),Fa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=hi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=fi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=di(t.type,t.key,t.props,null,e.mode,n),Fa(n,t),n.return=e,n;case _:return t=hi(t,e.mode,n),t.return=e,t;case E:return t=Oa(t),f(e,t,n)}if(ie(t)||O(t))return t=fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Pa(t),n);if(t.$$typeof===S)return f(e,na(e,t),n);Ia(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case E:return n=Oa(n),p(e,t,n,r)}if(ie(n)||O(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Pa(n),r);if(n.$$typeof===S)return p(e,t,na(e,n),r);Ia(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=Oa(r),m(e,t,n,r,i)}if(ie(r)||O(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Pa(r),i);if(r.$$typeof===S)return m(e,t,n,na(t,r),i);Ia(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Pi&&Di(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Pi&&Di(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Pi&&Di(i,h),l}function y(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Pi&&Di(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Pi&&Di(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Pi&&Di(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&Oa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Fa(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===v?(c=fi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=di(a.type,a.key,a.props,null,e.mode,c),Fa(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(a,e.mode,c),c.return=e,e=c}return s(e);case E:return a=Oa(a),b(e,r,a,c)}if(ie(a))return h(e,r,a,c);if(O(a)){if(l=O(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Pa(a),c);if(a.$$typeof===S)return b(e,r,na(e,a),c);Ia(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=pi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(e)}function Ga(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tt(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var qa=!1;function Ja(){if(qa){var e=pa;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(ql&f)===f:(r&f)===f){f!==0&&f===fa&&(qa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),tu|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Xa(n[e],t)}var Qa=se(null),$a=se(0);function eo(e,t){e=$l,P($a,e),P(Qa,t),$l=e|t.baseLanes}function to(){P($a,$l),P(Qa,Qa.current)}function no(){$l=$a.current,N(Qa),N($a)}var ro=se(null),io=null;function ao(e){var t=e.alternate;P(uo,uo.current&1),P(ro,e),io===null&&(t===null||Qa.current!==null||t.memoizedState!==null)&&(io=e)}function oo(e){P(uo,uo.current),P(ro,e),io===null&&(io=e)}function so(e){e.tag===22?(P(uo,uo.current),P(ro,e),io===null&&(io=e)):co(e)}function co(){P(uo,uo.current),P(ro,ro.current)}function lo(e){N(ro),io===e&&(io=null),N(uo)}var uo=se(0);function fo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||vf(n)||yf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var po=0,mo=null,ho=null,go=null,_o=!1,vo=!1,yo=!1,bo=0,xo=0,So=null,Co=0;function wo(){throw Error(o(321))}function To(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function Eo(e,t,n,r,i,a){return po=a,mo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Hs:Us,yo=!1,a=n(r,i),yo=!1,vo&&(a=Oo(t,n,r,i)),Do(e),a}function Do(e){A.H=Vs;var t=ho!==null&&ho.next!==null;if(po=0,go=ho=mo=null,_o=!1,xo=0,So=null,t)throw Error(o(300));e===null||oc||(e=e.dependencies,e!==null&&$i(e)&&(oc=!0))}function Oo(e,t,n,r){mo=e;var i=0;do{if(vo&&(So=null),xo=0,vo=!1,25<=i)throw Error(o(301));if(i+=1,go=ho=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}A.H=Ws,a=t(n,r)}while(vo);return a}function ko(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?Io(t):t,e=e.useState()[0],(ho===null?null:ho.memoizedState)!==e&&(mo.flags|=1024),t}function Ao(){var e=bo!==0;return bo=0,e}function jo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Mo(e){if(_o){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}_o=!1}po=0,go=ho=mo=null,vo=!1,xo=bo=0,So=null}function No(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return go===null?mo.memoizedState=go=e:go=go.next=e,go}function Po(){if(ho===null){var e=mo.alternate;e=e===null?null:e.memoizedState}else e=ho.next;var t=go===null?mo.memoizedState:go.next;if(t!==null)go=t,ho=e;else{if(e===null)throw mo.alternate===null?Error(o(467)):Error(o(310));ho=e,e={memoizedState:ho.memoizedState,baseState:ho.baseState,baseQueue:ho.baseQueue,queue:ho.queue,next:null},go===null?mo.memoizedState=go=e:go=go.next=e}return go}function Fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Io(e){var t=xo;return xo+=1,So===null&&(So=[]),e=Da(So,e,t),t=mo,(go===null?t.memoizedState:go.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Hs:Us),e}function Lo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Io(e);if(e.$$typeof===S)return ta(e)}throw Error(o(438,String(e)))}function Ro(e){var t=null,n=mo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=mo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Fo(),mo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=te;return t.index++,n}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){return Vo(Po(),ho,e)}function Vo(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(po&f)===f:(ql&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===fa&&(d=!0);else if((po&p)===p){u=u.next,p===fa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,mo.lanes|=p,tu|=p;f=u.action,yo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,mo.lanes|=f,tu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!xr(a,e.memoizedState)&&(oc=!0,d&&(n=pa,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function B(e){var t=Po(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);xr(a,t.memoizedState)||(oc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Ho(e,t,n){var r=mo,i=Po(),a=Pi;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!xr((ho||i).memoizedState,n);if(s&&(i.memoizedState=n,oc=!0),i=i.queue,ps(Go.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||go!==null&&go.memoizedState.tag&1){if(r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,i,n,t),null),Gl===null)throw Error(o(349));a||po&127||Uo(r,t,n)}return n}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=mo.updateQueue,t===null?(t=Fo(),mo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function qo(e){var t=ni(e,2);t!==null&&Tu(t,e,2)}function Jo(e){var t=No();if(typeof e==`function`){var n=e;if(e=n(),yo){Re(!0);try{n()}finally{Re(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t}function Yo(e,t,n,r){return e.baseState=n,Vo(e,ho,typeof r==`function`?r:zo)}function Xo(e,t,n,r,i){if(Rs(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};A.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Zo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),Qo(e,t,s)}catch(n){es(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),Qo(e,t,a)}catch(n){es(e,t,n)}}function Qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){$o(e,t,n)},function(n){return es(e,t,n)}):$o(e,t,n)}function $o(e,t,n){t.status=`fulfilled`,t.value=n,ts(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Zo(e,n)))}function es(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ts(t),t=t.next;while(t!==r)}e.action=null}function ts(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ns(e,t){return t}function rs(e,t){if(Pi){var n=Gl.formState;if(n!==null){a:{var r=mo;if(Pi){if(Ni){b:{for(var i=Ni,a=Ii;i.nodeType!==8;){if(!a){i=null;break b}if(i=xf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=xf(i.nextSibling),r=i.data===`F!`;break a}}Ri(r)}r=!1}r&&(t=n[0])}}return n=No(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:t},n.queue=r,n=Fs.bind(null,mo,r),r.dispatch=n,r=Jo(!1),a=Ls.bind(null,mo,!1,r.queue),r=No(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Xo.bind(null,mo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function is(e){return as(Po(),ho,e)}function as(e,t,n){if(t=Vo(e,t,ns)[0],e=Bo(zo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Io(t)}catch(e){throw e===Sa?wa:e}else r=t;t=Po();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(mo.flags|=2048,cs(9,{destroy:void 0},os.bind(null,i,n),null)),[r,a,e]}function os(e,t){e.action=t}function ss(e){var t=Po(),n=ho;if(n!==null)return as(t,n,e);Po(),t=t.memoizedState,n=Po();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function cs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=mo.updateQueue,t===null&&(t=Fo(),mo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ls(){return Po().memoizedState}function us(e,t,n,r){var i=No();mo.flags|=e,i.memoizedState=cs(1|t,{destroy:void 0},n,r===void 0?null:r)}function ds(e,t,n,r){var i=Po();r=r===void 0?null:r;var a=i.memoizedState.inst;ho!==null&&r!==null&&To(r,ho.memoizedState.deps)?i.memoizedState=cs(t,a,n,r):(mo.flags|=e,i.memoizedState=cs(1|t,a,n,r))}function fs(e,t){us(8390656,8,e,t)}function ps(e,t){ds(2048,8,e,t)}function ms(e){mo.flags|=4;var t=mo.updateQueue;if(t===null)t=Fo(),mo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function hs(e){var t=Po().memoizedState;return ms({ref:t,nextImpl:e}),function(){if(Wl&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function gs(e,t){return ds(4,2,e,t)}function _s(e,t){return ds(4,4,e,t)}function vs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ys(e,t,n){n=n==null?null:n.concat([e]),ds(4,4,vs.bind(null,t,e),n)}function bs(){}function xs(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&To(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ss(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&To(t,r[1]))return r[0];if(r=e(),yo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r}function Cs(e,t,n){return n===void 0||po&1073741824&&!(ql&261930)?e.memoizedState=t:(e.memoizedState=n,e=wu(),mo.lanes|=e,tu|=e,n)}function ws(e,t,n,r){return xr(n,t)?n:Qa.current===null?!(po&42)||po&1073741824&&!(ql&261930)?(oc=!0,e.memoizedState=n):(e=wu(),mo.lanes|=e,tu|=e,t):(e=Cs(e,n,r),xr(e,t)||(oc=!0),e)}function Ts(e,t,n,r,i){var a=j.p;j.p=a!==0&&8>a?a:8;var o=A.T,s={};A.T=s,Ls(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Is(e,t,ga(c,r),Cu(e)):Is(e,t,r,Cu(e))}catch(n){Is(e,t,{then:function(){},status:`rejected`,reason:n},Cu())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function Es(){}function Ds(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Os(e).queue;Ts(e,i,t,M,n===null?Es:function(){return ks(e),n(r)})}function Os(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:M,baseState:M,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:M},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ks(e){var t=Os(e);t.next===null&&(t=e.alternate.memoizedState),Is(e,t.next.queue,{},Cu())}function As(){return ta(up)}function js(){return Po().memoizedState}function Ms(){return Po().memoizedState}function Ns(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Cu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(Tu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function Ps(e,t,n){var r=Cu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rs(e)?zs(t,n):(n=ti(e,t,n,r),n!==null&&(Tu(n,e,r),Bs(n,t,r)))}function Fs(e,t,n){Is(e,t,n,Cu())}function Is(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rs(e))zs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return ei(e,t,i,0),Gl===null&&$r(),!1}catch{}if(n=ti(e,t,i,r),n!==null)return Tu(n,e,r),Bs(n,t,r),!0}return!1}function Ls(e,t,n,r){if(r={lane:2,revertLane:Sd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Rs(e)){if(t)throw Error(o(479))}else t=ti(e,n,r,2),t!==null&&Tu(t,e,2)}function Rs(e){var t=e.alternate;return e===mo||t!==null&&t===mo}function zs(e,t){vo=_o=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Bs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tt(e,n)}}var Vs={readContext:ta,use:Lo,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useLayoutEffect:wo,useInsertionEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useSyncExternalStore:wo,useId:wo,useHostTransitionStatus:wo,useFormState:wo,useActionState:wo,useOptimistic:wo,useMemoCache:wo,useCacheRefresh:wo};Vs.useEffectEvent=wo;var Hs={readContext:ta,use:Lo,useCallback:function(e,t){return No().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:fs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),us(4194308,4,vs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return us(4194308,4,e,t)},useInsertionEffect:function(e,t){us(4,2,e,t)},useMemo:function(e,t){var n=No();t=t===void 0?null:t;var r=e();if(yo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=No();if(n!==void 0){var i=n(t);if(yo){Re(!0);try{n(t)}finally{Re(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ps.bind(null,mo,e),[r.memoizedState,e]},useRef:function(e){var t=No();return e={current:e},t.memoizedState=e},useState:function(e){e=Jo(e);var t=e.queue,n=Fs.bind(null,mo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:bs,useDeferredValue:function(e,t){return Cs(No(),e,t)},useTransition:function(){var e=Jo(!1);return e=Ts.bind(null,mo,e.queue,!0,!1),No().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=mo,i=No();if(Pi){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Gl===null)throw Error(o(349));ql&127||Uo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,fs(Go.bind(null,r,a,e),[e]),r.flags|=2048,cs(9,{destroy:void 0},Wo.bind(null,r,a,n,t),null),n},useId:function(){var e=No(),t=Gl.identifierPrefix;if(Pi){var n=Ei,r=Ti;n=(r&~(1<<32-ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=bo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Co++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:As,useFormState:rs,useActionState:rs,useOptimistic:function(e){var t=No();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ls.bind(null,mo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ro,useCacheRefresh:function(){return No().memoizedState=Ns.bind(null,mo)},useEffectEvent:function(e){var t=No(),n={impl:e};return t.memoizedState=n,function(){if(Wl&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Us={readContext:ta,use:Lo,useCallback:xs,useContext:ta,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:Bo,useRef:ls,useState:function(){return Bo(zo)},useDebugValue:bs,useDeferredValue:function(e,t){return ws(Po(),ho.memoizedState,e,t)},useTransition:function(){var e=Bo(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:is,useActionState:is,useOptimistic:function(e,t){return Yo(Po(),ho,e,t)},useMemoCache:Ro,useCacheRefresh:Ms};Us.useEffectEvent=hs;var Ws={readContext:ta,use:Lo,useCallback:xs,useContext:ta,useEffect:ps,useImperativeHandle:ys,useInsertionEffect:gs,useLayoutEffect:_s,useMemo:Ss,useReducer:B,useRef:ls,useState:function(){return B(zo)},useDebugValue:bs,useDeferredValue:function(e,t){var n=Po();return ho===null?Cs(n,e,t):ws(n,ho.memoizedState,e,t)},useTransition:function(){var e=B(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Ho,useId:js,useHostTransitionStatus:As,useFormState:ss,useActionState:ss,useOptimistic:function(e,t){var n=Po();return ho===null?(n.baseState=e,[e,n.queue.dispatch]):Yo(n,ho,e,t)},useMemoCache:Ro,useCacheRefresh:Ms};Ws.useEffectEvent=hs;function Gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ks={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ua(r);i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(Tu(t,e,r),Ga(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Cu(),i=Ua(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(Tu(t,e,r),Ga(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Cu(),r=Ua(n);r.tag=2,t!=null&&(r.callback=t),t=Wa(e,r,n),t!==null&&(Tu(t,e,n),Ga(t,e,n))}};function qs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function Js(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ks.enqueueReplaceState(t,t.state,null)}function Ys(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Xs(e){Yr(e)}function Zs(e){console.error(e)}function Qs(e){Yr(e)}function $s(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ec(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function tc(e,t,n){return n=Ua(n),n.tag=3,n.payload={element:null},n.callback=function(){$s(e,t)},n}function nc(e){return e=Ua(e),e.tag=3,e}function rc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){ec(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){ec(t,n,r),typeof i!=`function`&&(pu===null?pu=new Set([this]):pu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function ic(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Qi(t,n,i,!0),n=ro.current,n!==null){switch(n.tag){case 31:case 13:return io===null?Lu():n.alternate===null&&eu===0&&(eu=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),nd(e,r,i)),!1;case 22:return n.flags|=65536,r===Ta?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),nd(e,r,i)),!1}throw Error(o(435,n.tag))}return nd(e,r,i),Lu(),!1}if(Pi)return t=ro.current,t===null?(r!==Li&&(t=Error(o(423),{cause:r}),Wi(_i(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=_i(r,n),i=tc(e.stateNode,r,i),Ka(e,i),eu!==4&&(eu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Li&&(e=Error(o(422),{cause:r}),Wi(_i(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=_i(a,n),ou===null?ou=[a]:ou.push(a),eu!==4&&(eu=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=tc(n.stateNode,r,e),Ka(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(pu===null||!pu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=nc(i),rc(i,e,n,r),Ka(n,i),!1}n=n.return}while(n!==null);return!1}var ac=Error(o(461)),oc=!1;function sc(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function cc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ea(t),r=Eo(e,t,n,o,a,i),s=Ao(),e!==null&&!oc?(jo(e,t,i),Mc(e,t,i)):(Pi&&s&&ki(t),t.flags|=1,sc(e,t,r,i),t.child)}function lc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,uc(e,t,a,r,i)):(e=di(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Nc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return Mc(e,t,i)}return t.flags|=1,e=li(a,r),e.ref=t.ref,e.return=t,t.child=e}function uc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref)if(oc=!1,t.pendingProps=r=a,Nc(e,i))e.flags&131072&&(oc=!0);else return t.lanes=e.lanes,Mc(e,t,i)}return vc(e,t,n,r,i)}function dc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return pc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ba(t,a===null?null:a.cachePool),a===null?to():eo(t,a),so(t);else return r=t.lanes=536870912,pc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ba(t,null),to(),co(t)):(ba(t,a.cachePool),eo(t,a),co(t),t.memoizedState=null);return sc(e,t,i,n),t.child}function fc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pc(e,t,n,r,i){var a=ya();return a=a===null?null:{parent:sa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ba(t,null),to(),so(t),e!==null&&Qi(e,t,r,!0),t.childLanes=i,null}function mc(e,t){return t=Dc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hc(e,t,n){return Ra(t,e.child,null,n),e=mc(t,t.pendingProps),e.flags|=2,lo(t),t.memoizedState=null,e}function gc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Pi){if(r.mode===`hidden`)return e=mc(t,r),t.lanes=536870912,fc(null,e);if(oo(t),(e=Ni)?(e=_f(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return t.lanes=536870912,null}return mc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(oo(t),i)if(t.flags&256)t.flags&=-257,t=hc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(oc||Qi(e,t,n,!1),i=(n&e.childLanes)!==0,oc||i){if(r=Gl,r!==null&&(s=nt(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,ni(e,s),Tu(r,e,s),ac;Lu(),t=hc(e,t,n)}else e=a.treeContext,Ni=xf(s.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=mc(t,r),t.flags|=4096;return t}return e=li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function _c(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function vc(e,t,n,r,i){return ea(t),n=Eo(e,t,n,r,void 0,i),r=Ao(),e!==null&&!oc?(jo(e,t,i),Mc(e,t,i)):(Pi&&r&&ki(t),t.flags|=1,sc(e,t,n,i),t.child)}function yc(e,t,n,r,i,a){return ea(t),t.updateQueue=null,n=Oo(t,r,n,i),Do(e),r=Ao(),e!==null&&!oc?(jo(e,t,a),Mc(e,t,a)):(Pi&&r&&ki(t),t.flags|=1,sc(e,t,n,a),t.child)}function bc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ks,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Va(t),o=n.contextType,a.context=typeof o==`object`&&o?ta(o):ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Gs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ks.enqueueReplaceState(a,a.state,null),Ya(t,r,a,i),Ja(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ys(n,s);a.props=c;var l=a.context,u=n.contextType;o=ai,typeof u==`object`&&u&&(o=ta(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Js(t,a,r,o),Ba=!1;var f=t.memoizedState;a.state=f,Ya(t,r,a,i),Ja(),l=t.memoizedState,s||f!==l||Ba?(typeof d==`function`&&(Gs(t,n,d,r),l=t.memoizedState),(c=Ba||qs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ha(e,t),o=t.memoizedProps,u=Ys(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ai,typeof l==`object`&&l&&(c=ta(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Js(t,a,r,c),Ba=!1,f=t.memoizedState,a.state=f,Ya(t,r,a,i),Ja();var p=t.memoizedState;o!==d||f!==p||Ba||e!==null&&e.dependencies!==null&&$i(e.dependencies)?(typeof s==`function`&&(Gs(t,n,s,r),p=t.memoizedState),(u=Ba||qs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&$i(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,_c(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ra(t,e.child,null,i),t.child=Ra(t,null,n,i)):sc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Mc(e,t,i),e}function xc(e,t,n,r){return Hi(),t.flags|=256,sc(e,t,n,r),t.child}var Sc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cc(e){return{baseLanes:e,cachePool:xa()}}function wc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=iu),e}function Tc(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:(uo.current&2)!=0),s&&(i=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Pi){if(i?ao(t):co(t),(e=Ni)?(e=_f(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return yf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(co(t),i=t.mode,c=Dc({mode:`hidden`,children:c},i),r=fi(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(null,r)):(ao(t),Ec(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(ao(t),t.flags&=-257,t=Oc(e,t,n)):t.memoizedState===null?(co(t),c=r.fallback,i=t.mode,r=Dc({mode:`visible`,children:r.children},i),c=fi(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ra(t,e.child,null,n),r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,t=fc(null,r)):(co(t),t.child=e.child,t.flags|=128,t=null);else if(ao(t),yf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,Wi({value:r,source:null,stack:null}),t=Oc(e,t,n)}else if(oc||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,oc||s){if(s=Gl,s!==null&&(r=nt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(e,r),Tu(s,e,r),ac;vf(c)||Lu(),t=Oc(e,t,n)}else vf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=xf(c.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=Ec(t,r.children),t.flags|=4096);return t}return i?(co(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,i,n,null),c.flags|=2):c=li(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,fc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Cc(n):(i=c.cachePool,i===null?i=xa():(l=sa._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(e.child,r)):(ao(t),n=e.child,e=n.sibling,n=li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Ec(e,t){return t=Dc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Dc(e,t){return e=si(22,e,null,t),e.lanes=0,e}function Oc(e,t,n){return Ra(t,e.child,null,n),e=Ec(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xi(e.return,t,n)}function Ac(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function jc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=uo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,P(uo,o),sc(e,t,r,n),r=Pi?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kc(e,n,t);else if(e.tag===19)kc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&fo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ac(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&fo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ac(t,!0,n,null,a,r);break;case`together`:Ac(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Mc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Nc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&$i(e))):!0}function Pc(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),Ji(t,sa,e.memoizedState.cache),Hi();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(ao(t),e=Mc(e,t,n),e===null?null:e.sibling):Tc(e,t,n):(ao(t),t.flags|=128,null);ao(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return jc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(uo,uo.current),r)break;return null;case 22:return t.lanes=0,dc(e,t,n,t.pendingProps);case 24:Ji(t,sa,e.memoizedState.cache)}return Mc(e,t,n)}function Fc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)oc=!0;else{if(!Nc(e,n)&&!(t.flags&128))return oc=!1,Pc(e,t,n);oc=!!(e.flags&131072)}else oc=!1,Pi&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e==`function`)ci(e)?(r=Ys(e,r),t.tag=1,t=bc(null,t,e,r,n)):(t.tag=0,t=vc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===C){t.tag=11,t=cc(null,t,e,r,n);break a}else if(i===ee){t.tag=14,t=lc(null,t,e,r,n);break a}}throw t=k(e)||e,Error(o(306,t,``))}}return t;case 0:return vc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Ys(r,t.pendingProps),bc(e,t,r,i,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Ha(e,t),Ya(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,sa,r),r!==a.cache&&Zi(t,[sa],n,!0),Ja(),r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=xc(e,t,r,n);break a}else if(r!==i){i=_i(Error(o(424)),t),Wi(i),t=xc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ni=xf(e.firstChild),Mi=t,Pi=!0,Fi=null,Ii=!0,n=za(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),r===i){t=Mc(e,t,n);break a}sc(e,t,r,n)}t=t.child}return t;case 26:return _c(e,t),e===null?(n=V(t.type,null,t.pendingProps,null))?t.memoizedState=n:Pi||(n=t.type,e=t.pendingProps,r=$d(ue.current).createElement(n),r[ct]=t,r[lt]=e,qd(r,n,e),bt(r),t.stateNode=r):t.memoizedState=V(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return me(t),e===null&&Pi&&(r=t.stateNode=Tf(t.type,t.pendingProps,ue.current),Mi=t,Ii=!0,i=Ni,df(t.type)?(Sf=i,Ni=xf(r.firstChild)):Ni=i),sc(e,t,t.pendingProps.children,n),_c(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pi&&((i=r=Ni)&&(r=hf(r,t.type,t.pendingProps,Ii),r===null?i=!1:(t.stateNode=r,Mi=t,Ni=xf(r.firstChild),Ii=!1,i=!0)),i||Ri(t)),me(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,nf(i,a)?r=null:s!==null&&nf(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=Eo(e,t,ko,null,null,n),up._currentValue=i),_c(e,t),sc(e,t,r,n),t.child;case 6:return e===null&&Pi&&((e=n=Ni)&&(n=gf(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Ri(t)),null;case 13:return Tc(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ra(t,null,r,n):sc(e,t,r,n),t.child;case 11:return cc(e,t,t.type,t.pendingProps,n);case 7:return sc(e,t,t.pendingProps,n),t.child;case 8:return sc(e,t,t.pendingProps.children,n),t.child;case 12:return sc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),sc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ea(t),i=ta(i),r=r(i),t.flags|=1,sc(e,t,r,n),t.child;case 14:return lc(e,t,t.type,t.pendingProps,n);case 15:return uc(e,t,t.type,t.pendingProps,n);case 19:return jc(e,t,n);case 31:return gc(e,t,n);case 22:return dc(e,t,n,t.pendingProps);case 24:return ea(t),r=ta(sa),e===null?(i=ya(),i===null&&(i=Gl,a=ca(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Va(t),Ji(t,sa,i)):((e.lanes&n)!==0&&(Ha(e,t),Ya(t,null,null,n),Ja()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ji(t,sa,r),r!==i.cache&&Zi(t,[sa],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ji(t,sa,r))),sc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Ic(e){e.flags|=4}function Lc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Pu())e.flags|=8192;else throw ka=Ta,Ca}else e.flags&=-16777217}function Rc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!np(t))if(Pu())e.flags|=8192;else throw ka=Ta,Ca}function zc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Xe(),e.lanes|=t,au|=t)}function Bc(e,t){if(!Pi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Vc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Hc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vc(t),null;case 1:return Vc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Yi(sa),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Ic(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),Vc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Ic(t),a===null?(Vc(t),Lc(t,i,null,r,n)):(Vc(t),Rc(t,a))):a?a===e.memoizedState?(Vc(t),t.flags&=-16777217):(Ic(t),Vc(t),Rc(t,a)):(e=e.memoizedProps,e!==r&&Ic(t),Vc(t),Lc(t,i,e,r,n)),null;case 27:if(he(t),n=ue.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Vc(t),null}e=ce.current,Vi(t)?zi(t,e):(e=Tf(i,r,n),t.stateNode=e,Ic(t))}return Vc(t),null;case 5:if(he(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Vc(t),null}if(a=ce.current,Vi(t))zi(t,a);else{var s=$d(ue.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[ct]=t,a[lt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(qd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ic(t)}}return Vc(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=ue.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Mi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Wd(e.nodeValue,n)),e||Ri(t,!0)}else e=$d(e).createTextNode(r),e[ct]=t,t.stateNode=e}return Vc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[ct]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(lo(t),t):(lo(t),null);if(t.flags&128)throw Error(o(558))}return Vc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[ct]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),i=!1}else i=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(lo(t),t):(lo(t),null)}return lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),zc(t,t.updateQueue),Vc(t),null);case 4:return pe(),e===null&&Pd(t.stateNode.containerInfo),Vc(t),null;case 10:return Yi(t.type),Vc(t),null;case 19:if(N(uo),r=t.memoizedState,r===null)return Vc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Bc(r,!1);else{if(eu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=fo(e),a!==null){for(t.flags|=128,Bc(r,!1),e=a.updateQueue,t.updateQueue=e,zc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ui(n,e),n=n.sibling;return P(uo,uo.current&1|2),Pi&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>du&&(t.flags|=128,i=!0,Bc(r,!1),t.lanes=4194304)}else{if(!i)if(e=fo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,zc(t,e),Bc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Pi)return Vc(t),null}else 2*De()-r.renderingStartTime>du&&n!==536870912&&(t.flags|=128,i=!0,Bc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Vc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=uo.current,P(uo,i?n&1|2:n&1),Pi&&Di(t,r.treeForkCount),e);case 22:case 23:return lo(t),no(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Vc(t),t.subtreeFlags&6&&(t.flags|=8192)):Vc(t),n=t.updateQueue,n!==null&&zc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&N(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),Vc(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Uc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return he(t),null;case 31:if(t.memoizedState!==null){if(lo(t),t.alternate===null)throw Error(o(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(uo),null;case 4:return pe(),null;case 10:return Yi(t.type),null;case 22:case 23:return lo(t),no(),e!==null&&N(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Wc(e,t){switch(Ai(t),t.tag){case 3:Yi(sa),pe();break;case 26:case 27:case 5:he(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&lo(t);break;case 13:lo(t);break;case 19:N(uo);break;case 10:Yi(t.type);break;case 22:case 23:lo(t),no(),e!==null&&N(va);break;case 24:Yi(sa)}}function Gc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){td(t,t.return,e)}}function Kc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){td(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){td(t,t.return,e)}}function qc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){td(e,e.return,t)}}}function Jc(e,t,n){n.props=Ys(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){td(e,t,n)}}function Yc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){td(e,t,n)}}function Xc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){td(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){td(e,t,n)}else n.current=null}function Zc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){td(e,e.return,t)}}function Qc(e,t,n){try{var r=e.stateNode;Jd(r,e.type,n,t),r[lt]=t}catch(t){td(e,e.return,t)}}function $c(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&df(e.type)||e.tag===4}function el(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||$c(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&df(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=en));else if(r!==4&&(r===27&&df(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&df(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(nl(e,t,n),e=e.sibling;e!==null;)nl(e,t,n),e=e.sibling}function rl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);qd(t,r,n),t[ct]=e,t[lt]=n}catch(t){td(e,e.return,t)}}var il=!1,al=!1,ol=!1,sl=typeof WeakSet==`function`?WeakSet:Set,cl=null;function ll(e,t){if(e=e.containerInfo,Zd=_p,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Qd={focusedElem:e,selectionRange:n},_p=!1,cl=t;cl!==null;)if(t=cl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,cl=e;else for(;cl!==null;){switch(t=cl,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Ys(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){td(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)mf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:mf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,cl=e;break}cl=t.return}}function ul(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Tl(e,n),r&4&&Gc(5,n);break;case 1:if(Tl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){td(n,n.return,e)}else{var i=Ys(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){td(n,n.return,e)}}r&64&&qc(n),r&512&&Yc(n,n.return);break;case 3:if(Tl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Za(e,t)}catch(e){td(n,n.return,e)}}break;case 27:t===null&&r&4&&rl(n);case 26:case 5:Tl(e,n),t===null&&r&4&&Zc(n),r&512&&Yc(n,n.return);break;case 12:Tl(e,n);break;case 31:Tl(e,n),r&4&&gl(e,n);break;case 13:Tl(e,n),r&4&&_l(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ad.bind(null,n),bf(e,n))));break;case 22:if(r=n.memoizedState!==null||il,!r){t=t!==null&&t.memoizedState!==null||al,i=il;var a=al;il=r,(al=t)&&!a?Dl(e,n,(n.subtreeFlags&8772)!=0):Tl(e,n),il=i,al=a}break;case 30:break;default:Tl(e,n)}}function dl(e){var t=e.alternate;t!==null&&(e.alternate=null,dl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ht(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var fl=null,pl=!1;function ml(e,t,n){for(n=n.child;n!==null;)hl(e,t,n),n=n.sibling}function hl(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount==`function`)try{Le.onCommitFiberUnmount(Ie,n)}catch{}switch(n.tag){case 26:al||Xc(n,t),ml(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:al||Xc(n,t);var r=fl,i=pl;df(n.type)&&(fl=n.stateNode,pl=!1),ml(e,t,n),Ef(n.stateNode),fl=r,pl=i;break;case 5:al||Xc(n,t);case 6:if(r=fl,i=pl,fl=null,ml(e,t,n),fl=r,pl=i,fl!==null)if(pl)try{(fl.nodeType===9?fl.body:fl.nodeName===`HTML`?fl.ownerDocument.body:fl).removeChild(n.stateNode)}catch(e){td(n,t,e)}else try{fl.removeChild(n.stateNode)}catch(e){td(n,t,e)}break;case 18:fl!==null&&(pl?(e=fl,ff(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Ip(e)):ff(fl,n.stateNode));break;case 4:r=fl,i=pl,fl=n.stateNode.containerInfo,pl=!0,ml(e,t,n),fl=r,pl=i;break;case 0:case 11:case 14:case 15:Kc(2,n,t),al||Kc(4,n,t),ml(e,t,n);break;case 1:al||(Xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Jc(n,t,r)),ml(e,t,n);break;case 21:ml(e,t,n);break;case 22:al=(r=al)||n.memoizedState!==null,ml(e,t,n),al=r;break;default:ml(e,t,n)}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ip(e)}catch(e){td(t,t.return,e)}}}function _l(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ip(e)}catch(e){td(t,t.return,e)}}function vl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new sl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new sl),t;default:throw Error(o(435,e.tag))}}function yl(e,t){var n=vl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=od.bind(null,e,t);t.then(r,r)}})}function bl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(df(c.type)){fl=c.stateNode,pl=!1;break a}break;case 5:fl=c.stateNode,pl=!1;break a;case 3:case 4:fl=c.stateNode.containerInfo,pl=!0;break a}c=c.return}if(fl===null)throw Error(o(160));hl(a,s,i),fl=null,pl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sl(t,e),t=t.sibling}var xl=null;function Sl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:bl(t,e),Cl(e),r&4&&(Kc(3,e,e.return),Gc(3,e),Kc(5,e,e.return));break;case 1:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&64&&il&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=xl;if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[mt]||a[ct]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),qd(a,r,n),a[ct]=e,bt(a),r=a;break a;case`link`:var s=$f(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),qd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=$f(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),qd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[ct]=e,bt(a),r=a}e.stateNode=r}else ep(i,e.type,e.stateNode);else e.stateNode=Jf(i,r,e.memoizedProps);else a===r?r===null&&e.stateNode!==null&&Qc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?ep(i,e.type,e.stateNode):Jf(i,r,e.memoizedProps))}break;case 27:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),n!==null&&r&4&&Qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),e.flags&32){i=e.stateNode;try{Kt(i,``)}catch(t){td(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Qc(e,i,n===null?i:n.memoizedProps)),r&1024&&(ol=!0);break;case 6:if(bl(t,e),Cl(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){td(e,e.return,t)}}break;case 3:if(Qf=null,i=xl,xl=kf(t.containerInfo),bl(t,e),xl=i,Cl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ip(t.containerInfo)}catch(t){td(e,e.return,t)}ol&&(ol=!1,wl(e));break;case 4:r=xl,xl=kf(e.stateNode.containerInfo),bl(t,e),Cl(e),xl=r;break;case 12:bl(t,e),Cl(e);break;case 31:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 13:bl(t,e),Cl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(lu=De()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=il,d=al;if(il=u||i,al=d||l,bl(t,e),al=d,il=u,Cl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||il||al||El(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){td(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){td(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?pf(m,!0):pf(l.stateNode,!1)}catch(e){td(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,yl(e,n))));break;case 19:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 30:break;case 21:break;default:bl(t,e),Cl(e)}}function Cl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if($c(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;nl(e,el(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Kt(a,``),n.flags&=-33),nl(e,el(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;tl(e,el(e),s);break;default:throw Error(o(161))}}catch(t){td(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ul(e,t.alternate,t),t=t.sibling}function El(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Kc(4,t,t.return),El(t);break;case 1:Xc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Jc(t,t.return,n),El(t);break;case 27:Ef(t.stateNode);case 26:case 5:Xc(t,t.return),El(t);break;case 22:t.memoizedState===null&&El(t);break;case 30:El(t);break;default:El(t)}e=e.sibling}}function Dl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Dl(i,a,n),Gc(4,a);break;case 1:if(Dl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){td(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Xa(c[i],s)}catch(e){td(r,r.return,e)}}n&&o&64&&qc(a),Yc(a,a.return);break;case 27:rl(a);case 26:case 5:Dl(i,a,n),n&&r===null&&o&4&&Zc(a),Yc(a,a.return);break;case 12:Dl(i,a,n);break;case 31:Dl(i,a,n),n&&o&4&&gl(i,a);break;case 13:Dl(i,a,n),n&&o&4&&_l(i,a);break;case 22:a.memoizedState===null&&Dl(i,a,n),Yc(a,a.return);break;case 30:break;default:Dl(i,a,n)}t=t.sibling}}function Ol(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&la(n))}function kl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e))}function Al(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jl(e,t,n,r),t=t.sibling}function jl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Al(e,t,n,r),i&2048&&Gc(9,t);break;case 1:Al(e,t,n,r);break;case 3:Al(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e)));break;case 12:if(i&2048){Al(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){td(t,t.return,e)}}else Al(e,t,n,r);break;case 31:Al(e,t,n,r);break;case 13:Al(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Al(e,t,n,r):(a._visibility|=2,Ml(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Al(e,t,n,r):Nl(e,t),i&2048&&Ol(o,t);break;case 24:Al(e,t,n,r),i&2048&&kl(t.alternate,t);break;default:Al(e,t,n,r)}}function Ml(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ml(a,o,s,c,i),Gc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ml(a,o,s,c,i)):u._visibility&2?Ml(a,o,s,c,i):Nl(a,o),i&&l&2048&&Ol(o.alternate,o);break;case 24:Ml(a,o,s,c,i),i&&l&2048&&kl(o.alternate,o);break;default:Ml(a,o,s,c,i)}t=t.sibling}}function Nl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Nl(n,r),i&2048&&Ol(r.alternate,r);break;case 24:Nl(n,r),i&2048&&kl(r.alternate,r);break;default:Nl(n,r)}t=t.sibling}}var Pl=8192;function Fl(e,t,n){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Il(e,t,n),e=e.sibling}function Il(e,t,n){switch(e.tag){case 26:Fl(e,t,n),e.flags&Pl&&e.memoizedState!==null&&rp(n,xl,e.memoizedState,e.memoizedProps);break;case 5:Fl(e,t,n);break;case 3:case 4:var r=xl;xl=kf(e.stateNode.containerInfo),Fl(e,t,n),xl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Pl,Pl=16777216,Fl(e,t,n),Pl=r):Fl(e,t,n));break;default:Fl(e,t,n)}}function Ll(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)zl(e),e=e.sibling}function zl(e){switch(e.tag){case 0:case 11:case 15:Rl(e),e.flags&2048&&Kc(9,e,e.return);break;case 3:Rl(e);break;case 12:Rl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bl(e)):Rl(e);break;default:Rl(e)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Kc(8,t,t.return),Bl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bl(t));break;default:Bl(t)}e=e.sibling}}function Vl(e,t){for(;cl!==null;){var n=cl;switch(n.tag){case 0:case 11:case 15:Kc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:la(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cl=r;else a:for(n=e;cl!==null;){r=cl;var i=r.sibling,a=r.return;if(dl(r),r===n){cl=null;break a}if(i!==null){i.return=a,cl=i;break a}cl=a}}}var Hl={getCacheForType:function(e){var t=ta(sa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(sa).controller.signal}},Ul=typeof WeakMap==`function`?WeakMap:Map,Wl=0,Gl=null,Kl=null,ql=0,Jl=0,Yl=null,Xl=!1,Zl=!1,Ql=!1,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=0,ou=null,su=null,cu=!1,lu=0,uu=0,du=1/0,fu=null,pu=null,mu=0,hu=null,gu=null,_u=0,vu=0,yu=null,bu=null,xu=0,Su=null;function Cu(){return Wl&2&&ql!==0?ql&-ql:A.T===null?at():Sd()}function wu(){if(iu===0)if(!(ql&536870912)||Pi){var e=We;We<<=1,!(We&3932160)&&(We=262144),iu=e}else iu=536870912;return e=ro.current,e!==null&&(e.flags|=32),iu}function Tu(e,t,n){(e===Gl&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)&&(Mu(e,0),ku(e,ql,iu,!1)),Qe(e,n),(!(Wl&2)||e!==Gl)&&(e===Gl&&(!(Wl&2)&&(nu|=n),eu===4&&ku(e,ql,iu,!1)),md(e))}function Eu(e,t,n){if(Wl&6)throw Error(o(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Je(e,t),i=r?Bu(e,t):Ru(e,t,!0),a=r;do{if(i===0){Zl&&!r&&ku(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!Ou(n)){i=Ru(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ou;var l=c.current.memoizedState.isDehydrated;if(l&&(Mu(c,s).flags|=256),s=Ru(c,s,!1),s!==2){if(Ql&&!l){c.errorRecoveryDisabledLanes|=a,nu|=a,i=4;break a}a=su,su=i,a!==null&&(su===null?su=a:su.push.apply(su,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){Mu(e,0),ku(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:ku(r,t,iu,!Xl);break a;case 2:su=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=lu+300-De(),10<i)){if(ku(r,t,iu,!Xl),qe(r,0,!0)!==0)break a;_u=t,r.timeoutHandle=of(Du.bind(null,r,n,su,fu,cu,t,iu,nu,au,Xl,a,`Throttled`,-0,0),i);break a}Du(r,n,su,fu,cu,t,iu,nu,au,Xl,a,null,-0,0)}}break}while(1);md(e)}function Du(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:en},Il(t,a,d);var m=(a&62914560)===a?lu-De():(a&4194048)===a?uu-De():0;if(m=ap(d,m),m!==null){_u=a,e.cancelPendingCommit=m(qu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),ku(e,a,o,!l);return}}qu(e,t,a,n,r,i,o,s,c)}function Ou(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ku(e,t,n,r){t&=~ru,t&=~nu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&et(e,n,t)}function Au(){return Wl&6?!0:(hd(0,!1),!1)}function ju(){if(Kl!==null){if(Jl===0)var e=Kl.return;else e=Kl,qi=Ki=null,Mo(e),Ma=null,Na=0,e=Kl;for(;e!==null;)Wc(e.alternate,e),e=e.return;Kl=null}}function Mu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,sf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),_u=0,ju(),Gl=e,Kl=n=li(e.current,null),ql=t,Jl=0,Yl=null,Xl=!1,Zl=Je(e,t),Ql=!1,au=iu=ru=nu=tu=eu=0,su=ou=null,cu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-ze(r),a=1<<i;t|=e[i],r&=~a}return $l=t,$r(),n}function Nu(e,t){mo=null,A.H=Vs,t===Sa||t===wa?(t=Aa(),Jl=3):t===Ca?(t=Aa(),Jl=4):Jl=t===ac?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Yl=t,Kl===null&&(eu=1,$s(e,_i(t,e.current)))}function Pu(){var e=ro.current;return e===null?!0:(ql&4194048)===ql?io===null:(ql&62914560)===ql||ql&536870912?e===io:!1}function Fu(){var e=A.H;return A.H=Vs,e===null?Vs:e}function Iu(){var e=A.A;return A.A=Hl,e}function Lu(){eu=4,Xl||(ql&4194048)!==ql&&ro.current!==null||(Zl=!0),!(tu&134217727)&&!(nu&134217727)||Gl===null||ku(Gl,ql,iu,!1)}function Ru(e,t,n){var r=Wl;Wl|=2;var i=Fu(),a=Iu();(Gl!==e||ql!==t)&&(fu=null,Mu(e,t)),t=!1;var o=eu;a:do try{if(Jl!==0&&Kl!==null){var s=Kl,c=Yl;switch(Jl){case 8:ju(),o=6;break a;case 3:case 2:case 9:case 6:ro.current===null&&(t=!0);var l=Jl;if(Jl=0,Yl=null,Wu(e,s,c,l),n&&Zl){o=0;break a}break;default:l=Jl,Jl=0,Yl=null,Wu(e,s,c,l)}}zu(),o=eu;break}catch(t){Nu(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,Wl=r,A.H=i,A.A=a,Kl===null&&(Gl=null,ql=0,$r()),o}function zu(){for(;Kl!==null;)Hu(Kl)}function Bu(e,t){var n=Wl;Wl|=2;var r=Fu(),i=Iu();Gl!==e||ql!==t?(fu=null,du=De()+500,Mu(e,t)):Zl=Je(e,t);a:do try{if(Jl!==0&&Kl!==null){t=Kl;var a=Yl;b:switch(Jl){case 1:Jl=0,Yl=null,Wu(e,t,a,1);break;case 2:case 9:if(Ea(a)){Jl=0,Yl=null,Uu(t);break}t=function(){Jl!==2&&Jl!==9||Gl!==e||(Jl=7),md(e)},a.then(t,t);break a;case 3:Jl=7;break a;case 4:Jl=5;break a;case 7:Ea(a)?(Jl=0,Yl=null,Uu(t)):(Jl=0,Yl=null,Wu(e,t,a,7));break;case 5:var s=null;switch(Kl.tag){case 26:s=Kl.memoizedState;case 5:case 27:var c=Kl;if(s?np(s):c.stateNode.complete){Jl=0,Yl=null;var l=c.sibling;if(l!==null)Kl=l;else{var u=c.return;u===null?Kl=null:(Kl=u,Gu(u))}break b}}Jl=0,Yl=null,Wu(e,t,a,5);break;case 6:Jl=0,Yl=null,Wu(e,t,a,6);break;case 8:ju(),eu=6;break a;default:throw Error(o(462))}}Vu();break}catch(t){Nu(e,t)}while(1);return qi=Ki=null,A.H=r,A.A=i,Wl=n,Kl===null?(Gl=null,ql=0,$r(),eu):0}function Vu(){for(;Kl!==null&&!Te();)Hu(Kl)}function Hu(e){var t=Fc(e.alternate,e,$l);e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Uu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=yc(n,t,t.pendingProps,t.type,void 0,ql);break;case 11:t=yc(n,t,t.pendingProps,t.type.render,t.ref,ql);break;case 5:Mo(t);default:Wc(n,t),t=Kl=ui(t,$l),t=Fc(n,t,$l)}e.memoizedProps=e.pendingProps,t===null?Gu(e):Kl=t}function Wu(e,t,n,r){qi=Ki=null,Mo(t),Ma=null,Na=0;var i=t.return;try{if(ic(e,i,t,n,ql)){eu=1,$s(e,_i(n,e.current)),Kl=null;return}}catch(t){if(i!==null)throw Kl=i,t;eu=1,$s(e,_i(n,e.current)),Kl=null;return}t.flags&32768?(Pi||r===1?e=!0:Zl||ql&536870912?e=!1:(Xl=e=!0,(r===2||r===9||r===3||r===6)&&(r=ro.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ku(t,e)):Gu(t)}function Gu(e){var t=e;do{if(t.flags&32768){Ku(t,Xl);return}e=t.return;var n=Hc(t.alternate,t,$l);if(n!==null){Kl=n;return}if(t=t.sibling,t!==null){Kl=t;return}Kl=t=e}while(t!==null);eu===0&&(eu=5)}function Ku(e,t){do{var n=Uc(e.alternate,e);if(n!==null){n.flags&=32767,Kl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Kl=e;return}Kl=e=n}while(e!==null);eu=6,Kl=null}function qu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do Qu();while(mu!==0);if(Wl&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=Qr,$e(e,n,a,s,c,l),e===Gl&&(Kl=Gl=null,ql=0),gu=t,hu=e,_u=n,vu=a,yu=i,bu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,sd(je,function(){return $u(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=A.T,A.T=null,i=j.p,j.p=2,s=Wl,Wl|=4;try{ll(e,t,n)}finally{Wl=s,j.p=i,A.T=r}}mu=1,Ju(),Yu(),Xu()}}function Ju(){if(mu===1){mu=0;var e=hu,t=gu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Wl;Wl|=4;try{Sl(t,e);var a=Qd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}_p=!!Zd,Qd=Zd=null}finally{Wl=i,j.p=r,A.T=n}}e.current=t,mu=2}}function Yu(){if(mu===2){mu=0;var e=hu,t=gu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=Wl;Wl|=4;try{ul(e,t.alternate,t)}finally{Wl=i,j.p=r,A.T=n}}mu=3}}function Xu(){if(mu===4||mu===3){mu=0,Ee();var e=hu,t=gu,n=_u,r=bu;t.subtreeFlags&10256||t.flags&10256?mu=5:(mu=0,gu=hu=null,Zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(pu=null),it(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot==`function`)try{Le.onCommitFiberRoot(Ie,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=A.T,i=j.p,j.p=2,A.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{A.T=t,j.p=i}}_u&3&&Qu(),md(e),i=e.pendingLanes,n&261930&&i&42?e===Su?xu++:(xu=0,Su=e):xu=0,hd(0,!1)}}function Zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,la(t)))}function Qu(){return Ju(),Yu(),Xu(),$u()}function $u(){if(mu!==5)return!1;var e=hu,t=vu;vu=0;var n=it(_u),r=A.T,i=j.p;try{j.p=32>n?32:n,A.T=null,n=yu,yu=null;var a=hu,s=_u;if(mu=0,gu=hu=null,_u=0,Wl&6)throw Error(o(331));var c=Wl;if(Wl|=4,zl(a.current),jl(a,a.current,s,n),Wl=c,hd(0,!1),Le&&typeof Le.onPostCommitFiberRoot==`function`)try{Le.onPostCommitFiberRoot(Ie,a)}catch{}return!0}finally{j.p=i,A.T=r,Zu(e,t)}}function ed(e,t,n){t=_i(n,t),t=tc(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(Qe(e,2),md(e))}function td(e,t,n){if(e.tag===3)ed(e,e,n);else for(;t!==null;){if(t.tag===3){ed(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(pu===null||!pu.has(r))){e=_i(n,e),n=nc(2),r=Wa(t,n,2),r!==null&&(rc(n,r,t,e),Qe(r,2),md(r));break}}t=t.return}}function nd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ul;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ql=!0,i.add(n),e=rd.bind(null,e,t,n),t.then(e,e))}function rd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(ql&n)===n&&(eu===4||eu===3&&(ql&62914560)===ql&&300>De()-lu?!(Wl&2)&&Mu(e,0):ru|=n,au===ql&&(au=0)),md(e)}function id(e,t){t===0&&(t=Xe()),e=ni(e,t),e!==null&&(Qe(e,t),md(e))}function ad(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),id(e,n)}function od(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),id(e,n)}function sd(e,t){return Ce(e,t)}var cd=null,ld=null,ud=!1,dd=!1,fd=!1,pd=0;function md(e){e!==ld&&e.next===null&&(ld===null?cd=ld=e:ld=ld.next=e),dd=!0,ud||(ud=!0,xd())}function hd(e,t){if(!fd&&dd){fd=!0;do for(var n=!1,r=cd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,bd(r,a))}else a=ql,a=qe(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Je(r,a)||(n=!0,bd(r,a));r=r.next}while(n);fd=!1}}function gd(){_d()}function _d(){dd=ud=!1;var e=0;pd!==0&&af()&&(e=pd);for(var t=De(),n=null,r=cd;r!==null;){var i=r.next,a=vd(r,t);a===0?(r.next=null,n===null?cd=i:n.next=i,i===null&&(ld=n)):(n=r,(e!==0||a&3)&&(dd=!0)),r=i}mu!==0&&mu!==5||hd(e,!1),pd!==0&&(pd=0)}function vd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ye(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Gl,n=ql,n=qe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Je(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),it(n)){case 2:case 8:n=Ae;break;case 32:n=je;break;case 268435456:n=Ne;break;default:n=je}return r=yd.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(r),e.callbackPriority=2,e.callbackNode=null,2}function yd(e,t){if(mu!==0&&mu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Qu()&&e.callbackNode!==n)return null;var r=ql;return r=qe(e,e===Gl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Eu(e,r,t),vd(e,De()),e.callbackNode!=null&&e.callbackNode===n?yd.bind(null,e):null)}function bd(e,t){if(Qu())return null;Eu(e,t,!0)}function xd(){lf(function(){Wl&6?Ce(ke,gd):_d()})}function Sd(){if(pd===0){var e=fa;e===0&&(e=Ue,Ue<<=1,!(Ue&261888)&&(Ue=256)),pd=e}return pd}function Cd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:$t(``+e)}function wd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Td(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Cd((i[lt]||null).action),o=r.submitter;o&&(t=(t=o[lt]||null)?Cd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Sn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(pd!==0){var e=o?wd(i,o):new FormData(i);Ds(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?wd(i,o):new FormData(i),Ds(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ed=0;Ed<qr.length;Ed++){var Dd=qr[Ed];Jr(Dd.toLowerCase(),`on`+(Dd[0].toUpperCase()+Dd.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),wt(`onMouseEnter`,[`mouseout`,`mouseover`]),wt(`onMouseLeave`,[`mouseout`,`mouseover`]),wt(`onPointerEnter`,[`pointerout`,`pointerover`]),wt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ct(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ct(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ct(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ct(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ct(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ct(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Od=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),kd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Od));function Ad(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function jd(e,t){var n=t[dt];n===void 0&&(n=t[dt]=new Set);var r=e+`__bubble`;n.has(r)||(Fd(t,e,2,!1),n.add(r))}function Md(e,t,n){var r=0;t&&(r|=4),Fd(n,e,r,t)}var Nd=`_reactListening`+Math.random().toString(36).slice(2);function Pd(e){if(!e[Nd]){e[Nd]=!0,xt.forEach(function(t){t!==`selectionchange`&&(kd.has(t)||Md(t,!1,e),Md(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Nd]||(t[Nd]=!0,Md(`selectionchange`,!1,t))}}function Fd(e,t,n,r){switch(Cp(t)){case 2:var i=vp;break;case 8:i=yp;break;default:i=bp}n=i.bind(null,t,n,e),i=void 0,!dn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Id(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=gt(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}cn(function(){var r=a,i=nn(n),o=[];a:{var s=Kr.get(e);if(s!==void 0){var l=Sn,u=e;switch(e){case`keypress`:if(_n(n)===0)break a;case`keydown`:case`keyup`:l=Rn;break;case`focusin`:u=`focus`,l=L;break;case`focusout`:u=`blur`,l=L;break;case`beforeblur`:case`afterblur`:l=L;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=An;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Bn;break;case zr:case Br:case Vr:l=jn;break;case Gr:l=Vn;break;case`scroll`:case`scrollend`:l=wn;break;case`wheel`:l=Hn;break;case`copy`:case`cut`:case`paste`:l=Nn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=zn;break;case`toggle`:case`beforetoggle`:l=Un}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=ln(m,p),g!=null&&d.push(Ld(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,s&&n!==tn&&(u=n.relatedTarget||n.fromElement)&&(gt(u)||u[ut]))break a;if((l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?gt(u):null,u!==null&&(f=c(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:vt(l),h=u==null?s:vt(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,gt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=zd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Bd(o,s,l,d,!1),u!==null&&f!==null&&Bd(o,f,u,d,!0)}}a:{if(s=r?vt(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var v=lr;else if(rr(s))if(ur)v=yr;else{v=_r;var y=gr}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Xt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Ht(s,`number`,s.value)}switch(y=r?vt(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(o,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(o,n,i)}var b;if(Gn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=gn()):(pn=i,mn=`value`in pn?pn.value:pn.textContent,$n=!0)),y=Rd(r,x),0<y.length&&(x=new Pn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=Rd(r,`onBeforeInput`),0<x.length&&(y=new Pn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),Td(o,e,r,n,i)}Ad(o,t)})}function Ld(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Rd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=ln(e,n),i!=null&&r.unshift(Ld(e,i,a)),i=ln(e,t),i!=null&&r.push(Ld(e,i,a))),e.tag===3)return r;e=e.return}return[]}function zd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Bd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=ln(n,a),l!=null&&o.unshift(Ld(n,l,c))):i||(l=ln(n,a),l!=null&&o.push(Ld(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Vd=/\r\n?/g,Hd=/\u0000|\uFFFD/g;function Ud(e){return(typeof e==`string`?e:``+e).replace(Vd,`
10
- `).replace(Hd,``)}function Wd(e,t){return t=Ud(t),Ud(e)===t}function Gd(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Kt(e,``+r);break;case`className`:At(e,`class`,r);break;case`tabIndex`:At(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:At(e,n,r);break;case`style`:Yt(e,r,a);break;case`data`:if(t!==`object`){At(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Gd(e,t,`name`,i.name,i,null),Gd(e,t,`formEncType`,i.formEncType,i,null),Gd(e,t,`formMethod`,i.formMethod,i,null),Gd(e,t,`formTarget`,i.formTarget,i,null)):(Gd(e,t,`encType`,i.encType,i,null),Gd(e,t,`method`,i.method,i,null),Gd(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=en);break;case`onScroll`:r!=null&&jd(`scroll`,e);break;case`onScrollEnd`:r!=null&&jd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=$t(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:jd(`beforetoggle`,e),jd(`toggle`,e),kt(e,`popover`,r);break;case`xlinkActuate`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:kt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Zt.get(n)||n,kt(e,n,r))}}function Kd(e,t,n,r,i,a){switch(n){case`style`:Yt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Kt(e,``+r);break;case`onScroll`:r!=null&&jd(`scroll`,e);break;case`onScrollEnd`:r!=null&&jd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=en);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!St.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[lt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):kt(e,n,r)}}}function qd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:jd(`error`,e),jd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Gd(e,t,a,s,n,null)}}i&&Gd(e,t,`srcSet`,n.srcSet,n,null),r&&Gd(e,t,`src`,n.src,n,null);return;case`input`:jd(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Gd(e,t,r,d,n,null)}}Vt(e,a,c,l,u,s,i,!1);return;case`select`:for(i in jd(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Gd(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&Ut(e,!!r,n,!0):Ut(e,!!r,t,!1);return;case`textarea`:for(s in jd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Gd(e,t,s,c,n,null)}Gt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Gd(e,t,l,r,n,null)}return;case`dialog`:jd(`beforetoggle`,e),jd(`toggle`,e),jd(`cancel`,e),jd(`close`,e);break;case`iframe`:case`object`:jd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Od.length;r++)jd(Od[r],e);break;case`image`:jd(`error`,e),jd(`load`,e);break;case`details`:jd(`toggle`,e);break;case`embed`:case`source`:case`link`:jd(`error`,e),jd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Gd(e,t,u,r,n,null)}return;default:if(Xt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Kd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Gd(e,t,c,r,n,null))}function Jd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Gd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Gd(e,t,p,m,r,f)}}Bt(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Gd(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Gd(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ut(e,!!n,n?[]:``,!1):Ut(e,!!n,t,!0)):Ut(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Gd(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Gd(e,t,s,i,r,a)}Wt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Gd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Gd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Gd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Gd(e,t,u,p,r,m)}return;default:if(Xt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Kd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Kd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Gd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Gd(e,t,f,p,r,m)}function Yd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Xd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Yd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Yd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Zd=null,Qd=null;function $d(e){return e.nodeType===9?e:e.ownerDocument}function ef(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function tf(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function nf(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var rf=null;function af(){var e=window.event;return e&&e.type===`popstate`?e===rf?!1:(rf=e,!0):(rf=null,!1)}var of=typeof setTimeout==`function`?setTimeout:void 0,sf=typeof clearTimeout==`function`?clearTimeout:void 0,cf=typeof Promise==`function`?Promise:void 0,lf=typeof queueMicrotask==`function`?queueMicrotask:cf===void 0?of:function(e){return cf.resolve(null).then(e).catch(uf)};function uf(e){setTimeout(function(){throw e})}function df(e){return e===`head`}function ff(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Ef(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Ef(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[mt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Ef(e.ownerDocument.body);n=i}while(n);Ip(t)}function pf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function mf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:mf(n),ht(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function hf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[mt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=xf(e.nextSibling),e===null)break}return null}function gf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=xf(e.nextSibling),e===null))return null;return e}function _f(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=xf(e.nextSibling),e===null))return null;return e}function vf(e){return e.data===`$?`||e.data===`$~`}function yf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function bf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function xf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Sf=null;function Cf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return xf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function wf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Tf(e,t,n){switch(t=$d(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function Ef(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ht(e)}var Df=new Map,Of=new Set;function kf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Af=j.d;j.d={f:jf,r:Mf,D:Ff,C:If,L:Lf,m:Rf,X:Bf,S:zf,M:Vf};function jf(){var e=Af.f(),t=Au();return e||t}function Mf(e){var t=_t(e);t!==null&&t.tag===5&&t.type===`form`?ks(t):Af.r(e)}var Nf=typeof document>`u`?null:document;function Pf(e,t,n){var r=Nf;if(r&&typeof t==`string`&&t){var i=zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Of.has(i)||(Of.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),qd(t,`link`,e),bt(t),r.head.appendChild(t)))}}function Ff(e){Af.D(e),Pf(`dns-prefetch`,e,null)}function If(e,t){Af.C(e,t),Pf(`preconnect`,e,t)}function Lf(e,t,n){Af.L(e,t,n);var r=Nf;if(r&&e&&t){var i=`link[rel="preload"][as="`+zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+zt(n.imageSizes)+`"]`)):i+=`[href="`+zt(e)+`"]`;var a=i;switch(t){case`style`:a=Hf(e);break;case`script`:a=Kf(e)}Df.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Df.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Uf(a))||t===`script`&&r.querySelector(qf(a))||(t=r.createElement(`link`),qd(t,`link`,e),bt(t),r.head.appendChild(t)))}}function Rf(e,t){Af.m(e,t);var n=Nf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+zt(r)+`"][href="`+zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Kf(e)}if(!Df.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Df.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qf(a)))return}r=n.createElement(`link`),qd(r,`link`,e),bt(r),n.head.appendChild(r)}}}function zf(e,t,n){Af.S(e,t,n);var r=Nf;if(r&&e){var i=yt(r).hoistableStyles,a=Hf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Uf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Df.get(a))&&Xf(e,n);var c=o=r.createElement(`link`);bt(c),qd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Yf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Bf(e,t){Af.X(e,t);var n=Nf;if(n&&e){var r=yt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0},t),(t=Df.get(i))&&Zf(e,t),a=n.createElement(`script`),bt(a),qd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t){Af.M(e,t);var n=Nf;if(n&&e){var r=yt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Df.get(i))&&Zf(e,t),a=n.createElement(`script`),bt(a),qd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function V(e,t,n,r){var i=(i=ue.current)?kf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Hf(n.href),n=yt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Hf(n.href);var a=yt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Uf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),Df.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Df.set(e,n),a||Gf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Kf(n),n=yt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Hf(e){return`href="`+zt(e)+`"`}function Uf(e){return`link[rel="stylesheet"][`+e+`]`}function Wf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Gf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),qd(t,`link`,n),bt(t),e.head.appendChild(t))}function Kf(e){return`[src="`+zt(e)+`"]`}function qf(e){return`script[async]`+e}function Jf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+zt(n.href)+`"]`);if(r)return t.instance=r,bt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),bt(r),qd(r,`style`,i),Yf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Hf(n.href);var a=e.querySelector(Uf(i));if(a)return t.state.loading|=4,t.instance=a,bt(a),a;r=Wf(n),(i=Df.get(i))&&Xf(r,i),a=(e.ownerDocument||e).createElement(`link`),bt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),qd(a,`link`,r),t.state.loading|=4,Yf(a,n.precedence,e),t.instance=a;case`script`:return a=Kf(n.src),(i=e.querySelector(qf(a)))?(t.instance=i,bt(i),i):(r=n,(i=Df.get(a))&&(r=m({},n),Zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),bt(i),qd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Yf(r,n.precedence,e));return t.instance}function Yf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Xf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qf=null;function $f(e,t,n){if(Qf===null){var r=new Map,i=Qf=new Map;i.set(n,r)}else i=Qf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[mt]||a[ct]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function tp(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function np(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Hf(r.href),a=t.querySelector(Uf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=op.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,bt(a);return}a=t.ownerDocument||t,r=Wf(r),(i=Df.get(i))&&Xf(r,i),a=a.createElement(`link`),bt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),qd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=op.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ip=0;function ap(e,t){return e.stylesheets&&e.count===0&&cp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ip===0&&(ip=62500*Xd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ip?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function op(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sp=null;function cp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sp=new Map,t.forEach(lp,e),sp=null,op.call(e))}function lp(e,t){if(!(t.state.loading&4)){var n=sp.get(e);if(n)var r=n.get(null);else{n=new Map,sp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=op.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var up={$$typeof:S,Provider:null,Consumer:null,_currentValue:M,_currentValue2:M,_threadCount:0};function H(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ze(0),this.hiddenUpdates=Ze(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function dp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new H(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=si(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function fp(e){return e?(e=ai,e):ai}function pp(e,t,n,r,i,a){i=fp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(Tu(n,e,t),Ga(n,e,t))}function U(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mp(e,t){U(e,t),(e=e.alternate)&&U(e,t)}function hp(e){if(e.tag===13||e.tag===31){var t=ni(e,67108864);t!==null&&Tu(t,e,67108864),mp(e,67108864)}}function gp(e){if(e.tag===13||e.tag===31){var t=Cu();t=rt(t);var n=ni(e,t);n!==null&&Tu(n,e,t),mp(e,t)}}var _p=!0;function vp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,bp(e,t,n,r)}finally{j.p=a,A.T=i}}function yp(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,bp(e,t,n,r)}finally{j.p=a,A.T=i}}function bp(e,t,n,r){if(_p){var i=W(r);if(i===null)Id(e,t,r,xp,n),Op(e,r);else if(Ap(i,e,t,n,r))r.stopPropagation();else if(Op(e,r),t&4&&-1<Dp.indexOf(e)){for(;i!==null;){var a=_t(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ke(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-ze(o);s.entanglements[1]|=c,o&=~c}md(a),!(Wl&6)&&(du=De()+500,hd(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&Tu(s,a,2),Au(),mp(a,2)}if(a=W(r),a===null&&Id(e,t,r,xp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Id(e,t,r,null,n)}}function W(e){return e=nn(e),Sp(e)}var xp=null;function Sp(e){if(xp=null,e=gt(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xp=e,null}function Cp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Oe()){case ke:return 2;case Ae:return 8;case je:case Me:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var G=!1,wp=null,K=null,q=null,Tp=new Map,J=new Map,Ep=[],Dp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Op(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:K=null;break;case`mouseover`:case`mouseout`:q=null;break;case`pointerover`:case`pointerout`:Tp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:J.delete(t.pointerId)}}function kp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=_t(t),t!==null&&hp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ap(e,t,n,r,i){switch(t){case`focusin`:return wp=kp(wp,e,t,n,r,i),!0;case`dragenter`:return K=kp(K,e,t,n,r,i),!0;case`mouseover`:return q=kp(q,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Tp.set(a,kp(Tp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,J.set(a,kp(J.get(a)||null,e,t,n,r,i)),!0}return!1}function Y(e){var t=gt(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,ot(e.priority,function(){gp(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,ot(e.priority,function(){gp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=W(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tn=r,n.target.dispatchEvent(r),tn=null}else return t=_t(n),t!==null&&hp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){G=!1,wp!==null&&jp(wp)&&(wp=null),K!==null&&jp(K)&&(K=null),q!==null&&jp(q)&&(q=null),Tp.forEach(Mp),J.forEach(Mp)}function X(e,n){e.blockedOn===n&&(e.blockedOn=null,G||(G=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Pp=null;function Fp(e){Pp!==e&&(Pp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Pp===e&&(Pp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sp(r||n)===null)continue;break}var a=_t(n);a!==null&&(e.splice(t,3),t-=3,Ds(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Ip(e){function t(t){return X(t,e)}wp!==null&&X(wp,e),K!==null&&X(K,e),q!==null&&X(q,e),Tp.forEach(t),J.forEach(t);for(var n=0;n<Ep.length;n++){var r=Ep[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ep.length&&(n=Ep[0],n.blockedOn===null);)Y(n),n.blockedOn===null&&Ep.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[lt]||null;if(typeof a==`function`)o||Fp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[lt]||null)s=o.formAction;else if(Sp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Fp(n)}}}function Z(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;pp(n,Cu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;pp(e.current,2,null,e,null,null),Au(),t[ut]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=at();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ep.length&&t!==0&&t<Ep[n].priority;n++);Ep.splice(n,0,e),n===0&&Y(e)}};var zp=n.version;if(zp!==`19.2.4`)throw Error(o(527,zp,`19.2.4`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{Ie=Vp.inject(Bp),Le=Vp}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=Xs,a=Zs,c=Qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dp(e,1,!1,null,null,n,r,null,i,a,c,Z),e[ut]=t.current,Pd(e),new Lp(t)}})),Pn=r(n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Nn()}))(),1),R=o();function Fn({title:e,description:t,extra:n,actions:r}){return(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`strong`,{children:e}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:t}),n]}),(0,R.jsx)(`div`,{className:`flex gap-2 flex-wrap`,children:r.map(e=>(0,R.jsx)(`button`,{"data-testid":e.testId,className:`px-3 py-1.5 text-xs font-medium rounded-md hover:bg-accent hover:text-accent-foreground`,onClick:t=>{t.stopPropagation(),e.onClick()},children:e.label},e.testId))})]})}var In={model:`stub-model`,stopReason:`endTurn`,role:`assistant`,content:{type:`text`,text:`positive`}},z=r(i(),1),Ln=z.createContext(void 0);function Rn(e){let t=z.useContext(Ln);if(t===void 0&&!e)throw Error(Ve(33));return t}var zn=z.createContext(void 0);function Bn(e){let t=z.useContext(zn);if(t===void 0&&!e)throw Error(Ve(36));return t}var Vn=z.createContext(void 0);function Hn(e=!0){let t=z.useContext(Vn);if(t===void 0&&!e)throw Error(Ve(25));return t}function Un(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=Hn(!0),f=d!==void 0;return z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:re})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!_e&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var Wn={type:`regular-item`};function Gn(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=a.useState(`disabled`),d=n||u,f=z.useRef(null),{getButtonProps:p,buttonRef:m}=Pe({disabled:d,focusableWhenDisabled:!0,native:s,composite:!0}),h=Un({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:f,itemMetadata:c}),g=z.useCallback(e=>Ut(h,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,p),[h,p,c]),_=Ze(f,m);return z.useMemo(()=>({getItemProps:g,itemRef:_}),[g,_])}var Kn=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),qn={checked(e){return e?{[Kn.checked]:``}:{[Kn.unchecked]:``}},...bt},Jn=z.createContext(void 0),Yn=z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Zt({label:a}),f=Rn(!0),p=N(i),{store:m}=Bn(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=Gn({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Wn});return We(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),Xn={...Ot,...bt},Zn=z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Bn(),{side:c,align:l}=Rn(),u=Cn(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`activeTriggerElement`),T=s.useState(`hoverEnabled`),ee=s.useState(`disabled`),E=s.useState(`openMethod`),D=_.type===`context-menu`;x({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),z.useEffect(()=>{function e(e){s.setOpen(!1,ae(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]),Ke(b,{enabled:T&&!ee&&!D&&_.type!==`menubar`,closeDelay:C});let te=z.useCallback(e=>{s.set(`popupElement`,e)},[s]),ne=We(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,te],stateAttributesMapping:Xn,props:[p,{onKeyDown(e){u&&Qt.has(e.key)&&e.stopPropagation()}},je(f),o,{"data-rootownerid":y}]}),O=_.type===void 0||D;return(g||_.type===`menubar`&&v!==`outside-press`)&&(O=!0),(0,R.jsx)(rn,{context:b,openInteractionType:E,modal:D,disabled:!m,returnFocus:a===void 0?O:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:ne})}),Qn=z.createContext(void 0);function $n(){let e=z.useContext(Qn);if(e===void 0)throw Error(Ve(32));return e}var er=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Bn();return i.useState(`mounted`)||n?(0,R.jsx)(Qn.Provider,{value:n,children:(0,R.jsx)(me,{ref:t,...r})}):null}),tr=z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=j,style:g,...v}=e,{store:y}=Bn(),b=$n(),x=Hn(!0),S=y.useState(`parent`),C=y.useState(`floatingRootContext`),w=y.useState(`floatingTreeRoot`),T=y.useState(`mounted`),ee=y.useState(`open`),E=y.useState(`modal`),D=y.useState(`openMethod`),te=y.useState(`activeTriggerElement`),O=y.useState(`transitionStatus`),re=y.useState(`positionerElement`),k=y.useState(`instantType`),ie=y.useState(`hasViewport`),A=y.useState(`lastOpenChangeReason`),M=y.useState(`floatingNodeId`),oe=y.useState(`floatingParentNodeId`),se=C.useState(`domReferenceElement`),N=z.useRef(null),P=_(re,!1,!1),ce=n,le=c,de=l,fe=s,pe=h;S.type===`context-menu`&&(ce=n??S.context?.anchor,fe??=`start`,!o&&fe!==`center`&&(de=e.alignOffset??2,le=e.sideOffset??-5));let me=o,he=fe;S.type===`menu`?(me??=`inline-end`,he??=`start`,pe=e.collisionAvoidance??ve):S.type===`menubar`&&(me??=S.context.orientation===`vertical`?`inline-end`:`bottom`,he??=`start`);let ge=S.type===`context-menu`,_e=ne({anchor:ce,floatingRootContext:C,positionMethod:x?`fixed`:r,mounted:T,side:me,sideOffset:le,align:he,alignOffset:de,arrowPadding:ge?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:M,keepMounted:b,disableAnchorTracking:m,collisionAvoidance:pe,shiftCrossAxis:ge&&!(`side`in pe&&pe.side===`flip`),externalTree:w,adaptiveOrigin:ie?ke:void 0});z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===M&&y.set(`hoverEnabled`,!1),e.nodeId!==M&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,ae(Me)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[y,w.events,M]),z.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,ae(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,y]);let ye=Se();z.useEffect(()=>{ee||ye.clear()},[ee,ye]),z.useEffect(()=>{function e(e){if(!(!ee||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&te&&te!==e.target){let e=y.select(`closeDelay`);e>0?ye.isStarted()||ye.start(e,()=>{y.setOpen(!1,ae(Me))}):y.setOpen(!1,ae(Me))}else ye.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,ee,te,y,ye]),z.useEffect(()=>{let e={open:ee,nodeId:M,parentNodeId:oe,reason:y.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,ee,y,M,oe]),be(()=>{let e=se,t=N.current;if(e&&(N.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return P(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[se,P,y]);let F={open:ee,side:_e.side,align:_e.align,anchorHidden:_e.anchorHidden,nested:S.type===`menu`,instant:k},xe=S.type===`menubar`&&S.context.modal;an(ee&&(xe||E&&A!==`trigger-hover`),D===`touch`,re,te);let Ce=wt(e,F,{styles:_e.positionerStyles,transitionStatus:O,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!T,inert:!ee}),we=T&&S.type!==`menu`&&(S.type!==`menubar`&&E&&A!==`trigger-hover`||S.type===`menubar`&&S.context.modal),Te=null;return S.type===`menubar`?Te=S.context.contentElement:S.type===void 0&&(Te=te),(0,R.jsxs)(Ln.Provider,{value:_e,children:[we&&(0,R.jsx)(wn,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:sn(!ee),cutout:Te}),(0,R.jsx)(ue,{id:M,children:(0,R.jsx)($t,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:Ce})})]})}),nr=z.createContext(void 0);function rr(){let e=z.useContext(nr);if(e===void 0)throw Error(Ve(34));return e}var ir=z.memo(z.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=z.useState(void 0),[p,h]=Yt({controlled:i,default:a,name:`MenuRadioGroup`}),g=m((e,t)=>{o?.(e,t),!t.isCanceled&&h(e)}),_=We(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),v=z.useMemo(()=>({value:p,setValue:g,disabled:s}),[p,g,s]);return(0,R.jsx)(Jn.Provider,{value:f,children:(0,R.jsx)(nr.Provider,{value:v,children:_})})})),ar=z.createContext(void 0);function or(){let e=z.useContext(ar);if(e===void 0)throw Error(Ve(35));return e}var sr=z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=Zt({label:a}),p=Rn(!0),m=N(i),{store:h}=Bn(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=rr(),x=b||s,S=v===l,{getItemProps:C,itemRef:w}=Gn({closeOnClick:c,disabled:x,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:Wn}),T=z.useMemo(()=>({disabled:x,highlighted:g,checked:S}),[x,g,S]);function ee(e){y(l,ae(re,e.nativeEvent,void 0,{preventUnmountOnClose(){}}))}let E=We(`div`,e,{state:T,stateAttributesMapping:qn,props:[_,{role:`menuitemradio`,"aria-checked":S,onClick:ee},d,C],ref:[w,t,f.ref]});return(0,R.jsx)(ar.Provider,{value:T,children:E})}),cr=z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=or(),c=z.useRef(null),{transitionStatus:l,setMounted:u}=lt(s.checked);return x({open:s.checked,ref:c,onComplete(){s.checked||u(!1)}}),We(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:qn,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||s.checked})}),lr=z.createContext(null);function ur(e){let t=z.useContext(lr);if(t===null&&!e)throw Error(Ve(5));return t}var dr={...ze,disabled:Vt(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:Vt(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:Vt(e=>e.openMethod),allowMouseEnter:Vt(e=>e.allowMouseEnter),highlightItemOnHover:Vt(e=>e.highlightItemOnHover),stickIfOpen:Vt(e=>e.stickIfOpen),parent:Vt(e=>e.parent),rootId:Vt(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:Vt(e=>e.activeIndex),isActive:Vt((e,t)=>e.activeIndex===t),hoverEnabled:Vt(e=>e.hoverEnabled),instantType:Vt(e=>e.instantType),lastOpenChangeReason:Vt(e=>e.openChangeReason),floatingTreeRoot:Vt(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:Vt(e=>e.floatingNodeId),floatingParentNodeId:Vt(e=>e.floatingParentNodeId),itemProps:Vt(e=>e.itemProps),closeDelay:Vt(e=>e.closeDelay),hasViewport:Vt(e=>e.hasViewport),keyboardEventRelay:Vt(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},fr=class e extends Kt{constructor(e){super({...pr(),...e},{positionerRef:z.createRef(),popupRef:z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:z.createRef(),beforeContentFocusGuardRef:z.createRef(),onOpenChangeComplete:void 0,triggerElements:new xt},dr),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=Bt(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function pr(){return{...kt(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ce,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:St,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var mr=z.createContext(void 0);function hr(){return z.useContext(mr)}var gr=F(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:f=!1,handle:p,triggerId:h,defaultTriggerId:g=null,highlightItemOnHover:_=!0}=e,v=Hn(!0),b=Bn(!0),x=ur(!0),S=hr(),C=z.useMemo(()=>S&&b?{type:`menu`,store:b.store}:x?{type:`menubar`,context:x}:v&&!b?{type:`context-menu`,context:v}:{type:void 0},[v,b,x,S]),w=fr.useStore(p?.store,{open:a,openProp:n,activeTriggerId:g,triggerIdProp:h,parent:C});Ye(w,n,a,g),w.useControlledProp(`openProp`,n),w.useControlledProp(`triggerIdProp`,h),w.useContextCallback(`onOpenChangeComplete`,i);let T=fe(),ee=fe(),E=w.useState(`floatingTreeRoot`),D=d(E),te=st(),ne=w.useState(`open`),O=w.useState(`activeTriggerElement`),re=w.useState(`positionerElement`),k=w.useState(`hoverEnabled`),ie=w.useState(`disabled`),A=w.useState(`lastOpenChangeReason`),j=w.useState(`parent`),M=w.useState(`activeIndex`),oe=w.useState(`payload`),se=w.useState(`floatingParentNodeId`),N=z.useRef(null),P=z.useRef(j.type!==`context-menu`),ce=Se(),le=z.useRef(!0),ue=Se(),de=se!=null,{openMethod:pe,triggerProps:me}=fn(ne);w.useSyncedValues({disabled:o,highlightItemOnHover:_,modal:j.type===void 0?s:void 0,openMethod:pe,rootId:T}),Ge(w);let{forceUnmount:he}=Ct(ne,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0})});be(()=>{v&&!b?w.update({parent:{type:`context-menu`,context:v},floatingNodeId:D,floatingParentNodeId:te}):b&&w.update({floatingNodeId:D,floatingParentNodeId:te})},[v,b,D,te,w]),z.useEffect(()=>{if(ne||(N.current=null),j.type===`context-menu`){if(!ne){ce.clear(),P.current=!1;return}ce.start(500,()=>{P.current=!0})}},[ce,ne,j.type]),be(()=>{!ne&&!k&&w.set(`hoverEnabled`,!0)},[ne,k,w]);let ge=m((e,t)=>{let n=t.reason;if(ne===e&&t.trigger===O&&A===n)return;let i=Ue(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;w.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!le.current)return;e&&n===`trigger-focus`?(le.current=!1,ue.start(300,()=>{le.current=!0})):(le.current=!0,ue.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};N.current=t.event??null,Ft(c,e,t.trigger,i()),w.update(c),j.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?w.set(`instantType`,`group`):o||s?w.set(`instantType`,o?`click`:`dismiss`):w.set(`instantType`,void 0)}),_e=Lt({popupStore:w,floatingId:ee,nested:te!=null,onOpenChange:ge}),ve=_e.context.events;z.useEffect(()=>{let e=({open:e,eventDetails:t})=>ge(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,ge]);let ye=z.useCallback(()=>{w.setOpen(!1,ae(De))},[w]);z.useImperativeHandle(u,()=>({unmount:he,close:ye}),[he,ye]);let F;j.type===`context-menu`&&(F=j.context),z.useImperativeHandle(F?.positionerRef,()=>re,[re]),z.useImperativeHandle(F?.actionsRef,()=>({setOpen:ge}),[ge]);let xe=y(_e,{enabled:!ie,bubbles:{escapeKey:f&&j.type===`menu`},outsidePress(){return j.type!==`context-menu`||N.current?.type===`contextmenu`?!0:P.current},externalTree:de?E:void 0}),Ce=Oe(),we=z.useCallback(e=>{w.select(`activeIndex`)!==e&&w.set(`activeIndex`,e)},[w]),Te=tn(_e,{enabled:!ie,listRef:w.context.itemDomElements,activeIndex:M,nested:j.type!==void 0,loopFocus:c,orientation:l,parentOrientation:j.type===`menubar`?j.context.orientation:void 0,rtl:Ce===`rtl`,disabledIndices:Je,onNavigate:we,openOnArrowKeyDown:j.type!==`context-menu`,externalTree:de?E:void 0,focusItemOnHover:_}),Ee=z.useCallback(e=>{w.context.typingRef.current=e},[w]),ke=nn(_e,{enabled:!ie,listRef:w.context.itemLabels,elementsRef:w.context.itemDomElements,activeIndex:M,resetMs:500,onMatch:e=>{ne&&e!==M&&w.set(`activeIndex`,e)},onTyping:Ee});ht(w,{floatingRootContext:_e,activeTriggerProps:z.useMemo(()=>{let e=Ut(ke.reference,Te.reference,xe.reference,{onMouseMove(){w.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=ne,e},[w,ke.reference,Te.reference,xe.reference,me,ne]),inactiveTriggerProps:z.useMemo(()=>{let e=Ut(Te.trigger,xe.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Te.trigger,xe.trigger,me]),popupProps:z.useMemo(()=>Ut(Mt,{id:ee,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){w.set(`allowMouseEnter`,!0),j.type===`menu`&&w.set(`hoverEnabled`,!1)},onClick(){w.select(`hoverEnabled`)&&w.set(`hoverEnabled`,!1)},onKeyDown(e){let t=w.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},ke.floating,Te.floating,xe.floating),[O,ee,j.type,w,ke.floating,Te.floating,xe.floating]),itemProps:Te.item??St});let Ae=z.useMemo(()=>({store:w,parent:C}),[w,C]),je=(0,R.jsx)(zn.Provider,{value:Ae,children:typeof t==`function`?t({payload:oe}):t});return j.type===void 0||j.type===`context-menu`?(0,R.jsx)(dt,{externalTree:E,children:je}):je});function _r(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Gt(),{ref:i,index:a}=Zt(e),o=n===a,s=z.useRef(null),c=Ze(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function vr(e){let{render:t,className:n,style:r,state:i=St,props:a=Je,refs:o=Je,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=_r({metadata:s});return We(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function yr(e){if(ut(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!u(e))return yr(S(e))}var br=r(a(),1);function xr(e,t){let n=z.useRef(null);function r(t){br.flushSync(()=>{e.setOpen(!1,ae(Te,t.nativeEvent,t.currentTarget))}),k(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Tt(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{br.flushSync(()=>{e.setOpen(!1,ae(Te,n.nativeEvent,n.currentTarget))});let i=ee(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&pt(r,i);){let e=i;if(i=Ee(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Sr(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=z.useRef(!1);return z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,yt(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:St,[t,n,r])}var Cr=2,wr=h(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:c,openOnHover:l,delay:u=100,closeDelay:f=0,handle:p,payload:h,...g}=e,_=Bn(!0),v=p?.store??_?.store;if(!v)throw Error(Ve(85));let y=N(c),b=v.useState(`isTriggerActive`,y),x=v.useState(`floatingRootContext`),S=v.useState(`isOpenedByTrigger`,y),C=v.useState(`triggerPopupId`,y),w=z.useRef(null),T=Er(),ee=Gt(!0),E=oe(),D=z.useMemo(()=>E??new ce,[E]),{registerTrigger:te,isMountedByThisTrigger:ne}=Fe(y,w,v,{payload:h,closeDelay:f,parent:T,floatingTreeRoot:D,floatingNodeId:d(D),floatingParentNodeId:st(),keyboardEventRelay:ee?.relayKeyboardEvent}),O=T.type===`menubar`,re=v.useState(`disabled`),k=a||re||O&&T.context.disabled,{getButtonProps:ie,buttonRef:A}=Pe({disabled:k,native:o});z.useEffect(()=>{!S&&T.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,S,T.type]);let j=z.useRef(null),M=Se(),ae=m(e=>{if(!j.current)return;M.clear(),v.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(pt(j.current,t)||pt(v.select(`positionerElement`),t)||t===j.current||t!=null&&yr(t)===v.select(`rootId`))return;let n=hn(j.current);e.clientX>=n.left-Cr&&e.clientX<=n.right+Cr&&e.clientY>=n.top-Cr&&e.clientY<=n.bottom+Cr||D.events.emit(`close`,{domEvent:e,reason:Jt})});z.useEffect(()=>{S&&v.select(`lastOpenChangeReason`)===`trigger-hover`&&yt(j.current).addEventListener(`mouseup`,ae,{once:!0})},[S,ae,v]);let se=O&&T.context.hasSubmenuOpen,P=s(x,{enabled:(l??se)&&!k&&T.type!==`context-menu`&&(!O||se&&!ne),handleClose:he({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:T.type===void 0?u:void 0,delay:{close:f},triggerElementRef:w,externalTree:D,isActiveTrigger:b,isClosing:()=>v.select(`transitionStatus`)===`ending`}),le=Tr(S,v.select(`lastOpenChangeReason`)),ue=Sn(x,{enabled:!k&&T.type!==`context-menu`,event:S&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?le:!1}),de=Pt(x,{enabled:!k&&se}),fe=Sr({open:S,enabled:O,mouseDownAction:`open`}),pe=z.useMemo(()=>Ut(de.reference,ue.reference),[de.reference,ue.reference]),me=v.useState(`triggerProps`,ne),{preFocusGuardRef:ge,handlePreFocusGuardFocus:_e,handleFocusTargetFocus:ve}=xr(v,w),ye={disabled:k,open:S},be=[j,t,A,te,w],F=[pe,P??St,me,{"aria-haspopup":`menu`,"aria-controls":C,id:y,onMouseDown:e=>{v.select(`open`)||(M.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),yt(e.currentTarget).addEventListener(`mouseup`,ae,{once:!0}))}},O?{role:`menuitem`}:{},fe,g,ie],xe=We(`button`,e,{enabled:!O,stateAttributesMapping:it,state:ye,ref:be,props:F});return O?(0,R.jsx)(vr,{tag:`button`,render:n,className:r,style:i,state:ye,refs:be,props:F,stateAttributesMapping:it}):S?(0,R.jsxs)(z.Fragment,{children:[(0,R.jsx)(Dt,{ref:ge,onFocus:_e},`${y}-pre-focus-guard`),(0,R.jsx)(z.Fragment,{children:xe},y),(0,R.jsx)(Dt,{ref:v.context.triggerFocusTargetRef,onFocus:ve},`${y}-post-focus-guard`)]}):(0,R.jsx)(z.Fragment,{children:xe},y)});function Tr(e,t){let n=Se(),[r,i]=z.useState(!1);return be(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Er(){let e=Hn(!0),t=Bn(!0),n=ur(!0);return z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var Dr=L(`arrow-down-left`,[[`path`,{d:`M17 7 7 17`,key:`15tmo1`}],[`path`,{d:`M17 17H7V7`,key:`1org7z`}]]),Or=L(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kr=L(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ar=L(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),jr=L(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Mr=L(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Nr=L(`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`}]]),Pr=L(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),Fr=L(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ir=L(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Lr=L(`chevrons-left-right-ellipsis`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`m17 7 5 5-5 5`,key:`1xlxn0`}],[`path`,{d:`m7 7-5 5 5 5`,key:`19njba`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]),Rr=L(`circle-minus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}]]),zr=L(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Br=L(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Vr=L(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Hr=L(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),Ur=L(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Wr=L(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Gr=L(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Kr=L(`dot`,[[`circle`,{cx:`12.1`,cy:`12.1`,r:`1`,key:`18d7e5`}]]),qr=L(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Jr=L(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Yr=L(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Xr=L(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Zr=L(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Qr=L(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),$r=L(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),ei=L(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ti=L(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),ni=L(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),ri=L(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),ii=L(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),ai=L(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),oi=L(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),si=L(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ci=L(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),li=L(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ui=L(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),di=L(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),fi=L(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),pi=L(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),mi=L(`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`}]]),hi=L(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),gi=L(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),_i=L(`message-circle`,[[`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`}]]),vi=L(`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`}]]),yi=L(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),bi=L(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),xi=L(`paintbrush`,[[`path`,{d:`m14.622 17.897-10.68-2.913`,key:`vj2p1u`}],[`path`,{d:`M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z`,key:`18tc5c`}],[`path`,{d:`M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15`,key:`ytzfxy`}]]),Si=L(`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`}]]),Ci=L(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),wi=L(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),Ti=L(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Ei=L(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Di=L(`pipette`,[[`path`,{d:`m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12`,key:`1y3wsu`}],[`path`,{d:`m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z`,key:`110lr1`}],[`path`,{d:`m2 22 .414-.414`,key:`jhxm08`}]]),Oi=L(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ki=L(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ai=L(`rectangle-horizontal`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`,key:`9lu3g6`}]]),ji=L(`rocket`,[[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z`,key:`m3kijz`}],[`path`,{d:`m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z`,key:`1fmvmk`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0`,key:`1f8sc4`}],[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}]]),Mi=L(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ni=L(`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`}]]),Pi=L(`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`}]]),Fi=L(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Ii=L(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),Li=L(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ri=L(`square-library`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 7v10`,key:`d5nglc`}],[`path`,{d:`M11 7v10`,key:`pptsnr`}],[`path`,{d:`m15 7 2 10`,key:`1m7qm5`}]]),zi=L(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Bi=L(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Vi=L(`sun-dim`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 4h.01`,key:`1ujb9j`}],[`path`,{d:`M20 12h.01`,key:`1ykeid`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M4 12h.01`,key:`158zrr`}],[`path`,{d:`M17.657 6.343h.01`,key:`31pqzk`}],[`path`,{d:`M17.657 17.657h.01`,key:`jehnf4`}],[`path`,{d:`M6.343 17.657h.01`,key:`gdk6ow`}],[`path`,{d:`M6.343 6.343h.01`,key:`1uurf0`}]]),Hi=L(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ui=L(`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`}]]),Wi=L(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Gi=L(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Ki=L(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),qi=L(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Ji=L(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Yi=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function Xi(e,t){return de(e)?e[Yi(0,e.length,t)]:e}var Zi=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return Qi(this.animations,`duration`)}get iterationDuration(){return Qi(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function Qi(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var $i=class extends Zi{then(e,t){return this.finished.finally(e).then(()=>{})}};function ea(e,t){return e in t}var ta=class extends It{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(ea(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return Be()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}};function na(e){let t=we(()=>g(e)),{isStatic:n}=(0,z.useContext)(I);if(n){let[,n]=(0,z.useState)(e);(0,z.useEffect)(()=>t.on(`change`,n),[])}return t}function ra(e){return typeof e==`object`&&!Array.isArray(e)}function ia(e,t,n,r){return e==null?[]:typeof e==`string`&&ra(t)?Rt(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function aa(e,t,n){return e*(t+1)+n*t}function oa(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function sa(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(f(e,i),r--)}}function ca(e,t,n,r,i,a){sa(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:se(i,a,r[o]),easing:Xi(n,o)})}function la(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function ua(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var da=`easeInOut`,fa=20;function pa(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},u=new Map,d=0,f=0,p=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){u.set(o,f);continue}else if(!Array.isArray(o)){u.set(o.name,oa(f,o.at,d,u));continue}let[m,h,g={}]=o;g.at!==void 0&&(f=oa(f,g.at,d,u));let _=0,v=(e,n,r,o=0,s=0)=>{let c=ga(e),{delay:u=0,times:d=ct(c),type:m=t.type||`keyframes`,repeat:h,repeatType:g,repeatDelay:v=0,...y}=n,{ease:b=t.ease||`easeOut`,duration:x}=n,S=typeof u==`function`?u(o,s):u,w=c.length,T=le(m)?m:i?.[m||`keyframes`];if(w<=2&&T){let e=100;if(w===2&&ya(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...y};x!==void 0&&(n.duration=E(x));let r=M(n,e,T);b=r.ease,x=r.duration}x??=a;let ee=f+S;d.length===1&&d[0]===0&&(d[1]=1);let D=d.length-c.length;if(D>0&&l(d,D),c.length===1&&c.unshift(null),h&&qt(h<fa,`Sequence segments can't repeat ${h} times — ignoring repeat option. Use a value below ${fa} or apply repeat at the sequence level instead.`),h&&h<fa){let e=x>0?v/x:0;x=aa(x,h,v);let t=[...c],n=[...d];b=Array.isArray(b)?[...b]:[b];let r=[...b],i=g===`reverse`||g===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),g===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?C(e):e)));for(let s=0;s<h;s++){let l=i&&s%2==0,u=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),d.push(p),b.push(`linear`)),c.push(...u);for(let e=0;e<u.length;e++)d.push(n[e]+p),b.push(e===0?`linear`:Xi(f,e-1))}la(d,h,e)}let te=ee+x;ca(r,c,b,d,ee,te),_=Math.max(S+x,_),p=Math.max(te,p)};if(b(m)){let e=ma(m,s);v(h,g,ha(`default`,e))}else{let e=ia(m,h,r,c),t=e.length;for(let n=0;n<t;n++){h=h,g=g;let r=e[n],i=ma(r,s);for(let e in h)v(h[e],_a(g,e),ha(e,i),n,t)}}d=f,f+=_}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(ua);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(ie(0,p,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(da)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...f}=t;u.transition[i]={...f,duration:p,ease:l,times:c,...n}}}),o}function ma(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function ha(e,t){return t[e]||(t[e]=[]),t[e]}function ga(e){return Array.isArray(e)?e:[e]}function _a(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var va=e=>typeof e==`number`,ya=e=>e.every(va);function ba(e){let t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=ye(e)&&!Ht(e)?new Xe(t):new Ne(t);n.mount(e),Wt.set(e,n)}function xa(e){let t=new ta({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),Wt.set(e,t)}function Sa(e,t){return b(e)||typeof e==`number`||typeof e==`string`&&!ra(t)}function Ca(e,t,n,r){let i=[];if(Sa(e,t))i.push($e(e,ra(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=ia(e,t,r),o=a.length;ge(!!o,`No valid elements provided.`,`no-valid-elements`);for(let e=0;e<o;e++){let r=a[e],s=r instanceof Element?ba:xa;Wt.has(r)||s(r);let c=Wt.get(r),l={...n};`delay`in l&&typeof l.delay==`function`&&(l.delay=l.delay(e,o)),i.push(...xe(c,{...t,transition:l},{}))}}return i}function wa(e,t,n){let r=[];return pa(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=g(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:ot}).forEach(({keyframes:e,transition:t},n)=>{r.push(...Ca(n,e,t))}),r}function Ta(e){return Array.isArray(e)&&e.some(Array.isArray)}function Ea(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=[],s,c={};if(n!==void 0&&(c.reduceMotion=n),r!==void 0&&(c.skipAnimations=r),Ta(e)){let{onComplete:n,...r}=i||{};typeof n==`function`&&(s=n),o=wa(e,{...c,...r},t)}else{let{onComplete:n,...r}=a||{};typeof n==`function`&&(s=n),o=Ca(e,i,{...c,...r},t)}let l=new $i(o);return s&&l.finished.then(s),t&&(t.animations.push(l),l.finished.then(()=>{f(t.animations,l)})),l}return i}var Da=Ea(),Oa={some:0,all:1};function ka(e,t,{root:n,margin:r,amount:i=`some`}={}){let a=Rt(e),o=new WeakMap,s=new IntersectionObserver(e=>{e.forEach(e=>{let n=o.get(e.target);if(e.isIntersecting!==!!n)if(e.isIntersecting){let n=t(e.target,e);typeof n==`function`?o.set(e.target,n):s.unobserve(e.target)}else typeof n==`function`&&(n(e),o.delete(e.target))})},{root:n,rootMargin:r,threshold:typeof i==`number`?i:Oa[i]});return a.forEach(e=>s.observe(e)),()=>s.disconnect()}function Aa(e,{root:t,margin:n,amount:r,once:i=!1,initial:a=!1}={}){let[o,s]=(0,z.useState)(a);return(0,z.useEffect)(()=>{if(!e.current||i&&o)return;let a=()=>(s(!0),i?void 0:()=>s(!1)),c={root:t&&t.current||void 0,margin:n,amount:r};return ka(e.current,a,c)},[t,e,n,i,r]),o}var ja=w.rounded,Ma=(0,z.createContext)(null);function Na(){let e=(0,z.useContext)(Ma);if(!e)throw Error(`useDropdown must be used within a Dropdown`);return e}var Pa=(0,z.forwardRef)(({icon:e,label:t,customContent:n,index:r,checked:i,onSelect:a,disabled:o,closeOnClick:s,className:c,onClick:l,...u},d)=>{let f=(0,z.useRef)(null),p=(0,z.useRef)(!1),{registerItem:m,activeIndex:h,checkedIndex:g,renderMenuItem:_}=Na();(0,z.useEffect)(()=>(m(r,f.current),()=>m(r,null)),[r,m]),(0,z.useEffect)(()=>{p.current=!0},[]);let v=h===r,y=!p.current,b=e=>{f.current=e,typeof d==`function`?d(e):d&&(d.current=e)},x=o?void 0:e=>{l?.(e),a?.()},S=A(`relative z-10 flex h-9 items-center gap-2 ${ja.item} px-2 cursor-pointer outline-none`,o&&`opacity-50 pointer-events-none`,c),C=t??(typeof n==`string`?n:`Menu item`),w=n??(0,R.jsxs)(R.Fragment,{children:[e&&(0,R.jsxs)(`span`,{className:`inline-grid`,children:[(0,R.jsx)(`span`,{className:`col-start-1 row-start-1 invisible`,children:(0,R.jsx)(e,{size:16,strokeWidth:2})}),(0,R.jsx)(e,{size:16,strokeWidth:v||i?2:1.5,className:A(`col-start-1 row-start-1 transition-[color,stroke-width] duration-80`,v||i?`text-foreground`:`text-muted-foreground`)})]}),(0,R.jsxs)(`span`,{className:`inline-grid flex-1 text-[13px]`,children:[(0,R.jsx)(`span`,{className:`col-start-1 row-start-1 invisible [text-box:trim-both_cap_alphabetic]`,style:{fontVariationSettings:He.semibold},"aria-hidden":`true`,children:C}),(0,R.jsx)(`span`,{className:A(`col-start-1 row-start-1 transition-[color,font-variation-settings] duration-80 [text-box:trim-both_cap_alphabetic]`,v||i?`text-foreground`:`text-muted-foreground`),style:{fontVariationSettings:i?He.semibold:He.normal},children:C})]}),(0,R.jsx)(en,{children:i&&(0,R.jsx)(qe.svg,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-foreground shrink-0`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:1},children:(0,R.jsx)(qe.path,{d:`M4 12L9 17L20 6`,initial:{pathLength:+!!y},animate:{pathLength:1,transition:{duration:.08,ease:`easeOut`}},exit:{pathLength:0,transition:{duration:.04,ease:`easeIn`}}})},`check`)})]});return _?_({radio:typeof i==`boolean`,value:r,disabled:o,label:C,closeOnClick:s??!0,element:(0,R.jsx)(`div`,{ref:b,"data-proximity-index":r,"aria-label":C,onClick:x,className:S,...u}),children:w}):(0,R.jsx)(`div`,{ref:b,"data-proximity-index":r,tabIndex:!o&&r===(g??0)?0:-1,role:typeof i==`boolean`?`menuitemradio`:`menuitem`,"aria-checked":typeof i==`boolean`?i:void 0,"aria-disabled":o||void 0,"aria-label":C,onClick:x,onKeyDown:e=>{o||(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),a?.())},className:S,...u,children:w})});Pa.displayName=`MenuItem`;var Fa=w.rounded,Ia=(0,z.forwardRef)(({children:e,checkedIndex:t,className:n,...r},i)=>{let a=(0,z.useRef)(null),{activeIndex:o,setActiveIndex:s,itemRects:c,sessionRef:l,handlers:u,registerItem:d,measureItems:f}=_n(a);(0,z.useEffect)(()=>{f()},[f,e]);let[p,m]=(0,z.useState)(null),h=o===null?null:c[o],g=t==null?null:c[t],_=p===null?null:c[p],v=o!==null&&o!==t;return(0,R.jsx)(Ma.Provider,{value:{registerItem:d,activeIndex:o,checkedIndex:t},children:(0,R.jsxs)(mn,{offset:2,shadowLevel:3,ref:e=>{a.current=e,typeof i==`function`?i(e):i&&(i.current=e)},onMouseEnter:u.onMouseEnter,onMouseMove:u.onMouseMove,onMouseLeave:u.onMouseLeave,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);if(t!=null){let n=Number(t);s(n),m(e.target.matches(`:focus-visible`)?n:null)}},onBlur:e=>{a.current?.contains(e.relatedTarget)||(m(null),s(null))},onKeyDown:e=>{let t=Array.from(a.current?.querySelectorAll(`[role="menuitem"], [role="menuitemradio"]`)??[]),n=t.indexOf(e.target);n!==-1&&([`ArrowDown`,`ArrowUp`,`ArrowRight`,`ArrowLeft`].includes(e.key)?(e.preventDefault(),t[[`ArrowDown`,`ArrowRight`].includes(e.key)?(n+1)%t.length:(n-1+t.length)%t.length].focus()):e.key===`Home`?(e.preventDefault(),t[0]?.focus()):e.key===`End`&&(e.preventDefault(),t[t.length-1]?.focus()))},role:`group`,className:A(`relative flex flex-col gap-0.5 w-72 max-w-full ${Fa.container} p-1 select-none`,n),...r,children:[(0,R.jsx)(en,{children:g&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.bg} bg-active pointer-events-none`,initial:!1,animate:{top:g.top,left:g.left,width:g.width,height:g.height,opacity:v?.8:1},exit:{opacity:0,transition:At.moderate.exit},transition:{...At.moderate,opacity:{duration:.08}}})}),(0,R.jsx)(en,{children:h&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.bg} bg-hover pointer-events-none`,initial:{opacity:0,top:g?.top??h.top,left:g?.left??h.left,width:g?.width??h.width,height:g?.height??h.height},animate:{opacity:1,top:h.top,left:h.left,width:h.width,height:h.height},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}},l.current)}),(0,R.jsx)(en,{children:_&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.focusRing} pointer-events-none z-20 border border-[color:var(--focus-ring,#6B97FF)]`,initial:!1,animate:{left:_.left-2,top:_.top-2,width:_.width+4,height:_.height+4},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}})}),e]})})});Ia.displayName=`Dropdown`;var La=(0,z.createContext)(null);function Ra(){let e=(0,z.useContext)(La);if(!e)throw Error(`DropdownMenu compound components must be inside <DropdownMenu>`);return e}function za({children:e,open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i=!1}){let[a,o]=(0,z.useState)(n),s=t===void 0?a:t,c=(0,z.useRef)(null),l=(0,z.useCallback)(e=>{t===void 0&&o(e),r?.(e)},[t,r]),u=(0,z.useMemo)(()=>({open:s,actionsRef:c}),[s]);return(0,R.jsx)(La.Provider,{value:u,children:(0,R.jsx)(gr,{open:s,onOpenChange:l,actionsRef:c,disabled:i,modal:!1,children:e})})}za.displayName=`DropdownMenu`;var Ba=wr,Va=(0,z.forwardRef)(({className:e,children:t,checkedIndex:n,side:r=`bottom`,align:i=`start`,sideOffset:a=6},o)=>{let{open:s,actionsRef:c}=Ra(),l=(0,z.useRef)(null),{activeIndex:u,setActiveIndex:d,itemRects:f,sessionRef:p,handlers:m,registerItem:h,measureItems:g}=_n(l),[_,v]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(s)return;let e=setTimeout(()=>c.current?.unmount(),vt(At.fast));return()=>clearTimeout(e)},[s,c]),(0,z.useEffect)(()=>{if(!s)return;let e,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{g()})});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[s,g]);let y=u===null?null:f[u],b=n==null?null:f[n],x=_===null?null:f[_],S=u!==null&&u!==n,C=(0,z.useCallback)(({radio:e,value:t,disabled:n,label:r,closeOnClick:i,element:a,children:o})=>e?(0,R.jsx)(sr,{value:t,disabled:n,label:r,closeOnClick:i,render:a,children:o}):(0,R.jsx)(Yn,{disabled:n,label:r,closeOnClick:i,render:a,children:o}),[]),w=(0,z.useMemo)(()=>({registerItem:h,activeIndex:u,checkedIndex:n,inMenu:!0,renderMenuItem:C}),[h,u,n,C]);return(0,R.jsx)(er,{children:(0,R.jsx)(tr,{side:r,align:i,sideOffset:a,className:`z-50 outline-none`,children:(0,R.jsx)(qe.div,{initial:{opacity:0,y:-4,scaleY:.96},animate:s?{opacity:1,y:0,scaleY:1}:{opacity:0,y:-4,scaleY:.96},transition:s?At.fast:At.fast.exit,style:{transformOrigin:`top center`},onAnimationComplete:()=>{s||c.current?.unmount()},children:(0,R.jsx)(Ma.Provider,{value:w,children:(0,R.jsxs)(Zn,{render:(0,R.jsx)(mn,{offset:2,shadowLevel:3,ref:e=>{l.current=e,typeof o==`function`?o(e):o&&(o.current=e)}}),onMouseEnter:()=>{m.onMouseEnter(),v(null)},onMouseMove:m.onMouseMove,onMouseLeave:m.onMouseLeave,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);if(t!=null){let n=Number(t);d(n),v(e.target.matches(`:focus-visible`)?n:null)}},onBlur:e=>{l.current?.contains(e.relatedTarget)||(v(null),d(null))},className:A(`relative flex flex-col gap-0.5 w-72 max-w-full min-w-[var(--anchor-width)] max-h-[min(480px,var(--available-height))] overflow-y-auto ${Fa.container} p-1 select-none outline-none`,e),children:[(0,R.jsx)(en,{children:b&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.bg} bg-active pointer-events-none`,initial:!1,animate:{top:b.top,left:b.left,width:b.width,height:b.height,opacity:S?.8:1},exit:{opacity:0,transition:At.moderate.exit},transition:{...At.moderate,opacity:{duration:.08}}})}),(0,R.jsx)(en,{children:y&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.bg} bg-hover pointer-events-none`,initial:{opacity:0,top:b?.top??y.top,left:b?.left??y.left,width:b?.width??y.width,height:b?.height??y.height},animate:{opacity:1,top:y.top,left:y.left,width:y.width,height:y.height},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}},p.current)}),(0,R.jsx)(en,{children:x&&(0,R.jsx)(qe.div,{className:`absolute ${Fa.focusRing} pointer-events-none z-20 border border-[color:var(--focus-ring,#6B97FF)]`,initial:!1,animate:{left:x.left-2,top:x.top-2,width:x.width+4,height:x.height+4},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}})}),n==null?t:(0,R.jsx)(ir,{value:n,className:`contents`,children:t})]})})})})})});Va.displayName=`DropdownContent`;var Ha=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(`div`,{ref:n,className:A(`px-2 py-1.5 text-[11px] text-muted-foreground`,e),...t}));Ha.displayName=`DropdownLabel`;var Ua=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(`div`,{ref:n,role:`separator`,className:A(`my-1 -mx-1 h-px bg-border/60`,e),...t}));Ua.displayName=`DropdownSeparator`;var Wa=z.createContext(null);function Ga(){let e=z.useContext(Wa);if(!e)throw Error(`Dropdown menu items must be inside DropdownMenuContent`);return e.next()}function Ka(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Ka).filter(Boolean).join(` `).trim():z.isValidElement(e)?Ka(e.props.children):`Menu item`}function qa(e){return(0,R.jsx)(za,{"data-slot":`dropdown-menu`,...e})}function Ja(e){return(0,R.jsx)(Ba,{"data-slot":`dropdown-menu-trigger`,...e})}function Ya({className:e,align:t=`start`,side:n=`bottom`,sideOffset:r=6,children:i,forceMount:a,...o}){let s=z.useRef(0),c=z.useMemo(()=>({next:()=>s.current++}),[]);return s.current=0,(0,R.jsx)(Wa.Provider,{value:c,children:(0,R.jsx)(Va,{"data-slot":`dropdown-menu-content`,className:e,align:t,side:n,sideOffset:r,...o,children:i})})}function Xa({className:e,inset:t,...n}){return(0,R.jsx)(Ha,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:A(t&&`pl-8`,e),...n})}function Za({className:e,inset:t,variant:n=`default`,render:r,children:i,onSelect:a,onClick:o,disabled:s,...c}){let l=Ga(),u=Ka(r??i),d=()=>{a?.(new Event(`select`))};if(r&&z.isValidElement(r)){let i=r;return(0,R.jsx)(Pa,{index:l,label:u,disabled:s,customContent:z.cloneElement(i,{className:A(`relative z-10 flex h-9 w-full items-center gap-2 rounded-lg px-2 text-[13px] outline-none`,t&&`pl-8`,n===`destructive`&&`text-destructive`,i.props.className,e),onClick:e=>{i.props.onClick?.(e),o?.(e),e.defaultPrevented||d()}}),onSelect:d,...c})}return(0,R.jsx)(Pa,{index:l,label:u,disabled:s,className:A(t&&`pl-8`,n===`destructive`&&`text-destructive`,e),customContent:(0,R.jsx)(`span`,{className:`flex w-full min-w-0 items-center gap-2 text-[13px] text-inherit`,children:i}),onClick:o,onSelect:d,...c})}function Qa({...e}){return(0,R.jsx)(ir,{"data-slot":`dropdown-menu-radio-group`,...e})}function $a({className:e,children:t,inset:n,...r}){return(0,R.jsxs)(sr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:A(`relative z-10 flex h-9 cursor-default items-center gap-2 rounded-lg py-0 pr-8 pl-2 text-[13px] outline-none select-none data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,R.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,R.jsx)(cr,{children:(0,R.jsx)(Fr,{className:`size-4`})})}),t]})}function eo({className:e,...t}){return(0,R.jsx)(Ua,{"data-slot":`dropdown-menu-separator`,className:e,...t})}function to({message:e,className:t=``,vertical:n,noBorder:r}){return(0,R.jsx)(`div`,{className:A(`mt-2 rounded-md p-6 ${t}`,!r&&`border`),children:(0,R.jsxs)(`p`,{className:A(`text-sm text-muted-foreground flex items-center gap-4`,n&&`flex-col`),children:[(0,R.jsxs)(`svg`,{width:`40`,height:`40`,viewBox:`-6 -6 512 512`,xmlns:`http://www.w3.org/2000/svg`,className:`flex-shrink-0 stroke-black dark:stroke-white`,fill:`none`,strokeWidth:`4`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]}),e]})})}var no=`data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%20400%20310%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cfilter%20id%3D%27noiseFilter%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.083%27%20numOctaves%3D%273%27%20stitchTiles%3D%27stitch%27%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%27100%25%27%20height%3D%27100%25%27%20filter%3D%27url(%23noiseFilter)%27%2F%3E%3C%2Fsvg%3E`,ro=`data:image/svg+xml,%3Csvg%20viewBox%3D%270%200%20400%20310%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cfilter%20id%3D%27noiseFilter%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.42%27%20numOctaves%3D%273%27%20stitchTiles%3D%27stitch%27%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%27100%25%27%20height%3D%27100%25%27%20filter%3D%27url(%23noiseFilter)%27%2F%3E%3C%2Fsvg%3E`,io=ro;function ao(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t)}function oo(e,t=0){let n=Math.sin(e+t)*1e4;return n-Math.floor(n)}function so({className:e,color:t,children:n,grayscaled:r=!1,seed:i,variant:a=`default`}){let o=(0,z.useId)(),s=(0,z.useMemo)(()=>ao(i||t||o),[i,t,o]),c=(0,z.useMemo)(()=>{if(t){let e=t.split(`(`)[1].split(`)`)[0].trim().split(/\s+/);return Number.parseFloat(e[1]||`0`)}return r?0:.2},[t,r]),l=(0,z.useMemo)(()=>{if(t){let e=t.split(`(`)[1].split(`)`)[0].trim().split(/\s+/);return Number.parseFloat(e[0]||`0.5`)}return r?.3:.4},[t,r]),u=(0,z.useMemo)(()=>{if(t){let e=t.split(`(`)[1].split(`)`)[0].trim().split(/\s+/);return Number.parseFloat(e[2]||`0`)}return Math.floor(oo(s,0)*360)},[t,s]),d=(0,z.useMemo)(()=>t||`oklch(${Math.min(l,1)} ${c} ${u})`,[u,c,l,t]),f=(0,z.useMemo)(()=>`oklch(${Math.min(l*2,1)} ${c} ${u})`,[u,c,l,t]),p=(0,z.useMemo)(()=>Math.floor(oo(s,1)*360),[s]),m=a===`tile`?ro:no;return(0,R.jsx)(`section`,{className:A(`relative w-full h-full overflow-hidden`,e),style:{background:`${f}`},children:(0,R.jsxs)(`div`,{className:`isolate relative w-full h-full`,children:[(0,R.jsx)(`div`,{className:`noise w-full h-full`,style:{background:`linear-gradient(${p}deg, ${d}, transparent), url("${m}")`,filter:`contrast(220%) brightness(1000%)`}}),n&&(0,R.jsx)(`div`,{className:`relative z-10 w-full h-full`,children:n})]})})}var co=`#version 300 es
11
- in vec4 a_position;
12
- out vec2 v_objectUV;
13
- void main(){
14
- gl_Position=a_position;
15
- v_objectUV=a_position.xy*0.5+0.5;
16
- }`,lo=`#version 300 es
17
- precision mediump float;
18
- uniform float u_time;
19
- uniform vec4 u_colors[4];
20
- uniform float u_colorsCount;
21
- uniform float u_distortion;
22
- uniform float u_swirl;
23
- uniform float u_grainMixer;
24
- uniform float u_grainOverlay;
25
- in vec2 v_objectUV;
26
- out vec4 fragColor;
27
- vec2 rotate(vec2 uv,float th){return mat2(cos(th),sin(th),-sin(th),cos(th))*uv;}
28
- float hash21(vec2 p){
29
- p=fract(p*vec2(0.3183099,0.3678794))+0.1;
30
- p+=dot(p,p+19.19);
31
- return fract(p.x*p.y);
32
- }
33
- float valueNoise(vec2 st){
34
- vec2 i=floor(st);vec2 f=fract(st);
35
- float a=hash21(i),b=hash21(i+vec2(1.,0.)),c=hash21(i+vec2(0.,1.)),d=hash21(i+vec2(1.,1.));
36
- vec2 u=f*f*(3.-2.*f);
37
- return mix(mix(a,b,u.x),mix(c,d,u.x),u.y);
38
- }
39
- vec2 getPosition(int i,float t){
40
- float a=float(i)*.37,b=.6+fract(float(i)/3.)*.9,c=.8+fract(float(i+1)/4.);
41
- float x=sin(t*b+a),y=cos(t*c+a*1.5);
42
- return .5+.5*vec2(x,y);
43
- }
44
- void main(){
45
- vec2 uv=v_objectUV;uv+=.5;
46
- vec2 grainUV=uv*1000.;
47
- float grain=valueNoise(grainUV);
48
- float mixerGrain=.4*u_grainMixer*(grain-.5);
49
- float t=.5*(u_time+41.5);
50
- float radius=smoothstep(0.,1.,length(uv-.5));
51
- float center=1.-radius;
52
- for(float i=1.;i<=2.;i++){
53
- uv.x+=u_distortion*center/i*sin(t+i*.4*smoothstep(0.,1.,uv.y))*cos(.2*t+i*2.4*smoothstep(0.,1.,uv.y));
54
- uv.y+=u_distortion*center/i*cos(t+i*2.*smoothstep(0.,1.,uv.x));
55
- }
56
- vec2 uvR=uv-vec2(.5);
57
- float angle=3.*u_swirl*radius;
58
- uvR=rotate(uvR,-angle);uvR+=vec2(.5);
59
- vec3 color=vec3(0.);float opacity=0.,totalWeight=0.;
60
- for(int i=0;i<4;i++){
61
- if(i>=int(u_colorsCount))break;
62
- vec2 pos=getPosition(i,t)+mixerGrain;
63
- vec3 cf=u_colors[i].rgb*u_colors[i].a;
64
- float opacityF=u_colors[i].a;
65
- float dist=length(uvR-pos);
66
- dist=pow(dist,3.5);
67
- float w=1./(dist+1e-3);
68
- color+=cf*w;opacity+=opacityF*w;totalWeight+=w;
69
- }
70
- color/=max(1e-4,totalWeight);
71
- opacity/=max(1e-4,totalWeight);
72
- float grainO=valueNoise(rotate(grainUV,1.)+vec2(3.));
73
- grainO=mix(grainO,valueNoise(rotate(grainUV,2.)+vec2(-1.)),.5);
74
- grainO=pow(grainO,1.3);
75
- float grainOV=grainO*2.-1.;
76
- vec3 grainOC=vec3(step(0.,grainOV));
77
- float grainOS=u_grainOverlay*abs(grainOV);
78
- grainOS=pow(grainOS,.8);
79
- color=mix(color,grainOC,.35*grainOS);
80
- opacity+=.5*grainOS;
81
- fragColor=vec4(color,clamp(opacity,0.,1.));
82
- }`;function uo(e){return[parseInt(e.slice(1,3),16)/255,parseInt(e.slice(3,5),16)/255,parseInt(e.slice(5,7),16)/255,1]}function fo({className:e,colors:t=[`#e0eaff`,`#f9ffbd`,`#dedede`,`#ffffff`],distortion:n=.8,swirl:r=.1,grainMixer:i=0,grainOverlay:a=.2,speed:o=1}){let s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useRef)({colors:t,distortion:n,swirl:r,grainMixer:i,grainOverlay:a,speed:o});return l.current={colors:t,distortion:n,swirl:r,grainMixer:i,grainOverlay:a,speed:o},(0,z.useEffect)(()=>{let e=s.current,t=c.current;if(!e||!t)return;let n=e.getContext(`webgl2`);if(!n)return;let r=(e,t)=>{let r=n.createShader(e);return r?(n.shaderSource(r,t),n.compileShader(r),n.getShaderParameter(r,n.COMPILE_STATUS)?r:(console.error(n.getShaderInfoLog(r)),null)):null},i=r(n.VERTEX_SHADER,co),a=r(n.FRAGMENT_SHADER,lo);if(!i||!a)return;let o=n.createProgram();if(!o)return;if(n.attachShader(o,i),n.attachShader(o,a),n.linkProgram(o),!n.getProgramParameter(o,n.LINK_STATUS)){console.error(n.getProgramInfoLog(o));return}n.useProgram(o);let u=n.getAttribLocation(o,`a_position`),d=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,d),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),n.STATIC_DRAW),n.enableVertexAttribArray(u),n.vertexAttribPointer(u,2,n.FLOAT,!1,0,0);let f=n.getUniformLocation(o,`u_time`),p=[0,1,2,3].map(e=>n.getUniformLocation(o,`u_colors[${e}]`)),m=n.getUniformLocation(o,`u_colorsCount`),h=n.getUniformLocation(o,`u_distortion`),g=n.getUniformLocation(o,`u_swirl`),_=n.getUniformLocation(o,`u_grainMixer`),v=n.getUniformLocation(o,`u_grainOverlay`),y=0,b=0,x=()=>{let r=Math.min(2,window.devicePixelRatio||1);e.width=Math.floor(t.clientWidth*r),e.height=Math.floor(t.clientHeight*r),n.viewport(0,0,e.width,e.height)},S=()=>{if(document.hidden){b=requestAnimationFrame(S);return}let{colors:e,distortion:t,swirl:r,grainMixer:i,grainOverlay:a,speed:o}=l.current,s=e.map(uo);y+=.016*o,n.uniform1f(f,y);for(let e=0;e<4;e++){let t=p[e];t&&n.uniform4fv(t,s[e]??[1,1,1,1])}n.uniform1f(m,s.length),n.uniform1f(h,t),n.uniform1f(g,r),n.uniform1f(_,i),n.uniform1f(v,a),n.drawArrays(n.TRIANGLES,0,6),b=requestAnimationFrame(S)};x();let C=new ResizeObserver(x);return C.observe(t),S(),()=>{cancelAnimationFrame(b),C.disconnect()}},[]),(0,R.jsx)(`div`,{ref:c,className:e,children:(0,R.jsx)(`canvas`,{ref:s,className:`h-full w-full`,"aria-hidden":!0})})}var po=class{name=`mcp_inspector_open`;properties;constructor(e){this.properties={server_url:e.serverUrl,connection_count:e.connectionCount}}},mo=class{name=`mcp_tool_execution`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId,success:e.success,duration:e.duration,error:e.error}}},ho=class{name=`mcp_resource_read`;properties;constructor(e){this.properties={resource_uri:e.resourceUri,server_id:e.serverId,success:e.success,error:e.error}}},go=class{name=`mcp_prompt_call`;properties;constructor(e){this.properties={prompt_name:e.promptName,server_id:e.serverId,success:e.success,error:e.error}}},_o=class{name=`mcp_server_connection`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,success:e.success,connection_type:e.connectionType,error:e.error}}},vo=class{name=`mcp_chat_message`;properties;constructor(e){this.properties={server_id:e.serverId,provider:e.provider,model:e.model,message_count:e.messageCount,tool_calls_count:e.toolCallsCount,success:e.success,execution_mode:e.executionMode,duration:e.duration,error:e.error}}},yo=class{name=`mcp_server_added`;properties;constructor(e){this.properties={server_id:e.serverId,server_url:e.serverUrl,connection_type:e.connectionType,via_proxy:e.viaProxy}}},bo=class{name=`mcp_server_removed`;properties;constructor(e){this.properties={server_id:e.serverId}}},xo=class{name=`mcp_command_palette_open`;properties;constructor(e){this.properties={trigger:e.trigger}}},So=class{name=`mcp_tool_saved`;properties;constructor(e){this.properties={tool_name:e.toolName,server_id:e.serverId}}},Co=class{name=`mcp_tunnel_action`;properties;constructor(e){this.properties={action:e.action,success:e.success,tunnel_url:e.tunnelUrl}}},wo=class{name=`mcp_deploy_click`;properties;constructor(e){this.properties={referrer:e.referrer}}},To=class{name=`mcp_chat_configured`;properties;constructor(e){this.properties={provider:e.provider,model:e.model}}},Eo=class{name=`mcp_tab_navigation`;properties;constructor(e){this.properties={tab:e.tab,previous_tab:e.previousTab}}},Do=class{name=`mcp_add_to_client`;properties;constructor(e){this.properties={client:e.client}}},Oo=class{name=`mcp_session_duration`;properties;constructor(e){this.properties={duration_seconds:e.durationSeconds,tabs_visited:e.tabsVisited,tools_executed:e.toolsExecuted}}};function ko(){try{if(typeof window<`u`){let e=window.__INSPECTOR_VERSION__;if(e!==void 0)return e}return`0.0.0`}catch{return`0.0.0`}}var Ao=Object.create,jo=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,No=Object.getOwnPropertyNames,Po=Object.getPrototypeOf,Fo=Object.prototype.hasOwnProperty,Io=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Lo=(e,t)=>{let n={};for(var r in e)jo(n,r,{get:e[r],enumerable:!0});return t&&jo(n,Symbol.toStringTag,{value:`Module`}),n},Ro=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=No(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Fo.call(e,s)&&s!==n&&jo(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Mo(t,s))||r.enumerable});return e},zo=(e,t,n)=>(n=e==null?{}:Ao(Po(e)),Ro(t||!e||!e.__esModule?jo(n,`default`,{value:e,enumerable:!0}):n,e)),Bo,Vo=Object.freeze({status:`aborted`});function B(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ho=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Uo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Bo=globalThis).__zod_globalConfig??(Bo.__zod_globalConfig={});var Wo=globalThis.__zod_globalConfig;function Go(e){return e&&Object.assign(Wo,e),Wo}function Ko(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function qo(e,t){return typeof t==`bigint`?t.toString():t}function Jo(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Yo(e){return e==null}function Xo(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Zo(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Qo=Symbol(`evaluating`);function $o(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Qo)return r===void 0&&(r=Qo,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function es(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ts(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ns(e){return JSON.stringify(e)}function rs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var is=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function as(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var os=Jo(()=>{if(Wo.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ss(e){if(as(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(as(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function cs(e){return ss(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ls=new Set([`string`,`number`,`symbol`]);function us(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ds(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function fs(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ps(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ms={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function hs(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ds(e,ts(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return es(this,`shape`,e),e},checks:[]}))}function gs(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ds(e,ts(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return es(this,`shape`,r),r},checks:[]}))}function _s(e,t){if(!ss(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ds(e,ts(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return es(this,`shape`,n),n}}))}function vs(e,t){if(!ss(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ds(e,ts(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return es(this,`shape`,n),n}}))}function ys(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ds(e,ts(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return es(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function bs(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ds(t,ts(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return es(this,`shape`,i),i},checks:[]}))}function xs(e,t,n){return ds(t,ts(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return es(this,`shape`,i),i}}))}function Ss(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Cs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ws(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ts(e){return typeof e==`string`?e:e?.message}function Es(e,t,n){let r=e.message?e.message:Ts(e.inst?._zod.def?.error?.(e))??Ts(t?.error?.(e))??Ts(n.customError?.(e))??Ts(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ds(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Os(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ks=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},As=B(`$ZodError`,ks),js=B(`$ZodError`,ks,{Parent:Error});function Ms(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ns(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ps=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ho;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Es(e,a,Go())));throw is(t,i?.callee),t}return o.value},Fs=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Es(e,a,Go())));throw is(t,i?.callee),t}return o.value},Is=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ho;return a.issues.length?{success:!1,error:new(e??As)(a.issues.map(e=>Es(e,i,Go())))}:{success:!0,data:a.value}},Ls=Is(js),Rs=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Es(e,i,Go())))}:{success:!0,data:a.value}},zs=Rs(js),Bs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ps(e)(t,n,i)},Vs=e=>(t,n,r)=>Ps(e)(t,n,r),Hs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fs(e)(t,n,i)},Us=e=>async(t,n,r)=>Fs(e)(t,n,r),Ws=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Is(e)(t,n,i)},Gs=e=>(t,n,r)=>Is(e)(t,n,r),Ks=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Rs(e)(t,n,i)},qs=e=>async(t,n,r)=>Rs(e)(t,n,r),Js=/^[cC][0-9a-z]{6,}$/,Ys=/^[0-9a-z]+$/,Xs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zs=/^[0-9a-vA-V]{20}$/,Qs=/^[A-Za-z0-9]{27}$/,$s=/^[a-zA-Z0-9_-]{21}$/,ec=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,rc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ic=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ac(){return new RegExp(ic,`u`)}var oc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,lc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dc=/^[A-Za-z0-9_-]*$/,fc=/^https?$/,pc=/^\+[1-9]\d{6,14}$/,mc=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,hc=RegExp(`^${mc}$`);function gc(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _c(e){return RegExp(`^${gc(e)}$`)}function vc(e){let t=gc({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${mc}T(?:${r})$`)}var yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},bc=/^-?\d+$/,xc=/^-?\d+(?:\.\d+)?$/,Sc=/^(?:true|false)$/i,Cc=/^null$/i,wc=/^undefined$/i,Tc=/^[^A-Z]*$/,Ec=/^[^a-z]*$/,Dc=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Oc={number:`number`,bigint:`bigint`,object:`date`},kc=B(`$ZodCheckLessThan`,(e,t)=>{Dc.init(e,t);let n=Oc[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ac=B(`$ZodCheckGreaterThan`,(e,t)=>{Dc.init(e,t);let n=Oc[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jc=B(`$ZodCheckMultipleOf`,(e,t)=>{Dc.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Zo(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Mc=B(`$ZodCheckNumberFormat`,(e,t)=>{Dc.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ms[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=bc)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Nc=B(`$ZodCheckMaxLength`,(e,t)=>{var n;Dc.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Yo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ds(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Pc=B(`$ZodCheckMinLength`,(e,t)=>{var n;Dc.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Yo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ds(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Fc=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;Dc.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Yo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ds(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ic=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Dc.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Lc=B(`$ZodCheckRegex`,(e,t)=>{Ic.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Rc=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Tc,Ic.init(e,t)}),zc=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ec,Ic.init(e,t)}),Bc=B(`$ZodCheckIncludes`,(e,t)=>{Dc.init(e,t);let n=us(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Vc=B(`$ZodCheckStartsWith`,(e,t)=>{Dc.init(e,t);let n=RegExp(`^${us(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Hc=B(`$ZodCheckEndsWith`,(e,t)=>{Dc.init(e,t);let n=RegExp(`.*${us(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Uc=B(`$ZodCheckOverwrite`,(e,t)=>{Dc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Wc=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
83
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
84
- `))}},Gc={major:4,minor:4,patch:3},Kc=B(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gc;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Ss(e),i;for(let a of t){if(a._zod.def.when){if(Cs(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Ho;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Ss(e,t))});else{if(e.issues.length===t)continue;r||=Ss(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Ss(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ho;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Ho;return o.then(e=>t(e,r,a))}return t(o,r,a)}}$o(e,`~standard`,()=>({validate:t=>{try{let n=Ls(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return zs(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),qc=B(`$ZodString`,(e,t)=>{Kc.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Jc=B(`$ZodStringFormat`,(e,t)=>{Ic.init(e,t),qc.init(e,t)}),Yc=B(`$ZodGUID`,(e,t)=>{t.pattern??=tc,Jc.init(e,t)}),Xc=B(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=nc(e)}else t.pattern??=nc();Jc.init(e,t)}),Zc=B(`$ZodEmail`,(e,t)=>{t.pattern??=rc,Jc.init(e,t)}),Qc=B(`$ZodURL`,(e,t)=>{Jc.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===fc.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),$c=B(`$ZodEmoji`,(e,t)=>{t.pattern??=ac(),Jc.init(e,t)}),el=B(`$ZodNanoID`,(e,t)=>{t.pattern??=$s,Jc.init(e,t)}),tl=B(`$ZodCUID`,(e,t)=>{t.pattern??=Js,Jc.init(e,t)}),nl=B(`$ZodCUID2`,(e,t)=>{t.pattern??=Ys,Jc.init(e,t)}),rl=B(`$ZodULID`,(e,t)=>{t.pattern??=Xs,Jc.init(e,t)}),il=B(`$ZodXID`,(e,t)=>{t.pattern??=Zs,Jc.init(e,t)}),al=B(`$ZodKSUID`,(e,t)=>{t.pattern??=Qs,Jc.init(e,t)}),ol=B(`$ZodISODateTime`,(e,t)=>{t.pattern??=vc(t),Jc.init(e,t)}),sl=B(`$ZodISODate`,(e,t)=>{t.pattern??=hc,Jc.init(e,t)}),cl=B(`$ZodISOTime`,(e,t)=>{t.pattern??=_c(t),Jc.init(e,t)}),ll=B(`$ZodISODuration`,(e,t)=>{t.pattern??=ec,Jc.init(e,t)}),ul=B(`$ZodIPv4`,(e,t)=>{t.pattern??=oc,Jc.init(e,t),e._zod.bag.format=`ipv4`}),dl=B(`$ZodIPv6`,(e,t)=>{t.pattern??=sc,Jc.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),fl=B(`$ZodCIDRv4`,(e,t)=>{t.pattern??=cc,Jc.init(e,t)}),pl=B(`$ZodCIDRv6`,(e,t)=>{t.pattern??=lc,Jc.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function ml(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var hl=B(`$ZodBase64`,(e,t)=>{t.pattern??=uc,Jc.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ml(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function gl(e){if(!dc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ml(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var _l=B(`$ZodBase64URL`,(e,t)=>{t.pattern??=dc,Jc.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{gl(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),vl=B(`$ZodE164`,(e,t)=>{t.pattern??=pc,Jc.init(e,t)});function yl(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var bl=B(`$ZodJWT`,(e,t)=>{Jc.init(e,t),e._zod.check=n=>{yl(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),xl=B(`$ZodNumber`,(e,t)=>{Kc.init(e,t),e._zod.pattern=e._zod.bag.pattern??xc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Sl=B(`$ZodNumberFormat`,(e,t)=>{Mc.init(e,t),xl.init(e,t)}),Cl=B(`$ZodBoolean`,(e,t)=>{Kc.init(e,t),e._zod.pattern=Sc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),wl=B(`$ZodUndefined`,(e,t)=>{Kc.init(e,t),e._zod.pattern=wc,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),Tl=B(`$ZodNull`,(e,t)=>{Kc.init(e,t),e._zod.pattern=Cc,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),El=B(`$ZodAny`,(e,t)=>{Kc.init(e,t),e._zod.parse=e=>e}),Dl=B(`$ZodUnknown`,(e,t)=>{Kc.init(e,t),e._zod.parse=e=>e}),Ol=B(`$ZodNever`,(e,t)=>{Kc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function kl(e,t,n){e.issues.length&&t.issues.push(...ws(n,e.issues)),t.value[n]=e.value}var Al=B(`$ZodArray`,(e,t)=>{Kc.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>kl(t,n,e))):kl(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function jl(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ws(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Ml(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ps(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Nl(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>jl(e,n,i,t,u,d))):jl(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Pl=B(`$ZodObject`,(e,t)=>{if(Kc.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Jo(()=>Ml(t));$o(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=as,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>jl(n,t,e,s,r,i))):jl(a,t,e,s,r,i)}return i?Nl(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fl=B(`$ZodObjectJIT`,(e,t)=>{Pl.init(e,t);let n=e._zod.parse,r=Jo(()=>Ml(t)),i=e=>{let t=new Wc([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ns(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ns(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
85
- if (${n}.issues.length) {
86
- if (${o} in input) {
87
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
88
- ...iss,
89
- path: iss.path ? [${o}, ...iss.path] : [${o}]
90
- })));
91
- }
92
- }
93
-
94
- if (${n}.value === undefined) {
95
- if (${o} in input) {
96
- newResult[${o}] = undefined;
97
- }
98
- } else {
99
- newResult[${o}] = ${n}.value;
100
- }
101
-
102
- `):c?t.write(`
103
- if (${n}.issues.length) {
104
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
105
- ...iss,
106
- path: iss.path ? [${o}, ...iss.path] : [${o}]
107
- })));
108
- }
109
-
110
- if (${n}.value === undefined) {
111
- if (${o} in input) {
112
- newResult[${o}] = undefined;
113
- }
114
- } else {
115
- newResult[${o}] = ${n}.value;
116
- }
117
-
118
- `):t.write(`
119
- const ${n}_present = ${o} in input;
120
- if (${n}.issues.length) {
121
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
122
- ...iss,
123
- path: iss.path ? [${o}, ...iss.path] : [${o}]
124
- })));
125
- }
126
- if (!${n}_present && !${n}.issues.length) {
127
- payload.issues.push({
128
- code: "invalid_type",
129
- expected: "nonoptional",
130
- input: undefined,
131
- path: [${o}]
132
- });
133
- }
134
-
135
- if (${n}_present) {
136
- if (${n}.value === undefined) {
137
- newResult[${o}] = undefined;
138
- } else {
139
- newResult[${o}] = ${n}.value;
140
- }
141
- }
142
-
143
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=as,s=!Wo.jitless,c=s&&os.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Nl([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Il(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ss(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Es(e,r,Go())))}),t)}var Ll=B(`$ZodUnion`,(e,t)=>{Kc.init(e,t),$o(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),$o(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),$o(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),$o(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Xo(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Il(t,r,e,i)):Il(o,r,e,i)}}),Rl=B(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ll.init(e,t);let n=e._zod.parse;$o(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Jo(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!as(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),zl=B(`$ZodIntersection`,(e,t)=>{Kc.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Vl(e,t,n)):Vl(e,i,a)}});function Bl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ss(e)&&ss(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Bl(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Bl(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Vl(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ss(e))return e;let o=Bl(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Hl=B(`$ZodRecord`,(e,t)=>{Kc.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ss(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Es(e,r,Go())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...ws(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...ws(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&xc.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Es(e,r,Go())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...ws(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...ws(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ul=B(`$ZodEnum`,(e,t)=>{Kc.init(e,t);let n=Ko(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ls.has(typeof e)).map(e=>typeof e==`string`?us(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Wl=B(`$ZodLiteral`,(e,t)=>{if(Kc.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?us(e):e?us(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Gl=B(`$ZodTransform`,(e,t)=>{Kc.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Uo(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Ho;return n.value=i,n.fallback=!0,n}});function Kl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ql=B(`$ZodOptional`,(e,t)=>{Kc.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,$o(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$o(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Xo(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Kl(e,r)):Kl(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Jl=B(`$ZodExactOptional`,(e,t)=>{ql.init(e,t),$o(e._zod,`values`,()=>t.innerType._zod.values),$o(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Yl=B(`$ZodNullable`,(e,t)=>{Kc.init(e,t),$o(e._zod,`optin`,()=>t.innerType._zod.optin),$o(e._zod,`optout`,()=>t.innerType._zod.optout),$o(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Xo(e.source)}|null)$`):void 0}),$o(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Xl=B(`$ZodDefault`,(e,t)=>{Kc.init(e,t),e._zod.optin=`optional`,$o(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Zl(e,t)):Zl(r,t)}});function Zl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ql=B(`$ZodPrefault`,(e,t)=>{Kc.init(e,t),e._zod.optin=`optional`,$o(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$l=B(`$ZodNonOptional`,(e,t)=>{Kc.init(e,t),$o(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>eu(t,e)):eu(i,e)}});function eu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var tu=B(`$ZodCatch`,(e,t)=>{Kc.init(e,t),e._zod.optin=`optional`,$o(e._zod,`optout`,()=>t.innerType._zod.optout),$o(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Es(e,n,Go()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Es(e,n,Go()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),nu=B(`$ZodPipe`,(e,t)=>{Kc.init(e,t),$o(e._zod,`values`,()=>t.in._zod.values),$o(e._zod,`optin`,()=>t.in._zod.optin),$o(e._zod,`optout`,()=>t.out._zod.optout),$o(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ru(e,t.in,n)):ru(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ru(e,t.out,n)):ru(r,t.out,n)}});function ru(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var iu=B(`$ZodPreprocess`,(e,t)=>{nu.init(e,t)}),au=B(`$ZodReadonly`,(e,t)=>{Kc.init(e,t),$o(e._zod,`propValues`,()=>t.innerType._zod.propValues),$o(e._zod,`values`,()=>t.innerType._zod.values),$o(e._zod,`optin`,()=>t.innerType?._zod?.optin),$o(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ou):ou(r)}});function ou(e){return e.value=Object.freeze(e.value),e}var su=B(`$ZodLazy`,(e,t)=>{Kc.init(e,t),$o(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),$o(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),$o(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),$o(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),$o(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),cu=B(`$ZodCustom`,(e,t)=>{Dc.init(e,t),Kc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>lu(t,n,r,e));lu(i,n,r,e)}});function lu(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Os(e))}}var uu,du=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fu(){return new du}(uu=globalThis).__zod_globalRegistry??(uu.__zod_globalRegistry=fu());var pu=globalThis.__zod_globalRegistry;function mu(e,t){return new e({type:`string`,...fs(t)})}function hu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...fs(t)})}function gu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...fs(t)})}function _u(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...fs(t)})}function vu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...fs(t)})}function yu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...fs(t)})}function bu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...fs(t)})}function xu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...fs(t)})}function Su(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...fs(t)})}function Cu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...fs(t)})}function wu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...fs(t)})}function Tu(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...fs(t)})}function Eu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...fs(t)})}function Du(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...fs(t)})}function Ou(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...fs(t)})}function ku(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...fs(t)})}function Au(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...fs(t)})}function ju(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...fs(t)})}function Mu(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...fs(t)})}function Nu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...fs(t)})}function Pu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...fs(t)})}function Fu(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...fs(t)})}function Iu(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...fs(t)})}function Lu(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...fs(t)})}function Ru(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...fs(t)})}function zu(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...fs(t)})}function Bu(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...fs(t)})}function Vu(e,t){return new e({type:`number`,checks:[],...fs(t)})}function Hu(e,t){return new e({type:`number`,coerce:!0,checks:[],...fs(t)})}function Uu(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...fs(t)})}function Wu(e,t){return new e({type:`boolean`,...fs(t)})}function Gu(e,t){return new e({type:`undefined`,...fs(t)})}function Ku(e,t){return new e({type:`null`,...fs(t)})}function qu(e){return new e({type:`any`})}function Ju(e){return new e({type:`unknown`})}function Yu(e,t){return new e({type:`never`,...fs(t)})}function Xu(e,t){return new kc({check:`less_than`,...fs(t),value:e,inclusive:!1})}function Zu(e,t){return new kc({check:`less_than`,...fs(t),value:e,inclusive:!0})}function Qu(e,t){return new Ac({check:`greater_than`,...fs(t),value:e,inclusive:!1})}function $u(e,t){return new Ac({check:`greater_than`,...fs(t),value:e,inclusive:!0})}function ed(e,t){return new jc({check:`multiple_of`,...fs(t),value:e})}function td(e,t){return new Nc({check:`max_length`,...fs(t),maximum:e})}function nd(e,t){return new Pc({check:`min_length`,...fs(t),minimum:e})}function rd(e,t){return new Fc({check:`length_equals`,...fs(t),length:e})}function id(e,t){return new Lc({check:`string_format`,format:`regex`,...fs(t),pattern:e})}function ad(e){return new Rc({check:`string_format`,format:`lowercase`,...fs(e)})}function od(e){return new zc({check:`string_format`,format:`uppercase`,...fs(e)})}function sd(e,t){return new Bc({check:`string_format`,format:`includes`,...fs(t),includes:e})}function cd(e,t){return new Vc({check:`string_format`,format:`starts_with`,...fs(t),prefix:e})}function ld(e,t){return new Hc({check:`string_format`,format:`ends_with`,...fs(t),suffix:e})}function ud(e){return new Uc({check:`overwrite`,tx:e})}function dd(e){return ud(t=>t.normalize(e))}function fd(){return ud(e=>e.trim())}function pd(){return ud(e=>e.toLowerCase())}function md(){return ud(e=>e.toUpperCase())}function hd(){return ud(e=>rs(e))}function gd(e,t,n){return new e({type:`array`,element:t,...fs(n)})}function _d(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...fs(n)})}function vd(e,t){let n=yd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Os(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Os(r))}},e(t.value,t)),t);return n}function yd(e,t){let n=new Dc({check:`custom`,...fs(t)});return n._zod.check=e,n}function bd(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??pu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function xd(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,xd(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&wd(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Sd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
144
-
145
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Cd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ed(t,`input`,e.processors),output:Ed(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function wd(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return wd(r.element,n);if(r.type===`set`)return wd(r.valueType,n);if(r.type===`lazy`)return wd(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return wd(r.innerType,n);if(r.type===`intersection`)return wd(r.left,n)||wd(r.right,n);if(r.type===`record`||r.type===`map`)return wd(r.keyType,n)||wd(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:wd(r.in,n)||wd(r.out,n);if(r.type===`object`){for(let e in r.shape)if(wd(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(wd(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(wd(e,n))return!0;return!!(r.rest&&wd(r.rest,n))}return!1}var Td=(e,t={})=>n=>{let r=bd({...n,processors:t});return xd(e,r),Sd(r,e),Cd(r,e)},Ed=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=bd({...i??{},target:a,io:t,processors:n});return xd(e,o),Sd(o,e),Cd(o,e)},Dd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Od=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Dd[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},kd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ad=(e,t,n,r)=>{n.type=`boolean`},jd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Md=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Nd=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Pd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Fd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Id=(e,t,n,r)=>{n.not={}},Ld=(e,t,n,r)=>{},Rd=(e,t,n,r)=>{},zd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Bd=(e,t,n,r)=>{let i=e._zod.def,a=Ko(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Vd=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Hd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Ud=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Wd=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Gd=(e,t,n,r)=>{n.type=`boolean`},Kd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},qd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Jd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Xd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Zd=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=xd(a.element,t,{...r,path:[...r.path,`items`]})},Qd=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=xd(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=xd(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},$d=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>xd(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ef=(e,t,n,r)=>{let i=e._zod.def,a=xd(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=xd(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},tf=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>xd(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?xd(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},nf=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=xd(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=xd(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=xd(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},rf=(e,t,n,r)=>{let i=e._zod.def,a=xd(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},af=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},of=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},sf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},cf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},lf=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;xd(o,t,r);let s=t.seen.get(e);s.ref=o},uf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},df=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ff=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pf=(e,t,n,r)=>{let i=e._zod.innerType;xd(i,t,r);let a=t.seen.get(e);a.ref=i},mf={string:Od,number:kd,boolean:Ad,bigint:jd,symbol:Md,null:Nd,undefined:Pd,void:Fd,never:Id,any:Ld,unknown:Rd,date:zd,enum:Bd,literal:Vd,nan:Hd,template_literal:Ud,file:Wd,success:Gd,custom:Kd,function:qd,transform:Jd,map:Yd,set:Xd,array:Zd,object:Qd,union:$d,intersection:ef,tuple:tf,record:nf,nullable:rf,nonoptional:af,default:of,prefault:sf,catch:cf,pipe:lf,readonly:uf,promise:df,optional:ff,lazy:pf};function hf(e,t){if(`_idmap`in e){let n=e,r=bd({...t,processors:mf}),i={};for(let e of n._idmap.entries()){let[t,n]=e;xd(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Sd(r,n),a[t]=Cd(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=bd({...t,processors:mf});return xd(e,n),Sd(n,e),Cd(n,e)}var gf=B(`ZodISODateTime`,(e,t)=>{ol.init(e,t),Hf.init(e,t)});function _f(e){return Lu(gf,e)}var vf=B(`ZodISODate`,(e,t)=>{sl.init(e,t),Hf.init(e,t)});function yf(e){return Ru(vf,e)}var bf=B(`ZodISOTime`,(e,t)=>{cl.init(e,t),Hf.init(e,t)});function xf(e){return zu(bf,e)}var Sf=B(`ZodISODuration`,(e,t)=>{ll.init(e,t),Hf.init(e,t)});function Cf(e){return Bu(Sf,e)}var wf=B(`ZodError`,(e,t)=>{As.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ns(e,t)},flatten:{value:t=>Ms(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,qo,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,qo,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Tf=Ps(wf),Ef=Fs(wf),Df=Is(wf),Of=Rs(wf),kf=Bs(wf),Af=Vs(wf),jf=Hs(wf),Mf=Us(wf),Nf=Ws(wf),Pf=Gs(wf),Ff=Ks(wf),If=qs(wf),Lf=new WeakMap;function Rf(e,t,n){let r=Object.getPrototypeOf(e),i=Lf.get(r);if(i||(i=new Set,Lf.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var zf=B(`ZodType`,(e,t)=>(Kc.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ed(e,`input`),output:Ed(e,`output`)}}),e.toJSONSchema=Td(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Tf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Df(e,t,n),e.parseAsync=async(t,n)=>Ef(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Of(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>kf(e,t,n),e.decode=(t,n)=>Af(e,t,n),e.encodeAsync=async(t,n)=>jf(e,t,n),e.decodeAsync=async(t,n)=>Mf(e,t,n),e.safeEncode=(t,n)=>Nf(e,t,n),e.safeDecode=(t,n)=>Pf(e,t,n),e.safeEncodeAsync=async(t,n)=>Ff(e,t,n),e.safeDecodeAsync=async(t,n)=>If(e,t,n),Rf(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ts(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ds(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(rm(e,t))},superRefine(e,t){return this.check(im(e,t))},overwrite(e){return this.check(ud(e))},optional(){return Z(this)},exactOptional(){return Rp(this)},nullable(){return Bp(this)},nullish(){return Z(Bp(this))},nonoptional(e){return Kp(this,e)},array(){return G(this)},or(e){return J([this,e])},and(e){return kp(this,e)},transform(e){return Xp(this,Fp(e))},default(e){return Hp(this,e)},prefault(e){return Wp(this,e)},catch(e){return Jp(this,e)},pipe(e){return Xp(this,e)},readonly(){return $p(this)},describe(e){let t=this.clone();return pu.add(t,{description:e}),t},meta(...e){if(e.length===0)return pu.get(this);let t=this.clone();return pu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return pu.get(e)?.description},configurable:!0}),e)),Bf=B(`_ZodString`,(e,t)=>{qc.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Od(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Rf(e,`_ZodString`,{regex(...e){return this.check(id(...e))},includes(...e){return this.check(sd(...e))},startsWith(...e){return this.check(cd(...e))},endsWith(...e){return this.check(ld(...e))},min(...e){return this.check(nd(...e))},max(...e){return this.check(td(...e))},length(...e){return this.check(rd(...e))},nonempty(...e){return this.check(nd(1,...e))},lowercase(e){return this.check(ad(e))},uppercase(e){return this.check(od(e))},trim(){return this.check(fd())},normalize(...e){return this.check(dd(...e))},toLowerCase(){return this.check(pd())},toUpperCase(){return this.check(md())},slugify(){return this.check(hd())}})}),Vf=B(`ZodString`,(e,t)=>{qc.init(e,t),Bf.init(e,t),e.email=t=>e.check(hu(Uf,t)),e.url=t=>e.check(xu(qf,t)),e.jwt=t=>e.check(Iu(lp,t)),e.emoji=t=>e.check(Su(Yf,t)),e.guid=t=>e.check(gu(Gf,t)),e.uuid=t=>e.check(_u(Kf,t)),e.uuidv4=t=>e.check(vu(Kf,t)),e.uuidv6=t=>e.check(yu(Kf,t)),e.uuidv7=t=>e.check(bu(Kf,t)),e.nanoid=t=>e.check(Cu(Xf,t)),e.guid=t=>e.check(gu(Gf,t)),e.cuid=t=>e.check(wu(Zf,t)),e.cuid2=t=>e.check(Tu(Qf,t)),e.ulid=t=>e.check(Eu($f,t)),e.base64=t=>e.check(Nu(op,t)),e.base64url=t=>e.check(Pu(sp,t)),e.xid=t=>e.check(Du(ep,t)),e.ksuid=t=>e.check(Ou(tp,t)),e.ipv4=t=>e.check(ku(np,t)),e.ipv6=t=>e.check(Au(rp,t)),e.cidrv4=t=>e.check(ju(ip,t)),e.cidrv6=t=>e.check(Mu(ap,t)),e.e164=t=>e.check(Fu(cp,t)),e.datetime=t=>e.check(_f(t)),e.date=t=>e.check(yf(t)),e.time=t=>e.check(xf(t)),e.duration=t=>e.check(Cf(t))});function V(e){return mu(Vf,e)}var Hf=B(`ZodStringFormat`,(e,t)=>{Jc.init(e,t),Bf.init(e,t)}),Uf=B(`ZodEmail`,(e,t)=>{Zc.init(e,t),Hf.init(e,t)});function Wf(e){return hu(Uf,e)}var Gf=B(`ZodGUID`,(e,t)=>{Yc.init(e,t),Hf.init(e,t)}),Kf=B(`ZodUUID`,(e,t)=>{Xc.init(e,t),Hf.init(e,t)}),qf=B(`ZodURL`,(e,t)=>{Qc.init(e,t),Hf.init(e,t)});function Jf(e){return xu(qf,e)}var Yf=B(`ZodEmoji`,(e,t)=>{$c.init(e,t),Hf.init(e,t)}),Xf=B(`ZodNanoID`,(e,t)=>{el.init(e,t),Hf.init(e,t)}),Zf=B(`ZodCUID`,(e,t)=>{tl.init(e,t),Hf.init(e,t)}),Qf=B(`ZodCUID2`,(e,t)=>{nl.init(e,t),Hf.init(e,t)}),$f=B(`ZodULID`,(e,t)=>{rl.init(e,t),Hf.init(e,t)}),ep=B(`ZodXID`,(e,t)=>{il.init(e,t),Hf.init(e,t)}),tp=B(`ZodKSUID`,(e,t)=>{al.init(e,t),Hf.init(e,t)}),np=B(`ZodIPv4`,(e,t)=>{ul.init(e,t),Hf.init(e,t)}),rp=B(`ZodIPv6`,(e,t)=>{dl.init(e,t),Hf.init(e,t)}),ip=B(`ZodCIDRv4`,(e,t)=>{fl.init(e,t),Hf.init(e,t)}),ap=B(`ZodCIDRv6`,(e,t)=>{pl.init(e,t),Hf.init(e,t)}),op=B(`ZodBase64`,(e,t)=>{hl.init(e,t),Hf.init(e,t)}),sp=B(`ZodBase64URL`,(e,t)=>{_l.init(e,t),Hf.init(e,t)}),cp=B(`ZodE164`,(e,t)=>{vl.init(e,t),Hf.init(e,t)}),lp=B(`ZodJWT`,(e,t)=>{bl.init(e,t),Hf.init(e,t)}),up=B(`ZodNumber`,(e,t)=>{xl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kd(e,t,n,r),Rf(e,`ZodNumber`,{gt(e,t){return this.check(Qu(e,t))},gte(e,t){return this.check($u(e,t))},min(e,t){return this.check($u(e,t))},lt(e,t){return this.check(Xu(e,t))},lte(e,t){return this.check(Zu(e,t))},max(e,t){return this.check(Zu(e,t))},int(e){return this.check(fp(e))},safe(e){return this.check(fp(e))},positive(e){return this.check(Qu(0,e))},nonnegative(e){return this.check($u(0,e))},negative(e){return this.check(Xu(0,e))},nonpositive(e){return this.check(Zu(0,e))},multipleOf(e,t){return this.check(ed(e,t))},step(e,t){return this.check(ed(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function H(e){return Vu(up,e)}var dp=B(`ZodNumberFormat`,(e,t)=>{Sl.init(e,t),up.init(e,t)});function fp(e){return Uu(dp,e)}var pp=B(`ZodBoolean`,(e,t)=>{Cl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ad(e,t,n,r)});function U(e){return Wu(pp,e)}var mp=B(`ZodUndefined`,(e,t)=>{wl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pd(e,t,n,r)});function hp(e){return Gu(mp,e)}var gp=B(`ZodNull`,(e,t)=>{Tl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nd(e,t,n,r)});function _p(e){return Ku(gp,e)}var vp=B(`ZodAny`,(e,t)=>{El.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function yp(){return qu(vp)}var bp=B(`ZodUnknown`,(e,t)=>{Dl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function W(){return Ju(bp)}var xp=B(`ZodNever`,(e,t)=>{Ol.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Id(e,t,n,r)});function Sp(e){return Yu(xp,e)}var Cp=B(`ZodArray`,(e,t)=>{Al.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r),e.element=t.element,Rf(e,`ZodArray`,{min(e,t){return this.check(nd(e,t))},nonempty(e){return this.check(nd(1,e))},max(e,t){return this.check(td(e,t))},length(e,t){return this.check(rd(e,t))},unwrap(){return this.element}})});function G(e,t){return gd(Cp,e,t)}var wp=B(`ZodObject`,(e,t)=>{Fl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r),$o(e,`shape`,()=>t.shape),Rf(e,`ZodObject`,{keyof(){return Mp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:W()})},loose(){return this.clone({...this._zod.def,catchall:W()})},strict(){return this.clone({...this._zod.def,catchall:Sp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return _s(this,e)},safeExtend(e){return vs(this,e)},merge(e){return ys(this,e)},pick(e){return hs(this,e)},omit(e){return gs(this,e)},partial(...e){return bs(Ip,this,e[0])},required(...e){return xs(Gp,this,e[0])}})});function K(e,t){return new wp({type:`object`,shape:e??{},...fs(t)})}function q(e,t){return new wp({type:`object`,shape:e,catchall:W(),...fs(t)})}var Tp=B(`ZodUnion`,(e,t)=>{Ll.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.options=t.options});function J(e,t){return new Tp({type:`union`,options:e,...fs(t)})}var Ep=B(`ZodDiscriminatedUnion`,(e,t)=>{Tp.init(e,t),Rl.init(e,t)});function Dp(e,t,n){return new Ep({type:`union`,options:t,discriminator:e,...fs(n)})}var Op=B(`ZodIntersection`,(e,t)=>{zl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r)});function kp(e,t){return new Op({type:`intersection`,left:e,right:t})}var Ap=B(`ZodRecord`,(e,t)=>{Hl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,n){return!t||!t._zod?new Ap({type:`record`,keyType:V(),valueType:e,...fs(t)}):new Ap({type:`record`,keyType:e,valueType:t,...fs(n)})}var jp=B(`ZodEnum`,(e,t)=>{Ul.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bd(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new jp({...t,checks:[],...fs(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new jp({...t,checks:[],...fs(r),entries:i})}});function Mp(e,t){return new jp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...fs(t)})}var Np=B(`ZodLiteral`,(e,t)=>{Wl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vd(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new Np({type:`literal`,values:Array.isArray(e)?e:[e],...fs(t)})}var Pp=B(`ZodTransform`,(e,t)=>{Gl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jd(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Uo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Os(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Os(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Fp(e){return new Pp({type:`transform`,transform:e})}var Ip=B(`ZodOptional`,(e,t)=>{ql.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Z(e){return new Ip({type:`optional`,innerType:e})}var Lp=B(`ZodExactOptional`,(e,t)=>{Jl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rp(e){return new Lp({type:`optional`,innerType:e})}var zp=B(`ZodNullable`,(e,t)=>{Yl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bp(e){return new zp({type:`nullable`,innerType:e})}var Vp=B(`ZodDefault`,(e,t)=>{Xl.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Hp(e,t){return new Vp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():cs(t)}})}var Up=B(`ZodPrefault`,(e,t)=>{Ql.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wp(e,t){return new Up({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():cs(t)}})}var Gp=B(`ZodNonOptional`,(e,t)=>{$l.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kp(e,t){return new Gp({type:`nonoptional`,innerType:e,...fs(t)})}var qp=B(`ZodCatch`,(e,t)=>{tu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jp(e,t){return new qp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Yp=B(`ZodPipe`,(e,t)=>{nu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.in=t.in,e.out=t.out});function Xp(e,t){return new Yp({type:`pipe`,in:e,out:t})}var Zp=B(`ZodPreprocess`,(e,t)=>{Yp.init(e,t),iu.init(e,t)}),Qp=B(`ZodReadonly`,(e,t)=>{au.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $p(e){return new Qp({type:`readonly`,innerType:e})}var em=B(`ZodLazy`,(e,t)=>{su.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pf(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function tm(e){return new em({type:`lazy`,getter:e})}var nm=B(`ZodCustom`,(e,t)=>{cu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kd(e,t,n,r)});function rm(e,t={}){return _d(nm,e,t)}function im(e,t){return vd(e,t)}function am(e,t){return new Zp({type:`pipe`,in:Fp(e),out:t})}var om={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},sm;sm||={};function cm(e){return Hu(up,e)}var lm=`2025-11-25`,um=[lm,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],dm=`io.modelcontextprotocol/related-task`,fm=`io.modelcontextprotocol/protocolVersion`,pm=`io.modelcontextprotocol/clientInfo`,mm=`io.modelcontextprotocol/clientCapabilities`,hm=`io.modelcontextprotocol/subscriptionId`,gm=`io.modelcontextprotocol/logLevel`,_m=tm(()=>J([V(),H(),U(),_p(),Y(V(),_m),G(_m)])),vm=Y(V(),_m),ym=G(_m),bm=J([V(),H().int()]),xm=V(),Sm=K({ttl:H().optional()}),Cm=K({taskId:V()}),wm=q({progressToken:bm.optional(),[dm]:Cm.optional()}),Tm=K({_meta:wm.optional()}),Em=Tm.extend({task:Sm.optional()}),Dm=K({method:V(),params:Tm.loose().optional()}),Om=K({_meta:wm.optional()}),km=K({method:V(),params:Om.loose().optional()}),Am=q({_meta:wm.optional()}),jm=J([V(),H().int()]),Mm=K({jsonrpc:X(`2.0`),id:jm,...Dm.shape}).strict(),Nm=K({jsonrpc:X(`2.0`),...km.shape}).strict(),Pm=K({jsonrpc:X(`2.0`),id:jm,result:Am}).strict(),Fm=K({jsonrpc:X(`2.0`),id:jm.optional(),error:K({code:H().int(),message:V(),data:W().optional()})}).strict(),Im=J([Mm,Nm,Pm,Fm]),Lm=J([Pm,Fm]),Rm=Am.strict(),zm=Om.extend({requestId:jm.optional(),reason:V().optional()}),Bm=km.extend({method:X(`notifications/cancelled`),params:zm}),Vm=K({src:V(),mimeType:V().optional(),sizes:G(V()).optional(),theme:Mp([`light`,`dark`]).optional()}),Hm=K({icons:G(Vm).optional()}),Um=K({name:V(),title:V().optional()}),Wm=Um.extend({...Um.shape,...Hm.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),Gm=am(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,kp(K({form:kp(K({applyDefaults:U().optional()}),vm).optional(),url:vm.optional()}),vm.optional())),Km=q({list:vm.optional(),cancel:vm.optional(),requests:q({sampling:q({createMessage:vm.optional()}).optional(),elicitation:q({create:vm.optional()}).optional()}).optional()}),qm=q({list:vm.optional(),cancel:vm.optional(),requests:q({tools:q({call:vm.optional()}).optional()}).optional()}),Jm=K({experimental:Y(V(),vm).optional(),sampling:K({context:vm.optional(),tools:vm.optional()}).optional(),elicitation:Gm.optional(),roots:K({listChanged:U().optional()}).optional(),tasks:Km.optional(),extensions:Y(V(),vm).optional()}),Ym=Tm.extend({protocolVersion:V(),capabilities:Jm,clientInfo:Wm}),Xm=Dm.extend({method:X(`initialize`),params:Ym}),Zm=K({experimental:Y(V(),vm).optional(),logging:vm.optional(),completions:vm.optional(),prompts:K({listChanged:U().optional()}).optional(),resources:K({subscribe:U().optional(),listChanged:U().optional()}).optional(),tools:K({listChanged:U().optional()}).optional(),tasks:qm.optional(),extensions:Y(V(),vm).optional()}),Qm=Am.extend({protocolVersion:V(),capabilities:Zm,serverInfo:Wm,instructions:V().optional()}),$m=km.extend({method:X(`notifications/initialized`),params:Om.optional()}),eh=Dm.extend({method:X(`server/discover`),params:Tm.optional()}),th=Am.extend({supportedVersions:G(V()),capabilities:Zm,serverInfo:Wm,instructions:V().optional()}),nh=Dm.extend({method:X(`ping`),params:Tm.optional()}),rh=K({progress:H(),total:Z(H()),message:Z(V())}),ih=K({...Om.shape,...rh.shape,progressToken:bm}),ah=km.extend({method:X(`notifications/progress`),params:ih}),oh=Tm.extend({cursor:xm.optional()}),sh=Dm.extend({params:oh.optional()}),ch=Am.extend({nextCursor:xm.optional()}),lh=K({uri:V(),mimeType:Z(V()),_meta:Y(V(),W()).optional()}),uh=lh.extend({text:V()}),dh=V().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),fh=lh.extend({blob:dh}),ph=Mp([`user`,`assistant`]),mh=K({audience:G(ph).optional(),priority:H().min(0).max(1).optional(),lastModified:_f({offset:!0}).optional()}),hh=K({...Um.shape,...Hm.shape,uri:V(),description:Z(V()),mimeType:Z(V()),size:Z(H()),annotations:mh.optional(),_meta:Z(q({}))}),gh=K({...Um.shape,...Hm.shape,uriTemplate:V(),description:Z(V()),mimeType:Z(V()),annotations:mh.optional(),_meta:Z(q({}))}),_h=sh.extend({method:X(`resources/list`)}),vh=ch.extend({resources:G(hh)}),yh=sh.extend({method:X(`resources/templates/list`)}),bh=ch.extend({resourceTemplates:G(gh)}),xh=Tm.extend({uri:V()}),Sh=xh,Ch=Dm.extend({method:X(`resources/read`),params:Sh}),wh=Am.extend({contents:G(J([uh,fh]))}),Th=km.extend({method:X(`notifications/resources/list_changed`),params:Om.optional()}),Eh=xh,Dh=Dm.extend({method:X(`resources/subscribe`),params:Eh}),Oh=xh,kh=Dm.extend({method:X(`resources/unsubscribe`),params:Oh}),Ah=K({toolsListChanged:U().optional(),promptsListChanged:U().optional(),resourcesListChanged:U().optional(),resourceSubscriptions:G(V()).optional()}),jh=Tm.extend({notifications:Ah}),Mh=Dm.extend({method:X(`subscriptions/listen`),params:jh}),Nh=Om.extend({notifications:Ah}),Ph=km.extend({method:X(`notifications/subscriptions/acknowledged`),params:Nh}),Fh=q({[hm]:jm}),Ih=Am.extend({_meta:Fh}),Lh=Om.extend({uri:V()}),Rh=km.extend({method:X(`notifications/resources/updated`),params:Lh}),zh=K({name:V(),description:Z(V()),required:Z(U())}),Bh=K({...Um.shape,...Hm.shape,description:Z(V()),arguments:Z(G(zh)),_meta:Z(q({}))}),Vh=sh.extend({method:X(`prompts/list`)}),Hh=ch.extend({prompts:G(Bh)}),Uh=Tm.extend({name:V(),arguments:Y(V(),V()).optional()}),Wh=Dm.extend({method:X(`prompts/get`),params:Uh}),Gh=K({type:X(`text`),text:V(),annotations:mh.optional(),_meta:Y(V(),W()).optional()}),Kh=K({type:X(`image`),data:dh,mimeType:V(),annotations:mh.optional(),_meta:Y(V(),W()).optional()}),qh=K({type:X(`audio`),data:dh,mimeType:V(),annotations:mh.optional(),_meta:Y(V(),W()).optional()}),Jh=K({type:X(`tool_use`),name:V(),id:V(),input:Y(V(),W()),_meta:Y(V(),W()).optional()}),Yh=K({type:X(`resource`),resource:J([uh,fh]),annotations:mh.optional(),_meta:Y(V(),W()).optional()}),Xh=hh.extend({type:X(`resource_link`)}),Zh=J([Gh,Kh,qh,Xh,Yh]),Qh=K({role:ph,content:Zh}),$h=Am.extend({description:V().optional(),messages:G(Qh)}),eg=km.extend({method:X(`notifications/prompts/list_changed`),params:Om.optional()}),tg=K({title:V().optional(),readOnlyHint:U().optional(),destructiveHint:U().optional(),idempotentHint:U().optional(),openWorldHint:U().optional()}),ng=K({taskSupport:Mp([`required`,`optional`,`forbidden`]).optional()}),rg=K({...Um.shape,...Hm.shape,description:V().optional(),inputSchema:K({type:X(`object`),properties:Y(V(),_m).optional(),required:G(V()).optional()}).catchall(W()),outputSchema:q({$schema:V().optional()}).optional(),annotations:tg.optional(),execution:ng.optional(),_meta:Y(V(),W()).optional()}),ig=sh.extend({method:X(`tools/list`)}),ag=ch.extend({tools:G(rg)}),og=Am.extend({content:G(Zh).default([]),structuredContent:W().optional(),isError:U().optional()}),sg=og.or(Am.extend({toolResult:W()})),cg=Em.extend({name:V(),arguments:Y(V(),W()).optional()}),lg=Dm.extend({method:X(`tools/call`),params:cg}),ug=km.extend({method:X(`notifications/tools/list_changed`),params:Om.optional()}),dg=K({autoRefresh:U().default(!0),debounceMs:H().int().nonnegative().default(300)}),fg=Mp([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),pg=Tm.extend({level:fg}),mg=Dm.extend({method:X(`logging/setLevel`),params:pg}),hg=Om.extend({level:fg,logger:V().optional(),data:W()}),gg=km.extend({method:X(`notifications/message`),params:hg}),_g=K({name:V().optional()}),vg=K({hints:G(_g).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),yg=K({mode:Mp([`auto`,`required`,`none`]).optional()}),bg=K({type:X(`tool_result`),toolUseId:V().describe(`The unique identifier for the corresponding tool call.`),content:G(Zh),structuredContent:W().optional(),isError:U().optional(),_meta:Y(V(),W()).optional()}),xg=Dp(`type`,[Gh,Kh,qh]),Sg=Dp(`type`,[Gh,Kh,qh,Jh,bg]),Cg=K({role:ph,content:J([Sg,G(Sg)]),_meta:Y(V(),W()).optional()}),wg=Em.extend({messages:G(Cg),modelPreferences:vg.optional(),systemPrompt:V().optional(),includeContext:Mp([`none`,`thisServer`,`allServers`]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:G(V()).optional(),metadata:vm.optional(),tools:G(rg).optional(),toolChoice:yg.optional()}),Tg=Dm.extend({method:X(`sampling/createMessage`),params:wg}),Eg=Am.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`]).or(V())),role:ph,content:xg}),Dg=Am.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(V())),role:ph,content:J([Sg,G(Sg)])}),Og=K({type:X(`boolean`),title:V().optional(),description:V().optional(),default:U().optional()}),kg=K({type:X(`string`),title:V().optional(),description:V().optional(),minLength:H().optional(),maxLength:H().optional(),format:Mp([`email`,`uri`,`date`,`date-time`]).optional(),default:V().optional()}),Ag=K({type:Mp([`number`,`integer`]),title:V().optional(),description:V().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),jg=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),default:V().optional()}),Mg=K({type:X(`string`),title:V().optional(),description:V().optional(),oneOf:G(K({const:V(),title:V()})),default:V().optional()}),Ng=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),enumNames:G(V()).optional(),default:V().optional()}),Pg=J([jg,Mg]),Fg=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({type:X(`string`),enum:G(V())}),default:G(V()).optional()}),Ig=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({anyOf:G(K({const:V(),title:V()}))}),default:G(V()).optional()}),Lg=J([Fg,Ig]),Rg=J([Ng,Pg,Lg]),zg=J([Rg,Og,kg,Ag]),Bg=Em.extend({mode:X(`form`).optional(),message:V(),requestedSchema:K({type:X(`object`),properties:Y(V(),zg),required:G(V()).optional()}).catchall(W())}),Vg=Em.extend({mode:X(`url`),message:V(),elicitationId:V(),url:V().url()}),Hg=J([Bg,Vg]),Ug=Dm.extend({method:X(`elicitation/create`),params:Hg}),Wg=Om.extend({elicitationId:V()}),Gg=km.extend({method:X(`notifications/elicitation/complete`),params:Wg}),Kg=Am.extend({action:Mp([`accept`,`decline`,`cancel`]),content:am(e=>e===null?void 0:e,Y(V(),J([V(),H(),U(),G(V())])).optional())}),qg=K({type:X(`ref/resource`),uri:V()}),Jg=K({type:X(`ref/prompt`),name:V()}),Yg=Tm.extend({ref:J([Jg,qg]),argument:K({name:V(),value:V()}),context:K({arguments:Y(V(),V()).optional()}).optional()}),Xg=Dm.extend({method:X(`completion/complete`),params:Yg}),Zg=Am.extend({completion:q({values:G(V()).max(100),total:Z(H().int()),hasMore:Z(U())})}),Qg=K({uri:V().startsWith(`file://`),name:V().optional(),_meta:Y(V(),W()).optional()}),$g=Dm.extend({method:X(`roots/list`),params:Tm.optional()}),e_=Am.extend({roots:G(Qg)}),t_=km.extend({method:X(`notifications/roots/list_changed`),params:Om.optional()}),n_=q({ttl:H().optional(),pollInterval:H().optional()}),r_=Mp([`working`,`input_required`,`completed`,`failed`,`cancelled`]),i_=K({taskId:V(),status:r_,ttl:J([H(),_p()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:Z(H()),statusMessage:Z(V())}),a_=Am.extend({task:i_}),o_=Om.merge(i_),s_=km.extend({method:X(`notifications/tasks/status`),params:o_}),c_=Dm.extend({method:X(`tasks/get`),params:Tm.extend({taskId:V()})}),l_=Am.merge(i_),u_=Dm.extend({method:X(`tasks/result`),params:Tm.extend({taskId:V()})}),d_=Am.loose(),f_=sh.extend({method:X(`tasks/list`)}),p_=ch.extend({tasks:G(i_)}),m_=Dm.extend({method:X(`tasks/cancel`),params:Tm.extend({taskId:V()})}),h_=Am.merge(i_),g_=J([nh,Xm,eh,Xg,mg,Wh,Vh,_h,yh,Ch,Dh,kh,Mh,lg,ig]),__=J([Bm,ah,$m,t_]),v_=J([Rm,Eg,Dg,Kg,e_]),y_=J([nh,Tg,Ug,$g]),b_=J([Bm,ah,gg,Rh,Th,ug,eg,Ph,Gg]),x_=J([Rm,Qm,th,Zg,$h,Hh,vh,bh,wh,og,ag,Ih]),S_=Jf().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:om.custom,message:`URL must be parseable`,fatal:!0}),Vo}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),C_=q({resource:V().url(),authorization_servers:G(S_).optional(),jwks_uri:V().url().optional(),scopes_supported:G(V()).optional(),bearer_methods_supported:G(V()).optional(),resource_signing_alg_values_supported:G(V()).optional(),resource_name:V().optional(),resource_documentation:V().optional(),resource_policy_uri:V().url().optional(),resource_tos_uri:V().url().optional(),tls_client_certificate_bound_access_tokens:U().optional(),authorization_details_types_supported:G(V()).optional(),dpop_signing_alg_values_supported:G(V()).optional(),dpop_bound_access_tokens_required:U().optional()}),w_=q({issuer:V(),authorization_endpoint:S_,token_endpoint:S_,registration_endpoint:S_.optional(),scopes_supported:G(V()).optional(),response_types_supported:G(V()),response_modes_supported:G(V()).optional(),grant_types_supported:G(V()).optional(),token_endpoint_auth_methods_supported:G(V()).optional(),token_endpoint_auth_signing_alg_values_supported:G(V()).optional(),service_documentation:S_.optional(),revocation_endpoint:S_.optional(),revocation_endpoint_auth_methods_supported:G(V()).optional(),revocation_endpoint_auth_signing_alg_values_supported:G(V()).optional(),introspection_endpoint:V().optional(),introspection_endpoint_auth_methods_supported:G(V()).optional(),introspection_endpoint_auth_signing_alg_values_supported:G(V()).optional(),code_challenge_methods_supported:G(V()).optional(),client_id_metadata_document_supported:U().optional(),authorization_response_iss_parameter_supported:U().optional().catch(void 0)}),T_=q({issuer:V(),authorization_endpoint:S_,token_endpoint:S_,userinfo_endpoint:S_.optional(),jwks_uri:S_,registration_endpoint:S_.optional(),scopes_supported:G(V()).optional(),response_types_supported:G(V()),response_modes_supported:G(V()).optional(),grant_types_supported:G(V()).optional(),acr_values_supported:G(V()).optional(),subject_types_supported:G(V()),id_token_signing_alg_values_supported:G(V()),id_token_encryption_alg_values_supported:G(V()).optional(),id_token_encryption_enc_values_supported:G(V()).optional(),userinfo_signing_alg_values_supported:G(V()).optional(),userinfo_encryption_alg_values_supported:G(V()).optional(),userinfo_encryption_enc_values_supported:G(V()).optional(),request_object_signing_alg_values_supported:G(V()).optional(),request_object_encryption_alg_values_supported:G(V()).optional(),request_object_encryption_enc_values_supported:G(V()).optional(),token_endpoint_auth_methods_supported:G(V()).optional(),token_endpoint_auth_signing_alg_values_supported:G(V()).optional(),display_values_supported:G(V()).optional(),claim_types_supported:G(V()).optional(),claims_supported:G(V()).optional(),service_documentation:V().optional(),claims_locales_supported:G(V()).optional(),ui_locales_supported:G(V()).optional(),claims_parameter_supported:U().optional(),request_parameter_supported:U().optional(),request_uri_parameter_supported:U().optional(),require_request_uri_registration:U().optional(),op_policy_uri:S_.optional(),op_tos_uri:S_.optional(),client_id_metadata_document_supported:U().optional(),authorization_response_iss_parameter_supported:U().optional().catch(void 0)}),E_=K({...T_.shape,...w_.pick({code_challenge_methods_supported:!0}).shape}),D_=K({access_token:V(),id_token:V().optional(),token_type:V(),expires_in:cm().optional(),scope:V().optional(),refresh_token:V().optional()}).strip(),O_=K({issued_token_type:X(`urn:ietf:params:oauth:token-type:id-jag`),access_token:V(),token_type:V().optional(),expires_in:H().optional(),scope:V().optional()}).strip(),k_=K({error:V(),error_description:V().optional(),error_uri:V().optional()}),A_=S_.optional().or(X(``).transform(()=>void 0)),j_=K({redirect_uris:G(S_),token_endpoint_auth_method:V().optional(),grant_types:G(V()).optional(),response_types:G(V()).optional(),application_type:V().optional(),client_name:V().optional(),client_uri:S_.optional(),logo_uri:A_,scope:V().optional(),contacts:G(V()).optional(),tos_uri:A_,policy_uri:V().optional(),jwks_uri:S_.optional(),jwks:yp().optional(),software_id:V().optional(),software_version:V().optional(),software_statement:V().optional()}).strip(),M_=K({client_id:V(),client_secret:V().optional(),client_id_issued_at:H().optional(),client_secret_expires_at:H().optional()}).strip(),N_=j_.merge(M_),P_=K({error:V(),error_description:V().optional()}).strip(),F_=K({token:V(),token_type_hint:V().optional()}).strip(),I_=Symbol.for(`mcp.sdk.errorBrands`);function L_(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,I_,{value:n,enumerable:!1,configurable:!0})}function R_(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,I_)){let n=t[I_];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var z_=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e}({}),B_=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,L_(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},V_=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),H_=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,L_(this,new.target)}},U_=class extends H_{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function W_(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function G_({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var K_=`2026-07-28`,q_=[K_];function J_(e){return e>=K_}function Y_(e){return e.filter(e=>!J_(e))}function X_(e){return e.filter(e=>J_(e))}function Z_(e){let t=e.structuredContent;return t===void 0||!(typeof t!=`object`||!t||Array.isArray(t))||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Q_=[`task`,`inputRequests`,`requestState`];function $_(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Q_.some(t=>t in e)?e:{...e,content:[]}}function ev(){let e=tm(()=>J([V(),H(),U(),_p(),Y(V(),e),G(e)])),t=Y(V(),e),n=J([V(),H().int()]),r=V(),i=K({ttl:H().optional()}),a=K({taskId:V()}),o=q({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=K({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=K({method:V(),params:s.loose().optional()}),u=K({_meta:o.optional()}),d=K({method:V(),params:u.loose().optional()}),f=q({_meta:o.optional()}),p=J([V(),H().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:V().optional()}),g=d.extend({method:X(`notifications/cancelled`),params:h}),_=K({src:V(),mimeType:V().optional(),sizes:G(V()).optional(),theme:Mp([`light`,`dark`]).optional()}),v=K({icons:G(_).optional()}),y=K({name:V(),title:V().optional()}),b=y.extend({...y.shape,...v.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),x=am(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,kp(K({form:kp(K({applyDefaults:U().optional()}),t).optional(),url:t.optional()}),t.optional())),S=q({list:t.optional(),cancel:t.optional(),requests:q({sampling:q({createMessage:t.optional()}).optional(),elicitation:q({create:t.optional()}).optional()}).optional()}),C=q({list:t.optional(),cancel:t.optional(),requests:q({tools:q({call:t.optional()}).optional()}).optional()}),w=K({experimental:Y(V(),t).optional(),sampling:K({context:t.optional(),tools:t.optional()}).optional(),elicitation:x.optional(),roots:K({listChanged:U().optional()}).optional(),tasks:S.optional(),extensions:Y(V(),t).optional()}),T=s.extend({protocolVersion:V(),capabilities:w,clientInfo:b}),ee=l.extend({method:X(`initialize`),params:T}),E=K({experimental:Y(V(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:K({listChanged:U().optional()}).optional(),resources:K({subscribe:U().optional(),listChanged:U().optional()}).optional(),tools:K({listChanged:U().optional()}).optional(),tasks:C.optional(),extensions:Y(V(),t).optional()}),D=f.extend({protocolVersion:V(),capabilities:E,serverInfo:b,instructions:V().optional()}),te=d.extend({method:X(`notifications/initialized`),params:u.optional()}),ne=l.extend({method:X(`ping`),params:s.optional()}),O=K({progress:H(),total:Z(H()),message:Z(V())}),re=K({...u.shape,...O.shape,progressToken:n}),k=d.extend({method:X(`notifications/progress`),params:re}),ie=s.extend({cursor:r.optional()}),A=l.extend({params:ie.optional()}),j=f.extend({nextCursor:r.optional()}),M=K({uri:V(),mimeType:Z(V()),_meta:Y(V(),W()).optional()}),ae=M.extend({text:V()}),oe=V().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),se=M.extend({blob:oe}),N=Mp([`user`,`assistant`]),P=K({audience:G(N).optional(),priority:H().min(0).max(1).optional(),lastModified:_f({offset:!0}).optional()}),ce=K({...y.shape,...v.shape,uri:V(),description:Z(V()),mimeType:Z(V()),size:Z(H()),annotations:P.optional(),_meta:Z(q({}))}),le=K({...y.shape,...v.shape,uriTemplate:V(),description:Z(V()),mimeType:Z(V()),annotations:P.optional(),_meta:Z(q({}))}),ue=A.extend({method:X(`resources/list`)}),de=j.extend({resources:G(ce)}),fe=A.extend({method:X(`resources/templates/list`)}),pe=j.extend({resourceTemplates:G(le)}),me=s.extend({uri:V()}),he=me,ge=l.extend({method:X(`resources/read`),params:he}),_e=f.extend({contents:G(J([ae,se]))}),ve=d.extend({method:X(`notifications/resources/list_changed`),params:u.optional()}),ye=me,be=l.extend({method:X(`resources/subscribe`),params:ye}),F=me,xe=l.extend({method:X(`resources/unsubscribe`),params:F}),Se=u.extend({uri:V()}),Ce=d.extend({method:X(`notifications/resources/updated`),params:Se}),we=K({name:V(),description:Z(V()),required:Z(U())}),Te=K({...y.shape,...v.shape,description:Z(V()),arguments:Z(G(we)),_meta:Z(q({}))}),Ee=A.extend({method:X(`prompts/list`)}),De=j.extend({prompts:G(Te)}),Oe=s.extend({name:V(),arguments:Y(V(),V()).optional()}),ke=l.extend({method:X(`prompts/get`),params:Oe}),Ae=K({type:X(`text`),text:V(),annotations:P.optional(),_meta:Y(V(),W()).optional()}),je=K({type:X(`image`),data:oe,mimeType:V(),annotations:P.optional(),_meta:Y(V(),W()).optional()}),Me=K({type:X(`audio`),data:oe,mimeType:V(),annotations:P.optional(),_meta:Y(V(),W()).optional()}),Ne=K({type:X(`tool_use`),name:V(),id:V(),input:Y(V(),W()),_meta:Y(V(),W()).optional()}),Pe=K({type:X(`resource`),resource:J([ae,se]),annotations:P.optional(),_meta:Y(V(),W()).optional()}),Fe=ce.extend({type:X(`resource_link`)}),Ie=J([Ae,je,Me,Fe,Pe]),Le=K({role:N,content:Ie}),Re=f.extend({description:V().optional(),messages:G(Le)}),ze=d.extend({method:X(`notifications/prompts/list_changed`),params:u.optional()}),Be=K({title:V().optional(),readOnlyHint:U().optional(),destructiveHint:U().optional(),idempotentHint:U().optional(),openWorldHint:U().optional()}),Ve=K({taskSupport:Mp([`required`,`optional`,`forbidden`]).optional()}),He=K({...y.shape,...v.shape,description:V().optional(),inputSchema:K({type:X(`object`),properties:Y(V(),e).optional(),required:G(V()).optional()}).catchall(W()),outputSchema:K({type:X(`object`),properties:Y(V(),e).optional(),required:G(V()).optional()}).catchall(W()).optional(),annotations:Be.optional(),execution:Ve.optional(),_meta:Y(V(),W()).optional()}),Ue=A.extend({method:X(`tools/list`)}),We=j.extend({tools:G(He)}),Ge=f.extend({content:G(Ie),structuredContent:Y(V(),W()).optional(),isError:U().optional()}),Ke=c.extend({name:V(),arguments:Y(V(),W()).optional()}),qe=l.extend({method:X(`tools/call`),params:Ke}),Je=d.extend({method:X(`notifications/tools/list_changed`),params:u.optional()}),Ye=Mp([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Xe=s.extend({level:Ye}),Ze=l.extend({method:X(`logging/setLevel`),params:Xe}),Qe=u.extend({level:Ye,logger:V().optional(),data:W()}),$e=d.extend({method:X(`notifications/message`),params:Qe}),et=K({name:V().optional()}),tt=K({hints:G(et).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),nt=K({mode:Mp([`auto`,`required`,`none`]).optional()}),rt=K({type:X(`tool_result`),toolUseId:V().describe(`The unique identifier for the corresponding tool call.`),content:G(Ie),structuredContent:K({}).loose().optional(),isError:U().optional(),_meta:Y(V(),W()).optional()}),it=Dp(`type`,[Ae,je,Me]),at=Dp(`type`,[Ae,je,Me,Ne,rt]),ot=K({role:N,content:J([at,G(at)]),_meta:Y(V(),W()).optional()}),st=c.extend({messages:G(ot),modelPreferences:tt.optional(),systemPrompt:V().optional(),includeContext:Mp([`none`,`thisServer`,`allServers`]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:G(V()).optional(),metadata:t.optional(),tools:G(He).optional(),toolChoice:nt.optional()}),ct=l.extend({method:X(`sampling/createMessage`),params:st}),lt=f.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`]).or(V())),role:N,content:it}),ut=f.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(V())),role:N,content:J([at,G(at)])}),dt=K({type:X(`boolean`),title:V().optional(),description:V().optional(),default:U().optional()}),ft=K({type:X(`string`),title:V().optional(),description:V().optional(),minLength:H().optional(),maxLength:H().optional(),format:Mp([`email`,`uri`,`date`,`date-time`]).optional(),default:V().optional()}),I=K({type:Mp([`number`,`integer`]),title:V().optional(),description:V().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),pt=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),default:V().optional()}),mt=K({type:X(`string`),title:V().optional(),description:V().optional(),oneOf:G(K({const:V(),title:V()})),default:V().optional()}),ht=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),enumNames:G(V()).optional(),default:V().optional()}),gt=J([pt,mt]),_t=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({type:X(`string`),enum:G(V())}),default:G(V()).optional()}),vt=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({anyOf:G(K({const:V(),title:V()}))}),default:G(V()).optional()}),yt=J([_t,vt]),bt=J([ht,gt,yt]),xt=J([bt,dt,ft,I]),St=c.extend({mode:X(`form`).optional(),message:V(),requestedSchema:K({type:X(`object`),properties:Y(V(),xt),required:G(V()).optional()}).catchall(W())}),Ct=c.extend({mode:X(`url`),message:V(),elicitationId:V(),url:V().url()}),wt=J([St,Ct]),Tt=l.extend({method:X(`elicitation/create`),params:wt}),Et=u.extend({elicitationId:V()}),Dt=d.extend({method:X(`notifications/elicitation/complete`),params:Et}),Ot=f.extend({action:Mp([`accept`,`decline`,`cancel`]),content:am(e=>e===null?void 0:e,Y(V(),J([V(),H(),U(),G(V())])).optional())}),kt=K({type:X(`ref/resource`),uri:V()}),At=K({type:X(`ref/prompt`),name:V()}),jt=s.extend({ref:J([At,kt]),argument:K({name:V(),value:V()}),context:K({arguments:Y(V(),V()).optional()}).optional()}),Mt=l.extend({method:X(`completion/complete`),params:jt}),Nt=f.extend({completion:q({values:G(V()).max(100),total:Z(H().int()),hasMore:Z(U())})}),Pt=K({uri:V().startsWith(`file://`),name:V().optional(),_meta:Y(V(),W()).optional()}),Ft=l.extend({method:X(`roots/list`),params:s.optional()}),It=f.extend({roots:G(Pt)}),Lt=d.extend({method:X(`notifications/roots/list_changed`),params:u.optional()}),Rt=q({ttl:H().optional(),pollInterval:H().optional()}),zt=Mp([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Bt=K({taskId:V(),status:zt,ttl:J([H(),_p()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:Z(H()),statusMessage:Z(V())}),Vt=f.extend({task:Bt}),Ht=u.merge(Bt),Ut=d.extend({method:X(`notifications/tasks/status`),params:Ht}),Wt=l.extend({method:X(`tasks/get`),params:s.extend({taskId:V()})}),Gt=f.merge(Bt),Kt=l.extend({method:X(`tasks/result`),params:s.extend({taskId:V()})}),qt=f.loose(),Jt=A.extend({method:X(`tasks/list`)}),Yt=j.extend({tasks:G(Bt)}),Xt=l.extend({method:X(`tasks/cancel`),params:s.extend({taskId:V()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:v,BaseMetadataSchema:y,ImplementationSchema:b,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:C,ClientCapabilitiesSchema:w,InitializeRequestParamsSchema:T,InitializeRequestSchema:ee,ServerCapabilitiesSchema:E,InitializeResultSchema:D,InitializedNotificationSchema:te,PingRequestSchema:ne,ProgressSchema:O,ProgressNotificationParamsSchema:re,ProgressNotificationSchema:k,PaginatedRequestParamsSchema:ie,PaginatedRequestSchema:A,PaginatedResultSchema:j,ResourceContentsSchema:M,TextResourceContentsSchema:ae,BlobResourceContentsSchema:se,RoleSchema:N,AnnotationsSchema:P,ResourceSchema:ce,ResourceTemplateSchema:le,ListResourcesRequestSchema:ue,ListResourcesResultSchema:de,ListResourceTemplatesRequestSchema:fe,ListResourceTemplatesResultSchema:pe,ResourceRequestParamsSchema:me,ReadResourceRequestParamsSchema:he,ReadResourceRequestSchema:ge,ReadResourceResultSchema:_e,ResourceListChangedNotificationSchema:ve,SubscribeRequestParamsSchema:ye,SubscribeRequestSchema:be,UnsubscribeRequestParamsSchema:F,UnsubscribeRequestSchema:xe,ResourceUpdatedNotificationParamsSchema:Se,ResourceUpdatedNotificationSchema:Ce,PromptArgumentSchema:we,PromptSchema:Te,ListPromptsRequestSchema:Ee,ListPromptsResultSchema:De,GetPromptRequestParamsSchema:Oe,GetPromptRequestSchema:ke,TextContentSchema:Ae,ImageContentSchema:je,AudioContentSchema:Me,ToolUseContentSchema:Ne,EmbeddedResourceSchema:Pe,ResourceLinkSchema:Fe,ContentBlockSchema:Ie,PromptMessageSchema:Le,GetPromptResultSchema:Re,PromptListChangedNotificationSchema:ze,ToolAnnotationsSchema:Be,ToolExecutionSchema:Ve,ToolSchema:He,ListToolsRequestSchema:Ue,ListToolsResultSchema:We,CallToolResultSchema:Ge,CallToolRequestParamsSchema:Ke,CallToolRequestSchema:qe,ToolListChangedNotificationSchema:Je,LoggingLevelSchema:Ye,SetLevelRequestParamsSchema:Xe,SetLevelRequestSchema:Ze,LoggingMessageNotificationParamsSchema:Qe,LoggingMessageNotificationSchema:$e,ModelHintSchema:et,ModelPreferencesSchema:tt,ToolChoiceSchema:nt,ToolResultContentSchema:rt,SamplingContentSchema:it,SamplingMessageContentBlockSchema:at,SamplingMessageSchema:ot,CreateMessageRequestParamsSchema:st,CreateMessageRequestSchema:ct,CreateMessageResultSchema:lt,CreateMessageResultWithToolsSchema:ut,BooleanSchemaSchema:dt,StringSchemaSchema:ft,NumberSchemaSchema:I,UntitledSingleSelectEnumSchemaSchema:pt,TitledSingleSelectEnumSchemaSchema:mt,LegacyTitledEnumSchemaSchema:ht,SingleSelectEnumSchemaSchema:gt,UntitledMultiSelectEnumSchemaSchema:_t,TitledMultiSelectEnumSchemaSchema:vt,MultiSelectEnumSchemaSchema:yt,EnumSchemaSchema:bt,PrimitiveSchemaDefinitionSchema:xt,ElicitRequestFormParamsSchema:St,ElicitRequestURLParamsSchema:Ct,ElicitRequestParamsSchema:wt,ElicitRequestSchema:Tt,ElicitationCompleteNotificationParamsSchema:Et,ElicitationCompleteNotificationSchema:Dt,ElicitResultSchema:Ot,ResourceTemplateReferenceSchema:kt,PromptReferenceSchema:At,CompleteRequestParamsSchema:jt,CompleteRequestSchema:Mt,CompleteResultSchema:Nt,RootSchema:Pt,ListRootsRequestSchema:Ft,ListRootsResultSchema:It,RootsListChangedNotificationSchema:Lt,TaskCreationParamsSchema:Rt,TaskStatusSchema:zt,TaskSchema:Bt,CreateTaskResultSchema:Vt,TaskStatusNotificationParamsSchema:Ht,TaskStatusNotificationSchema:Ut,GetTaskRequestSchema:Wt,GetTaskResultSchema:Gt,GetTaskPayloadRequestSchema:Kt,GetTaskPayloadResultSchema:qt,ListTasksRequestSchema:Jt,ListTasksResultSchema:Yt,CancelTaskRequestSchema:Xt,CancelTaskResultSchema:f.merge(Bt),ClientRequestSchema:J([ne,ee,Mt,Ze,ke,Ee,ue,fe,ge,be,xe,qe,Ue,Wt,Kt,Jt,Xt]),ClientNotificationSchema:J([g,k,te,Lt,Ut]),ClientResultSchema:J([m,lt,ut,Ot,It,Gt,Yt,Vt]),ServerRequestSchema:J([ne,ct,Tt,Ft,Wt,Kt,Jt,Xt]),ServerNotificationSchema:J([g,k,$e,Ce,ve,Je,ze,Ut,Dt]),ServerResultSchema:J([m,D,Nt,Re,De,de,pe,_e,Ge,We,Gt,Yt,Vt]),CallToolResultWireSchema:W().superRefine((e,t)=>{if(!(typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0)){for(let n of Q_)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform($_).pipe(Ge)}}var tv;function nv(){return tv??=ev()}function rv(e){return e.type!==`object`}var iv=new Set([`const`,`enum`,`default`,`examples`]),av=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`]);function ov(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(e.$id!==void 0)return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=(e,t)=>{if(Array.isArray(e))return e.map(e=>n(e,!1));if(typeof e!=`object`||!e||!t&&e.$id!==void 0)return e;let r={};for(let[i,a]of Object.entries(e))t?r[i]=n(a,!1):(i===`$ref`||i===`$dynamicRef`)&&typeof a==`string`?r[i]=a===`#`?`#/properties/result`:a.startsWith(`#/`)?`#/properties/result${a.slice(1)}`:a:iv.has(i)?r[i]=a:av.has(i)?r[i]=n(a,!0):r[i]=n(a,!1);return r};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:n(e,!1)},required:[`result`]}}var sv={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},cv={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},lv={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},uv;function dv(){if(uv)return uv;let e=nv();return uv={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},uv}function fv(e){return Object.prototype.hasOwnProperty.call(sv,e)}function pv(e){return Object.prototype.hasOwnProperty.call(cv,e)}function mv(e){return Object.prototype.hasOwnProperty.call(lv,e)}function hv(e){return mv(e)?dv().resultSchemas[e]:void 0}function gv(e){return fv(e)?dv().requestSchemas[e]:void 0}function _v(e){return pv(e)?dv().notificationSchemas[e]:void 0}function vv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yv(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var bv={ok:!1,reason:`not-in-era`};function xv(e){return vv(e)&&vv(e.outputSchema)&&rv(e.outputSchema)}function Sv(e){return e}var Cv={era:`2025-11-25`,hasRequestMethod:fv,hasNotificationMethod:pv,validateRequest:(e,t)=>yv(gv(e),t),validateResult:(e,t)=>yv(hv(e),t),validateNotification:(e,t)=>yv(_v(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>bv,validateInputResponse:()=>bv,samplingResultVariant:((e,t)=>{let n=nv();return yv(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Z_(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&rv(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(vv(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Sv(e)}}return{kind:`complete`,result:Sv(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>xv(e))?t:{...t,tools:n.map(e=>xv(e)?{...e,outputSchema:ov(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function wv(){let e=tm(()=>J([V(),H(),U(),_p(),Y(V(),e),G(e)])),t=Y(V(),e),n=J([V(),H().int()]),r=V(),i=J([V(),H().int()]),a=Mp([`user`,`assistant`]),o=Mp([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=V().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=K({ttl:H().optional()}),l=K({taskId:V()}),u=q({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=K({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=K({_meta:u.optional()}),m=K({method:V(),params:p.loose().optional()}),h=K({src:V(),mimeType:V().optional(),sizes:G(V()).optional(),theme:Mp([`light`,`dark`]).optional()}),g=K({icons:G(h).optional()}),_=K({name:V(),title:V().optional()}),v=_.extend({..._.shape,...g.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),y=am(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,kp(K({form:kp(K({applyDefaults:U().optional()}),t).optional(),url:t.optional()}),t.optional())),b=q({list:t.optional(),cancel:t.optional(),requests:q({sampling:q({createMessage:t.optional()}).optional(),elicitation:q({create:t.optional()}).optional()}).optional()}),x=q({list:t.optional(),cancel:t.optional(),requests:q({tools:q({call:t.optional()}).optional()}).optional()}),S=K({experimental:Y(V(),t).optional(),sampling:K({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:K({listChanged:U().optional()}).optional(),tasks:b.optional(),extensions:Y(V(),t).optional()}),C=K({experimental:Y(V(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:K({listChanged:U().optional()}).optional(),resources:K({subscribe:U().optional(),listChanged:U().optional()}).optional(),tools:K({listChanged:U().optional()}).optional(),tasks:x.optional(),extensions:Y(V(),t).optional()}),w=K({progress:H(),total:Z(H()),message:Z(V())}),T=K({...p.shape,...w.shape,progressToken:n}),ee=m.extend({method:X(`notifications/progress`),params:T}),E=p.extend({level:o,logger:V().optional(),data:W()}),D=m.extend({method:X(`notifications/message`),params:E}),te=K({uri:V(),mimeType:Z(V()),_meta:Y(V(),W()).optional()}),ne=te.extend({text:V()}),O=te.extend({blob:s}),re=K({audience:G(a).optional(),priority:H().min(0).max(1).optional(),lastModified:_f({offset:!0}).optional()}),k=K({..._.shape,...g.shape,uri:V(),description:Z(V()),mimeType:Z(V()),size:Z(H()),annotations:re.optional(),_meta:Z(q({}))}),ie=K({..._.shape,...g.shape,uriTemplate:V(),description:Z(V()),mimeType:Z(V()),annotations:re.optional(),_meta:Z(q({}))}),A=m.extend({method:X(`notifications/resources/list_changed`),params:p.optional()}),j=p.extend({uri:V()}),M=m.extend({method:X(`notifications/resources/updated`),params:j}),ae=K({name:V(),description:Z(V()),required:Z(U())}),oe=K({..._.shape,...g.shape,description:Z(V()),arguments:Z(G(ae)),_meta:Z(q({}))}),se=m.extend({method:X(`notifications/prompts/list_changed`),params:p.optional()}),N=K({type:X(`text`),text:V(),annotations:re.optional(),_meta:Y(V(),W()).optional()}),P=K({type:X(`image`),data:s,mimeType:V(),annotations:re.optional(),_meta:Y(V(),W()).optional()}),ce=K({type:X(`audio`),data:s,mimeType:V(),annotations:re.optional(),_meta:Y(V(),W()).optional()}),le=K({type:X(`tool_use`),name:V(),id:V(),input:Y(V(),W()),_meta:Y(V(),W()).optional()}),ue=K({type:X(`resource`),resource:J([ne,O]),annotations:re.optional(),_meta:Y(V(),W()).optional()}),de=k.extend({type:X(`resource_link`)}),fe=J([N,P,ce,de,ue]),pe=K({role:a,content:fe}),me=K({title:V().optional(),readOnlyHint:U().optional(),destructiveHint:U().optional(),idempotentHint:U().optional(),openWorldHint:U().optional()}),he=m.extend({method:X(`notifications/tools/list_changed`),params:p.optional()}),ge=K({name:V().optional()}),_e=K({hints:G(ge).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),ve=K({mode:Mp([`auto`,`required`,`none`]).optional()}),ye=K({type:X(`boolean`),title:V().optional(),description:V().optional(),default:U().optional()}),be=K({type:X(`string`),title:V().optional(),description:V().optional(),minLength:H().optional(),maxLength:H().optional(),format:Mp([`email`,`uri`,`date`,`date-time`]).optional(),default:V().optional()}),F=K({type:Mp([`number`,`integer`]),title:V().optional(),description:V().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),xe=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),default:V().optional()}),Se=K({type:X(`string`),title:V().optional(),description:V().optional(),oneOf:G(K({const:V(),title:V()})),default:V().optional()}),Ce=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),enumNames:G(V()).optional(),default:V().optional()}),we=J([xe,Se]),Te=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({type:X(`string`),enum:G(V())}),default:G(V()).optional()}),Ee=K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({anyOf:G(K({const:V(),title:V()}))}),default:G(V()).optional()}),De=J([Te,Ee]),Oe=J([Ce,we,De]),ke=J([Oe,ye,be,F]),Ae=f.extend({mode:X(`form`).optional(),message:V(),requestedSchema:K({type:X(`object`),properties:Y(V(),ke),required:G(V()).optional()}).catchall(W())}),je=K({type:X(`ref/resource`),uri:V()}),Me=K({type:X(`ref/prompt`),name:V()}),Ne=K({uri:V().startsWith(`file://`),name:V().optional(),_meta:Y(V(),W()).optional()}),Pe=S.shape,Fe=K({experimental:Pe.experimental,sampling:Pe.sampling,elicitation:Pe.elicitation,roots:Pe.roots,extensions:Pe.extensions}),Ie=C.shape,Le=K({experimental:Ie.experimental,logging:Ie.logging,completions:Ie.completions,prompts:Ie.prompts,resources:Ie.resources,tools:Ie.tools,extensions:Ie.extensions}),Re=q({progressToken:n.optional(),[fm]:V(),[pm]:v,[mm]:Fe,[gm]:o.optional()}),ze=K({..._.shape,...g.shape,description:V().optional(),inputSchema:q({$schema:V().optional(),type:X(`object`)}),outputSchema:q({$schema:V().optional()}).optional(),annotations:me.optional(),_meta:Y(V(),W()).optional()}),Be=K({type:X(`tool_result`),toolUseId:V(),content:G(fe),structuredContent:W().optional(),isError:U().optional(),_meta:Y(V(),W()).optional()}),Ve=J([N,P,ce,le,Be]),He=K({role:a,content:J([Ve,G(Ve)]),_meta:Y(V(),W()).optional()}),Ue=V(),We=Y(V(),W()).optional();function Ge(e){return q({_meta:We,resultType:Ue.default(`complete`),...e})}let Ke=Ge({}),qe=Ge({nextCursor:r.optional()}),Je=Ge({content:G(fe),structuredContent:W().optional(),isError:U().optional()}),Ye=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),tools:G(ze),nextCursor:r.optional()}),Xe=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),prompts:G(oe),nextCursor:r.optional()}),Ze=Ge({description:V().optional(),messages:G(pe)}),Qe=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),resources:G(k),nextCursor:r.optional()}),$e=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),resourceTemplates:G(ie),nextCursor:r.optional()}),et=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),contents:G(J([ne,O]))}),tt=Ge({completion:K({values:G(V()).max(100),total:H().int().optional(),hasMore:U().optional()}).loose()}),nt=Ge({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`])}),rt=Ge({ttlMs:H().int().min(0).catch(0),cacheScope:Mp([`public`,`private`]).catch(`private`),supportedVersions:G(V()),capabilities:Le,serverInfo:v,instructions:V().optional()}),it=K({messages:G(He),modelPreferences:_e.optional(),systemPrompt:V().optional(),includeContext:Mp([`none`,`thisServer`,`allServers`]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:G(V()).optional(),metadata:t.optional(),tools:G(ze).optional(),toolChoice:ve.optional()}),at=K({method:X(`sampling/createMessage`),params:it}),ot=K({method:X(`roots/list`),params:K({_meta:Y(V(),W()).optional()}).optional()}),st=K({...He.shape,model:V(),stopReason:V().optional()}),ct=K({roots:G(Ne)}),lt=K({action:Mp([`accept`,`decline`,`cancel`]),content:Y(V(),J([V(),H(),U(),G(V())])).optional()}),ut=K({mode:X(`url`),message:V(),url:V().url()}),dt=J([Ae,ut]),ft=K({method:X(`elicitation/create`),params:dt}),I=J([at,ot,ft]),pt=J([st,ct,lt]),mt=Y(V(),I),ht=Y(V(),pt),gt=Ge({inputRequests:mt.optional(),requestState:V().optional()}),_t={inputResponses:ht.optional(),requestState:V().optional()},vt=K({_meta:Re,..._t}),yt=q({progressToken:n.optional()});function bt(e,t){return K({method:X(e),params:K({_meta:Re,...t})})}function xt(e,t){return K({method:X(e),params:K({_meta:yt.optional(),...t}).optional()})}let St={name:V(),arguments:Y(V(),W()).optional(),..._t},Ct={cursor:r.optional()},wt=bt(`tools/call`,St),Tt=bt(`tools/list`,Ct),Et=bt(`prompts/list`,Ct),Dt=bt(`prompts/get`,{name:V(),arguments:Y(V(),V()).optional(),..._t}),Ot=bt(`resources/list`,Ct),kt=bt(`resources/templates/list`,Ct),At=bt(`resources/read`,{uri:V(),..._t}),jt={ref:J([Me,je]),argument:K({name:V(),value:V()}),context:K({arguments:Y(V(),V()).optional()}).optional()},Mt=bt(`completion/complete`,jt),Nt=bt(`server/discover`,{}),Pt=K({toolsListChanged:U().optional(),promptsListChanged:U().optional(),resourcesListChanged:U().optional(),resourceSubscriptions:G(V()).optional()}),Ft={notifications:Pt},It=bt(`subscriptions/listen`,Ft),Lt=q({"io.modelcontextprotocol/subscriptionId":i}),Rt=q({_meta:Lt,resultType:Ue.default(`complete`)}),zt={"tools/call":xt(`tools/call`,St),"tools/list":xt(`tools/list`,Ct),"prompts/get":xt(`prompts/get`,{name:V(),arguments:Y(V(),V()).optional()}),"prompts/list":xt(`prompts/list`,Ct),"resources/list":xt(`resources/list`,Ct),"resources/templates/list":xt(`resources/templates/list`,Ct),"resources/read":xt(`resources/read`,{uri:V()}),"completion/complete":xt(`completion/complete`,jt),"server/discover":xt(`server/discover`,{}),"subscriptions/listen":xt(`subscriptions/listen`,Ft)};function Bt(e){return q({_meta:We,...e})}let Vt={"tools/call":Bt({content:G(fe),structuredContent:W().optional(),isError:U().optional()}),"tools/list":Bt({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),tools:G(ze),nextCursor:r.optional()}),"prompts/get":Bt({description:V().optional(),messages:G(pe)}),"prompts/list":Bt({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),prompts:G(oe),nextCursor:r.optional()}),"resources/list":Bt({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),resources:G(k),nextCursor:r.optional()}),"resources/templates/list":Bt({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),resourceTemplates:G(ie),nextCursor:r.optional()}),"resources/read":Bt({ttlMs:H().int().min(0),cacheScope:Mp([`public`,`private`]),contents:G(J([ne,O]))}),"completion/complete":Bt({completion:K({values:G(V()).max(100),total:H().int().optional(),hasMore:U().optional()}).loose()}),"server/discover":Bt({ttlMs:H().int().min(0).catch(0),cacheScope:Mp([`public`,`private`]).catch(`private`),supportedVersions:G(V()),capabilities:Le,serverInfo:v,instructions:V().optional()}),"subscriptions/listen":Bt({})},Ht=q({"io.modelcontextprotocol/subscriptionId":i.optional()}),Ut=K({method:X(`notifications/subscriptions/acknowledged`),params:K({_meta:Ht.optional(),notifications:Pt})}),Wt=K({_meta:Ht.optional(),requestId:i,reason:V().optional()}),Gt=K({method:X(`notifications/cancelled`),params:Wt}),Kt={"notifications/cancelled":Gt,"notifications/progress":ee,"notifications/message":D,"notifications/resources/updated":M,"notifications/resources/list_changed":A,"notifications/tools/list_changed":he,"notifications/prompts/list_changed":se,"notifications/subscriptions/acknowledged":Ut},qt=e=>K({jsonrpc:X(`2.0`),id:J([V(),H().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:S,ServerCapabilitiesSchema:C,ProgressSchema:w,ProgressNotificationParamsSchema:T,ProgressNotificationSchema:ee,LoggingMessageNotificationParamsSchema:E,LoggingMessageNotificationSchema:D,ResourceContentsSchema:te,TextResourceContentsSchema:ne,BlobResourceContentsSchema:O,AnnotationsSchema:re,ResourceSchema:k,ResourceTemplateSchema:ie,ResourceListChangedNotificationSchema:A,ResourceUpdatedNotificationParamsSchema:j,ResourceUpdatedNotificationSchema:M,PromptArgumentSchema:ae,PromptSchema:oe,PromptListChangedNotificationSchema:se,TextContentSchema:N,ImageContentSchema:P,AudioContentSchema:ce,ToolUseContentSchema:le,EmbeddedResourceSchema:ue,ResourceLinkSchema:de,ContentBlockSchema:fe,PromptMessageSchema:pe,ToolAnnotationsSchema:me,ToolListChangedNotificationSchema:he,ModelHintSchema:ge,ModelPreferencesSchema:_e,ToolChoiceSchema:ve,BooleanSchemaSchema:ye,StringSchemaSchema:be,NumberSchemaSchema:F,UntitledSingleSelectEnumSchemaSchema:xe,TitledSingleSelectEnumSchemaSchema:Se,LegacyTitledEnumSchemaSchema:Ce,SingleSelectEnumSchemaSchema:we,UntitledMultiSelectEnumSchemaSchema:Te,TitledMultiSelectEnumSchemaSchema:Ee,MultiSelectEnumSchemaSchema:De,EnumSchemaSchema:Oe,PrimitiveSchemaDefinitionSchema:ke,ElicitRequestFormParamsSchema:Ae,ResourceTemplateReferenceSchema:je,PromptReferenceSchema:Me,RootSchema:Ne,ClientCapabilities2026Schema:Fe,ServerCapabilities2026Schema:Le,RequestMetaEnvelopeSchema:Re,ToolSchema:ze,ToolResultContentSchema:Be,SamplingMessageContentBlockSchema:Ve,SamplingMessageSchema:He,ResultTypeSchema:Ue,ResultSchema:Ke,PaginatedResultSchema:qe,CallToolResultSchema:Je,ListToolsResultSchema:Ye,ListPromptsResultSchema:Xe,GetPromptResultSchema:Ze,ListResourcesResultSchema:Qe,ListResourceTemplatesResultSchema:$e,ReadResourceResultSchema:et,CompleteResultSchema:tt,CacheableResultSchema:nt,DiscoverResultSchema:rt,CreateMessageRequestParamsSchema:it,CreateMessageRequestSchema:at,ListRootsRequestSchema:ot,CreateMessageResultSchema:st,ListRootsResultSchema:ct,ElicitResultSchema:lt,ElicitRequestURLParamsSchema:ut,ElicitRequestParamsSchema:dt,ElicitRequestSchema:ft,InputRequestSchema:I,InputResponseSchema:pt,InputRequestsSchema:mt,InputResponsesSchema:ht,InputRequiredResultSchema:gt,InputResponseRequestParamsSchema:vt,CallToolRequestSchema:wt,ListToolsRequestSchema:Tt,ListPromptsRequestSchema:Et,GetPromptRequestSchema:Dt,ListResourcesRequestSchema:Ot,ListResourceTemplatesRequestSchema:kt,ReadResourceRequestSchema:At,CompleteRequestSchema:Mt,DiscoverRequestSchema:Nt,SubscriptionFilterSchema:Pt,SubscriptionsListenRequestSchema:It,SubscriptionsListenResultMetaSchema:Lt,SubscriptionsListenResultSchema:Rt,dispatchRequestSchemas:zt,dispatchResultSchemas:Vt,NotificationMetaSchema:Ht,SubscriptionsAcknowledgedNotificationSchema:Ut,CancelledNotificationParamsSchema:Wt,CancelledNotificationSchema:Gt,notificationSchemas2026:Kt,JSONRPCResultResponseSchema:qt(Ke),CallToolResultResponseSchema:qt(J([Je,gt])),ListToolsResultResponseSchema:qt(Ye),ListPromptsResultResponseSchema:qt(Xe),GetPromptResultResponseSchema:qt(J([Ze,gt])),ListResourcesResultResponseSchema:qt(Qe),ListResourceTemplatesResultResponseSchema:qt($e),ReadResourceResultResponseSchema:qt(J([et,gt])),CompleteResultResponseSchema:qt(tt),DiscoverResultResponseSchema:qt(rt)}}var Tv;function Ev(){return Tv??=wv()}var Dv=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ov(e){return Dv.includes(e)}var kv=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Av(e){return e[kv]}function jv(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Mv(e){return e===`public`||e===`private`}var Nv=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Pv=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,L_(this,new.target)}static fromError(t,n,r){if(t===Nv.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Iv(e.elicitations,n)}if(t===Nv.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Lv({supported:e.supported,requested:e.requested},n)}if(t===Nv.InvalidParams||t===Nv.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Nv.ResourceNotFound||Object.keys(e).length===1))return new Fv(e.uri,n)}if(t===Nv.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Rv({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Fv=class extends Pv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Nv.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Iv=class extends Pv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Nv.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Lv=class extends Pv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Nv.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Rv=class extends Pv{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Nv.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},zv=0,Bv=`private`,Vv=[`tools/call`,`prompts/get`,`resources/read`];function Hv(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Vv.includes(e))return t;throw new Pv(Nv.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Uv(e,t){let n=Av(t);if(t.resultType!==`complete`||!Ov(e))return n===void 0?t:Kv(t);let r=t,i=jv(r.ttlMs)?r.ttlMs:Wv(n),a=Mv(r.cacheScope)?r.cacheScope:Gv(n),o={...r,ttlMs:i,cacheScope:a};return delete o[kv],o}function Wv(e){return e!==void 0&&jv(e.ttlMs)?e.ttlMs:zv}function Gv(e){return e!==void 0&&Mv(e.cacheScope)?e.cacheScope:Bv}function Kv(e){let t={...e};return delete t[kv],t}var qv=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Jv;function Yv(){if(Jv)return Jv;let e=Ev();return Jv={request:{"elicitation/create":K({method:X(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":K({method:X(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":K({method:X(`roots/list`),params:q({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Jv}function Xv(e){return qv.includes(e)}function Zv(e){return Xv(e)?Yv().request[e]:void 0}function Qv(e){return Xv(e)?Yv().response[e]:void 0}var $v={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ey={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ty(e){return Object.prototype.hasOwnProperty.call($v,e)}function ny(e){return Object.prototype.hasOwnProperty.call(ey,e)}function ry(e){return Object.prototype.hasOwnProperty.call($v,e)}function iy(e){return ty(e)?Ev().dispatchRequestSchemas[e]:void 0}function ay(e){return ry(e)?Ev().dispatchResultSchemas[e]:void 0}function oy(e){return ny(e)?Ev().notificationSchemas2026[e]:void 0}function sy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cy(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ly={ok:!1,reason:`not-in-era`},uy=[fm,pm,mm];function dy(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>sy(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!sy(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(sy(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var fy={era:`2026-07-28`,hasRequestMethod:ty,hasNotificationMethod:ny,hasInputRequestMethod:e=>Zv(e)!==void 0,validateRequest:(e,t)=>cy(iy(e),t),validateResult:(e,t)=>cy(ay(e),t),validateNotification:(e,t)=>cy(oy(e),t),validateInputRequest:(e,t)=>cy(Zv(e),t),validateInputResponse:(e,t)=>cy(Qv(e),t),samplingResultVariant:()=>ly,outboundEnvelope(e){return{[fm]:e.protocolVersion,[pm]:e.clientInfo,[mm]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of uy)n in e||t.push({key:n,problem:`missing`});let n=Ev().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Z_(e),inputRequestSchema:Zv,decodeResult(e,t){if(!sy(t))return{kind:`invalid`,error:new H_(V_.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new H_(V_.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new H_(V_.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=sy(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new H_(V_.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new H_(V_.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=my(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new H_(V_.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t){return Uv(e,Hv(e,dy(e,t)))},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientInfo, io.modelcontextprotocol/clientCapabilities)`;let t=Ev().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},py;function my(){if(py)return py;let e=Ev();return py={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},py}var hy=`2026-07-28`;function gy(e){return e!==void 0&&J_(e)?fy:Cv}function _y(e){return e.revision===void 0?e.era===`modern`?fy.era:Cv.era:gy(e.revision).era}function vy(e){return by.some(t=>t.hasRequestMethod(e))}function yy(e){return by.some(t=>t.hasNotificationMethod(e))}var by=[Cv,fy],xy=Lo({AnnotationsSchema:()=>mh,AudioContentSchema:()=>qh,BaseMetadataSchema:()=>Um,BaseRequestParamsSchema:()=>Tm,BlobResourceContentsSchema:()=>fh,BooleanSchemaSchema:()=>Og,CallToolRequestParamsSchema:()=>cg,CallToolRequestSchema:()=>lg,CallToolResultSchema:()=>og,CancelTaskRequestSchema:()=>m_,CancelTaskResultSchema:()=>h_,CancelledNotificationParamsSchema:()=>zm,CancelledNotificationSchema:()=>Bm,ClientCapabilitiesSchema:()=>Jm,ClientNotificationSchema:()=>__,ClientRequestSchema:()=>g_,ClientResultSchema:()=>v_,ClientTasksCapabilitySchema:()=>Km,CompatibilityCallToolResultSchema:()=>sg,CompleteRequestParamsSchema:()=>Yg,CompleteRequestSchema:()=>Xg,CompleteResultSchema:()=>Zg,ContentBlockSchema:()=>Zh,CreateMessageRequestParamsSchema:()=>wg,CreateMessageRequestSchema:()=>Tg,CreateMessageResultSchema:()=>Eg,CreateMessageResultWithToolsSchema:()=>Dg,CreateTaskResultSchema:()=>a_,CursorSchema:()=>xm,DiscoverRequestSchema:()=>eh,DiscoverResultSchema:()=>th,ElicitRequestFormParamsSchema:()=>Bg,ElicitRequestParamsSchema:()=>Hg,ElicitRequestSchema:()=>Ug,ElicitRequestURLParamsSchema:()=>Vg,ElicitResultSchema:()=>Kg,ElicitationCompleteNotificationParamsSchema:()=>Wg,ElicitationCompleteNotificationSchema:()=>Gg,EmbeddedResourceSchema:()=>Yh,EmptyResultSchema:()=>Rm,EnumSchemaSchema:()=>Rg,GetPromptRequestParamsSchema:()=>Uh,GetPromptRequestSchema:()=>Wh,GetPromptResultSchema:()=>$h,GetTaskPayloadRequestSchema:()=>u_,GetTaskPayloadResultSchema:()=>d_,GetTaskRequestSchema:()=>c_,GetTaskResultSchema:()=>l_,IconSchema:()=>Vm,IconsSchema:()=>Hm,ImageContentSchema:()=>Kh,ImplementationSchema:()=>Wm,InitializeRequestParamsSchema:()=>Ym,InitializeRequestSchema:()=>Xm,InitializeResultSchema:()=>Qm,InitializedNotificationSchema:()=>$m,JSONArraySchema:()=>ym,JSONObjectSchema:()=>vm,JSONRPCErrorResponseSchema:()=>Fm,JSONRPCMessageSchema:()=>Im,JSONRPCNotificationSchema:()=>Nm,JSONRPCRequestSchema:()=>Mm,JSONRPCResponseSchema:()=>Lm,JSONRPCResultResponseSchema:()=>Pm,JSONValueSchema:()=>_m,LegacyTitledEnumSchemaSchema:()=>Ng,ListChangedOptionsBaseSchema:()=>dg,ListPromptsRequestSchema:()=>Vh,ListPromptsResultSchema:()=>Hh,ListResourceTemplatesRequestSchema:()=>yh,ListResourceTemplatesResultSchema:()=>bh,ListResourcesRequestSchema:()=>_h,ListResourcesResultSchema:()=>vh,ListRootsRequestSchema:()=>$g,ListRootsResultSchema:()=>e_,ListTasksRequestSchema:()=>f_,ListTasksResultSchema:()=>p_,ListToolsRequestSchema:()=>ig,ListToolsResultSchema:()=>ag,LoggingLevelSchema:()=>fg,LoggingMessageNotificationParamsSchema:()=>hg,LoggingMessageNotificationSchema:()=>gg,ModelHintSchema:()=>_g,ModelPreferencesSchema:()=>vg,MultiSelectEnumSchemaSchema:()=>Lg,NotificationSchema:()=>km,NotificationsParamsSchema:()=>Om,NumberSchemaSchema:()=>Ag,PaginatedRequestParamsSchema:()=>oh,PaginatedRequestSchema:()=>sh,PaginatedResultSchema:()=>ch,PingRequestSchema:()=>nh,PrimitiveSchemaDefinitionSchema:()=>zg,ProgressNotificationParamsSchema:()=>ih,ProgressNotificationSchema:()=>ah,ProgressSchema:()=>rh,ProgressTokenSchema:()=>bm,PromptArgumentSchema:()=>zh,PromptListChangedNotificationSchema:()=>eg,PromptMessageSchema:()=>Qh,PromptReferenceSchema:()=>Jg,PromptSchema:()=>Bh,ReadResourceRequestParamsSchema:()=>Sh,ReadResourceRequestSchema:()=>Ch,ReadResourceResultSchema:()=>wh,RelatedTaskMetadataSchema:()=>Cm,RequestIdSchema:()=>jm,RequestMetaSchema:()=>wm,RequestSchema:()=>Dm,ResourceContentsSchema:()=>lh,ResourceLinkSchema:()=>Xh,ResourceListChangedNotificationSchema:()=>Th,ResourceRequestParamsSchema:()=>xh,ResourceSchema:()=>hh,ResourceTemplateReferenceSchema:()=>qg,ResourceTemplateSchema:()=>gh,ResourceUpdatedNotificationParamsSchema:()=>Lh,ResourceUpdatedNotificationSchema:()=>Rh,ResultSchema:()=>Am,RoleSchema:()=>ph,RootSchema:()=>Qg,RootsListChangedNotificationSchema:()=>t_,SamplingContentSchema:()=>xg,SamplingMessageContentBlockSchema:()=>Sg,SamplingMessageSchema:()=>Cg,ServerCapabilitiesSchema:()=>Zm,ServerNotificationSchema:()=>b_,ServerRequestSchema:()=>y_,ServerResultSchema:()=>x_,ServerTasksCapabilitySchema:()=>qm,SetLevelRequestParamsSchema:()=>pg,SetLevelRequestSchema:()=>mg,SingleSelectEnumSchemaSchema:()=>Pg,StringSchemaSchema:()=>kg,SubscribeRequestParamsSchema:()=>Eh,SubscribeRequestSchema:()=>Dh,SubscriptionFilterSchema:()=>Ah,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Nh,SubscriptionsAcknowledgedNotificationSchema:()=>Ph,SubscriptionsListenRequestParamsSchema:()=>jh,SubscriptionsListenRequestSchema:()=>Mh,SubscriptionsListenResultMetaSchema:()=>Fh,SubscriptionsListenResultSchema:()=>Ih,TaskAugmentedRequestParamsSchema:()=>Em,TaskCreationParamsSchema:()=>n_,TaskMetadataSchema:()=>Sm,TaskSchema:()=>i_,TaskStatusNotificationParamsSchema:()=>o_,TaskStatusNotificationSchema:()=>s_,TaskStatusSchema:()=>r_,TextContentSchema:()=>Gh,TextResourceContentsSchema:()=>uh,TitledMultiSelectEnumSchemaSchema:()=>Ig,TitledSingleSelectEnumSchemaSchema:()=>Mg,ToolAnnotationsSchema:()=>tg,ToolChoiceSchema:()=>yg,ToolExecutionSchema:()=>ng,ToolListChangedNotificationSchema:()=>ug,ToolResultContentSchema:()=>bg,ToolSchema:()=>rg,ToolUseContentSchema:()=>Jh,UnsubscribeRequestParamsSchema:()=>Oh,UnsubscribeRequestSchema:()=>kh,UntitledMultiSelectEnumSchemaSchema:()=>Fg,UntitledSingleSelectEnumSchemaSchema:()=>jg}),Sy=e=>Mm.safeParse(e).success,Cy=e=>Nm.safeParse(e).success,wy=e=>Pm.safeParse(e).success,Ty=e=>Fm.safeParse(e).success,Ey=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Dy=e=>Xm.safeParse(e).success,Oy=e=>$m.safeParse(e).success,ky=`Mcp-Param-`,Ay=`x-mcp-header`,jy=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,My=new Set([`string`,`integer`,`boolean`,`number`]);function Ny(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ay in o){if(!a||i.length===0)return`${Iy(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ay];if(typeof e!=`string`||e.length===0)return`${Iy(i)}: x-mcp-header MUST be a non-empty string`;if(!jy.test(e))return`${Iy(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!My.has(r))return`${Iy(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??`<none>`}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Py){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Fy.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Py=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Fy=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Iy(e){return e.length===0?`<root>`:e.join(`.`)}var Ly=`=?base64?`,Ry=`?=`;function zy(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function By(e){if(e.length===0||e.startsWith(Ly)&&e.endsWith(Ry)||e!==e.trim())return!0;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(!(n===9||n>=32&&n<=126))return!0}return!1}function Vy(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function Hy(e){return By(e)?`${Ly}${Vy(e)}${Ry}`:e}function Uy(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Wy(e,t){let n={};for(let r of e){let e=Uy(t,r.path);if(e==null)continue;let i=zy(e);i!==void 0&&(n[`${ky}${r.headerName}`]=Hy(i))}return n}Nv.InvalidRequest,Nv.UnsupportedProtocolVersion,Nv.InvalidParams,Nv.MethodNotFound,Nv.InvalidParams,Nv.MissingRequiredClientCapability,Nv.ParseError,Nv.InvalidRequest,Nv.MethodNotFound,Nv.UnsupportedProtocolVersion,Nv.MissingRequiredClientCapability;function Gy(e,t){return Df(e,t)}function Ky(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function qy(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var Jy=!1,Yy=`draft-2020-12`;function Xy(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Yy});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);Jy||(Jy=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=hf(e,{target:Yy,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&Zy(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function Zy(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||Zy(e)))}return!1}function Qy(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function $y(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>Qy(e)).join(`, `)}:{success:!0,data:n.value}}function eb(e){let t=hf(e,{target:Yy,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var tb=/\\\.\\d\{(\d+)\}/;function nb(e){let t=tb.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>_f({local:e,offset:t,precision:n}))))}function rb(e,t){let n;switch(e){case`email`:n=[Wf()];break;case`uri`:n=[Jf()];break;case`date`:n=[yf()];break;case`date-time`:n=nb(t);break}return new Set(n.map(e=>eb(e)).filter(e=>e!==void 0))}function ib(e,t,n){return n===`zod`?rb(e,t).has(t):!0}function ab(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ob(e){try{return Xy(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Pv(Nv.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var sb=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function cb(e){return sb.has(e)||e.startsWith(`x-`)}var lb=new Set([`$schema`,...Object.keys(Bg.shape.requestedSchema.shape)]),ub={string:Ky([kg,jg,Mg,Ng]),number:Ky([Ag]),integer:Ky([Ag]),boolean:Ky([Og]),array:Ky([Fg,Ig])},db=new Set(kg.shape.format.unwrap().options);function fb(e,t,n,r){if(!ab(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(ub,e.type)?ub[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||cb(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?db.has(e.format)?(typeof s!=`string`||!ib(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function pb(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&ab(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,fb(n,`properties.${e}`,t,r)])):lb.has(i)?n[i]=a:cb(i)||r.push(i);if(r.length>0)throw new Pv(Nv.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function mb(e,t){if(!ab(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Gy(zg,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function hb(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>hb(e,t[r],`${n}[${r}]`)):!ab(e)||!ab(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?hb(r,t[e],i):cb(e)?[]:[i]})}function gb(e){if(!qy(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=pb(ob(e.requestedSchema),t),r=Gy(Bg.shape.requestedSchema,n);if(!r.success)throw new Pv(Nv.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${mb(n,r.error.message)}`);let i=hb(n,r.data);if(i.length>0)throw new Pv(Nv.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Pv(Nv.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function _b(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(_b,{elicit(e){try{return{method:`elicitation/create`,params:gb(e)}}catch(e){throw e instanceof Pv?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var vb=!0,yb=10,bb=250;function xb(e){return{autoFulfill:e?.autoFulfill??vb,maxRounds:e?.maxRounds??yb}}function Sb(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Cb(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function wb(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof H_?t.reason:new H_(V_.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof H_?t.reason:new H_(V_.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Tb(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Eb(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new H_(V_.InputRequiredRoundsExceeded,Cb(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Tb(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await wb(bb,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new H_(V_.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Sb(r,u,c.requestState),d);if(Ey(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var Db=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Ob={IdJagTokenExchangeResponseSchema:O_,OAuthClientInformationFullSchema:N_,OAuthClientInformationSchema:M_,OAuthClientMetadataSchema:j_,OAuthClientRegistrationErrorSchema:P_,OAuthErrorResponseSchema:k_,OAuthMetadataSchema:w_,OAuthProtectedResourceMetadataSchema:C_,OAuthTokenRevocationRequestSchema:F_,OAuthTokensSchema:D_,OpenIdProviderDiscoveryMetadataSchema:E_,OpenIdProviderMetadataSchema:T_},kb={},Ab={};function jb(e,t){let n=e.slice(0,-6);kb[n]=t,Ab[n]=e=>t.safeParse(e).success}for(let e of Db)jb(e,xy[e]);for(let[e,t]of Object.entries(Ob))jb(e,t);var Mb=Object.freeze(kb);Object.freeze(Ab);function Nb(e){switch(e){case`initialize`:case`notifications/initialized`:return gy(void 0);case`server/discover`:return gy(hy);default:return}}var Pb=[fm,pm,mm,gm],Fb=[`inputResponses`,`requestState`];function Ib(e,t){let n=e.params;if(!Vb(n))return{message:e,lifted:{}};let r=n._meta,i=Vb(r)?Pb.filter(e=>e in r):[],a=t===`request`?Fb.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Vb(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Lb(e,t){let n=e.validateResult(t,void 0);if(!(!n.ok&&n.reason===`not-in-era`))return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Rb(e){return()=>e}var zb=Rb(void 0),Bb=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??um,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new H_(V_.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new H_(V_.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),wy(e)||Ty(e)?this._onresponse(e):Sy(e)?this._onrequest(e,t):Cy(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new H_(V_.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Ib(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=_y(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(yy(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;i===void 0&&a===void 0||Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Ib(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=_y(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Nv.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(vy(n.method)&&!i.hasRequestMethod(n.method)){o(Nv.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Nv.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Nv.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Wb(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?zb:Rb(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),qy(t))return u(e,t,n);let i=Lb(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e)}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Nv.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Nv.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wy(e)?n(e):n(Pv.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),qy(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Lb(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return gy(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Nb(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(vy(t)&&!e.hasRequestMethod(t))throw new H_(V_.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof H_?e:new H_(V_.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof H_?e:new H_(V_.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Xb(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;$y(n,o).then(e=>{e.success?d(e.data):f(new H_(V_.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new H_(V_.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new H_(V_.NotConnected,`Not connected`);if(yy(t.method)&&!e.hasNotificationMethod(t.method))throw new H_(V_.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!vy(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Pv(Nv.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await $y(t.params,{...r.params});if(!a.success)throw new Pv(Nv.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!yy(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Pv(Nv.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await $y(t.params,{...r.params});if(!i.success)throw new Pv(Nv.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Vb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hb(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=Vb(a)&&Vb(i)?{...a,...i}:i}return n}function Ub(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wb(e){let t={},n=[];if(!Ub(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Ub(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Gb(e){throw new H_(V_.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function Kb(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:Rb(void 0),signal:r,send:(()=>Gb(`send`)),notify:()=>Gb(`notify`)}}}async function qb(e,t,n,r,i){if(!Ub(r)||typeof r.method!=`string`)throw new H_(V_.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new H_(V_.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new H_(V_.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=Ub(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(Kb(n,a,s,i,e.sessionId)))}function Jb(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function Yb(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>qb(e,i,t,n,r),retry:(e,t)=>r.retry(e,Jb(o,t))};return Eb({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function Xb(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var Zb=zo(Io((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function Qb(e){if(e)try{return Zb.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function $b(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function ex(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...$b(t.headers),...$b(r.headers)}:t.headers}):e}function tx(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!tx(e[r],t[r]))return!1;return!0}if(n===`object`){if(!e||!t)return e===t;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!tx(e[r],t[r]))return!1;return!0}return e===t}function nx(e){return encodeURI(rx(e))}function rx(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}var ix={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},ax={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},ox={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},sx=typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);function cx(e,t=Object.create(null),n=sx,r=``){if(e&&typeof e==`object`&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let a=new URL(i,n.href);a.hash.length>1?t[a.href]=e:(a.hash=``,r===``?n=a:cx(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(ox[i])continue;let a=`${r}/${nx(i)}`,o=e[i];if(Array.isArray(o)){if(ix[i]){let e=o.length;for(let r=0;r<e;r++)cx(o[r],t,n,`${a}/${r}`)}}else if(ax[i])for(let e in o)cx(o[e],t,n,`${a}/${nx(e)}`);else cx(o,t,n,a)}return t}var lx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ux=[0,31,28,31,30,31,30,31,31,30,31,30,31],dx=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,fx=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,px=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,mx=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,hx=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,gx=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,_x=/^(?:\/(?:[^~/]|~0|~1)*)*$/,vx=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,yx=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,bx=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},xx=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Sx=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Cx=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function wx(e){return e.test.bind(e)}var Tx={date:Dx,time:Ox.bind(void 0,!1),"date-time":Ax,duration:Cx,uri:Nx,"uri-reference":wx(px),"uri-template":wx(mx),url:wx(hx),email:bx,hostname:wx(fx),ipv4:wx(xx),ipv6:wx(Sx),regex:Fx,uuid:wx(gx),"json-pointer":wx(_x),"json-pointer-uri-fragment":wx(vx),"relative-json-pointer":wx(yx)};function Ex(e){return e%4==0&&(e%100!=0||e%400==0)}function Dx(e){let t=e.match(lx);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&Ex(n)?29:ux[r])}function Ox(e,t){let n=t.match(dx);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var kx=/t|\s/i;function Ax(e){let t=e.split(kx);return t.length==2&&Dx(t[0])&&Ox(!0,t[1])}var jx=/\/|:/,Mx=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Nx(e){return jx.test(e)&&Mx.test(e)}var Px=/[^\\]\\Z/;function Fx(e){if(Px.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function Ix(e){let t=0,n=e.length,r=0,i;for(;r<n;)t++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return t}function Lx(e,t,n=`2019-09`,r=cx(t),i=!0,a=null,o=`#`,s=`#`,c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:o,keyword:`false`,keywordLocation:o,error:`False boolean schema.`}]};let l=typeof e,u;switch(l){case`boolean`:case`number`:case`string`:u=l;break;case`object`:u=e===null?`null`:Array.isArray(e)?`array`:`object`;break;default:throw Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:_,not:v,anyOf:y,allOf:b,oneOf:x,if:S,then:C,else:w,format:T,properties:ee,patternProperties:E,additionalProperties:D,unevaluatedProperties:te,minProperties:ne,maxProperties:O,propertyNames:re,dependentRequired:k,dependentSchemas:ie,dependencies:A,prefixItems:j,items:M,additionalItems:ae,unevaluatedItems:oe,contains:se,minContains:N,maxContains:P,minItems:ce,maxItems:le,uniqueItems:ue,minimum:de,maximum:fe,exclusiveMinimum:pe,exclusiveMaximum:me,multipleOf:he,minLength:ge,maxLength:_e,pattern:ve,__absolute_ref__:ye,__absolute_recursive_ref__:be}=t,F=[];if(p===!0&&a===null&&(a=t),f===`#`){let l=a===null?r[be]:a,u=`${s}/$recursiveRef`,d=Lx(e,a===null?t:a,n,r,i,l,o,u,c);d.valid||F.push({instanceLocation:o,keyword:`$recursiveRef`,keywordLocation:u,error:`A subschema had errors.`},...d.errors)}if(d!==void 0){let t=r[ye||d];if(t===void 0){let e=`Unresolved $ref "${d}".`;throw ye&&ye!==d&&(e+=` Absolute URI "${ye}".`),e+=`\nKnown schemas:\n- ${Object.keys(r).join(`
146
- - `)}`,Error(e)}let l=`${s}/$ref`,u=Lx(e,t,n,r,i,a,o,l,c);if(u.valid||F.push({instanceLocation:o,keyword:`$ref`,keywordLocation:l,error:`A subschema had errors.`},...u.errors),n===`4`||n===`7`)return{valid:F.length===0,errors:F}}if(Array.isArray(m)){let t=m.length,n=!1;for(let r=0;r<t;r++)if(u===m[r]||m[r]===`integer`&&u===`number`&&e%1==0&&e===e){n=!0;break}n||F.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join(`", "`)}".`})}else m===`integer`?(u!==`number`||e%1||e!==e)&&F.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&F.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`});if(h!==void 0&&(u===`object`||u===`array`?tx(e,h)||F.push({instanceLocation:o,keyword:`const`,keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):e!==h&&F.push({instanceLocation:o,keyword:`const`,keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),g!==void 0&&(u===`object`||u===`array`?g.some(t=>tx(e,t))||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),v!==void 0){let t=`${s}/not`;Lx(e,v,n,r,i,a,o,t).valid&&F.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let xe=[];if(y!==void 0){let t=`${s}/anyOf`,l=F.length,u=!1;for(let s=0;s<y.length;s++){let l=y[s],d=Object.create(c),f=Lx(e,l,n,r,i,p===!0?a:null,o,`${t}/${s}`,d);F.push(...f.errors),u||=f.valid,f.valid&&xe.push(d)}u?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`anyOf`,keywordLocation:t,error:`Instance does not match any subschemas.`})}if(b!==void 0){let t=`${s}/allOf`,l=F.length,u=!0;for(let s=0;s<b.length;s++){let l=b[s],d=Object.create(c),f=Lx(e,l,n,r,i,p===!0?a:null,o,`${t}/${s}`,d);F.push(...f.errors),u&&=f.valid,f.valid&&xe.push(d)}u?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`allOf`,keywordLocation:t,error:`Instance does not match every subschema.`})}if(x!==void 0){let t=`${s}/oneOf`,l=F.length,u=x.filter((s,l)=>{let u=Object.create(c),d=Lx(e,s,n,r,i,p===!0?a:null,o,`${t}/${l}`,u);return F.push(...d.errors),d.valid&&xe.push(u),d.valid}).length;u===1?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${u} matches).`})}if((u===`object`||u===`array`)&&Object.assign(c,...xe),S!==void 0){let t=`${s}/if`;if(Lx(e,S,n,r,i,a,o,t,c).valid){if(C!==void 0){let l=Lx(e,C,n,r,i,a,o,`${s}/then`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(w!==void 0){let l=Lx(e,w,n,r,i,a,o,`${s}/else`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...l.errors)}}if(u===`object`){if(_!==void 0)for(let t of _)t in e||F.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(ne!==void 0&&t.length<ne&&F.push({instanceLocation:o,keyword:`minProperties`,keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${ne} properties.`}),O!==void 0&&t.length>O&&F.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${O} properties.`}),re!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${nx(s)}`,c=Lx(s,re,n,r,i,a,e,t);c.valid||F.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(k!==void 0){let t=`${s}/dependantRequired`;for(let n in k)if(n in e){let r=k[n];for(let i of r)i in e||F.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(ie!==void 0)for(let t in ie){let l=`${s}/dependentSchemas`;if(t in e){let s=Lx(e,ie[t],n,r,i,a,o,`${l}/${nx(t)}`,c);s.valid||F.push({instanceLocation:o,keyword:`dependentSchemas`,keywordLocation:l,error:`Instance has "${t}" but does not match dependant schema.`},...s.errors)}}if(A!==void 0){let t=`${s}/dependencies`;for(let s in A)if(s in e){let c=A[s];if(Array.isArray(c))for(let n of c)n in e||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not have "${n}".`});else{let l=Lx(e,c,n,r,i,a,o,`${t}/${nx(s)}`);l.valid||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not match dependant schema.`},...l.errors)}}}let l=Object.create(null),u=!1;if(ee!==void 0){let t=`${s}/properties`;for(let s in ee){if(!(s in e))continue;let d=`${o}/${nx(s)}`,f=Lx(e[s],ee[s],n,r,i,a,d,`${t}/${nx(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,F.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&E!==void 0){let t=`${s}/patternProperties`;for(let s in E){let d=new RegExp(s,`u`),f=E[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${nx(p)}`,h=Lx(e[p],f,n,r,i,a,m,`${t}/${nx(s)}`);h.valid?c[p]=l[p]=!0:(u=i,F.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&D!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${nx(s)}`,f=Lx(e[s],D,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,F.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&te!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${nx(s)}`,u=Lx(e[s],te,n,r,i,a,l,t);u.valid?c[s]=!0:F.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){le!==void 0&&e.length>le&&F.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${le}).`}),ce!==void 0&&e.length<ce&&F.push({instanceLocation:o,keyword:`minItems`,keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${ce}).`});let t=e.length,l=0,u=!1;if(j!==void 0){let d=`${s}/prefixItems`,f=Math.min(j.length,t);for(;l<f;l++){let t=Lx(e[l],j[l],n,r,i,a,`${o}/${l}`,`${d}/${l}`);if(c[l]=!0,!t.valid&&(u=i,F.push({instanceLocation:o,keyword:`prefixItems`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}}if(M!==void 0){let d=`${s}/items`;if(Array.isArray(M)){let s=Math.min(M.length,t);for(;l<s;l++){let t=Lx(e[l],M[l],n,r,i,a,`${o}/${l}`,`${d}/${l}`);if(c[l]=!0,!t.valid&&(u=i,F.push({instanceLocation:o,keyword:`items`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}}else for(;l<t;l++){let t=Lx(e[l],M,n,r,i,a,`${o}/${l}`,d);if(c[l]=!0,!t.valid&&(u=i,F.push({instanceLocation:o,keyword:`items`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}if(!u&&ae!==void 0){let d=`${s}/additionalItems`;for(;l<t;l++){let t=Lx(e[l],ae,n,r,i,a,`${o}/${l}`,d);c[l]=!0,t.valid||(u=i,F.push({instanceLocation:o,keyword:`additionalItems`,keywordLocation:d,error:`Items did not match additional items schema.`},...t.errors))}}}if(se!==void 0)if(t===0&&N===void 0)F.push({instanceLocation:o,keyword:`contains`,keywordLocation:`${s}/contains`,error:`Array is empty. It must contain at least one item matching the schema.`});else if(N!==void 0&&t<N)F.push({instanceLocation:o,keyword:`minContains`,keywordLocation:`${s}/minContains`,error:`Array has less items (${t}) than minContains (${N}).`});else{let l=`${s}/contains`,u=F.length,d=0;for(let s=0;s<t;s++){let t=Lx(e[s],se,n,r,i,a,`${o}/${s}`,l);t.valid?(c[s]=!0,d++):F.push(...t.errors)}d>=(N||0)&&(F.length=u),N===void 0&&P===void 0&&d===0?F.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):N!==void 0&&d<N?F.push({instanceLocation:o,keyword:`minContains`,keywordLocation:`${s}/minContains`,error:`Array must contain at least ${N} items matching schema. Only ${d} items were found.`}):P!==void 0&&d>P&&F.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${P} items matching schema. ${d} items were found.`})}if(!u&&oe!==void 0){let u=`${s}/unevaluatedItems`;for(;l<t;l++){if(c[l])continue;let t=Lx(e[l],oe,n,r,i,a,`${o}/${l}`,u);c[l]=!0,t.valid||F.push({instanceLocation:o,keyword:`unevaluatedItems`,keywordLocation:u,error:`Items did not match unevaluated items schema.`},...t.errors)}}if(ue)for(let n=0;n<t;n++){let r=e[n],i=typeof r==`object`&&!!r;for(let a=0;a<t;a++){if(n===a)continue;let t=e[a];(r===t||i&&typeof t==`object`&&t&&tx(r,t))&&(F.push({instanceLocation:o,keyword:`uniqueItems`,keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${n} and ${a}.`}),n=2**53-1,a=2**53-1)}}}else if(u===`number`){if(n===`4`?(de!==void 0&&(pe===!0&&e<=de||e<de)&&F.push({instanceLocation:o,keyword:`minimum`,keywordLocation:`${s}/minimum`,error:`${e} is less than ${pe?`or equal to `:``} ${de}.`}),fe!==void 0&&(me===!0&&e>=fe||e>fe)&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${me?`or equal to `:``} ${fe}.`})):(de!==void 0&&e<de&&F.push({instanceLocation:o,keyword:`minimum`,keywordLocation:`${s}/minimum`,error:`${e} is less than ${de}.`}),fe!==void 0&&e>fe&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${fe}.`}),pe!==void 0&&e<=pe&&F.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${pe}.`}),me!==void 0&&e>=me&&F.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${me}.`})),he!==void 0){let t=e%he;Math.abs(0-t)>=1.1920929e-7&&Math.abs(he-t)>=1.1920929e-7&&F.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${he}.`})}}else if(u===`string`){let t=ge===void 0&&_e===void 0?0:Ix(e);ge!==void 0&&t<ge&&F.push({instanceLocation:o,keyword:`minLength`,keywordLocation:`${s}/minLength`,error:`String is too short (${t} < ${ge}).`}),_e!==void 0&&t>_e&&F.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${_e}).`}),ve!==void 0&&!new RegExp(ve,`u`).test(e)&&F.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),T!==void 0&&Tx[T]&&!Tx[T](e)&&F.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${T}".`})}return{valid:F.length===0,errors:F}}var Rx=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=cx(e)}validate(e){return Lx(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),cx(e,this.lookup)}},zx=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),Bx=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}getValidator(e){if(this.draft===void 0&&`$schema`in e&&typeof e.$schema==`string`&&!zx.has(e.$schema.replace(/#$/,``))){let t=e.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${t}"). The default validator supports JSON Schema 2020-12 only; pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`)}let t=new Rx(e,this.draft??`2020-12`,this.shortcircuit);return e=>{let n=t.validate(e);return n.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:n.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join(`; `)}}}},Vx=globalThis.crypto;async function Hx(e){return(await Vx).getRandomValues(new Uint8Array(e))}async function Ux(e){let t=``;for(;t.length<e;){let n=await Hx(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function Wx(e){return await Ux(e)}async function Gx(e){let t=await(await Vx).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Kx(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Wx(e);return{code_verifier:t,code_challenge:await Gx(t)}}var qx=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Jx(e){}function Yx(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=Jx,onError:n=Jx,onRetry:r=Jx,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=Xx(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
147
- `;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new qx(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new qx(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
148
- `)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function Xx(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
149
- `,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}else{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
150
- `&&r++}}return[t,n]}var Zx=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Yx({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}},Qx=`modulepreload`,$x=function(e){return`/inspector/`+e},eS={},tS=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=$x(t,n),t in eS)return;eS[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Qx,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},nS=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e){super(e),this.name=new.target.name,L_(this,new.target)}},rS=class extends nS{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}},iS=class extends nS{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},aS=class extends nS{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},oS=class extends nS{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},sS=class extends nS{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};function cS(e,t,n){if(e!==void 0)return e.issuer===void 0?(n?.canPersistStamp!==!1&&console.warn(`[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.`),e):lS(e.issuer,t)?e:void 0}function lS(e,t){return e===t||e.endsWith(`/`)&&e.slice(0,-1)===t||t.endsWith(`/`)&&t.slice(0,-1)===e}function uS(e){if(e==null)return!1;let t=e;return typeof t.tokens==`function`&&typeof t.clientInformation==`function`}async function dS(e,t,n){let{resourceMetadataUrl:r,scope:i}=RS(t.response);if(await MS(e,{serverUrl:t.serverUrl,resourceMetadataUrl:r,scope:i,fetchFn:t.fetchFn,...n})!==`AUTHORIZED`)throw new pS}function fS(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async n=>dS(e,n,t)}}var pS=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,L_(this,new.target)}};function mS(e){return e?.authorization_response_iss_parameter_supported===!0}function hS({iss:e,expectedIssuer:t,issParameterSupported:n}){if(t!==void 0){if(e===void 0){if(n)throw new rS(`authorization_response`,t,void 0);return}if(e!==t)throw new rS(`authorization_response`,t,e)}}function gS(...e){let t=new Set;for(let n of e)if(n)for(let e of n.split(/\s+/))e&&t.add(e);return t.size>0?[...t].join(` `):void 0}function _S(e,t){if(!e)return!1;let n=new Set((t??``).split(/\s+/).filter(Boolean));for(let t of e.split(/\s+/))if(t&&!n.has(t))return!0;return!1}async function vS(e,t,n,r,i){if(typeof e==`string`)return{authorizationCode:e,iss:t};let a=e.get(`iss`)??void 0,o=e.get(`code`);if(o)return{authorizationCode:o,iss:a};let s=(await n.discoveryState?.())?.authorizationServerMetadata;if(!s)try{s=(await JS(r,i)).authorizationServerMetadata}catch{s=void 0}if(!s)throw new pS(`Authorization callback failed and the issuer could not be verified`);hS({iss:a,expectedIssuer:s.issuer,issParameterSupported:mS(s)});let c=e.get(`error`);throw c?new B_(c,e.get(`error_description`)??c,e.get(`error_uri`)??void 0):new pS("Authorization callback contained neither `code` nor `error`")}function yS(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var bS=`code`,xS=`S256`;function SS(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&yS(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?`client_secret_basic`:`none`:n&&t.includes(`client_secret_basic`)?`client_secret_basic`:n&&t.includes(`client_secret_post`)?`client_secret_post`:t.includes(`none`)?`none`:n?`client_secret_post`:`none`}function CS(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:wS(i,a,n);return;case`client_secret_post`:TS(i,a,r);return;case`none`:ES(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function wS(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function TS(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function ES(e,t){t.set(`client_id`,e)}function DS(e){return e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e===`::1`}function OS(e){let t=new URL(String(e));if(t.protocol!==`https:`&&!DS(t.hostname))throw new aS(t.href);return t}function kS(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{continue}if(e.protocol!==`http:`&&e.protocol!==`https:`||DS(e.hostname))return`native`}return`web`}function AS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:[`authorization_code`,`refresh_token`]),application_type:t.application_type??kS(t.redirect_uris)}}async function jS(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let e=k_.parse(JSON.parse(n));return B_.fromResponse(e)}catch(e){let r=`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`;return new B_(z_.ServerError,r)}}async function MS(e,t){try{return await PS(e,t)}catch(n){if(n instanceof B_){if(n.code===z_.InvalidClient||n.code===z_.UnauthorizedClient)return await e.invalidateCredentials?.(`client`),await e.invalidateCredentials?.(`tokens`),await PS(e,t);if(n.code===z_.InvalidGrant)return await e.invalidateCredentials?.(`tokens`),await PS(e,t)}throw n}}function NS(e){let{requestedScope:t,resourceMetadata:n,authServerMetadata:r,clientMetadata:i}=e,a=t||n?.scopes_supported?.join(` `)||i.scope;return a&&r?.scopes_supported?.includes(`offline_access`)&&!a.split(` `).includes(`offline_access`)&&i.grant_types?.includes(`refresh_token`)&&(a=`${a} offline_access`),a}async function PS(e,{serverUrl:t,authorizationCode:n,iss:r,scope:i,resourceMetadataUrl:a,fetchFn:o,skipIssuerMetadataValidation:s,forceReauthorization:c}){let l=AS(e),u=await e.discoveryState?.(),d,f,p,m,h=a;if(!h&&u?.resourceMetadataUrl&&(h=new URL(u.resourceMetadataUrl)),u?.authorizationServerUrl){if(f=u.authorizationServerUrl,d=u.resourceMetadata,p=u.authorizationServerMetadata??await qS(f,{fetchFn:o,skipIssuerValidation:s}),!d)try{d=await BS(t,{resourceMetadataUrl:h},o)}catch(e){if(e instanceof TypeError)throw e}(p!==u.authorizationServerMetadata||d!==u.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(f),resourceMetadataUrl:h?.toString(),resourceMetadata:d,authorizationServerMetadata:p})}else{let e=await JS(t,{resourceMetadataUrl:h,fetchFn:o,skipIssuerMetadataValidation:s});f=e.authorizationServerUrl,p=e.authorizationServerMetadata,d=e.resourceMetadata,m={authorizationServerUrl:String(f),resourceMetadataUrl:h?.toString(),resourceMetadata:d,authorizationServerMetadata:p}}let g=p?.issuer??String(f),_={issuer:g};if(await e.saveAuthorizationServerUrl?.(g),n!==void 0){let t=u?.authorizationServerMetadata?.issuer??u?.authorizationServerUrl;if(t===void 0){if(e.saveDiscoveryState!==void 0)throw new oS(`discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier`,g);console.warn(`[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.`)}else if(!lS(t,g))throw new oS(t,g)}m&&await e.saveDiscoveryState?.(m);let v=await LS(t,e,d);v&&await e.saveResourceUrl?.(String(v));let y=NS({requestedScope:i,resourceMetadata:d,authServerMetadata:p,clientMetadata:e.clientMetadata}),b=await Promise.resolve(e.clientInformation(_)),x=cS(b,g,{canPersistStamp:e.saveClientInformation!==void 0});if(x===void 0&&b?.issuer&&e.saveClientInformation===void 0)throw new oS(b.issuer,g);if(x&&x.issuer===void 0&&(x={...x,issuer:g},await e.saveClientInformation?.(x,_)),!x){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=p?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!IS(r))throw new B_(z_.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)x={client_id:r,issuer:g},await e.saveClientInformation?.(x,_);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);x={...await eC(f,{metadata:p,clientMetadata:l,scope:y,fetchFn:o}),issuer:g},await e.saveClientInformation(x,_)}}let S=!e.redirectUrl;if(n!==void 0||S){n!==void 0&&hS({iss:r,expectedIssuer:p?.issuer,issParameterSupported:mS(p)});let t=await $S(e,f,{metadata:p,resource:v,authorizationCode:n,iss:r,scope:y,fetchFn:o});return await e.saveTokens({...t,issuer:g},_),`AUTHORIZED`}let C=cS(await e.tokens(_),g);if(C&&C.issuer===void 0&&(C={...C,issuer:g},await e.saveTokens(C,_)),C?.refresh_token&&!c)try{let t=await QS(f,{metadata:p,clientInformation:x,refreshToken:C.refresh_token,resource:v,addClientAuthentication:e.addClientAuthentication,fetchFn:o});return await e.saveTokens({...t,issuer:g},_),`AUTHORIZED`}catch(e){if(e instanceof aS||!(!(e instanceof B_)||e.code===z_.ServerError))throw e}let w=e.state?await e.state():void 0,{authorizationUrl:T,codeVerifier:ee}=await YS(f,{metadata:p,clientInformation:x,state:w,redirectUrl:e.redirectUrl,scope:y,resource:v});return await e.saveCodeVerifier(ee),await e.redirectToAuthorization(T),`REDIRECT`}function FS(e){if(e&&!IS(e))throw new B_(z_.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${e}`)}function IS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function LS(e,t,n){let r=W_(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!G_({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function RS(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n?.toLowerCase()!==`bearer`||!r)return{};let i=zS(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=zS(e,`scope`)||void 0,s=zS(e,`error`)||void 0,c=zS(e,`error_description`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s,errorDescription:c}}function zS(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),i=n.match(r);if(i){let e=i[1]||i[2];if(e)return e}return null}async function BS(e,t,n=fetch){let r=await GS(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.text?.().catch(()=>{}),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.text?.().catch(()=>{}),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return C_.parse(await r.json())}async function VS(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(!(r instanceof TypeError))throw r;if(t)try{return await n(e,{})}catch(e){if(!(e instanceof TypeError))throw e;return}return}}function HS(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function US(e,t,n=fetch){return await VS(e,{"MCP-Protocol-Version":t},n)}function WS(e,t){return e?t===`/`?!1:e.status>=400&&e.status<500||e.status===502:!0}async function GS(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=HS(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await US(o,a,n);return!r?.metadataUrl&&WS(s,i.pathname)&&(s=await US(new URL(`/.well-known/${t}`,i),a,n)),s}function KS(e){let t=typeof e==`string`?new URL(e):e,n=t.pathname!==`/`,r=[];if(!n)return r.push({url:new URL(`/.well-known/oauth-authorization-server`,t.origin),type:`oauth`},{url:new URL(`/.well-known/openid-configuration`,t.origin),type:`oidc`}),r;let i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`},{url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`},{url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function qS(e,{fetchFn:t=fetch,protocolVersion:n=lm,skipIssuerValidation:r=!1}={}){let i={"MCP-Protocol-Version":n,Accept:`application/json`},a=KS(e);for(let{url:n,type:o}of a){let a=await VS(n,i,t);if(!a)continue;if(!a.ok){if(await a.text?.().catch(()=>{}),a.status>=400&&a.status<500||a.status===502)continue;throw Error(`HTTP ${a.status} trying to load ${o===`oauth`?`OAuth`:`OpenID provider`} metadata from ${n}`)}let s=o===`oauth`?w_.parse(await a.json()):E_.parse(await a.json());if(!r){let t=typeof e==`string`?e:e.href;if(!(s.issuer===t||t.endsWith(`/`)&&s.issuer===t.slice(0,-1)))throw new rS(`metadata`,t,s.issuer)}return s}}async function JS(e,t){let n,r;try{n=await BS(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch(e){if(e instanceof TypeError)throw e}r||=String(new URL(`/`,e));let i=await qS(r,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function YS(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(bS))throw Error(`Incompatible auth server: does not support response type ${bS}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(xS))throw Error(`Incompatible auth server: does not support code challenge method ${xS}`)}else s=new URL(`/authorize`,e);let c=await Kx(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,bS),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,xS),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.split(` `).includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function XS(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function ZS(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=OS(t?.token_endpoint??new URL(`/token`,e)),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&CS(SS(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await jS(l);let u=await l.json();try{return D_.parse(u)}catch(e){throw typeof u==`object`&&u&&`error`in u?await jS(JSON.stringify(u)):e}}async function QS(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await ZS(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function $S(e,t,{metadata:n,resource:r,authorizationCode:i,iss:a,scope:o,fetchFn:s}={}){i!==void 0&&hS({iss:a,expectedIssuer:n?.issuer,issParameterSupported:mS(n)});let c=o??e.clientMetadata.scope,l;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);l=XS(i,await e.codeVerifier(),e.redirectUrl)}let u=await e.clientInformation({issuer:n?.issuer??String(t)});return ZS(t,{metadata:n,tokenRequestParams:l,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function eC(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o={...n,...r===void 0?{}:{scope:r}},s=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)});if(!s.ok)throw new iS({status:s.status,body:await s.text(),submittedMetadata:o});return N_.parse(await s.json())}var tC=new Set([`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`server/discover`]),nC=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(rC(e))}set(e,t){let n=rC(e),r=tC.has(e.method),i=!this._entries.has(n);if(!r&&i&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let e of this._entries.keys())if(!tC.has(e.slice(0,e.indexOf(`\0`)))){this._entries.delete(e),this._cappedSize--;break}}let a=++this._stamp;return this._entries.set(n,{...t,stamp:a}),i&&!r&&this._cappedSize++,a}delete(e){this._entries.delete(rC(e))&&!tC.has(e.method)&&this._cappedSize--}evict(e){let t=`${e}\0`,n=tC.has(e);for(let e of this._entries.keys())e.startsWith(t)&&(this._entries.delete(e),n||this._cappedSize--)}clear(){this._entries.clear(),this._cappedSize=0}};function rC(e){return`${e.method}\0${JSON.stringify([e.partition??``,e.params??``])}`}function iC(e,t){return t===void 0?e:`${e}\0${t}`}var aC=864e5,oC=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity=``;constructor(e,t,n=()=>{},r=``,i=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=n,this._cachePartition=r,this._now=i}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e===`public`?``:this._cachePartition])}async _probe(e,t){let n={method:e,params:t??``},r=this._partitionFor(`private`),i=await this._store.get({...n,partition:r});if(i!==void 0)return i;let a=this._partitionFor(`public`);if(a===r)return;let o=await this._store.get({...n,partition:a});return o?.scope===`public`?o:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,``)}async _deleteBoth(e,t){let n=this._partitionFor(`private`),r=this._partitionFor(`public`);try{await this._store.delete({method:e,params:t,partition:n})}catch(e){this._reportError(e)}if(r!==n)try{await this._store.delete({method:e,params:t,partition:r})}catch(e){this._reportError(e)}}async evictKey(e,t){let n=iC(e,t),r=this._evictionGeneration.get(n);r!==void 0&&this._evictionGeneration.set(n,r+1),await this._deleteBoth(e,t)}captureGeneration(e,t){let n=iC(e,t),r=this._evictionGeneration.get(n)??0;return this._evictionGeneration.set(n,r),r}async write(e,t,n,r){if((this._evictionGeneration.get(iC(e,r?.params))??0)!==n)return;let i=r?.params??``,a=this._partitionFor(`private`),o=this._partitionFor(`public`),s=(r?.scope??`private`)===`public`?o:a;try{await this._store.set({method:e,params:i,partition:s},{value:sC(t),expiresAt:r?.expiresAt,scope:r?.scope})}catch(e){this._reportError(e)}if(o!==a)try{await this._store.delete({method:e,params:i,partition:s===a?o:a})}catch(e){this._reportError(e)}}async read(e,t){let n=await this._probe(e,t);if(!(n?.expiresAt===void 0||!(n.expiresAt>this.now())))try{let e=JSON.parse(n.value);if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`cached document is not an object`);return{value:e}}catch(n){this._reportError(n),await this._deleteBoth(e,t??``);return}}resetForReconnect(){this._isUserSupplied||this._store.clear(),this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=``}async toolDefinition(e){let t=await this._probe(`tools/list`);if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let e=this._decodeListTools(t),n=new Map;if(e!==void 0)for(let t of e.tools)n.set(t.name,t);this._toolIndex={stamp:t.stamp,byName:n}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let n=await this._probe(`tools/list`);if(n===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==n.stamp){let e=this._decodeListTools(n)??{tools:[]},r=new Map;for(let n of e.tools){let e=t(n);e!==void 0&&r.set(n.name,e)}this._toolOutputValidatorIndex={stamp:n.stamp,byName:r}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every(e=>typeof e==`object`&&!!e))throw TypeError(`cached tools/list document has a malformed tools array`);return t}catch(e){this._reportError(e);return}}};function sC(e){let t;try{t=JSON.stringify(e)}catch(e){throw TypeError(`cache value is not JSON-serializable: ${e instanceof Error?e.message:String(e)}`)}if(typeof t!=`string`)throw TypeError(`cache value is not JSON-serializable: it has no JSON representation`);return t}var cC=-32022,lC=new Set([-32001,-32020,-32021]);function uC(e,t){switch(e.kind){case`result`:return dC(e.result,t);case`rpc-error`:return fC(e,t);case`http-error`:return pC(e,t);case`network-error`:return mC(e.error,t);case`auth-required`:return{kind:`error`,error:e.error};case`timeout`:return t.transportKind===`stdio`?{kind:`legacy`}:{kind:`error`,error:new H_(V_.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function dC(e,t){let n=gy(hy).validateResult(`server/discover`,e);if(!n.ok)return{kind:`legacy`};let r=n.value.supportedVersions,i=t.clientModernVersions.find(e=>r.includes(e));return i===void 0?t.fallbackAvailable?{kind:`legacy`}:{kind:`error`,error:new Lv({supported:[...r],requested:t.requestedVersion})}:{kind:`modern`,version:i,discover:n.value}}function fC(e,t){let{code:n,message:r,data:i}=e;if(n===cC){let e=_C(i);if(e===void 0)return{kind:`legacy`};let n=new Lv({supported:e,requested:vC(i)??t.requestedVersion},r),a=X_(e),o=t.clientModernVersions.find(e=>a.includes(e));return o===void 0?a.length>0?{kind:`error`,error:n}:t.fallbackAvailable?{kind:`legacy`}:{kind:`error`,error:n}:{kind:`corrective`,version:o,error:n}}return lC.has(n),{kind:`legacy`}}function pC(e,t){let n=yC(e.body);return n===void 0?{kind:`legacy`}:fC(n,t)}function mC(e,t){return t.environment===`browser`&&hC(e)?{kind:`legacy`}:{kind:`error`,error:new H_(V_.EraNegotiationFailed,`Version negotiation probe failed: ${gC(e)}`,{cause:e})}}function hC(e){return e instanceof TypeError||e instanceof Error&&e.name===`TypeError`}function gC(e){return e instanceof Error?e.message:String(e)}function _C(e){if(typeof e!=`object`||!e)return;let t=e.supported;if(!(!Array.isArray(t)||t.length===0||!t.every(e=>typeof e==`string`)))return t}function vC(e){if(typeof e!=`object`||!e)return;let t=e.requested;return typeof t==`string`?t:void 0}function yC(e){if(e===void 0||e===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t)return;let n=t.error;if(typeof n!=`object`||!n)return;let{code:r,message:i,data:a}=n;if(typeof r==`number`)return{code:r,message:typeof i==`string`?i:``,data:a}}var bC=`legacy`;function xC(e,t){let n=e?.mode??bC;if(n===`legacy`)return{kind:`legacy`};let r=e?.probe??{};if(typeof n==`object`){if(!J_(n.pin))throw TypeError(`versionNegotiation: { pin: '${n.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:`pin`,version:n.pin,probe:r}}let i=t?X_(t):[];return{kind:`auto`,modernVersions:i.length>0?i:[...q_],fallbackAvailable:t?Y_(t).length>0:!0,probe:r}}function SC(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?`browser`:`node`}function CC(e){return`stderr`in e&&`pid`in e?`stdio`:`http`}var wC=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(e){this._transport=e,this._savedOnMessage=e.onmessage,this._savedOnError=e.onerror,this._savedOnClose=e.onclose}static async open(t){let n=new e(t);t.onmessage=e=>{let t=n._pending;if(t!==void 0&&(wy(e)||Ty(e))&&e.id===t.id){n._pending=void 0,wy(e)?t.resolve({kind:`response`,result:e.result}):t.resolve({kind:`response`,error:e.error});return}},t.onerror=e=>{n._savedOnError?.(e)},t.onclose=()=>{let e=n._pending;e!==void 0&&(n._pending=void 0,e.resolve({kind:`closed`})),n._closeDelivered=!0,n._savedOnClose?.()};try{await t.start()}catch(e){throw n.detach(),e}return n}async exchange(e,t){let n=`server-discover-probe-${++this._probeCounter}`;return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,clearTimeout(o),this._pending?.id===n&&(this._pending=void 0),r(e))},o=setTimeout(()=>a({kind:`timeout`}),t);this._pending={id:n,resolve:a},this._transport.send(e(n)).catch(e=>a({kind:`send-error`,error:e}))})}detach(){this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._transport.onclose=this._closeDelivered?void 0:this._savedOnClose}release(){this.detach();let e=this._transport,t=e.start.bind(e),n=!0;e.start=async()=>{if(n){n=!1,e.start=t;return}return t()}}};function TC(e,t,n,r){return{jsonrpc:`2.0`,id:e,method:`server/discover`,params:{_meta:gy(t).outboundEnvelope({protocolVersion:t,clientInfo:n,clientCapabilities:r})}}}function EC(e,t){switch(e.kind){case`response`:return e.error===void 0?{kind:`result`,result:e.result}:{kind:`rpc-error`,...e.error};case`send-error`:{let t=e.error;if(t instanceof U_){let e=t.data?.text;return{kind:`http-error`,status:t.data.status,body:typeof e==`string`?e:void 0}}return t instanceof pS||t instanceof Error&&t.name===`UnauthorizedError`?{kind:`auth-required`,error:t}:{kind:`network-error`,error:t}}case`closed`:return{kind:`network-error`,error:Error(`Connection closed during the version negotiation probe`)};case`timeout`:return{kind:`timeout`,timeoutMs:t}}}async function DC(e,t){let n=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),i=e.kind===`pin`?[e.version]:e.modernVersions,a=e.kind===`auto`&&e.fallbackAvailable,o=await wC.open(t.transport),s=async()=>{let s=i[0],c=!1,l=r;for(;;){let r=await o.exchange(e=>TC(e,s,t.clientInfo,t.capabilities),n);if(r.kind===`timeout`&&l>0){l--;continue}let u=uC(EC(r,n),{clientModernVersions:i,requestedVersion:s,fallbackAvailable:a,environment:t.environment,transportKind:t.transportKind});switch(u.kind){case`modern`:return{era:`modern`,version:u.version,discover:u.discover};case`corrective`:if(c)throw u.error;c=!0,s=u.version;continue;case`legacy`:if(e.kind===`pin`)throw new H_(V_.EraNegotiationFailed,`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new H_(V_.EraNegotiationFailed,`Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to`);return{era:`legacy`};case`error`:throw u.error}}},c;try{c=await s()}catch(e){throw o.detach(),e}return o.release(),c}function OC(e,t){if(!(!e||typeof t!=`object`||!t)){if(e.type===`object`&&e.properties&&typeof e.properties==`object`){let n=t,r=e.properties;for(let e of Object.keys(r)){let t=r[e];n[e]===void 0&&Object.prototype.hasOwnProperty.call(t,`default`)&&(n[e]=t.default),n[e]!==void 0&&OC(t,n[e])}}if(Array.isArray(e.anyOf))for(let n of e.anyOf)typeof n!=`boolean`&&OC(n,t);if(Array.isArray(e.oneOf))for(let n of e.oneOf)typeof n!=`boolean`&&OC(n,t)}}function kC(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}var AC={"notifications/tools/list_changed":[`tools/list`],"notifications/prompts/list_changed":[`prompts/list`],"notifications/resources/list_changed":[`resources/list`,`resources/templates/list`]},jC=64,MC=class extends Bb{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new H_(V_.ConnectionClosed,`subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset`);for(let t of this._listenState.values())t.settle({cause:`remote`,error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t),this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Bx,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=xb(t?.inputRequired),this._cache=new oC(t?.responseCacheStore??new nC,t?.responseCacheStore!==void 0,e=>this._reportStoreError(e),t?.cachePartition??``),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??jC,t?.listChanged&&(this._listChangedConfig=t.listChanged)}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&J_(this._negotiatedProtocolVersion)&&Sy(e))return`drop`}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){return this._inputRequiredDriverConfig.autoFulfill?Yb({getRequestHandler:e=>this._getRequestHandler(e),buildContext:e=>this.buildContext(e,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t):Promise.reject(new H_(V_.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:`input_required`,method:t.request.method}))}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler(`tools`,`notifications/tools/list_changed`,e.tools,async()=>(await this.listTools(void 0,{cacheMode:`refresh`})).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler(`prompts`,`notifications/prompts/list_changed`,e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:`refresh`})).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler(`resources`,`notifications/resources/list_changed`,e.resources,async()=>(await this.listResources(void 0,{cacheMode:`refresh`})).resources)}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=Hb(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error(`Cannot configure version negotiation after connecting to transport`);this._versionNegotiation=e}_wrapHandler(e,t){return e===`elicitation/create`?async(e,n)=>{let r=gy(this._negotiatedProtocolVersion),i=r.validateRequest(`elicitation/create`,e);if(!i.ok&&i.reason===`not-in-era`&&(i=r.validateInputRequest(`elicitation/create`,e)),!i.ok)throw new Pv(i.reason===`not-in-era`?Nv.InternalError:Nv.InvalidParams,i.reason===`not-in-era`?`No wire schema for elicitation/create in the resolved era`:`Invalid elicitation request: ${i.message}`);let{params:a}=i.value;a.mode=a.mode??`form`;let{supportsFormMode:o,supportsUrlMode:s}=kC(this._capabilities.elicitation);if(a.mode===`form`&&!o)throw new Pv(Nv.InvalidParams,`Client does not support form-mode elicitation requests`);if(a.mode===`url`&&!s)throw new Pv(Nv.InvalidParams,`Client does not support URL-mode elicitation requests`);let c=await t(e,n),l=r.validateResult(`elicitation/create`,c);if(!l.ok&&l.reason===`not-in-era`&&(l=r.validateInputResponse(`elicitation/create`,c)),!l.ok)throw new Pv(l.reason===`not-in-era`?Nv.InternalError:Nv.InvalidParams,l.reason===`not-in-era`?`No wire schema for elicitation/create in the resolved era`:`Invalid elicitation result: ${l.message}`);let u=l.value,d=a.mode===`form`?a.requestedSchema:void 0;if(a.mode===`form`&&u.action===`accept`&&u.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{OC(d,u.content)}catch{}return u}:e===`sampling/createMessage`?async(e,n)=>{let r=gy(this._negotiatedProtocolVersion),i=r.validateRequest(`sampling/createMessage`,e);if(!i.ok&&i.reason===`not-in-era`&&(i=r.validateInputRequest(`sampling/createMessage`,e)),!i.ok)throw new Pv(i.reason===`not-in-era`?Nv.InternalError:Nv.InvalidParams,i.reason===`not-in-era`?`No wire schema for sampling/createMessage in the resolved era`:`Invalid sampling request: ${i.message}`);let{params:a}=i.value,o=await t(e,n),s=!!(a.tools||a.toolChoice),c=r.samplingResultVariant(s,o);if(!c.ok&&c.reason===`not-in-era`&&(c=r.validateInputResponse(`sampling/createMessage`,o)),!c.ok)throw new Pv(c.reason===`not-in-era`?Nv.InternalError:Nv.InvalidParams,c.reason===`not-in-era`?`No result schema for sampling/createMessage in the resolved era`:`Invalid sampling result: ${c.message}`);return c.value}:t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new H_(V_.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!==void 0)return this._connectFromPrior(e,t.prior);let n=xC(this._versionNegotiation,this._supportedProtocolVersionsOption);if(n.kind!==`legacy`)return this._connectNegotiated(e,n,t);if(await super.connect(e),e.sessionId!==void 0){let t=this._negotiatedProtocolVersion;t!==void 0&&e.setProtocolVersion?.(t);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let n=Y_(this._supportedProtocolVersions);try{let r=n[0];if(r===void 0)throw new H_(V_.EraNegotiationFailed,`Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version`);let i=await this.request({method:`initialize`,params:{protocolVersion:r,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(i===void 0)throw Error(`Server sent invalid initialize result: ${i}`);if(!n.includes(i.protocolVersion))throw Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion&&e.setProtocolVersion(i.protocolVersion),this._instructions=i.instructions,await this.notification({method:`notifications/initialized`}),this._negotiatedProtocolVersion=i.protocolVersion,this._listChangedConfig&&this._setupListChangedHandlers(this._listChangedConfig)}catch(e){throw this.close(),e}}async _connectNegotiated(e,t,n){if(e.sessionId!==void 0){await super.connect(e);let t=this._negotiatedProtocolVersion;t!==void 0&&e.setProtocolVersion&&e.setProtocolVersion(t);return}this._resetConnectionState();let r;try{r=await DC(t,{transport:e,clientInfo:this._clientInfo,capabilities:this._capabilities,environment:SC(),transportKind:CC(e),defaultTimeoutMs:n?.timeout??6e4})}catch(t){throw await e.close().catch(()=>{}),t}if(await super.connect(e),r.era===`legacy`){await this._legacyHandshake(e,n);return}if(this._serverCapabilities=r.discover.capabilities,this._serverVersion=r.discover.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.discover.instructions,this._discoverResult=r.discover,this._negotiatedProtocolVersion=r.version,e.setProtocolVersion&&e.setProtocolVersion(r.version),this._listChangedConfig){let e=this._listChangedConfig,t=this._serverCapabilities,r={...e.tools&&t?.tools?.listChanged&&{tools:e.tools},...e.prompts&&t?.prompts?.listChanged&&{prompts:e.prompts},...e.resources&&t?.resources?.listChanged&&{resources:e.resources}},i=!0;try{this._setupListChangedHandlers(r)}catch(e){i=!1,this.onerror?.(e instanceof Error?e:Error(String(e)))}let a=i?{...r.tools&&{toolsListChanged:!0},...r.prompts&&{promptsListChanged:!0},...r.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(a).length>0){let e=new AbortController,t=()=>e.abort(n?.signal?.reason);n?.signal?.aborted&&t(),n?.signal?.addEventListener(`abort`,t);try{this._autoOpenedSubscription=await this.listen(a,{timeout:n?.timeout,signal:e.signal})}catch(e){if(n?.signal?.aborted)throw await this.close().catch(()=>{}),e;this.onerror?.(e instanceof Error?e:Error(String(e)))}finally{n?.signal?.removeEventListener(`abort`,t)}}}}async _connectFromPrior(e,t){this._resetConnectionState();let n=this._supportedProtocolVersionsOption,r=(n&&X_(n).length>0?X_(n):q_).find(e=>t.supportedVersions.includes(e));if(r===void 0)throw new H_(V_.EraNegotiationFailed,`connect({ prior }) requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. Use versionNegotiation: { mode: 'auto' } for legacy-era fallback.`);if(await super.connect(e),this._discoverResult=t,this._serverCapabilities=t.capabilities,this._serverVersion=t.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=t.instructions,this._negotiatedProtocolVersion=r,e.setProtocolVersion?.(r),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;return t===void 0?e.sessionId??``:`${t.name}@${t.version}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e!==void 0)return J_(e)?`modern`:`legacy`}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case`logging/setLevel`:if(!this._serverCapabilities?.logging)throw new H_(V_.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._serverCapabilities?.prompts)throw new H_(V_.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:case`resources/subscribe`:case`resources/unsubscribe`:if(!this._serverCapabilities?.resources)throw new H_(V_.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e===`resources/subscribe`&&!this._serverCapabilities.resources.subscribe)throw new H_(V_.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._serverCapabilities?.tools)throw new H_(V_.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case`completion/complete`:if(!this._serverCapabilities?.completions)throw new H_(V_.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case`initialize`:break;case`server/discover`:break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/roots/list_changed`:if(!this._capabilities.roots?.listChanged)throw new H_(V_.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case`notifications/initialized`:break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){switch(e){case`sampling/createMessage`:if(!this._capabilities.sampling)throw new H_(V_.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case`elicitation/create`:if(!this._capabilities.elicitation)throw new H_(V_.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case`roots/list`:if(!this._capabilities.roots)throw new H_(V_.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case`ping`:break}}async ping(e){return this.request({method:`ping`},e)}async discover(e){let t=await this._requestWithSchema({method:`server/discover`},th,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:`completion/complete`,params:e},t)}async setLoggingLevel(e,t){return this.request({method:`logging/setLevel`,params:{level:e}},t)}async getPrompt(e,t){return this.request({method:`prompts/get`,params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug(`Client.listPrompts() called but server does not advertise prompts capability - returning empty list`),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:`prompts/list`,params:e},t);let n=await this._serveFromCache(`prompts/list`,void 0,t);return n===void 0?this._listAllPages(`prompts/list`,e,t,(e,t)=>e.prompts.push(...t.prompts)):n}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug(`Client.listResources() called but server does not advertise resources capability - returning empty list`),{resources:[]};if(e?.cursor!==void 0)return this.request({method:`resources/list`,params:e},t);let n=await this._serveFromCache(`resources/list`,void 0,t);return n===void 0?this._listAllPages(`resources/list`,e,t,(e,t)=>e.resources.push(...t.resources)):n}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug(`Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list`),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:`resources/templates/list`,params:e},t);let n=await this._serveFromCache(`resources/templates/list`,void 0,t);return n===void 0?this._listAllPages(`resources/templates/list`,e,t,(e,t)=>e.resourceTemplates.push(...t.resourceTemplates)):n}async _listAllPages(e,t,n,r,i){let a=n?.cacheMode===`bypass`,o=this._cache.captureGeneration(e),s=await this.request({method:e,...t&&{params:{...t}}},n),c=s.nextCursor,l=new Set,u=1;for(;c!==void 0&&!l.has(c);){if(this._listMaxPages!==0&&u>=this._listMaxPages)throw new H_(V_.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});l.add(c);let i=await this.request({method:e,params:{...t,cursor:c}},n);r(s,i),c=i.nextCursor,u++}return delete s.nextCursor,i?.(s),a||await this._cache.write(e,s,o,this._freshness(s)),s}_freshness(e,t){let n=e,r=typeof n.ttlMs==`number`?n.ttlMs:this._defaultCacheTtlMs,i=n.cacheScope===`public`?`public`:`private`;return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),aC),scope:i,params:t}}async _serveFromCache(e,t,n){if(n?.cacheMode===`bypass`||n?.cacheMode===`refresh`)return;let r=await this._cache.read(e,t).catch(e=>void this._reportStoreError(e));if(r!==void 0){if(n?.signal?.aborted){let e=n.signal.reason;throw e instanceof H_?e:new H_(V_.RequestTimeout,String(e))}return r.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(e.outputSchema)try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(e){return{ok:!1,compileError:e}}}async _resolveXMcpHeaderScan(e,t){let n=t??await this._cache.toolDefinition(e);return n===void 0?void 0:Ny(n.inputSchema)}async readResource(e,t){let n=await this._serveFromCache(`resources/read`,e.uri,t);if(n!==void 0)return n;let r=this._cache.captureGeneration(`resources/read`,e.uri),i=await this.request({method:`resources/read`,params:e},t);if(t?.cacheMode!==`bypass`){let n=this._freshness(i,e.uri);n.expiresAt>this._cache.now()?await this._cache.write(`resources/read`,i,r,n):t?.cacheMode===`refresh`&&await this._cache.evictKey(`resources/read`,e.uri)}return i}async subscribeResource(e,t){return this.request({method:`resources/subscribe`,params:e},t)}async unsubscribeResource(e,t){return this.request({method:`resources/unsubscribe`,params:e},t)}async listen(e,t){if(this.transport===void 0)throw new H_(V_.NotConnected,`Not connected`);let n=this._negotiatedProtocolVersion;if(n===void 0||!J_(n))throw new H_(V_.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${n??`none`}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:`subscriptions/listen`,protocolVersion:n});if(t?.signal?.aborted){let e=t.signal.reason;throw e instanceof H_?e:new H_(V_.RequestTimeout,String(e))}let r=new AbortController,i=`listen:${this._nextListenId++}`,a=`opening`,o,s,c,l,u=new Promise((e,t)=>{c=e,l=t}),d,f=new Promise(e=>{d=e}),p=e=>{if(a===`closed`)return;let n=a===`opening`;if(o!==void 0&&(clearTimeout(o),o=void 0),`ack`in e){a=`open`,c(e.ack);return}a=`closed`,s!==void 0&&t?.signal?.removeEventListener(`abort`,s),this._listenState.delete(i),r.abort(),d(e.cause),n&&l(e.error??new H_(V_.ConnectionClosed,`subscriptions/listen closed before the server acknowledged`))},m=async()=>{r.abort(),await this.notification({method:`notifications/cancelled`,params:{requestId:i}}).catch(()=>{})},h=async()=>{a!==`closed`&&(p({cause:`local`}),await m())};this._listenState.set(i,{settle:p});let g=t?.timeout??6e4;if(o=setTimeout(()=>{p({cause:`remote`,error:new H_(V_.RequestTimeout,`subscriptions/listen ack timed out`,{timeout:g})}),m().catch(()=>{})},g),t?.signal){let e=t.signal;s=()=>{if(a===`closed`)return;let t=e.reason;p({cause:`local`,error:t instanceof Error?t:Error(String(t??`Aborted`))}),m().catch(()=>{})},e.addEventListener(`abort`,s,{once:!0})}let _={jsonrpc:`2.0`,id:i,method:`subscriptions/listen`,params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}};try{await this.transport.send(_,{requestSignal:r.signal,onRequestStreamEnd:()=>p({cause:`remote`,error:Error(`subscriptions/listen: stream ended`)})})}catch(e){p({cause:`remote`,error:e instanceof Error?e:Error(String(e))})}return{honoredFilter:await u,close:h,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let n=Object.hasOwn(AC,e.method)?AC[e.method]:void 0;if(e.method===`notifications/resources/updated`){let t=e.params?.uri;typeof t==`string`&&this._cache.evictKey(`resources/read`,t)}else if(n!==void 0)for(let e of n)this._cache.evict(e);if(e.method===`notifications/subscriptions/acknowledged`){let t=e.params?._meta?.[hm],n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){let t=this._wireCodec().validateNotification(`notifications/subscriptions/acknowledged`,e);n.settle({ack:t.ok?t.value.params.notifications:{}});return}}if(e.method===`notifications/cancelled`){let t=e.params?.requestId,n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){n.settle({cause:`remote`,error:Error(`subscriptions/listen: server cancelled the subscription`)});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,n=typeof t==`string`?this._listenState.get(t):void 0;if(n!==void 0){Ty(e)?n.settle({cause:`remote`,error:Pv.fromError(e.error.code,e.error.message,e.error.data)}):n.settle({cause:`graceful`,error:new H_(V_.ConnectionClosed,`subscriptions/listen: server closed the subscription gracefully before acknowledging`)});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new H_(V_.ConnectionClosed,`Connection closed`);for(let t of this._listenState.values())t.settle({cause:`remote`,error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let n=this.getProtocolEra()===`modern`&&SC()!==`browser`,r=async()=>{if(!n)return t;let r;try{r=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(e){this._reportStoreError(e)}if(!r?.valid||r.declarations.length===0)return t;let i=Wy(r.declarations,e.arguments);return Object.keys(i).length===0?t:{...t,headers:{...t?.headers,...i}}},i=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)):this._compileOutputValidator(t.toolDefinition),a=()=>{if(i===void 0||i.ok)return;let t=i.compileError,n=(t instanceof Error?t.message:String(t)).slice(0,200);throw new Pv(Nv.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${n}`)};a();let o;try{o=await this.request({method:`tools/call`,params:e},await r())}catch(s){let c=s instanceof Pv&&s.code===-32020;if(!n||!c||t?.toolDefinition!==void 0)throw s;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:`refresh`};await this._cache.evict(`tools/list`),await this.listTools(void 0,l).catch(e=>this._reportStoreError(e)),i=await this._cache.outputValidator(e.name,e=>this._compileOutputValidator(e)).catch(e=>void this._reportStoreError(e)),a(),o=await this.request({method:`tools/call`,params:e},await r())}let s=i!==void 0&&i.ok?i.validator:void 0;if(s){if(o.structuredContent===void 0&&!o.isError)throw new Pv(Nv.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent!==void 0&&!o.isError)try{let e=s(o.structuredContent);if(!e.valid)throw new Pv(Nv.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){throw e instanceof Pv?e:new Pv(Nv.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return o}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug(`Client.listTools() called but server does not advertise tools capability - returning empty list`),{tools:[]};if(e?.cursor!==void 0){let n=await this.request({method:`tools/list`,params:e},t);return this._excludeInvalidXMcpHeaderTools(n),n}let n=await this._serveFromCache(`tools/list`,void 0,t);return n===void 0?this._listAllPages(`tools/list`,e,t,(e,t)=>e.tools.push(...t.tools),e=>this._excludeInvalidXMcpHeaderTools(e)):n}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!==`modern`||!this.transport||CC(this.transport)===`stdio`)return;let t=e.tools.filter(e=>{let t=Ny(e.inputSchema);return t.valid?!0:(console.warn(`[mcp-sdk] excluding tool '${e.name}' from tools/list: invalid x-mcp-header declaration — ${t.reason}`),!1)});t.length!==e.tools.length&&(e.tools=t)}_setupListChangedHandler(e,t,n,r){let i=Gy(dg,n);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!=`function`)throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:o}=i.data,{onChanged:s}=n,c=async()=>{if(!a){s(null,null);return}try{s(null,await r())}catch(e){s(e instanceof Error?e:Error(String(e)),null)}};this.setNotificationHandler(t,()=>{if(o){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let n=setTimeout(c,o);this._listChangedDebounceTimers.set(e,n)}else c()})}async sendRootsListChanged(){return this.notification({method:`notifications/roots/list_changed`})}};(class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return R_(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return R_(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,L_(this,new.target)}});var NC=1,PC={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},FC=new Set([`authorization`,`content-type`,`mcp-protocol-version`,`mcp-method`,`mcp-name`,`mcp-session-id`]);function IC(e,t){if(typeof AbortSignal.any==`function`)return AbortSignal.any([e,t]);let n=new AbortController;if(e.aborted)return n.abort(e.reason),n.signal;if(t.aborted)return n.abort(t.reason),n.signal;let r=()=>{e.removeEventListener(`abort`,i),t.removeEventListener(`abort`,a)};function i(){r(),n.abort(e.reason)}function a(){r(),n.abort(t.reason)}return e.addEventListener(`abort`,i,{once:!0}),t.addEventListener(`abort`,a,{once:!0}),n.signal}var LC=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,uS(t?.authProvider)?(this._oauthProvider=t.authProvider,this._authProvider=fS(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation})):this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=ex(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??PC,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??`reauthorize`,this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??NC)}async _stepUpAuthorize(e,t){if(this._onInsufficientScope===`throw`||!this._oauthProvider)throw new sS({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new U_(V_.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??`Forbidden`,text:e.text});e.resourceMetadataUrl&&(this._resourceMetadataUrl=e.resourceMetadataUrl);let n=await this._oauthProvider.tokens(),r=gS(this._scope,n?.scope,e.scope);this._scope=r;let i=_S(r,n?.scope);return MS(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:r,forceReauthorization:i,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}async _commonHeaders(){let e={},t=await this._authProvider?.token();t&&(e.Authorization=`Bearer ${t}`),this._sessionId&&(e[`mcp-session-id`]=this._sessionId),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let n=$b(this._requestInit?.headers);return new Headers({...e,...n})}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!Sy(t))return;let n=t.params?._meta?.[fm];if(typeof n!=`string`)return;e.set(`mcp-protocol-version`,n),e.set(`mcp-method`,t.method);let r=t.params,i=t.method===`resources/read`?typeof r?.uri==`string`?r.uri:void 0:typeof r?.name==`string`?r.name:void 0;i!==void 0&&e.set(`mcp-name`,Hy(i))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!Sy(e))return!1;let t=e.params?._meta?.[fm];return typeof t==`string`&&J_(t)}async _startOrAuthSse(e,t=!1,n=0){let{resumptionToken:r,requestSignal:i}=e,a=()=>this._abortController?.signal.aborted===!0||i?.aborted===!0;try{let a=await this._commonHeaders(),o=[...a.get(`accept`)?.split(`,`).map(e=>e.trim().toLowerCase())??[],`text/event-stream`];a.set(`accept`,[...new Set(o)].join(`, `)),r&&a.set(`last-event-id`,r);let s=this._abortController?.signal,c=i!==void 0&&s!==void 0?IC(s,i):i??s,l=await(this._fetch??fetch)(this._url,{...this._requestInit,method:`GET`,headers:a,signal:c});if(!l.ok){if(l.status===401&&this._authProvider){if(l.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=RS(l);this._resourceMetadataUrl=e,this._scope=gS(this._scope,t)}if(this._authProvider.onUnauthorized&&!t)return await this._authProvider.onUnauthorized({response:l,serverUrl:this._url,fetchFn:this._fetchWithInit}),await l.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,n);throw await l.text?.().catch(()=>{}),t?new U_(V_.ClientHttpAuthentication,`Server returned 401 after re-authentication`,{status:401,statusText:l.statusText}):new pS}if(l.status===403){let{resourceMetadataUrl:r,scope:i,error:a,errorDescription:o}=RS(l);if(a===`insufficient_scope`){let a=await l.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:i,resourceMetadataUrl:r,errorDescription:o,statusText:l.statusText,text:a},n)!==`AUTHORIZED`)throw new pS;return this._startOrAuthSse(e,t,n+1)}}if(await l.text?.().catch(()=>{}),l.status===405){e.onRequestStreamEnd?.();return}throw new U_(V_.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${l.statusText}`,{status:l.status,statusText:l.statusText})}this._handleSseStream(l.body,e,!0)}catch(e){throw a()||this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*n**+e,r)}_scheduleReconnection(e,t=0){let n=this._reconnectionOptions.maxRetries;if(t>=n){this.onerror?.(Error(`Maximum reconnection attempts (${n}) exceeded.`)),e.onRequestStreamEnd?.();return}let r=this._getNextReconnectionDelay(t),i=()=>{this._cancelReconnection=void 0,!(this._abortController?.signal.aborted||e.requestSignal?.aborted)&&this._startOrAuthSse(e).catch(n=>{if(!(this._abortController?.signal.aborted||e.requestSignal?.aborted)){this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`));try{this._scheduleReconnection(e,t+1)}catch(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}}})};if(this._reconnectionScheduler){let e=this._reconnectionScheduler(i,r,t);this._cancelReconnection=typeof e==`function`?e:void 0}else{let e=setTimeout(i,r);this._cancelReconnection=()=>clearTimeout(e)}}_handleSseStream(e,t,n){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o}=t,s=()=>this._abortController?.signal.aborted===!0||a?.aborted===!0,c,l=!1,u=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new Zx({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:n}=await t.read();if(n)break;if(e.id&&(c=e.id,l=!0,r?.(e.id)),e.data&&(!e.event||e.event===`message`))try{let t=Im.parse(JSON.parse(e.data));(wy(t)||Ty(t))&&(u=!0,i!==void 0&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(n||l)&&!u&&this._abortController&&!s()?this._scheduleReconnection({resumptionToken:c,onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o},0):s()||o?.()}catch(e){if(s())return;if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(n||l)&&!u&&this._abortController&&!s())try{this._scheduleReconnection({resumptionToken:c,onresumptiontoken:r,replayMessageId:i,requestSignal:a,onRequestStreamEnd:o},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`)),o?.()}else o?.()}})()}async start(){if(this._abortController)throw Error(`StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.`);this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new pS(`finishAuth requires an OAuthClientProvider`);let{authorizationCode:n,iss:r}=await vS(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await MS(this._oauthProvider,{serverUrl:this._url,authorizationCode:n,iss:r,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!==`AUTHORIZED`)throw new pS(`Failed to authorize`)}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,n,r=0){try{let{resumptionToken:i,onresumptiontoken:a}=t||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:Sy(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch(e=>this.onerror?.(e));return}let o=await this._commonHeaders();this._applyBodyDerivedHeaders(o,e);let s=Array.isArray(e)?e.some(e=>Dy(e)):Dy(e);if(s&&o.delete(`mcp-session-id`),t?.headers!==void 0)for(let[e,n]of Object.entries(t.headers))FC.has(e.toLowerCase())||o.set(e,n);o.set(`content-type`,`application/json`);let c=[...o.get(`accept`)?.split(`,`).map(e=>e.trim().toLowerCase())??[],`application/json`,`text/event-stream`];o.set(`accept`,[...new Set(c)].join(`, `));let l=this._abortController?.signal,u=t?.requestSignal!==void 0&&l!==void 0?IC(l,t.requestSignal):t?.requestSignal??l,d={...this._requestInit,method:`POST`,headers:o,body:JSON.stringify(e),signal:u},f=await(this._fetch??fetch)(this._url,d);if(s&&f.ok&&(this._sessionId=f.headers.get(`mcp-session-id`)||void 0),!f.ok){if(f.status===401&&this._authProvider){if(f.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=RS(f);this._resourceMetadataUrl=e,this._scope=gS(this._scope,t)}if(this._authProvider.onUnauthorized&&!n)return await this._authProvider.onUnauthorized({response:f,serverUrl:this._url,fetchFn:this._fetchWithInit}),await f.text?.().catch(()=>{}),this._send(e,t,!0,r);throw await f.text?.().catch(()=>{}),n?new U_(V_.ClientHttpAuthentication,`Server returned 401 after re-authentication`,{status:401,statusText:f.statusText}):new pS}let i=await f.text?.().catch(()=>null);if(f.status===403){let{resourceMetadataUrl:a,scope:o,error:s,errorDescription:c}=RS(f);if(s===`insufficient_scope`){if(await this._stepUpAuthorize({scope:o,resourceMetadataUrl:a,errorDescription:c,statusText:f.statusText,text:i},r)!==`AUTHORIZED`)throw new pS;return this._send(e,t,n,r+1)}}if(f.status===400&&typeof i==`string`&&this._isModernEnvelopedRequest(e))try{let t=Im.parse(JSON.parse(i)),n=(Array.isArray(e)?e:[e]).filter(e=>Sy(e));if(Ty(t)&&n.some(e=>e.id===t.id)){this.onmessage?.(t);return}}catch{}throw new U_(V_.ClientHttpNotImplemented,`Error POSTing to endpoint: ${i}`,{status:f.status,statusText:f.statusText,text:i})}if(f.status===202){await f.text?.().catch(()=>{}),Oy(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let p=(Array.isArray(e)?e:[e]).some(e=>`method`in e&&`id`in e&&e.id!==void 0),m=f.headers.get(`content-type`),h=Qb(m);if(p)if(h===`text/event-stream`)this._handleSseStream(f.body,{onresumptiontoken:a,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(h===`application/json`){let e=await f.json(),t=Array.isArray(e)?e.map(e=>Im.parse(e)):[Im.parse(e)];for(let e of t)this.onmessage?.(e)}else throw await f.text?.().catch(()=>{}),new H_(V_.ClientHttpUnexpectedContent,`Unexpected content type: ${m}`,{contentType:m});else await f.text?.().catch(()=>{})}catch(e){throw t?.requestSignal?.aborted!==!0&&this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:`DELETE`,headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,t);if(await n.text?.().catch(()=>{}),!n.ok&&n.status!==405)throw new U_(V_.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${n.statusText}`,{status:n.status,statusText:n.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}},RC=t({BaseConnector:()=>tT,BrowserOAuthClientProvider:()=>Rw,DialectJsonSchemaValidator:()=>$w,HttpConnector:()=>iT,MCPClient:()=>pT,MCPConnection:()=>lT,MCPSession:()=>lT,POSTHOG_API_KEY:()=>ow,POSTHOG_HOST:()=>aw,SCARF_GATEWAY_URL:()=>sw,Tel:()=>jw,Telemetry:()=>Aw,VERSION:()=>XC,capturePostHog:()=>hw,captureScarf:()=>gw,completeOAuthFlow:()=>Kw,createOAuthProvider:()=>zw,getPackageVersion:()=>ZC,isUnauthorized:()=>Gw,logger:()=>Q,normalizeClientInfo:()=>cT,resolveCallbacks:()=>aT,setTelemetrySource:()=>Mw,shouldAutoProvisionOAuth:()=>oT,telFetch:()=>iw}),zC;function BC(e){zC=e}function VC(e,t){zC?.addServer(e,t)}function HC(e){zC?.removeServer(e)}var UC;function WC(e){UC=e}function GC(e){UC?.(e)}var KC=[`silent`,`error`,`warn`,`info`,`http`,`verbose`,`debug`,`silly`],qC={silent:``,error:`❌`,warn:`⚠️`,info:`ℹ️`,http:`🌐`,verbose:`📝`,debug:`🔍`,silly:`🤪`};function JC(){let e;try{e=typeof process<`u`?{}.MCP_USE_LOG_LEVEL??{}.DEBUG:void 0}catch{}let t=e?.trim().toLowerCase();return t===`2`?`debug`:t&&KC.includes(t)?t:`info`}var YC=class{constructor(e=`mcp-use`,t=`info`,n=`minimal`){this.name=e,this.level=t,this.format=n}write(e,t,n){if(this.level===`silent`||KC.indexOf(e)>KC.indexOf(this.level))return;let r=n.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `),i=r?`${t} ${r}`:t,a=new Date().toLocaleTimeString(`en-US`,{hour12:!1}),o=this.format===`minimal`?e:e.toUpperCase(),s=this.format===`emoji`?` ${qC[e]}`:``,c=`${a} [${this.name}]${s} ${o}: ${i}`;(e===`error`?console.error:e===`warn`?console.warn:e===`info`?console.info:e===`debug`?console.debug:console.log)(c)}error=(e,...t)=>this.write(`error`,e,t);warn=(e,...t)=>this.write(`warn`,e,t);info=(e,...t)=>this.write(`info`,e,t);debug=(e,...t)=>this.write(`debug`,e,t);http=(e,...t)=>this.write(`http`,e,t);verbose=(e,...t)=>this.write(`verbose`,e,t);silly=(e,...t)=>this.write(`silly`,e,t);setFormat(e){this.format=e}},Q=class{static instances={};static currentFormat=`minimal`;static currentLevel;static get(e=`mcp-use`){return this.instances[e]??=new YC(e,this.currentLevel??JC(),this.currentFormat)}static configure({level:e=JC(),format:t=`minimal`}={}){this.currentLevel=e,this.currentFormat=t;for(let n of Object.values(this.instances))n.level=e,n.format=t}static setDebug(e){let t=e===2||e===!0?`debug`:`info`;this.currentLevel=t;for(let e of Object.values(this.instances))e.level=t;try{typeof process<`u`&&({}.MCP_USE_LOG_LEVEL=t)}catch{}}static setFormat(e){this.configure({format:e})}}.get(),XC=`2.0.0-beta.0`;function ZC(){return XC}var QC=class{},$C=class extends QC{constructor(e){super(),this.data=e}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}},ew=class extends QC{constructor(e){super(),this.data=e}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},tw=class extends QC{constructor(e){super(),this.data=e}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},nw=class extends QC{constructor(e){super(),this.data=e}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},rw=class extends QC{constructor(e){super(),this.data=e}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};async function iw(e,t){try{await fetch(e,t)}catch{}}var aw=`https://eu.i.posthog.com`,ow=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`,sw=`https://mcpuse.gateway.scarf.sh/events-ts`,cw=`https://mcpuse.gateway.scarf.sh/simple/`,lw=1800,uw=new Set([`query`,`response`,`messages`]);function dw(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function fw(e,t=cw){let n=new URLSearchParams;for(let[t,r]of Object.entries(e)){let e=dw(r);uw.has(t)&&e.length>120&&(e=`${e.slice(0,117)}...`),e!==``&&n.set(t,e)}let r=`${t}${t.includes(`?`)?`&`:`?`}${n.toString()}`;if(r.length<=lw)return r;let i=[...n.keys()].sort((e,t)=>(n.get(t)?.length??0)-(n.get(e)?.length??0));for(let e of i){if(r.length<=lw)break;e===`event`||e===`user_id`||(n.delete(e),r=`${t}${t.includes(`?`)?`&`:`?`}${n.toString()}`)}return r.slice(0,lw)}function pw(e,t){return iw(t,{method:`POST`,headers:{"Content-Type":`application/json`},keepalive:!0,body:JSON.stringify(e)})}function mw(e,t){try{let n=fw(e,t),r=new Image;r.referrerPolicy=`no-referrer-when-downgrade`,r.src=n}catch{}return Promise.resolve()}function hw(e){let t=e.host??`https://eu.i.posthog.com`,n=e.apiKey??`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;return iw(`${t}/i/v0/e/`,{method:`POST`,headers:{"Content-Type":`application/json`},keepalive:!0,body:JSON.stringify({api_key:n,event:e.event,distinct_id:e.distinctId,properties:e.properties,timestamp:new Date().toISOString()})})}function gw(e,t=sw){return typeof window<`u`?mw(e,t===`https://mcpuse.gateway.scarf.sh/events-ts`?cw:t):pw(e,t)}function _w(){return globalThis.crypto.randomUUID()}function vw(){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function yw(e,t){let n=e=>e.split(`-`)[0].split(`.`).map(e=>parseInt(e,10)||0),r=n(e),i=n(t),a=Math.max(r.length,i.length);for(let e=0;e<a;e++){let t=r[e]??0,n=i[e]??0;if(t!==n)return t>n}return!1}var bw=`mcp_use_user_id`,xw=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`,Sw=`https://eu.i.posthog.com`,Cw=null;function ww(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}function Tw(){if(!ww())return null;try{localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`)}catch{return null}return{getUserId(){try{return localStorage.getItem(bw)}catch{return null}},setUserId(e){try{localStorage.setItem(bw,e)}catch{}},getDownloadedVersion:()=>null,setDownloadedVersion:()=>void 0}}function Ew(){try{return globalThis.Bun===void 0?globalThis.Deno===void 0?typeof navigator<`u`&&navigator.userAgent?.includes(`Cloudflare-Workers`)?`cloudflare-workers`:globalThis.EdgeRuntime===void 0?typeof window<`u`&&typeof document<`u`?`browser`:typeof process<`u`&&process.versions?.node!==void 0?`node`:`unknown`:`edge`:`deno`:`bun`}catch{return`unknown`}}function Dw(){if(typeof process<`u`&&{}.MCP_USE_TELEMETRY_SOURCE)return{}.MCP_USE_TELEMETRY_SOURCE;try{if(ww())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)??void 0}catch{}}function Ow(){if(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||typeof process<`u`&&{}.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase()===`false`)return!0;try{if(ww()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)return!0}catch{}return!1}function kw(){try{return`session-${_w()}`}catch{return`session-${Date.now()}-${vw()}`}}var Aw=class e{static instance=null;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_telemetryEnabled=!1;_pending=new Set;_scarfEnabled=!1;_runtimeEnvironment;_storageCapability;_storage;_fsBacked;_source;_productVersion;constructor(){this._runtimeEnvironment=Ew(),this._fsBacked=Cw!==null,this._storage=Cw??Tw()??null,this._storageCapability=this._storage?`persistent`:`session-only`,this._source=Dw()||this._runtimeEnvironment;let e=Ow(),t=this._runtimeEnvironment!==`unknown`;e?(this._telemetryEnabled=!1,Q.debug(`Telemetry disabled via opt-out`)):t?(Q.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable.`),this._telemetryEnabled=!0,this._scarfEnabled=!0,this._fsBacked&&setTimeout(()=>{this.trackPackageDownload({triggered_by:`initialization`}).catch(e=>Q.debug(`Failed to track package download: ${e}`))},0)):(this._telemetryEnabled=!1,Q.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{ww()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}Q.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}setProductVersion(e){this._productVersion=e}get isEnabled(){return this._telemetryEnabled||this._scarfEnabled}get userId(){if(this._currUserId)return this._currUserId;try{if(this._storage){let e=this._storage.getUserId();if(e)return this._currUserId=e,e;let t=_w();return this._storage.setUserId(t),this._currUserId=t,t}this._currUserId=kw()}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}async capture(e){if(!this._telemetryEnabled&&!this._scarfEnabled)return;let t=this.userId,n={...e.properties,mcp_use_version:this._productVersion??ZC(),language:`typescript`,source:this._source,runtime:this._runtimeEnvironment};if(this._telemetryEnabled){let r=hw({host:Sw,apiKey:xw,event:e.name,distinctId:t,properties:n});this._pending.add(r),r.finally(()=>this._pending.delete(r))}if(this._scarfEnabled){let r=gw({...n,user_id:t,event:e.name});this._pending.add(r),r.finally(()=>this._pending.delete(r))}}async trackPackageDownload(e){if(!this._scarfEnabled||!this._fsBacked||!this._storage)return;let t=ZC(),n=this._storage.getDownloadedVersion(),r=!1,i=!1;n?yw(t,n)&&(i=!0,this._storage.setDownloadedVersion(t)):(i=!0,r=!0,this._storage.setDownloadedVersion(t)),i&&await gw({...e||{},mcp_use_version:t,user_id:this.userId,event:`package_download`,first_download:r,language:`typescript`,source:this._source,runtime:this._runtimeEnvironment})}async trackAgentExecution(e){this.isEnabled&&await this.capture(new $C(e))}async trackMCPClientInit(e){this.isEnabled&&await this.capture(new ew(e))}async trackConnectorInit(e){this.isEnabled&&await this.capture(new tw(e))}async trackClientAddServer(e,t){this.isEnabled&&await this.capture(new nw({serverName:e,serverConfig:t}))}async trackClientRemoveServer(e){this.isEnabled&&await this.capture(new rw({serverName:e}))}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){this._currUserId=e,this._storage?.setUserId(e),this._telemetryEnabled&&hw({host:Sw,apiKey:xw,event:`$identify`,distinctId:e,properties:{$set:t??{}}})}reset(){this._currUserId=null}flush(){Promise.allSettled([...this._pending])}async shutdown(){try{await Promise.allSettled([...this._pending]),Q.debug(`Telemetry fetch captures flushed`)}catch(e){Q.debug(`Error flushing telemetry captures: ${e}`)}}},jw=Aw;function Mw(e){jw.getInstance().setSource(e)}BC({addServer:(e,t)=>Aw.getInstance().trackClientAddServer(e,t).catch(()=>void 0),removeServer:e=>Aw.getInstance().trackClientRemoveServer(e).catch(()=>void 0)}),WC(e=>Aw.getInstance().trackConnectorInit(e).catch(()=>void 0));function Nw(e){let t=()=>{throw Error(`Invalid url to pass to open(): ${e}`)},n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(Pw).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function Pw([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}var Fw=class{get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}keys(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&e.push(n)}return e}},Iw=class e{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;clientMetadataUrl;scope;store;allowClientSecret;constructor(t,n,r){FS(n.clientMetadataUrl),this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=e.hashString(t),this.clientName=n.clientName||`mcp-use`,this.clientUri=n.clientUri||(typeof window<`u`?window.location.origin:`https://mcp-use.com`),this.logoUri=n.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=Nw(n.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.clientMetadataUrl=n.clientMetadataUrl,this.scope=n.scope,this.store=r,this.allowClientSecret=n.allowClientSecret??!0}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}static hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri,...this.scope?{scope:this.scope}:{}}}credentialKey(e,t){return t?this.getKey(`${e}_${encodeURIComponent(t.issuer)}`):this.getKey(e)}async readCredential(e,t){let n=this.credentialKey(e,t),r=await this.store.get(n);if(!r&&t){let r=this.credentialKey(e),i=await this.store.get(r);if(i)try{let e=JSON.parse(i);if(!e.issuer||e.issuer===t.issuer){let i={...e,issuer:t.issuer},a=JSON.stringify(i);return await this.store.set(n,a),await this.store.set(r,a),{key:n,value:i}}}catch{await this.store.remove(r)}return}if(r)try{return{key:n,value:JSON.parse(r)}}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse ${e.replace(`_`,` `)}:`,t),await this.store.remove(n);return}}async tokens(e){return(await this.readCredential(`tokens`,e))?.value}async saveTokens(e,t){let n=JSON.stringify(e);await this.store.set(this.credentialKey(`tokens`,t),n),t&&await this.store.set(this.credentialKey(`tokens`),n),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`))}async clientInformation(e){let t=await this.readCredential(`client_info`,e);if(!t)return;let{key:n,value:r}=t;try{if(!this.allowClientSecret&&r.client_secret){await this.store.remove(n),e&&await this.store.remove(this.credentialKey(`client_info`)),console.warn(`[${this.storageKeyPrefix}] Removed OAuth client information containing a browser client_secret.`);return}let t=Array.isArray(r.redirect_uris)?r.redirect_uris:[];if(!(t.length===0||t.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),await this.store.remove(n),await this.store.remove(this.credentialKey(`tokens`,e)),await this.store.remove(this.getKey(`last_auth_url`));return}return r}catch{await this.store.remove(n);return}}async saveClientInformation(e,t){let n=e;if(!this.allowClientSecret&&n.client_secret)throw await this.store.remove(this.credentialKey(`client_info`,t)),t&&await this.store.remove(this.credentialKey(`client_info`)),Error(`Browser OAuth clients must be public clients; client_secret persistence is not allowed.`);let r=JSON.stringify(e);await this.store.set(this.credentialKey(`client_info`,t),r),t&&await this.store.set(this.credentialKey(`client_info`),r)}async saveCodeVerifier(e){await this.store.set(this.getKey(`code_verifier`),e)}async codeVerifier(){let e=this.getKey(`code_verifier`),t=await this.store.get(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async invalidateCredentials(e){let t=async e=>{let t=`${this.getKey(e)}_`;for(let n of await this.store.keys())(n===this.getKey(e)||n.startsWith(t))&&await this.store.remove(n)};switch(e){case`all`:await t(`tokens`),await t(`client_info`),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`)),await this.store.remove(this.getKey(`discovery_state`)),await this.store.remove(this.getKey(`token_endpoint`));break;case`client`:await t(`client_info`);break;case`tokens`:await t(`tokens`);break;case`verifier`:await this.store.remove(this.getKey(`code_verifier`));break;case`discovery`:await this.store.remove(this.getKey(`discovery_state`));break;default:break}}async saveDiscoveryState(e){await this.store.set(this.getKey(`discovery_state`),JSON.stringify(e))}async discoveryState(){let e=await this.store.get(this.getKey(`discovery_state`));if(e)try{return JSON.parse(e)}catch{await this.store.remove(this.getKey(`discovery_state`));return}}async storeAuthorizationState(e,t={}){let n=globalThis.crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${n}`,i={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,...this.clientMetadataUrl?{clientMetadataUrl:this.clientMetadataUrl}:{},...t.extraProviderOptions??{}},flowType:t.flowType,returnUrl:t.returnUrl};e.searchParams.set(`state`,n);let a=Nw(e.toString());return await this.store.set(r,JSON.stringify(i)),await this.store.set(this.getKey(`last_auth_url`),a),a}async getTokenEndpoint(){return(await this.discoveryState())?.authorizationServerMetadata?.token_endpoint??null}};async function Lw(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}var Rw=class{serverUrl;staticClientInfo;session;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;proxyOAuthRequests;onPopupWindow;constructor(e,t={}){if(t.staticClientInfo?.client_secret)throw Error(`Browser OAuth clients must be public clients; staticClientInfo.client_secret is not allowed.`);this.serverUrl=e,this.session=new Iw(e,{...t,allowClientSecret:!1},new Fw),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.proxyOAuthRequests=t.proxyOAuthRequests??!0,this.staticClientInfo=t.staticClientInfo,this.onPopupWindow=t.onPopupWindow}get storageKeyPrefix(){return this.session.storageKeyPrefix}get serverUrlHash(){return this.session.serverUrlHash}get clientName(){return this.session.clientName}get clientUri(){return this.session.clientUri}get logoUri(){return this.session.logoUri}get callbackUrl(){return this.session.callbackUrl}get scope(){return this.session.scope}get clientMetadataUrl(){return this.session.clientMetadataUrl}getKey(e){return this.session.getKey(e)}reanchorWellKnownUrl(e){if(!this.connectionUrl)return e;try{let t=new URL(e),n=new URL(this.connectionUrl);if(t.origin!==n.origin||!t.pathname.startsWith(`/.well-known/`))return e;let r=new URL(this.serverUrl),[i,...a]=t.pathname.slice(13).split(`/`);if(!i)return e;let o=a.length?`/${a.join(`/`)}`:``,s=n.pathname.replace(/\/+$/,``),c=r.pathname.replace(/\/+$/,``),l=o&&o===s?c:o;return`${r.origin}/.well-known/${i}${l}${t.search}`}catch{return e}}getProxyFetch(e){if(!this.proxyOAuthRequests||!this.oauthProxyUrl)return e;let t=e??globalThis.fetch.bind(globalThis),n=this.oauthProxyUrl,r=new Set,i=!1;return async(e,a)=>{let o=typeof e==`string`?e:e instanceof URL?e.toString():e.url,s=this.reanchorWellKnownUrl(o),c;try{c=new URL(s).pathname}catch{return await t(e,a)}let l=c.includes(`/.well-known/`);if(!i){i=!0;let e=(await this.discoveryState())?.authorizationServerMetadata;for(let t of[`registration_endpoint`,`token_endpoint`,`revocation_endpoint`,`introspection_endpoint`])typeof e?.[t]==`string`&&r.add(e[t])}let u=r.has(s)||/\/(?:register|registration|token|revoke|revocation|introspect|introspection)\/?$/.test(c);if(!l&&!u)return await t(e,a);try{let r=new URL(s),i=new URL(n);if(r.origin===i.origin&&(r.pathname.startsWith(i.pathname)||s.includes(`/inspector/api/oauth`)))return await t(e,a)}catch{}let d=l?`${n}/metadata?serverUrl=${encodeURIComponent(this.serverUrl)}&url=${encodeURIComponent(s)}`:`${n}/proxy`;if(l){let e=await t(d,{...a,method:`GET`});try{let t=await e.clone().json();for(let e of[`registration_endpoint`,`token_endpoint`,`revocation_endpoint`,`introspection_endpoint`])typeof t[e]==`string`&&r.add(t[e])}catch{}return e}let f=a?.body?await Lw(a.body):void 0,p=await(await t(d,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverUrl:this.serverUrl,url:s,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:f})})).json();return new Response(JSON.stringify(p.body),{status:p.status,statusText:p.statusText,headers:new Headers(p.headers)})}}get redirectUrl(){return this.session.redirectUrl}get clientMetadata(){return this.session.clientMetadata}tokens(e){return this.session.tokens(e)}saveTokens(e,t){return this.session.saveTokens(e,t)}async clientInformation(e){return this.staticClientInfo?this.staticClientInfo:this.session.clientInformation(e)}async saveClientInformation(e,t){if(!this.staticClientInfo)return this.session.saveClientInformation(e,t)}codeVerifier(){return this.session.codeVerifier()}saveCodeVerifier(e){return this.session.saveCodeVerifier(e)}invalidateCredentials(e){return this.session.invalidateCredentials(e)}saveDiscoveryState(e){return this.session.saveDiscoveryState(e)}discoveryState(){return this.session.discoveryState()}getTokenEndpoint(){return this.session.getTokenEndpoint()}async getClientCredentials(){let e=await this.clientInformation();return e?.client_id?{client_id:e.client_id}:null}async prepareAuthorizationUrl(e){return this.session.storeAuthorizationState(e,{extraProviderOptions:{oauthProxyUrl:this.oauthProxyUrl,...this.clientMetadataUrl?{clientMetadataUrl:this.clientMetadataUrl}:{},...this.staticClientInfo?{staticClientInfo:this.staticClientInfo}:{},...this.scope?{scope:this.scope}:{}},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0})}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?Nw(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}};async function zw(e,t={}){return new Rw(e,t)}var Bw=`mcp_auth_callback`,Vw=`mcp_auth_callback`;function Hw(e){try{return typeof localStorage<`u`&&!!localStorage.getItem(e)}catch{return!1}}function Uw({popup:e,state:t,tokensKey:n,timeoutMs:r=5*6e4,closePollMs:i=1e3,closeGraceMs:a=2e4,expectedOrigin:o=typeof window<`u`?window.location.origin:``}){return new Promise(s=>{let c=!1,l=null,u=null,d=null,f=null,p=()=>{if(l&&=(clearInterval(l),null),u&&=(clearTimeout(u),null),d&&=(clearTimeout(d),null),typeof window<`u`&&(window.removeEventListener(`message`,g),window.removeEventListener(`storage`,v)),f){try{f.removeEventListener(`message`,_),f.close()}catch{}f=null}},m=e=>{c||(c=!0,p(),s(e))},h=e=>{!e||e.type!==Vw||e.state&&t&&e.state!==t||(e.success?m({kind:`success`}):m({kind:`error`,error:e.error??`Authentication failed in callback.`}))},g=e=>{o&&e.origin!==o||h(e.data)},_=e=>{h(e.data)},v=e=>{e.key===n&&e.newValue&&m({kind:`success`})};if(typeof window<`u`&&(window.addEventListener(`message`,g),window.addEventListener(`storage`,v)),typeof BroadcastChannel<`u`)try{f=new BroadcastChannel(Bw),f.addEventListener(`message`,_)}catch{f=null}e&&(l=setInterval(()=>{if(c)return;let t=!1;try{t=e.closed}catch{t=!1}if(t){if(l&&=(clearInterval(l),null),Hw(n)){m({kind:`success`});return}d=setTimeout(()=>{m(Hw(n)?{kind:`success`}:{kind:`cancelled`})},a)}},i)),u=setTimeout(()=>{m(Hw(n)?{kind:`success`}:{kind:`timeout`})},r)})}var Ww=5*6e4;function Gw(e,t=0){if(!e||t>5)return!1;if(e instanceof pS)return!0;if(e instanceof Error){if(e.code===401||e.name===`UnauthorizedError`)return!0;let n=e.message??``;if(n.includes(`401`)||n.includes(`Unauthorized`)||e.cause&&Gw(e.cause,t+1))return!0;let r=e.data;if(r?.cause&&Gw(r.cause,t+1))return!0}return!1}async function Kw(e,t,n={}){let r=e,i=n.timeoutMs??Ww,a=n.fetchFn??r.getProxyFetch?.()??void 0;if(!r.hasPendingFlow){let n=await MS(e,{serverUrl:t,fetchFn:a});if(n===`AUTHORIZED`)return;if(n!==`REDIRECT`)throw Error(`Unexpected OAuth auth() result: ${n}`)}if(typeof r.getAuthorizationCode==`function`){await MS(e,{serverUrl:t,authorizationCode:await r.getAuthorizationCode(),fetchFn:a});return}await qw(r,i)}async function qw(e,t){if(typeof window>`u`)throw Error(`OAuth redirect requires a browser environment or a provider with getAuthorizationCode()`);if(e.useRedirectFlow)return;let n=e.getKey?.(`tokens`);if(!n)throw Error(`Browser OAuth provider must expose getKey() for token storage`);let r=null,i=e.getLastAttemptedAuthUrl?.();if(i)try{r=new URL(i).searchParams.get(`state`)}catch{}let a=await Uw({popup:null,state:r,tokensKey:n,timeoutMs:t});switch(a.kind){case`success`:return;case`cancelled`:throw Error(`OAuth authentication was cancelled.`);case`timeout`:throw Error(`OAuth callback not received within ${t}ms. Ensure /oauth/callback calls onMcpAuthorization().`);case`error`:throw Error(a.error);default:throw Error(`Unexpected OAuth popup result`)}}var Jw=`http://json-schema.org/draft-04/schema`,Yw=new Set([`http://json-schema.org/draft-07/schema`,`https://json-schema.org/draft-07/schema`]),Xw=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Zw=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]);function Qw(e){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let t=e.$schema.replace(/#$/,``);if(t===Jw)return`4`;if(Yw.has(t))return`7`;if(Xw.has(t))return`2019-09`;if(Zw.has(t))return`2020-12`}var $w=class{getValidator(e){let t=Qw(e);return(t===void 0?new Bx:new Bx({draft:t})).getValidator(e)}},eT={"~standard":{version:1,vendor:`mcp-use`,validate:e=>({value:e})}},tT=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];activeProgressHandlers=new Set;constructor(e={}){this.opts=e,e.roots&&(this.rootsCache=[...e.roots]),e.onNotification&&this.notificationHandlers.push(e.onNotification)}trackConnectorInit(e){let t=this.constructor.name;GC({connectorType:t,...e})}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}async forwardNotification(e){for(let t of this.notificationHandlers)try{await t(e)}catch(e){Q.error(`Error in notification handler:`,e)}}async handleListChanged(e,t,n){if(t){Q.warn(`[Auto] ${e} refresh failed:`,t);return}e===`notifications/tools/list_changed`&&n&&(this.toolsCache=[...n]),await this.forwardNotification({method:e})}setupNotificationHandler(){if(!this.client)return;this.client.fallbackNotificationHandler=async e=>{switch(e.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await this.forwardNotification(e)};let e=this.client._notificationHandlers;for(let t of[`notifications/progress`,`notifications/cancelled`]){let n=e.get(t);n&&e.set(t,async e=>{await n(e),await this.forwardNotification(e)})}}setupRoundProgressForwarding(){if(!this.client)return;let e=this.client,t=e._onnotification.bind(this.client);e._onnotification=async e=>{e&&typeof e==`object`&&e.method===`notifications/progress`&&this.forwardRoundProgress(e.params),await t?.(e)}}forwardRoundProgress(e){if(this.activeProgressHandlers.size===1){let[t]=this.activeProgressHandlers;t?.(e)}}async refreshToolsCache(){if(this.client)try{Q.debug(`[Auto] Refreshing tools cache due to list_changed notification`);let e=await this.client.listTools();this.toolsCache=e.tools??[],Q.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){Q.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){Q.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){Q.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(Q.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(`roots/list`,async()=>(Q.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){Q.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling;if(!e){Q.debug(`setupSamplingHandler: No sampling callback provided`);return}Q.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(`sampling/createMessage`,async t=>(Q.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),Q.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){Q.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation;if(!e){Q.debug(`setupElicitationHandler: No elicitation callback provided`);return}Q.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(`elicitation/create`,async t=>(Q.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),Q.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){Q.debug(`Not connected to MCP implementation`);return}Q.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,Q.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);Q.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n?{name:n.name,version:n.version,title:n.title,description:n.description,websiteUrl:n.websiteUrl,icons:n.icons}:null;try{let t=await this.client.listTools(void 0,e);this.toolsCache=t.tools??[],Q.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?Q.debug(`Server does not implement tools/list, assuming no tools`):Q.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return Q.debug(`Server capabilities:`,t),Q.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}get instructions(){return this.client?.getInstructions?.()}get protocolEra(){return this.client?.getProtocolEra?.()}get negotiatedProtocolVersion(){return this.client?.getNegotiatedProtocolVersion?.()}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},Q.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),Q.debug(`Calling tool '${e}' with args`,t);let i=r?.onprogress;i&&this.activeProgressHandlers.add(i);try{let n=await this.client.callTool({name:e,arguments:t},r);return Q.debug(`Tool '${e}' returned`,n),n}finally{i&&this.activeProgressHandlers.delete(i)}}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);Q.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return Q.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return Q.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{Q.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return Q.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);Q.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return Q.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return Q.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return Q.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return Q.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return Q.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},eT,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;Q.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;Q.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&Q.warn(`Resource cleanup finished with ${e.length} issue(s)`)}};function nT(e,t=0){if(!e||t>5)return!1;if(e instanceof pS||e instanceof U_&&e.status===401)return!0;if(e instanceof Error){if(e.cause&&nT(e.cause,t+1))return!0;let n=e instanceof H_?e.data:void 0;if(n?.cause&&nT(n.cause,t+1))return!0}return!1}function rT(e,t,n,r){let i=new URL(e),a=t.replace(/\/$/,``);return async(e,t)=>{let o=new Request(e,t),s=new URL(o.url);if(!(s.origin===i.origin&&s.pathname===i.pathname))return n(o);let c=new Headers(o.headers);c.set(`X-Target-URL`,o.url),r&&c.set(`X-Server-Id`,r);let l=o.method===`GET`||o.method===`HEAD`?void 0:await o.clone().arrayBuffer();return n(new Request(a,{method:o.method,headers:c,body:l,signal:o.signal,redirect:`manual`}))}}var iT=class extends tT{baseUrl;headers;timeout;customFetch;clientInfo;protocolNegotiation;gatewayUrl;serverId;reconnectionOptions;transportType=null;streamableTransport=null;constructor(e,t={}){super(t);let n=e.replace(/\/$/,``);this.baseUrl=n,this.headers={...t.headers??{}},this.gatewayUrl=t.gatewayUrl,this.serverId=t.serverId,t.authToken&&(this.headers.Authorization=`Bearer ${t.authToken}`),this.timeout=t.timeout??1e4;let r=t.fetch??globalThis.fetch.bind(globalThis);this.customFetch=this.gatewayUrl?rT(n,this.gatewayUrl,r,this.serverId):t.fetch,this.clientInfo=t.clientInfo??{name:`http-connector`,version:`1.0.0`},this.protocolNegotiation=t.protocolNegotiation??`auto`,this.reconnectionOptions=t.reconnectionOptions}buildClientOptions(){return{...this.opts.clientOptions||{},jsonSchemaValidator:this.opts.clientOptions?.jsonSchemaValidator??new $w,versionNegotiation:{mode:this.protocolNegotiation,...this.opts.clientOptions?.versionNegotiation??{}},listChanged:{tools:{autoRefresh:!0,onChanged:(e,t)=>void this.handleListChanged(`notifications/tools/list_changed`,e,t)},resources:{autoRefresh:!1,onChanged:e=>void this.handleListChanged(`notifications/resources/list_changed`,e)},prompts:{autoRefresh:!1,onChanged:e=>void this.handleListChanged(`notifications/prompts/list_changed`,e)},...this.opts.clientOptions?.listChanged??{}},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.onSampling?{sampling:{}}:{},...this.opts.onElicitation?{elicitation:{form:{},url:{}}}:{}}}}unwrapStreamableError(e){return e instanceof U_?e:e instanceof Error&&e.cause instanceof U_?e.cause:null}classifyStreamableHttpFailure(e){let t=`Unknown error`,n=!1,r,i=this.unwrapStreamableError(e);if(i){let e=i.status;return n=e===401,r=e,e===400&&i.message.includes(`Missing session ID`)?(t=`Server requires session ID (FastMCP compatibility)`,Q.warn(`\u26A0\uFE0F ${t}`)):e===404||e===405?(t=`Server returned ${e} - server likely doesn't support streamable HTTP`,Q.debug(t)):(t=`Server returned ${e}: ${i.message}`,Q.debug(t)),{fallbackReason:t,is401Error:n,httpStatusCode:r}}if(e instanceof Error){let r=e.toString(),i=e.message||``;n=nT(e)||r.includes(`401`)||i.includes(`Unauthorized`),r.includes(`Missing session ID`)||r.includes(`Bad Request: Missing session ID`)||i.includes(`FastMCP session ID error`)?(t=`Server requires session ID (FastMCP compatibility)`,Q.warn(`\u26A0\uFE0F ${t}`)):r.includes(`405 Method Not Allowed`)||r.includes(`404 Not Found`)?(t=`Server doesn't support streamable HTTP (405/404)`,Q.debug(t)):(t=`Streamable HTTP failed: ${e.message}`,Q.debug(t))}return{fallbackReason:t,is401Error:n,httpStatusCode:r}}async connect(){if(this.connected){Q.debug(`Already connected to MCP implementation`);return}let e=this.baseUrl;Q.debug(`Connecting to MCP implementation via HTTP: ${e}`);try{await this.connectWithStreamableHttp(e),Q.debug(`✅ Successfully connected via streamable HTTP`)}catch(e){Q.debug(`Streamable HTTP connect failed`,e);let{fallbackReason:t,is401Error:n,httpStatusCode:r}=this.classifyStreamableHttpFailure(e);if(await this.cleanupResources(),n){Q.info(`Authentication required`);let e=Error(`Authentication required`);throw e.code=401,e}let i=Error(`Could not connect via streamable HTTP: ${t}`);throw r!==void 0&&Object.defineProperty(i,"code",{value:r,writable:!1,enumerable:!0,configurable:!0}),i}}observeSseProgress(e){if(!e.body||!e.headers.get(`content-type`)?.includes(`text/event-stream`))return e;let[t,n]=e.body.tee();return(async()=>{let e=n.getReader(),t=new TextDecoder,r=``;try{for(;;){let{done:n,value:i}=await e.read();if(n)break;r+=t.decode(i,{stream:!0});let a=r.split(/\r?\n\r?\n/);r=a.pop()??``;for(let e of a)for(let t of e.split(/\r?\n/))if(t.startsWith(`data:`))try{let e=JSON.parse(t.slice(5).trim());e.method===`notifications/progress`&&this.forwardRoundProgress(e.params)}catch{}}}catch(e){e instanceof DOMException&&e.name===`AbortError`||Q.debug(`Progress observer stream ended:`,e)}finally{e.releaseLock()}})(),new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers})}async connectWithStreamableHttp(e){try{Q.debug(`[HttpConnector] Connecting with Streamable HTTP`,{baseUrl:e,originalUrl:this.baseUrl,gatewayUrl:this.gatewayUrl||`none`,authProviderUrl:this.opts.authProvider&&`serverUrl`in this.opts.authProvider&&typeof this.opts.authProvider.serverUrl==`string`?this.opts.authProvider.serverUrl:`none`,headers:this.headers});let t,n=new Promise(e=>{t=e}),r=this.customFetch??globalThis.fetch.bind(globalThis),i=new LC(new URL(e),{authProvider:this.opts.authProvider,fetch:async(e,n)=>{let i=await r(e,n),a=n?.method??(e instanceof Request?e.method:`GET`),o=new Headers(e instanceof Request?e.headers:void 0);return new Headers(n?.headers).forEach((e,t)=>{o.set(t,e)}),a.toUpperCase()===`GET`&&i.ok&&i.headers.get(`content-type`)?.includes(`text/event-stream`)&&t?.(),o.get(`mcp-method`)===`subscriptions/listen`?i:this.observeSseProgress(i)},requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2,...this.reconnectionOptions}}),a=i;if(this.opts.wrapTransport){let e=this.baseUrl;a=this.opts.wrapTransport(a,e)}let o=this.buildClientOptions();Q.debug(`Creating Client with capabilities:`,JSON.stringify(o.capabilities,null,2)),this.client=new MC(this.clientInfo,o),this.setupRootsHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),Q.debug(`Roots/sampling/elicitation handlers registered before connect`);try{let e;if(await Promise.race([this.client.connect(a),new Promise((t,n)=>{e=setTimeout(()=>n(Error(`MCP connection timed out after ${this.timeout}ms`)),this.timeout)})]).finally(()=>{e!==void 0&&clearTimeout(e)}),(this.client.getProtocolEra?.()??`legacy`)===`legacy`&&i.sessionId){let e,t=await Promise.race([n.then(()=>!0),new Promise(t=>e=setTimeout(()=>t(!1),Math.min(this.timeout,5e3)))]);e&&clearTimeout(e),t||Q.warn(`Legacy server push stream did not attach before connect completed`)}let t=i.sessionId;t&&Q.debug(`Session ID obtained: ${t}`)}catch(e){if(e instanceof Error){let t=e.message||e.toString();if(t.includes(`Missing session ID`)||t.includes(`Bad Request: Missing session ID`)||t.includes(`Mcp-Session-Id header is required`)){let n=Error(`Session ID error: ${t}. The SDK should automatically extract session ID from initialize response.`);throw n.cause=e,n}}throw e}this.streamableTransport=i,this.connectionManager={stop:async()=>{if(this.streamableTransport)try{await this.streamableTransport.close()}catch(e){Q.warn(`Error closing Streamable HTTP transport: ${e}`)}finally{this.streamableTransport=null}}},this.connected=!0,this.transportType=`streamable-http`,this.setupNotificationHandler(),Q.debug(`Successfully connected to MCP implementation via streamable HTTP: ${e}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (streamable-http)`})}catch(e){throw await this.cleanupResources(),e}}get publicIdentifier(){return{type:`http`,url:this.baseUrl,transport:this.transportType||`unknown`,protocolEra:this.protocolEra??`unknown`}}getTransportType(){return this.transportType}async cleanupResources(){if(this.streamableTransport&&this.protocolEra!==`modern`){let e;try{await Promise.race([this.streamableTransport.terminateSession().then(()=>!0),new Promise(t=>e=setTimeout(()=>t(!1),Math.min(this.timeout,5e3)))])||Q.debug(`Timed out terminating legacy HTTP session; closing transport`)}catch(e){Q.debug(`Error terminating Streamable HTTP session: ${e}`)}finally{e&&clearTimeout(e)}}await super.cleanupResources()}};function aT(e,t){return{onSampling:e?.onSampling??t?.onSampling,onElicitation:e?.onElicitation??t?.onElicitation,onNotification:e?.onNotification??t?.onNotification}}function oT(e){if(!(`url`in e)||typeof e.url!=`string`||e.authProvider||e.authToken||e.oauth===!1)return!1;let t=e.headers;if(t){for(let e of Object.keys(t))if(e.toLowerCase()===`authorization`)return!1}return!0}function sT(){return{name:`mcp-use`,title:`mcp-use`,version:ZC(),description:`mcp-use is a complete TypeScript framework for building and using MCP`,icons:[{src:`https://mcp-use.com/logo.png`}],websiteUrl:`https://mcp-use.com`}}function cT(e){let t=sT();if(!e||typeof e!=`object`)return t;let n=e;return!n.name||!n.version?t:{...t,...n}}var lT=class{connector;autoConnect;constructor(e,t=!0){this.connector=e,this.autoConnect=t}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}on(e,t){e===`notification`&&this.connector.onNotification(t)}async setRoots(e){return this.connector.setRoots(e)}getRoots(){return this.connector.getRoots()}get tools(){return this.connector.tools}async listTools(e){return this.connector.listTools(e)}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}get protocolEra(){return this.connector.protocolEra}get negotiatedProtocolVersion(){return this.connector.negotiatedProtocolVersion}get info(){let e=this.protocolEra,t=this.negotiatedProtocolVersion,n=this.serverInfo;if(!e||!t||!n)throw Error(`MCP connection is not initialized`);let r=this.serverCapabilities,i=r.extensions&&typeof r.extensions==`object`&&!Array.isArray(r.extensions)?r.extensions:{};return{protocolEra:e,protocolVersion:t,server:n,capabilities:r,instructions:this.connector.instructions,extensions:i}}supports(e){return e in this.serverCapabilities}async callTool(e,t={},n){return this.connector.callTool(e,t,n)}async listResources(e,t){return this.connector.listResources(e,t)}async listAllResources(e){return this.connector.listAllResources(e)}async listResourceTemplates(e){return this.connector.listResourceTemplates(e)}async complete(e,t){return this.connector.complete(e,t)}async readResource(e,t){return this.connector.readResource(e,t)}async subscribeToResource(e,t){return this.connector.subscribeToResource(e,t)}async unsubscribeFromResource(e,t){return this.connector.unsubscribeFromResource(e,t)}async listPrompts(){return this.connector.listPrompts()}async getPrompt(e,t){return this.connector.getPrompt(e,t)}async request(e,t=null,n){return this.connector.request(e,t,n)}};function uT(e){return!!e&&typeof e==`object`&&`redirectUrl`in e&&`clientMetadata`in e}var dT=class{config={};sessions={};activeSessions=[];constructor(e){e&&(this.config=e)}static fromDict(e){throw Error(`fromDict must be implemented by concrete class`)}addServer(e,t){this.config.mcpServers=this.config.mcpServers||{},this.config.mcpServers[e]=t,VC(e,t)}async removeServer(e){this.config.mcpServers?.[e]&&(await this.closeSession(e),delete this.config.mcpServers[e],HC(e))}getServerNames(){return Object.keys(this.config.mcpServers??{})}getServerConfig(e){return this.config.mcpServers?.[e]}getConfig(){return this.config??{}}async createSession(e,t=!0){let n=this.config.mcpServers??{};if(Object.keys(n).length===0&&Q.warn(`No MCP servers defined in config`),!n[e])throw Error(`Server '${e}' not found in config`);let r={...n[e]},i;if(oT(r)){let e=r.oauth===!1?void 0:r.oauth??{};i=await this.createDefaultOAuthProvider(r.url,e),r={...r,authProvider:i}}else `authProvider`in r&&r.authProvider&&uT(r.authProvider)&&(i=r.authProvider);let a=async()=>{let e=new lT(await Promise.resolve(this.createConnectorFromConfig(r)));return t&&await e.initialize(),e},o;try{o=await a()}catch(n){let s=r;if(!t||!i||!(`url`in s)||!Gw(n)||i.preventAutoAuth)throw n;Q.info(`[MCPClient] Unauthorized connecting to '${e}'; completing OAuth\u2026`),await Kw(i,s.url),o=await a()}return this.sessions[e]=o,this.activeSessions.includes(e)||this.activeSessions.push(e),o}async connect(e){return this.createSession(e)}async createAllSessions(e=!0){let t=this.config.mcpServers??{};Object.keys(t).length===0&&Q.warn(`No MCP servers defined in config`);for(let n of Object.keys(t))await this.createSession(n,e);return this.sessions}async connectAll(){return this.createAllSessions()}getSession(e){return this.sessions[e]||null}requireSession(e){let t=this.sessions[e];if(!t)throw Error(`Session '${e}' not found. Available sessions: ${this.activeSessions.join(`, `)||`none`}`);return t}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(e=>[e,this.sessions[e]]))}async closeSession(e){let t=this.sessions[e];if(!t){Q.warn(`No session exists for server ${e}, nothing to close`);return}try{Q.debug(`Closing session for server ${e}`),await t.disconnect()}catch(t){Q.error(`Error closing session for server '${e}': ${t}`)}finally{this.sessions[e]===t&&(delete this.sessions[e],this.activeSessions=this.activeSessions.filter(t=>t!==e))}}async closeAllSessions(){let e=Object.keys(this.sessions),t=[];for(let n of e)try{Q.debug(`Closing session for server ${n}`),await this.closeSession(n)}catch(e){let r=`Failed to close session for server '${n}': ${e}`;Q.error(r),t.push(r)}t.length?Q.error(`Encountered ${t.length} errors while closing sessions`):Q.debug(`All sessions closed successfully`)}async close(){await this.closeAllSessions()}};function fT(e){let t=Object.keys(e.mcpServers??{});jw.getInstance().trackMCPClientInit({codeMode:!1,sandbox:!1,allCallbacks:!1,verify:!1,servers:t,numServers:t.length,isBrowser:!0}).catch(e=>Q.debug(`Failed to track BrowserMCPClient init: ${e}`))}var pT=class e extends dT{static getPackageVersion(){return ZC()}constructor(e){super(e),fT(this.config)}static fromDict(t){return new e(t)}async createDefaultOAuthProvider(e,t={}){return zw(e,t)}createConnectorFromConfig(e){let{url:t,headers:n,fetch:r,authToken:i,authProvider:a,wrapTransport:o,clientOptions:s,protocolNegotiation:c,timeout:l,gatewayUrl:u,serverId:d,reconnectionOptions:f}=e;if(!t)throw Error(`Server URL is required`);let p=this.config,m=aT(e,p),h=cT(e.clientInfo??this.config.clientInfo),g={headers:n,fetch:r??globalThis.fetch.bind(globalThis),authToken:i,authProvider:a,wrapTransport:o,clientOptions:s,onSampling:m.onSampling,onElicitation:m.onElicitation,onNotification:m.onNotification,protocolNegotiation:c,timeout:l,clientInfo:h,gatewayUrl:u,serverId:d,reconnectionOptions:f};return Q.debug(`[BrowserMCPClient] Connector options prepared (clientOptions: ${s?`provided`:`none`})`),new iT(t,g)}},mT=`mcp_inspector_telemetry_disabled`,hT=`mcp_inspector_telemetry_user_id`,gT=`mcp_inspector_telemetry_download_version`,_T=`MCP_USE_ANONYMIZED_TELEMETRY`,vT=`mcp_use_user_id`;function yT(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`}function bT(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}function xT(e,t){let n=e=>e.split(`-`)[0].split(`.`).map(e=>parseInt(e,10)||0),r=n(e),i=n(t),a=Math.max(r.length,i.length);for(let e=0;e<a;e++){let t=r[e]??0,n=i[e]??0;if(t!==n)return t>n}return!1}function ST(){if(yT())try{if(localStorage.getItem(mT)===`true`&&localStorage.getItem(_T)!==`false`&&localStorage.setItem(_T,`false`),!localStorage.getItem(vT)){let e=localStorage.getItem(hT);e&&localStorage.setItem(vT,e)}}catch{}}async function CT(){if(!(typeof window>`u`||!yT()))try{let e=jw.getInstance();if(!e.isEnabled)return;let t=ko(),n=!1,r=!1,i=localStorage.getItem(gT);if(i?xT(t,i)&&(n=!0,localStorage.setItem(gT,t)):(n=!0,r=!0,localStorage.setItem(gT,t)),!n)return;gw({triggered_by:`initialization`,mcp_use_version:t,user_id:e.userId,event:`package_download`,first_download:r,language:`typescript`,source:`inspector`,package:`inspector`,mode:bT()},sw)}catch{}}function wT(){ST(),Mw(`inspector`),jw.getInstance().setProductVersion(ko()),CT()}function TT(){if(typeof window>`u`)return`standalone`;let e=window.__MCP_INSPECTOR_MODE__;return e===`standalone`||e===`embedded`||e===`cloud`?e:`standalone`}async function ET(e){await jw.getInstance().capture({name:e.name,properties:{...e.properties,package:`inspector`,mode:TT()}})}async function DT(e){await ET(new po(e))}var OT=`io.modelcontextprotocol/related-task`,kT=`io.modelcontextprotocol/subscriptionId`,AT=tm(()=>J([V(),H(),U(),_p(),Y(V(),AT),G(AT)])),jT=Y(V(),AT),MT=J([V(),H().int()]),NT=V(),PT=K({ttl:H().optional()}),FT=K({taskId:V()}),IT=q({progressToken:MT.optional(),[OT]:FT.optional()}),LT=K({_meta:IT.optional()}),RT=LT.extend({task:PT.optional()}),zT=K({method:V(),params:LT.loose().optional()}),BT=K({_meta:IT.optional()}),VT=K({method:V(),params:BT.loose().optional()}),HT=q({_meta:IT.optional()}),UT=J([V(),H().int()]),WT=K({jsonrpc:X(`2.0`),id:UT,...zT.shape}).strict(),GT=K({jsonrpc:X(`2.0`),...VT.shape}).strict(),KT=K({jsonrpc:X(`2.0`),id:UT,result:HT}).strict(),qT=K({jsonrpc:X(`2.0`),id:UT.optional(),error:K({code:H().int(),message:V(),data:W().optional()})}).strict(),JT=J([WT,GT,KT,qT]);J([KT,qT]);var YT=HT.strict(),XT=BT.extend({requestId:UT.optional(),reason:V().optional()}),ZT=VT.extend({method:X(`notifications/cancelled`),params:XT}),QT=K({icons:G(K({src:V(),mimeType:V().optional(),sizes:G(V()).optional(),theme:Mp([`light`,`dark`]).optional()})).optional()}),$T=K({name:V(),title:V().optional()}),eE=$T.extend({...$T.shape,...QT.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),tE=am(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,kp(K({form:kp(K({applyDefaults:U().optional()}),jT).optional(),url:jT.optional()}),jT.optional())),nE=q({list:jT.optional(),cancel:jT.optional(),requests:q({sampling:q({createMessage:jT.optional()}).optional(),elicitation:q({create:jT.optional()}).optional()}).optional()}),rE=q({list:jT.optional(),cancel:jT.optional(),requests:q({tools:q({call:jT.optional()}).optional()}).optional()}),iE=K({experimental:Y(V(),jT).optional(),sampling:K({context:jT.optional(),tools:jT.optional()}).optional(),elicitation:tE.optional(),roots:K({listChanged:U().optional()}).optional(),tasks:nE.optional(),extensions:Y(V(),jT).optional()}),aE=LT.extend({protocolVersion:V(),capabilities:iE,clientInfo:eE}),oE=zT.extend({method:X(`initialize`),params:aE}),sE=K({experimental:Y(V(),jT).optional(),logging:jT.optional(),completions:jT.optional(),prompts:K({listChanged:U().optional()}).optional(),resources:K({subscribe:U().optional(),listChanged:U().optional()}).optional(),tools:K({listChanged:U().optional()}).optional(),tasks:rE.optional(),extensions:Y(V(),jT).optional()}),cE=HT.extend({protocolVersion:V(),capabilities:sE,serverInfo:eE,instructions:V().optional()}),lE=VT.extend({method:X(`notifications/initialized`),params:BT.optional()}),uE=zT.extend({method:X(`server/discover`),params:LT.optional()}),dE=HT.extend({supportedVersions:G(V()),capabilities:sE,serverInfo:eE,instructions:V().optional()}),fE=zT.extend({method:X(`ping`),params:LT.optional()}),pE=K({progress:H(),total:Z(H()),message:Z(V())}),mE=K({...BT.shape,...pE.shape,progressToken:MT}),hE=VT.extend({method:X(`notifications/progress`),params:mE}),gE=LT.extend({cursor:NT.optional()}),_E=zT.extend({params:gE.optional()}),vE=HT.extend({nextCursor:NT.optional()}),yE=K({uri:V(),mimeType:Z(V()),_meta:Y(V(),W()).optional()}),bE=yE.extend({text:V()}),xE=V().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),SE=yE.extend({blob:xE}),CE=Mp([`user`,`assistant`]),wE=K({audience:G(CE).optional(),priority:H().min(0).max(1).optional(),lastModified:_f({offset:!0}).optional()}),TE=K({...$T.shape,...QT.shape,uri:V(),description:Z(V()),mimeType:Z(V()),size:Z(H()),annotations:wE.optional(),_meta:Z(q({}))}),EE=K({...$T.shape,...QT.shape,uriTemplate:V(),description:Z(V()),mimeType:Z(V()),annotations:wE.optional(),_meta:Z(q({}))}),DE=_E.extend({method:X(`resources/list`)}),OE=vE.extend({resources:G(TE)}),kE=_E.extend({method:X(`resources/templates/list`)}),AE=vE.extend({resourceTemplates:G(EE)}),jE=LT.extend({uri:V()}),ME=jE,NE=zT.extend({method:X(`resources/read`),params:ME}),PE=HT.extend({contents:G(J([bE,SE]))}),FE=VT.extend({method:X(`notifications/resources/list_changed`),params:BT.optional()}),IE=jE,LE=zT.extend({method:X(`resources/subscribe`),params:IE}),RE=jE,zE=zT.extend({method:X(`resources/unsubscribe`),params:RE}),BE=K({toolsListChanged:U().optional(),promptsListChanged:U().optional(),resourcesListChanged:U().optional(),resourceSubscriptions:G(V()).optional()}),VE=LT.extend({notifications:BE}),HE=zT.extend({method:X(`subscriptions/listen`),params:VE}),UE=BT.extend({notifications:BE}),WE=VT.extend({method:X(`notifications/subscriptions/acknowledged`),params:UE}),GE=q({[kT]:UT}),KE=HT.extend({_meta:GE}),qE=BT.extend({uri:V()}),JE=VT.extend({method:X(`notifications/resources/updated`),params:qE}),YE=K({name:V(),description:Z(V()),required:Z(U())}),XE=K({...$T.shape,...QT.shape,description:Z(V()),arguments:Z(G(YE)),_meta:Z(q({}))}),ZE=_E.extend({method:X(`prompts/list`)}),QE=vE.extend({prompts:G(XE)}),$E=LT.extend({name:V(),arguments:Y(V(),V()).optional()}),eD=zT.extend({method:X(`prompts/get`),params:$E}),tD=K({type:X(`text`),text:V(),annotations:wE.optional(),_meta:Y(V(),W()).optional()}),nD=K({type:X(`image`),data:xE,mimeType:V(),annotations:wE.optional(),_meta:Y(V(),W()).optional()}),rD=K({type:X(`audio`),data:xE,mimeType:V(),annotations:wE.optional(),_meta:Y(V(),W()).optional()}),iD=K({type:X(`tool_use`),name:V(),id:V(),input:Y(V(),W()),_meta:Y(V(),W()).optional()}),aD=K({type:X(`resource`),resource:J([bE,SE]),annotations:wE.optional(),_meta:Y(V(),W()).optional()}),oD=TE.extend({type:X(`resource_link`)}),sD=J([tD,nD,rD,oD,aD]),cD=K({role:CE,content:sD}),lD=HT.extend({description:V().optional(),messages:G(cD)}),uD=VT.extend({method:X(`notifications/prompts/list_changed`),params:BT.optional()}),dD=K({title:V().optional(),readOnlyHint:U().optional(),destructiveHint:U().optional(),idempotentHint:U().optional(),openWorldHint:U().optional()}),fD=K({taskSupport:Mp([`required`,`optional`,`forbidden`]).optional()}),pD=K({...$T.shape,...QT.shape,description:V().optional(),inputSchema:K({type:X(`object`),properties:Y(V(),AT).optional(),required:G(V()).optional()}).catchall(W()),outputSchema:q({$schema:V().optional()}).optional(),annotations:dD.optional(),execution:fD.optional(),_meta:Y(V(),W()).optional()}),mD=_E.extend({method:X(`tools/list`)}),hD=vE.extend({tools:G(pD)}),gD=HT.extend({content:G(sD).default([]),structuredContent:W().optional(),isError:U().optional()});gD.or(HT.extend({toolResult:W()}));var _D=RT.extend({name:V(),arguments:Y(V(),W()).optional()}),vD=zT.extend({method:X(`tools/call`),params:_D}),yD=VT.extend({method:X(`notifications/tools/list_changed`),params:BT.optional()});K({autoRefresh:U().default(!0),debounceMs:H().int().nonnegative().default(300)});var bD=Mp([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),xD=LT.extend({level:bD}),SD=zT.extend({method:X(`logging/setLevel`),params:xD}),CD=BT.extend({level:bD,logger:V().optional(),data:W()}),wD=VT.extend({method:X(`notifications/message`),params:CD}),TD=K({hints:G(K({name:V().optional()})).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),ED=K({mode:Mp([`auto`,`required`,`none`]).optional()}),DD=K({type:X(`tool_result`),toolUseId:V().describe(`The unique identifier for the corresponding tool call.`),content:G(sD),structuredContent:W().optional(),isError:U().optional(),_meta:Y(V(),W()).optional()}),OD=Dp(`type`,[tD,nD,rD]),kD=Dp(`type`,[tD,nD,rD,iD,DD]),AD=K({role:CE,content:J([kD,G(kD)]),_meta:Y(V(),W()).optional()}),jD=RT.extend({messages:G(AD),modelPreferences:TD.optional(),systemPrompt:V().optional(),includeContext:Mp([`none`,`thisServer`,`allServers`]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:G(V()).optional(),metadata:jT.optional(),tools:G(pD).optional(),toolChoice:ED.optional()}),MD=zT.extend({method:X(`sampling/createMessage`),params:jD}),ND=HT.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`]).or(V())),role:CE,content:OD}),PD=HT.extend({model:V(),stopReason:Z(Mp([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(V())),role:CE,content:J([kD,G(kD)])}),FD=K({type:X(`boolean`),title:V().optional(),description:V().optional(),default:U().optional()}),ID=K({type:X(`string`),title:V().optional(),description:V().optional(),minLength:H().optional(),maxLength:H().optional(),format:Mp([`email`,`uri`,`date`,`date-time`]).optional(),default:V().optional()}),LD=K({type:Mp([`number`,`integer`]),title:V().optional(),description:V().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),RD=K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),default:V().optional()}),zD=K({type:X(`string`),title:V().optional(),description:V().optional(),oneOf:G(K({const:V(),title:V()})),default:V().optional()}),BD=J([J([K({type:X(`string`),title:V().optional(),description:V().optional(),enum:G(V()),enumNames:G(V()).optional(),default:V().optional()}),J([RD,zD]),J([K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({type:X(`string`),enum:G(V())}),default:G(V()).optional()}),K({type:X(`array`),title:V().optional(),description:V().optional(),minItems:H().optional(),maxItems:H().optional(),items:K({anyOf:G(K({const:V(),title:V()}))}),default:G(V()).optional()})])]),FD,ID,LD]),VD=J([RT.extend({mode:X(`form`).optional(),message:V(),requestedSchema:K({type:X(`object`),properties:Y(V(),BD),required:G(V()).optional()}).catchall(W())}),RT.extend({mode:X(`url`),message:V(),elicitationId:V(),url:V().url()})]),HD=zT.extend({method:X(`elicitation/create`),params:VD}),UD=BT.extend({elicitationId:V()}),WD=VT.extend({method:X(`notifications/elicitation/complete`),params:UD}),GD=HT.extend({action:Mp([`accept`,`decline`,`cancel`]),content:am(e=>e===null?void 0:e,Y(V(),J([V(),H(),U(),G(V())])).optional())}),KD=K({type:X(`ref/resource`),uri:V()}),qD=K({type:X(`ref/prompt`),name:V()}),JD=LT.extend({ref:J([qD,KD]),argument:K({name:V(),value:V()}),context:K({arguments:Y(V(),V()).optional()}).optional()}),YD=zT.extend({method:X(`completion/complete`),params:JD}),XD=HT.extend({completion:q({values:G(V()).max(100),total:Z(H().int()),hasMore:Z(U())})}),ZD=K({uri:V().startsWith(`file://`),name:V().optional(),_meta:Y(V(),W()).optional()}),QD=zT.extend({method:X(`roots/list`),params:LT.optional()}),$D=HT.extend({roots:G(ZD)}),eO=VT.extend({method:X(`notifications/roots/list_changed`),params:BT.optional()});q({ttl:H().optional(),pollInterval:H().optional()});var tO=Mp([`working`,`input_required`,`completed`,`failed`,`cancelled`]),nO=K({taskId:V(),status:tO,ttl:J([H(),_p()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:Z(H()),statusMessage:Z(V())});HT.extend({task:nO});var rO=BT.merge(nO);VT.extend({method:X(`notifications/tasks/status`),params:rO}),zT.extend({method:X(`tasks/get`),params:LT.extend({taskId:V()})}),HT.merge(nO),zT.extend({method:X(`tasks/result`),params:LT.extend({taskId:V()})}),HT.loose(),_E.extend({method:X(`tasks/list`)}),vE.extend({tasks:G(nO)}),zT.extend({method:X(`tasks/cancel`),params:LT.extend({taskId:V()})}),HT.merge(nO),J([fE,oE,uE,YD,SD,eD,ZE,DE,kE,NE,LE,zE,HE,vD,mD]),J([ZT,hE,lE,eO]),J([YT,ND,PD,GD,$D]),J([fE,MD,HD,QD]),J([ZT,hE,wD,JE,FE,yD,uD,WE,WD]),J([YT,cE,dE,XD,lD,QE,OE,AE,PE,gD,hD,KE]);var iO=Jf().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:om.custom,message:`URL must be parseable`,fatal:!0}),Vo}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`});q({resource:V().url(),authorization_servers:G(iO).optional(),jwks_uri:V().url().optional(),scopes_supported:G(V()).optional(),bearer_methods_supported:G(V()).optional(),resource_signing_alg_values_supported:G(V()).optional(),resource_name:V().optional(),resource_documentation:V().optional(),resource_policy_uri:V().url().optional(),resource_tos_uri:V().url().optional(),tls_client_certificate_bound_access_tokens:U().optional(),authorization_details_types_supported:G(V()).optional(),dpop_signing_alg_values_supported:G(V()).optional(),dpop_bound_access_tokens_required:U().optional()});var aO=q({issuer:V(),authorization_endpoint:iO,token_endpoint:iO,registration_endpoint:iO.optional(),scopes_supported:G(V()).optional(),response_types_supported:G(V()),response_modes_supported:G(V()).optional(),grant_types_supported:G(V()).optional(),token_endpoint_auth_methods_supported:G(V()).optional(),token_endpoint_auth_signing_alg_values_supported:G(V()).optional(),service_documentation:iO.optional(),revocation_endpoint:iO.optional(),revocation_endpoint_auth_methods_supported:G(V()).optional(),revocation_endpoint_auth_signing_alg_values_supported:G(V()).optional(),introspection_endpoint:V().optional(),introspection_endpoint_auth_methods_supported:G(V()).optional(),introspection_endpoint_auth_signing_alg_values_supported:G(V()).optional(),code_challenge_methods_supported:G(V()).optional(),client_id_metadata_document_supported:U().optional(),authorization_response_iss_parameter_supported:U().optional().catch(void 0)});K({...q({issuer:V(),authorization_endpoint:iO,token_endpoint:iO,userinfo_endpoint:iO.optional(),jwks_uri:iO,registration_endpoint:iO.optional(),scopes_supported:G(V()).optional(),response_types_supported:G(V()),response_modes_supported:G(V()).optional(),grant_types_supported:G(V()).optional(),acr_values_supported:G(V()).optional(),subject_types_supported:G(V()),id_token_signing_alg_values_supported:G(V()),id_token_encryption_alg_values_supported:G(V()).optional(),id_token_encryption_enc_values_supported:G(V()).optional(),userinfo_signing_alg_values_supported:G(V()).optional(),userinfo_encryption_alg_values_supported:G(V()).optional(),userinfo_encryption_enc_values_supported:G(V()).optional(),request_object_signing_alg_values_supported:G(V()).optional(),request_object_encryption_alg_values_supported:G(V()).optional(),request_object_encryption_enc_values_supported:G(V()).optional(),token_endpoint_auth_methods_supported:G(V()).optional(),token_endpoint_auth_signing_alg_values_supported:G(V()).optional(),display_values_supported:G(V()).optional(),claim_types_supported:G(V()).optional(),claims_supported:G(V()).optional(),service_documentation:V().optional(),claims_locales_supported:G(V()).optional(),ui_locales_supported:G(V()).optional(),claims_parameter_supported:U().optional(),request_parameter_supported:U().optional(),request_uri_parameter_supported:U().optional(),require_request_uri_registration:U().optional(),op_policy_uri:iO.optional(),op_tos_uri:iO.optional(),client_id_metadata_document_supported:U().optional(),authorization_response_iss_parameter_supported:U().optional().catch(void 0)}).shape,...aO.pick({code_challenge_methods_supported:!0}).shape}),K({access_token:V(),id_token:V().optional(),token_type:V(),expires_in:cm().optional(),scope:V().optional(),refresh_token:V().optional()}).strip(),K({issued_token_type:X(`urn:ietf:params:oauth:token-type:id-jag`),access_token:V(),token_type:V().optional(),expires_in:H().optional(),scope:V().optional()}).strip(),K({error:V(),error_description:V().optional(),error_uri:V().optional()});var oO=iO.optional().or(X(``).transform(()=>void 0)),sO=K({redirect_uris:G(iO),token_endpoint_auth_method:V().optional(),grant_types:G(V()).optional(),response_types:G(V()).optional(),application_type:V().optional(),client_name:V().optional(),client_uri:iO.optional(),logo_uri:oO,scope:V().optional(),contacts:G(V()).optional(),tos_uri:oO,policy_uri:V().optional(),jwks_uri:iO.optional(),jwks:yp().optional(),software_id:V().optional(),software_version:V().optional(),software_statement:V().optional()}).strip(),cO=K({client_id:V(),client_secret:V().optional(),client_id_issued_at:H().optional(),client_secret_expires_at:H().optional()}).strip();sO.merge(cO),K({error:V(),error_description:V().optional()}).strip(),K({token:V(),token_type_hint:V().optional()}).strip(),(t=>typeof e<`u`?e:typeof Proxy<`u`?new Proxy(t,{get:(t,n)=>(typeof e<`u`?e:t)[n]}):t)(function(t){if(typeof e<`u`)return e.apply(this,arguments);throw Error(`Dynamic require of "`+t+`" is not supported`)});var lO=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},uO=`2026-01-26`,dO=J([X(`light`),X(`dark`)]).describe(`Color theme preference for the host environment.`),fO=J([X(`inline`),X(`fullscreen`),X(`pip`)]).describe(`Display mode for UI presentation.`),pO=Y(J([X(`--color-background-primary`),X(`--color-background-secondary`),X(`--color-background-tertiary`),X(`--color-background-inverse`),X(`--color-background-ghost`),X(`--color-background-info`),X(`--color-background-danger`),X(`--color-background-success`),X(`--color-background-warning`),X(`--color-background-disabled`),X(`--color-text-primary`),X(`--color-text-secondary`),X(`--color-text-tertiary`),X(`--color-text-inverse`),X(`--color-text-ghost`),X(`--color-text-info`),X(`--color-text-danger`),X(`--color-text-success`),X(`--color-text-warning`),X(`--color-text-disabled`),X(`--color-border-primary`),X(`--color-border-secondary`),X(`--color-border-tertiary`),X(`--color-border-inverse`),X(`--color-border-ghost`),X(`--color-border-info`),X(`--color-border-danger`),X(`--color-border-success`),X(`--color-border-warning`),X(`--color-border-disabled`),X(`--color-ring-primary`),X(`--color-ring-secondary`),X(`--color-ring-inverse`),X(`--color-ring-info`),X(`--color-ring-danger`),X(`--color-ring-success`),X(`--color-ring-warning`),X(`--font-sans`),X(`--font-mono`),X(`--font-weight-normal`),X(`--font-weight-medium`),X(`--font-weight-semibold`),X(`--font-weight-bold`),X(`--font-text-xs-size`),X(`--font-text-sm-size`),X(`--font-text-md-size`),X(`--font-text-lg-size`),X(`--font-heading-xs-size`),X(`--font-heading-sm-size`),X(`--font-heading-md-size`),X(`--font-heading-lg-size`),X(`--font-heading-xl-size`),X(`--font-heading-2xl-size`),X(`--font-heading-3xl-size`),X(`--font-text-xs-line-height`),X(`--font-text-sm-line-height`),X(`--font-text-md-line-height`),X(`--font-text-lg-line-height`),X(`--font-heading-xs-line-height`),X(`--font-heading-sm-line-height`),X(`--font-heading-md-line-height`),X(`--font-heading-lg-line-height`),X(`--font-heading-xl-line-height`),X(`--font-heading-2xl-line-height`),X(`--font-heading-3xl-line-height`),X(`--border-radius-xs`),X(`--border-radius-sm`),X(`--border-radius-md`),X(`--border-radius-lg`),X(`--border-radius-xl`),X(`--border-radius-full`),X(`--border-width-regular`),X(`--shadow-hairline`),X(`--shadow-sm`),X(`--shadow-md`),X(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
151
-
152
- Individual style keys are optional - hosts may provide any subset of these values.
153
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
154
-
155
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
156
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),J([V(),hp()]).describe(`Style variables for theming MCP apps.
157
-
158
- Individual style keys are optional - hosts may provide any subset of these values.
159
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
160
-
161
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
162
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
163
-
164
- Individual style keys are optional - hosts may provide any subset of these values.
165
- Values are strings containing CSS values (colors, sizes, font stacks, etc.).
166
-
167
- Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
168
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),mO=K({method:X(`ui/open-link`),params:K({url:V().describe(`URL to open in the host's browser`)})}),hO=K({isError:U().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),gO=K({isError:U().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),_O=K({isError:U().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough(),vO=K({method:X(`ui/notifications/sandbox-proxy-ready`),params:K({})}),yO=K({connectDomains:G(V()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
169
-
170
- - Maps to CSP \`connect-src\` directive
171
- - Empty or omitted → no network connections (secure default)`),resourceDomains:G(V()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:G(V()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:G(V()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),bO=K({camera:K({}).optional().describe(`Request camera access.
172
-
173
- Maps to Permission Policy \`camera\` feature.`),microphone:K({}).optional().describe(`Request microphone access.
174
-
175
- Maps to Permission Policy \`microphone\` feature.`),geolocation:K({}).optional().describe(`Request geolocation access.
176
-
177
- Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:K({}).optional().describe(`Request clipboard write access.
178
-
179
- Maps to Permission Policy \`clipboard-write\` feature.`)}),xO=K({method:X(`ui/notifications/size-changed`),params:K({width:H().optional().describe(`New width in pixels.`),height:H().optional().describe(`New height in pixels.`)})});K({method:X(`ui/notifications/tool-input`),params:K({arguments:Y(V(),W().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),K({method:X(`ui/notifications/tool-input-partial`),params:K({arguments:Y(V(),W().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),K({method:X(`ui/notifications/tool-cancelled`),params:K({reason:V().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var SO=K({fonts:V().optional()}),CO=K({variables:pO.optional().describe(`CSS variables for theming the app.`),css:SO.optional().describe(`CSS blocks that apps can inject.`)});K({method:X(`ui/resource-teardown`),params:K({})});var wO=Y(V(),W()),TO=K({text:K({}).optional().describe(`Host supports text content blocks.`),image:K({}).optional().describe(`Host supports image content blocks.`),audio:K({}).optional().describe(`Host supports audio content blocks.`),resource:K({}).optional().describe(`Host supports resource content blocks.`),resourceLink:K({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:K({}).optional().describe(`Host supports structured content.`)}),EO=K({method:X(`ui/notifications/request-teardown`),params:K({}).optional()}),DO=K({experimental:K({}).optional().describe(`Experimental features (structure TBD).`),openLinks:K({}).optional().describe(`Host supports opening external URLs.`),downloadFile:K({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:K({listChanged:U().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:K({listChanged:U().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:K({}).optional().describe(`Host accepts log messages.`),sandbox:K({permissions:bO.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:yO.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:TO.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:TO.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:K({tools:K({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),OO=K({experimental:K({}).optional().describe(`Experimental features (structure TBD).`),tools:K({listChanged:U().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:G(fO).optional().describe(`Display modes the app supports.`)}),kO=K({method:X(`ui/notifications/initialized`),params:K({}).optional()});K({csp:yO.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:bO.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:V().optional().describe(`Dedicated origin for view sandbox.
180
-
181
- Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
182
-
183
- **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
184
- - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
185
- - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
186
-
187
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:U().optional().describe(`Visual boundary preference - true if view prefers a visible border.
188
-
189
- Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
190
-
191
- - \`true\`: request visible border + background
192
- - \`false\`: request no visible border + background
193
- - omitted: host decides border`)});var AO=K({method:X(`ui/request-display-mode`),params:K({mode:fO.describe(`The display mode being requested.`)})}),jO=K({mode:fO.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),MO=J([X(`model`),X(`app`)]).describe(`Tool visibility scope - who can access the tool.`);K({resourceUri:V().optional(),visibility:G(MO).optional().describe(`Who can access this tool. Default: ["model", "app"]
194
- - "model": Tool visible to and callable by the agent
195
- - "app": Tool callable by the app from this server only`),csp:Sp().optional(),permissions:Sp().optional()}),K({mimeTypes:G(V()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var NO=K({method:X(`ui/download-file`),params:K({contents:G(J([aD,oD])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),PO=K({method:X(`ui/message`),params:K({role:X(`user`).describe(`Message role, currently only "user" is supported.`),content:G(sD).describe(`Message content blocks (text, image, etc.).`)})});K({method:X(`ui/notifications/sandbox-resource-ready`),params:K({html:V().describe(`HTML content to load into the inner iframe.`),sandbox:V().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:yO.optional().describe(`CSP configuration from resource metadata.`),permissions:bO.optional().describe(`Sandbox permissions from resource metadata.`)})}),K({method:X(`ui/notifications/tool-result`),params:gD.describe(`Standard MCP tool execution result.`)});var FO=K({toolInfo:K({id:UT.optional().describe(`JSON-RPC id of the tools/call request.`),tool:pD.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:dO.optional().describe(`Current color theme preference.`),styles:CO.optional().describe(`Style configuration for theming the app.`),displayMode:fO.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:G(fO).optional().describe(`Display modes the host supports.`),containerDimensions:J([K({height:H().describe(`Fixed container height in pixels.`)}),K({maxHeight:J([H(),hp()]).optional().describe(`Maximum container height in pixels.`)})]).and(J([K({width:H().describe(`Fixed container width in pixels.`)}),K({maxWidth:J([H(),hp()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
196
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:V().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:V().optional().describe(`User's timezone in IANA format.`),userAgent:V().optional().describe(`Host application identifier.`),platform:J([X(`web`),X(`desktop`),X(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:K({touch:U().optional().describe(`Whether the device supports touch input.`),hover:U().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:K({top:H().describe(`Top safe area inset in pixels.`),right:H().describe(`Right safe area inset in pixels.`),bottom:H().describe(`Bottom safe area inset in pixels.`),left:H().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();K({method:X(`ui/notifications/host-context-changed`),params:FO.describe(`Partial context update containing only changed fields.`)});var IO=K({method:X(`ui/update-model-context`),params:K({content:G(sD).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:Y(V(),W().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),LO=K({method:X(`ui/initialize`),params:K({appInfo:eE.describe(`App identification (name and version).`),appCapabilities:OO.describe(`Features and capabilities this app provides.`),protocolVersion:V().describe(`Protocol version this app supports.`)})}),RO=K({protocolVersion:V().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:eE.describe(`Host application identification and version.`),hostCapabilities:DO.describe(`Features and capabilities provided by the host.`),hostContext:FO.describe(`Rich context about the host environment.`)}).passthrough(),zO=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=JT.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},BO=`text/html;profile=mcp-app`;function VO(e){if(!e)return``;let t=[];return e.camera&&t.push(`camera`),e.microphone&&t.push(`microphone`),e.geolocation&&t.push(`geolocation`),e.clipboardWrite&&t.push(`clipboard-write`),t.join(`; `)}var HO=[uO],UO=class extends Bb{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new lO;_wrapHandler(e,t){let n=super._wrapHandler(e,t);return e===`ui/initialize`||e===`ping`?n:async(t,r)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),n(t,r))}eventSchemas={sizechange:xO,sandboxready:vO,initialized:kO,requestteardown:EO,loggingmessage:wD};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);let n=t=>{e===`initialized`&&(this._initializedReceived=!0),this._events.dispatch(e,t)};e===`loggingmessage`?this.setNotificationHandler(`notifications/message`,e=>{n(e.params)}):this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},e=>n(e)),this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,n){t&&n&&console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,n,r){super(r),this._client=e,this._hostInfo=t,this._hostCapabilities=n,this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.setRequestHandler(`ui/initialize`,{params:LO.shape.params,result:RO},e=>this._onAppsInitialize(e)),this.setRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.setRequestHandler(`ui/request-display-mode`,{params:AO.shape.params,result:jO},()=>({mode:this._hostContext.displayMode??`inline`}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler(`sizechange`)}set onsizechange(e){this.setEventHandler(`sizechange`,e)}get onsandboxready(){return this.getEventHandler(`sandboxready`)}set onsandboxready(e){this.setEventHandler(`sandboxready`,e)}get oninitialized(){return this.getEventHandler(`initialized`)}set oninitialized(e){this.setEventHandler(`initialized`,e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced(`onmessage`,this._onmessage,e),this._onmessage=e,this.setRequestHandler(`ui/message`,{params:PO.shape.params,result:_O},async(e,t)=>{if(!this._onmessage)throw Error(`No onmessage handler set`);return this._onmessage(e,t)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced(`onopenlink`,this._onopenlink,e),this._onopenlink=e,this.setRequestHandler(`ui/open-link`,{params:mO.shape.params,result:hO},async(e,t)=>{if(!this._onopenlink)throw Error(`No onopenlink handler set`);return this._onopenlink(e,t)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced(`ondownloadfile`,this._ondownloadfile,e),this._ondownloadfile=e,this.setRequestHandler(`ui/download-file`,{params:NO.shape.params,result:gO},async(e,t)=>{if(!this._ondownloadfile)throw Error(`No ondownloadfile handler set`);return this._ondownloadfile(e,t)})}get onrequestteardown(){return this.getEventHandler(`requestteardown`)}set onrequestteardown(e){this.setEventHandler(`requestteardown`,e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced(`onrequestdisplaymode`,this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.setRequestHandler(`ui/request-display-mode`,{params:AO.shape.params,result:jO},async(e,t)=>{if(!this._onrequestdisplaymode)throw Error(`No onrequestdisplaymode handler set`);return this._onrequestdisplaymode(e,t)})}get onloggingmessage(){return this.getEventHandler(`loggingmessage`)}set onloggingmessage(e){this.setEventHandler(`loggingmessage`,e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced(`onupdatemodelcontext`,this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.setRequestHandler(`ui/update-model-context`,{params:IO.shape.params,result:YT},async(e,t)=>{if(!this._onupdatemodelcontext)throw Error(`No onupdatemodelcontext handler set`);return this._onupdatemodelcontext(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.setRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}set oncreatesamplingmessage(e){this.setRequestHandler(`sampling/createMessage`,async(t,n)=>e(t.params,n))}sendToolListChanged(e={}){return this.notification({method:`notifications/tools/list_changed`,params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced(`onlistresources`,this._onlistresources,e),this._onlistresources=e,this.setRequestHandler(`resources/list`,async(e,t)=>{if(!this._onlistresources)throw Error(`No onlistresources handler set`);return this._onlistresources(e.params,t)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced(`onlistresourcetemplates`,this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.setRequestHandler(`resources/templates/list`,async(e,t)=>{if(!this._onlistresourcetemplates)throw Error(`No onlistresourcetemplates handler set`);return this._onlistresourcetemplates(e.params,t)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced(`onreadresource`,this._onreadresource,e),this._onreadresource=e,this.setRequestHandler(`resources/read`,async(e,t)=>{if(!this._onreadresource)throw Error(`No onreadresource handler set`);return this._onreadresource(e.params,t)})}sendResourceListChanged(e={}){return this.notification({method:`notifications/resources/list_changed`,params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced(`onlistprompts`,this._onlistprompts,e),this._onlistprompts=e,this.setRequestHandler(`prompts/list`,async(e,t)=>{if(!this._onlistprompts)throw Error(`No onlistprompts handler set`);return this._onlistprompts(e.params,t)})}sendPromptListChanged(e={}){return this.notification({method:`notifications/prompts/list_changed`,params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;return this._appInfo!==void 0&&console.warn(`[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.`),this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:HO.includes(t)?t:uO,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},n=!1;for(let r of Object.keys(e)){let i=this._hostContext[r],a=e[r];WO(i,a)||(t[r]=a,n=!0)}n&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:`ui/notifications/host-context-changed`,params:e})}sendToolInput(e){return this.notification({method:`ui/notifications/tool-input`,params:e})}sendToolInputPartial(e){return this.notification({method:`ui/notifications/tool-input-partial`,params:e})}sendToolResult(e){return this.notification({method:`ui/notifications/tool-result`,params:e})}sendToolCancelled(e){return this.notification({method:`ui/notifications/tool-cancelled`,params:e})}sendSandboxResourceReady(e){return this.notification({method:`ui/notifications/sandbox-resource-ready`,params:e})}teardownResource(e,t){return this.request({method:`ui/resource-teardown`,params:e},wO,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:`tools/call`,params:e},t)}listTools(e,t){return this.request({method:`tools/list`,params:e},t)}async connect(e){if(this.transport)throw Error(`AppBridge is already connected. Call close() before connecting again.`);if(this._initializedReceived=!1,this._client){let e=this._client.getServerCapabilities();if(!e)throw Error(`Client server capabilities not available`);e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:`tools/call`,params:e},{signal:t.mcpReq.signal}),e.tools.listChanged&&this._client.setNotificationHandler(`notifications/tools/list_changed`,e=>this.sendToolListChanged(e.params))),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:`resources/list`,params:e},{signal:t.mcpReq.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:`resources/templates/list`,params:e},{signal:t.mcpReq.signal}),this.onreadresource=async(e,t)=>this._client.request({method:`resources/read`,params:e},{signal:t.mcpReq.signal}),e.resources.listChanged&&this._client.setNotificationHandler(`notifications/resources/list_changed`,e=>this.sendResourceListChanged(e.params))),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:`prompts/list`,params:e},{signal:t.mcpReq.signal}),e.prompts.listChanged&&this._client.setNotificationHandler(`notifications/prompts/list_changed`,e=>this.sendPromptListChanged(e.params)))}return super.connect(e)}};function WO(e,t){return JSON.stringify(e)===JSON.stringify(t)}var GO=Object.defineProperty,KO=Object.getOwnPropertyNames,qO=(e,t)=>function(){return e&&(t=(0,e[KO(e)[0]])(e=0)),t},JO=(e,t)=>{for(var n in t)GO(e,n,{get:t[n],enumerable:!0})};function YO(){let e;try{e=typeof process<`u`?{}.MCP_USE_LOG_LEVEL??{}.DEBUG:void 0}catch{}let t=e?.trim().toLowerCase();return t===`2`?`debug`:t&&XO.includes(t)?t:`info`}var XO,ZO,QO,$O,$,ek=qO({"src/utils/logging.ts"(){XO=[`silent`,`error`,`warn`,`info`,`http`,`verbose`,`debug`,`silly`],ZO={silent:``,error:`❌`,warn:`⚠️`,info:`ℹ️`,http:`🌐`,verbose:`📝`,debug:`🔍`,silly:`🤪`},QO=class{constructor(e=`mcp-use`,t=`info`,n=`minimal`){this.name=e,this.level=t,this.format=n}write(e,t,n){if(this.level===`silent`||XO.indexOf(e)>XO.indexOf(this.level))return;let r=n.map(e=>{if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}).join(` `),i=r?`${t} ${r}`:t,a=new Date().toLocaleTimeString(`en-US`,{hour12:!1}),o=this.format===`minimal`?e:e.toUpperCase(),s=this.format===`emoji`?` ${ZO[e]}`:``,c=`${a} [${this.name}]${s} ${o}: ${i}`;(e===`error`?console.error:e===`warn`?console.warn:e===`info`?console.info:e===`debug`?console.debug:console.log)(c)}error=(e,...t)=>this.write(`error`,e,t);warn=(e,...t)=>this.write(`warn`,e,t);info=(e,...t)=>this.write(`info`,e,t);debug=(e,...t)=>this.write(`debug`,e,t);http=(e,...t)=>this.write(`http`,e,t);verbose=(e,...t)=>this.write(`verbose`,e,t);silly=(e,...t)=>this.write(`silly`,e,t);setFormat(e){this.format=e}},$O=class{static instances={};static currentFormat=`minimal`;static currentLevel;static get(e=`mcp-use`){return this.instances[e]??=new QO(e,this.currentLevel??YO(),this.currentFormat)}static configure({level:e=YO(),format:t=`minimal`}={}){this.currentLevel=e,this.currentFormat=t;for(let n of Object.values(this.instances))n.level=e,n.format=t}static setDebug(e){let t=e===2||e===!0?`debug`:`info`;this.currentLevel=t;for(let e of Object.values(this.instances))e.level=t;try{typeof process<`u`&&({}.MCP_USE_LOG_LEVEL=t)}catch{}}static setFormat(e){this.configure({format:e})}},$=$O.get()}}),tk={};JO(tk,{clearRpcLogs:()=>ak,getAllRpcLogs:()=>rk,getRpcLogs:()=>nk,subscribeToRpcLogs:()=>ik,wrapTransportForLogging:()=>ok});function nk(e){return lk.getLogsForServer(e)}function rk(){return lk.getAllLogs()}function ik(e){return lk.subscribe(e)}function ak(e){lk.clear(e)}function ok(e,t){class n{constructor(e){this.inner=e,this.inner.onmessage=(e,n)=>{lk.publish({serverId:t,direction:`receive`,timestamp:new Date().toISOString(),message:e}),this.onmessage?.(e,n)},this.inner.onclose=()=>{this.onclose?.()},this.inner.onerror=e=>{this.onerror?.(e)}}onclose;onerror;onmessage;async start(){typeof this.inner.start==`function`&&await this.inner.start()}async send(e,n){lk.publish({serverId:t,direction:`send`,timestamp:new Date().toISOString(),message:e}),await this.inner.send(e,n)}async close(){await this.inner.close()}get sessionId(){return this.inner.sessionId}setProtocolVersion(e){typeof this.inner.setProtocolVersion==`function`&&this.inner.setProtocolVersion(e)}}return new n(e)}var sk,ck,lk,uk=qO({"src/react/rpc-logger.ts"(){ek(),sk=$O.get(`RpcLogger`),ck=class{logs=[];listeners=new Set;maxLogs=1e3;publish(e){sk.debug(`[RPC Logger] Publishing log:`,e.direction,e.serverId,e.message?.method),this.logs.push(e),this.logs.length>this.maxLogs&&(this.logs=this.logs.slice(-this.maxLogs)),sk.debug(`[RPC Logger] Total logs:`,this.logs.length,`Listeners:`,this.listeners.size),this.listeners.forEach(t=>{try{t(e)}catch(e){sk.error(`[RPC Logger] Listener error:`,e)}})}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getLogsForServer(e){return this.logs.filter(t=>t.serverId===e)}getAllLogs(){return[...this.logs]}clear(e){e?this.logs=this.logs.filter(t=>t.serverId!==e):this.logs=[]}},lk=new ck}}),dk=`mcp_auth_callback`,fk=`mcp_auth_callback`;function pk(e){try{return typeof localStorage<`u`&&!!localStorage.getItem(e)}catch{return!1}}function mk({popup:e,state:t,tokensKey:n,timeoutMs:r=5*6e4,closePollMs:i=1e3,closeGraceMs:a=2e4,expectedOrigin:o=typeof window<`u`?window.location.origin:``}){return new Promise(s=>{let c=!1,l=null,u=null,d=null,f=null,p=()=>{if(l&&=(clearInterval(l),null),u&&=(clearTimeout(u),null),d&&=(clearTimeout(d),null),typeof window<`u`&&(window.removeEventListener(`message`,g),window.removeEventListener(`storage`,v)),f){try{f.removeEventListener(`message`,_),f.close()}catch{}f=null}},m=e=>{c||(c=!0,p(),s(e))},h=e=>{!e||e.type!==fk||e.state&&t&&e.state!==t||(e.success?m({kind:`success`}):m({kind:`error`,error:e.error??`Authentication failed in callback.`}))},g=e=>{o&&e.origin!==o||h(e.data)},_=e=>{h(e.data)},v=e=>{e.key===n&&e.newValue&&m({kind:`success`})};if(typeof window<`u`&&(window.addEventListener(`message`,g),window.addEventListener(`storage`,v)),typeof BroadcastChannel<`u`)try{f=new BroadcastChannel(dk),f.addEventListener(`message`,_)}catch{f=null}e&&(l=setInterval(()=>{if(c)return;let t=!1;try{t=e.closed}catch{t=!1}if(t){if(l&&=(clearInterval(l),null),pk(n)){m({kind:`success`});return}d=setTimeout(()=>{m(pk(n)?{kind:`success`}:{kind:`cancelled`})},a)}},i)),u=setTimeout(()=>{m(pk(n)?{kind:`success`}:{kind:`timeout`})},r)})}ek();var hk=`http://json-schema.org/draft-04/schema`,gk=new Set([`http://json-schema.org/draft-07/schema`,`https://json-schema.org/draft-07/schema`]),_k=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),vk=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]);function yk(e){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let t=e.$schema.replace(/#$/,``);if(t===hk)return`4`;if(gk.has(t))return`7`;if(_k.has(t))return`2019-09`;if(vk.has(t))return`2020-12`}var bk=class{getValidator(e){let t=yk(e);return(t===void 0?new Bx:new Bx({draft:t})).getValidator(e)}};ek();var xk;function Sk(e){xk?.(e)}var Ck={"~standard":{version:1,vendor:`mcp-use`,validate:e=>({value:e})}},wk=class{client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];activeProgressHandlers=new Set;constructor(e={}){this.opts=e,e.roots&&(this.rootsCache=[...e.roots]),e.onNotification&&this.notificationHandlers.push(e.onNotification)}trackConnectorInit(e){let t=this.constructor.name;Sk({connectorType:t,...e})}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}async forwardNotification(e){for(let t of this.notificationHandlers)try{await t(e)}catch(e){$.error(`Error in notification handler:`,e)}}async handleListChanged(e,t,n){if(t){$.warn(`[Auto] ${e} refresh failed:`,t);return}e===`notifications/tools/list_changed`&&n&&(this.toolsCache=[...n]),await this.forwardNotification({method:e})}setupNotificationHandler(){if(!this.client)return;this.client.fallbackNotificationHandler=async e=>{switch(e.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await this.forwardNotification(e)};let e=this.client._notificationHandlers;for(let t of[`notifications/progress`,`notifications/cancelled`]){let n=e.get(t);n&&e.set(t,async e=>{await n(e),await this.forwardNotification(e)})}}setupRoundProgressForwarding(){if(!this.client)return;let e=this.client,t=e._onnotification.bind(this.client);e._onnotification=async e=>{e&&typeof e==`object`&&e.method===`notifications/progress`&&this.forwardRoundProgress(e.params),await t?.(e)}}forwardRoundProgress(e){if(this.activeProgressHandlers.size===1){let[t]=this.activeProgressHandlers;t?.(e)}}async refreshToolsCache(){if(this.client)try{$.debug(`[Auto] Refreshing tools cache due to list_changed notification`);let e=await this.client.listTools();this.toolsCache=e.tools??[],$.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){$.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){$.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){$.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&($.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(`roots/list`,async()=>($.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){$.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling;if(!e){$.debug(`setupSamplingHandler: No sampling callback provided`);return}$.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(`sampling/createMessage`,async t=>($.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),$.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){$.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation;if(!e){$.debug(`setupElicitationHandler: No elicitation callback provided`);return}$.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(`elicitation/create`,async t=>($.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),$.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){$.debug(`Not connected to MCP implementation`);return}$.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,$.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);$.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n?{name:n.name,version:n.version,title:n.title,description:n.description,websiteUrl:n.websiteUrl,icons:n.icons}:null;try{let t=await this.client.listTools(void 0,e);this.toolsCache=t.tools??[],$.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?$.debug(`Server does not implement tools/list, assuming no tools`):$.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return $.debug(`Server capabilities:`,t),$.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}get instructions(){return this.client?.getInstructions?.()}get protocolEra(){return this.client?.getProtocolEra?.()}get negotiatedProtocolVersion(){return this.client?.getNegotiatedProtocolVersion?.()}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},$.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),$.debug(`Calling tool '${e}' with args`,t);let i=r?.onprogress;i&&this.activeProgressHandlers.add(i);try{let n=await this.client.callTool({name:e,arguments:t},r);return $.debug(`Tool '${e}' returned`,n),n}finally{i&&this.activeProgressHandlers.delete(i)}}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);$.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return $.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return $.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{$.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return $.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);$.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return $.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return $.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return $.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return $.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return $.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},Ck,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;$.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;$.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&$.warn(`Resource cleanup finished with ${e.length} issue(s)`)}};function Tk(e,t=0){if(!e||t>5)return!1;if(e instanceof pS||e instanceof U_&&e.status===401)return!0;if(e instanceof Error){if(e.cause&&Tk(e.cause,t+1))return!0;let n=e instanceof H_?e.data:void 0;if(n?.cause&&Tk(n.cause,t+1))return!0}return!1}function Ek(e,t,n,r){let i=new URL(e),a=t.replace(/\/$/,``);return async(e,t)=>{let o=new Request(e,t),s=new URL(o.url);if(!(s.origin===i.origin&&s.pathname===i.pathname))return n(o);let c=new Headers(o.headers);c.set(`X-Target-URL`,o.url),r&&c.set(`X-Server-Id`,r);let l=o.method===`GET`||o.method===`HEAD`?void 0:await o.clone().arrayBuffer();return n(new Request(a,{method:o.method,headers:c,body:l,signal:o.signal,redirect:`manual`}))}}var Dk=class extends wk{baseUrl;headers;timeout;customFetch;clientInfo;protocolNegotiation;gatewayUrl;serverId;reconnectionOptions;transportType=null;streamableTransport=null;constructor(e,t={}){super(t);let n=e.replace(/\/$/,``);this.baseUrl=n,this.headers={...t.headers??{}},this.gatewayUrl=t.gatewayUrl,this.serverId=t.serverId,t.authToken&&(this.headers.Authorization=`Bearer ${t.authToken}`),this.timeout=t.timeout??1e4;let r=t.fetch??globalThis.fetch.bind(globalThis);this.customFetch=this.gatewayUrl?Ek(n,this.gatewayUrl,r,this.serverId):t.fetch,this.clientInfo=t.clientInfo??{name:`http-connector`,version:`1.0.0`},this.protocolNegotiation=t.protocolNegotiation??`auto`,this.reconnectionOptions=t.reconnectionOptions}buildClientOptions(){return{...this.opts.clientOptions||{},jsonSchemaValidator:this.opts.clientOptions?.jsonSchemaValidator??new bk,versionNegotiation:{mode:this.protocolNegotiation,...this.opts.clientOptions?.versionNegotiation??{}},listChanged:{tools:{autoRefresh:!0,onChanged:(e,t)=>void this.handleListChanged(`notifications/tools/list_changed`,e,t)},resources:{autoRefresh:!1,onChanged:e=>void this.handleListChanged(`notifications/resources/list_changed`,e)},prompts:{autoRefresh:!1,onChanged:e=>void this.handleListChanged(`notifications/prompts/list_changed`,e)},...this.opts.clientOptions?.listChanged??{}},capabilities:{...this.opts.clientOptions?.capabilities||{},roots:{listChanged:!0},...this.opts.onSampling?{sampling:{}}:{},...this.opts.onElicitation?{elicitation:{form:{},url:{}}}:{}}}}unwrapStreamableError(e){return e instanceof U_?e:e instanceof Error&&e.cause instanceof U_?e.cause:null}classifyStreamableHttpFailure(e){let t=`Unknown error`,n=!1,r,i=this.unwrapStreamableError(e);if(i){let e=i.status;return n=e===401,r=e,e===400&&i.message.includes(`Missing session ID`)?(t=`Server requires session ID (FastMCP compatibility)`,$.warn(`\u26A0\uFE0F ${t}`)):e===404||e===405?(t=`Server returned ${e} - server likely doesn't support streamable HTTP`,$.debug(t)):(t=`Server returned ${e}: ${i.message}`,$.debug(t)),{fallbackReason:t,is401Error:n,httpStatusCode:r}}if(e instanceof Error){let r=e.toString(),i=e.message||``;n=Tk(e)||r.includes(`401`)||i.includes(`Unauthorized`),r.includes(`Missing session ID`)||r.includes(`Bad Request: Missing session ID`)||i.includes(`FastMCP session ID error`)?(t=`Server requires session ID (FastMCP compatibility)`,$.warn(`\u26A0\uFE0F ${t}`)):r.includes(`405 Method Not Allowed`)||r.includes(`404 Not Found`)?(t=`Server doesn't support streamable HTTP (405/404)`,$.debug(t)):(t=`Streamable HTTP failed: ${e.message}`,$.debug(t))}return{fallbackReason:t,is401Error:n,httpStatusCode:r}}async connect(){if(this.connected){$.debug(`Already connected to MCP implementation`);return}let e=this.baseUrl;$.debug(`Connecting to MCP implementation via HTTP: ${e}`);try{await this.connectWithStreamableHttp(e),$.debug(`✅ Successfully connected via streamable HTTP`)}catch(e){$.debug(`Streamable HTTP connect failed`,e);let{fallbackReason:t,is401Error:n,httpStatusCode:r}=this.classifyStreamableHttpFailure(e);if(await this.cleanupResources(),n){$.info(`Authentication required`);let e=Error(`Authentication required`);throw e.code=401,e}let i=Error(`Could not connect via streamable HTTP: ${t}`);throw r!==void 0&&Object.defineProperty(i,"code",{value:r,writable:!1,enumerable:!0,configurable:!0}),i}}observeSseProgress(e){if(!e.body||!e.headers.get(`content-type`)?.includes(`text/event-stream`))return e;let[t,n]=e.body.tee();return(async()=>{let e=n.getReader(),t=new TextDecoder,r=``;try{for(;;){let{done:n,value:i}=await e.read();if(n)break;r+=t.decode(i,{stream:!0});let a=r.split(/\r?\n\r?\n/);r=a.pop()??``;for(let e of a)for(let t of e.split(/\r?\n/))if(t.startsWith(`data:`))try{let e=JSON.parse(t.slice(5).trim());e.method===`notifications/progress`&&this.forwardRoundProgress(e.params)}catch{}}}catch(e){e instanceof DOMException&&e.name===`AbortError`||$.debug(`Progress observer stream ended:`,e)}finally{e.releaseLock()}})(),new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers})}async connectWithStreamableHttp(e){try{$.debug(`[HttpConnector] Connecting with Streamable HTTP`,{baseUrl:e,originalUrl:this.baseUrl,gatewayUrl:this.gatewayUrl||`none`,authProviderUrl:this.opts.authProvider&&`serverUrl`in this.opts.authProvider&&typeof this.opts.authProvider.serverUrl==`string`?this.opts.authProvider.serverUrl:`none`,headers:this.headers});let t,n=new Promise(e=>{t=e}),r=this.customFetch??globalThis.fetch.bind(globalThis),i=new LC(new URL(e),{authProvider:this.opts.authProvider,fetch:async(e,n)=>{let i=await r(e,n),a=n?.method??(e instanceof Request?e.method:`GET`),o=new Headers(e instanceof Request?e.headers:void 0);return new Headers(n?.headers).forEach((e,t)=>{o.set(t,e)}),a.toUpperCase()===`GET`&&i.ok&&i.headers.get(`content-type`)?.includes(`text/event-stream`)&&t?.(),o.get(`mcp-method`)===`subscriptions/listen`?i:this.observeSseProgress(i)},requestInit:{headers:this.headers},reconnectionOptions:{maxReconnectionDelay:3e4,initialReconnectionDelay:1e3,reconnectionDelayGrowFactor:1.5,maxRetries:2,...this.reconnectionOptions}}),a=i;if(this.opts.wrapTransport){let e=this.baseUrl;a=this.opts.wrapTransport(a,e)}let o=this.buildClientOptions();$.debug(`Creating Client with capabilities:`,JSON.stringify(o.capabilities,null,2)),this.client=new MC(this.clientInfo,o),this.setupRootsHandler(),this.setupSamplingHandler(),this.setupElicitationHandler(),$.debug(`Roots/sampling/elicitation handlers registered before connect`);try{let e;if(await Promise.race([this.client.connect(a),new Promise((t,n)=>{e=setTimeout(()=>n(Error(`MCP connection timed out after ${this.timeout}ms`)),this.timeout)})]).finally(()=>{e!==void 0&&clearTimeout(e)}),(this.client.getProtocolEra?.()??`legacy`)===`legacy`&&i.sessionId){let e,t=await Promise.race([n.then(()=>!0),new Promise(t=>e=setTimeout(()=>t(!1),Math.min(this.timeout,5e3)))]);e&&clearTimeout(e),t||$.warn(`Legacy server push stream did not attach before connect completed`)}let t=i.sessionId;t&&$.debug(`Session ID obtained: ${t}`)}catch(e){if(e instanceof Error){let t=e.message||e.toString();if(t.includes(`Missing session ID`)||t.includes(`Bad Request: Missing session ID`)||t.includes(`Mcp-Session-Id header is required`)){let n=Error(`Session ID error: ${t}. The SDK should automatically extract session ID from initialize response.`);throw n.cause=e,n}}throw e}this.streamableTransport=i,this.connectionManager={stop:async()=>{if(this.streamableTransport)try{await this.streamableTransport.close()}catch(e){$.warn(`Error closing Streamable HTTP transport: ${e}`)}finally{this.streamableTransport=null}}},this.connected=!0,this.transportType=`streamable-http`,this.setupNotificationHandler(),$.debug(`Successfully connected to MCP implementation via streamable HTTP: ${e}`),this.trackConnectorInit({serverUrl:this.baseUrl,publicIdentifier:`${this.baseUrl} (streamable-http)`})}catch(e){throw await this.cleanupResources(),e}}get publicIdentifier(){return{type:`http`,url:this.baseUrl,transport:this.transportType||`unknown`,protocolEra:this.protocolEra??`unknown`}}getTransportType(){return this.transportType}async cleanupResources(){if(this.streamableTransport&&this.protocolEra!==`modern`){let e;try{await Promise.race([this.streamableTransport.terminateSession().then(()=>!0),new Promise(t=>e=setTimeout(()=>t(!1),Math.min(this.timeout,5e3)))])||$.debug(`Timed out terminating legacy HTTP session; closing transport`)}catch(e){$.debug(`Error terminating Streamable HTTP session: ${e}`)}finally{e&&clearTimeout(e)}}await super.cleanupResources()}},Ok=`2.0.0-beta.0`;function kk(){return Ok}function Ak(e,t){return{onSampling:e?.onSampling??t?.onSampling,onElicitation:e?.onElicitation??t?.onElicitation,onNotification:e?.onNotification??t?.onNotification}}function jk(e){if(!(`url`in e)||typeof e.url!=`string`||e.authProvider||e.authToken||e.oauth===!1)return!1;let t=e.headers;if(t){for(let e of Object.keys(t))if(e.toLowerCase()===`authorization`)return!1}return!0}function Mk(){return{name:`mcp-use`,title:`mcp-use`,version:kk(),description:`mcp-use is a complete TypeScript framework for building and using MCP`,icons:[{src:`https://mcp-use.com/logo.png`}],websiteUrl:`https://mcp-use.com`}}function Nk(e){let t=Mk();if(!e||typeof e!=`object`)return t;let n=e;return!n.name||!n.version?t:{...t,...n}}function Pk(e){let t=e?.capabilities;if(!t||t.views!==!0)return e;let{views:n,...r}=t,i=r.extensions&&typeof r.extensions==`object`&&!Array.isArray(r.extensions)?{...r.extensions}:{};return{...e,capabilities:{...r,extensions:{...i,"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}}}function Fk(e){let t=()=>{throw Error(`Invalid url to pass to open(): ${e}`)},n;try{n=new URL(e)}catch{t()}return n.protocol!==`https:`&&n.protocol!==`http:`&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&=encodeURIComponent(n.username),n.password&&=encodeURIComponent(n.password),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(Ik).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function Ik([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}var Lk=class{get(e){return localStorage.getItem(e)}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}keys(){let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&e.push(n)}return e}},Rk=class e{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;logoUri;callbackUrl;clientMetadataUrl;scope;store;allowClientSecret;constructor(t,n,r){FS(n.clientMetadataUrl),this.serverUrl=t,this.storageKeyPrefix=n.storageKeyPrefix||`mcp:auth`,this.serverUrlHash=e.hashString(t),this.clientName=n.clientName||`mcp-use`,this.clientUri=n.clientUri||(typeof window<`u`?window.location.origin:`https://mcp-use.com`),this.logoUri=n.logoUri||`https://mcp-use.com/logo.png`,this.callbackUrl=Fk(n.callbackUrl||(typeof window<`u`?new URL(`/oauth/callback`,window.location.origin).toString():`/oauth/callback`)),this.clientMetadataUrl=n.clientMetadataUrl,this.scope=n.scope,this.store=r,this.allowClientSecret=n.allowClientSecret??!0}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}static hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}get redirectUrl(){return this.callbackUrl}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:`none`,grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],client_name:this.clientName,client_uri:this.clientUri,logo_uri:this.logoUri,...this.scope?{scope:this.scope}:{}}}credentialKey(e,t){return t?this.getKey(`${e}_${encodeURIComponent(t.issuer)}`):this.getKey(e)}async readCredential(e,t){let n=this.credentialKey(e,t),r=await this.store.get(n);if(!r&&t){let r=this.credentialKey(e),i=await this.store.get(r);if(i)try{let e=JSON.parse(i);if(!e.issuer||e.issuer===t.issuer){let i={...e,issuer:t.issuer},a=JSON.stringify(i);return await this.store.set(n,a),await this.store.set(r,a),{key:n,value:i}}}catch{await this.store.remove(r)}return}if(r)try{return{key:n,value:JSON.parse(r)}}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse ${e.replace(`_`,` `)}:`,t),await this.store.remove(n);return}}async tokens(e){return(await this.readCredential(`tokens`,e))?.value}async saveTokens(e,t){let n=JSON.stringify(e);await this.store.set(this.credentialKey(`tokens`,t),n),t&&await this.store.set(this.credentialKey(`tokens`),n),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`))}async clientInformation(e){let t=await this.readCredential(`client_info`,e);if(!t)return;let{key:n,value:r}=t;try{if(!this.allowClientSecret&&r.client_secret){await this.store.remove(n),e&&await this.store.remove(this.credentialKey(`client_info`)),console.warn(`[${this.storageKeyPrefix}] Removed OAuth client information containing a browser client_secret.`);return}let t=Array.isArray(r.redirect_uris)?r.redirect_uris:[];if(!(t.length===0||t.includes(this.redirectUrl))){console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`),await this.store.remove(n),await this.store.remove(this.credentialKey(`tokens`,e)),await this.store.remove(this.getKey(`last_auth_url`));return}return r}catch{await this.store.remove(n);return}}async saveClientInformation(e,t){let n=e;if(!this.allowClientSecret&&n.client_secret)throw await this.store.remove(this.credentialKey(`client_info`,t)),t&&await this.store.remove(this.credentialKey(`client_info`)),Error(`Browser OAuth clients must be public clients; client_secret persistence is not allowed.`);let r=JSON.stringify(e);await this.store.set(this.credentialKey(`client_info`,t),r),t&&await this.store.set(this.credentialKey(`client_info`),r)}async saveCodeVerifier(e){await this.store.set(this.getKey(`code_verifier`),e)}async codeVerifier(){let e=this.getKey(`code_verifier`),t=await this.store.get(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async invalidateCredentials(e){let t=async e=>{let t=`${this.getKey(e)}_`;for(let n of await this.store.keys())(n===this.getKey(e)||n.startsWith(t))&&await this.store.remove(n)};switch(e){case`all`:await t(`tokens`),await t(`client_info`),await this.store.remove(this.getKey(`code_verifier`)),await this.store.remove(this.getKey(`last_auth_url`)),await this.store.remove(this.getKey(`discovery_state`)),await this.store.remove(this.getKey(`token_endpoint`));break;case`client`:await t(`client_info`);break;case`tokens`:await t(`tokens`);break;case`verifier`:await this.store.remove(this.getKey(`code_verifier`));break;case`discovery`:await this.store.remove(this.getKey(`discovery_state`));break;default:break}}async saveDiscoveryState(e){await this.store.set(this.getKey(`discovery_state`),JSON.stringify(e))}async discoveryState(){let e=await this.store.get(this.getKey(`discovery_state`));if(e)try{return JSON.parse(e)}catch{await this.store.remove(this.getKey(`discovery_state`));return}}async storeAuthorizationState(e,t={}){let n=globalThis.crypto.randomUUID(),r=`${this.storageKeyPrefix}:state_${n}`,i={serverUrlHash:this.serverUrlHash,expiry:Date.now()+1e3*60*10,providerOptions:{serverUrl:this.serverUrl,storageKeyPrefix:this.storageKeyPrefix,clientName:this.clientName,clientUri:this.clientUri,callbackUrl:this.callbackUrl,...this.clientMetadataUrl?{clientMetadataUrl:this.clientMetadataUrl}:{},...t.extraProviderOptions??{}},flowType:t.flowType,returnUrl:t.returnUrl};e.searchParams.set(`state`,n);let a=Fk(e.toString());return await this.store.set(r,JSON.stringify(i)),await this.store.set(this.getKey(`last_auth_url`),a),a}async getTokenEndpoint(){return(await this.discoveryState())?.authorizationServerMetadata?.token_endpoint??null}};async function zk(e){return typeof e==`string`?e:e instanceof URLSearchParams||e instanceof FormData?Object.fromEntries(e.entries()):e instanceof Blob?await e.text():e}var Bk=class{serverUrl;staticClientInfo;session;preventAutoAuth;useRedirectFlow;oauthProxyUrl;connectionUrl;proxyOAuthRequests;onPopupWindow;constructor(e,t={}){if(t.staticClientInfo?.client_secret)throw Error(`Browser OAuth clients must be public clients; staticClientInfo.client_secret is not allowed.`);this.serverUrl=e,this.session=new Rk(e,{...t,allowClientSecret:!1},new Lk),this.preventAutoAuth=t.preventAutoAuth,this.useRedirectFlow=t.useRedirectFlow,this.oauthProxyUrl=t.oauthProxyUrl,this.connectionUrl=t.connectionUrl,this.proxyOAuthRequests=t.proxyOAuthRequests??!0,this.staticClientInfo=t.staticClientInfo,this.onPopupWindow=t.onPopupWindow}get storageKeyPrefix(){return this.session.storageKeyPrefix}get serverUrlHash(){return this.session.serverUrlHash}get clientName(){return this.session.clientName}get clientUri(){return this.session.clientUri}get logoUri(){return this.session.logoUri}get callbackUrl(){return this.session.callbackUrl}get scope(){return this.session.scope}get clientMetadataUrl(){return this.session.clientMetadataUrl}getKey(e){return this.session.getKey(e)}reanchorWellKnownUrl(e){if(!this.connectionUrl)return e;try{let t=new URL(e),n=new URL(this.connectionUrl);if(t.origin!==n.origin||!t.pathname.startsWith(`/.well-known/`))return e;let r=new URL(this.serverUrl),[i,...a]=t.pathname.slice(13).split(`/`);if(!i)return e;let o=a.length?`/${a.join(`/`)}`:``,s=n.pathname.replace(/\/+$/,``),c=r.pathname.replace(/\/+$/,``),l=o&&o===s?c:o;return`${r.origin}/.well-known/${i}${l}${t.search}`}catch{return e}}getProxyFetch(e){if(!this.proxyOAuthRequests||!this.oauthProxyUrl)return e;let t=e??globalThis.fetch.bind(globalThis),n=this.oauthProxyUrl,r=new Set,i=!1;return async(e,a)=>{let o=typeof e==`string`?e:e instanceof URL?e.toString():e.url,s=this.reanchorWellKnownUrl(o),c;try{c=new URL(s).pathname}catch{return await t(e,a)}let l=c.includes(`/.well-known/`);if(!i){i=!0;let e=(await this.discoveryState())?.authorizationServerMetadata;for(let t of[`registration_endpoint`,`token_endpoint`,`revocation_endpoint`,`introspection_endpoint`])typeof e?.[t]==`string`&&r.add(e[t])}let u=r.has(s)||/\/(?:register|registration|token|revoke|revocation|introspect|introspection)\/?$/.test(c);if(!l&&!u)return await t(e,a);try{let r=new URL(s),i=new URL(n);if(r.origin===i.origin&&(r.pathname.startsWith(i.pathname)||s.includes(`/inspector/api/oauth`)))return await t(e,a)}catch{}let d=l?`${n}/metadata?serverUrl=${encodeURIComponent(this.serverUrl)}&url=${encodeURIComponent(s)}`:`${n}/proxy`;if(l){let e=await t(d,{...a,method:`GET`});try{let t=await e.clone().json();for(let e of[`registration_endpoint`,`token_endpoint`,`revocation_endpoint`,`introspection_endpoint`])typeof t[e]==`string`&&r.add(t[e])}catch{}return e}let f=a?.body?await zk(a.body):void 0,p=await(await t(d,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({serverUrl:this.serverUrl,url:s,method:a?.method||`POST`,headers:a?.headers?Object.fromEntries(new Headers(a.headers)):{},body:f})})).json();return new Response(JSON.stringify(p.body),{status:p.status,statusText:p.statusText,headers:new Headers(p.headers)})}}get redirectUrl(){return this.session.redirectUrl}get clientMetadata(){return this.session.clientMetadata}tokens(e){return this.session.tokens(e)}saveTokens(e,t){return this.session.saveTokens(e,t)}async clientInformation(e){return this.staticClientInfo?this.staticClientInfo:this.session.clientInformation(e)}async saveClientInformation(e,t){if(!this.staticClientInfo)return this.session.saveClientInformation(e,t)}codeVerifier(){return this.session.codeVerifier()}saveCodeVerifier(e){return this.session.saveCodeVerifier(e)}invalidateCredentials(e){return this.session.invalidateCredentials(e)}saveDiscoveryState(e){return this.session.saveDiscoveryState(e)}discoveryState(){return this.session.discoveryState()}getTokenEndpoint(){return this.session.getTokenEndpoint()}async getClientCredentials(){let e=await this.clientInformation();return e?.client_id?{client_id:e.client_id}:null}async prepareAuthorizationUrl(e){return this.session.storeAuthorizationState(e,{extraProviderOptions:{oauthProxyUrl:this.oauthProxyUrl,...this.clientMetadataUrl?{clientMetadataUrl:this.clientMetadataUrl}:{},...this.staticClientInfo?{staticClientInfo:this.staticClientInfo}:{},...this.scope?{scope:this.scope}:{}},flowType:this.useRedirectFlow?`redirect`:`popup`,returnUrl:typeof window<`u`?window.location.href:void 0})}async redirectToAuthorization(e){let t=await this.prepareAuthorizationUrl(e);if(this.preventAutoAuth){console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);return}if(this.useRedirectFlow){console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`),window.location.href=t;return}let n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?Fk(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}};async function Vk(e,t={}){return new Bk(e,t)}ek(),ek();var Hk=class{},Uk=class extends Hk{constructor(e){super(),this.data=e}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}},Wk=class extends Hk{constructor(e){super(),this.data=e}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},Gk=class extends Hk{constructor(e){super(),this.data=e}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},Kk=class extends Hk{constructor(e){super(),this.data=e}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},qk=class extends Hk{constructor(e){super(),this.data=e}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};async function Jk(e,t){try{await fetch(e,t)}catch{}}var Yk=`https://eu.i.posthog.com`,Xk=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`,Zk=`https://mcpuse.gateway.scarf.sh/events-ts`,Qk=`https://mcpuse.gateway.scarf.sh/simple/`,$k=1800,eA=new Set([`query`,`response`,`messages`]);function tA(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function nA(e,t=Qk){let n=new URLSearchParams;for(let[t,r]of Object.entries(e)){let e=tA(r);eA.has(t)&&e.length>120&&(e=`${e.slice(0,117)}...`),e!==``&&n.set(t,e)}let r=`${t}${t.includes(`?`)?`&`:`?`}${n.toString()}`;if(r.length<=$k)return r;let i=[...n.keys()].sort((e,t)=>(n.get(t)?.length??0)-(n.get(e)?.length??0));for(let e of i){if(r.length<=$k)break;e===`event`||e===`user_id`||(n.delete(e),r=`${t}${t.includes(`?`)?`&`:`?`}${n.toString()}`)}return r.slice(0,$k)}function rA(e,t){return Jk(t,{method:`POST`,headers:{"Content-Type":`application/json`},keepalive:!0,body:JSON.stringify(e)})}function iA(e,t){try{let n=nA(e,t),r=new Image;r.referrerPolicy=`no-referrer-when-downgrade`,r.src=n}catch{}return Promise.resolve()}function aA(e){let t=e.host??Yk,n=e.apiKey??Xk;return Jk(`${t}/i/v0/e/`,{method:`POST`,headers:{"Content-Type":`application/json`},keepalive:!0,body:JSON.stringify({api_key:n,event:e.event,distinct_id:e.distinctId,properties:e.properties,timestamp:new Date().toISOString()})})}function oA(e,t=Zk){return typeof window<`u`?iA(e,t===Zk?Qk:t):rA(e,t)}function sA(){return globalThis.crypto.randomUUID()}function cA(){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function lA(e,t){let n=e=>e.split(`-`)[0].split(`.`).map(e=>parseInt(e,10)||0),r=n(e),i=n(t),a=Math.max(r.length,i.length);for(let e=0;e<a;e++){let t=r[e]??0,n=i[e]??0;if(t!==n)return t>n}return!1}var uA=`mcp_use_user_id`,dA=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`,fA=`https://eu.i.posthog.com`,pA=null;function mA(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}function hA(){if(!mA())return null;try{localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`)}catch{return null}return{getUserId(){try{return localStorage.getItem(uA)}catch{return null}},setUserId(e){try{localStorage.setItem(uA,e)}catch{}},getDownloadedVersion:()=>null,setDownloadedVersion:()=>void 0}}function gA(){try{return globalThis.Bun===void 0?globalThis.Deno===void 0?typeof navigator<`u`&&navigator.userAgent?.includes(`Cloudflare-Workers`)?`cloudflare-workers`:globalThis.EdgeRuntime===void 0?typeof window<`u`&&typeof document<`u`?`browser`:typeof process<`u`&&process.versions?.node!==void 0?`node`:`unknown`:`edge`:`deno`:`bun`}catch{return`unknown`}}function _A(){if(typeof process<`u`&&{}.MCP_USE_TELEMETRY_SOURCE)return{}.MCP_USE_TELEMETRY_SOURCE;try{if(mA())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)??void 0}catch{}}function vA(){if(typeof window<`u`&&window.__MCP_USE_ANONYMIZED_TELEMETRY__===!1||typeof process<`u`&&{}.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase()===`false`)return!0;try{if(mA()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)return!0}catch{}return!1}function yA(){try{return`session-${sA()}`}catch{return`session-${Date.now()}-${cA()}`}}var bA=class e{static instance=null;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_telemetryEnabled=!1;_pending=new Set;_scarfEnabled=!1;_runtimeEnvironment;_storageCapability;_storage;_fsBacked;_source;_productVersion;constructor(){this._runtimeEnvironment=gA(),this._fsBacked=pA!==null,this._storage=pA??hA()??null,this._storageCapability=this._storage?`persistent`:`session-only`,this._source=_A()||this._runtimeEnvironment;let e=vA(),t=this._runtimeEnvironment!==`unknown`;e?(this._telemetryEnabled=!1,$.debug(`Telemetry disabled via opt-out`)):t?($.debug(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable.`),this._telemetryEnabled=!0,this._scarfEnabled=!0,this._fsBacked&&setTimeout(()=>{this.trackPackageDownload({triggered_by:`initialization`}).catch(e=>$.debug(`Failed to track package download: ${e}`))},0)):(this._telemetryEnabled=!1,$.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{mA()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}$.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}setProductVersion(e){this._productVersion=e}get isEnabled(){return this._telemetryEnabled||this._scarfEnabled}get userId(){if(this._currUserId)return this._currUserId;try{if(this._storage){let e=this._storage.getUserId();if(e)return this._currUserId=e,e;let t=sA();return this._storage.setUserId(t),this._currUserId=t,t}this._currUserId=yA()}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}async capture(e){if(!this._telemetryEnabled&&!this._scarfEnabled)return;let t=this.userId,n={...e.properties,mcp_use_version:this._productVersion??kk(),language:`typescript`,source:this._source,runtime:this._runtimeEnvironment};if(this._telemetryEnabled){let r=aA({host:fA,apiKey:dA,event:e.name,distinctId:t,properties:n});this._pending.add(r),r.finally(()=>this._pending.delete(r))}if(this._scarfEnabled){let r=oA({...n,user_id:t,event:e.name});this._pending.add(r),r.finally(()=>this._pending.delete(r))}}async trackPackageDownload(e){if(!this._scarfEnabled||!this._fsBacked||!this._storage)return;let t=kk(),n=this._storage.getDownloadedVersion(),r=!1,i=!1;n?lA(t,n)&&(i=!0,this._storage.setDownloadedVersion(t)):(i=!0,r=!0,this._storage.setDownloadedVersion(t)),i&&await oA({...e||{},mcp_use_version:t,user_id:this.userId,event:`package_download`,first_download:r,language:`typescript`,source:this._source,runtime:this._runtimeEnvironment})}async trackAgentExecution(e){this.isEnabled&&await this.capture(new Uk(e))}async trackMCPClientInit(e){this.isEnabled&&await this.capture(new Wk(e))}async trackConnectorInit(e){this.isEnabled&&await this.capture(new Gk(e))}async trackClientAddServer(e,t){this.isEnabled&&await this.capture(new Kk({serverName:e,serverConfig:t}))}async trackClientRemoveServer(e){this.isEnabled&&await this.capture(new qk({serverName:e}))}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){this._currUserId=e,this._storage?.setUserId(e),this._telemetryEnabled&&aA({host:fA,apiKey:dA,event:`$identify`,distinctId:e,properties:{$set:t??{}}})}reset(){this._currUserId=null}flush(){Promise.allSettled([...this._pending])}async shutdown(){try{await Promise.allSettled([...this._pending]),$.debug(`Telemetry fetch captures flushed`)}catch(e){$.debug(`Error flushing telemetry captures: ${e}`)}}},xA=5*6e4;function SA(e,t=0){if(!e||t>5)return!1;if(e instanceof pS)return!0;if(e instanceof Error){if(e.code===401||e.name===`UnauthorizedError`)return!0;let n=e.message??``;if(n.includes(`401`)||n.includes(`Unauthorized`)||e.cause&&SA(e.cause,t+1))return!0;let r=e.data;if(r?.cause&&SA(r.cause,t+1))return!0}return!1}async function CA(e,t,n={}){let r=e,i=n.timeoutMs??xA,a=n.fetchFn??r.getProxyFetch?.()??void 0;if(!r.hasPendingFlow){let n=await MS(e,{serverUrl:t,fetchFn:a});if(n===`AUTHORIZED`)return;if(n!==`REDIRECT`)throw Error(`Unexpected OAuth auth() result: ${n}`)}if(typeof r.getAuthorizationCode==`function`){await MS(e,{serverUrl:t,authorizationCode:await r.getAuthorizationCode(),fetchFn:a});return}await wA(r,i)}async function wA(e,t){if(typeof window>`u`)throw Error(`OAuth redirect requires a browser environment or a provider with getAuthorizationCode()`);if(e.useRedirectFlow)return;let n=e.getKey?.(`tokens`);if(!n)throw Error(`Browser OAuth provider must expose getKey() for token storage`);let r=null,i=e.getLastAttemptedAuthUrl?.();if(i)try{r=new URL(i).searchParams.get(`state`)}catch{}let a=await mk({popup:null,state:r,tokensKey:n,timeoutMs:t});switch(a.kind){case`success`:return;case`cancelled`:throw Error(`OAuth authentication was cancelled.`);case`timeout`:throw Error(`OAuth callback not received within ${t}ms. Ensure /oauth/callback calls onMcpAuthorization().`);case`error`:throw Error(a.error);default:throw Error(`Unexpected OAuth popup result`)}}ek();var TA=class{connector;autoConnect;constructor(e,t=!0){this.connector=e,this.autoConnect=t}async connect(){await this.connector.connect()}async disconnect(){await this.connector.disconnect()}async initialize(){!this.isConnected&&this.autoConnect&&await this.connect(),await this.connector.initialize()}get isConnected(){return this.connector&&this.connector.isClientConnected}on(e,t){e===`notification`&&this.connector.onNotification(t)}async setRoots(e){return this.connector.setRoots(e)}getRoots(){return this.connector.getRoots()}get tools(){return this.connector.tools}async listTools(e){return this.connector.listTools(e)}get serverCapabilities(){return this.connector.serverCapabilities}get serverInfo(){return this.connector.serverInfo}get protocolEra(){return this.connector.protocolEra}get negotiatedProtocolVersion(){return this.connector.negotiatedProtocolVersion}get info(){let e=this.protocolEra,t=this.negotiatedProtocolVersion,n=this.serverInfo;if(!e||!t||!n)throw Error(`MCP connection is not initialized`);let r=this.serverCapabilities,i=r.extensions&&typeof r.extensions==`object`&&!Array.isArray(r.extensions)?r.extensions:{};return{protocolEra:e,protocolVersion:t,server:n,capabilities:r,instructions:this.connector.instructions,extensions:i}}supports(e){return e in this.serverCapabilities}async callTool(e,t={},n){return this.connector.callTool(e,t,n)}async listResources(e,t){return this.connector.listResources(e,t)}async listAllResources(e){return this.connector.listAllResources(e)}async listResourceTemplates(e){return this.connector.listResourceTemplates(e)}async complete(e,t){return this.connector.complete(e,t)}async readResource(e,t){return this.connector.readResource(e,t)}async subscribeToResource(e,t){return this.connector.subscribeToResource(e,t)}async unsubscribeFromResource(e,t){return this.connector.unsubscribeFromResource(e,t)}async listPrompts(){return this.connector.listPrompts()}async getPrompt(e,t){return this.connector.getPrompt(e,t)}async request(e,t=null,n){return this.connector.request(e,t,n)}},EA;function DA(e,t){EA?.addServer(e,t)}function OA(e){EA?.removeServer(e)}function kA(e){return!!e&&typeof e==`object`&&`redirectUrl`in e&&`clientMetadata`in e}var AA=class{config={};sessions={};activeSessions=[];constructor(e){e&&(this.config=e)}static fromDict(e){throw Error(`fromDict must be implemented by concrete class`)}addServer(e,t){this.config.mcpServers=this.config.mcpServers||{},this.config.mcpServers[e]=t,DA(e,t)}async removeServer(e){this.config.mcpServers?.[e]&&(await this.closeSession(e),delete this.config.mcpServers[e],OA(e))}getServerNames(){return Object.keys(this.config.mcpServers??{})}getServerConfig(e){return this.config.mcpServers?.[e]}getConfig(){return this.config??{}}async createSession(e,t=!0){let n=this.config.mcpServers??{};if(Object.keys(n).length===0&&$.warn(`No MCP servers defined in config`),!n[e])throw Error(`Server '${e}' not found in config`);let r={...n[e]},i;if(jk(r)){let e=r.oauth===!1?void 0:r.oauth??{};i=await this.createDefaultOAuthProvider(r.url,e),r={...r,authProvider:i}}else `authProvider`in r&&r.authProvider&&kA(r.authProvider)&&(i=r.authProvider);let a=async()=>{let e=new TA(await Promise.resolve(this.createConnectorFromConfig(r)));return t&&await e.initialize(),e},o;try{o=await a()}catch(n){let s=r;if(!t||!i||!(`url`in s)||!SA(n)||i.preventAutoAuth)throw n;$.info(`[MCPClient] Unauthorized connecting to '${e}'; completing OAuth\u2026`),await CA(i,s.url),o=await a()}return this.sessions[e]=o,this.activeSessions.includes(e)||this.activeSessions.push(e),o}async connect(e){return this.createSession(e)}async createAllSessions(e=!0){let t=this.config.mcpServers??{};Object.keys(t).length===0&&$.warn(`No MCP servers defined in config`);for(let n of Object.keys(t))await this.createSession(n,e);return this.sessions}async connectAll(){return this.createAllSessions()}getSession(e){return this.sessions[e]||null}requireSession(e){let t=this.sessions[e];if(!t)throw Error(`Session '${e}' not found. Available sessions: ${this.activeSessions.join(`, `)||`none`}`);return t}getAllActiveSessions(){return Object.fromEntries(this.activeSessions.map(e=>[e,this.sessions[e]]))}async closeSession(e){let t=this.sessions[e];if(!t){$.warn(`No session exists for server ${e}, nothing to close`);return}try{$.debug(`Closing session for server ${e}`),await t.disconnect()}catch(t){$.error(`Error closing session for server '${e}': ${t}`)}finally{this.sessions[e]===t&&(delete this.sessions[e],this.activeSessions=this.activeSessions.filter(t=>t!==e))}}async closeAllSessions(){let e=Object.keys(this.sessions),t=[];for(let n of e)try{$.debug(`Closing session for server ${n}`),await this.closeSession(n)}catch(e){let r=`Failed to close session for server '${n}': ${e}`;$.error(r),t.push(r)}t.length?$.error(`Encountered ${t.length} errors while closing sessions`):$.debug(`All sessions closed successfully`)}async close(){await this.closeAllSessions()}};function jA(e){let t=Object.keys(e.mcpServers??{});bA.getInstance().trackMCPClientInit({codeMode:!1,sandbox:!1,allCallbacks:!1,verify:!1,servers:t,numServers:t.length,isBrowser:!0}).catch(e=>$.debug(`Failed to track BrowserMCPClient init: ${e}`))}var MA=class e extends AA{static getPackageVersion(){return kk()}constructor(e){super(e),jA(this.config)}static fromDict(t){return new e(t)}async createDefaultOAuthProvider(e,t={}){return Vk(e,t)}createConnectorFromConfig(e){let{url:t,headers:n,fetch:r,authToken:i,authProvider:a,wrapTransport:o,clientOptions:s,protocolNegotiation:c,timeout:l,gatewayUrl:u,serverId:d,reconnectionOptions:f}=e;if(!t)throw Error(`Server URL is required`);let p=this.config,m=Ak(e,p),h=Nk(e.clientInfo??this.config.clientInfo),g={headers:n,fetch:r??globalThis.fetch.bind(globalThis),authToken:i,authProvider:a,wrapTransport:o,clientOptions:s,onSampling:m.onSampling,onElicitation:m.onElicitation,onNotification:m.onNotification,protocolNegotiation:c,timeout:l,clientInfo:h,gatewayUrl:u,serverId:d,reconnectionOptions:f};return $.debug(`[BrowserMCPClient] Connector options prepared (clientOptions: ${s?`provided`:`none`})`),new Dk(t,g)}};ek();var NA=`https://favicon.tools.mcp-use.com`,PA=/^\d{1,3}(\.\d{1,3}){3}$/;function FA(e){try{let t=e.includes(`://`)?e:`https://${e}`;return new URL(t).hostname}catch{return null}}function IA(e){let t=e.toLowerCase();if(t===`localhost`||t.endsWith(`.localhost`)||t===`host.docker.internal`||t===`0.0.0.0`)return!0;if(!PA.test(t))return!1;if(t===`127.0.0.1`||t.startsWith(`127.`)||t.startsWith(`10.`)||t.startsWith(`192.168.`))return!0;let n=/^172\.(\d+)\./.exec(t);if(n){let e=Number.parseInt(n[1],10);if(e>=16&&e<=31)return!0}return!1}function LA(e){let t=e.split(`.`);return Array.from({length:t.length-1},(e,n)=>t.slice(n).join(`.`))}function RA(e){return new Promise((t,n)=>{let r=new FileReader;r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}async function zA(e){try{let t=FA(e);if(!t||IA(t))return null;for(let e of LA(t))try{let t=await fetch(`${NA}/${e}?response=json`,{signal:AbortSignal.timeout(2e3)});if(!t.ok)continue;let n=await t.json();if(n.source==="default")continue;let r=n.url.replace(/^http:\/\//,`https://`),i=await fetch(r,{signal:AbortSignal.timeout(2e3)});if(!i.ok)continue;return await RA(await i.blob())}catch{continue}return null}catch(e){return console.warn(`[favicon] Error detecting favicon:`,e),null}}var BA=`inspector-server`;function VA(e,t){if(!e)throw Error(t)}async function HA(e){try{let t=e.serverInfo.icons?.[0]?.src;if(t){e.addLog(`info`,`Server provided icon:`,t);let n=await(await fetch(t)).blob(),r=await new Promise((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=t,r.readAsDataURL(n)});return e.isMounted()&&(e.setServerInfo(e=>e?{...e,icon:r}:void 0),e.addLog(`debug`,`Server icon converted to base64`)),r}if(e.url){let t=await zA(e.url);if(!e.isMounted())return e.addLog(`debug`,`Connection aborted after favicon detection - component unmounted`),null;if(t)return e.setServerInfo(e=>e?{...e,icon:t}:void 0),e.addLog(`debug`,`Favicon detected and added to serverInfo`),t}return null}catch(t){return e.addLog(`debug`,`Icon loading failed (non-critical):`,t),null}}function UA(e,t){return t?`state=${e}`:`client disconnected (state=${e})`}function WA(e){return{name:e.name,version:e.version,uri:e.websiteUrl,logo_uri:e.icons?.[0]?.src}}function GA(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return t.includes(`oauth discovery failed`)||t.includes(`oauth-authorization-server`)||t.includes(`not valid json`)||t.includes(`404`)&&(t.includes(`openid-configuration`)||t.includes(`oauth-protected-resources`)||t.includes(`oauth-authorization-url`)||t.includes(`register`))||t.includes(`invalid oauth error response`)&&t.includes(`not found`)}function KA(e,t){if(t)return t;if(e)try{let t=new URL(e);return t.pathname=t.pathname.replace(/\/proxy\/?$/,`/oauth`),t.toString()}catch{return}}function qA(e){let t=KA(e.gatewayUrl,e.oauthProxyUrl);return{provider:new Bk(e.effectiveOAuthUrl,{storageKeyPrefix:e.storageKeyPrefix,clientName:e.oauthClientConfig.name,clientUri:e.oauthClientConfig.uri,logoUri:e.oauthClientConfig.logo_uri||`https://mcp-use.com/logo.png`,callbackUrl:e.callbackUrl,preventAutoAuth:e.preventAutoAuth,useRedirectFlow:e.useRedirectFlow,oauthProxyUrl:t,connectionUrl:e.gatewayUrl,onPopupWindow:e.onPopupWindow,proxyOAuthRequests:e.proxyOAuthRequests,staticClientInfo:e.staticClientInfo,clientMetadataUrl:e.clientMetadataUrl,scope:e.scope}),oauthProxyUrl:t}}function JA(e){let t=null,n=Date.now(),r=!1,i=e.healthCheckIntervalMs??1e4,a=e.healthCheckTimeoutMs??3e4;return t=setInterval(async()=>{if(!r){if(!e.isMountedRef.current||e.stateRef.current!==`ready`){t&&=(clearInterval(t),null);return}try{let i=e.gatewayUrl||e.url;if(!i)return;let a=e.getAuthHeaders?await e.getAuthHeaders():{},o=await fetch(i,{method:`HEAD`,headers:{...e.allHeaders,...a},signal:AbortSignal.timeout(5e3)});if(o.status===405||o.status===404){r=!0,n=Date.now(),t&&=(clearInterval(t),null);return}if(o.ok||o.status<500)n=Date.now();else throw Error(`Server returned ${o.status}`)}catch{let r=Date.now()-n;r>a&&(e.addLog(`warn`,`Connection appears to be broken (no response for ${Math.round(r/1e3)}s), attempting to reconnect...`),t&&=(clearInterval(t),null),e.autoReconnectRef.current&&e.isMountedRef.current&&(e.setState(`discovering`),e.addLog(`info`,`Auto-reconnecting to MCP server...`),setTimeout(()=>{e.isMountedRef.current&&e.stateRef.current===`discovering`&&e.connect()},typeof e.autoReconnectRef.current==`number`?e.autoReconnectRef.current:e.defaultReconnectDelay)))}}},i),()=>{t&&=(clearInterval(t),null)}}function YA(e,t){let n=e.connectionRef.current;if(e.stateRef.current!==`ready`||!e.hasClient()||!n)throw Error(`MCP client is not ready (${UA(e.stateRef.current,e.hasClient())}). Cannot ${t}.`);return n}function XA(e){let t=(0,z.useCallback)(async(t,n,r)=>{let i=YA(e,`call tool "${t}"`);e.addLog(`info`,`Calling tool: ${t}`,n);let a=Date.now();try{let o=await i.callTool(t,n||{},r);return e.addLog(`info`,`Tool "${t}" call successful:`,o),bA.getInstance().trackUseMcpToolCall({toolName:t,success:!0,executionTimeMs:Date.now()-a}).catch(()=>{}),o}catch(n){throw e.addLog(`error`,`Tool "${t}" call failed:`,n),bA.getInstance().trackUseMcpToolCall({toolName:t,success:!1,errorType:n instanceof Error?n.name:`UnknownError`,executionTimeMs:Date.now()-a}).catch(()=>{}),n}},[e.addLog]),n=(0,z.useCallback)(async()=>{let t=YA(e,`list resources`);e.addLog(`info`,`Listing resources`);let n=await t.listAllResources();e.setResources(n.resources||[])},[e.addLog]),r=(0,z.useCallback)(async t=>{let n=YA(e,`read resource`);e.addLog(`info`,`Reading resource: ${t}`);try{let e=await n.readResource(t);return bA.getInstance().trackUseMcpResourceRead({resourceUri:t,success:!0}).catch(()=>{}),e}catch(e){throw bA.getInstance().trackUseMcpResourceRead({resourceUri:t,success:!1,errorType:e instanceof Error?e.name:`UnknownError`}).catch(()=>{}),e}},[e.addLog]),i=(0,z.useCallback)(async()=>{let t=YA(e,`list prompts`);e.addLog(`info`,`Listing prompts`);let n=await t.listPrompts();e.setPrompts(n.prompts||[])},[e.addLog]),a=(0,z.useCallback)(async()=>{if(!(e.stateRef.current!==`ready`||!e.connectionRef.current))try{e.setTools(await e.connectionRef.current.listTools()||[])}catch(t){e.addLog(`error`,`Failed to refresh tools:`,t)}},[e.addLog]),o=(0,z.useCallback)(async()=>{if(!(e.stateRef.current!==`ready`||!e.connectionRef.current))try{let t=await e.connectionRef.current.listAllResources();e.setResources(t.resources||[])}catch(t){e.addLog(`warn`,`Failed to refresh resources:`,t)}},[e.addLog]),s=(0,z.useCallback)(async()=>{if(!(e.stateRef.current!==`ready`||!e.connectionRef.current))try{let t=await e.connectionRef.current.listPrompts();e.setPrompts(t.prompts||[])}catch(t){e.addLog(`warn`,`Failed to refresh prompts:`,t)}},[e.addLog]),c=(0,z.useCallback)(async()=>{let t=await YA(e,`refresh resource templates`).listResourceTemplates();e.isMounted()&&e.setResourceTemplates(t.resourceTemplates||[])},[e.addLog]);return{callTool:t,listResources:n,readResource:r,listPrompts:i,refreshTools:a,refreshResources:o,refreshPrompts:s,refreshResourceTemplates:c,refreshAll:(0,z.useCallback)(()=>Promise.all([a(),o(),c(),s()]).then(()=>void 0),[a,o,c,s]),getPrompt:(0,z.useCallback)(async(t,n)=>YA(e,`get prompt`).getPrompt(t,n||{}),[e.addLog]),complete:(0,z.useCallback)(async t=>YA(e,`request completion`).complete(t),[e.addLog])}}var ZA=3e3,QA=5e3;function $A(e){let{url:t,enabled:n=!0,callbackUrl:r=typeof window<`u`?Fk(new URL(`/oauth/callback`,window.location.origin).toString()):`/oauth/callback`,storageKeyPrefix:i=`mcp:auth`,authProvider:a,headers:o,proxyConfig:s,oauthProxyUrl:c,autoProxyFallback:l=!1,logLevel:u=`silent`,autoRetry:d=!1,autoReconnect:f=!0,reconnectionOptions:p,preventAutoAuth:m=!0,useRedirectFlow:h=!1,onPopupWindow:g,timeout:_=3e4,wrapTransport:v,serverId:y,fetch:b,clientOptions:x,protocolNegotiation:S,onNotification:C,onSampling:w,onElicitation:T,oauth:ee}=e,E=`http`,D=ee?.clientId?.trim()||void 0,te=ee?.clientMetadataUrl?.trim()||void 0,ne=ee?.scope?.trim()||void 0,O=(0,z.useMemo)(()=>D?{client_id:D}:void 0,[D]),re=(0,z.useMemo)(()=>{let e=`useMcp:${t||`no-url`}`,n=$O.get(e);return u&&(n.level=u),n},[t,u]),k=o??{},ie=(0,z.useMemo)(()=>Pk(x),[x]),A=w,j=T,M=(0,z.useMemo)(()=>({name:`mcp-use`,title:`mcp-use`,version:kk(),description:`mcp-use is a complete TypeScript framework for building and using MCP`,icons:[{src:`https://mcp-use.com/logo.png`}],websiteUrl:`https://mcp-use.com`}),[]),ae=(0,z.useMemo)(()=>e.clientInfo?{...M,...e.clientInfo}:M,[e.clientInfo,M]),oe=(0,z.useMemo)(()=>WA(ae),[ae]),se=(0,z.useMemo)(()=>{if(!l)return{enabled:!1,proxyAddress:void 0};if(typeof l==`boolean`){let e=s?.proxyAddress;return{enabled:l&&!!e,proxyAddress:e}}let e=l.proxyAddress??s?.proxyAddress;return{enabled:l.enabled!==!1&&!!e,proxyAddress:e}},[l,s]),N=(0,z.useMemo)(()=>f===!1?{enabled:!1,initialDelay:0,healthCheckInterval:!1,healthCheckTimeout:3e4}:f===!0?{enabled:!0,initialDelay:ZA,healthCheckInterval:1e4,healthCheckTimeout:3e4}:typeof f==`number`?{enabled:!0,initialDelay:f,healthCheckInterval:1e4,healthCheckTimeout:3e4}:{enabled:f.enabled!==!1,initialDelay:f.initialDelay??ZA,healthCheckInterval:f.healthCheckInterval??1e4,healthCheckTimeout:f.healthCheckTimeout??3e4},[f]),[P,ce]=(0,z.useState)(void 0);(0,z.useEffect)(()=>{ce(void 0)},[t,s]);let le=(0,z.useMemo)(()=>{if(!P?.proxyAddress)return s;let e=s?.headers??{};return{...P,headers:{...e,...P.headers??{}}}},[P,s]),ue=le?.proxyAddress,de=le?.headers??{},fe=(0,z.useMemo)(()=>t||``,[t]),pe=(0,z.useMemo)(()=>({...de,...k}),[de,k]),[me,he]=(0,z.useState)(`discovering`),[ge,_e]=(0,z.useState)([]),[ve,ye]=(0,z.useState)([]),[be,F]=(0,z.useState)([]),[xe,Se]=(0,z.useState)([]),[Ce,we]=(0,z.useState)(e._initialServerInfo?.name?e._initialServerInfo:void 0),[Te,Ee]=(0,z.useState)(),[De,Oe]=(0,z.useState)(void 0),[ke,Ae]=(0,z.useState)(void 0),[je,Me]=(0,z.useState)(),[Ne,Pe]=(0,z.useState)({}),[Fe,Ie]=(0,z.useState)(void 0),[Le,Re]=(0,z.useState)([]),[ze,Be]=(0,z.useState)(void 0),[Ve,He]=(0,z.useState)(void 0),Ue=(0,z.useRef)(null),We=(0,z.useRef)(null),Ge=(0,z.useRef)(a??null),Ke=(0,z.useRef)(null),qe=(0,z.useRef)(!1),Je=(0,z.useRef)(!0),Ye=(0,z.useRef)(0),Xe=(0,z.useRef)(0),Ze=(0,z.useRef)(null),Qe=(0,z.useRef)(!1),$e=(0,z.useRef)(!1),et=(0,z.useRef)(me),tt=(0,z.useRef)(f),nt=(0,z.useRef)(null),rt=(0,z.useRef)(null),it=(0,z.useRef)(null),at=(0,z.useRef)(A),ot=(0,z.useRef)(j),st=(0,z.useRef)(A!==void 0),ct=(0,z.useRef)(j!==void 0),lt=(0,z.useRef)(C);A!==void 0&&(at.current=A),j!==void 0&&(ot.current=j),st.current=A!==void 0,ct.current=j!==void 0,lt.current=C;let ut=(0,z.useCallback)(async e=>at.current(e),[]),dt=(0,z.useCallback)(async e=>ot.current(e),[]),ft=(0,z.useCallback)(e=>{lt.current?.(e)},[]);(0,z.useEffect)(()=>{et.current=me,tt.current=f},[me,f]),(0,z.useEffect)(()=>{Ge.current=a??null},[a]);let I=(0,z.useCallback)((e,t,...n)=>{let r=n.length>0?`${t} ${n.map(e=>JSON.stringify(e)).join(` `)}`:t,i=`[useMcp] ${r}`;switch(e){case`error`:re.error(i);break;case`warn`:re.warn(i);break;case`info`:re.info(i);break;case`debug`:re.debug(i);break;default:re.info(i)}Je.current&&Re(t=>[...t.slice(-100),{level:e,message:r,timestamp:Date.now()}])},[re]),pt=XA({stateRef:et,connectionRef:We,hasClient:()=>Ue.current!==null,isMounted:()=>Je.current,setTools:_e,setResources:ye,setResourceTemplates:F,setPrompts:Se,addLog:I}),mt=(0,z.useCallback)(async(e=!1)=>{e||I(`info`,`Disconnecting...`),qe.current=!1,Ze.current&&clearTimeout(Ze.current),Ze.current=null;let t=Xe.current,n=Ue.current;if(n)try{let e=BA,t=n===Ue.current?We.current:null;t&&t._healthCheckCleanup&&(t._healthCheckCleanup(),t._healthCheckCleanup=null),t&&await n.closeSession(e)}catch(t){e||I(`warn`,`Error closing connection:`,t)}let r=Xe.current!==t;Ue.current===n&&!r&&(Ue.current=null,We.current=null),Je.current&&!e&&!r&&(he(`discovering`),_e([]),ye([]),F([]),Se([]),Ie(void 0),Be(void 0),He(void 0),we(void 0),Ee(void 0),Oe(void 0),Ae(void 0),Me(void 0),Pe({}))},[I]),ht=(0,z.useCallback)((e,n)=>{I(`error`,e,n??``);let r=n&&`code`in n?n.code:void 0,i=se.enabled&&!le?.proxyAddress,o=e.includes(`CORS`)||e.includes(`blocked by CORS policy`)||e.includes(`Failed to fetch`),s=r===400;if(i&&(o||s||typeof r==`number`&&r>=404&&r<500)&&!(r===401||r===403))return I(`info`,`Direct connection failed with ${o?`CORS error`:s?`HTTP 400 (Bad Request)`:`HTTP 4xx error`}. Trying with proxy...`),Ue.current=null,a||(Ge.current=null),I(`debug`,`Cleared client and auth provider for proxy fallback`),ce({proxyAddress:se.proxyAddress}),Je.current&&he(`discovering`),setTimeout(()=>{Je.current&&rt.current?.()},1e3),!0;if(Je.current){I(`info`,`Setting state to FAILED:`,e),he(`failed`),Ie(e);let t=Ge.current?.getLastAttemptedAuthUrl?.();t&&(Be(t),I(`info`,`Manual authentication URL may be available.`,t))}return qe.current=!1,t&&bA.getInstance().trackUseMcpConnection({url:t,transportType:E,success:!1,errorType:n?.name||`UnknownError`,hasOAuth:!!Ge.current,hasSampling:st.current,hasElicitation:ct.current}).catch(()=>{}),!1},[I,t,E,se,le,a]),gt=(0,z.useCallback)(async()=>{if(!n||!t){I(`debug`,n?`No server URL provided, skipping connection.`:`Connection disabled via enabled flag.`);return}if(qe.current){I(`debug`,`Connection attempt already in progress.`);return}if(!Je.current){I(`debug`,`Connect called after unmount, aborting.`);return}if(qe.current=!0,Xe.current+=1,Ye.current+=1,Ie(void 0),Be(void 0),nt.current=null,he(`discovering`),_e([]),ye([]),F([]),Se([]),we(void 0),Ee(void 0),Oe(void 0),Ae(void 0),Me(void 0),Pe({}),I(`info`,`Connecting attempt #${Ye.current} to ${t}...`),!Ge.current){let{provider:e,oauthProxyUrl:t}=qA({effectiveOAuthUrl:fe,storageKeyPrefix:i,oauthClientConfig:oe,callbackUrl:r,preventAutoAuth:m,useRedirectFlow:h,gatewayUrl:ue,oauthProxyUrl:c,onPopupWindow:g,proxyOAuthRequests:!0,staticClientInfo:O,clientMetadataUrl:te,scope:ne});Ge.current=e,t&&I(`debug`,`OAuth BFF enabled: ${t}`),I(`debug`,`BrowserOAuthClientProvider initialized with URL: ${fe}, proxy: ${t?`enabled`:`disabled`}, gateway: ${ue?`enabled`:`disabled`}`)}Ue.current?I(`debug`,`BrowserMCPClient already exists, reusing.`):(Ue.current=new MA,I(`debug`,`BrowserMCPClient initialized in connect.`));let e=async n=>{if(!Je.current)return I(`debug`,`Connection attempt aborted - component unmounted`),`failed`;I(`info`,`Attempting connection with transport: ${n}`),I(`debug`,`Client ref status at start of tryConnectWithTransport: ${Ue.current?`initialized`:`NULL`}`);try{let e=BA,r={url:t,timeout:_,clientInfo:ae,...(()=>{let e=Ge.current?.getProxyFetch?.(b)??b;return e?{fetch:e}:{}})(),...ie&&{clientOptions:ie},...S!==void 0&&{protocolNegotiation:S},...p?{reconnectionOptions:p}:f===!1?{reconnectionOptions:{maxRetries:0}}:{}};if(ue&&(r.gatewayUrl=ue,I(`debug`,`Using proxy gateway: ${ue} for target: ${t}`)),pe&&Object.keys(pe).length>0&&(r.headers=pe),!Ue.current){if(!Je.current)return I(`debug`,`Connection aborted - component unmounted, client cleaned up`),`failed`;let e=Error(`Client not initialized - this is a bug in the connection flow`);throw I(`error`,`Client ref is null in tryConnectWithTransport but component is still mounted`),e}Ue.current.addServer(e,{...r,authProvider:Ge.current,onSampling:st.current?ut:void 0,onElicitation:ct.current?dt:void 0,onNotification:e=>{I(`debug`,`Notification received:`,e.method,e),ft(e),e.method===`notifications/tools/list_changed`?(I(`info`,`Tools list changed, auto-refreshing...`),pt.refreshTools().catch(e=>I(`warn`,`Auto-refresh tools failed:`,e))):e.method===`notifications/resources/list_changed`?(I(`info`,`Resources list changed, auto-refreshing...`),pt.refreshResources().catch(e=>I(`warn`,`Auto-refresh resources failed:`,e))):e.method===`notifications/prompts/list_changed`&&(I(`info`,`Prompts list changed, auto-refreshing...`),pt.refreshPrompts().catch(e=>I(`warn`,`Auto-refresh prompts failed:`,e)))},wrapTransport:v?n=>(I(`debug`,`Applying transport wrapper for server:`,e,`url:`,t),v(n,y??t)):void 0});let i=await Ue.current.connect(e);if(We.current=i,!Je.current)return I(`debug`,`Connection aborted after connection creation - component unmounted`),`failed`;I(`info`,`✅ Successfully connected to MCP server`),I(`info`,`Server info:`,i.info.server),I(`info`,`Server capabilities:`,i.info.capabilities),N.enabled&&N.healthCheckInterval!==!1&&(i._healthCheckCleanup=JA({gatewayUrl:ue,url:t,allHeaders:pe,getAuthHeaders:async()=>{try{let e=await Ge.current?.tokens?.();if(e?.access_token){let t=e.token_type||`bearer`;return{Authorization:`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.access_token}`}}}catch{}return{}},isMountedRef:Je,stateRef:et,autoReconnectRef:tt,setState:he,addLog:I,connect:gt,defaultReconnectDelay:N.initialDelay,healthCheckIntervalMs:N.healthCheckInterval,healthCheckTimeoutMs:N.healthCheckTimeout})),bA.getInstance().trackUseMcpConnection({url:t,transportType:n,success:!0,hasOAuth:!!Ge.current,hasSampling:st.current,hasElicitation:ct.current}).catch(()=>{}),_e(i.tools||[]);let[a,o,s]=await Promise.all([i.listAllResources(),i.listPrompts(),i.supports(`resources`)?i.listResourceTemplates():Promise.resolve({resourceTemplates:[]})]);if(!Je.current)return I(`debug`,`Connection aborted after discovery - component unmounted`),`failed`;ye(a.resources||[]),Se(o.prompts||[]),F(s.resourceTemplates||[]);let{server:c,capabilities:l,protocolEra:u,protocolVersion:d,instructions:m,extensions:h}=i.info;if(Je.current&&(Oe(u),Ae(d),Me(m),Pe(h)),c){if(I(`debug`,`Server info:`,c),!Je.current)return I(`debug`,`Skipping state update - component unmounted`),`failed`;we(c),Ke.current=HA({serverInfo:c,url:t,isMounted:()=>Je.current,setServerInfo:we,addLog:I})}if(l){if(I(`debug`,`Server capabilities:`,l),!Je.current)return I(`debug`,`Skipping state update - component unmounted`),`failed`;Ee(l)}if(Ge.current){let e=await Ge.current.tokens?.();if(!Je.current)return I(`debug`,`Connection aborted after token fetch for auth tokens - component unmounted`),`failed`;if(e?.access_token){let t=e.expires_in?Date.now()+e.expires_in*1e3:void 0,n=null,r=null;try{n=await Ge.current.getTokenEndpoint?.()??null}catch{n=null}try{r=await Ge.current.getClientCredentials?.()??null}catch{r=null}if(!Je.current)return I(`debug`,`Skipping state update - component unmounted`),`failed`;He({access_token:e.access_token,token_type:e.token_type||`Bearer`,expires_at:t,refresh_token:e.refresh_token,scope:e.scope,...n?{token_endpoint:n}:{},...r?.client_id?{client_id:r.client_id}:{},...r?.client_secret?{client_secret:r.client_secret}:{}})}}return nt.current=n,he(`ready`),`success`}catch(r){let i=r,a=i?.message||String(r),o=Ge.current?.getLastAttemptedAuthUrl?.();if(o&&Ge.current&&m)return I(`info`,`OAuth already discovered (stored auth URL present); awaiting manual authentication.`),Je.current&&(he(`pending_auth`),Be(o)),qe.current=!1,`auth_redirect`;let s=GA(r),c=SA(r);if(s&&k&&Object.keys(k).length>0)return ht(`Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct.`),`failed`;if(s&&(!k||Object.keys(k).length===0))return ht(`Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY).`),`failed`;if(c){if(s)return ht(`Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY).`),`failed`;if(Ge.current)if(I(`info`,`Authentication required. OAuth provider available.`),m){if(I(`info`,`Waiting for user to initiate authentication flow...`),Je.current){he(`pending_auth`);let e=Ge.current?.getLastAttemptedAuthUrl?.();e&&(Be(e),I(`info`,`Retrieved stored auth URL for manual authentication`))}return qe.current=!1,`auth_redirect`}else{I(`info`,`Triggering automatic OAuth authentication flow...`);try{if(await MS(Ge.current,{serverUrl:t,fetchFn:Ge.current.getProxyFetch?.()})===`REDIRECT`){let e=await Ge.current.getAuthorizationCode?.();if(!e)throw Error(`Authorization code not captured by headless provider`);await MS(Ge.current,{serverUrl:t,authorizationCode:e,fetchFn:Ge.current.getProxyFetch?.()})}return I(`info`,`OAuth flow completed, reconnecting...`),await e(n)}catch(e){return ht(`Automatic OAuth authentication failed: ${e instanceof Error?e.message:String(e)}`,e instanceof Error?e:Error(String(e))),`failed`}}return k&&Object.keys(k).length>0?(ht(`Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct.`),`failed`):(ht(`Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY).`),`failed`)}return ht(a,i instanceof Error?i:Error(String(i)))?`auth_redirect`:`failed`}},a=`failed`;I(`debug`,`Connecting via streamable HTTP`),a=await e(`http`),(a===`success`||a===`failed`||a===`auth_redirect`)&&(qe.current=!1),I(`debug`,`Connection sequence finished with status: ${a}`)},[I,ht,mt,t,i,r,oe.name,oe.version,oe.uri,oe.logo_uri,O,te,ne,k,E,m,h,g,n,_,ae,ie,S,ue,c,pe,fe,ut,dt,ft]);(0,z.useEffect)(()=>{rt.current=gt,it.current=ht},[gt,ht]);let _t=(0,z.useCallback)(()=>{et.current===`failed`?(I(`info`,`Retry requested...`),rt.current?.()):I(`warn`,`Retry called but state is not 'failed' (state: ${et.current}). Ignoring.`)},[I]),vt=(0,z.useCallback)(async()=>{I(`info`,`Manual authentication requested...`);let e=et.current;if(e===`failed`)I(`info`,`Attempting to reconnect and authenticate via retry...`),_t();else if(e===`pending_auth`){I(`info`,`Proceeding with authentication from pending state...`);try{if(VA(Ge.current,`Auth Provider not available for manual auth`),VA(t,`Server URL is required for authentication`),a){I(`info`,`Using provided authProvider for manual authentication`);let e=new URL(t),n=e.origin+e.pathname.replace(/\/+$/,``);await MS(Ge.current,{serverUrl:n,fetchFn:Ge.current.getProxyFetch?.()}),rt.current?.();return}I(`info`,`Cleared ${Ge.current.clearStorage?.()??0} OAuth storage item(s) for fresh authentication`),he(`authenticating`);let e=null,n=null,{provider:o,oauthProxyUrl:s}=qA({effectiveOAuthUrl:fe,storageKeyPrefix:i,oauthClientConfig:oe,callbackUrl:r,preventAutoAuth:!1,useRedirectFlow:h,gatewayUrl:ue,oauthProxyUrl:c,onPopupWindow:(t,r,i)=>{e=i;try{n=new URL(t).searchParams.get(`state`)}catch{}g?.(t,r,i)},proxyOAuthRequests:!0,staticClientInfo:O,clientMetadataUrl:te,scope:ne});s&&I(`info`,`Scoped OAuth proxy fetch enabled for manual auth`),Ge.current=o,I(`info`,`Triggering fresh OAuth authorization...`);let l=new URL(t),u=l.origin+l.pathname.replace(/\/+$/,``);try{await MS(o,{serverUrl:u,fetchFn:o.getProxyFetch?.()}),I(`info`,`OAuth flow completed (tokens obtained)`)}catch(e){I(`info`,`OAuth flow initiated (popup/redirect):`,e instanceof Error?e.message:`Redirecting...`)}let d=o.getLastAttemptedAuthUrl?.();if(d&&(Be(d),I(`info`,`Updated auth URL for fallback:`,d),!n))try{n=new URL(d).searchParams.get(`state`)}catch{}if(h)return;let f=o.getKey?.(`tokens`);if(!f){I(`warn`,`Could not derive tokens storage key; relying on callback listener.`);return}$e.current=!0;let p;try{p=await mk({popup:e,state:n,tokensKey:f})}finally{$e.current=!1}if(!Je.current)return;switch(p.kind){case`success`:I(`info`,`Authentication succeeded; reconnecting to MCP server...`),qe.current=!1,rt.current?.();break;case`cancelled`:I(`warn`,`Authentication popup was closed before completing. Returning to pending_auth.`),he(`pending_auth`);break;case`timeout`:I(`warn`,`Authentication timed out waiting for the popup. Returning to pending_auth.`),he(`pending_auth`);break;case`error`:ht(`Authentication failed: ${p.error}`);break;default:break}}catch(e){if(!Je.current)return;he(`pending_auth`),I(`error`,`Manual authentication failed: ${e instanceof Error?e.message:String(e)}`)}}else if(e===`authenticating`){I(`warn`,`Already attempting authentication. Check for blocked popups or wait for timeout.`);let e=Ge.current?.getLastAttemptedAuthUrl?.();e&&!ze&&(Be(e),I(`info`,`Manual authentication URL retrieved:`,e))}else I(`info`,`Client not in a state requiring manual authentication trigger (state: ${e}). If needed, try disconnecting and reconnecting.`)},[I,_t,ht,ze,t,h,g,i,oe.name,oe.uri,oe.logo_uri,O,te,ne,r,ae,a]),yt=(0,z.useCallback)(()=>{Ge.current?.clearStorage?(I(`info`,`Cleared ${Ge.current.clearStorage()} item(s) from localStorage for ${t}.`),Be(void 0),mt()):I(`warn`,`Auth provider not initialized, cannot clear storage.`)},[t,I,mt]);(0,z.useEffect)(()=>{if(typeof window>`u`)return;let e=(e,t)=>{if($e.current){I(`debug`,`Ignoring auth callback via ${t}; manual popup flow owns this result.`);return}let n=Ge.current?.serverUrlHash;if(e?.serverUrlHash&&n&&e.serverUrlHash!==n){I(`debug`,`Ignoring auth callback via ${t} for a different server.`);return}if(I(`info`,`Received auth callback via ${t}.`,e),Ze.current&&clearTimeout(Ze.current),Ze.current=null,e?.success)I(`info`,`Authentication successful via popup. Reconnecting client...`),qe.current&&I(`debug`,`Connection attempt already in progress, resetting flag to allow reconnection.`),qe.current=!1,setTimeout(()=>{Je.current&&(I(`debug`,`Initiating reconnection after successful auth callback.`),rt.current?.())},100);else{if(et.current!==`authenticating`&&et.current!==`pending_auth`){I(`debug`,`Ignoring stale auth failure callback (state=${et.current}).`);return}it.current?.(`Authentication failed in callback: ${e?.error||`Unknown reason.`}`)}},t=t=>{t.origin===window.location.origin&&t.data?.type===fk&&e(t.data,`postMessage`)};window.addEventListener(`message`,t),I(`debug`,`Auth callback message listener added.`);let n=null,r=t=>{t.data?.type===fk&&e(t.data,`BroadcastChannel`)};if(typeof BroadcastChannel<`u`)try{n=new BroadcastChannel(dk),n.addEventListener(`message`,r),I(`debug`,`Auth callback BroadcastChannel listener added.`)}catch(e){I(`warn`,`Failed to open auth callback BroadcastChannel; lost-opener popups will not reach this client.`,e),n=null}return()=>{if(window.removeEventListener(`message`,t),I(`debug`,`Auth callback message listener removed.`),n){try{n.removeEventListener(`message`,r),n.close()}catch{}I(`debug`,`Auth callback BroadcastChannel listener removed.`)}Ze.current&&clearTimeout(Ze.current)}},[I]),(0,z.useEffect)(()=>{if(Je.current=!0,!n||!t)return I(`debug`,n?`No server URL provided, skipping connection.`:`Connection disabled via enabled flag.`),he(`discovering`),()=>{Je.current=!1};if(I(`debug`,`useMcp mounted, initiating connection.`),Ye.current=0,a)Ge.current=a,I(`debug`,`Using externally provided authProvider`);else if(!Ge.current||Ge.current.serverUrl!==fe){let{provider:e,oauthProxyUrl:t}=qA({effectiveOAuthUrl:fe,storageKeyPrefix:i,oauthClientConfig:oe,callbackUrl:r,preventAutoAuth:m,useRedirectFlow:h,gatewayUrl:ue,oauthProxyUrl:c,onPopupWindow:g,proxyOAuthRequests:!0,staticClientInfo:O,clientMetadataUrl:te,scope:ne});Ge.current=e,t&&I(`debug`,`OAuth proxy URL in effect: ${t}`),I(`debug`,`BrowserOAuthClientProvider initialized/updated with URL: ${fe}, proxy: ${t?`enabled`:`disabled`}, gateway: ${ue?`enabled`:`disabled`}`)}return gt(),()=>{Je.current=!1,I(`debug`,`useMcp unmounting, disconnecting.`),mt(!0)}},[t,n,i,r,oe.name,oe.version,oe.uri,oe.logo_uri,O,te,ne,h,ae,fe,s,a]);let bt=(0,z.useRef)(_t),xt=(0,z.useRef)(I);(0,z.useEffect)(()=>{bt.current=_t,xt.current=I},[_t,I]),(0,z.useEffect)(()=>{let e=null;if(me===`failed`&&d&&Ye.current>0){if(!Qe.current){Qe.current=!0;let t=typeof d==`number`?d:QA;xt.current(`info`,`Connection failed, auto-retrying in ${t}ms...`),e=setTimeout(()=>{Qe.current=!1,Je.current&&et.current===`failed`&&bt.current()},t)}}else me!==`failed`&&(Qe.current=!1);return()=>{e&&(clearTimeout(e),Qe.current=!1)}},[me,d]);let St=(0,z.useCallback)(async()=>et.current===`ready`?Ce?.icon?Ce.icon:Ke.current?(I(`debug`,`Waiting for icon to finish loading...`),await Ke.current):(I(`debug`,`No icon available and no loading in progress`),null):(I(`warn`,`Cannot ensure icon loaded - not connected`),null),[Ce,I]);return{state:me,name:Ce?.name||t||``,tools:ge,resources:ve,resourceTemplates:be,prompts:xe,serverInfo:Ce,capabilities:Te,protocolEra:De,protocolVersion:ke,instructions:je,extensions:Ne,error:Fe,log:Le,authUrl:ze,authTokens:Ve,client:Ue.current,...pt,retry:_t,disconnect:mt,authenticate:vt,clearStorage:yt,ensureIconLoaded:St}}var ej=null;function tj(){return typeof window<`u`&&window.name.startsWith(`mcp_auth_`)}function nj(e,t,n){return{type:fk,success:e,...e?{}:{error:t??`Unknown error`},...n.state?{state:n.state}:{},...n.serverUrlHash?{serverUrlHash:n.serverUrlHash}:{}}}function rj(e){if(typeof BroadcastChannel>`u`)return;let t;try{t=new BroadcastChannel(dk),t.postMessage(e)}catch(e){console.warn(`[mcp-callback] Failed to broadcast callback result:`,e)}finally{t&&setTimeout(()=>{try{t?.close()}catch{}},0)}}function ij(e,t,n,r){if(typeof document>`u`)return;document.body.innerHTML=``;let i=document.createElement(`div`);i.style.fontFamily=`sans-serif`,i.style.padding=`20px`;let a=document.createElement(`h1`);a.textContent=e,i.appendChild(a);let o=document.createElement(`p`);o.textContent=t,n&&(o.style.color=`red`,o.style.backgroundColor=`#ffebeb`,o.style.border=`1px solid red`,o.style.padding=`10px`,o.style.borderRadius=`4px`),i.appendChild(o);let s=document.createElement(`a`);if(s.href=`#`,s.textContent=`Close this window`,s.onclick=e=>(e.preventDefault(),window.close(),!1),i.appendChild(s),r){let e=document.createTextNode(` or `),t=document.createElement(`a`);t.href=r,t.textContent=`return to the app`,i.append(e,t)}document.body.appendChild(i)}function aj(e){let t=`mcp:auth:state_${e}`,n=localStorage.getItem(t)?t:null;if(!n){let t=`:state_${e}`;for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);if(r?.endsWith(t)){n=r;break}}}let r=n?localStorage.getItem(n):null;if(!n||!r)throw Error(`Invalid or expired OAuth state "${e}".`);let i;try{i=JSON.parse(r)}catch{throw localStorage.removeItem(n),Error(`Failed to parse stored OAuth state.`)}return{key:n,value:i}}function oj(e,t){let n=new URL(e);n.searchParams.set(`auth_error`,`oauth_callback_failed`),n.searchParams.set(`auth_error_description`,t),window.location.href=n.toString()}function sj(e,t,n,r){let i=nj(e,t,r),a=n?.returnUrl,o=n?.flowType===`popup`||tj();if(n?.flowType===`redirect`&&a){e?window.location.href=a:oj(a,t??`Authentication failed.`);return}if(window.opener&&!window.opener.closed){window.opener.postMessage(i,window.location.origin),window.close();return}if(o){rj(i),ij(e?`Authentication Successful!`:`Authentication Error`,e?`You're authenticated. You can close this window and return to the app.`:t??`Authentication failed.`,!e,a);try{window.close()}catch{}return}if(a){e?window.location.href=a:oj(a,t??`Authentication failed.`);return}if(!e){ij(`Authentication Error`,t??`Authentication failed.`,!0);return}window.location.href=`/`}function cj(){return ej||=lj(),ej}async function lj(){let e=new URLSearchParams(window.location.search),t=e.get(`state`),n=null,r=null,i=null;try{if(!t)throw Error(`OAuth callback is missing the state parameter.`);let a=aj(t);if(n=a.key,r=a.value,!r.expiry||r.expiry<Date.now())throw localStorage.removeItem(n),Error(`OAuth state has expired. Please start authentication again.`);if(!r.providerOptions)throw Error(`Stored OAuth state is missing provider options.`);let{serverUrl:o,...s}=r.providerOptions;i=new Bk(o,s),await new LC(new URL(o),{authProvider:i,fetch:i.getProxyFetch()}).finishAuth(e),localStorage.removeItem(n),sj(!0,void 0,r,{state:t,serverUrlHash:r.serverUrlHash})}catch(e){let a=e instanceof Error?e.message:String(e);console.error(`[mcp-callback] OAuth callback failed:`,e),n&&localStorage.removeItem(n),i&&localStorage.removeItem(i.getKey(`last_auth_url`)),sj(!1,a,r,{state:t,serverUrlHash:r?.serverUrlHash})}}ek();var uj=[`url`,`displayName`,`enabled`,`proxyConfig`,`oauthProxyUrl`,`connectionMode`,`autoProxyFallback`,`callbackUrl`,`storageKeyPrefix`,`headers`,`logLevel`,`autoRetry`,`autoReconnect`,`reconnectionOptions`,`popupFeatures`,`preventAutoAuth`,`useRedirectFlow`,`clientOptions`,`protocolNegotiation`,`timeout`,`clientInfo`,`oauth`];function dj(e){let t={};for(let n of uj){let r=e[n];r!==void 0&&(t[n]=r)}return t}function fj(e){return dj(e)}var pj=500,mj=5*6e4;function hj(e){let[t,n]=(0,z.useState)([]),[r,i]=(0,z.useState)([]),[a,o]=(0,z.useState)([]),s=(0,z.useRef)(0),c=(0,z.useRef)(0),l=(0,z.useRef)(new Map),u=(0,z.useRef)(new Map),d=(0,z.useCallback)(e=>{for(let t of l.current.values())clearTimeout(t.timeout),t.reject(Error(e));l.current.clear();for(let t of u.current.values())clearTimeout(t.timeout),t.reject(Error(e));u.current.clear(),i([]),o([])},[]);(0,z.useEffect)(()=>()=>d(`MCP server connection was removed`),[d]);let f=(0,z.useCallback)(t=>{let r={id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random()}`,method:t.method,params:t.params,timestamp:Date.now(),read:!1};n(e=>[r,...e].slice(0,pj)),e.onNotificationReceived?.(r)},[e.onNotificationReceived]),p=(0,z.useCallback)((e,t)=>{let n=l.current.get(e);n&&(clearTimeout(n.timeout),l.current.delete(e),i(t=>t.filter(t=>t.id!==e)),n.resolve(t))},[]),m=(0,z.useCallback)((e,t)=>{let n=l.current.get(e);n&&(clearTimeout(n.timeout),l.current.delete(e),i(t=>t.filter(t=>t.id!==e)),n.reject(Error(t??`User rejected sampling request`)))},[]),h=(0,z.useCallback)(t=>new Promise((n,r)=>{let a=`sampling-${s.current++}`,o={id:a,request:{method:`sampling/createMessage`,params:t},timestamp:Date.now(),serverName:e.serverName},c=setTimeout(()=>m(a,`Sampling request timed out`),mj);l.current.set(a,{resolve:n,reject:r,timeout:c}),i(e=>[...e,o]),e.onSamplingRequest?.(o),e.onGlobalSamplingRequest?.(o,e.serverId,e.serverName,p,m)}),[p,e,m]),g=(0,z.useCallback)((e,t)=>{let n=u.current.get(e);n&&(clearTimeout(n.timeout),u.current.delete(e),o(t=>t.filter(t=>t.id!==e)),n.resolve(t))},[]),_=(0,z.useCallback)((e,t)=>{let n=u.current.get(e);n&&(clearTimeout(n.timeout),u.current.delete(e),o(t=>t.filter(t=>t.id!==e)),n.reject(Error(t??`User rejected elicitation request`)))},[]),v=(0,z.useCallback)(t=>new Promise((n,r)=>{let i=`elicitation-${c.current++}`,a={id:i,request:t,timestamp:Date.now(),serverName:e.serverName},s=setTimeout(()=>_(i,`Elicitation request timed out`),mj);u.current.set(i,{resolve:n,reject:r,timeout:s}),o(e=>[...e,a]),e.onElicitationRequest?.(a),e.onGlobalElicitationRequest?.(a,e.serverId,e.serverName,g,_)}),[g,e,_]),y=(0,z.useCallback)(e=>{n(t=>t.map(t=>t.id===e?{...t,read:!0}:t))},[]),b=(0,z.useCallback)(()=>n(e=>e.map(e=>({...e,read:!0}))),[]),x=(0,z.useCallback)(()=>n([]),[]);return{notifications:t,pendingSamplingRequests:r,pendingElicitationRequests:a,unreadNotificationCount:t.filter(e=>!e.read).length,markNotificationRead:y,markAllNotificationsRead:b,clearNotifications:x,approveSampling:p,rejectSampling:m,approveElicitation:g,rejectElicitation:_,onNotification:f,onSampling:h,onElicitation:v,rejectAll:d}}var gj=$O.get(`McpClientProvider`),_j=(0,z.createContext)(null);function vj(e,t){return JSON.stringify(e)===JSON.stringify(t)}function yj(e,t){return e.id===t.id&&vj(dj(e),dj(t))&&e.name===t.name&&e.state===t.state&&e.error===t.error&&e.authUrl===t.authUrl&&vj(e.authTokens,t.authTokens)&&e.protocolEra===t.protocolEra&&e.protocolVersion===t.protocolVersion&&vj(e.serverInfo,t.serverInfo)&&vj(e.capabilities,t.capabilities)&&e.instructions===t.instructions&&vj(e.extensions,t.extensions)&&vj(e.tools,t.tools)&&vj(e.resources,t.resources)&&vj(e.resourceTemplates,t.resourceTemplates)&&vj(e.prompts,t.prompts)&&vj(e.notifications,t.notifications)&&e.unreadNotificationCount===t.unreadNotificationCount&&vj(e.pendingSamplingRequests,t.pendingSamplingRequests)&&vj(e.pendingElicitationRequests,t.pendingElicitationRequests)&&e.client===t.client}function bj({id:e,options:t,defaultCallbackUrl:n,defaultOAuthProxyUrl:r,defaultProxyConfig:i,defaultAutoProxyFallback:a,clientInfo:o,cachedMetadata:s,onUpdate:c,onUpdateConfig:l,onUpdateDisplayName:u,onReconnect:d,rpcWrapTransport:f,onGlobalSamplingRequest:p,onGlobalElicitationRequest:m}){let{displayName:h,onSamplingRequest:g,onElicitationRequest:_,onNotificationReceived:v,wrapTransport:y}=t,b=(0,z.useMemo)(()=>{let{displayName:c,onSamplingRequest:l,onElicitationRequest:u,onNotificationReceived:d,wrapTransport:f,...p}=t;return{...p,callbackUrl:p.callbackUrl||n,oauthProxyUrl:p.oauthProxyUrl||r,proxyConfig:p.proxyConfig||i,autoProxyFallback:p.autoProxyFallback===void 0?a:p.autoProxyFallback,clientInfo:p.clientInfo?o?{...o,...p.clientInfo}:p.clientInfo:o,_initialServerInfo:s,serverId:e}},[t,n,r,i,a,o,s]),x=(0,z.useMemo)(()=>{if(!(!f&&!y))return t=>{let n=t;return f&&(n=f(n,e)),y&&(n=y(n,e)),n}},[f,y,e]),S=hj({serverId:e,serverName:h||e,onNotificationReceived:v,onSamplingRequest:g,onElicitationRequest:_,onGlobalSamplingRequest:p,onGlobalElicitationRequest:m}),C=$A({...b,onNotification:S.onNotification,onSampling:S.onSampling,onElicitation:S.onElicitation,wrapTransport:x});(0,z.useEffect)(()=>{C.state!==`ready`&&S.rejectAll(`MCP server connection is no longer active`)},[C.state,S.rejectAll]);let w=(0,z.useCallback)(t=>l(e,t),[e,l]),T=(0,z.useCallback)(n=>{let r=t.proxyConfig?.proxyAddress?.trim();return t.connectionMode===`proxy`&&r?l(e,{proxyConfig:{...t.proxyConfig,proxyAddress:r,...n?{headers:n}:{}},headers:void 0}):l(e,{headers:n})},[e,t.connectionMode,t.proxyConfig,l]),ee=(0,z.useCallback)(t=>u(e,t),[e,u]),E=(0,z.useCallback)(()=>d(e),[e,d]),D=(0,z.useRef)(c),te=(0,z.useRef)(null);return(0,z.useEffect)(()=>{D.current=c},[c]),(0,z.useEffect)(()=>{let n={...fj(t),...C,id:e,displayName:h||t.displayName||e,notifications:S.notifications,unreadNotificationCount:S.unreadNotificationCount,markNotificationRead:S.markNotificationRead,markAllNotificationsRead:S.markAllNotificationsRead,clearNotifications:S.clearNotifications,pendingSamplingRequests:S.pendingSamplingRequests,approveSampling:S.approveSampling,rejectSampling:S.rejectSampling,pendingElicitationRequests:S.pendingElicitationRequests,approveElicitation:S.approveElicitation,rejectElicitation:S.rejectElicitation,updateConfig:w,setHeaders:T,setDisplayName:ee,reconnect:E},r=te.current;!r||!yj(r,n)?(te.current=n,D.current(n)):gj.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`)},[e,h,t,t.url,C.state,C.error,C.authUrl,C.tools,C.resources,C.resourceTemplates,C.prompts,C.serverInfo,C.capabilities,C.protocolEra,C.protocolVersion,C.instructions,C.extensions,C.authTokens,S,w,T,ee,E]),null}function xj({children:e,mcpServers:t,defaultCallbackUrl:n,defaultOAuthProxyUrl:r,defaultProxyConfig:i,defaultAutoProxyFallback:a=!1,defaultServerConfig:o,clientInfo:s,storageProvider:c,enableRpcLogging:l=!1,onServerAdded:u,onServerRemoved:d,onServerStateChange:f,onSamplingRequest:p,onElicitationRequest:m}){let[h,g]=(0,z.useState)([]),[_,v]=(0,z.useState)([]),[y,b]=(0,z.useState)({}),[x,S]=(0,z.useState)(!1),C=(0,z.useRef)(!1),w=(0,z.useRef)([]);(0,z.useEffect)(()=>{w.current=_},[_]);let T=(0,z.useRef)({}),[ee,E]=(0,z.useState)(void 0),[D,te]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!l||typeof window>`u`){E(void 0),te(!0);return}Promise.resolve().then(()=>(uk(),tk)).then(e=>{gj.debug(`[McpClientProvider] RPC logger loaded`),E(()=>e.wrapTransportForLogging),te(!0)}).catch(e=>{gj.error(`[McpClientProvider] Failed to load RPC logger:`,e),E(void 0),te(!0)})},[l]),(0,z.useEffect)(()=>{if(!D){gj.debug(`[McpClientProvider] Waiting for RPC logging to be ready before loading servers`);return}C.current||(C.current=!0,(async()=>{if(gj.debug(`[McpClientProvider] Loading servers, storageProvider:`,!!c,`mcpServers:`,t),!c){if(t){let e=Object.entries(t).map(([e,t])=>({id:e,options:t}));gj.debug(`[McpClientProvider] Loaded from mcpServers prop:`,e.length),g(e)}S(!0);return}try{let e=await Promise.resolve(c.getServers());if(gj.debug(`[McpClientProvider] Loaded from storage:`,Object.keys(e).length),c.getServerMetadata)try{let t=Object.keys(e).map(async e=>[e,await Promise.resolve(c.getServerMetadata(e))]),n=await Promise.all(t);T.current=Object.fromEntries(n.filter(e=>e[1]!==void 0)),gj.debug(`[McpClientProvider] Loaded cached metadata for`,Object.keys(T.current).length,`servers`)}catch(e){gj.warn(`[McpClientProvider] Failed to load cached metadata:`,e)}let n={...e,...t},r=Object.entries(n).map(([e,t])=>({id:e,options:t}));gj.debug(`[McpClientProvider] Total servers after merge:`,r.length),g(r),S(!0)}catch(e){gj.error(`[McpClientProvider] Failed to load from storage:`,e),t&&g(Object.entries(t).map(([e,t])=>({id:e,options:t}))),S(!0)}})())},[c,t,D]),(0,z.useEffect)(()=>{!c||!x||(async()=>{try{let e=h.reduce((e,t)=>(e[t.id]=fj(t.options),e),{});await Promise.resolve(c.setServers(e))}catch(e){gj.error(`[McpClientProvider] Failed to save to storage:`,e)}})()},[h,c,x]);let ne=(0,z.useCallback)(e=>{gj.debug(`[McpClientProvider] handleServerUpdate called for server ${e.id}`,{toolCount:e.tools.length,state:e.state});let t=[];v(n=>{let r=n.findIndex(t=>t.id===e.id);if(r===-1)return gj.debug(`[McpClientProvider] Adding new server ${e.id} to state`),t.push(()=>u?.(e.id,e)),[...n,e];let i=n[r],a=i.state!==e.state,o=i.serverInfo!==e.serverInfo;if(gj.debug(`[McpClientProvider] Comparing server ${e.id}:`,{toolsChanged:i.tools!==e.tools,currentToolCount:i.tools.length,updatedToolCount:e.tools.length,stateChanged:a}),yj(i,e))return gj.debug(`[McpClientProvider] No changes detected for server ${e.id}, skipping update`),n;if(gj.debug(`[McpClientProvider] Updating server ${e.id} in state`),a&&t.push(()=>f?.(e.id,e.state)),o&&e.serverInfo&&c?.setServerMetadata){let t={name:e.serverInfo.name,version:e.serverInfo.version,title:e.serverInfo.title,websiteUrl:e.serverInfo.websiteUrl,icons:e.serverInfo.icons,icon:e.serverInfo.icon};T.current[e.id]=t,Promise.resolve(c.setServerMetadata(e.id,t)).catch(e=>{gj.error(`[McpClientProvider] Failed to save server metadata:`,e)})}let s=[...n];return s[r]=e,s}),t.length>0&&queueMicrotask(()=>{t.forEach(e=>e())})},[u,f,c]),O=(0,z.useCallback)((e,t)=>{g(n=>n.find(t=>t.id===e)?n:(gj.debug(`[McpClientProvider] Adding new server to configs:`,e),[...n,{id:e,options:t}]))},[]),re=(0,z.useCallback)(async(e,t)=>{let n=w.current.find(t=>t.id===e);if(v(t=>t.filter(t=>t.id!==e)),g(t=>t.filter(t=>t.id!==e)),b(t=>{let{[e]:n,...r}=t;return r}),n?.disconnect&&await n.disconnect(),t?.clearCredentials&&n?.clearStorage&&await n.clearStorage(),l){let{clearRpcLogs:t}=await Promise.resolve().then(()=>(uk(),tk));t(e)}d?.(e)},[l,d]),k=(0,z.useCallback)(async(e,t)=>{let n=h.find(t=>t.id===e);if(!n){gj.warn(`[McpClientProvider] Cannot update server "${e}" - not found`);return}let r={...n.options,...t};vj(dj(n.options),dj(r))||(await w.current.find(t=>t.id===e)?.disconnect(),v(t=>t.filter(t=>t.id!==e)),g(t=>t.map(t=>t.id===e?{id:e,options:r}:t)),b(t=>({...t,[e]:(t[e]??0)+1})))},[h]),ie=(0,z.useCallback)(async e=>{if(!h.find(t=>t.id===e)){gj.warn(`[McpClientProvider] Cannot reconnect server "${e}" - not found`);return}await w.current.find(t=>t.id===e)?.disconnect(),v(t=>t.filter(t=>t.id!==e)),b(t=>({...t,[e]:(t[e]??0)+1}))},[h]),A=(0,z.useCallback)(async(e,t)=>new Promise(n=>{let r=h.find(t=>t.id===e);if(!r){gj.warn(`[McpClientProvider] Cannot update server metadata for "${e}" - not found`),n();return}let i={...r.options,displayName:t.name};v(n=>n.map(n=>n.id===e?{...n,displayName:t.name}:n)),g(t=>{let r=t.map(t=>t.id===e?{id:e,options:i}:t);return setTimeout(()=>n(),0),r})}),[h]),j=(0,z.useCallback)(e=>_.find(t=>t.id===e),[_]),M=(0,z.useMemo)(()=>({servers:_,addServer:O,removeServer:re,updateServerMetadata:A,updateServer:k,getServer:j,storageLoaded:x}),[_,O,re,A,k,j,x]),{capabilities:ae,...oe}=s||{},se=(0,z.useMemo)(()=>Object.keys(oe).length?oe:void 0,[s]),N=(0,z.useMemo)(()=>h.map(e=>{let t=o?{...o,...e.options}:e.options;return ae&&(t={...t,clientOptions:{...t.clientOptions,capabilities:{...ae,...t.clientOptions?.capabilities}}}),{id:e.id,options:t}}),[h,ae,o]),P=typeof window<`u`&&/\/oauth\/callback\/?$/.test(window.location.pathname);return z.createElement(_j.Provider,{value:M},e,!P&&N.map(e=>z.createElement(bj,{key:`${e.id}-v${y[e.id]??0}`,id:e.id,options:e.options,defaultCallbackUrl:n,defaultOAuthProxyUrl:r,defaultProxyConfig:i,defaultAutoProxyFallback:a,clientInfo:se,cachedMetadata:T.current[e.id],onUpdate:ne,onUpdateConfig:k,onUpdateDisplayName:(e,t)=>A(e,{name:t}),onReconnect:ie,rpcWrapTransport:ee,onGlobalSamplingRequest:p,onGlobalElicitationRequest:m})))}function Sj(){let e=(0,z.useContext)(_j);if(!e)throw Error(`useMcpClient must be used within a McpClientProvider`);return e}var Cj=class{constructor(e=`mcp-client-servers`){this.storageKey=e,this.metadataKey=`${e}-metadata`}metadataKey;getServers(){try{let e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error(`[LocalStorageProvider] Failed to load servers:`,e),{}}}setServers(e){try{localStorage.setItem(this.storageKey,JSON.stringify(e))}catch(e){console.error(`[LocalStorageProvider] Failed to save servers:`,e)}}setServer(e,t){let n=this.getServers();n[e]=t,this.setServers(n)}removeServer(e){let t=this.getServers();delete t[e],this.setServers(t),this.removeServerMetadata(e)}clear(){try{localStorage.removeItem(this.storageKey),localStorage.removeItem(this.metadataKey)}catch(e){console.error(`[LocalStorageProvider] Failed to clear:`,e)}}getAllMetadata(){try{let e=localStorage.getItem(this.metadataKey);return e?JSON.parse(e):{}}catch(e){return console.error(`[LocalStorageProvider] Failed to load metadata:`,e),{}}}setAllMetadata(e){try{localStorage.setItem(this.metadataKey,JSON.stringify(e))}catch(e){console.error(`[LocalStorageProvider] Failed to save metadata:`,e)}}getServerMetadata(e){return this.getAllMetadata()[e]}setServerMetadata(e,t){let n=this.getAllMetadata();n[e]={...t,cachedAt:Date.now()},this.setAllMetadata(n)}removeServerMetadata(e){let t=this.getAllMetadata();delete t[e],this.setAllMetadata(t)}};uk();function wj(e){let t={};if(!e)return t;for(let[n,r]of Object.entries(e))if(typeof r==`string`&&(r.trim().startsWith(`[`)||r.trim().startsWith(`{`)))try{t[n]=JSON.parse(r)}catch{t[n]=r}else t[n]=r;return t}function Tj(e){let{resourceResult:t,listingResource:n,cspMode:r,resourceUri:i}=e,a=(Array.isArray(t?.contents)?t.contents:[])[0],o=``,s;if(a&&(s=a.mimeType,typeof a.text==`string`?o=a.text:typeof a.blob==`string`&&(o=atob(a.blob))),!o)throw Error(`No HTML content in resource`);let c=n?._meta?.ui,l=a?._meta?.ui,u=c||l?{...c,...l}:void 0,d=u?.csp,f=u?.permissions,p=u?.prefersBorder??!1,m=s===BO,h=m?null:s?`Invalid MIME type "${s}" - SEP-1865 requires "${BO}"`:`Missing MIME type - SEP-1865 requires "${BO}"`;return h&&console.warn(`[ViewRenderer] MIME type validation:`,h,{resourceUri:i}),{html:o,declaredCsp:d,csp:r===`permissive`?void 0:d,permissions:f,prefersBorder:p,mimeType:s,mimeTypeValid:m,mimeTypeWarning:h}}function Ej(e,t){let{cspMode:n,permissions:r,widgetCsp:i}=t;e.searchParams.set(`v`,JSON.stringify({cspMode:n,permissions:r,widgetCsp:i})),e.searchParams.set(`csp_mode`,n),r&&Object.keys(r).length>0&&e.searchParams.set(`permissions`,JSON.stringify(r)),i&&Object.keys(i).length>0&&e.searchParams.set(`widget_csp`,JSON.stringify(i))}function Dj(e){let t=new URL(`https://sandbox.invalid/`);Ej(t,e);let n=kj(t.search);return new URL(URL.createObjectURL(new Blob([n],{type:`text/html`})))}var Oj=`<!doctype html>
197
- <html>
198
- <head>
199
- <meta charset="utf-8" />
200
- <meta
201
- http-equiv="Content-Security-Policy"
202
- content="default-src 'self'; img-src * data: blob: 'unsafe-inline'; media-src * blob: data:; font-src * blob: data:; script-src * 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data:; style-src * blob: data: 'unsafe-inline'; connect-src * data: blob: about:; frame-src * blob: data: http://localhost:* https://localhost:* http://127.0.0.1:* https://127.0.0.1:*;"
203
- />
204
- <title>MCP Apps Sandbox Proxy</title>
205
- <style>
206
- html, body { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; }
207
- * { box-sizing: border-box; }
208
- iframe { display: block; background-color: transparent; border: 0px none transparent; padding: 0px; width: 100%; height: 100%; }
209
- </style>
210
- </head>
211
- <body>
212
- <script>
213
- function sanitizeDomain(domain) {
214
- if (typeof domain !== "string") return "";
215
- return domain.replace(/['"<>;]/g, "").trim();
216
- }
217
-
218
- function buildAllowAttribute(permissions) {
219
- if (!permissions) return "";
220
- const allowList = [];
221
- if (permissions.camera) allowList.push("camera *");
222
- if (permissions.microphone) allowList.push("microphone *");
223
- if (permissions.geolocation) allowList.push("geolocation *");
224
- if (permissions.clipboardWrite) allowList.push("clipboard-write *");
225
- return allowList.join("; ");
226
- }
227
-
228
- function buildCSP(csp) {
229
- if (!csp) {
230
- return [
231
- "default-src 'none'",
232
- "script-src 'unsafe-inline'",
233
- "style-src 'unsafe-inline'",
234
- "img-src data:",
235
- "font-src data:",
236
- "media-src data:",
237
- "connect-src 'none'",
238
- "frame-src 'none'",
239
- "object-src 'none'",
240
- "base-uri 'none'",
241
- ].join("; ");
242
- }
243
-
244
- const connectDomains = (csp.connectDomains || []).map(sanitizeDomain).filter(Boolean);
245
- const resourceDomains = (csp.resourceDomains || []).map(sanitizeDomain).filter(Boolean);
246
- const frameDomains = (csp.frameDomains || []).map(sanitizeDomain).filter(Boolean);
247
- const baseUriDomains = (csp.baseUriDomains || []).map(sanitizeDomain).filter(Boolean);
248
- const scriptDirectives = (csp.scriptDirectives || []).filter(function(d) { return typeof d === "string" && d.length > 0; });
249
-
250
- const connectSrc = connectDomains.length > 0 ? connectDomains.join(" ") : "'none'";
251
- const resourceSrc = resourceDomains.length > 0 ? ["data:", "blob:", ...resourceDomains].join(" ") : "data: blob:";
252
- const frameSrc = frameDomains.length > 0 ? frameDomains.join(" ") : "'none'";
253
- const baseUri = baseUriDomains.length > 0 ? baseUriDomains.join(" ") : "'none'";
254
- const scriptSrcParts = ["'unsafe-inline'", resourceSrc];
255
- if (scriptDirectives.length > 0) scriptSrcParts.push(scriptDirectives.join(" "));
256
-
257
- return [
258
- "default-src 'none'",
259
- "script-src " + scriptSrcParts.join(" "),
260
- "style-src 'unsafe-inline' " + resourceSrc,
261
- "img-src " + resourceSrc,
262
- "font-src " + resourceSrc,
263
- "media-src " + resourceSrc,
264
- "connect-src " + connectSrc,
265
- "frame-src " + frameSrc,
266
- "object-src 'none'",
267
- "base-uri " + baseUri,
268
- ].join("; ");
269
- }
270
-
271
- function buildViolationListenerScript() {
272
- return \`<script>
273
- document.addEventListener('securitypolicyviolation', function(e) {
274
- var violation = {
275
- type: 'mcp-apps:csp-violation',
276
- directive: e.violatedDirective,
277
- blockedUri: e.blockedURI,
278
- sourceFile: e.sourceFile || null,
279
- lineNumber: e.lineNumber || null,
280
- columnNumber: e.columnNumber || null,
281
- effectiveDirective: e.effectiveDirective,
282
- originalPolicy: e.originalPolicy,
283
- disposition: e.disposition,
284
- timestamp: Date.now()
285
- };
286
- console.warn('[MCP Apps CSP Violation]', violation.directive, ':', violation.blockedUri);
287
- window.parent.postMessage(violation, '*');
288
- });
289
-
290
- function serializeConsoleArgs(args) {
291
- try {
292
- return Array.from(args || []).map(function(arg) {
293
- if (arg instanceof Error) {
294
- return {
295
- type: 'Error',
296
- message: arg.message,
297
- stack: arg.stack,
298
- name: arg.name,
299
- };
300
- }
301
- if (typeof arg === 'object' && arg !== null) {
302
- try {
303
- return JSON.parse(JSON.stringify(arg));
304
- } catch (e) {
305
- return String(arg);
306
- }
307
- }
308
- return arg;
309
- });
310
- } catch (e) {
311
- return [String(args)];
312
- }
313
- }
314
-
315
- function sendConsoleToParent(level, args) {
316
- try {
317
- window.parent.postMessage({
318
- type: 'iframe-console-log',
319
- level: level,
320
- args: serializeConsoleArgs(args),
321
- timestamp: new Date().toISOString(),
322
- url: window.location.href,
323
- }, '*');
324
- } catch (e) {}
325
- }
326
-
327
- var originalConsoleError = console.error.bind(console);
328
- console.error = function() {
329
- var args = Array.from(arguments);
330
- originalConsoleError.apply(console, args);
331
- sendConsoleToParent('error', args);
332
- };
333
-
334
- window.addEventListener('error', function(event) {
335
- sendConsoleToParent('error', [{
336
- message: event.message,
337
- filename: event.filename,
338
- lineno: event.lineno,
339
- colno: event.colno,
340
- error: event.error ? {
341
- message: event.error.message,
342
- stack: event.error.stack,
343
- name: event.error.name,
344
- } : null,
345
- }]);
346
- });
347
-
348
- window.addEventListener('unhandledrejection', function(event) {
349
- sendConsoleToParent('error', [{
350
- message: 'Unhandled Promise Rejection',
351
- reason: event.reason ? String(event.reason) : 'Unknown',
352
- error: event.reason instanceof Error ? {
353
- message: event.reason.message,
354
- stack: event.reason.stack,
355
- name: event.reason.name,
356
- } : null,
357
- }]);
358
- });
359
- </\` + \`script>\`;
360
- }
361
-
362
- function injectCSP(html, cspValue) {
363
- const cspMeta = '<meta http-equiv="Content-Security-Policy" content="' + cspValue + '">';
364
- const violationListener = buildViolationListenerScript();
365
- const injection = cspMeta + violationListener;
366
-
367
- if (html.includes("<head>")) {
368
- return html.replace("<head>", "<head>" + injection);
369
- } else if (html.includes("<HEAD>")) {
370
- return html.replace("<HEAD>", "<HEAD>" + injection);
371
- } else if (html.includes("<html>")) {
372
- return html.replace("<html>", "<html><head>" + injection + "</head>");
373
- } else if (html.includes("<HTML>")) {
374
- return html.replace("<HTML>", "<HTML><head>" + injection + "</head>");
375
- } else if (html.includes("<!DOCTYPE") || html.includes("<!doctype")) {
376
- return html.replace(/(<!DOCTYPE[^>]*>|<!doctype[^>]*>)/i, "$1<head>" + injection + "</head>");
377
- } else {
378
- return injection + html;
379
- }
380
- }
381
-
382
- // Query params from host (csp_mode, permissions, widget_csp). AppFrame only
383
- // sends { html, csp } in sandbox-resource-ready; we carry the rest on the URL.
384
- // Blob URLs cannot reliably carry search params, so the CDN shell injects
385
- // window.__SANDBOX_SEARCH__ via buildSandboxProxyBlobHtml.
386
- const query = new URLSearchParams(
387
- typeof window.__SANDBOX_SEARCH__ === "string"
388
- ? window.__SANDBOX_SEARCH__
389
- : location.search
390
- );
391
- const queryCspMode = query.get("csp_mode") || "permissive";
392
- let queryPermissions = null;
393
- let queryWidgetCsp = null;
394
- try {
395
- const rawPerm = query.get("permissions");
396
- if (rawPerm) queryPermissions = JSON.parse(rawPerm);
397
- } catch (e) {}
398
- try {
399
- const rawCsp = query.get("widget_csp");
400
- if (rawCsp) queryWidgetCsp = JSON.parse(rawCsp);
401
- } catch (e) {}
402
-
403
- const inner = document.createElement("iframe");
404
- inner.style = "width:100%; height:100%; border:none;";
405
- inner.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
406
- document.body.appendChild(inner);
407
-
408
- window.addEventListener("message", async (event) => {
409
- if (event.source === window.parent) {
410
- if (event.data && event.data.method === "ui/notifications/sandbox-resource-ready") {
411
- const params = event.data.params || {};
412
- const html = params.html;
413
- const sandbox = params.sandbox;
414
- // Prefer message csp when present; fall back to URL widget_csp
415
- const csp = params.csp != null ? params.csp : queryWidgetCsp;
416
- const permissions = params.permissions != null ? params.permissions : queryPermissions;
417
- const permissive =
418
- typeof params.permissive === "boolean"
419
- ? params.permissive
420
- : queryCspMode === "permissive";
421
- if (typeof sandbox === "string") {
422
- inner.setAttribute("sandbox", sandbox);
423
- }
424
- const allowAttribute = buildAllowAttribute(permissions);
425
- if (allowAttribute) {
426
- inner.setAttribute("allow", allowAttribute);
427
- }
428
- if (typeof html === "string") {
429
- if (permissive) {
430
- const permissiveCsp = [
431
- "default-src * 'unsafe-inline' 'unsafe-eval' data: blob: filesystem: about:",
432
- "script-src * 'unsafe-inline' 'unsafe-eval' data: blob:",
433
- "style-src * 'unsafe-inline' data: blob:",
434
- "img-src * data: blob: https: http:",
435
- "media-src * data: blob: https: http:",
436
- "font-src * data: blob: https: http:",
437
- "connect-src * data: blob: https: http: ws: wss: about:",
438
- "frame-src * data: blob: https: http: about:",
439
- "object-src * data: blob:",
440
- "base-uri *",
441
- "form-action *",
442
- ].join("; ");
443
- const processedHtml = injectCSP(html, permissiveCsp);
444
- inner.srcdoc = processedHtml;
445
- } else {
446
- const cspValue = buildCSP(csp);
447
- const processedHtml = injectCSP(html, cspValue);
448
- inner.srcdoc = processedHtml;
449
- }
450
- }
451
- } else {
452
- if (inner && inner.contentWindow) {
453
- inner.contentWindow.postMessage(event.data, "*");
454
- }
455
- }
456
- } else if (event.source === inner.contentWindow) {
457
- window.parent.postMessage(event.data, "*");
458
- }
459
- });
460
-
461
- window.parent.postMessage({
462
- jsonrpc: "2.0",
463
- method: "ui/notifications/sandbox-proxy-ready",
464
- params: {},
465
- }, "*");
466
- <\/script>
467
- </body>
468
- </html>`;function kj(e){let t=`<script>window.__SANDBOX_SEARCH__ = `+JSON.stringify(e).replace(/</g,`\\u003c`)+`;<\/script>`;return Oj.replace(`<body>`,`<body>`+t)}var Aj=`fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background`,jj=[`fixed top-4 left-1/2 -translate-x-1/2 z-[100]`,`rounded-3xl w-full min-w-[300px] h-[400px]`,`shadow-2xl border overflow-hidden`,`bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80`,`flex flex-col`].join(` `),Mj=`data-mcp-widget-fullscreen`,Nj=`data-mcp-widget-display-mode`;function Pj(e){(0,z.useEffect)(()=>{if(!(typeof document>`u`)){if(e===`pip`||e===`fullscreen`)return document.documentElement.setAttribute(Nj,e),e===`fullscreen`?document.documentElement.setAttribute(Mj,``):document.documentElement.removeAttribute(Mj),()=>{document.documentElement.removeAttribute(Nj),document.documentElement.removeAttribute(Mj)};document.documentElement.removeAttribute(Nj),document.documentElement.removeAttribute(Mj)}},[e])}function Fj({displayMode:e,setDisplayMode:t}){let n=e===`fullscreen`,r=e===`pip`;return Pj(e),{handleDisplayModeChange:(0,z.useCallback)(e=>t(e),[t]),fullscreenShellClassName:n?Aj:void 0,pipShellClassName:r?jj:void 0,isFullscreen:n,isPip:r}}var Ij={PIP_MAX_WIDTH:700,DEFAULT_HEIGHT:400};function Lj(e){let t=e?.ui;return t&&typeof t==`object`&&`resourceUri`in t&&typeof t.resourceUri==`string`?t.resourceUri:null}function Rj(e){return Lj(e)!==null}function zj(e){return e===BO}var Bj={name:`mcp-use-client`,version:`2.0.0`},Vj=6e5,Hj=`ui/notifications/sandbox-proxy-ready`,Uj={openLinks:{},serverTools:{},serverResources:{},logging:{},updateModelContext:{text:{}}};function Wj(e){return new Promise(t=>{let n=r=>{r.source===e.contentWindow&&r.data?.method===Hj&&(window.removeEventListener(`message`,n),t())};window.addEventListener(`message`,n)})}function Gj(e){let t=e.oninitialized;return new Promise(n=>{e.oninitialized=(...r)=>{n(),e.oninitialized=t,t?.(...r)}})}function Kj(e,t){let n=wj(t);return Object.keys(n).length>0?{...typeof e==`object`&&e?e:{},structuredContent:n}:e??null}function qj({viewId:e,source:t,sandboxUrl:n,toolName:r=`view`,toolInput:i,toolOutput:a,partialToolInput:o,customProps:s,cancelled:c,hostInfo:l=Bj,hostContext:u,hostCapabilities:d,cspMode:f=`widget-declared`,displayMode:p,onDisplayModeChange:m,inlineMaxWidth:h=768,chromeless:g,onMessage:_,onModelContextUpdate:v,onLog:y,onReady:b,onLifecycleChange:x,onError:S,onCspViolation:C,onResourceResolved:w,wrapTransport:T,toolCallTimeout:ee=Vj,className:E,testId:D=`mcp-app-frame`,invoking:te,invoked:ne}){let O=(0,z.useRef)(null),re=(0,z.useRef)(null),k=(0,z.useRef)(null),ie=(0,z.useRef)(t.kind===`live`?t.connection:null),[A,j]=(0,z.useState)(null),[M,ae]=(0,z.useState)(null),[oe,se]=(0,z.useState)(null),[N,P]=(0,z.useState)(0),[ce,le]=(0,z.useState)(!0),[ue,de]=(0,z.useState)(Ij.DEFAULT_HEIGHT),[fe,pe]=(0,z.useState)(`inline`),me=p??fe,he=(0,z.useRef)(u);he.current=u;let ge=(0,z.useRef)(_);ge.current=_;let _e=(0,z.useRef)(i);_e.current=i;let ve=(0,z.useRef)(a);ve.current=a;let ye=(0,z.useRef)(s);ye.current=s;let be=(0,z.useRef)(w);be.current=w;let F=(0,z.useRef)(v);F.current=v;let xe=(0,z.useRef)(y);xe.current=y;let Se=(0,z.useRef)(S);Se.current=S;let Ce=(0,z.useRef)(C);Ce.current=C;let we=(0,z.useRef)(b);we.current=b;let Te=(0,z.useRef)(x);Te.current=x;let Ee=(0,z.useRef)(n);Ee.current=n;let De=(0,z.useRef)(f);De.current=f;let Oe=(0,z.useCallback)(e=>{let t=Ee.current;return t?typeof t==`function`?t(e):t:Dj({cspMode:De.current,permissions:e.permissions,widgetCsp:e.declaredCsp})},[]),{handleDisplayModeChange:ke,fullscreenShellClassName:Ae,pipShellClassName:je,isFullscreen:Me,isPip:Ne}=Fj({containerRef:k,displayMode:me,setDisplayMode:(0,z.useCallback)(e=>{m?m(e):pe(e)},[m])}),Pe=(0,z.useRef)(ke);Pe.current=ke;let Fe=(0,z.useRef)(me);Fe.current=me;let Ie=t.kind===`live`?t.resourceUri:void 0,Le=t.kind===`preloaded`?t.html:void 0;t.kind===`live`&&(ie.current=t.connection),(0,z.useEffect)(()=>{let e=!1;Te.current?.({status:`resolving`});let n=e=>{j(e),Te.current?.({status:`sandbox-loading`});let t=Oe(e);ae(e=>e?.href===t.href?e:t),be.current?.(e)};if(t.kind===`preloaded`){n({html:t.html,declaredCsp:t.csp,csp:f===`permissive`?void 0:t.csp,permissions:t.permissions,prefersBorder:t.prefersBorder??!1,mimeType:`text/html;profile=mcp-app`,mimeTypeValid:!0,mimeTypeWarning:null});return}let{connection:r,resourceUri:i}=t;return ie.current=r,(async()=>{try{let t=await r.readResource(i);if(e)return;let a=r.resources?.find(e=>e.uri===i),o=Tj({resourceResult:t,listingResource:a,cspMode:f,resourceUri:i});if(!o.mimeTypeValid){let e=o.mimeTypeWarning||`Invalid MIME type - SEP-1865 requires "text/html;profile=mcp-app"`;se(e),Te.current?.({status:`error`,error:e});return}n(o)}catch(t){if(e)return;se(t instanceof Error?t.message:`Failed to prepare view`),Te.current?.({status:`error`,error:t instanceof Error?t.message:`Failed to prepare view`})}})(),()=>{e=!0}},[t.kind,Ie,Le,f,Oe]),(0,z.useEffect)(()=>{let e=M;return()=>{e?.protocol===`blob:`&&URL.revokeObjectURL(e.href)}},[M]);let Re=M?.protocol===`blob:`,ze=!M||Re?null:(()=>{try{return M.origin}catch{return null}})();(0,z.useEffect)(()=>{if(!ze&&!Re)return;let e=e=>{let t=O.current;if(t?.contentWindow&&e.source===t.contentWindow&&!(!Re&&e.origin!==ze&&ze!==`*`)){if(e.data?.type===`mcp-apps:csp-violation`){Ce.current?.({directive:e.data.directive,effectiveDirective:e.data.effectiveDirective,blockedUri:e.data.blockedUri,sourceFile:e.data.sourceFile,lineNumber:e.data.lineNumber,columnNumber:e.data.columnNumber,originalPolicy:e.data.originalPolicy,timestamp:e.data.timestamp||Date.now()});return}e.data?.type===`iframe-console-log`&&xe.current&&xe.current({level:e.data.level??`log`,data:e.data.args})}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[ze,Re]),(0,z.useEffect)(()=>{if(!A||!M)return;let t=O.current;if(!t)return;let n=!1,r=null;return(async()=>{try{Te.current?.({status:`connecting`}),t.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-forms`);let i=VO(A.permissions);i&&t.setAttribute(`allow`,i);let a=Wj(t);if(t.src=M.href,await a,n)return;r=new UO(null,l,{...d??Uj,sandbox:{csp:f===`permissive`?void 0:A.csp,permissions:A.permissions}},{hostContext:he.current}),r.onmessage=async({content:e})=>(e.length>0&&ge.current&&ge.current(e),{}),r.onopenlink=async({url:e})=>(e&&window.open(e,`_blank`,`noopener,noreferrer`),{}),r.oncalltool=(async({name:e,arguments:t})=>{let n=ie.current;if(!n)throw Error(`Server connection not available`);try{return await n.callTool(e,t||{},{timeout:ee,resetTimeoutOnProgress:!0})}catch(e){throw r?.sendToolCancelled({reason:e instanceof Error?e.message:String(e)}),e}}),r.onreadresource=(async({uri:e})=>{let t=ie.current;if(!t)throw Error(`Server connection not available`);return await t.readResource(e)}),r.onlistresources=(async()=>{let e=ie.current;if(!e)throw Error(`Server connection not available`);return{resources:[...e.resources??[]]}}),r.onrequestdisplaymode=async({mode:e})=>{let t=e??`inline`,n=(he.current?.availableDisplayModes??[`inline`,`pip`,`fullscreen`]).includes(t)?t:Fe.current;return await Pe.current(n),{mode:n}},r.onupdatemodelcontext=async({content:e,structuredContent:t})=>(F.current?.({content:e,structuredContent:t}),{}),r.onloggingmessage=async({level:e,data:t})=>(xe.current?.({level:e,data:t}),{}),r.onsizechange=async({height:e})=>{Fe.current===`inline`&&e!==void 0&&de(e)};let o=Gj(r),s=new zO(t.contentWindow,t.contentWindow);if(T&&(s=T(s,e)),await r.connect(s),n||(await r.sendSandboxResourceReady({html:A.html,csp:A.csp,permissions:A.permissions}),await o,n))return;re.current=r,P(e=>e+1),Te.current?.({status:`initialized`});let c={..._e.current,...wj(ye.current)};r.sendToolInput({arguments:c});let u=Kj(ve.current,ye.current);u&&r.sendToolResult(u),Te.current?.({status:`ready`})}catch(e){if(!n){let t=e instanceof Error?e.message:`Failed to connect view`;se(t),Se.current?.(t),Te.current?.({status:`error`,error:t})}}})(),()=>{n=!0;let e=r;re.current=null,e&&(Te.current?.({status:`tearing-down`}),(async()=>{try{await Promise.race([e.teardownResource({}),new Promise((e,t)=>setTimeout(()=>t(Error(`teardown timeout`)),2e3))])}catch{}finally{e.close().catch(()=>{}),Te.current?.({status:`closed`})}})())}},[A,M,l,d,f,e,T,ee]),(0,z.useEffect)(()=>{let e=re.current;!e||N===0||!u||e.setHostContext(u)},[u,N]),(0,z.useEffect)(()=>{let e=re.current;!e||N===0||!o||e.sendToolInputPartial({arguments:o})},[N,o]),(0,z.useEffect)(()=>{let e=re.current;if(!e||N===0)return;let t={...i,...wj(s)};e.sendToolInput({arguments:t})},[N,i,s]),(0,z.useEffect)(()=>{let e=re.current;if(!e||N===0)return;let t=Kj(a,s);t&&e.sendToolResult(t)},[N,a,s]),(0,z.useEffect)(()=>{let e=re.current;!e||N===0||!c||e.sendToolCancelled({reason:`Cancelled by user`})},[c,N]);let Be=(0,z.useRef)(!1);if((0,z.useEffect)(()=>{Be.current||N===0||(Be.current=!0,we.current?.())},[N]),(0,z.useEffect)(()=>{if(N===0||!ce)return;let e=setTimeout(()=>le(!1),300);return()=>clearTimeout(e)},[N,ce]),oe)return z.createElement(`div`,{className:E},z.createElement(`div`,{className:`border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4`},z.createElement(`p`,{className:`text-sm text-red-600 dark:text-red-400`},`Failed to load view: `,oe)));if(!A)return z.createElement(`div`,{className:E},z.createElement(`div`,{className:`flex items-center justify-center w-full h-[200px]`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading view…`)));let Ve=Ae??je??`flex group flex-1 items-center justify-center`,He={height:Me||Ne?`100%`:`${ue}px`,width:`100%`,maxWidth:me===`inline`?`${h}px`:`100%`,transition:Me||Ne?void 0:`height 300ms ease-out`},Ue=z.createElement(`div`,{ref:k,className:Ve,style:Ne?{height:Ij.DEFAULT_HEIGHT,maxWidth:Ij.PIP_MAX_WIDTH,zIndex:100}:Me?{zIndex:100}:void 0},(Me||Ne)&&z.createElement(`button`,{type:`button`,"data-testid":Me?`debugger-exit-fullscreen-button`:`debugger-exit-pip-button`,"aria-label":Me?`Exit fullscreen`:`Exit picture-in-picture`,className:`absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background`,style:{zIndex:110},onClick:()=>void ke(`inline`)},`×`),z.createElement(`div`,{className:Me||Ne?`relative w-full h-full min-h-0 flex flex-1 flex-col`:`relative w-full flex flex-1 justify-center items-center`},ce&&z.createElement(`div`,{className:`flex absolute inset-0 items-center justify-center z-10`},z.createElement(`span`,{className:`text-sm text-muted-foreground`},`Loading…`)),!Ne&&!Me&&(te||ne)&&z.createElement(`div`,{className:`absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground`},te&&!a?te:ne),z.createElement(`div`,{"data-testid":D,"data-mcp-app-tool":r,className:me===`fullscreen`?`w-full h-full overflow-hidden`:`w-full overflow-hidden`,style:He},z.createElement(`iframe`,{ref:O,title:`MCP App: ${r}`,className:`w-full h-full border-0 bg-transparent`,style:{border:A.prefersBorder&&me!==`fullscreen`?void 0:`none`}}))));return z.createElement(`div`,{className:E},Ue)}function Jj(e,t){return!(e.viewId!==t.viewId||e.source!==t.source||e.sandboxUrl!==t.sandboxUrl||e.displayMode!==t.displayMode||e.cancelled!==t.cancelled||e.toolInput!==t.toolInput||e.toolOutput!==t.toolOutput||e.partialToolInput!==t.partialToolInput||e.customProps!==t.customProps||e.hostContext!==t.hostContext||e.hostCapabilities!==t.hostCapabilities||e.cspMode!==t.cspMode||e.className!==t.className||e.onReady!==t.onReady||e.onLifecycleChange!==t.onLifecycleChange)}var Yj=(0,z.memo)(qj,Jj);function Xj(e){let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}finally{document.body.removeChild(t)}}function Zj(e){return Xj(e)}async function Qj(e){if(!Xj(e)){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);throw Error(`copy failed`)}}function $j(e){let t=Date.now()-e,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:a<7?`${a}d ago`:new Date(e).toLocaleDateString()}function eM(e){if(e==null)return`/mcp`;let t=e.trim().replace(/\/{2,}/g,`/`).replace(/\/+$/,``);return t===``||t===`/`?``:(t.startsWith(`/`)||(t=`/${t}`),t)}function tM(){if(typeof window>`u`)return``;let e=window.location.pathname||``,t=e.indexOf(`/inspector`);return t<=0?``:eM(e.slice(0,t))}function nM(){if(typeof window>`u`)return``;let e=window.__MCP_BASE_PATH__;return e==null?tM():eM(e)}function rM(){return`${nM()}/inspector`}function iM(e){let t=e.replace(/^\/+/,``);return`${rM()}/api/${t}`}var aM=/^127\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])){2}$/;function oM(e){try{let t=new URL(e).hostname.toLowerCase().replace(/^\[|\]$/g,``);return t===`localhost`||t===`::1`||t===`0.0.0.0`||aM.test(t)}catch{return!1}}function sM(e){try{return new URL(e).hostname.endsWith(`.mcp-use.run`)}catch{return!1}}function cM(e){let t=e.name?.trim(),n=e.url?.trim();return t?t===n?``:t:``}function lM(e){return cM(e)||e.serverInfo?.title?.trim()||e.serverInfo?.name?.trim()||e.name?.trim()||e.url?.trim()||`Unknown server`}function uM(){if(typeof window>`u`)return``;let e=window.__MCP_PROXY_URL__;return e===null?``:`${window.location.origin}${e||iM(`proxy`)}`}function dM(e,t,n=!1){return e===`auto`||e===`direct`||e===`proxy`?e:t===`Via Proxy`?`proxy`:t===`Direct`?`auto`:n?`proxy`:`auto`}function fM(e){return!e||typeof e==`boolean`?``:e.proxyAddress?.trim()||``}var pM=[`requestTimeout`,`resetTimeoutOnProgress`,`maxTotalTimeout`];function mM(e){if(!e)return{};let t={};for(let n of pM){let r=e[n];r!==void 0&&(t[n]=r)}return t}function hM(e,t){try{let n=localStorage.getItem(`mcp-inspector-connections`),r=n?JSON.parse(n):{};r[e]={...r[e],...t},localStorage.setItem(`mcp-inspector-connections`,JSON.stringify(r))}catch{}}function gM(e,t,n){let r=e.trim(),i=t.trim(),a=n.trim();if(!(!r&&!a))return{...r?{clientId:r}:{},...r&&i?{clientSecret:i}:{},...a?{scope:a}:{}}}function _M(e){let t=e.headers||e.proxyConfig?.headers||e.proxyConfig?.customHeaders;return t&&Object.keys(t).length>0?t:void 0}function vM(e){let t=e.proxyConfig,n=e.headers||e.customHeaders,r=t?.headers||t?.customHeaders||void 0,i=n||r,a=t?{...t,...r?{headers:r}:{},customHeaders:void 0}:void 0,{customHeaders:o,connectionType:s,transportType:c,...l}=e;return{...l,...i&&!a?.proxyAddress?{headers:i}:{},...a?{proxyConfig:a}:{},connectionMode:dM(e.connectionMode,e.connectionType,!!a?.proxyAddress)}}function yM(e){let t=SM(e),n=e.proxyConfig?.proxyAddress?.trim()||fM(e.autoProxyFallback),r=dM(e.connectionMode,e.connectionType,!!n),i={url:e.url,displayName:e.name?.trim()||e.url,connectionMode:r,...e.oauth?{oauth:e.oauth}:{}};return r===`proxy`&&n?i.proxyConfig={proxyAddress:n,...Object.keys(t).length>0?{headers:t}:{}}:Object.keys(t).length>0&&(i.headers=t),r===`auto`&&(i.autoProxyFallback=e.autoProxyFallback??(n?{enabled:!0,proxyAddress:n}:!1)),i}function bM(e,t){let n=t?vM(t):e,r=_M(e)||{},i=n.proxyConfig?.proxyAddress?.trim()||fM(n.autoProxyFallback);return{url:e.url||``,name:e.displayName||e.url||``,transportType:`http`,connectionMode:dM(n.connectionMode,void 0,!!i),connectionType:n.connectionMode===`proxy`?`Via Proxy`:`Direct`,proxyConfig:n.connectionMode===`proxy`&&i?{proxyAddress:i,...Object.keys(r).length>0?{headers:r}:{}}:void 0,headers:r,oauth:n.oauth,autoProxyFallback:n.autoProxyFallback,...mM(t)}}function xM(e){try{let t=localStorage.getItem(`mcp-inspector-connections`);return t&&JSON.parse(t)[e]||null}catch{return null}}function SM(e){let t=e.proxyConfig?.headers||e.proxyConfig?.customHeaders||e.headers||e.customHeaders||{};return Object.fromEntries(Object.entries(t).filter(([e,t])=>e&&t).map(([e,t])=>[e,String(t)]).sort(([e],[t])=>e.localeCompare(t)))}function CM(e){let t=e.url?.trim()||``,n=e.proxyConfig?.proxyAddress?.trim()||fM(e.autoProxyFallback);return{url:t,name:e.name?.trim()||t,transportType:e.transportType||`http`,proxyAddress:n,connectionMode:dM(e.connectionMode,e.connectionType,!!n),headers:SM(e),oauthClientId:e.oauth?.clientId?.trim()||``,oauthClientSecret:e.oauth?.clientSecret?.trim()||``,oauthScope:e.oauth?.scope?.trim()||``,requestTimeout:`requestTimeout`in e?e.requestTimeout:void 0,resetTimeoutOnProgress:`resetTimeoutOnProgress`in e?e.resetTimeoutOnProgress:void 0,maxTotalTimeout:`maxTotalTimeout`in e?e.maxTotalTimeout:void 0}}function wM(e,t){let n=CM(e),r=CM(t);return n.url===r.url&&n.transportType===r.transportType&&n.proxyAddress===r.proxyAddress&&n.connectionMode===r.connectionMode&&JSON.stringify(n.headers)===JSON.stringify(r.headers)&&n.oauthClientId===r.oauthClientId&&n.oauthClientSecret===r.oauthClientSecret&&n.oauthScope===r.oauthScope&&n.requestTimeout===r.requestTimeout&&n.resetTimeoutOnProgress===r.resetTimeoutOnProgress&&n.maxTotalTimeout===r.maxTotalTimeout&&n.name!==r.name}var TM=class extends Cj{setServers(e){let t=this.readRawStoredServers(),n=Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{...mM(t[e]),...n,...oM(e)&&typeof n.url==`string`&&sM(n.url)?{url:e}:{}}]));super.setServers(n)}setServer(e,t){let n=this.getServers();n[e]={...mM(this.readRawStoredServers()[e]),...t},this.setServers(n)}readRawStoredServers(){try{let e=localStorage.getItem(`mcp-inspector-connections`);return e?JSON.parse(e):{}}catch{return{}}}},EM=`popstate`;function DM(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function OM(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return NM(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:PM(t)}return IM(t,n,null,e)}function kM(e,t){if(e===!1||e==null)throw Error(t)}function AM(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function jM(){return Math.random().toString(36).substring(2,10)}function MM(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function NM(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?FM(t):t,state:n,key:t&&t.key||r||jM(),mask:i}}function PM({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function FM(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function IM(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=DM(e)?e:NM(h.location,e,t);n&&n(r,e),l=u()+1;let d=MM(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=DM(e)?e:NM(h.location,e,t);n&&n(r,e),l=u();let i=MM(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return LM(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(EM,d),c=e,()=>{i.removeEventListener(EM,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function LM(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),kM(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:PM(t);return i=i.replace(/ $/,`%20`),!n&&i.startsWith(`//`)&&(i=r+i),new URL(i,r)}function RM(e,t,n=`/`){return zM(e,t,n,!1)}function zM(e,t,n,r,i){let a=iN((typeof t==`string`?FM(t):t).pathname||`/`,n);if(a==null)return null;let o=i??VM(e),s=null,c=rN(a);for(let e=0;s==null&&e<o.length;++e)s=eN(o[e],c,r);return s}function BM(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function VM(e){let t=HM(e);return WM(t),t}function HM(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;kM(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=pN([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(kM(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),HM(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:QM(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of UM(e.path))a(e,t,!0,n)}),t}function UM(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=UM(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function WM(e){e.sort((e,t)=>e.score===t.score?$M(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var GM=/^:[\w-]+$/,KM=3,qM=2,JM=1,YM=10,XM=-2,ZM=e=>e===`*`;function QM(e,t){let n=e.split(`/`),r=n.length;return n.some(ZM)&&(r+=XM),t&&(r+=qM),n.filter(e=>!ZM(e)).reduce((e,t)=>e+(GM.test(t)?KM:t===``?JM:YM),r)}function $M(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function eN(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=tN({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=tN({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:pN([a,u.pathname]),pathnameBase:hN(pN([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=pN([a,u.pathnameBase]))}return o}function tN(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=nN(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function nN(e,t=!1,n=!0){AM(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function rN(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return AM(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function iN(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var aN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function oN(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?FM(e):e,a;return n?(n=fN(n),a=n.startsWith(`/`)?sN(n.substring(1),`/`):sN(n,t)):a=t,{pathname:a,search:gN(r),hash:_N(i)}}function sN(e,t){let n=mN(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function cN(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function lN(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function uN(e){let t=lN(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function dN(e,t,n,r=!1){let i;typeof e==`string`?i=FM(e):(i={...e},kM(!i.pathname||!i.pathname.includes(`?`),cN(`?`,`pathname`,`search`,i)),kM(!i.pathname||!i.pathname.includes(`#`),cN(`#`,`pathname`,`hash`,i)),kM(!i.search||!i.search.includes(`#`),cN(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=oN(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var fN=e=>e.replace(/\/\/+/g,`/`),pN=e=>fN(e.join(`/`)),mN=e=>e.replace(/\/+$/,``),hN=e=>mN(e).replace(/^\/*/,`/`),gN=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,_N=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,vN=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function yN(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function bN(e){return pN(e.map(e=>e.route.path).filter(Boolean))||`/`}var xN=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function SN(e,t){let n=e;if(typeof n!=`string`||!aN.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(xN)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=iN(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{AM(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var CN=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(CN);var wN=[`GET`,...CN];new Set(wN);var TN=z.createContext(null);TN.displayName=`DataRouter`;var EN=z.createContext(null);EN.displayName=`DataRouterState`;var DN=z.createContext(!1);function ON(){return z.useContext(DN)}var kN=z.createContext({isTransitioning:!1});kN.displayName=`ViewTransition`;var AN=z.createContext(new Map);AN.displayName=`Fetchers`;var jN=z.createContext(null);jN.displayName=`Await`;var MN=z.createContext(null);MN.displayName=`Navigation`;var NN=z.createContext(null);NN.displayName=`Location`;var PN=z.createContext({outlet:null,matches:[],isDataRoute:!1});PN.displayName=`Route`;var FN=z.createContext(null);FN.displayName=`RouteError`;var IN=`REACT_ROUTER_ERROR`,LN=`REDIRECT`,RN=`ROUTE_ERROR_RESPONSE`;function zN(e){if(e.startsWith(`${IN}:${LN}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function BN(e){if(e.startsWith(`${IN}:${RN}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new vN(t.status,t.statusText,t.data)}catch{}}function VN(e,{relative:t}={}){kM(HN(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=z.useContext(MN),{hash:i,pathname:a,search:o}=YN(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:pN([n,a])),r.createHref({pathname:s,search:o,hash:i})}function HN(){return z.useContext(NN)!=null}function UN(){return kM(HN(),`useLocation() may be used only in the context of a <Router> component.`),z.useContext(NN).location}var WN=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function GN(e){z.useContext(MN).static||z.useLayoutEffect(e)}function KN(){let{isDataRoute:e}=z.useContext(PN);return e?mP():qN()}function qN(){kM(HN(),`useNavigate() may be used only in the context of a <Router> component.`);let e=z.useContext(TN),{basename:t,navigator:n}=z.useContext(MN),{matches:r}=z.useContext(PN),{pathname:i}=UN(),a=JSON.stringify(uN(r)),o=z.useRef(!1);return GN(()=>{o.current=!0}),z.useCallback((r,s={})=>{if(AM(o.current,WN),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=dN(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:pN([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}z.createContext(null);function JN(){let{matches:e}=z.useContext(PN);return e[e.length-1]?.params??{}}function YN(e,{relative:t}={}){let{matches:n}=z.useContext(PN),{pathname:r}=UN(),i=JSON.stringify(uN(n));return z.useMemo(()=>dN(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function XN(e,t){return ZN(e,t)}function ZN(e,t,n){kM(HN(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=z.useContext(MN),{matches:i}=z.useContext(PN),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;gP(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
469
-
470
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=UN(),d;if(t){let e=typeof t==`string`?FM(t):t;kM(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):RM(e,{pathname:p});AM(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),AM(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=iP(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:pN([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:pN([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?z.createElement(NN.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function QN(){let e=pP(),t=yN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=z.createElement(z.Fragment,null,z.createElement(`p`,null,`💿 Hey developer 👋`),z.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,z.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,z.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),z.createElement(z.Fragment,null,z.createElement(`h2`,null,`Unexpected Application Error!`),z.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?z.createElement(`pre`,{style:i},n):null,o)}var $N=z.createElement(QN,null),eP=class extends z.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=BN(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:z.createElement(PN.Provider,{value:this.props.routeContext},z.createElement(FN.Provider,{value:e,children:this.props.component}));return this.context?z.createElement(nP,{error:e},t):t}};eP.contextType=DN;var tP=new WeakMap;function nP({children:e,error:t}){let{basename:n}=z.useContext(MN);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=zN(t.digest);if(e){let r=tP.get(t);if(r)throw r;let i=SN(e.location,n);if(xN&&!tP.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw tP.set(t,n),n}return z.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function rP({routeContext:e,match:t,children:n}){let r=z.useContext(TN);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),z.createElement(PN.Provider,{value:e},n)}function iP(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);kM(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:bN(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||$N,o&&(s<0&&c===0?(gP(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?z.createElement(n.route.Component,null):n.route.element?n.route.element:e,z.createElement(rP,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?z.createElement(eP,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function aP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oP(e){let t=z.useContext(TN);return kM(t,aP(e)),t}function sP(e){let t=z.useContext(EN);return kM(t,aP(e)),t}function cP(e){let t=z.useContext(PN);return kM(t,aP(e)),t}function lP(e){let t=cP(e),n=t.matches[t.matches.length-1];return kM(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uP(){return lP(`useRouteId`)}function dP(){let e=sP(`useNavigation`);return z.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function fP(){let{matches:e,loaderData:t}=sP(`useMatches`);return z.useMemo(()=>e.map(e=>BM(e,t)),[e,t])}function pP(){let e=z.useContext(FN),t=sP(`useRouteError`),n=lP(`useRouteError`);return e===void 0?t.errors?.[n]:e}function mP(){let{router:e}=oP(`useNavigate`),t=lP(`useNavigate`),n=z.useRef(!1);return GN(()=>{n.current=!0}),z.useCallback(async(r,i={})=>{AM(n.current,WN),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var hP={};function gP(e,t,n){!t&&!hP[e]&&(hP[e]=!0,AM(!1,n))}z.memo(_P);function _P({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return ZN(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function vP(e){kM(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function yP({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){kM(!HN(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=z.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=FM(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=z.useMemo(()=>{let e=iN(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return AM(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:z.createElement(MN.Provider,{value:c},z.createElement(NN.Provider,{children:t,value:h}))}function bP({children:e,location:t}){return XN(xP(e),t)}z.Component;function xP(e,t=[]){let n=[];return z.Children.forEach(e,(e,r)=>{if(!z.isValidElement(e))return;let i=[...t,r];if(e.type===z.Fragment){n.push.apply(n,xP(e.props.children,i));return}kM(e.type===vP,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),kM(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=xP(e.props.children,i)),n.push(a)}),n}var SP=`get`,CP=`application/x-www-form-urlencoded`;function wP(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function TP(e){return wP(e)&&e.tagName.toLowerCase()===`button`}function EP(e){return wP(e)&&e.tagName.toLowerCase()===`form`}function DP(e){return wP(e)&&e.tagName.toLowerCase()===`input`}function OP(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kP(e,t){return e.button===0&&(!t||t===`_self`)&&!OP(e)}function AP(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function jP(e,t){let n=AP(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var MP=null;function NP(){if(MP===null)try{new FormData(document.createElement(`form`),0),MP=!1}catch{MP=!0}return MP}var PP=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function FP(e){return e!=null&&!PP.has(e)?(AM(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${CP}"`),null):e}function IP(e,t){let n,r,i,a,o;if(EP(e)){let o=e.getAttribute(`action`);r=o?iN(o,t):null,n=e.getAttribute(`method`)||SP,i=FP(e.getAttribute(`enctype`))||CP,a=new FormData(e)}else if(TP(e)||DP(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?iN(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||SP,i=FP(e.getAttribute(`formenctype`))||FP(o.getAttribute(`enctype`))||CP,a=new FormData(o,e),!NP()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(wP(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=SP,r=null,i=CP,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var LP={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},RP=/[&><\u2028\u2029]/g;function zP(e){return e.replace(RP,e=>LP[e])}function BP(e,t){if(e===!1||e==null)throw Error(t)}function VP(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&iN(i.pathname,t)===`/`?i.pathname=`${mN(t)}/_root.${r}`:i.pathname=`${mN(i.pathname)}.${r}`,i}async function HP(e,t){if(e.id in t)return t[e.id];try{let n=await tS(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function UP(e){return e!=null&&typeof e.page==`string`}function WP(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function GP(e,t,n){return XP((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await HP(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(WP).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function KP(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function qP(e,t,{includeHydrateFallback:n}={}){return JP(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function JP(e){return[...new Set(e)]}function YP(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function XP(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!UP(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(YP(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ZP(){let e=z.useContext(TN);return BP(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function QP(){let e=z.useContext(EN);return BP(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var $P=z.createContext(void 0);$P.displayName=`FrameworkContext`;function eF(){let e=z.useContext($P);return BP(e,`You must render this element inside a <HydratedRouter> element`),e}function tF(e,t){let n=z.useContext($P),[r,i]=z.useState(!1),[a,o]=z.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=z.useRef(null);z.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),z.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:nF(s,p),onBlur:nF(c,m),onMouseEnter:nF(l,p),onMouseLeave:nF(u,m),onTouchStart:nF(d,p)}]:[a,f,{}]:[!1,f,{}]}function nF(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function rF({page:e,...t}){let n=ON(),{router:r}=ZP(),i=z.useMemo(()=>RM(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?z.createElement(aF,{page:e,matches:i,...t}):z.createElement(oF,{page:e,matches:i,...t}):null}function iF(e){let{manifest:t,routeModules:n}=eF(),[r,i]=z.useState([]);return z.useEffect(()=>{let r=!1;return GP(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function aF({page:e,matches:t,...n}){let r=UN(),{future:i}=eF(),{basename:a}=ZP(),o=z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=VP(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return z.createElement(z.Fragment,null,o.map(e=>z.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function oF({page:e,matches:t,...n}){let r=UN(),{future:i,manifest:a,routeModules:o}=eF(),{basename:s}=ZP(),{loaderData:c,matches:l}=QP(),u=z.useMemo(()=>KP(e,t,l,a,r,`data`),[e,t,l,a,r]),d=z.useMemo(()=>KP(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=z.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=VP(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=z.useMemo(()=>qP(d,a),[d,a]),m=iF(d);return z.createElement(z.Fragment,null,f.map(e=>z.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>z.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>z.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function sF(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}z.Component;var cF=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{cF&&(window.__reactRouterVersion=`7.16.0`)}catch{}function lF({basename:e,children:t,useTransitions:n,window:r}){let i=z.useRef();i.current??=OM({window:r,v5Compat:!0});let a=i.current,[o,s]=z.useState({action:a.action,location:a.location}),c=z.useCallback(e=>{n===!1?s(e):z.startTransition(()=>s(e))},[n]);return z.useLayoutEffect(()=>a.listen(c),[a,c]),z.createElement(yP,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function uF({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=z.useState({action:n.action,location:n.location}),o=z.useCallback(e=>{r===!1?a(e):z.startTransition(()=>a(e))},[r]);return z.useLayoutEffect(()=>n.listen(o),[n,o]),z.createElement(yP,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}uF.displayName=`unstable_HistoryRouter`;var dF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fF=z.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=z.useContext(MN),v=typeof l==`string`&&dF.test(l),y=SN(l,h);l=y.to;let b=VN(l,{relative:r}),x=UN(),S=null;if(o){let e=dN(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:pN([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=tF(n,p),ee=yF(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function E(t){e&&e(t),t.defaultPrevented||ee(t)}let D=!(y.isExternal||i),te=z.createElement(`a`,{...p,...T,href:(D?S:void 0)||y.absoluteURL||b,onClick:D?E:e,ref:sF(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?z.createElement(z.Fragment,null,te,z.createElement(rF,{page:b})):te});fF.displayName=`Link`;var pF=z.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=YN(a,{relative:c.relative}),d=UN(),f=z.useContext(EN),{navigator:p,basename:m}=z.useContext(MN),h=f!=null&&AF(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=iN(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return z.createElement(fF,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});pF.displayName=`NavLink`;var mF=z.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=SP,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=z.useContext(MN),g=CF(),_=wF(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&dF.test(s);return z.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?z.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});mF.displayName=`Form`;function hF({getKey:e,storageKey:t,...n}){let r=z.useContext($P),{basename:i}=z.useContext(MN),a=UN(),o=fP();OF({getKey:e,storageKey:t});let s=z.useMemo(()=>{if(!r||!e)return null;let t=DF(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return z.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${zP(JSON.stringify(t||TF))}, ${zP(JSON.stringify(s))})`}})}hF.displayName=`ScrollRestoration`;function gF(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _F(e){let t=z.useContext(TN);return kM(t,gF(e)),t}function vF(e){let t=z.useContext(EN);return kM(t,gF(e)),t}function yF(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=KN(),d=UN(),f=YN(e,{relative:o});return z.useCallback(p=>{if(kP(p,t)){p.preventDefault();let t=n===void 0?PM(d)===PM(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?z.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function bF(e){AM(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=z.useRef(AP(e)),n=z.useRef(!1),r=UN(),i=z.useMemo(()=>jP(r.search,n.current?null:t.current),[r.search]),a=KN();return[i,z.useCallback((e,t)=>{let r=AP(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var xF=0,SF=()=>`__${String(++xF)}__`;function CF(){let{router:e}=_F(`useSubmit`),{basename:t}=z.useContext(MN),n=uP(),r=e.fetch,i=e.navigate;return z.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=IP(e,t);a.navigate===!1?await r(a.fetcherKey||SF(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function wF(e,{relative:t}={}){let{basename:n}=z.useContext(MN),r=z.useContext(PN);kM(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...YN(e||`.`,{relative:t})},o=UN();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:pN([n,a.pathname])),PM(a)}var TF=`react-router-scroll-positions`,EF={};function DF(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:iN(e.pathname,n)||e.pathname},t)),i??=e.key,i}function OF({getKey:e,storageKey:t}={}){let{router:n}=_F(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=vF(`useScrollRestoration`),{basename:a}=z.useContext(MN),o=UN(),s=fP(),c=dP();z.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),kF(z.useCallback(()=>{if(c.state===`idle`){let t=DF(o,s,a,e);EF[t]=window.scrollY}try{sessionStorage.setItem(t||TF,JSON.stringify(EF))}catch(e){AM(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(z.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||TF);e&&(EF=JSON.parse(e))}catch{}},[t]),z.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(EF,()=>window.scrollY,e?(t,n)=>DF(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),z.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{AM(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function kF(e,t){let{capture:n}=t||{};z.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function AF(e,{relative:t}={}){let n=z.useContext(kN);kM(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=_F(`useViewTransitionState`),i=YN(e,{relative:t});if(!n.isTransitioning)return!1;let a=iN(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=iN(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tN(i.pathname,o)!=null||tN(i.pathname,a)!=null}function jF(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var MF=e=>{switch(e){case`success`:return FF;case`info`:return LF;case`warning`:return IF;case`error`:return RF;default:return null}},NF=Array(12).fill(0),PF=({visible:e,className:t})=>z.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},z.createElement(`div`,{className:`sonner-spinner`},NF.map((e,t)=>z.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),FF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),IF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},z.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),LF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),RF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},z.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),zF=z.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},z.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),z.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),BF=()=>{let[e,t]=z.useState(document.hidden);return z.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},VF=1,HF=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:VF++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],z.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(WF(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!z.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||VF++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},UF=(e,t)=>{let n=t?.id||VF++;return HF.addToast({title:e,...t,id:n}),n},WF=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,GF=Object.assign(UF,{success:HF.success,info:HF.info,warning:HF.warning,error:HF.error,custom:HF.custom,message:HF.message,promise:HF.promise,dismiss:HF.dismiss,loading:HF.loading},{getHistory:()=>HF.toasts,getToasts:()=>HF.getActiveToasts()});jF(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function KF(e){return e.label!==void 0}var qF=3,JF=`24px`,YF=`16px`,XF=4e3,ZF=356,QF=14,$F=45,eI=200;function tI(...e){return e.filter(Boolean).join(` `)}function nI(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var rI=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[ee,E]=z.useState(null),[D,te]=z.useState(null),[ne,O]=z.useState(!1),[re,k]=z.useState(!1),[ie,A]=z.useState(!1),[j,M]=z.useState(!1),[ae,oe]=z.useState(!1),[se,N]=z.useState(0),[P,ce]=z.useState(0),le=z.useRef(n.duration||y||XF),ue=z.useRef(null),de=z.useRef(null),fe=c===0,pe=c+1<=o,me=n.type,he=n.dismissible!==!1,ge=n.className||``,_e=n.descriptionClassName||``,ve=z.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ye=z.useMemo(()=>n.closeButton??p,[n.closeButton,p]),be=z.useMemo(()=>n.duration||y||XF,[n.duration,y]),F=z.useRef(0),xe=z.useRef(0),Se=z.useRef(0),Ce=z.useRef(null),[we,Te]=b.split(`-`),Ee=z.useMemo(()=>s.reduce((e,t,n)=>n>=ve?e:e+t.height,0),[s,ve]),De=BF(),Oe=n.invert||t,ke=me===`loading`;xe.current=z.useMemo(()=>ve*x+Ee,[ve,Ee]),z.useEffect(()=>{le.current=be},[be]),z.useEffect(()=>{O(!0)},[]),z.useEffect(()=>{let e=de.current;if(e){let t=e.getBoundingClientRect().height;return ce(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),z.useLayoutEffect(()=>{if(!ne)return;let e=de.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ce(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[ne,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ae=z.useCallback(()=>{k(!0),N(xe.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},eI)},[n,d,a,xe]);z.useEffect(()=>{if(n.promise&&me===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||De?(()=>{if(Se.current<F.current){let e=new Date().getTime()-F.current;le.current-=e}Se.current=new Date().getTime()})():le.current!==1/0&&(F.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ae()},le.current)),()=>clearTimeout(e)},[u,i,n,me,De,Ae]),z.useEffect(()=>{n.delete&&(Ae(),n.onDismiss==null||n.onDismiss.call(n,n))},[Ae,n.delete]);function je(){return w?.loading?z.createElement(`div`,{className:tI(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},w.loading):z.createElement(PF,{className:tI(C?.loader,n?.classNames?.loader),visible:me===`loading`})}let Me=n.icon||w?.[me]||MF(me);return z.createElement(`li`,{tabIndex:0,ref:de,className:tI(_,ge,C?.toast,n?.classNames?.toast,C?.default,C?.[me],n?.classNames?.[me]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":ne,"data-promise":!!n.promise,"data-swiped":ae,"data-removed":re,"data-visible":pe,"data-y-position":we,"data-x-position":Te,"data-index":c,"data-front":fe,"data-swiping":ie,"data-dismissible":he,"data-type":me,"data-invert":Oe,"data-swipe-out":j,"data-swipe-direction":D,"data-expanded":!!(u||S&&ne),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${re?se:xe.current}px`,"--initial-height":S?`auto`:`${P}px`,...m,...n.style},onDragEnd:()=>{A(!1),E(null),Ce.current=null},onPointerDown:e=>{e.button!==2&&(ke||!he||(ue.current=new Date,N(xe.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(A(!0),Ce.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(j||!he)return;Ce.current=null;let e=Number(de.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(de.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ue.current?.getTime(),i=ee===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=$F||a>.11){N(xe.current),n.onDismiss==null||n.onDismiss.call(n,n),te(ee===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ae(),M(!0);return}else{var o,s;(o=de.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=de.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}oe(!1),A(!1),E(null)},onPointerMove:t=>{var n,r;if(!Ce.current||!he||window.getSelection()?.toString().length>0)return;let i=t.clientY-Ce.current.y,a=t.clientX-Ce.current.x,o=e.swipeDirections??nI(b);!ee&&(Math.abs(a)>1||Math.abs(i)>1)&&E(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(ee===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(ee===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&oe(!0),(n=de.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=de.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},ye&&!n.jsx&&me!==`loading`?z.createElement(`button`,{"aria-label":T,"data-disabled":ke,"data-close-button":!0,onClick:ke||!he?()=>{}:()=>{Ae(),n.onDismiss==null||n.onDismiss.call(n,n)},className:tI(C?.closeButton,n?.classNames?.closeButton)},w?.close??zF):null,(me||n.icon||n.promise)&&n.icon!==null&&(w?.[me]!==null||n.icon)?z.createElement(`div`,{"data-icon":``,className:tI(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||je():null,n.type===`loading`?null:Me):null,z.createElement(`div`,{"data-content":``,className:tI(C?.content,n?.classNames?.content)},z.createElement(`div`,{"data-title":``,className:tI(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?z.createElement(`div`,{"data-description":``,className:tI(v,_e,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),z.isValidElement(n.cancel)?n.cancel:n.cancel&&KF(n.cancel)?z.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{KF(n.cancel)&&he&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ae())},className:tI(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,z.isValidElement(n.action)?n.action:n.action&&KF(n.action)?z.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{KF(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ae())},className:tI(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function iI(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function aI(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?YF:JF;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var oI=z.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=qF,toastOptions:g,dir:_=iI(),gap:v=QF,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=z.useState([]),C=z.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=z.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,ee]=z.useState([]),[E,D]=z.useState(!1),[te,ne]=z.useState(!1),[O,re]=z.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),k=z.useRef(null),ie=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),A=z.useRef(null),j=z.useRef(!1),M=z.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||HF.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return z.useEffect(()=>HF.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{br.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),z.useEffect(()=>{if(d!==`system`){re(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?re(`dark`):re(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{re(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{re(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),z.useEffect(()=>{x.length<=1&&D(!1)},[x]),z.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;D(!0),(t=k.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===k.current||k.current?.contains(document.activeElement))&&D(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),z.useEffect(()=>{if(k.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,j.current=!1)}},[k.current]),z.createElement(`section`,{ref:t,"aria-label":`${b} ${ie}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?z.createElement(`ol`,{key:t,dir:_===`auto`?iI():_,tabIndex:-1,ref:k,className:c,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${ZF}px`,"--gap":`${v}px`,...m,...aI(l,u)},onBlur:e=>{j.current&&!e.currentTarget.contains(e.relatedTarget)&&(j.current=!1,A.current&&=(A.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j.current||(j.current=!0,A.current=e.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{te||D(!1)},onDragEnd:()=>D(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ne(!0)},onPointerUp:()=>ne(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>z.createElement(rI,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:te,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:M,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:ee,expandByDefault:o,gap:v,expanded:E,swipeDirections:e.swipeDirections}))):null}))}),sI=`__mcpUseInspectorReconnect`;function cI(e){let t=e??(typeof window<`u`?window.location.search:``);if(typeof window<`u`){try{if(sessionStorage.getItem(`__mcpUseInspectorReconnect`))return!0}catch{}if(window.__MCP_USE_INSPECTOR__?.autoConnectUrl)return!0}return!!new URLSearchParams(t).get(`autoConnect`)}function lI(e,t){return e.url===t.url&&e.state!==`ready`&&(e.transportType??`http`)!==t.transportType}function uI(e){if(!e||typeof e!=`string`)return console.warn(`[useAutoConnect] parseAutoConnectParam: invalid param`,e),null;let t=e.trim();if((t.startsWith(`{`)||t.startsWith(`[`))&&t.endsWith(`/`)&&(t=t.replace(/\/+$/,``)),t.startsWith(`http://`)||t.startsWith(`https://`))return console.log(`[useAutoConnect] parseAutoConnectParam: treating as plain URL:`,t),{url:t,name:`Auto-connected Server`,transportType:`http`,connectionType:`Direct`,connectionMode:`auto`};try{let e=JSON.parse(t);if(console.log(`[useAutoConnect] parseAutoConnectParam: parsed JSON:`,e),e&&typeof e==`object`&&!Array.isArray(e))if(e.url&&typeof e.url==`string`){let t=e.url.trim();if((t.startsWith(`{`)||t.startsWith(`[`))&&t.length>2)try{let e=JSON.parse(t);e&&typeof e==`object`&&e.url&&typeof e.url==`string`?(t=e.url.trim(),console.log(`[useAutoConnect] parseAutoConnectParam: extracted URL from nested JSON:`,t)):console.warn(`[useAutoConnect] parseAutoConnectParam: url field is JSON but doesn't contain a url:`,e)}catch(e){console.warn(`[useAutoConnect] parseAutoConnectParam: url field looks like JSON but failed to parse, using as-is:`,e)}return!t.startsWith(`http://`)&&!t.startsWith(`https://`)?(console.error(`[useAutoConnect] parseAutoConnectParam: extracted URL is not a valid HTTP(S) URL:`,t),null):(console.log(`[useAutoConnect] parseAutoConnectParam: extracted URL:`,t),{url:t,name:e.name||`Auto-connected Server`,transportType:e.transportType===`sse`?`sse`:`http`,connectionMode:dM(e.connectionMode,e.connectionType,!!e.proxyConfig?.proxyAddress),connectionType:e.connectionType===`Via Proxy`?`Via Proxy`:`Direct`,autoProxyFallback:e.autoProxyFallback,customHeaders:e.customHeaders||{},requestTimeout:e.requestTimeout,resetTimeoutOnProgress:e.resetTimeoutOnProgress,maxTotalTimeout:e.maxTotalTimeout,auth:e.auth})}else return console.warn(`[useAutoConnect] parseAutoConnectParam: parsed object missing or invalid url field:`,e),null;else return typeof e==`string`&&(e.startsWith(`http://`)||e.startsWith(`https://`))?(console.log(`[useAutoConnect] parseAutoConnectParam: JSON parsed to URL string:`,e),{url:e,name:`Auto-connected Server`,transportType:`http`,connectionType:`Direct`,connectionMode:`auto`}):(console.warn(`[useAutoConnect] parseAutoConnectParam: parsed value is not a valid object:`,e),null)}catch(e){return console.error(`[useAutoConnect] parseAutoConnectParam: Failed to parse as JSON and not a valid URL:`,e,`Param:`,t),null}}function dI({connections:e,addServer:t,removeConnection:n,configLoaded:r,embedded:i=!1}){let a=KN(),[o,s]=(0,z.useState)(()=>cI()),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(!1),f=(0,z.useCallback)(e=>{let{url:n,name:r,transportType:a,connectionMode:o,customHeaders:s,auth:c}=e;console.log(`[useAutoConnect] Config received:`,e),console.log(`[useAutoConnect] Custom headers before auth:`,s),console.log(`[useAutoConnect] Auth config:`,c);let l={...s};if(c?.access_token){let e=c.token_type||`bearer`;if(l.Authorization=`${e.charAt(0).toUpperCase()+e.slice(1)} ${c.access_token}`,console.log(`[useAutoConnect] Added Authorization header:`,l.Authorization),typeof window<`u`&&!i){let e=`mcp:auth:${n}`,t={access_token:c.access_token,token_type:c.token_type||`bearer`,expires_at:c.expires_at,refresh_token:c.refresh_token,scope:c.scope||``};try{localStorage.setItem(e,JSON.stringify(t)),console.log(`[useAutoConnect] Pre-stored OAuth tokens for ${n}`)}catch(e){console.error(`[useAutoConnect] Failed to store OAuth tokens:`,e)}}}console.log(`[useAutoConnect] Final custom headers:`,l);let u;try{let e=new URL(n).origin;window.location.origin!==e&&(u=uM())}catch{u=uM()}let d=o===`proxy`&&u?{proxyAddress:u,...Object.keys(l).length>0&&{headers:l}}:Object.keys(l).length>0?{headers:l}:void 0,f=o===`auto`?e.autoProxyFallback===void 0?u?{enabled:!0,proxyAddress:u}:!1:e.autoProxyFallback:!1;console.warn(`[useAutoConnect] Attempting connection (${o}):`,{url:n,transportType:a,proxyConfig:d,autoProxyFallback:f}),t(n,yM({url:n,name:r,transportType:a,connectionMode:o,connectionType:o===`proxy`?`Via Proxy`:`Direct`,proxyConfig:d,headers:l,autoProxyFallback:f}))},[t]),p=(0,z.useCallback)(t=>{let r=e.find(e=>e.url===t.url);if(r){if(lI(r,t)){console.warn(`[useAutoConnect] Existing connection transport differs from auto-connect config; replacing it`),n(r.id),l(t),s(!0),f(t);return}if(r.state===`ready`){console.warn(`[useAutoConnect] Connection already ready, navigating to server`);let e=new URLSearchParams(window.location.search),t=e.get(`tunnelUrl`),n=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,r.id),t&&o.set(`tunnelUrl`,t),n&&o.set(`tab`,n),i&&o.set(`openTunnelPopover`,i),a(`/?${o.toString()}`)}else console.warn(`[useAutoConnect] Connection exists, waiting for ready state`),l(t),s(!0)}else l(t),s(!0),f(t)},[e,a,n,f]);return(0,z.useEffect)(()=>{if(u)return;let e=()=>{if(typeof sessionStorage>`u`)return!1;try{let e=sessionStorage.getItem(sI);if(!e)return!1;let t=JSON.parse(e);return sessionStorage.removeItem(sI),!t?.url||!t.transportType?!1:(p(t),!0)}catch{try{sessionStorage.removeItem(sI)}catch{}return!1}};if(i){if(e()){d(!0);return}let t=new URLSearchParams(window.location.search).get(`autoConnect`);if(t){try{t=decodeURIComponent(t)}catch{}console.log(`[useAutoConnect] Raw autoConnect param:`,t);let e=uI(t);console.log(`[useAutoConnect] Parsed config:`,e),e&&p(e),d(!0);return}d(!0);return}if(r!==!0)return;if(e()){d(!0);return}let t=new URLSearchParams(window.location.search).get(`autoConnect`);if(t)try{t=decodeURIComponent(t)}catch{}if(t){let e=uI(t);e&&p(e),d(!0);return}let n=window.__MCP_USE_INSPECTOR__?.autoConnectUrl;if(n){let e=uI(n);e&&p(e),d(!0);return}fetch(`${rM()}/config.json`).then(e=>e.json()).then(e=>{if(d(!0),e.autoConnectUrl){let t=uI(e.autoConnectUrl);t&&p(t)}}).catch(()=>d(!0))},[u,r,p,i]),(0,z.useEffect)(()=>{if(!c)return;let t=e.find(e=>e.url===c.url);if(t?.state===`ready`){console.warn(`[useAutoConnect] Connection succeeded, navigating to server`);let e=new URLSearchParams(window.location.search),n=e.get(`tunnelUrl`),r=e.get(`tab`),i=e.get(`openTunnelPopover`),o=new URLSearchParams;o.set(`server`,t.id),n&&o.set(`tunnelUrl`,n),r&&o.set(`tab`,r),i&&o.set(`openTunnelPopover`,i),a(`/?${o.toString()}`),setTimeout(()=>{l(null),s(!1)},100);return}if(t?.state===`pending_auth`||t?.state===`authenticating`){console.warn(`[useAutoConnect] Connection requires authentication, clearing loading overlay`),setTimeout(()=>{s(!1)},100);return}t?.state===`failed`&&(console.warn(`[useAutoConnect] Connection failed after all retries`),GF.error(`Cannot connect to server. Please check the URL and try again.`),queueMicrotask(()=>{s(!1),l(null)}))},[e,c,a]),(0,z.useEffect)(()=>{if(o&&e.length>0&&!c&&e.some(e=>e.state===`ready`||e.state===`failed`||e.state===`pending_auth`)){let e=setTimeout(()=>s(!1),500);return()=>clearTimeout(e)}},[o,e,c]),(0,z.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>{o&&(console.warn(`[useAutoConnect] Auto-connect timeout - clearing loading state`),s(!1),l(null))},3e4);return()=>clearTimeout(e)},[o]),{isAutoConnecting:o,autoConnectUrl:c?.url||null}}function fI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card`,className:A(`flex flex-col gap-6 rounded-xl border border-border bg-transparent py-6 text-card-foreground`,e),...t})}function pI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-header`,className:A(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]`,e),...t})}function mI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-title`,className:A(`font-semibold leading-none`,e),...t})}function hI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-description`,className:A(`text-sm text-muted-foreground`,e),...t})}function gI({className:e,...t}){return(0,R.jsx)(`div`,{"data-slot":`card-content`,className:A(`px-6`,e),...t})}var _I={"chevron-right":O,"chevron-down":Ir,pipette:Di,x:Ji,copy:Wr,menu:gi,dot:Kr,monitor:yi,sun:Hi,moon:bi,"rectangle-horizontal":Ai,circle:Br,"square-library":Ri,clock:Vr,star:Bi,settings:Pi,plus:ki,"arrow-left":Or,"arrow-right":kr,"arrow-up":jr,search:T,loader:fi,users:Ki,lock:pi,mail:hi,bell:Mr,shield:Fi,palette:Si,lightbulb:li,rocket:ji,heart:ni,paintbrush:xi,brain:Nr,globe:ei,user:Gi,image:ai,link:ui,check:Fr,"rotate-ccw":Mi,play:Oi,pause:Ti,home:ii,"message-circle":_i,inbox:oi,pencil:Ei,"skip-forward":Ii,"corner-down-right":Gr},vI=(0,z.createContext)(null);function yI(e){return((0,z.useContext)(vI)??_I)[e]}var bI=z.createContext(!1),xI=z.createContext(void 0);function SI(e){let t=z.useContext(xI);if(e===!1&&t===void 0)throw Error(Ve(27));return t}var CI={...Ot,...bt},wI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=SI(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return We(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:CI,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),TI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,{store:c}=SI(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Pe({disabled:a,native:o}),f={disabled:a};function m(e){l&&c.setOpen(!1,ae(p,e.nativeEvent))}return We(`button`,e,{state:f,ref:[t,d],props:[{onClick:m},s,u]})}),EI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=SI(),c=N(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),We(`p`,e,{ref:t,props:[{id:c},o]})}),DI=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),OI=function(e){return e[e.open=_t.open]=`open`,e[e.closed=_t.closed]=`closed`,e[e.startingStyle=_t.startingStyle]=`startingStyle`,e[e.endingStyle=_t.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),kI=z.createContext(void 0);function AI(){let e=z.useContext(kI);if(e===void 0)throw Error(Ve(26));return e}var jI={...Ot,...bt,nestedDialogOpen(e){return e?{[OI.nestedDialogOpen]:``}:null}},MI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,{store:c}=SI(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),S=c.useState(`role`),C=d.useState(`floatingId`),w=s.id??C;AI(),x({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let T=o===void 0?ft(c.context.popupRef):o,ee=g>0,E=c.useStateSetter(`popupElement`),D=We(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:ee},props:[f,{id:w,"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:S,...Mt,hidden:!m,onKeyDown(e){Qt.has(e.key)&&e.stopPropagation()},style:{[DI.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,E],stateAttributesMapping:jI});return(0,R.jsx)(rn,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:T,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:D})}),NI=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=SI(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,R.jsx)(kI.Provider,{value:n,children:(0,R.jsxs)(me,{ref:t,...r,children:[a&&o===!0&&(0,R.jsx)(wn,{ref:i.context.internalBackdropRef,inert:sn(!s)}),e.children]})}):null});function PI(e){let{store:t,actionsRef:n}=e,r=t.useState(`open`);tt(t,r),Ge(t);let{forceUnmount:i}=Ct(r,t),a=z.useCallback(()=>{t.setOpen(!1,ae(De))},[t]);z.useImperativeHandle(n,()=>({unmount:i,close:a}),[i,a])}function FI({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=z.useState(0),[u,d]=z.useState(0),f=c===0,p=y(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0||`touches`in t&&t.touches.length!==1)return!1;let n=et(t);return f&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===n||e.context.backdropRef.current===n||pt(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0:!1},escapeKey:f});return xn(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),e.useContextCallback(`onNestedDialogClose`,()=>{l(0),d(0)}),z.useEffect(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(c+1,u+ +!!n),t?.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[n,r,c,u,t]),ht(e,{activeTriggerProps:p.reference??St,inactiveTriggerProps:p.trigger??St,popupProps:p.floating??St,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var II={...ze,modal:Vt(e=>e.modal),nested:Vt(e=>e.nested),nestedOpenDialogCount:Vt(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Vt(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Vt(e=>e.disablePointerDismissal),openMethod:Vt(e=>e.openMethod),descriptionElementId:Vt(e=>e.descriptionElementId),titleElementId:Vt(e=>e.titleElementId),viewportElement:Vt(e=>e.viewportElement),role:Vt(e=>e.role)},LI=class e extends Kt{constructor(e,t,n=!1){let r=new xt,i=RI(e);i.floatingRootContext=at(r,t,n),super(i,{popupRef:z.createRef(),backdropRef:z.createRef(),internalBackdropRef:z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:r,onOpenChange:void 0,onOpenChangeComplete:void 0},II)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Ft(n,e,t.trigger),this.update(n)};static useStore(t,n){return Qe(t,(t,r)=>new e(n,t,r),!0).store}};function RI(e={}){return{...kt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function zI(e,t=`dialog`){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=t===`drawer`,m=t===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=SI(!0),y={modal:h,disablePointerDismissal:g,nested:!!v,role:_},b=LI.useStore(u?.store,{open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y});Ce(()=>{let e=r===void 0&&b.state.open===!1&&i===!0?{open:!0,activeTriggerId:f}:null;m?b.update(e?{...y,...e}:y):e&&b.update(e)}),b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);PI({store:b,actionsRef:l});let w=x||S,T=z.useMemo(()=>({store:b}),[b]);return(0,R.jsx)(bI.Provider,{value:!1,children:(0,R.jsxs)(xI.Provider,{value:T,children:[w&&(0,R.jsx)(FI,{store:b,parentContext:v?.store.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})})}function BI(e){return zI(e,z.useContext(bI)?`drawer`:`dialog`)}var VI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=SI(),c=N(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),We(`h2`,e,{ref:t,props:[{id:c},o]})}),HI=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=SI(!0),f=l?.store??d?.store;if(!f)throw Error(Ve(79));let p=N(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=z.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Fe(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Pe({disabled:a,native:o}),S=Sn(m,{enabled:m!=null}),C=dn(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return We(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[te]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:Re})}),UI=4,WI=`h-14`,GI=(0,z.createContext)(null);function KI({className:e}){let t=yI(`x`);return(0,R.jsx)(TI,{render:(0,R.jsxs)(jt,{variant:`ghost`,size:`icon-sm`,className:e,children:[(0,R.jsx)(t,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})}function qI({children:e,open:t,defaultOpen:n,onOpenChange:r,modal:i}){return(0,R.jsx)(BI,{open:t,defaultOpen:n,onOpenChange:e=>r?.(e),modal:i,children:e})}function JI(e){return(0,R.jsx)(HI,{"data-slot":`dialog-trigger`,...e})}var YI=(0,z.forwardRef)(({className:e,children:t,size:n=`sm`,scrollable:r=!1,container:i,...a},o)=>{let s=D(),c=un(),l=Math.min(c+UI,8),[u,d]=(0,z.useState)(!1),f=(0,z.useCallback)(e=>{d(e)},[]);return(0,R.jsxs)(NI,{container:i??void 0,children:[(0,R.jsx)(wI,{render:(e,t)=>{let n=t.transitionStatus===`ending`,{style:r,onDrag:a,onDragStart:o,onDragEnd:s,onAnimationStart:c,onAnimationEnd:l,onAnimationIteration:u,...d}=e;return(0,R.jsx)(qe.div,{...d,className:A(i?`absolute`:`fixed`,`inset-0 z-50 bg-black/40 dark:bg-black/80`),initial:{opacity:0},animate:{opacity:+!n},transition:n?At.slow.exit:At.slow})}}),(0,R.jsx)(MI,{ref:o,render:(o,c)=>{let d=c.transitionStatus===`ending`,{style:p,onDrag:m,onDragStart:h,onDragEnd:g,onAnimationStart:_,onAnimationEnd:v,onAnimationIteration:y,...b}=o;return(0,R.jsx)(qe.div,{...b,...a,className:A(i?`absolute`:`fixed`,`left-1/2 top-1/2 z-50 w-[calc(100%-2rem)]`,bn(l),`p-6 focus:outline-none`,n===`sm`&&`max-w-[400px]`,n===`lg`&&`max-w-[540px]`,s.container,r&&`flex flex-col overflow-hidden p-0`,e),style:{...p,...a.style},initial:{opacity:0,scale:.97,x:`-50%`,y:`-50%`},animate:{opacity:+!d,scale:d?.97:1,x:`-50%`,y:`-50%`},transition:d?At.slow.exit:At.slow,children:(0,R.jsx)(ln,{value:l,children:(0,R.jsxs)(GI.Provider,{value:{scrollable:r,setStickyHeader:f},children:[t,!u&&(0,R.jsx)(KI,{className:`absolute right-3 top-3 z-20`})]})})})}})]})});YI.displayName=`DialogContent`;function XI({className:e,sticky:t,children:n,...r}){let i=(0,z.useContext)(GI);return(0,z.useLayoutEffect)(()=>{if(t)return i?.setStickyHeader(!0),()=>i?.setStickyHeader(!1)},[t,i]),t?(0,R.jsxs)(`div`,{className:A(`sticky top-0 z-10 mb-0 flex shrink-0 items-center gap-2 border-b border-border/50 bg-white/50 px-6 backdrop-blur-xs dark:bg-black/50`,WI,e),...r,children:[n,(0,R.jsx)(KI,{className:`ml-auto shrink-0`})]}):(0,R.jsx)(`div`,{className:A(`mb-4 flex flex-col gap-1.5`,i?.scrollable&&`px-6 pt-6`,e),...r,children:n})}function ZI({className:e,...t}){return(0,R.jsx)(`div`,{className:A(`flex-1 min-h-0 overflow-y-auto overscroll-none pt-2`,(0,z.useContext)(GI)?.scrollable?`px-6 pb-6`:`-mx-6 px-6`,e),...t})}function QI({className:e,onCopy:t,children:n,...r}){let i=yI(`copy`),a=yI(`check`),[o,s]=(0,z.useState)(!1),c=async()=>{if(t)try{await t(),s(!0),setTimeout(()=>s(!1),2e3)}catch{}};return(0,R.jsxs)(`div`,{className:A(`group/json relative -mx-6 bg-muted/20 px-6 pt-6 pb-4`,e),...r,children:[t?(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10 opacity-0 transition-opacity group-hover/json:opacity-100`,children:(0,R.jsx)(jt,{variant:`ghost`,size:`icon-sm`,onClick:c,title:`Copy`,children:o?(0,R.jsx)(a,{className:`text-green-600`}):(0,R.jsx)(i,{})})}):null,n]})}function $I({className:e,...t}){return(0,R.jsx)(`div`,{className:A(`mt-6 flex justify-end gap-2`,(0,z.useContext)(GI)?.scrollable&&`px-6 pb-6`,e),...t})}var eL=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(VI,{ref:n,className:A(`m-0 text-[16px] leading-none text-foreground`,e),style:{fontVariationSettings:`'wght' 700`},...t}));eL.displayName=`DialogTitle`;var tL=(0,z.forwardRef)(({className:e,...t},n)=>(0,R.jsx)(EI,{ref:n,className:A(`text-[13px] text-muted-foreground`,e),...t}));tL.displayName=`DialogDescription`;function nL({headers:e,onChange:t,onSave:n,className:r,title:i=`Custom Headers`,description:a=`Headers with both name and value will be sent`,maxHeaders:o=50}){let[s,c]=(0,z.useState)({}),[l,u]=(0,z.useState)(null),d=(0,z.useRef)({});(0,z.useEffect)(()=>{l&&d.current[l]&&(d.current[l]?.focus(),u(null))},[l,e]);let f=()=>Math.random().toString(36).slice(2,11),p=()=>{if(e.length>=o)return;let n={id:f(),name:``,value:``};t([...e,n])},m=n=>{t(e.filter(e=>e.id!==n))},h=(n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},g=e=>{c(t=>({...t,[e]:!t[e]}))};return(0,R.jsxs)(`div`,{className:A(`space-y-3`,r),children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-base font-medium`,children:i}),(0,R.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 text-sm font-medium text-muted-foreground`,children:[(0,R.jsx)(`div`,{children:`Name`}),(0,R.jsx)(`div`,{children:`Value`})]}),e.length===0?(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 items-center`,children:[(0,R.jsx)(Nt,{placeholder:`Authorization`,value:``,onChange:e=>{if(e.target.value.trim()){let n=f();t([{id:n,name:e.target.value,value:``}]),u(n)}},className:`text-sm`,autoComplete:`off`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Nt,{placeholder:`Bearer token...`,value:``,onChange:()=>{},type:`password`,className:`font-mono text-sm`,autoComplete:`off`,disabled:!0}),(0,R.jsx)(jt,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-8 w-8 p-0`,disabled:!0,children:(0,R.jsx)(Zr,{className:`h-4 w-4`})}),(0,R.jsx)(jt,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`h-8 w-8 p-0`,disabled:!0,children:(0,R.jsx)(Ui,{className:`h-4 w-4`})})]})]}):e.map(e=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr] gap-4 items-center`,children:[(0,R.jsx)(Nt,{ref:t=>{d.current[e.id]=t},placeholder:`Authorization`,value:e.name,onChange:t=>h(e.id,`name`,t.target.value),className:`text-sm`,autoComplete:`off`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Nt,{placeholder:``,value:e.value,onChange:t=>h(e.id,`value`,t.target.value),type:s[e.id]?`text`:`password`,className:`font-mono text-sm`,autoComplete:`off`}),(0,R.jsx)(jt,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>g(e.id),className:`h-8 w-8 p-0`,children:s[e.id]?(0,R.jsx)(Xr,{className:`h-4 w-4`}):(0,R.jsx)(Zr,{className:`h-4 w-4`})}),(0,R.jsx)(jt,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>m(e.id),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Ui,{className:`h-4 w-4`})})]})]},e.id)),(0,R.jsx)(`div`,{className:`flex justify-start mt-4`,children:(0,R.jsxs)(jt,{type:`button`,variant:`outline`,size:`sm`,onClick:p,disabled:e.length>=o,className:`flex items-center gap-2`,children:[(0,R.jsx)(ki,{className:`h-4 w-4`}),`Add`]})})]}),n&&(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(jt,{type:`button`,onClick:n,className:`bg-black text-white hover:bg-gray-800`,children:`Save`})})]})}function rL({alias:e,setAlias:t,url:n,setUrl:r,connectionMode:i,setConnectionMode:a,customHeaders:o,setCustomHeaders:s,requestTimeout:c,setRequestTimeout:l,resetTimeoutOnProgress:u,setResetTimeoutOnProgress:d,maxTotalTimeout:f,setMaxTotalTimeout:p,proxyAddress:m,setProxyAddress:h,clientId:g,setClientId:_,clientSecret:v,setClientSecret:y,scope:b,setScope:x,onConnect:S,onSave:C,onCancel:w,variant:T=`default`,showConnectButton:ee=!1,showSaveButton:E=!1,showExportButton:D=!1,isConnecting:te=!1,inlineSections:ne=!1,cardSections:O=!1}){let[re,k]=(0,z.useState)(!1),[ie,j]=(0,z.useState)(!1),[M,ae]=(0,z.useState)(!1),oe=(0,z.useRef)(!1),se=async()=>{if(!n.trim()){GF.error(`Please enter a URL first`);return}let t={url:n,...e.trim()?{name:e.trim()}:{},transportType:`http`,connectionMode:i,connectionType:i===`proxy`?`Via Proxy`:`Direct`,proxyConfig:i===`proxy`&&m.trim()?{proxyAddress:m.trim(),customHeaders:o.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{})}:void 0,autoProxyFallback:i===`auto`&&m.trim()?{enabled:!0,proxyAddress:m.trim()}:void 0,customHeaders:o.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),requestTimeout:Number.parseInt(c,10),resetTimeoutOnProgress:u===`True`,maxTotalTimeout:Number.parseInt(f,10),oauth:g||b?{clientId:g,...g&&v?{clientSecret:v}:{},scope:b}:void 0};try{await Qj(JSON.stringify(t,null,2)),GF.success(`Configuration copied to clipboard`)}catch{GF.error(`Failed to copy configuration to clipboard`)}},N=T===`styled`,P=N?`bg-white/10 border-white/20 text-white placeholder:text-white/50`:``,ce=N?`text-white/90`:``,le=N?`bg-white/10 border-white/20 text-white hover:bg-white/20`:``,ue=async e=>{let n=e.clipboardData.getData(`text`);try{let i=JSON.parse(n);if(i.url&&typeof i.url==`string`){e.preventDefault(),r(i.url),t(typeof i.name==`string`&&i.name!==i.url?i.name:``);let n=i.proxyConfig?.proxyAddress||(typeof i.autoProxyFallback==`object`?i.autoProxyFallback.proxyAddress:void 0);a(dM(i.connectionMode,i.connectionType,!!n)),n&&h(n);let o=i.proxyConfig?.customHeaders||i.proxyConfig?.headers||i.customHeaders||i.headers||{};Object.keys(o).length>0&&s(Object.entries(o).map(([e,t],n)=>({id:`header-${n}`,name:e,value:String(t)}))),i.requestTimeout&&l(String(i.requestTimeout)),i.resetTimeoutOnProgress!==void 0&&d(i.resetTimeoutOnProgress?`True`:`False`),i.maxTotalTimeout&&p(String(i.maxTotalTimeout)),i.oauth&&(_(i.oauth.clientId||``),y(i.oauth.clientSecret||``),x(i.oauth.scope||``)),GF.success(`Configuration pasted and form populated`)}}catch{}},de=e=>{oe.current||e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&e.target.tagName!==`TEXTAREA`&&(e.preventDefault(),S&&n.trim()&&S())},fe=(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[!O&&(0,R.jsx)(`h4`,{className:`text-sm font-medium sm:col-span-2`,children:`OAuth 2.0`}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Client ID`}),(0,R.jsx)(Nt,{"data-testid":`auth-dialog-client-id-input`,placeholder:`Client ID`,value:g,onChange:e=>_(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Client Secret`}),(0,R.jsx)(Nt,{"data-testid":`auth-dialog-client-secret-input`,type:`password`,placeholder:`Client Secret (optional)`,value:v,onChange:e=>y(e.target.value)}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Stored in your browser's localStorage.`})]}),(0,R.jsxs)(`div`,{className:`space-y-2 sm:col-span-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Scope`}),(0,R.jsx)(Nt,{"data-testid":`auth-dialog-scope-input`,placeholder:`Scope (space-separated)`,value:b,onChange:e=>x(e.target.value)})]})]}),pe=(0,R.jsx)(nL,{title:(0,R.jsx)(R.Fragment,{}),headers:o,onChange:s}),me=(0,R.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Connection Mode`}),(0,R.jsxs)(yn,{value:i,onValueChange:e=>a(e),children:[(0,R.jsx)(pn,{className:`w-full`,"data-testid":`config-dialog-connection-mode-select`,children:(0,R.jsx)(on,{})}),(0,R.jsxs)(gn,{children:[(0,R.jsx)(vn,{value:`auto`,children:`Auto`}),(0,R.jsx)(vn,{value:`direct`,children:`Direct`}),(0,R.jsx)(vn,{value:`proxy`,children:`Proxy`})]})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Proxy Endpoint`}),(0,R.jsx)(Nt,{"data-testid":`config-dialog-proxy-address-input`,value:m,onChange:e=>h(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Request Timeout`}),(0,R.jsx)(Nt,{"data-testid":`config-dialog-request-timeout-input`,type:`number`,value:c,onChange:e=>l(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Maximum Total Timeout`}),(0,R.jsx)(Nt,{"data-testid":`config-dialog-max-timeout-input`,type:`number`,value:f,onChange:e=>p(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:`text-sm`,children:`Reset Timeout on Progress`}),(0,R.jsxs)(yn,{value:u,onValueChange:d,children:[(0,R.jsx)(pn,{className:`w-full`,"data-testid":`config-dialog-reset-timeout-select`,children:(0,R.jsx)(on,{})}),(0,R.jsxs)(gn,{children:[(0,R.jsx)(vn,{value:`True`,children:`True`}),(0,R.jsx)(vn,{value:`False`,children:`False`})]})]})]})]}),he=(0,R.jsxs)(`div`,{className:ne||O?`grid gap-4 sm:grid-cols-2`:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:ce,children:`Alias`}),(0,R.jsx)(Nt,{"data-testid":`connection-form-alias-input`,placeholder:`Optional server alias`,value:e,onChange:e=>t(e.target.value),className:P})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(Xt,{className:ce,children:`URL`}),(0,R.jsx)(Nt,{"data-testid":`connection-form-url-input`,placeholder:`http://localhost:3000`,value:n,onChange:e=>r(e.target.value),onPaste:ue,className:P}),(0,R.jsx)(`p`,{className:A(`text-xs text-muted-foreground`,N?`text-white/60`:``),children:`Tip: You can paste a copied connection config (JSON) to auto-populate the form`})]})]}),ge={onCompositionStart:()=>{oe.current=!0},onCompositionEnd:()=>{oe.current=!1},onKeyDown:de},_e=D?(0,R.jsxs)(jt,{"data-testid":`connection-form-copy-config-button`,variant:`ghost`,onClick:se,className:A(N?`absolute top-0 right-0 z-10 text-white hover:bg-white/20 dark:hover:bg-white/20`:`w-full`,!N&&`mb-2`),children:[(0,R.jsx)(Wr,{className:`mr-2 h-4 w-4`}),`Copy Config`]}):null;return ne&&O?(0,R.jsxs)(`div`,{className:`relative space-y-6 @container`,...ge,children:[_e,(0,R.jsxs)(fI,{className:`border`,children:[(0,R.jsxs)(pI,{children:[(0,R.jsx)(mI,{className:`text-base font-medium`,children:`Endpoint`}),(0,R.jsx)(hI,{children:`MCP server URL and display alias`})]}),(0,R.jsx)(gI,{className:`pt-0`,children:he})]}),(0,R.jsxs)(fI,{className:`border`,children:[(0,R.jsxs)(pI,{children:[(0,R.jsx)(mI,{className:`text-base font-medium`,children:`Authentication`}),(0,R.jsx)(hI,{children:`OAuth 2.0 client credentials`})]}),(0,R.jsx)(gI,{className:`pt-0`,children:fe})]}),(0,R.jsxs)(fI,{className:`border`,children:[(0,R.jsxs)(pI,{children:[(0,R.jsx)(mI,{className:`text-base font-medium`,children:`Custom Headers`}),(0,R.jsx)(hI,{children:`Extra HTTP headers sent with MCP requests`})]}),(0,R.jsx)(gI,{className:`pt-0`,children:pe})]}),(0,R.jsxs)(fI,{className:`border`,children:[(0,R.jsxs)(pI,{children:[(0,R.jsx)(mI,{className:`text-base font-medium`,children:`Configuration`}),(0,R.jsx)(hI,{children:`Connection mode, proxy, and request timeouts`})]}),(0,R.jsx)(gI,{className:`pt-0`,children:me})]})]}):(0,R.jsxs)(`div`,{className:`relative space-y-4 @container`,...ge,children:[!ne&&(0,R.jsx)(`h3`,{className:`mb-4 text-xl font-semibold text-white`,children:`Connect`}),_e,he,ne&&!O&&(0,R.jsxs)(`div`,{className:`space-y-8 pt-2`,children:[(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Authentication`}),fe]}),(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Custom Headers`}),pe]}),(0,R.jsxs)(`section`,{className:`space-y-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Configuration`}),me]})]}),!ne&&(0,R.jsxs)(`div`,{className:`flex flex-row gap-3 @lg:flex-col`,children:[(0,R.jsxs)(qI,{open:ie,onOpenChange:j,children:[(0,R.jsx)(JI,{render:(0,R.jsx)(`div`,{className:`relative flex-1 `,children:(0,R.jsxs)(jt,{"data-testid":`connection-form-auth-button`,variant:`outline`,className:A((g||v||b)&&`border-2`,`w-full justify-center hover:text-white cursor-pointer`,le),children:[(0,R.jsx)(Fi,{className:`w-4 h-4 mr-0`}),`Authentication`]})}),nativeButton:!1}),(0,R.jsxs)(YI,{scrollable:!0,className:`w-[calc(100vw-2rem)] sm:w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(XI,{children:(0,R.jsx)(eL,{children:`Authentication`})}),(0,R.jsxs)(ZI,{className:`space-y-4`,children:[fe,(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(jt,{onClick:()=>j(!1),children:`Save`})})]})]})]}),(0,R.jsxs)(qI,{open:re,onOpenChange:k,children:[(0,R.jsx)(JI,{render:(0,R.jsx)(`div`,{className:`relative flex-1 `,children:(0,R.jsxs)(jt,{"data-testid":`connection-form-headers-button`,variant:`outline`,className:A(`w-full justify-center hover:text-white cursor-pointer`,le),children:[(0,R.jsx)(Qr,{className:`w-4 h-4`}),`Custom Headers`]})}),nativeButton:!1}),(0,R.jsxs)(YI,{scrollable:!0,className:`w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(XI,{children:(0,R.jsx)(eL,{children:`Custom Headers`})}),(0,R.jsx)(ZI,{children:(0,R.jsx)(nL,{title:(0,R.jsx)(R.Fragment,{}),headers:o,onChange:s,onSave:()=>k(!1)})})]})]}),(0,R.jsxs)(qI,{open:M,onOpenChange:ae,children:[(0,R.jsx)(JI,{render:(0,R.jsxs)(jt,{"data-testid":`connection-form-config-button`,variant:`outline`,className:A(`flex-1 justify-center hover:text-white cursor-pointer`,le),children:[(0,R.jsx)(Hr,{className:`w-4 h-4`}),`Configuration`]}),nativeButton:!0}),(0,R.jsxs)(YI,{scrollable:!0,className:`w-full max-w-2xl max-h-[80vh]`,children:[(0,R.jsx)(XI,{children:(0,R.jsx)(eL,{children:`Configuration`})}),(0,R.jsxs)(ZI,{className:`space-y-4`,children:[me,(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(jt,{onClick:()=>ae(!1),children:`Save`})})]})]})]})]}),ee&&(0,R.jsx)(jt,{"data-testid":`connection-form-connect-button`,onClick:S,disabled:!n.trim()||te,size:N?`lg`:void 0,className:A(`w-full font-semibold`,N?`rounded-full text-black [&_[aria-hidden]]:bg-white hover:[&_[aria-hidden]]:bg-white/90 group-active:[&_[aria-hidden]]:bg-white/80`:``),children:te?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`svg`,{className:`w-4 h-4 mr-2 animate-spin`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})}),`Connecting...`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`svg`,{className:`w-4 h-4 mr-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,R.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),`Connect`]})}),E&&(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[w&&(0,R.jsx)(jt,{variant:`outline`,onClick:w,children:`Cancel`}),(0,R.jsx)(jt,{"data-testid":`connection-form-save-button`,onClick:C,children:`Save Connection Options`})]})]})}function iL({children:e,className:t,variant:n,duration:r=.4,delay:i=0,offset:a=6,direction:o=`down`,inView:s=!1,inViewMargin:c=`-50px`,blur:l=`6px`,...u}){let d=(0,z.useRef)(null),f=Aa(d,{once:!0,margin:c}),p=!s||f,m={hidden:{[o===`left`||o===`right`?`x`:`y`]:o===`right`||o===`down`?-a:a,opacity:0,filter:`blur(${l})`},visible:{[o===`left`||o===`right`?`x`:`y`]:0,opacity:1,filter:`blur(0px)`}},h=n||m;return(0,R.jsx)(en,{children:(0,R.jsx)(qe.div,{ref:d,initial:`hidden`,animate:p?`visible`:`hidden`,exit:`hidden`,variants:h,transition:{delay:.04+i,duration:r,ease:`easeOut`},className:t,...u,children:e})})}function aL({className:e,...t}){return(0,R.jsx)(di,{role:`status`,"aria-label":`Loading`,className:A(`size-4 animate-spin`,e),...t})}function oL({server:e,className:t,size:n=`md`}){let[r,i]=(0,z.useState)(!0),[a,o]=(0,z.useState)(!1),s={sm:`w-6 h-6`,md:`w-8 h-8`,lg:`w-12 h-12`,xs:`w-4 h-4`},c=(()=>{let t=e.serverInfo?.icons;return t&&Array.isArray(t)&&t.length>0?t[0].src:e.serverInfo?.icon?e.serverInfo.icon:null})();(0,z.useEffect)(()=>{i(c!==null),o(!1)},[c]);let l=lM(e);return!c||a?(0,R.jsx)(iL,{delay:.05,offset:0,children:(0,R.jsx)(so,{className:A(`flex items-center justify-center rounded-full overflow-hidden`,s[n],t)})}):(0,R.jsx)(iL,{delay:.05,offset:0,children:(0,R.jsxs)(`div`,{className:A(`rounded-md overflow-hidden flex items-center justify-center bg-white dark:bg-zinc-800 relative`,s[n],t),children:[r&&(0,R.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-zinc-100/80 dark:bg-zinc-800/80`,children:(0,R.jsx)(aL,{})}),(0,R.jsx)(`img`,{src:c,alt:l,className:A(`object-contain`,s[n]),onLoad:()=>i(!1),onError:()=>{i(!1),o(!0)},style:{imageRendering:`-webkit-optimize-contrast`,display:r?`none`:`block`}})]})})}var sL=`mcp-inspector-connect-panel-mesh-animation-paused`,cL=[`#e0eaff`,`#f9ffbd`,`#dedede`,`#ffffff`];function lL(){let{servers:e,addServer:t,removeServer:n}=Sj(),r=(0,z.useRef)(new Set);(0,z.useEffect)(()=>{e.forEach(e=>{if(e.state===`ready`&&!r.current.has(e.id)){r.current.add(e.id);try{ET(new _o({serverId:e.id,serverUrl:e.url??``,success:!0,connectionType:`http`})).catch(()=>{})}catch{}}else e.state===`failed`&&r.current.has(e.id)&&r.current.delete(e.id)})},[e]);let i=(0,z.useCallback)(e=>{try{ET(new bo({serverId:e})).catch(()=>{})}catch{}r.current.delete(e),n(e,{clearCredentials:!0})},[n]),[a,o]=(0,z.useState)(new Set),s=(0,z.useRef)(new Set);(0,z.useEffect)(()=>{s.current=a},[a]);let c=(0,z.useCallback)(async t=>{if(s.current.has(t)){console.warn(`[InspectorDashboard] Connection ${t} is already being reconnected, skipping`);return}let n=e.find(e=>e.id===t);if(n){o(e=>new Set(e).add(t));try{await n.reconnect()}catch(e){console.error(`[InspectorDashboard] Failed to reconnect server ${t}:`,e)}finally{o(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]),l=KN(),u=UN(),[d,f]=(0,z.useState)(new Set),[p,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{DT({connectionCount:e.length}).catch(()=>{})},[]);let[h,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(`auto`),[x,S]=(0,z.useState)([]),[C,w]=(0,z.useState)(`10000`),[T,ee]=(0,z.useState)(`True`),[E,D]=(0,z.useState)(`60000`),[te,ne]=(0,z.useState)(uM()),[O,re]=(0,z.useState)(``),[k,ie]=(0,z.useState)(``),[A,j]=(0,z.useState)(``),M=(0,z.useRef)(null),[ae,oe]=(0,z.useState)(()=>{try{return localStorage.getItem(sL)===`true`}catch{return!1}}),se=(0,z.useCallback)(()=>{oe(e=>{let t=!e;try{localStorage.setItem(sL,t?`true`:`false`)}catch{}return t})},[]),N=(0,z.useCallback)(()=>{if(!_.trim())return;let e=_.trim();try{let t=new URL(e);if(!(t.protocol===`http:`||t.protocol===`https:`)){GF.error(`Invalid URL protocol. Please use http:// or https://`);return}}catch{try{let t=`https://${e}`,n=new URL(t);if(!(n.protocol===`http:`||n.protocol===`https:`)){GF.error(`Invalid URL protocol. Please use http:// or https://`);return}e=t}catch{GF.error(`Invalid URL format. Please enter a valid URL.`);return}}let n=x.reduce((e,t)=>(t.name&&t.value&&(e[t.name]=t.value),e),{}),r=y===`proxy`&&te.trim()?{proxyAddress:te.trim(),headers:n}:void 0,i=y===`auto`&&te.trim()?{enabled:!0,proxyAddress:te.trim()}:!1,a=gM(O,k,A),o={url:e,displayName:h.trim()||e,connectionMode:y,autoProxyFallback:i,...r?{proxyConfig:r}:{},...Object.keys(n).length>0&&!r?{headers:n}:{},...a?{oauth:a}:{}};t(e,o),ET(new yo({serverId:_.trim(),serverUrl:_.trim(),connectionType:`http`,viaProxy:!!r?.proxyAddress})).catch(()=>{}),g(``),v(``),S([]),b(`auto`),re(``),ie(``),j(``),GF.success(`Server added successfully`)},[_,h,y,te,x,O,k,A,t]),ce=()=>{e.forEach(e=>{i(e.id)})},le=async e=>{try{await Qj(e),GF.success(`Error message copied to clipboard`)}catch{GF.error(`Failed to copy error message`)}},ue=async e=>{try{let t=bM(e,xM(e.id));await Qj(JSON.stringify(t,null,2)),GF.success(`Connection configuration copied to clipboard`)}catch{GF.error(`Failed to copy connection configuration`)}},de=(e,t)=>{e.stopPropagation(),t()},fe=(e,t)=>{let n=new URLSearchParams(u.search).get(`tunnelUrl`),r=new URLSearchParams;r.set(`server`,e.id),r.set(`tab`,t),n&&r.set(`tunnelUrl`,n),l(`/?${r.toString()}`)},pe=e=>{if(e.state===`failed`)return;let t=new URLSearchParams(u.search),n=t.get(`tunnelUrl`),r=t.get(`tab`),i=new URLSearchParams;i.set(`server`,e.id),n&&i.set(`tunnelUrl`,n),r&&i.set(`tab`,r),l(`/?${i.toString()}`)},me=e=>{console.log(`[InspectorDashboard] Reconnecting server:`,e.id),e.state===`failed`&&e.retry?e.retry():c(e.id)};return(0,z.useEffect)(()=>{f(t=>{let n=new Set(t),r=!1;return t.forEach(t=>{let i=e.find(e=>e.id===t);i&&(i.state===`ready`||i.state===`failed`)&&(n.delete(t),r=!0)}),r?n:t})},[e]),(0,z.useEffect)(()=>{if(!p)return;let t=e.find(e=>e.id===p),n=(t?.tools?.length||0)>0||(t?.resources?.length||0)>0||(t?.prompts?.length||0)>0;if(t&&(t.state===`ready`||n&&t.state!==`discovering`)){m(null);let e=new URLSearchParams(u.search),n=e.get(`tunnelUrl`),r=e.get(`tab`),i=new URLSearchParams;i.set(`server`,t.id),n&&i.set(`tunnelUrl`,n),r&&i.set(`tab`,r),l(`/?${i.toString()}`)}else t&&t.state===`failed`&&!n&&t.error&&(console.warn(`[InspectorDashboard] Connection failed with no data, canceling navigation`),m(null))},[e,p,l]),(0,R.jsxs)(`div`,{className:`flex flex-col lg:flex-row items-start justify-start gap-4 h-auto lg:h-full relative`,children:[(0,R.jsxs)(`div`,{className:`w-full px-3 pt-6 sm:px-6 sm:pt-3 overflow-visible lg:overflow-auto`,children:[(0,R.jsxs)(`div`,{className:`flex mb-3 md:mb-0 flex-col sm:flex-row items-center sm:items-center gap-3 relative z-10`,children:[(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block order-1 sm:order-2`,children:(0,R.jsxs)(P,{variant:`secondary`,className:`text-xs cursor-pointer hover:bg-secondary/80 transition-colors`,children:[`v`,ko()]})}),nativeButton:!1}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`Visit GitHub`})})]}),(0,R.jsx)(`h2`,{className:`text-2xl font-medium tracking-tight text-center sm:text-left order-2 sm:order-1`,children:`MCP Inspector`})]}),(0,R.jsx)(`p`,{className:`text-muted-foreground relative z-10 text-center sm:text-left`,children:`Inspect and debug MCP (Model Context Protocol) servers`}),(0,R.jsxs)(`div`,{className:`space-y-4 mt-4 sm:mt-8`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center sm:items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`hidden sm:block text-base font-medium text-center sm:text-left`,children:`Connected Servers`}),(0,R.jsx)(`div`,{className:`hidden sm:flex items-center gap-3 justify-center sm:justify-start`,children:e.length>0&&(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,onClick:ce,children:`Clear All`})})]}),e.length===0?(0,R.jsx)(to,{message:`No servers connected yet. Add a server above to get started.`}):(0,R.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,R.jsxs)(`div`,{"data-testid":`server-tile-${e.id}`,onClick:()=>pe(e),className:`group rounded-lg bg-zinc-100 dark:bg-white/10 p-4 transition-colors ${e.state===`ready`?`hover:bg-zinc-200 dark:hover:bg-white/15 cursor-pointer`:``}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(oL,{server:e,size:`md`}),(0,R.jsx)(`h4`,{className:`font-semibold text-sm`,children:lM(e)}),(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:a.has(e.id)?(0,R.jsx)(di,{className:`w-3 h-3 animate-spin text-blue-500`}):e.error&&e.state!==`ready`?(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`button`,{type:`button`,"data-testid":`server-tile-status-${e.state}`,onClick:t=>{t.stopPropagation(),le(e.error)},className:`w-2 h-2 rounded-full transition-colors ${(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)?`bg-yellow-500 animate-status-pulse-yellow hover:bg-yellow-600`:`bg-rose-500 animate-status-pulse-red hover:bg-rose-600`}`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{className:`max-w-xs`,children:e.error})})]}):(0,R.jsx)(`div`,{"data-testid":`server-tile-status-${e.state}`,className:`w-2 h-2 rounded-full ${e.state===`ready`?`bg-emerald-600 animate-status-pulse`:e.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground dark:text-zinc-400 font-mono`,children:e.url}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`button`,{type:`button`,onClick:async t=>{t.stopPropagation();try{await Qj(e.url??``),GF.success(`URL copied to clipboard`)}catch{GF.error(`Failed to copy URL`)}},className:`opacity-0 group-hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded`,title:`Copy URL`,children:(0,R.jsx)(Wr,{className:`w-3 h-3 text-muted-foreground`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`Copy URL`})})]})]})]}),(0,R.jsxs)(`div`,{className:`hidden lg:flex items-center gap-1 flex-shrink-0`,children:[(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(jt,{"data-testid":`server-tile-copy-config`,variant:`secondary`,size:`sm`,onClick:t=>de(t,()=>ue(e)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Wr,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`Copy connection config`})})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(jt,{"data-testid":`server-tile-info`,variant:`secondary`,size:`sm`,onClick:t=>de(t,()=>fe(e,`server-metadata`)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(si,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`View server info`})})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(jt,{"data-testid":`server-tile-settings`,variant:`secondary`,size:`sm`,onClick:t=>de(t,()=>fe(e,`connection-settings`)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Pi,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`Edit connection settings`})})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(jt,{"data-testid":`server-tile-remove`,variant:`secondary`,size:`sm`,onClick:t=>de(t,()=>i(e.id)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Rr,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:`Remove connection`})})]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(jt,{"data-testid":`server-tile-reconnect`,variant:`secondary`,size:`sm`,onClick:t=>de(t,()=>me(e)),className:`h-8 w-8 p-0`,children:(0,R.jsx)(Mi,{className:`w-4 h-4`})}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`})})]})]}),(0,R.jsx)(`div`,{className:`lg:hidden flex-shrink-0`,children:(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,onClick:e=>e.stopPropagation(),children:(0,R.jsx)(Jr,{className:`h-4 w-4`})}),nativeButton:!0}),(0,R.jsxs)(Ya,{align:`end`,children:[(0,R.jsxs)(Za,{onClick:t=>{t.stopPropagation(),ue(e)},children:[(0,R.jsx)(Wr,{className:`h-4 w-4 mr-2`}),`Copy connection config`]}),(0,R.jsxs)(Za,{onClick:t=>{t.stopPropagation(),fe(e,`server-metadata`)},children:[(0,R.jsx)(si,{className:`h-4 w-4 mr-2`}),`View server info`]}),(0,R.jsxs)(Za,{onClick:t=>{t.stopPropagation(),fe(e,`connection-settings`)},children:[(0,R.jsx)(Pi,{className:`h-4 w-4 mr-2`}),`Edit connection settings`]}),(e.state===`ready`||e.state===`failed`||e.state===`discovering`)&&(0,R.jsxs)(Za,{onClick:t=>{t.stopPropagation(),me(e)},children:[(0,R.jsx)(Mi,{className:`h-4 w-4 mr-2`}),e.state===`failed`?`Retry connection`:e.state===`discovering`?`Reconnect`:`Resync connection`]}),(0,R.jsxs)(Za,{onClick:t=>{t.stopPropagation(),i(e.id)},className:`text-destructive focus:text-destructive`,children:[(0,R.jsx)(Rr,{className:`h-4 w-4 mr-2`}),`Remove connection`]})]})]})})]}),(e.state===`pending_auth`||e.state===`authenticating`)&&(0,R.jsx)(`div`,{className:`text-sm text-yellow-600 dark:text-yellow-400 mt-2`,children:e.state===`authenticating`?(0,R.jsxs)(jt,{size:`sm`,className:`bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500`,variant:`outline`,disabled:!0,children:[(0,R.jsx)(di,{className:`mr-2 h-4 w-4 animate-spin`}),`Authenticating...`]}):e.authUrl?(0,R.jsx)(jt,{"data-testid":`server-tile-authenticate`,size:`sm`,className:`bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500`,variant:`outline`,render:(0,R.jsx)(`a`,{href:e.authUrl,onClick:t=>{t.stopPropagation();try{sessionStorage.setItem(`__mcpUseInspectorReconnect`,JSON.stringify({url:e.url,name:e.name||`Auto-connected Server`,transportType:e.transportType||`http`,connectionMode:`auto`}))}catch{}}}),nativeButton:!1,children:`Authenticate`}):null}),e.state===`failed`&&e.error&&(e.error.includes(`401`)||e.error.includes(`Unauthorized`))&&e.error.includes(`does not support OAuth`)&&(0,R.jsx)(`div`,{className:`text-sm mt-2 p-2 bg-yellow-500/10 dark:bg-yellow-400/10 border border-yellow-500/20 dark:border-yellow-400/20 rounded text-yellow-800 dark:text-yellow-400`,children:e.error})]},e.id))})]})]}),(0,R.jsxs)(`div`,{ref:M,className:`w-full relative overflow-hidden h-auto lg:h-full py-4 px-4 sm:py-6 sm:px-6 lg:p-10 items-center justify-center flex`,children:[(0,R.jsx)(`div`,{className:`absolute inset-0 z-0 overflow-hidden dark:opacity-60 pointer-events-none`,children:(0,R.jsx)(fo,{className:`h-full w-full`,colors:cL,distortion:.8,swirl:.1,grainMixer:0,grainOverlay:.2,speed:+!ae})}),(0,R.jsx)(`div`,{className:`absolute inset-0 z-[1] pointer-events-none opacity-[0.07] mix-blend-soft-light dark:opacity-[0.06]`,"aria-hidden":!0,children:(0,R.jsx)(`div`,{className:`absolute inset-0 noise`,style:{background:`url("${io}")`,filter:`contrast(150%) brightness(550%)`}})}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`button`,{type:`button`,onClick:se,"aria-label":ae?`Enable background shader animation`:`Disable background shader animation`,className:`absolute bottom-3 right-3 sm:bottom-5 sm:right-5 z-[8] flex h-7 w-7 cursor-pointer items-center justify-center rounded-full border border-zinc-500/60 bg-transparent text-zinc-600 transition-colors hover:border-zinc-500 hover:text-zinc-800 dark:border-zinc-500/50 dark:text-zinc-400 dark:hover:border-zinc-400 dark:hover:text-zinc-200`,children:ae?(0,R.jsx)(Oi,{className:`h-3 w-3 ml-px`,fill:`currentColor`}):(0,R.jsx)(zi,{className:`h-2.5 w-2.5`,fill:`currentColor`})}),nativeButton:!0}),(0,R.jsx)(Et,{side:`left`,children:(0,R.jsx)(`p`,{children:ae?`Enable shader animation`:`Disable shader animation`})})]}),(0,R.jsx)(`div`,{className:`relative w-full max-w-xl mx-auto z-10 flex flex-col gap-3 rounded-3xl p-4 sm:p-6 bg-black/70 dark:bg-black/90 shadow-2xl shadow-black/50 backdrop-blur-md`,children:(0,R.jsx)(rL,{alias:h,setAlias:g,url:_,setUrl:v,connectionMode:y,setConnectionMode:b,customHeaders:x,setCustomHeaders:S,requestTimeout:C,setRequestTimeout:w,resetTimeoutOnProgress:T,setResetTimeoutOnProgress:ee,maxTotalTimeout:E,setMaxTotalTimeout:D,proxyAddress:te,setProxyAddress:ne,clientId:O,setClientId:re,clientSecret:k,setClientSecret:ie,scope:A,setScope:j,onConnect:N,variant:`styled`,showConnectButton:!0,showExportButton:!0})})]})]})}var uL=(0,z.createContext)(void 0);function dL({children:e}){let t=(typeof window<`u`?window.__MANUFACT_CHAT_URL__:void 0)??void 0,[n,r]=(0,z.useState)({selectedServerId:null,activeTab:`tools`,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null,tunnelUrl:null,isTunnelStarting:!1,isEmbedded:!1,embeddedConfig:t?{chatApiUrl:t,chatStreamProtocol:`data-stream`,chatEnableFreeTierUpgrade:!0}:{}}),i=(0,z.useCallback)(e=>{r(t=>({...t,selectedServerId:e}))},[]),a=(0,z.useCallback)(e=>{r(t=>({...t,activeTab:e}))},[]),o=(0,z.useCallback)(e=>{r(t=>({...t,selectedToolName:e}))},[]),s=(0,z.useCallback)(e=>{r(t=>({...t,selectedPromptName:e}))},[]),c=(0,z.useCallback)(e=>{r(t=>({...t,selectedResourceUri:e}))},[]),l=(0,z.useCallback)(e=>{r(t=>({...t,selectedSamplingRequestId:e}))},[]),u=(0,z.useCallback)(e=>{r(t=>({...t,selectedElicitationRequestId:e}))},[]),d=(0,z.useCallback)(e=>{r(t=>({...t,tunnelUrl:e}))},[]),f=(0,z.useCallback)(e=>{r(t=>({...t,isTunnelStarting:e}))},[]),p=(0,z.useCallback)((e,t={})=>{r(n=>({...n,isEmbedded:e,embeddedConfig:t}))},[]),m=(0,z.useCallback)((e,t,n)=>{fetch(`http://127.0.0.1:7371/ingest/4e7482c5-571f-4071-bd09-762c357289f4`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Debug-Session-Id":`831b88`},body:JSON.stringify({sessionId:`831b88`,location:`InspectorContext.tsx:navigateToItem`,message:`context navigateToItem`,data:{serverId:e,tab:t,itemIdentifier:n??null,selectedToolName:t===`tools`?n??null:null,selectedResourceUri:t===`resources`?n??null:null},timestamp:Date.now(),hypothesisId:`H5`})}).catch(()=>{}),console.warn(`[InspectorContext] navigateToItem called:`,{serverId:e,tab:t,itemIdentifier:n}),r(r=>({...r,selectedServerId:e,activeTab:t,selectedToolName:t===`tools`&&n||null,selectedPromptName:t===`prompts`&&n||null,selectedResourceUri:t===`resources`&&n||null,selectedSamplingRequestId:t===`sampling`&&n||null,selectedElicitationRequestId:t===`elicitation`&&n||null}))},[]),h=(0,z.useCallback)(()=>{r(e=>({...e,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]);return(0,R.jsx)(uL,{value:{...n,setSelectedServerId:i,setActiveTab:a,setSelectedToolName:o,setSelectedPromptName:s,setSelectedResourceUri:c,setSelectedSamplingRequestId:l,setSelectedElicitationRequestId:u,setTunnelUrl:d,setIsTunnelStarting:f,setEmbeddedMode:p,navigateToItem:m,clearSelection:h},children:e})}function fL(){let e=(0,z.use)(uL);if(!e)throw Error(`useInspector must be used within InspectorProvider`);return e}function pL(e){(0,z.useEffect)(()=>{let t=t=>{let n=t.target,r=n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.contentEditable===`true`;if((t.metaKey||t.ctrlKey)&&t.key===`k`){t.preventDefault(),e.onCommandPalette?.();return}if((t.metaKey||t.ctrlKey)&&t.key===`o`&&e.onNewChat){t.preventDefault(),e.onNewChat();return}if(t.key===`Escape`){t.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),e.onBlurSearch?.();return}if(!r&&!(t.metaKey||t.ctrlKey||t.altKey||t.shiftKey))switch(t.key.toLowerCase()){case`t`:t.preventDefault(),e.onToolsTab?.();break;case`p`:t.preventDefault(),e.onPromptsTab?.();break;case`r`:t.preventDefault(),e.onResourcesTab?.();break;case`c`:t.preventDefault(),e.onChatTab?.();break;case`h`:t.preventDefault(),e.onHome?.();break;case`f`:t.preventDefault(),e.onFocusSearch?.();break;default:break}};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}var mL=`mcp-inspector-saved-requests`;function hL(){let[e,t]=(0,z.useState)([]);return(0,z.useEffect)(()=>{try{let e=localStorage.getItem(mL);e&&t(JSON.parse(e))}catch(e){console.error(`[useSavedRequests] Failed to load saved requests:`,e)}},[]),(0,z.useEffect)(()=>{let e=e=>{if(e.key===mL&&e.newValue)try{t(JSON.parse(e.newValue))}catch(e){console.error(`[useSavedRequests] Failed to parse saved requests:`,e)}};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),{savedRequests:e,saveSavedRequests:(0,z.useCallback)(e=>{try{localStorage.setItem(mL,JSON.stringify(e)),t(e)}catch(e){console.error(`[useSavedRequests] Failed to save requests:`,e)}},[])}}function gL(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase()}function _L(e){return`'${e.replace(/'/g,`'\\''`)}'`}function vL(e){return e.replace(/[^a-zA-Z0-9]/g,`_`).toUpperCase().replace(/^_+|_+$/g,``)}function yL(e,t,n){let r={url:e};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`{{${vL(t)}}}`;r.headers=e}let i=JSON.stringify(r);return`cursor://anysphere.cursor-deeplink/mcp/install?config=${btoa(i)}&name=${encodeURIComponent(gL(t))}`}function bL(e,t,n){let r={url:e,name:gL(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${vL(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode:mcp/install?${encodeURIComponent(i)}`}function xL(e,t,n){let r={url:e,name:gL(t),type:`http`};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${vL(t)}-value`;r.headers=e}let i=JSON.stringify(r);return`vscode-insiders:mcp/install?${encodeURIComponent(i)}`}function SL(e,t,n){let r={url:e,name:gL(t)};if(n&&Object.keys(n).length>0){let e={};for(let[t]of Object.entries(n))e[t]=`your-${vL(t)}-value`;r.headers=e}return r}function CL(e,t,n){try{let r=SL(e,t,n),i=JSON.stringify(r,null,2),a=globalThis.Blob,o=new a([i],{type:`application/json`}),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=`${gL(t)}.mcpb`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(s)}catch(e){throw console.error(`Failed to download .mcpb file:`,e),e}}function wL(e,t,n){let r=`claude mcp add --transport http "${gL(t)}" \\\n ${_L(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=vL(e);r+=` \\\n --header ${_L(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function TL(e,t,n){let r=`gemini mcp add --transport http "${gL(t)}" ${_L(e)}`,i=[];if(n&&Object.keys(n).length>0)for(let[e]of Object.entries(n)){let t=vL(e);r+=` \\\n --header ${_L(`${e}:\${${t}}`)}`,i.push({name:t,header:e})}return{command:r,envVars:i}}function EL(e,t,n){let r=`[mcp_servers.${gL(t)}]\nurl = "${e}"`,i=[];if(n&&Object.keys(n).length>0){let e=[];for(let[t]of Object.entries(n)){let n=vL(t);e.push(`"${t}" = "your-${n}-value"`),i.push({name:n,header:t})}if(r+=`\nhttp_headers = { ${e.join(`, `)} }`,i.length>0){r+=`
471
-
472
- # (optional) Use environment variables instead:
473
- # env_http_headers = { `;let e=i.map(({name:e,header:t})=>`"${t}" = "${e}"`);r+=e.join(`, `),r+=` }`}}return{config:r,envVars:i}}function DL(e){if(e.length===0)return``;let t=`Set these environment variables in your shell:
474
-
475
- `;for(let{name:n}of e)t+=`export ${n}="your-${n}-value"\n`;return t}function OL({className:e,size:t=`md`}){return(0,R.jsxs)(`svg`,{viewBox:`0 0 500 500`,className:A(`text-current`,{sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`}[t],e),fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]})}function kL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})})}function AL({className:e}){return(0,R.jsxs)(`svg`,{fill:`currentColor`,fillRule:`evenodd`,viewBox:`0 0 24 24`,className:e,xmlns:`http://www.w3.org/2000/svg`,"aria-label":`ModelContextProtocol`,children:[(0,R.jsx)(`path`,{d:`M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z`}),(0,R.jsx)(`path`,{d:`M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z`})]})}function jL({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}function ML({isOpen:e,onOpenChange:t,tools:n,prompts:r,resources:i,savedRequests:a,connections:o,selectedServer:s,tunnelUrl:c,onNavigate:l,onServerSelect:u}){let[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(0),h=(0,z.useRef)(null),g=(0,z.useRef)(null),_=KN(),v=w.pill,{activeIndex:y,itemRects:b,sessionRef:x,handlers:S,registerItem:C,measureItems:ee}=_n(h),E=s?c?`${c}/mcp`:s.url:null,D=s?.name||`MCP Server`,te=s?_M(s):void 0,ne=s?[{id:`open-in-cursor`,name:`Open in Cursor`,description:`Add this server to Cursor`,type:`global`,category:`Open in Client`,action:()=>{try{let e=yL(E,D,te);window.location.href=e,GF.success(`Opening in Cursor...`),t(!1)}catch{GF.error(`Failed to open in Cursor`)}}},{id:`open-in-claude-code`,name:`Open in Claude Code`,description:`Add this server to Claude Code CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=wL(E,D,te);Qj(e),GF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-claude-desktop`,name:`Open in Claude Desktop`,description:`Download .mcpb configuration file`,type:`global`,category:`Open in Client`,action:()=>{try{CL(E,D,te),GF.success(`Downloaded .mcpb file`),t(!1)}catch{GF.error(`Failed to download configuration file`)}}},{id:`open-in-vscode`,name:`Open in VS Code`,description:`Add this server to VS Code`,type:`global`,category:`Open in Client`,action:()=>{try{let e=bL(E,D,te);window.location.href=e,GF.success(`Opening in VS Code...`),t(!1)}catch{GF.error(`Failed to open in VS Code`)}}},{id:`open-in-vscode-insiders`,name:`Open in VS Code Insiders`,description:`Add this server to VS Code Insiders`,type:`global`,category:`Open in Client`,action:()=>{try{let e=xL(E,D,te);window.location.href=e,GF.success(`Opening in VS Code Insiders...`),t(!1)}catch{GF.error(`Failed to open in VS Code Insiders`)}}},{id:`open-in-gemini`,name:`Open in Gemini CLI`,description:`Add this server to Gemini CLI`,type:`global`,category:`Open in Client`,action:()=>{let{command:e}=TL(E,D,te);Qj(e),GF.success(`Command copied to clipboard`),t(!1)}},{id:`open-in-codex`,name:`Open in Codex CLI`,description:`Add this server to Codex CLI`,type:`global`,category:`Open in Client`,action:()=>{let{config:e}=EL(E,D,te);Qj(e),GF.success(`Config copied to clipboard`),t(!1)}}]:[],O=[{id:`connect-server`,name:`Connect Server`,description:`Add a new MCP server connection`,type:`global`,category:`Navigation`,action:()=>_(`/`)},{id:`mcp-use-website`,name:`MCP Use Website`,description:`Visit mcp-use.com for tools and resources`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com`,`_blank`)},{id:`mcp-use-docs`,name:`How to Create an MCP Server`,description:`Step-by-step guide to building MCP servers`,type:`global`,category:`Documentation`,action:()=>window.open(`https://mcp-use.com/docs`,`_blank`)},{id:`mcp-docs`,name:`MCP Official Documentation`,description:`Learn about the Model Context Protocol`,type:`global`,category:`Documentation`,action:()=>window.open(`https://modelcontextprotocol.io/docs/getting-started/intro`,`_blank`)},{id:`discord`,name:`Join Discord Community`,description:`Connect with the MCP community`,type:`global`,category:`Community`,action:()=>window.open(`https://discord.gg/XkNkSkMz3V`,`_blank`)},{id:`clear-localstorage`,name:`Clear localStorage & Reload`,description:`Having trouble connecting? Clear stored auth data and refresh`,type:`global`,category:`Troubleshooting`,action:()=>{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n&&(n.startsWith(`mcp:auth`)||n.startsWith(`mcp-inspector`))&&e.push(n)}e.forEach(e=>localStorage.removeItem(e)),GF.success(`Cleared ${e.length} localStorage item(s). Refreshing page...`,{duration:2e3}),setTimeout(()=>{window.location.reload()},500),t(!1)}}],re=o.map(e=>({id:`server-${e.id}`,name:lM(e),description:`Connected server (${e.state})`,type:`global`,category:`Connected Servers`,metadata:{serverId:e.id,state:e.state},action:()=>u(e.id)})),k=[...O,...ne,...re,...n.map(e=>({id:`tool-${e.name}`,name:e.name,description:e.description,type:`tool`,category:e._serverName?`Tools - ${e._serverName}`:`Tools`,metadata:{inputSchema:e.inputSchema,serverId:e._serverId,serverName:e._serverName}})),...r.map(e=>({id:`prompt-${e.name}`,name:e.name,description:e.description,type:`prompt`,category:e._serverName?`Prompts - ${e._serverName}`:`Prompts`,metadata:{arguments:e.arguments,serverId:e._serverId,serverName:e._serverName}})),...i.map(e=>({id:`resource-${e.uri}`,name:e.name,description:e.description,type:`resource`,category:e._serverName?`Resources - ${e._serverName}`:`Resources`,metadata:{uri:e.uri,mimeType:e.mimeType,serverId:e._serverId,serverName:e._serverName}})),...a.map(e=>({id:`saved-${e.id}`,name:e.name,description:`Saved request for ${e.toolName}`,type:`saved-request`,category:`Saved Requests`,metadata:{toolName:e.toolName,args:e.args,savedAt:e.savedAt,serverId:e.serverId,serverName:e.serverName}}))].filter(e=>d.trim()?`${e.name} ${e.description||``} ${e.category}`.toLowerCase().includes(d.trim().toLowerCase()):!0),ie=(0,z.useCallback)(e=>{if(console.warn(`[CommandPalette] Item selected:`,{itemType:e.type,itemName:e.name,itemId:e.id,metadata:e.metadata}),e.action)console.warn(`[CommandPalette] Executing action for global item`),e.action(),t(!1);else if(e.type===`global`)e.metadata?.serverId&&(console.warn(`[CommandPalette] Selecting server:`,e.metadata.serverId),u(e.metadata.serverId),t(!1));else{let n=e.type===`resource`?e.metadata?.uri:e.name,r=e.type===`tool`?`tools`:e.type===`prompt`?`prompts`:e.type===`saved-request`?`tools`:`resources`;fetch(`http://127.0.0.1:7371/ingest/4e7482c5-571f-4071-bd09-762c357289f4`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Debug-Session-Id":`831b88`},body:JSON.stringify({sessionId:`831b88`,location:`CommandPalette.tsx:handleSelect`,message:`palette navigate item`,data:{itemType:e.type,itemName:e.name,itemIdentifier:n,tabName:r,serverId:e.metadata?.serverId??null},timestamp:Date.now(),hypothesisId:`H1`})}).catch(()=>{}),console.warn(`[CommandPalette] Navigating to item:`,{tab:r,itemIdentifier:n,serverId:e.metadata?.serverId}),l(r,n,e.metadata?.serverId),t(!1)}},[l,t,u]),j=(e,t,n)=>{switch(e){case`tool`:return(0,R.jsx)(`div`,{className:`bg-blue-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(qi,{className:`h-4 w-4 text-blue-500`})});case`prompt`:return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(vi,{className:`h-4 w-4 text-purple-500`})});case`resource`:return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Qr,{className:`h-4 w-4 text-green-500`})});case`saved-request`:return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(ri,{className:`h-4 w-4 text-orange-500`})});case`global`:if(t===`Navigation`)return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(ki,{className:`h-4 w-4 text-gray-600 dark:text-gray-300`})});if(t===`Open in Client`){if(n?.includes(`Cursor`))return(0,R.jsx)(`div`,{className:`bg-gray-200 dark:bg-gray-800 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`})});if(n?.includes(`Claude Code`)||n?.includes(`Claude Desktop`))return(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`})});if(n?.includes(`VS Code`))return(0,R.jsx)(`div`,{className:`bg-blue-600/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(kL,{className:`h-4 w-4 text-blue-600`})});if(n?.includes(`Gemini`))return(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`})});if(n?.includes(`Codex`))return(0,R.jsx)(`div`,{className:`bg-green-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`})})}return t===`Documentation`?n?.includes(`MCP Use`)||n?.includes(`mcp-use`)?(0,R.jsx)(`div`,{className:`bg-black/10 dark:bg-white/10 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(OL,{className:`h-4 w-4 text-black dark:text-white`,size:`sm`})}):(0,R.jsx)(`div`,{className:`bg-orange-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-orange-500`})}):t===`Community`?(0,R.jsx)(`div`,{className:`bg-purple-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(jL,{className:`h-4 w-4 text-purple-500`})}):t===`Troubleshooting`?(0,R.jsx)(`div`,{className:`bg-yellow-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Pr,{className:`h-4 w-4 text-yellow-500`})}):t===`Connected Servers`?(0,R.jsx)(`div`,{className:`bg-cyan-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Ni,{className:`h-4 w-4 text-cyan-500`})}):(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(Yr,{className:`h-4 w-4 text-gray-500`})});default:return(0,R.jsx)(`div`,{className:`bg-gray-500/20 rounded-full p-2 flex items-center justify-center shrink-0`,children:(0,R.jsx)(T,{className:`h-4 w-4 text-gray-500`})})}};(0,z.useEffect)(()=>{e&&(f(``),m(0),requestAnimationFrame(()=>g.current?.focus()))},[e]),(0,z.useEffect)(()=>{h.current&&(h.current.scrollTop=0),m(0)},[d]),(0,z.useEffect)(()=>{p>=k.length&&m(Math.max(0,k.length-1))},[p,k.length]),(0,z.useLayoutEffect)(()=>{e&&ee()},[e,ee,k]);let M=b[p]??null,ae=y===null?null:b[y],oe=y!==null&&y!==p;return e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-50 bg-black/40 backdrop-blur-sm`,"aria-label":`Close command palette`,onClick:()=>t(!1)}),(0,R.jsxs)(`div`,{role:`dialog`,"aria-label":`Command Palette`,"data-testid":`command-palette-dialog`,className:`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-[51] max-w-[640px] w-[calc(100vw-2rem)] sm:w-full p-2 bg-white dark:bg-zinc-900/90 backdrop-blur-xl rounded-xl overflow-hidden border border-border shadow-[var(--cmdk-shadow)] transition-transform duration-100 ease-out outline-none`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),m(e=>Math.min(e+1,k.length-1))):e.key===`ArrowUp`?(e.preventDefault(),m(e=>Math.max(e-1,0))):e.key===`Enter`&&k[p]?(e.preventDefault(),ie(k[p])):e.key===`Escape`&&(e.preventDefault(),t(!1))},children:[(0,R.jsx)(`input`,{ref:g,placeholder:`What do you need?`,value:d,onChange:e=>f(e.target.value),className:`border-none w-full text-[17px] px-4 pt-2 pb-4 outline-none bg-transparent text-foreground border-b border-border mb-0 rounded-none placeholder:text-muted-foreground`,"data-testid":`command-palette-input`}),(0,R.jsxs)(`div`,{ref:h,onMouseEnter:S.onMouseEnter,onMouseMove:S.onMouseMove,onMouseLeave:S.onMouseLeave,className:`relative isolate min-h-[200px] sm:min-h-[330px] max-h-[400px] overflow-auto overscroll-contain transition-[height] duration-100 ease-out px-1`,"data-testid":`command-palette-list`,children:[(0,R.jsx)(en,{children:M&&(0,R.jsx)(qe.div,{"aria-hidden":!0,className:A(`pointer-events-none absolute bg-active`,v.bg),initial:!1,animate:{top:M.top,left:M.left,width:M.width,height:M.height,opacity:oe?.8:1},exit:{opacity:0,transition:At.moderate.exit},transition:{...At.moderate,opacity:{duration:.08}}})}),(0,R.jsx)(en,{children:ae&&(0,R.jsx)(qe.div,{"aria-hidden":!0,className:A(`pointer-events-none absolute bg-hover`,v.bg),initial:{opacity:0,top:M?.top??ae.top,left:M?.left??ae.left,width:M?.width??ae.width,height:M?.height??ae.height},animate:{opacity:1,top:ae.top,left:ae.left,width:ae.width,height:ae.height},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}},x.current)}),k.length===0?(0,R.jsx)(`div`,{className:`text-sm flex items-center justify-center h-12 whitespace-pre-wrap text-muted-foreground`,children:`No results found.`}):k.map((e,t)=>(0,R.jsxs)(`button`,{ref:e=>C(t,e),type:`button`,"data-testid":`command-palette-item-${e.id}`,"data-proximity-index":t,onClick:()=>ie(e),className:`[content-visibility:auto] relative z-10 cursor-pointer h-12 text-sm flex items-center gap-3 px-3 text-foreground select-none w-full text-left mt-1 first:mt-0`,children:[j(e.type,e.category,e.name),(0,R.jsx)(`span`,{className:`font-medium truncate flex-1 min-w-0`,children:e.name}),(()=>{let t=e.metadata?.serverId;if(!t||e.category===`Connected Servers`)return null;let n=o.find(e=>e.id===t);return n?(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 text-muted-foreground`,children:[(0,R.jsx)(oL,{server:n,size:`xs`}),(0,R.jsx)(`span`,{className:`text-xs truncate max-w-[9rem]`,children:lM(n)})]}):null})()]},e.id))]}),(0,R.jsxs)(`div`,{className:`border-t border-border px-4 py-3 pb-1 flex items-center justify-between text-xs text-muted-foreground `,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`t`}),(0,R.jsx)(`span`,{children:`Tools`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`p`}),(0,R.jsx)(`span`,{children:`Prompts`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`r`}),(0,R.jsx)(`span`,{children:`Resources`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`c`}),(0,R.jsx)(`span`,{children:`Chat`})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center w-5 h-5 font-mono font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`h`}),(0,R.jsx)(`span`,{children:`Home`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex items-center justify-center px-2 h-5 font-mono text-[10px] font-medium rounded shadow-sm bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 text-foreground leading-none`,children:`esc`}),(0,R.jsx)(`span`,{children:`Close`})]})]})]})]})]}):null}var NL=`openid profile email offline_access`,PL=`mcp-inspector:manufact-auth`,FL=`manufact:session-changed`,IL={loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null},LL=new Map,RL=new Set,zL=new Map,BL=new Map;function VL(e){let t=LL.get(e);if(t)return t;let n={...IL,loaded:!1};return LL.set(e,n),n}function HL(){return typeof window>`u`?null:window.localStorage}function UL(e){return new URL(e).origin}function WL(e,t){let n=new URL(e),r=new URL(t),i=new Set([`localhost`,`127.0.0.1`]);return i.has(n.hostname)&&i.has(r.hostname)?n.origin===r.origin:(n.hostname===`manufact.com`||n.hostname.endsWith(`.manufact.com`))&&(r.hostname===`manufact.com`||r.hostname.endsWith(`.manufact.com`))}function GL(e){let t=window.__MANUFACT_LOGIN_URL__;if(t)return new URL(t).origin;let n=new URL(e);return n.hostname===`localhost`||n.hostname===`127.0.0.1`?`${n.protocol}//${n.hostname}:3000`:`${n.protocol}//manufact.com`}function KL(e){return`${GL(e)}/login`}function qL(e){return`${GL(e)}/auth/embedded-sign-out`}function JL(e,t){return`${PL}:${t}:${e}`}function YL(e){return HL()?.getItem(JL(e,`skip-session`))===`1`}function XL(e,t){let n=JL(e,`skip-session`);t?HL()?.setItem(n,`1`):HL()?.removeItem(n)}function ZL(e){return`${PL}:state:${e}`}function QL(e){let t=HL()?.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return HL()?.removeItem(e),null}}function $L(e,t){HL()?.setItem(e,JSON.stringify(t))}function eR(e,t){LL.set(e,{...LL.get(e)??IL,...t}),RL.forEach(e=>e()),window.dispatchEvent(new CustomEvent(FL))}function tR(e){let t=``;return e.forEach(e=>{t+=String.fromCharCode(e)}),btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function nR(e=32){let t=new Uint8Array(e);return crypto.getRandomValues(t),tR(t)}async function rR(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return tR(new Uint8Array(t))}async function iR(e){let t=await fetch(`${e}/api/auth/.well-known/openid-configuration`);if(!t.ok)throw Error(`Manufact OAuth discovery failed`);return await t.json()}function aR(){return`${window.location.origin}${rM()}/auth/callback`}async function oR(e,t){let n=aR(),r=JL(e,`client`),i=QL(r);if(i?.client_id&&i.redirect_uri===n)return i;if(!t.registration_endpoint)throw Error(`Manufact OAuth registration is unavailable`);let a=await fetch(t.registration_endpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({client_name:`mcp-use Inspector`,redirect_uris:[n],grant_types:[`authorization_code`,`refresh_token`],response_types:[`code`],token_endpoint_auth_method:`none`,scope:NL})});if(!a.ok)throw Error(`Could not register Inspector with Manufact`);let o=await a.json();if(!o.client_id)throw Error(`Manufact returned no OAuth client ID`);let s={...o,redirect_uri:n};return $L(r,s),s}async function sR(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams(t)}),r=await n.json().catch(()=>({}));if(!n.ok||!r.access_token)throw Error(r.error_description??`Manufact token exchange failed`);return{access_token:r.access_token,refresh_token:r.refresh_token,token_type:r.token_type,expires_at:Date.now()+(r.expires_in??3600)*1e3}}async function cR(e,t){if(!t.refresh_token)return null;let n=BL.get(e);if(n)return n;let r=(async()=>{try{let n=await iR(e),r=QL(JL(e,`client`));if(!r?.client_id)return null;let i=await sR(n.token_endpoint,{grant_type:`refresh_token`,refresh_token:t.refresh_token,client_id:r.client_id}),a={...i,refresh_token:i.refresh_token??t.refresh_token};return $L(JL(e,`tokens`),a),a}catch{return HL()?.removeItem(JL(e,`tokens`)),null}finally{BL.delete(e)}})();return BL.set(e,r),r}async function lR(e){let t=QL(JL(e,`tokens`));return t?.access_token?t.expires_at>Date.now()+3e4?t:cR(e,t):null}async function uR(e,t){let n=await iR(e);if(!n.userinfo_endpoint)return null;let r=await fetch(n.userinfo_endpoint,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)return null;let i=await r.json();return i.sub?{id:i.sub,name:i.name,email:i.email,image:i.picture}:null}async function dR(e){try{let t=await fetch(`${e}/api/auth/get-session`,{credentials:`include`});return t.ok?(await t.json())?.user??null:null}catch{return null}}async function fR(e){let t=zL.get(e);if(t)return t;LL.set(e,{...LL.get(e)??IL,loaded:!1});let n=(async()=>{try{let t=WL(typeof window<`u`?window.location.href:e,e),n=YL(e),r=await lR(e),i=r?await uR(e,r.access_token):null;if(i&&r){XL(e,!1),eR(e,{loaded:!0,accessToken:r.access_token,user:i,mode:`oauth`});return}r&&!i&&HL()?.removeItem(JL(e,`tokens`));let a=t&&!n?await dR(e):null;if(a){eR(e,{loaded:!0,accessToken:null,user:a,mode:`session`});return}eR(e,{loaded:!0,accessToken:null,user:null,mode:null})}catch{eR(e,{loaded:!0,accessToken:null,user:null,mode:null})}})().finally(()=>zL.delete(e));return zL.set(e,n),n}async function pR(e){let t=UL(e);XL(t,!1);let n=window.open(``,`manufact-oauth`,`width=600,height=700,resizable=yes,scrollbars=yes`);if(!n)throw Error(`Allow popups to sign in with Manufact`);if(eR(t,{authorizing:!0}),WL(window.location.href,t)){n.location.href=KL(t);let e=window.setInterval(async()=>{if(n.closed){window.clearInterval(e),eR(t,{authorizing:!1});return}let r=await dR(t);r&&(window.clearInterval(e),n.close(),eR(t,{loaded:!0,authorizing:!1,accessToken:null,user:r,mode:`session`}))},1e3);return}try{let e=await iR(t),r=await oR(t,e),i=nR(64),a=nR(),o=aR();$L(ZL(a),{authOrigin:t,clientId:r.client_id,redirectUri:o,codeVerifier:i,expiresAt:Date.now()+600*1e3});let s=new URL(e.authorization_endpoint);s.searchParams.set(`response_type`,`code`),s.searchParams.set(`client_id`,r.client_id),s.searchParams.set(`redirect_uri`,o),s.searchParams.set(`scope`,NL),s.searchParams.set(`state`,a),s.searchParams.set(`code_challenge`,await rR(i)),s.searchParams.set(`code_challenge_method`,`S256`),s.searchParams.set(`prompt`,`consent`),n.location.href=s.toString();let c=window.setInterval(()=>{n.closed&&(window.clearInterval(c),fR(t).finally(()=>eR(t,{authorizing:!1})))},500)}catch(e){throw n.close(),eR(t,{authorizing:!1}),e}}async function mR(e=new URL(window.location.href)){let t=e.searchParams.get(`state`),n=e.searchParams.get(`code`),r=e.searchParams.get(`error_description`)??e.searchParams.get(`error`);if(r)throw Error(r);if(!t||!n)throw Error(`Missing OAuth code or state`);let i=ZL(t),a=QL(i);if(HL()?.removeItem(i),!a||a.expiresAt<Date.now())throw Error(`OAuth state is invalid or expired`);let o=await sR((await iR(a.authOrigin)).token_endpoint,{grant_type:`authorization_code`,code:n,redirect_uri:a.redirectUri,client_id:a.clientId,code_verifier:a.codeVerifier});$L(JL(a.authOrigin,`tokens`),o),XL(a.authOrigin,!1);let s=await uR(a.authOrigin,o.access_token);eR(a.authOrigin,{loaded:!0,authorizing:!1,accessToken:o.access_token,user:s,mode:`oauth`}),window.opener?.postMessage({type:`manufact:oauth-complete`,authOrigin:a.authOrigin},window.location.origin)}function hR(e){let t=UL(e);HL()?.removeItem(JL(t,`tokens`)),eR(t,{loaded:!0,authorizing:!1,accessToken:null,user:null,mode:null})}async function gR(e){let t=QL(JL(e,`tokens`)),n=QL(JL(e,`client`)),r=t?.refresh_token??t?.access_token;if(!n?.client_id||!r)return null;try{let i=(await iR(e)).revocation_endpoint??`${e}/api/auth/oauth2/revoke`;return(await fetch(i,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({client_id:n.client_id,token:r,token_type_hint:t?.refresh_token?`refresh_token`:`access_token`})})).status}catch{return-1}}async function _R(e){let t=GL(e),n=window.open(qL(e),`manufact-sign-out`,`width=420,height=320`);return n?new Promise(r=>{let i=!1,a=e=>{i||(i=!0,window.clearTimeout(o),window.clearInterval(c),window.removeEventListener(`message`,s),r(e))},o=window.setTimeout(()=>{a({attempted:!0,signOutOk:!1,signOutStatus:null})},3e4),s=e=>{e.origin===t&&e.data?.type===`manufact:sign-out-complete`&&a({attempted:!0,signOutOk:!0,signOutStatus:200})},c=window.setInterval(()=>{n.closed&&dR(e).then(e=>{a({attempted:!0,signOutOk:!e,signOutStatus:e?401:200})})},500);window.addEventListener(`message`,s)}):{attempted:!0,signOutOk:!1,signOutStatus:null}}async function vR(e,t){let n=UL(e),r=!!QL(JL(n,`tokens`))?.access_token;t===`oauth`||r?(await gR(n),XL(n,!0)):t===`session`&&(await _R(n),XL(n,!1)),hR(e)}function yR(e){let t=e?UL(e):null,n=(0,z.useSyncExternalStore)((0,z.useCallback)(e=>(RL.add(e),()=>RL.delete(e)),[]),(0,z.useCallback)(()=>t?VL(t):IL,[t]),()=>IL);return(0,z.useEffect)(()=>{if(!t)return;fR(t);let e=e=>{e.origin===window.location.origin&&e.data?.type===`manufact:oauth-complete`&&e.data.authOrigin===t&&fR(t).finally(()=>eR(t,{authorizing:!1}))},n=e=>{e.key!==JL(t,`tokens`)||!e.newValue||fR(t).finally(()=>eR(t,{authorizing:!1}))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,n),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,n)}},[t]),{...n,authorize:(0,z.useCallback)(async()=>{e&&await pR(e)},[e]),logout:(0,z.useCallback)(async()=>{e&&await vR(e,n.mode)},[e,n.mode])}}var bR=(0,z.lazy)(()=>tS(()=>import(`./ChatTab-Cy8eyFYI.js`).then(e=>({default:e.ChatTab})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),xR=(0,z.lazy)(()=>tS(()=>import(`./ToolsTab-DJWF7Q_x.js`).then(e=>({default:e.ToolsTab})),__vite__mapDeps([21,1,2,3,4,5,7,6,8,9,22,23,24,13,17,18,19,25,26,27,12,28,29,30]))),SR=(0,z.lazy)(()=>tS(()=>import(`./PromptsTab-DsQVOjKH.js`).then(e=>({default:e.PromptsTab})),__vite__mapDeps([31,1,2,3,4,5,7,6,8,9,25,27,12,28,29,30,16,18,20]))),CR=(0,z.lazy)(()=>tS(()=>import(`./ResourcesTab-Bw8_p6M1.js`).then(e=>({default:e.ResourcesTab})),__vite__mapDeps([32,1,2,3,4,5,8,22,7,6,9,23,24,13,17,18,19,33,25,26,27,12,28,29,14]))),wR=(0,z.lazy)(()=>tS(()=>import(`./SamplingTab-BrcF1zJF.js`).then(e=>({default:e.SamplingTab})),__vite__mapDeps([34,1,2,3,4,5,7,6,8,9,27,12,28,23,24,13,14,18]))),TR=(0,z.lazy)(()=>tS(()=>import(`./ElicitationTab-wDKgU1qL.js`).then(e=>({default:e.ElicitationTab})),__vite__mapDeps([35,1,2,3,4,5,9,27,12,28,23,15,16,18]))),ER=(0,z.lazy)(()=>tS(()=>import(`./NotificationsTab-JevzvJTg.js`).then(e=>({default:e.NotificationsTab})),__vite__mapDeps([36,1,2,3,4,5,33,26,27,12,28,29]))),DR=(0,z.lazy)(()=>tS(()=>import(`./ServerMetadataTab-Bydeh1Po.js`).then(e=>({default:e.ServerMetadataTab})),__vite__mapDeps([37,1,2,3,4,5,10,8,9,28,12,38]))),OR=(0,z.lazy)(()=>tS(()=>import(`./ConnectionSettingsTab-sDZGaUJn.js`).then(e=>({default:e.ConnectionSettingsTab})),__vite__mapDeps([39,1,2,3,4,5,28,12,38])));function kR({children:e}){return(0,R.jsx)(z.Suspense,{fallback:(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,R.jsx)(aL,{className:`size-6`})}),children:e})}var AR=`anthropic/claude-sonnet-4.6`;function jR({isManaged:e,enableFreeTierUpgrade:t,isAuthenticated:n}){return e&&t&&!n}function MR({isLoopback:e,chatApiUrl:t}){return e&&!!t}function NR(e,t,n=!1,r){let i=e.replace(/\/chat\/stream\/?$/,`/llm`);return{provider:`openai-compatible`,model:r??`anthropic/claude-sonnet-4.6`,apiKey:t??`server-managed`,baseUrl:i,...n?{credentials:`include`}:{}}}function PR(e){return e?{Authorization:`Bearer ${e}`}:void 0}var FR=`mcp-inspector:managed-model`;function IR(e){return`${FR}:${e}`}function LR(e){try{return localStorage.getItem(IR(e))}catch{return null}}function RR(e,t,n,r){let i=e?new URL(e).origin:null,[a,o]=(0,z.useState)([]),[s,c]=(0,z.useState)(AR),[l,u]=(0,z.useState)(()=>i?LR(i)??`anthropic/claude-sonnet-4.6`:AR),[d,f]=(0,z.useState)(!1),p=(0,z.useCallback)(e=>{if(u(e),i)try{localStorage.setItem(IR(i),e)}catch{}},[i]);return(0,z.useEffect)(()=>{if(!r||!i)return;let e=!1;return f(!0),(async()=>{try{let r=PR(t),a=await fetch(`${i}/api/v1/models`,{headers:r,credentials:n===`session`?`include`:`same-origin`});if(!a.ok)return;let s=await a.json();if(e)return;let l=s.models??[];o(l);let d=s.defaultModelId??`anthropic/claude-sonnet-4.6`;c(d);let f=new Set(l.map(e=>e.id)),p=LR(i);p&&f.has(p)?u(p):f.has(d)?u(d):l[0]&&u(l[0].id)}finally{e||f(!1)}})(),()=>{e=!0}},[r,i,t,n]),{models:a,selectedModelId:l,setSelectedModelId:p,isLoading:d,selectedModel:a.find(e=>e.id===l)??null,defaultModelId:s}}var zR=[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`];function BR(e){return zR.includes(e)?e:`tools`}function VR({selectedServer:e,activeTab:t,toolsSearchRef:n,promptsSearchRef:r,resourcesSearchRef:i,onUpdateConnection:a,children:o}){let{embeddedConfig:s}=fL(),c=BR(t),[l,u]=(0,z.useState)(()=>new Set([c]));(0,z.useEffect)(()=>{let e=BR(t);u(t=>t.has(e)?t:new Set(t).add(e))},[t]);let{accessToken:d,mode:f,user:p}=yR(s.chatApiUrl),m=PR(d),h=f===`session`?`include`:void 0,g=p!=null,_=s.chatApiUrl,v=!!e?.url&&oM(e.url),y=e?MR({isLoopback:v,chatApiUrl:s.chatApiUrl,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade}):!1,b=RR(_,d,f,!!e&&!!_&&g),x=y?NR(_,d,f===`session`,g?b.selectedModelId:void 0):s.managedLlmConfig??(_&&!v?{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`}:void 0);if(!e&&s.forceConnected)return s.chatApiUrl?(0,R.jsx)(kR,{children:(0,R.jsx)(bR,{connection:{id:`force-connected`,url:``,displayName:``,name:``,state:`ready`,tools:[],prompts:[],resources:[]},isConnected:!0,prompts:[],serverId:`force-connected`,callPrompt:async()=>({messages:[]}),readResource:async()=>({contents:[]}),useClientSide:!1,chatApiUrl:s.chatApiUrl,extraHeaders:m,credentials:h,managedLlmConfig:s.managedLlmConfig??{provider:`anthropic`,model:`claude-haiku-4-5`,apiKey:`server-managed`},enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!0,hideServerUrl:s.chatHideServerUrl??!0,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,enableKeyboardShortcuts:!1},`chat-force-connected`)}):(0,R.jsx)(R.Fragment,{children:o});if(!e)return(0,R.jsx)(R.Fragment,{children:o});let S=e=>s.visibleTabs?s.visibleTabs.includes(e):!0,C=zR;return(0,R.jsxs)(kR,{children:[S(`tools`)&&l.has(`tools`)&&(0,R.jsx)(`div`,{style:{display:t===`tools`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(xR,{ref:n,tools:e.tools,callTool:e.callTool,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,refreshTools:e.refreshTools},`tools-${e.id}`)}),S(`prompts`)&&l.has(`prompts`)&&(0,R.jsx)(`div`,{style:{display:t===`prompts`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(SR,{ref:r,prompts:e.prompts,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),serverId:e.id,isConnected:e.state===`ready`,refreshPrompts:e.refreshPrompts},`prompts-${e.id}`)}),S(`resources`)&&l.has(`resources`)&&(0,R.jsx)(`div`,{style:{display:t===`resources`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(CR,{ref:i,resources:e.resources,readResource:e.readResource,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url||``,refreshResources:e.refreshResources},`resources-${e.id}`)}),S(`chat`)&&l.has(`chat`)&&(0,R.jsx)(`div`,{style:{display:t===`chat`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(bR,{connection:e,isConnected:s.forceConnected||e.state===`ready`,prompts:e.prompts,serverId:e.id,callPrompt:(t,n)=>e.getPrompt(t,n?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,typeof t==`string`?t:String(t??``)])):void 0),readResource:e.readResource,useClientSide:y||!_,chatApiUrl:_,extraHeaders:m,credentials:s.chatCredentials??h,managedLlmConfig:x,managedCloudModel:b,enableFreeTierUpgrade:s.chatEnableFreeTierUpgrade,hideTitle:s.chatHideTitle,hideModelBadge:s.chatHideModelBadge??!1,hideServerUrl:s.chatHideServerUrl??!!_,clearButtonLabel:s.chatClearButtonLabel,clearButtonHideIcon:s.chatClearButtonHideIcon,clearButtonHideShortcut:s.chatClearButtonHideShortcut,clearButtonVariant:s.chatClearButtonVariant,chatQuickQuestions:s.chatQuickQuestions,chatFollowups:s.chatFollowups,hideClearButton:s.chatHideClearButton,hideToolSelector:s.chatHideToolSelector,streamProtocol:s.chatStreamProtocol,managedKeyUnavailable:v&&!_&&!y},`chat-${e.id}`)}),S(`sampling`)&&l.has(`sampling`)&&(0,R.jsx)(`div`,{style:{display:t===`sampling`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(wR,{pendingRequests:e.pendingSamplingRequests,onApprove:e.approveSampling,onReject:e.rejectSampling,serverId:e.id,isConnected:e.state===`ready`,mcpServerUrl:e.url??``},`sampling-${e.id}`)}),S(`elicitation`)&&l.has(`elicitation`)&&(0,R.jsx)(`div`,{style:{display:t===`elicitation`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(TR,{pendingRequests:e.pendingElicitationRequests,onApprove:e.approveElicitation,onReject:e.rejectElicitation,serverId:e.id,isConnected:e.state===`ready`},`elicitation-${e.id}`)}),S(`notifications`)&&l.has(`notifications`)&&(0,R.jsx)(`div`,{style:{display:t===`notifications`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(ER,{notifications:e.notifications,unreadCount:e.unreadNotificationCount,markNotificationRead:e.markNotificationRead,markAllNotificationsRead:e.markAllNotificationsRead,clearNotifications:e.clearNotifications,serverId:e.id,isConnected:e.state===`ready`},`notifications-${e.id}`)}),S(`server-metadata`)&&l.has(`server-metadata`)&&(0,R.jsx)(`div`,{style:{display:t===`server-metadata`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(DR,{connection:e},`server-metadata-${e.id}`)}),S(`connection-settings`)&&l.has(`connection-settings`)&&a&&(0,R.jsx)(`div`,{style:{display:t===`connection-settings`?`block`:`none`},className:`h-full`,children:(0,R.jsx)(OR,{connection:e,onSave:a},`connection-settings-${e.id}`)}),!C.includes(t)&&(0,R.jsx)(R.Fragment,{children:o})]})}var HR=z.createContext(void 0);function UR(){let e=z.use(HR);if(!e)throw Error(`useTabs must be used within a TabsProvider`);return e}var WR=z.createContext(void 0);function GR(){return z.use(WR)}function KR({ref:e,children:t,defaultValue:n,value:r,onValueChange:i,className:a,collapsed:o,onCollapsedChange:s,...c}){let[l,u]=z.useState(n||``),d=r!==void 0,f=o!==void 0,[p,m]=z.useState(!1),h=z.useCallback(e=>{d||u(e),i?.(e)},[d,i]);return(0,R.jsx)(HR,{value:{activeValue:d?r:l,handleValueChange:h,collapsed:f?o:p,handleCollapsedChange:z.useCallback(e=>{f||m(e),s?.(e)},[f,s])},children:(0,R.jsx)(`div`,{ref:e,className:A(`flex flex-col gap-2`,a),...c,children:t})})}KR.displayName=`Tabs`;function qR({ref:e,children:t,className:n,variant:r=`default`,collapsible:i=!1,...a}){let{activeValue:o,collapsed:s,handleCollapsedChange:c}=UR(),[l,u]=z.useState({width:0,left:0}),d=z.useRef(null),f=z.useRef(null),p=z.useRef(null),m=z.useCallback(()=>{let e=d.current;if(!e)return;let t=e.querySelector(`div:first-child`);if(!t)return;let n=t.querySelector(`button[data-tab-value="${o}"]`);if(n&&o){let e=t.getBoundingClientRect(),r=n.getBoundingClientRect();u({width:r.width,left:r.left-e.left})}else u({width:0,left:0})},[o]),h=z.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(m,16)},[m]);z.useEffect(()=>{let e=setTimeout(m,10);return()=>clearTimeout(e)},[m,s]),z.useEffect(()=>{let e=d.current;if(!e)return;f.current=new ResizeObserver(()=>{h()}),f.current.observe(e);let t=e.querySelector(`div:first-child`);return t&&t.querySelectorAll(`button[data-tab-value]`).forEach(e=>{f.current&&f.current.observe(e)}),()=>{f.current&&f.current.disconnect(),p.current&&clearTimeout(p.current)}},[h]),z.useEffect(()=>{let e=()=>{h()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]);let g=z.useRef(null);return z.useEffect(()=>{g.current&&(g.current.style.width=`${l.width}px`,g.current.style.left=`${l.left}px`)},[l]),(0,R.jsx)(WR,{value:{variant:r,collapsed:s,handleCollapsedChange:c},children:(0,R.jsx)(`div`,{ref:d,className:A(`relative flex items-center bg-none gap-1`,r==="default"&&`p-1 rounded-full border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`border-b border-zinc-200 dark:border-zinc-700`,n),...a,children:(0,R.jsxs)(`div`,{role:`tablist`,className:`flex-1 flex items-center relative`,children:[t,(0,R.jsx)(`span`,{ref:g,className:A(`absolute transition-all duration-[250ms] ease-in-out z-0`,r==="default"&&`bg-white dark:bg-zinc-700 rounded-full h-[calc(100%)] top-0 border border-zinc-300 dark:border-zinc-600`,r===`underline`&&`bottom-0 h-0.5 bg-black dark:bg-white`)})]})})})}qR.displayName=`TabsList`;var JR=({children:e,title:t,collapsed:n})=>!t||!n?e:(0,R.jsx)(nt,{children:(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`span`,{className:`contents`,children:e}),nativeButton:!1}),(0,R.jsx)(Et,{children:t})]})}),YR=z.forwardRef(({children:e,value:t,className:n,disabled:r,icon:i,title:a,showDot:o=!1,alwaysExpanded:s=!1,badge:c,...l},u)=>{let{activeValue:d,handleValueChange:f,collapsed:p}=UR(),m=GR()?.variant||`default`,h=d===t,g=!p||h||s;return(0,R.jsx)(JR,{title:a,collapsed:p&&!g,children:(0,R.jsxs)(`button`,{ref:u,disabled:r,onClick:()=>f(t),"data-tab-value":t,"data-tab-active":h,role:`tab`,"aria-selected":h?`true`:`false`,title:p&&!g&&a?a:void 0,className:A(`relative z-10 flex-1 inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-all duration-[250ms] ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 cursor-pointer`,m==="default"&&`py-2.5`,m==="default"&&`rounded-md px-4`,m===`underline`&&`px-6 py-3 border-b-2 border-transparent`,h&&`text-foreground`,!h&&`text-muted-foreground hover:text-foreground`,n),...l,children:[i&&(0,R.jsx)(i,{className:A(`h-4 w-4 shrink-0 transition-all duration-[250ms] ease-in-out`,g&&`mr-2`,!g&&`mr-0!`)}),o&&(0,R.jsx)(`span`,{className:`absolute top-1.5 right-1.5 w-2 h-2 bg-orange-500 dark:bg-orange-400 border-2 border-white dark:border-zinc-900 rounded-full transition-opacity duration-300 z-10 animate-status-pulse-orange`}),(0,R.jsx)(`span`,{className:A(`min-w-0 transition-all duration-[250ms] ease-in-out overflow-hidden`,g?`w-auto opacity-100`:`w-0 opacity-0`),children:e}),c]})})});YR.displayName=`TabsTrigger`;function XR(e){return yR(e)}var ZR=z.createContext(void 0);function QR(){let e=z.useContext(ZR);if(e===void 0)throw Error(Ve(13));return e}var $R={imageLoadingStatus:()=>null},ez=z.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,[o,s]=z.useState(`idle`),c={imageLoadingStatus:o},l=z.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=We(`span`,e,{state:c,ref:t,props:a,stateAttributesMapping:$R});return(0,R.jsx)(ZR.Provider,{value:l,children:u})});function tz(e,{referrerPolicy:t,crossOrigin:n,sizes:r,srcSet:i}){let[a,o]=z.useState(`idle`);return be(()=>{if(!e&&!i)return o(`error`),mt;let a=!0,s=new window.Image,c=e=>()=>{a&&o(e)};return o(`loading`),s.onload=c(`loaded`),s.onerror=c(`error`),t&&(s.referrerPolicy=t),s.crossOrigin=n??null,r&&(s.sizes=r),i&&(s.srcset=i),e&&(s.src=e),s.complete&&o(s.naturalWidth>0?`loaded`:`error`),()=>{a=!1}},[e,i,r,n,t]),a}var nz={...$R,...bt},rz=z.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:i,style:a,...o}=e,{setImageLoadingStatus:s}=QR(),c=tz(o.src,o),l=c===`loaded`,{mounted:u,transitionStatus:d,setMounted:f}=lt(l),p=z.useRef(null),h=m(e=>{i?.(e),s(e)});be(()=>{c!==`idle`&&h(c)},[c,h]),be(()=>()=>s(`idle`),[s]),x({open:l,ref:p,onComplete(){l||f(!1)}});let g=We(`img`,e,{state:{imageLoadingStatus:c,transitionStatus:d},ref:[t,p],props:o,stateAttributesMapping:nz,enabled:u});return u?g:null}),iz=z.forwardRef(function(e,t){let{className:n,render:r,delay:i,style:a,...o}=e,{imageLoadingStatus:s}=QR(),[c,l]=z.useState(i===void 0),u=Se();return z.useEffect(()=>(i===void 0?l(!0):u.start(i,()=>l(!0)),u.clear),[u,i]),We(`span`,e,{state:{imageLoadingStatus:s},ref:t,props:o,stateAttributesMapping:$R,enabled:s!==`loaded`&&(i===void 0||c)})});function az({className:e,size:t=`default`,...n}){return(0,R.jsx)(ez,{"data-slot":`avatar`,"data-size":t,className:A(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function oz({className:e,...t}){return(0,R.jsx)(rz,{"data-slot":`avatar-image`,className:A(`aspect-square size-full rounded-full object-cover`,e),...t})}function sz({className:e,...t}){return(0,R.jsx)(iz,{"data-slot":`avatar-fallback`,className:A(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function cz(e,t){return e?.[0]?e[0].toUpperCase():t?.[0]?t[0].toUpperCase():`U`}function lz({chatApiUrl:e,dashboardUrl:t=`https://manufact.com/cloud`,fallback:n=null,onUserResolved:r}){let{user:i,loaded:a,authorizing:o,authorize:s,logout:c,mode:l}=XR(e),u=(0,z.useRef)(void 0);if((0,z.useEffect)(()=>{if(!a)return;let e=i?.id??null;u.current!==e&&(u.current=e,r?.(i))},[a,i,r]),!a)return null;if(!i)return(0,R.jsxs)(R.Fragment,{children:[n,(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`rounded-full px-4 text-[13px]`,disabled:o,onClick:()=>{s().catch(e=>GF.error(e instanceof Error?e.message:`Authorization failed`))},children:o?`Authorizing…`:`Sign in`})]});let d=cz(i.name,i.email),f=i.name??i.email??`User`;return(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,R.jsx)(jt,{variant:`ghost`,className:`relative h-8 w-8 shrink-0 rounded-full p-0 mr-2`,"aria-label":`User menu`,children:(0,R.jsxs)(az,{className:`h-8 w-8 border border-zinc-300 dark:border-zinc-600`,children:[(0,R.jsx)(oz,{src:i.image??``,alt:f}),(0,R.jsx)(sz,{className:`text-sm`,children:d})]})}),nativeButton:!0}),(0,R.jsxs)(Ya,{className:`w-56`,align:`end`,forceMount:!0,children:[(0,R.jsx)(Xa,{className:`font-normal`,children:(0,R.jsxs)(`div`,{className:`flex flex-col space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium leading-none truncate`,children:f}),i.email&&i.email!==f&&(0,R.jsx)(`p`,{className:`text-xs leading-none text-muted-foreground truncate`,children:i.email})]})}),(0,R.jsx)(eo,{}),(0,R.jsx)(Za,{render:(0,R.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,children:[(0,R.jsx)(ci,{className:`mr-2 h-4 w-4`}),`Go to dashboard`]})}),(0,R.jsx)(eo,{}),(0,R.jsxs)(Za,{onClick:()=>{c().catch(()=>GF.error(`Sign out failed`))},children:[(0,R.jsx)(mi,{className:`mr-2 h-4 w-4`}),l===`session`?`Sign out of Manufact`:`Disconnect Inspector`]})]})]})}function uz({count:e,isActive:t,size:n=`md`}){return e<=0?null:(0,R.jsx)(`span`,{className:A(t?`dark:bg-black`:`dark:bg-zinc-700`,`shrink-0 ml-1 bg-zinc-200 text-zinc-700 dark:text-zinc-300 rounded-full font-medium`,n===`sm`&&`text-[10px] px-1.5 py-0.5`,n===`md`&&`text-xs px-2 py-0.5`),children:e})}var dz=`flex h-10 items-center gap-2`;function fz({serverConfig:e,additionalItems:t=[],showClients:n={cursor:!0,vsCode:!0,vsCodeInsiders:!0,claudeDesktop:!0,claudeCode:!0,geminiCli:!0,codexCli:!0},className:r=``,onSuccess:i,onError:a,trigger:o}){let[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),{url:p,name:m,headers:h}=e,g=e=>{try{ET(new Do({client:e})).catch(()=>{})}catch{}},_=()=>{g(`cursor`);try{let e=yL(p,m,h);window.location.href=e,i?.(`Cursor`)}catch(e){console.error(`Failed to generate Cursor deep link:`,e),a?.(e)}},v=()=>{g(`vscode`);try{let e=bL(p,m,h);window.location.href=e,i?.(`VS Code`)}catch(e){console.error(`Failed to generate VS Code deep link:`,e),a?.(e)}},y=()=>{g(`vscode-insiders`);try{let e=xL(p,m,h);window.location.href=e,i?.(`VS Code Insiders`)}catch(e){console.error(`Failed to generate VS Code Insiders deep link:`,e),a?.(e)}},b=()=>{g(`claude-desktop`);try{CL(p,m,h),i?.(`Claude Desktop`)}catch(e){console.error(`Failed to download .mcpb file:`,e),a?.(e)}},x=()=>{g(`claude-code`),u(`claude-code`),c(!0)},S=()=>{g(`gemini-cli`),u(`gemini-cli`),c(!0)},C=()=>{g(`codex-cli`),u(`codex-cli`),c(!0)},w=async e=>{try{await Qj(e),f(!0),setTimeout(()=>f(!1),2e3)}catch(e){console.error(`Failed to copy:`,e),a?.(e)}},T=()=>{if(l===`claude-code`){let{command:e,envVars:t}=wL(p,m,h),n=DL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(XI,{children:[(0,R.jsx)(eL,{children:`Add to Claude Code`}),(0,R.jsx)(tL,{children:`Execute the following command in your shell to add this server to Claude Code.`})]}),(0,R.jsxs)(ZI,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Claude Code executable is available in your path`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:`After installation, set these environment variables in your shell:`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`The MCP configuration supports environment variable expansion using `,(0,R.jsx)(`code`,{className:`text-foreground`,children:"${VAR}"}),` `,`syntax.`]})]})]})}if(l===`gemini-cli`){let{command:e,envVars:t}=TL(p,m,h),n=DL(t);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(XI,{children:[(0,R.jsx)(eL,{children:`Add to Gemini CLI`}),(0,R.jsx)(tL,{children:`Execute the following command in your shell to add this server to Gemini CLI.`})]}),(0,R.jsxs)(ZI,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsx)(`span`,{children:`Ensure the Gemini CLI executable is available in your path`})]}),n&&(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsx)(`span`,{children:`Set these environment variables in your shell before running the command:`})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:n?`3.`:`2.`}),(0,R.jsx)(`span`,{children:`Execute the following snippet in your shell:`})]})]})]}),n&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Environment Variables`}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:n})})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Gemini CLI to load the new configuration.`})]})]})}if(l===`codex-cli`){let{config:e,envVars:t}=EL(p,m,h);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(XI,{children:[(0,R.jsx)(eL,{children:`Add to Codex CLI`}),(0,R.jsxs)(tL,{children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),` `,`file.`]})]}),(0,R.jsxs)(ZI,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Instructions`}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Add this configuration to your`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`~/.codex/config.toml`}),`:`]})]}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`h-7 px-2 bg-background hover:bg-accent border border-border`,onClick:()=>w(e),children:d?(0,R.jsx)(Fr,{className:`size-3.5 text-green-600`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}),(0,R.jsx)(`pre`,{className:`bg-muted p-3 pr-14 rounded-md text-xs overflow-x-auto`,children:(0,R.jsx)(`code`,{children:e})})]}),t.length>0&&(0,R.jsx)(`div`,{children:(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`(optional) If you would rather use variables from your system's environment, replace the`,` `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`http_headers`}),` key with the `,(0,R.jsx)(`code`,{className:`text-foreground`,children:`env_http_headers`}),` `,`key as shown in the commented section above.`]})}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Restart Codex CLI to load the new configuration.`})]})]})}return null},ee=(0,R.jsxs)(jt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center ${r}`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(ki,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]}),E=o?typeof o==`function`?o({isOpen:!1,onClick:()=>{}}):o:ee;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,z.isValidElement)(E)?E:ee,nativeButton:!0}),(0,R.jsxs)(Ya,{align:`end`,className:`w-auto min-w-[300px]`,children:[t.map(e=>(0,R.jsxs)(Za,{onClick:async()=>{await e.onClick()},className:dz,children:[e.icon,(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:e.label})]},e.id)),t.length>0&&(0,R.jsx)(eo,{}),n.cursor&&(0,R.jsxs)(Za,{onClick:_,className:dz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/cursor`,alt:`Cursor`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Cursor`})]}),n.claudeCode&&(0,R.jsxs)(Za,{onClick:x,className:dz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Code`})]}),n.claudeDesktop&&(0,R.jsxs)(Za,{onClick:b,className:dz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/claude`,alt:`Claude`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Claude Desktop`})]}),n.vsCode&&(0,R.jsxs)(Za,{onClick:v,className:dz,children:[(0,R.jsx)(kL,{className:`h-4 w-4 text-blue-500`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code`})]}),n.vsCodeInsiders&&(0,R.jsxs)(Za,{onClick:y,className:dz,children:[(0,R.jsx)(kL,{className:`h-4 w-4 text-teal-400`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`VS Code Insiders`})]}),n.geminiCli&&(0,R.jsxs)(Za,{onClick:S,className:dz,children:[(0,R.jsx)(`img`,{src:`https://cdn.simpleicons.org/googlegemini`,alt:`Gemini`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Gemini CLI`})]}),n.codexCli&&(0,R.jsxs)(Za,{onClick:C,className:dz,children:[(0,R.jsx)(`img`,{src:`https://inspector-cdn.mcp-use.com/providers/openai.png`,alt:`Codex`,className:`h-4 w-4`}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-full whitespace-nowrap`,children:`Codex CLI`})]})]})]}),(0,R.jsx)(qI,{open:s,onOpenChange:c,children:(0,R.jsx)(YI,{scrollable:!0,className:`max-w-3xl max-h-[80vh]`,children:T()})})]})}function pz({className:e,state:t=`collapsed`,to:n=`/`,showLabel:r=t===`expanded`,pinSymbolInIconColumn:i=!1,size:a}){let[o,s]=(0,z.useState)(!1),c=1.5,l=.2/c,u=.8999999999999999/c,d=t===`expanded`&&r,f=a??(i?20:t===`expanded`?40:20),p=(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(qe.svg,{viewBox:`0 0 500 500`,initial:`rest`,animate:o?`hover`:`rest`,className:`text-foreground`,style:{width:f,height:f},children:[(0,R.jsxs)(qe.g,{variants:{rest:{opacity:1},hover:{opacity:[1,0,0,1],transition:{duration:c,times:[0,l,u,1],ease:`easeInOut`}}},fill:`currentColor`,fillRule:`nonzero`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`}),(0,R.jsx)(`circle`,{cx:`100.426`,cy:`399.575`,r:`100.426`}),(0,R.jsx)(`path`,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`})]}),(0,R.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:4,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(mz,{d:`M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z`,times:{T0:0,T1:l,T2:u,T3:1},total:c}),(0,R.jsx)(hz,{cx:100.426,cy:399.575,r:100.426,times:{T0:0,T1:l,T2:u,T3:1},total:c}),(0,R.jsx)(mz,{d:`M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z`,times:{T0:0,T1:l,T2:u,T3:1},total:c})]})]})}),m=r?(0,R.jsxs)(`span`,{className:A(`font-ubuntu flex items-center gap-2 whitespace-nowrap`,i?A(`pl-(--sidebar-nav-text-pl-absolute)`,d?`relative opacity-100 blur-0`:`pointer-events-none absolute left-0 top-1/2 w-0 -translate-y-1/2 overflow-hidden opacity-0 blur-[3px]`):`mr-3`),children:[(0,R.jsx)(`span`,{className:`text-xl font-bold leading-none text-foreground [text-box:trim-both_cap_alphabetic]`,children:`mcp-use`}),(0,R.jsx)(`span`,{className:`text-lg font-sans font-light leading-none tracking-wide text-muted-foreground [text-box:trim-both_cap_alphabetic]`,children:`Inspector`})]}):null,h=i?(0,R.jsxs)(`div`,{className:A(`relative flex shrink-0 items-center`,d?`min-w-(--sidebar-width-icon)`:`w-(--sidebar-width-icon)`),children:[(0,R.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex w-(--sidebar-width-icon) items-center justify-center`,children:(0,R.jsx)(`div`,{className:`pointer-events-auto`,children:p})}),m]}):(0,R.jsxs)(R.Fragment,{children:[p,m]});return(0,R.jsx)(fF,{to:n,className:A(`flex items-center transition-opacity`,!i&&`-my-3`,e),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:h})}function mz({d:e,times:t,total:n}){let{T0:r,T1:i,T2:a,T3:o}=t;return(0,R.jsx)(qe.path,{d:e,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:n,times:[r,i,a,o],ease:`easeInOut`}}}})}function hz({cx:e,cy:t,r:n,times:r,total:i}){let{T0:a,T1:o,T2:s,T3:c}=r;return(0,R.jsx)(qe.circle,{cx:e,cy:t,r:n,variants:{rest:{pathLength:0,opacity:0},hover:{pathLength:[0,0,1,1],opacity:[0,0,1,1],transition:{duration:i,times:[a,o,s,c],ease:`easeInOut`}}}})}var gz=(0,z.createContext)(void 0);function _z(){let e=(0,z.use)(gz);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function vz({children:e,defaultTheme:t=`system`,storageKey:n=`theme`,forcedTheme:r}){let[i,a]=(0,z.useState)(r||t),[o,s]=(0,z.useState)(!1),c=()=>typeof window>`u`?`light`:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,l=i===`system`?c():i,u=e=>{let t=document.documentElement,i=e===`system`?c():e;t.classList.remove(`light`,`dark`),t.classList.add(i),r||localStorage.setItem(n,e)};return(0,z.useEffect)(()=>{s(!0);let e=localStorage.getItem(n),i=r||e||t;a(i),u(i)},[t,n,r]),(0,z.useEffect)(()=>{if(i!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{u(`system`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[i]),(0,z.useEffect)(()=>{o&&u(i)},[i,o]),(0,R.jsx)(gz,{value:{theme:i,setTheme:e=>{if(r){console.warn(`[ThemeProvider] Theme is forced via URL parameter, ignoring setTheme call`);return}a(e)},resolvedTheme:l},children:e})}function yz({ref:e,shimmerColor:t,shimmerSize:n=`0.05em`,shimmerDuration:r=`3s`,borderRadius:i=`100px`,background:a,className:o,children:s,...c}){let{theme:l}=_z();return(0,R.jsxs)(`button`,{style:{"--spread":`90deg`,"--shimmer-color":t||(l===`dark`?`#000000`:`#ffffff`),"--radius":i,"--speed":r,"--cut":n,"--bg":a||(l===`dark`?`rgba(255, 255, 255, 1)`:`rgba(0, 0, 0, 1)`)},className:A(`group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden [border-radius:var(--radius)] border px-6 py-3 whitespace-nowrap [background:var(--bg)]`,`transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px`,`dark:text-white text-black dark:border-white/10 border-black/10`,o),ref:e,...c,children:[(0,R.jsx)(`div`,{className:A(`-z-30 blur-[2px]`,`@container-[size] absolute inset-0 overflow-visible`),children:(0,R.jsx)(`div`,{className:`animate-shimmer-slide absolute inset-0 aspect-[1] h-[100cqh] rounded-none mask-none`,children:(0,R.jsx)(`div`,{className:`animate-spin-around absolute -inset-full w-auto [translate:0_0] rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))]`})})}),s,(0,R.jsx)(`div`,{className:A(`absolute inset-0 size-full`,`rounded-2xl px-4 py-1.5 text-sm font-medium`,`transform-gpu transition-all duration-300 ease-in-out`,`dark:shadow-[inset_0_-8px_10px_#0000001f] dark:group-hover:shadow-[inset_0_-6px_10px_#0000003f] dark:group-active:shadow-[inset_0_-10px_10px_#0000003f] shadow-[inset_0_-8px_10px_#ffffff1f] group-hover:shadow-[inset_0_-6px_10px_#ffffff3f] group-active:shadow-[inset_0_-10px_10px_#ffffff3f]`)}),(0,R.jsx)(`div`,{className:A(`absolute [inset:var(--cut)] -z-20 [border-radius:var(--radius)] bg-black dark:bg-white`)})]})}yz.displayName=`ShimmerButton`;function bz(e){switch(e){case`ready`:return`bg-emerald-600 animate-status-pulse`;case`failed`:return`bg-rose-600 animate-status-pulse-red`;default:return`bg-yellow-500 animate-status-pulse-yellow`}}function xz(e){switch(e){case`ready`:return`Connected`;case`failed`:return`Failed`;default:return e}}function Sz({status:e,className:t}){return(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`div`,{className:A(`w-2 h-2 rounded-full shrink-0`,bz(e),t)}),nativeButton:!1}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{children:xz(e)})})]})}var Cz=`h-6 px-2 text-xs bg-yellow-500/20 border-0 dark:bg-yellow-400/10 text-yellow-800 dark:text-yellow-500 shrink-0`;function wz(e){try{sessionStorage.setItem(sI,JSON.stringify({url:e.url,name:e.name||`Auto-connected Server`,transportType:e.transportType||`http`,connectionMode:`auto`}))}catch{}}function Tz({server:e,className:t}){let{state:n,authUrl:r,authenticate:i}=e;return n!==`pending_auth`&&n!==`authenticating`?null:n===`authenticating`?(0,R.jsxs)(jt,{size:`sm`,variant:`outline`,disabled:!0,className:A(Cz,t),children:[(0,R.jsx)(di,{className:`h-3 w-3 animate-spin mr-1`}),`Authenticating`]}):i?(0,R.jsx)(jt,{"data-testid":`server-header-authenticate`,size:`sm`,variant:`outline`,className:A(Cz,t),onClick:t=>{t.stopPropagation(),wz(e),i()},children:`Authenticate`}):r?(0,R.jsx)(jt,{size:`sm`,variant:`outline`,className:A(Cz,t),render:(0,R.jsx)(`a`,{href:r,"data-testid":`server-header-authenticate`,onClick:t=>{t.stopPropagation(),wz(e)}}),nativeButton:!1,children:`Authenticate`}):null}function Ez({connections:e,selectedServer:t,onServerSelect:n,mobileMode:r=!1,variant:i=`default`}){let a=KN(),o=t=>{e.some(e=>e.id===t)&&n(t)},s=(0,R.jsxs)(Ya,{className:`w-[calc(100vw-2rem)] sm:w-[300px]`,align:`start`,children:[(0,R.jsx)(Xa,{className:`cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-800`,onClick:()=>a(`/`),children:`MCP Servers`}),(0,R.jsx)(eo,{}),e.length===0?(0,R.jsx)(`div`,{className:`px-2 py-4 text-sm text-muted-foreground dark:text-zinc-400 text-center`,children:`No servers connected. Go to the dashboard to add one.`}):e.map(e=>(0,R.jsxs)(Za,{onClick:()=>o(e.id),className:`flex items-center gap-3`,children:[(0,R.jsx)(oL,{server:e,size:`sm`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`div`,{className:`font-medium`,children:lM(e)}),(0,R.jsx)(Sz,{status:e.state})]})]},e.id)),(0,R.jsx)(eo,{}),(0,R.jsx)(Za,{onClick:()=>a(`/`),children:(0,R.jsx)(`span`,{className:`text-blue-600 dark:text-blue-400`,children:`+ Add new server`})})]});return r?(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,R.jsxs)(jt,{variant:`ghost`,className:`h-11 px-2 bg-black dark:bg-white text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200 flex items-center gap-1.5`,children:[t?(0,R.jsx)(oL,{server:t,size:`md`}):(0,R.jsx)(Ni,{className:`h-5 w-5`}),(0,R.jsx)(Ir,{className:`h-4 w-4`})]}),nativeButton:!0}),s]})})}):i===`header`?(0,R.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,R.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-2 min-w-0 border-0 bg-transparent p-0 cursor-pointer text-foreground transition-opacity hover:opacity-80`,children:[t&&(0,R.jsx)(oL,{server:t,size:`sm`,className:`!size-5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate text-sm leading-none [text-box:trim-both_cap_alphabetic]`,children:t?lM(t):`Select server`}),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Sz,{status:t.state}),(0,R.jsx)(Tz,{server:t})]}),(0,R.jsx)(Ir,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),nativeButton:!0}),s]})}):(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsx)(`div`,{className:`relative`,children:(0,R.jsxs)(qa,{children:[(0,R.jsx)(Ja,{render:(0,R.jsxs)(yz,{className:A(`min-w-0 sm:min-w-[200px] p-0 px-1 text-sm h-11 justify-start text-white dark:text-black border-black dark:border-white hover:bg-gray-800 dark:hover:bg-zinc-100 hover:border-gray-800 dark:hover:border-zinc-200`,!t&&`pl-4`),children:[t&&(0,R.jsx)(oL,{server:t,size:`md`,className:`mr-2`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-1`,children:[(0,R.jsx)(`span`,{className:`truncate lg:max-w-[120px] xl:max-w-none`,children:t?lM(t):`Select server to inspect`}),t&&(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:t.error&&t.state!==`ready`?(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`button`,{onClick:e=>{e.stopPropagation()},className:`w-2 h-2 rounded-full bg-rose-500 animate-status-pulse-red hover:bg-rose-600 transition-colors`,title:`Click to copy error message`,"aria-label":`Copy error message to clipboard`}),nativeButton:!0}),(0,R.jsx)(Et,{children:(0,R.jsx)(`p`,{className:`max-w-xs`,children:t.error})})]}):(0,R.jsx)(`div`,{className:`w-2 h-2 rounded-full ${t.state===`ready`?`bg-emerald-600 animate-status-pulse`:t.state===`failed`?`bg-rose-600 animate-status-pulse-red`:`bg-yellow-500 animate-status-pulse-yellow`}`})})]})]}),nativeButton:!0}),s]})})})}function Dz(e){if(!e)return null;try{let t=new URL(e);if(t.protocol===`https:`)return t.origin}catch{}return null}function Oz(e,t){return e===`tools`?t.tools.length:e===`prompts`?t.prompts.length:e===`resources`?t.resources.length:e===`sampling`?t.pendingSamplingRequests?.length||0:e===`elicitation`?t.pendingElicitationRequests?.length||0:e===`notifications`?t.unreadNotificationCount:0}function kz(e,t,n){return n&&t>0&&[`sampling`,`elicitation`,`notifications`].includes(e)}var Az=[{id:`server-metadata`,label:`Server Metadata`,icon:si},{id:`separator`},{id:`chat`,label:`Chat`,icon:_i,alwaysExpanded:!0},{id:`separator`},{id:`tools`,label:`Tools`,icon:qi},{id:`prompts`,label:`Prompts`,icon:vi},{id:`resources`,label:`Resources`,icon:$r},{id:`sampling`,label:`Sampling`,icon:ti},{id:`elicitation`,label:`Elicitation`,icon:Li},{id:`notifications`,label:`Notifications`,icon:Mr},{id:`separator`},{id:`connection-settings`,label:`Connection Settings`,icon:Pi}],jz=z.createContext(void 0);function Mz(e){let t=z.useContext(jz);if(t===void 0&&!e)throw Error(Ve(47));return t}function Nz(){return{...kt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Pz={...ze,disabled:Vt(e=>e.disabled),instantType:Vt(e=>e.instantType),openMethod:Vt(e=>e.openMethod),openChangeReason:Vt(e=>e.openChangeReason),modal:Vt(e=>e.modal),focusManagerModal:Vt(e=>e.focusManagerModal),stickIfOpen:Vt(e=>e.stickIfOpen),titleElementId:Vt(e=>e.titleElementId),descriptionElementId:Vt(e=>e.descriptionElementId),openOnHover:Vt(e=>e.openOnHover),closeDelay:Vt(e=>e.closeDelay),hasViewport:Vt(e=>e.hasViewport)},Fz=class e extends Kt{constructor(e,t,n=!1){let r={...Nz(),...e},i=new xt;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=at(i,t,n),super(r,{popupRef:z.createRef(),backdropRef:z.createRef(),internalBackdropRef:z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:z.createRef(),beforeContentFocusGuardRef:z.createRef(),stickIfOpenTimeout:new zt,triggerElements:i},Pz)}setOpen=(e,t)=>{let n=t.reason===c,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Ue(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};Ft(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),br.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=Qe(t,(t,r)=>new e(n,t,r));return z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Iz({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Fz.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Ye(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=st()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),tt(u,d),Ge(u);let{forceUnmount:h}=Ct(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=z.useCallback(()=>{u.setOpen(!1,ae(De))},[u]);z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,v=z.useMemo(()=>({store:u}),[u]);return(0,R.jsxs)(jz.Provider,{value:v,children:[_&&(0,R.jsx)(Rz,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Lz(e){return Mz(!0)?(0,R.jsx)(Iz,{props:e}):(0,R.jsx)(dt,{children:(0,R.jsx)(Iz,{props:e})})}function Rz({store:e,modal:t}){let n=y(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return ht(e,{activeTriggerProps:n.reference??St,inactiveTriggerProps:n.trigger??St,popupProps:z.useMemo(()=>Ut(Mt,n.floating),[n.floating])}),null}var zz=z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:c,payload:l,openOnHover:u=!1,delay:d=300,closeDelay:f=0,id:p,...m}=e,h=Mz(!0),g=c?.store??h?.store;if(!g)throw Error(Ve(74));let _=N(p),v=g.useState(`isTriggerActive`,_),y=g.useState(`floatingRootContext`),b=g.useState(`isOpenedByTrigger`,_),x=g.useState(`triggerPopupId`,_),S=z.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Fe(_,S,g,{payload:l,disabled:a,openOnHover:u,closeDelay:f}),T=g.useState(`openChangeReason`),ee=g.useState(`stickIfOpen`),E=g.useState(`openMethod`),D=g.useState(`focusManagerModal`),ne=s(y,{enabled:!a&&y!=null&&u&&(E!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:he(),restMs:d,delay:{close:f},triggerElementRef:S,isActiveTrigger:v,isClosing:()=>g.select(`transitionStatus`)===`ending`}),O=Sn(y,{enabled:y!=null,stickIfOpen:ee}),re=dn(()=>g.select(`open`),e=>{g.set(`openMethod`,e)}),k=g.useState(`triggerProps`,w),{getButtonProps:ie,buttonRef:A}=Pe({disabled:a,native:o}),j={open(e){return e&&T===`trigger-press`?it.open(e):Re.open(e)}},{preFocusGuardRef:M,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:oe}=xr(g,S),se=We(`button`,e,{state:{disabled:a,open:b},ref:[A,t,C,S],props:[O.reference,ne,k,re,{[te]:``,id:_,"aria-haspopup":`dialog`,"aria-expanded":b,"aria-controls":x},m,ie],stateAttributesMapping:j});return w&&!D?(0,R.jsxs)(z.Fragment,{children:[(0,R.jsx)(Dt,{ref:M,onFocus:ae}),(0,R.jsx)(z.Fragment,{children:se},_),(0,R.jsx)(Dt,{ref:g.context.triggerFocusTargetRef,onFocus:oe})]}):(0,R.jsx)(z.Fragment,{children:se},_)}),Bz=z.createContext(void 0);function Vz(){let e=z.useContext(Bz);if(e===void 0)throw Error(Ve(45));return e}var Hz=z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Mz();return i.useState(`mounted`)||n?(0,R.jsx)(Bz.Provider,{value:n,children:(0,R.jsx)(me,{ref:t,...r})}):null}),Uz=z.createContext(void 0);function Wz(){let e=z.useContext(Uz);if(!e)throw Error(Ve(46));return e}var Gz=z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=ve,...y}=e,{store:b}=Mz(),x=Vz(),S=d(),C=b.useState(`floatingRootContext`),w=b.useState(`mounted`),T=b.useState(`open`),ee=b.useState(`openChangeReason`),E=b.useState(`activeTriggerElement`),D=b.useState(`modal`),te=b.useState(`openMethod`),O=b.useState(`positionerElement`),re=b.useState(`instantType`),k=b.useState(`transitionStatus`),ie=b.useState(`hasViewport`),A=z.useRef(null),j=_(O,!1,!1),M=ne({anchor:a,floatingRootContext:C,positionMethod:o,mounted:w,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:h,disableAnchorTracking:g,keepMounted:x,nodeId:S,collisionAvoidance:v,adaptiveOrigin:ie?ke:void 0}),ae=C.useState(`domReferenceElement`);be(()=>{let e=ae,t=A.current;if(e&&(A.current=e),t&&e&&e!==t){b.set(`instantType`,void 0);let e=new AbortController;return j(()=>{b.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[ae,j,b]),an(T&&D===!0&&ee!==`trigger-hover`,te===`touch`,O,E);let oe=z.useCallback(e=>{b.set(`positionerElement`,e)},[b]),se=wt(e,{open:T,side:M.side,align:M.align,anchorHidden:M.anchorHidden,instant:re},{styles:M.positionerStyles,transitionStatus:k,props:y,refs:[t,oe],hidden:!w,inert:!T});return(0,R.jsxs)(Uz.Provider,{value:M,children:[w&&D===!0&&ee!==`trigger-hover`&&(0,R.jsx)(wn,{ref:b.context.internalBackdropRef,inert:sn(!T),cutout:E}),(0,R.jsx)(ue,{id:S,children:se})]})}),Kz=z.createContext(void 0);function qz(){let[e,t]=z.useState(0),n=m(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Jz(e){let{value:t,children:n}=e;return(0,R.jsx)(Kz.Provider,{value:t,children:n})}var Yz={...Ot,...bt},Xz=z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,{store:c}=Mz(),l=Wz(),u=Cn(!0)!=null,{context:d,hasClosePart:f}=qz(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),ee=T.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),te=c.useState(`closeDelay`),ne=s.id??ee;x({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),Ke(T,{enabled:D&&!E,closeDelay:te});let O=a===void 0?ft(c.context.popupRef):a,re=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,re);let k=z.useCallback(e=>{c.set(`popupElement`,e)},[c]),ie=We(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,k],props:[_,{id:ne,role:`dialog`,...Mt,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Qt.has(e.key)&&e.stopPropagation()}},je(g),s],stateAttributesMapping:Yz});return(0,R.jsx)(rn,{context:T,openInteractionType:m,modal:re,disabled:!S||C===`trigger-hover`,initialFocus:O,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:ut(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,R.jsx)(Jz,{value:d,children:ie})})});function Zz({...e}){return(0,R.jsx)(Lz,{"data-slot":`popover`,...e})}function Qz(e){return(0,R.jsx)(zz,{"data-slot":`popover-trigger`,...e})}function $z({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,R.jsx)(Hz,{children:(0,R.jsx)(Gz,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,R.jsx)(Xz,{"data-slot":`popover-content`,className:A(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}var eB={success:`border-emerald-700/20 bg-emerald-700/10 text-emerald-700 dark:border-emerald-400/30 dark:bg-emerald-400/10 dark:text-emerald-400`,failed:`border-red-500/20 bg-red-500/10 text-red-500 dark:border-red-400/30 dark:bg-red-400/10 dark:text-red-400`,warning:`border-amber-700/20 bg-amber-700/10 text-amber-700 dark:border-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400`,loading:`border-purple-500/20 bg-purple-500/10 text-purple-500 dark:border-purple-400/30 dark:bg-purple-400/10 dark:text-purple-400 animate-spin`},tB=`size-4 shrink-0 rounded-full border p-0.5`;function nB({state:e,className:t}){let n=A(tB,eB[e],t);switch(e){case`success`:return(0,R.jsx)(Fr,{className:n,"aria-hidden":!0});case`failed`:return(0,R.jsx)(zr,{className:n,"aria-hidden":!0});case`warning`:return(0,R.jsx)(Wi,{className:n,"aria-hidden":!0});case`loading`:return(0,R.jsx)(di,{className:n,"aria-hidden":!0});default:return null}}function rB(){return`text-emerald-700 dark:text-emerald-400`}function iB({onStop:e,showCopiedBanner:t=!1}){return(0,R.jsxs)(R.Fragment,{children:[t&&(0,R.jsxs)(`div`,{className:A(`flex items-center gap-2 text-sm -mt-1`,rB()),children:[(0,R.jsx)(nB,{state:`success`}),(0,R.jsx)(`span`,{children:`URL copied to clipboard`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h4`,{className:`font-semibold text-sm`,children:`Tunnel URL`}),(0,R.jsxs)(`a`,{href:`https://manufact.com/docs/tunneling`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Docs`,(0,R.jsx)(Ar,{className:`size-3`})]})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h5`,{className:`font-semibold text-sm mb-2`,children:`Use in ChatGPT & Claude`}),(0,R.jsxs)(`ol`,{className:`space-y-2 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`1.`}),(0,R.jsxs)(`span`,{children:[`Enable`,` `,(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Security`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`dev mode`}),` `,`from settings`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`2.`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`a`,{href:`https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline underline-offset-2 hover:text-purple-600 dark:hover:text-purple-400`,children:`Add a connector`}),` `,`in App & Connectors`]})]}),(0,R.jsxs)(`li`,{className:`flex gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-foreground`,children:`3.`}),(0,R.jsx)(`span`,{children:`Use the tunnel URL in the input`})]})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void e(),className:`flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors cursor-pointer`,children:[(0,R.jsx)(zi,{className:`size-3 fill-current`}),`Stop Tunnel`]})]})}function aB(e){try{let t=new URL(e),n=t.pathname+t.search;return t.host+(n&&n!==`/`?n:``)}catch{return e}}function oB({copied:e,onCopy:t,className:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),t()},"aria-label":e?`URL copied`:`Copy URL`,className:A(`shrink-0 p-0.5 rounded-sm text-muted-foreground hover:text-foreground transition-opacity opacity-0 group-hover:opacity-100`,n),children:e?(0,R.jsx)(nB,{state:`success`,className:`size-3.5`}):(0,R.jsx)(Wr,{className:`size-3.5`})})}function sB({url:e,className:t,tunnelPopover:n}){let[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1);if(!e)return null;let s=aB(e),c=n?.mcpUrl??e,l=!!n,u=async()=>{try{await Qj(c),i(!0),setTimeout(()=>i(!1),2e3)}catch{GF.error(`Failed to copy URL`)}};(0,z.useEffect)(()=>{if(!n?.autoCopyOnOpen){o(!1);return}o(!0),i(!0);let e=setTimeout(()=>i(!1),2e3);return()=>clearTimeout(e)},[n?.autoCopyOnOpen]);let d=(0,R.jsxs)(R.Fragment,{children:[l?(0,R.jsx)(Lr,{className:`size-3.5 shrink-0`}):(0,R.jsx)(ei,{className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate max-w-[min(24rem,30vw)]`,children:s})]}),f=A(`flex items-center gap-1 min-w-0 truncate text-left text-sm cursor-pointer`,l?`text-purple-600 dark:text-purple-400`:`text-blue-500`);return(0,R.jsxs)(`div`,{className:A(`group flex items-center gap-1.5 min-w-0`,t),children:[l?(0,R.jsxs)(Zz,{open:n.open,onOpenChange:n.onOpenChange,children:[(0,R.jsx)(Qz,{render:(0,R.jsx)(`button`,{type:`button`,className:A(f,`hover:opacity-80`),children:d}),nativeButton:!0}),(0,R.jsx)($z,{className:`w-[calc(100vw-2rem)] sm:w-96`,align:`start`,sideOffset:4,children:(0,R.jsx)(iB,{showCopiedBanner:a,onStop:async()=>{n.onOpenChange(!1),await n.onStop()}})})]}):(0,R.jsx)(`span`,{className:f,children:d}),(0,R.jsx)(oB,{copied:r,onCopy:()=>void u()})]})}function cB({devFromCli:e,isTunnelStarting:t,waitTicks:n,onStart:r}){if(t)return(0,R.jsxs)(`button`,{disabled:!0,className:`flex items-center gap-2 h-8 px-3 bg-violet-50 dark:bg-violet-950/40 border border-violet-200 dark:border-violet-800 rounded-full opacity-75 cursor-wait shrink-0`,children:[(0,R.jsx)(di,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}),(0,R.jsxs)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:[`Start Tunnel `,(0,R.jsxs)(`span`,{className:`tabular-nums`,children:[n,`s`]})]})]});let i=e===!0,a=e===null;return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void r(),disabled:!i||a,title:e===!1?"Run `mcp-use dev` from your project to enable tunneling.":a?`Checking dev server…`:void 0,className:A(`flex items-center gap-2 h-8 px-3 border rounded-full transition-colors shrink-0`,i&&!a?`bg-violet-50 dark:bg-violet-950/40 border-violet-200 dark:border-violet-800 hover:bg-violet-100 dark:hover:bg-violet-900/50 cursor-pointer`:`bg-violet-50/60 dark:bg-violet-950/20 border-violet-200 dark:border-violet-800 cursor-not-allowed opacity-70`),children:[a?(0,R.jsx)(di,{className:`size-4 text-violet-500 dark:text-violet-400 animate-spin`}):(0,R.jsx)(Lr,{className:`size-4 text-violet-500 dark:text-violet-400`}),(0,R.jsx)(`span`,{className:`text-sm font-medium text-violet-600 dark:text-violet-300 hidden lg:inline`,children:`Start Tunnel`})]})}async function lB(){try{let e=await fetch(iM(`dev/info`));return e.ok?await e.json():null}catch{return null}}function uB(){return typeof window>`u`?!1:window.__MCP_INSPECTOR_MODE__!==`standalone`}function dB({tunnelUrl:e,setTunnelUrl:t,isTunnelStarting:n,setIsTunnelStarting:r,onTunnelStarted:i}){let[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(0),d=(0,z.useCallback)((e,n)=>{let r=n?.syncTunnel??!1;if(o(!!e.fromCli),e.mcpUrl&&c(e.mcpUrl),!r)return;if(e.tunnelUrl){t(new URL(e.tunnelUrl).origin);return}let i=Dz(e.mcpUrl??null);if(i){t(i);return}t(null)},[t]);return(0,z.useEffect)(()=>{if(!n){u(20);return}u(20);let e=setInterval(()=>u(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[n]),(0,z.useEffect)(()=>{let e=!1;if(!uB()){o(!1);return}return(async()=>{let t=await lB();e||(t?d(t,{syncTunnel:!0}):o(!1))})(),()=>{e=!0}},[d]),{devFromCli:a,mcpUrl:s,waitTicks:l,handleStartTunnel:(0,z.useCallback)(async()=>{if(a===!1){GF.error("Start Tunnel requires `mcp-use dev` from your project directory.");return}r(!0);let e=!1;try{let t=await fetch(iM(`dev/start-tunnel`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));GF.error(e.error||`Failed to start tunnel`);return}let n=await lB();if(n?.tunnelUrl||n?.mcpUrl){d(n,{syncTunnel:!0});let e=n.mcpUrl??(n.tunnelUrl?`${n.tunnelUrl.replace(/\/+$/,``)}/mcp`:null);e&&Zj(e),i?.()}e=!0}catch{GF.error(`Failed to start tunnel`)}finally{r(!1)}try{ET(new Co({action:`start`,success:e})).catch(()=>{})}catch{}},[d,a,i,r]),handleStopTunnel:(0,z.useCallback)(async()=>{r(!0);let n=!1;try{let e=await fetch(iM(`dev/stop-tunnel`),{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));GF.error(t.error||`Failed to stop tunnel`);return}t(null),c(null),GF.success(`Tunnel stopped`),n=!0}catch{GF.error(`Failed to stop tunnel`)}finally{r(!1)}try{ET(new Co({action:`stop`,success:n,tunnelUrl:e})).catch(()=>{})}catch{}},[r,t,e])}}function fB(e){let t=window.matchMedia(`(min-width: 1024px)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function pB(){return window.matchMedia(`(min-width: 1024px)`).matches}function mB(){return!0}function hB(){return(0,z.useSyncExternalStore)(fB,pB,mB)}function gB(e){let[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(!1),a=hB(),o=(0,z.useCallback)(()=>{n(!0),i(!0)},[]);return(0,z.useEffect)(()=>{e||(n(!1),i(!1))},[e]),(0,z.useEffect)(()=>{if(!e)return;let t=new URLSearchParams(window.location.search);if(!t.has(`openTunnelPopover`))return;n(!0),i(!0),t.delete(`openTunnelPopover`);let r=t.toString();window.history.replaceState({},``,`${window.location.pathname}${r?`?${r}`:``}`)},[e]),{open:t,onOpenChange:(0,z.useCallback)(e=>{n(e),e||i(!1)},[]),isLgUp:a,autoCopyOnOpen:r,openWithAutoCopy:o}}function _B({connections:e,selectedServer:t,activeTab:n,onServerSelect:r,onTabChange:i,embedded:a=!1,sidebarCollapsed:o=!1}){let{tunnelUrl:s,isTunnelStarting:c,setTunnelUrl:l,setIsTunnelStarting:u,embeddedConfig:d}=fL(),[f,p]=(0,z.useState)(!1),[m]=(0,z.useState)(!0),h=gB(s),g=dB({tunnelUrl:s,setTunnelUrl:l,isTunnelStarting:c,setIsTunnelStarting:u,onTunnelStarted:h.openWithAutoCopy});if(d.singleTab)return null;let _=d.visibleTabs?Az.filter(e=>e.id===`separator`||d.visibleTabs.includes(e.id)):Az,v=!!t,y=!!t&&(oM(t.url??``)||sM(t.url??``)||!!s),b=t?s?`${s.replace(/\/+$/,``)}${nM()}`:t.url??``:``,x=g.mcpUrl??(s?`${s.replace(/\/+$/,``)}${nM()}`:null),S=(e,n)=>{if(!t||!b)return null;let r=e===`desktop`?h.isLgUp:!h.isLgUp;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(sB,{url:b,className:n,tunnelPopover:s&&x&&r?{mcpUrl:x,onStop:g.handleStopTunnel,open:h.open,onOpenChange:h.onOpenChange,autoCopyOnOpen:h.autoCopyOnOpen}:void 0}),y&&!s&&(0,R.jsx)(cB,{devFromCli:g.devFromCli,isTunnelStarting:c,waitTicks:g.waitTicks,onStart:g.handleStartTunnel})]})},C=()=>a?null:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 flex-shrink-0`,children:[t&&(0,R.jsx)(R.Fragment,{children:(0,R.jsx)(fz,{serverConfig:{url:b,name:lM(t),headers:_M(t),serverId:t.id},onSuccess:e=>GF.success(`Opening in ${e}...`),onError:e=>GF.error(`Failed: ${e.message}`),trigger:(0,R.jsxs)(jt,{variant:`ghost`,className:`bg-zinc-200 dark:bg-zinc-800 hover:bg-zinc-300 dark:hover:bg-zinc-700 rounded-full transition-colors px-3 flex items-center justify-center`,"aria-label":`Add to Client`,children:[(0,R.jsxs)(`span`,{className:`xl:hidden hidden sm:flex items-center gap-1`,children:[(0,R.jsx)(ki,{className:`size-3`}),`Client`]}),(0,R.jsxs)(`span`,{className:`hidden xl:flex items-center gap-1`,children:[`Add to Client`,(0,R.jsx)(Ir,{className:`size-3`})]})]})})}),(0,R.jsx)(`a`,{href:f?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{try{ET(new wo({referrer:`mcp-use-inspector`})).catch(()=>{})}catch{}},className:`inline-flex h-8 items-center justify-center rounded-full border border-blue-500/25 bg-blue-500/10 px-4 text-[13px] text-blue-500 outline-none cursor-pointer transition-colors hover:bg-blue-500/15 dark:border-blue-400/30 dark:bg-blue-400/10 dark:text-blue-400 dark:hover:bg-blue-400/15 focus-visible:ring-1 focus-visible:ring-ring`,children:(0,R.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Deploy`})}),d.chatApiUrl?(0,R.jsx)(lz,{chatApiUrl:d.chatApiUrl,onUserResolved:e=>p(!!e)}):null]});return(0,R.jsxs)(`header`,{className:`w-full shrink-0`,children:[(0,R.jsxs)(`div`,{className:`hidden lg:flex h-(--header-height) items-center justify-between gap-3 px-4 md:pl-0 md:pr-6`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:A(`hidden lg:block shrink-0`,v&&o&&`-mr-[calc(var(--sidebar-width-icon)/2-0.625rem)]`),children:(0,R.jsx)(pz,{pinSymbolInIconColumn:!0,showLabel:!v||!o,state:v&&o?`collapsed`:`expanded`})}),(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground/60 shrink-0 [text-box:trim-both_cap_alphabetic]`,children:`/`}),(0,R.jsx)(Ez,{connections:e,selectedServer:t,onServerSelect:r,variant:`header`}),S(`desktop`)]})}),C()]}),(0,R.jsxs)(`div`,{className:`flex lg:hidden flex-col gap-3`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between w-full`,children:!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`flex-1 flex justify-start`,children:(0,R.jsx)(Ez,{connections:e,selectedServer:t,onServerSelect:r,mobileMode:!0})}),(0,R.jsx)(`div`,{className:`flex-shrink-0 flex justify-center`,children:(0,R.jsx)(pz,{state:`collapsed`,showLabel:!0})}),(0,R.jsx)(`div`,{className:`flex-1 flex justify-end`,children:C()})]})}),t&&b&&!a&&(0,R.jsx)(`div`,{className:`flex items-center gap-2 px-1 min-w-0`,children:S(`mobile`,`min-w-0`)}),t&&(0,R.jsx)(`div`,{className:`w-full lg:hidden`,children:(0,R.jsx)(KR,{value:n,onValueChange:e=>i(e),collapsed:m,children:(0,R.jsx)(qR,{className:`w-full justify-center border-0 bg-transparent p-0`,children:_.map((e,r)=>{if(e.id===`separator`)return(0,R.jsx)(`div`,{className:`h-5 w-px bg-zinc-300 dark:bg-zinc-600 mx-1 shrink-0`},`separator-${r}`);let i=Oz(e.id,t),a=kz(e.id,i,m);return(0,R.jsx)(YR,{value:e.id,"data-testid":`tab-${e.id}`,icon:e.icon,showDot:a,badge:(0,R.jsx)(uz,{count:i,isActive:n===e.id,size:`sm`}),alwaysExpanded:`alwaysExpanded`in e&&e.alwaysExpanded,className:A(`[&>svg]:mr-0 flex-1 flex-row gap-2 relative`,m&&`pl-2`),children:(0,R.jsx)(`span`,{className:`sr-only`,children:e.label})},e.id)})})})})]})]})}function vB({collapsed:e,onToggle:t}){let n=e?`Expand sidebar`:`Collapse sidebar`;return(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsxs)(jt,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-label":n,onClick:t,className:A(`border-border absolute top-1/2 right-0 z-30 hidden size-7 min-h-7 min-w-7 -translate-y-1/2 translate-x-1/2 rounded-full border bg-background lg:flex`,`opacity-0 transition-opacity duration-200 group-hover/sidebar:opacity-100 focus-visible:opacity-100`),children:[(0,R.jsx)(Ci,{className:`size-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:n})]}),nativeButton:!0}),(0,R.jsx)(Et,{side:`right`,children:n})]})}function yB({className:e}){return(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentcolor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[(0,R.jsx)(`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`}),(0,R.jsx)(`path`,{d:`M9 18c-4.51 2-5-2-7-2`})]})}var bB=z.createContext(void 0);function xB(){let e=z.useContext(bB);if(e===void 0)throw Error(Ve(63));return e}var SB=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),CB={...Tn,checked(e){return e?{[SB.checked]:``}:{[SB.unchecked]:``}}};function wB(e,t,n,r=!0,i){let[a,o]=z.useState(),s=N(i?`${i}-label`:void 0),c=e??t??a;return be(()=>{let i=e||t||!r?void 0:TB(n.current,s);a!==i&&o(i)}),c}function TB(e,t){let n=EB(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function EB(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var DB=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:y,...b}=e,{clearErrors:x}=An(),{state:S,setTouched:C,setDirty:w,validityData:T,setFilled:ee,setFocused:E,validationMode:D,disabled:te,name:ne,validation:O}=On(),{labelId:re}=kn(),k=te||m,ie=ne??l,A=z.useRef(null),j=Ze(A,c,O.inputRef),M=z.useRef(null),oe=N(),se=cn({id:s,implicit:!1,controlRef:M}),P=u?void 0:se,[ce,le]=Yt({controlled:n,default:!!i,name:`Switch`,state:`checked`});En(M,oe,ce,void 0,!k,l),be(()=>{A.current&&ee(A.current.checked)},[A,ee]),Dn(ce,()=>{x(ie),w(ce!==T.initialValue),ee(ce),O.change(ce)});let{getButtonProps:ue,buttonRef:de}=Pe({disabled:k,native:u}),fe=wB(a,re,A,!u,P),pe={id:u?se:oe,role:`switch`,"aria-checked":ce,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":fe,onFocus(){k||E(!0)},onBlur(){let e=A.current;!e||k||(C(!0),E(!1),D===`onBlur`&&O.commit(e.checked))},onClick(e){if(f||k)return;e.preventDefault();let t=A.current;t&&t.dispatchEvent(new(v(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},me=Ut({checked:ce,disabled:k,form:o,id:P,name:ie,required:p,style:ie?Le:rt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:j,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=ae(Ae,e.nativeEvent);d?.(t,n),!n.isCanceled&&le(t)},onFocus(){M.current?.focus()}},e=>O.getValidationProps(k,e),_===void 0?St:{value:_}),he=z.useMemo(()=>({...S,checked:ce,disabled:k,readOnly:f,required:p}),[S,ce,k,f,p]),ge=We(`span`,e,{state:he,ref:[t,M,de],props:[pe,b,ue,e=>O.getValidationProps(k,e)],stateAttributesMapping:CB});return(0,R.jsxs)(bB.Provider,{value:he,children:[ge,!ce&&ie&&g!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:o,name:ie,value:g,disabled:k}),(0,R.jsx)(`input`,{...me,suppressHydrationWarning:!0})]})}),OB=z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return We(`span`,e,{state:xB(),ref:t,stateAttributesMapping:CB,props:a})}),kB=34,AB=20,jB=16,MB=2,NB=4,PB=2;function FB(e){return`label`in e&&typeof e.label==`string`}var IB=(0,z.forwardRef)(({label:e,checked:t,onToggle:n,disabled:r=!1,thumbTransition:i,uncheckedTrackColor:a,uncheckedTrackColorHovered:o,className:s,...c},l)=>{let u=(0,z.useId)(),d=(0,z.useRef)(!1),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),g=(0,z.useRef)(!1),_=(0,z.useRef)(!1),v=(0,z.useRef)(null),y=na(t?16:MB);(0,z.useEffect)(()=>{d.current=!0},[]);let b=m?20:f?18:jB,x=m?jB-NB:jB,S=m?4:MB,C=b-jB,w=t?16-C:MB;(0,z.useEffect)(()=>{g.current||(d.current?Da(y,w,i??At.moderate):y.set(w))},[w,y,i]);let T=(0,z.useCallback)(e=>{r||e.pointerType===`mouse`&&e.button!==0||(h(!0),g.current=!1,_.current=!1,v.current={clientX:e.clientX,originX:y.get()},e.currentTarget.setPointerCapture(e.pointerId))},[r,y]),ee=(0,z.useCallback)(e=>{if(!v.current)return;let t=e.clientX-v.current.clientX;if(!g.current){if(Math.abs(t)<PB)return;g.current=!0}let n=MB,r=kB-MB-20,i=v.current.originX+t;y.set(Math.max(n,Math.min(r,i)))},[y]),E=(0,z.useCallback)(e=>{v.current&&=(h(!1),g.current&&(_.current=!0,g.current=!1,e&&(y.get()>14/2===t?Da(y,t?16:MB,i??At.moderate):n()),requestAnimationFrame(()=>{_.current=!1})),null)},[t,n,y,i]);return(0,R.jsxs)(`div`,{ref:l,className:A(`relative z-10 flex items-center gap-2.5 px-3 py-2 cursor-pointer select-none touch-none`,r&&`opacity-50 pointer-events-none`,s),onPointerEnter:e=>{e.pointerType===`mouse`&&p(!0)},onPointerLeave:()=>p(!1),onPointerDown:T,onPointerMove:ee,onPointerUp:()=>E(!0),onPointerCancel:()=>{v.current&&=(h(!1),g.current&&(g.current=!1,Da(y,t?16:MB,i??At.moderate)),null)},onClick:()=>{r||_.current||n()},...c,children:[(0,R.jsx)(DB,{checked:t,"aria-labelledby":u,onCheckedChange:()=>{_.current||n()},disabled:r,tabIndex:0,className:A(`relative shrink-0 rounded-full outline-none cursor-pointer`,`transition-colors duration-80`,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)] focus-visible:ring-offset-2 focus-visible:ring-offset-background`),style:{width:kB,height:AB,backgroundColor:t?f?`color-mix(in oklab, var(--primary) 88%, black)`:`var(--primary)`:f?o??`color-mix(in oklab, var(--accent), rgb(var(--overlay)) 10%)`:a??`var(--accent)`},onClick:e=>e.stopPropagation(),children:(0,R.jsx)(OB,{render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:a,onAnimationStart:o,onAnimationEnd:s,onAnimationIteration:c,...l}=e;return(0,R.jsx)(qe.span,{...l,className:`absolute top-0 left-0 block rounded-full bg-white shadow-sm`,initial:!1,style:{...t,x:y},animate:{y:S,width:b,height:x},transition:d.current?i??At.moderate:{duration:0}})}})}),(0,R.jsx)(`span`,{id:u,className:A(`text-[13px] [text-box:trim-both_cap_alphabetic] transition-[color] duration-80`,t?`text-foreground`:`text-muted-foreground`),children:e})]})});IB.displayName=`FluidSwitch`;var LB=(0,z.forwardRef)(({checked:e,defaultChecked:t=!1,onCheckedChange:n,disabled:r=!1,className:i},a)=>{let[o,s]=(0,z.useState)(t),c=e??o;return(0,R.jsx)(DB,{ref:a,checked:c,disabled:r,onCheckedChange:t=>{e===void 0&&s(t),n?.(t)},className:A(`peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors duration-80`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,`disabled:cursor-not-allowed disabled:opacity-50`,`data-checked:bg-primary data-unchecked:bg-input`,i),children:(0,R.jsx)(OB,{className:A(`pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform duration-80`,`data-checked:translate-x-4 data-unchecked:translate-x-0`)})})});LB.displayName=`ShadcnSwitch`;var RB=(0,z.forwardRef)((e,t)=>FB(e)?(0,R.jsx)(IB,{ref:t,...e}):(0,R.jsx)(LB,{ref:t,...e}));RB.displayName=`Switch`;function zB({className:e}){return(0,R.jsx)(`svg`,{viewBox:`0 -28.5 256 256`,className:e,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,R.jsx)(`path`,{d:`M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z`,fillRule:`nonzero`})})}var BB=`flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,VB=`color-mix(in oklab, var(--sidebar-foreground) 22%, var(--sidebar))`,HB=`color-mix(in oklab, var(--sidebar-foreground) 30%, var(--sidebar))`,UB=`data-unchecked:!bg-zinc-300 dark:data-unchecked:!bg-zinc-600`;function WB({collapsed:e,rpcLoggerOpen:t,onRpcLoggerOpenChange:n,onCommandPaletteOpen:r}){let{embeddedConfig:i}=fL(),{theme:a,setTheme:o}=_z(),{user:s}=XR(i.chatApiUrl),c=s?`https://manufact.com/cloud?ref=mcp-use-inspector`:`https://manufact.com/signup?ref=mcp-use-inspector`,l=()=>{try{ET(new wo({referrer:`mcp-use-inspector-sidebar`})).catch(()=>{})}catch{}};return(0,R.jsx)(`footer`,{className:`mt-auto shrink-0`,children:(0,R.jsxs)(`div`,{className:A(`flex flex-col`,e?`items-center gap-2 px-2 py-3`:`gap-3 px-(--sidebar-nav-inset-x) py-4`),children:[e?(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`div`,{className:`flex size-8 items-center justify-center`,children:(0,R.jsx)(RB,{checked:t,onCheckedChange:n,"aria-label":`RPC Panel`,className:A(`scale-75`,UB)})}),nativeButton:!1}),(0,R.jsx)(Et,{side:`right`,children:`RPC Panel`})]}):(0,R.jsx)(RB,{label:`RPC Panel`,checked:t,onToggle:()=>n(!t),uncheckedTrackColor:VB,uncheckedTrackColorHovered:HB,className:`w-full flex-row-reverse justify-between`}),e?(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:BB,"aria-label":`Deploying your MCP Server? Try manufact.com`,children:(0,R.jsx)(Ar,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(Et,{side:`right`,children:`Deploying your MCP Server? Try manufact.com`})]}):(0,R.jsxs)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:l,className:`relative block rounded-xl border border-sidebar-border bg-white p-3 transition-colors hover:bg-sidebar-accent/50 dark:bg-black`,children:[(0,R.jsx)(Ar,{className:`absolute top-2.5 right-2.5 size-3.5 text-muted-foreground`,"aria-hidden":!0}),(0,R.jsx)(`p`,{className:`pr-5 text-xs leading-snug text-muted-foreground`,children:`Deploying your MCP Server?`}),(0,R.jsxs)(`p`,{className:`mt-0.5 text-xs leading-snug`,children:[`Try`,` `,(0,R.jsx)(`span`,{className:`font-medium underline underline-offset-2`,children:`manufact.com`})]})]}),(0,R.jsxs)(`div`,{className:A(`flex`,e?`flex-col items-center gap-1`:`flex-row items-center gap-2`),children:[(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`a`,{href:`https://github.com/mcp-use/mcp-use`,target:`_blank`,rel:`noopener noreferrer`,className:BB,"aria-label":`GitHub`,children:(0,R.jsx)(yB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(Et,{side:e?`right`:`top`,children:`GitHub`})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`a`,{href:`https://discord.gg/XkNkSkMz3V`,target:`_blank`,rel:`noopener noreferrer`,className:BB,"aria-label":`Discord`,children:(0,R.jsx)(zB,{className:`size-4`})}),nativeButton:!1}),(0,R.jsx)(Et,{side:e?`right`:`top`,children:`Discord`})]}),(0,R.jsxs)(qa,{children:[(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(Ja,{render:(0,R.jsx)(`button`,{type:`button`,className:BB,"aria-label":`Theme`,children:a===`light`?(0,R.jsx)(Vi,{className:`size-4`}):a===`dark`?(0,R.jsx)(bi,{className:`size-4`}):(0,R.jsx)(yi,{className:`size-4`})}),nativeButton:!0}),nativeButton:!0}),(0,R.jsx)(Et,{side:e?`right`:`top`,children:`Theme`})]}),(0,R.jsx)(Ya,{side:e?`right`:`top`,align:e?`start`:`center`,className:`w-40`,children:(0,R.jsxs)(Qa,{value:a,onValueChange:e=>o(e),children:[(0,R.jsxs)($a,{value:`light`,children:[(0,R.jsx)(Vi,{className:`size-4 mr-2`}),`Light`]}),(0,R.jsxs)($a,{value:`dark`,children:[(0,R.jsx)(bi,{className:`size-4 mr-2`}),`Dark`]}),(0,R.jsxs)($a,{value:`system`,children:[(0,R.jsx)(yi,{className:`size-4 mr-2`}),`System`]})]})})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`button`,{type:`button`,onClick:r,className:BB,"aria-label":`Command Palette`,"data-testid":`command-palette-trigger-button`,children:(0,R.jsx)(Ur,{className:`size-4`})}),nativeButton:!0}),(0,R.jsxs)(Et,{side:e?`right`:`top`,children:[`Command Palette (`,`⌘`,`K)`]})]})]})]})})}function GB(e,t){let n=0,r=0,i=e;for(;i&&i!==t;)n+=i.offsetTop,r+=i.offsetLeft,i=i.offsetParent;if(i!==t){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{top:r.top-n.top,left:r.left-n.left,width:r.width,height:r.height}}return{top:n,left:r,width:e.offsetWidth,height:e.offsetHeight}}function KB(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.top!==i.top||n.left!==i.left||n.width!==i.width||n.height!==i.height)return!1}return!0}function qB(e,t={}){let{axis:n=`y`}=t,r=(0,z.useRef)(new Map),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)({}),c=(0,z.useRef)({}),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=(0,z.useRef)(null),f=(0,z.useCallback)(()=>{let t=e.current;if(!t)return;let n={};r.current.forEach((e,r)=>{n[r]=GB(e,t)}),!KB(c.current,n)&&(c.current=n,s(n))},[e]),p=(0,z.useCallback)((e,t)=>{t?r.current.set(e,t):r.current.delete(e),d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})},[f]),m=(0,z.useCallback)(t=>{let r=t.clientX,i=t.clientY;u.current!==null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let t=e.current;if(!t)return;let o=t.getBoundingClientRect(),s=n===`x`?r:i,l=null,d=1/0,f=null,p=c.current,m=n===`x`?t.scrollLeft:t.scrollTop,h=n===`x`?t.clientLeft:t.clientTop,g=n===`x`?o.left:o.top,_=n===`x`?t.offsetWidth:t.offsetHeight,v=n===`x`?o.width:o.height,y=_>0?v/_:1;for(let[e,t]of Object.entries(p)){let r=g+(h+(n===`x`?t.left:t.top)-m)*y,i=(n===`x`?t.width:t.height)*y,a=r+i;s>=r&&s<=a&&(f=e);let o=r+i/2,c=Math.abs(s-o);c<d&&(d=c,l=e)}a(f??l)})},[n,e]),h=(0,z.useCallback)(()=>{l.current+=1},[]),g=(0,z.useCallback)(()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),a(null)},[]);return(0,z.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>{d.current!==null&&cancelAnimationFrame(d.current),d.current=requestAnimationFrame(()=>{d.current=null,f()})});return n.observe(t),()=>n.disconnect()},[e,f]),(0,z.useEffect)(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current),d.current!==null&&cancelAnimationFrame(d.current)},[]),{activeKey:i,itemRects:o,sessionRef:l,handlers:{onMouseMove:m,onMouseEnter:h,onMouseLeave:g},registerItem:p,measureItems:f}}function JB(e){if(!e)return{left:0,right:0};let t=getComputedStyle(e),n=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-bleed`))||0,r=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-scrollbar-width`))||0,i=Number.parseFloat(t.getPropertyValue(`--sidebar-nav-pill-outer-trim-right`))||0;return{left:n,right:n+r+i}}function YB(e,t){return{...e,left:e.left-t.left,width:e.width+t.left+t.right}}var XB=(0,z.createContext)(null);function ZB(){let e=(0,z.useContext)(XB),t=(0,z.useRef)(e?.registerItem);t.current=e?.registerItem;let n=(0,z.useRef)(new Map);return(0,z.useCallback)(e=>{let r=n.current,i=r.get(e);return i||(i=n=>t.current?.(e,n),r.set(e,i)),i},[])}function QB({children:e,isActiveKey:t,className:n}){let r=(0,z.useRef)(null),{activeKey:i,itemRects:a,sessionRef:o,handlers:s,registerItem:c,measureItems:l}=qB(r),u=(0,z.useMemo)(()=>({registerItem:c}),[c]),d=Object.keys(a).find(e=>t(e))??null;(0,z.useLayoutEffect)(()=>{l()},[l,e,d]);let f=JB(r.current),p=i?a[i]:null,m=d?a[d]:null,h=p?YB(p,f):null,g=m?YB(m,f):null,_=i!==null&&i!==d;return(0,R.jsx)(XB.Provider,{value:u,children:(0,R.jsxs)(`div`,{ref:r,onMouseEnter:s.onMouseEnter,onMouseMove:s.onMouseMove,onMouseLeave:s.onMouseLeave,className:A(`relative isolate`,n),children:[(0,R.jsx)(en,{initial:!1,children:g&&d?(0,R.jsx)(qe.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-20 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g.top,left:g.left,width:g.width,height:g.height},animate:{opacity:_?.85:1,top:g.top,left:g.left,width:g.width,height:g.height},exit:{opacity:0,transition:At.fast.exit},transition:{opacity:{duration:.08},top:{duration:0},left:{duration:0},width:{duration:0},height:{duration:0}}},d):null}),(0,R.jsx)(en,{children:h?(0,R.jsx)(qe.div,{"aria-hidden":!0,className:`pointer-events-none absolute -z-10 rounded-full bg-sidebar-accent`,initial:{opacity:0,top:g?.top??h.top,left:g?.left??h.left,width:g?.width??h.width,height:g?.height??h.height},animate:{opacity:1,top:h.top,left:h.left,width:h.width,height:h.height},exit:{opacity:0,transition:At.fast.exit},transition:{...At.fast,opacity:{duration:.08}}},o.current):null}),e]})})}var $B=A(`pointer-events-auto absolute right-(--sidebar-nav-trailing-right) top-1/2 z-10 flex h-(--sidebar-nav-trailing-size) min-w-(--sidebar-nav-trailing-size) -translate-y-1/2 items-center justify-center`,A(`transition-[opacity,filter] duration-200 ease-out`,`opacity-100 blur-0`,`group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:blur-[3px] group-data-[collapsible=icon]:pointer-events-none`,`group-data-[collapsed=true]:opacity-0 group-data-[collapsed=true]:blur-[3px] group-data-[collapsed=true]:pointer-events-none`)),eV=A(`truncate transition-[opacity,filter,margin] duration-200 ease-out`,`group-data-[collapsible=icon]:hidden`,`group-data-[collapsed=true]:hidden`),tV=A(`peer/menu-button flex cursor-pointer items-center gap-2 overflow-hidden rounded-full py-2 text-left text-sm outline-hidden ring-sidebar-ring hover:text-sidebar-accent-foreground group-hover/menu-item:text-sidebar-accent-foreground focus-visible:ring-2 active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:font-medium data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,`transition-[width,max-width,height,padding,border-radius] duration-200 ease-out`,`h-8 text-sm`);function nV({count:e}){return(0,R.jsx)(`span`,{className:A(`inline-flex h-5 shrink-0 items-center justify-center border border-border bg-zinc-200 px-1 text-[10px] font-medium tabular-nums leading-none text-foreground dark:bg-zinc-700`,String(e).length>=3?`min-w-5 rounded-md`:`size-5 min-w-5 rounded-full`),children:e})}function rV(e){return e.id!==`separator`}function iV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i}){let a=ZB();return(0,R.jsx)(`ul`,{className:`flex w-full min-w-0 flex-col gap-1 px-(--sidebar-nav-inset-x) group`,"data-collapsed":i,"aria-label":`Inspector tabs`,children:(r?Az.filter(e=>rV(e)&&r.includes(e.id)):Az.filter(rV)).map((r,o)=>{let s=Oz(r.id,n),c=kz(r.id,s,i),l=r.icon,u=e===r.id,d=s>0||c,f=(0,R.jsxs)(`button`,{ref:a(r.id),type:`button`,"data-testid":`tab-${r.id}`,"data-active":u?!0:void 0,onClick:()=>t(r.id),className:A(tV,i?`size-8! w-8! max-w-8! shrink-0 justify-center gap-0 p-0!`:`w-full max-w-full sidebar-nav-pill-bleed-x pl-(--sidebar-nav-icon-pl-bleed) pr-(--sidebar-nav-pr-bleed)`,d&&!i&&`pr-[calc(var(--sidebar-nav-trailing-right)+var(--sidebar-nav-trailing-size))]`),children:[(0,R.jsx)(l,{className:`size-4 shrink-0`}),(0,R.jsx)(`span`,{className:eV,children:r.label})]});return(0,R.jsxs)(`li`,{className:A(`group/menu-item relative`,o===0&&`mt-4`),children:[i?(0,R.jsxs)(gt,{delayDuration:0,children:[(0,R.jsx)(Ie,{render:f,nativeButton:!0}),(0,R.jsx)(Et,{side:`right`,children:s>0?`${r.label} (${s})`:r.label})]}):f,d&&!i?(0,R.jsx)(`div`,{className:$B,children:s>0?(0,R.jsx)(nV,{count:s}):c?(0,R.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full bg-yellow-500 animate-status-pulse-yellow`}):null}):null]},r.id)})})}function aV({activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i,onCollapsedChange:a,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}){return(0,R.jsxs)(`aside`,{className:A(`group/sidebar relative hidden lg:flex flex-col shrink-0 text-sidebar-foreground transition-[width] duration-200 ease-out @container/sidebar`,i?`w-(--sidebar-width-icon)`:`w-(--sidebar-width)`),"data-collapsed":i,"data-collapsible":i?`icon`:`expanded`,children:[(0,R.jsx)(`div`,{className:`sidebar-nav-scroll flex-1 overflow-y-auto overflow-x-hidden min-h-0`,children:(0,R.jsx)(QB,{isActiveKey:t=>t===e,className:`pb-2`,children:(0,R.jsx)(iV,{activeTab:e,onTabChange:t,selectedServer:n,visibleTabs:r,collapsed:i})})}),(0,R.jsx)(WB,{collapsed:i,rpcLoggerOpen:o,onRpcLoggerOpenChange:s,onCommandPaletteOpen:c}),(0,R.jsx)(vB,{collapsed:i,onToggle:()=>a(!i)})]})}function oV(e){if(e===0)return`0 Bytes`;let t=1024,n=[`Bytes`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/t**r*100)/100+` `+n[r]}function sV(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/t**r).toFixed(1))} ${n[r]}`}var cV=100*1024,lV=1024*20;function uV(e,t){if(e==null)return e;if(typeof e==`string`)return e.length>t?e.substring(0,t)+`... (truncated)`:e;if(Array.isArray(e))return e.map(e=>uV(e,t));if(typeof e==`object`){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=uV(e[r],t));return n}return e}function dV(e){let t=JSON.stringify(e,null,2);return new TextEncoder().encode(t).length>cV?uV(e,lV):e}function fV(e){let t=JSON.stringify(e,null,2),n=new TextEncoder().encode(t).length,r=n>cV,i;if(r){let t=uV(e,lV);i=JSON.stringify(t,null,2)}else i=t;return{isLarge:r,size:n,sizeFormatted:oV(n),preview:i,full:t}}function pV(e,t){try{let n=JSON.stringify(e,null,2),r=globalThis.Blob,i=new r([n],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=t||`data-${Date.now()}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}catch(e){throw console.error(`Failed to download JSON:`,e),e}}var mV={key:`text-sky-600 dark:text-sky-400`,string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,punctuation:`text-muted-foreground`};function hV(e){let t=[],n=0,r=(e,n)=>{n&&t.push({kind:e,text:n})};for(;n<e.length;){let t=e[n];if(t===`"`){let t=n;for(n++;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`"`){n++;break}n++}let i=e.slice(t,n),a=n;for(;a<e.length&&/[ \t]/.test(e[a]);)a++;r(e[a]===`:`?`key`:`string`,i);continue}if(/[0-9-]/.test(t)){let t=n;for(e[n]===`-`&&n++;n<e.length&&/[0-9.eE+-]/.test(e[n]);)n++;r(`number`,e.slice(t,n));continue}if(e.startsWith(`true`,n)||e.startsWith(`false`,n)){let t=e.startsWith(`true`,n)?`true`:`false`;r(`boolean`,t),n+=t.length;continue}if(e.startsWith(`null`,n)){r(`null`,`null`),n+=4;continue}if(/[{}[\],:]/.test(t)){r(`punctuation`,t),n++;continue}r(`punctuation`,t),n++}return t}function gV(e){return hV(e).map((e,t)=>(0,R.jsx)(`span`,{className:mV[e.kind],children:e.text},t))}var _V={string:`text-emerald-600 dark:text-emerald-400`,number:`text-amber-600 dark:text-amber-400`,boolean:`text-violet-600 dark:text-violet-400`,null:`text-zinc-500 dark:text-zinc-400`,key:`text-sky-600 dark:text-sky-400`,punctuation:`text-muted-foreground`};function vV(e){return e===null?(0,R.jsx)(`span`,{className:_V.null,children:`null`}):typeof e==`string`?(0,R.jsx)(`span`,{className:_V.string,children:JSON.stringify(e)}):typeof e==`number`?(0,R.jsx)(`span`,{className:_V.number,children:String(e)}):typeof e==`boolean`?(0,R.jsx)(`span`,{className:_V.boolean,children:String(e)}):(0,R.jsx)(`span`,{className:_V.string,children:JSON.stringify(e)})}function yV(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}function bV({label:e,value:t,depth:n,defaultExpanded:r}){let i=typeof t==`object`&&t&&!Array.isArray(t)?Object.keys(t).length>0:Array.isArray(t)?t.length>0:!1,[a,o]=(0,z.useState)(i&&(r||n===0));if(!i){let r=Array.isArray(t)?`[]`:`{}`;return typeof t==`object`&&t?(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:_V.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:_V.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:_V.punctuation,children:r})]}):(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,style:{paddingLeft:n*12},children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:_V.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:_V.punctuation,children:`: `})]}),vV(t)]})}let s=Array.isArray(t)?t.map((e,t)=>[String(t),e]):Object.entries(t),c=Array.isArray(t),l=c?`[`:`{`,u=c?`]`:`}`;return(0,R.jsxs)(`div`,{className:`font-mono text-[0.8rem] leading-relaxed`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-0.5`,style:{paddingLeft:n*12},children:[(0,R.jsx)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`mt-0.5 inline-flex shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(O,{className:A(`h-3.5 w-3.5 transition-transform`,a&&`rotate-90`)})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e!=null&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:_V.key,children:JSON.stringify(e)}),(0,R.jsx)(`span`,{className:_V.punctuation,children:`: `})]}),(0,R.jsx)(`span`,{className:_V.punctuation,children:l}),!a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`mx-1 text-xs text-muted-foreground hover:text-foreground`,children:yV(t)}),(0,R.jsx)(`span`,{className:_V.punctuation,children:u})]})]})]}),a&&(0,R.jsxs)(`div`,{children:[s.map(([e,t])=>(0,R.jsx)(bV,{label:e,value:t,depth:n+1,defaultExpanded:r},`${n}-${e}`)),(0,R.jsx)(`div`,{style:{paddingLeft:n*12},children:(0,R.jsx)(`span`,{className:_V.punctuation,children:u})})]})]})}function xV({data:e,defaultExpanded:t=!0,className:n}){return(0,R.jsx)(`div`,{className:A(`text-gray-900 dark:text-gray-100 [overflow-wrap:anywhere]`,n),"data-testid":`collapsible-json`,children:(0,R.jsx)(bV,{value:e,depth:0,defaultExpanded:t})})}var SV=`font-mono text-[0.8rem] text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`;function CV({data:e,filename:t,className:n,collapsible:r=!1,defaultExpanded:i=!0,...a}){let o=fV(e),s=dV(e),c=o.isLarge?(0,R.jsx)(`div`,{className:`mb-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsxs)(`p`,{className:`text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1`,children:[`JSON is too large (`,o.sizeFormatted,`)`]}),(0,R.jsx)(`p`,{className:`text-xs text-yellow-700 dark:text-yellow-400`,children:`Showing full structure with truncated values. Download the full JSON file to see complete values.`})]}),(0,R.jsxs)(jt,{variant:`outline`,size:`sm`,onClick:()=>{pV(e,t)},className:`shrink-0`,children:[(0,R.jsx)(qr,{className:`h-4 w-4 mr-1`}),`Download`]})]})}):null;return r?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(xV,{data:s,defaultExpanded:i})]}):o.isLarge?(0,R.jsxs)(`div`,{className:n,...a,children:[c,(0,R.jsx)(`pre`,{className:SV,children:(0,R.jsx)(`code`,{children:gV(o.preview)})})]}):(0,R.jsx)(`div`,{className:n,...a,children:(0,R.jsx)(`pre`,{className:SV,children:(0,R.jsx)(`code`,{children:gV(o.preview)})})})}function wV(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var TV=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function EV(e){return z.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[TV.checked]:``}:{[TV.unchecked]:``}},...Tn}),[e.indeterminate])}var DV=z.createContext({disabled:!1});function OV(){return z.useContext(DV)}var kV=z.createContext(void 0);function AV(e=!0){let t=z.useContext(kV);if(t===void 0&&!e)throw Error(Ve(3));return t}var jV=z.createContext(void 0);function MV(){let e=z.useContext(jV);if(e===void 0)throw Error(Ve(14));return e}var NV=`data-parent`,PV=z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:y,nativeButton:b=!1,style:x,...S}=e,{clearErrors:C}=An(),{disabled:w,name:T,setDirty:ee,setFilled:E,setFocused:D,setTouched:te,state:ne,validationMode:O,validityData:re,validation:k}=On(),ie=OV(),{labelId:A,controlId:j,registerControlId:M,getDescriptionProps:oe}=kn(),se=AV(),P=se?.parent,ce=P&&se.allValues,le=w||ie.disabled||se?.disabled||o,ue=T??d,de=y??ue,fe=N(),pe=N(),me=j;ce?me=p?pe:`${P.id}-${de}`:c&&(me=c);let he={};ce&&(p?he=se.parent.getParentProps():de&&(he=se.parent.getChildProps(de)));let{checked:ge=n,indeterminate:_e=l,onCheckedChange:ve,...ye}=he,F=se?.value,xe=se?.setValue,Se=se?.defaultValue,Ce=z.useRef(null),we=Bt(()=>Symbol(`checkbox-control`)),Te=z.useRef(!1),{getButtonProps:Ee,buttonRef:De}=Pe({disabled:le,native:b}),Oe=se?.validation??k,[ke,je]=Yt({controlled:de&&F&&!p?F.includes(de):ge,default:de&&Se&&!p?Se.includes(de):i,name:`Checkbox`,state:`checked`}),Me=ce?!!ge:ke,Ne=ce&&_e||l;be(()=>{M!==mt&&(Te.current=!0,M(we.current,me))},[me,M,we]),z.useEffect(()=>{let e=we.current;return()=>{!Te.current||M===mt||(Te.current=!1,M(e,void 0))}},[M,we]),En(Ce,fe,ke,void 0,!se&&!le,d);let Fe=z.useRef(null),Ie=Ze(u,Fe,Oe.inputRef,Oe.registerInput),Re=wB(a,A,Fe,!b,me??void 0);be(()=>{Fe.current&&(Fe.current.indeterminate=Ne,ke&&E(!0))},[ke,Ne,E]),Dn(ke,()=>{se||(C(ue),E(ke),ee(ke!==re.initialValue),Oe.change(ke))});let ze=Ut({checked:ke,disabled:le,form:s,name:p?void 0:ue,id:b?void 0:me??void 0,required:g,ref:Ie,style:ue?Le:rt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=ae(Ae,e.nativeEvent);f?.(t,n),!n.isCanceled&&(ve?.(t,n),!n.isCanceled&&(je(t),de&&F&&xe&&!p&&!ce&&xe(t?[...F,de]:F.filter(e=>e!==de),n)))},onFocus(){Ce.current?.focus()}},y===void 0?St:{value:(se?ke&&y:y)||``},oe,e=>Oe.getValidationProps(le,e));z.useEffect(()=>{if(!P||!de)return;let e=P.disabledStatesRef.current;return e.set(de,le),()=>{e.delete(de)}},[P,le,de]);let Be=z.useMemo(()=>({...ne,checked:Me,disabled:le,readOnly:m,required:g,indeterminate:Ne}),[ne,Me,le,m,g,Ne]),Ve=EV(Be),He=We(`span`,e,{state:Be,ref:[De,Ce,t,se?.registerControlRef],props:[{id:b?me??void 0:fe,role:`checkbox`,"aria-checked":Ne?`mixed`:Me,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":Re,[NV]:p?``:void 0,onFocus(){le||D(!0)},onBlur(){let e=Fe.current;e&&(te(!0),D(!1),O===`onBlur`&&Oe.commit(se?F:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Fe.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),v(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||wV(t)?.click()})},onClick(e){if(m||le)return;e.preventDefault();let t=Fe.current;t&&t.dispatchEvent(new(v(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},S,ye,Ee,oe,e=>Oe.getValidationProps(le,e)],stateAttributesMapping:Ve});return(0,R.jsxs)(jV.Provider,{value:Be,children:[He,!ke&&!se&&ue&&!p&&_!==void 0&&(0,R.jsx)(`input`,{type:`hidden`,form:s,name:ue,value:_,disabled:le}),(0,R.jsx)(`input`,{...ze,suppressHydrationWarning:!0})]})}),FV=z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=MV(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=lt(c),f=z.useRef(null),p={...s,transitionStatus:u};x({open:c,ref:f,onComplete(){c||d(!1)}});let m={...EV(s),...bt,...Tn},h=a||l,g=We(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null}),IV=(0,z.createContext)(null);function LV(){let e=(0,z.useContext)(IV);if(!e)throw Error(`useCheckboxGroup must be used within a CheckboxGroup`);return e}var RV=(0,z.forwardRef)(({children:e,checkedIndices:t,orientation:n=`vertical`,className:r,...i},a)=>{let o=(0,z.useRef)(null),s=n===`horizontal`,{activeIndex:c,setActiveIndex:l,handlers:u,registerItem:d,measureItems:f}=_n(o,{axis:s?`x`:`y`});(0,z.useEffect)(()=>{f()},[f,e]);let p=s?`ArrowLeft`:`ArrowUp`,m=s?`ArrowRight`:`ArrowDown`;return(0,R.jsx)(IV.Provider,{value:{registerItem:d,activeIndex:c},children:(0,R.jsx)(`div`,{ref:e=>{o.current=e,typeof a==`function`?a(e):a&&(a.current=e)},onMouseEnter:u.onMouseEnter,onMouseMove:u.onMouseMove,onMouseLeave:u.onMouseLeave,onFocus:e=>{let t=e.target.closest(`[data-proximity-index]`)?.getAttribute(`data-proximity-index`);t!=null&&l(Number(t))},onBlur:e=>{o.current?.contains(e.relatedTarget)||l(null)},onKeyDown:e=>{let t=Array.from(o.current?.querySelectorAll(`[data-proximity-index]`)??[]),n=t.indexOf(e.target);n!==-1&&([p,m].includes(e.key)?(e.preventDefault(),t[e.key===m?(n+1)%t.length:(n-1+t.length)%t.length]?.focus()):e.key===`Home`?(e.preventDefault(),t[0]?.focus()):e.key===`End`&&(e.preventDefault(),t[t.length-1]?.focus()))},role:`group`,className:A(`relative flex max-w-full select-none`,s?`w-auto flex-row`:`w-72 flex-col`,r),...i,children:e})})});RV.displayName=`CheckboxGroup`;var zV=(0,z.forwardRef)(({label:e,index:t,checked:n,onToggle:r,size:i=`default`,className:a,...o},s)=>{let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),{registerItem:u,activeIndex:d}=LV();(0,z.useEffect)(()=>(u(t,c.current),()=>u(t,null)),[t,u]),(0,z.useEffect)(()=>{l.current=!0},[]);let f=d===t,p=!l.current,m=D(),h=i===`sm`;return(0,R.jsxs)(`div`,{ref:e=>{c.current=e,typeof s==`function`?s(e):s&&(s.current=e)},"data-proximity-index":t,tabIndex:0,role:`checkbox`,"aria-checked":n,"aria-label":e,onClick:r,onMouseDown:e=>{let t=e.target.closest(`button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);t&&t!==e.currentTarget||(e.preventDefault(),e.currentTarget.focus())},onKeyDown:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),r())},className:A(`relative z-10 flex items-center cursor-pointer outline-none`,h?`h-7 gap-1.5 px-2`:`h-8 gap-2.5 px-3`,m.item,`focus-visible:ring-1 focus-visible:ring-[color:var(--focus-ring,#6B97FF)]`,a),...o,children:[(0,R.jsxs)(PV,{checked:n,tabIndex:-1,"aria-hidden":!0,className:A(`pointer-events-none relative shrink-0 appearance-none bg-transparent p-0 border-0 outline-none`,h?`size-[13px]`:`size-[15px]`),children:[(0,R.jsx)(`div`,{className:A(`absolute inset-0 rounded-[5px] border-solid transition-all duration-80 border-[1.5px]`,n?`border-border`:f?`border-neutral-400 dark:border-neutral-500`:`border-border`)}),(0,R.jsx)(en,{children:n&&(0,R.jsx)(FV,{keepMounted:!0,render:e=>{let{style:t,onDrag:n,onDragStart:r,onDragEnd:i,onAnimationStart:a,onAnimationEnd:o,onAnimationIteration:s,...c}=e;return(0,R.jsx)(qe.svg,{...c,width:h?14:18,height:h?14:18,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-foreground`,initial:{opacity:1},animate:{opacity:1},exit:{opacity:1},children:(0,R.jsx)(qe.path,{d:`M6 12L10 16L18 8`,initial:{pathLength:+!!p},animate:{pathLength:1,transition:{duration:.08,ease:`easeOut`}},exit:{pathLength:0,transition:{duration:.04,ease:`easeIn`}}})})}})})]}),(0,R.jsxs)(`span`,{className:`inline-grid items-center self-center leading-none`,children:[(0,R.jsx)(`span`,{className:`col-start-1 row-start-1 invisible leading-none`,style:{fontVariationSettings:He.semibold},"aria-hidden":`true`,children:e}),(0,R.jsx)(`span`,{className:A(`col-start-1 row-start-1 leading-none transition-[color,font-variation-settings] duration-80`,h?`text-[11px]`:`text-[13px]`,n||f?`text-foreground`:`text-muted-foreground`),style:{fontVariationSettings:n?He.semibold:He.normal},children:e})]})]})});zV.displayName=`CheckboxItem`;var BV=36,VV=188,HV=6;function UV(e,t,n){let[r,i]=(0,z.useState)(0),[a,o]=(0,z.useState)(0),s=(0,z.useMemo)(()=>{let n=[],r=[],i=0;for(let a of e){n.push(i);let e=BV+(t.has(a.id)?VV:0);r.push(e),i+=e}return{offsets:n,heights:r,totalHeight:i}},[t,e]),c=(0,z.useMemo)(()=>{if(e.length===0)return{totalHeight:0,visibleItems:[]};let{offsets:t,heights:n,totalHeight:i}=s,o=r+a,c=0;for(;c<e.length&&t[c]+n[c]<r;)c++;c=Math.max(0,c-HV);let l=c;for(;l<e.length&&t[l]<o;)l++;l=Math.min(e.length,l+HV);let u=[];for(let r=c;r<l;r++)u.push({index:r,item:e[r],top:t[r],height:n[r]});return{totalHeight:i,visibleItems:u}},[e,s,r,a]),l=(0,z.useCallback)(()=>{let e=n.current;e&&i(e.scrollTop)},[n]);return(0,z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{o(e.clientHeight),i(e.scrollTop)};t();let r=new ResizeObserver(t);return r.observe(e),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r.disconnect(),e.removeEventListener(`scroll`,l)}},[l,n,e.length]),c}var WV=300,GV=/(?:^|\/)notifications\//;function KV(e){let t=e;return typeof t?.method==`string`?t.method:null}function qV(e){let t=e.message;if(t?.id!==void 0&&t.id!==null||t?.result!==void 0||t?.error!==void 0)return null;let n=KV(e.message);return!n||!GV.test(n)?null:[e.source,e.serverId,e.widgetId??``,e.direction,n].join(`|`)}function JV(e,t,n=Date.now()){let r=qV(e),i=qV(t);if(!r||r!==i)return!1;let a=Date.parse(e.timestamp);return Number.isNaN(a)?!1:n-a<=WV}function YV(e,t){return{...e,timestamp:t.timestamp,message:t.message,repeatCount:(e.repeatCount??1)+1}}var XV=new class{maxEntries;entries=[];listeners=new Set;nextId=0;emitFrame=null;constructor(e=1e3){this.maxEntries=e}publish(e){let t=this.entries[this.entries.length-1];if(t&&JV(t,e,Date.parse(e.timestamp))){this.entries[this.entries.length-1]=YV(t,e),this.scheduleEmit();return}this.entries.push({...e,id:`rpc-${++this.nextId}`}),this.entries.length>this.maxEntries&&this.entries.splice(0,this.entries.length-this.maxEntries),this.scheduleEmit()}getSnapshot=()=>this.entries;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));clear(e={}){let t=new Set(e.serverIds??[]),n=new Set(e.sources??[]);t.size===0&&n.size===0?this.entries=[]:this.entries=this.entries.filter(e=>!((t.size===0||t.has(e.serverId))&&(n.size===0||n.has(e.source)))),this.scheduleEmit()}peekCoalesceKey(e){return qV(e)}scheduleEmit(){if(this.emitFrame===null){if(typeof requestAnimationFrame>`u`){this.emit();return}this.emitFrame=requestAnimationFrame(()=>{this.emitFrame=null,this.emit()})}}emit(){this.listeners.forEach(e=>e())}},ZV;function QV(e){XV.publish({source:`mcp`,serverId:e.serverId,direction:e.direction,timestamp:e.timestamp,message:e.message})}function $V(){ZV||=(rk().forEach(QV),ik(QV))}$V();function eH({serverIds:e,onCountChange:t,onClearRef:n,onExportRef:r}={}){let i=(0,z.useRef)(null),[a,o]=(0,z.useState)(new Set),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(()=>new Set([`mcp`,`widget`])),p=(0,z.useSyncExternalStore)(XV.subscribe,XV.getSnapshot,XV.getSnapshot),m=async e=>{try{await Qj(JSON.stringify(e,null,2)),GF.success(`Message copied to clipboard`)}catch(e){console.error(`Failed to copy message:`,e),GF.error(`Failed to copy to clipboard`)}},h=(0,z.useMemo)(()=>{if(!e?.length)return p;let t=new Set(e);return p.filter(e=>t.has(e.serverId))},[p,e]),g=(0,z.useMemo)(()=>{let e=new Set;return d.has(`mcp`)&&e.add(0),d.has(`widget`)&&e.add(1),e},[d]),_=(0,z.useCallback)(e=>{f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,z.useMemo)(()=>{let e=h;d.size>0&&(e=e.filter(e=>d.has(e.source)));let t=s.trim().toLowerCase();return t&&(e=e.filter(e=>{let n=nH(e);return e.serverId.toLowerCase().includes(t)||e.widgetId?.toLowerCase().includes(t)||e.source.includes(t)||n.toLowerCase().includes(t)||e.direction.toLowerCase().includes(t)||JSON.stringify(e.message).toLowerCase().includes(t)})),[...e].reverse()},[h,s,d]),{totalHeight:y,visibleItems:b}=UV(v,a,i),x=(0,z.useCallback)(e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),S=(0,z.useCallback)(async()=>{let t=d.size===0||d.size===2?void 0:[...d];(!t||t.includes(`mcp`))&&(e?.length?e.forEach(e=>ak(e)):ak()),XV.clear({serverIds:e,sources:t}),o(new Set)},[e,d]),C=(0,z.useCallback)(async()=>{try{await Qj(JSON.stringify(v,null,2)),GF.success(`Copied ${v.length} messages`)}catch(e){console.error(`Failed to copy messages:`,e),GF.error(`Failed to copy to clipboard`)}},[v]),w=(0,z.useCallback)(()=>{let e=new Blob([JSON.stringify(v,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`mcp-rpc-traffic-${new Date().toISOString().replaceAll(`:`,`-`)}.json`,n.click(),URL.revokeObjectURL(t)},[v]);return(0,z.useEffect)(()=>{t?.(v.length)},[v.length,t]),(0,z.useEffect)(()=>(n&&(n.current=S),()=>{n&&(n.current=null)}),[S,n]),(0,z.useEffect)(()=>(r&&(r.current=C),()=>{r&&(r.current=null)}),[C,r]),(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 pr-2 pt-2 pl-1`,children:[(0,R.jsx)(`h2`,{className:`text-xs font-medium text-foreground`,children:`RPC Logs`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:C,disabled:v.length===0,"aria-label":`Copy filtered RPC traffic`,title:`Copy filtered`,children:(0,R.jsx)(Wr,{className:`size-3.5`})}),(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:w,disabled:v.length===0,"aria-label":`Download filtered RPC traffic as JSON`,title:`Download JSON`,children:(0,R.jsx)(qr,{className:`size-3.5`})}),(0,R.jsx)(jt,{variant:`ghost`,size:`sm`,className:`size-7 p-0`,onClick:S,disabled:p.length===0,"aria-label":`Clear RPC traffic`,title:`Clear`,children:(0,R.jsx)(Ui,{className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center pr-2 pb-2 pt-1 pl-1`,children:[(0,R.jsxs)(`div`,{className:`relative min-w-0 flex-1 transition-[flex-grow] duration-200 ease-out`,children:[(0,R.jsx)(T,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,R.jsx)(Nt,{value:s,onChange:e=>c(e.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),placeholder:`Search`,"aria-label":`Search RPC traffic`,className:`h-8 w-full pl-7 text-xs shadow-none transition-[width] duration-200 ease-out`})]}),(0,R.jsx)(`div`,{"aria-hidden":l,className:A(`shrink-0 overflow-hidden transition-[max-width,opacity,margin] duration-200 ease-out`,l?`pointer-events-none ml-0 max-w-0 opacity-0`:`ml-2 max-w-32 opacity-100`),children:(0,R.jsxs)(RV,{checkedIndices:g,orientation:`horizontal`,"aria-label":`Filter RPC traffic by source`,className:`w-auto shrink-0`,children:[(0,R.jsx)(zV,{index:0,label:`MCP`,size:`sm`,checked:d.has(`mcp`),onToggle:()=>_(`mcp`)}),(0,R.jsx)(zV,{index:1,label:`UI`,size:`sm`,checked:d.has(`widget`),onToggle:()=>_(`widget`)})]})})]}),(0,R.jsx)(`div`,{ref:i,className:`min-h-0 flex-1 overflow-y-auto pb-10`,style:{maskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`,WebkitMaskImage:`linear-gradient(to bottom, black 0, black calc(100% - 3rem), transparent 100%)`},children:v.length===0?(0,R.jsxs)(`div`,{className:`text-center py-8`,children:[(0,R.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No messages yet`}),(0,R.jsx)(`div`,{className:`text-[10px] text-muted-foreground mt-1`,children:`JSON-RPC messages will appear here`})]}):(0,R.jsx)(`div`,{className:`relative w-full`,style:{height:y},children:b.map(({item:e,top:t,height:n})=>(0,R.jsx)(tH,{item:e,top:t,height:n,expanded:a.has(e.id),onToggle:()=>x(e.id),onCopy:()=>m(e.message)},e.id))})})]})}function tH({item:e,top:t,height:n,expanded:r,onToggle:i,onCopy:a}){let o=nH(e),s=rH(e),c=e.repeatCount&&e.repeatCount>1?` ×${e.repeatCount}`:``;return(0,R.jsxs)(`div`,{className:`absolute inset-x-0 overflow-hidden`,style:{top:t,height:n},"data-testid":`rpc-message-${o.replace(/\//g,`-`)}`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:i,className:`flex h-9 w-full cursor-pointer items-center gap-2 py-2 pr-3 pl-1 text-left text-muted-foreground transition-colors hover:text-foreground`,children:[(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:e.direction===`receive`?(0,R.jsx)(Dr,{className:`size-3.5 text-blue-500`}):(0,R.jsx)(Ar,{className:`size-3.5 text-emerald-500`})}),nativeButton:!1}),(0,R.jsx)(Et,{side:`left`,children:s})]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`span`,{className:`flex size-3.5 shrink-0 items-center justify-center`,children:e.source===`mcp`?(0,R.jsx)(AL,{className:`size-3`}):(0,R.jsx)(wi,{className:`size-3`})}),nativeButton:!1}),(0,R.jsx)(Et,{side:`left`,children:e.source===`mcp`?`MCP server`:`UI widget`})]}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,children:[o,c?(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:c}):null]}),(0,R.jsxs)(gt,{children:[(0,R.jsx)(Ie,{render:(0,R.jsx)(`time`,{dateTime:e.timestamp,className:`shrink-0 cursor-default font-mono text-[10px] tabular-nums text-muted-foreground underline decoration-dotted underline-offset-2`,children:new Date(e.timestamp).toLocaleTimeString()}),nativeButton:!1}),(0,R.jsx)(Et,{side:`left`,children:new Date(e.timestamp).toLocaleString()})]})]}),r?(0,R.jsxs)(`div`,{className:`relative mx-3 mb-2 max-h-44 overflow-auto rounded-lg p-2 pr-8`,children:[(0,R.jsx)(CV,{data:e.message,className:`[&_pre]:!text-[10px] [&_pre]:!leading-4`}),(0,R.jsx)(jt,{variant:`secondary`,size:`icon-sm`,onClick:a,className:`absolute right-1 top-1 size-6 rounded-full p-0`,title:`Copy message`,"aria-label":`Copy message`,children:(0,R.jsx)(Wr,{className:`size-3`})})]}):null]})}function nH(e){let t=KV(e.message);if(t)return t;let n=e.message;return n?.result===void 0?n?.error===void 0?`unknown`:`error`:`result`}function rH(e){return e.source===`widget`?e.direction===`send`?`Host → Widget`:`Widget → Host`:e.direction===`send`?`Inspector → MCP`:`MCP → Inspector`}function iH({serverId:e,open:t}){return(0,R.jsx)(`aside`,{"aria-label":`RPC Panel`,"aria-hidden":!t,className:A(`relative hidden min-h-0 shrink-0 flex-col overflow-hidden transition-[width,margin] duration-200 ease-out lg:flex`,t?`w-(--rpc-panel-width) lg:mr-[18px]`:`w-0 lg:mr-0`),children:(0,R.jsx)(`div`,{className:A(`flex h-full min-h-0 w-(--rpc-panel-width) flex-col transition-opacity duration-200 ease-out`,t?`opacity-100`:`pointer-events-none opacity-0`),children:(0,R.jsx)(eH,{serverIds:[e]})})})}function aH(e){return`${e.replace(/\/+$/,``)}${nM()}`}function oH({tunnelUrl:e,tunnelMcpUrl:t,selectedServerId:n,selectedServer:r,configLoaded:i,removeConnection:a,updateConnection:o,connections:s}){let c=(0,z.useRef)(null),l=(0,z.useRef)(!1),u=(0,z.useRef)(null),[d,f]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{!d||r?.url!==u.current||r.state!==`ready`&&r.state!==`failed`||(f(!1),l.current=!1,u.current=null)},[d,r]),(0,z.useEffect)(()=>{n&&oM(n)?c.current=n:r?.url&&oM(r.url)&&(c.current=r.url)},[r?.url,n]),(0,z.useEffect)(()=>{if(!i||!n||!r||l.current)return;let d=r.url??``,p=oM(d),m=sM(d),h=t??(e?aH(e):null),g=null;e&&h&&p?g=h:!e&&m&&c.current&&(g=c.current),!(!g||g===d)&&(l.current=!0,u.current=g,f(!0),(async()=>{try{g!==n&&s.some(e=>e.id===g)&&await a(g),await o(n,yM({...xM(n)??bM(r),url:g}))}catch{f(!1),u.current=null,l.current=!1}})())},[i,s,a,r,n,t,e,o]),(0,z.useEffect)(()=>{d||(l.current=!1)},[d]),d}function sH({children:e}){let t=KN(),n=UN(),{servers:r,addServer:i,removeServer:a,updateServerMetadata:o,updateServer:s,storageLoaded:c}=Sj(),l=(0,z.useCallback)(async(e,t)=>{try{await s(e,yM(t)),hM(e,t)}catch(t){console.error(`[Layout] Failed to update connection ${e}:`,t)}},[s]),u=(0,z.useCallback)(async(e,t)=>{try{await o(e,t)}catch(t){console.error(`[Layout] Failed to update connection metadata for ${e}:`,t)}},[o]),{selectedServerId:d,setSelectedServerId:f,activeTab:p,setActiveTab:m,navigateToItem:h,setTunnelUrl:g,tunnelUrl:_,isEmbedded:v,embeddedConfig:y,setEmbeddedMode:b}=fL(),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-sidebar-collapsed`)===`true`}catch{return!1}}),[T,ee]=(0,z.useState)(()=>{try{return localStorage.getItem(`inspector-rpc-logger-open`)===`true`}catch{return!1}});(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-sidebar-collapsed`,C?`true`:`false`)}catch{}},[C]),(0,z.useEffect)(()=>{try{localStorage.setItem(`inspector-rpc-logger-open`,String(T))}catch{}},[T]);let{savedRequests:E}=hL();(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search),t=e.get(`embedded`)===`true`,r=e.get(`embeddedConfig`);if(t){let e={};if(r)try{e=JSON.parse(r)}catch(e){console.error(`Failed to parse embeddedConfig:`,e)}b(!0,e),e.defaultTab&&m(e.defaultTab)}},[]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tunnelUrl`);e!==null&&g(e)},[n.search,g]),(0,z.useEffect)(()=>{let e=new URLSearchParams(n.search).get(`tab`);e&&[`tools`,`prompts`,`resources`,`chat`,`sampling`,`elicitation`,`notifications`,`server-metadata`,`connection-settings`].includes(e)&&m(e)},[n.search,m]);let D=(0,z.useRef)(null),te=(0,z.useRef)(Date.now()),ne=(0,z.useRef)(new Set),O=(0,z.useRef)(0);(0,z.useEffect)(()=>{let e=()=>{O.current++};return window.addEventListener(`mcp-tool-executed`,e),()=>window.removeEventListener(`mcp-tool-executed`,e)},[]),(0,z.useEffect)(()=>{let e=()=>{try{ET(new Oo({durationSeconds:Math.round((Date.now()-te.current)/1e3),tabsVisited:ne.current.size,toolsExecuted:O.current})).catch(()=>{})}catch{}};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let re=(0,z.useCallback)(e=>{try{ET(new Eo({tab:e,previousTab:D.current})).catch(()=>{})}catch{}D.current=e,ne.current.add(e),m(e);let r=new URLSearchParams(n.search);r.set(`tab`,e),t(`/?${r.toString()}`,{replace:!0})},[m,t,n.search]);(0,z.useEffect)(()=>{let e=e=>{let t=e.detail.requestId;d&&h(d,`sampling`,t)},t=e=>{let t=e.detail.requestId;d&&h(d,`elicitation`,t)},n=e=>{let t=e.detail.toolName;d&&t?h(d,`tools`,t):d&&re(`tools`)};return window.addEventListener(`navigate-to-sampling`,e),window.addEventListener(`navigate-to-elicitation`,t),window.addEventListener(`navigate-to-tool-result`,n),()=>{window.removeEventListener(`navigate-to-sampling`,e),window.removeEventListener(`navigate-to-elicitation`,t),window.removeEventListener(`navigate-to-tool-result`,n)}},[d,re,h]);let k=(0,z.useRef)(null),ie=(0,z.useRef)(null),j=(0,z.useRef)(null),{isAutoConnecting:M}=dI({connections:r,addServer:i,removeConnection:a,configLoaded:c,embedded:v});(0,z.useEffect)(()=>{let e=()=>{let e=document.documentElement.classList.contains(`dark`)?`#000000`:`#f3f3f3`;document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]);let ae=(0,z.useCallback)(e=>{ET(new xo({trigger:e})).catch(()=>{}),S(!0)},[]),oe=e=>{if(!r.find(t=>t.id===e))return;f(e);let i=new URLSearchParams(n.search),a=i.get(`tunnelUrl`),o=i.get(`tab`),s=new URLSearchParams;s.set(`server`,e),a&&s.set(`tunnelUrl`,a),o&&s.set(`tab`,o),t(`/?${s.toString()}`)},se=(0,z.useCallback)(e=>{if(!d)return;let t=xM(d)||r.find(e=>e.id===d);e.url===d?t&&wM(t,e)?(u(d,{name:e.name||e.url}),hM(d,e)):l(d,e):(a(d),i(e.url,yM(e))),GF.success(`Connection settings updated`)},[d,r,a,i,u,l]),N=(e,i,a)=>{if(fetch(`http://127.0.0.1:7371/ingest/4e7482c5-571f-4071-bd09-762c357289f4`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Debug-Session-Id":`831b88`},body:JSON.stringify({sessionId:`831b88`,location:`Layout.tsx:handleCommandPaletteNavigate`,message:`layout navigate entry`,data:{tab:e,itemName:i??null,serverId:a??null,hasServerId:!!a},timestamp:Date.now(),hypothesisId:`H1`})}).catch(()=>{}),console.warn(`[Layout] handleCommandPaletteNavigate called:`,{tab:e,itemName:i,serverId:a}),a){let o=r.find(e=>e.id===a);if(console.warn(`[Layout] Server lookup:`,{serverId:a,serverFound:!!o,serverState:o?.state}),!o||o.state!==`ready`){console.warn(`[Layout] Server not ready, showing error`),GF.error(`Server is not connected and cannot be inspected`);return}console.warn(`[Layout] Calling navigateToItem:`,{serverId:a,tab:e,itemName:i}),fetch(`http://127.0.0.1:7371/ingest/4e7482c5-571f-4071-bd09-762c357289f4`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Debug-Session-Id":`831b88`},body:JSON.stringify({sessionId:`831b88`,location:`Layout.tsx:navigateToItem-call`,message:`calling navigateToItem`,data:{serverId:a,tab:e,itemName:i??null,serverState:o?.state??null},timestamp:Date.now(),hypothesisId:`H1`})}).catch(()=>{}),h(a,e,i);let s=new URLSearchParams(n.search),c=s.get(`tunnelUrl`),l=s.get(`tab`),u=new URLSearchParams;u.set(`server`,a),c&&u.set(`tunnelUrl`,c),e?u.set(`tab`,e):l&&u.set(`tab`,l);let d=`/?${u.toString()}`;console.warn(`[Layout] Navigating to:`,d),t(d)}else console.warn(`[Layout] No serverId, just updating tab to:`,e),re(e)},P=r.find(e=>e.id===d),ce=oH({tunnelUrl:_,selectedServerId:d,selectedServer:P,configLoaded:c,removeConnection:a,updateConnection:s,connections:r}),le=P?P.tools.map(e=>({...e,_serverId:P.id})):r.flatMap(e=>e.state===`ready`?e.tools.map(t=>({...t,_serverId:e.id,_serverName:lM(e)})):[]),ue=P?P.prompts.map(e=>({...e,_serverId:P.id})):r.flatMap(e=>e.state===`ready`?e.prompts.map(t=>({...t,_serverId:e.id,_serverName:lM(e)})):[]),de=P?P.resources.map(e=>({...e,_serverId:P.id})):r.flatMap(e=>e.state===`ready`?e.resources.map(t=>({...t,_serverId:e.id,_serverName:lM(e)})):[]);(0,z.useEffect)(()=>{if(ce)return;let e=new URLSearchParams(n.search),i=e.get(`server`);if(i&&(i.startsWith(`http://`)||i.startsWith(`https://`))&&!r.find(e=>e.id===i)){let n=new URLSearchParams(e);n.delete(`server`),n.set(`autoConnect`,i),t(`/?${n.toString()}`,{replace:!0});return}i!==d&&f(i)},[n.search,d,f,r,t,ce]),(0,z.useEffect)(()=>{if(ce)return;let e=new URLSearchParams(n.search).get(`server`);if(e&&!r.find(t=>t.id===e)){let e=setTimeout(()=>t(`/`),3e3);return()=>clearTimeout(e)}},[n.search,t,r,ce]),(0,z.useEffect)(()=>{if(!v)return;let e=e=>{if(!e.data||typeof e.data!=`object`||e.data.type!==`mcp-inspector:connect_servers`)return;let t=e.data.servers;if(!Array.isArray(t)||t.length===0)return;let n=null;for(let e of t){if(!e.url||typeof e.url!=`string`)continue;let t=e.url,a=e.name??`Server`,o={...e.headers??{}};if(e.auth?.access_token){let t=e.auth.token_type||`bearer`;o.Authorization=`${t.charAt(0).toUpperCase()+t.slice(1)} ${e.auth.access_token}`}let s=typeof e.proxyConfig?.proxyAddress==`string`?e.proxyConfig.proxyAddress.trim():``,c=``;try{new URL(t).origin!==window.location.origin&&(c=uM())}catch{c=uM()}let l=s||c,u=dM(e.connectionMode,e.connectionType,!!s),d=yM({url:t,name:a,transportType:`http`,connectionMode:u,connectionType:u===`proxy`?`Via Proxy`:`Direct`,proxyConfig:u===`proxy`&&l?{proxyAddress:l,...Object.keys(o).length>0?{headers:o}:{}}:void 0,headers:o,autoProxyFallback:u===`auto`&&l?{enabled:!0,proxyAddress:l}:!1});r.find(e=>e.url===t)||i(t,d),n||=t}window.parent!==window&&window.parent.postMessage({type:`mcp-inspector:servers_connected`,count:t.length},`*`)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[v,r,i]);let fe=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(!v||fe.current||d)return;let e=r.find(e=>e.state===`ready`);if(e){fe.current=!0,f(e.id);let r=new URLSearchParams(n.search);r.set(`server`,e.id),t(`/?${r.toString()}`,{replace:!0})}},[v,r,d,f,t,n.search]),pL({onCommandPalette:()=>ae(`keyboard`),onToolsTab:()=>{P&&re(`tools`)},onPromptsTab:()=>{P&&re(`prompts`)},onResourcesTab:()=>{P&&re(`resources`)},onChatTab:()=>{P&&re(`chat`)},onHome:()=>{t(`/`)},onFocusSearch:()=>{p===`tools`&&k.current?k.current.focusSearch():p===`prompts`&&ie.current?ie.current.focusSearch():p===`resources`&&j.current&&j.current.focusSearch()},onBlurSearch:()=>{p===`tools`&&k.current?k.current.blurSearch():p===`prompts`&&ie.current?ie.current.blurSearch():p===`resources`&&j.current&&j.current.blurSearch()}});let pe=new URLSearchParams(n.search).get(`server`),me=!c&&!!pe&&!pe.startsWith(`http://`)&&!pe.startsWith(`https://`),he=M||me||ce,ge=P?.id??`home`,_e=he?`boot`:ge,[ve,ye]=(0,z.useState)(_e);(0,z.useLayoutEffect)(()=>{if(_e===ve)return;let e=()=>(0,br.flushSync)(()=>ye(_e));typeof document.startViewTransition==`function`?document.startViewTransition(e):e()},[_e,ve]);let be=ve===`boot`,F=be||ve===`home`?void 0:r.find(e=>e.id===ve),xe=v&&y.singleTab,Se=v?{backgroundColor:y.backgroundColor||`#f3f3f3`,padding:xe?`0`:y.padding||`0.5rem`}:{},Ce=v?xe?`h-screen flex flex-col`:`h-screen flex flex-col gap-2 sm:gap-4`:`h-screen bg-[#f3f3f3] dark:bg-black flex flex-col px-4 lg:px-0 pb-4`,we=xe?`flex-1 w-full bg-white dark:bg-black p-0 overflow-auto`:A(`flex-1 min-h-0 w-full bg-white dark:bg-black rounded-2xl border border-zinc-200 dark:border-zinc-700 overflow-auto`,!F&&`lg:mx-4`,F&&`lg:mr-4`);return(0,R.jsxs)(nt,{children:[(0,R.jsx)(`div`,{className:`inspector-view-transition h-screen bg-[#f3f3f3] dark:bg-black`,children:be?(0,R.jsx)(`div`,{className:`flex h-full items-center justify-center bg-[#f3f3f3] dark:bg-black`,children:(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,R.jsx)(aL,{className:`h-8 w-8 text-zinc-600 dark:text-zinc-400`}),(0,R.jsx)(`p`,{className:`text-sm text-zinc-600 dark:text-zinc-400`,children:`Connecting to MCP server...`})]})}):(0,R.jsxs)(`div`,{className:Ce,style:Se,children:[!xe&&(0,R.jsx)(_B,{connections:r,selectedServer:F,activeTab:p,onServerSelect:oe,onTabChange:re,embedded:v,sidebarCollapsed:C}),(0,R.jsxs)(`div`,{className:xe?`flex-1 min-h-0`:`flex flex-1 min-h-0 min-w-0`,children:[F&&!xe&&(0,R.jsx)(aV,{activeTab:p,onTabChange:re,selectedServer:F,visibleTabs:y.visibleTabs,collapsed:C,onCollapsedChange:w,rpcLoggerOpen:T,onRpcLoggerOpenChange:ee,onCommandPaletteOpen:()=>ae(`button`)}),(0,R.jsx)(`main`,{className:we,children:(0,R.jsx)(VR,{selectedServer:F,activeTab:p,toolsSearchRef:k,promptsSearchRef:ie,resourcesSearchRef:j,onUpdateConnection:se,children:e})}),F&&!xe&&(0,R.jsx)(iH,{serverId:F.id,open:T})]})]})}),(0,R.jsx)(ML,{isOpen:x,onOpenChange:S,tools:le,prompts:ue,resources:de,savedRequests:E,connections:r,selectedServer:P,tunnelUrl:_,onNavigate:N,onServerSelect:oe})]})}function cH({...e}){let{resolvedTheme:t}=_z();return(0,R.jsx)(oI,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}var lH=(0,z.createContext)(void 0),uH={deviceType:`desktop`,customViewport:{width:768,height:1024},cspMode:`permissive`,displayModeOverride:null,capabilities:{hover:!0,touch:!1},safeAreaInsets:{top:0,right:0,bottom:0,left:0},locale:`en-US`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`};function dH({children:e}){let[t,n]=(0,z.useState)({activeWidgetId:null,widgets:new Map,playground:uH}),r=(0,z.useCallback)(e=>{n(t=>({...t,activeWidgetId:e}))},[]),i=(0,z.useCallback)((e,t)=>{n(n=>{if(n.widgets.has(e))return n;let r=new Map(n.widgets);return r.set(e,{...t,cspViolations:[]}),{...n,widgets:r}})},[]),a=(0,z.useCallback)(e=>{n(t=>{let n=new Map(t.widgets);return n.delete(e),{...t,widgets:n,activeWidgetId:t.activeWidgetId===e?null:t.activeWidgetId}})},[]),o=(0,z.useRef)(t);o.current=t;let s=(0,z.useCallback)(e=>o.current.widgets.get(e),[]),c=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i={cspViolations:[...r.cspViolations,t]};t.originalPolicy&&r.effectivePolicy===void 0&&(i.effectivePolicy=t.originalPolicy);let a=new Map(n.widgets);return a.set(e,{...r,...i}),{...n,widgets:a}})},[]),l=(0,z.useCallback)(e=>{n(t=>{let n=t.widgets.get(e);if(!n)return t;let r=new Map(t.widgets);return r.set(e,{...n,cspViolations:[]}),{...t,widgets:r}})},[]),u=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,modelContext:t}),{...n,widgets:i}})},[]),d=(0,z.useCallback)((e,t)=>{n(n=>{let r=n.widgets.get(e);if(!r)return n;let i=new Map(n.widgets);return i.set(e,{...r,widgetState:t}),{...n,widgets:i}})},[]),f=(0,z.useCallback)((e,t,r)=>{n(n=>{let i=n.widgets.get(e);if(!i)return n;let a=new Map(n.widgets);return a.set(e,{...i,declaredCsp:t,...r!==void 0&&{effectivePolicy:r}}),{...n,widgets:a}})},[]),p=(0,z.useCallback)(e=>{n(t=>({...t,playground:{...t.playground,...e}}))},[]),m=(0,z.useCallback)(()=>{n(e=>({...e,widgets:new Map,activeWidgetId:null}))},[]),h=(0,z.useCallback)(()=>{let e=new Map;for(let[n,r]of t.widgets)r.modelContext&&e.set(n,r.modelContext);return e},[t.widgets]);return(0,R.jsx)(lH,{value:(0,z.useMemo)(()=>({...t,setActiveWidget:r,addWidget:i,removeWidget:a,getWidget:s,addCspViolation:c,clearCspViolations:l,setWidgetModelContext:u,setWidgetState:d,setWidgetDeclaredCsp:f,updatePlaygroundSettings:p,clearAllWidgets:m,getAllModelContexts:h}),[t,r,i,a,s,c,l,u,d,f,p,m,h]),children:e})}function fH(){let e=(0,z.use)(lH);if(!e)throw Error(`useWidgetDebug must be used within WidgetDebugProvider`);return e}var pH={mobile:{width:390,height:844,name:`iPhone 14`},tablet:{width:820,height:1180,name:`iPad Air`},desktop:{width:1440,height:900,name:`Desktop`},custom:{width:768,height:1024,name:`Custom`}},mH=(0,z.lazy)(()=>tS(()=>import(`./OAuthCallback-BjcRxLh5.js`).then(e=>({default:e.OAuthCallback})),__vite__mapDeps([40,1,5]))),hH=(0,z.lazy)(()=>tS(()=>import(`./ManufactOAuthCallback-DCLbW-mz.js`).then(e=>({default:e.ManufactOAuthCallback})),__vite__mapDeps([41,1,5]))),gH=(0,z.lazy)(()=>tS(()=>import(`./ViewPreview-jgeU7bY9.js`).then(e=>({default:e.ViewPreview})),__vite__mapDeps([42,1,5,19])));function _H({activeTabRef:e}){let{activeTab:t}=fL();return(0,z.useEffect)(()=>{e.current=t},[t,e]),null}function vH(){let e=(0,z.useRef)(`tools`),t=new URLSearchParams(window.location.search),n=t.get(`embedded`)===`true`,r=t.get(`theme`),i=(0,z.useMemo)(()=>n?void 0:new TM(`mcp-inspector-connections`),[n]),a=uM(),o=a?.replace(/\/proxy\/?$/,`/oauth`),s=rM();return(0,z.useEffect)(()=>{wT()},[]),(0,z.useEffect)(()=>{let e=t.get(`auth_error`);if(!e)return;let n=t.get(`auth_error_description`);GF.error(`OAuth authentication failed: ${n||e}`,{duration:1/0,closeButton:!0});let r=new URLSearchParams(t);r.delete(`auth_error`),r.delete(`auth_error_description`);let i=r.toString();window.history.replaceState({},``,`${window.location.pathname}${i?`?${i}`:``}`)},[]),(0,R.jsx)(vz,{forcedTheme:r||void 0,children:(0,R.jsx)(pe,{defaultShape:`pill`,children:(0,R.jsx)(dH,{children:(0,R.jsx)(xj,{storageProvider:i,enableRpcLogging:!0,defaultCallbackUrl:`${window.location.origin}${s}/oauth/callback`,defaultOAuthProxyUrl:o,defaultAutoProxyFallback:a?{enabled:!0,proxyAddress:a}:!1,defaultServerConfig:{preventAutoAuth:!0,useRedirectFlow:!0},clientInfo:{name:`mcp-use Inspector`,version:ko(),websiteUrl:`https://mcp-use.com`,icons:[{src:`https://mcp-use.com/logo.png`}],capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:[`text/html;profile=mcp-app`]}}}},onServerAdded:(e,t)=>{console.log(`[Inspector] Server added:`,e,t.state)},onServerRemoved:e=>{console.log(`[Inspector] Server removed:`,e)},onServerStateChange:(e,t)=>{console.log(`[Inspector] Server state changed:`,e,t)},onSamplingRequest:(e,t,n,r,i)=>{let a=GF((0,R.jsx)(Fn,{title:`Sampling Request Received`,description:`New request from ${n}`,actions:[{label:`View Details`,testId:`sampling-toast-view-details`,onClick:()=>{let t=new CustomEvent(`navigate-to-sampling`,{detail:{requestId:e.id}});window.dispatchEvent(t),GF.dismiss(a)}},{label:`Approve`,testId:`sampling-toast-approve`,onClick:()=>{r(e.id,In),GF.success(`Sampling request approved`),GF.dismiss(a)}},{label:`Deny`,testId:`sampling-toast-deny`,onClick:()=>{i(e.id,`User denied from toast`),GF.dismiss(a)}}]}),{duration:1/0})},onElicitationRequest:(t,n,r,i,a)=>{if(e.current===`chat`)return;let o=t.request.mode||`form`,s=t.request.message,c=o===`url`&&`url`in t.request?t.request.url:void 0,l=GF((0,R.jsx)(Fn,{title:`Elicitation Request Received`,description:`From ${r}: ${s}`,extra:o===`url`&&c?(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 font-mono`,children:c}):void 0,actions:[{label:`View Details`,testId:`elicitation-toast-view-details`,onClick:()=>{let e=new CustomEvent(`navigate-to-elicitation`,{detail:{requestId:t.id}});window.dispatchEvent(e),GF.dismiss(l)}},...o===`url`&&c?[{label:`Open URL`,testId:`elicitation-toast-open-url`,onClick:()=>{window.open(c,`_blank`),GF.dismiss(l)}}]:[],{label:`Cancel`,testId:`elicitation-toast-cancel`,onClick:()=>{a(t.id,`User cancelled from toast`),GF.dismiss(l)}}]}),{duration:1/0})},children:(0,R.jsxs)(dL,{children:[(0,R.jsx)(_H,{activeTabRef:e}),(0,R.jsx)(lF,{basename:s,children:(0,R.jsxs)(bP,{children:[(0,R.jsx)(vP,{path:`/oauth/callback`,element:(0,R.jsx)(kR,{children:(0,R.jsx)(mH,{})})}),(0,R.jsx)(vP,{path:`/auth/callback`,element:(0,R.jsx)(kR,{children:(0,R.jsx)(hH,{})})}),(0,R.jsx)(vP,{path:`/preview/:view`,element:(0,R.jsx)(kR,{children:(0,R.jsx)(gH,{})})}),(0,R.jsx)(vP,{path:`/`,element:(0,R.jsx)(sH,{children:(0,R.jsx)(lL,{})})})]})}),(0,R.jsx)(cH,{position:`top-center`})]})})})})})}var yH=document.getElementById(`root`);yH?Pn.createRoot(yH).render((0,R.jsx)(vH,{})):console.error(`[inspector] Root element not found`);export{JN as $,Zr as $t,YI as A,qa as At,zI as B,Pi as Bt,pL as C,To as Ct,rL as D,mo as Dt,iL as E,ho as Et,eL as F,Ji as Ft,wI as G,yi as Gt,MI as H,Oi as Ht,JI as I,qi as It,gI as J,si as Jt,yI as K,vi as Kt,HI as L,Ui as Lt,$I as M,Za as Mt,XI as N,Ja as Nt,qI as O,So as Ot,QI as P,Pa as Pt,GF as Q,$r as Qt,VI as R,Hi as Rt,hL as S,hf as St,aL as T,go as Tt,EI as U,wi as Ut,NI as V,ki as Vt,TI as W,bi as Wt,pI as X,ri as Xt,hI as Y,ai as Yt,mI as Z,ti as Zt,Qz as _,ET as _t,PV as a,Ir as an,cM as at,jR as b,tS as bt,OV as c,jr as cn,iM as ct,pV as d,Yj as dt,Xr as en,bF as et,sV as f,Lj as ft,$z as g,Sj as gt,Zz as h,cj as ht,FV as i,Vr as in,bM as it,tL as j,Ya as jt,ZI as k,to as kt,CV as l,vr as ln,Qj as lt,wB as m,Rj as mt,fH as n,qr as nn,uM as nt,NV as o,Fr as on,lM as ot,RB as p,zj as pt,fI as q,di as qt,XV as r,Wr as rn,xM as rt,kV as s,Mr as sn,nM as st,pH as t,Yr as tn,gM as tt,fV as u,_r as un,$j as ut,_z as v,RC as vt,fL as w,vo as wt,mR as x,Mb as xt,XR as y,Q as yt,BI as z,Li as zt};