@mcpjam/inspector 3.3.6 → 3.4.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.
Files changed (29) hide show
  1. package/README.md +33 -0
  2. package/bin/launch-workspace.d.mts +17 -0
  3. package/bin/launch-workspace.mjs +74 -0
  4. package/bin/start.js +31 -0
  5. package/dist/client/assets/dead-clicks-autocapture-D8PonUmY.js +2 -0
  6. package/dist/client/assets/exception-autocapture-D8fwMBrA.js +2 -0
  7. package/dist/client/assets/highlighted-body-OFNGDK62-DSAkJIuh.js +2 -0
  8. package/dist/client/assets/index-Cd1YrfPX.css +1 -0
  9. package/dist/client/assets/{index-CPz3J6s3.js → index-DRqGwDPP.js} +8 -2488
  10. package/dist/client/assets/jszip.min-CBm444cl.js +2 -0
  11. package/dist/client/assets/posthog-recorder-Cc0E-JHG.js +2 -0
  12. package/dist/client/assets/surveys-DAzKgVVH.js +2 -0
  13. package/dist/client/assets/web-vitals-BTZc1cda.js +2 -0
  14. package/dist/client/claude-desktop-logo.png +0 -0
  15. package/dist/client/guest-credit-wall.png +0 -0
  16. package/dist/client/index.html +2 -2
  17. package/dist/client/user-testing-empty.png +0 -0
  18. package/dist/server/{chunk-7TOT3ZWN.js → chunk-5TXZXCUR.js} +1089 -133
  19. package/dist/server/harness-install-cli.js +1 -1
  20. package/dist/server/index.js +56359 -26517
  21. package/package.json +10 -4
  22. package/dist/client/assets/dead-clicks-autocapture-BMgZJ0Wv.js +0 -2
  23. package/dist/client/assets/exception-autocapture-HqVjr75I.js +0 -3
  24. package/dist/client/assets/highlighted-body-OFNGDK62-CZgdeyBU.js +0 -2
  25. package/dist/client/assets/index-BArhVpAv.css +0 -1
  26. package/dist/client/assets/jszip.min-DzIFtwMm.js +0 -3
  27. package/dist/client/assets/posthog-recorder-BeJOU0JC.js +0 -109
  28. package/dist/client/assets/surveys-BZ6tGdti.js +0 -2
  29. package/dist/client/assets/web-vitals--9YBaAs8.js +0 -2
package/README.md CHANGED
@@ -72,6 +72,39 @@ docker build -t mcpjam/mcp-inspector:local -f mcpjam-inspector/Dockerfile .
72
72
  docker run -p 127.0.0.1:6274:6274 mcpjam/mcp-inspector:local
73
73
  ```
74
74
 
75
+ ## Accessing over the network
76
+
77
+ Network access requires **Docker**. A native (`npx`) install binds to
78
+ `127.0.0.1` (localhost only) and has no bind-address override, so it is not
79
+ reachable from another machine. The Docker image binds `0.0.0.0`, so it is.
80
+
81
+ For security, the inspector only issues its session token to `localhost`. When
82
+ you open a Docker install from another machine (e.g. `http://192.168.1.50:6274`),
83
+ it will otherwise dead-end on an authentication error. To allow a specific host,
84
+ set `MCPJAM_ALLOWED_HOSTS` to that hostname (or a comma-separated list; wildcards
85
+ like `*.example.com` are supported), and publish the port on your network
86
+ interface (drop the `127.0.0.1:` prefix from `-p`):
87
+
88
+ ```bash
89
+ docker run -p 6274:6274 -e MCPJAM_ALLOWED_HOSTS=192.168.1.50 mcpjam/mcp-inspector:local
90
+ ```
91
+
92
+ For an IPv6 host, bracket the entry: `MCPJAM_ALLOWED_HOSTS=[fd00::50]`.
93
+
94
+ If you use a **wildcard** entry (e.g. `MCPJAM_ALLOWED_HOSTS=*.lan`), also set
95
+ `MCPJAM_ALLOW_WILDCARD_ORIGINS=true`. Wildcards deliver the session token on
96
+ their own, but for security the request-origin check ignores wildcard hosts
97
+ unless you opt in with that variable — without it, API calls still 403. A
98
+ single exact host (like the IP above) needs no extra flag.
99
+
100
+ Only add hosts you trust. Allowlisting a host does more than expose the session
101
+ token: the same host is accepted as a request Origin, which also reaches the
102
+ local shell and agent-browser tools that are enabled by default in self-hosted
103
+ mode. Any client that can reach an allowlisted host can obtain the session token
104
+ and drive those tools. Set `MCPJAM_LOCAL_COMPUTER_ENABLED=false` and
105
+ `MCPJAM_LOCAL_BROWSER_ENABLED=false` if you don't want that. Tunnel/relay domains
106
+ are never allowed, even if listed.
107
+
75
108
  # Key features
