@akira-tl/forgerelay 1.1.0 → 1.1.2

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 (153) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +4 -2
  3. package/dist/activity/runtime/mcp-query-tools.js +16 -10
  4. package/dist/cli/mcp/external-mcp.js +481 -0
  5. package/dist/cli/mcp/status.js +295 -0
  6. package/dist/cli.js +14 -1
  7. package/dist/lsp/test-support/server-fixture.js +1 -2
  8. package/dist/mcp/oauth/auth-protocol.js +375 -0
  9. package/dist/mcp/oauth/oauth-provider.js +11 -12
  10. package/dist/mcp/oauth/oauth-store.js +2 -2
  11. package/dist/mcp/oauth/router.js +2 -6
  12. package/dist/mcp/operations/batch/executor.js +1 -1
  13. package/dist/mcp/operations/external-mcp/external-mcp-oauth.js +387 -0
  14. package/dist/mcp/operations/external-mcp/external-mcp-runtime.js +23 -6
  15. package/dist/mcp/operations/external-mcp/external-mcp.js +178 -23
  16. package/dist/mcp/operations/native-bulk-mutations.js +1 -1
  17. package/dist/mcp/process/tools.js +19 -15
  18. package/dist/mcp/request-context.js +18 -0
  19. package/dist/mcp/request-meta.js +28 -3
  20. package/dist/mcp/server/core/capabilities.js +1 -4
  21. package/dist/mcp/server/operations/runtime/filesystem-tools.js +35 -28
  22. package/dist/mcp/server/operations/runtime/operation-runtime.js +7 -7
  23. package/dist/mcp/server/transport/http-server.js +41 -20
  24. package/dist/mcp/server/workspace/runtime/workspace-open-presentation.js +2 -0
  25. package/dist/mcp/server/workspace/runtime/workspace-open.js +13 -9
  26. package/dist/mcp/server/workspace/runtime/workspace-tools.js +31 -27
  27. package/dist/runtime/config/external-mcp-auth-store.js +225 -0
  28. package/dist/runtime/config/external-mcp-config.js +76 -22
  29. package/dist/runtime/config/external-mcp-registry.js +165 -0
  30. package/dist/runtime/testing/server-fixture.js +4 -4
  31. package/dist/server.js +15 -9
  32. package/dist/ui/.vite/manifest.json +297 -298
  33. package/dist/ui/activity-panel-app.html +1 -1
  34. package/dist/ui/assets/activity-panel-app-Bw7ZFX2g.js +114 -0
  35. package/dist/ui/assets/angular-html-DeUNP12X.js +1 -0
  36. package/dist/ui/assets/{angular-ts-BearSZDb.js → angular-ts-B3v8FKi_.js} +1 -1
  37. package/dist/ui/assets/{apl-CYQtr-y6.js → apl-Bs3iQm4P.js} +1 -1
  38. package/dist/ui/assets/{astro-DDzqKIjK.js → astro-D6GHecBY.js} +1 -1
  39. package/dist/ui/assets/{blade-DkwEyHvQ.js → blade-BMNbVOHv.js} +1 -1
  40. package/dist/ui/assets/c-BquuA6bv.js +1 -0
  41. package/dist/ui/assets/{cobol-xBn5JxHE.js → cobol-BuZ6kfps.js} +1 -1
  42. package/dist/ui/assets/{coffee-BaXXvoJw.js → coffee-DgC5uBzL.js} +1 -1
  43. package/dist/ui/assets/cpp-BdvWqCaB.js +1 -0
  44. package/dist/ui/assets/{crystal-DjOpXVU1.js → crystal-0Q5qBvNI.js} +1 -1
  45. package/dist/ui/assets/css-Be_T8idh.js +1 -0
  46. package/dist/ui/assets/{edge-DNaRizoR.js → edge-DaGLdgh_.js} +1 -1
  47. package/dist/ui/assets/{elixir-CwBMwZmy.js → elixir-CMgiFIzB.js} +1 -1
  48. package/dist/ui/assets/{elm-gOUD2CW3.js → elm-B-ufMlMC.js} +1 -1
  49. package/dist/ui/assets/{erb-BcR-fjUp.js → erb-CaGiOZM-.js} +1 -1
  50. package/dist/ui/assets/{git-rebase-BAQPKHF6.js → git-rebase-CpwUWCzK.js} +1 -1
  51. package/dist/ui/assets/{glimmer-js-P_wOfSz_.js → glimmer-js-BRxccvnE.js} +1 -1
  52. package/dist/ui/assets/{glimmer-ts-B44aY1fZ.js → glimmer-ts-CgQbPzlT.js} +1 -1
  53. package/dist/ui/assets/glsl-D7JmHFr0.js +1 -0
  54. package/dist/ui/assets/graphql-C8n0eUBK.js +1 -0
  55. package/dist/ui/assets/{hack-ddU2k0nt.js → hack-lVN7KVQv.js} +1 -1
  56. package/dist/ui/assets/haml-h18lG0pS.js +1 -0
  57. package/dist/ui/assets/{handlebars-BpzaUpmz.js → handlebars-lRFjRPfj.js} +1 -1
  58. package/dist/ui/assets/heavy-payload-Cqx9MOkH.js +290 -0
  59. package/dist/ui/assets/html-DtILqTE1.js +1 -0
  60. package/dist/ui/assets/{html-derivative-B2beVdmA.js → html-derivative-CSTSmPup.js} +1 -1
  61. package/dist/ui/assets/{http-iEskZy8U.js → http-DNI8fsbY.js} +1 -1
  62. package/dist/ui/assets/{hurl-BuUsLSKv.js → hurl-DgRi60JG.js} +1 -1
  63. package/dist/ui/assets/java-CW9pZ5bh.js +1 -0
  64. package/dist/ui/assets/javascript-Cvg2UrWL.js +1 -0
  65. package/dist/ui/assets/{jinja-CRpkWwrH.js → jinja-CZw_S1FB.js} +1 -1
  66. package/dist/ui/assets/{jison-BYfSnuHj.js → jison-C56u_FZv.js} +1 -1
  67. package/dist/ui/assets/json-DW2UTv1q.js +1 -0
  68. package/dist/ui/assets/jsx-Zj5gobdD.js +1 -0
  69. package/dist/ui/assets/{julia-B8Rxy7vD.js → julia-Cvcrre-L.js} +1 -1
  70. package/dist/ui/assets/{just-DzhIWpFP.js → just-8CZ2u6Tj.js} +1 -1
  71. package/dist/ui/assets/{latex-CUNjUUL-.js → latex-D289AXWG.js} +1 -1
  72. package/dist/ui/assets/{liquid-hUg7nC61.js → liquid-CFEX3SkZ.js} +1 -1
  73. package/dist/ui/assets/lua-BKpJ0ybO.js +1 -0
  74. package/dist/ui/assets/{marko-CQmIkwMF.js → marko-D9maZ0a6.js} +1 -1
  75. package/dist/ui/assets/{mdc-CB-6dHYa.js → mdc-rM9l0qWR.js} +1 -1
  76. package/dist/ui/assets/{nginx-CQORo_Bt.js → nginx-C9w6p2C9.js} +1 -1
  77. package/dist/ui/assets/{nim-BNwBNzdn.js → nim-BRePHk0J.js} +1 -1
  78. package/dist/ui/assets/{perl-Cnz14fAJ.js → perl-CskTmiPQ.js} +1 -1
  79. package/dist/ui/assets/{php-YywDo63b.js → php-DCU_FvNI.js} +1 -1
  80. package/dist/ui/assets/{pug-BwbJp4cM.js → pug-XLaVxTvv.js} +1 -1
  81. package/dist/ui/assets/{qml-D2DY6dMH.js → qml-CaONKSl-.js} +1 -1
  82. package/dist/ui/assets/r-BCVR0ZE3.js +1 -0
  83. package/dist/ui/assets/{razor-pMTG7k41.js → razor-DDnGXxnU.js} +1 -1
  84. package/dist/ui/assets/regexp-DWGTYYVx.js +1 -0
  85. package/dist/ui/assets/{rst-CO_ndDm4.js → rst-Dz3GWvQm.js} +1 -1
  86. package/dist/ui/assets/{ruby-xzRn9gTh.js → ruby-DC3jGtMY.js} +1 -1
  87. package/dist/ui/assets/{sas-CBdtFKLA.js → sas-7mNpvsjZ.js} +1 -1
  88. package/dist/ui/assets/scss-uBsoCJVy.js +1 -0
  89. package/dist/ui/assets/shellscript-BCN9N_Jf.js +1 -0
  90. package/dist/ui/assets/{shellsession-BaZnm5rZ.js → shellsession-Hsw46VXV.js} +1 -1
  91. package/dist/ui/assets/{soy-IouG3xdB.js → soy-D6KV69HU.js} +1 -1
  92. package/dist/ui/assets/sql-CVzVQkJh.js +1 -0
  93. package/dist/ui/assets/{stata-dgbkIZHP.js → stata-BwUjXNhI.js} +1 -1
  94. package/dist/ui/assets/{surrealql-CBROnw_p.js → surrealql-CgloWqRa.js} +1 -1
  95. package/dist/ui/assets/{svelte-6r6BpX4-.js → svelte-DcC3n6IC.js} +1 -1
  96. package/dist/ui/assets/{templ-BKD_PsbL.js → templ-DOFfnWTJ.js} +1 -1
  97. package/dist/ui/assets/{tex-CKY1bwHb.js → tex-ln89VPaX.js} +1 -1
  98. package/dist/ui/assets/{ts-tags-BiYP5N_C.js → ts-tags-CWMzCstH.js} +1 -1
  99. package/dist/ui/assets/tsx-DgzfiGeK.js +1 -0
  100. package/dist/ui/assets/{twig-BTe1oPFW.js → twig-Bi2itZL9.js} +1 -1
  101. package/dist/ui/assets/typescript-CQ24f4zW.js +1 -0
  102. package/dist/ui/assets/{vue-CT0IiySh.js → vue-BS8jE5u6.js} +1 -1
  103. package/dist/ui/assets/{vue-html-B-tXcbat.js → vue-html-o38xqhyB.js} +1 -1
  104. package/dist/ui/assets/{vue-vine-C5ZyDCrs.js → vue-vine-D2NvKv50.js} +1 -1
  105. package/dist/ui/assets/xml-_44rx9_2.js +1 -0
  106. package/dist/ui/assets/{xsl-DvDSndNI.js → xsl-B5QWQPoi.js} +1 -1
  107. package/dist/ui/assets/yaml-CKL2pEWe.js +1 -0
  108. package/dist/workspaces/relay/auth/remote-auth.js +3 -5
  109. package/dist/workspaces/relay/tests/test-support.js +7 -4
  110. package/dist/workspaces/relay/workspace-relay.js +14 -8
  111. package/dist/workspaces/resources/skills.js +1 -1
  112. package/docs/chatgpt-coding-workflow.md +12 -6
  113. package/docs/configuration.md +158 -6
  114. package/docs/debugging.md +8 -5
  115. package/docs/roadmap.md +64 -3
  116. package/docs/security.md +18 -0
  117. package/package.json +11 -4
  118. package/scripts/debug/accept/bootstrap.mjs +2 -0
  119. package/scripts/debug/accept/harness.mjs +9 -2
  120. package/scripts/debug/accept/modern-http.mjs +169 -0
  121. package/scripts/debug/accept/support.mjs +10 -6
  122. package/scripts/debug/accept.mjs +1 -0
  123. package/scripts/debug/runtime.mjs +4 -1
  124. package/scripts/debug/runtime.test.mjs +9 -0
  125. package/scripts/release/parity-sandbox.mjs +35 -0
  126. package/scripts/release/release-gate.test.mjs +42 -1
  127. package/scripts/release-parity.mjs +3 -22
  128. package/scripts/release-proof.mjs +24 -4
  129. package/scripts/release-proof.test.mjs +12 -4
  130. package/dist/ui/assets/activity-panel-app-XlqSanXT.js +0 -115
  131. package/dist/ui/assets/angular-html-tB9EchbM.js +0 -1
  132. package/dist/ui/assets/c-Dv-N5hjn.js +0 -1
  133. package/dist/ui/assets/cpp-C3unXX-3.js +0 -1
  134. package/dist/ui/assets/css-8Xr4kNNH.js +0 -1
  135. package/dist/ui/assets/glsl-BvCQg9MI.js +0 -1
  136. package/dist/ui/assets/graphql-C9S90gn_.js +0 -1
  137. package/dist/ui/assets/haml-Bb1w9rMG.js +0 -1
  138. package/dist/ui/assets/heavy-payload-CJKqi8Ac.js +0 -290
  139. package/dist/ui/assets/html-dUOs5pA9.js +0 -1
  140. package/dist/ui/assets/java-BFZCrORY.js +0 -1
  141. package/dist/ui/assets/javascript-DaIQ0Zqj.js +0 -1
  142. package/dist/ui/assets/json-BQC_Yp48.js +0 -1
  143. package/dist/ui/assets/jsx-Dd-CJRf9.js +0 -1
  144. package/dist/ui/assets/lua-BoZTiL2I.js +0 -1
  145. package/dist/ui/assets/r-B5nYsy-M.js +0 -1
  146. package/dist/ui/assets/regexp-oP0lbks_.js +0 -1
  147. package/dist/ui/assets/scss-CEqgKQNf.js +0 -1
  148. package/dist/ui/assets/shellscript-DzJJiWQC.js +0 -1
  149. package/dist/ui/assets/sql-DC2rdTzV.js +0 -1
  150. package/dist/ui/assets/tsx-D2OMiPNF.js +0 -1
  151. package/dist/ui/assets/typescript-BGIABksB.js +0 -1
  152. package/dist/ui/assets/xml-CfeBNlMP.js +0 -1
  153. package/dist/ui/assets/yaml-umbj2r1g.js +0 -1
