@mcpjam/inspector 3.12.2 → 3.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/client/assets/{OAuthDesktopReturnNotice-BvaAi4cq.js → OAuthDesktopReturnNotice-C5D90OSm.js} +2 -2
  2. package/dist/client/assets/{app-bootstrap-BW4kwx2v.js → app-bootstrap-C1Jn01kP.js} +332 -332
  3. package/dist/client/assets/{button-DnQ-Tv1N.js → button-RD2Dghjp.js} +2 -2
  4. package/dist/client/assets/{chunk-YOKDWASO-D9rkUgct.js → chunk-YOKDWASO-DTTU1wSE.js} +5 -5
  5. package/dist/client/assets/{dead-clicks-autocapture-DmzB74X1.js → dead-clicks-autocapture-CDkbT21a.js} +2 -2
  6. package/dist/client/assets/{error-reporting-fkIkUpXy.js → error-reporting-Dg5b1JwS.js} +3 -3
  7. package/dist/client/assets/{error-reporting-C6hkRPpb.js → error-reporting-_SEhX6IL.js} +1 -1
  8. package/dist/client/assets/{exception-autocapture-BJuba1BH.js → exception-autocapture-CtxHwPtn.js} +2 -2
  9. package/dist/client/assets/{failed-request-tracker-Biouu9sg.js → failed-request-tracker-kUaJ-sVM.js} +2 -2
  10. package/dist/client/assets/{highlighted-body-KPVGNVTW-C5fdYDQ6.js → highlighted-body-KPVGNVTW-CBC2hHHb.js} +2 -2
  11. package/dist/client/assets/{index-DcaDaXoT.js → index-yOjxp36p.js} +3 -3
  12. package/dist/client/assets/{jszip.min-DbcCjjhc.js → jszip.min-B3Qii_az.js} +2 -2
  13. package/dist/client/assets/{mermaid-HWGCJPDP-C0opeW_Z.js → mermaid-HWGCJPDP-BzT3-9sO.js} +1 -1
  14. package/dist/client/assets/{posthog-recorder-C0Eve_v2.js → posthog-recorder-B06ULcLl.js} +2 -2
  15. package/dist/client/assets/{preload-helper-6yXzl-We.js → preload-helper-DvWwGI6x.js} +2 -2
  16. package/dist/client/assets/{rolldown-runtime-aO8ZncHb.js → rolldown-runtime-DVMSi0Yr.js} +1 -1
  17. package/dist/client/assets/{surveys-CYgi8qEu.js → surveys-D941hgn3.js} +2 -2
  18. package/dist/client/assets/{trace-timeline-BipssVoa.js → trace-timeline-Bk3hAXNq.js} +1 -1
  19. package/dist/client/assets/{trace-timeline-BQ5wej-R.js → trace-timeline-DVZqlQSW.js} +2 -2
  20. package/dist/client/assets/{web-vitals-O0au_1Qc.js → web-vitals-DZUBt4dL.js} +2 -2
  21. package/dist/client/index.html +6 -6
  22. package/dist/server/{chunk-PPGJCZNJ.js → chunk-5RE7KJ2M.js} +4 -3
  23. package/dist/server/{chunk-KML2Y7FH.js → chunk-WGJHSGJP.js} +4 -3
  24. package/dist/server/{consent-lifetime-DYWG3A3P.js → consent-lifetime-PTGAZQSU.js} +2 -2
  25. package/dist/server/harness-install-cli.js +1 -1
  26. package/dist/server/index.js +9195 -7811
  27. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import{t as iy}from"./failed-request-tracker-Biouu9sg.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.12.2"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5d44395f-285e-4586-bcd3-e2e00cbc9a8e",e._sentryDebugIdIdentifier="sentry-dbid-5d44395f-285e-4586-bcd3-e2e00cbc9a8e")}catch{}})();var Gt=[],It=[],sy=Uint8Array,$a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var bn=0,oy=$a.length;bn<oy;++bn)Gt[bn]=$a[bn],It[$a.charCodeAt(bn)]=bn;It[45]=62;It[95]=63;function ay(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function cy(e,t,r){return(t+r)*3/4-r}function ro(e){for(var t,r=ay(e),n=r[0],i=r[1],s=new sy(cy(e,n,i)),o=0,a=i>0?n-4:n,c=0;c<a;c+=4)t=It[e.charCodeAt(c)]<<18|It[e.charCodeAt(c+1)]<<12|It[e.charCodeAt(c+2)]<<6|It[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=It[e.charCodeAt(c)]<<2|It[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=It[e.charCodeAt(c)]<<10|It[e.charCodeAt(c+1)]<<4|It[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function ly(e){return Gt[e>>18&63]+Gt[e>>12&63]+Gt[e>>6&63]+Gt[e&63]}function uy(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(ly(n));return i.join("")}function no(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(uy(e,o,o+s>a?a:o+s));return n===1?(t=e[r-1],i.push(Gt[t>>2]+Gt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Gt[t>>10]+Gt[t>>4&63]+Gt[t<<2&63]+"=")),i.join("")}function sM(e){if(e===void 0)return{};if(!Yp(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function oM(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function Yp(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),n=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&n}var Xp=!0,Wn=BigInt("-9223372036854775808"),Ul=BigInt("9223372036854775807"),kc=BigInt("0"),dy=BigInt("8"),hy=BigInt("256"),Ca="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Qp=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(Ca)}valueOf(){throw new Error(Ca)}toJSON(){throw new Error(Ca)}toString(){return"[unresolved commit timestamp]"}},py=new Qp;function ef(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function fy(e){e<kc&&(e-=Wn+Wn);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let n=0;for(const i of t.match(/.{2}/g).reverse())r.set([parseInt(i,16)],n++),e>>=dy;return no(r)}function vy(e){const t=ro(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=kc,n=kc;for(const i of t)r+=BigInt(i)*hy**n,n++;return r>Ul&&(r+=Wn+Wn),r}function gy(e){if(e<Wn||Ul<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),no(new Uint8Array(t))}function my(e){const t=ro(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var _y=DataView.prototype.setBigInt64?gy:fy,yy=DataView.prototype.getBigInt64?my:vy,Yu=1024;function Rc(e){if(e.length>Yu)throw new Error(`Field name ${e} exceeds maximum field name length ${Yu}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Xu(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(n=>Xu(n));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const n=t[0][0];if(n==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return ro(e.$bytes).buffer}if(n==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return yy(e.$integer)}if(n==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const i=ro(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const s=new DataView(i.buffer).getFloat64(0,Xp);if(!ef(s))throw new Error(`Float ${s} should be encoded as a number`);return s}if(n==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return py}if(n==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(n==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[n,i]of Object.entries(e))Rc(n),r[n]=Xu(i);return r}var by=16384;function Fn(e){const t=JSON.stringify(e,(r,n)=>n===void 0?"undefined":typeof n=="bigint"?`${n.toString()}n`:n);if(t.length>by){const r="[...truncated]";let n=16370;const i=t.codePointAt(n-1);return i!==void 0&&i>65535&&(n-=1),t.substring(0,n)+r}return t}function io(e,t,r,n){if(e===void 0){const o=r&&` (present at path ${r} in original object ${Fn(t)})`;throw new Error(`undefined is not a valid Convex value${o}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Wn||Ul<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:_y(e)}}if(typeof e=="number")if(ef(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,Xp),{$float:no(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:no(new Uint8Array(e))};if(e instanceof Qp)return{$commitTs:null};if(Array.isArray(e))return e.map((o,a)=>io(o,t,r+`[${a}]`,!1));if(e instanceof Set)throw new Error(Pa(r,"Set",[...e],t));if(e instanceof Map)throw new Error(Pa(r,"Map",[...e],t));if(!Yp(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(Pa(r,a,e,t))}const i={},s=Object.entries(e);s.sort(([o,a],[c,l])=>o===c?0:o<c?-1:1);for(const[o,a]of s)a!==void 0?(Rc(o),i[o]=io(a,t,r+`.${o}`,!1)):n&&(Rc(o),i[o]=wy(a,t,r+`.${o}`));return i}function Pa(e,t,r,n){return e?`${t}${Fn(r)} is not a supported Convex type (present at path ${e} in original object ${Fn(n)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Fn(r)} is not a supported Convex type.`}function wy(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Fn(e)} but original value is undefined`);return io(e,t,r,!1)}function aM(e){return io(e,e,"",!1)}var Sy=Object.defineProperty,Ey=(e,t,r)=>t in e?Sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Oa=(e,t,r)=>Ey(e,typeof t!="symbol"?t+"":t,r),Qu,ed,ky=Symbol.for("ConvexError"),Ry=class extends(ed=Error,Qu=ky,ed){constructor(e){super(typeof e=="string"?e:Fn(e)),Oa(this,"name","ConvexError"),Oa(this,"data"),Oa(this,Qu,!0),this.data=e}};function Fl(e){if(!(e instanceof Ry))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="forbidden"}var so;function cM(e){try{so=new URL(e).hostname}catch{so=void 0}}function Ac(e){try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return;const r=t.pathname.replace(/(\/(?:results|conformance\/shared|evals\/shared|organizations)\/)[^/]+/g,"$1[redacted]").replace(/(\/(?:user-testing|chatbox)\/[^/]+\/)[^/]+/g,"$1[redacted]");return`${t.origin}${r}`}catch{return}}function Oi(e){const t=/^\[CONVEX Q\(([\w/.-]+:[\w.-]+)\)\]/.exec(e);if(!t)return;const r=/\[Request ID: ([a-f\d]+)\]/i.exec(e)?.[1],n=`${t[0]}${r?` [Request ID: ${r}]`:""} ${/\bServer Error\b/.test(e)?"Server Error":"Query failed"}`;return{functionName:t[1],requestId:r,safeMessage:n}}function tf(e){const t=Oi(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},...so?{convex_backend:so}:{}}}function Ay(e){const t=Oi(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const n=e.stack.split(`
1
+ import{t as iy}from"./failed-request-tracker-kUaJ-sVM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.12.3"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7c83102d-16e4-4c30-9f94-4013afc8401b",e._sentryDebugIdIdentifier="sentry-dbid-7c83102d-16e4-4c30-9f94-4013afc8401b")}catch{}})();var Gt=[],It=[],sy=Uint8Array,$a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var bn=0,oy=$a.length;bn<oy;++bn)Gt[bn]=$a[bn],It[$a.charCodeAt(bn)]=bn;It[45]=62;It[95]=63;function ay(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function cy(e,t,r){return(t+r)*3/4-r}function ro(e){for(var t,r=ay(e),n=r[0],i=r[1],s=new sy(cy(e,n,i)),o=0,a=i>0?n-4:n,c=0;c<a;c+=4)t=It[e.charCodeAt(c)]<<18|It[e.charCodeAt(c+1)]<<12|It[e.charCodeAt(c+2)]<<6|It[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=It[e.charCodeAt(c)]<<2|It[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=It[e.charCodeAt(c)]<<10|It[e.charCodeAt(c+1)]<<4|It[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function ly(e){return Gt[e>>18&63]+Gt[e>>12&63]+Gt[e>>6&63]+Gt[e&63]}function uy(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(ly(n));return i.join("")}function no(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(uy(e,o,o+s>a?a:o+s));return n===1?(t=e[r-1],i.push(Gt[t>>2]+Gt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Gt[t>>10]+Gt[t>>4&63]+Gt[t<<2&63]+"=")),i.join("")}function sM(e){if(e===void 0)return{};if(!Yp(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function oM(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function Yp(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),n=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&n}var Xp=!0,Wn=BigInt("-9223372036854775808"),Ul=BigInt("9223372036854775807"),kc=BigInt("0"),dy=BigInt("8"),hy=BigInt("256"),Ca="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",Qp=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(Ca)}valueOf(){throw new Error(Ca)}toJSON(){throw new Error(Ca)}toString(){return"[unresolved commit timestamp]"}},py=new Qp;function ef(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function fy(e){e<kc&&(e-=Wn+Wn);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let n=0;for(const i of t.match(/.{2}/g).reverse())r.set([parseInt(i,16)],n++),e>>=dy;return no(r)}function vy(e){const t=ro(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=kc,n=kc;for(const i of t)r+=BigInt(i)*hy**n,n++;return r>Ul&&(r+=Wn+Wn),r}function gy(e){if(e<Wn||Ul<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),no(new Uint8Array(t))}function my(e){const t=ro(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var _y=DataView.prototype.setBigInt64?gy:fy,yy=DataView.prototype.getBigInt64?my:vy,Yu=1024;function Rc(e){if(e.length>Yu)throw new Error(`Field name ${e} exceeds maximum field name length ${Yu}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Xu(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(n=>Xu(n));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const n=t[0][0];if(n==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return ro(e.$bytes).buffer}if(n==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return yy(e.$integer)}if(n==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const i=ro(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const s=new DataView(i.buffer).getFloat64(0,Xp);if(!ef(s))throw new Error(`Float ${s} should be encoded as a number`);return s}if(n==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return py}if(n==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(n==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[n,i]of Object.entries(e))Rc(n),r[n]=Xu(i);return r}var by=16384;function Fn(e){const t=JSON.stringify(e,(r,n)=>n===void 0?"undefined":typeof n=="bigint"?`${n.toString()}n`:n);if(t.length>by){const r="[...truncated]";let n=16370;const i=t.codePointAt(n-1);return i!==void 0&&i>65535&&(n-=1),t.substring(0,n)+r}return t}function io(e,t,r,n){if(e===void 0){const o=r&&` (present at path ${r} in original object ${Fn(t)})`;throw new Error(`undefined is not a valid Convex value${o}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Wn||Ul<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:_y(e)}}if(typeof e=="number")if(ef(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,Xp),{$float:no(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:no(new Uint8Array(e))};if(e instanceof Qp)return{$commitTs:null};if(Array.isArray(e))return e.map((o,a)=>io(o,t,r+`[${a}]`,!1));if(e instanceof Set)throw new Error(Pa(r,"Set",[...e],t));if(e instanceof Map)throw new Error(Pa(r,"Map",[...e],t));if(!Yp(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(Pa(r,a,e,t))}const i={},s=Object.entries(e);s.sort(([o,a],[c,l])=>o===c?0:o<c?-1:1);for(const[o,a]of s)a!==void 0?(Rc(o),i[o]=io(a,t,r+`.${o}`,!1)):n&&(Rc(o),i[o]=wy(a,t,r+`.${o}`));return i}function Pa(e,t,r,n){return e?`${t}${Fn(r)} is not a supported Convex type (present at path ${e} in original object ${Fn(n)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Fn(r)} is not a supported Convex type.`}function wy(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Fn(e)} but original value is undefined`);return io(e,t,r,!1)}function aM(e){return io(e,e,"",!1)}var Sy=Object.defineProperty,Ey=(e,t,r)=>t in e?Sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Oa=(e,t,r)=>Ey(e,typeof t!="symbol"?t+"":t,r),Qu,ed,ky=Symbol.for("ConvexError"),Ry=class extends(ed=Error,Qu=ky,ed){constructor(e){super(typeof e=="string"?e:Fn(e)),Oa(this,"name","ConvexError"),Oa(this,"data"),Oa(this,Qu,!0),this.data=e}};function Fl(e){if(!(e instanceof Ry))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="forbidden"}var so;function cM(e){try{so=new URL(e).hostname}catch{so=void 0}}function Ac(e){try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return;const r=t.pathname.replace(/(\/(?:results|conformance\/shared|evals\/shared|organizations)\/)[^/]+/g,"$1[redacted]").replace(/(\/(?:user-testing|chatbox)\/[^/]+\/)[^/]+/g,"$1[redacted]");return`${t.origin}${r}`}catch{return}}function Oi(e){const t=/^\[CONVEX Q\(([\w/.-]+:[\w.-]+)\)\]/.exec(e);if(!t)return;const r=/\[Request ID: ([a-f\d]+)\]/i.exec(e)?.[1],n=`${t[0]}${r?` [Request ID: ${r}]`:""} ${/\bServer Error\b/.test(e)?"Server Error":"Query failed"}`;return{functionName:t[1],requestId:r,safeMessage:n}}function tf(e){const t=Oi(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},...so?{convex_backend:so}:{}}}function Ay(e){const t=Oi(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const n=e.stack.split(`
2
2
  `).filter(i=>/^(\s+at |[^@]*@(?:https?|file|webpack|vite):)/.test(i));r.stack=`${r.name}: ${r.message}
3
3
  ${n.join(`
4
4
  `)}`}return r}function rf(e=500){const t=new Set;return(r,n)=>{if(!r||!n)return!1;const i=`${r}:${n}`;return t.has(i)?!0:(t.add(i),t.size>e&&t.delete(t.values().next().value),!1)}}function lM(e=500){const t=rf(e);return(r,n={})=>{try{const i=r.exception?.values,s=i?.find(u=>Oi(u.value??"")),o=Oi(s?.value??"");if(!o)return r;if(Fl(n.originalException))return null;const a=tf(s.value),c=typeof r.tags?.convex_backend=="string"?r.tags.convex_backend:a.convex_backend;if(t(c,o.requestId))return null;s.value=o.safeMessage,r.message&&(r.message=o.safeMessage),r.tags={...r.tags,...a,...c?{convex_backend:c}:{}};const l=Ac((typeof r.extra?.page_location=="string"?r.extra.page_location:void 0)??r.request?.url??(typeof window<"u"?window.location.href:""));r.request=l?{url:l}:void 0,r.breadcrumbs=void 0,r.extra={...typeof r.extra?.boundary=="string"?{boundary:r.extra.boundary}:{},...typeof r.extra?.componentStack=="string"?{componentStack:r.extra.componentStack}:{},...l?{page_location:l}:{}};for(const u of i??[])if(u!==s&&u.value&&(u.value=Oi(u.value)?.safeMessage??"Query failure cause"),u.stacktrace)for(const h of u.stacktrace.frames??[])delete h.vars;return r.transaction?.includes("/")&&(r.transaction=Ac(`https://route.invalid${r.transaction}`)?.replace("https://route.invalid","")),r}catch{return null}}}var Iy=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nf="8.55.1",$t=globalThis;function qo(e,t,r){const n=r||$t,i=n.__SENTRY__=n.__SENTRY__||{},s=i[nf]=i["8.55.1"]||{};return s[e]||(s[e]=t())}var jo=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ty="Sentry Logger ",td=["debug","info","warn","error","log","assert","trace"],rd={};function sf(e){if(!("console"in $t))return e();const t=$t.console,r={},n=Object.keys(rd);n.forEach(i=>{const s=rd[i];r[i]=t[i],t[i]=s});try{return e()}finally{n.forEach(i=>{t[i]=r[i]})}}function $y(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return jo?td.forEach(r=>{t[r]=(...n)=>{e&&sf(()=>{$t.console[r](`${Ty}[${r}]:`,...n)})}}):td.forEach(r=>{t[r]=()=>{}}),t}var cn=qo("logger",$y),of=50;var nd=/\(error: (.*)\)/,id=/captureMessage|captureException/;function Cy(...e){const t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{const s=[],o=r.split(`
@@ -97,6 +97,6 @@ ${i}${p}`}else return`${d}${o}${h.join(" ")}${o}${p}`}function zo({indent:e,opti
97
97
  `).join(" "),s=d;continue}try{t[c]=Rl(l)}catch(u){if(!(u instanceof kl))throw u;n.push(o)}s++}return{data:t,unparsed:r,tooDeep:n}}function lC(e){const t=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(e);return t?{frontmatter:t[1],body:e.slice(t[0].length)}:null}function uC(e){return!Array.isArray(e)||e.some(t=>typeof t!="string")?null:e}async function cD(e){const{pluginName:t,directory:r,directoryName:n,skillFilePath:i,skillText:s,skillContentHash:o,files:a,issues:c}=e,l=`skill:${n}`,u={path:i,componentKey:l},h=lC(s);if(h===null)return c.error("SKILL_FRONTMATTER_MISSING",`skill "${n}" is missing YAML frontmatter in SKILL.md`,u),null;const{data:d,unparsed:p,tooDeep:f}=cC(h.frontmatter);for(const M of p)c.warn("SKILL_FRONTMATTER_UNPARSED",`skill "${n}": frontmatter line not interpreted: ${M.trim()}`,u);for(const M of f)c.error("VALUE_TOO_DEEP",`skill "${n}": frontmatter value nests deeper than 32 levels: ${M.trim().slice(0,80)}`,u);const v=d.name;if(typeof v!="string"||v.length===0)return c.error("SKILL_MISSING_NAME",`skill "${n}" is missing the required "name" field`,u),null;if(!aC(v))return c.error("SKILL_INVALID_NAME",`skill name "${v}" must be kebab-case ([a-z0-9-], 1-${p_} chars, no "--")`,u),null;v!==n&&c.warn("SKILL_NAME_MISMATCH",`skill name "${v}" does not match its directory "${n}"`,u);const m=d.description;if(typeof m!="string"||m.length===0)return c.error("SKILL_MISSING_DESCRIPTION",`skill "${n}" is missing the required "description" field`,u),null;if(m.length>gp)return c.error("SKILL_DESCRIPTION_TOO_LONG",`skill "${n}" description exceeds ${gp} characters`,u),null;let _;const w=d.allow_implicit_invocation;w!==void 0&&(typeof w!="boolean"?c.warn("SKILL_INVALID_METADATA",`skill "${n}": "allow_implicit_invocation" must be a boolean`,u):_=w);const S=[],T=d.mcp_tools;if(T!==void 0){const M=uC(T);if(M===null)c.warn("SKILL_INVALID_METADATA",`skill "${n}": "mcp_tools" must be a list of strings`,u);else for(const L of M)S.includes(L)||S.push(L)}const I=a.filter(M=>M.path!==i).map(M=>({path:M.path,relativePath:M.path.slice(r.length+1),size:M.size,contentHash:M.contentHash})),C=await X$(a.map(M=>({path:M.path.slice(r.length+1),contentHash:M.contentHash})));return{componentKey:l,directory:r,directoryName:n,skillFilePath:i,name:v,description:m,modelRef:`${t}/${v}`,instructions:h.body.trim(),frontmatter:d,frontmatterRaw:h.frontmatter,..._!==void 0?{allowImplicitInvocation:_}:{},mcpToolDependencies:S,supportingFiles:I,contentHash:o,aggregateHash:C}}var lD=new TextDecoder("utf-8",{fatal:!1}),dC=new Set(["access_token","refresh_token","id_token","client_secret","code","code_verifier","authorization_code","authorization","state","cookie","set_cookie","api_key"]),hC=[/^authorization$/i,/^proxy-authorization$/i,/^cookie$/i,/^set-cookie$/i,/^x-api-key$/i,/^api-key$/i,/^apikey$/i,/^x-auth-token$/i,/^x-csrf-token$/i,/^x-session-token$/i,/^x-access-token$/i,/^x-refresh-token$/i,/^x-client-secret$/i,/^x-credential$/i];function $u(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").toLowerCase()}var pC=["_type","_types","_endpoint","_endpoints","_supported","_method","_methods","_uri","_uris","_url","_urls","_alg","_algs","_values","_in"];function fC(e){return pC.some(t=>e.endsWith(t))}function Cu(e){return dC.has(e)?!0:fC(e)?!1:/(^|_)(token|secret|password|credential|cookie|auth)(_|$)/.test(e)||/(^|_)api_?key(_|$)/.test(e)}function vC(e){return Cu($u(e))}function gC(e){return Cu($u(e))||hC.some(t=>t.test(e))}function mC(e){return Cu($u(e))}function Pu(e){return typeof e!="string"||e.length<=8?"[redacted]":`${e.slice(0,4)}...[redacted]...${e.slice(-2)}`}var f_="client_secret|access_token|refresh_token|id_token|code_verifier|code|assertion|password|api[-_]?key|token|secret|state",v_=new RegExp(`(^|[^\\w-])((?:[\\w-]*[_-])?(?:${f_}))=[^&\\s"'<>]+`,"gi"),g_=`(?:(?:[\\w-]*[_-])?(?:${f_}))`,_C=new RegExp(`("${g_}"\\s*:\\s*)"(?:\\\\.|[^"\\\\])*"`,"gi"),yC=new RegExp(`("${g_}"\\s*:\\s*)"(?:\\\\[\\s\\S]?|[^"\\\\])*$`,"gi");var bC=new RegExp(`\\b((?:[\\w-]*[_-])?(?:client[-_]?secret|access[-_]?token|refresh[-_]?token|id[-_]?token|code[-_]?verifier))(\\s*[:=]\\s*)("(?:\\\\.|[^"\\\\])*"|[^&\\s"'<>,;]+)`,"gi");function m_(e){const t=e.replace(/[.,;:!?)\]}]+$/,"");return!/^[a-z]{1,20}$/.test(t)}function wC(e,t,r,n){return m_(n)?`${t}${r}[redacted]`:e}function Cr(e,t={}){const r=t.maxScanned??4e3,n=t.maxLength??500,i=e.length>r,s=(i?e.slice(0,r):e).replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*@/gi,"$1[redacted]@").replace(/(^|[\s(<"'])[^\s/@:]+:[^\s/]+@(?=[\w.-]+)/g,"$1[redacted]@").replace(bC,(o,a,c,l)=>`${a}${c}${l.startsWith('"')?'"[redacted]"':"[redacted]"}`).replace(v_,"$1$2=[redacted]").replace(/\b((?:proxy-)?authorization\s*[:=]\s*)(bearer|basic)\s+\S+/gi,"$1$2 [redacted]").replace(/\b(bearer|basic)(\s+)(\S+)/gi,wC).replace(_C,'$1"[redacted]"');return(i?s.replace(yC,'$1"[redacted]').replace(/([a-z][a-z0-9+.-]*:\/\/)[^\s/?#]*$/gi,"$1[redacted]"):s).slice(0,n)}function SC(e){if(!e)return;if(typeof e=="string"){const r=e.trim();if(!r)return;if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{const s=JSON.parse(r);if(typeof s=="object"&&s!==null&&!Array.isArray(s)){const o=Object.entries(s).flatMap(([a,c])=>typeof c=="string"?[[a,c]]:typeof c=="number"||typeof c=="boolean"?[[a,String(c)]]:[]);return o.length>0?Object.fromEntries(o):void 0}}catch{}const n=new URLSearchParams(r),i=Object.fromEntries(n.entries());return Object.keys(i).length>0?i:void 0}if(typeof e!="object"||e===null||Array.isArray(e))return;const t=Object.entries(e).flatMap(([r,n])=>typeof n=="string"?[[r,n]]:typeof n=="number"||typeof n=="boolean"?[[r,String(n)]]:[]);return t.length>0?Object.fromEntries(t):void 0}function EC(e){return Object.keys(e).every(t=>t.length<=64&&/^[A-Za-z0-9_.\-[\]]+$/.test(t))}var kC=3;function RC(e,t){return/^https?:\/\//i.test(e)?t>=kC?"[redacted]":Ou(e,t+1):e.replace(v_,"$1$2=[redacted]")}function Ou(e,t=0){try{const r=new URL(e);r.username="",r.password="";let n=!1;const i=new URLSearchParams;for(const[s,o]of r.searchParams.entries()){const a=mC(s)?"[redacted]":RC(o,t);n||=a!==o,i.append(s,a)}return n&&(r.search=i.toString()),r.hash&&(r.hash="#[redacted]"),r.toString()}catch{return Cr(e)}}function __(e){const t=e.trim();if(!t)return e;if(/^https?:\/\//i.test(t))return Ou(t);if(t.includes("=")||t.includes("&")||t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")){const r=SC(t);if(r&&EC(r))return Jt(r)}return Cr(t)}function Jt(e){return Array.isArray(e)?e.map(t=>Jt(t)):typeof e=="string"?__(e):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).map(([t,r])=>vC(t)?[t,Pu(r)]:[t,Jt(r)]))}function AC(e){const t=__(e);return typeof t=="string"?t:Pu(e)}function mp(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>gC(t)?[t,Pu(r)]:[t,AC(r)]))}function uD(e){const t=typeof e.callbackState=="string"&&e.callbackState.length>0;return e.issuedState?{statePresent:t,stateMatched:t&&e.callbackState===e.issuedState}:{statePresent:t}}function IC(e){return Al(e,[])}function Al(e,t){return Array.isArray(e)?e.map(r=>Al(r,t)):!e||typeof e!="object"?typeof e=="string"?TC(e):e:Object.fromEntries(Object.entries(e).map(([r,n])=>[r,CC(r,n,t)?"[REDACTED]":Al(n,[...t,r])]))}function TC(e){return e.replace(/\b(authorization|proxy-authorization|cookie|set-cookie)\s*:\s*[^\r\n]*/giu,(t,r)=>`${r}: [REDACTED]`).replace(/\bBearer(\s+)(\S+)/giu,$C).replace(/\b(access_token|refresh_token|client_secret|id_token|code|code_verifier|accessToken|refreshToken|clientSecret|idToken|codeVerifier)=([^&\s]+)/giu,"$1=[REDACTED]").replace(/(["']?(?:access_token|refresh_token|client_secret|id_token|code|code_verifier|accessToken|refreshToken|clientSecret|idToken|codeVerifier)["']?\s*:\s*["'])[^"']*(["'])/giu,"$1[REDACTED]$2")}function $C(e,t,r){return/^[A-Za-z_][A-Za-z0-9_-]*=/u.test(r)?e:m_(r)?`Bearer${t}[REDACTED]`:e}function CC(e,t,r){const n=e.toLowerCase().replace(/[^a-z0-9]/gu,"");return n==="code"?OC(t,r):n==="authorization"||n==="proxyauthorization"||n==="cookie"||n==="setcookie"?!0:(n==="codeverifier"||n==="accesstoken"||n.endsWith("accesstoken")||n==="refreshtoken"||n.endsWith("refreshtoken")||n==="clientsecret"||n.endsWith("clientsecret")||n==="idtoken"||n.endsWith("idtoken"))&&PC(t)||n==="apikey"||n==="xapikey"}function PC(e){return typeof e=="string"&&e.length>0}function OC(e,t){return t[t.length-1]==="error"||t[t.length-1]==="snapshotError"||typeof e!="string"||/^[A-Z0-9_:-]+$/u.test(e)?!1:e.length>0}var xC="ERA_NEGOTIATION_FAILED";function MC(e){return!!e&&typeof e=="object"&&e.code===xC}function LC(e){const t=new Set;let r=e;for(;MC(r)&&!t.has(r);){t.add(r);const n=r.data,i=(n&&typeof n=="object"?n.cause:void 0)??r.cause;if(i===void 0||i===r)break;r=i}return r}var At={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,HeaderMismatch:-32020,MissingRequiredClientCapability:-32021,UnsupportedProtocolVersion:-32022,ResourceNotFound:-32602,ConnectionClosed:-32e3,RequestTimeout:-32001,UrlElicitationRequired:-32042},DC={HeaderMismatch:-32001,MissingRequiredClientCapability:-32003,UnsupportedProtocolVersion:-32004},NC="/troubleshooting/error-codes",_p={"jsonrpc/internal_error":"user_server","jsonrpc/invalid_response_format":"user_server","jsonrpc/parse_error":"ambiguous","jsonrpc/method_not_found":"ambiguous","jsonrpc/invalid_params":"ambiguous","jsonrpc/unsupported_protocol_version":"ambiguous","provider/invalid_tool_name":"ambiguous","oauth/well_known_unreachable":"ambiguous","transport/socket_hang_up":"ambiguous","transport/econnrefused":"user_config","transport/enotfound":"user_config","auth/http_401":"user_config","auth/http_403":"user_config","auth/missing_bearer":"user_config","auth/insufficient_scope":"user_config","auth/oauth_refresh_failed":"user_config","auth/consent_required":"user_config","oauth/invalid_client":"user_config","oauth/invalid_grant":"user_config","oauth/redirect_mismatch":"user_config","provider/auth_error":"user_config","provider/quota":"user_config","provider/mcpjam_limit":"user_config","provider/mcpjam_platform_budget":"user_config","account/suspended":"user_config","provider/mcpjam_limit_daily":"user_config","provider/mcpjam_limit_monthly":"user_config","provider/mcpjam_limit_insufficient":"user_config","provider/fallback_prohibited":"ambiguous","server/rate_limited":"user_server","jsonrpc/missing_required_client_capability":"user_config","jsonrpc/url_elicitation_required":"user_config","sdk/stateless_requires_http":"user_config","sdk/protocol_version_pin_unsupported":"user_config","sdk/not_yet_supported_in_stateless":"mcpjam","sdk/paginated_tool_header_discovery_unsupported":"mcpjam","provider/not_allowlisted":"mcpjam","oauth/no_bearer_challenge":"ambiguous","oauth/non_compliant_challenge":"user_server","auth/authorization_server_unreachable":"ambiguous","auth/proxy_rejected":"ambiguous","jsonrpc/connection_closed":"ambiguous","jsonrpc/request_timeout":"ambiguous","transport/etimedout":"ambiguous","transport/econnreset":"ambiguous","transport/eai_again":"ambiguous","transport/fetch_failed":"ambiguous","transport/undici":"ambiguous","jsonrpc/invalid_request":"ambiguous","jsonrpc/header_mismatch":"ambiguous","internal/unknown":"ambiguous","provider/empty_response":"ambiguous"};function fe(e,t,r,n,i,s,o="error"){return{slug:e,title:t,oneLine:r,likelyCauses:n,nextSteps:i,docsAnchor:`${NC}#${s}`,severity:o,..._p[e]?{origin:_p[e]}:{}}}var Il={"jsonrpc/parse_error":fe("jsonrpc/parse_error","Parse error (-32700)","The MCP wire contained JSON the inspector could not parse as JSON-RPC.",["The server emitted invalid JSON on the response channel.","A proxy or middleware mangled the response body.","Server emitted log output on stdout instead of stderr (STDIO transport).","The inspector sent malformed JSON and the server returned a parse error."],["Check the server's stdout/stderr for unintended log output.","Use the inspector's Traffic Log to inspect the raw response."],"parse-error"),"jsonrpc/invalid_request":fe("jsonrpc/invalid_request","Invalid request (-32600)","The server rejected the payload as not a well-formed JSON-RPC request.",["Client sent a request shape the server's MCP runtime does not accept.","Outdated server SDK that disagrees with the protocol version advertised."],["Verify the negotiated MCP protocol version.","Update the server's MCP SDK."],"invalid-request"),"jsonrpc/method_not_found":fe("jsonrpc/method_not_found","Method not found (-32601)","The server does not implement the JSON-RPC method that was called.",["The server hasn't implemented the requested MCP method.","Client and server are on incompatible MCP protocol versions.","The capability you expected was not advertised in `initialize`."],["Check the server's advertised capabilities in the connection info.","Confirm the protocol version negotiated at `initialize`."],"method-not-found"),"jsonrpc/invalid_params":fe("jsonrpc/invalid_params","Invalid params (-32602)","The server rejected the request parameters.",["Required field is missing from the call.","Field type does not match the tool's input schema.","Server-side validator is stricter than the published schema."],["Re-check the tool's input schema in the Tools tab.","Compare your call payload against the schema in the inspector."],"invalid-params"),"jsonrpc/internal_error":fe("jsonrpc/internal_error","Internal error (-32603)","The server hit an unexpected error while handling the request.",["Unhandled exception inside the server's tool/resource/prompt handler.","Downstream dependency (database, API) failed during the call."],["Check the server's logs around the time of the error.","Retry the request once the server is healthy."],"internal-error"),"jsonrpc/invalid_response_format":fe("jsonrpc/invalid_response_format","Invalid response format (-32603)","The server replied, but the result was not a valid MCP tool, resource, or prompt payload.",["The handler returned a string or custom object instead of the MCP result shape (usually `{ content: [...] }`)."],["Inspect the result in the Traffic Log and compare it to the MCP result shape.",'Return `{ content: [{ type: "text", text: "..." }] }` from the handler, or the matching resource/prompt result.'],"invalid-response-format"),"jsonrpc/connection_closed":fe("jsonrpc/connection_closed","Connection closed (-32000)","The underlying transport closed before the response could be delivered.",["STDIO server process exited or crashed mid-request.","HTTP server dropped the streaming connection.","Network blip between the inspector and the server."],["Restart the server and reconnect.","Check the server logs for a crash or exit message."],"connection-closed"),"jsonrpc/request_timeout":fe("jsonrpc/request_timeout","Request timed out (-32001)","The server did not respond within the configured request timeout.",["Server is overloaded or stuck on the operation.","Long-running tool call exceeds the inspector's per-request timeout.","Network latency between client and server."],["Increase the per-server request timeout in the Servers tab.","Use MCP `tasks/*` for operations that legitimately run long."],"request-timeout"),"jsonrpc/header_mismatch":fe("jsonrpc/header_mismatch","Protocol header mismatch (-32020)","The server returned an `MCP-Protocol-Version` header that does not match what the client negotiated.",["Server is enforcing a different protocol version than the one negotiated at `initialize`.","A proxy stripped or rewrote the `MCP-Protocol-Version` header."],["Verify the server's protocol-version pinning in the connection settings.","If you set an explicit protocol version per server, ensure it matches what the server advertises."],"header-mismatch"),"jsonrpc/unsupported_protocol_version":fe("jsonrpc/unsupported_protocol_version","Unsupported protocol version (-32022)","The server does not support any protocol version this inspector offered.",["Server pinned to a newer MCP draft your inspector build does not understand.","Server pinned to a legacy version this build dropped support for."],["Update the inspector to a newer build.","Check the supported versions list in the server's `server/discover` result (modern) or `initialize` response (legacy)."],"unsupported-protocol-version"),"jsonrpc/missing_required_client_capability":fe("jsonrpc/missing_required_client_capability","Missing required client capability (-32021)","The server refused the request because the client did not advertise a capability the operation requires.",["A server-initiated input request (elicitation, sampling) needs a client capability MCPJam did not declare.","The connection advertised a capability set the server considers insufficient for this operation."],["Enable the required client capability in the connection's Client settings.","Check the server's documentation for which client capabilities it requires."],"missing-required-client-capability"),"jsonrpc/url_elicitation_required":fe("jsonrpc/url_elicitation_required","URL elicitation required (-32042)","The server needs the user to visit an external URL to complete the operation.",["Server requested a URL elicitation (OAuth, payment, confirmation).","Operation cannot proceed until the user opens the URL in a browser."],["Open the elicited URL and complete the flow.","Re-issue the request after the external step completes."],"url-elicitation-required","warning"),"transport/econnrefused":fe("transport/econnrefused","Connection refused","Nothing is listening on the host and port the server URL points at.",["Server isn't running.","Port number is wrong in the server URL.","Server is bound to a different interface (e.g. only `127.0.0.1` but you're connecting via the LAN IP)."],["Start the server.","Double-check the URL's host and port.","For Docker/containers, confirm the port is published to your host."],"econnrefused"),"transport/econnreset":fe("transport/econnreset","Connection reset","The remote side closed the TCP connection abruptly.",["Server process crashed mid-request.","Intermediate proxy or load balancer dropped the connection.","Server hit an OS-level resource limit."],["Inspect the server logs for a crash.","Retry the request."],"econnreset"),"transport/etimedout":fe("transport/etimedout","Connection timed out","The OS-level TCP connection attempt did not complete in time.",["Wrong host/port in the server URL.","Firewall is silently dropping packets.","Server is overloaded and never accepted the connection."],["Verify the URL is reachable from your machine (e.g. `curl`).","Check firewall / VPN rules."],"etimedout"),"transport/enotfound":fe("transport/enotfound","Host not found","DNS lookup failed for the server's hostname.",["Hostname is misspelled in the URL.","DNS resolver is misconfigured.","You're offline."],["Confirm the hostname in the URL is correct.","Try resolving the host with `nslookup` or `dig`."],"enotfound"),"transport/eai_again":fe("transport/eai_again","Temporary DNS failure","DNS resolution failed with a transient error.",["Local DNS resolver is overloaded or restarting.","Upstream DNS server is briefly unavailable."],["Wait a few seconds and retry.","Switch to a different DNS resolver if this persists."],"eai-again","warning"),"transport/undici":fe("transport/undici","HTTP transport error","The underlying HTTP client (undici / fetch) reported a low-level transport failure.",["Server closed the connection mid-response.","TLS handshake failed.","Socket-level error during streaming."],["Inspect the Traffic Log for the failed request.","Verify the server's TLS certificate is valid."],"undici-transport-error"),"transport/fetch_failed":fe("transport/fetch_failed","Fetch failed","The HTTP request never produced a response.",["Server is unreachable (offline, wrong URL, blocked by firewall).","TLS handshake failed (self-signed cert, expired cert).","Mixed-content block (HTTPS page calling HTTP endpoint in browser)."],["Open the URL in a browser to confirm it loads.","If self-signed, install the certificate or switch to a trusted one."],"fetch-failed"),"transport/socket_hang_up":fe("transport/socket_hang_up","Socket hang up","The server closed the connection without sending a response.",["Server crashed or restarted during the request.","Reverse proxy timed the request out."],["Retry the request.","Check server-side logs for the crash."],"socket-hang-up"),"auth/http_401":fe("auth/http_401","Unauthorized (401)","The server requires authentication that wasn't provided or is no longer valid.",["Missing or expired bearer token.","OAuth access token expired and refresh failed.","Server changed its required authentication scheme."],["Re-authenticate using the Reconnect button on the server card.","If using OAuth, run through the OAuth flow again from Servers."],"unauthorized-401"),"auth/http_403":fe("auth/http_403","Forbidden (403)","You authenticated successfully but lack permission for the operation.",["OAuth scopes granted don't cover the requested operation.","Server-side ACL blocks this account."],["Re-run OAuth and request the additional scopes if the server allows.","Ask the server admin to grant the necessary permissions."],"forbidden-403"),"auth/oauth_refresh_failed":fe("auth/oauth_refresh_failed","OAuth token refresh failed","An expired OAuth access token could not be refreshed.",["Refresh token was revoked.","Refresh token expired.","Server returned `invalid_grant` to the refresh attempt."],["Click Reconnect on the server card to run a fresh OAuth flow."],"oauth-refresh-failed"),"auth/consent_required":fe("auth/consent_required","Sign-in required","This server needs your permission before it can connect.",["Reconnect ran without opening the sign-in prompt, so no OAuth token exists for this server yet."],["Click Reconnect and approve the request in the window that opens."],"consent-required","warning"),"auth/missing_bearer":fe("auth/missing_bearer","Missing bearer token","The API call did not include the required `Authorization: Bearer ...` header.",["Inspector session expired.","Sign-in token failed to attach to the request."],["Refresh the page and sign in again."],"missing-bearer"),"auth/insufficient_scope":fe("auth/insufficient_scope","Insufficient scope (403)","The server reported insufficient_scope: the grant does not cover this operation.",["The authorization did not request the scopes the server now requires.","The server added a scope requirement after the grant was issued."],["Re-authorize and grant the scopes the server names in its challenge."],"insufficient-scope"),"auth/authorization_server_unreachable":fe("auth/authorization_server_unreachable","Authorization server unreachable","The stored token could not be refreshed because the authorization server was unreachable or did not return a usable response.",["The authorization server is down or slow.","The refresh request could not leave the network it was made from."],["Retry in a minute; if it persists, check the authorization server's status.","Reconnect the server to obtain a fresh token once the authorization server is reachable."],"authorization-server-unreachable","warning"),"auth/proxy_rejected":fe("auth/proxy_rejected","HTML access rejection (403)","The response was HTTP 403 with an HTML content type and no authentication challenge; a proxy or firewall may be involved.",["An IP allowlist or WAF blocks the address the request came from.","A corporate proxy or SSO portal intercepted the request."],["Allow MCPJam's egress addresses, or the address you connect from, on the server's firewall.","Open the server URL in a browser from the same network to see what answers."],"proxy-rejected"),"oauth/no_bearer_challenge":fe("oauth/no_bearer_challenge","401 without a Bearer challenge","The response was HTTP 401 without a Bearer challenge. This response did not explain how to authorize.",["The server or an intermediary omitted a Bearer challenge.","The server expects a static API key and does not implement OAuth."],["Check OAuth discovery, including the well-known metadata fallback supported by newer MCP versions.","If the server expects an API key, configure it as a header on the server instead of OAuth."],"no-bearer-challenge"),"oauth/non_compliant_challenge":fe("oauth/non_compliant_challenge","Bearer challenge on the wrong status","The response reported invalid_token with HTTP 403; MCP requires HTTP 401 for an invalid or expired token.",["The server maps every authorization failure to 403.","A gateway rewrites the server's 401 to 403."],["Re-authorize the server to replace the rejected token.","Report the status mismatch to the server author; invalid-token recovery expects HTTP 401."],"non-compliant-challenge","warning"),"oauth/invalid_grant":fe("oauth/invalid_grant","OAuth: invalid grant","The OAuth server rejected the authorization code or refresh token.",["Authorization code was already redeemed.","Refresh token was revoked.","Authorization code expired (typical lifetime ~60s)."],["Start the OAuth flow again from the server card."],"oauth-invalid-grant"),"oauth/invalid_client":fe("oauth/invalid_client","OAuth: invalid client","The OAuth server does not recognize the client credentials.",["Client was deleted on the authorization server.","Dynamic registration cache is stale.","`client_id` was rotated server-side."],["Re-register the client (Reconnect from the server card triggers DCR if supported)."],"oauth-invalid-client"),"oauth/redirect_mismatch":fe("oauth/redirect_mismatch","OAuth: redirect URI mismatch","The redirect URI in the request does not match the one registered with the OAuth server.",["Authorization server requires the inspector's callback URL to be registered explicitly.","Server's allow-list is wrong."],["Add the inspector's callback URL to the OAuth server's allowed redirects.","Verify the inspector's base URL hasn't changed."],"oauth-redirect-mismatch"),"oauth/well_known_unreachable":fe("oauth/well_known_unreachable","OAuth metadata unreachable","The OAuth `.well-known` discovery endpoint could not be fetched.",["Authorization server is down.","Wrong issuer URL.","CORS blocks the discovery request from the browser."],["Confirm the issuer URL in the server config.","Open the `.well-known/openid-configuration` (or `oauth-authorization-server`) URL in a browser."],"oauth-well-known-unreachable"),"sdk/not_yet_supported_in_stateless":fe("sdk/not_yet_supported_in_stateless","Operation not supported on stateless transport","The inspector's stateless HTTP transport does not yet implement this MCP operation.",["Operation requires a server-initiated channel (subscriptions, MRTR) the stateless preview transport hasn't wired up yet."],["Switch the server to the legacy stateful transport in its protocol-mode toggle."],"not-yet-supported-in-stateless","warning"),"sdk/stateless_requires_http":fe("sdk/stateless_requires_http","Stateless transport requires HTTP","Stateless mode can only be used with an HTTP-transport server, not STDIO.",["You enabled the stateless protocol toggle on a stdio server."],["Disable the stateless toggle for stdio servers."],"stateless-requires-http"),"sdk/protocol_version_pin_unsupported":fe("sdk/protocol_version_pin_unsupported","Server doesn't support the pinned protocol version","This connection is pinned to one MCP protocol version, and the server does not offer it.",["The client profile you're emulating pins a protocol version this server hasn't adopted — a host set to the latest revision against a server that still speaks a 2025 one.","A per-server protocol override left pinned to a version the server dropped or never shipped."],["Set the protocol version to Automatic to negotiate whatever the server does support.","Or pick the version the server advertises — `server/discover` (modern) or the `initialize` response (legacy) lists them."],"protocol-version-pin-unsupported"),"sdk/paginated_tool_header_discovery_unsupported":fe("sdk/paginated_tool_header_discovery_unsupported","Paginated tool discovery not supported with header overrides","Paginated tools discovery cannot run alongside per-request header overrides on this transport.",["Conflicting combination of progressive tool discovery + per-server header overrides."],["Disable progressive tool discovery for this server, or move headers into the server config."],"paginated-tool-and-header-discovery-unsupported","warning"),"provider/invalid_tool_name":fe("provider/invalid_tool_name","Provider rejected the tool name","An LLM provider rejected a tool name (Anthropic's strict tool-name validator is the most common source).",["Tool name contains characters or length the provider does not allow.","Two attached servers expose tools whose namespaced names collide after sanitization."],["Rename the offending tool on the server.","Detach one of the colliding servers from the chat surface."],"provider-invalid-tool-name"),"provider/auth_error":fe("provider/auth_error","Provider authentication error","Your LLM provider rejected the API key for this request.",["Key is missing.","Key is invalid or revoked.","Key is for a different environment (project, region)."],["Add or update your API key under Settings → LLM Providers.","Verify the key in the provider's dashboard."],"provider-auth-error"),"provider/not_allowlisted":fe("provider/not_allowlisted","Model provider not enabled on MCPJam","This model's provider is not enabled on MCPJam's hosted AI gateway, so MCPJam can't run it. Retrying or changing your API key won't help.",["MCPJam's hosted gateway does not have this model's provider on its provider allowlist."],["Choose a model from a different provider.","Add your own key for this provider under Settings → LLM Providers (BYOK) to run the model on your key instead of MCPJam's gateway."],"provider-not-allowlisted","warning"),"provider/mcpjam_limit_daily":fe("provider/mcpjam_limit_daily","Out of MCPJam credits","Your organization's daily MCPJam credits are used up. They reset tomorrow.",["Chat, evals and swarm generation all draw on one daily bucket, shared across the organization."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the daily allowance to reset.","Your own API key covers supported model inference. MCPJam features can still require credits; Swarm generation and persona turns always do."],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_monthly":fe("provider/mcpjam_limit_monthly","Out of MCPJam credits","Your organization's available MCPJam credits are used up for this billing period.",["Paid plans include a monthly credit allowance shared across the organization. It renews with the billing period."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the billing period to renew.","Your own API key covers supported model inference. MCPJam features can still require credits; Swarm generation and persona turns always do."],"out-of-mcpjam-credits","warning"),"provider/mcpjam_limit_insufficient":fe("provider/mcpjam_limit_insufficient","Not enough MCPJam credits","Your organization has MCPJam credits left, but not enough for this request.",["MCPJam reserves a request's worst-case cost before it runs, so an expensive model or a long conversation can need more than the remaining balance."],["Try a cheaper model or a shorter conversation.","On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Your own API key covers supported model inference. MCPJam features can still require credits; Swarm generation and persona turns always do."],"out-of-mcpjam-credits","warning"),"provider/fallback_prohibited":fe("provider/fallback_prohibited","Provider failed, fallback not permitted","The model's provider failed and this model selection does not allow a fallback provider, so the request stopped rather than running somewhere other than where it was asked to.",[`The provider serving this model returned an error or was unreachable, and the selection's fallback policy is "none" — the default for evals, swarms and judges, so a result never silently comes from a different provider.`],["Retry — the provider's failure may be temporary.","Pick a different model, or a model on a connection you control."],"provider-failed-fallback-not-permitted","warning"),"provider/mcpjam_platform_budget":fe("provider/mcpjam_platform_budget","MCPJam shared free allowance unavailable","The shared free allowance is exhausted or temporarily paused.",["This limit applies across free usage, not just your account."],["Wait until the supplied reset time, if present.","Use purchased credits or your own provider key for chat."],"mcpjam-platform-budget","warning"),"account/suspended":fe("account/suspended","Account suspended","This account has been suspended by MCPJam.",["Support has suspended this account."],["Contact founders@mcpjam.com for support."],"account-suspended","warning"),"provider/mcpjam_limit":fe("provider/mcpjam_limit","Out of MCPJam credits","Your organization is out of MCPJam credits, so this request could not continue.",["Chat, evals and swarm generation all draw on the same MCPJam allowance."],["On Free, upgrade for a larger monthly allowance and access to top-ups. On eligible paid plans, buy shared credits to continue testing.","Wait for the allowance to reset.","Your own API key covers supported model inference. MCPJam features can still require credits; Swarm generation and persona turns always do."],"out-of-mcpjam-credits","warning"),"provider/quota":fe("provider/quota","Provider quota / rate limit","Your LLM provider rejected the request because you hit a rate limit or quota.",["Daily/monthly quota exhausted.","Per-minute rate limit exceeded.","Free tier limits hit."],["Wait for the limit window to reset.","Upgrade your provider plan.","Switch to a different provider in Settings."],"provider-quota","warning"),"server/rate_limited":fe("server/rate_limited","MCP server rate limit","The MCP server rejected the request with HTTP 429 (too many requests).",["The server enforces its own per-client rate limit.","An upstream API the server calls is throttling it.","A burst of tool calls exceeded what the server allows."],["Wait for the server's limit window to reset, then retry.","Reduce concurrency or the number of tool calls in the run.","Check the server's own rate-limit documentation or logs."],"server-rate-limited","warning"),"provider/empty_response":fe("provider/empty_response","Model returned no response","The model returned no response, so the turn could not complete.",["The model request ended without usable content."],["Rerun the affected cases. If this recurs, report it with the run details."],"model-empty-response"),"internal/unknown":fe("internal/unknown","Unknown error","An error occurred that the inspector could not classify.",["Unhandled error path.","New error class the inspector hasn't been taught about yet."],["Open the details panel and copy the raw message.","File an issue with the raw message so we can add it to the catalog."],"unknown-error")};function y_(e,t=0){if(!e||typeof e!="object"||t>3)return;const r=e.code,n=typeof r=="string"?r:void 0;if(n!==void 0&&zC(n))return n;const i=e.cause;if(i!==void 0&&i!==e){const s=y_(i,t+1);if(s!==void 0)return s}return n}function zC(e){return UC.has(e)||e.startsWith("UND_ERR_")}var UC=new Set(["ECONNREFUSED","ECONNRESET","EAI_AGAIN","ENETDOWN","ENETUNREACH","ENOTFOUND","EPIPE","ETIMEDOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_SOCKET"]);function FC(e){return!!e&&typeof e=="object"&&typeof e.slug=="string"&&typeof e.title=="string"&&typeof e.oneLine=="string"&&typeof e.docsAnchor=="string"&&typeof e.severity=="string"&&typeof e.rawMessage=="string"&&Array.isArray(e.likelyCauses)&&Array.isArray(e.nextSteps)}function si(e){const t=IC(e);return typeof t=="string"?t:String(e)}function qC(e){if(!e||typeof e!="object")return;const t=e.name;return typeof t=="string"?t:void 0}function xu(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e==null)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function b_(e){if(!e||typeof e!="object")return;const t=e.code;if(typeof t=="number"&&Number.isFinite(t))return t;const r=e.error;if(r&&typeof r=="object"){const n=r.code;if(typeof n=="number"&&Number.isFinite(n))return n}}function jC(e){if(!e||typeof e!="object")return;const t=e.code;return typeof t=="string"?t:void 0}function HC(e){if(!e||typeof e!="object")return;const t=e.statusCode;if(typeof t=="number")return t;const r=e.status;if(typeof r=="number")return r}function w_(e){return Il[e]??Il["internal/unknown"]}var VC=200;function Tl(e){const t=e.replace(/\s+/g," ").trim();return t.length<=VC?t:`${t.slice(0,199).trimEnd()}…`}function S_(e,t,r){if(t==="provider/mcpjam_limit_insufficient"){const n=Lu(r);return n?{...e,oneLine:n}:e}return t!=="internal/unknown"||!r?e:{...e,oneLine:Tl(r)}}var BC=["Backend step returned no content (stream error or empty response)","Backend step returned no messages (stream error or empty response)"];function GC(e){if(/NotYetSupportedInStateless/i.test(e))return"sdk/not_yet_supported_in_stateless";if(/StatelessRequiresHttpTransport/i.test(e))return"sdk/stateless_requires_http";if(/PaginatedToolHeaderDiscoveryUnsupported/i.test(e))return"sdk/paginated_tool_header_discovery_unsupported";if(/which this client is pinned to/i.test(e))return"sdk/protocol_version_pin_unsupported"}var WC={[At.ParseError]:"jsonrpc/parse_error",[At.InvalidRequest]:"jsonrpc/invalid_request",[At.MethodNotFound]:"jsonrpc/method_not_found",[At.InvalidParams]:"jsonrpc/invalid_params",[At.InternalError]:"jsonrpc/internal_error",[At.ConnectionClosed]:"jsonrpc/connection_closed",[At.HeaderMismatch]:"jsonrpc/header_mismatch",[At.MissingRequiredClientCapability]:"jsonrpc/missing_required_client_capability",[At.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[DC.UnsupportedProtocolVersion]:"jsonrpc/unsupported_protocol_version",[At.UrlElicitationRequired]:"jsonrpc/url_elicitation_required"};function ZC(e){return/header[^a-z]*mismatch/i.test(e)||/MCP-Protocol-Version/i.test(e)?"jsonrpc/header_mismatch":"jsonrpc/request_timeout"}var JC=/^(?:MCP error -32603:\s*)?invalid response format$/i;function E_(e){return JC.test(e.trim())}function KC(e){return E_(e)?"jsonrpc/invalid_response_format":"jsonrpc/internal_error"}function k_(e){const t=e.toUpperCase();switch(t){case"ECONNREFUSED":return"transport/econnrefused";case"ECONNRESET":return"transport/econnreset";case"ETIMEDOUT":return"transport/etimedout";case"ENOTFOUND":return"transport/enotfound";case"EAI_AGAIN":return"transport/eai_again";default:return t.startsWith("UND_ERR_")?"transport/undici":void 0}}function YC(e){const t=e.toLowerCase();if(/\bsocket\s+hang\s+up\b/i.test(e))return"transport/socket_hang_up";for(const r of e.matchAll(/\b(E[A-Z]{2,}(?:_[A-Z]+)*|UND_ERR_[A-Z_]+)\b/g)){const n=k_(r[1]);if(n)return n}if(/\bfetch\s+failed\b/i.test(e))return"transport/fetch_failed";if(/\bgetaddrinfo\b/i.test(e))return"transport/enotfound";if(/\bconnection\s+(?:refused|reset|closed|timed?\s*out|aborted|error|failed)\b/i.test(e)||/\b(?:failed|unable)\s+to\s+connect\b/i.test(e))return t.includes("refused")?"transport/econnrefused":t.includes("reset")?"transport/econnreset":t.includes("timed out")||t.includes("timeout")?"transport/etimedout":t.includes("closed")?"jsonrpc/connection_closed":"transport/fetch_failed";if(/Invalid tool name/i.test(e))return"provider/invalid_tool_name";if(E_(e))return"jsonrpc/invalid_response_format"}function XC(e){const t=eP(e);if(!t)return;const r=QC(e)??(typeof t.error=="string"?t.error:typeof t.error_code=="string"?t.error_code:void 0);if(r)switch(r.toLowerCase()){case"invalid_grant":return"oauth/invalid_grant";case"invalid_client":return"oauth/invalid_client";case"invalid_redirect_uri":case"redirect_uri_mismatch":return"oauth/redirect_mismatch";default:return}}function QC(e){if(!e||typeof e!="object"||e.name!=="OAuthResponseError")return;const t=e.code;return typeof t=="string"&&t?t:void 0}function eP(e){if(!e||typeof e!="object")return;const t="body"in e?e.body:"data"in e?e.data:e;if(!(!t||typeof t!="object"))return t}function R_(e){if(!(e instanceof Error))return;const t=e.cause;if(!t||typeof t!="object")return;const r=typeof t.name=="string"?t.name:"Error",n=typeof t.message=="string"?si(t.message):"";if(n)return{name:r,message:n}}var yp={AUTH_ERROR:"auth/http_401",OAUTH_REQUIRED:"auth/http_401"};function tP(e){const t=qC(e);if(t==="MCPAuthError"||t==="UnauthorizedError")return"auth/http_401";const r=jC(e);if(r&&yp[r])return yp[r]}function bp(e){if(e===401)return"auth/http_401";if(e===403)return"auth/http_403";if(e===429)return"provider/quota"}function rP(e){if(/(?:^|[^\w.:])401\b/.test(e))return"auth/http_401";if(/(?:^|[^\w.:])403\b/.test(e))return"auth/http_403";if(/(?:^|[^\w.:])429\b|too many requests/i.test(e))return"provider/quota"}function nP(e){const t=xu(e),r=e&&typeof e=="object"?e:null,n=r?.data?.code??r?.code;if(n==="platform_free_budget_exhausted")return{slug:"provider/mcpjam_platform_budget",rawCode:n};if(n==="account_suspended")return{slug:"account/suspended",rawCode:n};if(BC.some(p=>t.startsWith(p)))return{slug:"provider/empty_response"};const i=GC(t);if(i)return{slug:i};const s=tP(e);if(s)return{slug:s};const o=b_(e);if(o!==void 0){if(o===-32001)return{slug:ZC(t),rawCode:o};if(o===At.InternalError)return{slug:KC(t),rawCode:o};const p=WC[o];if(p)return{slug:p,rawCode:o};const f=bp(o);if(f)return{slug:f,rawCode:o}}const a=y_(e);if(a){const p=k_(a);if(p)return{slug:p,rawCode:a}}if(/missing\s+(?:or\s+invalid\s+)?bearer/i.test(t)||/bearer\s+token\s+(?:is\s+)?required/i.test(t))return{slug:"auth/missing_bearer"};if(Lu(t))return{slug:"provider/mcpjam_limit_insufficient"};if(/\bout of MCPJam credits\b/i.test(t))return{slug:"provider/mcpjam_limit"};const c=pP(t);if(c)return{slug:c};const l=Mu(e);if(l!==void 0){const p=bp(l);if(p)return{slug:p,rawCode:l}}const u=XC(e);if(u)return{slug:u};const h=rP(t);if(h)return{slug:h};if(/refresh\s+token/i.test(t)&&/(failed|invalid|expired|revoked)/i.test(t))return{slug:"auth/oauth_refresh_failed"};if(/consent\s+is\s+required/i.test(t)||/^\s*reauthenticate\b[\s\S]*\bto\s+continue\b/i.test(t))return{slug:"auth/consent_required"};const d=YC(t);return d?{slug:d}:/well[-_]?known/i.test(t)&&/(unreachable|fail|404)/i.test(t)?{slug:"oauth/well_known_unreachable"}:{slug:"internal/unknown"}}var iP=new Set(["auth/http_401","auth/http_403","auth/missing_bearer","auth/oauth_refresh_failed","auth/authorization_server_unreachable","oauth/invalid_client","oauth/invalid_grant","provider/auth_error","provider/quota"]);function Mu(e){const t=new Set;let r=e;for(let n=0;n<5&&r&&typeof r=="object"&&!t.has(r);n++){t.add(r);const i=HC(r);if(i!==void 0)return i;const s=b_(r);if(s!==void 0&&s>=100&&s<=599)return s;if(r.name==="UnauthorizedError")return 401;const o=LC(r);r=o!==r?o:r.cause}}function sP(e,t){if(!t)return;if(t.refresh?.outcome==="authorization_server_unreachable")return"auth/authorization_server_unreachable";if(t.refresh?.outcome==="token_rejected")return"auth/oauth_refresh_failed";const r=t.challenge;if(!r)return;const n=Mu(e);if(n===401&&r.scheme!=="bearer")return"oauth/no_bearer_challenge";if(n===401)return"auth/http_401";if(n===403)return r.scheme==="bearer"&&r.error==="insufficient_scope"?"auth/insufficient_scope":r.scheme==="bearer"&&r.error==="invalid_token"?"oauth/non_compliant_challenge":r.scheme==="none"&&r.bodyKind==="html"?"auth/proxy_rejected":"auth/http_403"}function oP(e,t,r){if(t==="auth/insufficient_scope"&&r?.challenge?.scopes?.length)return{...e,oneLine:Tl(si(`${e.oneLine} Required scopes: ${r.challenge.scopes.join(" ")}.`))};const n=r?.challenge?.error;return!n||t!=="auth/http_401"&&t!=="auth/http_403"?e:{...e,oneLine:Tl(si(`${e.oneLine} The server reported \`${n}\`.`))}}var aP=new Set(["user_server","user_config","mcpjam","ambiguous"]);function cP(e){return typeof e=="string"&&aP.has(e)}function lP(e){const t=e?.origin;return cP(t)?t:"ambiguous"}function A_(e,t,r){return r?.credentialOwner==="mcpjam"&&iP.has(t)?{...e,origin:"mcpjam"}:e}function uP(e,t){return e==="provider/quota"&&t?.surface==="mcpServer"?"server/rate_limited":e}function dP(e,t){try{const r=si(xu(e)),n=sP(e,t),i=n?{slug:n}:nP(e),s=uP(i.slug,t),o=i.rawCode??(n?Mu(e):void 0),a=A_(oP(S_(w_(s),s,r),s,t),s,t),c=R_(e);return{...a,rawMessage:r,...o!==void 0?{rawCode:o}:{},...c?{cause:c}:{}}}catch{return I_(e,"Unknown")}}function dD(e,t,r){try{const n=A_(w_(e),e,r),i=t!==void 0?si(xu(t)):"",s=R_(t);return{...n,rawMessage:i,...s?{cause:s}:{}}}catch{return I_(t,"")}}function I_(e,t){const r=Il["internal/unknown"];let n=t;try{n=si(e instanceof Error?e.message:String(e??t))}catch{n=t}return{...S_(r,"internal/unknown",n),rawMessage:n}}var hP=/\bThis request needs about (\d+) MCPJam credits; your organization has (\d+) left[^.]{0,40}\./i;function Lu(e){const t=hP.exec(e);if(!t)return;const r=Number(t[1]),n=Number(t[2]);return Number.isSafeInteger(r)&&Number.isSafeInteger(n)&&n>0&&r>n?t[0]:void 0}function pP(e){if(Lu(e))return"provider/mcpjam_limit_insufficient";const t=/\b(daily|monthly)\s+mcpjam[\w\s-]{0,40}model limit/i.exec(e);if(t)return t[1].toLowerCase()==="monthly"?"provider/mcpjam_limit_monthly":"provider/mcpjam_limit_daily";if(/mcpjam[\w\s-]{0,40}model limit/i.test(e))return"provider/mcpjam_limit"}var $l="[A-Za-z0-9!#$%&'*+.^_`|~-]+";function fP(e){const t={},r=new RegExp(`(${$l})\\s*=\\s*(?:"((?:\\\\.|[^"\\\\])*)"|([^,\\s]+))`,"g");for(let n=r.exec(e);n;n=r.exec(e)){const i=n[2];t[n[1].toLowerCase()]=i!==void 0?i.replace(/\\([\s\S])/g,"$1"):n[3]??""}return t}function ur(e){return T_(e)[0]??{}}function Du(e){if(!e)return;const t=e.split(/\s+/).map(r=>r.trim()).filter(Boolean);return t.length>0?Array.from(new Set(t)):void 0}function vP(e,t){const r=[],n=new Set;for(const i of[...e??[],...t??[]]){const s=i?.trim();!s||n.has(s)||(n.add(s),r.push(s))}return r}function T_(e){if(!e)return[];const t=[];let r="",n=!1;for(let a=0;a<e.length;a++){const c=e[a];n&&c==="\\"&&a+1<e.length?(r+=c+e[a+1],a++):c==='"'?(n=!n,r+=c):c===","&&!n?(t.push(r),r=""):r+=c}t.push(r);const i=[],s=new RegExp(`^(${$l})\\s+(?!\\s*=)(.+)$`,"s"),o=new RegExp(`^(${$l})$`);for(const a of t){const c=a.trim();if(!c)continue;const l=s.exec(c),u=l?null:o.exec(c);l?i.push({scheme:l[1].toLowerCase(),params:[l[2]]}):u?i.push({scheme:u[1].toLowerCase(),params:[]}):i.length>0&&i[i.length-1].params.push(c)}return i.filter(a=>a.scheme==="bearer").map(a=>fP(a.params.join(", ")))}function gP(e){return T_(e).length>0}var zr=class extends Error{status;constructor(e,t){super(e),this.name="UnexpectedProbeStatusError",this.status=t}},$_="MCP server returned HTTP ";function hD(e){return e.startsWith($_)}function vs(e){if(e.status===401)return{kind:"challenged",specCompliant:!0};if(e.status===200)return{kind:"anonymous_allowed"};if(e.status===403&&gP(e.wwwAuthenticateHeader))return{kind:"challenged",specCompliant:!1};const t=e.serverMessage||e.statusText,r=`${$_}${e.status}${t?` ${t}`:""}`;return e.status===403?e.wwwAuthenticateHeader?.trim()?{kind:"unexpected",message:`${r}, and its WWW-Authenticate header offers no Bearer challenge. MCP OAuth has nothing to discover from without one, so the flow cannot continue against this server.`}:{kind:"unexpected",message:`${r} with no WWW-Authenticate challenge. MCP requires 401 with a WWW-Authenticate header to begin OAuth, so there is nothing to discover from. A bare 403 usually means a proxy, WAF, or IP allowlist rejected the request before the MCP server saw it.`}:{kind:"unexpected",message:`${r} where MCP requires 401 Unauthorized (or 200, if the server allows anonymous access).`}}function pD(e){return e.step!=="request_without_token"||e.status===void 0?!1:vs({status:e.status,statusText:e.statusText,wwwAuthenticateHeader:e.wwwAuthenticateHeader}).kind==="challenged"}function fD(e){const t=Number.isInteger(e.maxRetries)&&e.maxRetries>=0?e.maxRetries:1;switch(e.authMode){case"m2m":return"throw";case"debugger":return"manual";case"interactive":return e.attempt<t?"reauthorize":"throw"}}function mP(e){const t=e.customScopes?.trim();if(t)return t;const r=e.challengedScopes?.filter(Boolean)??[];if(r.length>0)return Array.from(new Set(r)).join(" ");const n=e.supportedScopes?.filter(Boolean)??[];if(n.length!==0)return Array.from(new Set(n)).join(" ")}var _P;_P=globalThis.crypto;var yP="Resource server does not implement OAuth 2.0 Protected Resource Metadata.",wp="No response while loading OAuth protected resource metadata.",bP="Failed to request resource metadata";function aa(e){const t=e instanceof Error?e.message:String(e);return`${bP}: ${t}`}function vD(e){return e==="Resource server does not implement OAuth 2.0 Protected Resource Metadata."||e===aa(new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata."))}function wP(e){try{const t=new URL(e);return t.protocol=t.protocol.toLowerCase(),t.hostname=t.hostname.toLowerCase(),t.hash="",t.pathname!=="/"&&t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),t.toString()}catch{return e}}function SP(e,t){if(e.origin!==t.origin||t.pathname.length<e.pathname.length)return!1;const r=t.pathname.endsWith("/")?t.pathname:`${t.pathname}/`,n=e.pathname.endsWith("/")?e.pathname:`${e.pathname}/`;return r.startsWith(n)}function EP(e,t,r){const n=c=>({value:e,source:t,status:"invalid",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:c,reason:c});let i;try{i=new URL(e)}catch{return n(`Resource indicator "${e}" is not a parseable URI.`)}if(i.hash)return n(`Resource indicator "${e}" must not include a fragment (RFC 8707 §2).`);if(i.protocol!=="https:"&&i.protocol!=="http:")return n(`Resource indicator "${e}" must be an https URL (RFC 9728 §2).`);let s;try{s=new URL(r)}catch{return n(`Server URL "${r}" is not a parseable URI.`)}if(i.origin!==s.origin){const c=`Resource indicator "${e}" is on a different origin than the server URL "${r}" — honoring it would let the server steer tokens to an audience it doesn't own.`;return{value:e,source:t,status:"incompatible",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:c,reason:c}}const o=SP(i,s),a=i.protocol!=="https:"?`Resource indicator "${e}" must use the https scheme to comply with RFC 9728.`:o?void 0:`Resource indicator "${e}" does not satisfy the protected-resource binding for server URL "${r}" required for RFC 9728 conformance.`;return{value:e,source:t,status:"valid",strictClientCompatible:o,rfc9728Compliant:a===void 0,...a?{rfc9728Reason:a}:{},...o?{}:{reason:`Resource indicator "${e}" is not a path prefix of the server URL "${r}"; clients that enforce the official MCP SDK's strict binding will refuse it.`}}}function kP(e){return e.resolved?e.resolved.value:e.serverUrl===void 0?e.prmResource:Cl({serverUrl:e.serverUrl,prmResource:e.prmResource}).value}function Cl(e){const t=[[e.prmResource,"prm"],[e.authorizationUrlResource,"authorization"],[e.configuredResource,"configured"]];for(const[n,i]of t){const s=n?.trim();if(s)return EP(s,i,e.serverUrl)}try{new URL(e.serverUrl)}catch{return{value:e.serverUrl,source:"server",status:"invalid",strictClientCompatible:!1,rfc9728Compliant:!1,rfc9728Reason:`Server URL "${e.serverUrl}" is not a parseable URI.`,reason:`Server URL "${e.serverUrl}" is not a parseable URI.`}}const r=new URL(e.serverUrl).protocol==="https:"?void 0:`Resource indicator "${e.serverUrl}" must use the https scheme to comply with RFC 9728.`;return{value:wP(e.serverUrl),source:"server",status:"valid",strictClientCompatible:!0,rfc9728Compliant:r===void 0,...r?{rfc9728Reason:r}:{}}}var C_="2025-11-25";async function P_(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(!(n instanceof TypeError))throw n;if(!t)return;try{return await r(e,{})}catch(i){if(!(i instanceof TypeError))throw i;return}}}function RP(e,t="",r={}){const n=t.endsWith("/")?t.slice(0,-1):t;return r.prependPathname?`${n}/.well-known/${e}`:`/.well-known/${e}${n}`}async function Sp(e,t,r=fetch){return P_(e,{"MCP-Protocol-Version":t,Accept:"application/json"},r)}function AP(e,t){return e?t==="/"?!1:e.status>=400&&e.status<500||e.status===502:!0}async function IP(e,t,r,n){const i=new URL(e),s=n?.protocolVersion??C_;let o;if(n?.metadataUrl)o=new URL(n.metadataUrl);else{const l=RP(t,i.pathname);o=new URL(l,n?.metadataServerUrl??i),o.search=i.search}let a=await Sp(o,s,r),c=!a;return!n?.metadataUrl&&AP(a,i.pathname)&&(a=await Sp(new URL(`/.well-known/${t}`,i),s,r),c||=!a),{response:a,sawNoResponse:c}}function TP(e){const t=typeof e=="string"?new URL(e):e;if(t.pathname==="/")return[{url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}];const r=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;return[{url:new URL(`/.well-known/oauth-authorization-server${r}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${r}`,t.origin),type:"oidc"},{url:new URL(`${r}/.well-known/openid-configuration`,t.origin),type:"oidc"}]}async function ca(e,t,r=fetch){const{response:n,sawNoResponse:i}=await IP(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n)throw new Error(wp);if(n.status===404)throw await n.text().catch(()=>{}),new Error(i?wp:yP);if(!n.ok)throw await n.text().catch(()=>{}),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return await n.json()}async function $P(e,{fetchFn:t=fetch,protocolVersion:r=C_}={}){const n={"MCP-Protocol-Version":r,Accept:"application/json"};for(const{url:i,type:s}of TP(e)){const o=await P_(i,n,t);if(o){if(!o.ok){if(await o.text().catch(()=>{}),o.status>=400&&o.status<500||o.status===502)continue;throw new Error(`HTTP ${o.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return await o.json()}}}async function gD(e,t){let r,n;try{r=await ca(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers?.length&&(n=r.authorization_servers[0])}catch(s){if(s instanceof TypeError)throw s}n||(n=String(new URL("/",e)));const i=await $P(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:String(n),authorizationServerMetadata:i,resourceMetadata:r}}function CP(e){const t=e?.token_endpoint_auth_methods_supported;if(!Array.isArray(t)||t.length===0)return["client_secret_basic"];const r=t.filter(n=>typeof n=="string");return r.length>0?r:["client_secret_basic"]}function la(e){const t=CP(e.authorizationServerMetadata);return e.hasClientSecret?t.includes("client_secret_basic")?{ok:!0,method:"client_secret_basic",supportedMethods:t}:t.includes("client_secret_post")?{ok:!0,method:"client_secret_post",supportedMethods:t}:t.includes("none")?{ok:!0,method:"none",supportedMethods:t}:{ok:!1,message:`Unsupported OAuth client authentication method: ${t.join(", ")||"none advertised"}.`,supportedMethods:t}:{ok:!0,method:"none",supportedMethods:t}}function Ep(e){return new URLSearchParams([["v",e]]).toString().slice(2)}function Ur(e){const{clientId:t,clientSecret:r,tokenEndpointAuthMethod:n}=e;if(r&&n==="client_secret_basic")return{headers:{Authorization:`Basic ${btoa(`${Ep(t??"")}:${Ep(r)}`)}`},bodyParams:{}};const i={};return t&&(i.client_id=t),r&&n!=="none"&&(i.client_secret=r),{headers:{},bodyParams:i}}function ua(e){const t=e.token_endpoint_auth_method;if(!(e.client_secret&&(!t||t==="none")))return t||"none"}var kp=300,O_="Authenticated request failed";function mD(e){return e.startsWith(`${O_}: `)}function er(e){if(typeof e!="string")return;const t=e.trim();return t||void 0}function Pl(e){return e.replace(/\s+/g," ").trim()}function x_(e){if(typeof e=="string")return er(e);if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,r=er(t.error_type),n=er(t.error_description),i=er(t.error_message)??n??er(t.message),s=er(t.error);if(r&&i)return er(`${r}: ${i}`);if(s&&n)return er(`${s}: ${n}`);if(s)return s;const o=t.error;if(o&&typeof o=="object"&&!Array.isArray(o)){const a=er(o.message);if(a)return a}return i}function M_(e,t){const r=Pl(Cr(t.statusText??"",{maxLength:kp})),n=x_(t.body),i=n?Pl(Cr(n,{maxLength:kp})):void 0;return`${e}: ${t.status}${r?` ${r}`:""}${i?`: ${i}`:""}`}function da(e){return M_(O_,e)}function ha(e){return M_("Token request failed",e)}function Rp(e){try{const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t+"=".repeat((4-t.length%4)%4);let n;if(typeof globalThis.atob=="function")n=globalThis.atob(r);else if(typeof Buffer<"u")n=Buffer.from(r,"base64").toString("utf-8");else return null;return JSON.parse(n)}catch{return null}}function PP(e){const t=e.split(".");return t.length!==3?null:{header:Rp(t[0]),payload:Rp(t[1]),signature:t[2]}}function Fr(e){return PP(e)?.payload??null}function De(e){try{return new Date(e*1e3).toLocaleString()}catch{return String(e)}}var _D={isInitiatingAuth:!1,currentStep:"idle",httpHistory:[],infoLogs:[],tokenEndpointAuthMethod:void 0};function pa(){return{isInitiatingAuth:!1,currentStep:"idle",serverUrl:void 0,wwwAuthenticateHeader:void 0,challengedScopes:void 0,resourceMetadataUrl:void 0,resourceMetadata:void 0,resourceIndicator:void 0,resourceIndicatorSuppressed:void 0,authorizationServerUrl:void 0,authorizationServerMetadata:void 0,clientId:void 0,clientSecret:void 0,tokenEndpointAuthMethod:void 0,codeVerifier:void 0,codeChallenge:void 0,codeChallengeMethod:void 0,authorizationUrl:void 0,authorizationCode:void 0,state:void 0,recordedIssuer:void 0,authorizationResponseIss:void 0,requestedScopes:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,lastRequest:void 0,lastResponse:void 0,httpHistory:[],infoLogs:[],error:void 0}}function zn(e,t){return`${e.substring(0,t)}...`}function Ol(e){if(typeof e=="string"&&e.trim()!=="")try{return new URL(e).pathname}catch{return`${e} (not an absolute URL)`}let t;try{t=typeof e=="string"||typeof e=="object"&&e!==null?JSON.stringify(e)??String(e):String(e)}catch{t="[unserializable value]"}return`${t} (not an absolute URL)`}function wc(e,t,r){return e.resourceIndicatorSuppressed?"omitted (emulation)":t.resourceValue(e)||r}function OP(e,t){return[{id:"request_without_token",label:"MCP request without token",description:"Client makes initial request without authorization",from:"client",to:"mcpServer",details:e.serverUrl?[{label:"POST",value:e.serverUrl},{label:"method",value:t.initialMcpMethod}]:void 0},{id:"received_401_unauthorized",label:"HTTP 401 Unauthorized with WWW-Authenticate header",description:"Server returns 401 with WWW-Authenticate header",from:"mcpServer",to:"client",details:e.resourceMetadataUrl!==void 0?[{label:"Note",value:"Extract resource_metadata URL"}]:void 0},{id:"request_resource_metadata",label:"Request Protected Resource Metadata",description:"Client requests metadata from well-known URI",from:"client",to:"mcpServer",details:e.resourceMetadataUrl!==void 0?[{label:"GET",value:Ol(e.resourceMetadataUrl)}]:void 0},{id:"received_resource_metadata",label:"Return metadata",description:"Server returns OAuth protected resource metadata",from:"mcpServer",to:"client",details:e.resourceMetadata?.authorization_servers?[{label:"Auth Server",value:e.resourceMetadata.authorization_servers[0]}]:void 0}]}function xP(e){return[{id:"cimd_prepare",label:"Client uses HTTPS URL as client_id",description:"Client prepares to use URL-based client identification",from:"client",to:"client",details:e.clientId?[{label:"client_id (URL)",value:e.clientId.includes("http")?e.clientId:"https://www.mcpjam.com/.well-known/oauth/client-metadata.json"},{label:"Method",value:"Client ID Metadata Document (CIMD)"}]:[{label:"Note",value:"HTTPS URL points to metadata document"}]},{id:"cimd_fetch_request",label:"Fetch metadata from client_id URL",description:"Authorization Server fetches client metadata from the URL",from:"authServer",to:"client",details:[{label:"Action",value:"GET client_id URL"},{label:"Note",value:"Server initiates metadata fetch during authorization"}]},{id:"cimd_metadata_response",label:"JSON metadata document",description:"Client hosting returns metadata with redirect_uris and client info",from:"client",to:"authServer",details:[{label:"Content-Type",value:"application/json"},{label:"Contains",value:"client_id, client_name, redirect_uris, etc."}]},{id:"received_client_credentials",label:"Validate metadata and redirect_uris",description:"Authorization Server validates fetched metadata",from:"authServer",to:"authServer",details:[{label:"Validates",value:"client_id matches URL, redirect_uris are valid"},{label:"Security",value:"SSRF protection, domain trust policies"}]}]}function MP(e,t,r){if(r==="cimd")return xP(e);const n=t.clientCredentialsExtras?.(e)??[];return r==="dcr"?[{id:"request_client_registration",label:`POST /register (${t.protocolVersion})`,description:"Client registers dynamically with Authorization Server",from:"client",to:"authServer",details:[{label:"Note",value:"Dynamic client registration (DCR)"},...t.dcrNotes??[]]},{id:"received_client_credentials",label:"Client Credentials",description:"Authorization Server returns client ID and credentials",from:"authServer",to:"client",details:e.clientId?[{label:"client_id",value:zn(e.clientId,20)},...n]:void 0}]:[{id:"received_client_credentials",label:`Use Pre-registered Client (${t.protocolVersion})`,description:"Client uses pre-configured credentials (skipped DCR)",from:"client",to:"client",details:e.clientId?[{label:"client_id",value:zn(e.clientId,20)},{label:"Note",value:"Pre-registered (no DCR needed)"},...n]:[{label:"Note",value:"Pre-registered client credentials"}]}]}function fa(e,t,r){return[...r.includesProtectedResourceMetadata?OP(e,r):[],{id:"request_authorization_server_metadata",label:r.authorizationServerMetadata.label,description:r.authorizationServerMetadata.description,from:"client",to:"authServer",details:e.authorizationServerUrl?[{label:"URL",value:e.authorizationServerUrl},{label:"Protocol",value:r.protocolVersion}]:void 0},{id:"received_authorization_server_metadata",label:"Authorization server metadata response",description:"Authorization Server returns metadata",from:"authServer",to:"client",details:e.authorizationServerMetadata?[{label:"Token",value:Ol(e.authorizationServerMetadata.token_endpoint)},{label:"Auth",value:Ol(e.authorizationServerMetadata.authorization_endpoint)}]:void 0},...MP(e,r,t),{id:"generate_pkce_parameters",label:r.pkce.label,description:r.pkce.description,from:"client",to:"client",details:e.codeChallenge?[{label:"code_challenge",value:zn(e.codeChallenge,15)},{label:"method",value:e.codeChallengeMethod||"S256"},{label:"resource",value:wc(e,r,"—")},{label:"Protocol",value:r.protocolVersion}]:void 0},{id:"authorization_request",label:"Open browser with authorization URL",description:"Client opens browser with authorization URL + code_challenge + resource",from:"client",to:"browser",details:e.authorizationUrl?[{label:"code_challenge",value:e.codeChallenge?.substring(0,12)+"..."||"S256"},{label:"resource",value:wc(e,r,"")},...r.authorizationRequestExtras?.(e)??[]]:void 0},{id:"browser_to_auth_server",label:"Authorization request with resource parameter",description:"Browser navigates to authorization endpoint",from:"browser",to:"authServer",details:e.authorizationUrl?[{label:"Note",value:"User authorizes in browser"}]:void 0},{id:"auth_redirect_to_browser",label:"Redirect to callback with authorization code",description:"Authorization Server redirects browser back to callback URL",from:"authServer",to:"browser",details:e.authorizationCode?[{label:"code",value:zn(e.authorizationCode,20)}]:void 0},{id:"received_authorization_code",label:"Authorization code callback",description:"Browser redirects back to client with authorization code",from:"browser",to:"client",details:e.authorizationCode?[{label:"code",value:zn(e.authorizationCode,20)}]:void 0},{id:"token_request",label:"Token request + code_verifier + resource",description:"Client exchanges authorization code for access token",from:"client",to:"authServer",details:e.codeVerifier?[{label:"grant_type",value:"authorization_code"},{label:"resource",value:wc(e,r,"")}]:void 0},{id:"received_access_token",label:"Access token (+ refresh token)",description:"Authorization Server returns access token",from:"authServer",to:"client",details:e.accessToken?[{label:"token_type",value:e.tokenType||"Bearer"},{label:"expires_in",value:e.expiresIn?.toString()||"3600"}]:void 0},{id:"authenticated_mcp_request",label:"MCP request with access token",description:"Client makes authenticated request to MCP server",from:"client",to:"mcpServer",details:e.accessToken?[{label:"POST",value:"tools/list"},{label:"Authorization",value:`Bearer ${zn(e.accessToken,15)}`}]:void 0},{id:"complete",label:"MCP response",description:"MCP Server returns successful response",from:"mcpServer",to:"client",details:e.accessToken?[{label:"Status",value:"200 OK"},{label:"Content",value:"tools, resources, prompts"}]:void 0}]}function ne(e,t,r,n,i,s={}){const{level:o="info",error:a}=s;return[...e.infoLogs||[],{id:r,step:t,label:n,data:i,timestamp:Date.now(),level:o,error:a}]}function LP(e,t,r,n){return!r||r.source!=="prm"||r.strictClientCompatible&&r.rfc9728Compliant?t:ne({...e,infoLogs:t},"received_resource_metadata","resource-identifier-mismatch","Resource identifier mismatch",{"Advertised resource":r.value,"Server URL":n,Status:r.status,Reason:r.reason,"RFC 9728 compliant":r.rfc9728Compliant,...r.rfc9728Reason?{"RFC 9728 reason":r.rfc9728Reason}:{},Note:r.status==="valid"?"The flow will send this interoperability-safe resource, but it is not RFC 9728 compliant and strict conformance surfaces will reject it.":"The debugger will send the advertised resource as-is so you can observe real behavior, but MCP clients — including MCPJam's Quick OAuth and the official MCP SDK — validate it against the server URL and will refuse to connect."},{level:"warning"})}function va(e,t,r,n){return ne({...e,infoLogs:t},r,"non-compliant-challenge-status","Non-compliant challenge status",{Received:`${n.status}${n.statusText?` ${n.statusText}`:""}`,Expected:"401 Unauthorized",Note:"The server sent a WWW-Authenticate Bearer challenge, so the debugger continues OAuth discovery from it. MCP requires 401 here — clients that decide to authenticate from the status code alone, including the official MCP SDK, will not start OAuth against this server."},{level:"warning"})}function Tt(e){return e instanceof Error?{message:e.message,details:{name:e.name,stack:e.stack}}:typeof e=="string"?{message:e}:{message:"Unexpected error",details:e}}function gn(e,t){if(!e||e.length===0)return e||void 0;const r=[...e],n={...r[r.length-1]};return r[r.length-1]={...n,error:t,duration:n.duration!==void 0?n.duration:Date.now()-n.timestamp},r}function dt(e,t={}){const r={},n=new Map,i=s=>{if(s)for(const[o,a]of Object.entries(s)){const c=o.toLowerCase(),l=n.get(c);l&&l!==o&&delete r[l],n.set(c,o),r[o]=a}};return i(e),i(t),r}function ct(e,t={}){const r=dt(e,t);for(const n of Object.keys(r))n.toLowerCase()==="authorization"&&delete r[n];return r}function Nu(e,t,r,n={}){try{const i=new URL(e).origin;return new URL(t,e).origin===i?dt(r,n):ct(r,n)}catch{return ct(r,n)}}function Pr(e){if(!e)return{};if(e instanceof Headers){const t={};return e.forEach((r,n)=>{t[n]=r}),t}return Array.isArray(e)?Object.fromEntries(e.map(([t,r])=>[t,String(r)])):Object.fromEntries(Object.entries(e).map(([t,r])=>[t,String(r)]))}function DP(e){if(typeof globalThis.btoa=="function"){const t=Array.from(e,r=>String.fromCharCode(r)).join("");return globalThis.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}if(typeof Buffer<"u")return Buffer.from(e).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");throw new Error("No base64 encoder available")}function qr(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=new Uint8Array(e);return crypto.getRandomValues(r),Array.from(r,n=>t[n%66]).join("")}async function ga(e){const t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return DP(new Uint8Array(r))}var ma="Authorization server metadata missing required 'issuer' field",NP=new Set(["2025-03-26"]),zP=new Set(["2025-03-26","2025-06-18"]);function UP(e){return!NP.has(e)}function FP(e){return!zP.has(e)}function L_(e,t){if(FP(t)){if(!e||e.length===0)return`PKCE is REQUIRED for ${t} protocol, but authorization server does not advertise code_challenge_methods_supported. Server is not compliant with ${t} spec.`;if(!e.includes("S256"))return`Authorization server advertises PKCE without S256 (advertised: ${e.join(", ")}). MCPJam will not downgrade to a weaker code challenge method, so the ${t} flow stops here. Use the OAuth debugger to observe this server's behavior without connecting.`}}function zu(e){const t=e.authorizationServers?.find(r=>typeof r=="string"&&r.trim()!=="")?.trim();return t?{authorizationServerUrl:t,substituted:!1}:UP(e.protocolVersion)?{authorizationServerUrl:e.fallbackServerUrl,substituted:!0,error:`Protected resource metadata does not list an authorization server. RFC 9728 \`authorization_servers\` is required by the ${e.protocolVersion} MCP profile; without it there is no server authorized to issue tokens for this resource, and using the MCP server's own URL would invent one.`}:{authorizationServerUrl:e.fallbackServerUrl,substituted:!0}}var qP="io.modelcontextprotocol/oauth-client-credentials",jP="io.modelcontextprotocol/protocolVersion",HP="io.modelcontextprotocol/clientCapabilities",VP="io.modelcontextprotocol/clientInfo";function Uu(e){switch(e){case"2025-11-25":return"2025-11-25";case"2026-07-28":return"2026-07-28";case"2025-06-18":case"2025-03-26":return"2024-11-05";default:return e}}function D_(e){return e!=="client_credentials"?{}:{extensions:{[qP]:{}}}}function Ut(e){return{jsonrpc:"2.0",method:"initialize",params:{protocolVersion:e.protocolVersion,capabilities:D_(e.authMode),clientInfo:{name:e.clientName,version:e.clientVersion}},id:e.id}}function Us(e){return{jsonrpc:"2.0",method:"tools/list",params:{_meta:{[jP]:e.protocolVersion,[HP]:D_(e.authMode),[VP]:{name:e.clientName,version:e.clientVersion}}},id:e.id}}var BP="***REDACTED***",GP=new Set(["client_secret","registration_access_token","access_token","refresh_token"]),_a="Authorization server metadata does not include a registration_endpoint. Configure a pre-registered client or use a different registration strategy.",ya="Authorization server metadata does not include a registration_endpoint required for DCR conformance.";function WP(e){const t=r=>{let n;try{n=new URL(r)}catch{return!0}if(n.protocol!=="http:"&&n.protocol!=="https:")return!0;if(n.protocol!=="http:")return!1;const i=n.hostname;return i==="localhost"||i==="127.0.0.1"||i==="[::1]"};return e.some(t)?"native":"web"}function ba(e){const{dynamicRegistrationDefaults:t}=e,r={...t,redirect_uris:t.redirect_uris??[e.redirectUri],grant_types:t.grant_types??["authorization_code","refresh_token"],response_types:t.response_types??["code"],token_endpoint_auth_method:t.token_endpoint_auth_method??"none"};return e.scope&&(r.scope=e.scope),{method:"POST",url:e.registrationEndpoint,headers:ct(e.customHeaders,{"Content-Type":"application/json"}),body:r}}function xl(e){if(Array.isArray(e))return e.map(xl);if(e&&typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))t[r]=GP.has(r.toLowerCase())?BP:xl(n);return t}return e}function ZP(e){return{status:e.status,statusText:e.statusText,headers:{...e.headers},body:xl(e.body)}}function Ap(e,t){const r=[...e||[]];if(r.length>0){const n=r[r.length-1];r[r.length-1]={...n,response:t,duration:Date.now()-(n.timestamp||Date.now())}}return r}var Sc="Configure a pre-registered client or enable DCR on the authorization server.";async function wa(e){let t;try{t=await e.requestExecutor(e.request)}catch(o){const a=o instanceof Error?o.message:String(o),c={status:0,statusText:"Network Error",headers:{},body:{error:a}},l=`Client registration failed: ${a}`;return{status:"network_error",response:c,httpHistory:Ap(e.httpHistory,c),error:l,fallbackNote:"Client registration failed; using pre-registered client credentials.",errorWithFallbackHint:`${l}. ${Sc}`}}const r=ZP({status:t.status,statusText:t.statusText,headers:t.headers,body:t.body}),n=Ap(e.httpHistory,r);if(!t.ok){const o=`Dynamic Client Registration failed (${t.status}).`;return{status:"http_error",response:r,httpHistory:n,error:o,fallbackNote:`Dynamic Client Registration failed (${t.status}); using pre-registered client credentials.`,errorWithFallbackHint:`${o} ${Sc}`}}const i=t.body;if(!i||typeof i!="object"||Array.isArray(i)){const o="Client registration failed: the registration response body was not a JSON object";return{status:"invalid_response",response:r,httpHistory:n,error:o,fallbackNote:"Client registration failed; using pre-registered client credentials.",errorWithFallbackHint:`${o}. ${Sc}`}}const s={"Client ID":i.client_id,"Client Name":i.client_name,"Token Auth Method":i.token_endpoint_auth_method||"none","Redirect URIs":i.redirect_uris,"Grant Types":i.grant_types,"Response Types":i.response_types};return i.client_secret&&(s["Client Secret Issued"]=!0,s.Note="Server issued client_secret - this will be used in token requests"),{status:"registered",response:r,httpHistory:n,clientInfo:i,credentials:{clientId:typeof i.client_id=="string"?i.client_id:void 0,clientSecret:typeof i.client_secret=="string"?i.client_secret:void 0,tokenEndpointAuthMethod:typeof i.token_endpoint_auth_method=="string"?i.token_endpoint_auth_method:void 0,clientSecretExpiresAt:typeof i.client_secret_expires_at=="number"?i.client_secret_expires_at:void 0},missingClientId:typeof i.client_id!="string",nonCanonicalSuccessStatus:t.status!==201,infoLogData:s}}function Sa(e){return e?.sendResourceIndicator!==!1}function jr(e,t){const r=e?.scopeRequest;if(!r)return mP(t);switch(r.mode){case"omit":return;case"fixed":return r.scopes.join(" ");case"challenge":{const n=t.challengedScopes?.filter(Boolean)??[];return n.length>0?Array.from(new Set(n)).join(" "):void 0}case"all-supported":{const n=t.supportedScopes?.filter(Boolean)??[];return n.length>0?Array.from(new Set(n)).join(" "):void 0}}}function Ea(e,t){if(!t)return e;const r={...e};return t.dcrClientName!==void 0&&(r.client_name=t.dcrClientName),t.tokenEndpointAuthMethod!==void 0&&(r.token_endpoint_auth_method=t.tokenEndpointAuthMethod),t.dcrRedirectUris!==void 0&&(r.redirect_uris=[...t.dcrRedirectUris]),r}function Hr(e,t){return e?.tokenEndpointAuthMethod??t}function JP(e,t){return t?.userAgent?{...e??{},"User-Agent":t.userAgent}:e}function mn(e,t){return e?.mcpProtocolVersion??t}function KP(e,t){return fa(e,t,{protocolVersion:"2025-03-26",includesProtectedResourceMetadata:!1,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET /.well-known/oauth-authorization-server from MCP base URL",description:"Direct discovery from MCP server base URL with fallback to /authorize, /token, /register"},pkce:{label:"Generate PKCE parameters",description:"Client generates code verifier and challenge (recommended), includes resource parameter"},resourceValue:r=>r.serverUrl})}function YP(e){return new URL(e).origin}function Ip(e){const t=new URL(e),r=[];if(t.pathname==="/"||t.pathname==="")r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString());else{const n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;r.push(new URL(`/.well-known/oauth-authorization-server${n}`,t.origin).toString()),r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString())}return r}var XP=e=>{const{state:t,getState:r,updateState:n,serverUrl:i,serverName:s,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,customScopes:h,customHeaders:d,authMode:p,hasClientSecret:f=!1,strictConformance:v=!1,registrationStrategy:m="dcr",emulation:_}=e,w=o,S=mn(_,"2025-03-26"),T=mn(_,Uu("2025-03-26")),I=Sa(_),C=Ea(u??{},_);if(m==="dcr"&&!C.client_name)throw new Error("Dynamic registration metadata must include client_name");const M=()=>r?r():t,L=(k,ie={})=>a({url:k,method:ie.method||"GET",headers:Pr(ie.headers),body:ie.body}),q=k=>{const ie=la({authorizationServerMetadata:M().authorizationServerMetadata,hasClientSecret:!!(k||f)});if(!ie.ok)throw new Error(ie.message);return ie.method},X=async k=>{const{clientId:ie,clientSecret:H}=await l?.({serverName:s,serverUrl:i})??{};if(!ie)return;const oe=q(H),$={"Client ID":ie,"Client Secret":H||f?"Configured":"Not provided (public client)","Token Auth Method":oe,Note:k};return{clientId:ie,clientSecret:H||void 0,tokenEndpointAuthMethod:oe,infoLogs:ne(M(),"received_client_credentials","preregistered-fallback","Pre-registered Client",$)}},ee={state:t,updateState:n,proceedToNextStep:async()=>{const k=M();n({isInitiatingAuth:!0});const ie=H=>{c?.(()=>{ee.proceedToNextStep()},H)};try{switch(k.currentStep){case"idle":n({currentStep:"discovery_start",serverUrl:i,httpHistory:[],isInitiatingAuth:!1}),ie(50);return;case"request_without_token":if(!k.serverUrl)throw new Error("No server URL available");try{const z=await L(k.serverUrl,{method:"POST",headers:dt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":S}),body:JSON.stringify(Ut({protocolVersion:T,authMode:p,clientName:"MCP Inspector",clientVersion:"1.0.0",id:1}))}),se={status:z.status,statusText:z.statusText,headers:z.headers,body:z.body},ae=[...k.httpHistory||[]];if(ae.length>0){const Oe=ae[ae.length-1];Oe.response=se,Oe.duration=Date.now()-(Oe.timestamp||Date.now())}const he=vs({status:z.status,statusText:z.statusText,wwwAuthenticateHeader:z.headers["www-authenticate"],serverMessage:z.body?.error?.message});if(he.kind==="challenged"||he.kind==="anonymous_allowed"){let Oe=he.kind==="anonymous_allowed"?ne(k,"discovery_start","optional-auth","Optional Authentication",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"}):k.infoLogs;he.kind==="challenged"&&!he.specCompliant&&(Oe=va(k,Oe,"discovery_start",se)),n({currentStep:"discovery_start",lastResponse:se,httpHistory:ae,infoLogs:Oe,isInitiatingAuth:!1})}else throw n({lastResponse:se,httpHistory:ae}),new zr(he.message,z.status)}catch(z){throw z instanceof zr?z:new Error(`Failed to request MCP server: ${z instanceof Error?z.message:String(z)}`)}break;case"discovery_start":const H=k.serverUrl,oe={method:"GET",url:Ip(H)[0],headers:ct(d,{})};n({currentStep:"request_authorization_server_metadata",authorizationServerUrl:H,lastRequest:oe,lastResponse:void 0,httpHistory:[...k.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:oe}],isInitiatingAuth:!1}),ie(50);return;case"request_authorization_server_metadata":if(!k.authorizationServerUrl)throw new Error("No authorization server URL available");const $=Ip(k.authorizationServerUrl);let Q=null,y=null;for(const z of $)try{const se=ct(d,{"MCP-Protocol-Version":"2025-03-26"}),ae=[...k.httpHistory||[]];ae.length>0&&(ae[ae.length-1].request={method:"GET",url:z,headers:se}),n({lastRequest:{method:"GET",url:z,headers:se},httpHistory:ae});const he=await L(z,{method:"GET",headers:se});if(he.ok){Q=he.body,y=he;break}else if(he.status>=400&&he.status<500)continue}catch{continue}if(!Q){const z=YP(k.authorizationServerUrl);Q={issuer:z,authorization_endpoint:`${z}/authorize`,token_endpoint:`${z}/token`,registration_endpoint:`${z}/register`,response_types_supported:["code"],grant_types_supported:["authorization_code","refresh_token"],code_challenge_methods_supported:["S256"]};const se=ne(M(),"received_authorization_server_metadata","fallback-endpoints","Using Fallback Endpoints",{Note:"Metadata discovery failed, using default endpoints per 2025-03-26 spec","Authorization Endpoint":Q.authorization_endpoint,"Token Endpoint":Q.token_endpoint,"Registration Endpoint":Q.registration_endpoint});n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:Q,infoLogs:se,isInitiatingAuth:!1});break}if(!Q.issuer)throw new Error(ma);if(!Q.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!Q.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!Q.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const V={status:y.status,statusText:y.statusText,headers:y.headers,body:Q},K=[...k.httpHistory||[]];if(K.length>0){const z=K[K.length-1];z.response=V,z.duration=Date.now()-(z.timestamp||Date.now())}const le=Q.code_challenge_methods_supported||[];(!le||le.length===0||!le.includes("S256"))&&console.warn("Authorization server may not support PKCE S256 (REQUIRED for 2025-03-26 spec)"),n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:Q,lastResponse:V,httpHistory:K,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!k.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(m==="preregistered"){const{clientId:z,clientSecret:se}=await l?.({serverName:s,serverUrl:i})??{};if(!z){n({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const ae=q(se),he={"Client ID":z,"Client Secret":se||f?"Configured":"Not provided (public client)","Token Auth Method":ae,Note:"Using pre-registered client credentials (skipped DCR)"},Oe=ne(M(),"received_client_credentials","dcr","Pre-registered Client",he);n({currentStep:"received_client_credentials",clientId:z,clientSecret:se||void 0,tokenEndpointAuthMethod:ae,infoLogs:Oe,isInitiatingAuth:!1})}else if(k.authorizationServerMetadata.registration_endpoint){const z=k.authorizationServerMetadata.scopes_supported,se=jr(_,{customScopes:h,supportedScopes:z}),ae=ba({registrationEndpoint:k.authorizationServerMetadata.registration_endpoint,redirectUri:w,dynamicRegistrationDefaults:C,scope:se,customHeaders:d});n({currentStep:"request_client_registration",lastRequest:ae,lastResponse:void 0,httpHistory:[...k.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:ae}],isInitiatingAuth:!1}),ie(50);return}else{if(v){n({error:ya,isInitiatingAuth:!1});return}const z=await X("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!z){n({error:_a,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:z.clientId,clientSecret:z.clientSecret,tokenEndpointAuthMethod:z.tokenEndpointAuthMethod,infoLogs:z.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!k.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!k.lastRequest?.body)throw new Error("No client metadata in request");{const z=await wa({request:k.lastRequest,requestExecutor:a,httpHistory:k.httpHistory});if(z.status!=="registered"){if(n({lastResponse:z.response,httpHistory:z.httpHistory,error:z.error}),v){z.status==="invalid_response"&&n({isInitiatingAuth:!1});return}const ae=await X(z.fallbackNote);if(!ae){n({error:z.errorWithFallbackHint,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:ae.clientId,clientSecret:ae.clientSecret,tokenEndpointAuthMethod:ae.tokenEndpointAuthMethod,infoLogs:ae.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(z.missingClientId){n({lastResponse:z.response,httpHistory:z.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const se=ne(M(),"received_client_credentials","dcr","Dynamic Client Registration",z.infoLogData);n({currentStep:"received_client_credentials",clientId:z.credentials.clientId,clientSecret:z.credentials.clientSecret,tokenEndpointAuthMethod:ua(z.clientInfo),lastResponse:z.response,httpHistory:z.httpHistory,infoLogs:se,error:void 0,isInitiatingAuth:!1})}break;case"received_client_credentials":const de=qr(43),Ce=await ga(de),Re=ne(M(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters (REQUIRED)",{code_challenge:Ce,method:"S256",...I?{resource:k.serverUrl||"Unknown"}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"},note:"PKCE is REQUIRED for all clients in 2025-03-26 spec"});n({currentStep:"generate_pkce_parameters",codeVerifier:de,codeChallenge:Ce,codeChallengeMethod:"S256",...I?{}:{resourceIndicatorSuppressed:!0},state:qr(16),infoLogs:Re,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!k.authorizationServerMetadata?.authorization_endpoint||!k.clientId)throw new Error("Missing authorization endpoint or client ID");const _e=new URL(k.authorizationServerMetadata.authorization_endpoint);_e.searchParams.set("response_type","code"),_e.searchParams.set("client_id",k.clientId),_e.searchParams.set("redirect_uri",w),_e.searchParams.set("code_challenge",k.codeChallenge||""),_e.searchParams.set("code_challenge_method","S256"),_e.searchParams.set("state",k.state||""),k.serverUrl&&I&&_e.searchParams.set("resource",k.serverUrl);const ve=jr(_,{customScopes:h,supportedScopes:k.authorizationServerMetadata.scopes_supported});ve&&_e.searchParams.set("scope",ve);const Je=ne(M(),"authorization_request","auth-url","Authorization URL",{url:_e.toString()});n({currentStep:"authorization_request",authorizationUrl:_e.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:Je,isInitiatingAuth:!1});break;case"authorization_request":n({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!k.authorizationCode||k.authorizationCode.trim()===""){n({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!k.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const z=Ur({clientId:k.clientId,clientSecret:k.clientSecret,tokenEndpointAuthMethod:Hr(_,k.tokenEndpointAuthMethod)}),se={grant_type:"authorization_code",code:k.authorizationCode,redirect_uri:w,...z.bodyParams};k.codeVerifier&&(se.code_verifier=k.codeVerifier),k.serverUrl&&I&&(se.resource=k.serverUrl);const ae={method:"POST",url:k.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...z.headers},body:se};n({currentStep:"token_request",lastRequest:ae,lastResponse:void 0,...I?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...k.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:ae}],isInitiatingAuth:!1}),ie(50);return}case"token_request":if(!k.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!k.authorizationCode)throw new Error("Missing authorization code");if(!k.codeVerifier)throw new Error("PKCE code_verifier is missing - REQUIRED by 2025-03-26 spec for token exchange");try{const z=Ur({clientId:k.clientId,clientSecret:k.clientSecret,tokenEndpointAuthMethod:Hr(_,k.tokenEndpointAuthMethod)}),se=new URLSearchParams({grant_type:"authorization_code",code:k.authorizationCode,redirect_uri:w,code_verifier:k.codeVerifier||"",...z.bodyParams});k.serverUrl&&I&&se.set("resource",k.serverUrl);const ae=await L(k.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...ct(d,{"Content-Type":"application/x-www-form-urlencoded"}),...z.headers},body:se.toString()}),he={status:ae.status,statusText:ae.statusText,headers:ae.headers,body:ae.body},Oe=[...k.httpHistory||[]];if(Oe.length>0){const pe=Oe[Oe.length-1];pe.response=he,pe.duration=Date.now()-(pe.timestamp||Date.now())}if(!ae.ok){n({lastResponse:he,httpHistory:Oe,authorizationCode:void 0,error:ha(ae),isInitiatingAuth:!1});return}const we=ae.body;let Se=(M().infoLogs||[]).filter(pe=>pe.id!=="auth-code"&&pe.id!=="oauth-tokens"&&pe.id!=="token");if(k.authorizationCode&&(Se=[...Se,{id:"auth-code",level:"info",step:"received_authorization_code",label:"Authorization Code",data:{code:k.authorizationCode},timestamp:Date.now()}]),we.access_token){const pe={access_token:we.access_token};we.refresh_token&&(pe.refresh_token=we.refresh_token),Se=[...Se,{id:"oauth-tokens",level:"info",step:"received_access_token",label:"OAuth Tokens",data:pe,timestamp:Date.now()}]}if(we.access_token){const pe=Fr(we.access_token);if(pe){const me={...pe};me.exp&&(me.exp=`${me.exp} (${De(me.exp)})`),me.iat&&(me.iat=`${me.iat} (${De(me.iat)})`),me.nbf&&(me.nbf=`${me.nbf} (${De(me.nbf)})`);const Ee={...me};if(me.aud){const Ge=k.serverUrl,U=(Array.isArray(me.aud)?me.aud:[me.aud]).some(W=>W===Ge);Ee._validation={expected_audience:Ge,audience_matches:U,note:U?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Ee._validation={note:"⚠ No audience claim found - server should validate token binding"};Se=[...Se,{id:"token",step:"received_access_token",level:"info",label:"Access Token (Decoded JWT)",data:Ee,timestamp:Date.now()}]}}if(we.id_token){const pe=Fr(we.id_token);if(pe){const me={...pe};me.exp&&(me.exp=`${me.exp} (${De(me.exp)})`),me.iat&&(me.iat=`${me.iat} (${De(me.iat)})`),me.nbf&&(me.nbf=`${me.nbf} (${De(me.nbf)})`),me.auth_time&&(me.auth_time=`${me.auth_time} (${De(me.auth_time)})`),me._note="OIDC ID Token - Used for user identity verification",Se=[...Se,{id:"id-token",step:"received_access_token",level:"info",label:"ID Token (OIDC - Decoded JWT)",data:me,timestamp:Date.now()}]}}n({currentStep:"received_access_token",accessToken:we.access_token,refreshToken:we.refresh_token,tokenType:we.token_type||"Bearer",expiresIn:we.expires_in,lastResponse:he,httpHistory:Oe,infoLogs:Se,error:void 0,isInitiatingAuth:!1})}catch(z){const se={status:0,statusText:"Network Error",headers:{},body:{error:z instanceof Error?z.message:String(z)}},ae=[...k.httpHistory||[]];if(ae.length>0){const he=ae[ae.length-1];he.response=se,he.duration=Date.now()-(he.timestamp||Date.now())}n({lastResponse:se,httpHistory:ae,error:`Token exchange failed: ${z instanceof Error?z.message:String(z)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!k.serverUrl||!k.accessToken)throw new Error("Missing server URL or access token");const Xe={method:"POST",url:k.serverUrl,headers:{Authorization:`Bearer ${k.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"},body:Ut({protocolVersion:T,authMode:p,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2})},Pe=ne(M(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-03-26",Client:"MCP Inspector v1.0.0",Endpoint:k.serverUrl});n({currentStep:"authenticated_mcp_request",lastRequest:Xe,lastResponse:void 0,httpHistory:[...k.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Xe}],infoLogs:Pe,isInitiatingAuth:!1}),ie(50);return;case"authenticated_mcp_request":if(!k.serverUrl||!k.accessToken)throw new Error("Missing server URL or access token");try{const z=await L(k.serverUrl,{method:"POST",headers:dt(d,{Authorization:`Bearer ${k.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream"}),body:JSON.stringify(Ut({protocolVersion:T,authMode:p,clientName:"MCP Inspector",clientVersion:"1.0.0",id:2}))}),se={status:z.status,statusText:z.statusText,headers:z.headers,body:z.body},ae=[...k.httpHistory||[]];if(ae.length>0){const pe=ae[ae.length-1];pe.response=se,pe.duration=Date.now()-(pe.timestamp||Date.now())}if(!z.ok){if(z.status>=400&&z.status<500)try{const pe={method:"GET",url:k.serverUrl,headers:{Authorization:`Bearer ${k.accessToken}`,Accept:"text/event-stream"}},me={step:"complete",timestamp:Date.now(),request:pe};ae.push(me);const Ee=await L(k.serverUrl,{method:"GET",headers:{Authorization:`Bearer ${k.accessToken}`,Accept:"text/event-stream"}});me.response={status:Ee.status,statusText:Ee.statusText,headers:Ee.headers,body:Ee.body},me.duration=Date.now()-me.timestamp;const Ge=Ee.body;if(Ge&&typeof Ge=="object"&&Ge.isOldTransport&&Ge.endpoint){const U=Ge.endpoint,W=new URL(U,k.serverUrl).toString(),Y=ne(M(),"authenticated_mcp_request","http-sse-detected","HTTP+SSE Transport Detected (2024-11-05)",{Transport:"HTTP+SSE (2024-11-05 - Deprecated)","SSE Stream URL":k.serverUrl,"POST Endpoint":W,"First Event":Ge.events?.[0],"Migration Note":"This transport is deprecated. Please update your server to use the 2025-03-26 Streamable HTTP transport.","How It Works":"Client connected via GET for SSE stream. Subsequent requests use POST to: "+W});n({currentStep:"complete",lastResponse:{status:Ee.status,statusText:"OK - HTTP+SSE Transport",headers:Ee.headers,body:{transport:"HTTP+SSE (2024-11-05)",sseStreamUrl:k.serverUrl,postEndpoint:W,events:Ge.events}},httpHistory:ae,infoLogs:Y,error:void 0,isInitiatingAuth:!1});return}}catch(pe){console.error("GET fallback failed:",pe)}n({lastResponse:se,httpHistory:ae,error:da(z),isInitiatingAuth:!1});return}let he=M().infoLogs||[];const Oe=z.headers["content-type"]||"",we=Oe.includes("text/event-stream");let Se=null;if(we&&z.body?.transport==="sse"?Se=z.body.mcpResponse:Se=z.body,we&&Se?.result?.protocolVersion){const pe={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":Se.result.protocolVersion};Se.result.serverInfo&&(pe["Server Name"]=Se.result.serverInfo.name,pe["Server Version"]=Se.result.serverInfo.version),Se.result.capabilities&&(pe.Capabilities=Se.result.capabilities),he=ne(M(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",pe)}else if(we)he=ne(M(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":Oe,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:z.body?.events?`${z.body.events.length} events parsed`:"No events parsed"});else if(Se?.result?.protocolVersion){const pe={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":Se.result.protocolVersion};Se.result.serverInfo&&(pe["Server Name"]=Se.result.serverInfo.name,pe["Server Version"]=Se.result.serverInfo.version),Se.result.capabilities&&(pe.Capabilities=Se.result.capabilities),he=ne(M(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",pe)}n({currentStep:"complete",lastResponse:se,httpHistory:ae,infoLogs:he,error:void 0,isInitiatingAuth:!1})}catch(z){const se=Tt(z),ae={status:0,statusText:"Network Error",headers:{},body:{error:se.message,details:se.details}},he=[...k.httpHistory||[]];if(he.length>0){const Se={...he[he.length-1],response:ae,duration:Date.now()-(he[he.length-1]?.timestamp||Date.now()),error:se};he[he.length-1]=Se}const Oe=M(),we=ne(Oe,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:Oe.lastRequest,error:se},{level:"error",error:se});n({lastResponse:ae,httpHistory:he,infoLogs:we,error:`Authenticated MCP request failed: ${se.message}`,isInitiatingAuth:!1})}break;case"complete":n({isInitiatingAuth:!1});break;default:n({isInitiatingAuth:!1})}}catch(H){const oe=M(),$=Tt(H),Q=ne(oe,oe.currentStep,`error-${oe.currentStep}-${Date.now()}`,"Step failed",{step:oe.currentStep,request:oe.lastRequest,response:oe.lastResponse,error:$},{level:"error",error:$}),y=gn(oe.httpHistory,$),V={error:$.message,infoLogs:Q,isInitiatingAuth:!1};y&&(V.httpHistory=y),n(V)}},startGuidedFlow:async()=>{n({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{n(pa())}};return ee};function Fu(e){const t=new URL(e);if(t.pathname!=="/"&&t.pathname!==""){const r=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;return new URL(`/.well-known/oauth-protected-resource${r}`,t.origin).toString()}return new URL("/.well-known/oauth-protected-resource",t.origin).toString()}var Tp="Could not discover authorization server metadata.";function QP(e){if("error"in e){const t=e.error instanceof Error?e.error.message:String(e.error);return`${e.url} failed: ${t}`}return e.status>=200&&e.status<300?`${e.url} returned HTTP ${e.status} with no metadata document`:`${e.url} returned HTTP ${e.status}`}function qu(e){return e.length===0?`${Tp} No well-known URL was tried.`:`${Tp} ${e.map(QP).join("; ")}.`}function di(e,t){return kP({serverUrl:e.serverUrl??t,prmResource:e.resourceMetadata?.resource,resolved:e.resourceIndicator})}function ju(e){const t=e.state.serverUrl??e.fallbackServerUrl,r=e.prmResource?.trim();if(!r){const o='Protected Resource Metadata is missing its required "resource" identifier (RFC 9728 §2).';if(e.enforcement!=="warn")throw new Error(o);return{resourceIndicator:Cl({serverUrl:t}),infoLogs:ne({...e.state,infoLogs:e.infoLogs},"received_resource_metadata","resource-identifier-mismatch","Resource identifier missing",{"Server URL":t,Reason:o,Note:"The debugger will fall back to the server URL as the resource indicator, but strict MCP clients treat this metadata as invalid."},{level:"warning"})}}const n=Cl({serverUrl:t,prmResource:r}),i=e.enforcement!=="warn"&&n.status!=="valid",s=e.enforcement==="reject-rfc9728"&&!n.rfc9728Compliant;if(n.source==="prm"&&(i||s))throw new Error((s?n.rfc9728Reason:void 0)??n.reason??"Protected Resource Metadata advertises an unusable resource identifier.");return{resourceIndicator:n,infoLogs:LP(e.state,e.infoLogs,n,t)}}var eO=e=>di(e);function tO(e,t){return fa(e,t,{protocolVersion:"2025-06-18",includesProtectedResourceMetadata:!0,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try RFC8414 path, then RFC8414 root (no OIDC support)"},pkce:{label:"Generate PKCE parameters",description:"Client generates code verifier and challenge (recommended), includes resource parameter"},resourceValue:eO})}function $p(e){const t=new URL(e),r=[];if(t.pathname==="/"||t.pathname==="")r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString());else{const n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;r.push(new URL(`/.well-known/oauth-authorization-server${n}`,t.origin).toString()),r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString())}return r}var rO=e=>{const{state:t,getState:r,updateState:n,serverUrl:i,serverName:s,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,customScopes:h,customHeaders:d,resourceMetadataUrl:p,authMode:f,hasClientSecret:v=!1,strictConformance:m=!1,resourceIndicatorEnforcement:_="warn",requiredMetadataEnforcement:w="reject",registrationStrategy:S="dcr",emulation:T}=e,I=o,C=mn(T,"2025-06-18"),M=mn(T,Uu("2025-06-18")),L=Sa(T),q=Ea(u??{},T);if(S==="dcr"&&!q.client_name)throw new Error("Dynamic registration metadata must include client_name");const X=()=>r?r():t,ee=()=>di(X(),i),k=($,Q={})=>a({url:$,method:Q.method||"GET",headers:Pr(Q.headers),body:Q.body}),ie=$=>{const Q=la({authorizationServerMetadata:X().authorizationServerMetadata,hasClientSecret:!!($||v)});if(!Q.ok)throw new Error(Q.message);return Q.method},H=async $=>{const{clientId:Q,clientSecret:y}=await l?.({serverName:s,serverUrl:i})??{};if(!Q)return;const V=ie(y),K={"Client ID":Q,"Client Secret":y||v?"Configured":"Not provided (public client)","Token Auth Method":V,Note:$};return{clientId:Q,clientSecret:y||void 0,tokenEndpointAuthMethod:V,infoLogs:ne(X(),"received_client_credentials","preregistered-fallback","Pre-registered Client",K)}},oe={state:t,updateState:n,proceedToNextStep:async()=>{const $=X();n({isInitiatingAuth:!0});const Q=y=>{c?.(()=>{oe.proceedToNextStep()},y)};try{switch($.currentStep){case"idle":{const U=dt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":C}),W=Ut({protocolVersion:M,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),Y={method:"POST",url:i,headers:U,body:W};n({currentStep:"request_without_token",serverUrl:i,lastRequest:Y,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:Y}],isInitiatingAuth:!1}),Q(50);return}case"request_without_token":if(!$.serverUrl)throw new Error("No server URL available");try{const U=await k($.serverUrl,{method:"POST",headers:dt(d,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":C}),body:JSON.stringify(Ut({protocolVersion:M,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),W={status:U.status,statusText:U.statusText,headers:U.headers,body:U.body},Y=[...$.httpHistory||[]];if(Y.length>0){const R=Y[Y.length-1];R.response=W,R.duration=Date.now()-(R.timestamp||Date.now())}const g=vs({status:U.status,statusText:U.statusText,wwwAuthenticateHeader:U.headers["www-authenticate"],serverMessage:U.body?.error?.message});if(g.kind==="challenged"){const R=U.headers["www-authenticate"],E=ur(R),P=Du(E.scope);let F=R?ne($,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:R,...P&&P.length>0?{scope:P.join(" ")}:{},"Received from":$.serverUrl||"Unknown"}):$.infoLogs;g.specCompliant||(F=va($,F,"received_401_unauthorized",W)),n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:R||void 0,challengedScopes:P,lastResponse:W,httpHistory:Y,infoLogs:F,isInitiatingAuth:!1})}else if(g.kind==="anonymous_allowed"){const R=ne($,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,challengedScopes:void 0,lastResponse:W,httpHistory:Y,infoLogs:R,isInitiatingAuth:!1})}else throw n({lastResponse:W,httpHistory:Y}),new zr(g.message,U.status)}catch(U){throw U instanceof zr?U:new Error(`Failed to request MCP server: ${U instanceof Error?U.message:String(U)}`)}break;case"received_401_unauthorized":{const U=ur($.wwwAuthenticateHeader);let W=p||U.resource_metadata;if(!W&&$.serverUrl&&(W=Fu($.serverUrl)),!W)throw new Error("Could not determine resource metadata URL");const Y={method:"GET",url:W,headers:dt(d,{})};n({currentStep:"request_resource_metadata",resourceMetadataUrl:W,lastRequest:Y,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:Y}],isInitiatingAuth:!1}),Q(50);return}case"request_resource_metadata":if(!$.serverUrl)throw new Error("No server URL available");const y=[...$.httpHistory||[]];let V=y.length>0&&y[y.length-1]?.step==="request_resource_metadata"&&!y[y.length-1]?.response?y.pop():void 0;const K=[],le=U=>{if(!U)return{};if(U instanceof Headers){const W={};return U.forEach((Y,g)=>{W[g]=Y}),W}return Array.isArray(U)?Object.fromEntries(U):Object.fromEntries(Object.entries(U).map(([W,Y])=>[W,String(Y)]))},de=async(U,W={})=>{const Y=typeof U=="string"?U:U.toString(),g=Nu(i,Y,d,le(W.headers)),R=V?{...V,timestamp:Date.now(),request:{method:W.method||"GET",url:Y,headers:g,body:W.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:W.method||"GET",url:Y,headers:g,body:W.body}};V=void 0,K.push(R);try{const E=await k(Y,{method:W.method||"GET",headers:g,body:W.body});R.response={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body},R.duration=Date.now()-R.timestamp;const P={status:E.status,statusText:E.statusText,headers:E.headers},F=typeof E.body=="string"?E.body:JSON.stringify(E.body??{});return new Response(F,P)}catch(E){throw R.error=Tt(E),R.duration=Date.now()-R.timestamp,E}};try{const U=(p||ur($.wwwAuthenticateHeader).resource_metadata)&&$.resourceMetadataUrl?{resourceMetadataUrl:$.resourceMetadataUrl}:void 0,W=await ca($.serverUrl,U,de),Y=[...y,...K],g=K[K.length-1],R=zu({authorizationServers:W.authorization_servers,fallbackServerUrl:i,protocolVersion:"2025-06-18"}),E=R.authorizationServerUrl;if(R.error&&w!=="observe"){n({resourceMetadata:W,resourceMetadataUrl:g?.request?.url||$.resourceMetadataUrl,lastRequest:g?.request,lastResponse:g?.response,httpHistory:Y,error:R.error,isInitiatingAuth:!1});return}let P=$.infoLogs??[];R.error&&(P=ne({...X(),infoLogs:P},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:R.error,"Using instead":E}));const{resourceIndicator:F,infoLogs:B}=ju({state:$,fallbackServerUrl:i,prmResource:W.resource,enforcement:_,infoLogs:P});n({currentStep:"received_resource_metadata",resourceMetadata:W,resourceIndicator:F,resourceMetadataUrl:g?.request?.url||$.resourceMetadataUrl,authorizationServerUrl:E,lastRequest:g?.request,lastResponse:g?.response,httpHistory:Y,infoLogs:B,isInitiatingAuth:!1})}catch(U){const W=gn([...y,...K],Tt(U));throw n({lastResponse:K[K.length-1]?.response,httpHistory:W}),new Error(aa(U))}break;case"received_resource_metadata":if(!$.authorizationServerUrl)throw new Error("No authorization server URL available");const Ce={method:"GET",url:$p($.authorizationServerUrl)[0],headers:ct(d,{})};n({currentStep:"request_authorization_server_metadata",lastRequest:Ce,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:Ce}],isInitiatingAuth:!1}),Q(50);return;case"request_authorization_server_metadata":if(!$.authorizationServerUrl)throw new Error("No authorization server URL available");const Re=$p($.authorizationServerUrl);let _e=null;const ve=[];let Je={},Xe=null;for(const U of Re)try{const W=ct(d,{}),Y=[...$.httpHistory||[]];Y.length>0&&(Y[Y.length-1].request={method:"GET",url:U,headers:W}),n({lastRequest:{method:"GET",url:U,headers:W},httpHistory:Y});const g=await k(U,{method:"GET",headers:ct(d,{})});if(g.ok){_e=g.body,Je=g.headers,Xe=g,_e||ve.push({url:U,status:g.status});break}ve.push({url:U,status:g.status})}catch(W){ve.push({url:U,error:W});continue}if(!_e||!Xe)throw new Error(qu(ve));if(!_e.issuer)throw new Error(ma);if(!_e.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!_e.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!_e.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const Pe={status:Xe.status,statusText:Xe.statusText,headers:Je,body:_e},z=[...$.httpHistory||[]];z.length>0&&(z[z.length-1].response=Pe);const se=_e.code_challenge_methods_supported||[];se.includes("S256")?n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:_e,lastResponse:Pe,httpHistory:z,isInitiatingAuth:!1}):(console.warn("Authorization server may not support S256 PKCE method. Supported methods:",se),n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:_e,lastResponse:Pe,httpHistory:z,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1}));break;case"received_authorization_server_metadata":if(!$.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(S==="preregistered"){const{clientId:U,clientSecret:W}=await l?.({serverName:s,serverUrl:i})??{};if(!U){n({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const Y=ie(W),g={"Client ID":U,"Client Secret":W||v?"Configured":"Not provided (public client)","Token Auth Method":Y,Note:"Using pre-registered client credentials from server config (skipped DCR)"},R=ne(X(),"received_client_credentials","dcr","Pre-registered Client",g);n({currentStep:"received_client_credentials",clientId:U,clientSecret:W||void 0,tokenEndpointAuthMethod:Y,infoLogs:R,isInitiatingAuth:!1})}else if($.authorizationServerMetadata.registration_endpoint){const U=$.resourceMetadata?.scopes_supported||$.authorizationServerMetadata.scopes_supported,W=jr(T,{customScopes:h,challengedScopes:$.challengedScopes,supportedScopes:U}),Y=ba({registrationEndpoint:$.authorizationServerMetadata.registration_endpoint,redirectUri:I,dynamicRegistrationDefaults:q,scope:W,customHeaders:d});n({currentStep:"request_client_registration",lastRequest:Y,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:Y}],isInitiatingAuth:!1}),Q(50);return}else{if(m){n({error:ya,isInitiatingAuth:!1});return}const U=await H("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!U){n({error:_a,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpointAuthMethod:U.tokenEndpointAuthMethod,infoLogs:U.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":{if(!$.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!$.lastRequest?.body)throw new Error("No client metadata in request");const U=await wa({request:$.lastRequest,requestExecutor:a,httpHistory:$.httpHistory});if(U.status!=="registered"){if(n({lastResponse:U.response,httpHistory:U.httpHistory,error:U.error}),m){U.status==="invalid_response"&&n({isInitiatingAuth:!1});return}const Y=await H(U.fallbackNote);if(!Y){n({error:U.errorWithFallbackHint,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:Y.clientId,clientSecret:Y.clientSecret,tokenEndpointAuthMethod:Y.tokenEndpointAuthMethod,infoLogs:Y.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(U.missingClientId){n({lastResponse:U.response,httpHistory:U.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const W=ne(X(),"received_client_credentials","dcr","Dynamic Client Registration",U.infoLogData);n({currentStep:"received_client_credentials",clientId:U.credentials.clientId,clientSecret:U.credentials.clientSecret,tokenEndpointAuthMethod:ua(U.clientInfo),lastResponse:U.response,httpHistory:U.httpHistory,infoLogs:W,error:void 0,isInitiatingAuth:!1});break}case"received_client_credentials":const ae=qr(43),he=await ga(ae),Oe=ne(X(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:he,method:"S256",...L?{resource:ee()||"Unknown"}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});n({currentStep:"generate_pkce_parameters",codeVerifier:ae,codeChallenge:he,codeChallengeMethod:"S256",...L?{}:{resourceIndicatorSuppressed:!0},state:qr(16),infoLogs:Oe,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!$.authorizationServerMetadata?.authorization_endpoint||!$.clientId)throw new Error("Missing authorization endpoint or client ID");const we=new URL($.authorizationServerMetadata.authorization_endpoint);we.searchParams.set("response_type","code"),we.searchParams.set("client_id",$.clientId),we.searchParams.set("redirect_uri",I),we.searchParams.set("code_challenge",$.codeChallenge||""),we.searchParams.set("code_challenge_method","S256"),we.searchParams.set("state",$.state||"");const Se=ee();Se&&L&&we.searchParams.set("resource",Se);const pe=jr(T,{customScopes:h,challengedScopes:$.challengedScopes,supportedScopes:$.resourceMetadata?.scopes_supported||$.authorizationServerMetadata.scopes_supported});pe&&we.searchParams.set("scope",pe);const me=ne(X(),"authorization_request","auth-url","Authorization URL",{url:we.toString()});n({currentStep:"authorization_request",authorizationUrl:we.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:me,isInitiatingAuth:!1});break;case"authorization_request":n({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!$.authorizationCode||$.authorizationCode.trim()===""){n({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!$.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const U=Ur({clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpointAuthMethod:Hr(T,$.tokenEndpointAuthMethod)}),W={grant_type:"authorization_code",code:$.authorizationCode,redirect_uri:I,...U.bodyParams};$.codeVerifier&&(W.code_verifier=$.codeVerifier);const Y=ee();Y&&L&&(W.resource=Y);const g={method:"POST",url:$.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...U.headers},body:W};n({currentStep:"token_request",lastRequest:g,lastResponse:void 0,...L?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...$.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:g}],isInitiatingAuth:!1}),Q(50);return}case"token_request":if(!$.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!$.authorizationCode)throw new Error("Missing authorization code");if(!$.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const U=Ur({clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpointAuthMethod:Hr(T,$.tokenEndpointAuthMethod)}),W=new URLSearchParams({grant_type:"authorization_code",code:$.authorizationCode,redirect_uri:I,code_verifier:$.codeVerifier||"",...U.bodyParams}),Y=ee();Y&&L&&W.set("resource",Y);const g=await k($.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...ct(d,{"Content-Type":"application/x-www-form-urlencoded"}),...U.headers},body:W.toString()}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...$.httpHistory||[]];if(E.length>0){const B=E[E.length-1];B.response=R,B.duration=Date.now()-(B.timestamp||Date.now())}if(!g.ok){n({lastResponse:R,httpHistory:E,authorizationCode:void 0,error:ha(g),isInitiatingAuth:!1});return}const P=g.body;let F=(X().infoLogs||[]).filter(B=>B.id!=="auth-code"&&B.id!=="oauth-tokens"&&B.id!=="token");if($.authorizationCode&&(F=[...F,{id:"auth-code",step:"token_request",level:"info",label:"Authorization Code",data:{code:$.authorizationCode},timestamp:Date.now()}]),P.access_token){const B={access_token:P.access_token};P.refresh_token&&(B.refresh_token=P.refresh_token),F=[...F,{id:"oauth-tokens",step:"token_request",level:"info",label:"OAuth Tokens",data:B,timestamp:Date.now()}]}if(P.access_token){const B=Fr(P.access_token);if(B){const D={...B};D.exp&&(D.exp=`${D.exp} (${De(D.exp)})`),D.iat&&(D.iat=`${D.iat} (${De(D.iat)})`),D.nbf&&(D.nbf=`${D.nbf} (${De(D.nbf)})`);const G={...D};if(D.aud){const J=$.serverUrl,qt=(Array.isArray(D.aud)?D.aud:[D.aud]).some(Gr=>Gr===J);G._validation={expected_audience:J,audience_matches:qt,note:qt?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else G._validation={note:"⚠ No audience claim found - server should validate token binding"};F=[...F,{id:"token",step:"token_request",level:"info",label:"Access Token (Decoded JWT)",data:G,timestamp:Date.now()}]}}if(P.id_token){const B=Fr(P.id_token);if(B){const D={...B};D.exp&&(D.exp=`${D.exp} (${De(D.exp)})`),D.iat&&(D.iat=`${D.iat} (${De(D.iat)})`),D.nbf&&(D.nbf=`${D.nbf} (${De(D.nbf)})`),D.auth_time&&(D.auth_time=`${D.auth_time} (${De(D.auth_time)})`),D._note="OIDC ID Token - Used for user identity verification",F=[...F,{id:"id-token",step:"token_request",level:"info",label:"ID Token (OIDC - Decoded JWT)",data:D,timestamp:Date.now()}]}}n({currentStep:"received_access_token",accessToken:P.access_token,refreshToken:P.refresh_token,tokenType:P.token_type||"Bearer",expiresIn:P.expires_in,lastResponse:R,httpHistory:E,infoLogs:F,error:void 0,isInitiatingAuth:!1})}catch(U){const W={status:0,statusText:"Network Error",headers:{},body:{error:U instanceof Error?U.message:String(U)}},Y=[...$.httpHistory||[]];if(Y.length>0){const g=Y[Y.length-1];g.response=W,g.duration=Date.now()-(g.timestamp||Date.now())}n({lastResponse:W,httpHistory:Y,error:`Token exchange failed: ${U instanceof Error?U.message:String(U)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!$.serverUrl||!$.accessToken)throw new Error("Missing server URL or access token");const Ee={method:"POST",url:$.serverUrl,headers:{Authorization:`Bearer ${$.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":C},body:Ut({protocolVersion:M,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},Ge=ne(X(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-06-18",Client:"MCPJam Inspector v1.0.0",Endpoint:$.serverUrl});n({currentStep:"authenticated_mcp_request",lastRequest:Ee,lastResponse:void 0,httpHistory:[...$.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:Ee}],infoLogs:Ge,isInitiatingAuth:!1}),Q(50);return;case"authenticated_mcp_request":if(!$.serverUrl||!$.accessToken)throw new Error("Missing server URL or access token");try{const U=await k($.serverUrl,{method:"POST",headers:dt(d,{Authorization:`Bearer ${$.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":C}),body:JSON.stringify(Ut({protocolVersion:M,authMode:f,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),W={status:U.status,statusText:U.statusText,headers:U.headers,body:U.body},Y=[...$.httpHistory||[]];if(Y.length>0){const F=Y[Y.length-1];F.response=W,F.duration=Date.now()-(F.timestamp||Date.now())}if(!U.ok){n({lastResponse:W,httpHistory:Y,error:da(U),isInitiatingAuth:!1});return}let g=X().infoLogs||[];const R=U.headers["content-type"]||"",E=R.includes("text/event-stream");let P=null;if(E&&U.body?.transport==="sse"?P=U.body.mcpResponse:P=U.body,E&&P?.result?.protocolVersion){const F={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(F["Server Name"]=P.result.serverInfo.name,F["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(F.Capabilities=P.result.capabilities),g=ne(X(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",F)}else if(E)g=ne(X(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":R,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:U.body?.events?`${U.body.events.length} events parsed`:"No events parsed"});else if(P?.result?.protocolVersion){const F={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":P.result.protocolVersion};P.result.serverInfo&&(F["Server Name"]=P.result.serverInfo.name,F["Server Version"]=P.result.serverInfo.version),P.result.capabilities&&(F.Capabilities=P.result.capabilities),g=ne(X(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",F)}n({currentStep:"complete",lastResponse:W,httpHistory:Y,infoLogs:g,error:void 0,isInitiatingAuth:!1})}catch(U){const W=Tt(U),Y={status:0,statusText:"Network Error",headers:{},body:{error:W.message,details:W.details}},g=[...$.httpHistory||[]];if(g.length>0){const P={...g[g.length-1],response:Y,duration:Date.now()-(g[g.length-1]?.timestamp||Date.now()),error:W};g[g.length-1]=P}const R=X(),E=ne(R,"authenticated_mcp_request",`error-authenticated_mcp_request-${Date.now()}`,"Authenticated MCP request failed",{request:R.lastRequest,error:W},{level:"error",error:W});n({lastResponse:Y,httpHistory:g,infoLogs:E,error:`Authenticated MCP request failed: ${W.message}`,isInitiatingAuth:!1})}break;case"complete":n({isInitiatingAuth:!1});break;default:n({isInitiatingAuth:!1})}}catch(y){const V=X(),K=Tt(y),le=ne(V,V.currentStep,`error-${V.currentStep}-${Date.now()}`,"Step failed",{step:V.currentStep,request:V.lastRequest,response:V.lastResponse,error:K},{level:"error",error:K}),de=gn(V.httpHistory,K),Ce={error:K.message,infoLogs:le,isInitiatingAuth:!1};de&&(Ce.httpHistory=de),n(Ce)}},startGuidedFlow:async()=>{n({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{n(pa())}};return oe};function ka(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase();return t==="localhost"||t.endsWith(".localhost")||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)||t==="::1"}function yD(e){try{const{protocol:t,hostname:r}=new URL(e);return t==="http:"&&ka(r)}catch{return!1}}function N_(e,t={}){let r;try{r=new URL(e)}catch{throw new Error("Client ID metadata URL must be a valid absolute URL")}const n=t.allowLoopback===!0&&r.protocol==="http:"&&ka(r.hostname);if(!n&&(r.protocol!=="https:"||!r.hostname))throw new Error("Client ID metadata URL must be an absolute HTTPS URL");const i=n?/^http:\/\//i:/^https:\/\//i;if(!i.test(e))throw new Error(n?"Client ID metadata URL must use the http:// scheme (with two slashes)":"Client ID metadata URL must use the https:// scheme (with two slashes)");if(/[\u0000-\u0020\u007f\\]/.test(e))throw new Error("Client ID metadata URL must not contain control characters, whitespace, or backslashes");if(r.hash||e.includes("#"))throw new Error("Client ID metadata URL must not contain a fragment component");const s=e.split(/[?#]/,1)[0].replace(i,""),o=s.indexOf("/"),a=o===-1?s:s.slice(0,o),c=o===-1?"":s.slice(o);if(!a)throw new Error("Client ID metadata URL must contain a host immediately after https://");if(r.username||r.password||a.includes("@"))throw new Error("Client ID metadata URL must not contain a userinfo component");if(!c)throw new Error("Client ID metadata URL must contain a path component");const l=u=>{const h=u.replace(/%2e/gi,".");return h==="."||h===".."};if(c.split("/").some(l))throw new Error("Client ID metadata URL must not contain single-dot or double-dot path segments");return e}var nO=e=>di(e);function iO(e,t){return fa(e,t,{protocolVersion:"2025-11-25",includesProtectedResourceMetadata:!0,initialMcpMethod:"initialize",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try OAuth path insertion, OIDC path insertion, OIDC path appending"},pkce:{label:`Generate PKCE (REQUIRED)
98
98
  Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:nO})}function Cp(e){const t=new URL(e),r=[];if(t.pathname==="/"||t.pathname==="")r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString()),r.push(new URL("/.well-known/openid-configuration",t.origin).toString());else{const n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;r.push(new URL(`/.well-known/oauth-authorization-server${n}`,t.origin).toString()),r.push(new URL(`/.well-known/openid-configuration${n}`,t.origin).toString()),r.push(new URL(`${n}/.well-known/openid-configuration`,t.origin).toString())}return r}var sO=e=>{const{state:t,getState:r,updateState:n,serverUrl:i,serverName:s,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,clientIdMetadataUrl:h,customScopes:d,customHeaders:p,resourceMetadataUrl:f,authMode:v,hasClientSecret:m=!1,strictConformance:_=!1,resourceIndicatorEnforcement:w="warn",requiredMetadataEnforcement:S="reject",registrationStrategy:T="cimd",emulation:I}=e,C=o,M=mn(I,"2025-11-25"),L=mn(I,Uu("2025-11-25")),q=Sa(I),X=Ea(u??{},I);let ee=h??"";if(T==="dcr"&&!X.client_name)throw new Error("Dynamic registration metadata must include client_name");if(T==="cimd"&&!ee)throw new Error("Client ID metadata URL is required for CIMD registration");T==="cimd"&&(ee=N_(ee));const k=()=>r?r():t,ie=()=>di(k(),i),H=(y,V={})=>a({url:y,method:V.method||"GET",headers:Pr(V.headers),body:V.body}),oe=y=>{const V=la({authorizationServerMetadata:k().authorizationServerMetadata,hasClientSecret:!!(y||m)});if(!V.ok)throw new Error(V.message);return V.method},$=async y=>{const{clientId:V,clientSecret:K}=await l?.({serverName:s,serverUrl:i})??{};if(!V)return;const le=oe(K),de={"Client ID":V,"Client Secret":K||m?"Configured":"Not provided (public client)","Token Auth Method":le,Note:y};return{clientId:V,clientSecret:K||void 0,tokenEndpointAuthMethod:le,infoLogs:ne(k(),"received_client_credentials","preregistered-fallback","Pre-registered Client",de)}},Q={state:t,updateState:n,proceedToNextStep:async()=>{const y=k();n({isInitiatingAuth:!0});const V=K=>{c?.(()=>{Q.proceedToNextStep()},K)};try{switch(y.currentStep){case"idle":{const g=dt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),R=Ut({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),E={method:"POST",url:i,headers:g,body:R};n({currentStep:"request_without_token",serverUrl:i,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_without_token":if(!y.serverUrl)throw new Error("No server URL available");try{const g=await H(y.serverUrl,{method:"POST",headers:dt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),body:JSON.stringify(Ut({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const F=E[E.length-1];F.response=R,F.duration=Date.now()-(F.timestamp||Date.now())}const P=vs({status:g.status,statusText:g.statusText,wwwAuthenticateHeader:g.headers["www-authenticate"],serverMessage:g.body?.error?.message});if(P.kind==="challenged"){const F=g.headers["www-authenticate"],B=ur(F),D=Du(B.scope);let G=F?ne(y,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:F,...D&&D.length>0?{scope:D.join(" ")}:{},"Received from":y.serverUrl||"Unknown"}):y.infoLogs;P.specCompliant||(G=va(y,G,"received_401_unauthorized",R)),n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:F||void 0,challengedScopes:D,lastResponse:R,httpHistory:E,infoLogs:G,isInitiatingAuth:!1})}else if(P.kind==="anonymous_allowed"){const F=ne(y,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,lastResponse:R,httpHistory:E,infoLogs:F,isInitiatingAuth:!1})}else throw n({lastResponse:R,httpHistory:E}),new zr(P.message,g.status)}catch(g){throw g instanceof zr?g:new Error(`Failed to request MCP server: ${g instanceof Error?g.message:String(g)}`)}break;case"received_401_unauthorized":{const g=ur(y.wwwAuthenticateHeader);let R=f||g.resource_metadata;if(!R&&y.serverUrl&&(R=Fu(y.serverUrl)),!R)throw new Error("Could not determine resource metadata URL");const E={method:"GET",url:R,headers:dt(p,{})};n({currentStep:"request_resource_metadata",resourceMetadataUrl:R,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_resource_metadata":if(!y.serverUrl)throw new Error("No server URL available");const K=[...y.httpHistory||[]];let le=K.length>0&&K[K.length-1]?.step==="request_resource_metadata"&&!K[K.length-1]?.response?K.pop():void 0;const de=[],Ce=async(g,R={})=>{const E=typeof g=="string"?g:g.toString(),P=Nu(i,E,p,Pr(R.headers)),F=le?{...le,timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}};le=void 0,de.push(F);try{const B=await H(E,{method:R.method||"GET",headers:P,body:R.body});F.response={status:B.status,statusText:B.statusText,headers:B.headers,body:B.body},F.duration=Date.now()-F.timestamp;const D={status:B.status,statusText:B.statusText,headers:B.headers},G=typeof B.body=="string"?B.body:JSON.stringify(B.body??{});return new Response(G,D)}catch(B){throw F.error=Tt(B),F.duration=Date.now()-F.timestamp,B}};try{const g=(f||ur(y.wwwAuthenticateHeader).resource_metadata)&&y.resourceMetadataUrl?{resourceMetadataUrl:y.resourceMetadataUrl}:void 0,R=await ca(y.serverUrl,g,Ce),E=[...K,...de],P=de[de.length-1],F=zu({authorizationServers:R.authorization_servers,fallbackServerUrl:i,protocolVersion:"2025-11-25"}),B=F.authorizationServerUrl;if(F.error&&S!=="observe"){n({resourceMetadata:R,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,error:F.error,isInitiatingAuth:!1});return}let D=y.infoLogs??[];F.error&&(D=ne({...k(),infoLogs:D},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:F.error,"Using instead":B}));const G=ju({state:y,fallbackServerUrl:i,prmResource:R.resource,enforcement:w,infoLogs:D}),J=G.resourceIndicator;D=G.infoLogs,n({currentStep:"received_resource_metadata",resourceMetadata:R,resourceIndicator:J,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,authorizationServerUrl:B,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,infoLogs:D,isInitiatingAuth:!1})}catch(g){const R=gn([...K,...de],Tt(g));throw n({lastResponse:de[de.length-1]?.response,httpHistory:R}),new Error(aa(g))}break;case"received_resource_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const Re={method:"GET",url:Cp(y.authorizationServerUrl)[0],headers:ct(p,{})};n({currentStep:"request_authorization_server_metadata",lastRequest:Re,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:Re}],isInitiatingAuth:!1}),V(50);return;case"request_authorization_server_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const _e=Cp(y.authorizationServerUrl);let ve=null;const Je=[];let Xe={},Pe=null;for(const g of _e)try{const R=ct(p,{}),E=[...y.httpHistory||[]];E.length>0&&(E[E.length-1].request={method:"GET",url:g,headers:R}),n({lastRequest:{method:"GET",url:g,headers:R},httpHistory:E});const P=await H(g,{method:"GET",headers:ct(p,{})});if(P.ok){ve=P.body,Xe=P.headers,Pe=P,ve||Je.push({url:g,status:P.status});break}Je.push({url:g,status:P.status})}catch(R){Je.push({url:g,error:R});continue}if(!ve||!Pe)throw new Error(qu(Je));if(!ve.issuer)throw new Error(ma);if(!ve.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!ve.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!ve.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const z={status:Pe.status,statusText:Pe.statusText,headers:Xe,body:ve},se=[...y.httpHistory||[]];if(se.length>0){const g=se[se.length-1];g.response=z,g.duration=Date.now()-(g.timestamp||Date.now())}const ae=ve.code_challenge_methods_supported||[],he=L_(ae,"2025-11-25"),Oe=typeof ve.client_id_metadata_document_supported=="boolean"?ve.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)",we=ne(k(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":Oe});if(he){if(_||S!=="observe"){n({lastResponse:z,httpHistory:se,infoLogs:we,error:he,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",ae),n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!y.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(T==="cimd"){if(y.authorizationServerMetadata.client_id_metadata_document_supported!==!0){n({error:"The authorization server does not support Client ID Metadata Documents (client_id_metadata_document_supported is not advertised in AS metadata). Try using 'dcr' or 'preregistered' registration strategy instead.",isInitiatingAuth:!1});return}n({currentStep:"cimd_prepare",clientId:ee,isInitiatingAuth:!1}),V(800);return}else if(T==="preregistered"){const{clientId:g,clientSecret:R}=await l?.({serverName:s,serverUrl:i})??{};if(!g){n({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const E=oe(R),P={"Client ID":g,"Client Secret":R||m?"Configured":"Not provided (public client)","Token Auth Method":E,Note:"Using pre-registered client credentials from server config (skipped DCR)"},F=ne(k(),"received_client_credentials","dcr","Pre-registered Client",P);n({currentStep:"received_client_credentials",clientId:g,clientSecret:R||void 0,tokenEndpointAuthMethod:E,infoLogs:F,isInitiatingAuth:!1})}else if(y.authorizationServerMetadata.registration_endpoint){const g=y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported,R=jr(I,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:g}),E=ba({registrationEndpoint:y.authorizationServerMetadata.registration_endpoint,redirectUri:C,dynamicRegistrationDefaults:X,scope:R,customHeaders:p});n({currentStep:"request_client_registration",lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}else{if(_){n({error:ya,isInitiatingAuth:!1});return}const g=await $("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!g){n({error:_a,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:g.clientId,clientSecret:g.clientSecret,tokenEndpointAuthMethod:g.tokenEndpointAuthMethod,infoLogs:g.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!y.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!y.lastRequest?.body)throw new Error("No client metadata in request");{const g=await wa({request:y.lastRequest,requestExecutor:a,httpHistory:y.httpHistory});if(g.status!=="registered"){if(n({lastResponse:g.response,httpHistory:g.httpHistory,error:g.error,isInitiatingAuth:!1}),_)return;const E=await $(g.fallbackNote);if(!E){n({error:g.errorWithFallbackHint,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpointAuthMethod:E.tokenEndpointAuthMethod,infoLogs:E.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(g.missingClientId){n({lastResponse:g.response,httpHistory:g.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const R=ne(k(),"received_client_credentials","dcr","Dynamic Client Registration",g.infoLogData);n({currentStep:"received_client_credentials",clientId:g.credentials.clientId,clientSecret:g.credentials.clientSecret,tokenEndpointAuthMethod:ua(g.clientInfo),lastResponse:g.response,httpHistory:g.httpHistory,infoLogs:R,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":n({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),V(800);return;case"cimd_fetch_request":try{const g={method:"GET",url:ee,headers:Pr(void 0)},R=Date.now(),E=await H(ee,{method:"GET"});if(!E.ok)throw new Error(`CIMD endpoint returned HTTP ${E.status}`);const P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body};n({currentStep:"cimd_metadata_response",lastRequest:g,lastResponse:P,httpHistory:[...y.httpHistory||[],{step:"cimd_fetch_request",timestamp:R,duration:Date.now()-R,request:g,response:P}],isInitiatingAuth:!1}),V(800);return}catch(g){n({error:`CIMD metadata fetch failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const g=y.lastResponse?.body;if(!g||typeof g!="object")throw new Error("CIMD metadata document was not available");if(g.client_id!==ee)throw new Error("CIMD client_id mismatch");const R=y.authorizationServerMetadata?.client_id_metadata_document_supported,E={"Client ID":ee,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":g.client_name||"MCPJam","Redirect URIs":g.redirect_uris||[],"Token Auth Method":g.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};R?E["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":E["Server Support"]="⚠ Not advertised (attempting anyway)";const P=ne(k(),"received_client_credentials","cimd","Client ID Metadata Document",E);n({currentStep:"received_client_credentials",clientId:ee,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:P,isInitiatingAuth:!1})}catch(g){n({error:`CIMD validation failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Se=qr(43),pe=await ga(Se),me=ne(k(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:pe,method:"S256",...q?{resource:ie()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});n({currentStep:"generate_pkce_parameters",codeVerifier:Se,codeChallenge:pe,codeChallengeMethod:"S256",...q?{}:{resourceIndicatorSuppressed:!0},state:qr(16),infoLogs:me,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!y.authorizationServerMetadata?.authorization_endpoint||!y.clientId)throw new Error("Missing authorization endpoint or client ID");const Ee=new URL(y.authorizationServerMetadata.authorization_endpoint);Ee.searchParams.set("response_type","code"),Ee.searchParams.set("client_id",y.clientId),Ee.searchParams.set("redirect_uri",C),Ee.searchParams.set("code_challenge",y.codeChallenge||""),Ee.searchParams.set("code_challenge_method","S256"),Ee.searchParams.set("state",y.state||""),q&&Ee.searchParams.set("resource",ie());const Ge=jr(I,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported});Ge&&Ee.searchParams.set("scope",Ge);const U=ne(k(),"authorization_request","auth-url","Authorization URL",{url:Ee.toString()});n({currentStep:"authorization_request",authorizationUrl:Ee.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,infoLogs:U,isInitiatingAuth:!1});break;case"authorization_request":n({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!y.authorizationCode||y.authorizationCode.trim()===""){n({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const g=Ur({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Hr(I,y.tokenEndpointAuthMethod)}),R={grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:C,...g.bodyParams};y.codeVerifier&&(R.code_verifier=y.codeVerifier),q&&(R.resource=ie());const E={method:"POST",url:y.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...g.headers},body:R};n({currentStep:"token_request",lastRequest:E,lastResponse:void 0,...q?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...y.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"token_request":if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!y.authorizationCode)throw new Error("Missing authorization code");if(!y.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const g=Ur({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Hr(I,y.tokenEndpointAuthMethod)}),R=new URLSearchParams({grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:C,code_verifier:y.codeVerifier||"",...g.bodyParams});q&&R.set("resource",ie());const E=await H(y.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...ct(p,{"Content-Type":"application/x-www-form-urlencoded"}),...g.headers},body:R.toString()}),P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body},F=[...y.httpHistory||[]];if(F.length>0){const G=F[F.length-1];G.response=P,G.duration=Date.now()-(G.timestamp||Date.now())}if(!E.ok){n({lastResponse:P,httpHistory:F,authorizationCode:void 0,error:ha(E),isInitiatingAuth:!1});return}const B=E.body;let D=(k().infoLogs||[]).filter(G=>G.id!=="auth-code"&&G.id!=="oauth-tokens"&&G.id!=="token");if(y.authorizationCode&&(D=[...D,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:y.authorizationCode},timestamp:Date.now()}]),B.access_token){const G={access_token:B.access_token};B.refresh_token&&(G.refresh_token=B.refresh_token),D=[...D,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:G,timestamp:Date.now()}]}if(B.access_token){const G=Fr(B.access_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`);const qt={...J};if(J.aud){const Gr=y.serverUrl,hi=(Array.isArray(J.aud)?J.aud:[J.aud]).some(Ta=>Ta===Gr);qt._validation={expected_audience:Gr,audience_matches:hi,note:hi?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else qt._validation={note:"⚠ No audience claim found - server should validate token binding"};D=[...D,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:qt,timestamp:Date.now()}]}}if(B.id_token){const G=Fr(B.id_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`),J.auth_time&&(J.auth_time=`${J.auth_time} (${De(J.auth_time)})`),J._note="OIDC ID Token - Used for user identity verification",D=[...D,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:J,timestamp:Date.now()}]}}n({currentStep:"received_access_token",accessToken:B.access_token,refreshToken:B.refresh_token,tokenType:B.token_type||"Bearer",expiresIn:B.expires_in,lastResponse:P,httpHistory:F,infoLogs:D,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Token exchange failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");const W={method:"POST",url:y.serverUrl,headers:{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M},body:Ut({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},Y=ne(k(),"authenticated_mcp_request","authenticated-init","Authenticated MCP Initialize Request",{Request:"MCP initialize with OAuth bearer token","Protocol Version":"2025-11-25",Client:"MCPJam Inspector v1.0.0",Endpoint:y.serverUrl});n({currentStep:"authenticated_mcp_request",lastRequest:W,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:W}],infoLogs:Y,isInitiatingAuth:!1}),V(50);return;case"authenticated_mcp_request":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");try{const g=await H(y.serverUrl,{method:"POST",headers:dt(p,{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":M}),body:JSON.stringify(Ut({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const G=E[E.length-1];G.response=R,G.duration=Date.now()-(G.timestamp||Date.now())}if(!g.ok){n({lastResponse:R,httpHistory:E,error:da(g),isInitiatingAuth:!1});return}let P=k().infoLogs||[];const F=g.headers["content-type"]||"",B=F.includes("text/event-stream");let D=null;if(B&&g.body?.transport==="sse"?D=g.body.mcpResponse:D=g.body,B&&D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(B)P=ne(k(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":F,Note:"Server returned streaming response. Initialize response delivered via SSE stream.",Events:g.body?.events?`${g.body.events.length} events parsed`:"No events parsed"});else if(D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}n({currentStep:"complete",lastResponse:R,httpHistory:E,infoLogs:P,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Authenticated MCP request failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"complete":n({isInitiatingAuth:!1});break;default:n({isInitiatingAuth:!1})}}catch(K){const le=k(),de=Tt(K),Ce=ne(le,le.currentStep,`error-${le.currentStep}-${Date.now()}`,"Step failed",{step:le.currentStep,request:le.lastRequest,response:le.lastResponse,error:de},{level:"error",error:de}),Re=gn(le.httpHistory,de),_e={error:de.message,infoLogs:Ce,isInitiatingAuth:!1};Re&&(_e.httpHistory=Re),n(_e)}},startGuidedFlow:async()=>{n({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{n(pa())}};return Q},oO=e=>di(e);function aO(e){const t=e.requestedScopes??[],r=e.challengedScopes??[],n=[];if(t.length>0&&n.push({label:"requested scopes",value:t.join(" ")}),r.length>0){const i=vP(t,r);n.push({label:"challenged scopes",value:r.join(" ")}),n.push({label:"scope union",value:i.join(" ")})}return n}function cO(e){const t=e.recordedIssuer??e.authorizationServerMetadata?.issuer;return t?[{label:"bound to issuer",value:t}]:[]}function lO(e,t){return fa(e,t,{protocolVersion:"2026-07-28",includesProtectedResourceMetadata:!0,initialMcpMethod:"tools/list",authorizationServerMetadata:{label:"GET Authorization server metadata endpoint",description:"Try OAuth path insertion, OIDC path insertion, OIDC path appending"},pkce:{label:`Generate PKCE (REQUIRED)
99
99
  Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:oO,dcrNotes:[{label:"Deprecated",value:"DCR is deprecated in 2026-07-28 (PR #2858). Prefer CIMD or a pre-registered client; DCR remains a compatibility fallback for authorization servers without CIMD support."}],clientCredentialsExtras:cO,authorizationRequestExtras:aO})}function Pp(e){const t=new URL(e),r=[];if(t.pathname==="/"||t.pathname==="")r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString()),r.push(new URL("/.well-known/openid-configuration",t.origin).toString());else{const n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;r.push(new URL(`/.well-known/oauth-authorization-server${n}`,t.origin).toString()),r.push(new URL(`/.well-known/openid-configuration${n}`,t.origin).toString()),r.push(new URL(`${n}/.well-known/openid-configuration`,t.origin).toString())}return r}function Op(e){const t=e.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029]+/g," ").trim();return`\`${t.length>256?`${t.slice(0,256)}…`:t}\``}function uO(e,t){let r,n;try{r=new URL(e),n=new URL(t)}catch{return!1}if(r.origin!==n.origin||r.search||r.hash||n.search||n.hash)return!1;const i=a=>a.endsWith("/")?a.slice(0,-1):a,s=i(r.pathname),o=i(n.pathname);return s===o?!1:s===""||s==="/"?o.length>0:o.startsWith(`${s}/`)}function dO(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function xp(e,t){return e==null?!1:typeof e!="string"?!0:!dO(e,t)}function Mp(e){return typeof e=="string"?`"${e}"`:"a non-string value"}function hO(e){const{advertisedIssuer:t,discoveryUrl:r,tokenEndpoint:n,registrationEndpoint:i,allowPathScopedIssuer:s}=e,o=uO(t,r),a=s&&o,c=a&&xp(n,t),l=a&&xp(i,t);return a&&!c&&!l?{accepted:!0,hint:""}:{accepted:!1,hint:c?` The path-scoped authorization server's token endpoint (${Mp(n)}) is not on the same origin as its issuer ("${t}"); refusing to send credentials off-origin.`:l?` The path-scoped authorization server's registration endpoint (${Mp(i)}) is not on the same origin as its issuer ("${t}"); refusing dynamic registration off-origin.`:o?` The advertised issuer is the same-origin root of the discovery URL — a multi-tenant, path-scoped authorization server. Enable "Path-scoped authorization server" in the server's OAuth configuration (Advanced settings) to allow this.`:""}}function pO(e){const{recordedIssuer:t,returnedIss:r,issParameterSupported:n,enforcePresentIssMismatch:i=!0}=e;if(r!=null&&r!==""){if(t!==void 0&&r!==t){const s=`Authorization response \`iss\` does not match the issuer this flow started with. Recorded from authorization-server metadata: ${Op(t)}; returned on the callback: ${Op(r)}.`;return i?{ok:!1,reason:`${s} Refusing to exchange the authorization code; not displaying any server-supplied error parameters (RFC 9207).`}:{ok:!0,warning:`${s} This protocol version does not require RFC 9207 issuer validation, so the flow continues; on 2026-07-28 this stops the flow before the authorization code is redeemed.`}}return{ok:!0}}return n===!0?{ok:!1,reason:"Authorization server advertised `authorization_response_iss_parameter_supported: true` but the callback did not include an `iss` parameter (RFC 9207 requires it)."}:{ok:!0}}var fO=e=>{const{state:t,getState:r,updateState:n,serverUrl:i,serverName:s,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,clientIdMetadataUrl:h,customScopes:d,customHeaders:p,resourceMetadataUrl:f,authMode:v,hasClientSecret:m=!1,strictConformance:_=!1,allowPathScopedIssuer:w=!1,resourceIndicatorEnforcement:S="warn",requiredMetadataEnforcement:T="reject",registrationStrategy:I="cimd",emulation:C}=e,M=o,L=mn(C,"2026-07-28"),q=Sa(C),X=Ea(u??{},C);let ee=h??"";if(I==="dcr"&&!X.client_name)throw new Error("Dynamic registration metadata must include client_name");if(I==="cimd"&&!ee)throw new Error("Client ID metadata URL is required for CIMD registration");I==="cimd"&&(ee=N_(ee));const k=()=>r?r():t,ie=()=>di(k(),i),H=(y,V={})=>a({url:y,method:V.method||"GET",headers:Pr(V.headers),body:V.body}),oe=y=>{const V=la({authorizationServerMetadata:k().authorizationServerMetadata,hasClientSecret:!!(y||m)});if(!V.ok)throw new Error(V.message);return V.method},$=async y=>{const{clientId:V,clientSecret:K}=await l?.({serverName:s,serverUrl:i})??{};if(!V)return;const le=oe(K),de={"Client ID":V,"Client Secret":K||m?"Configured":"Not provided (public client)","Token Auth Method":le,Note:y};return{clientId:V,clientSecret:K||void 0,tokenEndpointAuthMethod:le,infoLogs:ne(k(),"received_client_credentials","preregistered-fallback","Pre-registered Client",de)}},Q={state:t,updateState:n,proceedToNextStep:async()=>{const y=k();n({isInitiatingAuth:!0});const V=K=>{c?.(()=>{Q.proceedToNextStep()},K)};try{switch(y.currentStep){case"idle":{const g=dt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),R=Us({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),E={method:"POST",url:i,headers:g,body:R};n({currentStep:"request_without_token",serverUrl:i,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_without_token":if(!y.serverUrl)throw new Error("No server URL available");try{const g=await H(y.serverUrl,{method:"POST",headers:dt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),body:JSON.stringify(Us({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const F=E[E.length-1];F.response=R,F.duration=Date.now()-(F.timestamp||Date.now())}const P=vs({status:g.status,statusText:g.statusText,wwwAuthenticateHeader:g.headers["www-authenticate"],serverMessage:g.body?.error?.message});if(P.kind==="challenged"){const F=g.headers["www-authenticate"],B=ur(F),D=Du(B.scope);let G=F?ne(y,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:F,...D&&D.length>0?{scope:D.join(" ")}:{},"Received from":y.serverUrl||"Unknown"}):y.infoLogs;P.specCompliant||(G=va(y,G,"received_401_unauthorized",R)),n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:F||void 0,challengedScopes:D,lastResponse:R,httpHistory:E,infoLogs:G,isInitiatingAuth:!1})}else if(P.kind==="anonymous_allowed"){const F=ne(y,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,lastResponse:R,httpHistory:E,infoLogs:F,isInitiatingAuth:!1})}else throw n({lastResponse:R,httpHistory:E}),new zr(P.message,g.status)}catch(g){throw g instanceof zr?g:new Error(`Failed to request MCP server: ${g instanceof Error?g.message:String(g)}`)}break;case"received_401_unauthorized":{const g=ur(y.wwwAuthenticateHeader);let R=f||g.resource_metadata;if(!R&&y.serverUrl&&(R=Fu(y.serverUrl)),!R)throw new Error("Could not determine resource metadata URL");const E={method:"GET",url:R,headers:dt(p,{})};n({currentStep:"request_resource_metadata",resourceMetadataUrl:R,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_resource_metadata":if(!y.serverUrl)throw new Error("No server URL available");const K=[...y.httpHistory||[]];let le=K.length>0&&K[K.length-1]?.step==="request_resource_metadata"&&!K[K.length-1]?.response?K.pop():void 0;const de=[],Ce=async(g,R={})=>{const E=typeof g=="string"?g:g.toString(),P=Nu(i,E,p,Pr(R.headers)),F=le?{...le,timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}};le=void 0,de.push(F);try{const B=await H(E,{method:R.method||"GET",headers:P,body:R.body});F.response={status:B.status,statusText:B.statusText,headers:B.headers,body:B.body},F.duration=Date.now()-F.timestamp;const D={status:B.status,statusText:B.statusText,headers:B.headers},G=typeof B.body=="string"?B.body:JSON.stringify(B.body??{});return new Response(G,D)}catch(B){throw F.error=Tt(B),F.duration=Date.now()-F.timestamp,B}};try{const g=(f||ur(y.wwwAuthenticateHeader).resource_metadata)&&y.resourceMetadataUrl?{resourceMetadataUrl:y.resourceMetadataUrl}:void 0,R=await ca(y.serverUrl,g,Ce),E=[...K,...de],P=de[de.length-1],F=zu({authorizationServers:R.authorization_servers,fallbackServerUrl:i,protocolVersion:"2026-07-28"}),B=F.authorizationServerUrl;if(F.error&&T!=="observe"){n({resourceMetadata:R,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,error:F.error,isInitiatingAuth:!1});return}let D=y.infoLogs??[];F.error&&(D=ne({...k(),infoLogs:D},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:F.error,"Using instead":B}));const G=ju({state:y,fallbackServerUrl:i,prmResource:R.resource,enforcement:S,infoLogs:D}),J=G.resourceIndicator;D=G.infoLogs,n({currentStep:"received_resource_metadata",resourceMetadata:R,resourceIndicator:J,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,authorizationServerUrl:B,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,infoLogs:D,isInitiatingAuth:!1})}catch(g){const R=gn([...K,...de],Tt(g));throw n({lastResponse:de[de.length-1]?.response,httpHistory:R}),new Error(aa(g))}break;case"received_resource_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const Re={method:"GET",url:Pp(y.authorizationServerUrl)[0],headers:ct(p,{})};n({currentStep:"request_authorization_server_metadata",lastRequest:Re,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:Re}],isInitiatingAuth:!1}),V(50);return;case"request_authorization_server_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const _e=Pp(y.authorizationServerUrl);let ve=null;const Je=[];let Xe={},Pe=null;for(const g of _e)try{const R=ct(p,{}),E=[...y.httpHistory||[]];E.length>0&&(E[E.length-1].request={method:"GET",url:g,headers:R}),n({lastRequest:{method:"GET",url:g,headers:R},httpHistory:E});const P=await H(g,{method:"GET",headers:ct(p,{})});if(P.ok){ve=P.body,Xe=P.headers,Pe=P,ve||Je.push({url:g,status:P.status});break}Je.push({url:g,status:P.status})}catch(R){Je.push({url:g,error:R});continue}if(!ve||!Pe)throw new Error(qu(Je));if(!ve.issuer)throw new Error(ma);if(ve.issuer!==y.authorizationServerUrl){const g=hO({advertisedIssuer:ve.issuer,discoveryUrl:y.authorizationServerUrl,tokenEndpoint:ve.token_endpoint,registrationEndpoint:ve.registration_endpoint,allowPathScopedIssuer:w});if(!g.accepted)throw new Error(`Authorization server metadata \`issuer\` does not match the authorization server URL it was discovered from (expected "${y.authorizationServerUrl}", got "${ve.issuer}"). RFC 8414 §3.3 requires an exact match; refusing to continue.`+g.hint)}if(!ve.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!ve.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!ve.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const z={status:Pe.status,statusText:Pe.statusText,headers:Xe,body:ve},se=[...y.httpHistory||[]];if(se.length>0){const g=se[se.length-1];g.response=z,g.duration=Date.now()-(g.timestamp||Date.now())}const ae=ve.code_challenge_methods_supported||[],he=L_(ae,"2026-07-28"),Oe=typeof ve.client_id_metadata_document_supported=="boolean"?ve.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)";let we=ne(k(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":Oe});if(ve.issuer!==y.authorizationServerUrl&&(we=ne({...k(),infoLogs:we},"received_authorization_server_metadata","path-scoped-issuer","Path-scoped authorization server",{"Discovery URL":y.authorizationServerUrl,"Advertised issuer":ve.issuer,Note:'The advertised issuer is the same-origin root of the discovery URL. Accepted because "Path-scoped authorization server" is enabled for this server; strict RFC 8414 §3.3 conformance requires an exact issuer match, and strict MCP clients may refuse to connect.'},{level:"warning"})),he){if(_||T!=="observe"){n({lastResponse:z,httpHistory:se,infoLogs:we,error:he,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",ae),n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!y.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(I==="cimd"){if(y.authorizationServerMetadata.client_id_metadata_document_supported!==!0){n({error:"The authorization server does not support Client ID Metadata Documents (client_id_metadata_document_supported is not advertised in AS metadata). Try using 'dcr' or 'preregistered' registration strategy instead.",isInitiatingAuth:!1});return}n({currentStep:"cimd_prepare",clientId:ee,isInitiatingAuth:!1}),V(800);return}else if(I==="preregistered"){const{clientId:g,clientSecret:R}=await l?.({serverName:s,serverUrl:i})??{};if(!g){n({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const E=oe(R),P={"Client ID":g,"Client Secret":R||m?"Configured":"Not provided (public client)","Token Auth Method":E,Note:"Using pre-registered client credentials from server config (skipped DCR)"},F=ne(k(),"received_client_credentials","dcr","Pre-registered Client",P);n({currentStep:"received_client_credentials",clientId:g,clientSecret:R||void 0,tokenEndpointAuthMethod:E,infoLogs:F,isInitiatingAuth:!1})}else if(y.authorizationServerMetadata.registration_endpoint){const g=y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported,R=jr(C,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:g}),E=ba({registrationEndpoint:y.authorizationServerMetadata.registration_endpoint,redirectUri:M,dynamicRegistrationDefaults:{...X,application_type:X.application_type??WP(X.redirect_uris??[M])},scope:R,customHeaders:p}),P=ne(k(),"request_client_registration","dcr-deprecated","DCR is deprecated in 2026-07-28",{Note:"Dynamic Client Registration (RFC 7591) is deprecated as a registration mechanism in 2026-07-28 (PR #2858). It remains a compatibility fallback; prefer CIMD or a pre-registered client where the authorization server supports it."},{level:"warning"});n({currentStep:"request_client_registration",lastRequest:E,lastResponse:void 0,infoLogs:P,httpHistory:[...y.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}else{if(_){n({error:ya,isInitiatingAuth:!1});return}const g=await $("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!g){n({error:_a,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:g.clientId,clientSecret:g.clientSecret,tokenEndpointAuthMethod:g.tokenEndpointAuthMethod,infoLogs:g.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!y.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!y.lastRequest?.body)throw new Error("No client metadata in request");{const g=await wa({request:y.lastRequest,requestExecutor:a,httpHistory:y.httpHistory});if(g.status!=="registered"){if(n({lastResponse:g.response,httpHistory:g.httpHistory,error:g.error,isInitiatingAuth:!1}),_)return;const E=await $(g.fallbackNote);if(!E){n({error:g.errorWithFallbackHint,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpointAuthMethod:E.tokenEndpointAuthMethod,infoLogs:E.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(g.missingClientId){n({lastResponse:g.response,httpHistory:g.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const R=ne(k(),"received_client_credentials","dcr","Dynamic Client Registration",g.infoLogData);n({currentStep:"received_client_credentials",clientId:g.credentials.clientId,clientSecret:g.credentials.clientSecret,tokenEndpointAuthMethod:ua(g.clientInfo),lastResponse:g.response,httpHistory:g.httpHistory,infoLogs:R,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":n({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),V(800);return;case"cimd_fetch_request":try{const g={method:"GET",url:ee,headers:Pr(void 0)},R=Date.now(),E=await H(ee,{method:"GET"});if(!E.ok)throw new Error(`CIMD endpoint returned HTTP ${E.status}`);const P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body};n({currentStep:"cimd_metadata_response",lastRequest:g,lastResponse:P,httpHistory:[...y.httpHistory||[],{step:"cimd_fetch_request",timestamp:R,duration:Date.now()-R,request:g,response:P}],isInitiatingAuth:!1}),V(800);return}catch(g){n({error:`CIMD metadata fetch failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const g=y.lastResponse?.body;if(!g||typeof g!="object")throw new Error("CIMD metadata document was not available");if(g.client_id!==ee)throw new Error("CIMD client_id mismatch");const R=y.authorizationServerMetadata?.client_id_metadata_document_supported,E={"Client ID":ee,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":g.client_name||"MCPJam","Redirect URIs":g.redirect_uris||[],"Token Auth Method":g.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};R?E["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":E["Server Support"]="⚠ Not advertised (attempting anyway)";const P=ne(k(),"received_client_credentials","cimd","Client ID Metadata Document",E);n({currentStep:"received_client_credentials",clientId:ee,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:P,isInitiatingAuth:!1})}catch(g){n({error:`CIMD validation failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Se=qr(43),pe=await ga(Se),me=ne(k(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:pe,method:"S256",...q?{resource:ie()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});n({currentStep:"generate_pkce_parameters",codeVerifier:Se,codeChallenge:pe,codeChallengeMethod:"S256",...q?{}:{resourceIndicatorSuppressed:!0},state:qr(16),recordedIssuer:k().authorizationServerMetadata?.issuer,infoLogs:me,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!y.authorizationServerMetadata?.authorization_endpoint||!y.clientId)throw new Error("Missing authorization endpoint or client ID");const Ee=new URL(y.authorizationServerMetadata.authorization_endpoint);Ee.searchParams.set("response_type","code"),Ee.searchParams.set("client_id",y.clientId),Ee.searchParams.set("redirect_uri",M),Ee.searchParams.set("code_challenge",y.codeChallenge||""),Ee.searchParams.set("code_challenge_method","S256"),Ee.searchParams.set("state",y.state||""),q&&Ee.searchParams.set("resource",ie());const Ge=jr(C,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported});Ge&&Ee.searchParams.set("scope",Ge);const U=ne(k(),"authorization_request","auth-url","Authorization URL",{url:Ee.toString()});n({currentStep:"authorization_request",authorizationUrl:Ee.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,requestedScopes:Ge?Ge.split(/\s+/).filter(Boolean):void 0,infoLogs:U,isInitiatingAuth:!1});break;case"authorization_request":n({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!y.authorizationCode||y.authorizationCode.trim()===""){n({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const g=pO({recordedIssuer:y.recordedIssuer,returnedIss:y.authorizationResponseIss,issParameterSupported:void 0,enforcePresentIssMismatch:!0});if(!g.ok){n({error:g.reason,isInitiatingAuth:!1});return}const R=Ur({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Hr(C,y.tokenEndpointAuthMethod)}),E={grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:M,...R.bodyParams};y.codeVerifier&&(E.code_verifier=y.codeVerifier),q&&(E.resource=ie());const P={method:"POST",url:y.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...R.headers},body:E};n({currentStep:"token_request",lastRequest:P,lastResponse:void 0,...q?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...y.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:P}],isInitiatingAuth:!1}),V(50);return}case"token_request":if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!y.authorizationCode)throw new Error("Missing authorization code");if(!y.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const g=Ur({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:Hr(C,y.tokenEndpointAuthMethod)}),R=new URLSearchParams({grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:M,code_verifier:y.codeVerifier||"",...g.bodyParams});q&&R.set("resource",ie());const E=await H(y.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...ct(p,{"Content-Type":"application/x-www-form-urlencoded"}),...g.headers},body:R.toString()}),P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body},F=[...y.httpHistory||[]];if(F.length>0){const G=F[F.length-1];G.response=P,G.duration=Date.now()-(G.timestamp||Date.now())}if(!E.ok){n({lastResponse:P,httpHistory:F,authorizationCode:void 0,error:ha(E),isInitiatingAuth:!1});return}const B=E.body;let D=(k().infoLogs||[]).filter(G=>G.id!=="auth-code"&&G.id!=="oauth-tokens"&&G.id!=="token");if(y.authorizationCode&&(D=[...D,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:y.authorizationCode},timestamp:Date.now()}]),B.access_token){const G={access_token:B.access_token};B.refresh_token&&(G.refresh_token=B.refresh_token),D=[...D,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:G,timestamp:Date.now()}]}if(B.access_token){const G=Fr(B.access_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`);const qt={...J};if(J.aud){const Gr=y.serverUrl,hi=(Array.isArray(J.aud)?J.aud:[J.aud]).some(Ta=>Ta===Gr);qt._validation={expected_audience:Gr,audience_matches:hi,note:hi?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else qt._validation={note:"⚠ No audience claim found - server should validate token binding"};D=[...D,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:qt,timestamp:Date.now()}]}}if(B.id_token){const G=Fr(B.id_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`),J.auth_time&&(J.auth_time=`${J.auth_time} (${De(J.auth_time)})`),J._note="OIDC ID Token - Used for user identity verification",D=[...D,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:J,timestamp:Date.now()}]}}n({currentStep:"received_access_token",accessToken:B.access_token,refreshToken:B.refresh_token,tokenType:B.token_type||"Bearer",expiresIn:B.expires_in,lastResponse:P,httpHistory:F,infoLogs:D,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Token exchange failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");const W={method:"POST",url:y.serverUrl,headers:{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"},body:Us({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},Y=ne(k(),"authenticated_mcp_request","authenticated-verify","Authenticated MCP Verify Request (tools/list)",{Request:"Stateless tools/list with OAuth bearer token","Protocol Version":"2026-07-28",Client:"MCPJam Inspector v1.0.0",Endpoint:y.serverUrl});n({currentStep:"authenticated_mcp_request",lastRequest:W,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:W}],infoLogs:Y,isInitiatingAuth:!1}),V(50);return;case"authenticated_mcp_request":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");try{const g=await H(y.serverUrl,{method:"POST",headers:dt(p,{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),body:JSON.stringify(Us({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const G=E[E.length-1];G.response=R,G.duration=Date.now()-(G.timestamp||Date.now())}if(!g.ok){n({lastResponse:R,httpHistory:E,error:da(g),isInitiatingAuth:!1});return}let P=k().infoLogs||[];const F=g.headers["content-type"]||"",B=F.includes("text/event-stream");let D=null;if(B&&g.body?.transport==="sse"?D=g.body.mcpResponse:D=g.body,B&&D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(B)P=ne(k(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":F,Note:"Server returned streaming response. tools/list verify response delivered via SSE stream.",Events:g.body?.events?`${g.body.events.length} events parsed`:"No events parsed"});else if(D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(D?.result){const G=Array.isArray(D.result.tools)?D.result.tools.length:void 0;P=ne(k(),"authenticated_mcp_request","mcp-token-verified","Access token verified (tools/list)",{Transport:"Streamable HTTP","Response Format":"JSON",Result:"Bearer token accepted; tools/list succeeded",...G!==void 0?{"Tools listed":G}:{}})}n({currentStep:"complete",lastResponse:R,httpHistory:E,infoLogs:P,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Authenticated MCP request failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"complete":n({isInitiatingAuth:!1});break;default:n({isInitiatingAuth:!1})}}catch(K){const le=k(),de=Tt(K),Ce=ne(le,le.currentStep,`error-${le.currentStep}-${Date.now()}`,"Step failed",{step:le.currentStep,request:le.lastRequest,response:le.lastResponse,error:de},{level:"error",error:de}),Re=gn(le.httpHistory,de),_e={error:de.message,infoLogs:Ce,isInitiatingAuth:!1};Re&&(_e.httpHistory=Re),n(_e)}},startGuidedFlow:async()=>{n({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{n(pa())}};return Q};function bD({protocolVersion:e,registrationStrategy:t,flowState:r}){switch(e){case"2025-03-26":return KP(r,t==="cimd"?"dcr":t);case"2025-06-18":return tO(r,t==="cimd"?"dcr":t);case"2025-11-25":return iO(r,t);case"2026-07-28":return lO(r,t);default:throw new Error(`Unknown protocol version: ${e}`)}}function Ra(e){return e.replace(/^\[|\]$/g,"").trim().toLowerCase().replace(/\.+$/,"")}function z_(e){const t=e.split(".").map(s=>parseInt(s,10));if(t.length!==4||t.some(s=>!Number.isInteger(s)||s<0||s>255))return!0;const[r,n,i]=t;return r===0||r===10||r===100&&n>=64&&n<=127||r===127||r===169&&n===254||r===172&&n>=16&&n<=31||r===192&&n===0&&i===0||r===192&&n===0&&i===2||r===192&&n===88&&i===99||r===192&&n===168||r===198&&(n===18||n===19)||r===198&&n===51&&i===100||r===203&&n===0&&i===113||r>=224&&r<=239||r>=240}function U_(e){let t=e.trim().toLowerCase().split("%")[0];t.startsWith("[")&&t.endsWith("]")&&(t=t.slice(1,-1));const r=t.match(/^(.*:)(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);if(r){const o=[r[2],r[3],r[4],r[5]].map(a=>parseInt(a,10));if(o.some(a=>a<0||a>255))return null;t=`${r[1]}${(o[0]<<8|o[1]).toString(16)}:${(o[2]<<8|o[3]).toString(16)}`}const n=o=>{if(o==="")return[];const a=[];for(const c of o.split(":")){if(!/^[0-9a-f]{1,4}$/.test(c))return null;a.push(parseInt(c,16))}return a},i=t.split("::");if(i.length>2)return null;if(i.length===2){const o=n(i[0]),a=n(i[1]);if(!o||!a)return null;const c=8-o.length-a.length;return c<1?null:[...o,...Array(c).fill(0),...a]}const s=n(t);return s&&s.length===8?s:null}function Lp(e,t){return z_(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function vO(e){const t=U_(e);if(!t||t.slice(0,6).every(n=>n===0)&&t[6]===0&&(t[7]===0||t[7]===1))return!0;const r=t[0]>>8;return(r&254)===252||t[0]>=65152&&t[0]<=65215||r===255||t[0]===8193&&t[1]===3512||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0?!0:t[0]===100&&t[1]===65435?t[2]===1?!0:Lp(t[6],t[7]):t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?Lp(t[6],t[7]):!1}function gO(e){const t=Ra(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?z_(t):t.includes(":")?vO(t):!1}function mO(e){const t=Ra(e);return t==="localhost"||t.endsWith(".localhost")?!0:gO(t)}function _O(e){const t=Ra(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?F_(t):t.includes(":")?yO(t):!1}function F_(e){const t=e.split(".").map(o=>parseInt(o,10));if(t.length!==4||t.some(o=>!Number.isInteger(o)||o<0||o>255))return!0;const[r,n,i,s]=t;return r===0||r===169&&n===254||r===100&&n===100&&i===100&&s===200||r>=224&&r<=239||r>=240}function Dp(e,t){return F_(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function yO(e){const t=U_(e);return t?t.slice(0,6).every(r=>r===0)&&t[6]===0&&(t[7]===0||t[7]===1)?t[7]===0:t[0]>=65152&&t[0]<=65215||t[0]>>8===255||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0||t[0]===64768&&t[1]===3778&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0&&t[6]===0&&t[7]===596?!0:t[0]===100&&t[1]===65435||t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?Dp(t[6],t[7]):!1:!0}var bO=new Set(["metadata.google.internal","metadata.goog"]);function wO(e){const t=Ra(e);return bO.has(t)?!0:_O(t)}function q_(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase(),r=t.match(/^::(?:ffff:)?(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);if(r)return parseInt(r[1],10)===127;const n=t.match(/^::(?:ffff:)?([0-9a-f]{1,4}):[0-9a-f]{1,4}$/);return n?parseInt(n[1],16)>>8===127:!1}function wD(e){if(!e)return!1;try{const t=new URL(e).hostname;return ka(t)||q_(t)}catch{return!1}}var ki=class extends Error{url;reason;constructor(e,t,r){super(r),this.name="OAuthOutboundUrlBlockedError",this.url=e,this.reason=t}};function SO(e,t={}){let r;try{r=new URL(e)}catch{throw new ki(e,"invalid-url","Outbound OAuth fetch URL is not a valid absolute URL")}if(r.protocol!=="https:"&&r.protocol!=="http:")throw new ki(e,"invalid-scheme",`Outbound OAuth fetch must be http(s); got "${r.protocol}"`);const n=r.hostname;if(wO(n))throw new ki(e,"private-host",`Refusing outbound OAuth fetch to link-local or cloud-metadata host "${n}"`);if(t.allowPrivateNetwork===!0)return r;if(ka(n)||q_(n)){if(t.allowLoopback===!0)return r;throw new ki(e,"private-host",`Refusing outbound OAuth fetch to loopback host "${n}" (no loopback opt-in)`)}if(mO(n))throw new ki(e,"private-host",`Refusing outbound OAuth fetch to private/reserved host "${n}"`);return r}var EO=class extends Error{field;constructor(e,t){super(`OAuth response from ${t} carried a redacted \`${e}\`. Trace redaction was applied to data the OAuth flow consumes; a redaction sentinel is a non-empty string, so it would be sent upstream as a credential and rejected as invalid. Redaction belongs to the trace projection layer only.`),this.name="OAuthRedactedCredentialError",this.field=e}},kO=["access_token","refresh_token","id_token","client_secret"],RO=[/^\[redacted\]$/,/^[\s\S]{4}\.\.\.\[redacted\]\.\.\.[\s\S]{2}$/];function AO(e){try{const t=new URL(e.url);return`${t.origin}${t.pathname}`}catch{return"the authorization server"}}function IO(e,t){const r=e?.body;if(!r||typeof r!="object"||Array.isArray(r))return e;const n=r;for(const i of kO){const s=n[i];if(typeof s=="string"&&RO.some(o=>o.test(s)))throw new EO(i,AO(t))}return e}function TO(e){const{protocolVersion:t,allowLoopbackMetadataFetch:r,allowPrivateMetadataFetch:n,...i}=e,s=r??!1,o=n??!1,c={...i,requestExecutor:async l=>(SO(l.url,{allowLoopback:s,allowPrivateNetwork:o}),IO(await i.requestExecutor(l),l)),customHeaders:JP(i.customHeaders,i.emulation)};switch(t){case"2025-03-26":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-03-26 protocol. Use 'dcr' or 'preregistered' instead.");return XP(c);case"2025-06-18":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-06-18 protocol. Use 'dcr' or 'preregistered' instead.");return rO(c);case"2025-11-25":return sO(c);case"2026-07-28":return fO(c);default:throw new Error(`Unknown protocol version: ${t}`)}}function SD(e){switch(e){case"2025-03-26":return"dcr";case"2025-06-18":return"dcr";case"2025-11-25":return"cimd";case"2026-07-28":return"cimd";default:return"dcr"}}function ED(e){switch(e){case"2025-03-26":return["dcr","preregistered"];case"2025-06-18":return["dcr","preregistered"];case"2025-11-25":return["cimd","dcr","preregistered"];case"2026-07-28":return["cimd","dcr","preregistered"];default:return["dcr","preregistered"]}}var kD={"2025-03-26":{label:zs("2025-03-26"),description:"Original MCP OAuth specification with direct discovery",features:["Dynamic Client Registration (DCR) SHOULD be supported","Direct RFC8414 discovery from MCP server base URL","Fallback to default endpoints (/authorize, /token, /register)","PKCE is REQUIRED for all clients","No Protected Resource Metadata (RFC9728)"]},"2025-06-18":{label:zs("2025-06-18"),description:"MCP OAuth specification with resource metadata",features:["Dynamic Client Registration (DCR) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 discovery ONLY (no OIDC) with root fallback","PKCE recommended but not strictly enforced"]},"2025-11-25":{label:zs("2025-11-25"),description:"MCP OAuth specification with CIMD support",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","Enhanced security with URL-based client IDs"]},"2026-07-28":{label:zs("2026-07-28"),description:"Newest MCP OAuth specification: 2025-11-25 discovery plus OIDC application_type",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","SEP-837: OIDC application_type sent on Dynamic Client Registration"]}},$O=["idle","request_without_token","received_401_unauthorized","discovery_start","request_resource_metadata","received_resource_metadata","request_authorization_server_metadata","received_authorization_server_metadata","cimd_prepare","cimd_fetch_request","cimd_metadata_response","request_client_registration","received_client_credentials","generate_pkce_parameters","authorization_request","received_authorization_code","token_request","received_access_token","authenticated_mcp_request","complete","verify_list_tools","verify_call_tool"],CO={idle:{title:"Idle",summary:"The OAuth flow is ready to start.",teachableMoments:["Review your server selection and OAuth configuration before starting."]},request_without_token:{title:"Initial MCP Request",summary:"The client sends an unauthenticated initialize request to discover whether OAuth is required.",teachableMoments:["OAuth flows usually begin with a protected resource request that deliberately lacks credentials.","The response determines which discovery path the client must follow."]},received_401_unauthorized:{title:"401 Unauthorized Received",summary:"The MCP server indicates OAuth is required and often provides discovery hints in WWW-Authenticate.",teachableMoments:["Look for the resource metadata URL or realm in the header to understand where discovery begins."],tips:["If you get 200 instead, the server may allow optional OAuth or anonymous access."]},discovery_start:{title:"Start Discovery",summary:"The client derives authorization server endpoints from the MCP server URL.",teachableMoments:["Legacy servers rely on RFC8414 discovery directly from the MCP base URL.","Understanding how fallback URLs are constructed helps debug missing metadata issues."]},request_resource_metadata:{title:"Request Resource Metadata",summary:"The client requests RFC9728 resource metadata to learn which authorization server to use.",teachableMoments:["Protected resource metadata links the resource to one or more authorization servers.","If this step fails, check the MCP server's well-known configuration and headers."]},received_resource_metadata:{title:"Resource Metadata Received",summary:"The response describes supported authorization servers, scopes, and bearer method details.",teachableMoments:["Validate that the authorization server URL looks correct for the environment you're targeting."]},request_authorization_server_metadata:{title:"Request Authorization Server Metadata",summary:"The client requests the authorization server's well-known metadata endpoint (RFC8414 or OIDC).",teachableMoments:["Different protocol versions prioritize different discovery strategies (path insertion, appending, etc.).","Failure here often points to misconfigured issuer URLs or CORS/proxy issues."]},received_authorization_server_metadata:{title:"Authorization Server Metadata Received",summary:"Inspector validates the authorization, token, and optional registration endpoints.",teachableMoments:["Confirm PKCE methods include S256 for modern flows.","Check the available scopes and grant types to ensure the server supports what you need."]},cimd_prepare:{title:"Prepare CIMD",summary:"Draft protocol: the client prepares to use a Client ID Metadata Document (CIMD).",teachableMoments:["CIMD replaces static client IDs with an HTTPS URL that hosts client metadata."]},cimd_fetch_request:{title:"Authorization Server Fetches CIMD",summary:"The authorization server fetches the client's metadata document over HTTPS.",teachableMoments:["Monitor this step to diagnose TLS or hosting issues with your metadata document."]},cimd_metadata_response:{title:"CIMD Validated",summary:"The client confirms the authorization server successfully read the client metadata document.",teachableMoments:["Ensure redirect URIs declared in the document match the environment you're testing."]},request_client_registration:{title:"Request Dynamic Client Registration",summary:"The client submits metadata to register a public client with the authorization server.",teachableMoments:["Dynamic registration is optional in draft flows but required in earlier specs unless you pre-register.","Watch for HTTP 4xx responses that indicate validation failures."]},received_client_credentials:{title:"Client Credentials Received",summary:"The client stores client_id (and optionally client_secret) for the remainder of the flow.",teachableMoments:["Keep an eye on whether the server returned a secret; public clients should use PKCE instead."]},generate_pkce_parameters:{title:"Generate PKCE Parameters",summary:"The client creates a code verifier and challenge to protect the authorization code exchange.",teachableMoments:["PKCE S256 is required in draft specs and strongly recommended everywhere else."]},authorization_request:{title:"Authorization Request Ready",summary:"The client composes the authorization URL and waits for the user to approve access.",teachableMoments:["Inspect the URL to ensure scopes and redirect URI are what you expect."]},received_authorization_code:{title:"Authorization Code Received",summary:"The user completed consent and the client captured the returned authorization code.",teachableMoments:["State mismatches here usually indicate multiple concurrent authorizations or stale popups."]},token_request:{title:"Request Tokens with Authorization Code",summary:"The client calls the token endpoint with the authorization code and PKCE verifier.",teachableMoments:["Token endpoint errors often reveal scope or client configuration problems."]},received_access_token:{title:"Tokens Received",summary:"The client stores access and refresh tokens for subsequent authenticated MCP requests.",teachableMoments:["Check the token type and expiry to confirm the server honored offline access or refresh tokens."]},authenticated_mcp_request:{title:"Authenticated MCP Request",summary:"The client retries the MCP initialize call with the freshly issued access token.",teachableMoments:["Use this step to validate that MCP servers accept OAuth tokens and return capabilities."]},complete:{title:"Flow Complete",summary:"The client verified the server with OAuth credentials and recorded the final response.",teachableMoments:["Continue exploring with authenticated requests or reset to run the flow again."]},verify_list_tools:{title:"Verify: List Tools",summary:"Connect to the MCP server with the obtained token and list available tools.",teachableMoments:["This step confirms the OAuth token is actually usable for MCP operations."]},verify_call_tool:{title:"Verify: Call Tool",summary:"Execute a tool on the MCP server to confirm end-to-end functionality.",teachableMoments:["Calling a tool validates not just authentication but also authorization scopes."]}};function Np(e){return CO[e]??{title:e,summary:"No additional information available for this step."}}function _r(e){const t=$O.indexOf(e);return t===-1?Number.MAX_SAFE_INTEGER:t}function PO(e){return JSON.parse(JSON.stringify(e))}function OO(e){return{...e,request:{...e.request,url:Ou(e.request.url),headers:mp(e.request.headers),body:Jt(e.request.body)},...e.response?{response:{...e.response,headers:mp(e.response.headers),body:Jt(e.response.body)}}:{},...e.error?{error:{...e.error,...e.error.message?{message:Cr(e.error.message)}:{},details:Jt(e.error.details)}}:{}}}function xO(...e){const t=e.filter(r=>r!=null);if(t.length!==0)return Math.max(...t)}function MO(){return{syntheticStepTimestamps:{},lastSyntheticTimestamp:0}}function LO(e,t,r){if(!e)return r;const n=e.syntheticStepTimestamps[t];return typeof n=="number"?n:r}function zp(e,t,r,n){const i=LO(t,r,n),s=e.get(r);if(s)return s.startedAt=Math.min(s.startedAt,i),s.completedAt=Math.max(s.completedAt??i,n),s;const o={step:r,startedAt:i,completedAt:n};return e.set(r,o),o}function Yr(e,t,r,n,i,s){if(!n||e.has(r))return;let o=Date.now();t&&(o=Math.max(o,t.lastSyntheticTimestamp+1),t.syntheticStepTimestamps[r]=o,t.lastSyntheticTimestamp=o);const a=i==null?void 0:s?Jt(i):JSON.parse(JSON.stringify(i));e.set(r,{step:r,startedAt:o,completedAt:o,details:a})}function DO(e,t){if(e!==t.currentStep)return!1;switch(e){case"authorization_request":return!!t.authorizationUrl;case"received_authorization_code":return!!t.authorizationCode;case"received_access_token":return!!t.accessToken;case"complete":return t.currentStep==="complete";default:return!1}}function NO(e){if(!(!e||e.status<400))return x_(e.body)??`HTTP ${e.status} ${e.statusText}`}function zO(e){if(e.error?.message)return e.error.message;if(e.step==="request_client_registration")return NO(e.response)}function Up(e){return!e.error||!e.clientId||_r(e.currentStep)<=_r("request_client_registration")?!1:e.error.startsWith("Dynamic Client Registration failed")||e.error.startsWith("Client registration failed:")}function UO(e){const{state:t,context:r,sanitize:n=!0}=e,i=t.error?n?Cr(t.error):t.error:void 0,s={version:1,currentStep:t.currentStep,steps:[],httpHistory:(t.httpHistory??[]).map(u=>n?OO(u):PO(u)),...i?{error:i}:{}},o=_r(t.currentStep),a=new Map;for(const u of t.httpHistory??[]){const h=zp(a,r,u.step,u.timestamp);h.details||(h.details={request:n?Jt(u.request):u.request,...u.response?{response:n?Jt(u.response):u.response}:{}});const d=zO(u);d&&(h.error=Pl(n?Cr(d):d.slice(0,500)))}for(const u of t.infoLogs??[]){const h=zp(a,r,u.step,u.timestamp);h.message=u.label;const d=n?Jt(u.data):u.data;d&&typeof d=="object"&&d!==null&&!Array.isArray(d)&&(h.details=d),u.error?.message&&(h.error=n?Cr(u.error.message):u.error.message)}const c=Math.max(Date.now(),...(t.httpHistory??[]).map(u=>u.timestamp),...(t.infoLogs??[]).map(u=>u.timestamp),r?.lastSyntheticTimestamp??0);r&&(r.lastSyntheticTimestamp=Math.max(r.lastSyntheticTimestamp,c)),Yr(a,r,"received_client_credentials",!!t.clientId,{clientId:t.clientId},n),Yr(a,r,"generate_pkce_parameters",!!t.codeVerifier,{codeVerifier:t.codeVerifier},n),Yr(a,r,"authorization_request",!!t.authorizationUrl,{authorizationUrl:t.authorizationUrl},n),Yr(a,r,"received_authorization_code",!!t.authorizationCode,t.authorizationCode?{code:t.authorizationCode}:void 0,n),Yr(a,r,"received_access_token",!!t.accessToken,{tokenType:t.tokenType,expiresIn:t.expiresIn},n),Yr(a,r,"complete",t.currentStep==="complete",void 0,n);const l=a.get("request_client_registration");if(l?.error&&_r(t.currentStep)>_r("request_client_registration")&&t.clientId&&(l.recovered=!0,l.recoveredAt=xO(l.recoveredAt,l.completedAt,a.get("received_client_credentials")?.startedAt),l.recoveryMessage="Using pre-registered client credentials after registration failed."),t.error&&!Up(t)&&!a.has(t.currentStep)){Yr(a,r,t.currentStep,!0,void 0,n);const u=a.get(t.currentStep);u&&(u.error=i)}return s.steps=Array.from(a.values()).sort((u,h)=>u.startedAt-h.startedAt||_r(u.step)-_r(h.step)).map(u=>{const h=_r(u.step),d=u.step===t.currentStep&&!!t.error&&!Up(t),p=u.error??(d?i:void 0),f=u.recovered?"success":p?"error":h<o||t.currentStep==="complete"||DO(u.step,t)?"success":u.step===t.currentStep?"pending":"success";return{step:u.step,title:Np(u.step).title,status:f,message:u.message??Np(u.step).summary,...p?{error:p}:{},...u.details?{details:u.details}:{},...u.recovered?{recovered:!0}:{},...u.recoveredAt?{recoveredAt:u.recoveredAt}:{},...u.recoveryMessage?{recoveryMessage:u.recoveryMessage}:{},startedAt:u.startedAt,completedAt:f==="pending"?void 0:u.completedAt}}),s}function Fs(e){return{message:e instanceof Error?e.message:String(e)}}async function RD(e){const{maxSteps:t=40,onAuthorizationRequest:r,onTraceUpdate:n,getState:i,sanitizeTrace:s=!0,...o}=e;let a=e.state;const c=MO(),l=i??(()=>a),u=(v,m=l(),_=c)=>{n?.({trace:UO({state:m,context:_,sanitize:s}),state:m,reason:v})},h=v=>{a={...a,...v},e.updateState(v),u("state_update",a)},d=TO({...o,getState:l,updateState:h});let p=0;for(;l().currentStep!=="complete"&&p<t;){p+=1;const v=l();if(v.currentStep==="authorization_request"){if(!v.authorizationUrl)return h({error:"Authorization URL was not generated."}),{completed:!1,redirected:!1,state:l(),error:{message:"Authorization URL was not generated."}};if(!r)return h({error:"Authorization request requires an authorization handler."}),{completed:!1,redirected:!1,authorizationUrl:v.authorizationUrl,state:l(),error:{message:"Authorization request requires an authorization handler."}};try{const w=await r({authorizationUrl:v.authorizationUrl,state:v});if(w.type==="redirect")return u("redirect"),{completed:!1,redirected:!0,authorizationUrl:v.authorizationUrl,state:l()};h({currentStep:"received_authorization_code",authorizationCode:w.authorizationCode,error:void 0});continue}catch(w){return h({error:Fs(w).message}),{completed:!1,redirected:!1,authorizationUrl:v.authorizationUrl,state:l(),error:Fs(w)}}}const m=v.currentStep;try{await d.proceedToNextStep()}catch(w){return l().error?u("error"):h({error:Fs(w).message}),{completed:!1,redirected:!1,state:l(),error:Fs(w)}}const _=l();if(_.currentStep===m)return _.error?u("error",_):h({error:`Step ${m} did not advance.`}),{completed:!1,redirected:!1,state:l(),error:{message:l().error||`Step ${m} did not advance.`}}}const f=l();return p>=t&&f.currentStep!=="complete"?(h({error:"OAuth login exceeded its step guard."}),{completed:!1,redirected:!1,state:l(),error:{message:"OAuth login exceeded its step guard."}}):(u(f.currentStep==="complete"?"complete":"state_update"),{completed:f.currentStep==="complete",redirected:!1,authorizationUrl:f.authorizationUrl,state:f,...f.error?{error:{message:f.error}}:{}})}var AD=["server-initialize","ping","logging-set-level","completion-complete","capabilities-consistent","tools-list","tools-input-schemas-valid","tools-x-mcp-header-declarations-valid","prompts-list","resources-list","protocol-invalid-method-error","localhost-host-rebinding-rejected","localhost-host-valid-accepted","server-sse-polling-session","server-accepts-multiple-post-streams","server-sse-streams-functional","notification-post-accepted","get-stream-or-405","session-id-visible-ascii","post-response-content-type","modern-client-handshake","modern-server-discover","modern-result-type-present","modern-cacheable-result-hints","modern-cache-hint-coverage","modern-cache-hint-values-valid","modern-cache-scope-stable-across-pages","modern-protocol-version-header-mismatch","modern-method-header-mismatch","modern-name-header-mismatch","modern-unsupported-version-error","modern-missing-method-header-rejected","modern-header-names-case-insensitive","modern-undeclared-capability-error","modern-no-session-id","modern-removed-methods-not-found","modern-resource-not-found-invalid-params","modern-resource-read-no-empty-contents","modern-tool-output-schema-conformant","modern-logs-require-log-level","modern-subscription-ack-precedes-notifications","modern-subscription-filter-and-tagging","modern-subscription-graceful-close","wire-schema-valid"],FO={"2025-03-26":"legacy","2025-06-18":"legacy","2025-11-25":"legacy","2026-07-28":"modern"},ID=Object.keys(FO),TD={"server-initialize":["legacy"],ping:["legacy"],"capabilities-consistent":["legacy","modern"],"server-sse-polling-session":["legacy"],"server-accepts-multiple-post-streams":["legacy"],"server-sse-streams-functional":["legacy"],"notification-post-accepted":["legacy"],"get-stream-or-405":["legacy"],"session-id-visible-ascii":["legacy"],"post-response-content-type":["legacy","modern"],"localhost-host-rebinding-rejected":["legacy"],"localhost-host-valid-accepted":["legacy"],"tools-list":["legacy","modern"],"tools-input-schemas-valid":["legacy","modern"],"tools-x-mcp-header-declarations-valid":["modern"],"prompts-list":["legacy","modern"],"resources-list":["legacy","modern"],"logging-set-level":["legacy","modern"],"completion-complete":["legacy","modern"],"protocol-invalid-method-error":["legacy","modern"],"modern-client-handshake":["modern"],"modern-server-discover":["modern"],"modern-result-type-present":["modern"],"modern-cacheable-result-hints":["modern"],"modern-cache-hint-coverage":["modern"],"modern-cache-hint-values-valid":["modern"],"modern-cache-scope-stable-across-pages":["modern"],"modern-protocol-version-header-mismatch":["modern"],"modern-method-header-mismatch":["modern"],"modern-name-header-mismatch":["modern"],"modern-unsupported-version-error":["modern"],"modern-missing-method-header-rejected":["modern"],"modern-header-names-case-insensitive":["modern"],"modern-undeclared-capability-error":["modern"],"modern-no-session-id":["modern"],"modern-removed-methods-not-found":["modern"],"modern-resource-not-found-invalid-params":["modern"],"modern-resource-read-no-empty-contents":["modern"],"modern-tool-output-schema-conformant":["modern"],"modern-logs-require-log-level":["modern"],"modern-subscription-ack-precedes-notifications":["modern"],"modern-subscription-filter-and-tagging":["modern"],"modern-subscription-graceful-close":["modern"],"wire-schema-valid":["legacy","modern"]};function qO(){return"8.17.0"}var $D=qO();function j_(e,t){if(!t||t.pendingCheckIds.length===0)return{scored:[...e],pending:[]};const r=new Set(t.pendingCheckIds),n=[],i=[];for(const s of e)(r.has(s.id)?i:n).push(s);return{scored:n,pending:i}}var jO=95,H_=5,HO={should:2,may:1};function VO(e){const t=e.reduce((r,n)=>r+HO[n.tier],0);return Math.min(t,H_)}function Hu(e,t,r,n){const i=e.passed+e.failed+e.couldNotRun,s=VO(t);let o=null;if(i>0){const a=jO*e.passed/i,c=H_-s;o=Math.round(a+c),r!=="passed"?o=Math.min(o,94):t.length>0&&(o=Math.min(o,99))}return{score:o,outcome:r,applicable:i,...e,pending:e.pending??0,advisories:t,advicePointsLost:s,...n!==void 0?{protocolVersion:n}:{}}}function Vu(e,t=[],r,n){const{scored:i,pending:s}=j_(e,n),o={passed:i.filter(c=>c.status==="passed").length,failed:i.filter(c=>c.status==="failed").length,couldNotRun:i.filter(Lg).length,notApplicable:i.filter(RE).length,pending:s.length},{outcome:a}=AE(i);return Hu(o,t,a,r)}function Bu(e){const t={passed:Ri(e,a=>a.passed),failed:Ri(e,a=>a.failed),couldNotRun:Ri(e,a=>a.couldNotRun),notApplicable:Ri(e,a=>a.notApplicable),pending:Ri(e,a=>a.pending??0)},r=e.flatMap(a=>a.advisories??[]),n=e.map(a=>a.outcome),i=n.includes("failed")?"failed":n.includes("incomplete")?"incomplete":"passed",s=e.filter(a=>a.applicable>0),o=new Set(s.map(a=>a.protocolVersion));return Hu(t,r,i,s.length>0&&o.size===1?[...o][0]:void 0)}function Ri(e,t){return e.reduce((r,n)=>r+t(n),0)}function CD(e){if(e.score===null)return`not scored — 0 applicable checks (${e.notApplicable} not applicable)`;const t=[`${e.passed}/${e.applicable} applicable checks passed`];e.failed>0&&t.push(`${e.failed} failed`),e.couldNotRun>0&&t.push(`${e.couldNotRun} could not run`),e.advisories.length>0&&t.push(`${e.advisories.length} advisor${e.advisories.length===1?"y":"ies"} (−${e.advicePointsLost})`),(e.pending??0)>0&&t.push(`${e.pending} pending (unscored by this profile)`);const r=e.protocolVersion?` [${e.protocolVersion}]`:"";return`${e.score}/100 — ${t.join(", ")}${r}`}function Fp(e){return Vu(e.checks,(e.readiness??[]).filter(t=>t.informational!==!0).map(t=>({id:t.id,tier:t.specStrength==="MAY"?"may":"should"})),e.protocolVersion,e.profile)}function V_(e,t,r){const{scored:n}=j_(e,r);return Vu(e,n.flatMap(i=>(i.warnings??[]).map((s,o)=>({id:`${i.id}-warning-${o+1}`,tier:"may"}))),t,r)}function qp(e){return V_(e.checks,e.protocolVersion)}function BO(e){return V_(e.checks,e.discovery.protocolVersion,e.profile)}function jp(e){return e.outcome==="not-applicable"?Hu({passed:0,failed:0,couldNotRun:0,notApplicable:e.steps.length},[],"passed",e.protocolVersion):Vu(e.steps.map(t=>({id:t.step,status:t.status,...t.skipReason?{skipReason:t.skipReason}:{},...t.error?.message?{error:{message:t.error.message}}:{}})),[],e.protocolVersion)}var GO=8;function WO(e){return ir(e,0,new WeakSet)}function ir(e,t,r){if(e===null)return null;switch(typeof e){case"string":case"boolean":return e;case"number":return Number.isFinite(e)?e:String(e);case"bigint":return e.toString();case"undefined":case"function":case"symbol":return}const n=e;if(r.has(n))return"[circular]";if(t>=GO)return"[max-depth]";if(n instanceof Date)return n.toISOString();if(n instanceof URL)return n.toString();r.add(n);try{if(Array.isArray(n))return n.map(s=>ir(s,t+1,r)??null);if(n instanceof Map)return[...n.entries()].map(([s,o])=>[ir(s,t+1,r)??null,ir(o,t+1,r)??null]);if(n instanceof Set)return[...n].map(s=>ir(s,t+1,r)??null);const i={};if(n instanceof Error){i.name=n.name,i.message=n.message;const s=n;s.code!==void 0&&(i.code=ir(s.code,t+1,r)),s.statusCode!==void 0&&(i.statusCode=ir(s.statusCode,t+1,r)),s.cause!==void 0&&(i.cause=ir(s.cause,t+1,r))}for(const[s,o]of Object.entries(n)){const a=ir(o,t+1,r);a!==void 0&&(i[s]=a)}return i}finally{r.delete(n)}}function B_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Gn(e){const t=Object.entries(e).filter(([,r])=>r===void 0?!1:Array.isArray(r)?r.length>0:B_(r)?Object.keys(r).length>0:!0);if(t.length!==0)return WO(Object.fromEntries(t))}function ZO(e){if(e.httpAttempts.length!==0)return e.httpAttempts.map(t=>`${`${t.request.method} ${t.request.url}`} → ${t.response?`${t.response.status} ${t.response.statusText}`:"No response"}`).join(`
100
- `)}function JO(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0?{details:Gn({details:e.details,errorDetails:e.error?.details})}:{}}}function KO(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0||e.warnings?.length?{details:Gn({details:e.details,errorDetails:e.error?.details,warnings:e.warnings})}:{}}}function YO(e){const t=ZO(e);return{id:e.step,title:e.title||e.step,category:"oauth",status:e.status,durationMs:e.durationMs,description:e.summary,...e.error?.message?{error:e.error.message}:{},...e.error?.details!==void 0||e.warnings?.length||e.teachableMoments?.length?{details:Gn({errorDetails:e.error?.details,warnings:e.warnings,teachableMoments:e.teachableMoments})}:{},...t?{output:t}:{}}}function oi(e){const t=e.outcome;return t!=="passed"&&t!=="failed"&&t!=="incomplete"?{}:{outcome:t,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function Gu(e){const t=e.map(r=>oi(r).outcome??(r.outcome==="not-applicable"||r.passed?"passed":"failed"));if(t.includes("failed"))return{outcome:"failed"};if(t.includes("incomplete")){const r=e.find(n=>oi(n).outcome==="incomplete");return{outcome:"incomplete",...r?.incompleteReason?{incompleteReason:r.incompleteReason}:{}}}return{outcome:"passed"}}function Hp(e,t,r){return{id:`mcp-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:(()=>{const n=new Set(e.profile?.pendingCheckIds??[]);return e.checks.map(i=>JO(i,n))})()}}function Ml(e,t,r,n="apps"){const i=new Set(e.profile?.pendingCheckIds??[]);return{id:`${n}-${r+1}`,title:t,target:e.target,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.checks.map(s=>KO(s,i))}}function Vp(e,t,r){return{id:`oauth-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.steps.map(YO)}}function XO(e){return"checks"in e&&!("results"in e)&&"serverUrl"in e&&!("target"in e)}function QO(e){return"checks"in e&&!("results"in e)&&"target"in e}function ex(e){return"checks"in e&&!("results"in e)&&"discovery"in e&&B_(e.discovery)&&"wire"in e.discovery}function tx(e){return"steps"in e&&!("results"in e)}function rx(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"checks"in e.results[0]}function nx(e){return"results"in e&&"target"in e}function ix(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"steps"in e.results[0]}function sx(e){const t=e[0]?.profile;return t?e.every(r=>r.profile?.profileId===t.profileId&&r.profile?.profileVersion===t.profileVersion&&r.profile?.manifestDigest===t.manifestDigest)?{profile:t}:{}:{}}function ox(e){return"results"in e?{schemaVersion:1,kind:"protocol-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(Fp)),...sx(e.results),durationMs:e.durationMs,groups:e.results.map((t,r)=>Hp(t,t.label,r))}:{schemaVersion:1,kind:"protocol-conformance",name:"MCP Protocol Conformance",passed:e.passed,...oi(e),score:Fp(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Hp(e,"MCP Protocol Conformance",0)]}}function ax(e){return"results"in e?{schemaVersion:1,kind:"apps-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(qp)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Ml(t,t.label,r))}:{schemaVersion:1,kind:"apps-conformance",name:"MCP Apps Conformance",passed:e.passed,...oi(e),score:qp(e),durationMs:e.durationMs,groups:[Ml(e,"MCP Apps Conformance",0)]}}function cx(e){return"results"in e?{schemaVersion:1,kind:"oauth-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(jp)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Vp(t,t.label,r))}:{schemaVersion:1,kind:"oauth-conformance",name:"OAuth Conformance",passed:e.passed,...oi(e),score:jp(e),durationMs:e.durationMs,groups:[Vp(e,`${e.protocolVersion}/${e.registrationStrategy}`,0)]}}function lx(e){return"lanes"in e&&"findings"in e&&"badges"in e&&!("readinessKind"in e)}var ux={kind:"claude-directory-readiness",providerName:"Claude Directory Readiness",isResult:lx,isDispositive:e=>xE(e)};function dx(e){return e.status==="violated"?"failed":e.status==="satisfied"?"passed":"skipped"}function hx(e,t){const r=t.isDispositive,n=[],i=new Set,s=e.lanes.map(o=>{const a=e.findings.filter(c=>c.lane===o.lane);for(const c of a)i.add(c),!r(c)&&n.push({id:c.id,title:c.title,group:o.lane,kind:c.class,status:c.status,message:c.remediation??c.notEvaluatedReason,details:Gn({provenance:c.provenance,source:c.source,derivedFrom:c.derivedFrom,observed:c.details})});return{id:o.lane,title:o.lane,target:e.context.target,passed:o.status==="ready",durationMs:0,summary:o.summary,cases:a.filter(r).map(c=>({id:c.id,title:c.title,category:c.class,status:dx(c),skipReason:c.status==="not-evaluated"?"could-not-run":c.status==="not-applicable"?"not-applicable":void 0,durationMs:0,description:c.remediation,error:c.status==="violated"?c.remediation??"Requirement not satisfied":c.status==="not-evaluated"?c.notEvaluatedReason:void 0,details:Gn({provenance:c.provenance,intrusiveness:c.intrusiveness,source:c.source,requiresCapabilities:c.requiresCapabilities,derivedFrom:c.derivedFrom,observed:c.details})}))}});for(const o of e.findings)i.has(o)||n.push({id:o.id,title:o.title,group:o.lane,kind:o.class,status:o.status,message:o.remediation??o.notEvaluatedReason??"reported outside any lane in this result",details:Gn({provenance:o.provenance,source:o.source,orphanedLane:o.lane})});return{schemaVersion:1,kind:t.kind,name:t.providerName,passed:e.status==="ready",outcome:e.status==="ready"?"passed":e.status==="not-ready"?"failed":"incomplete",incompleteReason:e.status==="incomplete"?e.summary:void 0,durationMs:e.durationMs,groups:s,advisories:n}}var px={kind:"openai-directory-readiness",providerName:"OpenAI Plugin Directory Readiness",isResult:e=>UE(e),isDispositive:e=>Dg(e)},fx=[px,ux];function vx(e){return fx.find(t=>t.isResult(e))}function PD(e){const t=vx(e);if(t)return hx(e,t);if(XO(e)||rx(e))return ox(e);if(ex(e))return{schemaVersion:1,kind:"tasks-conformance",name:"MCP Tasks Conformance",passed:e.passed,...oi(e),score:BO(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Ml(e,"MCP Tasks Conformance",0,"tasks")]};if(QO(e)||nx(e))return ax(e);if(tx(e)||ix(e))return cx(e);throw new Error("Unsupported conformance result shape")}var OD=Object.freeze({chatgpt:!0,copilot:!0,mcpjam:!0,claude:!1,"claude-desktop":!1,cursor:!1,codex:!1,goose:!1,slack:!1,vscode:!1,notion:!1});function Dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tt(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function Fo(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function gx(e){if(!Dt(e))return;if(e.source==="legacy"){const r=tt(e.modelId);return r?{source:"legacy",modelId:r}:void 0}if(!W$(e))return;const t=G_(e.connectionRef);return{modelId:e.modelId,source:e.source,...t?{connectionRef:t}:{},...e.nativeModelId!==void 0?{nativeModelId:e.nativeModelId}:{},...e.settings?{settings:{...e.settings.reasoningEffort!==void 0?{reasoningEffort:e.settings.reasoningEffort}:{},...e.settings.temperature!==void 0?{temperature:e.settings.temperature}:{}}}:{},fallback:{provider:e.fallback.provider,model:e.fallback.model}}}function G_(e){if(Dt(e)){if(e.kind==="orgProvider"){const t=tt(e.id);return t?{kind:"orgProvider",id:t}:void 0}if(e.kind==="localProvider"){const t=tt(e.providerKey);if(!t)return;const r=tt(e.customProviderName);return{kind:"localProvider",providerKey:t,...r?{customProviderName:r}:{}}}}}function mx(e){if(!Dt(e))return;const t=tt(e.rail),r=tt(e.providerKey);if(!t||!r)return;const n=tt(e.connectionLabel),i=Fo(e.credentialVersion),s=tt(e.nativeModelId);return{rail:t,providerKey:r,...n?{connectionLabel:n}:{},...i!==void 0?{credentialVersion:i}:{},...s?{nativeModelId:s}:{}}}function _x(e){if(!Dt(e))return;const t=tt(e.rail),r=tt(e.wireModelId),n=tt(e.outcome),i=Fo(e.at);if(!t||!r||!n||i===void 0)return;const s=tt(e.code);return{rail:t,wireModelId:r,outcome:n,...s?{code:s}:{},at:i}}function xD(e){if(!Dt(e))return;const t=gx(e.requested),r=e.resolved;if(!t||!Dt(r))return;const n=tt(r.rail),i=tt(r.wireModelId),s=mx(r.offering);if(!n||!i||!s)return;const o=e.effectiveSettings;if(!Dt(o))return;const a=Fo(o.maxOutputTokens);if(a===void 0)return;const c=G_(r.connectionRef),l=tt(r.nativeModelId),u=e.harness,h=Dt(u)?tt(u.id):void 0,d=Dt(u)?tt(u.runtimeVersion):void 0,p=tt(o.reasoningEffort),f=Fo(o.temperature),v=Array.isArray(e.attempts)?e.attempts.flatMap(T=>{const I=_x(T);return I?[I]:[]}):[],m=tt(e.upstreamModel),_=e.deviation,w=Dt(_)?tt(_.kind):void 0,S=Dt(_)&&typeof _.reason=="string"?_.reason:"";return{requested:t,resolved:{rail:n,wireModelId:i,...c?{connectionRef:c}:{},...l?{nativeModelId:l}:{},offering:s},...h&&d?{harness:{id:h,runtimeVersion:d}}:{},effectiveSettings:{...p?{reasoningEffort:p}:{},...f!==void 0?{temperature:f}:{},maxOutputTokens:a},attempts:v,...m?{upstreamModel:m}:{},...w?{deviation:{kind:w,reason:S}}:{}}}var yx={gateway:"Vercel AI Gateway",openrouter:"OpenRouter",orgCloud:"organization connection",local:"local key"};function Wu(e){return yx[e]??e}var bx={provider_fallback:"Provider fallback",model_substitution:"Model substituted",harness_substitution:"Harness substituted"};function wx(e){return bx[e]??e}function qs(e){const t=e.resolved.connectionRef;return t?.kind==="localProvider"&&t.customProviderName?t.customProviderName:e.resolved.offering.providerKey}function Sx(e){const{rail:t,offering:r}=e.resolved;switch(t){case"gateway":case"openrouter":return`${Wu(t)} (MCPJam key)`;case"orgCloud":return r.connectionLabel?`org connection "${r.connectionLabel}" (${qs(e)})`:`org ${qs(e)} connection`;case"local":return r.connectionLabel?`local key "${r.connectionLabel}" (${qs(e)})`:`local ${qs(e)} key`;default:return`${t} (${r.providerKey})`}}function Ex(e){return e===0?"max output provider default":`max output ${e.toLocaleString("en-US")} tokens`}function kx(e){const t=e.effectiveSettings;return[...t.reasoningEffort?[`effort ${t.reasoningEffort}`]:[],...t.temperature!==void 0?[`temperature ${t.temperature}`]:[],Ex(t.maxOutputTokens)]}function Rx(e){const{wireModelId:t,nativeModelId:r}=e.resolved,n=[...r&&r!==t?[`deployment ${r}`]:[],...e.upstreamModel&&e.upstreamModel!==t?[`provider reported ${e.upstreamModel}`]:[]];return n.length>0?`${t} (${n.join(", ")})`:t}function Ax(e){return[`Ran on ${Rx(e)} via ${Sx(e)}`,...e.harness?[`${e.harness.id} v${e.harness.runtimeVersion}`]:[],...kx(e)].join(", ")}var Ix={hosted:"MCPJam-hosted",org:"organization connection",local:"local key"};function Tx(e){const t=e.requested;if(t.source==="legacy")return`Requested ${t.modelId} (saved without a source; inferred at run time)`;const r=Ix[t.source]??t.source,n=t.fallback.provider==="none"?"no fallback permitted":`${Wu(t.fallback.provider)} fallback permitted`;return`Requested ${t.modelId} (${r}, ${n})`}function $x(e){return e.attempts.map((t,r)=>{const n=t.outcome==="ok"?"ok":t.outcome==="error"?`failed${t.code?` (${t.code})`:""}`:`${t.outcome}${t.code?` (${t.code})`:""}`;return`Attempt ${r+1}: ${Wu(t.rail)} · ${t.wireModelId} · ${n}`})}function MD(e){return{line:Ax(e),request:Tx(e),attempts:$x(e),...e.deviation?{deviation:{kind:e.deviation.kind,title:wx(e.deviation.kind),reason:e.deviation.reason}}:{}}}var Cx="=?base64?";function Px(e){const t=e.toLowerCase();if(t==="mcp-protocol-version")return"protocol-version";if(t==="mcp-method")return"method";if(t==="mcp-name")return"name";if(t==="mcp-session-id")return"session";if(t==="last-event-id")return"resumption";if(t.startsWith("mcp-param-"))return"param"}function Ox(e){const t=globalThis;if(typeof t.atob=="function"){const r=t.atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i+=1)n[i]=r.charCodeAt(i);return new TextDecoder("utf-8",{fatal:!0}).decode(n)}if(t.Buffer)return t.Buffer.from(e,"base64").toString("utf8");throw new Error("no base64 decoder available")}function to(e){if(!e.startsWith("=?base64?")||!e.endsWith("?=")||e.length<11)return{raw:e,encoded:!1,value:e};const t=e.slice(9,e.length-2);try{return{raw:e,encoded:!0,value:Ox(t)}}catch(r){return{raw:e,encoded:!0,value:e,decodeError:r instanceof Error?r.message:String(r)}}}var xx=new Set(["tools/call","resources/read","prompts/get"]),W_=new Set(["tasks/get","tasks/update","tasks/cancel"]);function Mx(e){return e===void 0?!1:xx.has(e)||W_.has(e)}var Bp=["protocol-version","method","name","param","session","resumption"];function Lx(e){return e!==void 0&&W_.has(e)?".params.taskId":e==="resources/read"?".params.uri":".params.name"}function Dx(e){const t=e.declarations??[],r=Wx(t,e.arguments);return t.map(n=>{const i=`${Z_}${n.headerName}`,s=r[i];return{header:i.toLowerCase(),displayName:i,expected:s===void 0?void 0:to(s).value,bodyField:`.params.arguments${n.path.map(o=>`.${o}`).join("")}`}})}function LD(e,t,r){const n=new Map;for(const[d,p]of Object.entries(e))n.set(d.toLowerCase(),{name:d,value:p});const i=n.get("mcp-protocol-version")?.value??t?.protocolVersion,s=!!i&&R$(i)&&A$(i)&&!!t,o=[],a=new Set,c=s&&t?[{header:"mcp-protocol-version",family:"protocol-version",bodyValue:t.protocolVersion,bodyField:"._meta protocolVersion",required:!0},{header:"mcp-method",family:"method",bodyValue:t.method,bodyField:".method",required:!0},{header:"mcp-name",family:"name",bodyValue:t.name,bodyField:Lx(t.method),required:Mx(t.method)}]:[];for(const d of c){a.add(d.header);const p=n.get(d.header);if(!p){d.required&&d.bodyValue!==void 0?o.push({name:d.header,family:d.family,status:"missing",bodyValue:d.bodyValue,bodyField:d.bodyField}):!d.required&&t?.method!==void 0&&o.push({name:d.header,family:d.family,status:"not-required"});continue}const f=to(p.value),v={name:p.name,family:d.family,raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):d.bodyValue===void 0?o.push({...v,status:"unchecked"}):f.value===d.bodyValue?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.bodyValue,bodyField:d.bodyField})}const l=r!==void 0&&"arguments"in r,u=s&&r?Dx(r):[],h=s&&r?.declarations!==void 0;for(const d of u){a.add(d.header);const p=n.get(d.header);if(!p){if(!l){o.push({name:d.displayName,family:"param",status:"unchecked"});continue}o.push(d.expected===void 0?{name:d.displayName,family:"param",status:"not-required"}:{name:d.displayName,family:"param",status:"missing",bodyValue:d.expected,bodyField:d.bodyField});continue}const f=to(p.value),v={name:p.name,family:"param",raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):l?d.expected===void 0?o.push({...v,status:"mismatch",bodyValue:"(absent from arguments)",bodyField:d.bodyField}):f.value===d.expected?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.expected,bodyField:d.bodyField}):o.push({...v,status:"unchecked"})}for(const[d,p]of n){if(a.has(d))continue;const f=Px(p.name);if(!f)continue;const v=to(p.value),m=s&&f==="param"&&!!v.decodeError,_=h&&f==="param"&&!m;o.push({name:p.name,family:f,raw:p.value,decoded:v.encoded&&!v.decodeError?v.value:void 0,status:m?"undecodable":_?"undeclared":"unchecked"})}return o.sort((d,p)=>Bp.indexOf(d.family)-Bp.indexOf(p.family)||d.name.localeCompare(p.name))}var Gp="x-mcp-header",Z_="Mcp-Param-",Nx=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,zx=new Set(["string","integer","boolean","number"]),Ux=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Fx=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function qx(e){return e.length===0?"<root>":e.join(".")}function DD(e){const t=[],r=new Map,n=(s,o,a)=>{if(s===null||typeof s!="object")return;const c=s;if(Gp in c){const u=qx(o);if(!a||o.length===0)return`${u}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;const h=c[Gp];if(typeof h!="string"||h.length===0)return`${u}: x-mcp-header MUST be a non-empty string`;if(!Nx.test(h))return`${u}: x-mcp-header '${h}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;const d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!zx.has(d))return`${u}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;const p=h.toLowerCase(),f=r.get(p);if(f!==void 0)return`x-mcp-header '${h}' is not case-insensitively unique (also declared as '${f}')`;r.set(p,h),t.push({path:o,headerName:h,type:d})}const l=c.properties;if(l!==null&&typeof l=="object")for(const[u,h]of Object.entries(l)){const d=n(h,[...o,u],a);if(d!==void 0)return d}for(const u of Ux){const h=c[u];if(h===void 0)continue;const d=h!==null&&typeof h=="object"&&Fx.has(u),p=Array.isArray(h)?h:d?Object.values(h):[h];for(const f of p){const v=n(f,[...o,`<${u}>`],!1);if(v!==void 0)return v}}},i=n(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}function jx(e){const t=globalThis,r=new TextEncoder().encode(e);if(typeof t.btoa=="function"){let n="";for(const i of r)n+=String.fromCodePoint(i);return t.btoa(n)}if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");throw new Error("no base64 encoder available")}function Hx(e){if(e.length===0||e.startsWith("=?base64?")&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t+=1){const r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function Vx(e){if(!Hx(e))return e;const t=jx(e);return`${Cx}${t}?=`}function Bx(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function Gx(e,t){let r=e;for(const n of t){if(r===null||typeof r!="object")return;r=r[n]}return r}function Wx(e,t){const r={};for(const n of e){const i=Gx(t,n.path);if(i==null)continue;const s=Bx(i);s!==void 0&&(r[`${Z_}${n.headerName}`]=Vx(s))}return r}var Zx="tracestate",Jx="baggage",Kx=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/,Yx="0".repeat(32),Xx="0".repeat(16);function Qx(e){if(typeof e!="string")return;const t=Kx.exec(e);if(!t)return;const[,r,n,i,s]=t;if(!(r==="ff"||r!=="00")&&!(n===Yx||i===Xx))return{version:r,traceId:n,spanId:i,flags:s,sampled:(Number.parseInt(s,16)&1)===1}}function e1(e){return Qx(e)!==void 0}var t1=32,r1=/^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/,n1=/^[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]$/;function i1(e){if(typeof e!="string"||e.length===0)return!1;const t=e.split(",");if(t.length>t1)return!1;let r=0;for(const n of t){const i=n.trim();if(i.length===0)continue;r+=1;const s=i.indexOf("=");if(s<=0||!r1.test(i.slice(0,s))||!n1.test(i.slice(s+1)))return!1}return r>0}var s1=180,o1=8192,a1=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Wp=/^[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*$/;function c1(e){if(typeof e!="string"||e.length===0||e.length>o1)return!1;const t=e.split(",");if(t.length>s1)return!1;for(const r of t){const n=r.trim();if(n.length===0)return!1;const[i,...s]=n.split(";"),o=i.indexOf("=");if(o<=0||!a1.test(i.slice(0,o).trim())||!Wp.test(i.slice(o+1).trim()))return!1;for(const a of s)if(!Wp.test(a.replace(/=/g,"").trim()))return!1}return!0}function l1(e){if(!(!e||!e1(e.traceparent)))return{traceparent:e.traceparent,...i1(e.tracestate)?{tracestate:e.tracestate}:{},...c1(e.baggage)?{baggage:e.baggage}:{}}}function ND(e){if(!e||typeof e!="object")return;const t=r=>{const n=e[r];return typeof n=="string"?n:void 0};return l1({traceparent:t("traceparent")??"",tracestate:t(Zx),baggage:t(Jx)})}var zD=At.MissingRequiredClientCapability,u1=/\.[cm]?[jt]sx?$/,d1=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function h1(e,t){if(typeof e!="string"||!d1.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!u1.test(r.pathname)}function p1(e,t){return e.length===0?!1:e.every(r=>h1(r,t))}function f1(e,t){return e.length===0?!1:e.every(r=>p1(r,t))}var v1=["timeout","network","upstream_status","bad_json","bad_payload","provisioning"],g1=/^[A-Z][A-Z0-9_]{1,63}$/;function m1(e){return typeof e=="string"&&v1.includes(e)}function _1(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:n}=e;if(!m1(t))return;const i={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(i.upstreamStatus=r),typeof n=="string"&&g1.test(n)&&(i.networkCode=n),i}var J_="mcpjam_guest_session_v1",Ll="mcpjam_guest_activated",Aa=3e5,wt=null,yr=null,br=null,sn=null,K_=!1,Or=0,Dl=new Set,y1=6e5,Un=null,Ai=null;function Y_(){for(const e of Dl)e()}function X_(e){Ai!==null&&(clearTimeout(Ai),Ai=null),Un=e,e&&(Ai=setTimeout(()=>{Ai=null,Un===e&&X_(null)},Math.max(0,e.until-Date.now()))),Y_()}function b1(){return Un&&Un.until<=Date.now()&&(Un=null),Un}function Ia(e){const t=wt?.guestId??null;wt=e,t!==(wt?.guestId??null)&&Y_()}function UD(e){return Dl.add(e),()=>{Dl.delete(e)}}function FD(e){if(e)try{localStorage.getItem(Ll)!==e&&localStorage.setItem(Ll,e)}catch{}}function qD(e){if(!e)return!1;try{return localStorage.getItem(Ll)===e}catch{return!1}}function w1(){if(typeof window>"u")return;const e=window.__MCP_GUEST_BOOTSTRAP__;try{delete window.__MCP_GUEST_BOOTSTRAP__}catch{window.__MCP_GUEST_BOOTSTRAP__=void 0}e&&(typeof e.token!="string"||e.token.length===0||typeof e.expiresAt!="number"||typeof e.guestId!="string"||e.guestId.length===0||e.expiresAt-Aa<=Date.now()||(wt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}w1();function Zu(){if(K_)return null;try{const e=localStorage.getItem(J_);if(!e)return null;const t=JSON.parse(e);return typeof t.token=="string"&&t.token.length>0?t.token:null}catch{return null}}function Zp(){try{localStorage.removeItem(J_)}catch{}K_=!0}var Pi=class extends Error{status;upstreamFailure;constructor(e,t,r){super(e),this.name="GuestSessionRequestError",this.status=t,this.upstreamFailure=r}},Q_=class extends Pi{retryAfterMs;constructor(e){super("guest-session creation refused (429)"),this.name="GuestSessionRefusedError",this.retryAfterMs=e}},S1=1e3;async function E1(e){if(typeof e.json!="function")return;let t;try{const r=await Promise.race([e.json(),new Promise(n=>{t=setTimeout(()=>n(void 0),S1)})]);return _1(r?.details)}catch{return}finally{t!==void 0&&clearTimeout(t)}}function k1(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function R1(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:y1}async function Ju(e,t){const r={mode:e};t&&(r.legacyToken=t);let n;try{n=await fetch("/api/web/guest-session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(s){throw new Pi(s instanceof Error?s.message:"network error")}if(n.status===204)return t&&Zp(),null;if(n.status===429)throw new Q_(R1(n.headers?.get?.("retry-after")));if(!n.ok){const s=await E1(n);throw new Pi(`guest-session request failed: ${n.status} ${n.statusText}${k1(s)}`,n.status,s)}let i;try{i=await n.json()}catch(s){throw new Pi(`guest-session response was not valid JSON: ${s instanceof Error?s.message:String(s)}`)}if(typeof i?.token!="string"||typeof i?.expiresAt!="number")throw new Pi("guest-session response missing token or expiresAt");return t&&Zp(),i}async function A1(){if(wt&&wt.expiresAt-Aa>Date.now())return wt;if(b1())return null;if(yr)return yr;const e=Zu(),t=Or;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Ju("lookup_or_create",e);return n&&t===Or&&Ia(n),n}catch(n){if(n instanceof Q_)return X_({until:Date.now()+n.retryAfterMs}),null;throw console.error("Failed to create guest session:",n),n}finally{yr===r&&(yr=null)}})(),yr=r,r.catch(()=>{}),yr}async function I1(){try{return await A1()}catch{return null}}async function jD(){return(await I1())?.token??null}function Nl(){return wt&&wt.expiresAt-Aa>Date.now()?wt:null}async function T1(){if(wt&&wt.expiresAt-Aa>Date.now())return wt.token;if(br)return(await br)?.token??null;const e=Zu(),t=Or;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Ju("lookup_only",e);return n&&t===Or&&Ia(n),n}finally{br===r&&(br=null)}})(),br=r,(await br)?.token??null}async function HD(){const e=Nl();if(e?.guestId)return e.guestId;try{await T1()}catch{return null}return Nl()?.guestId??null}function $1(){Or+=1,Ia(null),yr=null,br=null,sn=null}async function VD(){let e=!1;try{const t=await fetch("/api/web/guest-session/revoke",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(t.ok)try{e=(await t.json())?.revoked===!0}catch{e=!1}}catch(t){console.error("Failed to revoke guest session:",t)}finally{$1()}return e}async function BD(){try{const e=await fetch("/api/web/guest-session/promotion-proof",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(e.status===204||!e.ok)return null;const t=await e.json();return typeof t.token=="string"&&t.token.length>0?t.token:null}catch(e){return console.error("Failed to fetch guest promotion proof:",e),null}}async function C1(){if(sn)return(await sn)?.token??null;Or+=1;const e=Or;wt=null,yr=null,br=null,sn=(async()=>{try{const t=await Ju("lookup_or_create",Zu());return t&&e===Or&&Ia(t),t}catch(t){throw console.error("Failed to refresh guest session:",t),t}})(),sn.catch(()=>{});try{return(await sn)?.token??null}finally{sn=null}}async function GD(){try{return await C1()}catch{return null}}var ey=new Set(["caniuse.dev","www.caniuse.dev"]),P1=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),O1=new Set([...ey,...P1]),WD="https://app.mcpjam.com";function x1(e){return ey.has(e.toLowerCase())}function ZD(e=typeof window>"u"?void 0:window.location.hostname){return!!e&&x1(e)}var JD=null,KD="write",Jp=null,M1=String(101376);function YD(){return Jp?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:Jp,scope:"bot applications.commands",permissions:M1}).toString()}`:null}var L1="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",D1="https://us.i.posthog.com";function N1(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:D1}function ty(e){const t=Nl()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var z1={advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},U1=["/results/","/conformance/shared/","/evals/shared/"];function ry(e){let t=e;for(const r of U1){const n=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");t=t.replace(new RegExp(`(${n})[^/?#]+`,"g"),"$1[redacted]")}return t=t.replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]"),t}var F1=new Set(["Load failed","Failed to fetch","NetworkError when attempting to fetch resource."]),q1=/^'TypeError' captured as exception with message: '([\s\S]*)'$/;function j1(e){const t=q1.exec(e.value),r=t?t[1]:e.type==="TypeError"?e.value:void 0;return r===void 0?!1:F1.has(r)||r.startsWith("Failed to fetch (")&&r.endsWith(")")}var H1=1e4;function V1(e){const t=e.$exception_list;if(!(Array.isArray(t)&&t.some(i=>typeof i?.value=="string"&&j1(i))))return;const r=iy();if(!r)return;const n=Date.now()-r.at;n>H1||(e.failed_request=`${r.method} ${ry(r.target)}`,e.failed_request_age_ms=n)}function B1(e,t){for(const r of["$current_url","$referrer","$pathname","$session_entry_url","$session_entry_pathname","$session_entry_referrer","$initial_current_url","$initial_pathname","$initial_referrer"])typeof e[r]=="string"&&(e[r]=ry(e[r]));return t==="$exception"&&V1(e),e}function G1(e){if(e?.event!=="$exception"||typeof window>"u")return e;const t=e.properties?.$exception_list;if(!Array.isArray(t))return e;const r=t.map(n=>{const i=n?.stacktrace?.frames;return Array.isArray(i)?i.map(s=>s?.filename):[]});return f1(r,window.location.origin)?null:e}var W1=O1;function gs(){return Z1()}function Z1(){return typeof window<"u"&&window.isElectron===!0}var J1="data-ph-no-capture",K1={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:`[${J1}]`};function Ku(e=typeof window>"u"?void 0:window.location?.pathname){return!!e&&(e.startsWith("/results/")||e.startsWith("/conformance/shared/")||e.startsWith("/evals/shared/"))}function Y1(){return gs()&&!Ku()}var Ec=!1;function XD(e,t){try{if(!gs())return;if(Ku(t)){e.sessionRecordingStarted?.()&&(Ec=!0),e.stopSessionRecording?.();return}Ec&&(Ec=!1,e.startSessionRecording?.())}catch{}}function X1(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&W1.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var Kp={api_host:N1(),ui_host:"https://us.posthog.com",...ty(),...X1(),...z1,person_profiles:"always",sanitize_properties:B1,before_send:G1,capture_dead_clicks:!0,get capture_exceptions(){return gs()},get disable_session_recording(){return!Y1()},session_recording:K1,loaded:e=>{e.register({environment:"production",platform:zl(),version:"3.12.2",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({local_browser_security_version:"1",deployment:"self_hosted",platform:zl()})}};function Q1(e){const t=ty(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors(Kp),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):Kp}var QD=()=>L1,eN=e=>Q1(e);function zl(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function eM(){return"production"}function tN(e){const t=eM();return{location:e,platform:zl(),...t!==void 0?{environment:t}:{}}}function tM(e){try{if(typeof e!="object"||e===null)return;const t=e.normalized;return FC(t)?t:void 0}catch{return}}function rN(e,t){try{if(!gs()||Fl(e))return!1;const r=tM(e)??dP(e),n=lP(r);return n!=="mcpjam"?!1:(ny(e,{...t,extra:{...t.extra??{},slug:r.slug,origin:n}}),!0)}catch{return!1}}var rM=rf();function nM(e){if(e instanceof Error)return e;try{return new Error(typeof e=="string"?e:JSON.stringify(e))}catch{return new Error(String(e))}}function ny(e,t){if(Fl(e))return;const r=Ay(nM(e)),n=tf(r.message);if(n&&t.queryBackend&&(n.convex_backend=t.queryBackend),n&&rM(n.convex_backend,n.request_id))return;const i=n&&typeof window<"u"?Ac(window.location.href):void 0;try{K0(r,{level:t.level??"error",tags:{source:t.source,...n},...n?{extra:{boundary:t.extra?.boundary,componentStack:t.extra?.componentStack,page_location:i}}:t.extra?{extra:t.extra}:{}})}catch{}try{gs()&&!Ku()&&kE.captureException(r,{source:t.source,level:t.level??"error",...n?{...n,page_location:i}:t.extra??{}})}catch{}}function nN(e,t,r){ny(e,{source:r?`react_boundary:${r}`:"react_boundary",extra:{componentStack:t?.componentStack??void 0,boundary:r??"unnamed"}})}export{qO as $,sM as $i,sL as $n,$M as $r,oC as $t,qD as A,vM as Ai,Dm as An,NM as Ar,Cl as At,LD as B,cn as Bi,pl as Bn,a0 as Br,lP as Bt,T1 as C,fM as Ci,rn as Cn,qM as Cr,PP as Ct,b1 as D,Ho as Di,PL as Dn,p0 as Dr,$P as Dt,BD as E,Ly as Ei,dT as En,FM as Er,la as Et,f1 as F,dM as Fi,fl as Fn,MM as Fr,fD as Ft,MD as G,Iy as Gi,fL as Gn,CM as Gr,Jt as Gt,wx as H,jo as Hi,mI as Hn,Vr as Hr,m_ as Ht,ND as I,Oy as Ii,AL as In,u0 as Ir,dD as It,Bu as J,Ay as Ji,kE as Jn,ad as Jr,oD as Jt,PD as K,cM as Ki,UE as Kn,Go as Kr,Ou as Kt,Qx as L,uM as Li,ze as Ln,d0 as Lr,dP as Lt,VD as M,Hl as Mi,hn as Mn,LM as Mr,vP as Mt,UD as N,cs as Ni,up as Nn,OM as Nr,pD as Nt,I1 as O,My as Oi,CL as On,UM as Or,gD as Ot,_1 as P,Cy as Pi,ML as Pn,xM as Pr,hD as Pt,BO as Q,Xu as Qi,YM as Qn,Gl as Qr,nD as Qt,W_ as R,td as Ri,$L as Rn,l0 as Rr,FC as Rt,Nl as S,pM as Si,Mt as Sn,jM as Sr,Fr as St,jD as T,hM as Ti,TL as Tn,y0 as Tr,mD as Tt,Wu as U,$t as Ui,wL as Un,_n as Ur,SC as Ut,DD as V,rd as Vi,II as Vn,ls as Vr,uD as Vt,xD as W,nf as Wi,lk as Wn,PM as Wr,mp as Wt,jp as X,Ry as Xi,XM as Xn,ao as Xr,cD as Xt,qp as Y,Fl as Yi,nL as Yn,Jn as Yr,aD as Yt,Fp as Z,aM as Zi,K0 as Zn,Vo as Zr,sC as Zt,WD as _,xi as _i,Ar as _n,VM as _r,_a as _t,zl as a,Ir as ai,X$ as an,KM as ar,_r as at,GD as b,gM as bi,EL as bn,dd as br,ma as bt,Ku as c,Bl as ci,YL as cn,ZM as cr,SD as ct,Y1 as d,EM as di,qL as dn,k0 as dr,wO as dt,oM as ea,TM as ei,iD as en,rL as er,TD as et,tN as f,wM as fi,G$ as fn,HM as fr,mO as ft,YD as g,bM as gi,zs as gn,E0 as gr,N_ as gt,KD as h,yM as hi,A$ as hn,BM as hr,yD as ht,L1 as i,RM as ii,rD as in,iL as ir,UO as it,FD as j,oo as ji,Lo as jn,DM as jr,vD as jt,A1 as k,jl as ki,IL as kn,zM as kr,wP as kt,gs as l,Zn as li,Y$ as ln,JM as lr,ED as lt,JD as m,Hy as mi,R$ as mn,ff as mr,pO as mt,ny as n,ro as na,AM as ni,eD as nn,eL as nr,FO as nt,QD as o,kM as oi,QL as on,fr as or,Np as ot,XD as p,SM as pi,wl as pn,GM as pr,bD as pt,CD as q,lM as qi,cL as qn,$c as qr,Cr as qt,rN as r,IM as ri,tD as rn,tL as rr,RD as rt,eN as s,Vl as si,XL as sn,T0 as sr,TO as st,nN as t,no as ta,Gy as ti,sD as tn,QM as tr,AD as tt,ry as u,zt as ui,jL as un,A0 as ur,wD as ut,ZD as v,_M as vi,xL as vn,WM as vr,ya as vt,HD as w,xy as wi,OL as wn,m0 as wr,De as wt,C1 as x,Fy as xi,RL as xn,Wo as xr,_D as xt,$1 as y,mM as yi,kL as yn,Wl as yr,wa as yt,Px as z,sf as zi,cT as zn,c0 as zr,pP as zt};
100
+ `)}function JO(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0?{details:Gn({details:e.details,errorDetails:e.error?.details})}:{}}}function KO(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0||e.warnings?.length?{details:Gn({details:e.details,errorDetails:e.error?.details,warnings:e.warnings})}:{}}}function YO(e){const t=ZO(e);return{id:e.step,title:e.title||e.step,category:"oauth",status:e.status,durationMs:e.durationMs,description:e.summary,...e.error?.message?{error:e.error.message}:{},...e.error?.details!==void 0||e.warnings?.length||e.teachableMoments?.length?{details:Gn({errorDetails:e.error?.details,warnings:e.warnings,teachableMoments:e.teachableMoments})}:{},...t?{output:t}:{}}}function oi(e){const t=e.outcome;return t!=="passed"&&t!=="failed"&&t!=="incomplete"?{}:{outcome:t,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function Gu(e){const t=e.map(r=>oi(r).outcome??(r.outcome==="not-applicable"||r.passed?"passed":"failed"));if(t.includes("failed"))return{outcome:"failed"};if(t.includes("incomplete")){const r=e.find(n=>oi(n).outcome==="incomplete");return{outcome:"incomplete",...r?.incompleteReason?{incompleteReason:r.incompleteReason}:{}}}return{outcome:"passed"}}function Hp(e,t,r){return{id:`mcp-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:(()=>{const n=new Set(e.profile?.pendingCheckIds??[]);return e.checks.map(i=>JO(i,n))})()}}function Ml(e,t,r,n="apps"){const i=new Set(e.profile?.pendingCheckIds??[]);return{id:`${n}-${r+1}`,title:t,target:e.target,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.checks.map(s=>KO(s,i))}}function Vp(e,t,r){return{id:`oauth-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.steps.map(YO)}}function XO(e){return"checks"in e&&!("results"in e)&&"serverUrl"in e&&!("target"in e)}function QO(e){return"checks"in e&&!("results"in e)&&"target"in e}function ex(e){return"checks"in e&&!("results"in e)&&"discovery"in e&&B_(e.discovery)&&"wire"in e.discovery}function tx(e){return"steps"in e&&!("results"in e)}function rx(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"checks"in e.results[0]}function nx(e){return"results"in e&&"target"in e}function ix(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"steps"in e.results[0]}function sx(e){const t=e[0]?.profile;return t?e.every(r=>r.profile?.profileId===t.profileId&&r.profile?.profileVersion===t.profileVersion&&r.profile?.manifestDigest===t.manifestDigest)?{profile:t}:{}:{}}function ox(e){return"results"in e?{schemaVersion:1,kind:"protocol-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(Fp)),...sx(e.results),durationMs:e.durationMs,groups:e.results.map((t,r)=>Hp(t,t.label,r))}:{schemaVersion:1,kind:"protocol-conformance",name:"MCP Protocol Conformance",passed:e.passed,...oi(e),score:Fp(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Hp(e,"MCP Protocol Conformance",0)]}}function ax(e){return"results"in e?{schemaVersion:1,kind:"apps-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(qp)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Ml(t,t.label,r))}:{schemaVersion:1,kind:"apps-conformance",name:"MCP Apps Conformance",passed:e.passed,...oi(e),score:qp(e),durationMs:e.durationMs,groups:[Ml(e,"MCP Apps Conformance",0)]}}function cx(e){return"results"in e?{schemaVersion:1,kind:"oauth-conformance",name:e.name,passed:e.passed,...Gu(e.results),score:Bu(e.results.map(jp)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Vp(t,t.label,r))}:{schemaVersion:1,kind:"oauth-conformance",name:"OAuth Conformance",passed:e.passed,...oi(e),score:jp(e),durationMs:e.durationMs,groups:[Vp(e,`${e.protocolVersion}/${e.registrationStrategy}`,0)]}}function lx(e){return"lanes"in e&&"findings"in e&&"badges"in e&&!("readinessKind"in e)}var ux={kind:"claude-directory-readiness",providerName:"Claude Directory Readiness",isResult:lx,isDispositive:e=>xE(e)};function dx(e){return e.status==="violated"?"failed":e.status==="satisfied"?"passed":"skipped"}function hx(e,t){const r=t.isDispositive,n=[],i=new Set,s=e.lanes.map(o=>{const a=e.findings.filter(c=>c.lane===o.lane);for(const c of a)i.add(c),!r(c)&&n.push({id:c.id,title:c.title,group:o.lane,kind:c.class,status:c.status,message:c.remediation??c.notEvaluatedReason,details:Gn({provenance:c.provenance,source:c.source,derivedFrom:c.derivedFrom,observed:c.details})});return{id:o.lane,title:o.lane,target:e.context.target,passed:o.status==="ready",durationMs:0,summary:o.summary,cases:a.filter(r).map(c=>({id:c.id,title:c.title,category:c.class,status:dx(c),skipReason:c.status==="not-evaluated"?"could-not-run":c.status==="not-applicable"?"not-applicable":void 0,durationMs:0,description:c.remediation,error:c.status==="violated"?c.remediation??"Requirement not satisfied":c.status==="not-evaluated"?c.notEvaluatedReason:void 0,details:Gn({provenance:c.provenance,intrusiveness:c.intrusiveness,source:c.source,requiresCapabilities:c.requiresCapabilities,derivedFrom:c.derivedFrom,observed:c.details})}))}});for(const o of e.findings)i.has(o)||n.push({id:o.id,title:o.title,group:o.lane,kind:o.class,status:o.status,message:o.remediation??o.notEvaluatedReason??"reported outside any lane in this result",details:Gn({provenance:o.provenance,source:o.source,orphanedLane:o.lane})});return{schemaVersion:1,kind:t.kind,name:t.providerName,passed:e.status==="ready",outcome:e.status==="ready"?"passed":e.status==="not-ready"?"failed":"incomplete",incompleteReason:e.status==="incomplete"?e.summary:void 0,durationMs:e.durationMs,groups:s,advisories:n}}var px={kind:"openai-directory-readiness",providerName:"OpenAI Plugin Directory Readiness",isResult:e=>UE(e),isDispositive:e=>Dg(e)},fx=[px,ux];function vx(e){return fx.find(t=>t.isResult(e))}function PD(e){const t=vx(e);if(t)return hx(e,t);if(XO(e)||rx(e))return ox(e);if(ex(e))return{schemaVersion:1,kind:"tasks-conformance",name:"MCP Tasks Conformance",passed:e.passed,...oi(e),score:BO(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Ml(e,"MCP Tasks Conformance",0,"tasks")]};if(QO(e)||nx(e))return ax(e);if(tx(e)||ix(e))return cx(e);throw new Error("Unsupported conformance result shape")}var OD=Object.freeze({chatgpt:!0,copilot:!0,mcpjam:!0,claude:!1,"claude-desktop":!1,cursor:!1,codex:!1,goose:!1,slack:!1,vscode:!1,notion:!1});function Dt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tt(e){return typeof e=="string"&&e.trim().length>0?e:void 0}function Fo(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function gx(e){if(!Dt(e))return;if(e.source==="legacy"){const r=tt(e.modelId);return r?{source:"legacy",modelId:r}:void 0}if(!W$(e))return;const t=G_(e.connectionRef);return{modelId:e.modelId,source:e.source,...t?{connectionRef:t}:{},...e.nativeModelId!==void 0?{nativeModelId:e.nativeModelId}:{},...e.settings?{settings:{...e.settings.reasoningEffort!==void 0?{reasoningEffort:e.settings.reasoningEffort}:{},...e.settings.temperature!==void 0?{temperature:e.settings.temperature}:{}}}:{},fallback:{provider:e.fallback.provider,model:e.fallback.model}}}function G_(e){if(Dt(e)){if(e.kind==="orgProvider"){const t=tt(e.id);return t?{kind:"orgProvider",id:t}:void 0}if(e.kind==="localProvider"){const t=tt(e.providerKey);if(!t)return;const r=tt(e.customProviderName);return{kind:"localProvider",providerKey:t,...r?{customProviderName:r}:{}}}}}function mx(e){if(!Dt(e))return;const t=tt(e.rail),r=tt(e.providerKey);if(!t||!r)return;const n=tt(e.connectionLabel),i=Fo(e.credentialVersion),s=tt(e.nativeModelId);return{rail:t,providerKey:r,...n?{connectionLabel:n}:{},...i!==void 0?{credentialVersion:i}:{},...s?{nativeModelId:s}:{}}}function _x(e){if(!Dt(e))return;const t=tt(e.rail),r=tt(e.wireModelId),n=tt(e.outcome),i=Fo(e.at);if(!t||!r||!n||i===void 0)return;const s=tt(e.code);return{rail:t,wireModelId:r,outcome:n,...s?{code:s}:{},at:i}}function xD(e){if(!Dt(e))return;const t=gx(e.requested),r=e.resolved;if(!t||!Dt(r))return;const n=tt(r.rail),i=tt(r.wireModelId),s=mx(r.offering);if(!n||!i||!s)return;const o=e.effectiveSettings;if(!Dt(o))return;const a=Fo(o.maxOutputTokens);if(a===void 0)return;const c=G_(r.connectionRef),l=tt(r.nativeModelId),u=e.harness,h=Dt(u)?tt(u.id):void 0,d=Dt(u)?tt(u.runtimeVersion):void 0,p=tt(o.reasoningEffort),f=Fo(o.temperature),v=Array.isArray(e.attempts)?e.attempts.flatMap(T=>{const I=_x(T);return I?[I]:[]}):[],m=tt(e.upstreamModel),_=e.deviation,w=Dt(_)?tt(_.kind):void 0,S=Dt(_)&&typeof _.reason=="string"?_.reason:"";return{requested:t,resolved:{rail:n,wireModelId:i,...c?{connectionRef:c}:{},...l?{nativeModelId:l}:{},offering:s},...h&&d?{harness:{id:h,runtimeVersion:d}}:{},effectiveSettings:{...p?{reasoningEffort:p}:{},...f!==void 0?{temperature:f}:{},maxOutputTokens:a},attempts:v,...m?{upstreamModel:m}:{},...w?{deviation:{kind:w,reason:S}}:{}}}var yx={gateway:"Vercel AI Gateway",openrouter:"OpenRouter",orgCloud:"organization connection",local:"local key"};function Wu(e){return yx[e]??e}var bx={provider_fallback:"Provider fallback",model_substitution:"Model substituted",harness_substitution:"Harness substituted"};function wx(e){return bx[e]??e}function qs(e){const t=e.resolved.connectionRef;return t?.kind==="localProvider"&&t.customProviderName?t.customProviderName:e.resolved.offering.providerKey}function Sx(e){const{rail:t,offering:r}=e.resolved;switch(t){case"gateway":case"openrouter":return`${Wu(t)} (MCPJam key)`;case"orgCloud":return r.connectionLabel?`org connection "${r.connectionLabel}" (${qs(e)})`:`org ${qs(e)} connection`;case"local":return r.connectionLabel?`local key "${r.connectionLabel}" (${qs(e)})`:`local ${qs(e)} key`;default:return`${t} (${r.providerKey})`}}function Ex(e){return e===0?"max output provider default":`max output ${e.toLocaleString("en-US")} tokens`}function kx(e){const t=e.effectiveSettings;return[...t.reasoningEffort?[`effort ${t.reasoningEffort}`]:[],...t.temperature!==void 0?[`temperature ${t.temperature}`]:[],Ex(t.maxOutputTokens)]}function Rx(e){const{wireModelId:t,nativeModelId:r}=e.resolved,n=[...r&&r!==t?[`deployment ${r}`]:[],...e.upstreamModel&&e.upstreamModel!==t?[`provider reported ${e.upstreamModel}`]:[]];return n.length>0?`${t} (${n.join(", ")})`:t}function Ax(e){return[`Ran on ${Rx(e)} via ${Sx(e)}`,...e.harness?[`${e.harness.id} v${e.harness.runtimeVersion}`]:[],...kx(e)].join(", ")}var Ix={hosted:"MCPJam-hosted",org:"organization connection",local:"local key"};function Tx(e){const t=e.requested;if(t.source==="legacy")return`Requested ${t.modelId} (saved without a source; inferred at run time)`;const r=Ix[t.source]??t.source,n=t.fallback.provider==="none"?"no fallback permitted":`${Wu(t.fallback.provider)} fallback permitted`;return`Requested ${t.modelId} (${r}, ${n})`}function $x(e){return e.attempts.map((t,r)=>{const n=t.outcome==="ok"?"ok":t.outcome==="error"?`failed${t.code?` (${t.code})`:""}`:`${t.outcome}${t.code?` (${t.code})`:""}`;return`Attempt ${r+1}: ${Wu(t.rail)} · ${t.wireModelId} · ${n}`})}function MD(e){return{line:Ax(e),request:Tx(e),attempts:$x(e),...e.deviation?{deviation:{kind:e.deviation.kind,title:wx(e.deviation.kind),reason:e.deviation.reason}}:{}}}var Cx="=?base64?";function Px(e){const t=e.toLowerCase();if(t==="mcp-protocol-version")return"protocol-version";if(t==="mcp-method")return"method";if(t==="mcp-name")return"name";if(t==="mcp-session-id")return"session";if(t==="last-event-id")return"resumption";if(t.startsWith("mcp-param-"))return"param"}function Ox(e){const t=globalThis;if(typeof t.atob=="function"){const r=t.atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i+=1)n[i]=r.charCodeAt(i);return new TextDecoder("utf-8",{fatal:!0}).decode(n)}if(t.Buffer)return t.Buffer.from(e,"base64").toString("utf8");throw new Error("no base64 decoder available")}function to(e){if(!e.startsWith("=?base64?")||!e.endsWith("?=")||e.length<11)return{raw:e,encoded:!1,value:e};const t=e.slice(9,e.length-2);try{return{raw:e,encoded:!0,value:Ox(t)}}catch(r){return{raw:e,encoded:!0,value:e,decodeError:r instanceof Error?r.message:String(r)}}}var xx=new Set(["tools/call","resources/read","prompts/get"]),W_=new Set(["tasks/get","tasks/update","tasks/cancel"]);function Mx(e){return e===void 0?!1:xx.has(e)||W_.has(e)}var Bp=["protocol-version","method","name","param","session","resumption"];function Lx(e){return e!==void 0&&W_.has(e)?".params.taskId":e==="resources/read"?".params.uri":".params.name"}function Dx(e){const t=e.declarations??[],r=Wx(t,e.arguments);return t.map(n=>{const i=`${Z_}${n.headerName}`,s=r[i];return{header:i.toLowerCase(),displayName:i,expected:s===void 0?void 0:to(s).value,bodyField:`.params.arguments${n.path.map(o=>`.${o}`).join("")}`}})}function LD(e,t,r){const n=new Map;for(const[d,p]of Object.entries(e))n.set(d.toLowerCase(),{name:d,value:p});const i=n.get("mcp-protocol-version")?.value??t?.protocolVersion,s=!!i&&R$(i)&&A$(i)&&!!t,o=[],a=new Set,c=s&&t?[{header:"mcp-protocol-version",family:"protocol-version",bodyValue:t.protocolVersion,bodyField:"._meta protocolVersion",required:!0},{header:"mcp-method",family:"method",bodyValue:t.method,bodyField:".method",required:!0},{header:"mcp-name",family:"name",bodyValue:t.name,bodyField:Lx(t.method),required:Mx(t.method)}]:[];for(const d of c){a.add(d.header);const p=n.get(d.header);if(!p){d.required&&d.bodyValue!==void 0?o.push({name:d.header,family:d.family,status:"missing",bodyValue:d.bodyValue,bodyField:d.bodyField}):!d.required&&t?.method!==void 0&&o.push({name:d.header,family:d.family,status:"not-required"});continue}const f=to(p.value),v={name:p.name,family:d.family,raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):d.bodyValue===void 0?o.push({...v,status:"unchecked"}):f.value===d.bodyValue?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.bodyValue,bodyField:d.bodyField})}const l=r!==void 0&&"arguments"in r,u=s&&r?Dx(r):[],h=s&&r?.declarations!==void 0;for(const d of u){a.add(d.header);const p=n.get(d.header);if(!p){if(!l){o.push({name:d.displayName,family:"param",status:"unchecked"});continue}o.push(d.expected===void 0?{name:d.displayName,family:"param",status:"not-required"}:{name:d.displayName,family:"param",status:"missing",bodyValue:d.expected,bodyField:d.bodyField});continue}const f=to(p.value),v={name:p.name,family:"param",raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):l?d.expected===void 0?o.push({...v,status:"mismatch",bodyValue:"(absent from arguments)",bodyField:d.bodyField}):f.value===d.expected?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.expected,bodyField:d.bodyField}):o.push({...v,status:"unchecked"})}for(const[d,p]of n){if(a.has(d))continue;const f=Px(p.name);if(!f)continue;const v=to(p.value),m=s&&f==="param"&&!!v.decodeError,_=h&&f==="param"&&!m;o.push({name:p.name,family:f,raw:p.value,decoded:v.encoded&&!v.decodeError?v.value:void 0,status:m?"undecodable":_?"undeclared":"unchecked"})}return o.sort((d,p)=>Bp.indexOf(d.family)-Bp.indexOf(p.family)||d.name.localeCompare(p.name))}var Gp="x-mcp-header",Z_="Mcp-Param-",Nx=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,zx=new Set(["string","integer","boolean","number"]),Ux=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Fx=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function qx(e){return e.length===0?"<root>":e.join(".")}function DD(e){const t=[],r=new Map,n=(s,o,a)=>{if(s===null||typeof s!="object")return;const c=s;if(Gp in c){const u=qx(o);if(!a||o.length===0)return`${u}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;const h=c[Gp];if(typeof h!="string"||h.length===0)return`${u}: x-mcp-header MUST be a non-empty string`;if(!Nx.test(h))return`${u}: x-mcp-header '${h}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;const d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!zx.has(d))return`${u}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;const p=h.toLowerCase(),f=r.get(p);if(f!==void 0)return`x-mcp-header '${h}' is not case-insensitively unique (also declared as '${f}')`;r.set(p,h),t.push({path:o,headerName:h,type:d})}const l=c.properties;if(l!==null&&typeof l=="object")for(const[u,h]of Object.entries(l)){const d=n(h,[...o,u],a);if(d!==void 0)return d}for(const u of Ux){const h=c[u];if(h===void 0)continue;const d=h!==null&&typeof h=="object"&&Fx.has(u),p=Array.isArray(h)?h:d?Object.values(h):[h];for(const f of p){const v=n(f,[...o,`<${u}>`],!1);if(v!==void 0)return v}}},i=n(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}function jx(e){const t=globalThis,r=new TextEncoder().encode(e);if(typeof t.btoa=="function"){let n="";for(const i of r)n+=String.fromCodePoint(i);return t.btoa(n)}if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");throw new Error("no base64 encoder available")}function Hx(e){if(e.length===0||e.startsWith("=?base64?")&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t+=1){const r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function Vx(e){if(!Hx(e))return e;const t=jx(e);return`${Cx}${t}?=`}function Bx(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function Gx(e,t){let r=e;for(const n of t){if(r===null||typeof r!="object")return;r=r[n]}return r}function Wx(e,t){const r={};for(const n of e){const i=Gx(t,n.path);if(i==null)continue;const s=Bx(i);s!==void 0&&(r[`${Z_}${n.headerName}`]=Vx(s))}return r}var Zx="tracestate",Jx="baggage",Kx=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/,Yx="0".repeat(32),Xx="0".repeat(16);function Qx(e){if(typeof e!="string")return;const t=Kx.exec(e);if(!t)return;const[,r,n,i,s]=t;if(!(r==="ff"||r!=="00")&&!(n===Yx||i===Xx))return{version:r,traceId:n,spanId:i,flags:s,sampled:(Number.parseInt(s,16)&1)===1}}function e1(e){return Qx(e)!==void 0}var t1=32,r1=/^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/,n1=/^[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]$/;function i1(e){if(typeof e!="string"||e.length===0)return!1;const t=e.split(",");if(t.length>t1)return!1;let r=0;for(const n of t){const i=n.trim();if(i.length===0)continue;r+=1;const s=i.indexOf("=");if(s<=0||!r1.test(i.slice(0,s))||!n1.test(i.slice(s+1)))return!1}return r>0}var s1=180,o1=8192,a1=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Wp=/^[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*$/;function c1(e){if(typeof e!="string"||e.length===0||e.length>o1)return!1;const t=e.split(",");if(t.length>s1)return!1;for(const r of t){const n=r.trim();if(n.length===0)return!1;const[i,...s]=n.split(";"),o=i.indexOf("=");if(o<=0||!a1.test(i.slice(0,o).trim())||!Wp.test(i.slice(o+1).trim()))return!1;for(const a of s)if(!Wp.test(a.replace(/=/g,"").trim()))return!1}return!0}function l1(e){if(!(!e||!e1(e.traceparent)))return{traceparent:e.traceparent,...i1(e.tracestate)?{tracestate:e.tracestate}:{},...c1(e.baggage)?{baggage:e.baggage}:{}}}function ND(e){if(!e||typeof e!="object")return;const t=r=>{const n=e[r];return typeof n=="string"?n:void 0};return l1({traceparent:t("traceparent")??"",tracestate:t(Zx),baggage:t(Jx)})}var zD=At.MissingRequiredClientCapability,u1=/\.[cm]?[jt]sx?$/,d1=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function h1(e,t){if(typeof e!="string"||!d1.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!u1.test(r.pathname)}function p1(e,t){return e.length===0?!1:e.every(r=>h1(r,t))}function f1(e,t){return e.length===0?!1:e.every(r=>p1(r,t))}var v1=["timeout","network","upstream_status","bad_json","bad_payload","provisioning"],g1=/^[A-Z][A-Z0-9_]{1,63}$/;function m1(e){return typeof e=="string"&&v1.includes(e)}function _1(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:n}=e;if(!m1(t))return;const i={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(i.upstreamStatus=r),typeof n=="string"&&g1.test(n)&&(i.networkCode=n),i}var J_="mcpjam_guest_session_v1",Ll="mcpjam_guest_activated",Aa=3e5,wt=null,yr=null,br=null,sn=null,K_=!1,Or=0,Dl=new Set,y1=6e5,Un=null,Ai=null;function Y_(){for(const e of Dl)e()}function X_(e){Ai!==null&&(clearTimeout(Ai),Ai=null),Un=e,e&&(Ai=setTimeout(()=>{Ai=null,Un===e&&X_(null)},Math.max(0,e.until-Date.now()))),Y_()}function b1(){return Un&&Un.until<=Date.now()&&(Un=null),Un}function Ia(e){const t=wt?.guestId??null;wt=e,t!==(wt?.guestId??null)&&Y_()}function UD(e){return Dl.add(e),()=>{Dl.delete(e)}}function FD(e){if(e)try{localStorage.getItem(Ll)!==e&&localStorage.setItem(Ll,e)}catch{}}function qD(e){if(!e)return!1;try{return localStorage.getItem(Ll)===e}catch{return!1}}function w1(){if(typeof window>"u")return;const e=window.__MCP_GUEST_BOOTSTRAP__;try{delete window.__MCP_GUEST_BOOTSTRAP__}catch{window.__MCP_GUEST_BOOTSTRAP__=void 0}e&&(typeof e.token!="string"||e.token.length===0||typeof e.expiresAt!="number"||typeof e.guestId!="string"||e.guestId.length===0||e.expiresAt-Aa<=Date.now()||(wt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}w1();function Zu(){if(K_)return null;try{const e=localStorage.getItem(J_);if(!e)return null;const t=JSON.parse(e);return typeof t.token=="string"&&t.token.length>0?t.token:null}catch{return null}}function Zp(){try{localStorage.removeItem(J_)}catch{}K_=!0}var Pi=class extends Error{status;upstreamFailure;constructor(e,t,r){super(e),this.name="GuestSessionRequestError",this.status=t,this.upstreamFailure=r}},Q_=class extends Pi{retryAfterMs;constructor(e){super("guest-session creation refused (429)"),this.name="GuestSessionRefusedError",this.retryAfterMs=e}},S1=1e3;async function E1(e){if(typeof e.json!="function")return;let t;try{const r=await Promise.race([e.json(),new Promise(n=>{t=setTimeout(()=>n(void 0),S1)})]);return _1(r?.details)}catch{return}finally{t!==void 0&&clearTimeout(t)}}function k1(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function R1(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:y1}async function Ju(e,t){const r={mode:e};t&&(r.legacyToken=t);let n;try{n=await fetch("/api/web/guest-session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(s){throw new Pi(s instanceof Error?s.message:"network error")}if(n.status===204)return t&&Zp(),null;if(n.status===429)throw new Q_(R1(n.headers?.get?.("retry-after")));if(!n.ok){const s=await E1(n);throw new Pi(`guest-session request failed: ${n.status} ${n.statusText}${k1(s)}`,n.status,s)}let i;try{i=await n.json()}catch(s){throw new Pi(`guest-session response was not valid JSON: ${s instanceof Error?s.message:String(s)}`)}if(typeof i?.token!="string"||typeof i?.expiresAt!="number")throw new Pi("guest-session response missing token or expiresAt");return t&&Zp(),i}async function A1(){if(wt&&wt.expiresAt-Aa>Date.now())return wt;if(b1())return null;if(yr)return yr;const e=Zu(),t=Or;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Ju("lookup_or_create",e);return n&&t===Or&&Ia(n),n}catch(n){if(n instanceof Q_)return X_({until:Date.now()+n.retryAfterMs}),null;throw console.error("Failed to create guest session:",n),n}finally{yr===r&&(yr=null)}})(),yr=r,r.catch(()=>{}),yr}async function I1(){try{return await A1()}catch{return null}}async function jD(){return(await I1())?.token??null}function Nl(){return wt&&wt.expiresAt-Aa>Date.now()?wt:null}async function T1(){if(wt&&wt.expiresAt-Aa>Date.now())return wt.token;if(br)return(await br)?.token??null;const e=Zu(),t=Or;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Ju("lookup_only",e);return n&&t===Or&&Ia(n),n}finally{br===r&&(br=null)}})(),br=r,(await br)?.token??null}async function HD(){const e=Nl();if(e?.guestId)return e.guestId;try{await T1()}catch{return null}return Nl()?.guestId??null}function $1(){Or+=1,Ia(null),yr=null,br=null,sn=null}async function VD(){let e=!1;try{const t=await fetch("/api/web/guest-session/revoke",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(t.ok)try{e=(await t.json())?.revoked===!0}catch{e=!1}}catch(t){console.error("Failed to revoke guest session:",t)}finally{$1()}return e}async function BD(){try{const e=await fetch("/api/web/guest-session/promotion-proof",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(e.status===204||!e.ok)return null;const t=await e.json();return typeof t.token=="string"&&t.token.length>0?t.token:null}catch(e){return console.error("Failed to fetch guest promotion proof:",e),null}}async function C1(){if(sn)return(await sn)?.token??null;Or+=1;const e=Or;wt=null,yr=null,br=null,sn=(async()=>{try{const t=await Ju("lookup_or_create",Zu());return t&&e===Or&&Ia(t),t}catch(t){throw console.error("Failed to refresh guest session:",t),t}})(),sn.catch(()=>{});try{return(await sn)?.token??null}finally{sn=null}}async function GD(){try{return await C1()}catch{return null}}var ey=new Set(["caniuse.dev","www.caniuse.dev"]),P1=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),O1=new Set([...ey,...P1]),WD="https://app.mcpjam.com";function x1(e){return ey.has(e.toLowerCase())}function ZD(e=typeof window>"u"?void 0:window.location.hostname){return!!e&&x1(e)}var JD=null,KD="write",Jp=null,M1=String(101376);function YD(){return Jp?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:Jp,scope:"bot applications.commands",permissions:M1}).toString()}`:null}var L1="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",D1="https://us.i.posthog.com";function N1(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:D1}function ty(e){const t=Nl()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var z1={advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},U1=["/results/","/conformance/shared/","/evals/shared/"];function ry(e){let t=e;for(const r of U1){const n=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");t=t.replace(new RegExp(`(${n})[^/?#]+`,"g"),"$1[redacted]")}return t=t.replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]"),t}var F1=new Set(["Load failed","Failed to fetch","NetworkError when attempting to fetch resource."]),q1=/^'TypeError' captured as exception with message: '([\s\S]*)'$/;function j1(e){const t=q1.exec(e.value),r=t?t[1]:e.type==="TypeError"?e.value:void 0;return r===void 0?!1:F1.has(r)||r.startsWith("Failed to fetch (")&&r.endsWith(")")}var H1=1e4;function V1(e){const t=e.$exception_list;if(!(Array.isArray(t)&&t.some(i=>typeof i?.value=="string"&&j1(i))))return;const r=iy();if(!r)return;const n=Date.now()-r.at;n>H1||(e.failed_request=`${r.method} ${ry(r.target)}`,e.failed_request_age_ms=n)}function B1(e,t){for(const r of["$current_url","$referrer","$pathname","$session_entry_url","$session_entry_pathname","$session_entry_referrer","$initial_current_url","$initial_pathname","$initial_referrer"])typeof e[r]=="string"&&(e[r]=ry(e[r]));return t==="$exception"&&V1(e),e}function G1(e){if(e?.event!=="$exception"||typeof window>"u")return e;const t=e.properties?.$exception_list;if(!Array.isArray(t))return e;const r=t.map(n=>{const i=n?.stacktrace?.frames;return Array.isArray(i)?i.map(s=>s?.filename):[]});return f1(r,window.location.origin)?null:e}var W1=O1;function gs(){return Z1()}function Z1(){return typeof window<"u"&&window.isElectron===!0}var J1="data-ph-no-capture",K1={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:`[${J1}]`};function Ku(e=typeof window>"u"?void 0:window.location?.pathname){return!!e&&(e.startsWith("/results/")||e.startsWith("/conformance/shared/")||e.startsWith("/evals/shared/"))}function Y1(){return gs()&&!Ku()}var Ec=!1;function XD(e,t){try{if(!gs())return;if(Ku(t)){e.sessionRecordingStarted?.()&&(Ec=!0),e.stopSessionRecording?.();return}Ec&&(Ec=!1,e.startSessionRecording?.())}catch{}}function X1(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&W1.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var Kp={api_host:N1(),ui_host:"https://us.posthog.com",...ty(),...X1(),...z1,person_profiles:"always",sanitize_properties:B1,before_send:G1,capture_dead_clicks:!0,get capture_exceptions(){return gs()},get disable_session_recording(){return!Y1()},session_recording:K1,loaded:e=>{e.register({environment:"production",platform:zl(),version:"3.12.3",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({local_browser_security_version:"1",deployment:"self_hosted",platform:zl()})}};function Q1(e){const t=ty(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors(Kp),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):Kp}var QD=()=>L1,eN=e=>Q1(e);function zl(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function eM(){return"production"}function tN(e){const t=eM();return{location:e,platform:zl(),...t!==void 0?{environment:t}:{}}}function tM(e){try{if(typeof e!="object"||e===null)return;const t=e.normalized;return FC(t)?t:void 0}catch{return}}function rN(e,t){try{if(!gs()||Fl(e))return!1;const r=tM(e)??dP(e),n=lP(r);return n!=="mcpjam"?!1:(ny(e,{...t,extra:{...t.extra??{},slug:r.slug,origin:n}}),!0)}catch{return!1}}var rM=rf();function nM(e){if(e instanceof Error)return e;try{return new Error(typeof e=="string"?e:JSON.stringify(e))}catch{return new Error(String(e))}}function ny(e,t){if(Fl(e))return;const r=Ay(nM(e)),n=tf(r.message);if(n&&t.queryBackend&&(n.convex_backend=t.queryBackend),n&&rM(n.convex_backend,n.request_id))return;const i=n&&typeof window<"u"?Ac(window.location.href):void 0;try{K0(r,{level:t.level??"error",tags:{source:t.source,...n},...n?{extra:{boundary:t.extra?.boundary,componentStack:t.extra?.componentStack,page_location:i}}:t.extra?{extra:t.extra}:{}})}catch{}try{gs()&&!Ku()&&kE.captureException(r,{source:t.source,level:t.level??"error",...n?{...n,page_location:i}:t.extra??{}})}catch{}}function nN(e,t,r){ny(e,{source:r?`react_boundary:${r}`:"react_boundary",extra:{componentStack:t?.componentStack??void 0,boundary:r??"unnamed"}})}export{qO as $,sM as $i,sL as $n,$M as $r,oC as $t,qD as A,vM as Ai,Dm as An,NM as Ar,Cl as At,LD as B,cn as Bi,pl as Bn,a0 as Br,lP as Bt,T1 as C,fM as Ci,rn as Cn,qM as Cr,PP as Ct,b1 as D,Ho as Di,PL as Dn,p0 as Dr,$P as Dt,BD as E,Ly as Ei,dT as En,FM as Er,la as Et,f1 as F,dM as Fi,fl as Fn,MM as Fr,fD as Ft,MD as G,Iy as Gi,fL as Gn,CM as Gr,Jt as Gt,wx as H,jo as Hi,mI as Hn,Vr as Hr,m_ as Ht,ND as I,Oy as Ii,AL as In,u0 as Ir,dD as It,Bu as J,Ay as Ji,kE as Jn,ad as Jr,oD as Jt,PD as K,cM as Ki,UE as Kn,Go as Kr,Ou as Kt,Qx as L,uM as Li,ze as Ln,d0 as Lr,dP as Lt,VD as M,Hl as Mi,hn as Mn,LM as Mr,vP as Mt,UD as N,cs as Ni,up as Nn,OM as Nr,pD as Nt,I1 as O,My as Oi,CL as On,UM as Or,gD as Ot,_1 as P,Cy as Pi,ML as Pn,xM as Pr,hD as Pt,BO as Q,Xu as Qi,YM as Qn,Gl as Qr,nD as Qt,W_ as R,td as Ri,$L as Rn,l0 as Rr,FC as Rt,Nl as S,pM as Si,Mt as Sn,jM as Sr,Fr as St,jD as T,hM as Ti,TL as Tn,y0 as Tr,mD as Tt,Wu as U,$t as Ui,wL as Un,_n as Ur,SC as Ut,DD as V,rd as Vi,II as Vn,ls as Vr,uD as Vt,xD as W,nf as Wi,lk as Wn,PM as Wr,mp as Wt,jp as X,Ry as Xi,XM as Xn,ao as Xr,cD as Xt,qp as Y,Fl as Yi,nL as Yn,Jn as Yr,aD as Yt,Fp as Z,aM as Zi,K0 as Zn,Vo as Zr,sC as Zt,WD as _,xi as _i,Ar as _n,VM as _r,_a as _t,zl as a,Ir as ai,X$ as an,KM as ar,_r as at,GD as b,gM as bi,EL as bn,dd as br,ma as bt,Ku as c,Bl as ci,YL as cn,ZM as cr,SD as ct,Y1 as d,EM as di,qL as dn,k0 as dr,wO as dt,oM as ea,TM as ei,iD as en,rL as er,TD as et,tN as f,wM as fi,G$ as fn,HM as fr,mO as ft,YD as g,bM as gi,zs as gn,E0 as gr,N_ as gt,KD as h,yM as hi,A$ as hn,BM as hr,yD as ht,L1 as i,RM as ii,rD as in,iL as ir,UO as it,FD as j,oo as ji,Lo as jn,DM as jr,vD as jt,A1 as k,jl as ki,IL as kn,zM as kr,wP as kt,gs as l,Zn as li,Y$ as ln,JM as lr,ED as lt,JD as m,Hy as mi,R$ as mn,ff as mr,pO as mt,ny as n,ro as na,AM as ni,eD as nn,eL as nr,FO as nt,QD as o,kM as oi,QL as on,fr as or,Np as ot,XD as p,SM as pi,wl as pn,GM as pr,bD as pt,CD as q,lM as qi,cL as qn,$c as qr,Cr as qt,rN as r,IM as ri,tD as rn,tL as rr,RD as rt,eN as s,Vl as si,XL as sn,T0 as sr,TO as st,nN as t,no as ta,Gy as ti,sD as tn,QM as tr,AD as tt,ry as u,zt as ui,jL as un,A0 as ur,wD as ut,ZD as v,_M as vi,xL as vn,WM as vr,ya as vt,HD as w,xy as wi,OL as wn,m0 as wr,De as wt,C1 as x,Fy as xi,RL as xn,Wo as xr,_D as xt,$1 as y,mM as yi,kL as yn,Wl as yr,wa as yt,Px as z,sf as zi,cT as zn,c0 as zr,pP as zt};
101
101
 
102
- //# sourceMappingURL=error-reporting-fkIkUpXy.js.map
102
+ //# sourceMappingURL=error-reporting-Dg5b1JwS.js.map