76
109
 
77
110
  | Capability | Description |
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Types for the launcher's invocation-folder reader.
3
+ *
4
+ * `bin/` is plain ESM — it runs under a bare Node before anything is built —
5
+ * so this carries a hand-written declaration rather than being compiled. The
6
+ * server test suite imports the module to prove the folder an `npx` user
7
+ * launched from is what gets suggested, and that the package/cache directory
8
+ * never is.
9
+ */
10
+ export declare function launchWorkspaceCandidate(args: {
11
+ /** The installed package root, which is never a valid suggestion. */
12
+ projectRoot: string;
13
+ /** Defaults to `process.cwd()`. */
14
+ cwd?: string;
15
+ /** Defaults to `process.env`. */
16
+ env?: NodeJS.ProcessEnv;
17
+ }): string | null;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The directory the user invoked `npx @mcpjam/inspector` FROM.
3
+ *
4
+ * ── Why the launcher has to capture this ─────────────────────────────────
5
+ * The server cannot work it out for itself. `bin/start.js` spawns it with
6
+ * `cwd: projectRoot` — the installed package's own directory — so
7
+ * `process.cwd()` on the server side is `.../node_modules/@mcpjam/inspector`,
8
+ * or an npx cache path. Offering that as "the folder Claude Code will work in"
9
+ * would be worse than offering nothing: it is a real directory, it looks
10
+ * plausible in a dialog, and it is never what the user meant.
11
+ *
12
+ * So the invocation folder is read HERE, while the process still has it, and
13
+ * handed to the child explicitly through `MCPJAM_LAUNCH_WORKSPACE`. The server
14
+ * reads only that variable and never falls back to its own `process.cwd()`.
15
+ *
16
+ * ── Why null is a real answer ────────────────────────────────────────────
17
+ * Every rejection below is a case where a suggestion would be wrong rather
18
+ * than merely unhelpful, and the dialog asking is the correct outcome:
19
+ *
20
+ * - the home directory and the filesystem root are refused by
21
+ * `registerWorkspaceGrant` anyway, so suggesting one produces a folder the
22
+ * user picks and the server then rejects;
23
+ * - a cwd that no longer resolves names nothing;
24
+ * - the installed package root is what a global-install shell wrapper leaves
25
+ * behind, and is the exact directory this whole module exists to avoid.
26
+ *
27
+ * Kept as its own ESM module rather than living inside `bin/start.js` so it can
28
+ * be tested: importing `start.js` runs `main()`.
29
+ */
30
+ import { realpathSync } from "node:fs";
31
+ import { homedir } from "node:os";
32
+ import { sep } from "node:path";
33
+
34
+ /**
35
+ * @param {object} args
36
+ * @param {string} args.projectRoot Installed package root, to reject.
37
+ * @param {string} [args.cwd] Defaults to `process.cwd()`.
38
+ * @param {NodeJS.ProcessEnv} [args.env] Defaults to `process.env`.
39
+ * @returns {string | null} An absolute, canonical directory, or null.
40
+ */
41
+ export function launchWorkspaceCandidate(args) {
42
+ const env = args.env ?? process.env;
43
+ // Electron supplies the folder from its own native picker in the main
44
+ // process, which is a deliberate choice by the user rather than an ambient
45
+ // one — so there is nothing to suggest, and suggesting the app bundle's
46
+ // working directory would be actively wrong.
47
+ if (env.ELECTRON_APP === "true") return null;
48
+
49
+ let cwd;
50
+ try {
51
+ cwd = realpathSync(args.cwd ?? process.cwd());
52
+ } catch {
53
+ return null;
54
+ }
55
+
56
+ let home;
57
+ try {
58
+ home = realpathSync(homedir());
59
+ } catch {
60
+ home = homedir();
61
+ }
62
+ if (cwd === home) return null;
63
+ // `sep` covers POSIX; the drive-root pattern covers `C:\` and `C:/`, which
64
+ // is the same "not a project" answer as `/`.
65
+ if (cwd === sep || cwd === "/") return null;
66
+ if (/^[A-Za-z]:[\\/]?$/.test(cwd)) return null;
67
+
68
+ try {
69
+ if (cwd === realpathSync(args.projectRoot)) return null;
70
+ } catch {
71
+ // An unresolvable package root cannot match anything, so the cwd stands.
72
+ }
73
+ return cwd;
74
+ }
package/bin/start.js CHANGED
@@ -7,6 +7,7 @@ import { createServer, createConnection } from "net";
7
7
  import { execSync } from "child_process";
8
8
  import { existsSync, readFileSync } from "fs";
9
9
  import open from "open";
10
+ import { launchWorkspaceCandidate } from "./launch-workspace.mjs";
10
11
 
11
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
12
13
 
@@ -497,6 +498,31 @@ async function runHarnessSubcommand(args) {
497
498
  logSuccess(`Runtime pack ${result.packVersion} installed and verified`);
498
499
  return 0;
499
500
  }