@@ -0,0 +1,114 @@
1
+ (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Object.defineProperty,t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},r=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]);function i(e){return typeof e==`string`&&r.has(e.replace(/#$/,``))}var a,o=Object.freeze({status:`aborted`});function s(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var c=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},l=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(a=globalThis).__zod_globalConfig??(a.__zod_globalConfig={});var u=globalThis.__zod_globalConfig;function d(e){return e&&Object.assign(u,e),u}function f(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 p(e,t){return typeof t==`bigint`?t.toString():t}function m(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function h(e){return e==null}function g(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ee(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var te=Symbol(`evaluating`);function _(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ne(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function re(e){return JSON.stringify(e)}function ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ae=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var se=m(()=>{if(u.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ce(e){if(oe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(oe(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function le(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ue=new Set([`string`,`number`,`symbol`]);function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function y(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 pe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var me={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function he(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return fe(e,ne(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return v(this,`shape`,e),e},checks:[]}))}function ge(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return fe(e,ne(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return v(this,`shape`,r),r},checks:[]}))}function _e(e,t){if(!ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return v(this,`shape`,n),n}}))}function ve(e,t){if(!ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return fe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return v(this,`shape`,n),n}}))}function ye(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return fe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return v(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function be(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return fe(t,ne(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return v(this,`shape`,i),i},checks:[]}))}function xe(e,t,n){return fe(t,ne(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return v(this,`shape`,i),i}}))}function b(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 Se(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 Ce(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function we(e){return typeof e==`string`?e:e?.message}function Te(e,t,n){let r=e.message?e.message:we(e.inst?._zod.def?.error?.(e))??we(t?.error?.(e))??we(n.customError?.(e))??we(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ee(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function De(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Oe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,p,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ke=s(`$ZodError`,Oe),Ae=s(`$ZodError`,Oe,{Parent:Error});function je(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Me(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ne=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new c;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Te(e,a,d())));throw ae(t,i?.callee),t}return o.value},Pe=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Te(e,a,d())));throw ae(t,i?.callee),t}return o.value},Fe=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 c;return a.issues.length?{success:!1,error:new(e??ke)(a.issues.map(e=>Te(e,i,d())))}:{success:!0,data:a.value}},Ie=Fe(Ae),Le=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Te(e,i,d())))}:{success:!0,data:a.value}},Re=Le(Ae),ze=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ne(e)(t,n,i)},Be=e=>(t,n,r)=>Ne(e)(t,n,r),Ve=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pe(e)(t,n,i)},He=e=>async(t,n,r)=>Pe(e)(t,n,r),Ue=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Fe(e)(t,n,i)},We=e=>(t,n,r)=>Fe(e)(t,n,r),Ge=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Le(e)(t,n,i)},Ke=e=>async(t,n,r)=>Le(e)(t,n,r),qe=/^[cC][0-9a-z]{6,}$/,Je=/^[0-9a-z]+$/,Ye=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xe=/^[0-9a-vA-V]{20}$/,Ze=/^[A-Za-z0-9]{27}$/,Qe=/^[a-zA-Z0-9_-]{21}$/,$e=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,et=/^([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})$/,tt=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)$/,nt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function it(){return new RegExp(rt,`u`)}var at=/^(?:(?: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])$/,ot=/^(([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}|:))$/,x=/^((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])$/,st=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ct=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lt=/^[A-Za-z0-9_-]*$/,ut=/^https?$/,dt=/^\+[1-9]\d{6,14}$/,ft=`(?:(?:\\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])))`,pt=RegExp(`^${ft}$`);function mt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ht(e){return RegExp(`^${mt(e)}$`)}function gt(e){let t=mt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ft}T(?:${r})$`)}var _t=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},vt=/^-?\d+$/,yt=/^-?\d+(?:\.\d+)?$/,bt=/^(?:true|false)$/i,xt=/^null$/i,St=/^undefined$/i,Ct=/^[^A-Z]*$/,wt=/^[^a-z]*$/,S=s(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tt={number:`number`,bigint:`bigint`,object:`date`},Et=s(`$ZodCheckLessThan`,(e,t)=>{S.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dt=s(`$ZodCheckGreaterThan`,(e,t)=>{S.init(e,t);let n=Tt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=s(`$ZodCheckMultipleOf`,(e,t)=>{S.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ee(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})}}),kt=s(`$ZodCheckNumberFormat`,(e,t)=>{S.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=me[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=vt)}),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})}}),At=s(`$ZodCheckMaxLength`,(e,t)=>{var n;S.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ee(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jt=s(`$ZodCheckMinLength`,(e,t)=>{var n;S.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ee(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mt=s(`$ZodCheckLengthEquals`,(e,t)=>{var n;S.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!h(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ee(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nt=s(`$ZodCheckStringFormat`,(e,t)=>{var n,r;S.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pt=s(`$ZodCheckRegex`,(e,t)=>{Nt.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})}}),Ft=s(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ct,Nt.init(e,t)}),It=s(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wt,Nt.init(e,t)}),Lt=s(`$ZodCheckIncludes`,(e,t)=>{S.init(e,t);let n=de(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rt=s(`$ZodCheckStartsWith`,(e,t)=>{S.init(e,t);let n=RegExp(`^${de(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zt=s(`$ZodCheckEndsWith`,(e,t)=>{S.init(e,t);let n=RegExp(`.*${de(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bt=s(`$ZodCheckOverwrite`,(e,t)=>{S.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Vt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
+ `))}},Ht={major:4,minor:4,patch:3},C=s(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ht;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=b(e),i;for(let a of t){if(a._zod.def.when){if(Se(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new c;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=b(e,t))});else{if(e.issues.length===t)continue;r||=b(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(b(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new c;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new c;return o.then(e=>t(e,r,a))}return t(o,r,a)}}_(e,`~standard`,()=>({validate:t=>{try{let n=Ie(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Re(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ut=s(`$ZodString`,(e,t)=>{C.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??_t(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),w=s(`$ZodStringFormat`,(e,t)=>{Nt.init(e,t),Ut.init(e,t)}),Wt=s(`$ZodGUID`,(e,t)=>{t.pattern??=et,w.init(e,t)}),Gt=s(`$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??=tt(e)}else t.pattern??=tt();w.init(e,t)}),Kt=s(`$ZodEmail`,(e,t)=>{t.pattern??=nt,w.init(e,t)}),qt=s(`$ZodURL`,(e,t)=>{w.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ut.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Jt=s(`$ZodEmoji`,(e,t)=>{t.pattern??=it(),w.init(e,t)}),Yt=s(`$ZodNanoID`,(e,t)=>{t.pattern??=Qe,w.init(e,t)}),Xt=s(`$ZodCUID`,(e,t)=>{t.pattern??=qe,w.init(e,t)}),Zt=s(`$ZodCUID2`,(e,t)=>{t.pattern??=Je,w.init(e,t)}),Qt=s(`$ZodULID`,(e,t)=>{t.pattern??=Ye,w.init(e,t)}),T=s(`$ZodXID`,(e,t)=>{t.pattern??=Xe,w.init(e,t)}),$t=s(`$ZodKSUID`,(e,t)=>{t.pattern??=Ze,w.init(e,t)}),en=s(`$ZodISODateTime`,(e,t)=>{t.pattern??=gt(t),w.init(e,t)}),tn=s(`$ZodISODate`,(e,t)=>{t.pattern??=pt,w.init(e,t)}),nn=s(`$ZodISOTime`,(e,t)=>{t.pattern??=ht(t),w.init(e,t)}),rn=s(`$ZodISODuration`,(e,t)=>{t.pattern??=$e,w.init(e,t)}),an=s(`$ZodIPv4`,(e,t)=>{t.pattern??=at,w.init(e,t),e._zod.bag.format=`ipv4`}),on=s(`$ZodIPv6`,(e,t)=>{t.pattern??=ot,w.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),sn=s(`$ZodCIDRv4`,(e,t)=>{t.pattern??=x,w.init(e,t)}),cn=s(`$ZodCIDRv6`,(e,t)=>{t.pattern??=st,w.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function ln(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var un=s(`$ZodBase64`,(e,t)=>{t.pattern??=ct,w.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{ln(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function dn(e){if(!lt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ln(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var fn=s(`$ZodBase64URL`,(e,t)=>{t.pattern??=lt,w.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{dn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),pn=s(`$ZodE164`,(e,t)=>{t.pattern??=dt,w.init(e,t)});function mn(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 hn=s(`$ZodJWT`,(e,t)=>{w.init(e,t),e._zod.check=n=>{mn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),gn=s(`$ZodNumber`,(e,t)=>{C.init(e,t),e._zod.pattern=e._zod.bag.pattern??yt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),_n=s(`$ZodNumberFormat`,(e,t)=>{kt.init(e,t),gn.init(e,t)}),vn=s(`$ZodBoolean`,(e,t)=>{C.init(e,t),e._zod.pattern=bt,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}}),yn=s(`$ZodUndefined`,(e,t)=>{C.init(e,t),e._zod.pattern=St,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}}),bn=s(`$ZodNull`,(e,t)=>{C.init(e,t),e._zod.pattern=xt,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}}),xn=s(`$ZodAny`,(e,t)=>{C.init(e,t),e._zod.parse=e=>e}),Sn=s(`$ZodUnknown`,(e,t)=>{C.init(e,t),e._zod.parse=e=>e}),Cn=s(`$ZodNever`,(e,t)=>{C.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function wn(e,t,n){e.issues.length&&t.issues.push(...Ce(n,e.issues)),t.value[n]=e.value}var Tn=s(`$ZodArray`,(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>wn(t,n,e))):wn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function En(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Ce(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Dn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=pe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function On(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>En(e,n,i,t,u,d))):En(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var kn=s(`$ZodObject`,(e,t)=>{if(C.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=m(()=>Dn(t));_(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=oe,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>En(n,t,e,s,r,i))):En(a,t,e,s,r,i)}return i?On(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),An=s(`$ZodObjectJIT`,(e,t)=>{kn.init(e,t);let n=e._zod.parse,r=m(()=>Dn(t)),i=e=>{let t=new Vt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=re(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=re(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
+ if (${n}.issues.length) {
5
+ if (${o} in input) {
6
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${n}.value === undefined) {
14
+ if (${o} in input) {
15
+ newResult[${o}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${o}] = ${n}.value;
19
+ }
20
+
21
+ `):c?t.write(`
22
+ if (${n}.issues.length) {
23
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
26
+ })));
27
+ }
28
+
29
+ if (${n}.value === undefined) {
30
+ if (${o} in input) {
31
+ newResult[${o}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${o}] = ${n}.value;
35
+ }
36
+
37
+ `):t.write(`
38
+ const ${n}_present = ${o} in input;
39
+ if (${n}.issues.length) {
40
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
41
+ ...iss,
42
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
43
+ })));
44
+ }
45
+ if (!${n}_present && !${n}.issues.length) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "nonoptional",
49
+ input: undefined,
50
+ path: [${o}]
51
+ });
52
+ }
53
+
54
+ if (${n}_present) {
55
+ if (${n}.value === undefined) {
56
+ newResult[${o}] = undefined;
57
+ } else {
58
+ newResult[${o}] = ${n}.value;
59
+ }
60
+ }
61
+
62
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=oe,s=!u.jitless,c=s&&se.value,l=t.catchall,d;e._zod.parse=(u,f)=>{d??=r.value;let p=u.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),u=a(u,f),l?On([],p,u,f,d,e):u):n(u,f):(u.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),u)}});function jn(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=>!b(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=>Te(e,r,d())))}),t)}var Mn=s(`$ZodUnion`,(e,t)=>{C.init(e,t),_(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),_(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),_(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),_(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>g(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=>jn(t,r,e,i)):jn(o,r,e,i)}}),Nn=s(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mn.init(e,t);let n=e._zod.parse;_(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=m(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!oe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Pn=s(`$ZodIntersection`,(e,t)=>{C.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])=>In(e,t,n)):In(e,i,a)}});function Fn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Fn(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=Fn(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 In(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),b(e))return e;let o=Fn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Ln=s(`$ZodRecord`,(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Te(e,r,d())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Ce(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Ce(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&yt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Te(e,r,d())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Ce(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Ce(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Rn=s(`$ZodEnum`,(e,t)=>{C.init(e,t);let n=f(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ue.has(typeof e)).map(e=>typeof e==`string`?de(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),zn=s(`$ZodLiteral`,(e,t)=>{if(C.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?de(e):e?de(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Bn=s(`$ZodTransform`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new c;return n.value=i,n.fallback=!0,n}});function Vn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Hn=s(`$ZodOptional`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${g(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Vn(e,r)):Vn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Un=s(`$ZodExactOptional`,(e,t)=>{Hn.init(e,t),_(e._zod,`values`,()=>t.innerType._zod.values),_(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wn=s(`$ZodNullable`,(e,t)=>{C.init(e,t),_(e._zod,`optin`,()=>t.innerType._zod.optin),_(e._zod,`optout`,()=>t.innerType._zod.optout),_(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${g(e.source)}|null)$`):void 0}),_(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Gn=s(`$ZodDefault`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Kn(e,t)):Kn(r,t)}});function Kn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qn=s(`$ZodPrefault`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Jn=s(`$ZodNonOptional`,(e,t)=>{C.init(e,t),_(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Yn(t,e)):Yn(i,e)}});function Yn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Xn=s(`$ZodCatch`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,_(e._zod,`optout`,()=>t.innerType._zod.optout),_(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Te(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Te(e,n,d()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Zn=s(`$ZodPipe`,(e,t)=>{C.init(e,t),_(e._zod,`values`,()=>t.in._zod.values),_(e._zod,`optin`,()=>t.in._zod.optin),_(e._zod,`optout`,()=>t.out._zod.optout),_(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Qn(e,t.in,n)):Qn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Qn(e,t.out,n)):Qn(r,t.out,n)}});function Qn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var $n=s(`$ZodPreprocess`,(e,t)=>{Zn.init(e,t)}),er=s(`$ZodReadonly`,(e,t)=>{C.init(e,t),_(e._zod,`propValues`,()=>t.innerType._zod.propValues),_(e._zod,`values`,()=>t.innerType._zod.values),_(e._zod,`optin`,()=>t.innerType?._zod?.optin),_(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(tr):tr(r)}});function tr(e){return e.value=Object.freeze(e.value),e}var nr=s(`$ZodLazy`,(e,t)=>{C.init(e,t),_(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),_(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),_(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),_(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),_(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),rr=s(`$ZodCustom`,(e,t)=>{S.init(e,t),C.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=>ir(t,n,r,e));ir(i,n,r,e)}});function ir(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(De(e))}}var ar,or=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 sr(){return new or}(ar=globalThis).__zod_globalRegistry??(ar.__zod_globalRegistry=sr());var cr=globalThis.__zod_globalRegistry;function lr(e,t){return new e({type:`string`,...y(t)})}function ur(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...y(t)})}function dr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...y(t)})}function fr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...y(t)})}function pr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...y(t)})}function mr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...y(t)})}function hr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...y(t)})}function gr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...y(t)})}function _r(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...y(t)})}function vr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...y(t)})}function yr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...y(t)})}function br(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...y(t)})}function xr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...y(t)})}function Sr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...y(t)})}function Cr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...y(t)})}function wr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...y(t)})}function Tr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...y(t)})}function Er(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...y(t)})}function Dr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...y(t)})}function Or(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...y(t)})}function kr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...y(t)})}function Ar(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...y(t)})}function jr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...y(t)})}function Mr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...y(t)})}function Nr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...y(t)})}function Pr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...y(t)})}function Fr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...y(t)})}function Ir(e,t){return new e({type:`number`,checks:[],...y(t)})}function Lr(e,t){return new e({type:`number`,coerce:!0,checks:[],...y(t)})}function Rr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...y(t)})}function zr(e,t){return new e({type:`boolean`,...y(t)})}function Br(e,t){return new e({type:`undefined`,...y(t)})}function Vr(e,t){return new e({type:`null`,...y(t)})}function Hr(e){return new e({type:`any`})}function Ur(e){return new e({type:`unknown`})}function Wr(e,t){return new e({type:`never`,...y(t)})}function Gr(e,t){return new Et({check:`less_than`,...y(t),value:e,inclusive:!1})}function Kr(e,t){return new Et({check:`less_than`,...y(t),value:e,inclusive:!0})}function qr(e,t){return new Dt({check:`greater_than`,...y(t),value:e,inclusive:!1})}function Jr(e,t){return new Dt({check:`greater_than`,...y(t),value:e,inclusive:!0})}function Yr(e,t){return new Ot({check:`multiple_of`,...y(t),value:e})}function Xr(e,t){return new At({check:`max_length`,...y(t),maximum:e})}function Zr(e,t){return new jt({check:`min_length`,...y(t),minimum:e})}function Qr(e,t){return new Mt({check:`length_equals`,...y(t),length:e})}function $r(e,t){return new Pt({check:`string_format`,format:`regex`,...y(t),pattern:e})}function ei(e){return new Ft({check:`string_format`,format:`lowercase`,...y(e)})}function ti(e){return new It({check:`string_format`,format:`uppercase`,...y(e)})}function ni(e,t){return new Lt({check:`string_format`,format:`includes`,...y(t),includes:e})}function ri(e,t){return new Rt({check:`string_format`,format:`starts_with`,...y(t),prefix:e})}function ii(e,t){return new zt({check:`string_format`,format:`ends_with`,...y(t),suffix:e})}function ai(e){return new Bt({check:`overwrite`,tx:e})}function oi(e){return ai(t=>t.normalize(e))}function si(){return ai(e=>e.trim())}function ci(){return ai(e=>e.toLowerCase())}function li(){return ai(e=>e.toUpperCase())}function ui(){return ai(e=>ie(e))}function di(e,t,n){return new e({type:`array`,element:t,...y(n)})}function fi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...y(n)})}function pi(e,t){let n=mi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(De(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(De(r))}},e(t.value,t)),t);return n}function mi(e,t){let n=new S({check:`custom`,...y(t)});return n._zod.check=e,n}function hi(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??cr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function E(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,E(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&D(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 gi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
+
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function _i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:yi(t,`input`,e.processors),output:yi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function D(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 D(r.element,n);if(r.type===`set`)return D(r.valueType,n);if(r.type===`lazy`)return D(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return D(r.innerType,n);if(r.type===`intersection`)return D(r.left,n)||D(r.right,n);if(r.type===`record`||r.type===`map`)return D(r.keyType,n)||D(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:D(r.in,n)||D(r.out,n);if(r.type===`object`){for(let e in r.shape)if(D(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(D(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(D(e,n))return!0;return!!(r.rest&&D(r.rest,n))}return!1}var vi=(e,t={})=>n=>{let r=hi({...n,processors:t});return E(e,r),gi(r,e),_i(r,e)},yi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=hi({...i??{},target:a,io:t,processors:n});return E(e,o),gi(o,e),_i(o,e)},bi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},xi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=bi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Si=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ci=(e,t,n,r)=>{n.type=`boolean`},wi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},Ti=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},Ei=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Di=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Oi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},ki=(e,t,n,r)=>{n.not={}},Ai=(e,t,n,r)=>{},ji=(e,t,n,r)=>{},Mi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Ni=(e,t,n,r)=>{let i=e._zod.def,a=f(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Pi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Fi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Ii=(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},Li=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Ri=(e,t,n,r)=>{n.type=`boolean`},zi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Bi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Vi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Hi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Ui=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Wi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=E(a.element,t,{...r,path:[...r.path,`items`]})},Gi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=E(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=E(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ki=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>E(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},qi=(e,t,n,r)=>{let i=e._zod.def,a=E(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=E(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ji=(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)=>E(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?E(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Yi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=E(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=E(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=E(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Xi=(e,t,n,r)=>{let i=e._zod.def,a=E(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`}]},Zi=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qi=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},$i=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ea=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ta=(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;E(o,t,r);let s=t.seen.get(e);s.ref=o},na=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ra=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ia=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},aa=(e,t,n,r)=>{let i=e._zod.innerType;E(i,t,r);let a=t.seen.get(e);a.ref=i},oa={string:xi,number:Si,boolean:Ci,bigint:wi,symbol:Ti,null:Ei,undefined:Di,void:Oi,never:ki,any:Ai,unknown:ji,date:Mi,enum:Ni,literal:Pi,nan:Fi,template_literal:Ii,file:Li,success:Ri,custom:zi,function:Bi,transform:Vi,map:Hi,set:Ui,array:Wi,object:Gi,union:Ki,intersection:qi,tuple:Ji,record:Yi,nullable:Xi,nonoptional:Zi,default:Qi,prefault:$i,catch:ea,pipe:ta,readonly:na,promise:ra,optional:ia,lazy:aa};function sa(e,t){if(`_idmap`in e){let n=e,r=hi({...t,processors:oa}),i={};for(let e of n._idmap.entries()){let[t,n]=e;E(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;gi(r,n),a[t]=_i(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=hi({...t,processors:oa});return E(e,n),gi(n,e),_i(n,e)}var ca=s(`ZodISODateTime`,(e,t)=>{en.init(e,t),A.init(e,t)});function la(e){return Mr(ca,e)}var ua=s(`ZodISODate`,(e,t)=>{tn.init(e,t),A.init(e,t)});function da(e){return Nr(ua,e)}var fa=s(`ZodISOTime`,(e,t)=>{nn.init(e,t),A.init(e,t)});function pa(e){return Pr(fa,e)}var ma=s(`ZodISODuration`,(e,t)=>{rn.init(e,t),A.init(e,t)});function ha(e){return Fr(ma,e)}var ga=s(`ZodError`,(e,t)=>{ke.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Me(e,t)},flatten:{value:t=>je(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,p,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,p,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),_a=Ne(ga),va=Pe(ga),ya=Fe(ga),ba=Le(ga),xa=ze(ga),Sa=Be(ga),Ca=Ve(ga),wa=He(ga),Ta=Ue(ga),Ea=We(ga),Da=Ge(ga),Oa=Ke(ga),ka=new WeakMap;function Aa(e,t,n){let r=Object.getPrototypeOf(e),i=ka.get(r);if(i||(i=new Set,ka.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var O=s(`ZodType`,(e,t)=>(C.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:yi(e,`input`),output:yi(e,`output`)}}),e.toJSONSchema=vi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>_a(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ya(e,t,n),e.parseAsync=async(t,n)=>va(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ba(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>xa(e,t,n),e.decode=(t,n)=>Sa(e,t,n),e.encodeAsync=async(t,n)=>Ca(e,t,n),e.decodeAsync=async(t,n)=>wa(e,t,n),e.safeEncode=(t,n)=>Ta(e,t,n),e.safeDecode=(t,n)=>Ea(e,t,n),e.safeEncodeAsync=async(t,n)=>Da(e,t,n),e.safeDecodeAsync=async(t,n)=>Oa(e,t,n),Aa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ne(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 fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(qo(e,t))},superRefine(e,t){return this.check(Jo(e,t))},overwrite(e){return this.check(ai(e))},optional(){return V(this)},exactOptional(){return Oo(this)},nullable(){return Ao(this)},nullish(){return V(Ao(this))},nonoptional(e){return Io(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return bo(this,e)},transform(e){return Bo(this,To(e))},default(e){return Mo(this,e)},prefault(e){return Po(this,e)},catch(e){return Ro(this,e)},pipe(e){return Bo(this,e)},readonly(){return Uo(this)},describe(e){let t=this.clone();return cr.add(t,{description:e}),t},meta(...e){if(e.length===0)return cr.get(this);let t=this.clone();return cr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return cr.get(e)?.description},configurable:!0}),e)),ja=s(`_ZodString`,(e,t)=>{Ut.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Aa(e,`_ZodString`,{regex(...e){return this.check($r(...e))},includes(...e){return this.check(ni(...e))},startsWith(...e){return this.check(ri(...e))},endsWith(...e){return this.check(ii(...e))},min(...e){return this.check(Zr(...e))},max(...e){return this.check(Xr(...e))},length(...e){return this.check(Qr(...e))},nonempty(...e){return this.check(Zr(1,...e))},lowercase(e){return this.check(ei(e))},uppercase(e){return this.check(ti(e))},trim(){return this.check(si())},normalize(...e){return this.check(oi(...e))},toLowerCase(){return this.check(ci())},toUpperCase(){return this.check(li())},slugify(){return this.check(ui())}})}),Ma=s(`ZodString`,(e,t)=>{Ut.init(e,t),ja.init(e,t),e.email=t=>e.check(ur(Na,t)),e.url=t=>e.check(gr(La,t)),e.jwt=t=>e.check(jr($a,t)),e.emoji=t=>e.check(_r(za,t)),e.guid=t=>e.check(dr(Fa,t)),e.uuid=t=>e.check(fr(Ia,t)),e.uuidv4=t=>e.check(pr(Ia,t)),e.uuidv6=t=>e.check(mr(Ia,t)),e.uuidv7=t=>e.check(hr(Ia,t)),e.nanoid=t=>e.check(vr(Ba,t)),e.guid=t=>e.check(dr(Fa,t)),e.cuid=t=>e.check(yr(Va,t)),e.cuid2=t=>e.check(br(Ha,t)),e.ulid=t=>e.check(xr(Ua,t)),e.base64=t=>e.check(Or(Xa,t)),e.base64url=t=>e.check(kr(Za,t)),e.xid=t=>e.check(Sr(Wa,t)),e.ksuid=t=>e.check(Cr(Ga,t)),e.ipv4=t=>e.check(wr(Ka,t)),e.ipv6=t=>e.check(Tr(qa,t)),e.cidrv4=t=>e.check(Er(Ja,t)),e.cidrv6=t=>e.check(Dr(Ya,t)),e.e164=t=>e.check(Ar(Qa,t)),e.datetime=t=>e.check(la(t)),e.date=t=>e.check(da(t)),e.time=t=>e.check(pa(t)),e.duration=t=>e.check(ha(t))});function k(e){return lr(Ma,e)}var A=s(`ZodStringFormat`,(e,t)=>{w.init(e,t),ja.init(e,t)}),Na=s(`ZodEmail`,(e,t)=>{Kt.init(e,t),A.init(e,t)});function Pa(e){return ur(Na,e)}var Fa=s(`ZodGUID`,(e,t)=>{Wt.init(e,t),A.init(e,t)}),Ia=s(`ZodUUID`,(e,t)=>{Gt.init(e,t),A.init(e,t)}),La=s(`ZodURL`,(e,t)=>{qt.init(e,t),A.init(e,t)});function Ra(e){return gr(La,e)}var za=s(`ZodEmoji`,(e,t)=>{Jt.init(e,t),A.init(e,t)}),Ba=s(`ZodNanoID`,(e,t)=>{Yt.init(e,t),A.init(e,t)}),Va=s(`ZodCUID`,(e,t)=>{Xt.init(e,t),A.init(e,t)}),Ha=s(`ZodCUID2`,(e,t)=>{Zt.init(e,t),A.init(e,t)}),Ua=s(`ZodULID`,(e,t)=>{Qt.init(e,t),A.init(e,t)}),Wa=s(`ZodXID`,(e,t)=>{T.init(e,t),A.init(e,t)}),Ga=s(`ZodKSUID`,(e,t)=>{$t.init(e,t),A.init(e,t)}),Ka=s(`ZodIPv4`,(e,t)=>{an.init(e,t),A.init(e,t)}),qa=s(`ZodIPv6`,(e,t)=>{on.init(e,t),A.init(e,t)}),Ja=s(`ZodCIDRv4`,(e,t)=>{sn.init(e,t),A.init(e,t)}),Ya=s(`ZodCIDRv6`,(e,t)=>{cn.init(e,t),A.init(e,t)}),Xa=s(`ZodBase64`,(e,t)=>{un.init(e,t),A.init(e,t)}),Za=s(`ZodBase64URL`,(e,t)=>{fn.init(e,t),A.init(e,t)}),Qa=s(`ZodE164`,(e,t)=>{pn.init(e,t),A.init(e,t)}),$a=s(`ZodJWT`,(e,t)=>{hn.init(e,t),A.init(e,t)}),eo=s(`ZodNumber`,(e,t)=>{gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),Aa(e,`ZodNumber`,{gt(e,t){return this.check(qr(e,t))},gte(e,t){return this.check(Jr(e,t))},min(e,t){return this.check(Jr(e,t))},lt(e,t){return this.check(Gr(e,t))},lte(e,t){return this.check(Kr(e,t))},max(e,t){return this.check(Kr(e,t))},int(e){return this.check(no(e))},safe(e){return this.check(no(e))},positive(e){return this.check(qr(0,e))},nonnegative(e){return this.check(Jr(0,e))},negative(e){return this.check(Gr(0,e))},nonpositive(e){return this.check(Kr(0,e))},multipleOf(e,t){return this.check(Yr(e,t))},step(e,t){return this.check(Yr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function j(e){return Ir(eo,e)}var to=s(`ZodNumberFormat`,(e,t)=>{_n.init(e,t),eo.init(e,t)});function no(e){return Rr(to,e)}var ro=s(`ZodBoolean`,(e,t)=>{vn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r)});function M(e){return zr(ro,e)}var io=s(`ZodUndefined`,(e,t)=>{yn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r)});function ao(e){return Br(io,e)}var oo=s(`ZodNull`,(e,t)=>{bn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function so(e){return Vr(oo,e)}var co=s(`ZodAny`,(e,t)=>{xn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function lo(){return Hr(co)}var uo=s(`ZodUnknown`,(e,t)=>{Sn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return Ur(uo)}var fo=s(`ZodNever`,(e,t)=>{Cn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function po(e){return Wr(fo,e)}var mo=s(`ZodArray`,(e,t)=>{Tn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.element=t.element,Aa(e,`ZodArray`,{min(e,t){return this.check(Zr(e,t))},nonempty(e){return this.check(Zr(1,e))},max(e,t){return this.check(Xr(e,t))},length(e,t){return this.check(Qr(e,t))},unwrap(){return this.element}})});function P(e,t){return di(mo,e,t)}var ho=s(`ZodObject`,(e,t)=>{An.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),_(e,`shape`,()=>t.shape),Aa(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:N()})},loose(){return this.clone({...this._zod.def,catchall:N()})},strict(){return this.clone({...this._zod.def,catchall:po()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return _e(this,e)},safeExtend(e){return ve(this,e)},merge(e){return ye(this,e)},pick(e){return he(this,e)},omit(e){return ge(this,e)},partial(...e){return be(Eo,this,e[0])},required(...e){return xe(Fo,this,e[0])}})});function F(e,t){return new ho({type:`object`,shape:e??{},...y(t)})}function I(e,t){return new ho({type:`object`,shape:e,catchall:N(),...y(t)})}var go=s(`ZodUnion`,(e,t)=>{Mn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.options=t.options});function L(e,t){return new go({type:`union`,options:e,...y(t)})}var _o=s(`ZodDiscriminatedUnion`,(e,t)=>{go.init(e,t),Nn.init(e,t)});function vo(e,t,n){return new _o({type:`union`,options:t,discriminator:e,...y(n)})}var yo=s(`ZodIntersection`,(e,t)=>{Pn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r)});function bo(e,t){return new yo({type:`intersection`,left:e,right:t})}var xo=s(`ZodRecord`,(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new xo({type:`record`,keyType:k(),valueType:e,...y(t)}):new xo({type:`record`,keyType:e,valueType:t,...y(n)})}var So=s(`ZodEnum`,(e,t)=>{Rn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new So({...t,checks:[],...y(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 So({...t,checks:[],...y(r),entries:i})}});function z(e,t){return new So({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var Co=s(`ZodLiteral`,(e,t)=>{zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(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 B(e,t){return new Co({type:`literal`,values:Array.isArray(e)?e:[e],...y(t)})}var wo=s(`ZodTransform`,(e,t)=>{Bn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new l(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(De(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(De(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function To(e){return new wo({type:`transform`,transform:e})}var Eo=s(`ZodOptional`,(e,t)=>{Hn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Eo({type:`optional`,innerType:e})}var Do=s(`ZodExactOptional`,(e,t)=>{Un.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e){return new Do({type:`optional`,innerType:e})}var ko=s(`ZodNullable`,(e,t)=>{Wn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new ko({type:`nullable`,innerType:e})}var jo=s(`ZodDefault`,(e,t)=>{Gn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mo(e,t){return new jo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var No=s(`ZodPrefault`,(e,t)=>{qn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Po(e,t){return new No({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var Fo=s(`ZodNonOptional`,(e,t)=>{Jn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Io(e,t){return new Fo({type:`nonoptional`,innerType:e,...y(t)})}var Lo=s(`ZodCatch`,(e,t)=>{Xn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ro(e,t){return new Lo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var zo=s(`ZodPipe`,(e,t)=>{Zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r),e.in=t.in,e.out=t.out});function Bo(e,t){return new zo({type:`pipe`,in:e,out:t})}var Vo=s(`ZodPreprocess`,(e,t)=>{zo.init(e,t),$n.init(e,t)}),Ho=s(`ZodReadonly`,(e,t)=>{er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uo(e){return new Ho({type:`readonly`,innerType:e})}var Wo=s(`ZodLazy`,(e,t)=>{nr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Go(e){return new Wo({type:`lazy`,getter:e})}var Ko=s(`ZodCustom`,(e,t)=>{rr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r)});function qo(e,t={}){return fi(Ko,e,t)}function Jo(e,t){return pi(e,t)}function Yo(e,t){return new Vo({type:`pipe`,in:To(e),out:t})}var Xo={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`},Zo;Zo||={};function Qo(e){return Lr(eo,e)}var $o=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],es=`io.modelcontextprotocol/related-task`,ts=`io.modelcontextprotocol/protocolVersion`,ns=`io.modelcontextprotocol/clientInfo`,rs=`io.modelcontextprotocol/serverInfo`,is=`io.modelcontextprotocol/clientCapabilities`,as=`io.modelcontextprotocol/subscriptionId`,os=`io.modelcontextprotocol/logLevel`,ss=Go(()=>L([k(),j(),M(),so(),R(k(),ss),P(ss)])),H=R(k(),ss),cs=P(ss),ls=L([k(),j().int()]),us=k(),ds=F({ttl:j().optional()}),fs=F({taskId:k()}),ps=I({progressToken:ls.optional(),[es]:fs.optional()}),U=F({_meta:ps.optional()}),ms=U.extend({task:ds.optional()}),W=F({method:k(),params:U.loose().optional()}),hs=F({_meta:ps.optional()}),gs=F({method:k(),params:hs.loose().optional()}),_s=I({get[rs](){return js.optional().catch(void 0)}}),G=I({_meta:_s.optional()}),vs=L([k(),j().int()]),ys=F({jsonrpc:B(`2.0`),id:vs,...W.shape}).strict(),bs=F({jsonrpc:B(`2.0`),...gs.shape}).strict(),xs=F({jsonrpc:B(`2.0`),id:vs,result:G}).strict(),Ss=F({jsonrpc:B(`2.0`),id:vs.optional(),error:F({code:j().int(),message:k(),data:N().optional()})}).strict(),Cs=L([ys,bs,xs,Ss]),ws=L([xs,Ss]),Ts=G.strict(),Es=hs.extend({requestId:vs.optional(),reason:k().optional()}),Ds=gs.extend({method:B(`notifications/cancelled`),params:Es}),Os=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),ks=F({icons:P(Os).optional()}),As=F({name:k(),title:k().optional()}),js=As.extend({...As.shape,...ks.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),Ms=Yo(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,bo(F({form:bo(F({applyDefaults:M().optional()}),H).optional(),url:H.optional()}),H.optional())),Ns=I({list:H.optional(),cancel:H.optional(),requests:I({sampling:I({createMessage:H.optional()}).optional(),elicitation:I({create:H.optional()}).optional()}).optional()}),Ps=I({list:H.optional(),cancel:H.optional(),requests:I({tools:I({call:H.optional()}).optional()}).optional()}),Fs=F({experimental:R(k(),H).optional(),sampling:F({context:H.optional(),tools:H.optional()}).optional(),elicitation:Ms.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:Ns.optional(),extensions:R(k(),H).optional()}),Is=U.extend({protocolVersion:k(),capabilities:Fs,clientInfo:js}),Ls=W.extend({method:B(`initialize`),params:Is}),Rs=F({experimental:R(k(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:Ps.optional(),extensions:R(k(),H).optional()}),zs=G.extend({protocolVersion:k(),capabilities:Rs,serverInfo:js,instructions:k().optional()}),Bs=gs.extend({method:B(`notifications/initialized`),params:hs.optional()}),Vs=W.extend({method:B(`server/discover`),params:U.optional()}),Hs=G.extend({supportedVersions:P(k()),capabilities:Rs,instructions:k().optional()}),Us=W.extend({method:B(`ping`),params:U.optional()}),Ws=F({progress:j(),total:V(j()),message:V(k())}),Gs=F({...hs.shape,...Ws.shape,progressToken:ls}),Ks=gs.extend({method:B(`notifications/progress`),params:Gs}),qs=U.extend({cursor:us.optional()}),Js=W.extend({params:qs.optional()}),Ys=G.extend({nextCursor:us.optional()}),Xs=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),Zs=Xs.extend({text:k()}),Qs=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),$s=Xs.extend({blob:Qs}),ec=z([`user`,`assistant`]),tc=F({audience:P(ec).optional(),priority:j().min(0).max(1).optional(),lastModified:la({offset:!0}).optional()}),nc=F({...As.shape,...ks.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:tc.optional(),_meta:V(I({}))}),rc=F({...As.shape,...ks.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:tc.optional(),_meta:V(I({}))}),ic=Js.extend({method:B(`resources/list`)}),ac=Ys.extend({resources:P(nc)}),oc=Js.extend({method:B(`resources/templates/list`)}),sc=Ys.extend({resourceTemplates:P(rc)}),cc=U.extend({uri:k()}),lc=cc,uc=W.extend({method:B(`resources/read`),params:lc}),dc=G.extend({contents:P(L([Zs,$s]))}),fc=gs.extend({method:B(`notifications/resources/list_changed`),params:hs.optional()}),pc=cc,mc=W.extend({method:B(`resources/subscribe`),params:pc}),hc=cc,gc=W.extend({method:B(`resources/unsubscribe`),params:hc}),_c=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),vc=U.extend({notifications:_c}),yc=W.extend({method:B(`subscriptions/listen`),params:vc}),bc=hs.extend({notifications:_c}),xc=gs.extend({method:B(`notifications/subscriptions/acknowledged`),params:bc}),Sc=_s.extend({[as]:vs}),Cc=G.extend({_meta:Sc}),wc=hs.extend({uri:k()}),Tc=gs.extend({method:B(`notifications/resources/updated`),params:wc}),Ec=F({name:k(),description:V(k()),required:V(M())}),Dc=F({...As.shape,...ks.shape,description:V(k()),arguments:V(P(Ec)),_meta:V(I({}))}),Oc=Js.extend({method:B(`prompts/list`)}),kc=Ys.extend({prompts:P(Dc)}),Ac=U.extend({name:k(),arguments:R(k(),k()).optional()}),jc=W.extend({method:B(`prompts/get`),params:Ac}),Mc=F({type:B(`text`),text:k(),annotations:tc.optional(),_meta:R(k(),N()).optional()}),Nc=F({type:B(`image`),data:Qs,mimeType:k(),annotations:tc.optional(),_meta:R(k(),N()).optional()}),Pc=F({type:B(`audio`),data:Qs,mimeType:k(),annotations:tc.optional(),_meta:R(k(),N()).optional()}),Fc=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Ic=F({type:B(`resource`),resource:L([Zs,$s]),annotations:tc.optional(),_meta:R(k(),N()).optional()}),Lc=nc.extend({type:B(`resource_link`)}),Rc=L([Mc,Nc,Pc,Lc,Ic]),zc=F({role:ec,content:Rc}),Bc=G.extend({description:k().optional(),messages:P(zc)}),Vc=gs.extend({method:B(`notifications/prompts/list_changed`),params:hs.optional()}),Hc=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),Uc=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),Wc=F({...As.shape,...ks.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),ss).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:I({$schema:k().optional()}).optional(),annotations:Hc.optional(),execution:Uc.optional(),_meta:R(k(),N()).optional()}),Gc=Js.extend({method:B(`tools/list`)}),Kc=Ys.extend({tools:P(Wc)}),qc=G.extend({content:P(Rc).default([]),structuredContent:N().optional(),isError:M().optional()}),Jc=qc.or(G.extend({toolResult:N()})),Yc=ms.extend({name:k(),arguments:R(k(),N()).optional()}),Xc=W.extend({method:B(`tools/call`),params:Yc}),Zc=gs.extend({method:B(`notifications/tools/list_changed`),params:hs.optional()}),Qc=F({autoRefresh:M().default(!0),debounceMs:j().int().nonnegative().default(300)}),$c=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),el=U.extend({level:$c}),tl=W.extend({method:B(`logging/setLevel`),params:el}),nl=hs.extend({level:$c,logger:k().optional(),data:N()}),rl=gs.extend({method:B(`notifications/message`),params:nl}),il=F({name:k().optional()}),al=F({hints:P(il).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),ol=F({mode:z([`auto`,`required`,`none`]).optional()}),sl=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Rc),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),cl=vo(`type`,[Mc,Nc,Pc]),ll=vo(`type`,[Mc,Nc,Pc,Fc,sl]),ul=F({role:ec,content:L([ll,P(ll)]),_meta:R(k(),N()).optional()}),dl=ms.extend({messages:P(ul),modelPreferences:al.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:H.optional(),tools:P(Wc).optional(),toolChoice:ol.optional()}),fl=W.extend({method:B(`sampling/createMessage`),params:dl}),pl=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:ec,content:cl}),ml=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:ec,content:L([ll,P(ll)])}),hl=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),gl=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),_l=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),vl=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),yl=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),bl=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),xl=L([vl,yl]),Sl=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Cl=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),wl=L([Sl,Cl]),Tl=L([bl,xl,wl]),El=L([Tl,hl,gl,_l]),Dl=ms.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),El),required:P(k()).optional()}).catchall(N())}),Ol=ms.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),kl=L([Dl,Ol]),Al=W.extend({method:B(`elicitation/create`),params:kl}),jl=hs.extend({elicitationId:k()}),Ml=gs.extend({method:B(`notifications/elicitation/complete`),params:jl}),Nl=G.extend({action:z([`accept`,`decline`,`cancel`]),content:Yo(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Pl=F({type:B(`ref/resource`),uri:k()}),Fl=F({type:B(`ref/prompt`),name:k()}),Il=U.extend({ref:L([Fl,Pl]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Ll=W.extend({method:B(`completion/complete`),params:Il}),Rl=G.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),zl=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Bl=W.extend({method:B(`roots/list`),params:U.optional()}),Vl=G.extend({roots:P(zl)}),Hl=gs.extend({method:B(`notifications/roots/list_changed`),params:hs.optional()}),Ul=I({ttl:j().optional(),pollInterval:j().optional()}),Wl=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Gl=F({taskId:k(),status:Wl,ttl:L([j(),so()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),Kl=G.extend({task:Gl}),ql=hs.merge(Gl),Jl=gs.extend({method:B(`notifications/tasks/status`),params:ql}),Yl=W.extend({method:B(`tasks/get`),params:U.extend({taskId:k()})}),Xl=G.merge(Gl),Zl=W.extend({method:B(`tasks/result`),params:U.extend({taskId:k()})}),Ql=G.loose(),$l=Js.extend({method:B(`tasks/list`)}),eu=Ys.extend({tasks:P(Gl)}),tu=W.extend({method:B(`tasks/cancel`),params:U.extend({taskId:k()})}),nu=G.merge(Gl),ru=L([Us,Ls,Vs,Ll,tl,jc,Oc,ic,oc,uc,mc,gc,yc,Xc,Gc]),iu=L([Ds,Ks,Bs,Hl]),au=L([Ts,pl,ml,Nl,Vl]),ou=L([Us,fl,Al,Bl]),su=L([Ds,Ks,rl,Tc,fc,Zc,Vc,xc,Ml]),cu=L([Ts,zs,Hs,Rl,Bc,kc,ac,sc,dc,qc,Kc,Cc]),K=Ra().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Xo.custom,message:`URL must be parseable`,fatal:!0}),o}).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`}),lu=I({resource:k().url(),authorization_servers:P(K).optional(),jwks_uri:k().url().optional(),scopes_supported:P(k()).optional(),bearer_methods_supported:P(k()).optional(),resource_signing_alg_values_supported:P(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:M().optional(),authorization_details_types_supported:P(k()).optional(),dpop_signing_alg_values_supported:P(k()).optional(),dpop_bound_access_tokens_required:M().optional()}),uu=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),service_documentation:K.optional(),revocation_endpoint:K.optional(),revocation_endpoint_auth_methods_supported:P(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:P(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P(k()).optional(),code_challenge_methods_supported:P(k()).optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),du=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,userinfo_endpoint:K.optional(),jwks_uri:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),acr_values_supported:P(k()).optional(),subject_types_supported:P(k()),id_token_signing_alg_values_supported:P(k()),id_token_encryption_alg_values_supported:P(k()).optional(),id_token_encryption_enc_values_supported:P(k()).optional(),userinfo_signing_alg_values_supported:P(k()).optional(),userinfo_encryption_alg_values_supported:P(k()).optional(),userinfo_encryption_enc_values_supported:P(k()).optional(),request_object_signing_alg_values_supported:P(k()).optional(),request_object_encryption_alg_values_supported:P(k()).optional(),request_object_encryption_enc_values_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),display_values_supported:P(k()).optional(),claim_types_supported:P(k()).optional(),claims_supported:P(k()).optional(),service_documentation:k().optional(),claims_locales_supported:P(k()).optional(),ui_locales_supported:P(k()).optional(),claims_parameter_supported:M().optional(),request_parameter_supported:M().optional(),request_uri_parameter_supported:M().optional(),require_request_uri_registration:M().optional(),op_policy_uri:K.optional(),op_tos_uri:K.optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),fu=F({...du.shape,...uu.pick({code_challenge_methods_supported:!0}).shape}),pu=F({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:Qo().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),mu=F({issued_token_type:B(`urn:ietf:params:oauth:token-type:id-jag`),access_token:k(),token_type:k().optional(),expires_in:j().optional(),scope:k().optional()}).strip(),hu=F({error:k(),error_description:k().optional(),error_uri:k().optional()}),gu=K.optional().or(B(``).transform(()=>void 0)),_u=F({redirect_uris:P(K),token_endpoint_auth_method:k().optional(),grant_types:P(k()).optional(),response_types:P(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:K.optional(),logo_uri:gu,scope:k().optional(),contacts:P(k()).optional(),tos_uri:gu,policy_uri:k().optional(),jwks_uri:K.optional(),jwks:lo().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),vu=F({client_id:k(),client_secret:k().optional(),client_id_issued_at:j().optional(),client_secret_expires_at:j().optional()}).strip(),yu=_u.merge(vu),bu=F({error:k(),error_description:k().optional()}).strip(),xu=F({token:k(),token_type_hint:k().optional()}).strip(),Su=Symbol.for(`mcp.sdk.errorBrands`);function Cu(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,Su,{value:n,enumerable:!1,configurable:!0})}function wu(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Su)){let n=t[Su];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 wu(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 wu(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Cu(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 q=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}({}),J=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return wu(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 wu(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Cu(this,new.target)}};(class extends J{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Tu=`2026-07-28`;function Eu(e){return e>=Tu}function Du(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 Ou=[`task`,`inputRequests`,`requestState`];function ku(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Ou.some(t=>t in e)?e:{...e,content:[]}}function Au(){let e=Go(()=>L([k(),j(),M(),so(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=F({ttl:j().optional()}),a=F({taskId:k()}),o=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=F({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=F({method:k(),params:s.loose().optional()}),u=F({_meta:o.optional()}),d=F({method:k(),params:u.loose().optional()}),f=I({_meta:o.optional()}),p=L([k(),j().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:k().optional()}),g=d.extend({method:B(`notifications/cancelled`),params:h}),ee=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),te=F({icons:P(ee).optional()}),_=F({name:k(),title:k().optional()}),v=_.extend({..._.shape,...te.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),ne=Yo(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,bo(F({form:bo(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),re=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ie=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),ae=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:re.optional(),extensions:R(k(),t).optional()}),oe=s.extend({protocolVersion:k(),capabilities:ae,clientInfo:v}),se=l.extend({method:B(`initialize`),params:oe}),ce=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ie.optional(),extensions:R(k(),t).optional()}),le=f.extend({protocolVersion:k(),capabilities:ce,serverInfo:v,instructions:k().optional()}),ue=d.extend({method:B(`notifications/initialized`),params:u.optional()}),de=l.extend({method:B(`ping`),params:s.optional()}),fe=F({progress:j(),total:V(j()),message:V(k())}),y=F({...u.shape,...fe.shape,progressToken:n}),pe=d.extend({method:B(`notifications/progress`),params:y}),me=s.extend({cursor:r.optional()}),he=l.extend({params:me.optional()}),ge=f.extend({nextCursor:r.optional()}),_e=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),ve=_e.extend({text:k()}),ye=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),be=_e.extend({blob:ye}),xe=z([`user`,`assistant`]),b=F({audience:P(xe).optional(),priority:j().min(0).max(1).optional(),lastModified:la({offset:!0}).optional()}),Se=F({..._.shape,...te.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:b.optional(),_meta:V(I({}))}),Ce=F({..._.shape,...te.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:b.optional(),_meta:V(I({}))}),we=he.extend({method:B(`resources/list`)}),Te=ge.extend({resources:P(Se)}),Ee=he.extend({method:B(`resources/templates/list`)}),De=ge.extend({resourceTemplates:P(Ce)}),Oe=s.extend({uri:k()}),ke=Oe,Ae=l.extend({method:B(`resources/read`),params:ke}),je=f.extend({contents:P(L([ve,be]))}),Me=d.extend({method:B(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:B(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:B(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:k()}),Re=d.extend({method:B(`notifications/resources/updated`),params:Le}),ze=F({name:k(),description:V(k()),required:V(M())}),Be=F({..._.shape,...te.shape,description:V(k()),arguments:V(P(ze)),_meta:V(I({}))}),Ve=he.extend({method:B(`prompts/list`)}),He=ge.extend({prompts:P(Be)}),Ue=s.extend({name:k(),arguments:R(k(),k()).optional()}),We=l.extend({method:B(`prompts/get`),params:Ue}),Ge=F({type:B(`text`),text:k(),annotations:b.optional(),_meta:R(k(),N()).optional()}),Ke=F({type:B(`image`),data:ye,mimeType:k(),annotations:b.optional(),_meta:R(k(),N()).optional()}),qe=F({type:B(`audio`),data:ye,mimeType:k(),annotations:b.optional(),_meta:R(k(),N()).optional()}),Je=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Ye=F({type:B(`resource`),resource:L([ve,be]),annotations:b.optional(),_meta:R(k(),N()).optional()}),Xe=Se.extend({type:B(`resource_link`)}),Ze=L([Ge,Ke,qe,Xe,Ye]),Qe=F({role:xe,content:Ze}),$e=f.extend({description:k().optional(),messages:P(Qe)}),et=d.extend({method:B(`notifications/prompts/list_changed`),params:u.optional()}),tt=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),nt=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),rt=F({..._.shape,...te.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()).optional(),annotations:tt.optional(),execution:nt.optional(),_meta:R(k(),N()).optional()}),it=he.extend({method:B(`tools/list`)}),at=ge.extend({tools:P(rt)}),ot=f.extend({content:P(Ze),structuredContent:R(k(),N()).optional(),isError:M().optional()}),x=c.extend({name:k(),arguments:R(k(),N()).optional()}),st=l.extend({method:B(`tools/call`),params:x}),ct=d.extend({method:B(`notifications/tools/list_changed`),params:u.optional()}),lt=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),ut=s.extend({level:lt}),dt=l.extend({method:B(`logging/setLevel`),params:ut}),ft=u.extend({level:lt,logger:k().optional(),data:N()}),pt=d.extend({method:B(`notifications/message`),params:ft}),mt=F({name:k().optional()}),ht=F({hints:P(mt).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),gt=F({mode:z([`auto`,`required`,`none`]).optional()}),_t=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Ze),structuredContent:F({}).loose().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),vt=vo(`type`,[Ge,Ke,qe]),yt=vo(`type`,[Ge,Ke,qe,Je,_t]),bt=F({role:xe,content:L([yt,P(yt)]),_meta:R(k(),N()).optional()}),xt=c.extend({messages:P(bt),modelPreferences:ht.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(rt).optional(),toolChoice:gt.optional()}),St=l.extend({method:B(`sampling/createMessage`),params:xt}),Ct=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:xe,content:vt}),wt=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:xe,content:L([yt,P(yt)])}),S=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Tt=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Et=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Dt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Ot=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),kt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),At=L([Dt,Ot]),jt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Mt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Nt=L([jt,Mt]),Pt=L([kt,At,Nt]),Ft=L([Pt,S,Tt,Et]),It=c.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ft),required:P(k()).optional()}).catchall(N())}),Lt=c.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Rt=L([It,Lt]),zt=l.extend({method:B(`elicitation/create`),params:Rt}),Bt=u.extend({elicitationId:k()}),Vt=d.extend({method:B(`notifications/elicitation/complete`),params:Bt}),Ht=f.extend({action:z([`accept`,`decline`,`cancel`]),content:Yo(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),C=F({type:B(`ref/resource`),uri:k()}),Ut=F({type:B(`ref/prompt`),name:k()}),w=s.extend({ref:L([Ut,C]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Wt=l.extend({method:B(`completion/complete`),params:w}),Gt=f.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Kt=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),qt=l.extend({method:B(`roots/list`),params:s.optional()}),Jt=f.extend({roots:P(Kt)}),Yt=d.extend({method:B(`notifications/roots/list_changed`),params:u.optional()}),Xt=I({ttl:j().optional(),pollInterval:j().optional()}),Zt=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Qt=F({taskId:k(),status:Zt,ttl:L([j(),so()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),T=f.extend({task:Qt}),$t=u.merge(Qt),en=d.extend({method:B(`notifications/tasks/status`),params:$t}),tn=l.extend({method:B(`tasks/get`),params:s.extend({taskId:k()})}),nn=f.merge(Qt),rn=l.extend({method:B(`tasks/result`),params:s.extend({taskId:k()})}),an=f.loose(),on=he.extend({method:B(`tasks/list`)}),sn=ge.extend({tasks:P(Qt)}),cn=l.extend({method:B(`tasks/cancel`),params:s.extend({taskId:k()})});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:ee,IconsSchema:te,BaseMetadataSchema:_,ImplementationSchema:v,ClientTasksCapabilitySchema:re,ServerTasksCapabilitySchema:ie,ClientCapabilitiesSchema:ae,InitializeRequestParamsSchema:oe,InitializeRequestSchema:se,ServerCapabilitiesSchema:ce,InitializeResultSchema:le,InitializedNotificationSchema:ue,PingRequestSchema:de,ProgressSchema:fe,ProgressNotificationParamsSchema:y,ProgressNotificationSchema:pe,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:he,PaginatedResultSchema:ge,ResourceContentsSchema:_e,TextResourceContentsSchema:ve,BlobResourceContentsSchema:be,RoleSchema:xe,AnnotationsSchema:b,ResourceSchema:Se,ResourceTemplateSchema:Ce,ListResourcesRequestSchema:we,ListResourcesResultSchema:Te,ListResourceTemplatesRequestSchema:Ee,ListResourceTemplatesResultSchema:De,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:ke,ReadResourceRequestSchema:Ae,ReadResourceResultSchema:je,ResourceListChangedNotificationSchema:Me,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Pe,UnsubscribeRequestParamsSchema:Fe,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Re,PromptArgumentSchema:ze,PromptSchema:Be,ListPromptsRequestSchema:Ve,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Ue,GetPromptRequestSchema:We,TextContentSchema:Ge,ImageContentSchema:Ke,AudioContentSchema:qe,ToolUseContentSchema:Je,EmbeddedResourceSchema:Ye,ResourceLinkSchema:Xe,ContentBlockSchema:Ze,PromptMessageSchema:Qe,GetPromptResultSchema:$e,PromptListChangedNotificationSchema:et,ToolAnnotationsSchema:tt,ToolExecutionSchema:nt,ToolSchema:rt,ListToolsRequestSchema:it,ListToolsResultSchema:at,CallToolResultSchema:ot,CallToolRequestParamsSchema:x,CallToolRequestSchema:st,ToolListChangedNotificationSchema:ct,LoggingLevelSchema:lt,SetLevelRequestParamsSchema:ut,SetLevelRequestSchema:dt,LoggingMessageNotificationParamsSchema:ft,LoggingMessageNotificationSchema:pt,ModelHintSchema:mt,ModelPreferencesSchema:ht,ToolChoiceSchema:gt,ToolResultContentSchema:_t,SamplingContentSchema:vt,SamplingMessageContentBlockSchema:yt,SamplingMessageSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,CreateMessageResultSchema:Ct,CreateMessageResultWithToolsSchema:wt,BooleanSchemaSchema:S,StringSchemaSchema:Tt,NumberSchemaSchema:Et,UntitledSingleSelectEnumSchemaSchema:Dt,TitledSingleSelectEnumSchemaSchema:Ot,LegacyTitledEnumSchemaSchema:kt,SingleSelectEnumSchemaSchema:At,UntitledMultiSelectEnumSchemaSchema:jt,TitledMultiSelectEnumSchemaSchema:Mt,MultiSelectEnumSchemaSchema:Nt,EnumSchemaSchema:Pt,PrimitiveSchemaDefinitionSchema:Ft,ElicitRequestFormParamsSchema:It,ElicitRequestURLParamsSchema:Lt,ElicitRequestParamsSchema:Rt,ElicitRequestSchema:zt,ElicitationCompleteNotificationParamsSchema:Bt,ElicitationCompleteNotificationSchema:Vt,ElicitResultSchema:Ht,ResourceTemplateReferenceSchema:C,PromptReferenceSchema:Ut,CompleteRequestParamsSchema:w,CompleteRequestSchema:Wt,CompleteResultSchema:Gt,RootSchema:Kt,ListRootsRequestSchema:qt,ListRootsResultSchema:Jt,RootsListChangedNotificationSchema:Yt,TaskCreationParamsSchema:Xt,TaskStatusSchema:Zt,TaskSchema:Qt,CreateTaskResultSchema:T,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:nn,GetTaskPayloadRequestSchema:rn,GetTaskPayloadResultSchema:an,ListTasksRequestSchema:on,ListTasksResultSchema:sn,CancelTaskRequestSchema:cn,CancelTaskResultSchema:f.merge(Qt),ClientRequestSchema:L([de,se,Wt,dt,We,Ve,we,Ee,Ae,Pe,Ie,st,it,tn,rn,on,cn]),ClientNotificationSchema:L([g,pe,ue,Yt,en]),ClientResultSchema:L([m,Ct,wt,Ht,Jt,nn,sn,T]),ServerRequestSchema:L([de,St,zt,qt,tn,rn,on,cn]),ServerNotificationSchema:L([g,pe,pt,Re,Me,ct,et,en,Vt]),ServerResultSchema:L([m,le,Gt,$e,He,Te,De,je,ot,at,nn,sn,T]),CallToolResultWireSchema:N().superRefine((e,t)=>{if(!(typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0)){for(let n of Ou)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(ku).pipe(ot)}}var ju;function Mu(){return ju??=Au()}function Nu(e){return e.type!==`object`}var Pu=new Set([`const`,`enum`,`default`,`examples`]),Fu=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Iu(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Lu(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Iu(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(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&&Iu(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:Pu.has(o)?i[o]=s:Fu.has(o)?i[o]=r(s,!0):i[o]=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 Ru={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},zu={"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},Bu={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},Vu;function Hu(){if(Vu)return Vu;let e=Mu();return Vu={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}},Vu}function Uu(e){return Object.prototype.hasOwnProperty.call(Ru,e)}function Wu(e){return Object.prototype.hasOwnProperty.call(zu,e)}function Gu(e){return Object.prototype.hasOwnProperty.call(Bu,e)}function Ku(e){return Gu(e)?Hu().resultSchemas[e]:void 0}function qu(e){return Uu(e)?Hu().requestSchemas[e]:void 0}function Ju(e){return Wu(e)?Hu().notificationSchemas[e]:void 0}function Yu(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xu(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 Zu={ok:!1,reason:`not-in-era`};function Qu(e){return Yu(e)&&Yu(e.outputSchema)&&Nu(e.outputSchema)}function $u(e){return e}var ed={era:`2025-11-25`,hasRequestMethod:Uu,hasNotificationMethod:Wu,validateRequest:(e,t)=>Xu(qu(e),t),validateResult:(e,t)=>Xu(Ku(e),t),validateNotification:(e,t)=>Xu(Ju(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Zu,validateInputResponse:()=>Zu,samplingResultVariant:((e,t)=>{let n=Mu();return Xu(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Du(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Nu(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Yu(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:$u(e)}}return{kind:`complete`,result:$u(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Qu(e))?t:{...t,tools:n.map(e=>Qu(e)?{...e,outputSchema:Lu(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function td(){let e=Go(()=>L([k(),j(),M(),so(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=L([k(),j().int()]),a=z([`user`,`assistant`]),o=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=F({ttl:j().optional()}),l=F({taskId:k()}),u=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=F({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=F({_meta:u.optional()}),m=F({method:k(),params:p.loose().optional()}),h=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),g=F({icons:P(h).optional()}),ee=F({name:k(),title:k().optional()}),te=ee.extend({...ee.shape,...g.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),_=Yo(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,bo(F({form:bo(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),v=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ne=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),re=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:_.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:v.optional(),extensions:R(k(),t).optional()}),ie=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ne.optional(),extensions:R(k(),t).optional()}),ae=F({progress:j(),total:V(j()),message:V(k())}),oe=F({...p.shape,...ae.shape,progressToken:n}),se=m.extend({method:B(`notifications/progress`),params:oe}),ce=p.extend({level:o,logger:k().optional(),data:N()}),le=m.extend({method:B(`notifications/message`),params:ce}),ue=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),de=ue.extend({text:k()}),fe=ue.extend({blob:s}),y=F({audience:P(a).optional(),priority:j().min(0).max(1).optional(),lastModified:la({offset:!0}).optional()}),pe=F({...ee.shape,...g.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:y.optional(),_meta:V(I({}))}),me=F({...ee.shape,...g.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:y.optional(),_meta:V(I({}))}),he=m.extend({method:B(`notifications/resources/list_changed`),params:p.optional()}),ge=p.extend({uri:k()}),_e=m.extend({method:B(`notifications/resources/updated`),params:ge}),ve=F({name:k(),description:V(k()),required:V(M())}),ye=F({...ee.shape,...g.shape,description:V(k()),arguments:V(P(ve)),_meta:V(I({}))}),be=m.extend({method:B(`notifications/prompts/list_changed`),params:p.optional()}),xe=F({type:B(`text`),text:k(),annotations:y.optional(),_meta:R(k(),N()).optional()}),b=F({type:B(`image`),data:s,mimeType:k(),annotations:y.optional(),_meta:R(k(),N()).optional()}),Se=F({type:B(`audio`),data:s,mimeType:k(),annotations:y.optional(),_meta:R(k(),N()).optional()}),Ce=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),we=F({type:B(`resource`),resource:L([de,fe]),annotations:y.optional(),_meta:R(k(),N()).optional()}),Te=pe.extend({type:B(`resource_link`)}),Ee=L([xe,b,Se,Te,we]),De=F({role:a,content:Ee}),Oe=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),ke=m.extend({method:B(`notifications/tools/list_changed`),params:p.optional()}),Ae=F({name:k().optional()}),je=F({hints:P(Ae).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),Me=F({mode:z([`auto`,`required`,`none`]).optional()}),Ne=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Pe=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Fe=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Ie=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Le=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Re=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),ze=L([Ie,Le]),Be=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Ve=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),He=L([Be,Ve]),Ue=L([Re,ze,He]),We=L([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),We),required:P(k()).optional()}).catchall(N())}),Ke=F({type:B(`ref/resource`),uri:k()}),qe=F({type:B(`ref/prompt`),name:k()}),Je=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Ye=re.shape,Xe=F({experimental:Ye.experimental,sampling:Ye.sampling,elicitation:Ye.elicitation,roots:Ye.roots,extensions:Ye.extensions}),Ze=ie.shape,Qe=F({experimental:Ze.experimental,logging:Ze.logging,completions:Ze.completions,prompts:Ze.prompts,resources:Ze.resources,tools:Ze.tools,extensions:Ze.extensions}),$e=I({progressToken:n.optional(),[ts]:k(),[ns]:te.optional(),[is]:Xe,[os]:o.optional()}),et=F({...ee.shape,...g.shape,description:k().optional(),inputSchema:I({$schema:k().optional(),type:B(`object`)}),outputSchema:I({$schema:k().optional()}).optional(),annotations:Oe.optional(),_meta:R(k(),N()).optional()}),tt=F({type:B(`tool_result`),toolUseId:k(),content:P(Ee),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),nt=L([xe,b,Se,Ce,tt]),rt=F({role:a,content:L([nt,P(nt)]),_meta:R(k(),N()).optional()}),it=k(),at=I({[rs]:te.optional().catch(void 0)}),ot=at.optional();function x(e){return I({_meta:ot,resultType:it.default(`complete`),...e})}let st=x({}),ct=x({nextCursor:r.optional()}),lt=x({content:P(Ee),structuredContent:N().optional(),isError:M().optional()}),ut=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P(et),nextCursor:r.optional()}),dt=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),ft=x({description:k().optional(),messages:P(De)}),pt=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(pe),nextCursor:r.optional()}),mt=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),ht=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([de,fe]))}),gt=x({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),_t=x({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`])}),vt=x({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Qe,instructions:k().optional()}),yt=F({messages:P(rt),modelPreferences:je.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(et).optional(),toolChoice:Me.optional()}),bt=F({method:B(`sampling/createMessage`),params:yt}),xt=F({method:B(`roots/list`),params:F({_meta:R(k(),N()).optional()}).optional()}),St=F({...rt.shape,model:k(),stopReason:k().optional()}),Ct=F({roots:P(Je)}),wt=F({action:z([`accept`,`decline`,`cancel`]),content:R(k(),L([k(),j(),M(),P(k())])).optional()}),S=F({mode:B(`url`),message:k(),url:k().url()}),Tt=L([Ge,S]),Et=F({method:B(`elicitation/create`),params:Tt}),Dt=L([bt,xt,Et]),Ot=L([St,Ct,wt]),kt=R(k(),Dt),At=R(k(),Ot),jt=x({inputRequests:kt.optional(),requestState:k().optional()}),Mt={inputResponses:At.optional(),requestState:k().optional()},Nt=F({_meta:$e,...Mt}),Pt=I({progressToken:n.optional()});function Ft(e,t){return F({method:B(e),params:F({_meta:$e,...t})})}function It(e,t){return F({method:B(e),params:F({_meta:Pt.optional(),...t}).optional()})}let Lt={name:k(),arguments:R(k(),N()).optional(),...Mt},Rt={cursor:r.optional()},zt=Ft(`tools/call`,Lt),Bt=Ft(`tools/list`,Rt),Vt=Ft(`prompts/list`,Rt),Ht=Ft(`prompts/get`,{name:k(),arguments:R(k(),k()).optional(),...Mt}),C=Ft(`resources/list`,Rt),Ut=Ft(`resources/templates/list`,Rt),w=Ft(`resources/read`,{uri:k(),...Mt}),Wt={ref:L([qe,Ke]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()},Gt=Ft(`completion/complete`,Wt),Kt=Ft(`server/discover`,{}),qt=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Jt={notifications:qt},Yt=Ft(`subscriptions/listen`,Jt),Xt=at.extend({"io.modelcontextprotocol/subscriptionId":i}),Zt=I({_meta:Xt,resultType:it.default(`complete`)}),Qt={"tools/call":It(`tools/call`,Lt),"tools/list":It(`tools/list`,Rt),"prompts/get":It(`prompts/get`,{name:k(),arguments:R(k(),k()).optional()}),"prompts/list":It(`prompts/list`,Rt),"resources/list":It(`resources/list`,Rt),"resources/templates/list":It(`resources/templates/list`,Rt),"resources/read":It(`resources/read`,{uri:k()}),"completion/complete":It(`completion/complete`,Wt),"server/discover":It(`server/discover`,{}),"subscriptions/listen":It(`subscriptions/listen`,Jt)};function T(e){return I({_meta:ot,...e})}let $t={"tools/call":T({content:P(Ee),structuredContent:N().optional(),isError:M().optional()}),"tools/list":T({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P(et),nextCursor:r.optional()}),"prompts/get":T({description:k().optional(),messages:P(De)}),"prompts/list":T({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),"resources/list":T({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(pe),nextCursor:r.optional()}),"resources/templates/list":T({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),"resources/read":T({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([de,fe]))}),"completion/complete":T({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),"server/discover":T({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Qe,instructions:k().optional()}),"subscriptions/listen":T({})},en=I({"io.modelcontextprotocol/subscriptionId":i.optional()}),tn=F({method:B(`notifications/subscriptions/acknowledged`),params:F({_meta:en.optional(),notifications:qt})}),nn=F({_meta:en.optional(),requestId:i,reason:k().optional()}),rn=F({method:B(`notifications/cancelled`),params:nn}),an={"notifications/cancelled":rn,"notifications/progress":se,"notifications/message":le,"notifications/resources/updated":_e,"notifications/resources/list_changed":he,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":be,"notifications/subscriptions/acknowledged":tn},on=e=>F({jsonrpc:B(`2.0`),id:L([k(),j().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:ee,ImplementationSchema:te,ClientTasksCapabilitySchema:v,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:ae,ProgressNotificationParamsSchema:oe,ProgressNotificationSchema:se,LoggingMessageNotificationParamsSchema:ce,LoggingMessageNotificationSchema:le,ResourceContentsSchema:ue,TextResourceContentsSchema:de,BlobResourceContentsSchema:fe,AnnotationsSchema:y,ResourceSchema:pe,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:he,ResourceUpdatedNotificationParamsSchema:ge,ResourceUpdatedNotificationSchema:_e,PromptArgumentSchema:ve,PromptSchema:ye,PromptListChangedNotificationSchema:be,TextContentSchema:xe,ImageContentSchema:b,AudioContentSchema:Se,ToolUseContentSchema:Ce,EmbeddedResourceSchema:we,ResourceLinkSchema:Te,ContentBlockSchema:Ee,PromptMessageSchema:De,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:ke,ModelHintSchema:Ae,ModelPreferencesSchema:je,ToolChoiceSchema:Me,BooleanSchemaSchema:Ne,StringSchemaSchema:Pe,NumberSchemaSchema:Fe,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:Le,LegacyTitledEnumSchemaSchema:Re,SingleSelectEnumSchemaSchema:ze,UntitledMultiSelectEnumSchemaSchema:Be,TitledMultiSelectEnumSchemaSchema:Ve,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Ue,PrimitiveSchemaDefinitionSchema:We,ElicitRequestFormParamsSchema:Ge,ResourceTemplateReferenceSchema:Ke,PromptReferenceSchema:qe,RootSchema:Je,ClientCapabilities2026Schema:Xe,ServerCapabilities2026Schema:Qe,RequestMetaEnvelopeSchema:$e,ToolSchema:et,ToolResultContentSchema:tt,SamplingMessageContentBlockSchema:nt,SamplingMessageSchema:rt,ResultTypeSchema:it,ResultMetaSchema:at,ResultSchema:st,PaginatedResultSchema:ct,CallToolResultSchema:lt,ListToolsResultSchema:ut,ListPromptsResultSchema:dt,GetPromptResultSchema:ft,ListResourcesResultSchema:pt,ListResourceTemplatesResultSchema:mt,ReadResourceResultSchema:ht,CompleteResultSchema:gt,CacheableResultSchema:_t,DiscoverResultSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,ListRootsRequestSchema:xt,CreateMessageResultSchema:St,ListRootsResultSchema:Ct,ElicitResultSchema:wt,ElicitRequestURLParamsSchema:S,ElicitRequestParamsSchema:Tt,ElicitRequestSchema:Et,InputRequestSchema:Dt,InputResponseSchema:Ot,InputRequestsSchema:kt,InputResponsesSchema:At,InputRequiredResultSchema:jt,InputResponseRequestParamsSchema:Nt,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:C,ListResourceTemplatesRequestSchema:Ut,ReadResourceRequestSchema:w,CompleteRequestSchema:Gt,DiscoverRequestSchema:Kt,SubscriptionFilterSchema:qt,SubscriptionsListenRequestSchema:Yt,SubscriptionsListenResultMetaSchema:Xt,SubscriptionsListenResultSchema:Zt,dispatchRequestSchemas:Qt,dispatchResultSchemas:$t,NotificationMetaSchema:en,SubscriptionsAcknowledgedNotificationSchema:tn,CancelledNotificationParamsSchema:nn,CancelledNotificationSchema:rn,notificationSchemas2026:an,JSONRPCResultResponseSchema:on(st),CallToolResultResponseSchema:on(L([lt,jt])),ListToolsResultResponseSchema:on(ut),ListPromptsResultResponseSchema:on(dt),GetPromptResultResponseSchema:on(L([ft,jt])),ListResourcesResultResponseSchema:on(pt),ListResourceTemplatesResultResponseSchema:on(mt),ReadResourceResultResponseSchema:on(L([ht,jt])),CompleteResultResponseSchema:on(gt),DiscoverResultResponseSchema:on(vt)}}var nd;function rd(){return nd??=td()}var id=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function ad(e){return id.includes(e)}var od=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function sd(e){return e[od]}function cd(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function ld(e){return e===`public`||e===`private`}var Y=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}({}),X=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return wu(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 wu(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Cu(this,new.target)}static fromError(t,n,r){if(t===Y.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new dd(e.elicitations,n)}if(t===Y.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new fd({supported:e.supported,requested:e.requested},n)}if(t===Y.InvalidParams||t===Y.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Y.ResourceNotFound||Object.keys(e).length===1))return new ud(e.uri,n)}if(t===Y.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new pd({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},ud=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Y.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},dd=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Y.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},fd=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Y.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},pd=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Y.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},md=0,hd=`private`,gd=[`tools/call`,`prompts/get`,`resources/read`];function _d(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||gd.includes(e))return t;throw new X(Y.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function vd(e,t){let n=sd(t);if(t.resultType!==`complete`||!ad(e))return n===void 0?t:Cd(t);let r=t,i=cd(r.ttlMs)?r.ttlMs:xd(n),a=ld(r.cacheScope)?r.cacheScope:Sd(n),o={...r,ttlMs:i,cacheScope:a};return delete o[od],o}function yd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bd(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[rs]:t}}:!yd(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[rs]:t}}}function xd(e){return e!==void 0&&cd(e.ttlMs)?e.ttlMs:md}function Sd(e){return e!==void 0&&ld(e.cacheScope)?e.cacheScope:hd}function Cd(e){let t={...e};return delete t[od],t}var wd=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Td;function Ed(){if(Td)return Td;let e=rd();return Td={request:{"elicitation/create":F({method:B(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":F({method:B(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":F({method:B(`roots/list`),params:I({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Td}function Dd(e){return wd.includes(e)}function Od(e){return Dd(e)?Ed().request[e]:void 0}function kd(e){return Dd(e)?Ed().response[e]:void 0}var Ad={"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},jd={"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 Md(e){return Object.prototype.hasOwnProperty.call(Ad,e)}function Nd(e){return Object.prototype.hasOwnProperty.call(jd,e)}function Pd(e){return Object.prototype.hasOwnProperty.call(Ad,e)}function Fd(e){return Md(e)?rd().dispatchRequestSchemas[e]:void 0}function Id(e){return Pd(e)?rd().dispatchResultSchemas[e]:void 0}function Ld(e){return Nd(e)?rd().notificationSchemas2026[e]:void 0}function Rd(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zd(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 Bd={ok:!1,reason:`not-in-era`},Vd=[ts,is];function Hd(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=>Rd(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Rd(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Rd(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Ud={era:`2026-07-28`,hasRequestMethod:Md,hasNotificationMethod:Nd,hasInputRequestMethod:e=>Od(e)!==void 0,validateRequest:(e,t)=>zd(Fd(e),t),validateResult:(e,t)=>zd(Id(e),t),validateNotification:(e,t)=>zd(Ld(e),t),validateInputRequest:(e,t)=>zd(Od(e),t),validateInputResponse:(e,t)=>zd(kd(e),t),samplingResultVariant:()=>Bd,outboundEnvelope(e){return{[ts]:e.protocolVersion,[ns]:e.clientInfo,[is]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Vd)n in e||t.push({key:n,problem:`missing`});let n=rd().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=>Du(e),inputRequestSchema:Od,decodeResult(e,t){if(!Rd(t))return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new J(q.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 J(q.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Rd(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new J(q.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Gd(),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 J(q.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 bd(vd(e,_d(e,Hd(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=rd().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(`; `)}`}},Wd;function Gd(){if(Wd)return Wd;let e=rd();return Wd={"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},Wd}var Kd=`2026-07-28`;function qd(e){return e!==void 0&&Eu(e)?Ud:ed}function Jd(e){return e.revision===void 0?e.era===`modern`?Ud.era:ed.era:qd(e.revision).era}function Yd(e){return Zd.some(t=>t.hasRequestMethod(e))}function Xd(e){return Zd.some(t=>t.hasNotificationMethod(e))}var Zd=[ed,Ud],Qd=n({AnnotationsSchema:()=>tc,AudioContentSchema:()=>Pc,BaseMetadataSchema:()=>As,BaseRequestParamsSchema:()=>U,BlobResourceContentsSchema:()=>$s,BooleanSchemaSchema:()=>hl,CallToolRequestParamsSchema:()=>Yc,CallToolRequestSchema:()=>Xc,CallToolResultSchema:()=>qc,CancelTaskRequestSchema:()=>tu,CancelTaskResultSchema:()=>nu,CancelledNotificationParamsSchema:()=>Es,CancelledNotificationSchema:()=>Ds,ClientCapabilitiesSchema:()=>Fs,ClientNotificationSchema:()=>iu,ClientRequestSchema:()=>ru,ClientResultSchema:()=>au,ClientTasksCapabilitySchema:()=>Ns,CompatibilityCallToolResultSchema:()=>Jc,CompleteRequestParamsSchema:()=>Il,CompleteRequestSchema:()=>Ll,CompleteResultSchema:()=>Rl,ContentBlockSchema:()=>Rc,CreateMessageRequestParamsSchema:()=>dl,CreateMessageRequestSchema:()=>fl,CreateMessageResultSchema:()=>pl,CreateMessageResultWithToolsSchema:()=>ml,CreateTaskResultSchema:()=>Kl,CursorSchema:()=>us,DiscoverRequestSchema:()=>Vs,DiscoverResultSchema:()=>Hs,ElicitRequestFormParamsSchema:()=>Dl,ElicitRequestParamsSchema:()=>kl,ElicitRequestSchema:()=>Al,ElicitRequestURLParamsSchema:()=>Ol,ElicitResultSchema:()=>Nl,ElicitationCompleteNotificationParamsSchema:()=>jl,ElicitationCompleteNotificationSchema:()=>Ml,EmbeddedResourceSchema:()=>Ic,EmptyResultSchema:()=>Ts,EnumSchemaSchema:()=>Tl,GetPromptRequestParamsSchema:()=>Ac,GetPromptRequestSchema:()=>jc,GetPromptResultSchema:()=>Bc,GetTaskPayloadRequestSchema:()=>Zl,GetTaskPayloadResultSchema:()=>Ql,GetTaskRequestSchema:()=>Yl,GetTaskResultSchema:()=>Xl,IconSchema:()=>Os,IconsSchema:()=>ks,ImageContentSchema:()=>Nc,ImplementationSchema:()=>js,InitializeRequestParamsSchema:()=>Is,InitializeRequestSchema:()=>Ls,InitializeResultSchema:()=>zs,InitializedNotificationSchema:()=>Bs,JSONArraySchema:()=>cs,JSONObjectSchema:()=>H,JSONRPCErrorResponseSchema:()=>Ss,JSONRPCMessageSchema:()=>Cs,JSONRPCNotificationSchema:()=>bs,JSONRPCRequestSchema:()=>ys,JSONRPCResponseSchema:()=>ws,JSONRPCResultResponseSchema:()=>xs,JSONValueSchema:()=>ss,LegacyTitledEnumSchemaSchema:()=>bl,ListChangedOptionsBaseSchema:()=>Qc,ListPromptsRequestSchema:()=>Oc,ListPromptsResultSchema:()=>kc,ListResourceTemplatesRequestSchema:()=>oc,ListResourceTemplatesResultSchema:()=>sc,ListResourcesRequestSchema:()=>ic,ListResourcesResultSchema:()=>ac,ListRootsRequestSchema:()=>Bl,ListRootsResultSchema:()=>Vl,ListTasksRequestSchema:()=>$l,ListTasksResultSchema:()=>eu,ListToolsRequestSchema:()=>Gc,ListToolsResultSchema:()=>Kc,LoggingLevelSchema:()=>$c,LoggingMessageNotificationParamsSchema:()=>nl,LoggingMessageNotificationSchema:()=>rl,ModelHintSchema:()=>il,ModelPreferencesSchema:()=>al,MultiSelectEnumSchemaSchema:()=>wl,NotificationSchema:()=>gs,NotificationsParamsSchema:()=>hs,NumberSchemaSchema:()=>_l,PaginatedRequestParamsSchema:()=>qs,PaginatedRequestSchema:()=>Js,PaginatedResultSchema:()=>Ys,PingRequestSchema:()=>Us,PrimitiveSchemaDefinitionSchema:()=>El,ProgressNotificationParamsSchema:()=>Gs,ProgressNotificationSchema:()=>Ks,ProgressSchema:()=>Ws,ProgressTokenSchema:()=>ls,PromptArgumentSchema:()=>Ec,PromptListChangedNotificationSchema:()=>Vc,PromptMessageSchema:()=>zc,PromptReferenceSchema:()=>Fl,PromptSchema:()=>Dc,ReadResourceRequestParamsSchema:()=>lc,ReadResourceRequestSchema:()=>uc,ReadResourceResultSchema:()=>dc,RelatedTaskMetadataSchema:()=>fs,RequestIdSchema:()=>vs,RequestMetaSchema:()=>ps,RequestSchema:()=>W,ResourceContentsSchema:()=>Xs,ResourceLinkSchema:()=>Lc,ResourceListChangedNotificationSchema:()=>fc,ResourceRequestParamsSchema:()=>cc,ResourceSchema:()=>nc,ResourceTemplateReferenceSchema:()=>Pl,ResourceTemplateSchema:()=>rc,ResourceUpdatedNotificationParamsSchema:()=>wc,ResourceUpdatedNotificationSchema:()=>Tc,ResultMetaObjectSchema:()=>_s,ResultSchema:()=>G,RoleSchema:()=>ec,RootSchema:()=>zl,RootsListChangedNotificationSchema:()=>Hl,SamplingContentSchema:()=>cl,SamplingMessageContentBlockSchema:()=>ll,SamplingMessageSchema:()=>ul,ServerCapabilitiesSchema:()=>Rs,ServerNotificationSchema:()=>su,ServerRequestSchema:()=>ou,ServerResultSchema:()=>cu,ServerTasksCapabilitySchema:()=>Ps,SetLevelRequestParamsSchema:()=>el,SetLevelRequestSchema:()=>tl,SingleSelectEnumSchemaSchema:()=>xl,StringSchemaSchema:()=>gl,SubscribeRequestParamsSchema:()=>pc,SubscribeRequestSchema:()=>mc,SubscriptionFilterSchema:()=>_c,SubscriptionsAcknowledgedNotificationParamsSchema:()=>bc,SubscriptionsAcknowledgedNotificationSchema:()=>xc,SubscriptionsListenRequestParamsSchema:()=>vc,SubscriptionsListenRequestSchema:()=>yc,SubscriptionsListenResultMetaSchema:()=>Sc,SubscriptionsListenResultSchema:()=>Cc,TaskAugmentedRequestParamsSchema:()=>ms,TaskCreationParamsSchema:()=>Ul,TaskMetadataSchema:()=>ds,TaskSchema:()=>Gl,TaskStatusNotificationParamsSchema:()=>ql,TaskStatusNotificationSchema:()=>Jl,TaskStatusSchema:()=>Wl,TextContentSchema:()=>Mc,TextResourceContentsSchema:()=>Zs,TitledMultiSelectEnumSchemaSchema:()=>Cl,TitledSingleSelectEnumSchemaSchema:()=>yl,ToolAnnotationsSchema:()=>Hc,ToolChoiceSchema:()=>ol,ToolExecutionSchema:()=>Uc,ToolListChangedNotificationSchema:()=>Zc,ToolResultContentSchema:()=>sl,ToolSchema:()=>Wc,ToolUseContentSchema:()=>Fc,UnsubscribeRequestParamsSchema:()=>hc,UnsubscribeRequestSchema:()=>gc,UntitledMultiSelectEnumSchemaSchema:()=>Sl,UntitledSingleSelectEnumSchemaSchema:()=>vl}),$d=e=>ys.safeParse(e).success,ef=e=>bs.safeParse(e).success,tf=e=>xs.safeParse(e).success,nf=e=>Ss.safeParse(e).success;Y.InvalidRequest,Y.UnsupportedProtocolVersion,Y.InvalidParams,Y.MethodNotFound,Y.InvalidParams,Y.MissingRequiredClientCapability,Y.ParseError,Y.InvalidRequest,Y.MethodNotFound,Y.UnsupportedProtocolVersion,Y.MissingRequiredClientCapability;function rf(e,t){return ya(e,t)}function af(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function of(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 sf=!1,cf=`draft-2020-12`;function lf(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:cf});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().`);sf||(sf=!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=sa(e,{target:cf,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&&uf(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 uf(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`||uf(e)))}return!1}function df(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function ff(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>df(e)).join(`, `)}:{success:!0,data:n.value}}function pf(e){let t=sa(e,{target:cf,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var mf=/\\\.\\d\{(\d+)\}/;function hf(e){let t=mf.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=>la({local:e,offset:t,precision:n}))))}function gf(e,t){let n;switch(e){case`email`:n=[Pa()];break;case`uri`:n=[Ra()];break;case`date`:n=[da()];break;case`date-time`:n=hf(t);break}return new Set(n.map(e=>pf(e)).filter(e=>e!==void 0))}function _f(e,t,n){return n===`zod`?gf(e,t).has(t):!0}function vf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yf(e){try{return lf(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new X(Y.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var bf=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function xf(e){return bf.has(e)||e.startsWith(`x-`)}var Sf=new Set([`$schema`,...Object.keys(Dl.shape.requestedSchema.shape)]),Cf={string:af([gl,vl,yl,bl]),number:af([_l]),integer:af([_l]),boolean:af([hl]),array:af([Sl,Cl])},wf=new Set(gl.shape.format.unwrap().options);function Tf(e,t,n,r){if(!vf(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Cf,e.type)?Cf[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||xf(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?wf.has(e.format)?(typeof s!=`string`||!_f(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Ef(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&vf(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Tf(n,`properties.${e}`,t,r)])):Sf.has(i)?n[i]=a:xf(i)||r.push(i);if(r.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Df(e,t){if(!vf(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!rf(El,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Of(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Of(e,t[r],`${n}[${r}]`)):!vf(e)||!vf(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Of(r,t[e],i):xf(e)?[]:[i]})}function kf(e){if(!of(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Ef(yf(e.requestedSchema),t),r=rf(Dl.shape.requestedSchema,n);if(!r.success)throw new X(Y.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Df(n,r.error.message)}`);let i=Of(n,r.data);if(i.length>0)throw new X(Y.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 X(Y.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Af(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(Af,{elicit(e){try{return{method:`elicitation/create`,params:kf(e)}}catch(e){throw e instanceof X?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 jf=`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(`.`),Mf={IdJagTokenExchangeResponseSchema:mu,OAuthClientInformationFullSchema:yu,OAuthClientInformationSchema:vu,OAuthClientMetadataSchema:_u,OAuthClientRegistrationErrorSchema:bu,OAuthErrorResponseSchema:hu,OAuthMetadataSchema:uu,OAuthProtectedResourceMetadataSchema:lu,OAuthTokenRevocationRequestSchema:xu,OAuthTokensSchema:pu,OpenIdProviderDiscoveryMetadataSchema:fu,OpenIdProviderMetadataSchema:du},Nf={},Pf={};function Ff(e,t){let n=e.slice(0,-6);Nf[n]=t,Pf[n]=e=>t.safeParse(e).success}for(let e of jf)Ff(e,Qd[e]);for(let[e,t]of Object.entries(Mf))Ff(e,t);Object.freeze(Nf),Object.freeze(Pf);function If(e){switch(e){case`initialize`:case`notifications/initialized`:return qd(void 0);case`server/discover`:return qd(Kd);default:return}}var Lf=[ts,ns,is,os],Rf=[`inputResponses`,`requestState`];function zf(e,t){let n=e.params;if(!Wf(n))return{message:e,lifted:{}};let r=n._meta,i=Wf(r)?Lf.filter(e=>e in r):[],a=t===`request`?Rf.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Wf(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 Bf(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 Vf(e){return()=>e}var Hf=Vf(void 0),Uf=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??$o,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 J(q.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new J(q.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),tf(e)||nf(e)?this._onresponse(e):$d(e)?this._onrequest(e,t):ef(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 J(q.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}=zf(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Jd(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(Xd(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}=zf(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=Jd(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(Y.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Yd(n.method)&&!i.hasRequestMethod(n.method)){o(Y.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Y.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Y.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:Kf(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?Hf:Vf(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),of(t))return u(e,t,n);let i=Bf(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(Y.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:Y.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),tf(e)?n(e):n(X.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),of(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Bf(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 qd(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=If(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Yd(t)&&!e.hasRequestMethod(t))throw new J(q.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 J?e:new J(q.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 ee=this._envelopeOutbound(g),te=!1,_=e=>{te||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof J?e:new J(q.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(te=!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(qf(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;ff(n,o).then(e=>{e.success?d(e.data):f(new J(q.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>_(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let v=r?.timeout??6e4;this._setupTimeout(h,v,r?.maxTotalTimeout,()=>_(new J(q.RequestTimeout,`Request timed out`,{timeout:v})),r?.resetTimeoutOnProgress??!1),this._transport.send(ee,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new J(q.NotConnected,`Not connected`);if(Xd(t.method)&&!e.hasNotificationMethod(t.method))throw new J(q.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Yd(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 X(Y.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 ff(t.params,{...r.params});if(!a.success)throw new X(Y.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Xd(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 X(Y.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await ff(t.params,{...r.params});if(!i.success)throw new X(Y.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Wf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kf(e){let t={},n=[];if(!Gf(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Gf(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function qf(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}t((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 Jf=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Yf=/^(?=.{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,Xf=/^(?:[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,Zf=/^(?:(?:[^\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,Qf=/^(?:(?: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,$f=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ep=/^(?:\/(?:[^~/]|~0|~1)*)*$/,tp=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,np=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,rp=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ip=/^((([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 ap(e){return e.test.bind(e)}op.bind(void 0,!1),ap(Xf),ap(Zf),ap(Qf),ap(Yf),ap(rp),ap(ip),ap($f),ap(ep),ap(tp),ap(np);function op(e,t){let n=t.match(Jf);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 sp=`modulepreload`,cp=function(e,t){return new URL(e,t).href},lp={},up=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=cp(t,n),t in lp)return;lp[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:sp,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},dp=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return wu(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 wu(this,e)}constructor(e){super(e),this.name=new.target.name,Cu(this,new.target)}};(class extends dp{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 dp{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 dp{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends dp{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends dp{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 wu(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 wu(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Cu(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return wu(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 wu(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Cu(this,new.target)}};var fp=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}},pp=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)}},mp=new Set;function hp(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`;mp.has(o)||(mp.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},gp(t)):e=>s({method:a,params:e})]}function gp(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 _p=`2026-01-26`,vp=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=Cs.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},yp=L([B(`light`),B(`dark`)]).describe(`Color theme preference for the host environment.`),bp=L([B(`inline`),B(`fullscreen`),B(`pip`)]).describe(`Display mode for UI presentation.`),xp=R(L([B(`--color-background-primary`),B(`--color-background-secondary`),B(`--color-background-tertiary`),B(`--color-background-inverse`),B(`--color-background-ghost`),B(`--color-background-info`),B(`--color-background-danger`),B(`--color-background-success`),B(`--color-background-warning`),B(`--color-background-disabled`),B(`--color-text-primary`),B(`--color-text-secondary`),B(`--color-text-tertiary`),B(`--color-text-inverse`),B(`--color-text-ghost`),B(`--color-text-info`),B(`--color-text-danger`),B(`--color-text-success`),B(`--color-text-warning`),B(`--color-text-disabled`),B(`--color-border-primary`),B(`--color-border-secondary`),B(`--color-border-tertiary`),B(`--color-border-inverse`),B(`--color-border-ghost`),B(`--color-border-info`),B(`--color-border-danger`),B(`--color-border-success`),B(`--color-border-warning`),B(`--color-border-disabled`),B(`--color-ring-primary`),B(`--color-ring-secondary`),B(`--color-ring-inverse`),B(`--color-ring-info`),B(`--color-ring-danger`),B(`--color-ring-success`),B(`--color-ring-warning`),B(`--font-sans`),B(`--font-mono`),B(`--font-weight-normal`),B(`--font-weight-medium`),B(`--font-weight-semibold`),B(`--font-weight-bold`),B(`--font-text-xs-size`),B(`--font-text-sm-size`),B(`--font-text-md-size`),B(`--font-text-lg-size`),B(`--font-heading-xs-size`),B(`--font-heading-sm-size`),B(`--font-heading-md-size`),B(`--font-heading-lg-size`),B(`--font-heading-xl-size`),B(`--font-heading-2xl-size`),B(`--font-heading-3xl-size`),B(`--font-text-xs-line-height`),B(`--font-text-sm-line-height`),B(`--font-text-md-line-height`),B(`--font-text-lg-line-height`),B(`--font-heading-xs-line-height`),B(`--font-heading-sm-line-height`),B(`--font-heading-md-line-height`),B(`--font-heading-lg-line-height`),B(`--font-heading-xl-line-height`),B(`--font-heading-2xl-line-height`),B(`--font-heading-3xl-line-height`),B(`--border-radius-xs`),B(`--border-radius-sm`),B(`--border-radius-md`),B(`--border-radius-lg`),B(`--border-radius-xl`),B(`--border-radius-full`),B(`--border-width-regular`),B(`--shadow-hairline`),B(`--shadow-sm`),B(`--shadow-md`),B(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
65
+
66
+ Individual style keys are optional - hosts may provide any subset of these values.
67
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
68
+
69
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
70
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),L([k(),ao()]).describe(`Style variables for theming MCP apps.
71
+
72
+ Individual style keys are optional - hosts may provide any subset of these values.
73
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
74
+
75
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
76
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
77
+
78
+ Individual style keys are optional - hosts may provide any subset of these values.
79
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
80
+
81
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
82
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);F({method:B(`ui/open-link`),params:F({url:k().describe(`URL to open in the host's browser`)})});var Sp=F({isError:M().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),Cp=F({isError:M().optional().describe(`True if the download failed (e.g., user cancelled or host denied).`)}).passthrough(),wp=F({isError:M().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough();F({method:B(`ui/notifications/sandbox-proxy-ready`),params:F({})});var Tp=F({connectDomains:P(k()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
83
+
84
+ - Maps to CSP \`connect-src\` directive
85
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:P(k()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:P(k()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:P(k()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Ep=F({camera:F({}).optional().describe(`Request camera access.
86
+
87
+ Maps to Permission Policy \`camera\` feature.`),microphone:F({}).optional().describe(`Request microphone access.
88
+
89
+ Maps to Permission Policy \`microphone\` feature.`),geolocation:F({}).optional().describe(`Request geolocation access.
90
+
91
+ Maps to Permission Policy \`geolocation\` feature.`),clipboardWrite:F({}).optional().describe(`Request clipboard write access.
92
+
93
+ Maps to Permission Policy \`clipboard-write\` feature.`)});F({method:B(`ui/notifications/size-changed`),params:F({width:j().optional().describe(`New width in pixels.`),height:j().optional().describe(`New height in pixels.`)})});var Dp=F({method:B(`ui/notifications/tool-input`),params:F({arguments:R(k(),N().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),Op=F({method:B(`ui/notifications/tool-input-partial`),params:F({arguments:R(k(),N().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),kp=F({method:B(`ui/notifications/tool-cancelled`),params:F({reason:k().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})}),Ap=F({fonts:k().optional()}),jp=F({variables:xp.optional().describe(`CSS variables for theming the app.`),css:Ap.optional().describe(`CSS blocks that apps can inject.`)}),Mp=F({method:B(`ui/resource-teardown`),params:F({})}),Np=R(k(),N()),Pp=F({text:F({}).optional().describe(`Host supports text content blocks.`),image:F({}).optional().describe(`Host supports image content blocks.`),audio:F({}).optional().describe(`Host supports audio content blocks.`),resource:F({}).optional().describe(`Host supports resource content blocks.`),resourceLink:F({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:F({}).optional().describe(`Host supports structured content.`)});F({method:B(`ui/notifications/request-teardown`),params:F({}).optional()});var Fp=F({experimental:R(k(),R(k(),lo()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),openLinks:F({}).optional().describe(`Host supports opening external URLs.`),downloadFile:F({}).optional().describe(`Host supports file downloads via ui/download-file.`),serverTools:F({listChanged:M().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:F({listChanged:M().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:F({}).optional().describe(`Host accepts log messages.`),sandbox:F({permissions:Ep.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:Tp.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Pp.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Pp.optional().describe(`Host supports receiving content messages (ui/message) from the view.`),sampling:F({tools:F({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),Ip=F({experimental:R(k(),R(k(),lo()).describe(`Experimental features keyed by identifier.`)).optional().describe(`Experimental features keyed by identifier.`),tools:F({listChanged:M().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:P(bp).optional().describe(`Display modes the app supports.`)});F({method:B(`ui/notifications/initialized`),params:F({}).optional()}),F({csp:Tp.optional().describe(`Content Security Policy configuration for UI resources.`),permissions:Ep.optional().describe(`Sandbox permissions requested by the UI resource.`),domain:k().optional().describe(`Dedicated origin for view sandbox.
94
+
95
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
96
+
97
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
98
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
99
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
100
+
101
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:M().optional().describe(`Visual boundary preference - true if view prefers a visible border.
102
+
103
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
104
+
105
+ - \`true\`: request visible border + background
106
+ - \`false\`: request no visible border + background
107
+ - omitted: host decides border`)}),F({method:B(`ui/request-display-mode`),params:F({mode:bp.describe(`The display mode being requested.`)})});var Lp=F({mode:bp.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough(),Rp=L([B(`model`),B(`app`)]).describe(`Tool visibility scope - who can access the tool.`);F({resourceUri:k().optional(),visibility:P(Rp).optional().describe(`Who can access this tool. Default: ["model", "app"]
108
+ - "model": Tool visible to and callable by the agent
109
+ - "app": Tool callable by the app from this server only`),csp:po().optional(),permissions:po().optional()}),F({mimeTypes:P(k()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),F({method:B(`ui/download-file`),params:F({contents:P(L([Ic,Lc])).describe(`Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.`)})}),F({method:B(`ui/message`),params:F({role:B(`user`).describe(`Message role, currently only "user" is supported.`),content:P(Rc).describe(`Message content blocks (text, image, etc.).`)})}),F({method:B(`ui/notifications/sandbox-resource-ready`),params:F({html:k().describe(`HTML content to load into the inner iframe.`),sandbox:k().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:Tp.optional().describe(`CSP configuration from resource metadata.`),permissions:Ep.optional().describe(`Sandbox permissions from resource metadata.`)})});var zp=F({method:B(`ui/notifications/tool-result`),params:qc.describe(`Standard MCP tool execution result.`)}),Bp=F({toolInfo:F({id:vs.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Wc.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:yp.optional().describe(`Current color theme preference.`),styles:jp.optional().describe(`Style configuration for theming the app.`),displayMode:bp.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:P(bp).optional().describe(`Display modes the host supports.`),containerDimensions:L([F({height:j().describe(`Fixed container height in pixels.`)}),F({maxHeight:L([j(),ao()]).optional().describe(`Maximum container height in pixels.`)})]).and(L([F({width:j().describe(`Fixed container width in pixels.`)}),F({maxWidth:L([j(),ao()]).optional().describe(`Maximum container width in pixels.`)})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
110
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:k().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:k().optional().describe(`User's timezone in IANA format.`),userAgent:k().optional().describe(`Host application identifier.`),platform:L([B(`web`),B(`desktop`),B(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:F({touch:M().optional().describe(`Whether the device supports touch input.`),hover:M().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:F({top:j().describe(`Top safe area inset in pixels.`),right:j().describe(`Right safe area inset in pixels.`),bottom:j().describe(`Bottom safe area inset in pixels.`),left:j().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough(),Vp=F({method:B(`ui/notifications/host-context-changed`),params:Bp.describe(`Partial context update containing only changed fields.`)});F({method:B(`ui/update-model-context`),params:F({content:P(Rc).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:R(k(),N().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),F({method:B(`ui/initialize`),params:F({appInfo:js.describe(`App identification (name and version).`),appCapabilities:Ip.describe(`Features and capabilities this app provides.`),protocolVersion:k().describe(`Protocol version this app supports.`)})});var Hp=F({protocolVersion:k().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:js.describe(`Host application identification and version.`),hostCapabilities:Fp.describe(`Features and capabilities provided by the host.`),hostContext:Bp.describe(`Rich context about the host environment.`)}).passthrough(),Up={target:`draft-2020-12`};async function Wp(e,t){let n=e[`~standard`];if(n.jsonSchema)return n.jsonSchema[t](Up);throw Error(`Schema (vendor: ${n.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Gp(e,t,n=``){let r=await e[`~standard`].validate(t);if(r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>typeof e==`object`?e.key:e).join(`.`);return t?`${t}: ${e.message}`:e.message}).join(`; `);throw Error(n+e)}return r.value}function Kp(e){let t=document.documentElement;t.setAttribute(`data-theme`,e),t.style.colorScheme=e}function qp(e,t=document.documentElement){for(let[n,r]of Object.entries(e))r!==void 0&&t.style.setProperty(n,r)}function Jp(e){if(document.getElementById(`__mcp-host-fonts`))return;let t=document.createElement(`style`);t.id=`__mcp-host-fonts`,t.textContent=e,document.head.appendChild(t)}function Yp(e,t){let n={...e,...t};return t.experimental!==void 0&&(n.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(n.tools={...e.tools,...t.tools}),n}var Xp=class e extends Uf{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new fp;_methods=new pp;setRequestHandler=(...e)=>{let[t,...n]=hp(`request`,e)??e;this._methods.claim(t,`setRequestHandler`),super.setRequestHandler.call(this,t,...n)};setNotificationHandler=(...e)=>{let[t,...n]=hp(`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)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:Dp,toolinputpartial:Op,toolresult:zp,toolcancelled:kp,hostcontextchanged:Vp};static ONE_SHOT_EVENTS=new Set([`toolinput`,`toolinputpartial`,`toolresult`,`toolcancelled`]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let n=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(n);console.warn(n)}setEventHandler(e,t){t&&this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),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)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},t=>{let n=t;e===`hostcontextchanged`&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(e,n)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(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={autoResize:!0}){super(n),this._appInfo=e,this._appCapabilities=t,this.options=n,this._methods.replace(`notifications/cancelled`),this._methods.replace(`notifications/progress`),!n.allowUnsafeEval&&d({jitless:!0}),this.replaceRequestHandler(`ping`,e=>(console.log(`Received ping:`,e.params),{})),this.setEventHandler(`hostcontextchanged`,void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after transport is established`);this._appCapabilities=Yp(this._appCapabilities,e)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,i=()=>{r._initializedSent&&r._appCapabilities.tools?.listChanged&&r.sendToolListChanged()},a=t.inputSchema!==void 0,o={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(e){Object.assign(this,e),i()},remove(){r._registeredTools[e]===o&&(delete r._registeredTools[e],i())},handler:async(t,r)=>{if(!o.enabled)throw Error(`Tool ${e} is disabled`);let i;if(a){let a=o.inputSchema;i=await n(a?await Gp(a,t??{},`Invalid input for tool ${e}: `):t??{},r)}else i=await n(r);return o.outputSchema&&!i.isError&&(i.structuredContent=await Gp(o.outputSchema,i.structuredContent,`Invalid output for tool ${e}: `)),i}};return this._registeredTools[e]=o,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),o}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let n=this._registeredTools[e.name];if(!n)throw Error(`Tool ${e.name} not found`);return n.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([e,t])=>t.enabled).map(async([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?await Wp(t.inputSchema,`input`):{type:`object`,properties:{}}};return t.outputSchema&&(n.outputSchema=await Wp(t.outputSchema,`output`)),t.annotations&&(n.annotations=t.annotations),t._meta&&(n._meta=t._meta),n}))}))}async sendToolListChanged(e={}){this._assertInitialized(`sendToolListChanged`),await this.notification({method:`notifications/tools/list_changed`,params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler(`toolinput`)}set ontoolinput(e){this.setEventHandler(`toolinput`,e)}get ontoolinputpartial(){return this.getEventHandler(`toolinputpartial`)}set ontoolinputpartial(e){this.setEventHandler(`toolinputpartial`,e)}get ontoolresult(){return this.getEventHandler(`toolresult`)}set ontoolresult(e){this.setEventHandler(`toolresult`,e)}get ontoolcancelled(){return this.getEventHandler(`toolcancelled`)}set ontoolcancelled(e){this.setEventHandler(`toolcancelled`,e)}get onhostcontextchanged(){return this.getEventHandler(`hostcontextchanged`)}set onhostcontextchanged(e){this.setEventHandler(`hostcontextchanged`,e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced(`onteardown`,this._onteardown,e),this._onteardown=e,this.replaceRequestHandler(`ui/resource-teardown`,{params:Mp.shape.params,result:Np},(e,t)=>{if(!this._onteardown)throw Error(`No onteardown handler set`);return this._onteardown(e,t)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced(`oncalltool`,this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler(`tools/call`,(e,t)=>{if(!this._oncalltool)throw Error(`No oncalltool handler set`);return this._oncalltool(e.params,t)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced(`onlisttools`,this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler(`tools/list`,(e,t)=>{if(!this._onlisttools)throw Error(`No onlisttools handler set`);return this._onlisttools(e.params,t)})}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case`tools/call`:case`tools/list`:if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized(`callServerTool`),typeof e==`string`)throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:`tools/call`,params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized(`readServerResource`),await this.request({method:`resources/read`,params:e},t)}async listServerResources(e,t){return this._assertInitialized(`listServerResources`),await this.request({method:`resources/list`,params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized(`createSamplingMessage`),await this.request({method:`sampling/createMessage`,params:e},t)}sendMessage(e,t){return this._assertInitialized(`sendMessage`),this.request({method:`ui/message`,params:e},wp,t)}sendLog(e){return this.notification({method:`notifications/message`,params:e})}updateModelContext(e,t){return this._assertInitialized(`updateModelContext`),this.request({method:`ui/update-model-context`,params:e},Ts,t)}openLink(e,t){return this._assertInitialized(`openLink`),this.request({method:`ui/open-link`,params:e},Sp,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized(`downloadFile`),this.request({method:`ui/download-file`,params:e},Cp,t)}requestTeardown(e={}){return this.notification({method:`ui/notifications/request-teardown`,params:e})}requestDisplayMode(e,t){return this._assertInitialized(`requestDisplayMode`),this.request({method:`ui/request-display-mode`,params:e},Lp,t)}sendSizeChanged(e){return this.notification({method:`ui/notifications/size-changed`,params:e})}setupSizeChangedNotifications(){let e=!1,t=0,n=0,r=()=>{e||(e=!0,requestAnimationFrame(()=>{e=!1;let r=document.documentElement,i=r.style.height;r.style.height=`max-content`;let a=Math.ceil(r.getBoundingClientRect().height);r.style.height=i;let o=Math.ceil(window.innerWidth);(o!==t||a!==n)&&(t=o,n=a,this.sendSizeChanged({width:o,height:a}))}))};r();let i=new ResizeObserver(r);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(e=new vp(window.parent,window.parent),t){if(this.transport)throw Error(`App is already connected. Call close() before connecting again.`);this._initializedSent=!1;try{await super.connect(e);let n=await this.request({method:`ui/initialize`,params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:_p}},Hp,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:`ui/notifications/initialized`}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(e){throw this.close(),e}}},Zp=`forgerelay/activityPanelDefaultExpanded`;function Qp(e,t,n){return!n||e!==`working`?null:t<=0?1e3:t===1?2e3:t===2?5e3:1e4}function $p(e){return fm(e)?e[Zp]===!0:!1}function em(e){return fm(e)?typeof e.turnId==`string`&&um(e.revision)&&typeof e.changed==`boolean`&&cm(e.state):!1}function tm(e){return!em(e)||!fm(e)||!Array.isArray(e.activities)?!1:e.activities.every(sm)}function nm(e){return!fm(e)||!sm(e.activity)?!1:e.error===void 0||typeof e.error==`string`}function rm(e){return!fm(e)||typeof e.outputId!=`string`||typeof e.activityId!=`string`||!dm(e.processId)||typeof e.command!=`string`||typeof e.output!=`string`||!um(e.cursor)||e.status!==`running`&&e.status!==`done`&&e.status!==`failed`||typeof e.timedOut!=`boolean`||typeof e.startedAt!=`string`||e.exitCode!==void 0&&!Number.isInteger(e.exitCode)||e.signal!==void 0&&typeof e.signal!=`string`?!1:e.finishedAt===void 0||typeof e.finishedAt==`string`}function im(e,t){if(!t.changed)return e;let n=new Map(t.activities.map(e=>[e.activityId,e])),r=e.map(e=>n.get(e.activityId)??e),i=new Set(e.map(e=>e.activityId));for(let e of t.activities)i.has(e.activityId)||r.push(e);return r}function am(e){let t=new Set(e.map(e=>e.activityId)),n=new Map;for(let r of e){if(!r.parentActivityId||!t.has(r.parentActivityId))continue;let e=n.get(r.parentActivityId)??[];e.push(r),n.set(r.parentActivityId,e)}return e.flatMap(e=>e.parentActivityId&&t.has(e.parentActivityId)?[]:[{activity:e,children:n.get(e.activityId)??[]}])}function om(e,t=24){return e.scrollHeight-e.clientHeight-e.scrollTop<=t}function sm(e){return!fm(e)||e.member!==void 0&&typeof e.member!=`string`?!1:typeof e.activityId==`string`&&typeof e.tool==`string`&&typeof e.kind==`string`&&cm(e.status)&&lm(e.state)&&typeof e.title==`string`&&typeof e.target==`string`&&typeof e.detailAvailable==`boolean`&&typeof e.startedAt==`string`}function cm(e){return e===`working`||e===`done`||e===`error`}function lm(e){return e===`executing`||e===`returned`||e===`done`||e===`failed`||e===`blocked`}function um(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0}function dm(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function fm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pm(e){return e===`open_workspace`||e===`close_workspace`||e===`capability`||e===`apply_patch`||e===`exec_command`||e===`write_stdin`||e===`read`||e===`write`||e===`edit`||e===`rename`||e===`delete`||e===`grep`||e===`glob`||e===`ls`||e===`bash`}function mm(e){return e===`read`}function hm(e){return e===`write`}function gm(e){return e===`edit`}function _m(e){return e?.content?.map(e=>e.type===`text`?e.text??``:`[${e.mimeType??`image`} image payload]`).filter(Boolean).join(`
111
+
112
+ `)??``}function vm(e,t){let n=e?.[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function ym(e){let t=xm(xm(e.result)?._meta),n=xm(t?.card),r=typeof t?.tool==`string`?t.tool:e.activity.tool;if(!n||!pm(r))return;let i=xm(e.request);return{...n,tool:r,...typeof n.workspaceId==`string`?{}:typeof i?.workspaceId==`string`?{workspaceId:i.workspaceId}:{},...typeof n.path==`string`?{}:typeof i?.path==`string`?{path:i.path}:{}}}function bm(e){return gm(e.tool)||hm(e.tool)?!!(e.payload?.patch||e.payload?.diff):mm(e.tool)?_m(e.payload).length>0:!1}function xm(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}var Sm={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Cm=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=Cm(e);r.appendChild(t)}),r},wm=(e,t={})=>Cm([`svg`,{...Sm,...t},e]),Tm=[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`}]],Em=[[`path`,{d:`M12 8V4H8`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}],[`path`,{d:`M2 14h2`}],[`path`,{d:`M20 14h2`}],[`path`,{d:`M15 13v2`}],[`path`,{d:`M9 13v2`}]],Dm=[[`path`,{d:`m6 9 6 6 6-6`}]],Om=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]],km=[[`path`,{d:`M12 20v2`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M17 20v2`}],[`path`,{d:`M17 2v2`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M2 17h2`}],[`path`,{d:`M2 7h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`M20 17h2`}],[`path`,{d:`M20 7h2`}],[`path`,{d:`M7 20v2`}],[`path`,{d:`M7 2v2`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`}]],Am=[[`path`,{d:`M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`m14 20 2 2 4-4`}]],jm=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]],Mm=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M9 15h6`}]],Nm=[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`}],[`path`,{d:`M8 18h1`}]],Pm=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M9 15h6`}],[`path`,{d:`M12 18v-6`}]],Fm=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],Z={agents:Em,base:[[`circle`,{cx:`12`,cy:`12`,r:`3`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`}]],chevronDown:Dm,deleteFile:Mm,diff:jm,editFile:Nm,files:[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`}]],folderOpen:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]],folderTree:[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`}]],gitBranch:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]],instructions:Fm,instructionAvailable:Fm,instructionLoaded:Am,loading:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]],providers:km,readFile:Fm,search:[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]],skills:Tm,sourceCheckout:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`}],[`circle`,{cx:`13`,cy:`12`,r:`2`}],[`circle`,{cx:`20`,cy:`19`,r:`2`}]],terminal:[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]],terminalSquare:[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]],warning:Om,writeFile:Pm},Im={claude:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='257'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20257'%3e%3cpath%20fill='%23D97757'%20d='m50.228%20170.321%2050.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0%20125.796l.583-3.759%205.12-3.434%207.324.648%2016.202%201.101%2024.304%201.685%2017.629%201.037%2026.118%202.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758%207-7.713%209.397.649%202.398.648%209.527%207.323%2020.35%2015.75L94.817%2091.9l3.889%203.24%201.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42%200%2082.05%201.426l4.472%203.888%206.61%2015.101%2010.694%2023.786%2016.591%2032.34%204.861%209.592%202.592%208.879.973%202.722h1.685v-1.556l1.36-18.211%202.528-22.36%202.463-28.776.843-8.1%204.018-9.722%207.971-5.25%206.222%202.981%205.12%207.324-.713%204.73-3.046%2019.768-5.962%2030.98-3.889%2020.739h2.268l2.593-2.593%2010.499-13.934%2017.628-22.036%207.778-8.749%209.073-9.657%205.833-4.601h11.018l8.1%2012.055-3.628%2012.443-11.342%2014.388-9.398%2012.184-13.48%2018.147-8.426%2014.518.778%201.166%202.01-.194%2030.46-6.481%2016.462-2.982%2019.637-3.37%208.88%204.148.971%204.213-3.5%208.62-20.998%205.184-24.628%204.926-36.682%208.685-.454.324.519.648%2016.526%201.555%207.065.389h17.304l32.21%202.398%208.426%205.574%205.055%206.805-.843%205.184-12.962%206.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666%2011.406%2021.387%2019.314%2026.767%2024.887%201.36%206.157-3.434%204.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73%206.935%2025.017%2037.59%201.296%2011.536-1.814%203.76-6.481%202.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194%2077.448-3.37%203.953-7.778%202.981-6.48-4.925-3.436-7.972%203.435-15.749%204.148-20.544%203.37-16.333%203.046-20.285%201.815-6.74-.13-.454-1.49.194-15.295%2020.999-23.267%2031.433-18.406%2019.702-4.407%201.75-7.648-3.954.713-7.064%204.277-6.286%2025.47-32.405%2015.36-20.092%209.917-11.6-.065-1.686h-.583L44.07%20198.125l-12.055%201.555-5.185-4.86.648-7.972%202.463-2.593%2020.35-13.999-.064.065Z'/%3e%3c/svg%3e`,``+import.meta.url).href,codex:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='260'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20260'%3e%3cpath%20fill='%23fff'%20d='M239.184%20106.203a64.716%2064.716%200%200%200-5.576-53.103C219.452%2028.459%20191%2015.784%20163.213%2021.74A65.586%2065.586%200%200%200%2052.096%2045.22a64.716%2064.716%200%200%200-43.23%2031.36c-14.31%2024.602-11.061%2055.634%208.033%2076.74a64.665%2064.665%200%200%200%205.525%2053.102c14.174%2024.65%2042.644%2037.324%2070.446%2031.36a64.72%2064.72%200%200%200%2048.754%2021.744c28.481.025%2053.714-18.361%2062.414-45.481a64.767%2064.767%200%200%200%2043.229-31.36c14.137-24.558%2010.875-55.423-8.083-76.483Zm-97.56%20136.338a48.397%2048.397%200%200%201-31.105-11.255l1.535-.87%2051.67-29.825a8.595%208.595%200%200%200%204.247-7.367v-72.85l21.845%2012.636c.218.111.37.32.409.563v60.367c-.056%2026.818-21.783%2048.545-48.601%2048.601Zm-104.466-44.61a48.345%2048.345%200%200%201-5.781-32.589l1.534.921%2051.722%2029.826a8.339%208.339%200%200%200%208.441%200l63.181-36.425v25.221a.87.87%200%200%201-.358.665l-52.335%2030.184c-23.257%2013.398-52.97%205.431-66.404-17.803ZM23.549%2085.38a48.499%2048.499%200%200%201%2025.58-21.333v61.39a8.288%208.288%200%200%200%204.195%207.316l62.874%2036.272-21.845%2012.636a.819.819%200%200%201-.767%200L41.353%20151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466%2041.695-63.08-36.63L161.73%2077.86a.819.819%200%200%201%20.768%200l52.233%2030.184a48.6%2048.6%200%200%201-7.316%2087.635v-61.391a8.544%208.544%200%200%200-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39%208.39%200%200%200-8.492%200L99.98%2099.808V74.587a.716.716%200%200%201%20.307-.665l52.233-30.133a48.652%2048.652%200%200%201%2072.236%2050.391v.205ZM88.061%20139.097l-21.845-12.585a.87.87%200%200%201-.41-.614V65.685a48.652%2048.652%200%200%201%2079.757-37.346l-1.535.87-51.67%2029.825a8.595%208.595%200%200%200-4.246%207.367l-.051%2072.697Zm11.868-25.58%2028.138-16.217%2028.188%2016.218v32.434l-28.086%2016.218-28.188-16.218-.052-32.434Z'/%3e%3c/svg%3e`,``+import.meta.url).href,copilot:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20preserveAspectRatio='xMidYMid'%20viewBox='0%200%20256%20208'%3e%3cpath%20fill='%23fff'%20d='M205.3%2031.4c14%2014.8%2020%2035.2%2022.5%2063.6%206.6%200%2012.8%201.5%2017%207.2l7.8%2010.6c2.2%203%203.4%206.6%203.4%2010.4v28.7a12%2012%200%200%201-4.8%209.5C215.9%20187.2%20172.3%20208%20128%20208c-49%200-98.2-28.3-123.2-46.6a12%2012%200%200%201-4.8-9.5v-28.7c0-3.8%201.2-7.4%203.4-10.5l7.8-10.5c4.2-5.7%2010.4-7.2%2017-7.2%202.5-28.4%208.4-48.8%2022.5-63.6C77.3%203.2%20112.6%200%20127.6%200h.4c14.7%200%2050.4%202.9%2077.3%2031.4ZM128%2078.7c-3%200-6.5.2-10.3.6a27.1%2027.1%200%200%201-6%2012.1%2045%2045%200%200%201-32%2013c-6.8%200-13.9-1.5-19.7-5.2-5.5%201.9-10.8%204.5-11.2%2011-.5%2012.2-.6%2024.5-.6%2036.8%200%206.1%200%2012.3-.2%2018.5%200%203.6%202.2%206.9%205.5%208.4C79.9%20185.9%20105%20192%20128%20192s48-6%2074.5-18.1a9.4%209.4%200%200%200%205.5-8.4c.3-18.4%200-37-.8-55.3-.4-6.6-5.7-9.1-11.2-11-5.8%203.7-13%205.1-19.7%205.1a45%2045%200%200%201-32-12.9%2027.1%2027.1%200%200%201-6-12.1c-3.4-.4-6.9-.5-10.3-.6Zm-27%2044c5.8%200%2010.5%204.6%2010.5%2010.4v19.2a10.4%2010.4%200%200%201-20.8%200V133c0-5.8%204.6-10.4%2010.4-10.4Zm53.4%200c5.8%200%2010.4%204.6%2010.4%2010.4v19.2a10.4%2010.4%200%200%201-20.8%200V133c0-5.8%204.7-10.4%2010.4-10.4Zm-73-94.4c-11.2%201.1-20.6%204.8-25.4%2010-10.4%2011.3-8.2%2040.1-2.2%2046.2A31.2%2031.2%200%200%200%2075%2091.7c6.8%200%2019.6-1.5%2030.1-12.2%204.7-4.5%207.5-15.7%207.2-27-.3-9.1-2.9-16.7-6.7-19.9-4.2-3.6-13.6-5.2-24.2-4.3Zm69%204.3c-3.8%203.2-6.4%2010.8-6.7%2019.9-.3%2011.3%202.5%2022.5%207.2%2027a41.7%2041.7%200%200%200%2030%2012.2c8.9%200%2017-2.9%2021.3-7.2%206-6.1%208.2-34.9-2.2-46.3-4.8-5-14.2-8.8-25.4-9.9-10.6-1-20%20.7-24.2%204.3ZM128%2056c-2.6%200-5.6.2-9%20.5.4%201.7.5%203.7.7%205.7%200%201.5%200%203-.2%204.5%203.2-.3%206-.3%208.5-.3%202.6%200%205.3%200%208.5.3-.2-1.6-.2-3-.2-4.5.2-2%20.3-4%20.7-5.7-3.4-.3-6.4-.5-9-.5Z'/%3e%3c/svg%3e`,``+import.meta.url).href,cursor:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20466.73%20532.09'%3e%3cpath%20fill='%23edecec'%20d='M457.43%20125.94%20244.42%202.96c-6.84-3.95-15.28-3.95-22.12%200L9.3%20125.94c-5.75%203.32-9.3%209.46-9.3%2016.11v247.99c0%206.65%203.55%2012.79%209.3%2016.11l213.01%20122.98c6.84%203.95%2015.28%203.95%2022.12%200l213.01-122.98c5.75-3.32%209.3-9.46%209.3-16.11V142.05c0-6.65-3.55-12.79-9.3-16.11ZM444.05%20151.99%20238.42%20508.15c-1.39%202.4-5.06%201.42-5.06-1.36V273.58c0-4.66-2.49-8.97-6.53-11.31L24.87%20145.67c-2.4-1.39-1.42-5.06%201.36-5.06h411.26c5.84%200%209.49%206.33%206.57%2011.39Z'/%3e%3c/svg%3e`,``+import.meta.url).href,opencode:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%3e%3crect%20width='512'%20height='512'%20fill='%23131010'/%3e%3cpath%20d='M320%20224v128H192V224h128Z'%20fill='%235A5858'/%3e%3cpath%20fill='%23fff'%20fill-rule='evenodd'%20d='M384%20416H128V96h256v320ZM320%20160H192v192h128V160Z'%20clip-rule='evenodd'/%3e%3c/svg%3e`,``+import.meta.url).href,pi:new URL(`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20800'%3e%3cpath%20fill='%23fff'%20fill-rule='evenodd'%20d='M165.29%20165.29h352.07V400H400v117.36H282.65v117.36H165.29V165.29Zm117.36%20117.36V400H400V282.65H282.65Z'/%3e%3cpath%20fill='%23fff'%20d='M517.36%20400h117.36v234.72H517.36z'/%3e%3c/svg%3e`,``+import.meta.url).href};function Lm(e){return Im[e.trim().toLowerCase()]}function Rm(e,t=`icon-svg`){return wm(e,{class:t,"aria-hidden":`true`})}function zm(e){return(e.kind===`shell`||e.kind===`shell-result`)&&typeof e.outputId==`string`&&e.outputId.length>0}function Bm(e){let t=[`Process ${e.processId}`,e.status];return e.timedOut?t.push(`timed out`):e.signal?t.push(`signal ${e.signal}`):e.exitCode!==void 0&&t.push(`exit ${e.exitCode}`),t.join(` · `)}function Vm(e,t,n,r){let i=r?Q(`button`,{className:[`activity-row`,`interactive`,t?`child`:`parent`,`kind-${qm(e)}`,`phase-${Jm(e)}`,e.kind===`shell-result`?`shell-result`:void 0].filter(Boolean).join(` `),type:`button`,ariaExpanded:String(n)}):Q(`div`,{className:[`activity-row`,t?`child`:`parent`,`kind-${qm(e)}`,`phase-${Jm(e)}`,e.kind===`shell-result`?`shell-result`:void 0].filter(Boolean).join(` `)});r&&i.addEventListener(`click`,r),i.dataset.activityId=e.activityId;let a=Q(`span`,{className:`activity-icon`,ariaHidden:`true`});a.append(Rm(Km(e),`activity-icon-svg`));let o=Q(`span`,{className:`activity-main`}),s=Q(`span`,{className:`activity-title-line`});s.append(Q(`span`,{className:`activity-title`,text:e.title})),e.member&&s.append(Q(`span`,{className:`activity-member`,text:e.member,title:`Composite member: ${e.member}`})),s.append(Q(`span`,{className:`activity-target`,text:e.target,title:e.target})),o.append(s),e.children&&o.append(Wm(e.children));let c=Q(`span`,{className:`activity-meta`}),l=Q(`span`,{className:`activity-phase`,text:Xm(e)}),u=Zm(e.durationMs);c.append(l),u&&c.append(Q(`span`,{className:`activity-duration`,text:u}));let d=e.detailAvailable?Qm(n):Q(`span`,{className:`activity-detail-spacer`,ariaHidden:`true`});return d.classList.add(`activity-detail-chevron`),i.append(a,o,c,d),i}function Hm(e,t,n,r=!1){let i=Q(`section`,{className:`activity-detail-section${r?` error`:``}`});i.append(Q(`div`,{className:`activity-detail-label`,text:t}),Q(`pre`,{className:`activity-detail-value pretty-scrollbar`,text:Um(n)})),e.append(i)}function Um(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function Wm(e){let t=Q(`span`,{className:`activity-progress-wrap`}),n=Q(`span`,{className:`activity-progress-counts`,text:Gm(e)}),r=Q(`span`,{className:`activity-progress-track`,ariaHidden:`true`}),i=Q(`span`,{className:`activity-progress-fill`}),a=e.done+e.error;return i.style.width=`${e.total>0?Math.min(100,a/e.total*100):0}%`,r.append(i),t.append(n,r),t}function Gm(e){let t=[`${e.done+e.error}/${e.total}`];return e.working>0&&t.push(`${e.working} running`),e.error>0&&t.push(`${e.error} failed`),t.join(` · `)}function Km(e){switch(e.kind){case`read`:return Z.readFile;case`write`:return Z.writeFile;case`edit`:case`rename`:return Z.editFile;case`delete`:return Z.deleteFile;case`shell`:return Z.terminalSquare;case`shell-result`:return Z.terminal;case`capability`:case`batch`:return Z.skills;default:return Z.files}}function qm(e){switch(e.kind){case`read`:case`write`:case`edit`:case`rename`:case`delete`:case`shell`:case`shell-result`:case`capability`:case`batch`:return e.kind;default:return`tool`}}function Jm(e){return e.bashPhase?e.bashPhase:e.status===`working`?`executing`:e.status===`error`?`error`:`done`}function Ym(e){switch(e){case`working`:return`Working`;case`done`:return`Done`;case`error`:return`Error`}}function Xm(e){if(e.state===`blocked`)return`Blocked`;switch(Jm(e)){case`executing`:return`Running`;case`returned`:return`Returned`;case`done`:return`Done`;case`error`:return`Error`}}function Zm(e){if(e!==void 0)return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(+(e<1e4))}s`}function Qm(e){let t=Q(`span`,{className:`chevron ${e?`expanded`:``}`,ariaHidden:`true`});return t.append(Rm(Z.chevronDown)),t}function Q(e,t={}){let n=document.createElement(e);return t.className&&(n.className=t.className),t.text!==void 0&&(n.textContent=t.text),t.type!==void 0&&`type`in n&&n.setAttribute(`type`,t.type),t.title!==void 0&&(n.title=t.title),t.ariaHidden!==void 0&&n.setAttribute(`aria-hidden`,t.ariaHidden),t.ariaLabel!==void 0&&n.setAttribute(`aria-label`,t.ariaLabel),t.ariaExpanded!==void 0&&n.setAttribute(`aria-expanded`,t.ariaExpanded),n}var $m=1e3,eh=class{root;options;app=null;snapshot=null;activities=[];indexRevision;indexLoading=!1;indexInFlight=!1;indexError=null;expanded=!1;refreshTimer=null;refreshInFlight=!1;refreshError=null;unchangedRefreshes=0;visibilityListenerAttached=!1;followTail=!0;scrollTop=0;selectedActivityId=null;details=new Map;detailLoading=new Set;detailErrors=new Map;outputs=new Map;outputLoading=new Set;outputErrors=new Map;outputRefreshTimer=null;mountedRichPayload=null;renderGeneration=0;handleVisibilityChange=()=>{if(document.hidden){this.stopRefresh(),this.stopOutputRefresh();return}this.snapshot&&(this.stopRefresh(),this.scheduleRefresh(0,!0));let e=this.activities.find(e=>e.activityId===this.selectedActivityId);e&&zm(e)&&this.outputs.get(e.outputId)?.status===`running`&&this.scheduleOutputRefresh(e,0)};constructor(e,t={}){this.root=e,this.options=t}get active(){return this.snapshot!==null}accept(e){let t=e.structuredContent;if(!em(t))return!1;let n=this.snapshot?.turnId!==t.turnId;return this.snapshot=t,this.refreshError=null,n?(this.unchangedRefreshes=0,this.expanded=$p(e._meta),this.followTail=!0,this.scrollTop=0,this.activities=[],this.indexRevision=void 0,this.indexError=null,this.resetDetails()):this.unchangedRefreshes=t.changed?0:this.unchangedRefreshes+1,this.stopRefresh(),this.scheduleRefresh(),this.expanded&&t.revision>0&&this.indexRevision!==t.revision&&this.loadIndex(!1),!0}attach(e){this.app=e,this.visibilityListenerAttached||=(document.addEventListener(`visibilitychange`,this.handleVisibilityChange),!0),this.scheduleRefresh()}clear(){this.stopRefresh(),this.snapshot=null,this.activities=[],this.indexRevision=void 0,this.indexLoading=!1,this.indexInFlight=!1,this.indexError=null,this.refreshError=null,this.unchangedRefreshes=0,this.expanded=!1,this.followTail=!0,this.scrollTop=0,this.resetDetails()}detach(){this.clear(),this.visibilityListenerAttached&&=(document.removeEventListener(`visibilitychange`,this.handleVisibilityChange),!1),this.app=null}render(){return this.renderGeneration+=1,this.unmountRichPayload(),this.snapshot?this.snapshot.revision===0?(this.root.replaceChildren(),!0):(this.renderPanel(this.snapshot),!0):!1}scheduleRefresh(e,t=!1){if(!this.app||!this.snapshot||this.refreshTimer!==null||document.hidden)return;let n=e??Qp(this.snapshot.state,this.unchangedRefreshes,!0);if(!(!t&&n===null)&&n!==null){if(!this.app.getHostCapabilities()?.serverTools){this.refreshError=`Live Activity refresh is unavailable in this host.`,this.render();return}this.refreshTimer=window.setTimeout(()=>{this.refreshTimer=null,this.refreshSnapshot()},n)}}stopRefresh(){this.refreshTimer!==null&&(window.clearTimeout(this.refreshTimer),this.refreshTimer=null)}async refreshSnapshot(){if(!this.app||!this.snapshot||this.refreshInFlight)return;let e=this.snapshot.turnId,t=this.snapshot.revision;this.refreshInFlight=!0;try{let n=await this.app.callServerTool({name:`activity_snapshot`,arguments:{turnId:e,knownRevision:t}});if(n.isError)throw Error(`Activity snapshot refresh failed.`);let r=n.structuredContent;if(!em(r)||r.turnId!==e)throw Error(`Activity snapshot refresh returned an invalid Host Turn state.`);if(!this.snapshot||this.snapshot.turnId!==e)return;let i=r.changed||this.refreshError!==null;this.snapshot=r,this.unchangedRefreshes=r.changed?0:this.unchangedRefreshes+1,this.refreshError=null,i&&this.render(),r.changed&&this.expanded&&r.revision>0&&this.loadIndex(!1)}catch(e){this.unchangedRefreshes+=1;let t=e instanceof Error?e.message:`Activity snapshot refresh failed.`;this.refreshError!==t&&(this.refreshError=t,this.render())}finally{this.refreshInFlight=!1,this.scheduleRefresh()}}async loadIndex(e){if(!this.app||!this.snapshot||!this.expanded||this.snapshot.revision===0||this.indexInFlight)return;let t=this.snapshot.turnId,n=this.indexRevision;this.indexInFlight=!0,e&&(this.indexLoading=!0,this.indexError=null,this.render());try{let e=await this.app.callServerTool({name:`activity_index`,arguments:{turnId:t,...n===void 0?{}:{knownRevision:n}}});if(e.isError)throw Error(`Activity index request failed.`);let r=e.structuredContent;if(!tm(r)||r.turnId!==t)throw Error(`Activity index returned an invalid Activity index.`);if(!this.snapshot||this.snapshot.turnId!==t)return;this.activities=im(this.activities,r),this.indexRevision=r.revision,r.revision>=this.snapshot.revision&&(this.snapshot={turnId:r.turnId,revision:r.revision,changed:r.changed,state:r.state}),this.indexError=null}catch(e){if(!this.snapshot||this.snapshot.turnId!==t)return;this.indexError=e instanceof Error?e.message:`Activity index request failed.`}finally{this.indexLoading=!1,this.indexInFlight=!1,this.snapshot?.turnId===t&&this.render(),this.expanded&&this.snapshot?.turnId===t&&this.indexRevision!==void 0&&this.indexRevision!==this.snapshot.revision&&this.loadIndex(!1)}}resetDetails(){this.stopOutputRefresh(),this.unmountRichPayload(),this.selectedActivityId=null,this.details.clear(),this.detailLoading.clear(),this.detailErrors.clear(),this.outputs.clear(),this.outputLoading.clear(),this.outputErrors.clear()}toggleDetail(e){if(e.detailAvailable){if(this.stopOutputRefresh(),this.selectedActivityId===e.activityId){this.selectedActivityId=null,this.render();return}if(this.selectedActivityId=e.activityId,this.render(),zm(e)){let t=this.outputs.get(e.outputId);t?.status===`running`&&this.scheduleOutputRefresh(e),!t&&!this.outputLoading.has(e.outputId)&&!this.outputErrors.has(e.outputId)&&this.loadOutput(e,!0);return}!this.details.has(e.activityId)&&!this.detailLoading.has(e.activityId)&&!this.detailErrors.has(e.activityId)&&this.loadDetail(e)}}async loadDetail(e){if(!this.app||!this.snapshot||!e.detailAvailable)return;let t=this.snapshot.turnId,n=e.activityId;this.detailLoading.add(n),this.detailErrors.delete(n),this.render();try{let e=await this.app.callServerTool({name:`activity_detail`,arguments:{turnId:t,activityId:n}});if(e.isError)throw Error(`Activity detail request failed.`);let r=e.structuredContent;if(!nm(r)||r.activity.activityId!==n)throw Error(`Activity detail returned an invalid Activity record.`);if(!this.snapshot||this.snapshot.turnId!==t)return;this.details.set(n,r)}catch(e){if(!this.snapshot||this.snapshot.turnId!==t)return;this.detailErrors.set(n,e instanceof Error?e.message:`Activity detail request failed.`)}finally{this.detailLoading.delete(n),this.snapshot?.turnId===t&&this.render()}}stopOutputRefresh(){this.outputRefreshTimer!==null&&(window.clearTimeout(this.outputRefreshTimer),this.outputRefreshTimer=null)}scheduleOutputRefresh(e,t=$m){!zm(e)||this.outputRefreshTimer!==null||document.hidden||this.selectedActivityId===e.activityId&&(this.outputRefreshTimer=window.setTimeout(()=>{this.outputRefreshTimer=null,this.selectedActivityId===e.activityId&&this.loadOutput(e,!1)},t))}async loadOutput(e,t){if(!this.app||!this.snapshot||!zm(e))return;let n=this.snapshot.turnId,r=e.outputId;t&&this.outputLoading.add(r),this.outputErrors.delete(r),t&&this.render();let i=!1;try{let e=this.outputs.get(r),t=await this.app.callServerTool({name:`activity_output`,arguments:{turnId:n,outputId:r,...e?{cursor:e.cursor}:{}}});if(t.isError)throw Error(`Bash output request failed.`);let a=t.structuredContent;if(!rm(a)||a.outputId!==r)throw Error(`Bash output returned an invalid durable output record.`);if(e&&a.cursor<e.cursor)throw Error(`Bash output cursor moved backwards.`);if(!this.snapshot||this.snapshot.turnId!==n)return;this.outputs.set(r,e?{...a,output:e.output+a.output}:a),i=a.status===`running`}catch(e){if(!this.snapshot||this.snapshot.turnId!==n)return;this.outputErrors.set(r,e instanceof Error?e.message:`Bash output request failed.`)}finally{this.outputLoading.delete(r),this.snapshot?.turnId===n&&this.render(),i&&this.selectedActivityId===e.activityId&&this.scheduleOutputRefresh(e)}}renderActivityEntry(e,t){let n=this.selectedActivityId===e.activityId,r=Q(`div`,{className:`activity-entry${n?` expanded`:``}`});return r.append(Vm(e,t,n,e.detailAvailable?()=>this.toggleDetail(e):void 0)),n&&r.append(this.renderActivityDetail(e)),r}renderActivityDetail(e){if(zm(e))return this.renderBashOutput(e);let t=Q(`div`,{className:`activity-detail`}),n=e.activityId;if(this.detailLoading.has(n))return t.append(Q(`div`,{className:`activity-detail-status`,text:`Loading details...`})),t;let r=this.detailErrors.get(n);if(r)return t.append(Q(`div`,{className:`activity-detail-status error`,text:r})),t;let i=this.details.get(n);if(!i)return t.append(Q(`div`,{className:`activity-detail-status`,text:`Details unavailable.`})),t;i.error&&Hm(t,`Error`,i.error,!0);let a=ym(i);if(a&&bm(a)){let e=Q(`div`,{className:`activity-detail-rich`});return e.append(Q(`div`,{className:`activity-detail-status`,text:a.tool===`read`?`Loading file view...`:`Loading diff...`})),t.append(e),this.mountRichPayload(n,e,a,this.renderGeneration),t}return i.request!==void 0&&Hm(t,`Request`,i.request),i.result!==void 0&&Hm(t,`Result`,i.result),t.childElementCount===0&&t.append(Q(`div`,{className:`activity-detail-status`,text:`No additional details.`})),t}async mountRichPayload(e,t,n,r){try{let{mountHeavyPayload:i}=await up(async()=>{let{mountHeavyPayload:e}=await import(`./heavy-payload-Cqx9MOkH.js`);return{mountHeavyPayload:e}},[],import.meta.url);if(r!==this.renderGeneration||this.selectedActivityId!==e||!t.isConnected)return;t.replaceChildren(),this.mountedRichPayload=i(t,{card:n,hostContext:this.app?.getHostContext()??void 0})}catch(n){if(r!==this.renderGeneration||this.selectedActivityId!==e||!t.isConnected)return;t.replaceChildren(Q(`div`,{className:`activity-detail-status error`,text:n instanceof Error?n.message:`Unable to load Activity payload.`}))}}unmountRichPayload(){this.mountedRichPayload?.unmount(),this.mountedRichPayload=null}renderBashOutput(e){let t=Q(`div`,{className:`activity-detail activity-terminal`}),n=e.outputId;if(this.outputLoading.has(n))return t.append(Q(`div`,{className:`activity-detail-status`,text:`Loading terminal output...`})),t;let r=this.outputErrors.get(n);if(r)return t.append(Q(`div`,{className:`activity-detail-status error`,text:r})),t;let i=this.outputs.get(n);return i?(t.append(Q(`pre`,{className:`activity-terminal-command`,text:i.command}),Q(`pre`,{className:`activity-terminal-output pretty-scrollbar`,text:i.output||`(no output)`}),Q(`div`,{className:`activity-terminal-meta status-${i.status}`,text:Bm(i)})),t):(t.append(Q(`div`,{className:`activity-detail-status`,text:`Terminal output unavailable.`})),t)}renderPanel(e){let t=this.root.querySelector(`.activity-viewport`);t&&(this.scrollTop=t.scrollTop);let n=Q(`section`,{className:`activity-panel state-${e.state}`}),r=Q(`button`,{className:`activity-panel-header`,type:`button`,ariaExpanded:String(this.expanded)});r.addEventListener(`click`,()=>{this.expanded=!this.expanded,this.expanded||this.stopOutputRefresh(),this.render(),this.expanded&&e.revision>0&&this.indexRevision!==e.revision&&this.loadIndex(!0)});let i=Q(`span`,{className:`activity-panel-status state-${e.state}`,ariaHidden:`true`}),a=Q(`span`,{className:`activity-panel-title-group`});a.append(Q(`span`,{className:`activity-panel-title`,text:`Activity`}),Q(`span`,{className:`activity-panel-subtitle`,text:`Host Turn · revision ${e.revision}`}));let o=this.activities.length,s=Q(`span`,{className:`activity-panel-count state-${e.state}`,text:this.expanded&&this.indexRevision!==void 0?`${o} ${o===1?`activity`:`activities`}`:Ym(e.state)});if(r.append(i,a,s,Qm(this.expanded)),n.append(r),this.expanded){let e=Q(`div`,{className:`activity-panel-body`}),t=Q(`div`,{className:`activity-viewport pretty-scrollbar`,ariaLabel:`ForgeRelay Activity Panel`});t.addEventListener(`scroll`,()=>{this.scrollTop=t.scrollTop,this.followTail=om(t)});let r=am(this.activities);if(this.indexLoading&&this.indexRevision===void 0)t.append(Q(`div`,{className:`activity-empty`,text:`Loading Activity index...`}));else if(this.indexError)t.append(Q(`div`,{className:`activity-empty error`,text:this.indexError}));else if(r.length===0)t.append(Q(`div`,{className:`activity-empty`,text:`Waiting for ForgeRelay activity...`}));else{let e=Q(`div`,{className:`activity-list`});for(let t of r){let n=Q(`div`,{className:`activity-group${t.children.length>0?` grouped`:``}`});if(n.append(this.renderActivityEntry(t.activity,!1)),t.children.length>0){let e=Q(`div`,{className:`activity-children`});for(let n of t.children)e.append(this.renderActivityEntry(n,!0));n.append(e)}e.append(n)}t.append(e)}this.refreshError&&e.append(Q(`div`,{className:`activity-refresh-error`,text:this.refreshError})),e.prepend(t),n.append(e),this.replacePanel(n),this.followTail?(t.scrollTop=t.scrollHeight,this.scrollTop=t.scrollTop):t.scrollTop=Math.min(this.scrollTop,Math.max(0,t.scrollHeight-t.clientHeight));return}this.replacePanel(n)}replacePanel(e){if(this.options.embedded){this.root.replaceChildren(e);return}let t=Q(`main`,{className:`shell`});t.append(e),this.root.replaceChildren(t)}};function th(e){let t=sh(e._meta),n=sh(e.structuredContent),r=sh(t?.[`forgerelay/activityPanelWorkspace`])??sh(n?.[`forgerelay/activityPanelWorkspace`]);if(r&&!(typeof r.workspaceId!=`string`||r.workspaceId.length===0)&&!(typeof r.root!=`string`||r.root.length===0)&&!(r.mode!==void 0&&r.mode!==`checkout`&&r.mode!==`worktree`))return r}var nh=class{root;app=null;card=null;openInstructionKey=null;showAvailableInstructions=!1;instructionContents=new Map;instructionLoading=new Set;instructionErrors=new Map;constructor(e){this.root=e}get active(){return this.card!==null}get workspaceId(){return this.card?.workspaceId}attach(e){this.app=e}detach(){this.app=null}accept(e){let t=th(e);return t?(this.card?.workspaceId!==t.workspaceId&&(this.openInstructionKey=null,this.showAvailableInstructions=!1,this.instructionContents.clear(),this.instructionLoading.clear(),this.instructionErrors.clear()),this.card=t,!0):!1}clear(){this.card=null,this.openInstructionKey=null,this.showAvailableInstructions=!1,this.instructionContents.clear(),this.instructionLoading.clear(),this.instructionErrors.clear(),this.root.replaceChildren()}render(){return this.card?(this.root.replaceChildren(this.renderPanel(this.card)),!0):!1}renderPanel(e){let t=$(`section`,`workspace-panel`),n=$(`div`,`workspace-panel-header`),r=$(`span`,`workspace-panel-icon`);r.setAttribute(`aria-hidden`,`true`),r.append(Rm(Z.folderOpen,`workspace-panel-icon-svg`));let i=$(`span`,`workspace-panel-title-group`),a=$(`span`,`workspace-panel-title`,`Workspace`),o=$(`span`,`workspace-panel-subtitle`,oh(e.root));o.title=e.root,i.append(a,o);let s=$(`span`,`workspace-panel-mode`,e.mode??`workspace`);n.append(r,i,s);let c=$(`div`,`workspace-details pretty-scrollbar`),l=$(`div`,`workspace-rows`);return rh(l,`Root`,e.root,Z.folderOpen,!0),rh(l,`Mode`,e.mode??`workspace`,Z.folderTree),this.appendExecutionContextRows(l,e),e.worktree&&this.appendWorktreeRows(l,e),e.sourceRoot&&e.sourceRoot!==e.root&&rh(l,`Source checkout`,e.sourceRoot,Z.sourceCheckout,!0),this.appendInstructions(l,e.agentsFiles??[],e.availableAgentsFiles??[],e.workspaceInstructions??[]),this.appendSkills(l,e.skills??[]),this.appendAgents(l,e),c.append(l),t.append(n,c),t}appendExecutionContextRows(e,t){let n=t.executionContext;if(!n)return;n.platform&&rh(e,`Execution platform`,n.platform,Z.terminalSquare);let r=n.commandShellRuntime;r?.family&&(rh(e,`Command shell`,[r.family,r.version,r.source?`[${r.source}]`:void 0].filter(e=>!!e).join(` `),Z.terminalSquare),r.executable&&rh(e,`Shell executable`,r.executable,Z.terminal,!0)),n.runtimePrivilege?.level&&rh(e,`Runtime privilege`,n.runtimePrivilege.level,n.runtimePrivilege.level===`standard`?Z.terminal:Z.warning)}appendWorktreeRows(e,t){let n=t.worktree;if(!n)return;let r=[n.baseRef,n.baseSha?.slice(0,8)].filter(e=>!!e);if(r.length>0){let t=$(`span`,`workspace-base-value`),i=$(`span`,`workspace-value`,r.join(` · `));if(i.title=r.join(` · `),t.append(i),n.dirtySource){let e=$(`span`,`workspace-base-warning`);e.title=`The source checkout had uncommitted changes when this worktree was created.`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Source checkout changes are not included in this worktree`),e.append(Rm(Z.warning,`workspace-base-warning-svg`)),t.append(e)}ih(e,`Base`,t,Z.base)}n.branch&&rh(e,`Worktree branch`,n.branch,Z.gitBranch),n.targetBranch&&rh(e,`Merge target`,n.targetBranch,Z.gitBranch)}appendInstructions(e,t,n,r){let i=t.map((e,t)=>({key:`loaded:${t}`,path:e.path,label:e.path??`Loaded instructions`,content:e.content,status:`loaded`})),a=new Set(i.map(e=>e.path).filter(Boolean)),o=n.flatMap((e,t)=>e.path&&a.has(e.path)?[]:[{key:`available:${t}`,path:e.path,label:e.path??`Nested instructions`,status:`available`}]),s=new Set([...i,...o].map(e=>e.path).filter(e=>!!e)),c=r.flatMap((e,t)=>!e.status||e.path&&s.has(e.path)&&e.status!==`disabled`&&e.status!==`unavailable`?[]:[{key:`workspace:${t}`,path:e.path,label:e.path??`Shell instructions`,status:e.status}]),l=[...i,...c.filter(e=>e.status!==`available`)],u=[...o,...c.filter(e=>e.status===`available`)];if(l.length===0&&u.length===0)return;let d=this.showAvailableInstructions?[...l,...u]:l,f=$(`span`,`workspace-instruction-list`);for(let e of d)f.append(this.renderInstruction(e,f));if(u.length>0){let e=$(`button`,`workspace-instructions-toggle`,this.showAvailableInstructions?`Show less`:`View all`);e.type=`button`,e.setAttribute(`aria-expanded`,String(this.showAvailableInstructions)),e.addEventListener(`click`,()=>{this.showAvailableInstructions=!this.showAvailableInstructions,this.showAvailableInstructions||(this.openInstructionKey=null),this.render()}),f.append(e)}let p=$(`div`,`workspace-instructions-content`);p.append(f),ih(e,`Instructions`,p,Z.instructions,`workspace-instructions-row`)}renderInstruction(e,t){let n=$(`span`,`workspace-instruction-item`);n.dataset.instructionKey=e.key;let r=e.path?this.instructionContents.get(e.path):void 0,i=e.content??r,a=e.status!==`unavailable`&&(i!==void 0||e.path!==void 0),o=$(a?`button`:`span`,`workspace-instruction-header${a?` interactive`:``}`);o instanceof HTMLButtonElement&&(o.type=`button`,o.setAttribute(`aria-expanded`,String(this.openInstructionKey===e.key)));let s=$(`span`,`workspace-instruction-status ${e.status}`);s.setAttribute(`role`,`img`);let c=e.status===`loaded`?`Loaded into the current workspace context`:e.status===`disabled`?`Available but disabled for the current workspace context`:e.status===`unavailable`?`Configured instruction file is unavailable`:`Available for a nested directory`;s.setAttribute(`aria-label`,c),s.title=c,s.append(Rm(e.status===`loaded`?Z.instructionLoaded:e.status===`unavailable`?Z.warning:Z.instructionAvailable,`workspace-instruction-status-svg`));let l=$(`span`,`workspace-instruction-text`),u=oh(e.label);if(l.append($(`span`,`workspace-instruction-name`,u)),e.path&&e.path!==u){let t=$(`span`,`workspace-instruction-path`,e.path);t.title=e.path,l.append(t)}if(o.append(s,l),!a)return n.append(o),n;let d=$(`span`,`workspace-instruction-chevron`);d.setAttribute(`aria-hidden`,`true`),d.append(Rm(Z.chevronDown,`workspace-instruction-chevron-svg`)),o.append(d);let f=e.path?this.instructionLoading.has(e.path):!1,p=e.path?this.instructionErrors.get(e.path):void 0,m=$(`pre`,`workspace-instruction-preview pretty-scrollbar`,i??(f?`Loading instruction…`:p??`Instruction content is unavailable.`)),h=this.openInstructionKey===e.key;return n.classList.toggle(`expanded`,h),o.setAttribute(`aria-expanded`,String(h)),m.hidden=!h,o.addEventListener(`click`,()=>{if(this.openInstructionKey===e.key){this.openInstructionKey=null,this.render();return}this.openInstructionKey=e.key,i===void 0&&e.path&&this.loadInstruction(e.path),this.render()}),n.append(o,m),n}async loadInstruction(e){let t=this.app,n=this.card?.workspaceId;if(!(!t||!n||this.instructionLoading.has(e))){this.instructionLoading.add(e),this.instructionErrors.delete(e),this.render();try{let r=await t.callServerTool({name:`workspace_instruction`,arguments:{workspaceId:n,path:e}});if(this.card?.workspaceId!==n)return;if(r.isError)throw Error(r.content?.filter(e=>e.type===`text`).map(e=>e.text).join(`
113
+ `)||`Failed to load instruction.`);let i=sh(r.structuredContent),a=i?.content,o=i?.path;if(typeof a!=`string`||o!==void 0&&o!==e)throw Error(`Workspace instruction response was malformed.`);this.instructionContents.set(e,a)}catch(t){this.instructionErrors.set(e,t instanceof Error?t.message:String(t))}finally{this.instructionLoading.delete(e),this.card?.workspaceId===n&&this.render()}}}appendSkills(e,t){if(t.length===0)return;let n=ah(t.map(e=>({label:e.name??`Unnamed skill`,title:e.description||void 0})));n.classList.add(`workspace-skills-list`),ih(e,`Skills`,n,Z.skills,`workspace-skills-row`)}appendAgents(e,t){let n=t.agentProviders??[],r=(t.agents??[]).map(e=>{let t=e.provider?.trim(),n=e.providerAvailable===!1;return{label:e.name??`Unnamed agent`,logo:t?Lm(t):void 0,profile:!0,tone:n?`muted`:void 0,title:[e.description,t?`Provider: ${t}`:void 0,e.model?`Model: ${e.model}`:void 0,e.thinking?`Thinking: ${e.thinking}`:void 0,n?e.providerUnavailableReason??`Provider unavailable`:void 0].filter(Boolean).join(`
114
+ `)||void 0}}),i=n.map(e=>{let t=e.name?.trim()||`Unknown provider`,n=Lm(t);return{label:t,logo:n,bareLogo:!!n,ariaLabel:t,tone:e.available===!1?`muted`:void 0,title:e.available===!1?e.reason??`Provider unavailable`:t}});if(r.length>0){let t=ah([...r,...i]);t.classList.add(`workspace-agents-list`),ih(e,`Agents`,t,Z.agents,`workspace-agents-row`)}else i.length>0&&ih(e,`Providers`,ah(i),Z.providers)}};function rh(e,t,n,r,i=!1){let a=$(`span`,`workspace-value${i?` mono`:``}`,n);a.title=n,ih(e,t,a,r)}function ih(e,t,n,r,i){let a=$(`div`,[`workspace-row`,i].filter(Boolean).join(` `)),o=$(`span`,`workspace-row-icon`);o.setAttribute(`aria-hidden`,`true`),o.append(Rm(r,`workspace-row-icon-svg`)),a.append(o,$(`span`,`workspace-key`,t),n),e.append(a)}function ah(e){let t=$(`span`,`workspace-chip-list`);for(let n of e){let e=!!(n.bareLogo&&n.logo),r=$(`span`,[e?`workspace-provider-logo`:n.profile?`workspace-agent-profile`:`workspace-chip`,n.tone].filter(Boolean).join(` `));if(n.title&&(r.title=n.title),e&&(r.setAttribute(`role`,`img`),r.setAttribute(`aria-label`,n.ariaLabel??n.label)),n.logo){let t=document.createElement(`img`);t.className=e?`workspace-provider-logo-image`:n.profile?`workspace-agent-profile-logo`:`workspace-chip-logo`,t.src=n.logo,t.alt=``,t.setAttribute(`aria-hidden`,`true`),r.append(t)}e||r.append($(`span`,`workspace-chip-label`,n.label)),t.append(r)}return t}function oh(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).at(-1)??e}function sh(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function $(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}document.documentElement.dataset.forgerelayApp=`panel`;var ch=document.querySelector(`#app`);if(!ch)throw Error(`Missing #app root element.`);var lh=ch,uh=Oh(`section`,`forgerelay-panel`),dh=Oh(`div`,`workspace-panel-slot`),fh=Oh(`div`,`activity-panel-slot`);uh.append(dh,fh),lh.replaceChildren(uh);var ph=new nh(dh),mh=new eh(fh,{embedded:!0}),hh=null,gh,_h=!1,vh=null,yh,bh=!1,xh;Sh();async function Sh(){Eh(),hh=new Xp({name:`forgerelay-panel`,version:`0.1.0`},{}),hh.ontoolinput=e=>{let t=e.arguments?.workspaceId;typeof t==`string`&&t.length>0&&(yh=t,_h&&!mh.active&&wh()),Eh()},hh.ontoolresult=e=>{Ch(e)},hh.onhostcontextchanged=e=>{gh={...gh,...e},Th()},hh.onteardown=async()=>(_h=!1,mh.detach(),ph.detach(),ph.clear(),{});try{await hh.connect();let e=hh.getHostContext();e&&(gh=e),Th(),_h=!0,mh.attach(hh),ph.attach(hh),yh&&!mh.active&&wh()}catch(e){vh=e instanceof Error?e.message:String(e)}Eh()}function Ch(e){ph.accept(e)&&(yh=ph.workspaceId),mh.accept(e),Eh()}async function wh(){let e=yh;if(!(!hh||!_h||!e||mh.active||bh||xh===e)&&hh.getHostCapabilities()?.serverTools){xh=e,bh=!0,Eh();try{let t=await hh.callServerTool({name:`activity_snapshot`,arguments:{workspaceId:e}});t.isError||Ch(t)}finally{bh=!1,Eh()}}}function Th(){gh?.theme&&Kp(gh.theme),gh?.styles?.variables&&qp(gh.styles.variables),gh?.styles?.css?.fonts&&Jp(gh.styles.css.fonts);let e=gh?.safeAreaInsets;e&&(document.body.style.padding=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`)}function Eh(){ph.render()||Dh(),mh.render()||fh.replaceChildren()}function Dh(){let e=Oh(`section`,`workspace-panel pending`),t=Oh(`div`,`workspace-panel-header`),n=Oh(`span`,`workspace-panel-title-group`);n.append(Oh(`span`,`workspace-panel-title`,`Workspace`),Oh(`span`,`workspace-panel-subtitle`,vh||(yh?bh?`Loading workspace…`:yh:_h?`Waiting for workspace…`:`Connecting to host…`))),t.append(n),e.append(t),dh.replaceChildren(e)}function Oh(e,t,n){let r=document.createElement(e);return r.className=t,n!==void 0&&(r.textContent=n),r}export{vm as a,_m as i,mm as n,up as o,hm as r,gm as t};