@agimon-ai/po-cloudflare 0.0.2-alpha.20 → 0.0.2-alpha.21

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 (222) hide show
  1. package/dist/{agent-DTjnYFAN.js → agent-DZ-OKOHn.js} +1 -1
  2. package/dist/{apiContracts-DepyzMNr.js → apiContracts-b33nSAAI.js} +4 -80
  3. package/dist/{approval-Biq3NCWj.js → approval-r3NnI1VC.js} +2 -2
  4. package/dist/{approvalPrompt-DoHlIPkU.js → approvalPrompt-DWoXxu3S.js} +2 -2
  5. package/dist/artifactFiles-DLCReI0-.js +1 -0
  6. package/dist/assets/assets/{CodeEditorView-BU8DeV_G.js → CodeEditorView-XeNS0L9M.js} +2 -2
  7. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-BkzARjqu.js → abnfDiagram-WEYOIA3C-B6ZW0nkR.js} +2 -2
  8. package/dist/assets/assets/{architecture-WOLXFQ4H-B_dgnlXa.js → architecture-WOLXFQ4H-bVR64sHO.js} +1 -1
  9. package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DMGAifk0.js → architectureDiagram-ZHVYKT53-D7tZz3io.js} +2 -2
  10. package/dist/assets/assets/{blockDiagram-RJAE7QA3-DwTSK4lj.js → blockDiagram-RJAE7QA3-DdwScfiX.js} +2 -2
  11. package/dist/assets/assets/{c4Diagram-XDPPPE54-IRaOcC_u.js → c4Diagram-XDPPPE54-DgSxZJCV.js} +2 -2
  12. package/dist/assets/assets/channel-TPcVvp_3.js +2 -0
  13. package/dist/assets/assets/{chunk-2E7WHVMD-BvS46crW.js → chunk-2E7WHVMD-D5TXC2SM.js} +2 -2
  14. package/dist/assets/assets/{chunk-4EMNKR2T--n96Xbj0.js → chunk-4EMNKR2T-BWhOSvo1.js} +2 -2
  15. package/dist/assets/assets/{chunk-55XCU76K-D3h_hFRi.js → chunk-55XCU76K-HkkBzLtZ.js} +2 -2
  16. package/dist/assets/assets/{chunk-7S6XSTFO-Cj18feJl.js → chunk-7S6XSTFO-CBnjycLU.js} +2 -2
  17. package/dist/assets/assets/{chunk-AQDTSKZB-DXsT43bg.js → chunk-AQDTSKZB-75lIIq8T.js} +2 -2
  18. package/dist/assets/assets/{chunk-DSNLSHJZ-Br7dX7yf.js → chunk-DSNLSHJZ-D8PpnXMk.js} +2 -2
  19. package/dist/assets/assets/{chunk-HAGFOTED-BcozAtPo.js → chunk-HAGFOTED-CXRS2NIN.js} +2 -2
  20. package/dist/assets/assets/{chunk-HNE4Q36P-B8kgXgRq.js → chunk-HNE4Q36P-BocUqS94.js} +2 -2
  21. package/dist/assets/assets/{chunk-NQOKRVIF-Dn7UnsqE.js → chunk-NQOKRVIF-CHf_ogYT.js} +2 -2
  22. package/dist/assets/assets/{chunk-UHW7PFBP-BSJot0vi.js → chunk-UHW7PFBP-DrW1PaIv.js} +2 -2
  23. package/dist/assets/assets/{chunk-VQ5W62QI-Cpf1EfZK.js → chunk-VQ5W62QI-CLoA7bFm.js} +2 -2
  24. package/dist/assets/assets/{chunk-WQQL4CDK-Dnc36uZR.js → chunk-WQQL4CDK-BmBsrj9I.js} +2 -2
  25. package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +2 -0
  26. package/dist/assets/assets/{chunk-YZO67HFG-BV8_A7x3.js → chunk-YZO67HFG-DShE_cgv.js} +2 -2
  27. package/dist/assets/assets/{chunk-ZAUX2LTX-C4Ne_31B.js → chunk-ZAUX2LTX-B3oLvSXy.js} +2 -2
  28. package/dist/assets/assets/{chunk-ZCHMQSOR-Dq9ModsA.js → chunk-ZCHMQSOR-B14vKK7C.js} +2 -2
  29. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-1BWEjXP9.js → classDiagram-v2-4MYWR3UA-Da8elIW2.js} +2 -2
  30. package/dist/assets/assets/{cose-bilkent-JH36ORCC-DREkvC_x.js → cose-bilkent-JH36ORCC-Du4tGtiJ.js} +2 -2
  31. package/dist/assets/assets/{cynefin-EF2NZ3EQ-CWziP8nx.js → cynefin-EF2NZ3EQ-Cyj6i_WI.js} +1 -1
  32. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-DOoYmcvz.js → cynefinDiagram-WF24UDRP-DFWXwO7A.js} +2 -2
  33. package/dist/assets/assets/{dagre-NK4GIZVX-OoAtEico.js → dagre-NK4GIZVX-C1wB_cf-.js} +2 -2
  34. package/dist/assets/assets/{diagram-CBK3MWTC-B-pl2-iR.js → diagram-CBK3MWTC-MYCOBYl6.js} +2 -2
  35. package/dist/assets/assets/{diagram-I5XIIV2D-uKzNJSZ2.js → diagram-I5XIIV2D-BFYbKUFf.js} +2 -2
  36. package/dist/assets/assets/{diagram-ODIL2UCW-CEXY_Tzu.js → diagram-ODIL2UCW-6siqTpv_.js} +2 -2
  37. package/dist/assets/assets/{diagram-PFBEJUXE-MKlRQo-g.js → diagram-PFBEJUXE-CaBr9CoB.js} +2 -2
  38. package/dist/assets/assets/{diagram-RJA3I4VV-c2qlCEVs.js → diagram-RJA3I4VV-DAvmuDpc.js} +2 -2
  39. package/dist/assets/assets/{diagram-TYUNFSNR-DTdqLA6J.js → diagram-TYUNFSNR-CJnhgCpo.js} +2 -2
  40. package/dist/assets/assets/{dist-qZHwVT1x.js → dist-BQ4W1R18.js} +2 -2
  41. package/dist/assets/assets/{dist-DvZCwSZ8.js → dist-BnzFckPF.js} +2 -2
  42. package/dist/assets/assets/{dist-DCKskbBE.js → dist-CFtBpcYL.js} +2 -2
  43. package/dist/assets/assets/{dist-mQUN8X3n.js → dist-CIQX1z4W.js} +2 -2
  44. package/dist/assets/assets/{dist-D9lacOpq.js → dist-ChHYoe9_.js} +2 -2
  45. package/dist/assets/assets/{dist-BzTxJnSR.js → dist-DKxZO8d9.js} +2 -2
  46. package/dist/assets/assets/{dist-DCc8tQ7G.js → dist-DL6z28wl.js} +2 -2
  47. package/dist/assets/assets/{dist-4TUOlkyl.js → dist-DNyn1p9Z.js} +2 -2
  48. package/dist/assets/assets/{dist-DXlts_H5.js → dist-qYlLXIa8.js} +2 -2
  49. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-C89wxfCd.js → ebnfDiagram-V4P3TTPT-AUcqDTM3.js} +2 -2
  50. package/dist/assets/assets/{elk-QONTBCTQ-BMBgLOae.js → elk-QONTBCTQ-aA10PEHJ.js} +2 -2
  51. package/dist/assets/assets/{erDiagram-KYQIGQAA-Bb04CRa4.js → erDiagram-KYQIGQAA-hhYiqA-x.js} +2 -2
  52. package/dist/assets/assets/{eventmodeling-K75KTNOO-DSyNf2MV.js → eventmodeling-K75KTNOO-BQZqbRo5.js} +1 -1
  53. package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +1 -0
  54. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-sB7-pF_t.js → ganttDiagram-R7GPNTJY-CLON1GpW.js} +2 -2
  55. package/dist/assets/assets/{gitGraph-VSP46ZUC-pWPBCmdT.js → gitGraph-VSP46ZUC-DbmvNwR2.js} +1 -1
  56. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-DronDRed.js → gitGraphDiagram-PDYL7XHY-DJVO0WlL.js} +2 -2
  57. package/dist/assets/assets/index-BiTVAj5E.js +155 -0
  58. package/dist/assets/assets/{info-OHQRW6UA-B375mT1i.js → info-OHQRW6UA-CAt3Nt3g.js} +1 -1
  59. package/dist/assets/assets/{infoDiagram-MVDRKAX5-9Hw3wWP7.js → infoDiagram-MVDRKAX5-DTuqH-Zb.js} +2 -2
  60. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CdPAuupk.js → ishikawaDiagram-HPEHV2GE-BnWvdonT.js} +2 -2
  61. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-hqmaHM9u.js → journeyDiagram-BOSHW7O7-Btxtcgvl.js} +2 -2
  62. package/dist/assets/assets/{kanban-definition-FNSA4HC5-BdOHplX4.js → kanban-definition-FNSA4HC5-q7ek9o_H.js} +2 -2
  63. package/dist/assets/assets/{line-BCSC3Bu2.js → line-B7yLilmC.js} +2 -2
  64. package/dist/assets/assets/{linear-D5ddQU3r.js → linear-y8aSKEli.js} +2 -2
  65. package/dist/assets/assets/{mermaid-parser.core-BaSUi_Ph.js → mermaid-parser.core-B4rH50nD.js} +4 -4
  66. package/dist/assets/assets/{mermaid.core-CUUsU9Ou.js → mermaid.core-DnRVHTjE.js} +5 -5
  67. package/dist/assets/assets/{mindmap-definition-6OY57UG3-BtVkhvIZ.js → mindmap-definition-6OY57UG3-DT9Afs2v.js} +2 -2
  68. package/dist/assets/assets/{packet-JDAUHWVQ-CQ3OUDwI.js → packet-JDAUHWVQ-CnqNbu4p.js} +1 -1
  69. package/dist/assets/assets/{pegDiagram-ECIUJNBX-DDnq-Kn3.js → pegDiagram-ECIUJNBX-cvxdBBFq.js} +2 -2
  70. package/dist/assets/assets/{pie-XZMESJXO-BvOFTkQB.js → pie-XZMESJXO-etXMNsaL.js} +1 -1
  71. package/dist/assets/assets/{pieDiagram-GNMPY74T-Bdwhl9jD.js → pieDiagram-GNMPY74T-CBN-R3_j.js} +2 -2
  72. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-GHKoDEeT.js → quadrantDiagram-D57K4MC3-C5jjVPIH.js} +2 -2
  73. package/dist/assets/assets/{radar-ABXABTNO-Yk9rKkKW.js → radar-ABXABTNO-CAMd_mrV.js} +1 -1
  74. package/dist/assets/assets/{railroad-I3PHUGI6-Crr2QEwm.js → railroad-I3PHUGI6-DIs3auoe.js} +1 -1
  75. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-CLrgwBog.js → railroad-abnf-LNEFI6M7-CJXr1qWy.js} +1 -1
  76. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-zWReI6MC.js → railroad-ebnf-DWYD2UWJ-DfwtykqI.js} +1 -1
  77. package/dist/assets/assets/{railroad-peg-JR7BVNR7-CnVnlaHi.js → railroad-peg-JR7BVNR7-B8beAhTs.js} +1 -1
  78. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-MJ68mMla.js → railroadDiagram-Y72NRBL7-BDcQE-EL.js} +2 -2
  79. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-BYb-mTCH.js → requirementDiagram-EQYSW5RA-KJ4-QjZM.js} +2 -2
  80. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-DzONJsqQ.js → sankeyDiagram-SY24JHO5-VjIB-Ybr.js} +2 -2
  81. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-0vav9YWV.js → sequenceDiagram-BLEHNHQU-MfMuWq1M.js} +2 -2
  82. package/dist/assets/assets/{src-DZJUnjaM.js → src-BAxIj8GJ.js} +2 -2
  83. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-B0M8THPh.js → stateDiagram-v2-A6IESKWZ-mHwLRRCY.js} +2 -2
  84. package/dist/assets/assets/{swimlanes-B3ENRKFQ-5YJZCHIB.js → swimlanes-B3ENRKFQ-PArlYoqV.js} +2 -2
  85. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +9 -0
  86. package/dist/assets/assets/{timeline-definition-JXYKGLGB-us1LwUHo.js → timeline-definition-JXYKGLGB-B2nKiNFU.js} +2 -2
  87. package/dist/assets/assets/{treeView-D4JQ5SDB-BSLlcDre.js → treeView-D4JQ5SDB-gU23_RuI.js} +1 -1
  88. package/dist/assets/assets/{treemap-SAJKECNS-DZ2SwLmk.js → treemap-SAJKECNS-CiqoMvZa.js} +1 -1
  89. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-BrmvO_6k.js → usecaseDiagram-WPOLBNNX-DpeoWpMK.js} +2 -2
  90. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-FKXSeKp5.js → vennDiagram-Q3Y3IDCW-C31iGKvM.js} +2 -2
  91. package/dist/assets/assets/{wardley-7MLQ67FV-DZ_vIMp2.js → wardley-7MLQ67FV-CIzHhzNw.js} +1 -1
  92. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CfLYNckm.js → wardleyDiagram-IVAIDKWA-DIIkoezc.js} +2 -2
  93. package/dist/assets/assets/{webpack-CiS_BB3R.js → webpack-RFseiMZW.js} +2 -2
  94. package/dist/assets/assets/{xychartDiagram-4URNHDU4-DBucwhQh.js → xychartDiagram-4URNHDU4-QiHL91kC.js} +2 -2
  95. package/dist/assets/bundle-asset-policy.json +1 -1
  96. package/dist/assets/index.html +1 -1
  97. package/dist/assets/plugins/assets/base-CKKRZ7-h.css +2 -0
  98. package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
  99. package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
  100. package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
  101. package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +1 -0
  102. package/dist/assets/plugins/compositions.json +1 -1
  103. package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +2 -0
  104. package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +1 -0
  105. package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +93 -0
  106. package/dist/assets/plugins/slots/{autocompact.ec8f713f-B3KTYwW1.js → autocompact.dd97d013-IVq4Z6qm.js} +1 -1
  107. package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +7 -0
  108. package/dist/assets/plugins/slots/codemode.8eaee717-VWt9PqsU.js +10 -0
  109. package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +1 -0
  110. package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +7 -0
  111. package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +2 -0
  112. package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +1 -0
  113. package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +1 -0
  114. package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +3 -0
  115. package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +4 -0
  116. package/dist/assets/plugins/slots/{mcp.ea8b6aa2-D0CkHnIw.js → mcp.974af249-DPNHn9XH.js} +10 -10
  117. package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +3 -0
  118. package/dist/assets/plugins/slots/{profile.63bc3ae6-BSY3iYfJ.js → profile.48851a1d-yX6tzV3x.js} +1 -1
  119. package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +3 -0
  120. package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +1 -0
  121. package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +8 -0
  122. package/dist/assets/plugins/slots/skill.086701a4-CL6h_F-x.js +4 -0
  123. package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +1 -0
  124. package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.js +1 -0
  125. package/dist/{atomicJson-DCIsEywH.js → atomicJson-C_7F2zD1.js} +2 -3
  126. package/dist/{backgroundWork-Bswjs1av.js → backgroundWork-B1mPDYlf.js} +1 -1
  127. package/dist/{codemode-CgVosRtU.js → codemode-DQFmrosw.js} +1 -1
  128. package/dist/{contracts-CylyLZC8.js → contracts-DD3f1Lpn.js} +1 -1
  129. package/dist/exports-B0WMEXCP.js +34 -0
  130. package/dist/{exports-DERO0cQf.js → exports-D09VsUk-.js} +6 -7
  131. package/dist/{exports-C_dclnKs.js → exports-nV43ShA7.js} +10 -9
  132. package/dist/{extensionFile-Ds7RCpnb.js → extensionFile-DNM4xsje.js} +16 -2
  133. package/dist/{domains-BqChtBLN.js → harnessState-Dwrk3lfv.js} +90 -5
  134. package/dist/{harnessStore-BectazJQ.js → harnessStore-Z7yDLO45.js} +4 -5
  135. package/dist/{help-Dpm82qDr.js → help-w6vVEZGL.js} +15 -5
  136. package/dist/hubChannel-Cm-sxOvU.js +21 -0
  137. package/dist/{index.edge-b0z7PQ6b.js → index.edge-DyYmurS7.js} +14 -2
  138. package/dist/{index.edge-B0D_Lgbx.js → index.edge-K0w5auwG.js} +2 -2
  139. package/dist/{index.edge-BLmsRNW8.js → index.edge-Xa5LLtxz.js} +13 -3
  140. package/dist/{layeredConfig-pQGjhAks.js → layeredConfig-CUkYUs1f.js} +74 -5
  141. package/dist/{majorModes-BrL4EtzH.js → majorModes-BB0PXgFn.js} +3 -4
  142. package/dist/majorModes-C7vtBs4D.js +1 -0
  143. package/dist/{mcpProjection-pbPBBuvs.js → mcpProjection-BtKzB6oK.js} +2 -2
  144. package/dist/modeDefinition-C3Zbrw48.js +44 -0
  145. package/dist/narration-CpRurWLO.js +127 -0
  146. package/dist/{notification-CINsJWDL.js → notification-kckG3leF.js} +2 -2
  147. package/dist/{hubChannel-COvmdWGO.js → packageApi-t1oCjNDU.js} +2 -22
  148. package/dist/{piConfig-BDUpA6w0.js → piConfig-DQzlbPY4.js} +4 -5
  149. package/dist/piSettings-Cf1QofNe.js +1 -0
  150. package/dist/platform-BIEiM4TG.js +113 -0
  151. package/dist/pluginProtocol-BqXXyI4z.js +80 -0
  152. package/dist/{protocol-B6LbEIe6.js → protocol-DDL8geoS.js} +2 -2
  153. package/dist/{server-DRcCuj6P.js → server-AbXyhXlY.js} +4 -4
  154. package/dist/{server-Re1VNk9s.js → server-B6dqQoh2.js} +7 -6
  155. package/dist/{server-cStfn1Yv.js → server-BIHo9TFu.js} +4 -4
  156. package/dist/{server-1O3JEYO0.js → server-BJ7DNzCp.js} +7 -7
  157. package/dist/server-BO-j_GbD.js +15106 -0
  158. package/dist/{server-Cgym-G0a.js → server-BQzAiMns.js} +11 -11
  159. package/dist/server-BR7SZtj7.js +3125 -0
  160. package/dist/{server-DL6UyXfJ.js → server-BT2ORK83.js} +9 -8
  161. package/dist/{server-CzJjYgVk.js → server-BbSHYRnY.js} +3 -3
  162. package/dist/{server-DFCXmDed.js → server-BqoKlEGk.js} +8 -8
  163. package/dist/{server-BXFDsLgm.js → server-Busl0pQI.js} +8 -9
  164. package/dist/server-CIHM4jqu.js +1116 -0
  165. package/dist/{server-DhkR6ugd.js → server-CgWSSdvd.js} +6 -7
  166. package/dist/{server-B8P-UkxF.js → server-Co_UWKrR.js} +5 -5
  167. package/dist/{server-Bt6Zsqo8.js → server-CuEPb7u-.js} +2 -2
  168. package/dist/{server-V8W5mcGu.js → server-D40q2Jpx.js} +47 -27
  169. package/dist/{server-OerXqXJT.js → server-DCyf2Asb.js} +3 -4
  170. package/dist/{server-CCwwnpH0.js → server-DH7PfLln.js} +5 -5
  171. package/dist/{server-_0288DYR.js → server-DJ8bc89M.js} +3 -4
  172. package/dist/{server-GIQIpf33.js → server-DYdp0W9v.js} +7 -7
  173. package/dist/{server-B2G-c0hg.js → server-DsdPEYGu.js} +5 -5
  174. package/dist/{server-Dgn4el5K.js → server-DymH4Ucq.js} +4 -5
  175. package/dist/{server-pY027myK.js → server-IqECnUrb.js} +13 -236
  176. package/dist/{server-Ci_BGVwd.js → server-KBgW77zh.js} +3 -3
  177. package/dist/server-RW_9R3R3.js +1522 -0
  178. package/dist/server-aUit8j6r.js +1028 -0
  179. package/dist/{server-Ci3ls6LL.js → server-gifRriZK.js} +10 -11
  180. package/dist/{server-BR9yl54i.js → server-nkUlqnAL.js} +10 -10
  181. package/dist/server-oxyEbv1a.js +1256 -0
  182. package/dist/{server-DPTp6GXS.js → server-ub3s16Mc.js} +4 -4
  183. package/dist/{serverPlugin-OOfjB8tm.js → serverPlugin-CELT6P0Q.js} +12 -3
  184. package/dist/{sessionConfig-DfwcUKO2.js → sessionConfig-RQGvfm6E.js} +9 -10
  185. package/dist/{server-CyYesT-G.js → type-ASYnCGVW.js} +9 -1031
  186. package/dist/{validation-DuOGOKEi.js → validation-BJxVSAwx.js} +8 -3
  187. package/dist/{value-DyVsxCwZ.js → value-_W31So3B.js} +1 -1
  188. package/dist/{vaultSettings-BFCRCBM3.js → vaultSettings-Di3n5YIg.js} +1 -1
  189. package/dist/voiceTools-RMn4HvWo.js +246 -0
  190. package/dist/web-DCP7ELJj.js +3 -0
  191. package/dist/worker.js +345 -244
  192. package/dist/{workflow-BgwWq0nq.js → workflow-B7qx0Vv9.js} +1 -1
  193. package/package.json +37 -32
  194. package/wrangler.jsonc +2 -0
  195. package/dist/assets/assets/channel-BXwM62E-.js +0 -2
  196. package/dist/assets/assets/chunk-XXDRQBXY-C9Ka5KSI.js +0 -2
  197. package/dist/assets/assets/flowDiagram-IUGLLWBU-DXuTqLUd.js +0 -1
  198. package/dist/assets/assets/index-DdAdCxGc.js +0 -155
  199. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-aJTRXiIU.js +0 -9
  200. package/dist/assets/plugins/assets/base-C3j1WCCq.css +0 -2
  201. package/dist/assets/plugins/chunks/po-web-runtime-Czm_C4SJ.js +0 -1
  202. package/dist/assets/plugins/slots/approval.3e4ea6e4-CqQk6XG_.js +0 -2
  203. package/dist/assets/plugins/slots/artifacts.84980c32-DQlO5IFk.js +0 -1
  204. package/dist/assets/plugins/slots/builtin-tools.16ef5e25-CZRYQVIP.js +0 -7
  205. package/dist/assets/plugins/slots/codemode.5f359b9c-Bzl_K_vt.js +0 -10
  206. package/dist/assets/plugins/slots/domain.832848c8-CvnpuKCY.js +0 -1
  207. package/dist/assets/plugins/slots/edit.7c802139-kaxIknZ-.js +0 -7
  208. package/dist/assets/plugins/slots/files.364f16c9-wuB8gcQA.js +0 -2
  209. package/dist/assets/plugins/slots/grep.d8bf9f57-3FnU8p-d.js +0 -1
  210. package/dist/assets/plugins/slots/log.07fd59a4-C0PXQ0O1.js +0 -4
  211. package/dist/assets/plugins/slots/prompts.9d9b47cc-xdCkNkoA.js +0 -3
  212. package/dist/assets/plugins/slots/read.926c024f-qqaxVlEX.js +0 -1
  213. package/dist/assets/plugins/slots/runner.5393fa6c-DfO2Z9HG.js +0 -8
  214. package/dist/assets/plugins/slots/skill.56c1cc07-CL_n-l4h.js +0 -4
  215. package/dist/assets/plugins/slots/vault.587549ba-DbG3F_on.js +0 -1
  216. package/dist/harnessState-gmzJcPGt.js +0 -88
  217. package/dist/harnessStore-C0Zwvny8.js +0 -1
  218. package/dist/majorModes-WXt22_km.js +0 -1
  219. package/dist/piSettings-tdui0CZI.js +0 -1
  220. package/dist/platform-yhQXrrM_.js +0 -16
  221. package/dist/platformFiles-DB3Cw1l_.js +0 -64
  222. package/dist/web-cN41ySs9.js +0 -3
@@ -1,4 +1,4 @@
1
- import{$ as e,B as t,Bn as n,Cn as r,Gt as i,H as a,Hn as o,Ht as s,It as c,J as l,Jt as u,K as d,Kt as f,L as p,Ln as m,Lt as h,Nn as g,Ot as _,Pn as v,Q as y,R as b,S as ee,St as te,U as x,Ut as ne,V as S,Vt as C,X as w,Xt as re,Y as T,Yt as ie,Z as E,Zt as ae,_t as oe,a as D,b as se,bn as ce,ct as le,dt as ue,en as de,et as fe,f as pe,fn as me,i as he,jn as ge,jt as _e,kn as ve,l as ye,ln as be,mt as xe,n as Se,nn as Ce,o as O,p as k,pt as we,qt as Te,r as Ee,s as De,sn as Oe,t as ke,tn as Ae,tt as je,u as Me,ut as Ne,vt as A,x as Pe,xn as Fe,xt as Ie,y as Le,yn as Re,z as ze,zn as Be}from"../chunks/po-web-runtime-Czm_C4SJ.js";var Ve=Object.defineProperty,He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ue=(e,t)=>{let n={};for(var r in e)Ve(n,r,{get:e[r],enumerable:!0});return t&&Ve(n,Symbol.toStringTag,{value:`Module`}),n},We=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function Ge(e){return typeof e==`string`&&We.has(e.replace(/#$/,``))}function Ke(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 qe(e,t=`|`){return e.map(e=>bt(e)).join(t)}function Je(e,t){return typeof t==`bigint`?t.toString():t}var Ye=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Xe(e){return new Ye(e)}function Ze(e){return e==null}function Qe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function $e(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var et=Symbol(`evaluating`);function tt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==et)return r===void 0&&(r=et,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function it(e){return rt(e._zod.def)??e._zod.def.shape}function at(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return nt(this,t,e),e},enumerable:!0,configurable:!0})}function ot(e,t,n){t in e?nt(e,t,n):e[t]=n}function st(e,t,n,r){let i=it(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?at(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ot(e,a,r?r(n.value,a):n.value))}}function ct(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?at(e,n,()=>t[n]):ot(e,n,r.value))}}function lt(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ut(e){return JSON.stringify(e)}function dt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ft=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=Xe(()=>{if(un.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ht(e){if(pt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return pt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function gt(e){return ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _t=new Set([`string`,`number`,`symbol`]);function vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function j(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 bt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var St={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ct={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wt(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`);let i={};return st(i,e,Tt(e,t)),yt(e,lt(n,{shape:i,checks:[]}))}function Tt(e,t){let n=it(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Et(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`);let i=new Set(Tt(e,t)),a={};return st(a,e,Reflect.ownKeys(it(e)).filter(e=>!i.has(e))),yt(e,lt(n,{shape:a,checks:[]}))}function Dt(e,t){if(!ht(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=it(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yt(e,lt(e._zod.def,{shape:Ot(e,t)}))}function Ot(e,t){let n={};return st(n,e,Reflect.ownKeys(it(e))),ct(n,t),n}function kt(e,t){if(!ht(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yt(e,lt(e._zod.def,{shape:Ot(e,t)}))}function At(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return st(n,e,Reflect.ownKeys(it(e))),st(n,t,Reflect.ownKeys(it(t))),yt(e,lt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function jt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Tt(t,n)):void 0,o={};return st(o,t,Reflect.ownKeys(it(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),yt(t,lt(t._zod.def,{shape:o,checks:[]}))}function Mt(e,t,n){let r=n?new Set(Tt(t,n)):void 0,i={};return st(i,t,Reflect.ownKeys(it(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),yt(t,lt(t._zod.def,{shape:i}))}function Nt(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 Pt(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 Ft(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function It(e){return typeof e==`string`?e:e?.message}function Lt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Rt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function zt(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:It(e.inst?._zod.def?.error?.(e))??It(a?.(e))??It(t?.error?.(e))??It(n.customError?.(e))??It(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Bt=/[\uD800-\uDBFF]/;function Vt(e){let t=e.length;if(!Bt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ht(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ut(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Wt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Gt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Jt(e,n,r.value)}}function M(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Kt(e,t,n){return M(e,t,n,!1)}function qt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return M(this,n,r(this))},set(e){M(this,n,e)}})}return t}function Jt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:M(this,t,n.bind(this))},set(e){M(this,t,e)}})}function Yt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Xt,Zt=!1,Qt={configurable:!0,get(){Zt=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Xt!==e._zod?Xt=void 0:(Xt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qt);let e=Zt;Zt=!1;try{let r=n(this);return Zt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Zt||=e,r}catch(n){throw delete this[t],Zt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function $t(e,t,n,r){let i=Yt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var en=`~constantCatch`;function tn(e){let t=()=>e;return t[en]=!0,t}var nn,rn=Object.freeze({status:`aborted`}),an={value:void 0,enumerable:!1},on=`captureStackTrace`in Error?Error:null;function sn(e){let t=on;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return on=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){an.value=new a(r);try{Object.defineProperty(n,"_zod",an)}finally{an.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Gt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?sn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var cn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ln=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(nn=globalThis).__zod_globalConfig??(nn.__zod_globalConfig={});var un=globalThis.__zod_globalConfig;function dn(e){return e&&Object.assign(un,e),un}function fn(){let e=this._zod;return e.message??=JSON.stringify(e.def,Je,2),e.message}function pn(e){this._zod.message=e}var mn={get:fn,set:pn,enumerable:!0,configurable:!0},hn={value:void 0,enumerable:!1},gn=new WeakSet([Object.prototype,Error.prototype]),_n=P(`$ZodError`,(e,t)=>{e.name=`$ZodError`,hn.value=t,Object.defineProperty(e,"issues",hn),hn.value=void 0,Object.defineProperty(e,"message",mn);let n=Object.getPrototypeOf(e);gn.has(n)||(gn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function vn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function yn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?vn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function bn(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],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function xn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Sn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new cn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>zt(e,o,dn())));throw ft(n,a?.callee??t),n}return s.value};return t},Cn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>zt(e,o,dn())));throw ft(n,a?.callee??t),n}return s.value};return t},wn=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 cn;return a.issues.length?Tn(e,a.issues,i):{success:!0,data:a.value}};function Tn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>zt(e,n,dn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var En=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?Tn(e,a.issues,i):{success:!0,data:a.value}},Dn=Symbol.for(`zod.compile.invalid`),On=Symbol.for(`zod.compile.fallback`),kn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Dn)return!0;if(r.definite===!0&&n===void 0)return!1}return An(e,t,n)});function An(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[On]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new cn;return a.issues.length===0}var jn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Mn=e=>{let t=Sn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,xn(n,a))};return n},Nn=e=>{let t=Sn(e),n=(e,r,i,a)=>t(e,r,i,xn(n,a));return n},Pn=e=>{let t=Cn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,xn(n,a))};return n},Fn=e=>{let t=Cn(e),n=async(e,r,i,a)=>await t(e,r,i,xn(n,a));return n},In=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return wn(e)(t,n,i)},Ln=e=>(t,n,r)=>wn(e)(t,n,r),Rn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return En(e)(t,n,i)},zn=e=>async(t,n,r)=>En(e)(t,n,r),Bn=/^[cC][0-9a-z]{6,}$/,Vn=/^[0-9a-z]+$/,Hn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Un=/^[0-9a-vA-V]{20}$/,Wn=/^[A-Za-z0-9]{27}$/,Gn=/^[a-zA-Z0-9_-]{21}$/;function Kn(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var qn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jn=/^([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})$/,Yn=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)$/,Xn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Zn=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Qn(){return new RegExp(Zn,`u`)}var $n=/^(?:(?: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])$/,er=/^(([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}|:))$/,tr=/^((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])$/,nr=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ir=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ar=/^https?$/,or=/^\+[1-9]\d{6,14}$/,sr=`(?:(?:\\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])))`;function cr(e){return RegExp(`^${e}$`)}var lr=cr(sr);function ur(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dr(e){return RegExp(`^${ur(e)}$`)}function fr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ur({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ur({precision:e.precision})}`:n;return RegExp(`^${sr}T(?:${r})$`)}var pr=/^[\s\S]{0,}$/,mr=/^-?\d+$/,hr=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i,_r=/^null$/i,vr=/^undefined$/i,yr=/^[^A-Z]*$/,br=/^[^a-z]*$/,xr=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sr=e=>{let t=e.value;return!Ze(t)&&t.length!==void 0},Cr={number:`number`,bigint:`bigint`,object:`date`},wr=P(`$ZodCheckLessThan`,(e,t)=>{xr.init(e,t);let n=Cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Cr[typeof r.value]??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})}}),Tr=P(`$ZodCheckGreaterThan`,(e,t)=>{xr.init(e,t);let n=Cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Cr[typeof r.value]??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})}}),Er=P(`$ZodCheckMultipleOf`,(e,t)=>{xr.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):$e(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})}}),Dr=P(`$ZodCheckNumberFormat`,(e,t)=>{xr.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=St[t.format];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})}}),Or=P(`$ZodCheckMaxLength`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Vt(r):i)<=t.maximum)return;let a=Ht(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),kr=P(`$ZodCheckMinLength`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Vt(r):i)>=t.minimum)return;let a=Ht(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ar=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Vt(r):i;if(a===t.length)return;let o=Ht(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jr=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;xr.init(e,t),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=()=>{})}),Mr=P(`$ZodCheckRegex`,(e,t)=>{jr.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})}}),Nr=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=yr,jr.init(e,t)}),Pr=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=br,jr.init(e,t)}),Fr=P(`$ZodCheckIncludes`,(e,t)=>{xr.init(e,t);let n=vt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Ir=P(`$ZodCheckStartsWith`,(e,t)=>{xr.init(e,t);let n=RegExp(`^${vt(t.prefix)}.*`);t.pattern??=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})}}),Lr=P(`$ZodCheckEndsWith`,(e,t)=>{xr.init(e,t);let n=RegExp(`.*${vt(t.suffix)}$`);t.pattern??=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})}}),Rr=P(`$ZodCheckOverwrite`,(e,t)=>{xr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),zr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ import{$ as e,$n as t,An as n,At as r,C as i,Cn as a,Cr as o,E as s,En as c,Hn as l,Ht as u,In as d,J as f,Nt as p,Ot as m,Pt as h,Q as g,Qn as _,Qt as v,Rn as ee,Rt as y,Sn as b,T as te,Tn as ne,Wt as x,X as re,Xn as ie,Y as ae,Z as oe,_n as se,_r as S,a as ce,at as C,bn as le,br as ue,c as de,cn as fe,ct as w,d as pe,dr as me,dt as he,et as ge,ft as _e,gn as ve,h as T,hn as ye,i as be,jn as E,jt as xe,kn as Se,lt as Ce,m as we,mr as Te,n as Ee,o as D,ot as O,pr as De,rt as Oe,s as k,sr as ke,st as Ae,t as je,tn as Me,tr as Ne,u as Pe,un as Fe,ut as Ie,w as Le,wn as Re,xn as ze,yr as Be,zt as A}from"../chunks/po-web-runtime-BJDT6Lbw.js";var Ve=Object.defineProperty,He=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ue=(e,t)=>{let n={};for(var r in e)Ve(n,r,{get:e[r],enumerable:!0});return t&&Ve(n,Symbol.toStringTag,{value:`Module`}),n},We=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function Ge(e){return typeof e==`string`&&We.has(e.replace(/#$/,``))}function Ke(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 qe(e,t=`|`){return e.map(e=>bt(e)).join(t)}function Je(e,t){return typeof t==`bigint`?t.toString():t}var Ye=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Xe(e){return new Ye(e)}function Ze(e){return e==null}function Qe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function $e(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var et=Symbol(`evaluating`);function tt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==et)return r===void 0&&(r=et,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function it(e){return rt(e._zod.def)??e._zod.def.shape}function at(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return nt(this,t,e),e},enumerable:!0,configurable:!0})}function ot(e,t,n){t in e?nt(e,t,n):e[t]=n}function st(e,t,n,r){let i=it(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?at(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ot(e,a,r?r(n.value,a):n.value))}}function ct(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?at(e,n,()=>t[n]):ot(e,n,r.value))}}function lt(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ut(e){return JSON.stringify(e)}function dt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ft=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=Xe(()=>{if(un.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ht(e){if(pt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return pt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function gt(e){return ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _t=new Set([`string`,`number`,`symbol`]);function vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function j(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 bt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var St={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ct={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wt(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`);let i={};return st(i,e,Tt(e,t)),yt(e,lt(n,{shape:i,checks:[]}))}function Tt(e,t){let n=it(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Et(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`);let i=new Set(Tt(e,t)),a={};return st(a,e,Reflect.ownKeys(it(e)).filter(e=>!i.has(e))),yt(e,lt(n,{shape:a,checks:[]}))}function Dt(e,t){if(!ht(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=it(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yt(e,lt(e._zod.def,{shape:Ot(e,t)}))}function Ot(e,t){let n={};return st(n,e,Reflect.ownKeys(it(e))),ct(n,t),n}function kt(e,t){if(!ht(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yt(e,lt(e._zod.def,{shape:Ot(e,t)}))}function At(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return st(n,e,Reflect.ownKeys(it(e))),st(n,t,Reflect.ownKeys(it(t))),yt(e,lt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function jt(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Tt(t,n)):void 0,o={};return st(o,t,Reflect.ownKeys(it(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),yt(t,lt(t._zod.def,{shape:o,checks:[]}))}function Mt(e,t,n){let r=n?new Set(Tt(t,n)):void 0,i={};return st(i,t,Reflect.ownKeys(it(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),yt(t,lt(t._zod.def,{shape:i}))}function Nt(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 Pt(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 Ft(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function It(e){return typeof e==`string`?e:e?.message}function Lt(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Rt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function zt(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:It(e.inst?._zod.def?.error?.(e))??It(a?.(e))??It(t?.error?.(e))??It(n.customError?.(e))??It(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Bt=/[\uD800-\uDBFF]/;function Vt(e){let t=e.length;if(!Bt.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ht(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ut(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Wt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Gt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Jt(e,n,r.value)}}function M(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Kt(e,t,n){return M(e,t,n,!1)}function qt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return M(this,n,r(this))},set(e){M(this,n,e)}})}return t}function Jt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:M(this,t,n.bind(this))},set(e){M(this,t,e)}})}function Yt(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Xt,Zt=!1,Qt={configurable:!0,get(){Zt=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Xt!==e._zod?Xt=void 0:(Xt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qt);let e=Zt;Zt=!1;try{let r=n(this);return Zt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Zt||=e,r}catch(n){throw delete this[t],Zt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function $t(e,t,n,r){let i=Yt(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var en=`~constantCatch`;function tn(e){let t=()=>e;return t[en]=!0,t}var nn,rn=Object.freeze({status:`aborted`}),an={value:void 0,enumerable:!1},on=`captureStackTrace`in Error?Error:null;function sn(e){let t=on;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return on=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){an.value=new a(r);try{Object.defineProperty(n,"_zod",an)}finally{an.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Gt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?sn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var cn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ln=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(nn=globalThis).__zod_globalConfig??(nn.__zod_globalConfig={});var un=globalThis.__zod_globalConfig;function dn(e){return e&&Object.assign(un,e),un}function fn(){let e=this._zod;return e.message??=JSON.stringify(e.def,Je,2),e.message}function pn(e){this._zod.message=e}var mn={get:fn,set:pn,enumerable:!0,configurable:!0},hn={value:void 0,enumerable:!1},gn=new WeakSet([Object.prototype,Error.prototype]),_n=P(`$ZodError`,(e,t)=>{e.name=`$ZodError`,hn.value=t,Object.defineProperty(e,"issues",hn),hn.value=void 0,Object.defineProperty(e,"message",mn);let n=Object.getPrototypeOf(e);gn.has(n)||(gn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function vn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function yn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?vn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function bn(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],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function xn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Sn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new cn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>zt(e,o,dn())));throw ft(n,a?.callee??t),n}return s.value};return t},Cn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>zt(e,o,dn())));throw ft(n,a?.callee??t),n}return s.value};return t},wn=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 cn;return a.issues.length?Tn(e,a.issues,i):{success:!0,data:a.value}};function Tn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>zt(e,n,dn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var En=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?Tn(e,a.issues,i):{success:!0,data:a.value}},Dn=Symbol.for(`zod.compile.invalid`),On=Symbol.for(`zod.compile.fallback`),kn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Dn)return!0;if(r.definite===!0&&n===void 0)return!1}return An(e,t,n)});function An(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[On]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new cn;return a.issues.length===0}var jn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Mn=e=>{let t=Sn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,xn(n,a))};return n},Nn=e=>{let t=Sn(e),n=(e,r,i,a)=>t(e,r,i,xn(n,a));return n},Pn=e=>{let t=Cn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,xn(n,a))};return n},Fn=e=>{let t=Cn(e),n=async(e,r,i,a)=>await t(e,r,i,xn(n,a));return n},In=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return wn(e)(t,n,i)},Ln=e=>(t,n,r)=>wn(e)(t,n,r),Rn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return En(e)(t,n,i)},zn=e=>async(t,n,r)=>En(e)(t,n,r),Bn=/^[cC][0-9a-z]{6,}$/,Vn=/^[0-9a-z]+$/,Hn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Un=/^[0-9a-vA-V]{20}$/,Wn=/^[A-Za-z0-9]{27}$/,Gn=/^[a-zA-Z0-9_-]{21}$/;function Kn(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var qn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jn=/^([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})$/,Yn=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)$/,Xn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Zn=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Qn(){return new RegExp(Zn,`u`)}var $n=/^(?:(?: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])$/,er=/^(([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}|:))$/,tr=/^((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])$/,nr=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ir=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ar=/^https?$/,or=/^\+[1-9]\d{6,14}$/,sr=`(?:(?:\\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])))`;function cr(e){return RegExp(`^${e}$`)}var lr=cr(sr);function ur(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dr(e){return RegExp(`^${ur(e)}$`)}function fr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ur({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ur({precision:e.precision})}`:n;return RegExp(`^${sr}T(?:${r})$`)}var pr=/^[\s\S]{0,}$/,mr=/^-?\d+$/,hr=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i,_r=/^null$/i,vr=/^undefined$/i,yr=/^[^A-Z]*$/,br=/^[^a-z]*$/,xr=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sr=e=>{let t=e.value;return!Ze(t)&&t.length!==void 0},Cr={number:`number`,bigint:`bigint`,object:`date`},wr=P(`$ZodCheckLessThan`,(e,t)=>{xr.init(e,t);let n=Cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Cr[typeof r.value]??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})}}),Tr=P(`$ZodCheckGreaterThan`,(e,t)=>{xr.init(e,t);let n=Cr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Cr[typeof r.value]??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})}}),Er=P(`$ZodCheckMultipleOf`,(e,t)=>{xr.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):$e(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})}}),Dr=P(`$ZodCheckNumberFormat`,(e,t)=>{xr.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=St[t.format];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})}}),Or=P(`$ZodCheckMaxLength`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Vt(r):i)<=t.maximum)return;let a=Ht(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),kr=P(`$ZodCheckMinLength`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Vt(r):i)>=t.minimum)return;let a=Ht(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ar=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;xr.init(e,t),(n=e._zod.def).when??(n.when=Sr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Vt(r):i;if(a===t.length)return;let o=Ht(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),jr=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;xr.init(e,t),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=()=>{})}),Mr=P(`$ZodCheckRegex`,(e,t)=>{jr.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})}}),Nr=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=yr,jr.init(e,t)}),Pr=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=br,jr.init(e,t)}),Fr=P(`$ZodCheckIncludes`,(e,t)=>{xr.init(e,t);let n=vt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Ir=P(`$ZodCheckStartsWith`,(e,t)=>{xr.init(e,t);let n=RegExp(`^${vt(t.prefix)}.*`);t.pattern??=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})}}),Lr=P(`$ZodCheckEndsWith`,(e,t)=>{xr.init(e,t);let n=RegExp(`.*${vt(t.suffix)}$`);t.pattern??=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})}}),Rr=P(`$ZodCheckOverwrite`,(e,t)=>{xr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),zr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
3
  `)}\n};`)(...Object.values(this.closed))}},Br={major:4,minor:6,patch:7},F=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Br;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Nt(t),a;for(let o of n){if(o._zod.def.when){if(Pt(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new cn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Rt(t.issues,n,e),i||=Nt(t,n))});else{if(t.issues.length===n)continue;Rt(t.issues,n,e),i||=Nt(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Nt(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new cn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new cn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Kt(this,`~standard`,Ur(this))},set"~standard"(e){M(this,`~standard`,e)}}),Vr=(e,t)=>e.issues.length?{issues:e.issues.map(e=>zt(e,t,dn()))}:{value:e.value};async function Hr(e,t){let n={async:!0};return Vr(await e._zod.run({value:t,issues:[]},n),n)}function Ur(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Vr(r,n)}catch{}return Hr(e,t)},vendor:`zod`,version:1}}var Wr=P(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=t.pattern??pr,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}}),I=P(`$ZodStringFormat`,(e,t)=>{jr.init(e,t),Wr.init(e,t)}),Gr=P(`$ZodGUID`,(e,t)=>{t.pattern??=Jn,I.init(e,t)}),Kr=P(`$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??=Yn(e)}else t.pattern??=Yn();I.init(e,t)}),qr=P(`$ZodEmail`,(e,t)=>{t.pattern??=Xn,I.init(e,t)});function Jr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Yr(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Jr(e)||2:Xr(e,t)}function Xr(e,t){if(!t.normalize&&t.protocol?.source===ar.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Zr=/[\t\n\r]/g;function Qr(e){return e.replace(Zr,``)}function $r(e,t){return t.lastIndex=0,t.test(e.hostname)}function ei(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var ti=P(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Yr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Qr(r);return}t.hostname&&!$r(i,t.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&&!ei(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Qr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ni=P(`$ZodEmoji`,(e,t)=>{t.pattern??=Qn(),I.init(e,t)}),ri=P(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Gn:Kn(t.length),I.init(e,t)}),ii=P(`$ZodCUID`,(e,t)=>{t.pattern??=Bn,I.init(e,t)}),ai=P(`$ZodCUID2`,(e,t)=>{t.pattern??=Vn,I.init(e,t)}),oi=P(`$ZodULID`,(e,t)=>{t.pattern??=Hn,I.init(e,t)}),si=P(`$ZodXID`,(e,t)=>{t.pattern??=Un,I.init(e,t)}),ci=P(`$ZodKSUID`,(e,t)=>{t.pattern??=Wn,I.init(e,t)}),li=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=fr(t),I.init(e,t)}),ui=P(`$ZodISODate`,(e,t)=>{t.pattern??=lr,I.init(e,t)}),di=P(`$ZodISOTime`,(e,t)=>{t.pattern??=dr(t),I.init(e,t)}),fi=P(`$ZodISODuration`,(e,t)=>{t.pattern??=qn,I.init(e,t)}),pi=P(`$ZodIPv4`,(e,t)=>{t.pattern??=$n,I.init(e,t)}),mi=/^[0-9a-fA-F:.]+$/;function hi(e){return mi.test(e)?Jr(`http://[${e}]`):!1}var gi=P(`$ZodIPv6`,(e,t)=>{t.pattern??=er,I.init(e,t),e._zod.check=n=>{hi(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),_i=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=tr,I.init(e,t)});function vi(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:hi(n)}var yi=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=nr,I.init(e,t),e._zod.check=n=>{vi(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function bi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var xi=/^[0-9a-zA-Z+/]*={0,2}$/,Si=P(`$ZodBase64`,(e,t)=>{t.pattern??=xi,I.init(e,t),e._zod.check=n=>{bi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ci=/^[A-Za-z0-9_-]*$/;function wi(e){if(!Ci.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return bi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ti=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ci,I.init(e,t),e._zod.check=n=>{wi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ei=P(`$ZodE164`,(e,t)=>{t.pattern??=or,I.init(e,t)});function Di(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 Oi=P(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{Di(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ki=P(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=hr,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:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ai=P(`$ZodNumberFormat`,(e,t)=>{Dr.init(e,t),ki.init(e,t)}),ji=P(`$ZodBoolean`,(e,t)=>{F.init(e,t),e._zod.pattern=gr,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}}),Mi=P(`$ZodUndefined`,(e,t)=>{F.init(e,t),e._zod.pattern=vr,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}}),Ni=P(`$ZodNull`,(e,t)=>{F.init(e,t),e._zod.pattern=_r,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}}),Pi=P(`$ZodAny`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),Fi=P(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),Ii=P(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Li(e,t){let n=Lt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Lt(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Rt(n.issues,t,e),n}}return i(n,a)}}var Ri=e=>Array.isArray(e)?e.length:-1;function zi(e,t,n){e.issues.length&&t.issues.push(...Ft(n,e.issues)),t.value[n]=e.value}var Bi=P(`$ZodArray`,(e,t)=>{F.init(e,t);let n=un.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>zi(t,r,e)));else if(zi(c,r,e),s&&c.issues.length!==0&&Nt(c))break}return o.length?Promise.all(o).then(()=>r):r},Li(e,Ri)});function Vi(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Ft(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Hi=[];function Ui(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Hi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=xt(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Wi(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Nt(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Vi(e,n,i,t,d,f))):Vi(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Gi=P(`$ZodObject`,(e,t)=>{F.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Xe(()=>Ui(t));N(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||nt(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=pt,o=t.catchall,s,c=un.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Nt(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Vi(n,t,e,r,a,o))):Vi(s,t,e,r,a,o)}return o?Wi(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ki=P(`$ZodObjectJIT`,(e,t)=>{Gi.init(e,t);let n=e._zod.parse,r=Xe(()=>Ui(t)),i=un.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new zr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
4
  let ${e}_ab = false;
@@ -52,7 +52,7 @@ import{$ as e,B as t,Bn as n,Cn as r,Gt as i,H as a,Hn as o,Ht as s,It as c,J as
52
52
 
53
53
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=pt,c=!un.jitless,l=c&&mt.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Wi([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function qi(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=>!Nt(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=>zt(e,r,dn())))}),t)}var Ji=P(`$ZodUnion`,(e,t)=>{F.init(e,t),N(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),N(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),N(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),N(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Qe(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=>qi(t,r,e,i)):qi(o,r,e,i)}});function Yi(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Xi=P(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ji.init(e,t);let n=e._zod.parse;N(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||nt(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=rt(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Xe(()=>Yi(t));e._zod.parse=(i,a)=>{let o=i.value;if(!pt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._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()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Zi=P(`$ZodIntersection`,(e,t)=>{F.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])=>$i(e,t,n)):$i(e,i,a)}});function Qi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ht(e)&&ht(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Qi(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=Qi(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 $i(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Qi(t.value,n.value);if(!c.valid){if(Nt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ea=P(`$ZodRecord`,(e,t)=>{F.init(e,t);let n=un.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ht(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>zt(e,i,dn())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Ft(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Ft(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&hr.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>zt(e,i,dn())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Ft(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Ft(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ta=P(`$ZodEnum`,(e,t)=>{F.init(e,t);let n=Ke(t.entries),r=new Set(n);e._zod.values=r,N(e,`pattern`,e=>{let t=Ke(e.def.entries).filter(e=>_t.has(typeof e));return RegExp(t.length?`^(${t.map(e=>vt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),na=P(`$ZodLiteral`,(e,t)=>{F.init(e,t);let n=new Set(t.values);e._zod.values=n,N(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?vt(e):e?vt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),ra=P(`$ZodTransform`,(e,t)=>{F.init(e,t),e._zod.optin=`optional`,un.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ln(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));if(i instanceof Promise)throw new cn;return n.value=i,n}});function ia(e,t){return e.value=t.issues.length?void 0:t.value,e}var aa=P(`$ZodOptional`,(e,t)=>{F.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,N(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),N(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qe(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ia(e,t)):ia(e,r)}return t.innerType._zod.run(e,n)}}),oa=P(`$ZodExactOptional`,(e,t)=>{aa.init(e,t),N(e,`values`,e=>e.def.innerType._zod.values),N(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),sa=P(`$ZodNullable`,(e,t)=>{F.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin),N(e,`optout`,e=>e.def.innerType._zod.optout),N(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Qe(t.source)}|null)$`):void 0}),N(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ca=P(`$ZodDefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,N(e,`values`,e=>e.def.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=>la(e,t)):la(r,t)}});function la(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ua=P(`$ZodPrefault`,(e,t)=>{F.init(e,t),e._zod.optin=`defaulted`,N(e,`values`,e=>e.def.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))}),da=P(`$ZodNonOptional`,(e,t)=>{F.init(e,t),N(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>fa(t,e)):fa(i,e)}});function fa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function pa(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>zt(e,r,dn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ma=P(`$ZodCatch`,(e,t)=>{F.init(e,t),N(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),N(e,`optout`,e=>e.def.innerType._zod.optout),N(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>pa(e,r,t,n)):pa(e,r,t,n)}}),ha=P(`$ZodPipe`,(e,t)=>{F.init(e,t),N(e,`values`,e=>e.def.in._zod.values),N(e,`optin`,e=>e.def.in._zod.optin),N(e,`optout`,e=>e.def.out._zod.optout),N(e,`propValues`,e=>e.def.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=>ga(e,t.in,n)):ga(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ga(e,t.out,n)):ga(r,t.out,n)}});function ga(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var _a=P(`$ZodPreprocess`,(e,t)=>{ha.init(e,t)}),va=P(`$ZodReadonly`,(e,t)=>{F.init(e,t),N(e,`propValues`,e=>e.def.innerType._zod.propValues),N(e,`values`,e=>e.def.innerType._zod.values),N(e,`optin`,e=>e.def.innerType?._zod?.optin),N(e,`optout`,e=>e.def.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(ya):ya(r)}});function ya(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ba=P(`$ZodLazy`,(e,t)=>{F.init(e,t),tt(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),N(e,`pattern`,e=>e.innerType?._zod?.pattern),N(e,`propValues`,e=>e.innerType?._zod?.propValues),N(e,`optin`,e=>e.innerType?._zod?.optin??void 0),N(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),xa=P(`$ZodCustom`,(e,t)=>{xr.init(e,t),F.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=>Sa(t,n,r,e));Sa(i,n,r,e)}});function Sa(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(Wt(e))}}var Ca=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},wa=`~memo`,Ta=[];function Ea(e){return typeof e==`object`&&!!e}function Da(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Oa=new WeakMap,ka=0,Aa=1,ja=2;function Ma(e,t,n){let r=Oa.get(e);if(r!==void 0)return r?ja:ka;if(t.has(e))return ja;t.add(e);let i=ka,a=e=>{if(i!==ja&&e?._zod){let r=Ma(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=ka;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Aa:o.value?._zod?Ma(o.value,t,n):ka;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=rt(c);s(e?o(e,!0):Aa),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ma(r,t,!1):Aa);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Na(e,i)}function Na(e,t){return t!==Aa&&Oa.set(e,t===ja),t}function Pa(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Fa,Ia=[],La={alloc(e,t,n){let r=Fa;if(!r)return n;Fa=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ia.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&za(n,e.value))throw new Ca;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ma(e,new Set,!1);if(i===ka)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===ja||r?n=!0:r=!0}let l=s.value;if(!Ea(l))return t(s,c);let u=c[wa];u||(u={buckets:new WeakMap,backEdges:void 0},c[wa]=u);let d;i===c?d=a:(d=Pa(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Da(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Fa=d;let p=Ia.length,m=t(s,c);Fa=void 0;let h=Ia.length>p?Ia.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Da(e.issues):Ta),e)):(h&&(h.issues=m.issues.length?Da(m.issues):Ta),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ra(){return La}function za(e,t){let n=e[wa]?.backEdges;return n!==void 0&&Ea(t)&&n.has(t)}var Ba=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ut(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${bt(e.values[0])}`:`Invalid option: expected one of ${qe(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${qe(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Va(){return{localeError:Ba()}}var Ha,Ua=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 Wa(){return new Ua}(Ha=globalThis).__zod_globalRegistry??(Ha.__zod_globalRegistry=Wa());var Ga=globalThis.__zod_globalRegistry;function Ka(e){return e.checks&&=[...e.checks],e}function qa(e,t){return new e(Ka({type:`string`,...j(t)}))}function Ja(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...j(t)})}function Ya(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...j(t)})}function Xa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...j(t)})}function Za(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...j(t)})}function Qa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...j(t)})}function $a(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...j(t)})}function eo(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...j(t)})}function to(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...j(t)})}function no(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...j(t)})}function ro(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...j(t)})}function io(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...j(t)})}function ao(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...j(t)})}function oo(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...j(t)})}function so(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...j(t)})}function co(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...j(t)})}function lo(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...j(t)})}function uo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...j(t)})}function fo(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...j(t)})}function po(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...j(t)})}function mo(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...j(t)})}function ho(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...j(t)})}function go(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...j(t)})}function _o(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...j(t)})}function vo(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...j(t)})}function yo(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...j(t)})}function bo(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...j(t)})}function xo(e,t){return new e(Ka({type:`number`,checks:[],...j(t)}))}function So(e,t){return new e(Ka({type:`number`,coerce:!0,checks:[],...j(t)}))}function Co(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...j(t)})}function wo(e,t){return new e({type:`boolean`,...j(t)})}function To(e,t){return new e({type:`undefined`,...j(t)})}function Eo(e,t){return new e({type:`null`,...j(t)})}function Do(e){return new e({type:`any`})}function Oo(e){return new e({type:`unknown`})}function ko(e,t){return new e({type:`never`,...j(t)})}function Ao(e,t){return new wr({check:`less_than`,...j(t),value:e,inclusive:!1})}function jo(e,t){return new wr({check:`less_than`,...j(t),value:e,inclusive:!0})}function Mo(e,t){return new Tr({check:`greater_than`,...j(t),value:e,inclusive:!1})}function No(e,t){return new Tr({check:`greater_than`,...j(t),value:e,inclusive:!0})}function Po(e,t){return new Er({check:`multiple_of`,...j(t),value:e})}function Fo(e,t){return new Or({check:`max_length`,...j(t),maximum:e})}function Io(e,t){return new kr({check:`min_length`,...j(t),minimum:e})}function Lo(e,t){return new Ar({check:`length_equals`,...j(t),length:e})}function Ro(e,t){return new Mr({check:`string_format`,format:`regex`,...j(t),pattern:e})}function zo(e){return new Nr({check:`string_format`,format:`lowercase`,...j(e)})}function Bo(e){return new Pr({check:`string_format`,format:`uppercase`,...j(e)})}function Vo(e,t){return new Fr({check:`string_format`,format:`includes`,...j(t),includes:e})}function Ho(e,t){return new Ir({check:`string_format`,format:`starts_with`,...j(t),prefix:e})}function Uo(e,t){return new Lr({check:`string_format`,format:`ends_with`,...j(t),suffix:e})}function Wo(e){return new Rr({check:`overwrite`,tx:e})}function Go(e){return Wo(t=>t.normalize(e))}function Ko(){return Wo(e=>e.trim())}function qo(){return Wo(e=>e.toLowerCase())}function Jo(){return Wo(e=>e.toUpperCase())}function Yo(){return Wo(e=>dt(e))}function Xo(e,t,n){return new e({type:`array`,element:t,...j(n)})}function Zo(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...j(n)})}function Qo(e,t){let n=$o(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Wt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Wt(r))}},e(t.value,t)),t);return n}function $o(e,t){let n=new xr({check:`custom`,...j(t)});return n._zod.check=e,n}function es(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&nt(e,t,n[t]);return e}function ts(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??Ga,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ns(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function L(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,L(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&es(o.schema,c),t.io===`input`&&fs(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 rs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function is(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${rs(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+rs(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>
54
54
 
55
- 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function as(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;as(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var os=new Set([`type`,`properties`,`required`,`additionalProperties`]),ss=[`oneOf`,`anyOf`];function cs(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ls(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!os.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??cs(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}nt(n,r,e.length===1?e[0]:ls(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=cs(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function us(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of os)if(t in e)return;let n=t.filter(e=>ss.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ls(t);else{let e=n[0],i=ss.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ls([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,es(e,r))}function ds(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)):es(i,s),es(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())as(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])us(e)}}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)}es(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,nt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:ms(t,`input`,e.processors),output:ms(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fs(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 fs(r.element,n);if(r.type===`set`)return fs(r.valueType,n);if(r.type===`lazy`)return fs(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`||r.type===`catch`)return fs(r.innerType,n);if(r.type===`intersection`)return fs(r.left,n)||fs(r.right,n);if(r.type===`record`||r.type===`map`)return fs(r.keyType,n)||fs(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fs(r.in,n)||fs(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fs(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fs(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fs(e,n))return!0;return!!(r.rest&&fs(r.rest,n))}return!1}var ps=(e,t={})=>n=>{let r=ts({...n,processors:t});return L(e,r),is(r,e),ds(r,e)},ms=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ts({...i??{},target:a,io:t,processors:n});return L(e,o),is(o,e),ds(o,e)},hs=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},gs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},_s=(e,t)=>{hs(e,`minimum`,t),gs(e,`maximum`,t)},vs=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ys=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},bs=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},xs=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ss=(e,t)=>hs(e,`minimum`,t.minimum),Cs=(e,t)=>gs(e,`maximum`,t.maximum),ws=e=>(t,n)=>{xs(t,n.format);let[r,i]=e[n.format];hs(t,`minimum`,r),gs(t,`maximum`,i)},Ts={greater_than:(e,t)=>hs(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>gs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>vs(e,t.value),number_format:ws(St),bigint_format:ws(Ct),min_length:Ss,max_length:Cs,length_equals:(e,t)=>_s(e,t.length),min_size:Ss,max_size:Cs,size_equals:(e,t)=>_s(e,t.size),string_format:(e,t)=>{xs(e,t.format),t.pattern&&ys(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bs(e,t.mime)};function Es(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ts[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&hs(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&hs(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&gs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&gs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&vs(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&bs(t,i.mime);for(let e of i.patterns??[])ys(t,e);return t}var Ds={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Os=new Map([[xi,rr],[Ci,ir]]),ks=e=>Os.get(e)??e,As=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Es(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ds[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ks);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}))])}},js=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Es(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):ns(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Ms=(e,t,n,r)=>{n.type=`boolean`},Ns=(e,t,n,r)=>{ns(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Ps=(e,t,n,r)=>{ns(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Fs=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Is=(e,t,n,r)=>{ns(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ls=(e,t,n,r)=>{ns(e,t,n,r,`Void cannot be represented in JSON Schema`)},Rs=(e,t,n,r)=>{n.not={}},zs=(e,t,n,r)=>{},Bs=(e,t,n,r)=>{},Vs=(e,t,n,r)=>{ns(e,t,n,r,`Date cannot be represented in JSON Schema`)},Hs=(e,t,n,r)=>{let i=e._zod.def,a=Ke(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Us=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(ns(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(ns(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Ws=(e,t,n,r)=>{ns(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Gs=(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},Ks=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=Es(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},qs=(e,t,n,r)=>{n.type=`boolean`},Js=(e,t,n,r)=>{ns(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ys=(e,t,n,r)=>{ns(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Xs=(e,t,n,r)=>{ns(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Zs=(e,t,n,r)=>{ns(e,t,n,r,`Map cannot be represented in JSON Schema`)},Qs=(e,t,n,r)=>{ns(e,t,n,r,`Set cannot be represented in JSON Schema`)},$s=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Es(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=L(a.element,t,{...r,path:[...r.path,`items`]})};function ec(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ec(t.out):t.type===`catch`?ec(t.innerType):e._zod.optin}var tc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ns(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)nt(i.properties,e,L(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ec(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=L(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},nc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},rc=(e,t,n,r)=>{let i=e._zod.def,a=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ic=(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)=>L(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?L(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ec(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Es(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function ac(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=ac(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>ac(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?hr:mr).source)),p}var oc=new WeakMap;function sc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of oc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=ac(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var cc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Es(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=L(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)nt(i.patternProperties,ks(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=L(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=oc.get(t);n||(n=[],oc.set(t,n),t.deferred.push(()=>sc(t))),n.push(e)}i.additionalProperties=L(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ec(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},lc=(e,t,n,r)=>{let i=e._zod.def,a=L(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`}]},uc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dc=Symbol();function fc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ns(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),dc):JSON.parse(o)}var pc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=fc(i.defaultValue,e,t,n,r);o!==dc&&(n.default=o)},mc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=fc(i.defaultValue,e,t,n,r);o!==dc&&(n._prefault=o)},hc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ns(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},gc=(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;L(o,t,r);let s=t.seen.get(e);s.ref=o},_c=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},vc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bc=(e,t,n,r)=>{let i=e._zod.innerType;L(i,t,r);let a=t.seen.get(e);a.ref=i},xc={string:As,number:js,boolean:Ms,bigint:Ns,symbol:Ps,null:Fs,undefined:Is,void:Ls,never:Rs,any:zs,unknown:Bs,date:Vs,enum:Hs,literal:Us,nan:Ws,template_literal:Gs,file:Ks,success:qs,custom:Js,function:Ys,transform:Xs,map:Zs,set:Qs,array:$s,object:tc,union:nc,intersection:rc,tuple:ic,record:cc,nullable:lc,nonoptional:uc,default:pc,prefault:mc,catch:hc,pipe:gc,readonly:_c,promise:vc,optional:yc,lazy:bc};function Sc(e,t){if(`_idmap`in e){let n=e,r=ts({...t,processors:xc}),i={};for(let e of n._idmap.entries()){let[t,n]=e;L(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;is(r,n),nt(a,t,ds(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ts({...t,processors:xc});return L(e,n),is(n,e),ds(n,e)}var Cc=new WeakSet([Object.prototype,Error.prototype]);function wc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Tc=P(`ZodError`,(e,t)=>{_n.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Cc.has(n)||(Cc.add(n),wc(n,`format`,e=>t=>bn(e,t)),wc(n,`flatten`,e=>t=>yn(e,t)),wc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Je,2)}),wc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Je,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ec=Sn(Tc),Dc=Cn(Tc),Oc=wn(Tc),kc=En(Tc),Ac=Mn(Tc),jc=Nn(Tc),Mc=Pn(Tc),Nc=Fn(Tc),Pc=In(Tc),Fc=Ln(Tc),Ic=Rn(Tc),Lc=zn(Tc);function Rc(){un.localeError||dn(Va())}function zc(){un.memoizer||dn({memoizer:Ra()})}var R=P(`ZodType`,(e,t)=>(Rc(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(lt(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 yt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(au(e,t))},superRefine(e,t){return this.check(ou(e,t))},overwrite(e){return this.check(Wo(e))},optional(){return Z(this)},exactOptional(){return Bl(this)},nullable(){return Hl(this)},nullish(){return Z(Hl(this))},nonoptional(e){return Jl(this,e)},array(){return W(this)},or(e){return q([this,e])},and(e){return Ml(this,e)},transform(e){return Ql(this,Ll(e))},default(e){return Wl(this,e)},prefault(e){return Kl(this,e)},catch(e){return Xl(this,e)},pipe(e){return Ql(this,e)},readonly(){return tu(this)},describe(e){let t=this.clone();return Ga.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ga.get(this);let t=this.clone();return Ga.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Kt(this,`~standard`,{...Ur(this),jsonSchema:{input:ms(this,`input`),output:ms(this,`output`)}})},set"~standard"(e){M(this,`~standard`,e)},parse:function e(t,n){return Ec(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Dc(this,t,n,{callee:e})},safeParse(e,t){return Oc(this,e,t)},async safeParseAsync(e,t){return kc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){M(this,`spa`,e)},validate(e,t){return kn(this,e,t)},validateAsync(e,t){return jn(this,e,t)},encode:function e(t,n){return Ac(this,t,n,{callee:e})},decode:function e(t,n){return jc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Nc(this,t,n,{callee:e})},safeEncode(e,t){return Pc(this,e,t)},safeDecode(e,t){return Fc(this,e,t)},async safeEncodeAsync(e,t){return Ic(this,e,t)},async safeDecodeAsync(e,t){return Lc(this,e,t)},toJSONSchema(e){return ps(this,{})(e)},get description(){return Ga.get(this)?.description},get _def(){return this._zod.def}}),Bc=P(`_ZodString`,(e,t)=>{Wr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r)},qt({format:e=>Es(e).format??null,minLength:e=>Es(e).minimum??null,maxLength:e=>Es(e).maximum??null},{regex(...e){return this.check(Ro(...e))},includes(...e){return this.check(Vo(...e))},startsWith(...e){return this.check(Ho(...e))},endsWith(...e){return this.check(Uo(...e))},min(...e){return this.check(Io(...e))},max(...e){return this.check(Fo(...e))},length(...e){return this.check(Lo(...e))},nonempty(...e){return this.check(Io(1,...e))},lowercase(e){return this.check(zo(e))},uppercase(e){return this.check(Bo(e))},trim(){return this.check(Ko())},normalize(...e){return this.check(Go(...e))},toLowerCase(){return this.check(qo())},toUpperCase(){return this.check(Jo())},slugify(){return this.check(Yo())}})),Vc=P(`ZodString`,(e,t)=>{Wr.init(e,t),Bc.init(e,t)},{email(e){return this.check(Ja(Kc,e))},url(e){return this.check(eo(Xc,e))},jwt(e){return this.check(go(fl,e))},emoji(e){return this.check(to(Qc,e))},guid(e){return this.check(Ya(Jc,e))},uuid(e){return this.check(Xa(Yc,e))},uuidv4(e){return this.check(Za(Yc,e))},uuidv6(e){return this.check(Qa(Yc,e))},uuidv7(e){return this.check($a(Yc,e))},nanoid(e){return this.check(no($c,e))},cuid(e){return this.check(ro(el,e))},cuid2(e){return this.check(io(tl,e))},ulid(e){return this.check(ao(nl,e))},base64(e){return this.check(po(ll,e))},base64url(e){return this.check(mo(ul,e))},xid(e){return this.check(oo(rl,e))},ksuid(e){return this.check(so(il,e))},ipv4(e){return this.check(co(al,e))},ipv6(e){return this.check(lo(ol,e))},cidrv4(e){return this.check(uo(sl,e))},cidrv6(e){return this.check(fo(cl,e))},e164(e){return this.check(ho(dl,e))},datetime(e){return this.check(_o(Hc,e))},date(e){return this.check(vo(Uc,e))},time(e){return this.check(yo(Wc,e))},duration(e){return this.check(bo(Gc,e))}});function z(e){return qa(Vc,e)}var B=P(`ZodStringFormat`,(e,t)=>{I.init(e,t),Bc.init(e,t)}),Hc=P(`ZodISODateTime`,(e,t)=>{li.init(e,t),B.init(e,t)}),Uc=P(`ZodISODate`,(e,t)=>{ui.init(e,t),B.init(e,t)}),Wc=P(`ZodISOTime`,(e,t)=>{di.init(e,t),B.init(e,t)}),Gc=P(`ZodISODuration`,(e,t)=>{fi.init(e,t),B.init(e,t)}),Kc=P(`ZodEmail`,(e,t)=>{qr.init(e,t),B.init(e,t)});function qc(e){return Ja(Kc,e)}var Jc=P(`ZodGUID`,(e,t)=>{Gr.init(e,t),B.init(e,t)}),Yc=P(`ZodUUID`,(e,t)=>{Kr.init(e,t),B.init(e,t)}),Xc=P(`ZodURL`,(e,t)=>{ti.init(e,t),B.init(e,t)});function Zc(e){return eo(Xc,e)}var Qc=P(`ZodEmoji`,(e,t)=>{ni.init(e,t),B.init(e,t)}),$c=P(`ZodNanoID`,(e,t)=>{ri.init(e,t),B.init(e,t)}),el=P(`ZodCUID`,(e,t)=>{ii.init(e,t),B.init(e,t)}),tl=P(`ZodCUID2`,(e,t)=>{ai.init(e,t),B.init(e,t)}),nl=P(`ZodULID`,(e,t)=>{oi.init(e,t),B.init(e,t)}),rl=P(`ZodXID`,(e,t)=>{si.init(e,t),B.init(e,t)}),il=P(`ZodKSUID`,(e,t)=>{ci.init(e,t),B.init(e,t)}),al=P(`ZodIPv4`,(e,t)=>{pi.init(e,t),B.init(e,t)}),ol=P(`ZodIPv6`,(e,t)=>{gi.init(e,t),B.init(e,t)}),sl=P(`ZodCIDRv4`,(e,t)=>{_i.init(e,t),B.init(e,t)}),cl=P(`ZodCIDRv6`,(e,t)=>{yi.init(e,t),B.init(e,t)}),ll=P(`ZodBase64`,(e,t)=>{Si.init(e,t),B.init(e,t)}),ul=P(`ZodBase64URL`,(e,t)=>{Ti.init(e,t),B.init(e,t)}),dl=P(`ZodE164`,(e,t)=>{Ei.init(e,t),B.init(e,t)}),fl=P(`ZodJWT`,(e,t)=>{Oi.init(e,t),B.init(e,t)}),pl=P(`ZodNumber`,(e,t)=>{ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.isFinite=!0},qt({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Es(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Es(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Es(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Es(e).format??null},{gt(e,t){return this.check(Mo(e,t))},gte(e,t){return this.check(No(e,t))},min(e,t){return this.check(No(e,t))},lt(e,t){return this.check(Ao(e,t))},lte(e,t){return this.check(jo(e,t))},max(e,t){return this.check(jo(e,t))},int(e){return this.check(hl(e))},safe(e){return this.check(hl(e))},positive(e){return this.check(Mo(0,e))},nonnegative(e){return this.check(No(0,e))},negative(e){return this.check(Ao(0,e))},nonpositive(e){return this.check(jo(0,e))},multipleOf(e,t){return this.check(Po(e,t))},step(e,t){return this.check(Po(e,t))},finite(){return this}}));function V(e){return xo(pl,e)}var ml=P(`ZodNumberFormat`,(e,t)=>{Ai.init(e,t),pl.init(e,t)});function hl(e){return Co(ml,e)}var gl=P(`ZodBoolean`,(e,t)=>{ji.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r)});function H(e){return wo(gl,e)}var _l=P(`ZodUndefined`,(e,t)=>{Mi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r)});function vl(e){return To(_l,e)}var yl=P(`ZodNull`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r)});function bl(e){return Eo(yl,e)}var xl=P(`ZodAny`,(e,t)=>{Pi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sl(){return Do(xl)}var Cl=P(`ZodUnknown`,(e,t)=>{Fi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function U(){return Oo(Cl)}var wl=P(`ZodNever`,(e,t)=>{Ii.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r)});function Tl(e){return ko(wl,e)}var El=P(`ZodArray`,(e,t)=>{zc(),Bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Io(e,t))},nonempty(e){return this.check(Io(1,e))},max(e,t){return this.check(Fo(e,t))},length(e,t){return this.check(Lo(e,t))},unwrap(){return this.element}});function W(e,t){return Xo(El,e,t)}var Dl=P(`ZodObject`,(e,t)=>{zc(),Ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tc(e,t,n,r),$t(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(lt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(lt(this._zod.def,{catchall:U()}))},loose(){return this.clone(lt(this._zod.def,{catchall:U()}))},strict(){return this.clone(lt(this._zod.def,{catchall:Tl()}))},strip(){return this.clone(lt(this._zod.def,{catchall:void 0}))},extend(e){return Dt(this,e)},safeExtend(e){return kt(this,e)},merge(e){return At(this,e)},pick(e){return wt(this,e)},omit(e){return Et(this,e)},partial(...e){return jt(Rl,this,e[0])},exactPartial(...e){return jt(zl,this,e[0],`exactPartial`)},required(...e){return Mt(ql,this,e[0])}});function G(e,t){return new Dl({type:`object`,shape:e??{},...j(t)})}function K(e,t){return new Dl({type:`object`,shape:e,catchall:U(),...j(t)})}var Ol=P(`ZodUnion`,(e,t)=>{Ji.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(e,t,n,r),e.options=t.options});function q(e,t){return new Ol({type:`union`,options:e,...j(t)})}var kl=P(`ZodDiscriminatedUnion`,(e,t)=>{Ol.init(e,t),Xi.init(e,t)});function Al(e,t,n){return new kl({type:`union`,options:t,discriminator:e,...j(n)})}var jl=P(`ZodIntersection`,(e,t)=>{Zi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(e,t,n,r)});function Ml(e,t){return new jl({type:`intersection`,left:e,right:t})}var Nl=P(`ZodRecord`,(e,t)=>{zc(),ea.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new Nl({type:`record`,keyType:z(),valueType:e,...j(t)}):new Nl({type:`record`,keyType:e,valueType:t,...j(n)})}var Pl=P(`ZodEnum`,(e,t)=>{ta.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Pl({...t,checks:[],...j(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 Pl({...t,checks:[],...j(r),entries:i})}});function Y(e,t){return new Pl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...j(t)})}var Fl=P(`ZodLiteral`,(e,t)=>{na.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(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 Fl({type:`literal`,values:Array.isArray(e)?e:[e],...j(t)})}var Il=P(`ZodTransform`,(e,t)=>{zc(),ra.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ln(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Wt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Wt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ll(e){return new Il({type:`transform`,transform:e})}var Rl=P(`ZodOptional`,(e,t)=>{aa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Z(e){return new Rl({type:`optional`,innerType:e})}var zl=P(`ZodExactOptional`,(e,t)=>{oa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bl(e){return new zl({type:`optional`,innerType:e})}var Vl=P(`ZodNullable`,(e,t)=>{sa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hl(e){return new Vl({type:`nullable`,innerType:e})}var Ul=P(`ZodDefault`,(e,t)=>{ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wl(e,t){return new Ul({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():gt(t)}})}var Gl=P(`ZodPrefault`,(e,t)=>{ua.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kl(e,t){return new Gl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():gt(t)}})}var ql=P(`ZodNonOptional`,(e,t)=>{da.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jl(e,t){return new ql({type:`nonoptional`,innerType:e,...j(t)})}var Yl=P(`ZodCatch`,(e,t)=>{ma.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xl(e,t){return new Yl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:tn(t)})}var Zl=P(`ZodPipe`,(e,t)=>{ha.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.in=t.in,e.out=t.out});function Ql(e,t){return new Zl({type:`pipe`,in:e,out:t})}var $l=P(`ZodPreprocess`,(e,t)=>{Zl.init(e,t),_a.init(e,t)}),eu=P(`ZodReadonly`,(e,t)=>{va.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tu(e){return new eu({type:`readonly`,innerType:e})}var nu=P(`ZodLazy`,(e,t)=>{ba.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bc(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ru(e){return new nu({type:`lazy`,getter:e})}var iu=P(`ZodCustom`,(e,t)=>{xa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Js(e,t,n,r)});function au(e,t={}){return Zo(iu,e,t)}function ou(e,t){return Qo(e,t)}function su(e,t){return new $l({type:`pipe`,in:Ll(e),out:t})}var cu={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`},lu;lu||={};function uu(e){return _o(Hc,e)}function du(e){return vo(Uc,e)}function fu(e){return So(pl,e)}var pu=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],mu=`io.modelcontextprotocol/related-task`,hu=`io.modelcontextprotocol/protocolVersion`,gu=`io.modelcontextprotocol/clientInfo`,_u=`io.modelcontextprotocol/serverInfo`,vu=`io.modelcontextprotocol/clientCapabilities`,yu=`io.modelcontextprotocol/subscriptionId`,bu=`io.modelcontextprotocol/logLevel`,xu=ru(()=>q([z(),V(),H(),bl(),J(z(),xu),W(xu)])),Q=J(z(),xu),Su=W(xu),Cu=q([z(),V().int()]),wu=z(),Tu=G({ttl:V().optional()}),Eu=G({taskId:z()}),Du=K({progressToken:Cu.optional(),[mu]:Eu.optional()}),Ou=G({_meta:Du.optional()}),ku=Ou.extend({task:Tu.optional()}),Au=G({method:z(),params:Ou.loose().optional()}),ju=G({_meta:Du.optional()}),Mu=G({method:z(),params:ju.loose().optional()}),Nu=K({get[_u](){return Ju.optional().catch(void 0)}}),Pu=K({_meta:Nu.optional()}),Fu=q([z(),V().int()]),Iu=G({jsonrpc:X(`2.0`),id:Fu,...Au.shape}).strict(),Lu=G({jsonrpc:X(`2.0`),...Mu.shape}).strict(),Ru=G({jsonrpc:X(`2.0`),id:Fu,result:Pu}).strict(),zu=G({jsonrpc:X(`2.0`),id:Fu.optional(),error:G({code:V().int(),message:z(),data:U().optional()})}).strict(),Bu=q([Iu,Lu,Ru,zu]),Vu=q([Ru,zu]),Hu=Pu.strict(),Uu=ju.extend({requestId:Fu.optional(),reason:z().optional()}),Wu=Mu.extend({method:X(`notifications/cancelled`),params:Uu}),Gu=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),Ku=G({icons:W(Gu).optional()}),qu=G({name:z(),title:z().optional()}),Ju=qu.extend({...qu.shape,...Ku.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),Yu=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),Q).optional(),url:Q.optional()}),Q.optional())),Xu=K({list:Q.optional(),cancel:Q.optional(),requests:K({sampling:K({createMessage:Q.optional()}).optional(),elicitation:K({create:Q.optional()}).optional()}).optional()}),Zu=K({list:Q.optional(),cancel:Q.optional(),requests:K({tools:K({call:Q.optional()}).optional()}).optional()}),Qu=G({experimental:J(z(),Q).optional(),sampling:G({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:Yu.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:Xu.optional(),extensions:J(z(),Q).optional()}),$u=Ou.extend({protocolVersion:z(),capabilities:Qu,clientInfo:Ju}),ed=Au.extend({method:X(`initialize`),params:$u}),td=G({experimental:J(z(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:Zu.optional(),extensions:J(z(),Q).optional()}),nd=Pu.extend({protocolVersion:z(),capabilities:td,serverInfo:Ju,instructions:z().optional()}),rd=Mu.extend({method:X(`notifications/initialized`),params:ju.optional()}),id=Au.extend({method:X(`server/discover`),params:Ou.optional()}),ad=Pu.extend({supportedVersions:W(z()),capabilities:td,instructions:z().optional()}),od=Au.extend({method:X(`ping`),params:Ou.optional()}),sd=G({progress:V(),total:Z(V()),message:Z(z())}),cd=G({...ju.shape,...sd.shape,progressToken:Cu}),ld=Mu.extend({method:X(`notifications/progress`),params:cd}),ud=Ou.extend({cursor:wu.optional()}),dd=Au.extend({params:ud.optional()}),fd=Pu.extend({nextCursor:wu.optional()}),pd=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),md=pd.extend({text:z()}),hd=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),gd=pd.extend({blob:hd}),_d=Y([`user`,`assistant`]),vd=G({audience:W(_d).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),yd=G({...qu.shape,...Ku.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:vd.optional(),_meta:Z(K({}))}),bd=G({...qu.shape,...Ku.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:vd.optional(),_meta:Z(K({}))}),xd=dd.extend({method:X(`resources/list`)}),Sd=fd.extend({resources:W(yd)}),Cd=dd.extend({method:X(`resources/templates/list`)}),wd=fd.extend({resourceTemplates:W(bd)}),Td=Ou.extend({uri:z()}),Ed=Td,Dd=Au.extend({method:X(`resources/read`),params:Ed}),Od=Pu.extend({contents:W(q([md,gd]))}),kd=Mu.extend({method:X(`notifications/resources/list_changed`),params:ju.optional()}),Ad=Td,jd=Au.extend({method:X(`resources/subscribe`),params:Ad}),Md=Td,Nd=Au.extend({method:X(`resources/unsubscribe`),params:Md}),Pd=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(z()).optional()}),Fd=Ou.extend({notifications:Pd}),Id=Au.extend({method:X(`subscriptions/listen`),params:Fd}),Ld=ju.extend({notifications:Pd}),Rd=Mu.extend({method:X(`notifications/subscriptions/acknowledged`),params:Ld}),zd=Nu.extend({[yu]:Fu}),Bd=Pu.extend({_meta:zd}),Vd=ju.extend({uri:z()}),Hd=Mu.extend({method:X(`notifications/resources/updated`),params:Vd}),Ud=G({name:z(),description:Z(z()),required:Z(H())}),Wd=G({...qu.shape,...Ku.shape,description:Z(z()),arguments:Z(W(Ud)),_meta:Z(K({}))}),Gd=dd.extend({method:X(`prompts/list`)}),Kd=fd.extend({prompts:W(Wd)}),qd=Ou.extend({name:z(),arguments:J(z(),z()).optional()}),Jd=Au.extend({method:X(`prompts/get`),params:qd}),Yd=G({type:X(`text`),text:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Xd=G({type:X(`image`),data:hd,mimeType:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Zd=G({type:X(`audio`),data:hd,mimeType:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Qd=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),$d=G({type:X(`resource`),resource:q([md,gd]),annotations:vd.optional(),_meta:J(z(),U()).optional()}),ef=yd.extend({type:X(`resource_link`)}),tf=q([Yd,Xd,Zd,ef,$d]),nf=G({role:_d,content:tf}),rf=Pu.extend({description:z().optional(),messages:W(nf)}),af=Mu.extend({method:X(`notifications/prompts/list_changed`),params:ju.optional()}),of=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),sf=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),cf=G({...qu.shape,...Ku.shape,description:z().optional(),inputSchema:G({type:X(`object`),properties:J(z(),xu).optional(),required:W(z()).optional()}).catchall(U()),outputSchema:K({$schema:z().optional()}).optional(),annotations:of.optional(),execution:sf.optional(),_meta:J(z(),U()).optional()}),lf=dd.extend({method:X(`tools/list`)}),uf=fd.extend({tools:W(cf)}),df=Pu.extend({content:W(tf).default([]),structuredContent:U().optional(),isError:H().optional()}),ff=df.or(Pu.extend({toolResult:U()})),pf=ku.extend({name:z(),arguments:J(z(),U()).optional()}),mf=Au.extend({method:X(`tools/call`),params:pf}),hf=Mu.extend({method:X(`notifications/tools/list_changed`),params:ju.optional()}),gf=G({autoRefresh:H().default(!0),debounceMs:V().int().nonnegative().default(300)}),_f=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),vf=Ou.extend({level:_f}),yf=Au.extend({method:X(`logging/setLevel`),params:vf}),bf=ju.extend({level:_f,logger:z().optional(),data:U()}),xf=Mu.extend({method:X(`notifications/message`),params:bf}),Sf=G({name:z().optional()}),Cf=G({hints:W(Sf).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),wf=G({mode:Y([`auto`,`required`,`none`]).optional()}),Tf=G({type:X(`tool_result`),toolUseId:z().describe(`The unique identifier for the corresponding tool call.`),content:W(tf),structuredContent:U().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),Ef=Al(`type`,[Yd,Xd,Zd]),Df=Al(`type`,[Yd,Xd,Zd,Qd,Tf]),Of=G({role:_d,content:q([Df,W(Df)]),_meta:J(z(),U()).optional()}),kf=ku.extend({messages:W(Of),modelPreferences:Cf.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:Q.optional(),tools:W(cf).optional(),toolChoice:wf.optional()}),Af=Au.extend({method:X(`sampling/createMessage`),params:kf}),jf=Pu.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(z())),role:_d,content:Ef}),Mf=Pu.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(z())),role:_d,content:q([Df,W(Df)])}),Nf=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),Pf=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),Ff=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),If=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),Lf=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),Rf=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),zf=q([If,Lf]),Bf=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Vf=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),Hf=q([Bf,Vf]),Uf=q([Rf,zf,Hf]),Wf=q([Uf,Nf,Pf,Ff]),Gf=ku.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Wf),required:W(z()).optional()}).catchall(U())}),Kf=ku.extend({mode:X(`url`),message:z(),elicitationId:z(),url:z().url()}),qf=q([Gf,Kf]),Jf=Au.extend({method:X(`elicitation/create`),params:qf}),Yf=ju.extend({elicitationId:z()}),Xf=Mu.extend({method:X(`notifications/elicitation/complete`),params:Yf}),Zf=Pu.extend({action:Y([`accept`,`decline`,`cancel`]),content:su(e=>e===null?void 0:e,J(z(),q([z(),V(),H(),W(z())])).optional())}),Qf=G({type:X(`ref/resource`),uri:z()}),$f=G({type:X(`ref/prompt`),name:z()}),ep=Ou.extend({ref:q([$f,Qf]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()}),tp=Au.extend({method:X(`completion/complete`),params:ep}),np=Pu.extend({completion:K({values:W(z()).max(100),total:Z(V().int()),hasMore:Z(H())})}),rp=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),ip=Au.extend({method:X(`roots/list`),params:Ou.optional()}),ap=Pu.extend({roots:W(rp)}),op=Mu.extend({method:X(`notifications/roots/list_changed`),params:ju.optional()}),sp=K({ttl:V().optional(),pollInterval:V().optional()}),cp=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),lp=G({taskId:z(),status:cp,ttl:q([V(),bl()]),createdAt:z(),lastUpdatedAt:z(),pollInterval:Z(V()),statusMessage:Z(z())}),up=Pu.extend({task:lp}),dp=ju.merge(lp),fp=Mu.extend({method:X(`notifications/tasks/status`),params:dp}),pp=Au.extend({method:X(`tasks/get`),params:Ou.extend({taskId:z()})}),mp=Pu.merge(lp),hp=Au.extend({method:X(`tasks/result`),params:Ou.extend({taskId:z()})}),gp=Pu.loose(),_p=dd.extend({method:X(`tasks/list`)}),vp=fd.extend({tasks:W(lp)}),yp=Au.extend({method:X(`tasks/cancel`),params:Ou.extend({taskId:z()})}),bp=Pu.merge(lp),xp=q([od,ed,id,tp,yf,Jd,Gd,xd,Cd,Dd,jd,Nd,Id,mf,lf]),Sp=q([Wu,ld,rd,op]),Cp=q([Hu,jf,Mf,Zf,ap]),wp=q([od,Af,Jf,ip]),Tp=q([Wu,ld,xf,Hd,kd,hf,af,Rd,Xf]),Ep=q([Hu,nd,ad,np,rf,Kd,Sd,wd,Od,df,uf,Bd]),Dp=Zc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:cu.custom,message:`URL must be parseable`,fatal:!0}),rn}).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`}),Op=K({resource:z().url(),authorization_servers:W(Dp).optional(),jwks_uri:z().url().optional(),scopes_supported:W(z()).optional(),bearer_methods_supported:W(z()).optional(),resource_signing_alg_values_supported:W(z()).optional(),resource_name:z().optional(),resource_documentation:z().optional(),resource_policy_uri:z().url().optional(),resource_tos_uri:z().url().optional(),tls_client_certificate_bound_access_tokens:H().optional(),authorization_details_types_supported:W(z()).optional(),dpop_signing_alg_values_supported:W(z()).optional(),dpop_bound_access_tokens_required:H().optional()}),kp=K({issuer:z(),authorization_endpoint:Dp,token_endpoint:Dp,registration_endpoint:Dp.optional(),scopes_supported:W(z()).optional(),response_types_supported:W(z()),response_modes_supported:W(z()).optional(),grant_types_supported:W(z()).optional(),token_endpoint_auth_methods_supported:W(z()).optional(),token_endpoint_auth_signing_alg_values_supported:W(z()).optional(),service_documentation:Dp.optional(),revocation_endpoint:Dp.optional(),revocation_endpoint_auth_methods_supported:W(z()).optional(),revocation_endpoint_auth_signing_alg_values_supported:W(z()).optional(),introspection_endpoint:z().optional(),introspection_endpoint_auth_methods_supported:W(z()).optional(),introspection_endpoint_auth_signing_alg_values_supported:W(z()).optional(),code_challenge_methods_supported:W(z()).optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0),dpop_signing_alg_values_supported:W(z()).optional()}),Ap=K({issuer:z(),authorization_endpoint:Dp,token_endpoint:Dp,userinfo_endpoint:Dp.optional(),jwks_uri:Dp,registration_endpoint:Dp.optional(),scopes_supported:W(z()).optional(),response_types_supported:W(z()),response_modes_supported:W(z()).optional(),grant_types_supported:W(z()).optional(),acr_values_supported:W(z()).optional(),subject_types_supported:W(z()),id_token_signing_alg_values_supported:W(z()),id_token_encryption_alg_values_supported:W(z()).optional(),id_token_encryption_enc_values_supported:W(z()).optional(),userinfo_signing_alg_values_supported:W(z()).optional(),userinfo_encryption_alg_values_supported:W(z()).optional(),userinfo_encryption_enc_values_supported:W(z()).optional(),request_object_signing_alg_values_supported:W(z()).optional(),request_object_encryption_alg_values_supported:W(z()).optional(),request_object_encryption_enc_values_supported:W(z()).optional(),token_endpoint_auth_methods_supported:W(z()).optional(),token_endpoint_auth_signing_alg_values_supported:W(z()).optional(),display_values_supported:W(z()).optional(),claim_types_supported:W(z()).optional(),claims_supported:W(z()).optional(),service_documentation:z().optional(),claims_locales_supported:W(z()).optional(),ui_locales_supported:W(z()).optional(),claims_parameter_supported:H().optional(),request_parameter_supported:H().optional(),request_uri_parameter_supported:H().optional(),require_request_uri_registration:H().optional(),op_policy_uri:Dp.optional(),op_tos_uri:Dp.optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),jp=G({...Ap.shape,...kp.pick({code_challenge_methods_supported:!0}).shape}),Mp=G({access_token:z(),id_token:z().optional(),token_type:z(),expires_in:fu().optional(),scope:z().optional(),refresh_token:z().optional(),issuer:z().optional().catch(void 0)}).strip(),Np=G({issued_token_type:X(`urn:ietf:params:oauth:token-type:id-jag`),access_token:z(),token_type:z().optional(),expires_in:V().optional(),scope:z().optional()}).strip(),Pp=G({error:z(),error_description:z().optional(),error_uri:z().optional()}),Fp=Dp.optional().or(X(``).transform(()=>void 0)),Ip=G({redirect_uris:W(Dp),token_endpoint_auth_method:z().optional(),grant_types:W(z()).optional(),response_types:W(z()).optional(),application_type:z().optional(),client_name:z().optional(),client_uri:Dp.optional(),logo_uri:Fp,scope:z().optional(),contacts:W(z()).optional(),tos_uri:Fp,policy_uri:z().optional(),jwks_uri:Dp.optional(),jwks:Sl().optional(),software_id:z().optional(),software_version:z().optional(),software_statement:z().optional()}).strip(),Lp=G({client_id:z(),client_secret:z().optional(),client_id_issued_at:V().optional(),client_secret_expires_at:V().optional(),issuer:z().optional().catch(void 0)}).strip(),Rp=Ip.merge(Lp),zp=G({error:z(),error_description:z().optional()}).strip(),Bp=G({token:z(),token_type_hint:z().optional()}).strip(),Vp=Symbol.for(`mcp.sdk.errorBrands`);function Hp(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,Vp,{value:n,enumerable:!1,configurable:!0})}function Up(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Vp)){let n=t[Vp];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Hp(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)}});var Wp=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}({}),Gp=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Hp(this,new.target)}};(class extends Gp{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Kp=`2026-07-28`;function qp(e){return e>=Kp}function Jp(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 Yp=[`task`,`inputRequests`,`requestState`];function Xp(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Yp.some(t=>t in e)?e:{...e,content:[]}}function Zp(){let e=ru(()=>q([z(),V(),H(),bl(),J(z(),e),W(e)])),t=J(z(),e),n=q([z(),V().int()]),r=z(),i=G({ttl:V().optional()}),a=G({taskId:z()}),o=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=G({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=G({method:z(),params:s.loose().optional()}),u=G({_meta:o.optional()}),d=G({method:z(),params:u.loose().optional()}),f=K({_meta:o.optional()}),p=q([z(),V().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:z().optional()}),g=d.extend({method:X(`notifications/cancelled`),params:h}),_=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),v=G({icons:W(_).optional()}),y=G({name:z(),title:z().optional()}),b=y.extend({...y.shape,...v.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),ee=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),te=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),x=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),ne=G({experimental:J(z(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:te.optional(),extensions:J(z(),t).optional()}),S=s.extend({protocolVersion:z(),capabilities:ne,clientInfo:b}),C=l.extend({method:X(`initialize`),params:S}),w=G({experimental:J(z(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:x.optional(),extensions:J(z(),t).optional()}),re=f.extend({protocolVersion:z(),capabilities:w,serverInfo:b,instructions:z().optional()}),T=d.extend({method:X(`notifications/initialized`),params:u.optional()}),ie=l.extend({method:X(`ping`),params:s.optional()}),E=G({progress:V(),total:Z(V()),message:Z(z())}),ae=G({...u.shape,...E.shape,progressToken:n}),oe=d.extend({method:X(`notifications/progress`),params:ae}),D=s.extend({cursor:r.optional()}),se=l.extend({params:D.optional()}),ce=f.extend({nextCursor:r.optional()}),le=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),ue=le.extend({text:z()}),de=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),fe=le.extend({blob:de}),pe=Y([`user`,`assistant`]),me=G({audience:W(pe).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),he=G({...y.shape,...v.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:me.optional(),_meta:Z(K({}))}),ge=G({...y.shape,...v.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:me.optional(),_meta:Z(K({}))}),_e=se.extend({method:X(`resources/list`)}),ve=ce.extend({resources:W(he)}),ye=se.extend({method:X(`resources/templates/list`)}),be=ce.extend({resourceTemplates:W(ge)}),xe=s.extend({uri:z()}),Se=xe,Ce=l.extend({method:X(`resources/read`),params:Se}),O=f.extend({contents:W(q([ue,fe]))}),k=d.extend({method:X(`notifications/resources/list_changed`),params:u.optional()}),we=xe,Te=l.extend({method:X(`resources/subscribe`),params:we}),Ee=xe,De=l.extend({method:X(`resources/unsubscribe`),params:Ee}),Oe=u.extend({uri:z()}),ke=d.extend({method:X(`notifications/resources/updated`),params:Oe}),Ae=G({name:z(),description:Z(z()),required:Z(H())}),je=G({...y.shape,...v.shape,description:Z(z()),arguments:Z(W(Ae)),_meta:Z(K({}))}),Me=se.extend({method:X(`prompts/list`)}),Ne=ce.extend({prompts:W(je)}),A=s.extend({name:z(),arguments:J(z(),z()).optional()}),Pe=l.extend({method:X(`prompts/get`),params:A}),Fe=G({type:X(`text`),text:z(),annotations:me.optional(),_meta:J(z(),U()).optional()}),Ie=G({type:X(`image`),data:de,mimeType:z(),annotations:me.optional(),_meta:J(z(),U()).optional()}),Le=G({type:X(`audio`),data:de,mimeType:z(),annotations:me.optional(),_meta:J(z(),U()).optional()}),Re=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),ze=G({type:X(`resource`),resource:q([ue,fe]),annotations:me.optional(),_meta:J(z(),U()).optional()}),Be=he.extend({type:X(`resource_link`)}),Ve=q([Fe,Ie,Le,Be,ze]),He=G({role:pe,content:Ve}),Ue=f.extend({description:z().optional(),messages:W(He)}),We=d.extend({method:X(`notifications/prompts/list_changed`),params:u.optional()}),Ge=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Ke=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),qe=G({...y.shape,...v.shape,description:z().optional(),inputSchema:G({type:X(`object`),properties:J(z(),e).optional(),required:W(z()).optional()}).catchall(U()),outputSchema:G({type:X(`object`),properties:J(z(),e).optional(),required:W(z()).optional()}).catchall(U()).optional(),annotations:Ge.optional(),execution:Ke.optional(),_meta:J(z(),U()).optional()}),Je=se.extend({method:X(`tools/list`)}),Ye=ce.extend({tools:W(qe)}),Xe=f.extend({content:W(Ve),structuredContent:J(z(),U()).optional(),isError:H().optional()}),Ze=c.extend({name:z(),arguments:J(z(),U()).optional()}),Qe=l.extend({method:X(`tools/call`),params:Ze}),$e=d.extend({method:X(`notifications/tools/list_changed`),params:u.optional()}),et=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),tt=s.extend({level:et}),nt=l.extend({method:X(`logging/setLevel`),params:tt}),rt=u.extend({level:et,logger:z().optional(),data:U()}),it=d.extend({method:X(`notifications/message`),params:rt}),at=G({name:z().optional()}),ot=G({hints:W(at).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),st=G({mode:Y([`auto`,`required`,`none`]).optional()}),ct=G({type:X(`tool_result`),toolUseId:z().describe(`The unique identifier for the corresponding tool call.`),content:W(Ve),structuredContent:G({}).loose().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),lt=Al(`type`,[Fe,Ie,Le]),ut=Al(`type`,[Fe,Ie,Le,Re,ct]),dt=G({role:pe,content:q([ut,W(ut)]),_meta:J(z(),U()).optional()}),ft=c.extend({messages:W(dt),modelPreferences:ot.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:t.optional(),tools:W(qe).optional(),toolChoice:st.optional()}),pt=l.extend({method:X(`sampling/createMessage`),params:ft}),mt=f.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(z())),role:pe,content:lt}),ht=f.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(z())),role:pe,content:q([ut,W(ut)])}),gt=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),_t=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),vt=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),yt=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),j=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),bt=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),xt=q([yt,j]),St=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Ct=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),wt=q([St,Ct]),Tt=q([bt,xt,wt]),Et=q([Tt,gt,_t,vt]),Dt=c.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Et),required:W(z()).optional()}).catchall(U())}),Ot=c.extend({mode:X(`url`),message:z(),elicitationId:z(),url:z().url()}),kt=q([Dt,Ot]),At=l.extend({method:X(`elicitation/create`),params:kt}),jt=u.extend({elicitationId:z()}),Mt=d.extend({method:X(`notifications/elicitation/complete`),params:jt}),Nt=f.extend({action:Y([`accept`,`decline`,`cancel`]),content:su(e=>e===null?void 0:e,J(z(),q([z(),V(),H(),W(z())])).optional())}),Pt=G({type:X(`ref/resource`),uri:z()}),Ft=G({type:X(`ref/prompt`),name:z()}),It=s.extend({ref:q([Ft,Pt]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()}),Lt=l.extend({method:X(`completion/complete`),params:It}),Rt=f.extend({completion:K({values:W(z()).max(100),total:Z(V().int()),hasMore:Z(H())})}),zt=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),Bt=l.extend({method:X(`roots/list`),params:s.optional()}),Vt=f.extend({roots:W(zt)}),Ht=d.extend({method:X(`notifications/roots/list_changed`),params:u.optional()}),Ut=K({ttl:V().optional(),pollInterval:V().optional()}),Wt=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Gt=G({taskId:z(),status:Wt,ttl:q([V(),bl()]),createdAt:z(),lastUpdatedAt:z(),pollInterval:Z(V()),statusMessage:Z(z())}),M=f.extend({task:Gt}),Kt=u.merge(Gt),qt=d.extend({method:X(`notifications/tasks/status`),params:Kt}),Jt=l.extend({method:X(`tasks/get`),params:s.extend({taskId:z()})}),Yt=f.merge(Gt),Xt=l.extend({method:X(`tasks/result`),params:s.extend({taskId:z()})}),Zt=f.loose(),Qt=se.extend({method:X(`tasks/list`)}),N=ce.extend({tasks:W(Gt)}),$t=l.extend({method:X(`tasks/cancel`),params:s.extend({taskId:z()})});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:te,ServerTasksCapabilitySchema:x,ClientCapabilitiesSchema:ne,InitializeRequestParamsSchema:S,InitializeRequestSchema:C,ServerCapabilitiesSchema:w,InitializeResultSchema:re,InitializedNotificationSchema:T,PingRequestSchema:ie,ProgressSchema:E,ProgressNotificationParamsSchema:ae,ProgressNotificationSchema:oe,PaginatedRequestParamsSchema:D,PaginatedRequestSchema:se,PaginatedResultSchema:ce,ResourceContentsSchema:le,TextResourceContentsSchema:ue,BlobResourceContentsSchema:fe,RoleSchema:pe,AnnotationsSchema:me,ResourceSchema:he,ResourceTemplateSchema:ge,ListResourcesRequestSchema:_e,ListResourcesResultSchema:ve,ListResourceTemplatesRequestSchema:ye,ListResourceTemplatesResultSchema:be,ResourceRequestParamsSchema:xe,ReadResourceRequestParamsSchema:Se,ReadResourceRequestSchema:Ce,ReadResourceResultSchema:O,ResourceListChangedNotificationSchema:k,SubscribeRequestParamsSchema:we,SubscribeRequestSchema:Te,UnsubscribeRequestParamsSchema:Ee,UnsubscribeRequestSchema:De,ResourceUpdatedNotificationParamsSchema:Oe,ResourceUpdatedNotificationSchema:ke,PromptArgumentSchema:Ae,PromptSchema:je,ListPromptsRequestSchema:Me,ListPromptsResultSchema:Ne,GetPromptRequestParamsSchema:A,GetPromptRequestSchema:Pe,TextContentSchema:Fe,ImageContentSchema:Ie,AudioContentSchema:Le,ToolUseContentSchema:Re,EmbeddedResourceSchema:ze,ResourceLinkSchema:Be,ContentBlockSchema:Ve,PromptMessageSchema:He,GetPromptResultSchema:Ue,PromptListChangedNotificationSchema:We,ToolAnnotationsSchema:Ge,ToolExecutionSchema:Ke,ToolSchema:qe,ListToolsRequestSchema:Je,ListToolsResultSchema:Ye,CallToolResultSchema:Xe,CallToolRequestParamsSchema:Ze,CallToolRequestSchema:Qe,ToolListChangedNotificationSchema:$e,LoggingLevelSchema:et,SetLevelRequestParamsSchema:tt,SetLevelRequestSchema:nt,LoggingMessageNotificationParamsSchema:rt,LoggingMessageNotificationSchema:it,ModelHintSchema:at,ModelPreferencesSchema:ot,ToolChoiceSchema:st,ToolResultContentSchema:ct,SamplingContentSchema:lt,SamplingMessageContentBlockSchema:ut,SamplingMessageSchema:dt,CreateMessageRequestParamsSchema:ft,CreateMessageRequestSchema:pt,CreateMessageResultSchema:mt,CreateMessageResultWithToolsSchema:ht,BooleanSchemaSchema:gt,StringSchemaSchema:_t,NumberSchemaSchema:vt,UntitledSingleSelectEnumSchemaSchema:yt,TitledSingleSelectEnumSchemaSchema:j,LegacyTitledEnumSchemaSchema:bt,SingleSelectEnumSchemaSchema:xt,UntitledMultiSelectEnumSchemaSchema:St,TitledMultiSelectEnumSchemaSchema:Ct,MultiSelectEnumSchemaSchema:wt,EnumSchemaSchema:Tt,PrimitiveSchemaDefinitionSchema:Et,ElicitRequestFormParamsSchema:Dt,ElicitRequestURLParamsSchema:Ot,ElicitRequestParamsSchema:kt,ElicitRequestSchema:At,ElicitationCompleteNotificationParamsSchema:jt,ElicitationCompleteNotificationSchema:Mt,ElicitResultSchema:Nt,ResourceTemplateReferenceSchema:Pt,PromptReferenceSchema:Ft,CompleteRequestParamsSchema:It,CompleteRequestSchema:Lt,CompleteResultSchema:Rt,RootSchema:zt,ListRootsRequestSchema:Bt,ListRootsResultSchema:Vt,RootsListChangedNotificationSchema:Ht,TaskCreationParamsSchema:Ut,TaskStatusSchema:Wt,TaskSchema:Gt,CreateTaskResultSchema:M,TaskStatusNotificationParamsSchema:Kt,TaskStatusNotificationSchema:qt,GetTaskRequestSchema:Jt,GetTaskResultSchema:Yt,GetTaskPayloadRequestSchema:Xt,GetTaskPayloadResultSchema:Zt,ListTasksRequestSchema:Qt,ListTasksResultSchema:N,CancelTaskRequestSchema:$t,CancelTaskResultSchema:f.merge(Gt),ClientRequestSchema:q([ie,C,Lt,nt,Pe,Me,_e,ye,Ce,Te,De,Qe,Je,Jt,Xt,Qt,$t]),ClientNotificationSchema:q([g,oe,T,Ht,qt]),ClientResultSchema:q([m,mt,ht,Nt,Vt,Yt,N,M]),ServerRequestSchema:q([ie,pt,At,Bt,Jt,Xt,Qt,$t]),ServerNotificationSchema:q([g,oe,it,ke,k,$e,We,qt,Mt]),ServerResultSchema:q([m,re,Rt,Ue,Ne,ve,be,O,Xe,Ye,Yt,N,M]),CallToolResultWireSchema:U().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Yp)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(Xp).pipe(Xe)}}var Qp;function $p(){return Qp??=Zp()}function em(e){return e.type!==`object`}var tm=new Set([`const`,`enum`,`default`,`examples`]),nm=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function rm(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function im(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(rm(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ge(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&rm(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=tm.has(o)?s:nm.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var am={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},om={"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},sm={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},cm;function lm(){if(cm)return cm;let e=$p();return cm={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}},cm}function um(e){return Object.prototype.hasOwnProperty.call(am,e)}function dm(e){return Object.prototype.hasOwnProperty.call(om,e)}function fm(e){return Object.prototype.hasOwnProperty.call(sm,e)}function pm(e){return fm(e)?lm().resultSchemas[e]:void 0}function mm(e){return um(e)?lm().requestSchemas[e]:void 0}function hm(e){return dm(e)?lm().notificationSchemas[e]:void 0}Object.keys(am),Object.keys(om);function gm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _m(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 vm={ok:!1,reason:`not-in-era`};function ym(e){return gm(e)&&gm(e.outputSchema)&&em(e.outputSchema)}function bm(e){return e}var xm={era:`2025-11-25`,hasRequestMethod:um,hasNotificationMethod:dm,validateRequest:(e,t)=>_m(mm(e),t),validateResult:(e,t)=>_m(pm(e),t),validateNotification:(e,t)=>_m(hm(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>vm,validateInputResponse:()=>vm,samplingResultVariant:((e,t)=>{let n=$p();return _m(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Jp(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&em(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(gm(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:bm(e)}}return{kind:`complete`,result:bm(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>ym(e))?t:{...t,tools:n.map(e=>ym(e)?{...e,outputSchema:im(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Sm(){let e=ru(()=>q([z(),V(),H(),bl(),J(z(),e),W(e)])),t=J(z(),e),n=q([z(),V().int()]),r=z(),i=q([z(),V().int()]),a=Y([`user`,`assistant`]),o=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=G({ttl:V().optional()}),l=G({taskId:z()}),u=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=G({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=G({_meta:u.optional()}),m=G({method:z(),params:p.loose().optional()}),h=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),g=G({icons:W(h).optional()}),_=G({name:z(),title:z().optional()}),v=_.extend({..._.shape,...g.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),y=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),b=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),ee=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),te=G({experimental:J(z(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:b.optional(),extensions:J(z(),t).optional()}),x=G({experimental:J(z(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:ee.optional(),extensions:J(z(),t).optional()}),ne=G({progress:V(),total:Z(V()),message:Z(z())}),S=G({...p.shape,...ne.shape,progressToken:n}),C=m.extend({method:X(`notifications/progress`),params:S}),w=p.extend({level:o,logger:z().optional(),data:U()}),re=m.extend({method:X(`notifications/message`),params:w}),T=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),ie=T.extend({text:z()}),E=T.extend({blob:s}),ae=G({audience:W(a).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),oe=G({..._.shape,...g.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:ae.optional(),_meta:Z(K({}))}),D=G({..._.shape,...g.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:ae.optional(),_meta:Z(K({}))}),se=m.extend({method:X(`notifications/resources/list_changed`),params:p.optional()}),ce=p.extend({uri:z()}),le=m.extend({method:X(`notifications/resources/updated`),params:ce}),ue=G({name:z(),description:Z(z()),required:Z(H())}),de=G({..._.shape,...g.shape,description:Z(z()),arguments:Z(W(ue)),_meta:Z(K({}))}),fe=m.extend({method:X(`notifications/prompts/list_changed`),params:p.optional()}),pe=G({type:X(`text`),text:z(),annotations:ae.optional(),_meta:J(z(),U()).optional()}),me=G({type:X(`image`),data:s,mimeType:z(),annotations:ae.optional(),_meta:J(z(),U()).optional()}),he=G({type:X(`audio`),data:s,mimeType:z(),annotations:ae.optional(),_meta:J(z(),U()).optional()}),ge=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),_e=G({type:X(`resource`),resource:q([ie,E]),annotations:ae.optional(),_meta:J(z(),U()).optional()}),ve=oe.extend({type:X(`resource_link`)}),ye=q([pe,me,he,ve,_e]),be=G({role:a,content:ye}),xe=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Se=m.extend({method:X(`notifications/tools/list_changed`),params:p.optional()}),Ce=G({name:z().optional()}),O=G({hints:W(Ce).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),k=G({mode:Y([`auto`,`required`,`none`]).optional()}),we=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),Te=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),Ee=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),De=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),Oe=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),ke=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),Ae=q([De,Oe]),je=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Me=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),Ne=q([je,Me]),A=q([ke,Ae,Ne]),Pe=q([A,we,Te,Ee]),Fe=f.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Pe),required:W(z()).optional()}).catchall(U())}),Ie=G({type:X(`ref/resource`),uri:z()}),Le=G({type:X(`ref/prompt`),name:z()}),Re=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),ze=te.shape,Be=G({experimental:ze.experimental,sampling:ze.sampling,elicitation:ze.elicitation,roots:ze.roots,extensions:ze.extensions}),Ve=x.shape,He=G({experimental:Ve.experimental,logging:Ve.logging,completions:Ve.completions,prompts:Ve.prompts,resources:Ve.resources,tools:Ve.tools,extensions:Ve.extensions}),Ue=K({progressToken:n.optional(),[hu]:z(),[gu]:v.optional(),[vu]:Be,[bu]:o.optional()}),We=G({..._.shape,...g.shape,description:z().optional(),inputSchema:K({$schema:z().optional(),type:X(`object`)}),outputSchema:K({$schema:z().optional()}).optional(),annotations:xe.optional(),_meta:J(z(),U()).optional()}),Ge=G({type:X(`tool_result`),toolUseId:z(),content:W(ye),structuredContent:U().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),Ke=q([pe,me,he,ge,Ge]),qe=G({role:a,content:q([Ke,W(Ke)]),_meta:J(z(),U()).optional()}),Je=z(),Ye=K({[_u]:v.optional().catch(void 0)}),Xe=Ye.optional();function Ze(e){return K({_meta:Xe,resultType:Je.default(`complete`),...e})}let Qe=Ze({}),$e=Ze({nextCursor:r.optional()}),et=Ze({content:W(ye),structuredContent:U().optional(),isError:H().optional()}),tt=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(We),nextCursor:r.optional()}),nt=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(de),nextCursor:r.optional()}),rt=Ze({description:z().optional(),messages:W(be)}),it=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(oe),nextCursor:r.optional()}),at=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(D),nextCursor:r.optional()}),ot=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([ie,E]))}),st=Ze({completion:G({values:W(z()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),ct=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`])}),lt=Ze({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(z()),capabilities:He,instructions:z().optional()}),ut=G({messages:W(qe),modelPreferences:O.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:t.optional(),tools:W(We).optional(),toolChoice:k.optional()}),dt=G({method:X(`sampling/createMessage`),params:ut}),ft=G({method:X(`roots/list`),params:G({_meta:J(z(),U()).optional()}).optional()}),pt=G({...qe.shape,model:z(),stopReason:z().optional()}),mt=G({roots:W(Re)}),ht=G({action:Y([`accept`,`decline`,`cancel`]),content:J(z(),q([z(),V(),H(),W(z())])).optional()}),gt=G({mode:X(`url`),message:z(),url:z().url()}),_t=q([Fe,gt]),vt=G({method:X(`elicitation/create`),params:_t}),yt=q([dt,ft,vt]),j=q([pt,mt,ht]),bt=J(z(),yt),xt=J(z(),j),St=Ze({inputRequests:bt.optional(),requestState:z().optional()}),Ct={inputResponses:xt.optional(),requestState:z().optional()},wt=G({_meta:Ue,...Ct}),Tt=K({progressToken:n.optional()});function Et(e,t){return G({method:X(e),params:G({_meta:Ue,...t})})}function Dt(e,t){return G({method:X(e),params:G({_meta:Tt.optional(),...t}).optional()})}let Ot={name:z(),arguments:J(z(),U()).optional(),...Ct},kt={cursor:r.optional()},At=Et(`tools/call`,Ot),jt=Et(`tools/list`,kt),Mt=Et(`prompts/list`,kt),Nt=Et(`prompts/get`,{name:z(),arguments:J(z(),z()).optional(),...Ct}),Pt=Et(`resources/list`,kt),Ft=Et(`resources/templates/list`,kt),It=Et(`resources/read`,{uri:z(),...Ct}),Lt={ref:q([Le,Ie]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()},Rt=Et(`completion/complete`,Lt),zt=Et(`server/discover`,{}),Bt=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(z()).optional()}),Vt={notifications:Bt},Ht=Et(`subscriptions/listen`,Vt),Ut=Ye.extend({"io.modelcontextprotocol/subscriptionId":i}),Wt=K({_meta:Ut,resultType:Je.default(`complete`)}),Gt={"tools/call":Dt(`tools/call`,Ot),"tools/list":Dt(`tools/list`,kt),"prompts/get":Dt(`prompts/get`,{name:z(),arguments:J(z(),z()).optional()}),"prompts/list":Dt(`prompts/list`,kt),"resources/list":Dt(`resources/list`,kt),"resources/templates/list":Dt(`resources/templates/list`,kt),"resources/read":Dt(`resources/read`,{uri:z()}),"completion/complete":Dt(`completion/complete`,Lt),"server/discover":Dt(`server/discover`,{}),"subscriptions/listen":Dt(`subscriptions/listen`,Vt)};function M(e){return K({_meta:Xe,...e})}let Kt={"tools/call":M({content:W(ye),structuredContent:U().optional(),isError:H().optional()}),"tools/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(We),nextCursor:r.optional()}),"prompts/get":M({description:z().optional(),messages:W(be)}),"prompts/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(de),nextCursor:r.optional()}),"resources/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(oe),nextCursor:r.optional()}),"resources/templates/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(D),nextCursor:r.optional()}),"resources/read":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([ie,E]))}),"completion/complete":M({completion:G({values:W(z()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),"server/discover":M({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(z()),capabilities:He,instructions:z().optional()}),"subscriptions/listen":M({})},qt=K({"io.modelcontextprotocol/subscriptionId":i.optional()}),Jt=G({method:X(`notifications/subscriptions/acknowledged`),params:G({_meta:qt.optional(),notifications:Bt})}),Yt=G({_meta:qt.optional(),requestId:i,reason:z().optional()}),Xt=G({method:X(`notifications/cancelled`),params:Yt}),Zt={"notifications/cancelled":Xt,"notifications/progress":C,"notifications/message":re,"notifications/resources/updated":le,"notifications/resources/list_changed":se,"notifications/tools/list_changed":Se,"notifications/prompts/list_changed":fe,"notifications/subscriptions/acknowledged":Jt},Qt=e=>G({jsonrpc:X(`2.0`),id:q([z(),V().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:ee,ClientCapabilitiesSchema:te,ServerCapabilitiesSchema:x,ProgressSchema:ne,ProgressNotificationParamsSchema:S,ProgressNotificationSchema:C,LoggingMessageNotificationParamsSchema:w,LoggingMessageNotificationSchema:re,ResourceContentsSchema:T,TextResourceContentsSchema:ie,BlobResourceContentsSchema:E,AnnotationsSchema:ae,ResourceSchema:oe,ResourceTemplateSchema:D,ResourceListChangedNotificationSchema:se,ResourceUpdatedNotificationParamsSchema:ce,ResourceUpdatedNotificationSchema:le,PromptArgumentSchema:ue,PromptSchema:de,PromptListChangedNotificationSchema:fe,TextContentSchema:pe,ImageContentSchema:me,AudioContentSchema:he,ToolUseContentSchema:ge,EmbeddedResourceSchema:_e,ResourceLinkSchema:ve,ContentBlockSchema:ye,PromptMessageSchema:be,ToolAnnotationsSchema:xe,ToolListChangedNotificationSchema:Se,ModelHintSchema:Ce,ModelPreferencesSchema:O,ToolChoiceSchema:k,BooleanSchemaSchema:we,StringSchemaSchema:Te,NumberSchemaSchema:Ee,UntitledSingleSelectEnumSchemaSchema:De,TitledSingleSelectEnumSchemaSchema:Oe,LegacyTitledEnumSchemaSchema:ke,SingleSelectEnumSchemaSchema:Ae,UntitledMultiSelectEnumSchemaSchema:je,TitledMultiSelectEnumSchemaSchema:Me,MultiSelectEnumSchemaSchema:Ne,EnumSchemaSchema:A,PrimitiveSchemaDefinitionSchema:Pe,ElicitRequestFormParamsSchema:Fe,ResourceTemplateReferenceSchema:Ie,PromptReferenceSchema:Le,RootSchema:Re,ClientCapabilities2026Schema:Be,ServerCapabilities2026Schema:He,RequestMetaEnvelopeSchema:Ue,ToolSchema:We,ToolResultContentSchema:Ge,SamplingMessageContentBlockSchema:Ke,SamplingMessageSchema:qe,ResultTypeSchema:Je,ResultMetaSchema:Ye,ResultSchema:Qe,PaginatedResultSchema:$e,CallToolResultSchema:et,ListToolsResultSchema:tt,ListPromptsResultSchema:nt,GetPromptResultSchema:rt,ListResourcesResultSchema:it,ListResourceTemplatesResultSchema:at,ReadResourceResultSchema:ot,CompleteResultSchema:st,CacheableResultSchema:ct,DiscoverResultSchema:lt,CreateMessageRequestParamsSchema:ut,CreateMessageRequestSchema:dt,ListRootsRequestSchema:ft,CreateMessageResultSchema:pt,ListRootsResultSchema:mt,ElicitResultSchema:ht,ElicitRequestURLParamsSchema:gt,ElicitRequestParamsSchema:_t,ElicitRequestSchema:vt,InputRequestSchema:yt,InputResponseSchema:j,InputRequestsSchema:bt,InputResponsesSchema:xt,InputRequiredResultSchema:St,InputResponseRequestParamsSchema:wt,CallToolRequestSchema:At,ListToolsRequestSchema:jt,ListPromptsRequestSchema:Mt,GetPromptRequestSchema:Nt,ListResourcesRequestSchema:Pt,ListResourceTemplatesRequestSchema:Ft,ReadResourceRequestSchema:It,CompleteRequestSchema:Rt,DiscoverRequestSchema:zt,SubscriptionFilterSchema:Bt,SubscriptionsListenRequestSchema:Ht,SubscriptionsListenResultMetaSchema:Ut,SubscriptionsListenResultSchema:Wt,dispatchRequestSchemas:Gt,dispatchResultSchemas:Kt,NotificationMetaSchema:qt,SubscriptionsAcknowledgedNotificationSchema:Jt,CancelledNotificationParamsSchema:Yt,CancelledNotificationSchema:Xt,notificationSchemas2026:Zt,JSONRPCResultResponseSchema:Qt(Qe),CallToolResultResponseSchema:Qt(q([et,St])),ListToolsResultResponseSchema:Qt(tt),ListPromptsResultResponseSchema:Qt(nt),GetPromptResultResponseSchema:Qt(q([rt,St])),ListResourcesResultResponseSchema:Qt(it),ListResourceTemplatesResultResponseSchema:Qt(at),ReadResourceResultResponseSchema:Qt(q([ot,St])),CompleteResultResponseSchema:Qt(st),DiscoverResultResponseSchema:Qt(lt),SubscriptionsListenResultResponseSchema:Qt(Wt)}}var Cm;function wm(){return Cm??=Sm()}var Tm=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Em(e){return Tm.includes(e)}var Dm=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Om(e){return e[Dm]}function km(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Am(e){return e===`public`||e===`private`}var $=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}({}),jm=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Hp(this,new.target)}static fromError(t,n,r){if(t===$.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Nm(e.elicitations,n)}if(t===$.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Pm({supported:e.supported,requested:e.requested},n)}if(t===$.InvalidParams||t===$.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===$.ResourceNotFound||Object.keys(e).length===1))return new Mm(e.uri,n)}if(t===$.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Fm({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Mm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super($.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Nm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super($.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Pm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super($.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Fm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super($.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Im=0,Lm=`private`,Rm=[`tools/call`,`prompts/get`,`resources/read`];function zm(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Rm.includes(e))return t;throw new jm($.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Bm(e,t){let n=Om(t);if(t.resultType!==`complete`||!Em(e))return n===void 0?t:Gm(t);let r=t,i=km(r.ttlMs)?r.ttlMs:Um(n),a=Am(r.cacheScope)?r.cacheScope:Wm(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Dm],o}function Vm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hm(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[_u]:t}}:!Vm(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[_u]:t}}}function Um(e){return e!==void 0&&km(e.ttlMs)?e.ttlMs:Im}function Wm(e){return e!==void 0&&Am(e.cacheScope)?e.cacheScope:Lm}function Gm(e){let t={...e};return delete t[Dm],t}var Km=[`elicitation/create`,`sampling/createMessage`,`roots/list`],qm;function Jm(){if(qm)return qm;let e=wm();return qm={request:{"elicitation/create":G({method:X(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":G({method:X(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":G({method:X(`roots/list`),params:K({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},qm}function Ym(e){return Km.includes(e)}function Xm(e){return Ym(e)?Jm().request[e]:void 0}function Zm(e){return Ym(e)?Jm().response[e]:void 0}var Qm={"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},$m={"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 eh(e){return Object.prototype.hasOwnProperty.call(Qm,e)}function th(e){return Object.prototype.hasOwnProperty.call($m,e)}function nh(e){return Object.prototype.hasOwnProperty.call(Qm,e)}function rh(e){return eh(e)?wm().dispatchRequestSchemas[e]:void 0}function ih(e){return nh(e)?wm().dispatchResultSchemas[e]:void 0}function ah(e){return th(e)?wm().notificationSchemas2026[e]:void 0}Object.keys(Qm),Object.keys($m);function oh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sh(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 ch={ok:!1,reason:`not-in-era`},lh=[hu,vu];function uh(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=>oh(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!oh(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(oh(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var dh={era:`2026-07-28`,hasRequestMethod:eh,hasNotificationMethod:th,hasInputRequestMethod:e=>Xm(e)!==void 0,validateRequest:(e,t)=>sh(rh(e),t),validateResult:(e,t)=>sh(ih(e),t),validateNotification:(e,t)=>sh(ah(e),t),validateInputRequest:(e,t)=>sh(Xm(e),t),validateInputResponse:(e,t)=>sh(Zm(e),t),samplingResultVariant:()=>ch,outboundEnvelope(e){return{[hu]:e.protocolVersion,[gu]:e.clientInfo,[vu]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of lh)n in e||t.push({key:n,problem:`missing`});let n=wm().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=>Jp(e),inputRequestSchema:Xm,decodeResult(e,t){if(!oh(t))return{kind:`invalid`,error:new Gp(Wp.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Gp(Wp.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 Gp(Wp.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=oh(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:wm().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Gp(Wp.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},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Gp(Wp.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ph(),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 Gp(Wp.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Hm(Bm(e,zm(e,uh(e,t))),n)},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/clientCapabilities)`;let t=wm().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(`; `)}`}},fh;function ph(){if(fh)return fh;let e=wm();return fh={"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},fh}var mh=`2026-07-28`;function hh(e){return e!==void 0&&qp(e)?dh:xm}function gh(e){return e.revision===void 0?e.era===`modern`?dh.era:xm.era:hh(e.revision).era}function _h(e){return bh.some(t=>t.hasRequestMethod(e))}function vh(e){return bh.some(t=>t.hasNotificationMethod(e))}function yh(e){return e===`tasks/get`||e===`tasks/cancel`}var bh=[xm,dh],xh=Ue({AnnotationsSchema:()=>vd,AudioContentSchema:()=>Zd,BaseMetadataSchema:()=>qu,BaseRequestParamsSchema:()=>Ou,BlobResourceContentsSchema:()=>gd,BooleanSchemaSchema:()=>Nf,CallToolRequestParamsSchema:()=>pf,CallToolRequestSchema:()=>mf,CallToolResultSchema:()=>df,CancelTaskRequestSchema:()=>yp,CancelTaskResultSchema:()=>bp,CancelledNotificationParamsSchema:()=>Uu,CancelledNotificationSchema:()=>Wu,ClientCapabilitiesSchema:()=>Qu,ClientNotificationSchema:()=>Sp,ClientRequestSchema:()=>xp,ClientResultSchema:()=>Cp,ClientTasksCapabilitySchema:()=>Xu,CompatibilityCallToolResultSchema:()=>ff,CompleteRequestParamsSchema:()=>ep,CompleteRequestSchema:()=>tp,CompleteResultSchema:()=>np,ContentBlockSchema:()=>tf,CreateMessageRequestParamsSchema:()=>kf,CreateMessageRequestSchema:()=>Af,CreateMessageResultSchema:()=>jf,CreateMessageResultWithToolsSchema:()=>Mf,CreateTaskResultSchema:()=>up,CursorSchema:()=>wu,DiscoverRequestSchema:()=>id,DiscoverResultSchema:()=>ad,ElicitRequestFormParamsSchema:()=>Gf,ElicitRequestParamsSchema:()=>qf,ElicitRequestSchema:()=>Jf,ElicitRequestURLParamsSchema:()=>Kf,ElicitResultSchema:()=>Zf,ElicitationCompleteNotificationParamsSchema:()=>Yf,ElicitationCompleteNotificationSchema:()=>Xf,EmbeddedResourceSchema:()=>$d,EmptyResultSchema:()=>Hu,EnumSchemaSchema:()=>Uf,GetPromptRequestParamsSchema:()=>qd,GetPromptRequestSchema:()=>Jd,GetPromptResultSchema:()=>rf,GetTaskPayloadRequestSchema:()=>hp,GetTaskPayloadResultSchema:()=>gp,GetTaskRequestSchema:()=>pp,GetTaskResultSchema:()=>mp,IconSchema:()=>Gu,IconsSchema:()=>Ku,ImageContentSchema:()=>Xd,ImplementationSchema:()=>Ju,InitializeRequestParamsSchema:()=>$u,InitializeRequestSchema:()=>ed,InitializeResultSchema:()=>nd,InitializedNotificationSchema:()=>rd,JSONArraySchema:()=>Su,JSONObjectSchema:()=>Q,JSONRPCErrorResponseSchema:()=>zu,JSONRPCMessageSchema:()=>Bu,JSONRPCNotificationSchema:()=>Lu,JSONRPCRequestSchema:()=>Iu,JSONRPCResponseSchema:()=>Vu,JSONRPCResultResponseSchema:()=>Ru,JSONValueSchema:()=>xu,LegacyTitledEnumSchemaSchema:()=>Rf,ListChangedOptionsBaseSchema:()=>gf,ListPromptsRequestSchema:()=>Gd,ListPromptsResultSchema:()=>Kd,ListResourceTemplatesRequestSchema:()=>Cd,ListResourceTemplatesResultSchema:()=>wd,ListResourcesRequestSchema:()=>xd,ListResourcesResultSchema:()=>Sd,ListRootsRequestSchema:()=>ip,ListRootsResultSchema:()=>ap,ListTasksRequestSchema:()=>_p,ListTasksResultSchema:()=>vp,ListToolsRequestSchema:()=>lf,ListToolsResultSchema:()=>uf,LoggingLevelSchema:()=>_f,LoggingMessageNotificationParamsSchema:()=>bf,LoggingMessageNotificationSchema:()=>xf,ModelHintSchema:()=>Sf,ModelPreferencesSchema:()=>Cf,MultiSelectEnumSchemaSchema:()=>Hf,NotificationSchema:()=>Mu,NotificationsParamsSchema:()=>ju,NumberSchemaSchema:()=>Ff,PaginatedRequestParamsSchema:()=>ud,PaginatedRequestSchema:()=>dd,PaginatedResultSchema:()=>fd,PingRequestSchema:()=>od,PrimitiveSchemaDefinitionSchema:()=>Wf,ProgressNotificationParamsSchema:()=>cd,ProgressNotificationSchema:()=>ld,ProgressSchema:()=>sd,ProgressTokenSchema:()=>Cu,PromptArgumentSchema:()=>Ud,PromptListChangedNotificationSchema:()=>af,PromptMessageSchema:()=>nf,PromptReferenceSchema:()=>$f,PromptSchema:()=>Wd,ReadResourceRequestParamsSchema:()=>Ed,ReadResourceRequestSchema:()=>Dd,ReadResourceResultSchema:()=>Od,RelatedTaskMetadataSchema:()=>Eu,RequestIdSchema:()=>Fu,RequestMetaSchema:()=>Du,RequestSchema:()=>Au,ResourceContentsSchema:()=>pd,ResourceLinkSchema:()=>ef,ResourceListChangedNotificationSchema:()=>kd,ResourceRequestParamsSchema:()=>Td,ResourceSchema:()=>yd,ResourceTemplateReferenceSchema:()=>Qf,ResourceTemplateSchema:()=>bd,ResourceUpdatedNotificationParamsSchema:()=>Vd,ResourceUpdatedNotificationSchema:()=>Hd,ResultMetaObjectSchema:()=>Nu,ResultSchema:()=>Pu,RoleSchema:()=>_d,RootSchema:()=>rp,RootsListChangedNotificationSchema:()=>op,SamplingContentSchema:()=>Ef,SamplingMessageContentBlockSchema:()=>Df,SamplingMessageSchema:()=>Of,ServerCapabilitiesSchema:()=>td,ServerNotificationSchema:()=>Tp,ServerRequestSchema:()=>wp,ServerResultSchema:()=>Ep,ServerTasksCapabilitySchema:()=>Zu,SetLevelRequestParamsSchema:()=>vf,SetLevelRequestSchema:()=>yf,SingleSelectEnumSchemaSchema:()=>zf,StringSchemaSchema:()=>Pf,SubscribeRequestParamsSchema:()=>Ad,SubscribeRequestSchema:()=>jd,SubscriptionFilterSchema:()=>Pd,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ld,SubscriptionsAcknowledgedNotificationSchema:()=>Rd,SubscriptionsListenRequestParamsSchema:()=>Fd,SubscriptionsListenRequestSchema:()=>Id,SubscriptionsListenResultMetaSchema:()=>zd,SubscriptionsListenResultSchema:()=>Bd,TaskAugmentedRequestParamsSchema:()=>ku,TaskCreationParamsSchema:()=>sp,TaskMetadataSchema:()=>Tu,TaskSchema:()=>lp,TaskStatusNotificationParamsSchema:()=>dp,TaskStatusNotificationSchema:()=>fp,TaskStatusSchema:()=>cp,TextContentSchema:()=>Yd,TextResourceContentsSchema:()=>md,TitledMultiSelectEnumSchemaSchema:()=>Vf,TitledSingleSelectEnumSchemaSchema:()=>Lf,ToolAnnotationsSchema:()=>of,ToolChoiceSchema:()=>wf,ToolExecutionSchema:()=>sf,ToolListChangedNotificationSchema:()=>hf,ToolResultContentSchema:()=>Tf,ToolSchema:()=>cf,ToolUseContentSchema:()=>Qd,UnsubscribeRequestParamsSchema:()=>Md,UnsubscribeRequestSchema:()=>Nd,UntitledMultiSelectEnumSchemaSchema:()=>Bf,UntitledSingleSelectEnumSchemaSchema:()=>If}),Sh=e=>Iu.safeParse(e).success,Ch=e=>Lu.safeParse(e).success,wh=e=>Ru.safeParse(e).success,Th=e=>zu.safeParse(e).success;$.InvalidRequest,$.UnsupportedProtocolVersion,$.InvalidParams,$.MethodNotFound,$.InvalidParams,$.MissingRequiredClientCapability,$.ParseError,$.InvalidRequest,$.MethodNotFound,$.UnsupportedProtocolVersion,$.MissingRequiredClientCapability;function Eh(e,t){return Oc(e,t)}function Dh(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Oh(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 kh=!1,Ah=`draft-2020-12`;function jh(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Ah});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().`);kh||(kh=!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=Sc(e,{target:Ah,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&&Mh(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 Mh(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`||Mh(e)))}return!1}function Nh(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function Ph(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>Nh(e)).join(`, `)}:{success:!0,data:n.value}}function Fh(e){let t=Sc(e,{target:Ah,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Ih=/\\\.\\d\{(\d+)\}/;function Lh(e){let t=Ih.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=>uu({local:e,offset:t,precision:n}))))}function Rh(e,t){let n;switch(e){case`email`:n=[qc()];break;case`uri`:n=[Zc()];break;case`date`:n=[du()];break;case`date-time`:n=Lh(t)}return new Set(n.map(e=>Fh(e)).filter(e=>e!==void 0))}function zh(e,t,n){return n!==`zod`||Rh(e,t).has(t)}function Bh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vh(e){try{return jh(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new jm($.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Hh=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Uh(e){return Hh.has(e)||e.startsWith(`x-`)}var Wh=new Set([`$schema`,...Object.keys(Gf.shape.requestedSchema.shape)]),Gh={string:Dh([Pf,If,Lf,Rf]),number:Dh([Ff]),integer:Dh([Ff]),boolean:Dh([Nf]),array:Dh([Bf,Vf])},Kh=new Set(Pf.shape.format.unwrap().options);function qh(e,t,n,r){if(!Bh(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Gh,e.type)?Gh[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Uh(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Kh.has(e.format)?(typeof s!=`string`||!zh(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Jh(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Bh(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,qh(n,`properties.${e}`,t,r)])):Wh.has(i)?n[i]=a:Uh(i)||r.push(i);if(r.length>0)throw new jm($.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Yh(e,t){if(!Bh(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Eh(Wf,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Xh(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Xh(e,t[r],`${n}[${r}]`)):!Bh(e)||!Bh(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Xh(r,t[e],i):Uh(e)?[]:[i]})}function Zh(e){if(!Oh(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Jh(Vh(e.requestedSchema),t),r=Eh(Gf.shape.requestedSchema,n);if(!r.success)throw new jm($.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Yh(n,r.error.message)}`);let i=Xh(n,r.data);if(i.length>0)throw new jm($.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 jm($.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Qh(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(Qh,{elicit(e){try{return{method:`elicitation/create`,params:Zh(e)}}catch(e){throw e instanceof jm?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 $h=`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.ResultMetaObjectSchema.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(`.`),eg={IdJagTokenExchangeResponseSchema:Np,OAuthClientInformationFullSchema:Rp,OAuthClientInformationSchema:Lp,OAuthClientMetadataSchema:Ip,OAuthClientRegistrationErrorSchema:zp,OAuthErrorResponseSchema:Pp,OAuthMetadataSchema:kp,OAuthProtectedResourceMetadataSchema:Op,OAuthTokenRevocationRequestSchema:Bp,OAuthTokensSchema:Mp,OpenIdProviderDiscoveryMetadataSchema:jp,OpenIdProviderMetadataSchema:Ap},tg={},ng={};function rg(e,t){let n=e.slice(0,-6);tg[n]=t,ng[n]=e=>t.safeParse(e).success}for(let e of $h)rg(e,xh[e]);for(let[e,t]of Object.entries(eg))rg(e,t);Object.freeze(tg),Object.freeze(ng);function ig(e){switch(e){case`initialize`:case`notifications/initialized`:return hh(void 0);case`server/discover`:return hh(mh);default:return}}var ag=[hu,gu,vu,bu],og=[`inputResponses`,`requestState`];function sg(e,t){let n=e.params;if(!fg(n))return{message:e,lifted:{}};let r=n._meta,i=fg(r)?ag.filter(e=>e in r):[],a=t===`request`?og.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&fg(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 cg(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 lg(e){return()=>e}var ug=lg(void 0),dg=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_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??pu,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 Gp(Wp.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!==void 0&&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 Gp(Wp.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),wh(e)||Th(e)?this._onresponse(e):Sh(e)?this._onrequest(e,t):Ch(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 Gp(Wp.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}=sg(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=gh(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(vh(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}=sg(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=gh(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($.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(_h(n.method)&&!i.hasRequestMethod(n.method)&&!(yh(n.method)&&this._customSchemaRequestMethods.has(n.method))){o($.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o($.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o($.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:mg(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?ug:lg(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Oh(t))return u(e,t,n);let i=cg(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,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o($.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:$.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);n===void 0?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wh(e)?n(e):n(jm.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(Oh(t))return yh(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=cg(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 hh(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=ig(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(_h(t)&&!e.hasRequestMethod(t))throw new Gp(Wp.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 Gp?e:new Gp(Wp.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?t.method!==`initialize`&&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 Gp?e:new Gp(Wp.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(hg(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;Ph(n,o).then(e=>{e.success?d(e.data):f(new Gp(Wp.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 Gp(Wp.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 await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Gp(Wp.NotConnected,`Not connected`);if(vh(t.method)&&!e.hasNotificationMethod(t.method))throw new Gp(Wp.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===void 0){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))})}else await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!_h(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 jm($.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 Ph(t.params,{...r.params});if(!a.success)throw new jm($.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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(!vh(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 jm($.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))})}else{if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await Ph(t.params,{...r.params});if(!i.success)throw new jm($.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function fg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mg(e){let t={},n=[];if(!pg(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e))!pg(i)||`method`in i||`result`in i?n.push(r):t[r]=i;return{accepted:t,droppedKeys:n}}function hg(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}He((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}}))(),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`);var gg=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,_g=/^(?=.{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,vg=/^(?:[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,yg=/^(?:(?:[^\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,bg=/^(?:(?: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,xg=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Sg=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Cg=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,wg=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Tg=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Eg=/^((([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;function Dg(e){return e.test.bind(e)}Og.bind(void 0,!1),Dg(vg),Dg(yg),Dg(bg),Dg(_g),Dg(Tg),Dg(Eg),Dg(xg),Dg(Sg),Dg(Cg),Dg(wg);function Og(e,t){let n=t.match(gg);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)}globalThis.crypto;var kg=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e){super(e),this.name=new.target.name,Hp(this,new.target)}};(class extends kg{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}}),class extends kg{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}},class extends kg{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 / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends kg{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends kg{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}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Hp(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Hp(this,new.target)}};var Ag=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}},jg=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},Mg=new Set;function Ng(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;Mg.has(o)||(Mg.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},Pg(t)):e=>s({method:a,params:e})]}function Pg(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Fg=`2026-01-26`,Ig=q([X(`light`),X(`dark`)]).describe(`Color theme preference for the host environment.`),Lg=q([X(`inline`),X(`fullscreen`),X(`pip`)]).describe(`Display mode for UI presentation.`),Rg=J(q([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.
55
+ 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);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function as(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;as(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var os=new Set([`type`,`properties`,`required`,`additionalProperties`]),ss=[`oneOf`,`anyOf`];function cs(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ls(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!os.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??cs(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}nt(n,r,e.length===1?e[0]:ls(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=cs(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function us(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of os)if(t in e)return;let n=t.filter(e=>ss.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ls(t);else{let e=n[0],i=ss.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ls([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,es(e,r))}function ds(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)):es(i,s),es(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())as(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])us(e)}}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)}es(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,nt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:ms(t,`input`,e.processors),output:ms(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function fs(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 fs(r.element,n);if(r.type===`set`)return fs(r.valueType,n);if(r.type===`lazy`)return fs(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`||r.type===`catch`)return fs(r.innerType,n);if(r.type===`intersection`)return fs(r.left,n)||fs(r.right,n);if(r.type===`record`||r.type===`map`)return fs(r.keyType,n)||fs(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:fs(r.in,n)||fs(r.out,n);if(r.type===`object`){for(let e in r.shape)if(fs(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(fs(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(fs(e,n))return!0;return!!(r.rest&&fs(r.rest,n))}return!1}var ps=(e,t={})=>n=>{let r=ts({...n,processors:t});return L(e,r),is(r,e),ds(r,e)},ms=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ts({...i??{},target:a,io:t,processors:n});return L(e,o),is(o,e),ds(o,e)},hs=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},gs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},_s=(e,t)=>{hs(e,`minimum`,t),gs(e,`maximum`,t)},vs=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ys=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},bs=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},xs=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ss=(e,t)=>hs(e,`minimum`,t.minimum),Cs=(e,t)=>gs(e,`maximum`,t.maximum),ws=e=>(t,n)=>{xs(t,n.format);let[r,i]=e[n.format];hs(t,`minimum`,r),gs(t,`maximum`,i)},Ts={greater_than:(e,t)=>hs(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>gs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>vs(e,t.value),number_format:ws(St),bigint_format:ws(Ct),min_length:Ss,max_length:Cs,length_equals:(e,t)=>_s(e,t.length),min_size:Ss,max_size:Cs,size_equals:(e,t)=>_s(e,t.size),string_format:(e,t)=>{xs(e,t.format),t.pattern&&ys(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bs(e,t.mime)};function Es(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ts[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&hs(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&hs(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&gs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&gs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&vs(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&bs(t,i.mime);for(let e of i.patterns??[])ys(t,e);return t}var Ds={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Os=new Map([[xi,rr],[Ci,ir]]),ks=e=>Os.get(e)??e,As=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Es(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ds[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ks);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}))])}},js=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Es(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):ns(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Ms=(e,t,n,r)=>{n.type=`boolean`},Ns=(e,t,n,r)=>{ns(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},Ps=(e,t,n,r)=>{ns(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},Fs=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Is=(e,t,n,r)=>{ns(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Ls=(e,t,n,r)=>{ns(e,t,n,r,`Void cannot be represented in JSON Schema`)},Rs=(e,t,n,r)=>{n.not={}},zs=(e,t,n,r)=>{},Bs=(e,t,n,r)=>{},Vs=(e,t,n,r)=>{ns(e,t,n,r,`Date cannot be represented in JSON Schema`)},Hs=(e,t,n,r)=>{let i=e._zod.def,a=Ke(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Us=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(ns(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(ns(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},Ws=(e,t,n,r)=>{ns(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Gs=(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},Ks=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=Es(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},qs=(e,t,n,r)=>{n.type=`boolean`},Js=(e,t,n,r)=>{ns(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ys=(e,t,n,r)=>{ns(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Xs=(e,t,n,r)=>{ns(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Zs=(e,t,n,r)=>{ns(e,t,n,r,`Map cannot be represented in JSON Schema`)},Qs=(e,t,n,r)=>{ns(e,t,n,r,`Set cannot be represented in JSON Schema`)},$s=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Es(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=L(a.element,t,{...r,path:[...r.path,`items`]})};function ec(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ec(t.out):t.type===`catch`?ec(t.innerType):e._zod.optin}var tc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ns(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)nt(i.properties,e,L(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ec(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=L(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},nc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>L(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},rc=(e,t,n,r)=>{let i=e._zod.def,a=L(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=L(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ic=(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)=>L(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?L(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ec(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Es(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function ac(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=ac(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>ac(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?hr:mr).source)),p}var oc=new WeakMap;function sc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of oc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=ac(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var cc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Es(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=L(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)nt(i.patternProperties,ks(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=L(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=oc.get(t);n||(n=[],oc.set(t,n),t.deferred.push(()=>sc(t))),n.push(e)}i.additionalProperties=L(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ec(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},lc=(e,t,n,r)=>{let i=e._zod.def,a=L(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`}]},uc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},dc=Symbol();function fc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ns(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),dc):JSON.parse(o)}var pc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=fc(i.defaultValue,e,t,n,r);o!==dc&&(n.default=o)},mc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=fc(i.defaultValue,e,t,n,r);o!==dc&&(n._prefault=o)},hc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ns(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},gc=(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;L(o,t,r);let s=t.seen.get(e);s.ref=o},_c=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},vc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yc=(e,t,n,r)=>{let i=e._zod.def;L(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},bc=(e,t,n,r)=>{let i=e._zod.innerType;L(i,t,r);let a=t.seen.get(e);a.ref=i},xc={string:As,number:js,boolean:Ms,bigint:Ns,symbol:Ps,null:Fs,undefined:Is,void:Ls,never:Rs,any:zs,unknown:Bs,date:Vs,enum:Hs,literal:Us,nan:Ws,template_literal:Gs,file:Ks,success:qs,custom:Js,function:Ys,transform:Xs,map:Zs,set:Qs,array:$s,object:tc,union:nc,intersection:rc,tuple:ic,record:cc,nullable:lc,nonoptional:uc,default:pc,prefault:mc,catch:hc,pipe:gc,readonly:_c,promise:vc,optional:yc,lazy:bc};function Sc(e,t){if(`_idmap`in e){let n=e,r=ts({...t,processors:xc}),i={};for(let e of n._idmap.entries()){let[t,n]=e;L(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;is(r,n),nt(a,t,ds(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ts({...t,processors:xc});return L(e,n),is(n,e),ds(n,e)}var Cc=new WeakSet([Object.prototype,Error.prototype]);function wc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Tc=P(`ZodError`,(e,t)=>{_n.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Cc.has(n)||(Cc.add(n),wc(n,`format`,e=>t=>bn(e,t)),wc(n,`flatten`,e=>t=>yn(e,t)),wc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Je,2)}),wc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Je,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ec=Sn(Tc),Dc=Cn(Tc),Oc=wn(Tc),kc=En(Tc),Ac=Mn(Tc),jc=Nn(Tc),Mc=Pn(Tc),Nc=Fn(Tc),Pc=In(Tc),Fc=Ln(Tc),Ic=Rn(Tc),Lc=zn(Tc);function Rc(){un.localeError||dn(Va())}function zc(){un.memoizer||dn({memoizer:Ra()})}var R=P(`ZodType`,(e,t)=>(Rc(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(lt(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 yt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(au(e,t))},superRefine(e,t){return this.check(ou(e,t))},overwrite(e){return this.check(Wo(e))},optional(){return Z(this)},exactOptional(){return Bl(this)},nullable(){return Hl(this)},nullish(){return Z(Hl(this))},nonoptional(e){return Jl(this,e)},array(){return W(this)},or(e){return q([this,e])},and(e){return Ml(this,e)},transform(e){return Ql(this,Ll(e))},default(e){return Wl(this,e)},prefault(e){return Kl(this,e)},catch(e){return Xl(this,e)},pipe(e){return Ql(this,e)},readonly(){return tu(this)},describe(e){let t=this.clone();return Ga.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ga.get(this);let t=this.clone();return Ga.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Kt(this,`~standard`,{...Ur(this),jsonSchema:{input:ms(this,`input`),output:ms(this,`output`)}})},set"~standard"(e){M(this,`~standard`,e)},parse:function e(t,n){return Ec(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Dc(this,t,n,{callee:e})},safeParse(e,t){return Oc(this,e,t)},async safeParseAsync(e,t){return kc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){M(this,`spa`,e)},validate(e,t){return kn(this,e,t)},validateAsync(e,t){return jn(this,e,t)},encode:function e(t,n){return Ac(this,t,n,{callee:e})},decode:function e(t,n){return jc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Nc(this,t,n,{callee:e})},safeEncode(e,t){return Pc(this,e,t)},safeDecode(e,t){return Fc(this,e,t)},async safeEncodeAsync(e,t){return Ic(this,e,t)},async safeDecodeAsync(e,t){return Lc(this,e,t)},toJSONSchema(e){return ps(this,{})(e)},get description(){return Ga.get(this)?.description},get _def(){return this._zod.def}}),Bc=P(`_ZodString`,(e,t)=>{Wr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r)},qt({format:e=>Es(e).format??null,minLength:e=>Es(e).minimum??null,maxLength:e=>Es(e).maximum??null},{regex(...e){return this.check(Ro(...e))},includes(...e){return this.check(Vo(...e))},startsWith(...e){return this.check(Ho(...e))},endsWith(...e){return this.check(Uo(...e))},min(...e){return this.check(Io(...e))},max(...e){return this.check(Fo(...e))},length(...e){return this.check(Lo(...e))},nonempty(...e){return this.check(Io(1,...e))},lowercase(e){return this.check(zo(e))},uppercase(e){return this.check(Bo(e))},trim(){return this.check(Ko())},normalize(...e){return this.check(Go(...e))},toLowerCase(){return this.check(qo())},toUpperCase(){return this.check(Jo())},slugify(){return this.check(Yo())}})),Vc=P(`ZodString`,(e,t)=>{Wr.init(e,t),Bc.init(e,t)},{email(e){return this.check(Ja(Kc,e))},url(e){return this.check(eo(Xc,e))},jwt(e){return this.check(go(fl,e))},emoji(e){return this.check(to(Qc,e))},guid(e){return this.check(Ya(Jc,e))},uuid(e){return this.check(Xa(Yc,e))},uuidv4(e){return this.check(Za(Yc,e))},uuidv6(e){return this.check(Qa(Yc,e))},uuidv7(e){return this.check($a(Yc,e))},nanoid(e){return this.check(no($c,e))},cuid(e){return this.check(ro(el,e))},cuid2(e){return this.check(io(tl,e))},ulid(e){return this.check(ao(nl,e))},base64(e){return this.check(po(ll,e))},base64url(e){return this.check(mo(ul,e))},xid(e){return this.check(oo(rl,e))},ksuid(e){return this.check(so(il,e))},ipv4(e){return this.check(co(al,e))},ipv6(e){return this.check(lo(ol,e))},cidrv4(e){return this.check(uo(sl,e))},cidrv6(e){return this.check(fo(cl,e))},e164(e){return this.check(ho(dl,e))},datetime(e){return this.check(_o(Hc,e))},date(e){return this.check(vo(Uc,e))},time(e){return this.check(yo(Wc,e))},duration(e){return this.check(bo(Gc,e))}});function z(e){return qa(Vc,e)}var B=P(`ZodStringFormat`,(e,t)=>{I.init(e,t),Bc.init(e,t)}),Hc=P(`ZodISODateTime`,(e,t)=>{li.init(e,t),B.init(e,t)}),Uc=P(`ZodISODate`,(e,t)=>{ui.init(e,t),B.init(e,t)}),Wc=P(`ZodISOTime`,(e,t)=>{di.init(e,t),B.init(e,t)}),Gc=P(`ZodISODuration`,(e,t)=>{fi.init(e,t),B.init(e,t)}),Kc=P(`ZodEmail`,(e,t)=>{qr.init(e,t),B.init(e,t)});function qc(e){return Ja(Kc,e)}var Jc=P(`ZodGUID`,(e,t)=>{Gr.init(e,t),B.init(e,t)}),Yc=P(`ZodUUID`,(e,t)=>{Kr.init(e,t),B.init(e,t)}),Xc=P(`ZodURL`,(e,t)=>{ti.init(e,t),B.init(e,t)});function Zc(e){return eo(Xc,e)}var Qc=P(`ZodEmoji`,(e,t)=>{ni.init(e,t),B.init(e,t)}),$c=P(`ZodNanoID`,(e,t)=>{ri.init(e,t),B.init(e,t)}),el=P(`ZodCUID`,(e,t)=>{ii.init(e,t),B.init(e,t)}),tl=P(`ZodCUID2`,(e,t)=>{ai.init(e,t),B.init(e,t)}),nl=P(`ZodULID`,(e,t)=>{oi.init(e,t),B.init(e,t)}),rl=P(`ZodXID`,(e,t)=>{si.init(e,t),B.init(e,t)}),il=P(`ZodKSUID`,(e,t)=>{ci.init(e,t),B.init(e,t)}),al=P(`ZodIPv4`,(e,t)=>{pi.init(e,t),B.init(e,t)}),ol=P(`ZodIPv6`,(e,t)=>{gi.init(e,t),B.init(e,t)}),sl=P(`ZodCIDRv4`,(e,t)=>{_i.init(e,t),B.init(e,t)}),cl=P(`ZodCIDRv6`,(e,t)=>{yi.init(e,t),B.init(e,t)}),ll=P(`ZodBase64`,(e,t)=>{Si.init(e,t),B.init(e,t)}),ul=P(`ZodBase64URL`,(e,t)=>{Ti.init(e,t),B.init(e,t)}),dl=P(`ZodE164`,(e,t)=>{Ei.init(e,t),B.init(e,t)}),fl=P(`ZodJWT`,(e,t)=>{Oi.init(e,t),B.init(e,t)}),pl=P(`ZodNumber`,(e,t)=>{ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.isFinite=!0},qt({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Es(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Es(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Es(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Es(e).format??null},{gt(e,t){return this.check(Mo(e,t))},gte(e,t){return this.check(No(e,t))},min(e,t){return this.check(No(e,t))},lt(e,t){return this.check(Ao(e,t))},lte(e,t){return this.check(jo(e,t))},max(e,t){return this.check(jo(e,t))},int(e){return this.check(hl(e))},safe(e){return this.check(hl(e))},positive(e){return this.check(Mo(0,e))},nonnegative(e){return this.check(No(0,e))},negative(e){return this.check(Ao(0,e))},nonpositive(e){return this.check(jo(0,e))},multipleOf(e,t){return this.check(Po(e,t))},step(e,t){return this.check(Po(e,t))},finite(){return this}}));function V(e){return xo(pl,e)}var ml=P(`ZodNumberFormat`,(e,t)=>{Ai.init(e,t),pl.init(e,t)});function hl(e){return Co(ml,e)}var gl=P(`ZodBoolean`,(e,t)=>{ji.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r)});function H(e){return wo(gl,e)}var _l=P(`ZodUndefined`,(e,t)=>{Mi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r)});function vl(e){return To(_l,e)}var yl=P(`ZodNull`,(e,t)=>{Ni.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r)});function bl(e){return Eo(yl,e)}var xl=P(`ZodAny`,(e,t)=>{Pi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sl(){return Do(xl)}var Cl=P(`ZodUnknown`,(e,t)=>{Fi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function U(){return Oo(Cl)}var wl=P(`ZodNever`,(e,t)=>{Ii.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r)});function Tl(e){return ko(wl,e)}var El=P(`ZodArray`,(e,t)=>{zc(),Bi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Io(e,t))},nonempty(e){return this.check(Io(1,e))},max(e,t){return this.check(Fo(e,t))},length(e,t){return this.check(Lo(e,t))},unwrap(){return this.element}});function W(e,t){return Xo(El,e,t)}var Dl=P(`ZodObject`,(e,t)=>{zc(),Ki.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tc(e,t,n,r),$t(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(lt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(lt(this._zod.def,{catchall:U()}))},loose(){return this.clone(lt(this._zod.def,{catchall:U()}))},strict(){return this.clone(lt(this._zod.def,{catchall:Tl()}))},strip(){return this.clone(lt(this._zod.def,{catchall:void 0}))},extend(e){return Dt(this,e)},safeExtend(e){return kt(this,e)},merge(e){return At(this,e)},pick(e){return wt(this,e)},omit(e){return Et(this,e)},partial(...e){return jt(Rl,this,e[0])},exactPartial(...e){return jt(zl,this,e[0],`exactPartial`)},required(...e){return Mt(ql,this,e[0])}});function G(e,t){return new Dl({type:`object`,shape:e??{},...j(t)})}function K(e,t){return new Dl({type:`object`,shape:e,catchall:U(),...j(t)})}var Ol=P(`ZodUnion`,(e,t)=>{Ji.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(e,t,n,r),e.options=t.options});function q(e,t){return new Ol({type:`union`,options:e,...j(t)})}var kl=P(`ZodDiscriminatedUnion`,(e,t)=>{Ol.init(e,t),Xi.init(e,t)});function Al(e,t,n){return new kl({type:`union`,options:t,discriminator:e,...j(n)})}var jl=P(`ZodIntersection`,(e,t)=>{Zi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(e,t,n,r)});function Ml(e,t){return new jl({type:`intersection`,left:e,right:t})}var Nl=P(`ZodRecord`,(e,t)=>{zc(),ea.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function J(e,t,n){return!t||!t._zod?new Nl({type:`record`,keyType:z(),valueType:e,...j(t)}):new Nl({type:`record`,keyType:e,valueType:t,...j(n)})}var Pl=P(`ZodEnum`,(e,t)=>{ta.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Pl({...t,checks:[],...j(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 Pl({...t,checks:[],...j(r),entries:i})}});function Y(e,t){return new Pl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...j(t)})}var Fl=P(`ZodLiteral`,(e,t)=>{na.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(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 Fl({type:`literal`,values:Array.isArray(e)?e:[e],...j(t)})}var Il=P(`ZodTransform`,(e,t)=>{zc(),ra.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ln(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Wt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Wt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ll(e){return new Il({type:`transform`,transform:e})}var Rl=P(`ZodOptional`,(e,t)=>{aa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Z(e){return new Rl({type:`optional`,innerType:e})}var zl=P(`ZodExactOptional`,(e,t)=>{oa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bl(e){return new zl({type:`optional`,innerType:e})}var Vl=P(`ZodNullable`,(e,t)=>{sa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hl(e){return new Vl({type:`nullable`,innerType:e})}var Ul=P(`ZodDefault`,(e,t)=>{ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wl(e,t){return new Ul({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():gt(t)}})}var Gl=P(`ZodPrefault`,(e,t)=>{ua.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kl(e,t){return new Gl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():gt(t)}})}var ql=P(`ZodNonOptional`,(e,t)=>{da.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jl(e,t){return new ql({type:`nonoptional`,innerType:e,...j(t)})}var Yl=P(`ZodCatch`,(e,t)=>{ma.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xl(e,t){return new Yl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:tn(t)})}var Zl=P(`ZodPipe`,(e,t)=>{ha.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.in=t.in,e.out=t.out});function Ql(e,t){return new Zl({type:`pipe`,in:e,out:t})}var $l=P(`ZodPreprocess`,(e,t)=>{Zl.init(e,t),_a.init(e,t)}),eu=P(`ZodReadonly`,(e,t)=>{va.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tu(e){return new eu({type:`readonly`,innerType:e})}var nu=P(`ZodLazy`,(e,t)=>{ba.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bc(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ru(e){return new nu({type:`lazy`,getter:e})}var iu=P(`ZodCustom`,(e,t)=>{xa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Js(e,t,n,r)});function au(e,t={}){return Zo(iu,e,t)}function ou(e,t){return Qo(e,t)}function su(e,t){return new $l({type:`pipe`,in:Ll(e),out:t})}var cu={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`},lu;lu||={};function uu(e){return _o(Hc,e)}function du(e){return vo(Uc,e)}function fu(e){return So(pl,e)}var pu=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],mu=`io.modelcontextprotocol/related-task`,hu=`io.modelcontextprotocol/protocolVersion`,gu=`io.modelcontextprotocol/clientInfo`,_u=`io.modelcontextprotocol/serverInfo`,vu=`io.modelcontextprotocol/clientCapabilities`,yu=`io.modelcontextprotocol/subscriptionId`,bu=`io.modelcontextprotocol/logLevel`,xu=ru(()=>q([z(),V(),H(),bl(),J(z(),xu),W(xu)])),Q=J(z(),xu),Su=W(xu),Cu=q([z(),V().int()]),wu=z(),Tu=G({ttl:V().optional()}),Eu=G({taskId:z()}),Du=K({progressToken:Cu.optional(),[mu]:Eu.optional()}),Ou=G({_meta:Du.optional()}),ku=Ou.extend({task:Tu.optional()}),Au=G({method:z(),params:Ou.loose().optional()}),ju=G({_meta:Du.optional()}),Mu=G({method:z(),params:ju.loose().optional()}),Nu=K({get[_u](){return Ju.optional().catch(void 0)}}),Pu=K({_meta:Nu.optional()}),Fu=q([z(),V().int()]),Iu=G({jsonrpc:X(`2.0`),id:Fu,...Au.shape}).strict(),Lu=G({jsonrpc:X(`2.0`),...Mu.shape}).strict(),Ru=G({jsonrpc:X(`2.0`),id:Fu,result:Pu}).strict(),zu=G({jsonrpc:X(`2.0`),id:Fu.optional(),error:G({code:V().int(),message:z(),data:U().optional()})}).strict(),Bu=q([Iu,Lu,Ru,zu]),Vu=q([Ru,zu]),Hu=Pu.strict(),Uu=ju.extend({requestId:Fu.optional(),reason:z().optional()}),Wu=Mu.extend({method:X(`notifications/cancelled`),params:Uu}),Gu=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),Ku=G({icons:W(Gu).optional()}),qu=G({name:z(),title:z().optional()}),Ju=qu.extend({...qu.shape,...Ku.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),Yu=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),Q).optional(),url:Q.optional()}),Q.optional())),Xu=K({list:Q.optional(),cancel:Q.optional(),requests:K({sampling:K({createMessage:Q.optional()}).optional(),elicitation:K({create:Q.optional()}).optional()}).optional()}),Zu=K({list:Q.optional(),cancel:Q.optional(),requests:K({tools:K({call:Q.optional()}).optional()}).optional()}),Qu=G({experimental:J(z(),Q).optional(),sampling:G({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:Yu.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:Xu.optional(),extensions:J(z(),Q).optional()}),$u=Ou.extend({protocolVersion:z(),capabilities:Qu,clientInfo:Ju}),ed=Au.extend({method:X(`initialize`),params:$u}),td=G({experimental:J(z(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:Zu.optional(),extensions:J(z(),Q).optional()}),nd=Pu.extend({protocolVersion:z(),capabilities:td,serverInfo:Ju,instructions:z().optional()}),rd=Mu.extend({method:X(`notifications/initialized`),params:ju.optional()}),id=Au.extend({method:X(`server/discover`),params:Ou.optional()}),ad=Pu.extend({supportedVersions:W(z()),capabilities:td,instructions:z().optional()}),od=Au.extend({method:X(`ping`),params:Ou.optional()}),sd=G({progress:V(),total:Z(V()),message:Z(z())}),cd=G({...ju.shape,...sd.shape,progressToken:Cu}),ld=Mu.extend({method:X(`notifications/progress`),params:cd}),ud=Ou.extend({cursor:wu.optional()}),dd=Au.extend({params:ud.optional()}),fd=Pu.extend({nextCursor:wu.optional()}),pd=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),md=pd.extend({text:z()}),hd=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),gd=pd.extend({blob:hd}),_d=Y([`user`,`assistant`]),vd=G({audience:W(_d).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),yd=G({...qu.shape,...Ku.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:vd.optional(),_meta:Z(K({}))}),bd=G({...qu.shape,...Ku.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:vd.optional(),_meta:Z(K({}))}),xd=dd.extend({method:X(`resources/list`)}),Sd=fd.extend({resources:W(yd)}),Cd=dd.extend({method:X(`resources/templates/list`)}),wd=fd.extend({resourceTemplates:W(bd)}),Td=Ou.extend({uri:z()}),Ed=Td,Dd=Au.extend({method:X(`resources/read`),params:Ed}),Od=Pu.extend({contents:W(q([md,gd]))}),kd=Mu.extend({method:X(`notifications/resources/list_changed`),params:ju.optional()}),Ad=Td,jd=Au.extend({method:X(`resources/subscribe`),params:Ad}),Md=Td,Nd=Au.extend({method:X(`resources/unsubscribe`),params:Md}),Pd=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(z()).optional()}),Fd=Ou.extend({notifications:Pd}),Id=Au.extend({method:X(`subscriptions/listen`),params:Fd}),Ld=ju.extend({notifications:Pd}),Rd=Mu.extend({method:X(`notifications/subscriptions/acknowledged`),params:Ld}),zd=Nu.extend({[yu]:Fu}),Bd=Pu.extend({_meta:zd}),Vd=ju.extend({uri:z()}),Hd=Mu.extend({method:X(`notifications/resources/updated`),params:Vd}),Ud=G({name:z(),description:Z(z()),required:Z(H())}),Wd=G({...qu.shape,...Ku.shape,description:Z(z()),arguments:Z(W(Ud)),_meta:Z(K({}))}),Gd=dd.extend({method:X(`prompts/list`)}),Kd=fd.extend({prompts:W(Wd)}),qd=Ou.extend({name:z(),arguments:J(z(),z()).optional()}),Jd=Au.extend({method:X(`prompts/get`),params:qd}),Yd=G({type:X(`text`),text:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Xd=G({type:X(`image`),data:hd,mimeType:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Zd=G({type:X(`audio`),data:hd,mimeType:z(),annotations:vd.optional(),_meta:J(z(),U()).optional()}),Qd=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),$d=G({type:X(`resource`),resource:q([md,gd]),annotations:vd.optional(),_meta:J(z(),U()).optional()}),ef=yd.extend({type:X(`resource_link`)}),tf=q([Yd,Xd,Zd,ef,$d]),nf=G({role:_d,content:tf}),rf=Pu.extend({description:z().optional(),messages:W(nf)}),af=Mu.extend({method:X(`notifications/prompts/list_changed`),params:ju.optional()}),of=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),sf=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),cf=G({...qu.shape,...Ku.shape,description:z().optional(),inputSchema:G({type:X(`object`),properties:J(z(),xu).optional(),required:W(z()).optional()}).catchall(U()),outputSchema:K({$schema:z().optional()}).optional(),annotations:of.optional(),execution:sf.optional(),_meta:J(z(),U()).optional()}),lf=dd.extend({method:X(`tools/list`)}),uf=fd.extend({tools:W(cf)}),df=Pu.extend({content:W(tf).default([]),structuredContent:U().optional(),isError:H().optional()}),ff=df.or(Pu.extend({toolResult:U()})),pf=ku.extend({name:z(),arguments:J(z(),U()).optional()}),mf=Au.extend({method:X(`tools/call`),params:pf}),hf=Mu.extend({method:X(`notifications/tools/list_changed`),params:ju.optional()}),gf=G({autoRefresh:H().default(!0),debounceMs:V().int().nonnegative().default(300)}),_f=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),vf=Ou.extend({level:_f}),yf=Au.extend({method:X(`logging/setLevel`),params:vf}),bf=ju.extend({level:_f,logger:z().optional(),data:U()}),xf=Mu.extend({method:X(`notifications/message`),params:bf}),Sf=G({name:z().optional()}),Cf=G({hints:W(Sf).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),wf=G({mode:Y([`auto`,`required`,`none`]).optional()}),Tf=G({type:X(`tool_result`),toolUseId:z().describe(`The unique identifier for the corresponding tool call.`),content:W(tf),structuredContent:U().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),Ef=Al(`type`,[Yd,Xd,Zd]),Df=Al(`type`,[Yd,Xd,Zd,Qd,Tf]),Of=G({role:_d,content:q([Df,W(Df)]),_meta:J(z(),U()).optional()}),kf=ku.extend({messages:W(Of),modelPreferences:Cf.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:Q.optional(),tools:W(cf).optional(),toolChoice:wf.optional()}),Af=Au.extend({method:X(`sampling/createMessage`),params:kf}),jf=Pu.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(z())),role:_d,content:Ef}),Mf=Pu.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(z())),role:_d,content:q([Df,W(Df)])}),Nf=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),Pf=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),Ff=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),If=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),Lf=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),Rf=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),zf=q([If,Lf]),Bf=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Vf=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),Hf=q([Bf,Vf]),Uf=q([Rf,zf,Hf]),Wf=q([Uf,Nf,Pf,Ff]),Gf=ku.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Wf),required:W(z()).optional()}).catchall(U())}),Kf=ku.extend({mode:X(`url`),message:z(),elicitationId:z(),url:z().url()}),qf=q([Gf,Kf]),Jf=Au.extend({method:X(`elicitation/create`),params:qf}),Yf=ju.extend({elicitationId:z()}),Xf=Mu.extend({method:X(`notifications/elicitation/complete`),params:Yf}),Zf=Pu.extend({action:Y([`accept`,`decline`,`cancel`]),content:su(e=>e===null?void 0:e,J(z(),q([z(),V(),H(),W(z())])).optional())}),Qf=G({type:X(`ref/resource`),uri:z()}),$f=G({type:X(`ref/prompt`),name:z()}),ep=Ou.extend({ref:q([$f,Qf]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()}),tp=Au.extend({method:X(`completion/complete`),params:ep}),np=Pu.extend({completion:K({values:W(z()).max(100),total:Z(V().int()),hasMore:Z(H())})}),rp=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),ip=Au.extend({method:X(`roots/list`),params:Ou.optional()}),ap=Pu.extend({roots:W(rp)}),op=Mu.extend({method:X(`notifications/roots/list_changed`),params:ju.optional()}),sp=K({ttl:V().optional(),pollInterval:V().optional()}),cp=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),lp=G({taskId:z(),status:cp,ttl:q([V(),bl()]),createdAt:z(),lastUpdatedAt:z(),pollInterval:Z(V()),statusMessage:Z(z())}),up=Pu.extend({task:lp}),dp=ju.merge(lp),fp=Mu.extend({method:X(`notifications/tasks/status`),params:dp}),pp=Au.extend({method:X(`tasks/get`),params:Ou.extend({taskId:z()})}),mp=Pu.merge(lp),hp=Au.extend({method:X(`tasks/result`),params:Ou.extend({taskId:z()})}),gp=Pu.loose(),_p=dd.extend({method:X(`tasks/list`)}),vp=fd.extend({tasks:W(lp)}),yp=Au.extend({method:X(`tasks/cancel`),params:Ou.extend({taskId:z()})}),bp=Pu.merge(lp),xp=q([od,ed,id,tp,yf,Jd,Gd,xd,Cd,Dd,jd,Nd,Id,mf,lf]),Sp=q([Wu,ld,rd,op]),Cp=q([Hu,jf,Mf,Zf,ap]),wp=q([od,Af,Jf,ip]),Tp=q([Wu,ld,xf,Hd,kd,hf,af,Rd,Xf]),Ep=q([Hu,nd,ad,np,rf,Kd,Sd,wd,Od,df,uf,Bd]),Dp=Zc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:cu.custom,message:`URL must be parseable`,fatal:!0}),rn}).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`}),Op=K({resource:z().url(),authorization_servers:W(Dp).optional(),jwks_uri:z().url().optional(),scopes_supported:W(z()).optional(),bearer_methods_supported:W(z()).optional(),resource_signing_alg_values_supported:W(z()).optional(),resource_name:z().optional(),resource_documentation:z().optional(),resource_policy_uri:z().url().optional(),resource_tos_uri:z().url().optional(),tls_client_certificate_bound_access_tokens:H().optional(),authorization_details_types_supported:W(z()).optional(),dpop_signing_alg_values_supported:W(z()).optional(),dpop_bound_access_tokens_required:H().optional()}),kp=K({issuer:z(),authorization_endpoint:Dp,token_endpoint:Dp,registration_endpoint:Dp.optional(),scopes_supported:W(z()).optional(),response_types_supported:W(z()),response_modes_supported:W(z()).optional(),grant_types_supported:W(z()).optional(),token_endpoint_auth_methods_supported:W(z()).optional(),token_endpoint_auth_signing_alg_values_supported:W(z()).optional(),service_documentation:Dp.optional(),revocation_endpoint:Dp.optional(),revocation_endpoint_auth_methods_supported:W(z()).optional(),revocation_endpoint_auth_signing_alg_values_supported:W(z()).optional(),introspection_endpoint:z().optional(),introspection_endpoint_auth_methods_supported:W(z()).optional(),introspection_endpoint_auth_signing_alg_values_supported:W(z()).optional(),code_challenge_methods_supported:W(z()).optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0),dpop_signing_alg_values_supported:W(z()).optional()}),Ap=K({issuer:z(),authorization_endpoint:Dp,token_endpoint:Dp,userinfo_endpoint:Dp.optional(),jwks_uri:Dp,registration_endpoint:Dp.optional(),scopes_supported:W(z()).optional(),response_types_supported:W(z()),response_modes_supported:W(z()).optional(),grant_types_supported:W(z()).optional(),acr_values_supported:W(z()).optional(),subject_types_supported:W(z()),id_token_signing_alg_values_supported:W(z()),id_token_encryption_alg_values_supported:W(z()).optional(),id_token_encryption_enc_values_supported:W(z()).optional(),userinfo_signing_alg_values_supported:W(z()).optional(),userinfo_encryption_alg_values_supported:W(z()).optional(),userinfo_encryption_enc_values_supported:W(z()).optional(),request_object_signing_alg_values_supported:W(z()).optional(),request_object_encryption_alg_values_supported:W(z()).optional(),request_object_encryption_enc_values_supported:W(z()).optional(),token_endpoint_auth_methods_supported:W(z()).optional(),token_endpoint_auth_signing_alg_values_supported:W(z()).optional(),display_values_supported:W(z()).optional(),claim_types_supported:W(z()).optional(),claims_supported:W(z()).optional(),service_documentation:z().optional(),claims_locales_supported:W(z()).optional(),ui_locales_supported:W(z()).optional(),claims_parameter_supported:H().optional(),request_parameter_supported:H().optional(),request_uri_parameter_supported:H().optional(),require_request_uri_registration:H().optional(),op_policy_uri:Dp.optional(),op_tos_uri:Dp.optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),jp=G({...Ap.shape,...kp.pick({code_challenge_methods_supported:!0}).shape}),Mp=G({access_token:z(),id_token:z().optional(),token_type:z(),expires_in:fu().optional(),scope:z().optional(),refresh_token:z().optional(),issuer:z().optional().catch(void 0)}).strip(),Np=G({issued_token_type:X(`urn:ietf:params:oauth:token-type:id-jag`),access_token:z(),token_type:z().optional(),expires_in:V().optional(),scope:z().optional()}).strip(),Pp=G({error:z(),error_description:z().optional(),error_uri:z().optional()}),Fp=Dp.optional().or(X(``).transform(()=>void 0)),Ip=G({redirect_uris:W(Dp),token_endpoint_auth_method:z().optional(),grant_types:W(z()).optional(),response_types:W(z()).optional(),application_type:z().optional(),client_name:z().optional(),client_uri:Dp.optional(),logo_uri:Fp,scope:z().optional(),contacts:W(z()).optional(),tos_uri:Fp,policy_uri:z().optional(),jwks_uri:Dp.optional(),jwks:Sl().optional(),software_id:z().optional(),software_version:z().optional(),software_statement:z().optional()}).strip(),Lp=G({client_id:z(),client_secret:z().optional(),client_id_issued_at:V().optional(),client_secret_expires_at:V().optional(),issuer:z().optional().catch(void 0)}).strip(),Rp=Ip.merge(Lp),zp=G({error:z(),error_description:z().optional()}).strip(),Bp=G({token:z(),token_type_hint:z().optional()}).strip(),Vp=Symbol.for(`mcp.sdk.errorBrands`);function Hp(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,Vp,{value:n,enumerable:!1,configurable:!0})}function Up(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Vp)){let n=t[Vp];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Hp(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)}});var Wp=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}({}),Gp=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Hp(this,new.target)}};(class extends Gp{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Kp=`2026-07-28`;function qp(e){return e>=Kp}function Jp(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 Yp=[`task`,`inputRequests`,`requestState`];function Xp(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Yp.some(t=>t in e)?e:{...e,content:[]}}function Zp(){let e=ru(()=>q([z(),V(),H(),bl(),J(z(),e),W(e)])),t=J(z(),e),n=q([z(),V().int()]),r=z(),i=G({ttl:V().optional()}),a=G({taskId:z()}),o=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=G({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=G({method:z(),params:s.loose().optional()}),u=G({_meta:o.optional()}),d=G({method:z(),params:u.loose().optional()}),f=K({_meta:o.optional()}),p=q([z(),V().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:z().optional()}),g=d.extend({method:X(`notifications/cancelled`),params:h}),_=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),v=G({icons:W(_).optional()}),ee=G({name:z(),title:z().optional()}),y=ee.extend({...ee.shape,...v.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),b=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),te=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),ne=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),x=G({experimental:J(z(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:te.optional(),extensions:J(z(),t).optional()}),re=s.extend({protocolVersion:z(),capabilities:x,clientInfo:y}),ie=l.extend({method:X(`initialize`),params:re}),ae=G({experimental:J(z(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:ne.optional(),extensions:J(z(),t).optional()}),oe=f.extend({protocolVersion:z(),capabilities:ae,serverInfo:y,instructions:z().optional()}),se=d.extend({method:X(`notifications/initialized`),params:u.optional()}),S=l.extend({method:X(`ping`),params:s.optional()}),ce=G({progress:V(),total:Z(V()),message:Z(z())}),C=G({...u.shape,...ce.shape,progressToken:n}),le=d.extend({method:X(`notifications/progress`),params:C}),ue=s.extend({cursor:r.optional()}),de=l.extend({params:ue.optional()}),fe=f.extend({nextCursor:r.optional()}),w=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),pe=w.extend({text:z()}),me=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),he=w.extend({blob:me}),ge=Y([`user`,`assistant`]),_e=G({audience:W(ge).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),ve=G({...ee.shape,...v.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:_e.optional(),_meta:Z(K({}))}),T=G({...ee.shape,...v.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:_e.optional(),_meta:Z(K({}))}),ye=de.extend({method:X(`resources/list`)}),be=fe.extend({resources:W(ve)}),E=de.extend({method:X(`resources/templates/list`)}),xe=fe.extend({resourceTemplates:W(T)}),Se=s.extend({uri:z()}),Ce=Se,we=l.extend({method:X(`resources/read`),params:Ce}),Te=f.extend({contents:W(q([pe,he]))}),Ee=d.extend({method:X(`notifications/resources/list_changed`),params:u.optional()}),D=Se,O=l.extend({method:X(`resources/subscribe`),params:D}),De=Se,Oe=l.extend({method:X(`resources/unsubscribe`),params:De}),k=u.extend({uri:z()}),ke=d.extend({method:X(`notifications/resources/updated`),params:k}),Ae=G({name:z(),description:Z(z()),required:Z(H())}),je=G({...ee.shape,...v.shape,description:Z(z()),arguments:Z(W(Ae)),_meta:Z(K({}))}),Me=de.extend({method:X(`prompts/list`)}),Ne=fe.extend({prompts:W(je)}),Pe=s.extend({name:z(),arguments:J(z(),z()).optional()}),Fe=l.extend({method:X(`prompts/get`),params:Pe}),Ie=G({type:X(`text`),text:z(),annotations:_e.optional(),_meta:J(z(),U()).optional()}),Le=G({type:X(`image`),data:me,mimeType:z(),annotations:_e.optional(),_meta:J(z(),U()).optional()}),Re=G({type:X(`audio`),data:me,mimeType:z(),annotations:_e.optional(),_meta:J(z(),U()).optional()}),ze=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),Be=G({type:X(`resource`),resource:q([pe,he]),annotations:_e.optional(),_meta:J(z(),U()).optional()}),A=ve.extend({type:X(`resource_link`)}),Ve=q([Ie,Le,Re,A,Be]),He=G({role:ge,content:Ve}),Ue=f.extend({description:z().optional(),messages:W(He)}),We=d.extend({method:X(`notifications/prompts/list_changed`),params:u.optional()}),Ge=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Ke=G({taskSupport:Y([`required`,`optional`,`forbidden`]).optional()}),qe=G({...ee.shape,...v.shape,description:z().optional(),inputSchema:G({type:X(`object`),properties:J(z(),e).optional(),required:W(z()).optional()}).catchall(U()),outputSchema:G({type:X(`object`),properties:J(z(),e).optional(),required:W(z()).optional()}).catchall(U()).optional(),annotations:Ge.optional(),execution:Ke.optional(),_meta:J(z(),U()).optional()}),Je=de.extend({method:X(`tools/list`)}),Ye=fe.extend({tools:W(qe)}),Xe=f.extend({content:W(Ve),structuredContent:J(z(),U()).optional(),isError:H().optional()}),Ze=c.extend({name:z(),arguments:J(z(),U()).optional()}),Qe=l.extend({method:X(`tools/call`),params:Ze}),$e=d.extend({method:X(`notifications/tools/list_changed`),params:u.optional()}),et=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),tt=s.extend({level:et}),nt=l.extend({method:X(`logging/setLevel`),params:tt}),rt=u.extend({level:et,logger:z().optional(),data:U()}),it=d.extend({method:X(`notifications/message`),params:rt}),at=G({name:z().optional()}),ot=G({hints:W(at).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),st=G({mode:Y([`auto`,`required`,`none`]).optional()}),ct=G({type:X(`tool_result`),toolUseId:z().describe(`The unique identifier for the corresponding tool call.`),content:W(Ve),structuredContent:G({}).loose().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),lt=Al(`type`,[Ie,Le,Re]),ut=Al(`type`,[Ie,Le,Re,ze,ct]),dt=G({role:ge,content:q([ut,W(ut)]),_meta:J(z(),U()).optional()}),ft=c.extend({messages:W(dt),modelPreferences:ot.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:t.optional(),tools:W(qe).optional(),toolChoice:st.optional()}),pt=l.extend({method:X(`sampling/createMessage`),params:ft}),mt=f.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`]).or(z())),role:ge,content:lt}),ht=f.extend({model:z(),stopReason:Z(Y([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(z())),role:ge,content:q([ut,W(ut)])}),gt=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),_t=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),vt=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),yt=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),j=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),bt=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),xt=q([yt,j]),St=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Ct=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),wt=q([St,Ct]),Tt=q([bt,xt,wt]),Et=q([Tt,gt,_t,vt]),Dt=c.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Et),required:W(z()).optional()}).catchall(U())}),Ot=c.extend({mode:X(`url`),message:z(),elicitationId:z(),url:z().url()}),kt=q([Dt,Ot]),At=l.extend({method:X(`elicitation/create`),params:kt}),jt=u.extend({elicitationId:z()}),Mt=d.extend({method:X(`notifications/elicitation/complete`),params:jt}),Nt=f.extend({action:Y([`accept`,`decline`,`cancel`]),content:su(e=>e===null?void 0:e,J(z(),q([z(),V(),H(),W(z())])).optional())}),Pt=G({type:X(`ref/resource`),uri:z()}),Ft=G({type:X(`ref/prompt`),name:z()}),It=s.extend({ref:q([Ft,Pt]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()}),Lt=l.extend({method:X(`completion/complete`),params:It}),Rt=f.extend({completion:K({values:W(z()).max(100),total:Z(V().int()),hasMore:Z(H())})}),zt=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),Bt=l.extend({method:X(`roots/list`),params:s.optional()}),Vt=f.extend({roots:W(zt)}),Ht=d.extend({method:X(`notifications/roots/list_changed`),params:u.optional()}),Ut=K({ttl:V().optional(),pollInterval:V().optional()}),Wt=Y([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Gt=G({taskId:z(),status:Wt,ttl:q([V(),bl()]),createdAt:z(),lastUpdatedAt:z(),pollInterval:Z(V()),statusMessage:Z(z())}),M=f.extend({task:Gt}),Kt=u.merge(Gt),qt=d.extend({method:X(`notifications/tasks/status`),params:Kt}),Jt=l.extend({method:X(`tasks/get`),params:s.extend({taskId:z()})}),Yt=f.merge(Gt),Xt=l.extend({method:X(`tasks/result`),params:s.extend({taskId:z()})}),Zt=f.loose(),Qt=de.extend({method:X(`tasks/list`)}),N=fe.extend({tasks:W(Gt)}),$t=l.extend({method:X(`tasks/cancel`),params:s.extend({taskId:z()})});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:ee,ImplementationSchema:y,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:re,InitializeRequestSchema:ie,ServerCapabilitiesSchema:ae,InitializeResultSchema:oe,InitializedNotificationSchema:se,PingRequestSchema:S,ProgressSchema:ce,ProgressNotificationParamsSchema:C,ProgressNotificationSchema:le,PaginatedRequestParamsSchema:ue,PaginatedRequestSchema:de,PaginatedResultSchema:fe,ResourceContentsSchema:w,TextResourceContentsSchema:pe,BlobResourceContentsSchema:he,RoleSchema:ge,AnnotationsSchema:_e,ResourceSchema:ve,ResourceTemplateSchema:T,ListResourcesRequestSchema:ye,ListResourcesResultSchema:be,ListResourceTemplatesRequestSchema:E,ListResourceTemplatesResultSchema:xe,ResourceRequestParamsSchema:Se,ReadResourceRequestParamsSchema:Ce,ReadResourceRequestSchema:we,ReadResourceResultSchema:Te,ResourceListChangedNotificationSchema:Ee,SubscribeRequestParamsSchema:D,SubscribeRequestSchema:O,UnsubscribeRequestParamsSchema:De,UnsubscribeRequestSchema:Oe,ResourceUpdatedNotificationParamsSchema:k,ResourceUpdatedNotificationSchema:ke,PromptArgumentSchema:Ae,PromptSchema:je,ListPromptsRequestSchema:Me,ListPromptsResultSchema:Ne,GetPromptRequestParamsSchema:Pe,GetPromptRequestSchema:Fe,TextContentSchema:Ie,ImageContentSchema:Le,AudioContentSchema:Re,ToolUseContentSchema:ze,EmbeddedResourceSchema:Be,ResourceLinkSchema:A,ContentBlockSchema:Ve,PromptMessageSchema:He,GetPromptResultSchema:Ue,PromptListChangedNotificationSchema:We,ToolAnnotationsSchema:Ge,ToolExecutionSchema:Ke,ToolSchema:qe,ListToolsRequestSchema:Je,ListToolsResultSchema:Ye,CallToolResultSchema:Xe,CallToolRequestParamsSchema:Ze,CallToolRequestSchema:Qe,ToolListChangedNotificationSchema:$e,LoggingLevelSchema:et,SetLevelRequestParamsSchema:tt,SetLevelRequestSchema:nt,LoggingMessageNotificationParamsSchema:rt,LoggingMessageNotificationSchema:it,ModelHintSchema:at,ModelPreferencesSchema:ot,ToolChoiceSchema:st,ToolResultContentSchema:ct,SamplingContentSchema:lt,SamplingMessageContentBlockSchema:ut,SamplingMessageSchema:dt,CreateMessageRequestParamsSchema:ft,CreateMessageRequestSchema:pt,CreateMessageResultSchema:mt,CreateMessageResultWithToolsSchema:ht,BooleanSchemaSchema:gt,StringSchemaSchema:_t,NumberSchemaSchema:vt,UntitledSingleSelectEnumSchemaSchema:yt,TitledSingleSelectEnumSchemaSchema:j,LegacyTitledEnumSchemaSchema:bt,SingleSelectEnumSchemaSchema:xt,UntitledMultiSelectEnumSchemaSchema:St,TitledMultiSelectEnumSchemaSchema:Ct,MultiSelectEnumSchemaSchema:wt,EnumSchemaSchema:Tt,PrimitiveSchemaDefinitionSchema:Et,ElicitRequestFormParamsSchema:Dt,ElicitRequestURLParamsSchema:Ot,ElicitRequestParamsSchema:kt,ElicitRequestSchema:At,ElicitationCompleteNotificationParamsSchema:jt,ElicitationCompleteNotificationSchema:Mt,ElicitResultSchema:Nt,ResourceTemplateReferenceSchema:Pt,PromptReferenceSchema:Ft,CompleteRequestParamsSchema:It,CompleteRequestSchema:Lt,CompleteResultSchema:Rt,RootSchema:zt,ListRootsRequestSchema:Bt,ListRootsResultSchema:Vt,RootsListChangedNotificationSchema:Ht,TaskCreationParamsSchema:Ut,TaskStatusSchema:Wt,TaskSchema:Gt,CreateTaskResultSchema:M,TaskStatusNotificationParamsSchema:Kt,TaskStatusNotificationSchema:qt,GetTaskRequestSchema:Jt,GetTaskResultSchema:Yt,GetTaskPayloadRequestSchema:Xt,GetTaskPayloadResultSchema:Zt,ListTasksRequestSchema:Qt,ListTasksResultSchema:N,CancelTaskRequestSchema:$t,CancelTaskResultSchema:f.merge(Gt),ClientRequestSchema:q([S,ie,Lt,nt,Fe,Me,ye,E,we,O,Oe,Qe,Je,Jt,Xt,Qt,$t]),ClientNotificationSchema:q([g,le,se,Ht,qt]),ClientResultSchema:q([m,mt,ht,Nt,Vt,Yt,N,M]),ServerRequestSchema:q([S,pt,At,Bt,Jt,Xt,Qt,$t]),ServerNotificationSchema:q([g,le,it,ke,Ee,$e,We,qt,Mt]),ServerResultSchema:q([m,oe,Rt,Ue,Ne,be,xe,Te,Xe,Ye,Yt,N,M]),CallToolResultWireSchema:U().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Yp)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(Xp).pipe(Xe)}}var Qp;function $p(){return Qp??=Zp()}function em(e){return e.type!==`object`}var tm=new Set([`const`,`enum`,`default`,`examples`]),nm=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function rm(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function im(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(rm(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ge(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&rm(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=tm.has(o)?s:nm.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var am={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},om={"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},sm={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},cm;function lm(){if(cm)return cm;let e=$p();return cm={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}},cm}function um(e){return Object.prototype.hasOwnProperty.call(am,e)}function dm(e){return Object.prototype.hasOwnProperty.call(om,e)}function fm(e){return Object.prototype.hasOwnProperty.call(sm,e)}function pm(e){return fm(e)?lm().resultSchemas[e]:void 0}function mm(e){return um(e)?lm().requestSchemas[e]:void 0}function hm(e){return dm(e)?lm().notificationSchemas[e]:void 0}Object.keys(am),Object.keys(om);function gm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _m(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 vm={ok:!1,reason:`not-in-era`};function ym(e){return gm(e)&&gm(e.outputSchema)&&em(e.outputSchema)}function bm(e){return e}var xm={era:`2025-11-25`,hasRequestMethod:um,hasNotificationMethod:dm,validateRequest:(e,t)=>_m(mm(e),t),validateResult:(e,t)=>_m(pm(e),t),validateNotification:(e,t)=>_m(hm(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>vm,validateInputResponse:()=>vm,samplingResultVariant:((e,t)=>{let n=$p();return _m(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Jp(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&em(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(gm(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:bm(e)}}return{kind:`complete`,result:bm(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>ym(e))?t:{...t,tools:n.map(e=>ym(e)?{...e,outputSchema:im(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function Sm(){let e=ru(()=>q([z(),V(),H(),bl(),J(z(),e),W(e)])),t=J(z(),e),n=q([z(),V().int()]),r=z(),i=q([z(),V().int()]),a=Y([`user`,`assistant`]),o=Y([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=G({ttl:V().optional()}),l=G({taskId:z()}),u=K({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=G({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=G({_meta:u.optional()}),m=G({method:z(),params:p.loose().optional()}),h=G({src:z(),mimeType:z().optional(),sizes:W(z()).optional(),theme:Y([`light`,`dark`]).optional()}),g=G({icons:W(h).optional()}),_=G({name:z(),title:z().optional()}),v=_.extend({..._.shape,...g.shape,version:z(),websiteUrl:z().optional(),description:z().optional()}),ee=su(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ml(G({form:Ml(G({applyDefaults:H().optional()}),t).optional(),url:t.optional()}),t.optional())),y=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),b=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),te=G({experimental:J(z(),t).optional(),sampling:G({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:G({listChanged:H().optional()}).optional(),tasks:y.optional(),extensions:J(z(),t).optional()}),ne=G({experimental:J(z(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:G({listChanged:H().optional()}).optional(),resources:G({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:G({listChanged:H().optional()}).optional(),tasks:b.optional(),extensions:J(z(),t).optional()}),x=G({progress:V(),total:Z(V()),message:Z(z())}),re=G({...p.shape,...x.shape,progressToken:n}),ie=m.extend({method:X(`notifications/progress`),params:re}),ae=p.extend({level:o,logger:z().optional(),data:U()}),oe=m.extend({method:X(`notifications/message`),params:ae}),se=G({uri:z(),mimeType:Z(z()),_meta:J(z(),U()).optional()}),S=se.extend({text:z()}),ce=se.extend({blob:s}),C=G({audience:W(a).optional(),priority:V().min(0).max(1).optional(),lastModified:uu({offset:!0}).optional()}),le=G({..._.shape,...g.shape,uri:z(),description:Z(z()),mimeType:Z(z()),size:Z(V()),annotations:C.optional(),_meta:Z(K({}))}),ue=G({..._.shape,...g.shape,uriTemplate:z(),description:Z(z()),mimeType:Z(z()),annotations:C.optional(),_meta:Z(K({}))}),de=m.extend({method:X(`notifications/resources/list_changed`),params:p.optional()}),fe=p.extend({uri:z()}),w=m.extend({method:X(`notifications/resources/updated`),params:fe}),pe=G({name:z(),description:Z(z()),required:Z(H())}),me=G({..._.shape,...g.shape,description:Z(z()),arguments:Z(W(pe)),_meta:Z(K({}))}),he=m.extend({method:X(`notifications/prompts/list_changed`),params:p.optional()}),ge=G({type:X(`text`),text:z(),annotations:C.optional(),_meta:J(z(),U()).optional()}),_e=G({type:X(`image`),data:s,mimeType:z(),annotations:C.optional(),_meta:J(z(),U()).optional()}),ve=G({type:X(`audio`),data:s,mimeType:z(),annotations:C.optional(),_meta:J(z(),U()).optional()}),T=G({type:X(`tool_use`),name:z(),id:z(),input:J(z(),U()),_meta:J(z(),U()).optional()}),ye=G({type:X(`resource`),resource:q([S,ce]),annotations:C.optional(),_meta:J(z(),U()).optional()}),be=le.extend({type:X(`resource_link`)}),E=q([ge,_e,ve,be,ye]),xe=G({role:a,content:E}),Se=G({title:z().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Ce=m.extend({method:X(`notifications/tools/list_changed`),params:p.optional()}),we=G({name:z().optional()}),Te=G({hints:W(we).optional(),costPriority:V().min(0).max(1).optional(),speedPriority:V().min(0).max(1).optional(),intelligencePriority:V().min(0).max(1).optional()}),Ee=G({mode:Y([`auto`,`required`,`none`]).optional()}),D=G({type:X(`boolean`),title:z().optional(),description:z().optional(),default:H().optional()}),O=G({type:X(`string`),title:z().optional(),description:z().optional(),minLength:V().optional(),maxLength:V().optional(),format:Y([`email`,`uri`,`date`,`date-time`]).optional(),default:z().optional()}),De=G({type:Y([`number`,`integer`]),title:z().optional(),description:z().optional(),minimum:V().optional(),maximum:V().optional(),default:V().optional()}),Oe=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),default:z().optional()}),k=G({type:X(`string`),title:z().optional(),description:z().optional(),oneOf:W(G({const:z(),title:z()})),default:z().optional()}),ke=G({type:X(`string`),title:z().optional(),description:z().optional(),enum:W(z()),enumNames:W(z()).optional(),default:z().optional()}),Ae=q([Oe,k]),je=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({type:X(`string`),enum:W(z())}),default:W(z()).optional()}),Me=G({type:X(`array`),title:z().optional(),description:z().optional(),minItems:V().optional(),maxItems:V().optional(),items:G({anyOf:W(G({const:z(),title:z()}))}),default:W(z()).optional()}),Ne=q([je,Me]),Pe=q([ke,Ae,Ne]),Fe=q([Pe,D,O,De]),Ie=f.extend({mode:X(`form`).optional(),message:z(),requestedSchema:G({type:X(`object`),properties:J(z(),Fe),required:W(z()).optional()}).catchall(U())}),Le=G({type:X(`ref/resource`),uri:z()}),Re=G({type:X(`ref/prompt`),name:z()}),ze=G({uri:z().startsWith(`file://`),name:z().optional(),_meta:J(z(),U()).optional()}),Be=te.shape,A=G({experimental:Be.experimental,sampling:Be.sampling,elicitation:Be.elicitation,roots:Be.roots,extensions:Be.extensions}),Ve=ne.shape,He=G({experimental:Ve.experimental,logging:Ve.logging,completions:Ve.completions,prompts:Ve.prompts,resources:Ve.resources,tools:Ve.tools,extensions:Ve.extensions}),Ue=K({progressToken:n.optional(),[hu]:z(),[gu]:v.optional(),[vu]:A,[bu]:o.optional()}),We=G({..._.shape,...g.shape,description:z().optional(),inputSchema:K({$schema:z().optional(),type:X(`object`)}),outputSchema:K({$schema:z().optional()}).optional(),annotations:Se.optional(),_meta:J(z(),U()).optional()}),Ge=G({type:X(`tool_result`),toolUseId:z(),content:W(E),structuredContent:U().optional(),isError:H().optional(),_meta:J(z(),U()).optional()}),Ke=q([ge,_e,ve,T,Ge]),qe=G({role:a,content:q([Ke,W(Ke)]),_meta:J(z(),U()).optional()}),Je=z(),Ye=K({[_u]:v.optional().catch(void 0)}),Xe=Ye.optional();function Ze(e){return K({_meta:Xe,resultType:Je.default(`complete`),...e})}let Qe=Ze({}),$e=Ze({nextCursor:r.optional()}),et=Ze({content:W(E),structuredContent:U().optional(),isError:H().optional()}),tt=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(We),nextCursor:r.optional()}),nt=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(me),nextCursor:r.optional()}),rt=Ze({description:z().optional(),messages:W(xe)}),it=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(le),nextCursor:r.optional()}),at=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(ue),nextCursor:r.optional()}),ot=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([S,ce]))}),st=Ze({completion:G({values:W(z()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),ct=Ze({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`])}),lt=Ze({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(z()),capabilities:He,instructions:z().optional()}),ut=G({messages:W(qe),modelPreferences:Te.optional(),systemPrompt:z().optional(),includeContext:Y([`none`,`thisServer`,`allServers`]).optional(),temperature:V().optional(),maxTokens:V().int(),stopSequences:W(z()).optional(),metadata:t.optional(),tools:W(We).optional(),toolChoice:Ee.optional()}),dt=G({method:X(`sampling/createMessage`),params:ut}),ft=G({method:X(`roots/list`),params:G({_meta:J(z(),U()).optional()}).optional()}),pt=G({...qe.shape,model:z(),stopReason:z().optional()}),mt=G({roots:W(ze)}),ht=G({action:Y([`accept`,`decline`,`cancel`]),content:J(z(),q([z(),V(),H(),W(z())])).optional()}),gt=G({mode:X(`url`),message:z(),url:z().url()}),_t=q([Ie,gt]),vt=G({method:X(`elicitation/create`),params:_t}),yt=q([dt,ft,vt]),j=q([pt,mt,ht]),bt=J(z(),yt),xt=J(z(),j),St=Ze({inputRequests:bt.optional(),requestState:z().optional()}),Ct={inputResponses:xt.optional(),requestState:z().optional()},wt=G({_meta:Ue,...Ct}),Tt=K({progressToken:n.optional()});function Et(e,t){return G({method:X(e),params:G({_meta:Ue,...t})})}function Dt(e,t){return G({method:X(e),params:G({_meta:Tt.optional(),...t}).optional()})}let Ot={name:z(),arguments:J(z(),U()).optional(),...Ct},kt={cursor:r.optional()},At=Et(`tools/call`,Ot),jt=Et(`tools/list`,kt),Mt=Et(`prompts/list`,kt),Nt=Et(`prompts/get`,{name:z(),arguments:J(z(),z()).optional(),...Ct}),Pt=Et(`resources/list`,kt),Ft=Et(`resources/templates/list`,kt),It=Et(`resources/read`,{uri:z(),...Ct}),Lt={ref:q([Re,Le]),argument:G({name:z(),value:z()}),context:G({arguments:J(z(),z()).optional()}).optional()},Rt=Et(`completion/complete`,Lt),zt=Et(`server/discover`,{}),Bt=G({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:W(z()).optional()}),Vt={notifications:Bt},Ht=Et(`subscriptions/listen`,Vt),Ut=Ye.extend({"io.modelcontextprotocol/subscriptionId":i}),Wt=K({_meta:Ut,resultType:Je.default(`complete`)}),Gt={"tools/call":Dt(`tools/call`,Ot),"tools/list":Dt(`tools/list`,kt),"prompts/get":Dt(`prompts/get`,{name:z(),arguments:J(z(),z()).optional()}),"prompts/list":Dt(`prompts/list`,kt),"resources/list":Dt(`resources/list`,kt),"resources/templates/list":Dt(`resources/templates/list`,kt),"resources/read":Dt(`resources/read`,{uri:z()}),"completion/complete":Dt(`completion/complete`,Lt),"server/discover":Dt(`server/discover`,{}),"subscriptions/listen":Dt(`subscriptions/listen`,Vt)};function M(e){return K({_meta:Xe,...e})}let Kt={"tools/call":M({content:W(E),structuredContent:U().optional(),isError:H().optional()}),"tools/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),tools:W(We),nextCursor:r.optional()}),"prompts/get":M({description:z().optional(),messages:W(xe)}),"prompts/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),prompts:W(me),nextCursor:r.optional()}),"resources/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resources:W(le),nextCursor:r.optional()}),"resources/templates/list":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),resourceTemplates:W(ue),nextCursor:r.optional()}),"resources/read":M({ttlMs:V().int().min(0),cacheScope:Y([`public`,`private`]),contents:W(q([S,ce]))}),"completion/complete":M({completion:G({values:W(z()).max(100),total:V().int().optional(),hasMore:H().optional()}).loose()}),"server/discover":M({ttlMs:V().int().min(0).catch(0),cacheScope:Y([`public`,`private`]).catch(`private`),supportedVersions:W(z()),capabilities:He,instructions:z().optional()}),"subscriptions/listen":M({})},qt=K({"io.modelcontextprotocol/subscriptionId":i.optional()}),Jt=G({method:X(`notifications/subscriptions/acknowledged`),params:G({_meta:qt.optional(),notifications:Bt})}),Yt=G({_meta:qt.optional(),requestId:i,reason:z().optional()}),Xt=G({method:X(`notifications/cancelled`),params:Yt}),Zt={"notifications/cancelled":Xt,"notifications/progress":ie,"notifications/message":oe,"notifications/resources/updated":w,"notifications/resources/list_changed":de,"notifications/tools/list_changed":Ce,"notifications/prompts/list_changed":he,"notifications/subscriptions/acknowledged":Jt},Qt=e=>G({jsonrpc:X(`2.0`),id:q([z(),V().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:y,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:te,ServerCapabilitiesSchema:ne,ProgressSchema:x,ProgressNotificationParamsSchema:re,ProgressNotificationSchema:ie,LoggingMessageNotificationParamsSchema:ae,LoggingMessageNotificationSchema:oe,ResourceContentsSchema:se,TextResourceContentsSchema:S,BlobResourceContentsSchema:ce,AnnotationsSchema:C,ResourceSchema:le,ResourceTemplateSchema:ue,ResourceListChangedNotificationSchema:de,ResourceUpdatedNotificationParamsSchema:fe,ResourceUpdatedNotificationSchema:w,PromptArgumentSchema:pe,PromptSchema:me,PromptListChangedNotificationSchema:he,TextContentSchema:ge,ImageContentSchema:_e,AudioContentSchema:ve,ToolUseContentSchema:T,EmbeddedResourceSchema:ye,ResourceLinkSchema:be,ContentBlockSchema:E,PromptMessageSchema:xe,ToolAnnotationsSchema:Se,ToolListChangedNotificationSchema:Ce,ModelHintSchema:we,ModelPreferencesSchema:Te,ToolChoiceSchema:Ee,BooleanSchemaSchema:D,StringSchemaSchema:O,NumberSchemaSchema:De,UntitledSingleSelectEnumSchemaSchema:Oe,TitledSingleSelectEnumSchemaSchema:k,LegacyTitledEnumSchemaSchema:ke,SingleSelectEnumSchemaSchema:Ae,UntitledMultiSelectEnumSchemaSchema:je,TitledMultiSelectEnumSchemaSchema:Me,MultiSelectEnumSchemaSchema:Ne,EnumSchemaSchema:Pe,PrimitiveSchemaDefinitionSchema:Fe,ElicitRequestFormParamsSchema:Ie,ResourceTemplateReferenceSchema:Le,PromptReferenceSchema:Re,RootSchema:ze,ClientCapabilities2026Schema:A,ServerCapabilities2026Schema:He,RequestMetaEnvelopeSchema:Ue,ToolSchema:We,ToolResultContentSchema:Ge,SamplingMessageContentBlockSchema:Ke,SamplingMessageSchema:qe,ResultTypeSchema:Je,ResultMetaSchema:Ye,ResultSchema:Qe,PaginatedResultSchema:$e,CallToolResultSchema:et,ListToolsResultSchema:tt,ListPromptsResultSchema:nt,GetPromptResultSchema:rt,ListResourcesResultSchema:it,ListResourceTemplatesResultSchema:at,ReadResourceResultSchema:ot,CompleteResultSchema:st,CacheableResultSchema:ct,DiscoverResultSchema:lt,CreateMessageRequestParamsSchema:ut,CreateMessageRequestSchema:dt,ListRootsRequestSchema:ft,CreateMessageResultSchema:pt,ListRootsResultSchema:mt,ElicitResultSchema:ht,ElicitRequestURLParamsSchema:gt,ElicitRequestParamsSchema:_t,ElicitRequestSchema:vt,InputRequestSchema:yt,InputResponseSchema:j,InputRequestsSchema:bt,InputResponsesSchema:xt,InputRequiredResultSchema:St,InputResponseRequestParamsSchema:wt,CallToolRequestSchema:At,ListToolsRequestSchema:jt,ListPromptsRequestSchema:Mt,GetPromptRequestSchema:Nt,ListResourcesRequestSchema:Pt,ListResourceTemplatesRequestSchema:Ft,ReadResourceRequestSchema:It,CompleteRequestSchema:Rt,DiscoverRequestSchema:zt,SubscriptionFilterSchema:Bt,SubscriptionsListenRequestSchema:Ht,SubscriptionsListenResultMetaSchema:Ut,SubscriptionsListenResultSchema:Wt,dispatchRequestSchemas:Gt,dispatchResultSchemas:Kt,NotificationMetaSchema:qt,SubscriptionsAcknowledgedNotificationSchema:Jt,CancelledNotificationParamsSchema:Yt,CancelledNotificationSchema:Xt,notificationSchemas2026:Zt,JSONRPCResultResponseSchema:Qt(Qe),CallToolResultResponseSchema:Qt(q([et,St])),ListToolsResultResponseSchema:Qt(tt),ListPromptsResultResponseSchema:Qt(nt),GetPromptResultResponseSchema:Qt(q([rt,St])),ListResourcesResultResponseSchema:Qt(it),ListResourceTemplatesResultResponseSchema:Qt(at),ReadResourceResultResponseSchema:Qt(q([ot,St])),CompleteResultResponseSchema:Qt(st),DiscoverResultResponseSchema:Qt(lt),SubscriptionsListenResultResponseSchema:Qt(Wt)}}var Cm;function wm(){return Cm??=Sm()}var Tm=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Em(e){return Tm.includes(e)}var Dm=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Om(e){return e[Dm]}function km(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Am(e){return e===`public`||e===`private`}var $=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}({}),jm=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Hp(this,new.target)}static fromError(t,n,r){if(t===$.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Nm(e.elicitations,n)}if(t===$.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Pm({supported:e.supported,requested:e.requested},n)}if(t===$.InvalidParams||t===$.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===$.ResourceNotFound||Object.keys(e).length===1))return new Mm(e.uri,n)}if(t===$.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Fm({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Mm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super($.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Nm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super($.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Pm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super($.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Fm=class extends jm{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super($.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Im=0,Lm=`private`,Rm=[`tools/call`,`prompts/get`,`resources/read`];function zm(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Rm.includes(e))return t;throw new jm($.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Bm(e,t){let n=Om(t);if(t.resultType!==`complete`||!Em(e))return n===void 0?t:Gm(t);let r=t,i=km(r.ttlMs)?r.ttlMs:Um(n),a=Am(r.cacheScope)?r.cacheScope:Wm(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Dm],o}function Vm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hm(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[_u]:t}}:!Vm(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[_u]:t}}}function Um(e){return e!==void 0&&km(e.ttlMs)?e.ttlMs:Im}function Wm(e){return e!==void 0&&Am(e.cacheScope)?e.cacheScope:Lm}function Gm(e){let t={...e};return delete t[Dm],t}var Km=[`elicitation/create`,`sampling/createMessage`,`roots/list`],qm;function Jm(){if(qm)return qm;let e=wm();return qm={request:{"elicitation/create":G({method:X(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":G({method:X(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":G({method:X(`roots/list`),params:K({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},qm}function Ym(e){return Km.includes(e)}function Xm(e){return Ym(e)?Jm().request[e]:void 0}function Zm(e){return Ym(e)?Jm().response[e]:void 0}var Qm={"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},$m={"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 eh(e){return Object.prototype.hasOwnProperty.call(Qm,e)}function th(e){return Object.prototype.hasOwnProperty.call($m,e)}function nh(e){return Object.prototype.hasOwnProperty.call(Qm,e)}function rh(e){return eh(e)?wm().dispatchRequestSchemas[e]:void 0}function ih(e){return nh(e)?wm().dispatchResultSchemas[e]:void 0}function ah(e){return th(e)?wm().notificationSchemas2026[e]:void 0}Object.keys(Qm),Object.keys($m);function oh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sh(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 ch={ok:!1,reason:`not-in-era`},lh=[hu,vu];function uh(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=>oh(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!oh(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(oh(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var dh={era:`2026-07-28`,hasRequestMethod:eh,hasNotificationMethod:th,hasInputRequestMethod:e=>Xm(e)!==void 0,validateRequest:(e,t)=>sh(rh(e),t),validateResult:(e,t)=>sh(ih(e),t),validateNotification:(e,t)=>sh(ah(e),t),validateInputRequest:(e,t)=>sh(Xm(e),t),validateInputResponse:(e,t)=>sh(Zm(e),t),samplingResultVariant:()=>ch,outboundEnvelope(e){return{[hu]:e.protocolVersion,[gu]:e.clientInfo,[vu]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of lh)n in e||t.push({key:n,problem:`missing`});let n=wm().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=>Jp(e),inputRequestSchema:Xm,decodeResult(e,t){if(!oh(t))return{kind:`invalid`,error:new Gp(Wp.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Gp(Wp.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 Gp(Wp.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=oh(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:wm().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Gp(Wp.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},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Gp(Wp.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ph(),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 Gp(Wp.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Hm(Bm(e,zm(e,uh(e,t))),n)},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/clientCapabilities)`;let t=wm().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(`; `)}`}},fh;function ph(){if(fh)return fh;let e=wm();return fh={"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},fh}var mh=`2026-07-28`;function hh(e){return e!==void 0&&qp(e)?dh:xm}function gh(e){return e.revision===void 0?e.era===`modern`?dh.era:xm.era:hh(e.revision).era}function _h(e){return bh.some(t=>t.hasRequestMethod(e))}function vh(e){return bh.some(t=>t.hasNotificationMethod(e))}function yh(e){return e===`tasks/get`||e===`tasks/cancel`}var bh=[xm,dh],xh=Ue({AnnotationsSchema:()=>vd,AudioContentSchema:()=>Zd,BaseMetadataSchema:()=>qu,BaseRequestParamsSchema:()=>Ou,BlobResourceContentsSchema:()=>gd,BooleanSchemaSchema:()=>Nf,CallToolRequestParamsSchema:()=>pf,CallToolRequestSchema:()=>mf,CallToolResultSchema:()=>df,CancelTaskRequestSchema:()=>yp,CancelTaskResultSchema:()=>bp,CancelledNotificationParamsSchema:()=>Uu,CancelledNotificationSchema:()=>Wu,ClientCapabilitiesSchema:()=>Qu,ClientNotificationSchema:()=>Sp,ClientRequestSchema:()=>xp,ClientResultSchema:()=>Cp,ClientTasksCapabilitySchema:()=>Xu,CompatibilityCallToolResultSchema:()=>ff,CompleteRequestParamsSchema:()=>ep,CompleteRequestSchema:()=>tp,CompleteResultSchema:()=>np,ContentBlockSchema:()=>tf,CreateMessageRequestParamsSchema:()=>kf,CreateMessageRequestSchema:()=>Af,CreateMessageResultSchema:()=>jf,CreateMessageResultWithToolsSchema:()=>Mf,CreateTaskResultSchema:()=>up,CursorSchema:()=>wu,DiscoverRequestSchema:()=>id,DiscoverResultSchema:()=>ad,ElicitRequestFormParamsSchema:()=>Gf,ElicitRequestParamsSchema:()=>qf,ElicitRequestSchema:()=>Jf,ElicitRequestURLParamsSchema:()=>Kf,ElicitResultSchema:()=>Zf,ElicitationCompleteNotificationParamsSchema:()=>Yf,ElicitationCompleteNotificationSchema:()=>Xf,EmbeddedResourceSchema:()=>$d,EmptyResultSchema:()=>Hu,EnumSchemaSchema:()=>Uf,GetPromptRequestParamsSchema:()=>qd,GetPromptRequestSchema:()=>Jd,GetPromptResultSchema:()=>rf,GetTaskPayloadRequestSchema:()=>hp,GetTaskPayloadResultSchema:()=>gp,GetTaskRequestSchema:()=>pp,GetTaskResultSchema:()=>mp,IconSchema:()=>Gu,IconsSchema:()=>Ku,ImageContentSchema:()=>Xd,ImplementationSchema:()=>Ju,InitializeRequestParamsSchema:()=>$u,InitializeRequestSchema:()=>ed,InitializeResultSchema:()=>nd,InitializedNotificationSchema:()=>rd,JSONArraySchema:()=>Su,JSONObjectSchema:()=>Q,JSONRPCErrorResponseSchema:()=>zu,JSONRPCMessageSchema:()=>Bu,JSONRPCNotificationSchema:()=>Lu,JSONRPCRequestSchema:()=>Iu,JSONRPCResponseSchema:()=>Vu,JSONRPCResultResponseSchema:()=>Ru,JSONValueSchema:()=>xu,LegacyTitledEnumSchemaSchema:()=>Rf,ListChangedOptionsBaseSchema:()=>gf,ListPromptsRequestSchema:()=>Gd,ListPromptsResultSchema:()=>Kd,ListResourceTemplatesRequestSchema:()=>Cd,ListResourceTemplatesResultSchema:()=>wd,ListResourcesRequestSchema:()=>xd,ListResourcesResultSchema:()=>Sd,ListRootsRequestSchema:()=>ip,ListRootsResultSchema:()=>ap,ListTasksRequestSchema:()=>_p,ListTasksResultSchema:()=>vp,ListToolsRequestSchema:()=>lf,ListToolsResultSchema:()=>uf,LoggingLevelSchema:()=>_f,LoggingMessageNotificationParamsSchema:()=>bf,LoggingMessageNotificationSchema:()=>xf,ModelHintSchema:()=>Sf,ModelPreferencesSchema:()=>Cf,MultiSelectEnumSchemaSchema:()=>Hf,NotificationSchema:()=>Mu,NotificationsParamsSchema:()=>ju,NumberSchemaSchema:()=>Ff,PaginatedRequestParamsSchema:()=>ud,PaginatedRequestSchema:()=>dd,PaginatedResultSchema:()=>fd,PingRequestSchema:()=>od,PrimitiveSchemaDefinitionSchema:()=>Wf,ProgressNotificationParamsSchema:()=>cd,ProgressNotificationSchema:()=>ld,ProgressSchema:()=>sd,ProgressTokenSchema:()=>Cu,PromptArgumentSchema:()=>Ud,PromptListChangedNotificationSchema:()=>af,PromptMessageSchema:()=>nf,PromptReferenceSchema:()=>$f,PromptSchema:()=>Wd,ReadResourceRequestParamsSchema:()=>Ed,ReadResourceRequestSchema:()=>Dd,ReadResourceResultSchema:()=>Od,RelatedTaskMetadataSchema:()=>Eu,RequestIdSchema:()=>Fu,RequestMetaSchema:()=>Du,RequestSchema:()=>Au,ResourceContentsSchema:()=>pd,ResourceLinkSchema:()=>ef,ResourceListChangedNotificationSchema:()=>kd,ResourceRequestParamsSchema:()=>Td,ResourceSchema:()=>yd,ResourceTemplateReferenceSchema:()=>Qf,ResourceTemplateSchema:()=>bd,ResourceUpdatedNotificationParamsSchema:()=>Vd,ResourceUpdatedNotificationSchema:()=>Hd,ResultMetaObjectSchema:()=>Nu,ResultSchema:()=>Pu,RoleSchema:()=>_d,RootSchema:()=>rp,RootsListChangedNotificationSchema:()=>op,SamplingContentSchema:()=>Ef,SamplingMessageContentBlockSchema:()=>Df,SamplingMessageSchema:()=>Of,ServerCapabilitiesSchema:()=>td,ServerNotificationSchema:()=>Tp,ServerRequestSchema:()=>wp,ServerResultSchema:()=>Ep,ServerTasksCapabilitySchema:()=>Zu,SetLevelRequestParamsSchema:()=>vf,SetLevelRequestSchema:()=>yf,SingleSelectEnumSchemaSchema:()=>zf,StringSchemaSchema:()=>Pf,SubscribeRequestParamsSchema:()=>Ad,SubscribeRequestSchema:()=>jd,SubscriptionFilterSchema:()=>Pd,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ld,SubscriptionsAcknowledgedNotificationSchema:()=>Rd,SubscriptionsListenRequestParamsSchema:()=>Fd,SubscriptionsListenRequestSchema:()=>Id,SubscriptionsListenResultMetaSchema:()=>zd,SubscriptionsListenResultSchema:()=>Bd,TaskAugmentedRequestParamsSchema:()=>ku,TaskCreationParamsSchema:()=>sp,TaskMetadataSchema:()=>Tu,TaskSchema:()=>lp,TaskStatusNotificationParamsSchema:()=>dp,TaskStatusNotificationSchema:()=>fp,TaskStatusSchema:()=>cp,TextContentSchema:()=>Yd,TextResourceContentsSchema:()=>md,TitledMultiSelectEnumSchemaSchema:()=>Vf,TitledSingleSelectEnumSchemaSchema:()=>Lf,ToolAnnotationsSchema:()=>of,ToolChoiceSchema:()=>wf,ToolExecutionSchema:()=>sf,ToolListChangedNotificationSchema:()=>hf,ToolResultContentSchema:()=>Tf,ToolSchema:()=>cf,ToolUseContentSchema:()=>Qd,UnsubscribeRequestParamsSchema:()=>Md,UnsubscribeRequestSchema:()=>Nd,UntitledMultiSelectEnumSchemaSchema:()=>Bf,UntitledSingleSelectEnumSchemaSchema:()=>If}),Sh=e=>Iu.safeParse(e).success,Ch=e=>Lu.safeParse(e).success,wh=e=>Ru.safeParse(e).success,Th=e=>zu.safeParse(e).success;$.InvalidRequest,$.UnsupportedProtocolVersion,$.InvalidParams,$.MethodNotFound,$.InvalidParams,$.MissingRequiredClientCapability,$.ParseError,$.InvalidRequest,$.MethodNotFound,$.UnsupportedProtocolVersion,$.MissingRequiredClientCapability;function Eh(e,t){return Oc(e,t)}function Dh(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Oh(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 kh=!1,Ah=`draft-2020-12`;function jh(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Ah});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().`);kh||(kh=!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=Sc(e,{target:Ah,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&&Mh(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 Mh(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`||Mh(e)))}return!1}function Nh(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function Ph(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>Nh(e)).join(`, `)}:{success:!0,data:n.value}}function Fh(e){let t=Sc(e,{target:Ah,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Ih=/\\\.\\d\{(\d+)\}/;function Lh(e){let t=Ih.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=>uu({local:e,offset:t,precision:n}))))}function Rh(e,t){let n;switch(e){case`email`:n=[qc()];break;case`uri`:n=[Zc()];break;case`date`:n=[du()];break;case`date-time`:n=Lh(t)}return new Set(n.map(e=>Fh(e)).filter(e=>e!==void 0))}function zh(e,t,n){return n!==`zod`||Rh(e,t).has(t)}function Bh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vh(e){try{return jh(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new jm($.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Hh=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Uh(e){return Hh.has(e)||e.startsWith(`x-`)}var Wh=new Set([`$schema`,...Object.keys(Gf.shape.requestedSchema.shape)]),Gh={string:Dh([Pf,If,Lf,Rf]),number:Dh([Ff]),integer:Dh([Ff]),boolean:Dh([Nf]),array:Dh([Bf,Vf])},Kh=new Set(Pf.shape.format.unwrap().options);function qh(e,t,n,r){if(!Bh(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Gh,e.type)?Gh[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Uh(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Kh.has(e.format)?(typeof s!=`string`||!zh(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Jh(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Bh(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,qh(n,`properties.${e}`,t,r)])):Wh.has(i)?n[i]=a:Uh(i)||r.push(i);if(r.length>0)throw new jm($.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Yh(e,t){if(!Bh(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Eh(Wf,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Xh(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Xh(e,t[r],`${n}[${r}]`)):!Bh(e)||!Bh(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Xh(r,t[e],i):Uh(e)?[]:[i]})}function Zh(e){if(!Oh(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Jh(Vh(e.requestedSchema),t),r=Eh(Gf.shape.requestedSchema,n);if(!r.success)throw new jm($.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Yh(n,r.error.message)}`);let i=Xh(n,r.data);if(i.length>0)throw new jm($.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 jm($.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Qh(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(Qh,{elicit(e){try{return{method:`elicitation/create`,params:Zh(e)}}catch(e){throw e instanceof jm?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 $h=`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.ResultMetaObjectSchema.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(`.`),eg={IdJagTokenExchangeResponseSchema:Np,OAuthClientInformationFullSchema:Rp,OAuthClientInformationSchema:Lp,OAuthClientMetadataSchema:Ip,OAuthClientRegistrationErrorSchema:zp,OAuthErrorResponseSchema:Pp,OAuthMetadataSchema:kp,OAuthProtectedResourceMetadataSchema:Op,OAuthTokenRevocationRequestSchema:Bp,OAuthTokensSchema:Mp,OpenIdProviderDiscoveryMetadataSchema:jp,OpenIdProviderMetadataSchema:Ap},tg={},ng={};function rg(e,t){let n=e.slice(0,-6);tg[n]=t,ng[n]=e=>t.safeParse(e).success}for(let e of $h)rg(e,xh[e]);for(let[e,t]of Object.entries(eg))rg(e,t);Object.freeze(tg),Object.freeze(ng);function ig(e){switch(e){case`initialize`:case`notifications/initialized`:return hh(void 0);case`server/discover`:return hh(mh);default:return}}var ag=[hu,gu,vu,bu],og=[`inputResponses`,`requestState`];function sg(e,t){let n=e.params;if(!fg(n))return{message:e,lifted:{}};let r=n._meta,i=fg(r)?ag.filter(e=>e in r):[],a=t===`request`?og.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&fg(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 cg(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 lg(e){return()=>e}var ug=lg(void 0),dg=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_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??pu,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 Gp(Wp.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!==void 0&&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 Gp(Wp.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),wh(e)||Th(e)?this._onresponse(e):Sh(e)?this._onrequest(e,t):Ch(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 Gp(Wp.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}=sg(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=gh(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(vh(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}=sg(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=gh(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($.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(_h(n.method)&&!i.hasRequestMethod(n.method)&&!(yh(n.method)&&this._customSchemaRequestMethods.has(n.method))){o($.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o($.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o($.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:mg(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?ug:lg(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Oh(t))return u(e,t,n);let i=cg(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,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o($.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:$.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);n===void 0?this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`)):(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wh(e)?n(e):n(jm.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(Oh(t))return yh(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=cg(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 hh(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=ig(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(_h(t)&&!e.hasRequestMethod(t))throw new Gp(Wp.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 Gp?e:new Gp(Wp.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,ee=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&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 Gp?e:new Gp(Wp.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(hg(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;Ph(n,o).then(e=>{e.success?d(e.data):f(new Gp(Wp.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ee(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let y=r?.timeout??6e4;this._setupTimeout(h,y,r?.maxTotalTimeout,()=>ee(new Gp(Wp.RequestTimeout,`Request timed out`,{timeout:y})),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 await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Gp(Wp.NotConnected,`Not connected`);if(vh(t.method)&&!e.hasNotificationMethod(t.method))throw new Gp(Wp.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===void 0){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))})}else await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!_h(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 jm($.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 Ph(t.params,{...r.params});if(!a.success)throw new jm($.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.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(!vh(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 jm($.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))})}else{if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await Ph(t.params,{...r.params});if(!i.success)throw new jm($.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function fg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mg(e){let t={},n=[];if(!pg(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e))!pg(i)||`method`in i||`result`in i?n.push(r):t[r]=i;return{accepted:t,droppedKeys:n}}function hg(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}He((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}}))(),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`);var gg=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,_g=/^(?=.{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,vg=/^(?:[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,yg=/^(?:(?:[^\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,bg=/^(?:(?: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,xg=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Sg=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Cg=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,wg=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Tg=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Eg=/^((([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;function Dg(e){return e.test.bind(e)}Og.bind(void 0,!1),Dg(vg),Dg(yg),Dg(bg),Dg(_g),Dg(Tg),Dg(Eg),Dg(xg),Dg(Sg),Dg(Cg),Dg(wg);function Og(e,t){let n=t.match(gg);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)}globalThis.crypto;var kg=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e){super(e),this.name=new.target.name,Hp(this,new.target)}};(class extends kg{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}}),class extends kg{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}},class extends kg{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 / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends kg{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},class extends kg{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}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Hp(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return Up(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 Up(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Hp(this,new.target)}};var Ag=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}},jg=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},Mg=new Set;function Ng(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;Mg.has(o)||(Mg.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},Pg(t)):e=>s({method:a,params:e})]}function Pg(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Fg=`2026-01-26`,Ig=q([X(`light`),X(`dark`)]).describe(`Color theme preference for the host environment.`),Lg=q([X(`inline`),X(`fullscreen`),X(`pip`)]).describe(`Display mode for UI presentation.`),Rg=J(q([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.
56
56
 
57
57
  Individual style keys are optional - hosts may provide any subset of these values.
58
58
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -98,12 +98,12 @@ Boolean requesting whether a visible border and background is provided by the ho
98
98
  - omitted: host decides border`)});var t_=G({method:X(`ui/request-display-mode`),params:G({mode:Lg.describe(`The display mode being requested.`)})}),n_=G({mode:Lg.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),r_=q([X(`model`),X(`app`)]).describe(`Tool visibility scope - who can access the tool.`);G({resourceUri:z().optional(),visibility:W(r_).optional().describe(`Who can access this tool. Default: ["model", "app"]
99
99
  - "model": Tool visible to and callable by the agent
100
100
  - "app": Tool callable by the app from this server only`),csp:Tl().optional(),permissions:Tl().optional()}),G({mimeTypes:W(z()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var i_=G({method:X(`ui/download-file`),params:G({contents:W(q([$d,ef])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),a_=G({method:X(`ui/message`),params:G({role:X(`user`).describe(`Message role, currently only "user" is supported.`),content:W(tf).describe(`Message content blocks (text, image, etc.).`)})});G({method:X(`ui/notifications/sandbox-resource-ready`),params:G({html:z().describe(`HTML content to load into the inner iframe.`),sandbox:z().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:Wg.optional().describe(`CSP configuration from resource metadata.`),permissions:Gg.optional().describe(`Sandbox permissions from resource metadata.`)})}),G({method:X(`ui/notifications/tool-result`),params:df.describe(`Standard MCP tool execution result.`)});var o_=G({toolInfo:G({id:Fu.optional().describe(`JSON-RPC id of the tools/call request.`),tool:cf.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Ig.optional().describe(`Current color theme preference.`),styles:Jg.optional().describe(`Style configuration for theming the app.`),displayMode:Lg.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:W(Lg).optional().describe(`Display modes the host supports.`),containerDimensions:q([G({height:V().describe(`Fixed container height in pixels.`)}),G({maxHeight:q([V(),vl()]).optional().describe(`Maximum container height in pixels.`)})]).and(q([G({width:V().describe(`Fixed container width in pixels.`)}),G({maxWidth:q([V(),vl()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
101
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:z().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:z().optional().describe(`User's timezone in IANA format.`),userAgent:z().optional().describe(`Host application identifier.`),platform:q([X(`web`),X(`desktop`),X(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:G({touch:H().optional().describe(`Whether the device supports touch input.`),hover:H().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:G({top:V().describe(`Top safe area inset in pixels.`),right:V().describe(`Right safe area inset in pixels.`),bottom:V().describe(`Bottom safe area inset in pixels.`),left:V().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();G({method:X(`ui/notifications/host-context-changed`),params:o_.describe(`Partial context update containing only changed fields.`)});var s_=G({method:X(`ui/update-model-context`),params:G({content:W(tf).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:J(z(),U().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),c_=G({method:X(`ui/initialize`),params:G({appInfo:Ju.describe(`App identification (name and version).`),appCapabilities:$g.describe(`Features and capabilities this app provides.`),protocolVersion:z().describe(`Protocol version this app supports.`)})}),l_=G({protocolVersion:z().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ju.describe(`Host application identification and version.`),hostCapabilities:Qg.describe(`Features and capabilities provided by the host.`),hostContext:o_.describe(`Rich context about the host environment.`)}).passthrough(),u_=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=Bu.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},d_=[Fg],f_=class extends dg{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Ag;_methods=new jg;setRequestHandler=(...e)=>{let[t,...n]=Ng(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=Ng(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_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:Kg,sandboxready:Ug,initialized:e_,requestteardown:Zg,loggingmessage:xf};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._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.replaceRequestHandler(`ui/initialize`,{params:c_.shape.params,result:l_},e=>this._onAppsInitialize(e)),this.replaceRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(`ui/request-display-mode`,{params:t_.shape.params,result:n_},()=>({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.replaceRequestHandler(`ui/message`,{params:a_.shape.params,result:Hg},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.replaceRequestHandler(`ui/open-link`,{params:zg.shape.params,result:Bg},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.replaceRequestHandler(`ui/download-file`,{params:i_.shape.params,result:Vg},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.replaceRequestHandler(`ui/request-display-mode`,{params:t_.shape.params,result:n_},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.replaceRequestHandler(`ui/update-model-context`,{params:s_.shape.params,result:Hu},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.replaceRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced(`oncreatesamplingmessage`,this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler(`sampling/createMessage`,async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error(`No oncreatesamplingmessage handler set`);return this._oncreatesamplingmessage(e.params,t)})}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.replaceRequestHandler(`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.replaceRequestHandler(`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.replaceRequestHandler(`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.replaceRequestHandler(`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:d_.includes(t)?t:Fg,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];p_(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},Yg,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 p_(e,t){return JSON.stringify(e)===JSON.stringify(t)}var m_=`po-mcp-session-approval`;function h_(e){if(e===void 0||e.trim()===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=Object.keys(n).sort();if(r.length===2&&r[0]===`global`&&r[1]===`session`&&typeof n.global==`boolean`&&typeof n.session==`boolean`)return{global:n.global,session:n.session}}var g_=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`gu`),__=128,v_=8192,y_=512,b_=256,x_=64,S_=/^[A-Za-z0-9._-]{1,64}$/u,C_=[`not-connected`,`connecting`,`connected`,`degraded`,`needs-auth`,`failed`,`closed`,`disabled`];function w_(e){return C_.some(t=>t===e)}var T_=`/tool`,E_=`server`,D_=`tool`,O_=`/secrets`;function k_(e){if(e!==void 0&&e.trim()!==``)try{let t=JSON.parse(e.replace(g_,``));if(!Array.isArray(t)||t.length===0||t.length>__)return;let n=new Set;for(let e of t){if(!L_(e)||n.has(e.name))return;n.add(e.name)}return t}catch{return}}function A_(e){for(let t of e){let e=t.codePointAt(0);if(e!==void 0&&(e<32||e>=127&&e<=159))return!0}return!1}function j_(e){if(typeof e!=`string`||e.length>v_||A_(e))return!1;try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.username===``&&t.password===``}catch{return!1}}function M_(e){return typeof e==`string`&&e.trim()!==``&&e.length<=b_&&!A_(e)}function N_(e){return typeof e==`string`&&S_.test(e)}function P_(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0}function F_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`name`||e===`piName`||e===`tokens`)&&M_(t.name)&&(!(`piName`in t)||M_(t.piName))&&(!(`tokens`in t)||P_(t.tokens))}function I_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>[`owner`,`canEdit`,`canRemove`,`revision`,`target`,`kind`].includes(e))&&[`global`,`repository`,`read-only`].includes(String(t.owner))&&typeof t.canEdit==`boolean`&&typeof t.canRemove==`boolean`&&(!(`revision`in t)||typeof t.revision==`string`&&/^[a-f0-9]{64}$/u.test(t.revision))&&(!(`target`in t)||typeof t.target==`string`&&t.target.length<=2048&&!A_(t.target))&&(!(`kind`in t)||t.kind===`local`||t.kind===`remote`)&&(!(t.canEdit||t.canRemove)||t.owner!==`read-only`&&typeof t.revision==`string`)}function L_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`management`||e===`name`||e===`state`||e===`authorizationUrl`||e===`tools`||e===`missingSecrets`||e===`oauthEligible`||e===`oauthAuthorized`)&&(!(`management`in t)||I_(t.management))&&(!(`oauthEligible`in t)||typeof t.oauthEligible==`boolean`)&&(!(`oauthAuthorized`in t)||typeof t.oauthAuthorized==`boolean`)&&(!(`missingSecrets`in t)||Array.isArray(t.missingSecrets)&&t.missingSecrets.length<=x_&&t.missingSecrets.every(N_))&&(!(`authorizationUrl`in t)||j_(t.authorizationUrl))&&(!(`tools`in t)||Array.isArray(t.tools)&&t.tools.length<=y_&&t.tools.every(F_))&&typeof t.name==`string`&&t.name.trim()!==``&&!A_(t.name)&&w_(t.state)}var R_=`/repository`,z_=`/repository/discover`,B_=`/repository/authorize`,V_=`repositoryId`,H_=`flowId`,U_=`/servers`,W_=`/servers/global`,G_=`/settings`,K_=`${B_}/:${H_}`,q_={catalog:{method:`GET`,path:R_,query:[V_],response:void 0},discover:{method:`POST`,path:z_,response:void 0},authorize:{method:`POST`,path:B_,response:void 0},readAuthorization:{method:`GET`,path:K_,query:[V_],response:void 0},cancelAuthorization:{method:`DELETE`,path:K_,query:[V_],response:void 0},addServer:{method:`POST`,path:U_,response:void 0},editServer:{method:`PATCH`,path:U_,response:void 0},removeServer:{method:`DELETE`,path:U_,response:void 0},globalServers:{method:`GET`,path:W_,response:void 0},readSettings:{method:`GET`,path:G_,response:void 0},saveSettings:{method:`PUT`,path:G_,response:void 0},sessionTool:{method:`GET`,path:T_,query:[E_,D_],response:void 0},sessionSecret:{method:`POST`,path:O_,response:void 0}},J_=r(q_,{scopes:[`global`,`workspace`,`session`],basePath:`mcp`,transport:(e,t)=>Se.fetch(e,t),sessionAddress:o}),Y_=r(q_,{scopes:[`session`],basePath:`mcp-session`,transport:(e,t)=>Se.fetch(e,t),sessionAddress:o}),X_={"content-type":`application/json`};function Z_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Q_(e,t){let n;try{n=await e.json()}catch{n=void 0}return e.ok?{value:n}:{error:Z_(n)&&typeof n.error==`string`?n.error:t}}async function $_(e,t){let n=J_.workspace(t).catalog;return await Q_(await e(n.url({query:{[V_]:t}})),`The synced MCP catalog could not be read.`)}async function ev(e,t){let n=J_.workspace(t).discover;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify({repositoryId:t})}),`MCP discovery could not be completed.`)}async function tv(e,t,n){let r=J_.workspace(t).authorize;return await Q_(await e(r.url(),{method:r.spec.method,headers:X_,body:JSON.stringify({repositoryId:t,serverName:n})}),`MCP authorization could not be started.`)}async function nv(e,t,n){let r=J_.workspace(t).readAuthorization;return await Q_(await e(r.url({params:{[H_]:n},query:{[V_]:t}})),`The authorization state could not be read.`)}async function rv(e,t,n){let r=J_.workspace(t).cancelAuthorization;return await Q_(await e(r.url({params:{[H_]:n},query:{[V_]:t}}),{method:r.spec.method}),`The authorization flow could not be cancelled.`)}async function iv(e,t){let n=t.scope===`repository`&&t.repositoryId?J_.workspace(t.repositoryId).addServer:J_.global.addServer;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify(t)}),`The server could not be added.`)}async function av(e,t,n){let r=n.repositoryId?J_.workspace(n.repositoryId):J_.global,i=t===`edit`?r.editServer:r.removeServer;return await Q_(await e(i.url(),{method:i.spec.method,headers:X_,body:JSON.stringify(n)}),`The saved definition could not be changed.`)}async function ov(e){let t=J_.global.globalServers;return await Q_(await e(t.url()),`Your MCP servers could not be read.`)}async function sv(e){let t=J_.global.readSettings;return await Q_(await e(t.url()),`Your MCP settings could not be read.`)}async function cv(e,t){let n=J_.global.saveSettings;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify(t)}),`Your MCP settings could not be saved.`)}var lv={kind:`repository`},uv=`repository`,dv=`plugin:`;function fv(e){switch(e.kind){case`repository`:return`Workspace (.mcp.json)`;case`global`:return`Your personal config (~/.po/mcp.json)`;case`plugin`:return`Plugin ${e.pluginName} (.mcp.json)`;case`upstream`:return`Upstream (mcp-config.yaml)`}}function pv(e){if(!e?.source)return;let t=fv(e.source);return e.owner===`read-only`?e.readOnlyReason?`${t}, read-only: ${e.readOnlyReason}`:`${t}, read-only.`:`${t}.`}function mv(e){return[lv,...(e??[]).filter(e=>e.kind===`plugin`)]}function hv(e){return e.kind===`repository`?`This workspace (.mcp.json)`:`Plugin ${e.pluginName} (.mcp.json)`}function gv(e){return e.kind===`repository`?uv:`${dv}${e.pluginId}`}function _v(e,t){return e.find(e=>gv(e)===t)}function vv(e){return e.owner===`plugin`&&e.source?.kind===`plugin`?{kind:`plugin`,pluginId:e.source.pluginId}:void 0}var yv=/^[A-Za-z0-9_-]+$/,bv=/key|token|secret/i;function xv(e){return e.toLowerCase()===`authorization`||bv.test(e)}function Sv(e){return e.kind===`repository`?Cv.repository:`Sessions that load the ${e.pluginName} plugin can use it after you add it. It's saved to that plugin's .mcp.json in this repository.`}var Cv={repository:`Sessions in this repository can use it after you add it. It's saved to .mcp.json in this repository.`,global:`Sessions in every repository can use it after you add it. It's saved to your personal config, ~/.po/mcp.json.`};function wv(e,t){let n=e.split(`
102
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.indexOf(t);return n>0?[e.slice(0,n).trim(),e.slice(n+1).trim()]:[e,``]});return n.length>0?Object.fromEntries(n):void 0}function Tv(e){try{let t=new URL(e).protocol;return t===`https:`||t===`http:`}catch{return!1}}function Ev({open:e,onOpenChange:n,onCloseAutoFocus:r,scope:a,targets:o,existingNames:c,onSubmit:l,pending:d=!1,error:m,defaultValues:g={}}){let _=a===`repository`?mv(o):[],[v,y]=k(g.target??gv({kind:`repository`})),ee=_v(_,v)??_[0],te=ee?.kind===`plugin`?{kind:`plugin`,pluginId:ee.pluginId}:void 0,[x,w]=k(g.kind??`remote`),[T,E]=k(g.name??``),[se,ce]=k(g.url??``),[le,de]=k(g.headers??``),[fe,pe]=k(g.command??``),[me,ge]=k(g.args??``),[ve,ye]=k(g.env??``),[be,Se]=k(g.trusted??!1),[Ce,Ee]=k(g.vault??{}),De=e=>Ce[e]??xv(e),Oe=e=>Object.entries(e??{}).filter(([e,t])=>t!==``&&De(e)).map(([e])=>e),ke=T.trim(),Ae=ke===``?void 0:yv.test(ke)?c.includes(ke)?`A server named ${ke} already exists here.`:void 0:`Use letters, numbers, dashes or underscores.`,je=se.trim()!==``&&!Tv(se.trim())?`Enter an http or https address.`:void 0,Me=ke!==``&&Ae===void 0&&(x===`remote`?se.trim()!==``&&je===void 0:fe.trim()!==``&&be),Ne=()=>{if(Me&&!d){if(x===`remote`){let e=wv(le,`:`);l({name:ke,entry:{type:`http`,url:se.trim(),...e?{headers:e}:{}},trusted:!1,secretFields:Oe(e),...te?{target:te}:{}})}else{let e=wv(ve,`=`);l({name:ke,entry:{command:fe.trim(),args:me.split(`
103
- `).map(e=>e.trim()).filter(Boolean),...e?{env:e}:{}},trusted:be,secretFields:Oe(e),...te?{target:te}:{}})}}};return D(i,{open:e,onOpenChange:n,children:O(Te,{"data-testid":`mcp-add-server-dialog`,onCloseAutoFocus:r,children:[D(re,{className:`items-start px-4 py-4 sm:px-5`,dismissible:!0,children:O(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[D(ae,{children:`Add an MCP server`}),D(u,{children:ee?Sv(ee):Cv[a]})]})}),O(`form`,{onSubmit:e=>{e.preventDefault(),Ne()},children:[O(f,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[_.length>1?O(`div`,{className:`flex flex-col gap-1.5`,children:[D(Fe,{htmlFor:`mcp-add-target`,children:`Save to`}),O(p,{value:ee?gv(ee):v,onValueChange:y,children:[D(t,{id:`mcp-add-target`,"data-testid":`mcp-add-target`,children:D(S,{})}),D(b,{children:_.map(e=>D(ze,{value:gv(e),children:hv(e)},gv(e)))})]})]}):null,D(ue,{value:x,onValueChange:e=>w(e===`local`?`local`:`remote`),children:O(we,{"aria-label":`Server kind`,children:[D(xe,{value:`remote`,children:`Remote (URL)`}),D(xe,{value:`local`,children:`Local command`})]})}),O(`div`,{className:`flex flex-col gap-1.5`,children:[D(Fe,{htmlFor:`mcp-add-name`,children:`Name`}),D(Re,{id:`mcp-add-name`,className:`font-mono`,value:T,placeholder:`linear`,"aria-invalid":Ae!==void 0,"aria-describedby":`mcp-add-name-hint`,onChange:e=>E(e.target.value)}),D(`p`,{id:`mcp-add-name-hint`,className:`text-sm ${Ae?`text-po-red`:`text-po-dim`}`,children:Ae??(ke?`Tools appear as ${ke.replace(/[^A-Za-z0-9]/g,`_`)}_tool_name.`:`Tools appear with this name in front.`)})]}),x===`remote`?O(he,{children:[O(`div`,{className:`flex flex-col gap-1.5`,children:[D(Fe,{htmlFor:`mcp-add-url`,children:`Server URL`}),D(Re,{id:`mcp-add-url`,type:`url`,className:`font-mono`,value:se,placeholder:`https://mcp.example.com/mcp`,"aria-invalid":je!==void 0,onChange:e=>ce(e.target.value)}),je?D(`p`,{className:`text-sm text-po-red`,children:je}):null]}),O(C,{className:`flex flex-col gap-1.5`,defaultOpen:le!==``,children:[D(ne,{asChild:!0,children:O(A,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[D(h,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Headers (optional)`]})}),O(s,{className:`flex flex-col gap-1.5`,children:[D(oe,{"aria-label":`Headers`,className:`font-mono`,rows:3,value:le,placeholder:`Authorization: Bearer ...`,onChange:e=>de(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One header per line, as Name: value.`}),D(Dv,{serverName:ke,fields:Object.keys(wv(le,`:`)??{}),keepsInVault:De,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),D(`p`,{className:`text-sm text-po-dim`,children:`If the server uses sign-in, you can authorize it right after adding.`})]}):O(he,{children:[O(`div`,{className:`flex flex-col gap-1.5`,children:[D(Fe,{htmlFor:`mcp-add-command`,children:`Command`}),D(Re,{id:`mcp-add-command`,className:`font-mono`,value:fe,placeholder:`npx`,onChange:e=>pe(e.target.value)})]}),O(`div`,{className:`flex flex-col gap-1.5`,children:[D(Fe,{htmlFor:`mcp-add-args`,children:`Arguments`}),D(oe,{id:`mcp-add-args`,className:`font-mono`,rows:3,value:me,placeholder:`-y
101
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:z().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:z().optional().describe(`User's timezone in IANA format.`),userAgent:z().optional().describe(`Host application identifier.`),platform:q([X(`web`),X(`desktop`),X(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:G({touch:H().optional().describe(`Whether the device supports touch input.`),hover:H().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:G({top:V().describe(`Top safe area inset in pixels.`),right:V().describe(`Right safe area inset in pixels.`),bottom:V().describe(`Bottom safe area inset in pixels.`),left:V().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();G({method:X(`ui/notifications/host-context-changed`),params:o_.describe(`Partial context update containing only changed fields.`)});var s_=G({method:X(`ui/update-model-context`),params:G({content:W(tf).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:J(z(),U().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),c_=G({method:X(`ui/initialize`),params:G({appInfo:Ju.describe(`App identification (name and version).`),appCapabilities:$g.describe(`Features and capabilities this app provides.`),protocolVersion:z().describe(`Protocol version this app supports.`)})}),l_=G({protocolVersion:z().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ju.describe(`Host application identification and version.`),hostCapabilities:Qg.describe(`Features and capabilities provided by the host.`),hostContext:o_.describe(`Rich context about the host environment.`)}).passthrough(),u_=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=Bu.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},d_=[Fg],f_=class extends dg{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Ag;_methods=new jg;setRequestHandler=(...e)=>{let[t,...n]=Ng(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=Ng(`notification`,e)??e;this._methods.claim(t,`setNotificationHandler`),super.setNotificationHandler.call(this,t,...n)};removeRequestHandler=e=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=e=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_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:Kg,sandboxready:Ug,initialized:e_,requestteardown:Zg,loggingmessage:xf};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._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),this._ensureEventSlot(`initialized`),this._hostContext=r?.hostContext||{},this.replaceRequestHandler(`ui/initialize`,{params:c_.shape.params,result:l_},e=>this._onAppsInitialize(e)),this.replaceRequestHandler(`ping`,(e,t)=>(this.onping?.(e.params,t),{})),this.replaceRequestHandler(`ui/request-display-mode`,{params:t_.shape.params,result:n_},()=>({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.replaceRequestHandler(`ui/message`,{params:a_.shape.params,result:Hg},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.replaceRequestHandler(`ui/open-link`,{params:zg.shape.params,result:Bg},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.replaceRequestHandler(`ui/download-file`,{params:i_.shape.params,result:Vg},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.replaceRequestHandler(`ui/request-display-mode`,{params:t_.shape.params,result:n_},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.replaceRequestHandler(`ui/update-model-context`,{params:s_.shape.params,result:Hu},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.replaceRequestHandler(`tools/call`,async(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced(`oncreatesamplingmessage`,this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler(`sampling/createMessage`,async(e,t)=>{if(!this._oncreatesamplingmessage)throw Error(`No oncreatesamplingmessage handler set`);return this._oncreatesamplingmessage(e.params,t)})}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.replaceRequestHandler(`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.replaceRequestHandler(`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.replaceRequestHandler(`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.replaceRequestHandler(`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:d_.includes(t)?t:Fg,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];p_(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},Yg,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 p_(e,t){return JSON.stringify(e)===JSON.stringify(t)}var m_=`po-mcp-session-approval`;function h_(e){if(e===void 0||e.trim()===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=Object.keys(n).sort();if(r.length===2&&r[0]===`global`&&r[1]===`session`&&typeof n.global==`boolean`&&typeof n.session==`boolean`)return{global:n.global,session:n.session}}var g_=RegExp(`\x1B\\[[0-?]*[ -/]*[@-~]`,`gu`),__=128,v_=8192,y_=512,b_=256,x_=64,S_=/^[A-Za-z0-9._-]{1,64}$/u,C_=[`not-connected`,`connecting`,`connected`,`degraded`,`needs-auth`,`failed`,`closed`,`disabled`];function w_(e){return C_.some(t=>t===e)}var T_=`/tool`,E_=`server`,D_=`tool`,O_=`/secrets`;function k_(e){if(e!==void 0&&e.trim()!==``)try{let t=JSON.parse(e.replace(g_,``));if(!Array.isArray(t)||t.length===0||t.length>__)return;let n=new Set;for(let e of t){if(!L_(e)||n.has(e.name))return;n.add(e.name)}return t}catch{return}}function A_(e){for(let t of e){let e=t.codePointAt(0);if(e!==void 0&&(e<32||e>=127&&e<=159))return!0}return!1}function j_(e){if(typeof e!=`string`||e.length>v_||A_(e))return!1;try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.username===``&&t.password===``}catch{return!1}}function M_(e){return typeof e==`string`&&e.trim()!==``&&e.length<=b_&&!A_(e)}function N_(e){return typeof e==`string`&&S_.test(e)}function P_(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0}function F_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`name`||e===`piName`||e===`tokens`)&&M_(t.name)&&(!(`piName`in t)||M_(t.piName))&&(!(`tokens`in t)||P_(t.tokens))}function I_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>[`owner`,`canEdit`,`canRemove`,`revision`,`target`,`kind`].includes(e))&&[`global`,`repository`,`read-only`].includes(String(t.owner))&&typeof t.canEdit==`boolean`&&typeof t.canRemove==`boolean`&&(!(`revision`in t)||typeof t.revision==`string`&&/^[a-f0-9]{64}$/u.test(t.revision))&&(!(`target`in t)||typeof t.target==`string`&&t.target.length<=2048&&!A_(t.target))&&(!(`kind`in t)||t.kind===`local`||t.kind===`remote`)&&(!(t.canEdit||t.canRemove)||t.owner!==`read-only`&&typeof t.revision==`string`)}function L_(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).every(e=>e===`management`||e===`name`||e===`state`||e===`authorizationUrl`||e===`tools`||e===`missingSecrets`||e===`oauthEligible`||e===`oauthAuthorized`)&&(!(`management`in t)||I_(t.management))&&(!(`oauthEligible`in t)||typeof t.oauthEligible==`boolean`)&&(!(`oauthAuthorized`in t)||typeof t.oauthAuthorized==`boolean`)&&(!(`missingSecrets`in t)||Array.isArray(t.missingSecrets)&&t.missingSecrets.length<=x_&&t.missingSecrets.every(N_))&&(!(`authorizationUrl`in t)||j_(t.authorizationUrl))&&(!(`tools`in t)||Array.isArray(t.tools)&&t.tools.length<=y_&&t.tools.every(F_))&&typeof t.name==`string`&&t.name.trim()!==``&&!A_(t.name)&&w_(t.state)}var R_=`/repository`,z_=`/repository/discover`,B_=`/repository/authorize`,V_=`repositoryId`,H_=`flowId`,U_=`/servers`,W_=`/servers/global`,G_=`/settings`,K_=`${B_}/:${H_}`,q_={catalog:{method:`GET`,path:R_,query:[V_],response:void 0},discover:{method:`POST`,path:z_,response:void 0},authorize:{method:`POST`,path:B_,response:void 0},readAuthorization:{method:`GET`,path:K_,query:[V_],response:void 0},cancelAuthorization:{method:`DELETE`,path:K_,query:[V_],response:void 0},addServer:{method:`POST`,path:U_,response:void 0},editServer:{method:`PATCH`,path:U_,response:void 0},removeServer:{method:`DELETE`,path:U_,response:void 0},globalServers:{method:`GET`,path:W_,response:void 0},readSettings:{method:`GET`,path:G_,response:void 0},saveSettings:{method:`PUT`,path:G_,response:void 0},sessionTool:{method:`GET`,path:T_,query:[E_,D_],response:void 0},sessionSecret:{method:`POST`,path:O_,response:void 0}},J_=Ne(q_,{scopes:[`global`,`workspace`,`session`],basePath:`mcp`,transport:(e,t)=>Ee.fetch(e,t),sessionAddress:o}),Y_=Ne(q_,{scopes:[`session`],basePath:`mcp-session`,transport:(e,t)=>Ee.fetch(e,t),sessionAddress:o}),X_={"content-type":`application/json`};function Z_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Q_(e,t){let n;try{n=await e.json()}catch{n=void 0}return e.ok?{value:n}:{error:Z_(n)&&typeof n.error==`string`?n.error:t}}async function $_(e,t){let n=J_.workspace(t).catalog;return await Q_(await e(n.url({query:{[V_]:t}})),`The synced MCP catalog could not be read.`)}async function ev(e,t){let n=J_.workspace(t).discover;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify({repositoryId:t})}),`MCP discovery could not be completed.`)}async function tv(e,t,n){let r=J_.workspace(t).authorize;return await Q_(await e(r.url(),{method:r.spec.method,headers:X_,body:JSON.stringify({repositoryId:t,serverName:n})}),`MCP authorization could not be started.`)}async function nv(e,t,n){let r=J_.workspace(t).readAuthorization;return await Q_(await e(r.url({params:{[H_]:n},query:{[V_]:t}})),`The authorization state could not be read.`)}async function rv(e,t,n){let r=J_.workspace(t).cancelAuthorization;return await Q_(await e(r.url({params:{[H_]:n},query:{[V_]:t}}),{method:r.spec.method}),`The authorization flow could not be cancelled.`)}async function iv(e,t){let n=t.scope===`repository`&&t.repositoryId?J_.workspace(t.repositoryId).addServer:J_.global.addServer;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify(t)}),`The server could not be added.`)}async function av(e,t,n){let r=n.repositoryId?J_.workspace(n.repositoryId):J_.global,i=t===`edit`?r.editServer:r.removeServer;return await Q_(await e(i.url(),{method:i.spec.method,headers:X_,body:JSON.stringify(n)}),`The saved definition could not be changed.`)}async function ov(e){let t=J_.global.globalServers;return await Q_(await e(t.url()),`Your MCP servers could not be read.`)}async function sv(e){let t=J_.global.readSettings;return await Q_(await e(t.url()),`Your MCP settings could not be read.`)}async function cv(e,t){let n=J_.global.saveSettings;return await Q_(await e(n.url(),{method:n.spec.method,headers:X_,body:JSON.stringify(t)}),`Your MCP settings could not be saved.`)}var lv={kind:`repository`},uv=`repository`,dv=`plugin:`;function fv(e){switch(e.kind){case`repository`:return`Workspace (.mcp.json)`;case`global`:return`Your personal config (~/.po/mcp.json)`;case`plugin`:return`Plugin ${e.pluginName} (.mcp.json)`;case`upstream`:return`Upstream (mcp-config.yaml)`}}function pv(e){if(!e?.source)return;let t=fv(e.source);return e.owner===`read-only`?e.readOnlyReason?`${t}, read-only: ${e.readOnlyReason}`:`${t}, read-only.`:`${t}.`}function mv(e){return[lv,...(e??[]).filter(e=>e.kind===`plugin`)]}function hv(e){return e.kind===`repository`?`This workspace (.mcp.json)`:`Plugin ${e.pluginName} (.mcp.json)`}function gv(e){return e.kind===`repository`?uv:`${dv}${e.pluginId}`}function _v(e,t){return e.find(e=>gv(e)===t)}function vv(e){return e.owner===`plugin`&&e.source?.kind===`plugin`?{kind:`plugin`,pluginId:e.source.pluginId}:void 0}var yv=/^[A-Za-z0-9_-]+$/,bv=/key|token|secret/i;function xv(e){return e.toLowerCase()===`authorization`||bv.test(e)}function Sv(e){return e.kind===`repository`?Cv.repository:`Sessions that load the ${e.pluginName} plugin can use it after you add it. It's saved to that plugin's .mcp.json in this repository.`}var Cv={repository:`Sessions in this repository can use it after you add it. It's saved to .mcp.json in this repository.`,global:`Sessions in every repository can use it after you add it. It's saved to your personal config, ~/.po/mcp.json.`};function wv(e,t){let n=e.split(`
102
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.indexOf(t);return n>0?[e.slice(0,n).trim(),e.slice(n+1).trim()]:[e,``]});return n.length>0?Object.fromEntries(n):void 0}function Tv(e){try{let t=new URL(e).protocol;return t===`https:`||t===`http:`}catch{return!1}}function Ev({open:e,onOpenChange:n,onCloseAutoFocus:r,scope:i,targets:o,existingNames:s,onSubmit:l,pending:u=!1,error:d,defaultValues:m={}}){let _=i===`repository`?mv(o):[],[v,ee]=T(m.target??gv({kind:`repository`})),te=_v(_,v)??_[0],x=te?.kind===`plugin`?{kind:`plugin`,pluginId:te.pluginId}:void 0,[S,C]=T(m.kind??`remote`),[ue,de]=T(m.name??``),[fe,w]=T(m.url??``),[pe,me]=T(m.headers??``),[he,ge]=T(m.command??``),[_e,be]=T(m.args??``),[E,Se]=T(m.env??``),[Ce,we]=T(m.trusted??!1),[Te,Ee]=T(m.vault??{}),O=e=>Te[e]??xv(e),De=e=>Object.entries(e??{}).filter(([e,t])=>t!==``&&O(e)).map(([e])=>e),Oe=ue.trim(),ke=Oe===``?void 0:yv.test(Oe)?s.includes(Oe)?`A server named ${Oe} already exists here.`:void 0:`Use letters, numbers, dashes or underscores.`,Ae=fe.trim()!==``&&!Tv(fe.trim())?`Enter an http or https address.`:void 0,je=Oe!==``&&ke===void 0&&(S===`remote`?fe.trim()!==``&&Ae===void 0:he.trim()!==``&&Ce),Ne=()=>{if(je&&!u){if(S===`remote`){let e=wv(pe,`:`);l({name:Oe,entry:{type:`http`,url:fe.trim(),...e?{headers:e}:{}},trusted:!1,secretFields:De(e),...x?{target:x}:{}})}else{let e=wv(E,`=`);l({name:Oe,entry:{command:he.trim(),args:_e.split(`
103
+ `).map(e=>e.trim()).filter(Boolean),...e?{env:e}:{}},trusted:Ce,secretFields:De(e),...x?{target:x}:{}})}}};return D(le,{open:e,onOpenChange:n,children:k(b,{"data-testid":`mcp-add-server-dialog`,onCloseAutoFocus:r,children:[D(ne,{className:`items-start px-4 py-4 sm:px-5`,dismissible:!0,children:k(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[D(c,{children:`Add an MCP server`}),D(a,{children:te?Sv(te):Cv[i]})]})}),k(`form`,{onSubmit:e=>{e.preventDefault(),Ne()},children:[k(ze,{className:`gap-4 px-4 py-4 sm:px-5 sm:py-5`,children:[_.length>1?k(`div`,{className:`flex flex-col gap-1.5`,children:[D(t,{htmlFor:`mcp-add-target`,children:`Save to`}),k(f,{value:te?gv(te):v,onValueChange:ee,children:[D(oe,{id:`mcp-add-target`,"data-testid":`mcp-add-target`,children:D(g,{})}),D(ae,{children:_.map(e=>D(re,{value:gv(e),children:hv(e)},gv(e)))})]})]}):null,D(xe,{value:S,onValueChange:e=>C(e===`local`?`local`:`remote`),children:k(p,{"aria-label":`Server kind`,children:[D(h,{value:`remote`,children:`Remote (URL)`}),D(h,{value:`local`,children:`Local command`})]})}),k(`div`,{className:`flex flex-col gap-1.5`,children:[D(t,{htmlFor:`mcp-add-name`,children:`Name`}),D(ie,{id:`mcp-add-name`,className:`font-mono`,value:ue,placeholder:`linear`,"aria-invalid":ke!==void 0,"aria-describedby":`mcp-add-name-hint`,onChange:e=>de(e.target.value)}),D(`p`,{id:`mcp-add-name-hint`,className:`text-sm ${ke?`text-po-red`:`text-po-dim`}`,children:ke??(Oe?`Tools appear as ${Oe.replace(/[^A-Za-z0-9]/g,`_`)}_tool_name.`:`Tools appear with this name in front.`)})]}),S===`remote`?k(ce,{children:[k(`div`,{className:`flex flex-col gap-1.5`,children:[D(t,{htmlFor:`mcp-add-url`,children:`Server URL`}),D(ie,{id:`mcp-add-url`,type:`url`,className:`font-mono`,value:fe,placeholder:`https://mcp.example.com/mcp`,"aria-invalid":Ae!==void 0,onChange:e=>w(e.target.value)}),Ae?D(`p`,{className:`text-sm text-po-red`,children:Ae}):null]}),k(ye,{className:`flex flex-col gap-1.5`,defaultOpen:pe!==``,children:[D(se,{asChild:!0,children:k(A,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[D(Fe,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Headers (optional)`]})}),k(ve,{className:`flex flex-col gap-1.5`,children:[D(y,{"aria-label":`Headers`,className:`font-mono`,rows:3,value:pe,placeholder:`Authorization: Bearer ...`,onChange:e=>me(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One header per line, as Name: value.`}),D(Dv,{serverName:Oe,fields:Object.keys(wv(pe,`:`)??{}),keepsInVault:O,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),D(`p`,{className:`text-sm text-po-dim`,children:`If the server uses sign-in, you can authorize it right after adding.`})]}):k(ce,{children:[k(`div`,{className:`flex flex-col gap-1.5`,children:[D(t,{htmlFor:`mcp-add-command`,children:`Command`}),D(ie,{id:`mcp-add-command`,className:`font-mono`,value:he,placeholder:`npx`,onChange:e=>ge(e.target.value)})]}),k(`div`,{className:`flex flex-col gap-1.5`,children:[D(t,{htmlFor:`mcp-add-args`,children:`Arguments`}),D(y,{id:`mcp-add-args`,className:`font-mono`,rows:3,value:_e,placeholder:`-y
104
104
  @modelcontextprotocol/server-filesystem
105
- .`,onChange:e=>ge(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One argument per line, so paths with spaces stay whole.`})]}),O(C,{className:`flex flex-col gap-1.5`,defaultOpen:ve!==``,children:[D(ne,{asChild:!0,children:O(A,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[D(h,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Environment variables (optional)`]})}),O(s,{className:`flex flex-col gap-1.5`,children:[D(oe,{"aria-label":`Environment variables`,className:`font-mono`,rows:3,value:ve,placeholder:`API_KEY=...`,onChange:e=>ye(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One variable per line, as KEY=value.`}),D(Dv,{serverName:ke,fields:Object.keys(wv(ve,`=`)??{}),keepsInVault:De,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),O(`div`,{className:`flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3`,children:[D(`p`,{className:`text-base font-semibold text-po-hi`,children:`This runs on your machine`}),D(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Po starts this command with your user's permissions whenever a session uses it. Only add commands you trust.`}),O(`div`,{className:`flex items-center gap-2`,children:[D(_e,{id:`mcp-add-trust`,checked:be,onCheckedChange:e=>Se(e===!0)}),D(Fe,{htmlFor:`mcp-add-trust`,children:`I trust this command`})]})]})]}),m?D(`p`,{role:`alert`,className:`text-sm text-po-red`,children:m}):null]}),O(ie,{className:`border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[D(A,{type:`button`,variant:`ghost`,size:`md`,onClick:()=>n(!1),children:`Cancel`}),D(A,{type:`submit`,variant:`primary`,size:`md`,disabled:!Me||d,children:d?`Adding...`:`Add server`})]})]})]})})}function Dv({serverName:e,fields:t,keepsInVault:n,onChange:r}){if(t.length===0)return null;let i=(t.find(n)??t[0]??``).replace(/[^A-Za-z0-9._-]/g,`_`),a=`\${vault:${e||`server`}-${i}}`;return O(`div`,{className:`flex flex-col gap-1.5`,children:[D(`ul`,{"aria-label":`Keep in vault`,className:`flex flex-col divide-y divide-po-border-soft rounded-md border border-po-border-soft`,children:t.map((e,t)=>{let i=`mcp-add-vault-${t}`;return O(`li`,{className:`flex min-w-0 items-center gap-2 px-3 py-1.5`,children:[D(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e}),D(_e,{id:i,checked:n(e),onCheckedChange:t=>r(e,t===!0)}),D(Fe,{htmlFor:i,children:`Keep in vault`})]},e)})}),O(`p`,{className:`text-sm text-po-dim`,children:[`Kept values stay in Po's vault on this machine. The config only gets a reference, such as`,` `,D(`span`,{className:`font-mono`,children:a}),`.`]})]})}function Ov({scope:e,repositoryId:t,targets:n,existingNames:r,requestWithStepUp:i,disabled:a=!1,onAdded:o,renderTrigger:s,onCloseAutoFocus:c}){let l=pe(null),[u,d]=k(!1),[f,p]=k(!1),[m,h]=k(),g=()=>{a||(h(void 0),d(!0))};return O(he,{children:[s?s(g):D(A,{ref:l,variant:`outline`,size:`sm`,disabled:a,"data-testid":`mcp-add-server`,onClick:g,children:`Add server`}),u?D(Ev,{open:!0,onOpenChange:e=>{f||d(e)},onCloseAutoFocus:c??(e=>{e.preventDefault(),l.current?.focus()}),scope:e,targets:n,existingNames:r,pending:f,error:m,onSubmit:({name:n,entry:r,trusted:a,secretFields:s,target:c})=>{p(!0),h(void 0),iv(i,{scope:e,...t?{repositoryId:t}:{},...e===`repository`&&c?{target:c}:{},name:n,entry:r,trusted:a,...s.length>0?{secretFields:s}:{}}).then(e=>{p(!1),`error`in e?h(e.error):(d(!1),o(n))})}}):null]})}function kv({action:e,name:t,management:n,pending:r,error:a,onClose:o,onCloseAutoFocus:s,onSubmit:c}){let l=Me(),[d,p]=k(``),[m,h]=k(!1),[g,_]=k(),v=n.kind===`local`;return D(i,{open:!0,onOpenChange:e=>{!e&&!r&&o()},children:O(Te,{onCloseAutoFocus:s,children:[D(re,{children:O(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[O(ae,{children:[e===`edit`?`Edit`:`Remove`,` `,t]}),D(u,{children:e===`edit`?`Update headers or environment only. Existing values are retained unless overwritten. Values cannot be deleted here. Saved OAuth credentials are retained.`:`Remove this saved definition? Live connections and credentials are retained. A lower-priority definition may appear. This does not reconnect any session.`})]})}),O(f,{className:`space-y-4`,children:[O(`p`,{className:`break-all text-sm text-po-dim`,children:[n.source?fv(n.source):n.owner,` ·`,` `,v?`Local command`:`Remote`,` · `,n.target]}),e===`edit`?O(he,{children:[D(`p`,{className:`text-sm text-po-dim`,children:`Name, endpoint, transport, command and arguments are fixed. Updates are saved directly in the configuration file, not the vault. Existing values are not shown. Do not enter redacted placeholders or vault references.`}),O(`div`,{className:`space-y-2`,children:[O(Fe,{htmlFor:l,children:[v?`Environment updates`:`Header updates`,` (one NAME=value per line)`]}),D(oe,{id:l,className:`min-h-24 w-full`,value:d,disabled:r,onChange:e=>p(e.target.value),autoComplete:`off`})]}),v?O(Fe,{className:`flex items-center gap-2`,children:[D(_e,{checked:m,disabled:r,onCheckedChange:e=>h(e===!0)}),`I trust this command to run with my permissions.`]}):null]}):null,a||g?D(`p`,{role:`alert`,className:`text-sm text-po-red`,children:a??g}):null]}),O(ie,{className:`border-t border-po-border-soft px-4 py-3`,children:[D(A,{variant:`ghost`,disabled:r,onClick:o,children:`Cancel`}),D(A,{variant:e===`remove`?`danger`:`primary`,loading:r,disabled:r||e===`edit`&&(!d.trim()||v&&!m),onClick:()=>{let e=[];for(let t of d.split(`
106
- `).filter(e=>e.trim())){let n=t.indexOf(`=`);if(n<1||!t.slice(0,n).trim()||t.includes("${vault:")){_(`Use NAME=value on each line. Vault references cannot be edited here.`);return}e.push([t.slice(0,n).trim(),t.slice(n+1)])}_(void 0),c(Object.fromEntries(e),m)},children:e===`edit`?`Save updates`:`Remove saved definition`})]})]})})}function Av({name:e,management:t,repositoryId:n,requestWithStepUp:r,disabled:i,onChanged:a,onAuthorize:o,authorizeDisabled:s}){let c=pe(null),[l,u]=k(),[d,f]=k(),[p,m]=k(!1),[h,g]=k(),_=t&&t.owner!==`read-only`&&t.revision,v=!!(_&&t.canEdit&&t.target&&t.kind),y=!!(_&&t.canRemove);return O(he,{children:[O(de,{children:[D(be,{asChild:!0,children:D(A,{ref:c,variant:`ghost`,size:`icon`,"aria-label":`Actions for ${e}`,disabled:i||p,children:D(ce,{"aria-hidden":!0,className:`size-4`})})}),O(Ae,{align:`end`,children:[o?D(Ce,{disabled:i||s,onSelect:o,children:`Authorize`}):null,D(Ce,{disabled:!v,onSelect:()=>{g(void 0),v&&t&&(f({...t,name:e,repositoryId:n}),u(`edit`))},children:`Edit`}),D(Oe,{}),D(Ce,{disabled:!y,onSelect:()=>{g(void 0),y&&t&&(f({...t,name:e,repositoryId:n}),u(`remove`))},children:`Remove`})]})]}),l&&d?D(kv,{action:l,name:d.name,management:d,pending:p,error:h,onClose:()=>u(void 0),onCloseAutoFocus:e=>{e.preventDefault(),c.current?.focus()},onSubmit:async(t,i)=>{if(d.name!==e||d.repositoryId!==n)g(`The selected repository or server changed. Close this dialog and try again.`);else if(!(p||!d.revision||d.owner===`read-only`||(l===`edit`?!v:!y))){m(!0),g(void 0);try{let o=vv(d),s=await av(r,l,{scope:d.owner===`global`?`global`:`repository`,repositoryId:n,...o?{target:o}:{},name:e,revision:d.revision,...l===`edit`?{trusted:i,entry:d.kind===`local`?{command:d.target,env:t}:{type:`http`,url:d.target,headers:t}}:{}});if(`error`in s){g(s.error);return}u(void 0);let c=s.value;a(`${l===`remove`?`Saved definition removed.`:`Saved definition updated.`} Live connections and credentials retained.${c.syncRequired?` Run po sync, then refresh.`:``} ${c.shadowedDefinition===`present`?`A lower-priority definition is now visible.`:c.shadowedDefinition===`possible`?`A lower-priority definition may appear.`:`No lower-priority definition was reported.`}`,l===`remove`)}catch(e){g(e instanceof Error?e.message:`The saved definition could not be changed.`)}finally{m(!1)}}}}):null]})}var jv=`mcp-auto-approve`,Mv=`mcp-auto-approve-help`;function Nv({checked:t,busy:n,error:r,onCheckedChange:i,onRetry:a}){return O(y,{"data-testid":`mcp-approval-settings`,children:[D(fe,{children:D(je,{children:`Approval`})}),D(e,{children:`Po asks before running an MCP tool that could change your data. Tools a server marks read-only always run straight away.`}),D(x,{children:O(l,{changed:t,children:[O(w,{children:[D(E,{children:D(`label`,{htmlFor:jv,children:`Run tools that change data without asking`})}),D(T,{id:Mv,children:t?`On for every session, including ones already open. Turn it off to be asked again.`:`Applies to every session at once. Subagents and background work never ask.`}),r?D(T,{role:`alert`,className:`text-po-red`,children:r}):null]}),r&&a?D(A,{variant:`outline`,size:`sm`,onClick:a,children:`Try again`}):null,D(le,{id:jv,"data-testid":`mcp-auto-approve-switch`,"aria-describedby":Mv,checked:t,disabled:n,"aria-busy":n||void 0,onCheckedChange:i})]})})]})}function Pv({request:e,requestWithStepUp:t}){let[n,r]=k({status:`loading`}),i=De(async()=>{let t=await sv(e);r(`error`in t?{status:`load-failed`}:{status:`ready`,checked:t.value.autoApproveDestructiveTools})},[e]);ye(()=>{i()},[i]);let a=De(async(e,n)=>{r({status:`ready`,checked:e,saving:!0});let i=await cv(t,{autoApproveDestructiveTools:e});r(`error`in i?{status:`ready`,checked:n,failedTarget:e}:{status:`ready`,checked:i.value.autoApproveDestructiveTools})},[t]);if(n.status!==`ready`)return D(Nv,{checked:!1,busy:!0,error:n.status===`load-failed`?`Po couldn't read this setting just now.`:void 0,onRetry:()=>void i()});let{checked:o,saving:s,failedTarget:c}=n;return D(Nv,{checked:o,busy:s,error:c===void 0?void 0:c?`Po couldn't save this just now, so sessions still ask first.`:`Po couldn't save this just now, so sessions still run these tools without asking.`,onCheckedChange:e=>void a(e,o),onRetry:c===void 0?void 0:()=>void a(c,o)})}function Fv({request:e,requestWithStepUp:t}){let n=pe(null),[r,i]=k(),[o,s]=k({status:`loading`}),c=De(async()=>{let t=await ov(e);s(`error`in t?{status:`error`,error:t.error}:{status:`ready`,servers:t.value.servers})},[e]);ye(()=>{c()},[c]);let u=o.status===`ready`?o.servers:[];return O(y,{ref:n,tabIndex:-1,"data-testid":`mcp-global-settings`,children:[O(fe,{children:[D(je,{children:`Servers`}),D(a,{children:D(Ov,{scope:`global`,existingNames:u.map(e=>e.name),requestWithStepUp:t,disabled:o.status===`loading`,onAdded:()=>void c()})})]}),r?D(`output`,{className:`text-sm text-po-dim`,children:r}):null,D(x,{asChild:!0,children:D(`ul`,{children:o.status===`error`?D(l,{asChild:!0,role:`alert`,children:O(`li`,{children:[O(w,{children:[D(E,{children:`Po couldn't read your servers just now`}),D(T,{children:o.error})]}),D(A,{variant:`outline`,size:`sm`,onClick:()=>void c(),children:`Try again`})]})}):u.length===0?D(l,{asChild:!0,children:D(`li`,{children:O(w,{children:[D(E,{children:o.status===`loading`?`Reading your servers`:`No servers yet`}),D(T,{children:o.status===`loading`?`This takes a moment.`:`Servers you add here are available in every repository.`})]})})}):u.map(e=>D(l,{asChild:!0,children:O(`li`,{"data-testid":`mcp-global-server-${e.name}`,children:[O(w,{children:[D(E,{className:`font-mono first-letter:normal-case`,children:e.name}),O(T,{className:`truncate`,children:[e.kind===`remote`?`Remote`:`Local command`,` · `,e.target]})]}),D(Av,{name:e.name,management:e.management,requestWithStepUp:t,onChanged:(e,t)=>{i(e),c().then(()=>{t&&n.current?.focus()})}})]})},e.name))})})]})}function Iv(e){return O(`div`,{className:`flex flex-col gap-8`,children:[D(Pv,{...e}),D(Fv,{...e})]})}var Lv=v({label:`MCP servers`,detail:`Your own MCP servers, available in every repository. A repository server with the same name wins.`,icon:te,component:Iv}),Rv=new ke({repositoryId:void 0,catalog:void 0,authorization:void 0,busy:void 0,error:void 0});function zv(e){Rv.state.repositoryId!==e&&Rv.setState(()=>({repositoryId:e,catalog:void 0,authorization:void 0,busy:void 0,error:void 0}))}function Bv(e,t){Rv.state.repositoryId===e&&Rv.setState(t)}async function Vv(e,t){zv(t),Rv.setState(e=>({...e,busy:`loading`,error:void 0}));try{let n=await $_(e,t);Bv(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function Hv(e,t){zv(t),Rv.setState(e=>({...e,busy:`discovering`,error:void 0}));try{let n=await ev(e,t);Bv(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function Uv(e,t,n){zv(t),Rv.setState(e=>({...e,busy:`authorizing`,error:void 0}));try{let r=await tv(e,t,n);Bv(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}function Wv(e,t,n,r){let i=!1,a,o=async()=>{if(!i)try{let s=await nv(e,t,n);if(i)return;if(`error`in s){Bv(t,e=>({...e,error:s.error}));return}if(Bv(t,e=>({...e,authorization:s.value,error:void 0})),s.value.status===`completed`){r();return}if([`failed`,`cancelled`,`expired`].includes(s.value.status))return;a=setTimeout(()=>void o(),1e3)}catch{Bv(t,e=>({...e,error:`The authorization status could not be refreshed.`}))}};return o(),()=>{i=!0,a&&clearTimeout(a)}}async function Gv(e,t,n){Rv.setState(e=>({...e,busy:`cancelling`,error:void 0}));try{let r=await rv(e,t,n);Bv(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}var Kv=new Set([`completed`,`failed`,`cancelled`,`expired`]),qv={"never-synced":`this repository has never been synced`,"configuration-changed":`the configuration changed since the last sync`,"cockpit-bundle-missing":`the cockpit bundle is missing`,"package-apis-missing":`package APIs are missing`},Jv={"not-connected":`Not connected`,connecting:`Connecting`,connected:`Connected`,degraded:`Degraded`,"needs-auth":`Needs sign-in`,failed:`Failed`,closed:`Closed`},Yv={starting:`Starting sign-in.`,waiting:`Waiting for you to finish signing in.`,completed:`Signed in.`,failed:`Sign-in didn't finish.`,cancelled:`Sign-in was cancelled.`,expired:`Sign-in expired before it finished.`};function Xv(e){return`${e.map(e=>qv[e]??e).join(`, `)||`the last sync is out of date`}. Run po sync, then refresh.`}function Zv({server:e,busy:t,canAct:n,confirming:r,onAuthorize:i,repositoryId:o,requestWithStepUp:s,onChanged:c,onConfirm:u,onCancel:d}){let f=e.tools.length,p=pv(e.management);return D(l,{asChild:!0,className:`items-start`,children:O(`li`,{"data-testid":`mcp-server-${e.name}`,children:[O(w,{children:[D(E,{className:`font-mono first-letter:normal-case`,children:e.name}),O(T,{children:[Jv[e.state],`. `,e.credentialPresent?`Credential saved.`:`No credential saved.`]}),p===void 0?null:D(T,{"data-testid":`mcp-server-source-${e.name}`,children:p}),e.error===void 0?null:D(T,{className:`text-po-red`,children:e.error})]}),r?null:D(Av,{name:e.name,management:e.management,repositoryId:o,requestWithStepUp:s,disabled:t,onChanged:c,onAuthorize:i,authorizeDisabled:!n}),r?O(`div`,{className:`flex basis-full flex-wrap items-center gap-x-4 gap-y-2 rounded-md bg-po-bg px-4 py-3`,children:[O(`span`,{className:`min-w-0 flex-1 text-base leading-relaxed text-po-text`,children:[`Start a short OAuth sign-in for `,e.name,`? A passkey may be required.`]}),O(a,{children:[D(A,{variant:`primary`,size:`sm`,disabled:t,onClick:u,children:`Continue`}),D(A,{variant:`ghost`,size:`sm`,onClick:d,children:`Cancel`})]})]}):null,O(`details`,{className:`group basis-full`,children:[O(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1 text-base font-medium text-po-text hover:text-po-hi [&::-webkit-details-marker]:hidden`,children:[D(h,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-90`}),f===1?`1 tool`:`${String(f)} tools`,`, `,e.source]}),D(`ul`,{className:`mt-3 flex flex-col gap-1.5 border-l border-po-border-soft pl-4`,children:f===0?D(`li`,{className:`text-sm text-po-dim`,children:`Run discovery to see what this server offers.`}):e.tools.map(e=>O(`li`,{className:`flex min-w-0 items-baseline gap-3 text-base`,children:[D(`code`,{title:e.piName,className:`min-w-0 shrink-0 truncate font-mono text-po-hi`,children:e.piName}),D(`span`,{className:`min-w-0 truncate text-po-dim`,children:e.description??``})]},e.piName))})]})]})})}function Qv({repository:e,request:t,requestWithStepUp:n}){let r=Ee(Rv),[i,o]=k(),s=pe(null),[c,u]=k(!1),[f,p]=k(),m=e?.id;ye(()=>{u(!1),p(void 0),o(void 0),m&&Vv(t,m)},[m,t]);let h=r.repositoryId===m?r.authorization:void 0,g=h?.id,_=h?.status;if(ye(()=>{if(m&&g!==void 0&&!(_!==void 0&&Kv.has(_)))return Wv(t,m,g,()=>{Vv(t,m)})},[g,_,m,t]),!e)return D(x,{"data-testid":`mcp-repository-settings`,children:D(l,{children:O(w,{children:[D(E,{children:`No repository picked`}),D(T,{children:`Pick a repository above to see its MCP servers.`})]})})});let v=r.repositoryId===e.id?r.catalog:void 0,b=r.repositoryId===e.id?r.busy:void 0,ee=r.repositoryId===e.id?r.error:void 0,te=v?.sync.fresh===!0,ne=v?.servers??[],S=v?.droppedServers??[];return O(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`mcp-repository-settings`,children:[O(y,{children:[D(fe,{children:D(je,{children:`Catalog`})}),O(x,{children:[O(l,{children:[O(w,{children:[D(E,{children:te?`Up to date`:v?`Needs a sync`:`Reading the catalog`}),D(T,{children:te?`Po reads the cached catalog on this machine. Discovery contacts each configured server.`:v?Xv(v.sync.reasons):`Reading what the last sync recorded.`})]}),D(Ov,{scope:`repository`,repositoryId:e.id,targets:v?.targets,existingNames:ne.map(e=>e.name),requestWithStepUp:n,disabled:b!==void 0,onAdded:()=>void Vv(t,e.id),onCloseAutoFocus:e=>{e.preventDefault(),s.current?.focus()},renderTrigger:n=>O(de,{children:[D(be,{asChild:!0,children:D(A,{ref:s,variant:`ghost`,size:`icon`,"aria-label":`Catalog actions`,title:`Catalog actions`,disabled:b!==void 0,children:D(ce,{"aria-hidden":!0,className:`size-4`})})}),O(Ae,{align:`end`,children:[D(Ce,{disabled:b!==void 0,onSelect:()=>void Vv(t,e.id),children:`Refresh`}),D(Ce,{disabled:b!==void 0||!te||c,onSelect:()=>u(!0),children:`Discover servers`}),D(Ce,{disabled:b!==void 0,onSelect:n,children:`Add server`})]})]})})]}),c?O(l,{children:[O(w,{children:[D(E,{children:`Discover servers now?`}),D(T,{children:`Discovery starts the configured processes and contacts remote MCP servers.`})]}),O(a,{children:[D(A,{variant:`primary`,size:`sm`,disabled:b!==void 0,onClick:()=>{u(!1),Hv(n,e.id)},children:`Discover`}),D(A,{variant:`ghost`,size:`sm`,onClick:()=>u(!1),children:`Cancel`})]})]}):null,ee===void 0?null:O(l,{role:`alert`,children:[O(w,{children:[D(E,{children:`Po couldn't finish that just now`}),D(T,{children:ee})]}),D(A,{variant:`outline`,size:`sm`,disabled:b!==void 0,onClick:()=>void Vv(t,e.id),children:`Try again`})]})]})]}),h?O(y,{children:[D(fe,{children:D(je,{children:`Sign-in`})}),D(x,{children:O(l,{children:[O(w,{children:[D(E,{className:`font-mono first-letter:normal-case`,children:h.serverName}),D(T,{children:Yv[h.status]}),h.error?D(T,{className:`text-po-red`,children:h.error}):null]}),O(a,{children:[h.authorizationUrl?D(A,{variant:`primary`,size:`sm`,asChild:!0,children:O(`a`,{href:h.authorizationUrl,target:`_blank`,rel:`noreferrer noopener`,children:[`Open sign-in page`,D(me,{"aria-hidden":!0,className:`size-3.5`})]})}):null,Kv.has(h.status)?null:D(A,{variant:`ghost`,size:`sm`,loading:b===`cancelling`,disabled:b!==void 0,onClick:()=>void Gv(n,e.id,h.id),children:`Cancel`})]})]})})]}):null,O(y,{children:[i?D(`output`,{className:`text-sm text-po-dim`,children:i}):null,O(fe,{children:[D(je,{children:`Servers`}),ne.length===0?null:D(`span`,{className:`text-sm text-po-dim`,children:ne.length===1?`1 server`:`${String(ne.length)} servers`})]}),D(x,{asChild:!0,children:D(`ul`,{children:ne.length===0?D(l,{asChild:!0,children:D(`li`,{children:O(w,{children:[D(E,{children:b===`loading`?`Reading the catalog`:`No servers yet`}),D(T,{children:b===`loading`?`This takes a moment.`:`None are enabled in this repository's last sync.`})]})})}):ne.map(r=>D(Zv,{server:r,repositoryId:e.id,requestWithStepUp:n,onChanged:(n,r)=>{o(n),Vv(t,e.id).then(()=>{r&&s.current?.focus()})},busy:b!==void 0,canAct:te,confirming:f===r.name,onAuthorize:()=>p(r.name),onConfirm:()=>{p(void 0),Uv(n,e.id,r.name)},onCancel:()=>p(void 0)},r.name))})}),S.length===0?null:D(d,{children:`Left out by policy: ${S.join(`, `)}.`}),v?.diagnostics.map(e=>D(d,{className:`text-po-red`,children:e},e))]})]})}var $v=ge({label:`MCP servers`,detail:`The MCP servers this repository's sessions can use, what each one offers, and where to sign in.`,order:100,component:Qv});function ey(e,t,n){e(t,{type:`prompt`,message:`/mcp auth ${n}`})}function ty(e,t,n){e(t,{type:`prompt`,message:`/mcp disconnect ${n}`})}function ny(e,t,n){e(t,{type:`prompt`,message:`/mcp unauthorize ${n}`})}function ry(e,t,n){e(t,{type:`prompt`,message:`/mcp approve ${n?`on`:`off`}`})}async function iy(e,t){let n=await Y_.session(e).sessionSecret({body:t});return n.ok?{ok:!0}:n.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:n.error===``?`Po could not save that secret.`:n.error}}function ay({server:e,name:t,disabled:n=!1,pending:r=!1,error:i,onSubmit:a}){let[o,s]=k(``),c=`mcp-secret-${e}-${t}`,l=`${c}-hint`;return O(`form`,{"data-testid":`context-mcp-secret-${e}-${t}`,className:`flex flex-col gap-1.5 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-2.5 py-2`,onSubmit:e=>{e.preventDefault(),!(o===``||n||r)&&(a(o),s(``))},children:[O(`label`,{htmlFor:c,className:`text-sm text-po-text`,children:[D(`span`,{className:`font-semibold text-po-magenta`,children:`Needs secret`}),` `,D(`span`,{className:`font-mono text-po-hi`,children:t})]}),O(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D(Re,{id:c,type:`password`,size:`xs`,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1`,value:o,placeholder:`Paste the value`,"aria-describedby":l,"aria-invalid":i!==void 0,disabled:n||r,onChange:e=>s(e.target.value)}),D(A,{type:`submit`,variant:`outline`,size:`xs`,disabled:o===``||n||r,children:r?`saving...`:`save`})]}),D(`p`,{id:l,className:`text-sm ${i?`text-po-red`:`text-po-dim`}`,children:i??`Po keeps it in the vault, never shows it again, and reconnects ${e}.`})]})}var oy=`mcp-session-auto-approve`,sy=`mcp-session-auto-approve-help`;function cy({status:e,disabled:t,onCheckedChange:n}){return D(`section`,{"data-testid":`context-mcp-approval`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:O(`div`,{className:`flex min-w-0 items-start gap-3 px-1`,children:[O(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[D(`label`,{htmlFor:oy,className:`text-sm font-semibold text-po-hi`,children:`Run tools that change data without asking`}),D(`p`,{id:sy,className:`text-sm leading-relaxed text-po-dim`,children:e.global?`On for every session in MCP settings. Turn it off there to be asked again.`:e.session?`This session only. It asks again after a restart.`:`Po asks before each one, here and on Home. Read-only tools run straight away.`})]}),D(le,{id:oy,"data-testid":`context-mcp-approval-switch`,"aria-describedby":sy,checked:e.global||e.session,disabled:t||e.global,onCheckedChange:n})]})})}async function ly(e,t,n){let r=await Y_.session(e).sessionTool({query:{[E_]:t,[D_]:n}});return r.ok?{ok:!0,detail:r.data}:r.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:r.error===``?`The session answered ${r.status}.`:r.error}}function uy(e){return`${e.sessionId}\u0000${e.server}\u0000${e.tool}`}function dy({target:e,onClose:t}){let[n,r]=k(null);ye(()=>{if(e===null)return;let t=!0,n=uy(e);return ly(e.sessionId,e.server,e.tool).then(e=>{t&&r(e.ok?{key:n,detail:e.detail}:{key:n,error:e.error})}),()=>{t=!1}},[e]);let a=e!==null&&n?.key===uy(e)?n:null,o=a?.detail;return D(i,{open:e!==null,onOpenChange:e=>{e||t()},children:O(Te,{"data-testid":`mcp-tool-detail-dialog`,children:[D(re,{className:`items-start px-4 py-4 sm:px-5`,children:O(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[D(ae,{className:`break-words leading-snug`,children:o?.piName??e?.piName??(e===null?``:`${e.server} · ${e.tool}`)}),O(u,{children:[e===null?``:`${e.server} / ${e.tool}. `,e?.inContext===!1?`Not in the model context. `:``,o===void 0?`Description and complete input schema.`:`Estimated schema cost: ~${o.tokens.toLocaleString()} tokens.`]})]})}),O(f,{className:`flex flex-col gap-3 px-4 py-4 sm:px-5 sm:py-5`,children:[a===null?D(`output`,{className:`text-sm text-po-dim`,children:`Loading the tool...`}):null,a?.error===void 0?null:D(`output`,{className:`text-sm text-po-dim`,children:a.error}),o===void 0?null:O(he,{children:[O(`section`,{className:`flex flex-col gap-1`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`description`}),D(`p`,{className:`whitespace-pre-wrap text-base text-po-text`,children:o.description??`No description.`})]}),o.warnings?.length?D(`section`,{"aria-label":`Tool warnings`,className:`flex flex-col gap-1 text-base text-po-yellow`,children:o.warnings.map(e=>O(`p`,{children:[e.source,` `,e.path,`: `,e.message]},`${e.source}:${e.path}:${e.message}`))}):null,O(`section`,{className:`flex min-h-0 flex-col gap-1`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`input schema`}),D(`pre`,{"data-testid":`mcp-tool-detail-schema`,className:`max-h-96 overflow-auto rounded border border-po-border-soft p-2 font-mono text-sm text-po-text`,children:JSON.stringify(o.inputSchema,null,2)})]})]})]})]})})}function fy(e,t,n){return`${e}\u0000${t}\u0000${n}`}function py(e){return e===null?`-`:`~${e.toLocaleString()}`}function my({sessionId:e,statuses:t,sendSessionFrame:n,contextInventory:r=[]}){let a=k_(t[`po-mcp-session-auth`])??[],o=h_(t[m_]),[s,c]=k(null),[l,d]=k(null),p=pe(null),[m,h]=k(``),[g,v]=k(!1),[y,b]=k(null),[ee,te]=k({}),x=pe(null),ne=pe(void 0),S=s?.sessionId===e?s:null,C=a.find(e=>e.name===S?.name),w=C?.authorizationUrl,T=l?.sessionId===e?a.find(e=>e.name===l.name):void 0,E=()=>{x.current?.close(),x.current=null};ye(()=>{let e=x.current;S&&w&&e&&!e.closed&&(e.location.replace(w),x.current=null)},[S,w]),ye(()=>()=>{x.current?.close(),x.current=null},[e]),ye(()=>{let e=C?.state;e!==ne.current&&(ne.current=e,(e===`failed`||e===`closed`||e===`connected`)&&(x.current?.close(),x.current=null))},[C?.state]);let oe=t=>{if(e===null)return;let r=a.find(e=>e.name===t);if(ne.current=r?.state,!r||r.state===`disabled`||!(r.oauthEligible||r.state===`needs-auth`||r.authorizationUrl))return;E(),c({sessionId:e,name:t}),h(``);let i=window.open(`about:blank`,`_blank`);v(i===null),i&&(i.opener=null,r?.authorizationUrl?i.location.replace(r.authorizationUrl):(i.document.title=`MCP authorization`,i.document.body.textContent=`Preparing authorization. Return to Po for progress or manual sign-in.`,x.current=i)),!r?.authorizationUrl&&r?.state!==`connecting`&&ey(n,e,t)},se=(t,n,r)=>{if(e===null)return;let i=fy(e,t,n);te(e=>({...e,[i]:{pending:!0}})),iy(e,{server:t,name:n,value:r}).then(e=>{te(t=>({...t,[i]:e.ok?{pending:!1}:{pending:!1,error:e.error}}))})},le=async()=>{if(w)try{await navigator.clipboard.writeText(w),h(`Link copied.`)}catch{h(`Clipboard unavailable. Select the link above and copy it manually.`)}};return O(he,{children:[a.length===0?null:O(`section`,{"data-testid":`context-mcp-auth`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:[O(`div`,{className:`flex flex-col gap-0.5`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`MCP servers`}),D(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Open sign-in in a new tab, or copy the link from the authorization dialog.`})]}),D(`ul`,{"aria-label":`MCP servers`,className:`flex flex-col gap-2`,children:a.map(t=>{let i=r.filter(e=>e.source===`mcp`&&e.owner===t.name),a=t.tools??[],o=t.missingSecrets??[],s=o.length>0&&t.state!==`connected`;return O(`li`,{className:`flex min-w-0 flex-col gap-1 px-1 py-0.5`,children:[O(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:t.name}),s?D(`span`,{className:`text-sm font-semibold text-po-magenta`,children:`needs secret`}):D(`span`,{className:`text-sm font-semibold text-po-dim`,children:t.state.replace(/-/g,` `)}),t.oauthAuthorized===!0&&t.state===`connected`?O(`span`,{className:`flex items-center gap-1 text-sm text-po-green`,children:[D(_,{"aria-hidden":!0,className:`size-4`}),` Authorized`]}):null,!s&&t.state===`needs-auth`?D(A,{variant:`subtle`,size:`xs`,"aria-label":`Authorize ${t.name}`,disabled:e===null,onFocus:e=>{p.current=e.currentTarget},onClick:()=>oe(t.name),children:`Authorize`}):null,s?null:O(de,{children:[D(be,{asChild:!0,children:D(A,{variant:`ghost`,size:`icon`,"aria-label":`Actions for ${t.name}`,disabled:e===null||t.state===`disabled`,onPointerDownCapture:e=>{p.current=e.currentTarget},onFocus:e=>{p.current=e.currentTarget},children:D(ce,{"aria-hidden":!0,className:`size-4`})})}),O(Ae,{align:`end`,children:[t.oauthEligible||t.state===`needs-auth`||t.authorizationUrl?D(Ce,{onSelect:()=>oe(t.name),children:t.oauthAuthorized?`Reauthorize`:`Authorize`}):null,t.oauthEligible&&t.oauthAuthorized?D(Ce,{onSelect:()=>{e!==null&&d({sessionId:e,name:t.name})},children:`Unauthorize`}):null,t.state===`connected`?D(Ce,{onSelect:()=>{e!==null&&ty(n,e,t.name)},children:`Disconnect`}):null,!(t.oauthEligible||t.state===`needs-auth`||t.authorizationUrl)&&t.state!==`connected`?D(Ce,{disabled:!0,children:`Authorization unavailable`}):null]})]})]}),(s?o:[]).map(n=>{let r=e===null?void 0:ee[fy(e,t.name,n)];return D(ay,{server:t.name,name:n,disabled:e===null,pending:r?.pending??!1,...r?.error?{error:r.error}:{},onSubmit:e=>se(t.name,n,e)},n)}),i.length>0?D(`ul`,{"aria-label":`${t.name} tools and skills`,className:`flex flex-col`,children:i.map(n=>{let r=a.find(e=>e.piName===n.name);return O(`li`,{"data-active":n.active,className:`flex min-w-0 items-center gap-2 py-px pl-3`,children:[D(`abbr`,{title:n.itemKind,className:`w-3 shrink-0 text-2xs font-semibold no-underline ${n.active?`text-po-violet`:`text-po-dim`}`,children:n.itemKind===`skill`?`S`:`T`}),n.itemKind===`tool`?D(A,{variant:`ghost`,size:`card`,"aria-label":`Open schema for ${n.name}`,"data-testid":`context-mcp-tool-${n.name}`,disabled:e===null||r===void 0,onClick:()=>{e!==null&&r!==void 0&&b({sessionId:e,server:t.name,tool:r.name,piName:r.piName,inContext:n.active})},className:`min-w-0 flex-1 truncate rounded-none py-0 text-left text-base ${n.active?`text-po-hi`:`text-po-dim`}`,children:n.name}):D(`span`,{className:`min-w-0 flex-1 truncate text-base text-po-dim`,children:n.name}),D(`span`,{className:`w-14 shrink-0 text-right text-sm ${n.active?`text-po-text`:`text-po-dim`}`,children:n.active?py(n.tokens):`(${py(n.tokens)})`})]},`${n.itemKind}:${n.name}`)})}):a.length>0?O(`div`,{className:`flex flex-col`,children:[D(`p`,{className:`pl-3 text-sm text-po-dim`,children:`${a.length} available ${a.length===1?`tool`:`tools`}, not in context`}),D(`ul`,{"aria-label":`${t.name} reachable tools`,className:`flex flex-col`,children:a.map(n=>D(`li`,{className:`flex min-w-0`,children:O(A,{variant:`ghost`,size:`card`,"data-testid":`context-mcp-reachable-${t.name}-${n.name}`,title:`open the tool's description and schema`,disabled:e===null,onClick:()=>{e!==null&&b({sessionId:e,server:t.name,tool:n.name,piName:n.piName,inContext:!1})},className:`min-w-0 flex-1 flex-row items-center gap-2 rounded-none py-px pr-0 pl-3`,children:[D(`abbr`,{title:`tool`,className:`w-3 shrink-0 text-2xs font-semibold text-po-violet no-underline`,children:`T`}),D(`span`,{className:`min-w-0 flex-1 truncate text-left text-base text-po-text`,children:n.piName??n.name}),D(`span`,{title:`what the schema would cost if added to context directly`,className:`w-14 shrink-0 text-right text-sm text-po-dim`,children:n.tokens===void 0?`(-)`:`(~${n.tokens.toLocaleString()})`})]})},n.name))})]}):s?null:D(`p`,{className:`pl-3 text-sm text-po-dim`,children:`no tools or skills reported`})]},t.name)})})]}),a.length===0||o===void 0?null:D(cy,{status:o,disabled:e===null,onCheckedChange:t=>{e!==null&&ry(n,e,t)}}),D(dy,{target:y,onClose:()=>b(null)}),D(i,{open:T!==void 0,onOpenChange:e=>{e||d(null)},children:O(Te,{onCloseAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[D(re,{dismissible:!0,children:O(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[O(ae,{children:[`Unauthorize `,l?.name,`?`]}),D(u,{children:`Disconnect this session and clear the saved authorization. The server stays configured.`})]})}),D(f,{children:D(`p`,{className:`text-base leading-relaxed text-po-dim`,children:`The saved credential is shared. Other sessions stay connected, but may need to sign in again when they reconnect. This does not revoke access at the provider.`})}),O(ie,{className:`border-t border-po-border-soft px-4 py-3`,children:[D(A,{variant:`ghost`,onClick:()=>d(null),children:`Cancel`}),D(A,{variant:`danger`,disabled:!T?.oauthEligible,onClick:()=>{l&&T?.oauthEligible&&l.sessionId===e&&(ny(n,l.sessionId,l.name),d(null))},children:`Unauthorize`})]})]})}),D(i,{open:S!==null,onOpenChange:e=>{e||(E(),c(null))},children:O(Te,{"data-testid":`mcp-authorization-dialog`,onInteractOutside:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[D(re,{className:`items-start px-4 py-4 sm:px-5`,children:O(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[O(ae,{className:`break-words leading-snug`,children:[C?.oauthAuthorized?`Authorized`:`Authorize`,` `,S?.name]}),D(u,{className:`max-w-2xl`,children:C?.oauthAuthorized?`You can now use this server in Po.`:`Finish signing in in the provider tab Po opened. If it did not open, use the link below.`})]})}),O(f,{className:`px-4 py-4 sm:px-5 sm:py-5`,children:[D(`output`,{className:`text-sm text-po-dim`,children:C?.oauthAuthorized?`Authorization complete.`:C?.state===`connected`?`Connected. OAuth authorization has not been confirmed.`:C?.state===`closed`?`Disconnected from this session.`:w?`Waiting for you to complete authorization.`:C?.state===`failed`?`Connection failed. Retry authorization; details are in the session transcript.`:C?`Preparing the authorization link...`:`This server is no longer available in the session.`}),g?D(`p`,{className:`text-sm text-po-dim`,children:`The browser blocked the new tab. Open the link below when it is ready.`}):null,w?O(`div`,{className:`flex flex-col gap-2`,children:[D(Re,{"aria-label":`OAuth authorization URL`,readOnly:!0,value:w,onFocus:e=>e.currentTarget.select()}),D(`a`,{href:w,target:`_blank`,rel:`noopener noreferrer`,className:`text-base font-medium text-po-blue underline underline-offset-2`,children:`open authorization page`}),D(A,{variant:`outline`,size:`xs`,onClick:()=>void le(),children:`copy link`})]}):null,m?D(`output`,{className:`text-sm text-po-dim`,children:m}):null]}),O(ie,{className:`flex-wrap justify-end border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[C?.state===`connected`&&S?D(A,{variant:`outline`,size:`md`,onClick:()=>{E(),h(``),v(!1),ty(n,S.sessionId,S.name)},children:`disconnect`}):null,(C?.state===`failed`||C?.state===`closed`)&&C.oauthEligible&&S?D(A,{size:`md`,onClick:()=>oe(S.name),children:C.state===`failed`?`retry authorization`:`reauthorize`}):null,D(A,{variant:`ghost`,size:`md`,onClick:()=>{E(),c(null)},children:`close`})]})]})})]})}var hy=ve({component:my}),gy=g({runtime:null});function _y(e){let t=e.mount;if(t?.scope!==`session`)throw Error(`MCP Apps require a session runtime mount`);return gy.update(t.sessionId,()=>({runtime:e})),()=>{gy.select(gy.store.state,t.sessionId).runtime===e&&gy.drop(t.sessionId)}}var vy=Be(_y),yy=`po-mcp`,by=`,`,xy=`_`,Sy=3,Cy=12;function wy(e){let t=e[yy];return t===void 0?[]:t.split(by).map(e=>e.trim()).filter(e=>e.length>0)}function Ty(e,t){let n=null;for(let r of wy(t)){let t=`${r}${xy}`;e.startsWith(t)&&e.length!==t.length&&(n===null||r.length>n.server.length)&&(n={server:r,tool:e.slice(t.length)})}return n}function Ey(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.server!=`string`||typeof t.tool!=`string`?null:{server:t.server,tool:t.tool}}function Dy(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):e===null?`null`:Array.isArray(e)?`[${e.length}]`:`{…}`}function Oy(e){let t=Object.entries(e),n=t.slice(0,Sy).map(([e,t])=>`${e}=${Dy(t)}`);return t.length>n.length&&n.push(`+${t.length-n.length}`),n.join(` · `)}function ky(e){let t=e.output.split(`
107
- `);for(;t.length>0&&t.at(-1)?.trim()===``;)t.pop();let n=e.expanded?t:t.slice(0,Cy);return e.isPartial?{lines:n,status:{glyph:`◐`,tone:`running`,text:`running`}}:e.isError?{lines:n,status:{glyph:`✗`,tone:`error`,text:`failed`}}:!e.expanded&&t.length>n.length?{lines:n,status:{glyph:`…`,tone:`hint`,text:`${t.length-n.length} more line(s)`}}:n.length===0?{lines:n,status:{glyph:`✓`,tone:`ok`,text:`done`}}:{lines:n,status:null}}function Ay(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jy(e){if(!Ay(e))return null;let t=t=>typeof e[t]==`string`?e[t]:void 0;switch(e.type){case`audio`:{let e=t(`data`),n=t(`mimeType`);return e!==void 0&&n!==void 0?{type:`audio`,data:e,mimeType:n}:null}case`resource_link`:{let e=t(`uri`),n=t(`name`);if(e===void 0||n===void 0)return null;let r=t(`title`),i=t(`description`),a=t(`mimeType`);return{type:`resource_link`,uri:e,name:n,...r===void 0?{}:{title:r},...i===void 0?{}:{description:i},...a===void 0?{}:{mimeType:a}}}case`resource`:{let e=t(`uri`);if(e===void 0)return null;let n=t(`mimeType`),r=t(`text`),i=t(`blob`);return{type:`resource`,uri:e,...n===void 0?{}:{mimeType:n},...r===void 0?{}:{text:r},...i===void 0?{}:{blob:i}}}case`structured`:return Ay(e.value)?{type:`structured`,value:e.value}:null;default:return null}}function My(e){return!Ay(e)||!Array.isArray(e.blocks)?[]:e.blocks.flatMap(e=>{let t=jy(e);return t===null?[]:[t]})}function Ny(e){return e.flatMap(e=>!Ay(e)||e.type!==`image`?[]:typeof e.data==`string`&&typeof e.mimeType==`string`?[{data:e.data,mimeType:e.mimeType}]:[])}var Py=64,Fy=2048,Iy=/^(localhost|127(\.\d{1,3}){3}|\[::1\])$/u;function Ly(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Ry(e,t){if(e===void 0)return[];if(!Array.isArray(e)||e.length>Py)throw Error(`Invalid widget CSP domains`);return e.map(e=>{if(typeof e!=`string`||e.length>Fy)throw Error(`Invalid widget CSP domain`);let n=new URL(e),r=n.hostname.replace(/^%2a\./iu,`*.`),i=r.startsWith(`*.`),a=new URL(t),o=Iy.test(n.hostname),s=o?Iy.test(a.hostname)&&n.port===a.port:r===a.hostname||i&&a.hostname.endsWith(r.slice(1));if(!(o?[`http:`,`https:`,`ws:`,`wss:`]:[`https:`,`wss:`]).includes(n.protocol)||n.username||n.password||n.pathname!==`/`||n.search||n.hash||s||n.hostname.startsWith(`0.`)||/[\s;'"<>]/u.test(e))throw Error(`Unsafe widget CSP domain`);return`${n.protocol}//${r}${n.port?`:${n.port}`:``}`})}function zy(e,t){let n=Ly(e),r=Ly(n?.ui);if(n?.ui!==void 0&&r===void 0)throw Error(`Invalid widget UI metadata`);let i=r!==void 0&&`csp`in r,a=i?r.csp:n?.[`openai/widgetCSP`],o=a===void 0?{}:Ly(a);if(o===void 0)throw Error(`Invalid widget CSP`);let s=Ry(o[i?`resourceDomains`:`resource_domains`],t).join(` `),c=Ry(o[i?`connectDomains`:`connect_domains`],t).join(` `),l=Ry(o[i?`frameDomains`:`frame_domains`],t).join(` `);return[`default-src 'none'`,`script-src 'unsafe-inline' ${s}`,`style-src 'unsafe-inline' ${s}`,`img-src data: blob: ${s}`,`font-src data: ${s}`,`media-src blob: ${s}`,`connect-src ${c||`'none'`}`,`frame-src ${l||`'none'`}`,`child-src ${l||`'none'`}`,`worker-src 'none'`,`object-src 'none'`,`base-uri 'none'`,`form-action 'none'`].join(`; `)}function By(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`)}function Vy(e){let t=e,n=t?.channel===`po.openai`?t.globals?.theme:t?.jsonrpc===`2.0`&&t.method===`ui/notifications/host-context-changed`?t.params?.theme:void 0;return n===`light`||n===`dark`?n:void 0}function Hy(e,t){let n=document.documentElement,r=t,i=!1,a=()=>{!n.classList.contains(`light`)&&!n.classList.contains(`dark`)&&n.classList.add(r),n.getAttribute(`data-theme`)===null&&n.setAttribute(`data-theme`,r)},o=()=>{n.classList.remove(`light`,`dark`),n.classList.add(r);let e=n.getAttribute(`data-theme`);(e===null||e===`light`||e===`dark`)&&n.setAttribute(`data-theme`,r),n.style.colorScheme=r};window.addEventListener(`message`,t=>{let n=t.source===parent?e(t.data):void 0;n!==void 0&&(r=n,i=!0,document.readyState!==`loading`&&o())}),document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>{document.readyState===`interactive`&&(i?o():a())}):a()}function Uy(e){let t=!1,n=t=>{let n=e(t);n!==void 0&&(document.documentElement.style.colorScheme=n)};window.addEventListener(`message`,e=>{if(e.source!==parent||t||e.ports.length!==1)return;let r=e.data;if(typeof r?.html!=`string`||typeof r.policy!=`string`)return;t=!0;let i=e.ports[0],a=document.createElement(`iframe`);a.title=`MCP App content`,a.setAttribute(`sandbox`,`allow-scripts`),r.policy.includes(`frame-src 'none'`)&&a.setAttribute(`csp`,r.policy),a.setAttribute(`allow`,`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`),a.style.cssText=`width:100%;height:100%;border:0;display:block`;let o=!1,s=!1,c=()=>{s||(s=!0,a.remove(),i.postMessage({type:`revoked`}),i.close())};a.addEventListener(`load`,()=>{o&&c(),o=!0});let l=Date.now(),u=0;window.addEventListener(`message`,e=>{if(s||e.source!==a.contentWindow)return;try{let t=JSON.stringify(e.data);if(t===void 0||new TextEncoder().encode(t).byteLength>65536)return c();let n=Date.now();if(n-l>=1e3&&(l=n,u=0),++u>128)return c()}catch{return c()}let t=e.data?.channel===`po.openai`;r.protocol===`mcp`&&!t?parent.postMessage(e.data,`*`):i.postMessage({type:`legacy`,data:e.data})}),i.onmessage=e=>{s||(n(e.data),a.contentWindow?.postMessage(e.data,`*`))},window.addEventListener(`message`,e=>{if(!s&&e.source===parent&&r.protocol===`mcp`){let t=e.data;if(t?.jsonrpc!==`2.0`)return;n(t),a.contentWindow?.postMessage(t,`*`)}}),i.start(),a.srcdoc=r.html,document.body.append(a),i.postMessage({type:`ready`})})}function Wy(e,t=`light`){return`<!doctype html><html style="color-scheme:${t}"><meta http-equiv="Content-Security-Policy" content="${By(e.replace(/\b(frame|child)-src ([^;]*)/gu,(e,t,n)=>n===`'none'`?`${t}-src about:`:`${t}-src about: ${n}`))}"><style>html,body{margin:0;height:100%;overflow:hidden}</style><script>(${Uy.toString()})(${Vy.toString()})<\/script>`}function Gy(e,t,n=``,r=`light`){let i=`<script>(${Hy.toString()})(${Vy.toString()}, ${JSON.stringify(r)})<\/script>`;return`<!doctype html><meta http-equiv="Content-Security-Policy" content="${By(t)}"><meta name="color-scheme" content="${r}">${i}${n}${e}`}function Ky(){return typeof HTMLIFrameElement<`u`&&`csp`in HTMLIFrameElement.prototype}function qy(e){let t=`po.openai`,n=new Map,r=0,i=e,a=e=>{i={...i,...e},window.dispatchEvent(new CustomEvent(`openai:set_globals`,{detail:{globals:e}}))},o=(e,i)=>{if(n.size>=32)return Promise.reject(Error(`Too many pending widget requests`));let a=++r;return new Promise((r,o)=>{let s=window.setTimeout(()=>{n.delete(a),o(Error(`Widget request timed out`))},6e4);n.set(a,{resolve:r,reject:o,timer:s}),parent.postMessage({channel:t,id:a,method:e,input:i},`*`)})};Object.defineProperty(window,"openai",{value:Object.freeze({get toolInput(){return i.toolInput},get toolOutput(){return i.toolOutput},get toolResponseMetadata(){return i.toolResponseMetadata},get widgetState(){return i.widgetState},get theme(){return i.theme},get locale(){return i.locale},get displayMode(){return i.displayMode},get maxHeight(){return i.maxHeight},get safeArea(){return i.safeArea},get userAgent(){return i.userAgent},callTool:(e,t={})=>o(`callTool`,{name:e,arguments:t}),setWidgetState:e=>(a({widgetState:e}),o(`setState`,{state:e})),sendFollowUpMessage:e=>o(`followUp`,e),requestDisplayMode:()=>Promise.resolve({mode:`inline`}),openExternal:e=>o(`openLink`,{url:e.href}),requestClose:()=>o(`close`,{}),notifyIntrinsicHeight:e=>o(`height`,{height:e})}),configurable:!1,writable:!1}),window.addEventListener(`message`,e=>{if(e.source!==parent)return;let r=e.data;if(r?.channel!==t||(r.globals!==void 0&&a(r.globals),r.id===void 0))return;let i=n.get(r.id);i!==void 0&&(n.delete(r.id),clearTimeout(i.timer),typeof r.error==`string`?i.reject(Error(r.error)):i.resolve(r.result))}),parent.postMessage({channel:t,method:`initialized`,input:{}},`*`),document.addEventListener(`DOMContentLoaded`,()=>{a(i);let e=new ResizeObserver(()=>{let e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);parent.postMessage({channel:t,method:`height`,input:{height:e}},`*`)});e.observe(document.body),window.addEventListener(`pagehide`,()=>e.disconnect(),{once:!0})},{once:!0})}function Jy(e){let t=JSON.stringify(e).replaceAll(`<`,`\\u003c`).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`);return`<script>(${qy.toString()})(${t})<\/script>`}var Yy=320,Xy=1200,Zy=80,Qy=15e3,$y=`po.openai`;function eb(){let e=document.documentElement.style.colorScheme;return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function tb(e){return e instanceof Error?e.message:`The MCP App could not complete this request`}function nb(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Invalid App request`);return e}function rb(e,t,n,r){return e.invokeServerMethod({mount:{scope:`session`,sessionId:t},service:`mcp.apps`,method:n,input:r})}async function ib(e){if(typeof e!=`string`)throw Error(`Invalid external link`);let t=new URL(e);if(t.protocol!==`https:`||t.username||t.password)throw Error(`Only HTTPS external links are supported`);if(!window.confirm(`Open this external link?\n${t.href}`))throw Error(`Opening the link was declined`);let n=window.open(t.href,`_blank`,`noopener,noreferrer`);return n!==null&&(n.opener=null),{}}function ab({runtime:e,sessionId:t,toolCallId:n,data:r,savedState:i,saveState:a,onClose:o}){let s=pe(null),[c,l]=k(Yy),[u,d]=k(null),[f,p]=k(!1),[m]=k(()=>i);return ye(()=>{let i=s.current;if(i===null||i.contentWindow===null)return;let c=!0,u,f=new MessageChannel,h=(n,i)=>c?rb(e,t,n,{...i,leaseId:r.leaseId}):Promise.reject(Error(`MCP App is closed`)),g=e=>{typeof e==`number`&&Number.isFinite(e)&&l(Math.min(Xy,Math.max(Zy,Math.ceil(e))))},_=e=>{c&&(d(tb(e)),c=!1,i.srcdoc=``,v().catch(t=>{d(`${tb(e)}. Closing the App lease failed: ${tb(t)}`)}))},v=()=>rb(e,t,`close`,{leaseId:r.leaseId}),y=window.setTimeout(()=>_(Error(`MCP App initialization timed out`)),Qy),b=()=>{c&&(clearTimeout(y),p(!0))},ee=async(e,t)=>{if(r.readOnly)throw Error(`Enable interactions in the conversation before calling tools`);if(typeof e!=`string`)throw Error(`Invalid App tool name`);return await h(`callTool`,{name:e,arguments:nb(t??{})})},te=async e=>(await h(`setState`,{state:e}),a(e),{}),x=async e=>{if(r.readOnly)throw Error(`Enable interactions in the conversation before sending a follow-up`);if(typeof e!=`string`)throw Error(`Invalid App follow-up`);return await h(`followUp`,{prompt:e}),{}},ne=async()=>(await h(`close`,{}),o(),{}),S=eb(),C={toolInput:r.args,toolOutput:r.result.structuredContent??null,toolResponseMetadata:r.result._meta??{},widgetState:m,theme:S,locale:navigator.language,displayMode:`inline`,maxHeight:Xy,safeArea:{insets:{top:0,right:0,bottom:0,left:0}},userAgent:{device:{type:window.matchMedia(`(pointer: coarse)`).matches?`mobile`:`desktop`},capabilities:{hover:window.matchMedia(`(hover: hover)`).matches,touch:navigator.maxTouchPoints>0}}};try{let e=zy(r.resourceMeta,location.origin);r.protocol===`mcp`&&(u=new f_(null,{name:`Po`,version:`1`},{...r.readOnly?{}:{serverTools:{},message:{text:{}}},openLinks:{}},{hostContext:{theme:S,locale:navigator.language,displayMode:`inline`,availableDisplayModes:[`inline`],toolInfo:{id:n,tool:r.tool}}}),u.oncalltool=({name:e,arguments:t})=>ee(e,t),u.onmessage=async({content:e})=>{if(e.some(e=>e.type!==`text`))throw Error(`Only text follow-ups are supported`);return x(e.map(e=>e.type===`text`?e.text:``).join(`
108
- `))},u.onopenlink=({url:e})=>ib(e),u.onsizechange=({height:e})=>g(e),u.onrequestdisplaymode=async()=>({mode:`inline`}),u.onrequestteardown=()=>{ne().catch(_)},u.oninitialized=()=>{(async()=>{await u.sendToolInput({arguments:r.args}),await u.sendToolResult(r.result),b()})().catch(_)},u.connect(new u_(i.contentWindow,i.contentWindow)).catch(_)),f.port1.onmessage=e=>{if(!c)return;let t=e.data;if(t?.type===`revoked`){_(Error(`MCP App navigation was blocked; reopen it to continue`));return}if(t?.type!==`legacy`)return;let n=t.data;n?.channel===$y&&(async()=>{let e=nb(n.input??{});switch(n.method){case`initialized`:{b();let e=eb();return e!==S&&f.port1.postMessage({channel:$y,globals:{theme:e}}),{}}case`height`:return g(e.height),{};case`callTool`:return ee(e.name,e.arguments);case`setState`:return te(e.state);case`followUp`:return x(e.prompt);case`openLink`:return ib(e.url);case`close`:return ne();default:throw Error(`Unsupported ChatGPT widget method`)}})().then(e=>{if(!c||n.id===void 0)return;let t=n.method===`callTool`&&r.protocol===`openai`?e:void 0;f.port1.postMessage({channel:$y,id:n.id,result:e,...t===void 0?{}:{globals:{toolOutput:t.structuredContent??null,toolResponseMetadata:t._meta??{}}}})},e=>{c&&n.id!==void 0&&f.port1.postMessage({channel:$y,id:n.id,error:tb(e)})})},f.port1.start();let t=()=>{i.contentWindow?.postMessage({html:Gy(r.html,e,Jy(C),S),policy:e,protocol:r.protocol},`*`,[f.port2])};i.addEventListener(`load`,t,{once:!0}),i.srcdoc=Wy(e,S);let a=new MutationObserver(()=>{let e=eb();u?.setHostContext({theme:e}),f.port1.postMessage({channel:$y,globals:{theme:e}})});return a.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`,`style`]}),()=>{c=!1,clearTimeout(y),a.disconnect(),i.removeEventListener(`load`,t),f.port1.close(),f.port2.close(),u!==void 0&&u.close().catch(e=>d(tb(e))),i.srcdoc=``}}catch(e){return _(e),()=>{clearTimeout(y),f.port1.close(),f.port2.close()}}},[e,t,n,r,m,a,o]),O(`div`,{className:`overflow-hidden rounded border border-po-border-soft`,"data-testid":`mcp-inline-app`,children:[u===null?null:D(`p`,{role:`alert`,className:`p-3 text-po-dim`,children:u}),!f&&u===null?D(`output`,{className:`p-3 text-po-faint`,children:`Loading MCP App…`}):null,D(`iframe`,{ref:s,title:`${r.tool.name} MCP App`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`,className:u===null?`block w-full border-0`:`hidden`,style:{height:c}})]})}function ob({sessionId:e,toolCallId:t}){let n=Ee(gy.store,t=>gy.select(t,e).runtime),[r,i]=k(null),[a,o]=k(null),[s,c]=k(!1),[l,u]=k(null),[d,f]=k(!1),[p,m]=k(null),h=De(e=>m(e),[]),g=De(()=>f(!0),[]);return ye(()=>{if(n===null||e===null||!Ky())return;let r=!0,a;return rb(n,e,`open`,{toolCallId:t}).then(t=>{let o=t;if(a=o.leaseId,!r)return rb(n,e,`close`,{leaseId:a});m(o.state),i(o)}).catch(e=>{r&&o(tb(e))}),()=>{r=!1,a!==void 0&&rb(n,e,`close`,{leaseId:a}).catch(e=>o(tb(e)))}},[n,e,t]),d?D(`p`,{className:`text-po-faint`,children:`MCP App closed. Expand the card to view the tool result.`}):Ky()?a===null?n===null||e===null?D(`p`,{className:`text-po-faint`,children:`The interactive MCP App is unavailable in this view. Expand the card to view the tool result.`}):r===null?D(`output`,{className:`text-po-faint`,children:`Loading MCP App…`}):O(`div`,{className:`flex flex-col gap-2`,children:[O(`div`,{className:`flex items-center justify-between gap-2 text-po-faint`,children:[D(`span`,{children:r.readOnly?`Read-only MCP App`:`MCP App interactions enabled`}),r.readOnly?D(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),u(null),rb(n,e,`activate`,{leaseId:r.leaseId}).then(()=>{i({...r,readOnly:!1})}).catch(e=>u(tb(e))).finally(()=>c(!1))},className:`rounded border border-po-border-soft px-2 py-1 text-po-blue disabled:opacity-50`,children:s?`Enabling…`:`Enable interactions`}):null]}),l===null?null:D(`p`,{role:`alert`,className:`text-po-dim`,children:l}),D(ab,{runtime:n,sessionId:e,toolCallId:t,data:r,savedState:p,saveState:h,onClose:g},`${r.leaseId}-${String(r.readOnly)}`)]}):O(`p`,{role:`alert`,className:`text-po-dim`,children:[`MCP App unavailable: `,a]}):D(`p`,{className:`text-po-faint`,children:`This browser cannot securely display MCP Apps. Expand the card to view the tool result.`})}var sb={running:`running`,ok:`ok`,error:`error`,hint:`neutral`};function cb(e){let t=e.indexOf(`_`);return t<=0?{server:e,tool:``}:{server:e.slice(0,t),tool:e.slice(t+1)}}function lb({block:e}){switch(e.type){case`resource_link`:return D(`a`,{href:e.uri,target:`_blank`,rel:`noreferrer`,"data-testid":`tool-result-mcp-link`,className:`truncate text-po-blue hover:underline`,title:e.description??e.uri,children:e.title??e.name});case`resource`:return e.text===void 0?O(`span`,{"data-testid":`tool-result-mcp-resource`,className:`truncate text-po-dim`,children:[`binary `,e.mimeType??`resource`,` · `,e.uri]}):D(Ne,{"data-testid":`tool-result-mcp-resource`,className:`text-po-dim`,text:e.text});case`structured`:return D(Ne,{"data-testid":`tool-result-mcp-structured`,className:`text-po-dim`,grammar:`json`,text:JSON.stringify(e.value,null,2)});case`audio`:return O(`span`,{"data-testid":`tool-result-mcp-audio`,className:`text-po-dim`,children:[`audio · `,e.mimeType]})}}function ub({sessionId:e,toolCallId:t,toolName:n,args:r,result:i,output:a,running:o,isError:s,statuses:l}){let u=Ey(i?.details)??Ty(n,l)??cb(n),d=Oy(r),f=Ny(i?.content??[]),p=My(i?.details),m=i?.details,h=!o&&typeof m==`object`&&m&&`app`in m?m.app:void 0,g=typeof h==`object`&&!!h&&`version`in h&&h.version===1&&`resourceUri`in h&&typeof h.resourceUri==`string`,_=Object.keys(r).length>0,v=ky({output:a,expanded:!0,isPartial:o,isError:s}),y=v.status?.tone===`hint`,b=v.lines.length>0||v.status!==null||f.length>0||p.length>0;return D(Le,{tone:c({running:o,isError:s}),expandable:_||b,children:({expanded:n})=>O(he,{children:[D(Pe,{title:`mcp`,children:O(`span`,{"data-testid":`tool-call-mcp`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[D(`span`,{className:`shrink-0 text-po-dim`,children:u.server}),D(`span`,{className:`shrink-0 text-po-faint`,children:`/`}),D(`span`,{className:`shrink-0 text-po-blue`,children:u.tool}),d?O(`span`,{className:`min-w-0 flex-1 truncate text-po-dim`,children:[`· `,d]}):null]})}),g?D(se,{children:D(ob,{sessionId:e,toolCallId:t},`${e}:${t}`)}):null,n&&_?O(se,{"data-testid":`tool-input-mcp`,className:`flex flex-col gap-1`,children:[D(`span`,{className:`text-sm text-po-dim`,children:`Input`}),D(Ne,{className:`text-po-dim`,grammar:`json`,text:JSON.stringify(r,null,2)})]}):null,n&&b?O(se,{"data-testid":`tool-result-mcp`,"data-mcp-server":u.server,className:`flex flex-col gap-1`,children:[_?D(`span`,{className:`text-sm text-po-dim`,children:`Output`}):null,v.lines.length>0?D(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-po-dim`,children:v.lines.join(`
109
- `)}):null,f.map((e,t)=>D(Ie,{"data-testid":`tool-result-mcp-image`,src:`data:${e.mimeType};base64,${e.data}`,alt:`${u.tool} result ${String(t+1)}`,className:`max-h-60 max-w-full rounded border border-po-border-soft`},`${String(t)}-${e.mimeType}`)),p.map((e,t)=>D(lb,{block:e},`${String(t)}-${e.type}`)),v.status?D(ee,{"data-testid":`tool-result-mcp-status`,tone:sb[v.status.tone],glyph:v.status.glyph,expands:y,children:v.status.text}):null]}):null]})})}var db=m({tools:[],matches:(e,t,n)=>Ey(n)!==null||Ty(e,t)!==null,message:ub}),fb=(e,t)=>t===void 0?void 0:{...e,...t},pb=n({id:`mcp`,global:{get settingsPanels(){return[fb({id:`mcp-servers`},Lv)]}},workspace:{get repositorySettingsPanel(){return $v}},session:{get fills(){return[fb({slot:`context`,id:`mcp-auth`},hy)]},get start(){return vy},get toolRenderers(){return[fb({tools:[`mcp`]},db)]}}});export{pb as webPlugin};
105
+ .`,onChange:e=>be(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One argument per line, so paths with spaces stay whole.`})]}),k(ye,{className:`flex flex-col gap-1.5`,defaultOpen:E!==``,children:[D(se,{asChild:!0,children:k(A,{type:`button`,variant:`ghost`,size:`sm`,className:`group self-start gap-1.5`,children:[D(Fe,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Environment variables (optional)`]})}),k(ve,{className:`flex flex-col gap-1.5`,children:[D(y,{"aria-label":`Environment variables`,className:`font-mono`,rows:3,value:E,placeholder:`API_KEY=...`,onChange:e=>Se(e.target.value)}),D(`p`,{className:`text-sm text-po-dim`,children:`One variable per line, as KEY=value.`}),D(Dv,{serverName:Oe,fields:Object.keys(wv(E,`=`)??{}),keepsInVault:O,onChange:(e,t)=>Ee(n=>({...n,[e]:t}))})]})]}),k(`div`,{className:`flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3`,children:[D(`p`,{className:`text-base font-semibold text-po-hi`,children:`This runs on your machine`}),D(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Po starts this command with your user's permissions whenever a session uses it. Only add commands you trust.`}),k(`div`,{className:`flex items-center gap-2`,children:[D(Me,{id:`mcp-add-trust`,checked:Ce,onCheckedChange:e=>we(e===!0)}),D(t,{htmlFor:`mcp-add-trust`,children:`I trust this command`})]})]})]}),d?D(`p`,{role:`alert`,className:`text-sm text-po-red`,children:d}):null]}),k(Re,{className:`border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[D(A,{type:`button`,variant:`ghost`,size:`md`,onClick:()=>n(!1),children:`Cancel`}),D(A,{type:`submit`,variant:`primary`,size:`md`,disabled:!je||u,children:u?`Adding...`:`Add server`})]})]})]})})}function Dv({serverName:e,fields:n,keepsInVault:r,onChange:i}){if(n.length===0)return null;let a=(n.find(r)??n[0]??``).replace(/[^A-Za-z0-9._-]/g,`_`),o=`\${vault:${e||`server`}-${a}}`;return k(`div`,{className:`flex flex-col gap-1.5`,children:[D(`ul`,{"aria-label":`Keep in vault`,className:`flex flex-col divide-y divide-po-border-soft rounded-md border border-po-border-soft`,children:n.map((e,n)=>{let a=`mcp-add-vault-${n}`;return k(`li`,{className:`flex min-w-0 items-center gap-2 px-3 py-1.5`,children:[D(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-po-text`,children:e}),D(Me,{id:a,checked:r(e),onCheckedChange:t=>i(e,t===!0)}),D(t,{htmlFor:a,children:`Keep in vault`})]},e)})}),k(`p`,{className:`text-sm text-po-dim`,children:[`Kept values stay in Po's vault on this machine. The config only gets a reference, such as`,` `,D(`span`,{className:`font-mono`,children:o}),`.`]})]})}function Ov({scope:e,repositoryId:t,targets:n,existingNames:r,requestWithStepUp:i,disabled:a=!1,onAdded:o,renderTrigger:s,onCloseAutoFocus:c}){let l=we(null),[u,d]=T(!1),[f,p]=T(!1),[m,h]=T(),g=()=>{a||(h(void 0),d(!0))};return k(ce,{children:[s?s(g):D(A,{ref:l,variant:`outline`,size:`sm`,disabled:a,"data-testid":`mcp-add-server`,onClick:g,children:`Add server`}),u?D(Ev,{open:!0,onOpenChange:e=>{f||d(e)},onCloseAutoFocus:c??(e=>{e.preventDefault(),l.current?.focus()}),scope:e,targets:n,existingNames:r,pending:f,error:m,onSubmit:({name:n,entry:r,trusted:a,secretFields:s,target:c})=>{p(!0),h(void 0),iv(i,{scope:e,...t?{repositoryId:t}:{},...e===`repository`&&c?{target:c}:{},name:n,entry:r,trusted:a,...s.length>0?{secretFields:s}:{}}).then(e=>{p(!1),`error`in e?h(e.error):(d(!1),o(n))})}}):null]})}function kv({action:e,name:n,management:r,pending:i,error:o,onClose:s,onCloseAutoFocus:l,onSubmit:u}){let d=pe(),[f,p]=T(``),[m,h]=T(!1),[g,_]=T(),v=r.kind===`local`;return D(le,{open:!0,onOpenChange:e=>{!e&&!i&&s()},children:k(b,{onCloseAutoFocus:l,children:[D(ne,{children:k(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[k(c,{children:[e===`edit`?`Edit`:`Remove`,` `,n]}),D(a,{children:e===`edit`?`Update headers or environment only. Existing values are retained unless overwritten. Values cannot be deleted here. Saved OAuth credentials are retained.`:`Remove this saved definition? Live connections and credentials are retained. A lower-priority definition may appear. This does not reconnect any session.`})]})}),k(ze,{className:`space-y-4`,children:[k(`p`,{className:`break-all text-sm text-po-dim`,children:[r.source?fv(r.source):r.owner,` ·`,` `,v?`Local command`:`Remote`,` · `,r.target]}),e===`edit`?k(ce,{children:[D(`p`,{className:`text-sm text-po-dim`,children:`Name, endpoint, transport, command and arguments are fixed. Updates are saved directly in the configuration file, not the vault. Existing values are not shown. Do not enter redacted placeholders or vault references.`}),k(`div`,{className:`space-y-2`,children:[k(t,{htmlFor:d,children:[v?`Environment updates`:`Header updates`,` (one NAME=value per line)`]}),D(y,{id:d,className:`min-h-24 w-full`,value:f,disabled:i,onChange:e=>p(e.target.value),autoComplete:`off`})]}),v?k(t,{className:`flex items-center gap-2`,children:[D(Me,{checked:m,disabled:i,onCheckedChange:e=>h(e===!0)}),`I trust this command to run with my permissions.`]}):null]}):null,o||g?D(`p`,{role:`alert`,className:`text-sm text-po-red`,children:o??g}):null]}),k(Re,{className:`border-t border-po-border-soft px-4 py-3`,children:[D(A,{variant:`ghost`,disabled:i,onClick:s,children:`Cancel`}),D(A,{variant:e===`remove`?`danger`:`primary`,loading:i,disabled:i||e===`edit`&&(!f.trim()||v&&!m),onClick:()=>{let e=[];for(let t of f.split(`
106
+ `).filter(e=>e.trim())){let n=t.indexOf(`=`);if(n<1||!t.slice(0,n).trim()||t.includes("${vault:")){_(`Use NAME=value on each line. Vault references cannot be edited here.`);return}e.push([t.slice(0,n).trim(),t.slice(n+1)])}_(void 0),u(Object.fromEntries(e),m)},children:e===`edit`?`Save updates`:`Remove saved definition`})]})]})})}function Av({name:e,management:t,repositoryId:r,requestWithStepUp:i,disabled:a,onChanged:o,onAuthorize:s,authorizeDisabled:c}){let l=we(null),[u,f]=T(),[p,m]=T(),[h,g]=T(!1),[v,y]=T(),b=t&&t.owner!==`read-only`&&t.revision,te=!!(b&&t.canEdit&&t.target&&t.kind),ne=!!(b&&t.canRemove);return k(ce,{children:[k(Se,{children:[D(ee,{asChild:!0,children:D(A,{ref:l,variant:`ghost`,size:`icon`,"aria-label":`Actions for ${e}`,disabled:a||h,children:D(_,{"aria-hidden":!0,className:`size-4`})})}),k(n,{align:`end`,children:[s?D(E,{disabled:a||c,onSelect:s,children:`Authorize`}):null,D(E,{disabled:!te,onSelect:()=>{y(void 0),te&&t&&(m({...t,name:e,repositoryId:r}),f(`edit`))},children:`Edit`}),D(d,{}),D(E,{disabled:!ne,onSelect:()=>{y(void 0),ne&&t&&(m({...t,name:e,repositoryId:r}),f(`remove`))},children:`Remove`})]})]}),u&&p?D(kv,{action:u,name:p.name,management:p,pending:h,error:v,onClose:()=>f(void 0),onCloseAutoFocus:e=>{e.preventDefault(),l.current?.focus()},onSubmit:async(t,n)=>{if(p.name!==e||p.repositoryId!==r)y(`The selected repository or server changed. Close this dialog and try again.`);else if(!(h||!p.revision||p.owner===`read-only`||(u===`edit`?!te:!ne))){g(!0),y(void 0);try{let a=vv(p),s=await av(i,u,{scope:p.owner===`global`?`global`:`repository`,repositoryId:r,...a?{target:a}:{},name:e,revision:p.revision,...u===`edit`?{trusted:n,entry:p.kind===`local`?{command:p.target,env:t}:{type:`http`,url:p.target,headers:t}}:{}});if(`error`in s){y(s.error);return}f(void 0);let c=s.value;o(`${u===`remove`?`Saved definition removed.`:`Saved definition updated.`} Live connections and credentials retained.${c.syncRequired?` Run po sync, then refresh.`:``} ${c.shadowedDefinition===`present`?`A lower-priority definition is now visible.`:c.shadowedDefinition===`possible`?`A lower-priority definition may appear.`:`No lower-priority definition was reported.`}`,u===`remove`)}catch(e){y(e instanceof Error?e.message:`The saved definition could not be changed.`)}finally{g(!1)}}}}):null]})}var jv=`mcp-auto-approve`,Mv=`mcp-auto-approve-help`;function Nv({checked:e,busy:t,error:n,onCheckedChange:r,onRetry:i}){return k(Ce,{"data-testid":`mcp-approval-settings`,children:[D(he,{children:D(_e,{children:`Approval`})}),D(Ie,{children:`Po asks before running an MCP tool that could change your data. Tools a server marks read-only always run straight away.`}),D(ge,{children:k(C,{changed:e,children:[k(Ae,{children:[D(w,{children:D(`label`,{htmlFor:jv,children:`Run tools that change data without asking`})}),D(O,{id:Mv,children:e?`On for every session, including ones already open. Turn it off to be asked again.`:`Applies to every session at once. Subagents and background work never ask.`}),n?D(O,{role:`alert`,className:`text-po-red`,children:n}):null]}),n&&i?D(A,{variant:`outline`,size:`sm`,onClick:i,children:`Try again`}):null,D(m,{id:jv,"data-testid":`mcp-auto-approve-switch`,"aria-describedby":Mv,checked:e,disabled:t,"aria-busy":t||void 0,onCheckedChange:r})]})})]})}function Pv({request:e,requestWithStepUp:t}){let[n,r]=T({status:`loading`}),i=de(async()=>{let t=await sv(e);r(`error`in t?{status:`load-failed`}:{status:`ready`,checked:t.value.autoApproveDestructiveTools})},[e]);Pe(()=>{i()},[i]);let a=de(async(e,n)=>{r({status:`ready`,checked:e,saving:!0});let i=await cv(t,{autoApproveDestructiveTools:e});r(`error`in i?{status:`ready`,checked:n,failedTarget:e}:{status:`ready`,checked:i.value.autoApproveDestructiveTools})},[t]);if(n.status!==`ready`)return D(Nv,{checked:!1,busy:!0,error:n.status===`load-failed`?`Po couldn't read this setting just now.`:void 0,onRetry:()=>void i()});let{checked:o,saving:s,failedTarget:c}=n;return D(Nv,{checked:o,busy:s,error:c===void 0?void 0:c?`Po couldn't save this just now, so sessions still ask first.`:`Po couldn't save this just now, so sessions still run these tools without asking.`,onCheckedChange:e=>void a(e,o),onRetry:c===void 0?void 0:()=>void a(c,o)})}function Fv({request:t,requestWithStepUp:n}){let r=we(null),[i,a]=T(),[o,s]=T({status:`loading`}),c=de(async()=>{let e=await ov(t);s(`error`in e?{status:`error`,error:e.error}:{status:`ready`,servers:e.value.servers})},[t]);Pe(()=>{c()},[c]);let l=o.status===`ready`?o.servers:[];return k(Ce,{ref:r,tabIndex:-1,"data-testid":`mcp-global-settings`,children:[k(he,{children:[D(_e,{children:`Servers`}),D(e,{children:D(Ov,{scope:`global`,existingNames:l.map(e=>e.name),requestWithStepUp:n,disabled:o.status===`loading`,onAdded:()=>void c()})})]}),i?D(`output`,{className:`text-sm text-po-dim`,children:i}):null,D(ge,{asChild:!0,children:D(`ul`,{children:o.status===`error`?D(C,{asChild:!0,role:`alert`,children:k(`li`,{children:[k(Ae,{children:[D(w,{children:`Po couldn't read your servers just now`}),D(O,{children:o.error})]}),D(A,{variant:`outline`,size:`sm`,onClick:()=>void c(),children:`Try again`})]})}):l.length===0?D(C,{asChild:!0,children:D(`li`,{children:k(Ae,{children:[D(w,{children:o.status===`loading`?`Reading your servers`:`No servers yet`}),D(O,{children:o.status===`loading`?`This takes a moment.`:`Servers you add here are available in every repository.`})]})})}):l.map(e=>D(C,{asChild:!0,children:k(`li`,{"data-testid":`mcp-global-server-${e.name}`,children:[k(Ae,{children:[D(w,{className:`font-mono first-letter:normal-case`,children:e.name}),k(O,{className:`truncate`,children:[e.kind===`remote`?`Remote`:`Local command`,` · `,e.target]})]}),D(Av,{name:e.name,management:e.management,requestWithStepUp:n,onChanged:(e,t)=>{a(e),c().then(()=>{t&&r.current?.focus()})}})]})},e.name))})})]})}function Iv(e){return k(`div`,{className:`flex flex-col gap-8`,children:[D(Pv,{...e}),D(Fv,{...e})]})}var Lv=Te({label:`MCP servers`,detail:`Your own MCP servers, available in every repository. A repository server with the same name wins.`,icon:x,component:Iv}),Rv=new je({repositoryId:void 0,catalog:void 0,authorization:void 0,busy:void 0,error:void 0});function zv(e){Rv.state.repositoryId!==e&&Rv.setState(()=>({repositoryId:e,catalog:void 0,authorization:void 0,busy:void 0,error:void 0}))}function Bv(e,t){Rv.state.repositoryId===e&&Rv.setState(t)}async function Vv(e,t){zv(t),Rv.setState(e=>({...e,busy:`loading`,error:void 0}));try{let n=await $_(e,t);Bv(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function Hv(e,t){zv(t),Rv.setState(e=>({...e,busy:`discovering`,error:void 0}));try{let n=await ev(e,t);Bv(t,e=>`error`in n?{...e,busy:void 0,error:n.error}:{...e,busy:void 0,catalog:n.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}async function Uv(e,t,n){zv(t),Rv.setState(e=>({...e,busy:`authorizing`,error:void 0}));try{let r=await tv(e,t,n);Bv(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}function Wv(e,t,n,r){let i=!1,a,o=async()=>{if(!i)try{let s=await nv(e,t,n);if(i)return;if(`error`in s){Bv(t,e=>({...e,error:s.error}));return}if(Bv(t,e=>({...e,authorization:s.value,error:void 0})),s.value.status===`completed`){r();return}if([`failed`,`cancelled`,`expired`].includes(s.value.status))return;a=setTimeout(()=>void o(),1e3)}catch{Bv(t,e=>({...e,error:`The authorization status could not be refreshed.`}))}};return o(),()=>{i=!0,a&&clearTimeout(a)}}async function Gv(e,t,n){Rv.setState(e=>({...e,busy:`cancelling`,error:void 0}));try{let r=await rv(e,t,n);Bv(t,e=>`error`in r?{...e,busy:void 0,error:r.error}:{...e,busy:void 0,authorization:r.value,error:void 0})}catch{Bv(t,e=>({...e,busy:void 0,error:`The cockpit hub is unreachable.`}))}}var Kv=new Set([`completed`,`failed`,`cancelled`,`expired`]),qv={"never-synced":`this repository has never been synced`,"configuration-changed":`the configuration changed since the last sync`,"cockpit-bundle-missing":`the cockpit bundle is missing`,"package-apis-missing":`package APIs are missing`},Jv={"not-connected":`Not connected`,connecting:`Connecting`,connected:`Connected`,degraded:`Degraded`,"needs-auth":`Needs sign-in`,failed:`Failed`,closed:`Closed`},Yv={starting:`Starting sign-in.`,waiting:`Waiting for you to finish signing in.`,completed:`Signed in.`,failed:`Sign-in didn't finish.`,cancelled:`Sign-in was cancelled.`,expired:`Sign-in expired before it finished.`};function Xv(e){return`${e.map(e=>qv[e]??e).join(`, `)||`the last sync is out of date`}. Run po sync, then refresh.`}function Zv({server:t,busy:n,canAct:r,confirming:i,onAuthorize:a,repositoryId:o,requestWithStepUp:s,onChanged:c,onConfirm:l,onCancel:u}){let d=t.tools.length,f=pv(t.management);return D(C,{asChild:!0,className:`items-start`,children:k(`li`,{"data-testid":`mcp-server-${t.name}`,children:[k(Ae,{children:[D(w,{className:`font-mono first-letter:normal-case`,children:t.name}),k(O,{children:[Jv[t.state],`. `,t.credentialPresent?`Credential saved.`:`No credential saved.`]}),f===void 0?null:D(O,{"data-testid":`mcp-server-source-${t.name}`,children:f}),t.error===void 0?null:D(O,{className:`text-po-red`,children:t.error})]}),i?null:D(Av,{name:t.name,management:t.management,repositoryId:o,requestWithStepUp:s,disabled:n,onChanged:c,onAuthorize:a,authorizeDisabled:!r}),i?k(`div`,{className:`flex basis-full flex-wrap items-center gap-x-4 gap-y-2 rounded-md bg-po-bg px-4 py-3`,children:[k(`span`,{className:`min-w-0 flex-1 text-base leading-relaxed text-po-text`,children:[`Start a short OAuth sign-in for `,t.name,`? A passkey may be required.`]}),k(e,{children:[D(A,{variant:`primary`,size:`sm`,disabled:n,onClick:l,children:`Continue`}),D(A,{variant:`ghost`,size:`sm`,onClick:u,children:`Cancel`})]})]}):null,k(`details`,{className:`group basis-full`,children:[k(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1 text-base font-medium text-po-text hover:text-po-hi [&::-webkit-details-marker]:hidden`,children:[D(Fe,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-90`}),d===1?`1 tool`:`${String(d)} tools`,`, `,t.source]}),D(`ul`,{className:`mt-3 flex flex-col gap-1.5 border-l border-po-border-soft pl-4`,children:d===0?D(`li`,{className:`text-sm text-po-dim`,children:`Run discovery to see what this server offers.`}):t.tools.map(e=>k(`li`,{className:`flex min-w-0 items-baseline gap-3 text-base`,children:[D(`code`,{title:e.piName,className:`min-w-0 shrink-0 truncate font-mono text-po-hi`,children:e.piName}),D(`span`,{className:`min-w-0 truncate text-po-dim`,children:e.description??``})]},e.piName))})]})]})})}function Qv({repository:t,request:r,requestWithStepUp:i}){let a=be(Rv),[o,s]=T(),c=we(null),[u,d]=T(!1),[f,p]=T(),m=t?.id;Pe(()=>{d(!1),p(void 0),s(void 0),m&&Vv(r,m)},[m,r]);let h=a.repositoryId===m?a.authorization:void 0,g=h?.id,v=h?.status;if(Pe(()=>{if(m&&g!==void 0&&!(v!==void 0&&Kv.has(v)))return Wv(r,m,g,()=>{Vv(r,m)})},[g,v,m,r]),!t)return D(ge,{"data-testid":`mcp-repository-settings`,children:D(C,{children:k(Ae,{children:[D(w,{children:`No repository picked`}),D(O,{children:`Pick a repository above to see its MCP servers.`})]})})});let y=a.repositoryId===t.id?a.catalog:void 0,b=a.repositoryId===t.id?a.busy:void 0,te=a.repositoryId===t.id?a.error:void 0,ne=y?.sync.fresh===!0,x=y?.servers??[],re=y?.droppedServers??[];return k(`div`,{className:`flex min-w-0 flex-col gap-10`,"data-testid":`mcp-repository-settings`,children:[k(Ce,{children:[D(he,{children:D(_e,{children:`Catalog`})}),k(ge,{children:[k(C,{children:[k(Ae,{children:[D(w,{children:ne?`Up to date`:y?`Needs a sync`:`Reading the catalog`}),D(O,{children:ne?`Po reads the cached catalog on this machine. Discovery contacts each configured server.`:y?Xv(y.sync.reasons):`Reading what the last sync recorded.`})]}),D(Ov,{scope:`repository`,repositoryId:t.id,targets:y?.targets,existingNames:x.map(e=>e.name),requestWithStepUp:i,disabled:b!==void 0,onAdded:()=>void Vv(r,t.id),onCloseAutoFocus:e=>{e.preventDefault(),c.current?.focus()},renderTrigger:e=>k(Se,{children:[D(ee,{asChild:!0,children:D(A,{ref:c,variant:`ghost`,size:`icon`,"aria-label":`Catalog actions`,title:`Catalog actions`,disabled:b!==void 0,children:D(_,{"aria-hidden":!0,className:`size-4`})})}),k(n,{align:`end`,children:[D(E,{disabled:b!==void 0,onSelect:()=>void Vv(r,t.id),children:`Refresh`}),D(E,{disabled:b!==void 0||!ne||u,onSelect:()=>d(!0),children:`Discover servers`}),D(E,{disabled:b!==void 0,onSelect:e,children:`Add server`})]})]})})]}),u?k(C,{children:[k(Ae,{children:[D(w,{children:`Discover servers now?`}),D(O,{children:`Discovery starts the configured processes and contacts remote MCP servers.`})]}),k(e,{children:[D(A,{variant:`primary`,size:`sm`,disabled:b!==void 0,onClick:()=>{d(!1),Hv(i,t.id)},children:`Discover`}),D(A,{variant:`ghost`,size:`sm`,onClick:()=>d(!1),children:`Cancel`})]})]}):null,te===void 0?null:k(C,{role:`alert`,children:[k(Ae,{children:[D(w,{children:`Po couldn't finish that just now`}),D(O,{children:te})]}),D(A,{variant:`outline`,size:`sm`,disabled:b!==void 0,onClick:()=>void Vv(r,t.id),children:`Try again`})]})]})]}),h?k(Ce,{children:[D(he,{children:D(_e,{children:`Sign-in`})}),D(ge,{children:k(C,{children:[k(Ae,{children:[D(w,{className:`font-mono first-letter:normal-case`,children:h.serverName}),D(O,{children:Yv[h.status]}),h.error?D(O,{className:`text-po-red`,children:h.error}):null]}),k(e,{children:[h.authorizationUrl?D(A,{variant:`primary`,size:`sm`,asChild:!0,children:k(`a`,{href:h.authorizationUrl,target:`_blank`,rel:`noreferrer noopener`,children:[`Open sign-in page`,D(l,{"aria-hidden":!0,className:`size-3.5`})]})}):null,Kv.has(h.status)?null:D(A,{variant:`ghost`,size:`sm`,loading:b===`cancelling`,disabled:b!==void 0,onClick:()=>void Gv(i,t.id,h.id),children:`Cancel`})]})]})})]}):null,k(Ce,{children:[o?D(`output`,{className:`text-sm text-po-dim`,children:o}):null,k(he,{children:[D(_e,{children:`Servers`}),x.length===0?null:D(`span`,{className:`text-sm text-po-dim`,children:x.length===1?`1 server`:`${String(x.length)} servers`})]}),D(ge,{asChild:!0,children:D(`ul`,{children:x.length===0?D(C,{asChild:!0,children:D(`li`,{children:k(Ae,{children:[D(w,{children:b===`loading`?`Reading the catalog`:`No servers yet`}),D(O,{children:b===`loading`?`This takes a moment.`:`None are enabled in this repository's last sync.`})]})})}):x.map(e=>D(Zv,{server:e,repositoryId:t.id,requestWithStepUp:i,onChanged:(e,n)=>{s(e),Vv(r,t.id).then(()=>{n&&c.current?.focus()})},busy:b!==void 0,canAct:ne,confirming:f===e.name,onAuthorize:()=>p(e.name),onConfirm:()=>{p(void 0),Uv(i,t.id,e.name)},onCancel:()=>p(void 0)},e.name))})}),re.length===0?null:D(Oe,{children:`Left out by policy: ${re.join(`, `)}.`}),y?.diagnostics.map(e=>D(Oe,{className:`text-po-red`,children:e},e))]})]})}var $v=me({label:`MCP servers`,detail:`The MCP servers this repository's sessions can use, what each one offers, and where to sign in.`,order:100,component:Qv});function ey(e,t,n){e(t,{type:`prompt`,message:`/mcp auth ${n}`})}function ty(e,t,n){e(t,{type:`prompt`,message:`/mcp disconnect ${n}`})}function ny(e,t,n){e(t,{type:`prompt`,message:`/mcp unauthorize ${n}`})}function ry(e,t,n){e(t,{type:`prompt`,message:`/mcp approve ${n?`on`:`off`}`})}async function iy(e,t){let n=await Y_.session(e).sessionSecret({body:t});return n.ok?{ok:!0}:n.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:n.error===``?`Po could not save that secret.`:n.error}}function ay({server:e,name:t,disabled:n=!1,pending:r=!1,error:i,onSubmit:a}){let[o,s]=T(``),c=`mcp-secret-${e}-${t}`,l=`${c}-hint`;return k(`form`,{"data-testid":`context-mcp-secret-${e}-${t}`,className:`flex flex-col gap-1.5 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-2.5 py-2`,onSubmit:e=>{e.preventDefault(),!(o===``||n||r)&&(a(o),s(``))},children:[k(`label`,{htmlFor:c,className:`text-sm text-po-text`,children:[D(`span`,{className:`font-semibold text-po-magenta`,children:`Needs secret`}),` `,D(`span`,{className:`font-mono text-po-hi`,children:t})]}),k(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D(ie,{id:c,type:`password`,size:`xs`,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1`,value:o,placeholder:`Paste the value`,"aria-describedby":l,"aria-invalid":i!==void 0,disabled:n||r,onChange:e=>s(e.target.value)}),D(A,{type:`submit`,variant:`outline`,size:`xs`,disabled:o===``||n||r,children:r?`saving...`:`save`})]}),D(`p`,{id:l,className:`text-sm ${i?`text-po-red`:`text-po-dim`}`,children:i??`Po keeps it in the vault, never shows it again, and reconnects ${e}.`})]})}var oy=`mcp-session-auto-approve`,sy=`mcp-session-auto-approve-help`;function cy({status:e,disabled:t,onCheckedChange:n}){return D(`section`,{"data-testid":`context-mcp-approval`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:k(`div`,{className:`flex min-w-0 items-start gap-3 px-1`,children:[k(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[D(`label`,{htmlFor:oy,className:`text-sm font-semibold text-po-hi`,children:`Run tools that change data without asking`}),D(`p`,{id:sy,className:`text-sm leading-relaxed text-po-dim`,children:e.global?`On for every session in MCP settings. Turn it off there to be asked again.`:e.session?`This session only. It stays on when the session restarts.`:`Po asks before each one, here and on Home. Read-only tools run straight away.`})]}),D(m,{id:oy,"data-testid":`context-mcp-approval-switch`,"aria-describedby":sy,checked:e.global||e.session,disabled:t||e.global,onCheckedChange:n})]})})}async function ly(e,t,n){let r=await Y_.session(e).sessionTool({query:{[E_]:t,[D_]:n}});return r.ok?{ok:!0,detail:r.data}:r.status===0?{ok:!1,error:`The session is unreachable.`}:{ok:!1,error:r.error===``?`The session answered ${r.status}.`:r.error}}function uy(e){return`${e.sessionId}\u0000${e.server}\u0000${e.tool}`}function dy({target:e,onClose:t}){let[n,r]=T(null);Pe(()=>{if(e===null)return;let t=!0,n=uy(e);return ly(e.sessionId,e.server,e.tool).then(e=>{t&&r(e.ok?{key:n,detail:e.detail}:{key:n,error:e.error})}),()=>{t=!1}},[e]);let i=e!==null&&n?.key===uy(e)?n:null,o=i?.detail;return D(le,{open:e!==null,onOpenChange:e=>{e||t()},children:k(b,{"data-testid":`mcp-tool-detail-dialog`,children:[D(ne,{className:`items-start px-4 py-4 sm:px-5`,children:k(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[D(c,{className:`break-words leading-snug`,children:o?.piName??e?.piName??(e===null?``:`${e.server} · ${e.tool}`)}),k(a,{children:[e===null?``:`${e.server} / ${e.tool}. `,e?.inContext===!1?`Not in the model context. `:``,o===void 0?`Description and complete input schema.`:`Estimated schema cost: ~${o.tokens.toLocaleString()} tokens.`]})]})}),k(ze,{className:`flex flex-col gap-3 px-4 py-4 sm:px-5 sm:py-5`,children:[i===null?D(`output`,{className:`text-sm text-po-dim`,children:`Loading the tool...`}):null,i?.error===void 0?null:D(`output`,{className:`text-sm text-po-dim`,children:i.error}),o===void 0?null:k(ce,{children:[k(`section`,{className:`flex flex-col gap-1`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`description`}),D(`p`,{className:`whitespace-pre-wrap text-base text-po-text`,children:o.description??`No description.`})]}),o.warnings?.length?D(`section`,{"aria-label":`Tool warnings`,className:`flex flex-col gap-1 text-base text-po-yellow`,children:o.warnings.map(e=>k(`p`,{children:[e.source,` `,e.path,`: `,e.message]},`${e.source}:${e.path}:${e.message}`))}):null,k(`section`,{className:`flex min-h-0 flex-col gap-1`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`input schema`}),D(`pre`,{"data-testid":`mcp-tool-detail-schema`,className:`max-h-96 overflow-auto rounded border border-po-border-soft p-2 font-mono text-sm text-po-text`,children:JSON.stringify(o.inputSchema,null,2)})]})]})]})]})})}function fy(e,t,n){return`${e}\u0000${t}\u0000${n}`}function py(e){return e===null?`-`:`~${e.toLocaleString()}`}function my({sessionId:e,statuses:t,sendSessionFrame:r,contextInventory:i=[]}){let o=k_(t[`po-mcp-session-auth`])??[],s=h_(t[m_]),[l,u]=T(null),[d,f]=T(null),p=we(null),[m,h]=T(``),[g,y]=T(!1),[te,x]=T(null),[re,ae]=T({}),oe=we(null),se=we(void 0),S=l?.sessionId===e?l:null,C=o.find(e=>e.name===S?.name),ue=C?.authorizationUrl,de=d?.sessionId===e?o.find(e=>e.name===d.name):void 0,fe=()=>{oe.current?.close(),oe.current=null};Pe(()=>{let e=oe.current;S&&ue&&e&&!e.closed&&(e.location.replace(ue),oe.current=null)},[S,ue]),Pe(()=>()=>{oe.current?.close(),oe.current=null},[e]),Pe(()=>{let e=C?.state;e!==se.current&&(se.current=e,(e===`failed`||e===`closed`||e===`connected`)&&(oe.current?.close(),oe.current=null))},[C?.state]);let w=t=>{if(e===null)return;let n=o.find(e=>e.name===t);if(se.current=n?.state,!n||n.state===`disabled`||!(n.oauthEligible||n.state===`needs-auth`||n.authorizationUrl))return;fe(),u({sessionId:e,name:t}),h(``);let i=window.open(`about:blank`,`_blank`);y(i===null),i&&(i.opener=null,n?.authorizationUrl?i.location.replace(n.authorizationUrl):(i.document.title=`MCP authorization`,i.document.body.textContent=`Preparing authorization. Return to Po for progress or manual sign-in.`,oe.current=i)),!n?.authorizationUrl&&n?.state!==`connecting`&&ey(r,e,t)},pe=(t,n,r)=>{if(e===null)return;let i=fy(e,t,n);ae(e=>({...e,[i]:{pending:!0}})),iy(e,{server:t,name:n,value:r}).then(e=>{ae(t=>({...t,[i]:e.ok?{pending:!1}:{pending:!1,error:e.error}}))})},me=async()=>{if(ue)try{await navigator.clipboard.writeText(ue),h(`Link copied.`)}catch{h(`Clipboard unavailable. Select the link above and copy it manually.`)}};return k(ce,{children:[o.length===0?null:k(`section`,{"data-testid":`context-mcp-auth`,className:`flex flex-col gap-2 border-b border-po-border px-3 py-3`,children:[k(`div`,{className:`flex flex-col gap-0.5`,children:[D(`p`,{className:`text-sm font-semibold text-po-dim`,children:`MCP servers`}),D(`p`,{className:`text-sm leading-relaxed text-po-dim`,children:`Open sign-in in a new tab, or copy the link from the authorization dialog.`})]}),D(`ul`,{"aria-label":`MCP servers`,className:`flex flex-col gap-2`,children:o.map(t=>{let a=i.filter(e=>e.source===`mcp`&&e.owner===t.name),o=t.tools??[],s=t.missingSecrets??[],c=s.length>0&&t.state!==`connected`;return k(`li`,{className:`flex min-w-0 flex-col gap-1 px-1 py-0.5`,children:[k(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D(`span`,{className:`min-w-0 flex-1 truncate text-base font-semibold text-po-hi`,children:t.name}),c?D(`span`,{className:`text-sm font-semibold text-po-magenta`,children:`needs secret`}):D(`span`,{className:`text-sm font-semibold text-po-dim`,children:t.state.replace(/-/g,` `)}),t.oauthAuthorized===!0&&t.state===`connected`?k(`span`,{className:`flex items-center gap-1 text-sm text-po-green`,children:[D(v,{"aria-hidden":!0,className:`size-4`}),` Authorized`]}):null,!c&&t.state===`needs-auth`?D(A,{variant:`subtle`,size:`xs`,"aria-label":`Authorize ${t.name}`,disabled:e===null,onFocus:e=>{p.current=e.currentTarget},onClick:()=>w(t.name),children:`Authorize`}):null,c?null:k(Se,{children:[D(ee,{asChild:!0,children:D(A,{variant:`ghost`,size:`icon`,"aria-label":`Actions for ${t.name}`,disabled:e===null||t.state===`disabled`,onPointerDownCapture:e=>{p.current=e.currentTarget},onFocus:e=>{p.current=e.currentTarget},children:D(_,{"aria-hidden":!0,className:`size-4`})})}),k(n,{align:`end`,children:[t.oauthEligible||t.state===`needs-auth`||t.authorizationUrl?D(E,{onSelect:()=>w(t.name),children:t.oauthAuthorized?`Reauthorize`:`Authorize`}):null,t.oauthEligible&&t.oauthAuthorized?D(E,{onSelect:()=>{e!==null&&f({sessionId:e,name:t.name})},children:`Unauthorize`}):null,t.state===`connected`?D(E,{onSelect:()=>{e!==null&&ty(r,e,t.name)},children:`Disconnect`}):null,!(t.oauthEligible||t.state===`needs-auth`||t.authorizationUrl)&&t.state!==`connected`?D(E,{disabled:!0,children:`Authorization unavailable`}):null]})]})]}),(c?s:[]).map(n=>{let r=e===null?void 0:re[fy(e,t.name,n)];return D(ay,{server:t.name,name:n,disabled:e===null,pending:r?.pending??!1,...r?.error?{error:r.error}:{},onSubmit:e=>pe(t.name,n,e)},n)}),a.length>0?D(`ul`,{"aria-label":`${t.name} tools and skills`,className:`flex flex-col`,children:a.map(n=>{let r=o.find(e=>e.piName===n.name);return k(`li`,{"data-active":n.active,className:`flex min-w-0 items-center gap-2 py-px pl-3`,children:[D(`abbr`,{title:n.itemKind,className:`w-3 shrink-0 text-2xs font-semibold no-underline ${n.active?`text-po-violet`:`text-po-dim`}`,children:n.itemKind===`skill`?`S`:`T`}),n.itemKind===`tool`?D(A,{variant:`ghost`,size:`card`,"aria-label":`Open schema for ${n.name}`,"data-testid":`context-mcp-tool-${n.name}`,disabled:e===null||r===void 0,onClick:()=>{e!==null&&r!==void 0&&x({sessionId:e,server:t.name,tool:r.name,piName:r.piName,inContext:n.active})},className:`min-w-0 flex-1 truncate rounded-none py-0 text-left text-base ${n.active?`text-po-hi`:`text-po-dim`}`,children:n.name}):D(`span`,{className:`min-w-0 flex-1 truncate text-base text-po-dim`,children:n.name}),D(`span`,{className:`w-14 shrink-0 text-right text-sm ${n.active?`text-po-text`:`text-po-dim`}`,children:n.active?py(n.tokens):`(${py(n.tokens)})`})]},`${n.itemKind}:${n.name}`)})}):o.length>0?k(`div`,{className:`flex flex-col`,children:[D(`p`,{className:`pl-3 text-sm text-po-dim`,children:`${o.length} available ${o.length===1?`tool`:`tools`}, not in context`}),D(`ul`,{"aria-label":`${t.name} reachable tools`,className:`flex flex-col`,children:o.map(n=>D(`li`,{className:`flex min-w-0`,children:k(A,{variant:`ghost`,size:`card`,"data-testid":`context-mcp-reachable-${t.name}-${n.name}`,title:`open the tool's description and schema`,disabled:e===null,onClick:()=>{e!==null&&x({sessionId:e,server:t.name,tool:n.name,piName:n.piName,inContext:!1})},className:`min-w-0 flex-1 flex-row items-center gap-2 rounded-none py-px pr-0 pl-3`,children:[D(`abbr`,{title:`tool`,className:`w-3 shrink-0 text-2xs font-semibold text-po-violet no-underline`,children:`T`}),D(`span`,{className:`min-w-0 flex-1 truncate text-left text-base text-po-text`,children:n.piName??n.name}),D(`span`,{title:`what the schema would cost if added to context directly`,className:`w-14 shrink-0 text-right text-sm text-po-dim`,children:n.tokens===void 0?`(-)`:`(~${n.tokens.toLocaleString()})`})]})},n.name))})]}):c?null:D(`p`,{className:`pl-3 text-sm text-po-dim`,children:`no tools or skills reported`})]},t.name)})})]}),o.length===0||s===void 0?null:D(cy,{status:s,disabled:e===null,onCheckedChange:t=>{e!==null&&ry(r,e,t)}}),D(dy,{target:te,onClose:()=>x(null)}),D(le,{open:de!==void 0,onOpenChange:e=>{e||f(null)},children:k(b,{onCloseAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[D(ne,{dismissible:!0,children:k(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[k(c,{children:[`Unauthorize `,d?.name,`?`]}),D(a,{children:`Disconnect this session and clear the saved authorization. The server stays configured.`})]})}),D(ze,{children:D(`p`,{className:`text-base leading-relaxed text-po-dim`,children:`The saved credential is shared. Other sessions stay connected, but may need to sign in again when they reconnect. This does not revoke access at the provider.`})}),k(Re,{className:`border-t border-po-border-soft px-4 py-3`,children:[D(A,{variant:`ghost`,onClick:()=>f(null),children:`Cancel`}),D(A,{variant:`danger`,disabled:!de?.oauthEligible,onClick:()=>{d&&de?.oauthEligible&&d.sessionId===e&&(ny(r,d.sessionId,d.name),f(null))},children:`Unauthorize`})]})]})}),D(le,{open:S!==null,onOpenChange:e=>{e||(fe(),u(null))},children:k(b,{"data-testid":`mcp-authorization-dialog`,onInteractOutside:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[D(ne,{className:`items-start px-4 py-4 sm:px-5`,children:k(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[k(c,{className:`break-words leading-snug`,children:[C?.oauthAuthorized?`Authorized`:`Authorize`,` `,S?.name]}),D(a,{className:`max-w-2xl`,children:C?.oauthAuthorized?`You can now use this server in Po.`:`Finish signing in in the provider tab Po opened. If it did not open, use the link below.`})]})}),k(ze,{className:`px-4 py-4 sm:px-5 sm:py-5`,children:[D(`output`,{className:`text-sm text-po-dim`,children:C?.oauthAuthorized?`Authorization complete.`:C?.state===`connected`?`Connected. OAuth authorization has not been confirmed.`:C?.state===`closed`?`Disconnected from this session.`:ue?`Waiting for you to complete authorization.`:C?.state===`failed`?`Connection failed. Retry authorization; details are in the session transcript.`:C?`Preparing the authorization link...`:`This server is no longer available in the session.`}),g?D(`p`,{className:`text-sm text-po-dim`,children:`The browser blocked the new tab. Open the link below when it is ready.`}):null,ue?k(`div`,{className:`flex flex-col gap-2`,children:[D(ie,{"aria-label":`OAuth authorization URL`,readOnly:!0,value:ue,onFocus:e=>e.currentTarget.select()}),D(`a`,{href:ue,target:`_blank`,rel:`noopener noreferrer`,className:`text-base font-medium text-po-blue underline underline-offset-2`,children:`open authorization page`}),D(A,{variant:`outline`,size:`xs`,onClick:()=>void me(),children:`copy link`})]}):null,m?D(`output`,{className:`text-sm text-po-dim`,children:m}):null]}),k(Re,{className:`flex-wrap justify-end border-t border-po-border-soft px-4 py-3 sm:px-5`,children:[C?.state===`connected`&&S?D(A,{variant:`outline`,size:`md`,onClick:()=>{fe(),h(``),y(!1),ty(r,S.sessionId,S.name)},children:`disconnect`}):null,(C?.state===`failed`||C?.state===`closed`)&&C.oauthEligible&&S?D(A,{size:`md`,onClick:()=>w(S.name),children:C.state===`failed`?`retry authorization`:`reauthorize`}):null,D(A,{variant:`ghost`,size:`md`,onClick:()=>{fe(),u(null)},children:`close`})]})]})})]})}var hy=ke({component:my}),gy=De({runtime:null});function _y(e){let t=e.mount;if(t?.scope!==`session`)throw Error(`MCP Apps require a session runtime mount`);return gy.update(t.sessionId,()=>({runtime:e})),()=>{gy.select(gy.store.state,t.sessionId).runtime===e&&gy.drop(t.sessionId)}}var vy=Be(_y),yy=`po-mcp`,by=`,`,xy=`_`,Sy=3,Cy=12;function wy(e){let t=e[yy];return t===void 0?[]:t.split(by).map(e=>e.trim()).filter(e=>e.length>0)}function Ty(e,t){let n=null;for(let r of wy(t)){let t=`${r}${xy}`;e.startsWith(t)&&e.length!==t.length&&(n===null||r.length>n.server.length)&&(n={server:r,tool:e.slice(t.length)})}return n}function Ey(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.server!=`string`||typeof t.tool!=`string`?null:{server:t.server,tool:t.tool}}function Dy(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):e===null?`null`:Array.isArray(e)?`[${e.length}]`:`{…}`}function Oy(e){let t=Object.entries(e),n=t.slice(0,Sy).map(([e,t])=>`${e}=${Dy(t)}`);return t.length>n.length&&n.push(`+${t.length-n.length}`),n.join(` · `)}function ky(e){let t=e.output.split(`
107
+ `);for(;t.length>0&&t.at(-1)?.trim()===``;)t.pop();let n=e.expanded?t:t.slice(0,Cy);return e.isPartial?{lines:n,status:{glyph:`◐`,tone:`running`,text:`running`}}:e.isError?{lines:n,status:{glyph:`✗`,tone:`error`,text:`failed`}}:!e.expanded&&t.length>n.length?{lines:n,status:{glyph:`…`,tone:`hint`,text:`${t.length-n.length} more line(s)`}}:n.length===0?{lines:n,status:{glyph:`✓`,tone:`ok`,text:`done`}}:{lines:n,status:null}}function Ay(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jy(e){if(!Ay(e))return null;let t=t=>typeof e[t]==`string`?e[t]:void 0;switch(e.type){case`audio`:{let e=t(`data`),n=t(`mimeType`);return e!==void 0&&n!==void 0?{type:`audio`,data:e,mimeType:n}:null}case`resource_link`:{let e=t(`uri`),n=t(`name`);if(e===void 0||n===void 0)return null;let r=t(`title`),i=t(`description`),a=t(`mimeType`);return{type:`resource_link`,uri:e,name:n,...r===void 0?{}:{title:r},...i===void 0?{}:{description:i},...a===void 0?{}:{mimeType:a}}}case`resource`:{let e=t(`uri`);if(e===void 0)return null;let n=t(`mimeType`),r=t(`text`),i=t(`blob`);return{type:`resource`,uri:e,...n===void 0?{}:{mimeType:n},...r===void 0?{}:{text:r},...i===void 0?{}:{blob:i}}}case`structured`:return Ay(e.value)?{type:`structured`,value:e.value}:null;default:return null}}function My(e){return!Ay(e)||!Array.isArray(e.blocks)?[]:e.blocks.flatMap(e=>{let t=jy(e);return t===null?[]:[t]})}function Ny(e){return e.flatMap(e=>!Ay(e)||e.type!==`image`?[]:typeof e.data==`string`&&typeof e.mimeType==`string`?[{data:e.data,mimeType:e.mimeType}]:[])}var Py=64,Fy=2048,Iy=/^(localhost|127(\.\d{1,3}){3}|\[::1\])$/u;function Ly(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Ry(e,t){if(e===void 0)return[];if(!Array.isArray(e)||e.length>Py)throw Error(`Invalid widget CSP domains`);return e.map(e=>{if(typeof e!=`string`||e.length>Fy)throw Error(`Invalid widget CSP domain`);let n=new URL(e),r=n.hostname.replace(/^%2a\./iu,`*.`),i=r.startsWith(`*.`),a=new URL(t),o=Iy.test(n.hostname),s=o?Iy.test(a.hostname)&&n.port===a.port:r===a.hostname||i&&a.hostname.endsWith(r.slice(1));if(!(o?[`http:`,`https:`,`ws:`,`wss:`]:[`https:`,`wss:`]).includes(n.protocol)||n.username||n.password||n.pathname!==`/`||n.search||n.hash||s||n.hostname.startsWith(`0.`)||/[\s;'"<>]/u.test(e))throw Error(`Unsafe widget CSP domain`);return`${n.protocol}//${r}${n.port?`:${n.port}`:``}`})}function zy(e,t){let n=Ly(e),r=Ly(n?.ui);if(n?.ui!==void 0&&r===void 0)throw Error(`Invalid widget UI metadata`);let i=r!==void 0&&`csp`in r,a=i?r.csp:n?.[`openai/widgetCSP`],o=a===void 0?{}:Ly(a);if(o===void 0)throw Error(`Invalid widget CSP`);let s=Ry(o[i?`resourceDomains`:`resource_domains`],t).join(` `),c=Ry(o[i?`connectDomains`:`connect_domains`],t).join(` `),l=Ry(o[i?`frameDomains`:`frame_domains`],t).join(` `);return[`default-src 'none'`,`script-src 'unsafe-inline' ${s}`,`style-src 'unsafe-inline' ${s}`,`img-src data: blob: ${s}`,`font-src data: ${s}`,`media-src blob: ${s}`,`connect-src ${c||`'none'`}`,`frame-src ${l||`'none'`}`,`child-src ${l||`'none'`}`,`worker-src 'none'`,`object-src 'none'`,`base-uri 'none'`,`form-action 'none'`].join(`; `)}function By(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`).replaceAll(`<`,`&lt;`)}function Vy(e){let t=e,n=t?.channel===`po.openai`?t.globals?.theme:t?.jsonrpc===`2.0`&&t.method===`ui/notifications/host-context-changed`?t.params?.theme:void 0;return n===`light`||n===`dark`?n:void 0}function Hy(e,t){let n=document.documentElement,r=t,i=!1,a=()=>{!n.classList.contains(`light`)&&!n.classList.contains(`dark`)&&n.classList.add(r),n.getAttribute(`data-theme`)===null&&n.setAttribute(`data-theme`,r)},o=()=>{n.classList.remove(`light`,`dark`),n.classList.add(r);let e=n.getAttribute(`data-theme`);(e===null||e===`light`||e===`dark`)&&n.setAttribute(`data-theme`,r),n.style.colorScheme=r};window.addEventListener(`message`,t=>{let n=t.source===parent?e(t.data):void 0;n!==void 0&&(r=n,i=!0,document.readyState!==`loading`&&o())}),document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>{document.readyState===`interactive`&&(i?o():a())}):a()}function Uy(e){let t=!1,n=t=>{let n=e(t);n!==void 0&&(document.documentElement.style.colorScheme=n)};window.addEventListener(`message`,e=>{if(e.source!==parent||t||e.ports.length!==1)return;let r=e.data;if(typeof r?.html!=`string`||typeof r.policy!=`string`)return;t=!0;let i=e.ports[0],a=document.createElement(`iframe`);a.title=`MCP App content`,a.setAttribute(`sandbox`,`allow-scripts`),r.policy.includes(`frame-src 'none'`)&&a.setAttribute(`csp`,r.policy),a.setAttribute(`allow`,`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`),a.style.cssText=`width:100%;height:100%;border:0;display:block`;let o=!1,s=!1,c=()=>{s||(s=!0,a.remove(),i.postMessage({type:`revoked`}),i.close())};a.addEventListener(`load`,()=>{o&&c(),o=!0});let l=Date.now(),u=0;window.addEventListener(`message`,e=>{if(s||e.source!==a.contentWindow)return;try{let t=JSON.stringify(e.data);if(t===void 0||new TextEncoder().encode(t).byteLength>65536)return c();let n=Date.now();if(n-l>=1e3&&(l=n,u=0),++u>128)return c()}catch{return c()}let t=e.data?.channel===`po.openai`;r.protocol===`mcp`&&!t?parent.postMessage(e.data,`*`):i.postMessage({type:`legacy`,data:e.data})}),i.onmessage=e=>{s||(n(e.data),a.contentWindow?.postMessage(e.data,`*`))},window.addEventListener(`message`,e=>{if(!s&&e.source===parent&&r.protocol===`mcp`){let t=e.data;if(t?.jsonrpc!==`2.0`)return;n(t),a.contentWindow?.postMessage(t,`*`)}}),i.start(),a.srcdoc=r.html,document.body.append(a),i.postMessage({type:`ready`})})}function Wy(e,t=`light`){return`<!doctype html><html style="color-scheme:${t}"><meta http-equiv="Content-Security-Policy" content="${By(e.replace(/\b(frame|child)-src ([^;]*)/gu,(e,t,n)=>n===`'none'`?`${t}-src about:`:`${t}-src about: ${n}`))}"><style>html,body{margin:0;height:100%;overflow:hidden}</style><script>(${Uy.toString()})(${Vy.toString()})<\/script>`}function Gy(e,t,n=``,r=`light`){let i=`<script>(${Hy.toString()})(${Vy.toString()}, ${JSON.stringify(r)})<\/script>`;return`<!doctype html><meta http-equiv="Content-Security-Policy" content="${By(t)}"><meta name="color-scheme" content="${r}">${i}${n}${e}`}function Ky(){return typeof HTMLIFrameElement<`u`&&`csp`in HTMLIFrameElement.prototype}function qy(e){let t=`po.openai`,n=new Map,r=0,i=e,a=e=>{i={...i,...e},window.dispatchEvent(new CustomEvent(`openai:set_globals`,{detail:{globals:e}}))},o=(e,i)=>{if(n.size>=32)return Promise.reject(Error(`Too many pending widget requests`));let a=++r;return new Promise((r,o)=>{let s=window.setTimeout(()=>{n.delete(a),o(Error(`Widget request timed out`))},6e4);n.set(a,{resolve:r,reject:o,timer:s}),parent.postMessage({channel:t,id:a,method:e,input:i},`*`)})};Object.defineProperty(window,"openai",{value:Object.freeze({get toolInput(){return i.toolInput},get toolOutput(){return i.toolOutput},get toolResponseMetadata(){return i.toolResponseMetadata},get widgetState(){return i.widgetState},get theme(){return i.theme},get locale(){return i.locale},get displayMode(){return i.displayMode},get maxHeight(){return i.maxHeight},get safeArea(){return i.safeArea},get userAgent(){return i.userAgent},callTool:(e,t={})=>o(`callTool`,{name:e,arguments:t}),setWidgetState:e=>(a({widgetState:e}),o(`setState`,{state:e})),sendFollowUpMessage:e=>o(`followUp`,e),requestDisplayMode:()=>Promise.resolve({mode:`inline`}),openExternal:e=>o(`openLink`,{url:e.href}),requestClose:()=>o(`close`,{}),notifyIntrinsicHeight:e=>o(`height`,{height:e})}),configurable:!1,writable:!1}),window.addEventListener(`message`,e=>{if(e.source!==parent)return;let r=e.data;if(r?.channel!==t||(r.globals!==void 0&&a(r.globals),r.id===void 0))return;let i=n.get(r.id);i!==void 0&&(n.delete(r.id),clearTimeout(i.timer),typeof r.error==`string`?i.reject(Error(r.error)):i.resolve(r.result))}),parent.postMessage({channel:t,method:`initialized`,input:{}},`*`),document.addEventListener(`DOMContentLoaded`,()=>{a(i);let e=new ResizeObserver(()=>{let e=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);parent.postMessage({channel:t,method:`height`,input:{height:e}},`*`)});e.observe(document.body),window.addEventListener(`pagehide`,()=>e.disconnect(),{once:!0})},{once:!0})}function Jy(e){let t=JSON.stringify(e).replaceAll(`<`,`\\u003c`).replaceAll(`\u2028`,`\\u2028`).replaceAll(`\u2029`,`\\u2029`);return`<script>(${qy.toString()})(${t})<\/script>`}var Yy=320,Xy=1200,Zy=80,Qy=15e3,$y=`po.openai`;function eb(){let e=document.documentElement.style.colorScheme;return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function tb(e){return e instanceof Error?e.message:`The MCP App could not complete this request`}function nb(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Invalid App request`);return e}function rb(e,t,n,r){return e.invokeServerMethod({mount:{scope:`session`,sessionId:t},service:`mcp.apps`,method:n,input:r})}async function ib(e){if(typeof e!=`string`)throw Error(`Invalid external link`);let t=new URL(e);if(t.protocol!==`https:`||t.username||t.password)throw Error(`Only HTTPS external links are supported`);if(!window.confirm(`Open this external link?\n${t.href}`))throw Error(`Opening the link was declined`);let n=window.open(t.href,`_blank`,`noopener,noreferrer`);return n!==null&&(n.opener=null),{}}function ab({runtime:e,sessionId:t,toolCallId:n,data:r,savedState:i,saveState:a,onClose:o}){let s=we(null),[c,l]=T(Yy),[u,d]=T(null),[f,p]=T(!1),[m]=T(()=>i);return Pe(()=>{let i=s.current;if(i===null||i.contentWindow===null)return;let c=!0,u,f=new MessageChannel,h=(n,i)=>c?rb(e,t,n,{...i,leaseId:r.leaseId}):Promise.reject(Error(`MCP App is closed`)),g=e=>{typeof e==`number`&&Number.isFinite(e)&&l(Math.min(Xy,Math.max(Zy,Math.ceil(e))))},_=e=>{c&&(d(tb(e)),c=!1,i.srcdoc=``,v().catch(t=>{d(`${tb(e)}. Closing the App lease failed: ${tb(t)}`)}))},v=()=>rb(e,t,`close`,{leaseId:r.leaseId}),ee=window.setTimeout(()=>_(Error(`MCP App initialization timed out`)),Qy),y=()=>{c&&(clearTimeout(ee),p(!0))},b=async(e,t)=>{if(r.readOnly)throw Error(`Enable interactions in the conversation before calling tools`);if(typeof e!=`string`)throw Error(`Invalid App tool name`);return await h(`callTool`,{name:e,arguments:nb(t??{})})},te=async e=>(await h(`setState`,{state:e}),a(e),{}),ne=async e=>{if(r.readOnly)throw Error(`Enable interactions in the conversation before sending a follow-up`);if(typeof e!=`string`)throw Error(`Invalid App follow-up`);return await h(`followUp`,{prompt:e}),{}},x=async()=>(await h(`close`,{}),o(),{}),re=eb(),ie={toolInput:r.args,toolOutput:r.result.structuredContent??null,toolResponseMetadata:r.result._meta??{},widgetState:m,theme:re,locale:navigator.language,displayMode:`inline`,maxHeight:Xy,safeArea:{insets:{top:0,right:0,bottom:0,left:0}},userAgent:{device:{type:window.matchMedia(`(pointer: coarse)`).matches?`mobile`:`desktop`},capabilities:{hover:window.matchMedia(`(hover: hover)`).matches,touch:navigator.maxTouchPoints>0}}};try{let e=zy(r.resourceMeta,location.origin);r.protocol===`mcp`&&(u=new f_(null,{name:`Po`,version:`1`},{...r.readOnly?{}:{serverTools:{},message:{text:{}}},openLinks:{}},{hostContext:{theme:re,locale:navigator.language,displayMode:`inline`,availableDisplayModes:[`inline`],toolInfo:{id:n,tool:r.tool}}}),u.oncalltool=({name:e,arguments:t})=>b(e,t),u.onmessage=async({content:e})=>{if(e.some(e=>e.type!==`text`))throw Error(`Only text follow-ups are supported`);return ne(e.map(e=>e.type===`text`?e.text:``).join(`
108
+ `))},u.onopenlink=({url:e})=>ib(e),u.onsizechange=({height:e})=>g(e),u.onrequestdisplaymode=async()=>({mode:`inline`}),u.onrequestteardown=()=>{x().catch(_)},u.oninitialized=()=>{(async()=>{await u.sendToolInput({arguments:r.args}),await u.sendToolResult(r.result),y()})().catch(_)},u.connect(new u_(i.contentWindow,i.contentWindow)).catch(_)),f.port1.onmessage=e=>{if(!c)return;let t=e.data;if(t?.type===`revoked`){_(Error(`MCP App navigation was blocked; reopen it to continue`));return}if(t?.type!==`legacy`)return;let n=t.data;n?.channel===$y&&(async()=>{let e=nb(n.input??{});switch(n.method){case`initialized`:{y();let e=eb();return e!==re&&f.port1.postMessage({channel:$y,globals:{theme:e}}),{}}case`height`:return g(e.height),{};case`callTool`:return b(e.name,e.arguments);case`setState`:return te(e.state);case`followUp`:return ne(e.prompt);case`openLink`:return ib(e.url);case`close`:return x();default:throw Error(`Unsupported ChatGPT widget method`)}})().then(e=>{if(!c||n.id===void 0)return;let t=n.method===`callTool`&&r.protocol===`openai`?e:void 0;f.port1.postMessage({channel:$y,id:n.id,result:e,...t===void 0?{}:{globals:{toolOutput:t.structuredContent??null,toolResponseMetadata:t._meta??{}}}})},e=>{c&&n.id!==void 0&&f.port1.postMessage({channel:$y,id:n.id,error:tb(e)})})},f.port1.start();let t=()=>{i.contentWindow?.postMessage({html:Gy(r.html,e,Jy(ie),re),policy:e,protocol:r.protocol},`*`,[f.port2])};i.addEventListener(`load`,t,{once:!0}),i.srcdoc=Wy(e,re);let a=new MutationObserver(()=>{let e=eb();u?.setHostContext({theme:e}),f.port1.postMessage({channel:$y,globals:{theme:e}})});return a.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`data-theme`,`style`]}),()=>{c=!1,clearTimeout(ee),a.disconnect(),i.removeEventListener(`load`,t),f.port1.close(),f.port2.close(),u!==void 0&&u.close().catch(e=>d(tb(e))),i.srcdoc=``}}catch(e){return _(e),()=>{clearTimeout(ee),f.port1.close(),f.port2.close()}}},[e,t,n,r,m,a,o]),k(`div`,{className:`overflow-hidden rounded border border-po-border-soft`,"data-testid":`mcp-inline-app`,children:[u===null?null:D(`p`,{role:`alert`,className:`p-3 text-po-dim`,children:u}),!f&&u===null?D(`output`,{className:`p-3 text-po-faint`,children:`Loading MCP App…`}):null,D(`iframe`,{ref:s,title:`${r.tool.name} MCP App`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`,className:u===null?`block w-full border-0`:`hidden`,style:{height:c}})]})}function ob({sessionId:e,toolCallId:t}){let n=be(gy.store,t=>gy.select(t,e).runtime),[r,i]=T(null),[a,o]=T(null),[s,c]=T(!1),[l,u]=T(null),[d,f]=T(!1),[p,m]=T(null),h=de(e=>m(e),[]),g=de(()=>f(!0),[]);return Pe(()=>{if(n===null||e===null||!Ky())return;let r=!0,a;return rb(n,e,`open`,{toolCallId:t}).then(t=>{let o=t;if(a=o.leaseId,!r)return rb(n,e,`close`,{leaseId:a});m(o.state),i(o)}).catch(e=>{r&&o(tb(e))}),()=>{r=!1,a!==void 0&&rb(n,e,`close`,{leaseId:a}).catch(e=>o(tb(e)))}},[n,e,t]),d?D(`p`,{className:`text-po-faint`,children:`MCP App closed. Expand the card to view the tool result.`}):Ky()?a===null?n===null||e===null?D(`p`,{className:`text-po-faint`,children:`The interactive MCP App is unavailable in this view. Expand the card to view the tool result.`}):r===null?D(`output`,{className:`text-po-faint`,children:`Loading MCP App…`}):k(`div`,{className:`flex flex-col gap-2`,children:[k(`div`,{className:`flex items-center justify-between gap-2 text-po-faint`,children:[D(`span`,{children:r.readOnly?`Read-only MCP App`:`MCP App interactions enabled`}),r.readOnly?D(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),u(null),rb(n,e,`activate`,{leaseId:r.leaseId}).then(()=>{i({...r,readOnly:!1})}).catch(e=>u(tb(e))).finally(()=>c(!1))},className:`rounded border border-po-border-soft px-2 py-1 text-po-blue disabled:opacity-50`,children:s?`Enabling…`:`Enable interactions`}):null]}),l===null?null:D(`p`,{role:`alert`,className:`text-po-dim`,children:l}),D(ab,{runtime:n,sessionId:e,toolCallId:t,data:r,savedState:p,saveState:h,onClose:g},`${r.leaseId}-${String(r.readOnly)}`)]}):k(`p`,{role:`alert`,className:`text-po-dim`,children:[`MCP App unavailable: `,a]}):D(`p`,{className:`text-po-faint`,children:`This browser cannot securely display MCP Apps. Expand the card to view the tool result.`})}var sb={running:`running`,ok:`ok`,error:`error`,hint:`neutral`};function cb(e){let t=e.indexOf(`_`);return t<=0?{server:e,tool:``}:{server:e.slice(0,t),tool:e.slice(t+1)}}function lb({block:e}){switch(e.type){case`resource_link`:return D(`a`,{href:e.uri,target:`_blank`,rel:`noreferrer`,"data-testid":`tool-result-mcp-link`,className:`truncate text-po-blue hover:underline`,title:e.description??e.uri,children:e.title??e.name});case`resource`:return e.text===void 0?k(`span`,{"data-testid":`tool-result-mcp-resource`,className:`truncate text-po-dim`,children:[`binary `,e.mimeType??`resource`,` · `,e.uri]}):D(r,{"data-testid":`tool-result-mcp-resource`,className:`text-po-dim`,text:e.text});case`structured`:return D(r,{"data-testid":`tool-result-mcp-structured`,className:`text-po-dim`,grammar:`json`,text:JSON.stringify(e.value,null,2)});case`audio`:return k(`span`,{"data-testid":`tool-result-mcp-audio`,className:`text-po-dim`,children:[`audio · `,e.mimeType]})}}function ub({sessionId:e,toolCallId:t,toolName:n,args:a,result:o,output:c,running:l,isError:d,statuses:f}){let p=Ey(o?.details)??Ty(n,f)??cb(n),m=Oy(a),h=Ny(o?.content??[]),g=My(o?.details),_=o?.details,v=!l&&typeof _==`object`&&_&&`app`in _?_.app:void 0,ee=typeof v==`object`&&!!v&&`version`in v&&v.version===1&&`resourceUri`in v&&typeof v.resourceUri==`string`,y=Object.keys(a).length>0,b=ky({output:c,expanded:!0,isPartial:l,isError:d}),ne=b.status?.tone===`hint`,x=b.lines.length>0||b.status!==null||h.length>0||g.length>0;return D(i,{tone:fe({running:l,isError:d}),expandable:y||x,children:({expanded:n})=>k(ce,{children:[D(te,{title:`mcp`,children:k(`span`,{"data-testid":`tool-call-mcp`,className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[D(`span`,{className:`shrink-0 text-po-dim`,children:p.server}),D(`span`,{className:`shrink-0 text-po-faint`,children:`/`}),D(`span`,{className:`shrink-0 text-po-blue`,children:p.tool}),m?k(`span`,{className:`min-w-0 flex-1 truncate text-po-dim`,children:[`· `,m]}):null]})}),ee?D(Le,{children:D(ob,{sessionId:e,toolCallId:t},`${e}:${t}`)}):null,n&&y?k(Le,{"data-testid":`tool-input-mcp`,className:`flex flex-col gap-1`,children:[D(`span`,{className:`text-sm text-po-dim`,children:`Input`}),D(r,{className:`text-po-dim`,grammar:`json`,text:JSON.stringify(a,null,2)})]}):null,n&&x?k(Le,{"data-testid":`tool-result-mcp`,"data-mcp-server":p.server,className:`flex flex-col gap-1`,children:[y?D(`span`,{className:`text-sm text-po-dim`,children:`Output`}):null,b.lines.length>0?D(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-po-dim`,children:b.lines.join(`
109
+ `)}):null,h.map((e,t)=>D(u,{"data-testid":`tool-result-mcp-image`,src:`data:${e.mimeType};base64,${e.data}`,alt:`${p.tool} result ${String(t+1)}`,className:`max-h-60 max-w-full rounded border border-po-border-soft`},`${String(t)}-${e.mimeType}`)),g.map((e,t)=>D(lb,{block:e},`${String(t)}-${e.type}`)),b.status?D(s,{"data-testid":`tool-result-mcp-status`,tone:sb[b.status.tone],glyph:b.status.glyph,expands:ne,children:b.status.text}):null]}):null]})})}var db=S({tools:[],matches:(e,t,n)=>Ey(n)!==null||Ty(e,t)!==null,message:ub}),fb=(e,t)=>t===void 0?void 0:{...e,...t},pb=ue({id:`mcp`,global:{get settingsPanels(){return[fb({id:`mcp-servers`},Lv)]}},workspace:{get repositorySettingsPanel(){return $v}},session:{get fills(){return[fb({slot:`context`,id:`mcp-auth`},hy)]},get start(){return vy},get toolRenderers(){return[fb({tools:[`mcp`]},db)]}}});export{pb as webPlugin};