501
+ // The reason, where the installer could establish one. Each of these sends a
502
+ // reader somewhere different — retry the network, free some disk, report a
503
+ // bad artifact — so collapsing them into "it failed" is what makes an
504
+ // installer message useless.
505
+ const REASONS = {
506
+ network: "the runtime could not be downloaded",
507
+ verification:
508
+ "the downloaded runtime did not match what this Inspector expected, " +
509
+ "so it was not installed",
510
+ disk: "the runtime could not be written to its install location",
511
+ unknown: "the install did not complete",
512
+ };
513
+ if (result.state === "failed") {
514
+ logError(
515
+ `${REASONS[result.reason] ?? REASONS.unknown}` +
516
+ (result.message ? `: ${result.message}` : ""),
517
+ );
518
+ logInfo("Run `mcpjam-inspector harness install` again to retry.");
519
+ return 1;
520
+ }
521
+ if (result.state === "interrupted") {
522
+ logError("Setup was interrupted before it finished.");
523
+ logInfo("Run `mcpjam-inspector harness install` again to continue.");
524
+ return 1;
525
+ }
500
526
  logError(
501
527
  `Runtime pack not installed (${result.state})` +
502
528
  (result.message ? `: ${result.message}` : ""),
@@ -973,12 +999,17 @@ async function main() {
973
999
  }
974
1000
 
975
1001
  // Spawn the server process but don't wait for it to exit
1002
+ // The invocation folder travels EXPLICITLY, because `cwd` below is about
1003
+ // to become the installed package's root and the server would otherwise
1004
+ // have no way back to where the user actually was.
1005
+ const launchWorkspace = launchWorkspaceCandidate({ projectRoot });
976
1006
  const serverProcess = spawn("node", [distServerPath], {
977
1007
  env: {
978
1008
  ...process.env,
979
1009
  MCPJAM_INSPECTOR_PARENT_PID: process.pid.toString(),
980
1010
  NODE_ENV: "production",
981
1011
  PORT: PORT,
1012
+ ...(launchWorkspace ? { MCPJAM_LAUNCH_WORKSPACE: launchWorkspace } : {}),
982
1013
  ...(verboseLogs && { VERBOSE_LOGS: "true" }),
983
1014
  },
984
1015
  cwd: projectRoot,
@@ -0,0 +1,2 @@
1
+ !function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};t.SENTRY_RELEASE={id:"3.4.1"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="ffc5cdcc-9df0-4712-a880-e8d416d8b190",t._sentryDebugIdIdentifier="sentry-dbid-ffc5cdcc-9df0-4712-a880-e8d416d8b190")}catch(i){}}();import{g as t}from"./index-DRqGwDPP.js";function e(t,e){for(var i=0;i<e.length;i++){const n=e[i];if("string"!=typeof n&&!Array.isArray(n))for(const e in n)if("default"!==e&&!(e in t)){const i=Object.getOwnPropertyDescriptor(n,e);i&&Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>n[e]})}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var i,n={};var r=(i||(i=1,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},t.apply(null,arguments)}var e="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var n=null==i?void 0:i.document;null!=i&&i.XMLHttpRequest&&new i.XMLHttpRequest;var r=null!=e?e:{};function a(t,e){return-1!==t.indexOf(e)}var s=function(t){return t.trim()},o=Object.prototype,l=o.hasOwnProperty,c=o.toString,u=Array.isArray||function(t){return"[object Array]"===c.call(t)},d=t=>"function"==typeof t,h=t=>void 0===t,_=t=>"[object String]"==c.call(t),m=t=>null===t,f=t=>h(t)||m(t),v=t=>"[object Number]"==c.call(t)&&t==t,g=function(t,i){var{debugEnabled:n}=void 0===i?{}:i,a={C(i){if(e&&(r.POSTHOG_DEBUG||n)&&!h(e.console)&&e.console){for(var a=("__rrweb_original__"in e.console[i]?e.console[i].__rrweb_original__:e.console[i]),s=arguments.length,o=new Array(s>1?s-1:0),l=1;s>l;l++)o[l-1]=arguments[l];a(t,...o)}},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];a.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];a.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];a.C("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),n=0;e>n;n++)i[n]=arguments[n];console.error(t,...i)},uninitializedWarning(t){a.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>g(t+" "+e,i)};return a},p=g("[PostHog.js]"),b=p.createLogger;function y(t,e){if(!f(t))if(u(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)l.call(t,i)&&e(t[i],i)}var w=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;e>n;n++)i[n-1]=arguments[n];for(var r of i)for(var a in r)void 0!==r[a]&&(t[a]=r[a]);return t};function C(t){for(var e=Object.keys(t),i=e.length,n=new Array(i);i--;)n[i]=[e[i],t[e[i]]];return n}function k(t,e,i,n){var{capture:r=!1,passive:a=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:r,passive:a})}function D(t){return!!t&&1===t.nodeType}function x(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function E(t){return t?s(t).split(/\s+/):[]}function N(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return E(e)}function M(t){var e="";return L(t)&&!O(t)&&t.childNodes&&t.childNodes.length&&y(t.childNodes,function(t){var i,n,r;(r=t)&&3===r.nodeType&&t.textContent&&(e+=null!==(i=f(n=t.textContent)?null:s(n).split(/(\s+)/).filter(t=>P(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))&&void 0!==i?i:"")}),s(e)}var A=["a","button","form","input","select","textarea","label"];function L(t){for(var e=t;e.parentNode&&!x(e,"body");e=e.parentNode){var i=N(e);if(a(i,"ph-sensitive")||a(i,"ph-no-capture"))return!1}if(a(N(t),"ph-include"))return!0;var n=t.type||"";if(_(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=t.name||t.id||"";return!_(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function O(t){return!!(x(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||x(t,"select")||x(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var $="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",R=new RegExp("^(?:"+$+")$"),T=new RegExp($),j="\\d{3}-?\\d{2}-?\\d{4}",S=new RegExp("^("+j+")$"),I=new RegExp("("+j+")");function P(t,e){if(void 0===e&&(e=!0),f(t))return!1;if(_(t)){if(t=s(t),(e?R:T).test((t||"").replace(/[- ]/g,"")))return!1;if((e?S:I).test(t))return!1}return!0}function Z(t){var e=M(t);return P(e=(e+" "+H(t)).trim())?e:""}function H(t){var e="";return t&&t.childNodes&&t.childNodes.length&&y(t.childNodes,function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var n=M(t);e=(e+" "+n).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+H(t)).trim())}catch(r){p.error("[AutoCapture]",r)}}),e}function F(t){return t.replace(/"|\\"/g,'\\"')}function z(t){var e=t.attr__class;return e?u(e)?e:E(e):void 0}function B(t,e){return e.length>t?e.slice(0,t)+"...":e}function K(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!D(e));return e}b("[AutoCapture]");var G={};function W(t,e){return v(t)&&t>=e}class q{vt(t){var e,i,n,r,a,s=this.ft((null==t?void 0:t.__onCapture)||this.yt.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:s.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:s.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:s.selection_change_threshold_ms,mutation_threshold_ms:null!==(r=null==t?void 0:t.mutation_threshold_ms)&&void 0!==r?r:s.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(a=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==a?a:s.capture_clicks_with_modifier_keys,__onCapture:s.__onCapture}}constructor(t,e){this.bt=[],this.ft=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,__onCapture:t}),this.wt=t=>{var e,i,n,a,s=(a=h((i=e=t).target)?i.srcElement||null:null!=(n=i.target)&&n.shadowRoot?i.composedPath()[0]||null:i.target||null)?{node:a,originalEvent:e,timestamp:Date.now()}:null;m(s)||this.Ct(s)||this.bt.push(s),this.bt.length&&h(this.It)&&(this.It=r.setTimeout(()=>{this.St()},1e3))},this.kt=()=>{var t=Date.now();t%50==0&&this.bt.forEach(e=>{h(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.xt=()=>{this.At=Date.now()},this.Tt=()=>{"visible"===(null==n?void 0:n.visibilityState)&&(this.Nt=Date.now())},this.instance=t,this.Rt=this.vt(e),this._onCapture=this.Rt.__onCapture}start(t){this.Mt(),this._t(),this.Et(),this.Ot(),this.Ft(t)}Ft(t){if(!this.Lt){var i=function(t){return function(t,n){var r=G[t];if(r)return r;var a,s=n[t];if(d(a=s)&&-1!==a.toString().indexOf("[native code]")&&!e.Zone)return G[t]=s.bind(n);var o=n.document;if(o&&d(o.createElement))try{var l=o.createElement("iframe");l.hidden=!0,o.head.appendChild(l);var c=l.contentWindow;c&&c[t]&&(s=c[t]),o.head.removeChild(l)}catch(i){p.warn("Could not create sandbox iframe for "+t+" check, bailing to assignableWindow."+t+": ",i)}return s&&d(s)?G[t]=s.bind(n):s}("MutationObserver",t)}(r);this.Lt=new i(t=>{this.Bt(t)}),this.Lt.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null==(t=this.Lt)||t.disconnect(),this.Lt=void 0,r.removeEventListener("click",this.wt),r.removeEventListener("scroll",this.kt,{capture:!0}),r.removeEventListener("selectionchange",this.xt),null==n||n.removeEventListener("visibilitychange",this.Tt)}Bt(t){this.Zt=Date.now()}Mt(){k(r,"click",this.wt)}_t(){k(r,"scroll",this.kt,{capture:!0})}Et(){k(r,"selectionchange",this.xt)}Ot(){k(n,"visibilitychange",this.Tt)}Ct(t){return!(t&&(this.Rt.capture_clicks_with_modifier_keys||!((e=t.originalEvent).ctrlKey||e.metaKey||e.altKey||e.shiftKey))&&!((i=t.node)instanceof Element&&("__POSTHOG_TOOLBAR__"===i.id||null!=i.closest&&i.closest(".toolbar-global-fade-container")))&&!this.bt.some(e=>e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!x(t.node,"html")&&D(t.node)&&!A.includes(t.node.tagName.toLowerCase()));var e,i}St(){if(this.bt.length){clearTimeout(this.It),this.It=void 0;var t=this.bt;for(var e of(this.bt=[],t)){var i;e.mutationDelayMs=null!==(i=e.mutationDelayMs)&&void 0!==i?i:this.Zt&&this.Zt>=e.timestamp?this.Zt-e.timestamp:void 0,e.absoluteDelayMs=Date.now()-e.timestamp,e.selectionChangedDelayMs=this.At&&this.At>=e.timestamp?this.At-e.timestamp:void 0,e.visibilityChangedDelayMs=this.Nt?Math.abs(e.timestamp-this.Nt):void 0;var n=W(e.scrollDelayMs,this.Rt.scroll_threshold_ms),a=W(e.selectionChangedDelayMs,this.Rt.selection_change_threshold_ms),s=W(e.mutationDelayMs,this.Rt.mutation_threshold_ms),o=W(e.absoluteDelayMs,1.1*this.Rt.mutation_threshold_ms),l=v(e.scrollDelayMs)&&this.Rt.scroll_threshold_ms>e.scrollDelayMs,c=v(e.mutationDelayMs)&&this.Rt.mutation_threshold_ms>e.mutationDelayMs,u=v(e.selectionChangedDelayMs)&&this.Rt.selection_change_threshold_ms>e.selectionChangedDelayMs,d=v(e.visibilityChangedDelayMs)&&this.Rt.selection_change_threshold_ms>e.visibilityChangedDelayMs;if(!(l||c||u||d)){var _=W(e.visibilityChangedDelayMs,this.Rt.selection_change_threshold_ms);n||s||o||a||_?this._onCapture(e,{$dead_click_last_mutation_timestamp:this.Zt,$dead_click_event_timestamp:e.timestamp,$dead_click_scroll_timeout:n,$dead_click_mutation_timeout:s,$dead_click_absolute_timeout:o,$dead_click_selection_changed_timeout:a,$dead_click_visibility_changed_timeout:_}):this.Rt.mutation_threshold_ms>e.absoluteDelayMs&&this.bt.push(e)}}this.bt.length&&h(this.It)&&(this.It=r.setTimeout(()=>{this.St()},1e3))}}yt(i,r){this.instance.capture("$dead_click",t({},r,function(i,r){for(var s,o,l,{e:c,maskAllElementAttributes:u,maskAllText:d,elementAttributeIgnoreList:m}=r,f=[i],v=i;v.parentNode&&!x(v,"body");)(l=v.parentNode)&&11===l.nodeType?(f.push(v.parentNode.host),v=v.parentNode.host):(f.push(v.parentNode),v=v.parentNode);var g,p,b,k,D,$,R=[],T={},j=!1,S=!1;if(y(f,t=>{var e=L(t);"a"===t.tagName.toLowerCase()&&(j=t.getAttribute("href"),j=e&&j&&P(j)&&j),a(N(t),"ph-no-capture")&&(S=!0),R.push(function(t,e,i,n){var r=t.tagName.toLowerCase(),a={tag_name:r};A.indexOf(r)>-1&&!i&&(a.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?B(1024,Z(t)):B(1024,M(t)));var s=N(t);s.length>0&&(a.classes=s.filter(function(t){return""!==t})),y(t.attributes,function(i){var r;if((!O(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==n||!n.includes(i.name))&&!e&&P(i.value)&&(!_(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var s=i.value;"class"===i.name&&(s=E(s).join(" ")),a["attr__"+i.name]=B(1024,s)}});for(var o=1,l=1,c=t;c=K(c);)o++,c.tagName===t.tagName&&l++;return a.nth_child=o,a.nth_of_type=l,a}(t,u,d,m));var i=function(t){if(!L(t))return{};var e={};return y(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&P(n)&&(e[i]=n)}}),e}(t);w(T,i)}),S)return{props:{},explicitNoCapture:S};if(d||(R[0].$el_text="a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?Z(i):M(i)),j){var I,H;R[0].attr__href=j;var G=null==(p=j,b=null==n?void 0:n.createElement("a"),I=h(b)?null:(b.href=p,b))?void 0:I.host,W=null==e||null==(H=e.location)?void 0:H.host;G&&W&&G!==W&&(g=j)}return{props:w({$event_type:c.type,$ce_version:1},{$elements:R},{$elements_chain:(k=R,$=k,D=$.map(t=>{var e,i,n={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:z(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return C(t).filter(t=>{var[e]=t;return 0===e.indexOf("attr__")}).forEach(t=>{var[e,i]=t;return n.attributes[e]=i}),n}),D.map(e=>{var i,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var a of(e.attr_class.sort(),e.attr_class))r+="."+a.replace(/"/g,"");var s=t({},e.text?{text:e.text}:{},{"nth-child":null!==(i=e.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return C(s).sort((t,e)=>{var[i]=t,[n]=e;return i.localeCompare(n)}).forEach(t=>{var[e,i]=t;return o[F(e.toString())]=F(i.toString())}),(r+=":")+C(o).map(t=>{var[e,i]=t;return e+'="'+i+'"'}).join("")}).join(";"))},null!=(s=R[0])&&s.$el_text?{$el_text:null==(o=R[0])?void 0:o.$el_text}:{},g&&"click"===c.type?{$external_click_url:g}:{},T)}}(i.node,{e:i.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist}).props,{$dead_click_scroll_delay_ms:i.scrollDelayMs,$dead_click_mutation_delay_ms:i.mutationDelayMs,$dead_click_absolute_delay_ms:i.absoluteDelayMs,$dead_click_selection_changed_delay_ms:i.selectionChangedDelayMs,$dead_click_visibility_changed_delay_ms:i.visibilityChangedDelayMs}),{timestamp:new Date(i.timestamp)})}}r.__PosthogExtensions__=r.__PosthogExtensions__||{},r.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new q(t,e)}()),n);const a=e({__proto__:null,default:t(r)},[r]);export{a as d};
2
+ //# sourceMappingURL=dead-clicks-autocapture-D8PonUmY.js.map
@@ -0,0 +1,2 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"3.4.1"};var r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="2e072337-07db-4205-8556-aa26e994bf3e",e._sentryDebugIdIdentifier="sentry-dbid-2e072337-07db-4205-8556-aa26e994bf3e")}catch(n){}}(),function(){var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){}),null!=r&&r.XMLHttpRequest&&new r.XMLHttpRequest;var n=null!=e?e:{};function t(e,r,n,t,a,o,i){try{var s=e[o](i),c=s.value}catch(l){return void n(l)}s.done?r(c):Promise.resolve(c).then(t,a)}function a(e){return function(){var r=this,n=arguments;return new Promise(function(a,o){var i=e.apply(r,n);function s(e){t(i,a,o,s,c,"next",e)}function c(e){t(i,a,o,s,c,"throw",e)}s(void 0)})}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;arguments.length>r;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},o.apply(null,arguments)}var i,s,c,l={}.toString,u=Array.isArray||function(e){return"[object Array]"===l.call(e)},v=e=>void 0===e,d=e=>"[object String]"==l.call(e);function f(e){return null===e||"object"!=typeof e}function h(e,r){return{}.toString.call(e)==="[object "+r+"]"}function p(e){return"undefined"!=typeof Event&&function(e,r){try{return e instanceof r}catch(n){return!1}}(e,Event)}function g(e){var r=globalThis._posthogChunkIds;if(r){var n=Object.keys(r);return c&&n.length===s?c:(s=n.length,c=n.reduce((n,t)=>{i||(i={});var a=i[t];if(a)n[a[0]]=a[1];else for(var o=e(t),s=o.length-1;s>=0;s--){var c=o[s],l=null==c?void 0:c.filename,u=r[t];if(l&&u){n[l]=u,i[t]=[l,u];break}}return n},{}))}}var y="?";function m(e,r,n,t,a){var o={platform:e,filename:r,function:"<anonymous>"===n?y:n,in_app:!0};return v(t)||(o.lineno=t),v(a)||(o.colno=a),o}var E=(e,r)=>{var n=-1!==e.indexOf("safari-extension"),t=-1!==e.indexOf("safari-web-extension");return n||t?[-1!==e.indexOf("@")?e.split("@")[0]:y,n?"safari-extension:"+r:"safari-web-extension:"+r]:[e,r]},k=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,b=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_=/\((\S*)(?::(\d+))(?::(\d+))\)/,w=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,x=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,O=/\(error: (.*)\)/,j=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,T=["fatal","error","warning","log","info","debug"];function S(e,r){void 0===r&&(r=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var t=n.length;t>0;t--){var a=n.slice(0,t).join(", ");if(r>=a.length)return t===n.length?a:a.length>r?a.slice(0,r)+"...":a}return""}var P=function(r,t){var{debugEnabled:a}=void 0===t?{}:t,o={C(t){if(e&&(n.POSTHOG_DEBUG||a)&&!v(e.console)&&e.console){for(var o=("__rrweb_original__"in e.console[t]?e.console[t].__rrweb_original__:e.console[t]),i=arguments.length,s=new Array(i>1?i-1:0),c=1;i>c;c++)s[c-1]=arguments[c];o(r,...s)}},info(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];o.C("log",...r)},warn(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];o.C("warn",...r)},error(){for(var e=arguments.length,r=new Array(e),n=0;e>n;n++)r[n]=arguments[n];o.C("error",...r)},critical(){for(var e=arguments.length,n=new Array(e),t=0;e>t;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning(e){o.error("You must initialize PostHog before calling "+e)},createLogger:(e,n)=>P(r+" "+e,n)};return o},M=P("[PostHog.js]").createLogger;M("[Error tracking]");var D=M("[ExceptionAutocapture]"),R=new class{constructor(e,r,n){void 0===n&&(n=[]),this.coercers=e,this.stackParser=r,this.modifiers=n}buildFromUnknown(e,r){void 0===r&&(r={});var n=r&&r.mechanism||{handled:!0,type:"generic"},t=this.buildCoercingContext(n,r,0).apply(e),a=this.buildParsingContext(r),o=this.parseStacktrace(t,a);return{$exception_list:this.convertToExceptionList(o,n),$exception_level:"error"}}modifyFrames(e){var r=this;return a(function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&u(n.stacktrace.frames)&&(n.stacktrace.frames=yield r.applyModifiers(n.stacktrace.frames));return e})()}coerceFallback(e){var r;return{type:"Error",value:"Unknown error",stack:null==(r=e.syntheticException)?void 0:r.stack,synthetic:!0}}parseStacktrace(e,r){var n,t;return null!=e.cause&&(n=this.parseStacktrace(e.cause,r)),""!=e.stack&&null!=e.stack&&(t=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?r.skipFirstLines:0),r.chunkIdMap)),o({},e,{cause:n,stack:t})}applyChunkIds(e,r){return e.map(e=>(e.filename&&r&&(e.chunk_id=r[e.filename]),e))}applyCoercers(e,r){for(var n of this.coercers)if(n.match(e))return n.coerce(e,r);return this.coerceFallback(r)}applyModifiers(e){var r=this;return a(function*(){var n=e;for(var t of r.modifiers)n=yield t(n);return n})()}convertToExceptionList(e,r){var n,t,a,i={type:e.type,value:e.value,mechanism:{type:null!==(n=r.type)&&void 0!==n?n:"generic",handled:null===(t=r.handled)||void 0===t||t,synthetic:null!==(a=e.synthetic)&&void 0!==a&&a}};e.stack&&(i.stacktrace={type:"raw",frames:e.stack});var s=[i];return null!=e.cause&&s.push(...this.convertToExceptionList(e.cause,o({},r,{handled:!0}))),s}buildParsingContext(e){var r;return{chunkIdMap:g(this.stackParser),skipFirstLines:null!==(r=e.skipFirstLines)&&void 0!==r?r:1}}buildCoercingContext(e,r,n){void 0===n&&(n=0);var t=(n,t)=>{if(4>=t){var a=this.buildCoercingContext(e,r,t);return this.applyCoercers(n,a)}};return o({},r,{syntheticException:0==n?r.syntheticException:void 0,mechanism:e,apply:e=>t(e,n),next:e=>t(e,n+1)})}}([new class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,r){var n=d(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var r=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?r+": "+e.message:r}isDOMException(e){return h(e,"DOMException")}isDOMError(e){return h(e,"DOMError")}},new class{match(e){return h(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!p(e))return!1;try{var r=e.detail;return null!=r&&"object"==typeof r&&"reason"in r}catch(n){return!1}}coerce(e,r){var n,t=this.getUnhandledRejectionReason(e);return f(t)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(t),stack:null==(n=r.syntheticException)?void 0:n.stack,synthetic:!0}:r.apply(t)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(r){}return e}},new class{constructor(){}match(e){return h(e,"ErrorEvent")&&null!=e.error}coerce(e,r){var n;return r.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(n=r.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(e){return e instanceof Error}coerce(e,r){return{type:this.getType(e),value:this.getMessage(e,r),stack:this.getStack(e),cause:e.cause?r.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,r){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},new class{match(e){return p(e)}coerce(e,r){var n,t=e.constructor.name;return{type:t,value:t+" captured as exception with keys: "+S(e),stack:null==(n=r.syntheticException)?void 0:n.stack,synthetic:!0}}},new class{match(e){return"object"==typeof e&&null!==e}coerce(e,r){var n,t=this.getErrorPropertyFromObject(e);return t?r.apply(t):{type:this.getType(e),value:this.getValue(e),stack:null==(n=r.syntheticException)?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return p(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var r="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(r+=" with message: '"+e.message+"'"),r}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+S(e)}isSeverityLevel(e){return d(e)&&!(d(r=e)&&0===r.trim().length)&&T.indexOf(e)>=0;var r}getErrorPropertyFromObject(e){for(var r in e)if({}.hasOwnProperty.call(e,r)){var n=e[r];if(n instanceof Error)return n}}getObjectClassName(e){try{var r=Object.getPrototypeOf(e);return r?r.constructor.name:void 0}catch(n){return}}},new class{match(e){return"string"==typeof e}coerce(e,r){var n,[t,a]=this.getInfos(e);return{type:null!=t?t:"Error",value:null!=a?a:e,stack:null==(n=r.syntheticException)?void 0:n.stack,synthetic:!0}}getInfos(e){var r="Error",n=e,t=e.match(j);return t&&(r=t[1],n=t[2]),[r,n]}},new class{match(e){return f(e)}coerce(e,r){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=r.syntheticException)?void 0:n.stack,synthetic:!0}}}],function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;r>t;t++)n[t-1]=arguments[t];return function(r,t){void 0===t&&(t=0);for(var a=[],i=r.split("\n"),s=t;i.length>s;s++){var c=i[s];if(1024>=c.length){var l=O.test(c)?c.replace(O,"$1"):c;if(!l.match(/\S*Error: /)){for(var u of n){var v=u(l,e);if(v){a.push(v);break}}if(a.length>=50)break}}}return function(e){if(!e.length)return[];var r=Array.from(e);return r.reverse(),r.slice(0,50).map(e=>{return o({},e,{filename:e.filename||(n=r,n[n.length-1]||{}).filename,function:e.function||y});var n})}(a)}}("web:javascript",(e,r)=>{var n=k.exec(e);if(n){var[,t,a,o]=n;return m(r,t,y,+a,+o)}var i=b.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var s=_.exec(i[2]);s&&(i[2]=s[1],i[3]=s[2],i[4]=s[3])}var[c,l]=E(i[1]||y,i[2]);return m(r,l,c,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},(e,r)=>{var n=w.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var t=x.exec(n[3]);t&&(n[1]=n[1]||"eval",n[3]=t[1],n[4]=t[2],n[5]="")}var a=n[3],o=n[1]||y;return[o,a]=E(o,a),m(r,a,o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}})),C={wrapOnError(r){var n=e;n||D.info("window not available, cannot wrap onerror");var t=n.onerror;return n.onerror=function(){for(var e,n=arguments.length,a=new Array(n),o=0;n>o;o++)a[o]=arguments[o];var i=R.buildFromUnknown(a[4]||a[0],{mechanism:{handled:!1}});return r(i),null!==(e=null==t?void 0:t(...a))&&void 0!==e&&e},n.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=n.onerror)||delete e.__POSTHOG_INSTRUMENTED__,n.onerror=t}},wrapUnhandledRejection(r){var n=e;n||D.info("window not available, cannot wrap onUnhandledRejection");var t=n.onunhandledrejection;return n.onunhandledrejection=function(e){var a,o=R.buildFromUnknown(e,{mechanism:{handled:!1}});return r(o),null!==(a=null==t?void 0:t.apply(n,[e]))&&void 0!==a&&a},n.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=n.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,n.onunhandledrejection=t}},wrapConsoleError(e){var r=console;r||D.info("console not available, cannot wrap console.error");var n=r.error;return r.error=function(){for(var r,t=arguments.length,a=new Array(t),o=0;t>o;o++)a[o]=arguments[o];r=1==a.length?a[0]:a.join(" ");var i=a.find(e=>e instanceof Error),s=R.buildFromUnknown(i||r,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});return e(s),null==n?void 0:n(...a)},r.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=r.error)||delete e.__POSTHOG_INSTRUMENTED__,r.error=n}}};n.__PosthogExtensions__=n.__PosthogExtensions__||{},n.__PosthogExtensions__.errorWrappingFunctions=C,n.posthogErrorWrappingFunctions=C}();
2
+ //# sourceMappingURL=exception-autocapture-D8fwMBrA.js.map
@@ -0,0 +1,2 @@
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"3.4.1"};var a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="fbeb95b5-ad8b-456d-92fd-544a140ae44c",e._sentryDebugIdIdentifier="sentry-dbid-fbeb95b5-ad8b-456d-92fd-544a140ae44c")}catch(s){}}();import{r as e,R as a,L as s,j as t,A as d}from"./index-DRqGwDPP.js";var n=({code:n,language:i,raw:r,className:l,startLine:o,lineNumbers:f,...u})=>{let{shikiTheme:b}=e.useContext(a),g=s(),[c,h]=e.useState(r);return e.useEffect(()=>{if(!g)return void h(r);let e=g.highlight({code:n,language:i,themes:b},e=>{h(e)});e&&h(e)},[n,i,b,g,r]),t.jsx(d,{className:l,language:i,lineNumbers:f,result:c,startLine:o,...u})};export{n as HighlightedCodeBlockBody};
2
+ //# sourceMappingURL=highlighted-body-OFNGDK62-DSAkJIuh.js.map