@mcpjam/inspector 1.0.0 → 1.0.1

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.
@@ -1,4 +1,4 @@
1
- (function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"dd0323b7fe30793977eccdae3ff21db273efd6be"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="b293afe3-11e2-47cb-9eb1-822604cee60c",t._sentryDebugIdIdentifier="sentry-dbid-b293afe3-11e2-47cb-9eb1-822604cee60c")})()}catch{}function NX(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function th(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var TS={exports:{}},bp={};/**
1
+ (function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"e4bae8ed033602022eac9b77e59f2675a062aa1f"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="17b7368b-56c8-445b-b6e7-14a439278ef1",t._sentryDebugIdIdentifier="sentry-dbid-17b7368b-56c8-445b-b6e7-14a439278ef1")})()}catch{}function NX(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function th(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var TS={exports:{}},bp={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -1846,7 +1846,7 @@ ${t.error.stack}`]})]})]})]})}const ZAe=["error","warn","info","debug","trace"];
1846
1846
  --json-null: var(--muted-foreground);
1847
1847
  color: var(--muted-foreground) !important;
1848
1848
  }
1849
- `}),f.jsx("div",{className:"json-viewer-mcpjam",children:f.jsx(iu,{src:T,dark:!1,theme:"default",enableClipboard:!0,displaySize:!0,collapsed:2,collapseStringsAfterLength:80,collapseObjectsAfterLength:10,style:{fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', monospace",backgroundColor:"hsl(var(--background))",padding:0,borderRadius:0,border:"none"}})})]}):f.jsx("pre",{className:"text-xs bg-background p-2 rounded border mt-1 overflow-auto",children:C.body})})()]},C.id))})})]})]})}class VC{constructor(e){this.serverUrl=e,sessionStorage.setItem("debug-oauth-server-url",e)}get redirectUrl(){return`${window.location.origin}/oauth/callback/debug`}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:"MCPJam",client_uri:"https://github.com/mcpjam/inspector"}}async clientInformation(){const e=`debug-client-info-${this.serverUrl}`,n=sessionStorage.getItem(e);if(n)return JSON.parse(n)}saveClientInformation(e){const n=`debug-client-info-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}async tokens(){const e=`debug-tokens-${this.serverUrl}`,n=sessionStorage.getItem(e);if(n)return JSON.parse(n)}saveTokens(e){const n=`debug-tokens-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}redirectToAuthorization(e){}saveCodeVerifier(e){const n=`debug-verifier-${this.serverUrl}`;sessionStorage.setItem(n,e)}codeVerifier(){const e=`debug-verifier-${this.serverUrl}`,n=sessionStorage.getItem(e);if(!n)throw new Error("No code verifier saved for debug session");return n}saveServerMetadata(e){const n=`debug-server-metadata-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}getServerMetadata(){const e=`debug-server-metadata-${this.serverUrl}`,n=sessionStorage.getItem(e);return n?JSON.parse(n):null}clear(){[`debug-client-info-${this.serverUrl}`,`debug-tokens-${this.serverUrl}`,`debug-verifier-${this.serverUrl}`,`debug-server-metadata-${this.serverUrl}`].forEach(n=>sessionStorage.removeItem(n))}}const Dy={isInitiatingAuth:!1,oauthTokens:null,oauthStep:"metadata_discovery",oauthMetadata:null,resourceMetadata:null,resourceMetadataError:null,resource:null,authServerUrl:null,oauthClientInfo:null,authorizationUrl:null,authorizationCode:"",latestError:null,statusMessage:null,validationError:null},Md=({label:t,isComplete:e,isCurrent:n,error:r,children:s})=>f.jsxs("div",{children:[f.jsxs("div",{className:`flex items-center p-2 rounded-md ${n?"bg-accent":""}`,children:[e?f.jsx(Ise,{className:"h-5 w-5 text-green-500 mr-2"}):f.jsx(Hse,{className:"h-5 w-5 text-muted-foreground mr-2"}),f.jsx("span",{className:`${n?"font-medium":""}`,children:t})]}),(n||e)&&s&&f.jsx("div",{className:"ml-7 mt-1",children:s}),n&&r&&f.jsxs("div",{className:"ml-7 mt-2 p-3 border border-red-300 bg-red-50 dark:bg-red-950/50 rounded-md",children:[f.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:"Error:"}),f.jsx("p",{className:"text-xs text-red-600 dark:text-red-500 mt-1",children:r.message})]})]}),Ly=["metadata_discovery","client_registration","authorization_redirect","authorization_code","token_request","complete"],nRe=({serverUrl:t,flowState:e,updateFlowState:n,proceedToNextStep:r})=>{const s=w.useMemo(()=>new VC(t),[t]),[i,a]=w.useState(null),l=Ly.findIndex(d=>d===e.oauthStep);w.useEffect(()=>{const d=async()=>{if(e.oauthClientInfo)a(e.oauthClientInfo);else try{const h=await s.clientInformation();h&&a(h)}catch(h){console.error("Failed to fetch client information:",h)}};l>Ly.indexOf("client_registration")&&d()},[s,e.oauthStep,e.oauthClientInfo,l]);const u=d=>({isComplete:l>Ly.indexOf(d)||l===Ly.length-1,isCurrent:e.oauthStep===d,error:e.oauthStep===d?e.latestError:null});return f.jsxs("div",{className:"rounded-md border p-6 space-y-4 mt-4",children:[f.jsx("h3",{className:"text-lg font-medium",children:"OAuth Flow Progress"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Follow these steps to complete OAuth authentication with the server."}),f.jsxs("div",{className:"space-y-3",children:[f.jsx(Md,{label:"Metadata Discovery",...u("metadata_discovery"),children:e.oauthMetadata&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsxs("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:["OAuth Metadata Sources",!e.resourceMetadata&&" ℹ️"]}),e.resourceMetadata&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"font-medium",children:"Resource Metadata:"}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["From"," ",new URL("/.well-known/oauth-protected-resource",t).href]}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.resourceMetadata,null,2)})]}),e.resourceMetadataError&&f.jsxs("div",{className:"mt-2 p-3 border border-blue-300 bg-blue-50 dark:bg-blue-950/50 rounded-md",children:[f.jsxs("p",{className:"text-sm font-medium text-blue-700 dark:text-blue-400",children:["ℹ️ Problem with resource metadata from"," ",f.jsx("a",{href:new URL("/.well-known/oauth-protected-resource",t).href,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:new URL("/.well-known/oauth-protected-resource",t).href})]}),f.jsxs("p",{className:"text-xs text-blue-600 dark:text-blue-500 mt-1",children:["Resource metadata was added in the"," ",f.jsx("a",{href:"https://modelcontextprotocol.io/specification/draft/basic/authorization#2-3-1-authorization-server-location",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"2025-DRAFT-v2 specification update"}),f.jsx("br",{}),e.resourceMetadataError.message,e.resourceMetadataError instanceof TypeError&&" (This could indicate the endpoint doesn't exist or does not have CORS configured)"]})]}),e.oauthMetadata&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"font-medium",children:"Authorization Server Metadata:"}),e.authServerUrl&&f.jsxs("p",{className:"text-xs text-muted-foreground",children:["From"," ",new URL("/.well-known/oauth-authorization-server",e.authServerUrl).href]}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.oauthMetadata,null,2)})]})]})}),f.jsx(Md,{label:"Client Registration",...u("client_registration"),children:i&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Registered Client Information"}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(i,null,2)})]})}),f.jsx(Md,{label:"Preparing Authorization",...u("authorization_redirect"),children:e.authorizationUrl&&f.jsxs("div",{className:"mt-2 p-3 border rounded-md bg-muted",children:[f.jsx("p",{className:"font-medium mb-2 text-sm",children:"Authorization URL:"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"text-xs break-all",children:e.authorizationUrl}),f.jsx("a",{href:e.authorizationUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300","aria-label":"Open authorization URL in new tab",title:"Open authorization URL",children:f.jsx(gR,{className:"h-4 w-4"})})]}),f.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Click the link to authorize in your browser. After authorization, you'll be redirected back to continue the flow."})]})}),f.jsx(Md,{label:"Request Authorization and acquire authorization code",...u("authorization_code"),children:f.jsxs("div",{className:"mt-3",children:[f.jsx("label",{htmlFor:"authCode",className:"block text-sm font-medium mb-1",children:"Authorization Code"}),f.jsx("div",{className:"flex gap-2",children:f.jsx("input",{id:"authCode",value:e.authorizationCode,onChange:d=>{n({authorizationCode:d.target.value,validationError:null})},placeholder:"Enter the code from the authorization server",className:`flex h-9 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e.validationError?"border-red-500":"border-input"}`})}),e.validationError&&f.jsx("p",{className:"text-xs text-red-600 dark:text-red-500 mt-1",children:e.validationError}),f.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Once you've completed authorization in the link, paste the code here."})]})}),f.jsx(Md,{label:"Token Request",...u("token_request"),children:e.oauthMetadata&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Token Request Details"}),f.jsxs("div",{className:"mt-2 p-2 bg-muted rounded-md",children:[f.jsx("p",{className:"font-medium",children:"Token Endpoint:"}),f.jsx("code",{className:"block mt-1 text-xs overflow-x-auto",children:e.oauthMetadata.token_endpoint})]})]})}),f.jsx(Md,{label:"Authentication Complete",...u("complete"),children:e.oauthTokens&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Access Tokens"}),f.jsx("p",{className:"mt-1 text-sm",children:"Authentication successful! You can now use the authenticated connection. These tokens will be used automatically for server requests."}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.oauthTokens,null,2)})]})})]}),f.jsxs("div",{className:"flex gap-3 mt-4",children:[e.oauthStep!=="complete"&&f.jsx(f.Fragment,{children:f.jsx(De,{onClick:r,disabled:e.isInitiatingAuth,children:e.isInitiatingAuth?"Processing...":"Continue"})}),e.oauthStep==="authorization_redirect"&&e.authorizationUrl&&f.jsx(De,{variant:"outline",onClick:()=>window.open(e.authorizationUrl,"_blank"),children:"Open in New Tab"})]})]})},rRe={metadata_discovery:{canTransition:async()=>!0,execute:async t=>{try{if(t.updateState({latestError:null}),!t.serverUrl)throw new Error("Server URL is required");let e;try{e=new URL(t.serverUrl).toString()}catch{throw new Error(`Invalid server URL: ${t.serverUrl}`)}let n;try{n=new URL("/",e)}catch{throw new Error(`Failed to create base URL from server URL: ${e}`)}let r=null,s=null;try{if(r=await _H(e),r?.authorization_servers?.length){const l=r.authorization_servers[0];try{n=new URL(l)}catch{console.warn(`Invalid authorization server URL: ${l}, using default`)}}}catch(l){s=l instanceof Error?l:new Error(String(l))}const i=await Vle(n.toString());let a=null;try{a=await xH(e,t.provider,r??void 0)??null}catch(l){console.warn("selectResourceURL failed or not provided:",l)}t.updateState({resourceMetadata:r,resourceMetadataError:s,resource:a,authServerUrl:n,oauthMetadata:i,oauthStep:"client_registration"})}catch(e){const n=e instanceof Error?e:new Error(String(e));console.error("Metadata discovery error:",{error:n,serverUrl:t.serverUrl,serverName:t.serverName}),t.updateState({latestError:n,statusMessage:{type:"error",message:`Metadata discovery failed: ${n.message}`}})}}},client_registration:{canTransition:async t=>!!t.state.oauthMetadata,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata)throw new Error("OAuth metadata not available");let e;try{const n={...t.provider.clientMetadata},r=t.state.resourceMetadata?.scopes_supported||t.state.oauthMetadata.scopes_supported;r&&r.length>0&&(n.scope=r.join(" "));try{e=await kH(t.serverUrl,{metadata:t.state.oauthMetadata,clientMetadata:n}),t.provider.saveClientInformation(e)}catch(s){if(e=await t.provider.clientInformation(),!e)throw s}}catch(n){console.warn("Dynamic client registration failed, using static client metadata:",n);const r=await t.provider.clientInformation();r?e=r:(e={client_id:`static_client_${Date.now()}`,...t.provider.clientMetadata},t.provider.saveClientInformation(e))}t.updateState({oauthClientInfo:e,oauthStep:"authorization_redirect",statusMessage:{type:"success",message:"Client registration completed successfully."}})}catch(e){const n=e instanceof Error?e:new Error(String(e));console.error("Client registration error:",{error:n,serverUrl:t.serverUrl,serverName:t.serverName,hasOAuthMetadata:!!t.state.oauthMetadata,oauthMetadata:t.state.oauthMetadata,providerRedirectUrl:t.provider.redirectUrl,providerClientMetadata:t.provider.clientMetadata}),t.updateState({latestError:n,statusMessage:{type:"error",message:`Client registration failed: ${n.message}`}})}}},authorization_redirect:{canTransition:async t=>!!t.state.oauthMetadata&&!!t.state.oauthClientInfo,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata||!t.state.oauthClientInfo)throw new Error("OAuth metadata or client info not available");const e=t.state.resourceMetadata?.scopes_supported||t.state.oauthMetadata.scopes_supported,n=e&&e.length>0?e.join(" "):void 0,r=new Uint8Array(32);crypto.getRandomValues(r);const s=Array.from(r,a=>a.toString(16).padStart(2,"0")).join(""),i=await SH(t.serverUrl,{metadata:t.state.oauthMetadata,clientInformation:t.state.oauthClientInfo,redirectUrl:t.provider.redirectUrl,scope:n,state:s,resource:t.state.resource??void 0});t.provider.saveCodeVerifier(i.codeVerifier),t.updateState({authorizationUrl:i.authorizationUrl.toString(),oauthStep:"authorization_code",statusMessage:{type:"info",message:"Authorization URL generated. Please complete authorization in your browser."}})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,statusMessage:{type:"error",message:`Authorization preparation failed: ${n.message}`}})}}},authorization_code:{canTransition:async t=>!!t.state.authorizationCode.trim(),execute:async t=>{try{if(t.updateState({latestError:null,validationError:null}),!t.state.authorizationCode.trim()){t.updateState({validationError:"Authorization code is required"});return}t.updateState({oauthStep:"token_request"})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,validationError:n.message})}}},token_request:{canTransition:async t=>!!t.state.authorizationCode.trim()&&!!t.state.oauthMetadata,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata||!t.state.authorizationCode.trim()||!t.state.oauthClientInfo)throw new Error("OAuth metadata, authorization code, or client info not available");const e=await EH(t.serverUrl,{metadata:t.state.oauthMetadata,clientInformation:t.state.oauthClientInfo,authorizationCode:t.state.authorizationCode,codeVerifier:t.provider.codeVerifier(),redirectUri:t.provider.redirectUrl});t.updateState({oauthTokens:e,oauthStep:"complete",statusMessage:{type:"success",message:"OAuth authentication completed successfully!"}})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,statusMessage:{type:"error",message:`Token exchange failed: ${n.message}`}})}}},complete:{canTransition:async()=>!1,execute:async()=>{}}};class sRe{constructor(e){this.context=e}async proceedToNextStep(){const e=this.context.state.oauthStep,n=rRe[e];if(!n)return console.error("No transition found for step:",e),!1;try{return this.context.updateState({isInitiatingAuth:!0}),await n.canTransition(this.context)?(await n.execute(this.context),!0):(console.warn("Cannot transition from step:",e),!1)}catch(r){console.error("Error during state transition:",r);const s=r instanceof Error?r:new Error(String(r));return this.context.updateState({latestError:s,statusMessage:{type:"error",message:s.message}}),!1}finally{this.context.updateState({isInitiatingAuth:!1})}}reset(){this.context.updateState({isInitiatingAuth:!1,oauthTokens:null,oauthStep:"metadata_discovery",oauthMetadata:null,resourceMetadata:null,resourceMetadataError:null,resource:null,authServerUrl:null,oauthClientInfo:null,authorizationUrl:null,authorizationCode:"",latestError:null,statusMessage:null,validationError:null})}}const iRe=({message:t})=>{let e,n,r;switch(t.type){case"error":e="bg-red-50 dark:bg-red-950/50",n="text-red-700 dark:text-red-400",r="border-red-200 dark:border-red-800";break;case"success":e="bg-green-50 dark:bg-green-950/50",n="text-green-700 dark:text-green-400",r="border-green-200 dark:border-green-800";break;case"info":default:e="bg-blue-50 dark:bg-blue-950/50",n="text-blue-700 dark:text-blue-400",r="border-blue-200 dark:border-blue-800";break}return f.jsx("div",{className:`p-3 rounded-md border ${e} ${r} ${n} mb-4`,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx($m,{className:"h-4 w-4"}),f.jsx("p",{className:"text-sm",children:t.message})]})})},aRe=({serverConfig:t,serverEntry:e,serverName:n})=>{const[r,s]=w.useState(X3),[i,a]=w.useState(Dy),[l,u]=w.useState(!1),d=w.useCallback(j=>{s(M=>({...M,...j}))},[]),h=w.useCallback(j=>{a(M=>({...M,...j}))},[]),p=w.useCallback(()=>{if(u(!1),h(Dy),r.serverUrl)try{new VC(r.serverUrl).clear()}catch(j){console.warn("Failed to clear debug OAuth provider state:",j)}},[r.serverUrl,h]);w.useEffect(()=>{if(t&&t.url&&n){const j=t.url.toString(),M=ra(n);d({serverUrl:j,tokens:M,error:null,statusMessage:null})}else d(X3)},[t,n,d]),w.useEffect(()=>{p()},[n,p]);const g=w.useCallback(async()=>{if(!t||!r.serverUrl||!n){d({statusMessage:{type:"error",message:"Please select a server before refreshing tokens"}});return}d({isAuthenticating:!0,error:null,statusMessage:null});try{let j;if(r.tokens)j=await MR(n);else{const M={serverName:n,serverUrl:r.serverUrl};j=await Qb(M)}if(j.success){const M=ra(n);d({tokens:M,isAuthenticating:!1,statusMessage:{type:"success",message:r.tokens?"Tokens refreshed successfully!":j.serverConfig?"OAuth authentication completed!":"OAuth flow initiated. You will be redirected to authorize access."}}),setTimeout(()=>{d({statusMessage:null})},3e3)}else d({isAuthenticating:!1,error:j.error||"OAuth operation failed",statusMessage:{type:"error",message:`Failed: ${j.error||"OAuth operation failed"}`}})}catch(j){d({isAuthenticating:!1,error:j instanceof Error?j.message:String(j),statusMessage:{type:"error",message:`Failed: ${j instanceof Error?j.message:String(j)}`}})}},[t,r.serverUrl,r.tokens,n,d]),v=w.useCallback(async()=>{if(!t||!r.serverUrl||!n){d({statusMessage:{type:"error",message:"Please select a server before starting OAuth"}});return}d({isAuthenticating:!0,error:null,statusMessage:null});try{Um(n);const j={serverName:n,serverUrl:r.serverUrl},M=await Qb(j);if(M.success){const I=ra(n);d({tokens:I,isAuthenticating:!1,statusMessage:{type:"success",message:M.serverConfig?"OAuth authentication completed!":"OAuth flow initiated. You will be redirected to authorize access."}}),setTimeout(()=>{d({statusMessage:null})},3e3)}else d({isAuthenticating:!1,error:M.error||"OAuth authentication failed",statusMessage:{type:"error",message:`Failed: ${M.error||"OAuth authentication failed"}`}})}catch(j){d({isAuthenticating:!1,error:j instanceof Error?j.message:String(j),statusMessage:{type:"error",message:`Failed: ${j instanceof Error?j.message:String(j)}`}})}},[t,r.serverUrl,n,d]),b=w.useMemo(()=>{if(!t||!n||!r.serverUrl)return null;const j=new VC(r.serverUrl);return new sRe({state:i,serverUrl:r.serverUrl,serverName:n,provider:j,updateState:h})},[t,n,r.serverUrl,i,h]),x=w.useCallback(()=>{p(),u(!0),h(Dy),b&&b.proceedToNextStep()},[b,h,r.serverUrl,n,t,p]),E=w.useCallback(async()=>{b&&await b.proceedToNextStep()},[b]),S=w.useCallback(()=>{if(u(!1),h(Dy),n){const j=ra(n);d({tokens:j})}},[n,d,h]),C=w.useCallback(()=>{t&&r.serverUrl&&n&&(Um(n),d({tokens:null,error:null,statusMessage:{type:"success",message:"OAuth tokens cleared successfully"}}),setTimeout(()=>{d({statusMessage:null})},3e3))},[t,r.serverUrl,n,d]),T=t&&"url"in t,R=T,N=n&&(e?.oauthTokens||ra(n)||e?.connectionStatus==="oauth-flow"),A=f.jsxs("div",{className:"rounded-md border border-dashed border-primary/30 bg-primary/10 px-3 py-2 text-xs text-primary space-y-1",children:[f.jsxs("div",{children:[f.jsx("span",{className:"font-medium",children:"Help us improve this feature!"})," We're looking for contributors to polish up this feature."]}),f.jsx("a",{href:"https://discord.com/invite/JEnDtz8X6z",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-primary underline hover:text-primary/80",children:"Join our Discord"})]});return t?R?f.jsx("div",{className:"h-[calc(100vh-120px)] flex flex-col",children:f.jsxs("div",{className:"h-full flex flex-col bg-background",children:[f.jsx("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border bg-background",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(ir,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage OAuth authentication for the selected server"})]})}),f.jsx("div",{className:"flex-1 overflow-auto px-6 py-6",children:f.jsxs("div",{className:"space-y-6 max-w-2xl",children:[A,f.jsxs("div",{className:"rounded-md border p-4 space-y-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Selected Server"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Name: ",e?.name||"Unknown"]}),T&&f.jsxs("div",{children:["URL: ",t.url.toString()]}),f.jsx("div",{children:"Type: HTTP Server"})]})]}),f.jsxs("div",{className:"rounded-md border p-6 space-y-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ir,{className:"h-5 w-5"}),f.jsx("h3",{className:"text-lg font-medium",children:"OAuth Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:N?"Manage OAuth authentication for this server.":"This server supports OAuth authentication. Use Quick OAuth to authenticate and get tokens."}),r.statusMessage&&f.jsx(iRe,{message:r.statusMessage}),r.error&&!r.statusMessage&&f.jsx("div",{className:"p-3 rounded-md border border-red-200 bg-red-50 text-red-700 mb-4",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx($m,{className:"h-4 w-4"}),f.jsx("p",{className:"text-sm",children:r.error})]})}),f.jsxs("div",{className:"space-y-4",children:[r.tokens&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-sm font-medium",children:"Current Tokens:"}),f.jsxs("div",{className:"bg-muted p-3 rounded-md space-y-2",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Access Token:"}),f.jsxs("div",{className:"text-xs font-mono overflow-x-auto",children:[r.tokens.access_token.substring(0,40),"..."]})]}),r.tokens.refresh_token&&f.jsxs("div",{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Refresh Token:"}),f.jsxs("div",{className:"text-xs font-mono overflow-x-auto",children:[r.tokens.refresh_token.substring(0,40),"..."]})]}),f.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[f.jsxs("span",{children:["Type: ",r.tokens.token_type]}),r.tokens.expires_in&&f.jsxs("span",{children:["Expires in: ",r.tokens.expires_in,"s"]}),r.tokens.scope&&f.jsxs("span",{children:["Scope: ",r.tokens.scope]})]})]})]}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx(De,{onClick:r.tokens?g:v,disabled:r.isAuthenticating||!t,className:"flex items-center gap-2",variant:r.tokens?"outline":"default",children:r.isAuthenticating?f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4 animate-spin"}),r.tokens?"Refreshing...":"Authenticating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4"}),r.tokens?"Quick Refresh":"Quick OAuth"]})}),r.tokens&&f.jsx(De,{onClick:v,disabled:r.isAuthenticating||!t,className:"flex items-center gap-2",variant:"default",children:r.isAuthenticating?f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4 animate-spin"}),"Authenticating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4"}),"Quick OAuth"]})}),f.jsx(De,{variant:"outline",onClick:C,disabled:!t||!r.tokens,children:"Clear Tokens"}),f.jsx(De,{variant:"secondary",onClick:x,disabled:r.isAuthenticating||!t,children:"Guided OAuth Flow"})]}),f.jsx("p",{className:"text-xs text-muted-foreground",children:t?r.tokens?"Use Quick Refresh to renew existing tokens, or Quick OAuth to start a fresh authentication flow.":"Use Quick OAuth to authenticate with the server and get tokens.":"Select a server to manage its OAuth authentication."})]}),l&&r.serverUrl&&f.jsx(nRe,{serverUrl:r.serverUrl,flowState:i,updateFlowState:h,proceedToNextStep:E}),l&&f.jsx("div",{className:"mt-4",children:f.jsx(De,{variant:"outline",onClick:S,children:"Exit Guided Flow"})})]})]})})]})}):f.jsx("div",{className:"h-[calc(100vh-120px)] flex flex-col",children:f.jsxs("div",{className:"h-full flex flex-col bg-background",children:[f.jsx("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border bg-background",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(ir,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage OAuth authentication for the selected server"})]})}),f.jsx("div",{className:"flex-1 overflow-auto px-6 py-6",children:f.jsxs("div",{className:"space-y-6 max-w-2xl",children:[A,f.jsxs("div",{className:"rounded-md border p-4 space-y-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Selected Server"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Name: ",e?.name||"Unknown"]}),T&&f.jsxs("div",{children:["URL: ",t.url.toString()]}),!T&&f.jsxs("div",{children:["Command: ",t.command]}),f.jsxs("div",{children:["Type: ",T?"HTTP Server":"STDIO Server"]})]})]}),f.jsx(Ba,{children:f.jsx(xQ,{className:"pt-6",children:f.jsxs("div",{className:"text-center space-y-4",children:[f.jsx("div",{className:"mx-auto w-12 h-12 bg-muted rounded-full flex items-center justify-center",children:f.jsx(ir,{className:"h-6 w-6 text-muted-foreground"})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h3",{className:"text-lg font-medium",children:T?"No Authentication Required":"No OAuth Support"}),f.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:T?`The HTTP server "${e?.name||"Unknown"}" is connected without OAuth authentication.`:"STDIO servers don't support OAuth authentication."}),T&&f.jsx("p",{className:"text-xs text-muted-foreground max-w-md mx-auto mt-2",children:"If this server supports OAuth, you can reconnect it with OAuth enabled from the Servers tab."})]})]})})})]})})]})}):f.jsx(dh,{icon:Vie,title:"No Server Selected",description:"Connect to an MCP server to manage authentication and OAuth settings."})};function oRe(){const t=new URLSearchParams(window.location.search),e=t.get("code"),n=t.get("error"),r=t.get("error_description");return f.jsx("div",{className:"flex items-center justify-center min-h-[100vh] p-4",children:f.jsx("div",{className:"mt-4 p-4 bg-secondary rounded-md max-w-md w-full border",children:e?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"mb-2 text-sm",children:"Please copy this authorization code and return to the Auth screen:"}),f.jsx("code",{className:"block p-2 bg-muted rounded-sm overflow-x-auto text-xs",children:e}),f.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"Close this tab and paste the code in the OAuth flow to complete authentication."})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"mb-2 text-sm font-medium",children:"No authorization code found"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Error: ",n||"unknown"]}),r&&f.jsxs("div",{children:["Description: ",decodeURIComponent(r)]})]})]})})})}const Z1=768;function lRe(){const[t,e]=w.useState(void 0);return w.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Z1-1}px)`),r=()=>{e(window.innerWidth<Z1)};return n.addEventListener("change",r),e(window.innerWidth<Z1),()=>n.removeEventListener("change",r)},[]),!!t}function cRe({...t}){return f.jsx(OA,{"data-slot":"sheet",...t})}function uRe({...t}){return f.jsx(PA,{"data-slot":"sheet-portal",...t})}function dRe({className:t,...e}){return f.jsx(IA,{"data-slot":"sheet-overlay",className:Oe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function fRe({className:t,children:e,side:n="right",...r}){return f.jsxs(uRe,{children:[f.jsx(dRe,{}),f.jsxs(DA,{"data-slot":"sheet-content",className:Oe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",n==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",n==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",n==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",n==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...r,children:[e,f.jsxs(a0,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[f.jsx(ch,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hRe({className:t,...e}){return f.jsx("div",{"data-slot":"sheet-header",className:Oe("flex flex-col gap-1.5 p-4",t),...e})}function pRe({className:t,...e}){return f.jsx(LA,{"data-slot":"sheet-title",className:Oe("text-foreground font-semibold",t),...e})}function mRe({className:t,...e}){return f.jsx($A,{"data-slot":"sheet-description",className:Oe("text-muted-foreground text-sm",t),...e})}const gRe="sidebar_state",vRe=60*60*24*7,yRe="16rem",bRe="18rem",xRe="3rem",_Re="b",oG=w.createContext(null);function kj(){const t=w.useContext(oG);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function wRe({defaultOpen:t=!0,open:e,onOpenChange:n,className:r,style:s,children:i,...a}){const l=lRe(),[u,d]=w.useState(!1),[h,p]=w.useState(t),g=e??h,v=w.useCallback(S=>{const C=typeof S=="function"?S(g):S;n?n(C):p(C),document.cookie=`${gRe}=${C}; path=/; max-age=${vRe}`},[n,g]),b=w.useCallback(()=>l?d(S=>!S):v(S=>!S),[l,v,d]);w.useEffect(()=>{const S=C=>{C.key===_Re&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),b())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[b]);const x=g?"expanded":"collapsed",E=w.useMemo(()=>({state:x,open:g,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:b}),[x,g,v,l,u,d,b]);return f.jsx(oG.Provider,{value:E,children:f.jsx(E0,{delayDuration:0,children:f.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":yRe,"--sidebar-width-icon":xRe,...s},className:Oe("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",r),...a,children:i})})})}function SRe({side:t="left",variant:e="sidebar",collapsible:n="offcanvas",className:r,children:s,...i}){const{isMobile:a,state:l,openMobile:u,setOpenMobile:d}=kj();return n==="none"?f.jsx("div",{"data-slot":"sidebar",className:Oe("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...i,children:s}):a?f.jsx(cRe,{open:u,onOpenChange:d,...i,children:f.jsxs(fRe,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":bRe},side:t,children:[f.jsxs(hRe,{className:"sr-only",children:[f.jsx(pRe,{children:"Sidebar"}),f.jsx(mRe,{children:"Displays the mobile sidebar."})]}),f.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):f.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":e,"data-side":t,"data-slot":"sidebar",children:[f.jsx("div",{"data-slot":"sidebar-gap",className:Oe("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),f.jsx("div",{"data-slot":"sidebar-container",className:Oe("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:f.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function ERe({className:t,onClick:e,...n}){const{toggleSidebar:r}=kj();return f.jsxs(De,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:Oe("size-7",t),onClick:s=>{e?.(s),r()},...n,children:[f.jsx(Aie,{}),f.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function kRe({className:t,...e}){return f.jsx("main",{"data-slot":"sidebar-inset",className:Oe("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...e})}function TRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Oe("flex flex-col gap-2 p-2 drag",t),...e})}function CRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Oe("flex flex-col gap-2 p-2",t),...e})}function ARe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Oe("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...e})}function RRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Oe("relative flex w-full min-w-0 flex-col p-2",t),...e})}function NRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Oe("w-full text-sm",t),...e})}function lG({className:t,...e}){return f.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Oe("flex w-full min-w-0 flex-col gap-1",t),...e})}function cG({className:t,...e}){return f.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Oe("group/menu-item relative",t),...e})}const jRe=S0("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function uG({asChild:t=!1,isActive:e=!1,variant:n="default",size:r="default",tooltip:s,className:i,...a}){const l=t?CA:"button",{isMobile:u,state:d}=kj(),h=f.jsx(l,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":e,className:Oe(jRe({variant:n,size:r}),i),...a});return s?(typeof s=="string"&&(s={children:s}),f.jsxs(Pa,{children:[f.jsx(Ia,{asChild:!0,children:h}),f.jsx(Da,{side:"right",align:"center",hidden:d!=="collapsed"||u,...s})]})):h}function MRe({items:t,onItemClick:e}){const n=s=>{e&&e(s)},r=s=>s.isActive||!1;return f.jsx(RRe,{children:f.jsx(NRe,{children:f.jsx(lG,{children:t.map(s=>f.jsx(cG,{children:f.jsxs(uG,{tooltip:s.title,isActive:r(s),onClick:()=>n(s.url),className:r(s)?"[&[data-active=true]]:bg-black/5 dark:[&[data-active=true]]:bg-white/5 cursor-pointer":"cursor-pointer",children:[s.icon&&f.jsx(s.icon,{className:"h-4 w-4"}),f.jsx("span",{children:s.title})]})},s.title))})})})}function ORe(t){const e=document.documentElement;e.classList.add("disable-transitions"),e.classList.toggle("dark",t==="dark"),requestAnimationFrame(()=>{e.classList.remove("disable-transitions")})}function PRe(){const t=ig(r=>r.themeMode),e=ig(r=>r.setThemeMode),n=()=>{const r=t==="dark"?"light":"dark";ORe(r),e(r)};return f.jsxs(uG,{tooltip:`Switch to ${t==="dark"?"light":"dark"} mode`,onClick:n,className:"cursor-pointer",children:[t==="dark"?f.jsx(eae,{className:"h-4 w-4"}):f.jsx(Tie,{className:"h-4 w-4"}),f.jsx("span",{children:t==="dark"?"Light mode":"Dark mode"})]})}const O$=[{id:"connection",items:[{title:"MCP Servers",url:"#servers",icon:B0},{title:"Playground",url:"#chat",icon:WB},{title:"Tracing",url:"#tracing",icon:xse}]},{id:"tools",items:[{title:"Tools",url:"#tools",icon:die},{title:"Resources",url:"#resources",icon:kse},{title:"Prompts",url:"#prompts",icon:Sie},{title:"Auth",url:"#auth",icon:Wie}]},{id:"evals",items:[{title:"Run evals",url:"#evals",icon:Lse},{title:"Eval results",url:"#eval-results",icon:vie}]},{id:"settings",items:[{title:"Feedback",url:"https://github.com/MCPJam/inspector/issues/new",icon:hie},{title:"Settings",url:"#settings",icon:vR}]}];function IRe({onNavigate:t,activeTab:e,...n}){const r=ig(i=>i.themeMode),s=i=>{t&&i.startsWith("#")?t(i.slice(1)):window.open(i,"_blank")};return f.jsxs(SRe,{collapsible:"icon",...n,children:[f.jsx(TRe,{children:f.jsx("div",{className:"flex items-center justify-center px-4 py-4",children:f.jsx("img",{src:r==="dark"?"/mcp_jam_dark.png":"/mcp_jam_light.png",alt:"MCP Jam",className:"h-4 w-auto"})})}),f.jsx(ARe,{children:O$.map((i,a)=>f.jsxs(w.Fragment,{children:[f.jsx(MRe,{items:i.items.map(l=>({...l,isActive:l.url===`#${e}`})),onItemClick:s}),a<O$.length-1&&f.jsx("div",{className:"mx-4 my-2 border-t border-border/50"})]},i.id))}),f.jsx(CRe,{children:f.jsx(lG,{children:f.jsx(cG,{children:f.jsx(PRe,{})})})})]})}function DRe(t){switch(t){case"connected":return"bg-green-500 dark:bg-green-400";case"connecting":return"bg-yellow-500 dark:bg-yellow-400 animate-pulse";case"failed":return"bg-red-500 dark:bg-red-400";case"disconnected":return"bg-muted-foreground";default:return"bg-muted-foreground"}}function LRe(t){switch(t){case"connected":return"Connected";case"connecting":return"Connecting...";case"failed":return"Failed";case"disconnected":return"Disconnected";default:return"Unknown"}}function $Re({connectedServerConfigs:t,selectedServer:e,selectedMultipleServers:n,isMultiSelectEnabled:r,onServerChange:s,onMultiServerToggle:i,onConnect:a}){const[l,u]=w.useState(!1),d=fa(),h=Object.entries(t).filter(([,p])=>p.enabled!==!1);return h.length===0?null:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap",children:[h.map(([p,g])=>{const v=r?n.includes(p):e===p;return f.jsxs("button",{onClick:()=>r?i(p):s(p),className:Oe("group relative flex items-center gap-3 px-4 py-3 border-r border-b border-border transition-all duration-200 cursor-pointer","hover:bg-accent hover:text-accent-foreground",v?"bg-muted text-foreground":"bg-background text-foreground"),children:[r&&f.jsx("div",{className:Oe("w-4 h-4 rounded border-2 flex items-center justify-center transition-colors",v?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),children:v&&f.jsx(oi,{className:"w-3 h-3"})}),f.jsx("div",{className:Oe("w-2 h-2 rounded-full",DRe(g.connectionStatus)),title:LRe(g.connectionStatus)}),f.jsx("span",{className:"text-sm font-medium truncate max-w-36",children:p}),f.jsx("div",{className:"text-xs opacity-70",children:g.config.command?"STDIO":"HTTP"})]},p)}),f.jsxs("button",{onClick:()=>{u(!0)},className:Oe("group relative flex items-center gap-3 px-4 py-3 border-r border-b border-border transition-all duration-200 cursor-pointer","hover:bg-accent hover:text-accent-foreground","bg-background text-muted-foreground border-dashed"),children:[r&&f.jsx("div",{className:"w-4 h-4"}),f.jsx("span",{className:"text-sm font-medium",children:"Add Server"}),f.jsx("div",{className:"text-xs opacity-70",children:"+"})]})]}),f.jsx(iT,{mode:"add",isOpen:l,onClose:()=>u(!1),onSubmit:p=>{d.capture("connecting_server",{location:"active_server_selector",platform:Oi(),environment:void 0}),a(p)}})]})}var zRe=(t,e,n,r,s,i,a,l)=>{let u=document.documentElement,d=["light","dark"];function h(v){(Array.isArray(t)?t:[t]).forEach(b=>{let x=b==="class",E=x&&i?s.map(S=>i[S]||S):s;x?(u.classList.remove(...E),u.classList.add(i&&i[v]?i[v]:v)):u.setAttribute(b,v)}),p(v)}function p(v){l&&d.includes(v)&&(u.style.colorScheme=v)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)h(r);else try{let v=localStorage.getItem(e)||n,b=a&&v==="system"?g():v;h(b)}catch{}},FRe=w.createContext(void 0),URe={setTheme:t=>{},themes:[]},BRe=()=>{var t;return(t=w.useContext(FRe))!=null?t:URe};w.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:a,themes:l,nonce:u,scriptProps:d})=>{let h=JSON.stringify([n,e,i,t,l,a,r,s]).slice(1,-1);return w.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${zRe.toString()})(${h})`}})});const HRe=({...t})=>{const{theme:e="system"}=BRe();return f.jsx(Iae,{theme:e,className:"toaster group",closeButton:!0,style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})};function qRe(){w.useEffect(()=>{if(!window.isElectron||!window.electronAPI?.oauth)return;const t=e=>{console.log("Electron OAuth callback received:",e);try{const n=new URL(e),r=new URLSearchParams(n.search),s=r.get("code"),i=r.get("state"),a=r.get("error");if(a){console.error("OAuth error:",a);return}if(s){console.log("OAuth code received, redirecting to callback page");const l=new URL("/callback",window.location.origin);l.searchParams.set("code",s),i&&l.searchParams.set("state",i),window.location.href=l.toString()}}catch(n){console.error("Failed to parse OAuth callback URL:",n)}};return window.electronAPI.oauth.onCallback(t),()=>{window.electronAPI?.oauth&&window.electronAPI.oauth.removeCallback()}},[])}const Ct=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,uu="8.55.0",Gt=globalThis;function o_(t,e,n){const r=n||Gt,s=r.__SENTRY__=r.__SENTRY__||{},i=s[uu]=s[uu]||{};return i[t]||(i[t]=e())}const gc=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,VRe="Sentry Logger ",GC=["debug","info","warn","error","log","assert","trace"],Lx={};function vc(t){if(!("console"in Gt))return t();const e=Gt.console,n={},r=Object.keys(Lx);r.forEach(s=>{const i=Lx[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function GRe(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return gc?GC.forEach(n=>{e[n]=(...r)=>{t&&vc(()=>{Gt.console[n](`${VRe}[${n}]:`,...r)})}}):GC.forEach(n=>{e[n]=()=>{}}),e}const Ue=o_("logger",GRe),dG=50,Au="?",P$=/\(error: (.*)\)/,I$=/captureMessage|captureException/;function fG(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],a=n.split(`
1849
+ `}),f.jsx("div",{className:"json-viewer-mcpjam",children:f.jsx(iu,{src:T,dark:!1,theme:"default",enableClipboard:!0,displaySize:!0,collapsed:2,collapseStringsAfterLength:80,collapseObjectsAfterLength:10,style:{fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', monospace",backgroundColor:"hsl(var(--background))",padding:0,borderRadius:0,border:"none"}})})]}):f.jsx("pre",{className:"text-xs bg-background p-2 rounded border mt-1 overflow-auto",children:C.body})})()]},C.id))})})]})]})}class VC{constructor(e){this.serverUrl=e,sessionStorage.setItem("debug-oauth-server-url",e)}get redirectUrl(){return`${window.location.origin}/oauth/callback/debug`}get clientMetadata(){return{redirect_uris:[this.redirectUrl],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],client_name:"MCPJam",client_uri:"https://github.com/mcpjam/inspector"}}async clientInformation(){const e=`debug-client-info-${this.serverUrl}`,n=sessionStorage.getItem(e);if(n)return JSON.parse(n)}saveClientInformation(e){const n=`debug-client-info-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}async tokens(){const e=`debug-tokens-${this.serverUrl}`,n=sessionStorage.getItem(e);if(n)return JSON.parse(n)}saveTokens(e){const n=`debug-tokens-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}redirectToAuthorization(e){}saveCodeVerifier(e){const n=`debug-verifier-${this.serverUrl}`;sessionStorage.setItem(n,e)}codeVerifier(){const e=`debug-verifier-${this.serverUrl}`,n=sessionStorage.getItem(e);if(!n)throw new Error("No code verifier saved for debug session");return n}saveServerMetadata(e){const n=`debug-server-metadata-${this.serverUrl}`;sessionStorage.setItem(n,JSON.stringify(e))}getServerMetadata(){const e=`debug-server-metadata-${this.serverUrl}`,n=sessionStorage.getItem(e);return n?JSON.parse(n):null}clear(){[`debug-client-info-${this.serverUrl}`,`debug-tokens-${this.serverUrl}`,`debug-verifier-${this.serverUrl}`,`debug-server-metadata-${this.serverUrl}`].forEach(n=>sessionStorage.removeItem(n))}}const Dy={isInitiatingAuth:!1,oauthTokens:null,oauthStep:"metadata_discovery",oauthMetadata:null,resourceMetadata:null,resourceMetadataError:null,resource:null,authServerUrl:null,oauthClientInfo:null,authorizationUrl:null,authorizationCode:"",latestError:null,statusMessage:null,validationError:null},Md=({label:t,isComplete:e,isCurrent:n,error:r,children:s})=>f.jsxs("div",{children:[f.jsxs("div",{className:`flex items-center p-2 rounded-md ${n?"bg-accent":""}`,children:[e?f.jsx(Ise,{className:"h-5 w-5 text-green-500 mr-2"}):f.jsx(Hse,{className:"h-5 w-5 text-muted-foreground mr-2"}),f.jsx("span",{className:`${n?"font-medium":""}`,children:t})]}),(n||e)&&s&&f.jsx("div",{className:"ml-7 mt-1",children:s}),n&&r&&f.jsxs("div",{className:"ml-7 mt-2 p-3 border border-red-300 bg-red-50 dark:bg-red-950/50 rounded-md",children:[f.jsx("p",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:"Error:"}),f.jsx("p",{className:"text-xs text-red-600 dark:text-red-500 mt-1",children:r.message})]})]}),Ly=["metadata_discovery","client_registration","authorization_redirect","authorization_code","token_request","complete"],nRe=({serverUrl:t,flowState:e,updateFlowState:n,proceedToNextStep:r})=>{const s=w.useMemo(()=>new VC(t),[t]),[i,a]=w.useState(null),l=Ly.findIndex(d=>d===e.oauthStep);w.useEffect(()=>{const d=async()=>{if(e.oauthClientInfo)a(e.oauthClientInfo);else try{const h=await s.clientInformation();h&&a(h)}catch(h){console.error("Failed to fetch client information:",h)}};l>Ly.indexOf("client_registration")&&d()},[s,e.oauthStep,e.oauthClientInfo,l]);const u=d=>({isComplete:l>Ly.indexOf(d)||l===Ly.length-1,isCurrent:e.oauthStep===d,error:e.oauthStep===d?e.latestError:null});return f.jsxs("div",{className:"rounded-md border p-6 space-y-4 mt-4",children:[f.jsx("h3",{className:"text-lg font-medium",children:"OAuth Flow Progress"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Follow these steps to complete OAuth authentication with the server."}),f.jsxs("div",{className:"space-y-3",children:[f.jsx(Md,{label:"Metadata Discovery",...u("metadata_discovery"),children:e.oauthMetadata&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsxs("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:["OAuth Metadata Sources",!e.resourceMetadata&&" ℹ️"]}),e.resourceMetadata&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"font-medium",children:"Resource Metadata:"}),f.jsxs("p",{className:"text-xs text-muted-foreground",children:["From"," ",new URL("/.well-known/oauth-protected-resource",t).href]}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.resourceMetadata,null,2)})]}),e.resourceMetadataError&&f.jsxs("div",{className:"mt-2 p-3 border border-blue-300 bg-blue-50 dark:bg-blue-950/50 rounded-md",children:[f.jsxs("p",{className:"text-sm font-medium text-blue-700 dark:text-blue-400",children:["ℹ️ Problem with resource metadata from"," ",f.jsx("a",{href:new URL("/.well-known/oauth-protected-resource",t).href,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:new URL("/.well-known/oauth-protected-resource",t).href})]}),f.jsxs("p",{className:"text-xs text-blue-600 dark:text-blue-500 mt-1",children:["Resource metadata was added in the"," ",f.jsx("a",{href:"https://modelcontextprotocol.io/specification/draft/basic/authorization#2-3-1-authorization-server-location",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"2025-DRAFT-v2 specification update"}),f.jsx("br",{}),e.resourceMetadataError.message,e.resourceMetadataError instanceof TypeError&&" (This could indicate the endpoint doesn't exist or does not have CORS configured)"]})]}),e.oauthMetadata&&f.jsxs("div",{className:"mt-2",children:[f.jsx("p",{className:"font-medium",children:"Authorization Server Metadata:"}),e.authServerUrl&&f.jsxs("p",{className:"text-xs text-muted-foreground",children:["From"," ",new URL("/.well-known/oauth-authorization-server",e.authServerUrl).href]}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.oauthMetadata,null,2)})]})]})}),f.jsx(Md,{label:"Client Registration",...u("client_registration"),children:i&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Registered Client Information"}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(i,null,2)})]})}),f.jsx(Md,{label:"Preparing Authorization",...u("authorization_redirect"),children:e.authorizationUrl&&f.jsxs("div",{className:"mt-2 p-3 border rounded-md bg-muted",children:[f.jsx("p",{className:"font-medium mb-2 text-sm",children:"Authorization URL:"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"text-xs break-all",children:e.authorizationUrl}),f.jsx("a",{href:e.authorizationUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300","aria-label":"Open authorization URL in new tab",title:"Open authorization URL",children:f.jsx(gR,{className:"h-4 w-4"})})]}),f.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Click the link to authorize in your browser. After authorization, you'll be redirected back to continue the flow."})]})}),f.jsx(Md,{label:"Request Authorization and acquire authorization code",...u("authorization_code"),children:f.jsxs("div",{className:"mt-3",children:[f.jsx("label",{htmlFor:"authCode",className:"block text-sm font-medium mb-1",children:"Authorization Code"}),f.jsx("div",{className:"flex gap-2",children:f.jsx("input",{id:"authCode",value:e.authorizationCode,onChange:d=>{n({authorizationCode:d.target.value,validationError:null})},placeholder:"Enter the code from the authorization server",className:`flex h-9 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${e.validationError?"border-red-500":"border-input"}`})}),e.validationError&&f.jsx("p",{className:"text-xs text-red-600 dark:text-red-500 mt-1",children:e.validationError}),f.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Once you've completed authorization in the link, paste the code here."})]})}),f.jsx(Md,{label:"Token Request",...u("token_request"),children:e.oauthMetadata&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Token Request Details"}),f.jsxs("div",{className:"mt-2 p-2 bg-muted rounded-md",children:[f.jsx("p",{className:"font-medium",children:"Token Endpoint:"}),f.jsx("code",{className:"block mt-1 text-xs overflow-x-auto",children:e.oauthMetadata.token_endpoint})]})]})}),f.jsx(Md,{label:"Authentication Complete",...u("complete"),children:e.oauthTokens&&f.jsxs("details",{className:"text-xs mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-muted-foreground font-medium",children:"Access Tokens"}),f.jsx("p",{className:"mt-1 text-sm",children:"Authentication successful! You can now use the authenticated connection. These tokens will be used automatically for server requests."}),f.jsx("pre",{className:"mt-2 p-2 bg-muted rounded-md overflow-auto max-h-[300px]",children:JSON.stringify(e.oauthTokens,null,2)})]})})]}),f.jsxs("div",{className:"flex gap-3 mt-4",children:[e.oauthStep!=="complete"&&f.jsx(f.Fragment,{children:f.jsx(De,{onClick:r,disabled:e.isInitiatingAuth,children:e.isInitiatingAuth?"Processing...":"Continue"})}),e.oauthStep==="authorization_redirect"&&e.authorizationUrl&&f.jsx(De,{variant:"outline",onClick:()=>window.open(e.authorizationUrl,"_blank"),children:"Open in New Tab"})]})]})},rRe={metadata_discovery:{canTransition:async()=>!0,execute:async t=>{try{if(t.updateState({latestError:null}),!t.serverUrl)throw new Error("Server URL is required");let e;try{e=new URL(t.serverUrl).toString()}catch{throw new Error(`Invalid server URL: ${t.serverUrl}`)}let n;try{n=new URL("/",e)}catch{throw new Error(`Failed to create base URL from server URL: ${e}`)}let r=null,s=null;try{if(r=await _H(e),r?.authorization_servers?.length){const l=r.authorization_servers[0];try{n=new URL(l)}catch{console.warn(`Invalid authorization server URL: ${l}, using default`)}}}catch(l){s=l instanceof Error?l:new Error(String(l))}const i=await Vle(n.toString());let a=null;try{a=await xH(e,t.provider,r??void 0)??null}catch(l){console.warn("selectResourceURL failed or not provided:",l)}t.updateState({resourceMetadata:r,resourceMetadataError:s,resource:a,authServerUrl:n,oauthMetadata:i,oauthStep:"client_registration"})}catch(e){const n=e instanceof Error?e:new Error(String(e));console.error("Metadata discovery error:",{error:n,serverUrl:t.serverUrl,serverName:t.serverName}),t.updateState({latestError:n,statusMessage:{type:"error",message:`Metadata discovery failed: ${n.message}`}})}}},client_registration:{canTransition:async t=>!!t.state.oauthMetadata,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata)throw new Error("OAuth metadata not available");let e;try{const n={...t.provider.clientMetadata},r=t.state.resourceMetadata?.scopes_supported||t.state.oauthMetadata.scopes_supported;r&&r.length>0&&(n.scope=r.join(" "));try{e=await kH(t.serverUrl,{metadata:t.state.oauthMetadata,clientMetadata:n}),t.provider.saveClientInformation(e)}catch(s){if(e=await t.provider.clientInformation(),!e)throw s}}catch(n){console.warn("Dynamic client registration failed, using static client metadata:",n);const r=await t.provider.clientInformation();r?e=r:(e={client_id:`static_client_${Date.now()}`,...t.provider.clientMetadata},t.provider.saveClientInformation(e))}t.updateState({oauthClientInfo:e,oauthStep:"authorization_redirect",statusMessage:{type:"success",message:"Client registration completed successfully."}})}catch(e){const n=e instanceof Error?e:new Error(String(e));console.error("Client registration error:",{error:n,serverUrl:t.serverUrl,serverName:t.serverName,hasOAuthMetadata:!!t.state.oauthMetadata,oauthMetadata:t.state.oauthMetadata,providerRedirectUrl:t.provider.redirectUrl,providerClientMetadata:t.provider.clientMetadata}),t.updateState({latestError:n,statusMessage:{type:"error",message:`Client registration failed: ${n.message}`}})}}},authorization_redirect:{canTransition:async t=>!!t.state.oauthMetadata&&!!t.state.oauthClientInfo,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata||!t.state.oauthClientInfo)throw new Error("OAuth metadata or client info not available");const e=t.state.resourceMetadata?.scopes_supported||t.state.oauthMetadata.scopes_supported,n=e&&e.length>0?e.join(" "):void 0,r=new Uint8Array(32);crypto.getRandomValues(r);const s=Array.from(r,a=>a.toString(16).padStart(2,"0")).join(""),i=await SH(t.serverUrl,{metadata:t.state.oauthMetadata,clientInformation:t.state.oauthClientInfo,redirectUrl:t.provider.redirectUrl,scope:n,state:s,resource:t.state.resource??void 0});t.provider.saveCodeVerifier(i.codeVerifier),t.updateState({authorizationUrl:i.authorizationUrl.toString(),oauthStep:"authorization_code",statusMessage:{type:"info",message:"Authorization URL generated. Please complete authorization in your browser."}})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,statusMessage:{type:"error",message:`Authorization preparation failed: ${n.message}`}})}}},authorization_code:{canTransition:async t=>!!t.state.authorizationCode.trim(),execute:async t=>{try{if(t.updateState({latestError:null,validationError:null}),!t.state.authorizationCode.trim()){t.updateState({validationError:"Authorization code is required"});return}t.updateState({oauthStep:"token_request"})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,validationError:n.message})}}},token_request:{canTransition:async t=>!!t.state.authorizationCode.trim()&&!!t.state.oauthMetadata,execute:async t=>{try{if(t.updateState({latestError:null}),!t.state.oauthMetadata||!t.state.authorizationCode.trim()||!t.state.oauthClientInfo)throw new Error("OAuth metadata, authorization code, or client info not available");const e=await EH(t.serverUrl,{metadata:t.state.oauthMetadata,clientInformation:t.state.oauthClientInfo,authorizationCode:t.state.authorizationCode,codeVerifier:t.provider.codeVerifier(),redirectUri:t.provider.redirectUrl});t.updateState({oauthTokens:e,oauthStep:"complete",statusMessage:{type:"success",message:"OAuth authentication completed successfully!"}})}catch(e){const n=e instanceof Error?e:new Error(String(e));t.updateState({latestError:n,statusMessage:{type:"error",message:`Token exchange failed: ${n.message}`}})}}},complete:{canTransition:async()=>!1,execute:async()=>{}}};class sRe{constructor(e){this.context=e}async proceedToNextStep(){const e=this.context.state.oauthStep,n=rRe[e];if(!n)return console.error("No transition found for step:",e),!1;try{return this.context.updateState({isInitiatingAuth:!0}),await n.canTransition(this.context)?(await n.execute(this.context),!0):(console.warn("Cannot transition from step:",e),!1)}catch(r){console.error("Error during state transition:",r);const s=r instanceof Error?r:new Error(String(r));return this.context.updateState({latestError:s,statusMessage:{type:"error",message:s.message}}),!1}finally{this.context.updateState({isInitiatingAuth:!1})}}reset(){this.context.updateState({isInitiatingAuth:!1,oauthTokens:null,oauthStep:"metadata_discovery",oauthMetadata:null,resourceMetadata:null,resourceMetadataError:null,resource:null,authServerUrl:null,oauthClientInfo:null,authorizationUrl:null,authorizationCode:"",latestError:null,statusMessage:null,validationError:null})}}const iRe=({message:t})=>{let e,n,r;switch(t.type){case"error":e="bg-red-50 dark:bg-red-950/50",n="text-red-700 dark:text-red-400",r="border-red-200 dark:border-red-800";break;case"success":e="bg-green-50 dark:bg-green-950/50",n="text-green-700 dark:text-green-400",r="border-green-200 dark:border-green-800";break;case"info":default:e="bg-blue-50 dark:bg-blue-950/50",n="text-blue-700 dark:text-blue-400",r="border-blue-200 dark:border-blue-800";break}return f.jsx("div",{className:`p-3 rounded-md border ${e} ${r} ${n} mb-4`,children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx($m,{className:"h-4 w-4"}),f.jsx("p",{className:"text-sm",children:t.message})]})})},aRe=({serverConfig:t,serverEntry:e,serverName:n})=>{const[r,s]=w.useState(X3),[i,a]=w.useState(Dy),[l,u]=w.useState(!1),d=w.useCallback(j=>{s(M=>({...M,...j}))},[]),h=w.useCallback(j=>{a(M=>({...M,...j}))},[]),p=w.useCallback(()=>{if(u(!1),h(Dy),r.serverUrl)try{new VC(r.serverUrl).clear()}catch(j){console.warn("Failed to clear debug OAuth provider state:",j)}},[r.serverUrl,h]);w.useEffect(()=>{if(t&&t.url&&n){const j=t.url.toString(),M=ra(n);d({serverUrl:j,tokens:M,error:null,statusMessage:null})}else d(X3)},[t,n,d]),w.useEffect(()=>{p()},[n,p]);const g=w.useCallback(async()=>{if(!t||!r.serverUrl||!n){d({statusMessage:{type:"error",message:"Please select a server before refreshing tokens"}});return}d({isAuthenticating:!0,error:null,statusMessage:null});try{let j;if(r.tokens)j=await MR(n);else{const M={serverName:n,serverUrl:r.serverUrl};j=await Qb(M)}if(j.success){const M=ra(n);d({tokens:M,isAuthenticating:!1,statusMessage:{type:"success",message:r.tokens?"Tokens refreshed successfully!":j.serverConfig?"OAuth authentication completed!":"OAuth flow initiated. You will be redirected to authorize access."}}),setTimeout(()=>{d({statusMessage:null})},3e3)}else d({isAuthenticating:!1,error:j.error||"OAuth operation failed",statusMessage:{type:"error",message:`Failed: ${j.error||"OAuth operation failed"}`}})}catch(j){d({isAuthenticating:!1,error:j instanceof Error?j.message:String(j),statusMessage:{type:"error",message:`Failed: ${j instanceof Error?j.message:String(j)}`}})}},[t,r.serverUrl,r.tokens,n,d]),v=w.useCallback(async()=>{if(!t||!r.serverUrl||!n){d({statusMessage:{type:"error",message:"Please select a server before starting OAuth"}});return}d({isAuthenticating:!0,error:null,statusMessage:null});try{Um(n);const j={serverName:n,serverUrl:r.serverUrl},M=await Qb(j);if(M.success){const I=ra(n);d({tokens:I,isAuthenticating:!1,statusMessage:{type:"success",message:M.serverConfig?"OAuth authentication completed!":"OAuth flow initiated. You will be redirected to authorize access."}}),setTimeout(()=>{d({statusMessage:null})},3e3)}else d({isAuthenticating:!1,error:M.error||"OAuth authentication failed",statusMessage:{type:"error",message:`Failed: ${M.error||"OAuth authentication failed"}`}})}catch(j){d({isAuthenticating:!1,error:j instanceof Error?j.message:String(j),statusMessage:{type:"error",message:`Failed: ${j instanceof Error?j.message:String(j)}`}})}},[t,r.serverUrl,n,d]),b=w.useMemo(()=>{if(!t||!n||!r.serverUrl)return null;const j=new VC(r.serverUrl);return new sRe({state:i,serverUrl:r.serverUrl,serverName:n,provider:j,updateState:h})},[t,n,r.serverUrl,i,h]),x=w.useCallback(()=>{p(),u(!0),h(Dy),b&&b.proceedToNextStep()},[b,h,r.serverUrl,n,t,p]),E=w.useCallback(async()=>{b&&await b.proceedToNextStep()},[b]),S=w.useCallback(()=>{if(u(!1),h(Dy),n){const j=ra(n);d({tokens:j})}},[n,d,h]),C=w.useCallback(()=>{t&&r.serverUrl&&n&&(Um(n),d({tokens:null,error:null,statusMessage:{type:"success",message:"OAuth tokens cleared successfully"}}),setTimeout(()=>{d({statusMessage:null})},3e3))},[t,r.serverUrl,n,d]),T=t&&"url"in t,R=T,N=n&&(e?.oauthTokens||ra(n)||e?.connectionStatus==="oauth-flow"),A=f.jsxs("div",{className:"rounded-md border border-dashed border-primary/30 bg-primary/10 px-3 py-2 text-xs text-primary space-y-1",children:[f.jsxs("div",{children:[f.jsx("span",{className:"font-medium",children:"Help us improve this feature!"})," ","We're looking for contributors to polish up this feature."]}),f.jsx("a",{href:"https://discord.com/invite/JEnDtz8X6z",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-primary underline hover:text-primary/80",children:"Join our Discord"})]});return t?R?f.jsx("div",{className:"h-[calc(100vh-120px)] flex flex-col",children:f.jsxs("div",{className:"h-full flex flex-col bg-background",children:[f.jsx("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border bg-background",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(ir,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage OAuth authentication for the selected server"})]})}),f.jsx("div",{className:"flex-1 overflow-auto px-6 py-6",children:f.jsxs("div",{className:"space-y-6 max-w-2xl",children:[A,f.jsxs("div",{className:"rounded-md border p-4 space-y-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Selected Server"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Name: ",e?.name||"Unknown"]}),T&&f.jsxs("div",{children:["URL: ",t.url.toString()]}),f.jsx("div",{children:"Type: HTTP Server"})]})]}),f.jsxs("div",{className:"rounded-md border p-6 space-y-6",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ir,{className:"h-5 w-5"}),f.jsx("h3",{className:"text-lg font-medium",children:"OAuth Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:N?"Manage OAuth authentication for this server.":"This server supports OAuth authentication. Use Quick OAuth to authenticate and get tokens."}),r.statusMessage&&f.jsx(iRe,{message:r.statusMessage}),r.error&&!r.statusMessage&&f.jsx("div",{className:"p-3 rounded-md border border-red-200 bg-red-50 text-red-700 mb-4",children:f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx($m,{className:"h-4 w-4"}),f.jsx("p",{className:"text-sm",children:r.error})]})}),f.jsxs("div",{className:"space-y-4",children:[r.tokens&&f.jsxs("div",{className:"space-y-2",children:[f.jsx("p",{className:"text-sm font-medium",children:"Current Tokens:"}),f.jsxs("div",{className:"bg-muted p-3 rounded-md space-y-2",children:[f.jsxs("div",{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Access Token:"}),f.jsxs("div",{className:"text-xs font-mono overflow-x-auto",children:[r.tokens.access_token.substring(0,40),"..."]})]}),r.tokens.refresh_token&&f.jsxs("div",{children:[f.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Refresh Token:"}),f.jsxs("div",{className:"text-xs font-mono overflow-x-auto",children:[r.tokens.refresh_token.substring(0,40),"..."]})]}),f.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[f.jsxs("span",{children:["Type: ",r.tokens.token_type]}),r.tokens.expires_in&&f.jsxs("span",{children:["Expires in: ",r.tokens.expires_in,"s"]}),r.tokens.scope&&f.jsxs("span",{children:["Scope: ",r.tokens.scope]})]})]})]}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx(De,{onClick:r.tokens?g:v,disabled:r.isAuthenticating||!t,className:"flex items-center gap-2",variant:r.tokens?"outline":"default",children:r.isAuthenticating?f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4 animate-spin"}),r.tokens?"Refreshing...":"Authenticating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4"}),r.tokens?"Quick Refresh":"Quick OAuth"]})}),r.tokens&&f.jsx(De,{onClick:v,disabled:r.isAuthenticating||!t,className:"flex items-center gap-2",variant:"default",children:r.isAuthenticating?f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4 animate-spin"}),"Authenticating..."]}):f.jsxs(f.Fragment,{children:[f.jsx(ir,{className:"h-4 w-4"}),"Quick OAuth"]})}),f.jsx(De,{variant:"outline",onClick:C,disabled:!t||!r.tokens,children:"Clear Tokens"}),f.jsx(De,{variant:"secondary",onClick:x,disabled:r.isAuthenticating||!t,children:"Guided OAuth Flow"})]}),f.jsx("p",{className:"text-xs text-muted-foreground",children:t?r.tokens?"Use Quick Refresh to renew existing tokens, or Quick OAuth to start a fresh authentication flow.":"Use Quick OAuth to authenticate with the server and get tokens.":"Select a server to manage its OAuth authentication."})]}),l&&r.serverUrl&&f.jsx(nRe,{serverUrl:r.serverUrl,flowState:i,updateFlowState:h,proceedToNextStep:E}),l&&f.jsx("div",{className:"mt-4",children:f.jsx(De,{variant:"outline",onClick:S,children:"Exit Guided Flow"})})]})]})})]})}):f.jsx("div",{className:"h-[calc(100vh-120px)] flex flex-col",children:f.jsxs("div",{className:"h-full flex flex-col bg-background",children:[f.jsx("div",{className:"flex items-center justify-between px-6 py-5 border-b border-border bg-background",children:f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx(ir,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Authentication"})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage OAuth authentication for the selected server"})]})}),f.jsx("div",{className:"flex-1 overflow-auto px-6 py-6",children:f.jsxs("div",{className:"space-y-6 max-w-2xl",children:[A,f.jsxs("div",{className:"rounded-md border p-4 space-y-2",children:[f.jsx("h3",{className:"text-sm font-medium",children:"Selected Server"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Name: ",e?.name||"Unknown"]}),T&&f.jsxs("div",{children:["URL: ",t.url.toString()]}),!T&&f.jsxs("div",{children:["Command: ",t.command]}),f.jsxs("div",{children:["Type: ",T?"HTTP Server":"STDIO Server"]})]})]}),f.jsx(Ba,{children:f.jsx(xQ,{className:"pt-6",children:f.jsxs("div",{className:"text-center space-y-4",children:[f.jsx("div",{className:"mx-auto w-12 h-12 bg-muted rounded-full flex items-center justify-center",children:f.jsx(ir,{className:"h-6 w-6 text-muted-foreground"})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h3",{className:"text-lg font-medium",children:T?"No Authentication Required":"No OAuth Support"}),f.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:T?`The HTTP server "${e?.name||"Unknown"}" is connected without OAuth authentication.`:"STDIO servers don't support OAuth authentication."}),T&&f.jsx("p",{className:"text-xs text-muted-foreground max-w-md mx-auto mt-2",children:"If this server supports OAuth, you can reconnect it with OAuth enabled from the Servers tab."})]})]})})})]})})]})}):f.jsx(dh,{icon:Vie,title:"No Server Selected",description:"Connect to an MCP server to manage authentication and OAuth settings."})};function oRe(){const t=new URLSearchParams(window.location.search),e=t.get("code"),n=t.get("error"),r=t.get("error_description");return f.jsx("div",{className:"flex items-center justify-center min-h-[100vh] p-4",children:f.jsx("div",{className:"mt-4 p-4 bg-secondary rounded-md max-w-md w-full border",children:e?f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"mb-2 text-sm",children:"Please copy this authorization code and return to the Auth screen:"}),f.jsx("code",{className:"block p-2 bg-muted rounded-sm overflow-x-auto text-xs",children:e}),f.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"Close this tab and paste the code in the OAuth flow to complete authentication."})]}):f.jsxs(f.Fragment,{children:[f.jsx("p",{className:"mb-2 text-sm font-medium",children:"No authorization code found"}),f.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.jsxs("div",{children:["Error: ",n||"unknown"]}),r&&f.jsxs("div",{children:["Description: ",decodeURIComponent(r)]})]})]})})})}const Z1=768;function lRe(){const[t,e]=w.useState(void 0);return w.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Z1-1}px)`),r=()=>{e(window.innerWidth<Z1)};return n.addEventListener("change",r),e(window.innerWidth<Z1),()=>n.removeEventListener("change",r)},[]),!!t}function cRe({...t}){return f.jsx(OA,{"data-slot":"sheet",...t})}function uRe({...t}){return f.jsx(PA,{"data-slot":"sheet-portal",...t})}function dRe({className:t,...e}){return f.jsx(IA,{"data-slot":"sheet-overlay",className:Oe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function fRe({className:t,children:e,side:n="right",...r}){return f.jsxs(uRe,{children:[f.jsx(dRe,{}),f.jsxs(DA,{"data-slot":"sheet-content",className:Oe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",n==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",n==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",n==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",n==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...r,children:[e,f.jsxs(a0,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[f.jsx(ch,{className:"size-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function hRe({className:t,...e}){return f.jsx("div",{"data-slot":"sheet-header",className:Oe("flex flex-col gap-1.5 p-4",t),...e})}function pRe({className:t,...e}){return f.jsx(LA,{"data-slot":"sheet-title",className:Oe("text-foreground font-semibold",t),...e})}function mRe({className:t,...e}){return f.jsx($A,{"data-slot":"sheet-description",className:Oe("text-muted-foreground text-sm",t),...e})}const gRe="sidebar_state",vRe=60*60*24*7,yRe="16rem",bRe="18rem",xRe="3rem",_Re="b",oG=w.createContext(null);function kj(){const t=w.useContext(oG);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function wRe({defaultOpen:t=!0,open:e,onOpenChange:n,className:r,style:s,children:i,...a}){const l=lRe(),[u,d]=w.useState(!1),[h,p]=w.useState(t),g=e??h,v=w.useCallback(S=>{const C=typeof S=="function"?S(g):S;n?n(C):p(C),document.cookie=`${gRe}=${C}; path=/; max-age=${vRe}`},[n,g]),b=w.useCallback(()=>l?d(S=>!S):v(S=>!S),[l,v,d]);w.useEffect(()=>{const S=C=>{C.key===_Re&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),b())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[b]);const x=g?"expanded":"collapsed",E=w.useMemo(()=>({state:x,open:g,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:b}),[x,g,v,l,u,d,b]);return f.jsx(oG.Provider,{value:E,children:f.jsx(E0,{delayDuration:0,children:f.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":yRe,"--sidebar-width-icon":xRe,...s},className:Oe("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",r),...a,children:i})})})}function SRe({side:t="left",variant:e="sidebar",collapsible:n="offcanvas",className:r,children:s,...i}){const{isMobile:a,state:l,openMobile:u,setOpenMobile:d}=kj();return n==="none"?f.jsx("div",{"data-slot":"sidebar",className:Oe("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...i,children:s}):a?f.jsx(cRe,{open:u,onOpenChange:d,...i,children:f.jsxs(fRe,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":bRe},side:t,children:[f.jsxs(hRe,{className:"sr-only",children:[f.jsx(pRe,{children:"Sidebar"}),f.jsx(mRe,{children:"Displays the mobile sidebar."})]}),f.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):f.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":e,"data-side":t,"data-slot":"sidebar",children:[f.jsx("div",{"data-slot":"sidebar-gap",className:Oe("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),f.jsx("div",{"data-slot":"sidebar-container",className:Oe("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:f.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function ERe({className:t,onClick:e,...n}){const{toggleSidebar:r}=kj();return f.jsxs(De,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:Oe("size-7",t),onClick:s=>{e?.(s),r()},...n,children:[f.jsx(Aie,{}),f.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function kRe({className:t,...e}){return f.jsx("main",{"data-slot":"sidebar-inset",className:Oe("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...e})}function TRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Oe("flex flex-col gap-2 p-2 drag",t),...e})}function CRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Oe("flex flex-col gap-2 p-2",t),...e})}function ARe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Oe("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...e})}function RRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Oe("relative flex w-full min-w-0 flex-col p-2",t),...e})}function NRe({className:t,...e}){return f.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Oe("w-full text-sm",t),...e})}function lG({className:t,...e}){return f.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Oe("flex w-full min-w-0 flex-col gap-1",t),...e})}function cG({className:t,...e}){return f.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Oe("group/menu-item relative",t),...e})}const jRe=S0("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function uG({asChild:t=!1,isActive:e=!1,variant:n="default",size:r="default",tooltip:s,className:i,...a}){const l=t?CA:"button",{isMobile:u,state:d}=kj(),h=f.jsx(l,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":e,className:Oe(jRe({variant:n,size:r}),i),...a});return s?(typeof s=="string"&&(s={children:s}),f.jsxs(Pa,{children:[f.jsx(Ia,{asChild:!0,children:h}),f.jsx(Da,{side:"right",align:"center",hidden:d!=="collapsed"||u,...s})]})):h}function MRe({items:t,onItemClick:e}){const n=s=>{e&&e(s)},r=s=>s.isActive||!1;return f.jsx(RRe,{children:f.jsx(NRe,{children:f.jsx(lG,{children:t.map(s=>f.jsx(cG,{children:f.jsxs(uG,{tooltip:s.title,isActive:r(s),onClick:()=>n(s.url),className:r(s)?"[&[data-active=true]]:bg-black/5 dark:[&[data-active=true]]:bg-white/5 cursor-pointer":"cursor-pointer",children:[s.icon&&f.jsx(s.icon,{className:"h-4 w-4"}),f.jsx("span",{children:s.title})]})},s.title))})})})}function ORe(t){const e=document.documentElement;e.classList.add("disable-transitions"),e.classList.toggle("dark",t==="dark"),requestAnimationFrame(()=>{e.classList.remove("disable-transitions")})}function PRe(){const t=ig(r=>r.themeMode),e=ig(r=>r.setThemeMode),n=()=>{const r=t==="dark"?"light":"dark";ORe(r),e(r)};return f.jsxs(uG,{tooltip:`Switch to ${t==="dark"?"light":"dark"} mode`,onClick:n,className:"cursor-pointer",children:[t==="dark"?f.jsx(eae,{className:"h-4 w-4"}):f.jsx(Tie,{className:"h-4 w-4"}),f.jsx("span",{children:t==="dark"?"Light mode":"Dark mode"})]})}const O$=[{id:"connection",items:[{title:"MCP Servers",url:"#servers",icon:B0},{title:"Playground",url:"#chat",icon:WB},{title:"Tracing",url:"#tracing",icon:xse}]},{id:"tools",items:[{title:"Tools",url:"#tools",icon:die},{title:"Resources",url:"#resources",icon:kse},{title:"Prompts",url:"#prompts",icon:Sie},{title:"Auth",url:"#auth",icon:Wie}]},{id:"evals",items:[{title:"Run evals",url:"#evals",icon:Lse},{title:"Eval results",url:"#eval-results",icon:vie}]},{id:"settings",items:[{title:"Feedback",url:"https://github.com/MCPJam/inspector/issues/new",icon:hie},{title:"Settings",url:"#settings",icon:vR}]}];function IRe({onNavigate:t,activeTab:e,...n}){const r=ig(i=>i.themeMode),s=i=>{t&&i.startsWith("#")?t(i.slice(1)):window.open(i,"_blank")};return f.jsxs(SRe,{collapsible:"icon",...n,children:[f.jsx(TRe,{children:f.jsx("div",{className:"flex items-center justify-center px-4 py-4",children:f.jsx("img",{src:r==="dark"?"/mcp_jam_dark.png":"/mcp_jam_light.png",alt:"MCP Jam",className:"h-4 w-auto"})})}),f.jsx(ARe,{children:O$.map((i,a)=>f.jsxs(w.Fragment,{children:[f.jsx(MRe,{items:i.items.map(l=>({...l,isActive:l.url===`#${e}`})),onItemClick:s}),a<O$.length-1&&f.jsx("div",{className:"mx-4 my-2 border-t border-border/50"})]},i.id))}),f.jsx(CRe,{children:f.jsx(lG,{children:f.jsx(cG,{children:f.jsx(PRe,{})})})})]})}function DRe(t){switch(t){case"connected":return"bg-green-500 dark:bg-green-400";case"connecting":return"bg-yellow-500 dark:bg-yellow-400 animate-pulse";case"failed":return"bg-red-500 dark:bg-red-400";case"disconnected":return"bg-muted-foreground";default:return"bg-muted-foreground"}}function LRe(t){switch(t){case"connected":return"Connected";case"connecting":return"Connecting...";case"failed":return"Failed";case"disconnected":return"Disconnected";default:return"Unknown"}}function $Re({connectedServerConfigs:t,selectedServer:e,selectedMultipleServers:n,isMultiSelectEnabled:r,onServerChange:s,onMultiServerToggle:i,onConnect:a}){const[l,u]=w.useState(!1),d=fa(),h=Object.entries(t).filter(([,p])=>p.enabled!==!1);return h.length===0?null:f.jsxs("div",{children:[f.jsxs("div",{className:"flex flex-wrap",children:[h.map(([p,g])=>{const v=r?n.includes(p):e===p;return f.jsxs("button",{onClick:()=>r?i(p):s(p),className:Oe("group relative flex items-center gap-3 px-4 py-3 border-r border-b border-border transition-all duration-200 cursor-pointer","hover:bg-accent hover:text-accent-foreground",v?"bg-muted text-foreground":"bg-background text-foreground"),children:[r&&f.jsx("div",{className:Oe("w-4 h-4 rounded border-2 flex items-center justify-center transition-colors",v?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),children:v&&f.jsx(oi,{className:"w-3 h-3"})}),f.jsx("div",{className:Oe("w-2 h-2 rounded-full",DRe(g.connectionStatus)),title:LRe(g.connectionStatus)}),f.jsx("span",{className:"text-sm font-medium truncate max-w-36",children:p}),f.jsx("div",{className:"text-xs opacity-70",children:g.config.command?"STDIO":"HTTP"})]},p)}),f.jsxs("button",{onClick:()=>{u(!0)},className:Oe("group relative flex items-center gap-3 px-4 py-3 border-r border-b border-border transition-all duration-200 cursor-pointer","hover:bg-accent hover:text-accent-foreground","bg-background text-muted-foreground border-dashed"),children:[r&&f.jsx("div",{className:"w-4 h-4"}),f.jsx("span",{className:"text-sm font-medium",children:"Add Server"}),f.jsx("div",{className:"text-xs opacity-70",children:"+"})]})]}),f.jsx(iT,{mode:"add",isOpen:l,onClose:()=>u(!1),onSubmit:p=>{d.capture("connecting_server",{location:"active_server_selector",platform:Oi(),environment:void 0}),a(p)}})]})}var zRe=(t,e,n,r,s,i,a,l)=>{let u=document.documentElement,d=["light","dark"];function h(v){(Array.isArray(t)?t:[t]).forEach(b=>{let x=b==="class",E=x&&i?s.map(S=>i[S]||S):s;x?(u.classList.remove(...E),u.classList.add(i&&i[v]?i[v]:v)):u.setAttribute(b,v)}),p(v)}function p(v){l&&d.includes(v)&&(u.style.colorScheme=v)}function g(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)h(r);else try{let v=localStorage.getItem(e)||n,b=a&&v==="system"?g():v;h(b)}catch{}},FRe=w.createContext(void 0),URe={setTheme:t=>{},themes:[]},BRe=()=>{var t;return(t=w.useContext(FRe))!=null?t:URe};w.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:a,themes:l,nonce:u,scriptProps:d})=>{let h=JSON.stringify([n,e,i,t,l,a,r,s]).slice(1,-1);return w.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(${zRe.toString()})(${h})`}})});const HRe=({...t})=>{const{theme:e="system"}=BRe();return f.jsx(Iae,{theme:e,className:"toaster group",closeButton:!0,style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})};function qRe(){w.useEffect(()=>{if(!window.isElectron||!window.electronAPI?.oauth)return;const t=e=>{console.log("Electron OAuth callback received:",e);try{const n=new URL(e),r=new URLSearchParams(n.search),s=r.get("code"),i=r.get("state"),a=r.get("error");if(a){console.error("OAuth error:",a);return}if(s){console.log("OAuth code received, redirecting to callback page");const l=new URL("/callback",window.location.origin);l.searchParams.set("code",s),i&&l.searchParams.set("state",i),window.location.href=l.toString()}}catch(n){console.error("Failed to parse OAuth callback URL:",n)}};return window.electronAPI.oauth.onCallback(t),()=>{window.electronAPI?.oauth&&window.electronAPI.oauth.removeCallback()}},[])}const Ct=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,uu="8.55.0",Gt=globalThis;function o_(t,e,n){const r=n||Gt,s=r.__SENTRY__=r.__SENTRY__||{},i=s[uu]=s[uu]||{};return i[t]||(i[t]=e())}const gc=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,VRe="Sentry Logger ",GC=["debug","info","warn","error","log","assert","trace"],Lx={};function vc(t){if(!("console"in Gt))return t();const e=Gt.console,n={},r=Object.keys(Lx);r.forEach(s=>{const i=Lx[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function GRe(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return gc?GC.forEach(n=>{e[n]=(...r)=>{t&&vc(()=>{Gt.console[n](`${VRe}[${n}]:`,...r)})}}):GC.forEach(n=>{e[n]=()=>{}}),e}const Ue=o_("logger",GRe),dG=50,Au="?",P$=/\(error: (.*)\)/,I$=/captureMessage|captureException/;function fG(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],a=n.split(`
1850
1850
  `);for(let l=r;l<a.length;l++){const u=a[l];if(u.length>1024)continue;const d=P$.test(u)?u.replace(P$,"$1"):u;if(!d.match(/\S*Error: /)){for(const h of e){const p=h(d);if(p){i.push(p);break}}if(i.length>=dG+s)break}}return YRe(i.slice(s))}}function WRe(t){return Array.isArray(t)?fG(...t):t}function YRe(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test($y(e).function||"")&&e.pop(),e.reverse(),I$.test($y(e).function||"")&&(e.pop(),I$.test($y(e).function||"")&&e.pop()),e.slice(0,dG).map(n=>({...n,filename:n.filename||$y(e).filename,function:n.function||Au}))}function $y(t){return t[t.length-1]||{}}const ek="<anonymous>";function Wo(t){try{return!t||typeof t!="function"?ek:t.name||ek}catch{return ek}}function D$(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const yb={},L$={};function yc(t,e){yb[t]=yb[t]||[],yb[t].push(e)}function bc(t,e){if(!L$[t]){L$[t]=!0;try{e()}catch(n){gc&&Ue.error(`Error while instrumenting ${t}`,n)}}}function Ii(t,e){const n=t&&yb[t];if(n)for(const r of n)try{r(e)}catch(s){gc&&Ue.error(`Error while triggering instrumentation handler.
1851
1851
  Type: ${t}
1852
1852
  Name: ${Wo(r)}
@@ -1871,4 +1871,4 @@ now you can use replayer.getMirror() to access the mirror instance of a replayer
1871
1871
  or you can use record.mirror to access the mirror instance during recording.`;let Iz={map:{},getId(){return console.error(Hd),-1},getNode(){return console.error(Hd),null},removeNodeFromMap(){console.error(Hd)},has(){return console.error(Hd),!1},reset(){console.error(Hd)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Iz=new Proxy(Iz,{get(t,e,n){return e==="map"&&console.error(Hd),Reflect.get(t,e,n)}}));function mg(t,e,n={}){let r=null,s=0;return function(...i){const a=Date.now();!s&&n.leading===!1&&(s=a);const l=e-(a-s),u=this;l<=0||l>e?(r&&(gIe(r),r=null),s=a,t.apply(u,i)):!r&&n.trailing!==!1&&(r=y_(()=>{s=n.leading===!1?0:Date.now(),r=null,t.apply(u,i)},l))}}function BW(t,e,n,r,s=window){const i=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,r?n:{set(a){y_(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>BW(t,e,i||{},!0)}function Kj(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}let Wx=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Wx=()=>new Date().getTime());function HW(t){const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:$l([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollLeft])||$l([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollLeft])||$l([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollLeft])||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:$l([e,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollTop])||$l([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollTop])||$l([e,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollTop])||0}}function qW(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function VW(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function GW(t){return t?t.nodeType===t.ELEMENT_NODE?t:t.parentElement:null}function ei(t,e,n,r,s){if(!t)return!1;const i=GW(t);if(!i)return!1;const a=nf(e,n);if(!s){const d=r&&i.matches(r);return a(i)&&!d}const l=ru(i,a);let u=-1;return l<0?!1:(r&&(u=ru(i,nf(null,r))),l>-1&&u<0?!0:l<u)}function uIe(t,e){return e.getId(t)!==-1}function uk(t,e){return e.getId(t)===pg}function WW(t,e){if(Rm(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?WW(t.parentNode,e):!0:!0}function vA(t){return!!t.changedTouches}function dIe(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function YW(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function KW(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function yA(t){return!!$l([t,"optionalAccess",e=>e.shadowRoot])}class fIe{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return XMe(this.styleIDMap.get(e),()=>-1)}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function XW(t){let e=null;return $l([t,"access",n=>n.getRootNode,"optionalCall",n=>n(),"optionalAccess",n=>n.nodeType])===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function hIe(t){let e=t,n;for(;n=XW(e);)e=n;return e}function pIe(t){const e=t.ownerDocument;if(!e)return!1;const n=hIe(t);return e.contains(n)}function QW(t){const e=t.ownerDocument;return e?e.contains(t)||pIe(t):!1}const Dz={};function Xj(t){const e=Dz[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const s=n.createElement("iframe");s.hidden=!0,n.head.appendChild(s);const i=s.contentWindow;i&&i[t]&&(r=i[t]),n.head.removeChild(s)}catch{}return Dz[t]=r.bind(window)}function mIe(...t){return Xj("requestAnimationFrame")(...t)}function y_(...t){return Xj("setTimeout")(...t)}function gIe(...t){return Xj("clearTimeout")(...t)}var Lt=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Lt||{}),Et=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(Et||{}),hs=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(hs||{}),Eo=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Eo||{}),Lz;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(Lz||(Lz={}));var $z;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})($z||($z={}));function Qj(t){try{return t.contentDocument}catch{}}function vIe(t){try{return t.contentWindow}catch{}}function yIe(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function zz(t){return"__ln"in t}class bIe{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=yIe([n,"optionalAccess",s=>s.next])||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&zz(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&zz(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Fz=(t,e)=>`${t}@${e}`;class xIe{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,r=new bIe,s=u=>{let d=u,h=pg;for(;h===pg;)d=d&&d.nextSibling,h=d&&this.mirror.getId(d);return h},i=u=>{if(!u.parentNode||!QW(u))return;const d=Rm(u.parentNode)?this.mirror.getId(XW(u)):this.mirror.getId(u.parentNode),h=s(u);if(d===-1||h===-1)return r.addNode(u);const p=rf(u,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:g=>{YW(g,this.mirror)&&!ei(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(g),KW(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),yA(u)&&this.shadowDomManager.addShadowRoot(u.shadowRoot,this.doc)},onIframeLoad:(g,v)=>{ei(g,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(g,v),g.contentWindow&&this.canvasManager.addWindow(g.contentWindow),this.shadowDomManager.observeAttachShadow(g))},onStylesheetLoad:(g,v)=>{this.stylesheetManager.attachLinkElement(g,v)}});p&&(e.push({parentId:d,nextId:h,node:p}),n.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)Uz(this.removes,u,this.mirror)&&!this.movedSet.has(u.parentNode)||i(u);for(const u of this.addedSet)!Bz(this.droppedSet,u)&&!Uz(this.removes,u,this.mirror)||Bz(this.movedSet,u)?i(u):this.droppedSet.add(u);let a=null;for(;r.length;){let u=null;if(a){const d=this.mirror.getId(a.value.parentNode),h=s(a.value);d!==-1&&h!==-1&&(u=a)}if(!u){let d=r.tail;for(;d;){const h=d;if(d=d.previous,h){const p=this.mirror.getId(h.value.parentNode);if(s(h.value)===-1)continue;if(p!==-1){u=h;break}else{const v=h.value;if(v.parentNode&&v.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const b=v.parentNode.host;if(this.mirror.getId(b)!==-1){u=h;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}a=u.previous,r.removeNode(u.value),i(u.value)}const l={texts:this.texts.map(u=>({id:this.mirror.getId(u.node),value:u.value})).filter(u=>!n.has(u.id)).filter(u=>this.mirror.has(u.id)),attributes:this.attributes.map(u=>{const{attributes:d}=u;if(typeof d.style=="string"){const h=JSON.stringify(u.styleDiff),p=JSON.stringify(u._unchangedStyles);h.length<d.style.length&&(h+p).split("var(").length===d.style.split("var(").length&&(d.style=u.styleDiff)}return{id:this.mirror.getId(u.node),attributes:d}}).filter(u=>!n.has(u.id)).filter(u=>this.mirror.has(u.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.processMutation=e=>{if(!uk(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!ei(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:Zf(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,GW(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,s=e.target.getAttribute(r);if(r==="value"){const a=Wj(n),l=n.tagName;s=Vx(n,l,a);const u=g_({maskInputOptions:this.maskInputOptions,tagName:l,type:a}),d=Zf(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,u);s=hg({isMasked:d,element:n,value:s,maskInputFn:this.maskInputFn})}if(ei(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||s===e.oldValue)return;let i=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(s))if(!Qj(n))r="rr_src";else return;if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),r==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!UW(n.tagName,r)&&(i.attributes[r]=FW(this.doc,Jf(n.tagName),Jf(r),s,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(n.style)){const u=n.style.getPropertyValue(l),d=n.style.getPropertyPriority(l);u!==a.style.getPropertyValue(l)||d!==a.style.getPropertyPriority(l)?d===""?i.styleDiff[l]=u:i.styleDiff[l]=[u,d]:i._unchangedStyles[l]=[u,d]}for(const l of Array.from(a.style))n.style.getPropertyValue(l)===""&&(i.styleDiff[l]=!1)}break}case"childList":{if(ei(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),s=Rm(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ei(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||uk(n,this.mirror)||!uIe(n,this.mirror)||(this.addedSet.has(n)?(bA(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||WW(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Fz(r,s)]?bA(this.movedSet,n):this.removes.push({parentId:s,id:r,isShadow:Rm(e.target)&&Nm(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(uk(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Fz(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ei(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes.forEach(r=>this.genAdds(r)),yA(e)&&e.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function bA(t,e){t.delete(e),e.childNodes.forEach(n=>bA(t,n))}function Uz(t,e,n){return t.length===0?!1:_Ie(t,e,n)}function _Ie(t,e,n){let r=e.parentNode;for(;r;){const s=n.getId(r);if(t.some(i=>i.id===s))return!0;r=r.parentNode}return!1}function Bz(t,e){return t.size===0?!1:JW(t,e)}function JW(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:JW(t,n):!1}let jm;function wIe(t){jm=t}function SIe(){jm=void 0}const Kt=t=>jm?(...n)=>{try{return t(...n)}catch(r){if(jm&&jm(r)===!0)return()=>{};throw r}}:t;function na(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}const sf=[];function Gg(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function ZW(t,e){const n=new xIe;sf.push(n),n.init(t);let r=window.MutationObserver||window.__rrMutationObserver;const s=na([window,"optionalAccess",a=>a.Zone,"optionalAccess",a=>a.__symbol__,"optionalCall",a=>a("MutationObserver")]);s&&window[s]&&(r=window[s]);const i=new r(Kt(a=>{t.onMutation&&t.onMutation(a)===!1||n.processMutations.bind(n)(a)}));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function EIe({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const s=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const u=mg(Kt(p=>{const g=Date.now()-l;t(a.map(v=>(v.timeOffset-=g,v)),p),a=[],l=null}),i),d=Kt(mg(Kt(p=>{const g=Gg(p),{clientX:v,clientY:b}=vA(p)?p.changedTouches[0]:p;l||(l=Wx()),a.push({x:v,y:b,id:r.getId(g),timeOffset:Wx()-l}),u(typeof DragEvent<"u"&&p instanceof DragEvent?Et.Drag:p instanceof MouseEvent?Et.MouseMove:Et.TouchMove)}),s,{trailing:!1})),h=[ms("mousemove",d,n),ms("touchmove",d,n),ms("drag",d,n)];return Kt(()=>{h.forEach(p=>p())})}function kIe({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const l=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,u=[];let d=null;const h=p=>g=>{const v=Gg(g);if(ei(v,r,s,i,!0))return;let b=null,x=p;if("pointerType"in g){switch(g.pointerType){case"mouse":b=Eo.Mouse;break;case"touch":b=Eo.Touch;break;case"pen":b=Eo.Pen;break}b===Eo.Touch?hs[p]===hs.MouseDown?x="TouchStart":hs[p]===hs.MouseUp&&(x="TouchEnd"):Eo.Pen}else vA(g)&&(b=Eo.Touch);b!==null?(d=b,(x.startsWith("Touch")&&b===Eo.Touch||x.startsWith("Mouse")&&b===Eo.Mouse)&&(b=null)):hs[p]===hs.Click&&(b=d,d=null);const E=vA(g)?g.changedTouches[0]:g;if(!E)return;const S=n.getId(v),{clientX:C,clientY:T}=E;Kt(t)({type:hs[x],id:S,x:C,y:T,...b!==null&&{pointerType:b}})};return Object.keys(hs).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&l[p]!==!1).forEach(p=>{let g=Jf(p);const v=h(p);if(window.PointerEvent)switch(hs[p]){case hs.MouseDown:case hs.MouseUp:g=g.replace("mouse","pointer");break;case hs.TouchStart:case hs.TouchEnd:return}u.push(ms(g,v,e))}),Kt(()=>{u.forEach(p=>p())})}function eY({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,sampling:a}){const l=Kt(mg(Kt(u=>{const d=Gg(u);if(!d||ei(d,r,s,i,!0))return;const h=n.getId(d);if(d===e&&e.defaultView){const p=HW(e.defaultView);t({id:h,x:p.left,y:p.top})}else t({id:h,x:d.scrollLeft,y:d.scrollTop})}),a.scroll||100));return ms("scroll",l,e)}function TIe({viewportResizeCb:t},{win:e}){let n=-1,r=-1;const s=Kt(mg(Kt(()=>{const i=qW(),a=VW();(n!==i||r!==a)&&(t({width:Number(a),height:Number(i)}),n=i,r=a)}),200));return ms("resize",s,e)}const CIe=["INPUT","TEXTAREA","SELECT"],Hz=new WeakMap;function AIe({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,ignoreClass:a,ignoreSelector:l,maskInputOptions:u,maskInputFn:d,sampling:h,userTriggeredOnInput:p,maskTextClass:g,unmaskTextClass:v,maskTextSelector:b,unmaskTextSelector:x}){function E(j){let M=Gg(j);const I=j.isTrusted,O=M&&mA(M.tagName);if(O==="OPTION"&&(M=M.parentElement),!M||!O||CIe.indexOf(O)<0||ei(M,r,s,i,!0))return;const $=M;if($.classList.contains(a)||l&&$.matches(l))return;const z=Wj(M);let G=Vx($,O,z),W=!1;const Q=g_({maskInputOptions:u,tagName:O,type:z}),F=Zf(M,g,b,v,x,Q);(z==="radio"||z==="checkbox")&&(W=M.checked),G=hg({isMasked:F,element:M,value:G,maskInputFn:d}),S(M,p?{text:G,isChecked:W,userTriggered:I}:{text:G,isChecked:W});const Y=M.name;z==="radio"&&Y&&W&&e.querySelectorAll(`input[type="radio"][name="${Y}"]`).forEach(V=>{if(V!==M){const J=hg({isMasked:F,element:V,value:Vx(V,O,z),maskInputFn:d});S(V,p?{text:J,isChecked:!W,userTriggered:!1}:{text:J,isChecked:!W})}})}function S(j,M){const I=Hz.get(j);if(!I||I.text!==M.text||I.isChecked!==M.isChecked){Hz.set(j,M);const O=n.getId(j);Kt(t)({...M,id:O})}}const T=(h.input==="last"?["change"]:["input","change"]).map(j=>ms(j,Kt(E),e)),R=e.defaultView;if(!R)return()=>{T.forEach(j=>j())};const N=R.Object.getOwnPropertyDescriptor(R.HTMLInputElement.prototype,"value"),A=[[R.HTMLInputElement.prototype,"value"],[R.HTMLInputElement.prototype,"checked"],[R.HTMLSelectElement.prototype,"value"],[R.HTMLTextAreaElement.prototype,"value"],[R.HTMLSelectElement.prototype,"selectedIndex"],[R.HTMLOptionElement.prototype,"selected"]];return N&&N.set&&T.push(...A.map(j=>BW(j[0],j[1],{set(){Kt(E)({target:this,isTrusted:!1})}},!1,R))),Kt(()=>{T.forEach(j=>j())})}function Yx(t){const e=[];function n(r,s){if(Ky("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ky("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ky("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ky("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);s.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);s.unshift(a)}return s}return n(t,e)}function zl(t,e,n){let r,s;return t?(t.ownerNode?r=e.getId(t.ownerNode):s=n.getId(t),{styleId:s,id:r}):{}}function RIe({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const s=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:Kt((h,p,g)=>{const[v,b]=g,{id:x,styleId:E}=zl(p,e,n.styleMirror);return(x&&x!==-1||E&&E!==-1)&&t({id:x,styleId:E,adds:[{rule:v,index:b}]}),h.apply(p,g)})});const i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:Kt((h,p,g)=>{const[v]=g,{id:b,styleId:x}=zl(p,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,removes:[{index:v}]}),h.apply(p,g)})});let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Kt((h,p,g)=>{const[v]=g,{id:b,styleId:x}=zl(p,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,replace:v}),h.apply(p,g)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Kt((h,p,g)=>{const[v]=g,{id:b,styleId:x}=zl(p,e,n.styleMirror);return(b&&b!==-1||x&&x!==-1)&&t({id:b,styleId:x,replaceSync:v}),h.apply(p,g)})}));const u={};Xy("CSSGroupingRule")?u.CSSGroupingRule=r.CSSGroupingRule:(Xy("CSSMediaRule")&&(u.CSSMediaRule=r.CSSMediaRule),Xy("CSSConditionRule")&&(u.CSSConditionRule=r.CSSConditionRule),Xy("CSSSupportsRule")&&(u.CSSSupportsRule=r.CSSSupportsRule));const d={};return Object.entries(u).forEach(([h,p])=>{d[h]={insertRule:p.prototype.insertRule,deleteRule:p.prototype.deleteRule},p.prototype.insertRule=new Proxy(d[h].insertRule,{apply:Kt((g,v,b)=>{const[x,E]=b,{id:S,styleId:C}=zl(v.parentStyleSheet,e,n.styleMirror);return(S&&S!==-1||C&&C!==-1)&&t({id:S,styleId:C,adds:[{rule:x,index:[...Yx(v),E||0]}]}),g.apply(v,b)})}),p.prototype.deleteRule=new Proxy(d[h].deleteRule,{apply:Kt((g,v,b)=>{const[x]=b,{id:E,styleId:S}=zl(v.parentStyleSheet,e,n.styleMirror);return(E&&E!==-1||S&&S!==-1)&&t({id:E,styleId:S,removes:[{index:[...Yx(v),x]}]}),g.apply(v,b)})})}),Kt(()=>{r.CSSStyleSheet.prototype.insertRule=s,r.CSSStyleSheet.prototype.deleteRule=i,a&&(r.CSSStyleSheet.prototype.replace=a),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([h,p])=>{p.prototype.insertRule=d[h].insertRule,p.prototype.deleteRule=d[h].deleteRule})})}function tY({mirror:t,stylesheetManager:e},n){let r=null;n.nodeName==="#document"?r=t.getId(n):r=t.getId(n.host);const s=n.nodeName==="#document"?na([n,"access",a=>a.defaultView,"optionalAccess",a=>a.Document]):na([n,"access",a=>a.ownerDocument,"optionalAccess",a=>a.defaultView,"optionalAccess",a=>a.ShadowRoot]),i=na([s,"optionalAccess",a=>a.prototype])?Object.getOwnPropertyDescriptor(na([s,"optionalAccess",a=>a.prototype]),"adoptedStyleSheets"):void 0;return r===null||r===-1||!s||!i?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return na([i,"access",a=>a.get,"optionalAccess",a=>a.call,"call",a=>a(this)])},set(a){const l=na([i,"access",u=>u.set,"optionalAccess",u=>u.call,"call",u=>u(this,a)]);if(r!==null&&r!==-1)try{e.adoptStyleSheets(a,r)}catch{}return l}}),Kt(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function NIe({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:s}){const i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:Kt((l,u,d)=>{const[h,p,g]=d;if(n.has(h))return i.apply(u,[h,p,g]);const{id:v,styleId:b}=zl(na([u,"access",x=>x.parentRule,"optionalAccess",x=>x.parentStyleSheet]),e,r.styleMirror);return(v&&v!==-1||b&&b!==-1)&&t({id:v,styleId:b,set:{property:h,value:p,priority:g},index:Yx(u.parentRule)}),l.apply(u,d)})});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Kt((l,u,d)=>{const[h]=d;if(n.has(h))return a.apply(u,[h]);const{id:p,styleId:g}=zl(na([u,"access",v=>v.parentRule,"optionalAccess",v=>v.parentStyleSheet]),e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,remove:{property:h},index:Yx(u.parentRule)}),l.apply(u,d)})}),Kt(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=a})}function jIe({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:r,mirror:s,sampling:i,doc:a}){const l=Kt(d=>mg(Kt(h=>{const p=Gg(h);if(!p||ei(p,e,n,r,!0))return;const{currentTime:g,volume:v,muted:b,playbackRate:x}=p;t({type:d,id:s.getId(p),currentTime:g,volume:v,muted:b,playbackRate:x})}),i.media||500)),u=[ms("play",l(0),a),ms("pause",l(1),a),ms("seeked",l(2),a),ms("volumechange",l(3),a),ms("ratechange",l(4),a)];return Kt(()=>{u.forEach(d=>d())})}function MIe({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],s=new WeakMap,i=n.FontFace;n.FontFace=function(u,d,h){const p=new i(u,d,h);return s.set(p,{family:u,buffer:typeof d!="string",descriptors:h,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),p};const a=Kj(e.fonts,"add",function(l){return function(u){return y_(Kt(()=>{const d=s.get(u);d&&(t(d),s.delete(u))}),0),l.apply(this,[u])}});return r.push(()=>{n.FontFace=i}),r.push(a),Kt(()=>{r.forEach(l=>l())})}function OIe(t){const{doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:i,selectionCb:a}=t;let l=!0;const u=Kt(()=>{const d=e.getSelection();if(!d||l&&na([d,"optionalAccess",g=>g.isCollapsed]))return;l=d.isCollapsed||!1;const h=[],p=d.rangeCount||0;for(let g=0;g<p;g++){const v=d.getRangeAt(g),{startContainer:b,startOffset:x,endContainer:E,endOffset:S}=v;ei(b,r,s,i,!0)||ei(E,r,s,i,!0)||h.push({start:n.getId(b),startOffset:x,end:n.getId(E),endOffset:S})}a({ranges:h})});return u(),ms("selectionchange",u)}function PIe({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:Kj(n.customElements,"define",function(s){return function(i,a,l){try{e({define:{name:i}})}catch{}return s.apply(this,[i,a,l])}})}function IIe(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r;t.recordDOM&&(r=ZW(t,t.doc));const s=EIe(t),i=kIe(t),a=eY(t),l=TIe(t,{win:n}),u=AIe(t),d=jIe(t);let h=()=>{},p=()=>{},g=()=>{},v=()=>{};t.recordDOM&&(h=RIe(t,{win:n}),p=tY(t,t.doc),g=NIe(t,{win:n}),t.collectFonts&&(v=MIe(t)));const b=OIe(t),x=PIe(t),E=[];for(const S of t.plugins)E.push(S.observer(S.callback,n,S.options));return Kt(()=>{sf.forEach(S=>S.reset()),na([r,"optionalAccess",S=>S.disconnect,"call",S=>S()]),s(),i(),a(),l(),u(),d(),h(),p(),g(),v(),b(),x(),E.forEach(S=>S())})}function Ky(t){return typeof window[t]<"u"}function Xy(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class xA{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,s){const i=r||this.getIdToRemoteIdMap(e),a=s||this.getRemoteIdToIdMap(e);let l=i.get(n);return l||(l=this.generateIdFn(),i.set(n,l),a.set(l,n)),l}getIds(e,n){const r=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return n.map(i=>this.getId(e,i,r,s))}getRemoteId(e,n,r){const s=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const i=s.get(n);return i||-1}getRemoteIds(e,n){const r=this.getRemoteIdToIdMap(e);return n.map(s=>this.getRemoteId(e,s,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}function qz(t){let e,n=t[0],r=1;for(;r<t.length;){const s=t[r],i=t[r+1];if(r+=2,(s==="optionalAccess"||s==="optionalCall")&&n==null)return;s==="access"||s==="optionalAccess"?(e=n,n=i(n)):(s==="call"||s==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}class DIe{constructor(){this.crossOriginIframeMirror=new xA(Yj),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class LIe{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new xA(Yj),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new xA(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),qz([this,"access",s=>s.loadListener,"optionalCall",s=>s(e)]);const r=Qj(e);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const s=this.crossOriginIframeMap.get(e.source);if(!s)return;const i=this.transformCrossOriginEvent(s,n.data.event);i&&this.wrappedEmit(i,n.data.isCheckout)}transformCrossOriginEvent(e,n){switch(n.type){case Lt.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const r=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(n.data.node,r),{timestamp:n.timestamp,type:Lt.IncrementalSnapshot,data:{source:Et.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Lt.Meta:case Lt.Load:case Lt.DomContentLoaded:return!1;case Lt.Plugin:return n;case Lt.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case Lt.IncrementalSnapshot:switch(n.data.source){case Et.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(r.node,s)}),n.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),n.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),n.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case Et.Drag:case Et.TouchMove:case Et.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),n;case Et.ViewportResize:return!1;case Et.MediaInteraction:case Et.MouseInteraction:case Et.Scroll:case Et.CanvasMutation:case Et.Input:return this.replaceIds(n.data,e,["id"]),n;case Et.StyleSheetRule:case Et.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case Et.Font:return n;case Et.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),n;case Et.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),qz([n,"access",r=>r.data,"access",r=>r.styles,"optionalAccess",r=>r.forEach,"call",r=>r(s=>{this.replaceStyleIds(s,e,["styleId"])})]),n}}return!1}replace(e,n,r,s){for(const i of s)!Array.isArray(n[i])&&typeof n[i]!="number"||(Array.isArray(n[i])?n[i]=e.getIds(r,n[i]):n[i]=e.getId(r,n[i]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(e,n){e.type!==Sr.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class $Ie{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class zIe{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!Nm(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const r=ZW({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(eY({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),y_(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(tY({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const n=Qj(e),r=vIe(e);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(e,n){const r=this;this.restoreHandlers.push(Kj(e.prototype,"attachShadow",function(s){return function(i){const a=s.call(this,i);return this.shadowRoot&&QW(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}class Vz{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class FIe{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new fIe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const r={id:n,styleIds:[]},s=[];for(const i of e){let a;this.styleMirror.has(i)?a=this.styleMirror.getId(i):(a=this.styleMirror.add(i),s.push({styleId:a,rules:Array.from(i.rules||CSSRule,(l,u)=>({rule:PW(l),index:u}))})),r.styleIds.push(a)}s.length>0&&(r.styles=s),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class UIe{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){const r=this.nodeMap.get(e);return r&&Array.from(r).some(s=>s!==n)}add(e,n){this.active||(this.active=!0,mIe(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}}let Yn,Kx;try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=_b([t,"access",e=>e.contentWindow,"optionalAccess",e=>e.Array,"access",e=>e.from])||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}const Yi=FPe();function zo(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:s="rr-block",blockSelector:i=null,unblockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:u=null,maskAllText:d=!1,maskTextClass:h="rr-mask",unmaskTextClass:p=null,maskTextSelector:g=null,unmaskTextSelector:v=null,inlineStylesheet:b=!0,maskAllInputs:x,maskInputOptions:E,slimDOMOptions:S,maskAttributeFn:C,maskInputFn:T,maskTextFn:R,maxCanvasSize:N=null,packFn:A,sampling:j={},dataURLOptions:M={},mousemoveWait:I,recordDOM:O=!0,recordCanvas:$=!1,recordCrossOriginIframes:z=!1,recordAfter:G=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:Q=!1,inlineImages:F=!1,plugins:Y,keepIframeSrcFn:V=()=>!1,ignoreCSSAttributes:J=new Set([]),errorHandler:P,onMutation:re,getCanvasManager:fe}=t;wIe(P);const D=z?window.parent===window:!0;let Z=!1;if(!D)try{window.parent.document&&(Z=!1)}catch{Z=!0}if(D&&!e)throw new Error("emit function is required");if(!D&&!Z)return()=>{};I!==void 0&&j.mousemove===void 0&&(j.mousemove=I),Yi.reset();const ce=x===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:E!==void 0?E:{},H=S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:S==="all",headMetaDescKeywords:S==="all"}:S||{};dIe();let U,K=0;const ue=He=>{for(const vt of Y||[])vt.eventProcessor&&(He=vt.eventProcessor(He));return A&&!Z&&(He=A(He)),He};Yn=(He,vt)=>{const Le=He;if(Le.timestamp=Wx(),_b([sf,"access",et=>et[0],"optionalAccess",et=>et.isFrozen,"call",et=>et()])&&Le.type!==Lt.FullSnapshot&&!(Le.type===Lt.IncrementalSnapshot&&Le.data.source===Et.Mutation)&&sf.forEach(et=>et.unfreeze()),D)_b([e,"optionalCall",et=>et(ue(Le),vt)]);else if(Z){const et={type:"rrweb",event:ue(Le),origin:window.location.origin,isCheckout:vt};window.parent.postMessage(et,"*")}if(Le.type===Lt.FullSnapshot)U=Le,K=0;else if(Le.type===Lt.IncrementalSnapshot){if(Le.data.source===Et.Mutation&&Le.data.isAttachIframe)return;K++;const et=r&&K>=r,at=n&&U&&Le.timestamp-U.timestamp>n;(et||at)&&pt(!0)}};const q=He=>{Yn({type:Lt.IncrementalSnapshot,data:{source:Et.Mutation,...He}})},te=He=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.Scroll,...He}}),ae=He=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.CanvasMutation,...He}}),pe=He=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.AdoptedStyleSheet,...He}}),_e=new FIe({mutationCb:q,adoptedStyleSheetCb:pe}),Pe=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new DIe:new LIe({mirror:Yi,mutationCb:q,stylesheetManager:_e,recordCrossOriginIframes:z,wrappedEmit:Yn});for(const He of Y||[])He.getMirror&&He.getMirror({nodeMirror:Yi,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const Ie=new UIe,Ae=HIe(fe,{mirror:Yi,win:window,mutationCb:He=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.CanvasMutation,...He}}),recordCanvas:$,blockClass:s,blockSelector:i,unblockSelector:a,maxCanvasSize:N,sampling:j.canvas,dataURLOptions:M,errorHandler:P}),Je=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new $Ie:new zIe({mutationCb:q,scrollCb:te,bypassOptions:{onMutation:re,blockClass:s,blockSelector:i,unblockSelector:a,maskAllText:d,maskTextClass:h,unmaskTextClass:p,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:b,maskInputOptions:ce,dataURLOptions:M,maskAttributeFn:C,maskTextFn:R,maskInputFn:T,recordCanvas:$,inlineImages:F,sampling:j,slimDOMOptions:H,iframeManager:Pe,stylesheetManager:_e,canvasManager:Ae,keepIframeSrcFn:V,processedNodeManager:Ie},mirror:Yi}),pt=(He=!1)=>{if(!O)return;Yn({type:Lt.Meta,data:{href:window.location.href,width:VW(),height:qW()}},He),_e.reset(),Je.init(),sf.forEach(Le=>Le.lock());const vt=cIe(document,{mirror:Yi,blockClass:s,blockSelector:i,unblockSelector:a,maskAllText:d,maskTextClass:h,unmaskTextClass:p,maskTextSelector:g,unmaskTextSelector:v,inlineStylesheet:b,maskAllInputs:ce,maskAttributeFn:C,maskInputFn:T,maskTextFn:R,slimDOM:H,dataURLOptions:M,recordCanvas:$,inlineImages:F,onSerialize:Le=>{YW(Le,Yi)&&Pe.addIframe(Le),KW(Le,Yi)&&_e.trackLinkElement(Le),yA(Le)&&Je.addShadowRoot(Le.shadowRoot,document)},onIframeLoad:(Le,et)=>{Pe.attachIframe(Le,et),Le.contentWindow&&Ae.addWindow(Le.contentWindow),Je.observeAttachShadow(Le)},onStylesheetLoad:(Le,et)=>{_e.attachLinkElement(Le,et)},keepIframeSrcFn:V});if(!vt)return console.warn("Failed to snapshot the document");Yn({type:Lt.FullSnapshot,data:{node:vt,initialOffset:HW(window)}}),sf.forEach(Le=>Le.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&_e.adoptStyleSheets(document.adoptedStyleSheets,Yi.getId(document))};Kx=pt;try{const He=[],vt=et=>Kt(IIe)({onMutation:re,mutationCb:q,mousemoveCb:(at,lr)=>Yn({type:Lt.IncrementalSnapshot,data:{source:lr,positions:at}}),mouseInteractionCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.MouseInteraction,...at}}),scrollCb:te,viewportResizeCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.ViewportResize,...at}}),inputCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.Input,...at}}),mediaInteractionCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.MediaInteraction,...at}}),styleSheetRuleCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.StyleSheetRule,...at}}),styleDeclarationCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.StyleDeclaration,...at}}),canvasMutationCb:ae,fontCb:at=>Yn({type:Lt.IncrementalSnapshot,data:{source:Et.Font,...at}}),selectionCb:at=>{Yn({type:Lt.IncrementalSnapshot,data:{source:Et.Selection,...at}})},customElementCb:at=>{Yn({type:Lt.IncrementalSnapshot,data:{source:Et.CustomElement,...at}})},blockClass:s,ignoreClass:l,ignoreSelector:u,maskAllText:d,maskTextClass:h,unmaskTextClass:p,maskTextSelector:g,unmaskTextSelector:v,maskInputOptions:ce,inlineStylesheet:b,sampling:j,recordDOM:O,recordCanvas:$,inlineImages:F,userTriggeredOnInput:W,collectFonts:Q,doc:et,maskAttributeFn:C,maskInputFn:T,maskTextFn:R,keepIframeSrcFn:V,blockSelector:i,unblockSelector:a,slimDOMOptions:H,dataURLOptions:M,mirror:Yi,iframeManager:Pe,stylesheetManager:_e,shadowDomManager:Je,processedNodeManager:Ie,canvasManager:Ae,ignoreCSSAttributes:J,plugins:_b([Y,"optionalAccess",at=>at.filter,"call",at=>at(lr=>lr.observer),"optionalAccess",at=>at.map,"call",at=>at(lr=>({observer:lr.observer,options:lr.options,callback:oe=>Yn({type:Lt.Plugin,data:{plugin:lr.name,payload:oe}})}))])||[]},{});Pe.addLoadListener(et=>{try{He.push(vt(et.contentDocument))}catch(at){console.warn(at)}});const Le=()=>{pt(),He.push(vt(document))};return document.readyState==="interactive"||document.readyState==="complete"?Le():(He.push(ms("DOMContentLoaded",()=>{Yn({type:Lt.DomContentLoaded,data:{}}),G==="DOMContentLoaded"&&Le()})),He.push(ms("load",()=>{Yn({type:Lt.Load,data:{}}),G==="load"&&Le()},window))),()=>{He.forEach(et=>et()),Ie.destroy(),Kx=void 0,SIe()}}catch(He){console.warn(He)}}function BIe(t){if(!Kx)throw new Error("please take full snapshot after start recording");Kx(t)}zo.mirror=Yi;zo.takeFullSnapshot=BIe;function HIe(t,e){try{return t?t(e):new Vz}catch{return console.warn("Unable to initialize CanvasManager"),new Vz}}const qIe=3,VIe=5;function Jj(t){return t>9999999999?t:t*1e3}function dk(t){return t>9999999999?t/1e3:t}function Wg(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:Lt.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:ea(e,10,1e3)}}),e.category==="console")))}const GIe="button,a";function nY(t){return t.closest(GIe)||t}function rY(t){const e=sY(t);return!e||!(e instanceof Element)?e:nY(e)}function sY(t){return WIe(t)?t.target:t}function WIe(t){return typeof t=="object"&&!!t&&"target"in t}let Fl;function YIe(t){return Fl||(Fl=[],KIe()),Fl.push(t),()=>{const e=Fl?Fl.indexOf(t):-1;e>-1&&Fl.splice(e,1)}}function KIe(){Ls(En,"open",function(t){return function(...e){if(Fl)try{Fl.forEach(n=>n())}catch{}return t.apply(En,e)}})}const XIe=new Set([Et.Mutation,Et.StyleSheetRule,Et.StyleDeclaration,Et.AdoptedStyleSheet,Et.CanvasMutation,Et.Selection,Et.MediaInteraction]);function QIe(t,e,n){t.handleClick(e,n)}class JIe{constructor(e,n,r=Wg){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=YIe(()=>{this._lastMutation=Gz()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(eDe(n,this._ignoreSelector)||!tDe(e))return;const r={timestamp:dk(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(s=>s.node===r.node&&Math.abs(s.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=dk(e)}registerScroll(e=Date.now()){this._lastScroll=dk(e)}registerClick(e){const n=nY(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=Gz();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&e.push(r)});for(const r of e){const s=this._clicks.indexOf(r);s>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(s,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const n=this._replay,r=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,s=e.mutationAfter&&e.mutationAfter<=this._threshold,i=!r&&!s,{clickCount:a,clickBreadcrumb:l}=e;if(i){const u=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,d=u<this._timeout*1e3?"mutation":"timeout",h={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.slowClickDetected",data:{...l.data,url:En.location.href,route:n.getCurrentRoute(),timeAfterClickMs:u,endReason:d,clickCount:a||1}};this._addBreadcrumbEvent(n,h);return}if(a>1){const u={type:"default",message:l.message,timestamp:l.timestamp,category:"ui.multiClick",data:{...l.data,url:En.location.href,route:n.getCurrentRoute(),clickCount:a,metric:!0}};this._addBreadcrumbEvent(n,u)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Qf(()=>this._checkClicks(),1e3)}}const ZIe=["A","BUTTON","INPUT"];function eDe(t,e){return!!(!ZIe.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function tDe(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function Gz(){return Date.now()/1e3}function nDe(t,e){try{if(!rDe(e))return;const{source:n}=e.data;if(XIe.has(n)&&t.registerMutation(e.timestamp),n===Et.Scroll&&t.registerScroll(e.timestamp),sDe(e)){const{type:r,id:s}=e.data,i=zo.mirror.getNode(s);i instanceof HTMLElement&&r===hs.Click&&t.registerClick(i)}}catch{}}function rDe(t){return t.type===qIe}function sDe(t){return t.data.source===Et.MouseInteraction}function Ma(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var Xx;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(Xx||(Xx={}));const iDe=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function aDe(t){const e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(const n in t)if(iDe.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),e[r]=t[n]}return e}const oDe=t=>e=>{if(!t.isEnabled())return;const n=lDe(e);if(!n)return;const r=e.name==="click",s=r?e.event:void 0;r&&t.clickDetector&&s&&s.target&&!s.altKey&&!s.metaKey&&!s.ctrlKey&&!s.shiftKey&&QIe(t.clickDetector,n,rY(e.event)),Wg(t,n)};function iY(t,e){const n=zo.mirror.getId(t),r=n&&zo.mirror.getNode(n),s=r&&zo.mirror.getMeta(r),i=s&&uDe(s)?s:null;return{message:e,data:i?{nodeId:n,node:{id:n,tagName:i.tagName,textContent:Array.from(i.childNodes).map(a=>a.type===Xx.Text&&a.textContent).filter(Boolean).map(a=>a.trim()).join(""),attributes:aDe(i.attributes)}}:{}}}function lDe(t){const{target:e,message:n}=cDe(t);return Ma({category:`ui.${t.name}`,...iY(e,n)})}function cDe(t){const e=t.name==="click";let n,r=null;try{r=e?rY(t.event):sY(t.event),n=Ko(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function uDe(t){return t.type===Xx.Element}function dDe(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=fDe(e);n&&Wg(t,n)}function fDe(t){const{metaKey:e,shiftKey:n,ctrlKey:r,altKey:s,key:i,target:a}=t;if(!a||hDe(a)||!i)return null;const l=e||r||s,u=i.length===1;if(!l&&u)return null;const d=Ko(a,{maxStringLength:200})||"<unknown>",h=iY(a,d);return Ma({category:"ui.keyDown",message:d,data:{...h.data,metaKey:e,shiftKey:n,ctrlKey:r,altKey:s,key:i}})}function hDe(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const pDe={resource:bDe,paint:vDe,navigation:yDe};function Qy(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}function mDe(t){return t.map(gDe).filter(Boolean)}function gDe(t){const e=pDe[t.entryType];return e?e(t):null}function eh(t){return((bs||En.performance.timeOrigin)+t)/1e3}function vDe(t){const{duration:e,entryType:n,name:r,startTime:s}=t,i=eh(s);return{type:n,name:r,start:i,end:i+e,data:void 0}}function yDe(t){const{entryType:e,name:n,decodedBodySize:r,duration:s,domComplete:i,encodedBodySize:a,domContentLoadedEventStart:l,domContentLoadedEventEnd:u,domInteractive:d,loadEventStart:h,loadEventEnd:p,redirectCount:g,startTime:v,transferSize:b,type:x}=t;return s===0?null:{type:`${e}.${x}`,start:eh(v),end:eh(i),name:n,data:{size:b,decodedBodySize:r,encodedBodySize:a,duration:s,domInteractive:d,domContentLoadedEventStart:l,domContentLoadedEventEnd:u,loadEventStart:h,loadEventEnd:p,domComplete:i,redirectCount:g}}}function bDe(t){const{entryType:e,initiatorType:n,name:r,responseEnd:s,startTime:i,decodedBodySize:a,encodedBodySize:l,responseStatus:u,transferSize:d}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:eh(i),end:eh(s),name:r,data:{size:d,statusCode:u,decodedBodySize:a,encodedBodySize:l}}}function xDe(t){const e=t.entries[t.entries.length-1],n=e&&e.element?[e.element]:void 0;return b_(t,"largest-contentful-paint",n)}function _De(t){return t.sources!==void 0}function wDe(t){const e=[],n=[];for(const r of t.entries)if(_De(r)){const s=[];for(const i of r.sources)if(i.node){n.push(i.node);const a=zo.mirror.getId(i.node);a&&s.push(a)}e.push({value:r.value,nodeIds:s.length?s:void 0})}return b_(t,"cumulative-layout-shift",n,e)}function SDe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return b_(t,"first-input-delay",n)}function EDe(t){const e=t.entries[t.entries.length-1],n=e&&e.target?[e.target]:void 0;return b_(t,"interaction-to-next-paint",n)}function b_(t,e,n,r){const s=t.value,i=t.rating,a=eh(s);return{type:"web-vital",name:e,start:a,end:a,data:{value:s,size:s,rating:i,nodeIds:n?n.map(l=>zo.mirror.getId(l)):void 0,attributions:r}}}function kDe(t){function e(s){t.performanceEntries.includes(s)||t.performanceEntries.push(s)}function n({entries:s}){s.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(s=>{r.push(Xf(s,n))}),r.push(wW(Qy(xDe,t)),Bj(Qy(wDe,t)),SW(Qy(SDe,t)),EW(Qy(EDe,t))),()=>{r.forEach(s=>s())}}const yt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,TDe='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},U=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=x(f,15),M=b.t,E=b.l,A=x(h,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(a[t]^a[t+1]<<A^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=U(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;o<e;++o){if(a+5>i.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function CDe(){const t=new Blob([TDe]);return URL.createObjectURL(t)}const Wz=["info","warn","error","log"],Eb="[Replay] ";function fk(t,e="info"){oc({category:"console",data:{logger:"replay"},level:e,message:`${Eb}${t}`},{level:e})}function ADe(){let t=!1,e=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{t=r.captureExceptions,e=r.traceInternals}};return yt?(Wz.forEach(r=>{n[r]=(...s)=>{Ue[r](Eb,...s),e&&fk(s.join(""),aW(r))}}),n.exception=(r,...s)=>{s.length&&n.error&&n.error(...s),Ue.error(Eb,r),t?YG(r):e&&fk(r,"error")},n.infoTick=(...r)=>{Ue.info(Eb,...r),e&&setTimeout(()=>fk(r[0]),0)}):Wz.forEach(r=>{n[r]=()=>{}}),n}const wt=ADe();class Zj extends Error{constructor(){super(`Event buffer exceeded maximum size of ${Gj}.`)}}class aY{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>Gj)throw new Zj;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?Jj(e):null}}class RDe{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){yt&&wt.info("Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const r=this._getAndIncrementId();return new Promise((s,i)=>{const a=({data:l})=>{const u=l;if(u.method===e&&u.id===r){if(this._worker.removeEventListener("message",a),!u.success){yt&&wt.error("Error in compression worker: ",u.response),i(new Error("Error in compression worker"));return}s(u.response)}};this._worker.addEventListener("message",a),this._worker.postMessage({id:r,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class NDe{constructor(e){this._worker=new RDe(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const n=Jj(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>Gj?Promise.reject(new Zj):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{yt&&wt.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class jDe{constructor(e){this._fallback=new aY,this._compression=new NDe(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){yt&&wt.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n,waitForCheckout:r}=this._fallback,s=[];for(const i of e)s.push(this._compression.addEvent(i));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(s),this._fallback.clear()}catch(i){yt&&wt.exception(i,"Failed to add events when switching buffers.")}}}function MDe({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=ODe(e);if(n)return n}return yt&&wt.info("Using simple buffer"),new aY}function ODe(t){try{const e=t||PDe();if(!e)return;yt&&wt.info(`Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new jDe(n)}catch(e){yt&&wt.exception(e,"Failed to create compression worker")}}function PDe(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?CDe():""}function eM(){try{return"sessionStorage"in En&&!!En.sessionStorage}catch{return!1}}function IDe(t){DDe(),t.session=void 0}function DDe(){if(eM())try{En.sessionStorage.removeItem(qj)}catch{}}function oY(t){return t===void 0?!1:Math.random()<t}function lY(t){const e=Date.now(),n=t.id||ci(),r=t.started||e,s=t.lastActivity||e,i=t.segmentId||0,a=t.sampled,l=t.previousSessionId;return{id:n,started:r,lastActivity:s,segmentId:i,sampled:a,previousSessionId:l}}function tM(t){if(eM())try{En.sessionStorage.setItem(qj,JSON.stringify(t))}catch{}}function LDe(t,e){return oY(t)?"session":e?"buffer":!1}function Yz({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:r}={}){const s=LDe(t,e),i=lY({sampled:s,previousSessionId:r});return n&&tM(i),i}function $De(){if(!eM())return null;try{const t=En.sessionStorage.getItem(qj);if(!t)return null;const e=JSON.parse(t);return yt&&wt.infoTick("Loading existing session"),lY(e)}catch{return null}}function _A(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function cY(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:r=Date.now()}){return _A(t.started,e,r)||_A(t.lastActivity,n,r)}function uY(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!cY(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function hk({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},r){const s=r.stickySession&&$De();return s?uY(s,{sessionIdleExpire:t,maxReplayDuration:e})?(yt&&wt.infoTick("Session in sessionStorage is expired, creating new one..."),Yz(r,{previousSessionId:s.id})):s:(yt&&wt.infoTick("Creating new session"),Yz(r,{previousSessionId:n}))}function zDe(t){return t.type===Lt.Custom}function nM(t,e,n){return fY(t,e)?(dY(t,e,n),!0):!1}function FDe(t,e,n){return fY(t,e)?dY(t,e,n):Promise.resolve(null)}async function dY(t,e,n){const{eventBuffer:r}=t;if(!r||r.waitForCheckout&&!n)return null;const s=t.recordingMode==="buffer";try{n&&s&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);const i=t.getOptions(),a=UDe(e,i.beforeAddRecordingEvent);return a?await r.addEvent(a):void 0}catch(i){const a=i&&i instanceof Zj,l=a?"addEventSizeExceeded":"addEvent";if(a&&s)return r.clear(),r.waitForCheckout=!0,null;t.handleException(i),await t.stop({reason:l});const u=Vt();u&&u.recordDroppedEvent("internal_sdk_error","replay")}}function fY(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=Jj(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(yt&&wt.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function UDe(t,e){try{if(typeof e=="function"&&zDe(t))return e(t)}catch(n){return yt&&wt.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}function rM(t){return!t.type}function wA(t){return t.type==="transaction"}function BDe(t){return t.type==="replay_event"}function Kz(t){return t.type==="feedback"}function HDe(t){return(e,n)=>{if(!t.isEnabled()||!rM(e)&&!wA(e))return;const r=n&&n.statusCode;if(!(!r||r<200||r>=300)){if(wA(e)){qDe(t,e);return}VDe(t,e)}}}function qDe(t,e){const n=t.getContext();e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function VDe(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:r}=t.getOptions();typeof r=="function"&&!r(e)||Qf(async()=>{try{await t.sendBufferedReplayOrFlush()}catch(s){t.handleException(s)}})}function GDe(t){return e=>{!t.isEnabled()||!rM(e)||WDe(t,e)}}function WDe(t,e){const n=e.exception&&e.exception.values&&e.exception.values[0]&&e.exception.values[0].value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const r=Ma({category:"replay.hydrate-error",data:{url:yG()}});Wg(t,r)}}function YDe(t){const e=Vt();e&&e.on("beforeAddBreadcrumb",n=>KDe(t,n))}function KDe(t,e){if(!t.isEnabled()||!hY(e))return;const n=XDe(e);n&&Wg(t,n)}function XDe(t){return!hY(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?QDe(t):Ma(t)}function QDe(t){const e=t.data&&t.data.arguments;if(!Array.isArray(e)||e.length===0)return Ma(t);let n=!1;const r=e.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>Yy?(n=!0,`${s.slice(0,Yy)}…`):s;if(typeof s=="object")try{const i=ea(s,7);return JSON.stringify(i).length>Yy?(n=!0,`${JSON.stringify(i,null,2).slice(0,Yy)}…`):i}catch{}return s});return Ma({...t,data:{...t.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function hY(t){return!!t.category}function JDe(t,e){return t.type||!t.exception||!t.exception.values||!t.exception.values.length?!1:!!(e.originalException&&e.originalException.__rrweb__)}function pY(){const t=Tn().getPropagationContext().dsc;t&&delete t.replay_id;const e=Lr();if(e){const n=Iu(e);delete n.replay_id}}function ZDe(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:Lt.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function eLe(t,e){return t.recordingMode!=="buffer"||e.message===Vj||!e.exception||e.type?!1:oY(t.getOptions().errorSampleRate)}function tLe(t){return Object.assign((e,n)=>!t.isEnabled()||t.isPaused()?e:BDe(e)?(delete e.breadcrumbs,e):!rM(e)&&!wA(e)&&!Kz(e)?e:t.checkAndHandleExpiredSession()?Kz(e)?(t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),ZDe(t,e),e):JDe(e,n)&&!t.getOptions()._experiments.captureExceptions?(yt&&wt.log("Ignoring error from rrweb internals",e),null):((eLe(t,e)||t.recordingMode==="session")&&(e.tags={...e.tags,replayId:t.getSessionId()}),e):(pY(),e),{id:"Replay"})}function x_(t,e){return e.map(({type:n,start:r,end:s,name:i,data:a})=>{const l=t.throttledAddEvent({type:Lt.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:i,startTimestamp:r,endTimestamp:s,data:a}}});return typeof l=="string"?Promise.resolve(null):l})}function nLe(t){const{from:e,to:n}=t,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:e}}}function rLe(t){return e=>{if(!t.isEnabled())return;const n=nLe(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(x_(t,[n]),!1)))}}function sLe(t,e){return yt&&t.getOptions()._experiments.traceInternals?!1:nMe(e,Vt())}function mY(t,e){t.isEnabled()&&e!==null&&(sLe(t,e.name)||t.addUpdate(()=>(x_(t,[e]),!0)))}function __(t){if(!t)return;const e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=bY(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function gY(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function vY(t){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[bY(t)];if(!t)return[void 0]}catch(e){return yt&&wt.exception(e,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return yt&&wt.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Qx(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},r=n.warnings||[];return n.warnings=[...r,e],t._meta=n,t}function yY(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:r,url:s,method:i,statusCode:a,request:l,response:u}=e;return{type:t,start:n/1e3,end:r/1e3,name:s,data:Tr({method:i,statusCode:a,request:l,response:u})}}function gg(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function Kl(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const r={headers:t,size:e},{body:s,warnings:i}=iLe(n);return r.body=s,i&&i.length>0&&(r._meta={warnings:i}),r}function SA(t,e){return Object.entries(t).reduce((n,[r,s])=>{const i=r.toLowerCase();return e.includes(i)&&t[r]&&(n[i]=s),n},{})}function bY(t){return new URLSearchParams(t).toString()}function iLe(t){if(!t||typeof t!="string")return{body:t};const e=t.length>Rz,n=aLe(t);if(e){const r=t.slice(0,Rz);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function aLe(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function Jx(t,e){const n=oLe(t);return Yl(n,e)}function oLe(t,e=En.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(En.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const r=n.href;return!t.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function lLe(t,e,n){try{const r=await uLe(t,e,n),s=yY("resource.fetch",r);mY(n.replay,s)}catch(r){yt&&wt.exception(r,"Failed to capture fetch breadcrumb")}}function cLe(t,e){const{input:n,response:r}=e,s=n?xY(n):void 0,i=__(s),a=r?gY(r.headers.get("content-length")):void 0;i!==void 0&&(t.data.request_body_size=i),a!==void 0&&(t.data.response_body_size=a)}async function uLe(t,e,n){const r=Date.now(),{startTimestamp:s=r,endTimestamp:i=r}=e,{url:a,method:l,status_code:u=0,request_body_size:d,response_body_size:h}=t.data,p=Jx(a,n.networkDetailAllowUrls)&&!Jx(a,n.networkDetailDenyUrls),g=p?dLe(n,e.input,d):gg(d),v=await fLe(p,n,e.response,h);return{startTimestamp:s,endTimestamp:i,url:a,method:l,statusCode:u,request:g,response:v}}function dLe({networkCaptureBodies:t,networkRequestHeaders:e},n,r){const s=n?mLe(n,e):{};if(!t)return Kl(s,r,void 0);const i=xY(n),[a,l]=vY(i),u=Kl(s,r,a);return l?Qx(u,l):u}async function fLe(t,{networkCaptureBodies:e,networkResponseHeaders:n},r,s){if(!t&&s!==void 0)return gg(s);const i=r?_Y(r.headers,n):{};if(!r||!e&&s!==void 0)return Kl(i,s,void 0);const[a,l]=await pLe(r),u=hLe(a,{networkCaptureBodies:e,responseBodySize:s,captureDetails:t,headers:i});return l?Qx(u,l):u}function hLe(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:r,headers:s}){try{const i=t&&t.length&&n===void 0?__(t):n;return r?e?Kl(s,i,t):Kl(s,i,void 0):gg(i)}catch(i){return yt&&wt.exception(i,"Failed to serialize response body"),Kl(s,n,void 0)}}async function pLe(t){const e=gLe(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await vLe(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(yt&&wt.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(yt&&wt.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function xY(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}function _Y(t,e){const n={};return e.forEach(r=>{t.get(r)&&(n[r]=t.get(r))}),n}function mLe(t,e){return t.length===1&&typeof t[0]!="string"?Xz(t[0],e):t.length===2?Xz(t[1],e):{}}function Xz(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?_Y(n,e):Array.isArray(n)?{}:SA(n,e):{}}function gLe(t){try{return t.clone()}catch(e){yt&&wt.exception(e,"Failed to clone response body")}}function vLe(t){return new Promise((e,n)=>{const r=Qf(()=>n(new Error("Timeout while trying to read response body")),500);yLe(t).then(s=>e(s),s=>n(s)).finally(()=>clearTimeout(r))})}async function yLe(t){return await t.text()}async function bLe(t,e,n){try{const r=_Le(t,e,n),s=yY("resource.xhr",r);mY(n.replay,s)}catch(r){yt&&wt.exception(r,"Failed to capture xhr breadcrumb")}}function xLe(t,e){const{xhr:n,input:r}=e;if(!n)return;const s=__(r),i=n.getResponseHeader("content-length")?gY(n.getResponseHeader("content-length")):kLe(n.response,n.responseType);s!==void 0&&(t.data.request_body_size=s),i!==void 0&&(t.data.response_body_size=i)}function _Le(t,e,n){const r=Date.now(),{startTimestamp:s=r,endTimestamp:i=r,input:a,xhr:l}=e,{url:u,method:d,status_code:h=0,request_body_size:p,response_body_size:g}=t.data;if(!u)return null;if(!l||!Jx(u,n.networkDetailAllowUrls)||Jx(u,n.networkDetailDenyUrls)){const A=gg(p),j=gg(g);return{startTimestamp:s,endTimestamp:i,url:u,method:d,statusCode:h,request:A,response:j}}const v=l[nu],b=v?SA(v.request_headers,n.networkRequestHeaders):{},x=SA(wLe(l),n.networkResponseHeaders),[E,S]=n.networkCaptureBodies?vY(a):[void 0],[C,T]=n.networkCaptureBodies?SLe(l):[void 0],R=Kl(b,p,E),N=Kl(x,g,C);return{startTimestamp:s,endTimestamp:i,url:u,method:d,statusCode:h,request:S?Qx(R,S):R,response:T?Qx(N,T):N}}function wLe(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
1872
1872
  `).reduce((n,r)=>{const[s,i]=r.split(": ");return i&&(n[s.toLowerCase()]=i),n},{}):{}}function SLe(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return ELe(t.response,t.responseType)}catch(n){e.push(n)}return yt&&wt.warn("Failed to get xhr response body",...e),[void 0]}function ELe(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return yt&&wt.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return yt&&wt.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function kLe(t,e){try{const n=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return __(n)}catch{return}}function TLe(t){const e=Vt();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:a}=t.getOptions(),l={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:a};e&&e.on("beforeAddBreadcrumb",(u,d)=>CLe(l,u,d))}catch{}}function CLe(t,e,n){if(e.data)try{ALe(e)&&NLe(n)&&(xLe(e,n),bLe(e,n,t)),RLe(e)&&jLe(n)&&(cLe(e,n),lLe(e,n,t))}catch(r){yt&&wt.exception(r,"Error when enriching network breadcrumb")}}function ALe(t){return t.category==="xhr"}function RLe(t){return t.category==="fetch"}function NLe(t){return t&&t.xhr}function jLe(t){return t&&t.response}function MLe(t){const e=Vt();RW(oDe(t)),m_(rLe(t)),YDe(t),TLe(t);const n=tLe(t);Ije(n),e&&(e.on("beforeSendEvent",GDe(t)),e.on("afterSendEvent",HDe(t)),e.on("createDsc",r=>{const s=t.getSessionId();s&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(r.replay_id=s)}),e.on("spanStart",r=>{t.lastActiveSpan=r}),e.on("spanEnd",r=>{t.lastActiveSpan=r}),e.on("beforeSendFeedback",(r,s)=>{const i=t.getSessionId();s&&s.includeReplay&&t.isEnabled()&&i&&r.contexts&&r.contexts.feedback&&(r.contexts.feedback.replay_id=i)}))}async function OLe(t){try{return Promise.all(x_(t,[PLe(En.performance.memory)]))}catch{return[]}}function PLe(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}=t,s=Date.now()/1e3;return{type:"memory",name:"memory",start:s,end:s,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}}}}function ILe(t,e,n){let r,s,i;const a=n&&n.maxWait?Math.max(n.maxWait,e):0;function l(){return u(),r=t(),r}function u(){s!==void 0&&clearTimeout(s),i!==void 0&&clearTimeout(i),s=i=void 0}function d(){return s!==void 0||i!==void 0?l():r}function h(){return s&&clearTimeout(s),s=Qf(l,e),a&&i===void 0&&(i=Qf(l,a)),r}return h.cancel=u,h.flush=d,h}const Wc=Gt.navigator;function DLe(){return/iPhone|iPad|iPod/i.test(Wc&&Wc.userAgent||"")||/Macintosh/i.test(Wc&&Wc.userAgent||"")&&Wc&&Wc.maxTouchPoints&&Wc.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function LLe(t){let e=!1;return(n,r)=>{if(!t.checkAndHandleExpiredSession()){yt&&wt.warn("Received replay event after session expired.");return}const s=r||!e;e=!0,t.clickDetector&&nDe(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&s&&t.setInitialState(),!nM(t,n,s))return!0;if(!s)return!1;const i=t.session;if(zLe(t,s),t.recordingMode==="buffer"&&i&&t.eventBuffer){const a=t.eventBuffer.getEarliestTimestamp();a&&(yt&&wt.info(`Updating session start time to earliest event in buffer to ${new Date(a)}`),i.started=a,t.getOptions().stickySession&&tM(i))}return i&&i.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}}function $Le(t){const e=t.getOptions();return{type:Lt.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function zLe(t,e){!e||!t.session||t.session.segmentId!==0||nM(t,$Le(t),!1)}function FLe(t,e,n,r){return Du(BG(t,Dj(t),r,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function ULe({recordingData:t,headers:e}){let n;const r=`${JSON.stringify(e)}
1873
1873
  `;if(typeof t=="string")n=`${r}${t}`;else{const i=new TextEncoder().encode(r);n=new Uint8Array(i.length+t.length),n.set(i),n.set(t,i.length)}return n}async function BLe({client:t,scope:e,replayId:n,event:r}){const s=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,i={event_id:n,integrations:s};t.emit("preprocessEvent",r,i);const a=await WG(t.getOptions(),r,i,e,t,Ui());if(!a)return null;a.platform=a.platform||"javascript";const l=t.getSdkMetadata(),{name:u,version:d}=l&&l.sdk||{};return a.sdk={...a.sdk,name:u||"sentry.javascript.unknown",version:d||"0.0.0"},a}async function HLe({recordingData:t,replayId:e,segmentId:n,eventContext:r,timestamp:s,session:i}){const a=ULe({recordingData:t,headers:{segment_id:n}}),{urls:l,errorIds:u,traceIds:d,initialTimestamp:h}=r,p=Vt(),g=Tn(),v=p&&p.getTransport(),b=p&&p.getDsn();if(!p||!v||!b||!i.sampled)return Xo({});const x={type:_Pe,replay_start_timestamp:h/1e3,timestamp:s/1e3,error_ids:u,trace_ids:d,urls:l,replay_id:e,segment_id:n,replay_type:i.sampled},E=await BLe({scope:g,client:p,replayId:e,event:x});if(!E)return p.recordDroppedEvent("event_processor","replay",x),yt&&wt.info("An event processor returned `null`, will not send event."),Xo({});delete E.sdkProcessingMetadata;const S=FLe(E,a,b,p.getOptions().tunnel);let C;try{C=await v.send(S)}catch(R){const N=new Error(Vj);try{N.cause=R}catch{}throw N}if(typeof C.statusCode=="number"&&(C.statusCode<200||C.statusCode>=300))throw new wY(C.statusCode);const T=rW({},C);if(nW(T,"replay"))throw new sM(T);return C}class wY extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class sM extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function SY(t,e={count:0,interval:CPe}){const{recordingData:n,onError:r}=t;if(n.length)try{return await HLe(t),!0}catch(s){if(s instanceof wY||s instanceof sM)throw s;if(XG("Replays",{_retryCount:e.count}),r&&r(s),e.count>=APe){const i=new Error(`${Vj} - max retries exceeded`);try{i.cause=s}catch{}throw i}return e.interval*=++e.count,new Promise((i,a)=>{Qf(async()=>{try{await SY(t,e),i(!0)}catch(l){a(l)}},e.interval)})}}const EY="__THROTTLED",qLe="__SKIPPED";function VLe(t,e,n){const r=new Map,s=l=>{const u=l-n;r.forEach((d,h)=>{h<u&&r.delete(h)})},i=()=>[...r.values()].reduce((l,u)=>l+u,0);let a=!1;return(...l)=>{const u=Math.floor(Date.now()/1e3);if(s(u),i()>=e){const h=a;return a=!0,h?qLe:EY}a=!1;const d=r.get(u)||0;return r.set(u,d+1),t(...l)}}class Ul{constructor({options:e,recordingOptions:n}){Ul.prototype.__init.call(this),Ul.prototype.__init2.call(this),Ul.prototype.__init3.call(this),Ul.prototype.__init4.call(this),Ul.prototype.__init5.call(this),Ul.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:wPe,sessionIdleExpire:SPe},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=ILe(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=VLe((a,l)=>FDe(this,a,l),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:s}=this.getOptions(),i=r?{threshold:Math.min(RPe,r),timeout:r,scrollTimeout:NPe,ignoreSelector:s?s.join(","):""}:void 0;if(i&&(this.clickDetector=new JIe(this,i)),yt){const a=e._experiments;wt.setConfig({captureExceptions:!!a.captureExceptions,traceInternals:!!a.traceInternals})}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){yt&&wt.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:r}=this._options,s=n<=0&&r<=0;if(this._requiresManualStart=s,!s){if(this._initializeSessionForSampling(e),!this.session){yt&&wt.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",yt&&wt.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){yt&&wt.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){yt&&wt.info("Buffering is in progress, call `flush()` to save the replay");return}yt&&wt.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=hk({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this._initializeRecording()}startBuffering(){if(this._isEnabled){yt&&wt.info("Buffering is in progress, call `flush()` to save the replay");return}yt&&wt.infoTick("Starting replay in buffer mode");const e=hk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=zo({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:TPe}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:LLe(this),...DLe(),onMutation:this._onMutationHandler,...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}async stop({forceFlush:e=!1,reason:n}={}){if(this._isEnabled){this._isEnabled=!1;try{yt&&wt.info(`Stopping Replay${n?` triggered by ${n}`:""}`),pY(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,IDe(this)}catch(r){this.handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),yt&&wt.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),yt&&wt.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();yt&&wt.info("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode!=="buffer"&&n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&_A(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${En.location.pathname}${En.location.hash}${En.location.search}`,n=`${En.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const r=this._throttledAddEvent(e,n);if(r===EY){const s=Ma({category:"replay.throttled"});this.addUpdate(()=>!nM(this,{type:VIe,timestamp:s.timestamp||0,data:{tag:"breadcrumb",payload:s,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastActiveSpan||Lr(),n=e&&Yr(e),s=(n&&en(n).data||{})[ja];if(!(!n||!s||!["route","custom"].includes(s)))return en(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=MDe({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,r=hk({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return uY(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{En.document.addEventListener("visibilitychange",this._handleVisibilityChange),En.addEventListener("blur",this._handleWindowBlur),En.addEventListener("focus",this._handleWindowFocus),En.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(MLe(this),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=kDe(this)}_removeListeners(){try{En.document.removeEventListener("visibilitychange",this._handleVisibilityChange),En.removeEventListener("blur",this._handleWindowBlur),En.removeEventListener("focus",this._handleWindowFocus),En.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}__init(){this._handleVisibilityChange=()=>{En.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()}}__init2(){this._handleWindowBlur=()=>{const e=Ma({category:"ui.blur"});this._doChangeToBackgroundTasks(e)}}__init3(){this._handleWindowFocus=()=>{const e=Ma({category:"ui.focus"});this._doChangeToForegroundTasks(e)}}__init4(){this._handleKeyboardEvent=e=>{dDe(this,e)}}_doChangeToBackgroundTasks(e){!this.session||cY(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){yt&&wt.info("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:Lt.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=mDe(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;e=e.filter(r=>r.start>=n)}return Promise.all(x_(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;const r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){yt&&wt.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await OLe(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const r=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();const i=await this.eventBuffer.finish();await SY({replayId:e,recordingData:i,segmentId:s,eventContext:r,session:this.session,timestamp:n,onError:a=>this.handleException(a)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const r=Vt();if(r){const s=n instanceof sM?"ratelimit_backoff":"send_error";r.recordDroppedEvent(s,"replay")}}}__init5(){this._flush=async({force:e=!1}={})=>{if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){yt&&wt.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,s=Date.now()-n;this._debouncedFlush.cancel();const i=s<this._options.minReplayDuration,a=s>this._options.maxReplayDuration+5e3;if(i||a){yt&&wt.info(`Session duration (${Math.floor(s/1e3)}s) is too ${i?"short":"long"}, not sending replay.`),i&&this._debouncedFlush();return}const l=this.eventBuffer;l&&this.session.segmentId===0&&!l.hasCheckout&&yt&&wt.info("Flushing initial segment without checkout.");const u=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(d){this.handleException(d)}finally{this._flushLock=void 0,u&&this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&tM(this.session)}__init6(){this._onMutationHandler=e=>{const n=e.length,r=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,i=r&&n>r;if(n>s||i){const a=Ma({category:"replay.mutations",data:{count:n,limit:i}});this._createCustomBreadcrumb(a)}return i?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function zp(t,e){return[...t,...e].join(",")}function GLe({mask:t,unmask:e,block:n,unblock:r,ignore:s}){const i=["base","iframe[srcdoc]:not([src])"],a=zp(t,[".sentry-mask","[data-sentry-mask]"]),l=zp(e,[]);return{maskTextSelector:a,unmaskTextSelector:l,blockSelector:zp(n,[".sentry-block","[data-sentry-block]",...i]),unblockSelector:zp(r,[]),ignoreSelector:zp(s,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function WLe({el:t,key:e,maskAttributes:n,maskAllText:r,privacyOptions:s,value:i}){return!r||s.unmaskTextSelector&&t.matches(s.unmaskTextSelector)?i:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?i.replace(/[\S]/g,"*"):i}const Qz='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',YLe=["content-length","content-type","accept"];let Jz=!1;const KLe=t=>new w_(t);class w_{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:e=EPe,flushMaxDelay:n=kPe,minReplayDuration:r=jPe,maxReplayDuration:s=Nz,stickySession:i=!0,useCompression:a=!0,workerUrl:l,_experiments:u={},maskAllText:d=!0,maskAllInputs:h=!0,blockAllMedia:p=!0,mutationBreadcrumbLimit:g=750,mutationLimit:v=1e4,slowClickTimeout:b=7e3,slowClickIgnoreSelectors:x=[],networkDetailAllowUrls:E=[],networkDetailDenyUrls:S=[],networkCaptureBodies:C=!0,networkRequestHeaders:T=[],networkResponseHeaders:R=[],mask:N=[],maskAttributes:A=["title","placeholder"],unmask:j=[],block:M=[],unblock:I=[],ignore:O=[],maskFn:$,beforeAddRecordingEvent:z,beforeErrorSampling:G,onError:W}={}){this.name=w_.id;const Q=GLe({mask:N,unmask:j,block:M,unblock:I,ignore:O});if(this._recordingOptions={maskAllInputs:h,maskAllText:d,maskInputOptions:{password:!0},maskTextFn:$,maskInputFn:$,maskAttributeFn:(F,Y,V)=>WLe({maskAttributes:A,maskAllText:d,privacyOptions:Q,key:F,value:Y,el:V}),...Q,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:F=>{try{F.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(r,MPe),maxReplayDuration:Math.min(s,Nz),stickySession:i,useCompression:a,workerUrl:l,blockAllMedia:p,maskAllInputs:h,maskAllText:d,mutationBreadcrumbLimit:g,mutationLimit:v,slowClickTimeout:b,slowClickIgnoreSelectors:x,networkDetailAllowUrls:E,networkDetailDenyUrls:S,networkCaptureBodies:C,networkRequestHeaders:Zz(T),networkResponseHeaders:Zz(R),beforeAddRecordingEvent:z,beforeErrorSampling:G,onError:W,_experiments:u},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Qz}`:Qz),this._isInitialized&&xz())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return Jz}set _isInitialized(e){Jz=e}afterAllSetup(e){!xz()||this._replay||(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}getRecordingMode(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const n=XLe(this._initialOptions,e);this._replay=new Ul({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}w_.__initStatic();function XLe(t,e){const n=e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...Tr(t)},s=Fx(n.replaysSessionSampleRate),i=Fx(n.replaysOnErrorSampleRate);return s==null&&i==null&&vc(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),s!=null&&(r.sessionSampleRate=s),i!=null&&(r.errorSampleRate=i),r}function Zz(t){return[...YLe,...t.map(e=>e.toLowerCase())]}const eF=new WeakMap,pk=new Map,kb={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function QLe(t,e){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:s,shouldCreateSpanForRequest:i,enableHTTPTimings:a,tracePropagationTargets:l}={traceFetch:kb.traceFetch,traceXHR:kb.traceXHR,trackFetchStreamPerformance:kb.trackFetchStreamPerformance,...e},u=typeof i=="function"?i:p=>!0,d=p=>e3e(p,l),h={};n&&(t.addEventProcessor(p=>(p.type==="transaction"&&p.spans&&p.spans.forEach(g=>{if(g.op==="http.client"){const v=pk.get(g.span_id);v&&(g.timestamp=v/1e3,pk.delete(g.span_id))}}),p)),s&&UMe(p=>{if(p.response){const g=eF.get(p.response);g&&p.endTimestamp&&pk.set(g,p.endTimestamp)}}),dW(p=>{const g=PMe(p,u,d,h);if(p.response&&p.fetchData.__span&&eF.set(p.response,p.fetchData.__span),g){const v=kY(p.fetchData.url),b=v?hu(v).host:void 0;g.setAttributes({"http.url":v,"server.address":b})}a&&g&&tF(g)})),r&&jW(p=>{const g=t3e(p,u,d,h);a&&g&&tF(g)})}function JLe(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function tF(t){const{url:e}=en(t).data||{};if(!e||typeof e!="string")return;const n=Xf("resource",({entries:r})=>{r.forEach(s=>{JLe(s)&&s.name.endsWith(e)&&(ZLe(s).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function Sa(t=0){return((bs||performance.timeOrigin)+t)/1e3}function ZLe(t){const{name:e,version:n}=AW(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),bs?[...r,["http.request.redirect_start",Sa(t.redirectStart)],["http.request.fetch_start",Sa(t.fetchStart)],["http.request.domain_lookup_start",Sa(t.domainLookupStart)],["http.request.domain_lookup_end",Sa(t.domainLookupEnd)],["http.request.connect_start",Sa(t.connectStart)],["http.request.secure_connection_start",Sa(t.secureConnectionStart)],["http.request.connection_end",Sa(t.connectEnd)],["http.request.request_start",Sa(t.requestStart)],["http.request.response_start",Sa(t.responseStart)],["http.request.response_end",Sa(t.responseEnd)]]:r}function e3e(t,e){const n=Tt.location&&Tt.location.href;if(n){let r,s;try{r=new URL(t,n),s=new URL(n).origin}catch{return!1}const i=r.origin===s;return e?Yl(r.toString(),e)||i&&Yl(r.pathname,e):i}else{const r=!!t.match(/^\/(?!\/)/);return e?Yl(t,e):r}}function t3e(t,e,n,r){const s=t.xhr,i=s&&s[nu];if(!s||s.__sentry_own_request__||!i)return;const a=ac()&&e(i.url);if(t.endTimestamp&&a){const p=s.__sentry_xhr_span_id__;if(!p)return;const g=r[p];g&&i.status_code!==void 0&&(TG(g,i.status_code),g.end(),delete r[p]);return}const l=kY(i.url),u=l?hu(l).host:void 0,d=!!Lr(),h=a&&d?Ug({name:`${i.method} ${i.url}`,attributes:{type:"xhr","http.method":i.method,"http.url":l,url:i.url,"server.address":u,[Dr]:"auto.http.browser",[Nu]:"http.client"}}):new xh;return s.__sentry_xhr_span_id__=h.spanContext().spanId,r[s.__sentry_xhr_span_id__]=h,n(i.url)&&n3e(s,ac()&&d?h:void 0),h}function n3e(t,e){const{"sentry-trace":n,baggage:r}=iW({span:e});n&&r3e(t,n,r)}function r3e(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader("baggage",n)}catch{}}function kY(t){try{return new URL(t,Tt.location.origin).href}catch{return}}function s3e(){Tt&&Tt.document?Tt.document.addEventListener("visibilitychange",()=>{const t=Lr();if(!t)return;const e=Yr(t);if(Tt.document.hidden&&e){const n="cancelled",{op:r,status:s}=en(e);Ya&&Ue.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),s||e.setStatus({code:Or,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):Ya&&Ue.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const i3e="BrowserTracing",a3e={...xb,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...kb},o3e=(t={})=>{$Ne();const{enableInp:e,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:s,enableStandaloneClsSpans:i},beforeStartSpan:a,idleTimeout:l,finalTimeout:u,childSpanTimeout:d,markBackgroundSpan:h,traceFetch:p,traceXHR:g,trackFetchStreamPerformance:v,shouldCreateSpanForRequest:b,enableHTTPTimings:x,instrumentPageLoad:E,instrumentNavigation:S}={...a3e,...t},C=XOe({recordClsStandaloneSpans:i||!1});e&&_2e(),r&&Gt.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?JOe():n&&QOe(),s&&ZOe();const T={name:void 0,source:void 0};function R(N,A){const j=A.op==="pageload",M=a?a(A):A,I=M.attributes||{};A.name!==M.name&&(I[ja]="custom",M.attributes=I),T.name=M.name,T.source=I[ja];const O=GG(M,{idleTimeout:l,finalTimeout:u,childSpanTimeout:d,disableAutoFinish:j,beforeSpanEnd:z=>{C(),s2e(z,{recordClsOnPageloadSpan:!i})}});function $(){["interactive","complete"].includes(Tt.document.readyState)&&N.emit("idleSpanEnableAutoFinish",O)}return j&&Tt.document&&(Tt.document.addEventListener("readystatechange",()=>{$()}),$()),O}return{name:i3e,afterAllSetup(N){let A,j=Tt.location&&Tt.location.href;function M(){A&&!en(A).timestamp&&(Ya&&Ue.log(`[Tracing] Finishing current active span with op: ${en(A).op}`),A.end())}N.on("startNavigationSpan",I=>{Vt()===N&&(M(),A=R(N,{op:"navigation",...I}))}),N.on("startPageLoadSpan",(I,O={})=>{if(Vt()!==N)return;M();const $=O.sentryTrace||nF("sentry-trace"),z=O.baggage||nF("baggage"),G=jNe($,z);Tn().setPropagationContext(G),A=R(N,{op:"pageload",...I})}),N.on("spanEnd",I=>{const O=en(I).op;if(I!==Yr(I)||O!=="navigation"&&O!=="pageload")return;const $=Tn(),z=$.getPropagationContext();$.setPropagationContext({...z,sampled:z.sampled!==void 0?z.sampled:Pu(I),dsc:z.dsc||Iu(I)})}),Tt.location&&(E&&l3e(N,{name:Tt.location.pathname,startTime:bs?bs/1e3:void 0,attributes:{[ja]:"url",[Dr]:"auto.pageload.browser"}}),S&&m_(({to:I,from:O})=>{if(O===void 0&&j&&j.indexOf(I)!==-1){j=void 0;return}O!==I&&(j=void 0,c3e(N,{name:Tt.location.pathname,attributes:{[ja]:"url",[Dr]:"auto.navigation.browser"}}))})),h&&s3e(),s&&u3e(l,u,d,T),e&&S2e(),QLe(N,{traceFetch:p,traceXHR:g,trackFetchStreamPerformance:v,tracePropagationTargets:N.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:b,enableHTTPTimings:x})}}};function l3e(t,e,n){t.emit("startPageLoadSpan",e,n),Tn().setTransactionName(e.name);const r=Lr();return(r&&en(r).op)==="pageload"?r:void 0}function c3e(t,e){Ui().setPropagationContext({traceId:sc()}),Tn().setPropagationContext({traceId:sc()}),t.emit("startNavigationSpan",e),Tn().setTransactionName(e.name);const n=Lr();return(n&&en(n).op)==="navigation"?n:void 0}function nF(t){const e=rNe(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function u3e(t,e,n,r){let s;const i=()=>{const a="ui.action.click",l=Lr(),u=l&&Yr(l);if(u){const d=en(u).op;if(["navigation","pageload"].includes(d)){Ya&&Ue.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(s&&(s.setAttribute(QC,"interactionInterrupted"),s.end(),s=void 0),!r.name){Ya&&Ue.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}s=GG({name:r.name,op:a,attributes:{[ja]:r.source||"url"}},{idleTimeout:t,finalTimeout:e,childSpanTimeout:n})};Tt.document&&addEventListener("click",i,{once:!1,capture:!0})}function d3e(t){const e={...t};return sW(e,"react"),XG("react",{version:w.version}),xPe(e)}function f3e(){const{user:t}=ha(),{isAuthenticated:e,isLoading:n}=ro(),r=V7("users:ensureUser"),s=w.useRef(null);w.useEffect(()=>{e||(s.current=null,az(null))},[e]),w.useEffect(()=>{if(!n){if(!e&&t)throw console.log("useEnsureDbUser: not authenticated"),new Error("Not authenticated");e&&t&&s.current!==t.id&&r().then(i=>{s.current=t.id,az({id:t.id})}).catch(i=>{console.error("[auth] ensureUser failed",i),s.current=null})}},[e,n,t,r])}function h3e(){const t=fa(),{user:e}=ha(),{isAuthenticated:n}=ro();w.useEffect(()=>{t&&(n&&e?(t.identify(e.id,{email:e.email,name:e.firstName&&e.lastName?`${e.firstName} ${e.lastName}`:e.email,first_name:e.firstName,last_name:e.lastName}),t.register({user_id:e.id})):t.reset())},[t,n,e])}function rF({className:t,...e}){return f.jsx(wZ,{"data-slot":"avatar",className:Oe("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...e})}function sF({className:t,...e}){return f.jsx(SZ,{"data-slot":"avatar-image",className:Oe("aspect-square size-full",t),...e})}function iF({className:t,...e}){return f.jsx(EZ,{"data-slot":"avatar-fallback",className:Oe("bg-muted flex size-full items-center justify-center rounded-full",t),...e})}function p3e(){const{isLoading:t}=ro(),{user:e,signIn:n,signOut:r,signUp:s}=ha(),i=fa();if(t)return f.jsx(De,{variant:"outline",size:"sm",disabled:!0,children:f.jsx(ir,{className:"h-3 w-3 mr-1.5 animate-spin"})});if(!e)return f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(De,{variant:"outline",onClick:()=>{i.capture("sign_in",{location:"auth_upper_area",platform:Oi(),environment:void 0}),n()},children:"Sign in"}),f.jsx(De,{onClick:()=>{i.capture("create_account",{location:"auth_upper_area",platform:Oi(),environment:void 0}),s()},style:{backgroundColor:"#E55A3A"},children:"Create account"})]});const a=[e.firstName,e.lastName].filter(Boolean).join(" "),l=e.email,u=bQ(a),d=()=>{const p=window.location.origin,v=p.includes("://localhost")?p.replace("://localhost","://127.0.0.1"):p;r({returnTo:v})},h=e.profilePictureUrl||void 0;return f.jsxs(k0,{children:[f.jsx(T0,{asChild:!0,children:f.jsx("button",{className:"flex size-10 items-center justify-center rounded-full border border-border/60 bg-background/80 shadow-sm outline-none transition hover:ring-2 hover:ring-ring/20 focus-visible:ring-2 focus-visible:ring-ring",children:f.jsxs(rF,{className:"size-9",children:[f.jsx(sF,{src:h,alt:a}),f.jsx(iF,{className:"bg-muted text-muted-foreground text-sm font-medium",children:u!=="?"?u:f.jsx(CI,{className:"size-4"})})]})})}),f.jsxs(C0,{className:"w-56",align:"end",children:[f.jsx(Lae,{className:"pb-3",children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs(rF,{className:"size-10",children:[f.jsx(sF,{src:h,alt:a}),f.jsx(iF,{className:"bg-muted text-muted-foreground text-base font-semibold",children:u!=="?"?u:f.jsx(CI,{className:"size-5"})})]}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("p",{className:"text-sm font-medium leading-none truncate",children:a}),f.jsx("p",{className:"text-xs text-muted-foreground truncate",children:l})]})]})}),f.jsx(MI,{}),f.jsxs(Po,{onClick:()=>window.location.hash="settings",children:[f.jsx(vR,{className:"size-4"}),"Settings"]}),f.jsx(MI,{}),f.jsxs(Po,{variant:"destructive",onClick:d,children:[f.jsx(xie,{className:"size-4"}),"Log out"]})]})]})}function m3e(){const[t,e]=w.useState("servers"),n=fa();h3e(),w.useEffect(()=>{n.capture("app_launched",{platform:Oi(),environment:void 0,user_agent:navigator.userAgent})},[]),qRe(),f3e();const r=w.useMemo(()=>window.location.pathname.startsWith("/oauth/callback/debug"),[]),s=w.useMemo(()=>window.location.pathname==="/callback",[]),{appState:i,isLoading:a,connectedServerConfigs:l,selectedMCPConfig:u,handleConnect:d,handleDisconnect:h,handleReconnect:p,handleUpdate:g,handleRemoveServer:v,setSelectedServer:b,toggleServerSelection:x,selectedMCPConfigsMap:E,setSelectedMultipleServersToAllServers:S}=X7();w.useEffect(()=>{const T=()=>{const R=(window.location.hash||"#servers").replace("#","");e(R),R==="chat"&&S()};return T(),window.addEventListener("hashchange",T),()=>window.removeEventListener("hashchange",T)},[S]);const C=T=>{T==="chat"&&S(),window.location.hash=T,e(T)};return r?f.jsx(oRe,{}):s?(w.useEffect(()=>{const T=setTimeout(()=>{window.location.href="/"},5e3);return()=>clearTimeout(T)},[]),f.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Completing sign in..."}),f.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"If this takes too long, you'll be redirected automatically"})]})})):a?f.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"}),f.jsx("p",{className:"mt-4 text-muted-foreground",children:"Loading..."})]})}):f.jsxs(X1e,{themeMode:"light",themePreset:"default",children:[f.jsxs(wRe,{defaultOpen:!0,children:[f.jsx(IRe,{onNavigate:C,activeTab:t}),f.jsxs(kRe,{className:"flex flex-col",children:[f.jsx("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear drag",children:f.jsxs("div",{className:"flex w-full items-center justify-between px-4 lg:px-6",children:[f.jsx("div",{className:"flex items-center gap-1 lg:gap-2",children:f.jsx(ERe,{className:"-ml-1"})}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsx(p3e,{})})]})}),f.jsxs("div",{className:"flex-1",children:[(t==="tools"||t==="resources"||t==="prompts"||t==="auth"||t==="chat"||t==="interceptor")&&f.jsx($Re,{connectedServerConfigs:l,selectedServer:i.selectedServer,onServerChange:b,onConnect:d,isMultiSelectEnabled:t==="chat",onMultiServerToggle:x,selectedMultipleServers:i.selectedMultipleServers}),t==="servers"&&f.jsx(zde,{connectedServerConfigs:l,onConnect:d,onDisconnect:h,onReconnect:p,onUpdate:g,onRemove:v}),t==="tools"&&f.jsx(Gpe,{serverConfig:u,serverName:i.selectedServer}),t==="evals"&&f.jsx(eCe,{}),t==="eval-results"&&f.jsx(UTe,{}),t==="resources"&&f.jsx(Wpe,{serverConfig:u,serverName:i.selectedServer}),t==="prompts"&&f.jsx(Ype,{serverConfig:u,serverName:i.selectedServer}),t==="auth"&&f.jsx(aRe,{serverConfig:u,serverEntry:i.servers[i.selectedServer],serverName:i.selectedServer}),t==="chat"&&f.jsx(PTe,{serverConfigs:E,connectedServerConfigs:l}),t==="interceptor"&&f.jsx(tRe,{connectedServerConfigs:l,selectedServer:i.selectedServer}),t==="tracing"&&f.jsx(eRe,{}),t==="settings"&&f.jsx(KAe,{})]})]})]}),f.jsx(HRe,{})]})}function g3e({children:t,client:e,useAuth:n}){const r=v3e(n);return f.jsx(ATe,{client:e,useAuth:r,children:t})}function v3e(t){return w.useMemo(()=>function(){const{isLoading:n,user:r,getAccessToken:s}=t(),i=w.useCallback(async()=>{try{return await s()}catch{return null}},[s]);return w.useMemo(()=>({isLoading:n,isAuthenticated:!!r,fetchAccessToken:i}),[n,r,i])},[t])}const y3e={environment:"prod",sendDefaultPii:!1,tracesSampleRate:.1,tracePropagationTargets:["localhost",/^\//,/^https?:\/\/[^/]*\.convex\.(cloud|site)/]},b3e={...y3e,dsn:"https://c9df3785c734acfe9dad2d0c1e963e28@o4510109778378752.ingest.us.sentry.io/4510111435063296",replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1};function x3e(){d3e({...b3e,integrations:[KLe(),o3e()]})}x3e();const _3e="https://outstanding-fennec-304.convex.cloud",w3e="client_01K4C1TVPBE7JTBFQJF9SDW9P9",S3e=(()=>{const t="mcpjam://oauth/callback";return typeof window>"u"?t:window.location.protocol==="http:"||window.location.protocol==="https:"?`${window.location.origin}/callback`:t})(),E3e=new yTe(_3e),k3e=zX.createRoot(document.getElementById("root")),T3e=f.jsx(Sme,{clientId:w3e,redirectUri:S3e,children:f.jsx(g3e,{client:E3e,useAuth:ha,children:f.jsx(m3e,{})})});k3e.render(f.jsx(w.StrictMode,{children:f.jsx(Rde,{apiKey:Dde(),options:Lde(),children:T3e})}));
1874
- //# sourceMappingURL=index-BQ-ekSd_.js.map
1874
+ //# sourceMappingURL=index-Dn41SYnl.js.map
Binary file