@starko-one/sdk 0.0.0-stage → 0.1.0-beta.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 (108) hide show
  1. package/CHANGELOG.md +248 -0
  2. package/LICENSE +17 -0
  3. package/NOTICE +58 -0
  4. package/README.md +81 -2
  5. package/dist/api-BAFm4Lxj.d.ts +558 -0
  6. package/dist/api-DNrctwJu.d.cts +558 -0
  7. package/dist/browser/index.cjs +168 -0
  8. package/dist/browser/index.d.cts +131 -0
  9. package/dist/browser/index.d.ts +131 -0
  10. package/dist/browser/index.js +7 -0
  11. package/dist/build/rollup.cjs +22 -0
  12. package/dist/build/rollup.d.cts +34 -0
  13. package/dist/build/rollup.d.ts +34 -0
  14. package/dist/build/rollup.js +3 -0
  15. package/dist/build/vite.cjs +51 -0
  16. package/dist/build/vite.d.cts +23 -0
  17. package/dist/build/vite.d.ts +23 -0
  18. package/dist/build/vite.js +46 -0
  19. package/dist/build/webpack.cjs +18 -0
  20. package/dist/build/webpack.d.cts +39 -0
  21. package/dist/build/webpack.d.ts +39 -0
  22. package/dist/build/webpack.js +3 -0
  23. package/dist/chunk-2PM4FRM5.cjs +431 -0
  24. package/dist/chunk-335HNCOJ.js +249 -0
  25. package/dist/chunk-3AW5B2WW.js +115 -0
  26. package/dist/chunk-3R5TQAWD.js +216 -0
  27. package/dist/chunk-6H5MOPTQ.cjs +1230 -0
  28. package/dist/chunk-7TKNT3QJ.cjs +2487 -0
  29. package/dist/chunk-A4WLNFMU.cjs +220 -0
  30. package/dist/chunk-ALYFFOPR.cjs +134 -0
  31. package/dist/chunk-BVVFVRMO.js +1113 -0
  32. package/dist/chunk-CIHNKN62.cjs +15 -0
  33. package/dist/chunk-CMGCH6HD.js +1212 -0
  34. package/dist/chunk-D6QAPQ7L.cjs +56 -0
  35. package/dist/chunk-DUO5V6WZ.js +213 -0
  36. package/dist/chunk-EC2WZ6PG.js +90 -0
  37. package/dist/chunk-EFURLFJT.cjs +187 -0
  38. package/dist/chunk-EROUORMY.js +53 -0
  39. package/dist/chunk-LXBXFOAP.cjs +96 -0
  40. package/dist/chunk-MF6SA6DB.js +563 -0
  41. package/dist/chunk-N5R6ORIB.js +413 -0
  42. package/dist/chunk-N6R6BWHK.cjs +142 -0
  43. package/dist/chunk-QAGGN2T7.cjs +225 -0
  44. package/dist/chunk-QV4HRIDD.cjs +659 -0
  45. package/dist/chunk-TKNDYQB3.cjs +583 -0
  46. package/dist/chunk-UI5YC4TH.js +131 -0
  47. package/dist/chunk-VEHZYLK6.cjs +1151 -0
  48. package/dist/chunk-VNCWOGTI.js +12 -0
  49. package/dist/chunk-VWNIOGE6.js +180 -0
  50. package/dist/chunk-WDKRKGYF.js +608 -0
  51. package/dist/chunk-XOZIXBUK.js +2462 -0
  52. package/dist/chunk-ZS3K3SDR.cjs +258 -0
  53. package/dist/cli/index.cjs +2780 -0
  54. package/dist/common-DLFAqL2d.d.cts +36 -0
  55. package/dist/common-DbSXkaw6.d.ts +36 -0
  56. package/dist/dedupe-Bh5riD8Z.d.cts +13 -0
  57. package/dist/dedupe-DoYiSx-9.d.ts +13 -0
  58. package/dist/handler-BcnsnvhF.d.cts +82 -0
  59. package/dist/handler-qHzilC9T.d.ts +82 -0
  60. package/dist/index.cjs +309 -0
  61. package/dist/index.d.cts +187 -0
  62. package/dist/index.d.ts +187 -0
  63. package/dist/index.js +4 -0
  64. package/dist/next/client.cjs +113 -0
  65. package/dist/next/client.d.cts +26 -0
  66. package/dist/next/client.d.ts +26 -0
  67. package/dist/next/client.js +41 -0
  68. package/dist/next/config.cjs +277 -0
  69. package/dist/next/config.d.cts +193 -0
  70. package/dist/next/config.d.ts +193 -0
  71. package/dist/next/config.js +263 -0
  72. package/dist/next/index.cjs +148 -0
  73. package/dist/next/index.d.cts +32 -0
  74. package/dist/next/index.d.ts +32 -0
  75. package/dist/next/index.js +59 -0
  76. package/dist/node/index.cjs +257 -0
  77. package/dist/node/index.d.cts +145 -0
  78. package/dist/node/index.d.ts +145 -0
  79. package/dist/node/index.js +83 -0
  80. package/dist/options-BUhWuWJX.d.cts +79 -0
  81. package/dist/options-BUhWuWJX.d.ts +79 -0
  82. package/dist/react/index.cjs +107 -0
  83. package/dist/react/index.d.cts +84 -0
  84. package/dist/react/index.d.ts +84 -0
  85. package/dist/react/index.js +103 -0
  86. package/dist/scope-D1ouJm2h.d.cts +628 -0
  87. package/dist/scope-D1ouJm2h.d.ts +628 -0
  88. package/dist/server-edge-7624N3WF.cjs +51 -0
  89. package/dist/server-edge-BEEXWL7T.js +48 -0
  90. package/dist/server-node-ET4LIPEC.cjs +27 -0
  91. package/dist/server-node-TQUVMZUC.js +24 -0
  92. package/dist/session-C_WzbEN2.d.cts +4 -0
  93. package/dist/session-C_WzbEN2.d.ts +4 -0
  94. package/dist/session-propagation-Pr0Zb9Zn.d.cts +30 -0
  95. package/dist/session-propagation-RM5py1bp.d.ts +30 -0
  96. package/dist/starko.min.js +6 -0
  97. package/docs/browser.md +386 -0
  98. package/docs/configuration.md +310 -0
  99. package/docs/nextjs.md +488 -0
  100. package/docs/node.md +427 -0
  101. package/docs/other-backends.md +232 -0
  102. package/docs/privacy.md +112 -0
  103. package/docs/react.md +187 -0
  104. package/docs/source-maps.md +482 -0
  105. package/docs/troubleshooting.md +263 -0
  106. package/docs/widget.md +84 -0
  107. package/docs/wire-format.md +547 -0
  108. package/package.json +191 -4
@@ -0,0 +1,48 @@
1
+ import { withNextDefaults, captureNextRequestError } from './chunk-EROUORMY.js';
2
+ import { requestDataIntegration, ServerClient, makeServerFetchTransport, SERVER_DEFAULTS, nodeIsInApp } from './chunk-DUO5V6WZ.js';
3
+ import { installAsyncScopeManager, currentRequestKey, getRequestData, noteInit, markServing } from './chunk-N5R6ORIB.js';
4
+ import './chunk-UI5YC4TH.js';
5
+ import { dedupeIntegration, nodeStackParser } from './chunk-CMGCH6HD.js';
6
+ import { buildTimeRelease } from './chunk-EC2WZ6PG.js';
7
+ import './chunk-VNCWOGTI.js';
8
+ import './chunk-335HNCOJ.js';
9
+ import { getClient, setCurrentClient, getGlobalScope } from './chunk-WDKRKGYF.js';
10
+ import './chunk-3AW5B2WW.js';
11
+
12
+ // src/next/server-edge.ts
13
+ function init(input) {
14
+ try {
15
+ const options = withNextDefaults(input);
16
+ const previous = getClient();
17
+ if (previous) void previous.close(0);
18
+ installAsyncScopeManager();
19
+ const defaults = options.defaultIntegrations === false ? [] : [dedupeIntegration({ requestKey: currentRequestKey }), requestDataIntegration()];
20
+ const integrations = typeof options.integrations === "function" ? options.integrations(defaults) : [...defaults, ...options.integrations || []];
21
+ const { apiKey, fetch: fetchImpl, ...rest } = options;
22
+ const client = new ServerClient({
23
+ ...rest,
24
+ // Precedence: see `buildTimeRelease`. Unset here, the client reads the injected global per event.
25
+ release: rest.release || buildTimeRelease(),
26
+ platform: "node",
27
+ framePlatform: "node:javascript",
28
+ sdkName: "starko.nextjs.edge",
29
+ stackParser: nodeStackParser,
30
+ isInApp: nodeIsInApp,
31
+ getSessionId: () => getRequestData()?.sessionId,
32
+ ...SERVER_DEFAULTS,
33
+ transport: options.transport || ((o) => makeServerFetchTransport({ ...o, apiKey, fetchImpl: typeof fetchImpl === "function" ? fetchImpl : void 0 }))
34
+ });
35
+ setCurrentClient(client);
36
+ client.init(integrations);
37
+ noteInit(options.user ? getGlobalScope().user : null);
38
+ markServing();
39
+ return client;
40
+ } catch {
41
+ return void 0;
42
+ }
43
+ }
44
+ function captureRequestError(error, request, context, flushTimeout) {
45
+ return captureNextRequestError(error, request, context, flushTimeout, "edge");
46
+ }
47
+
48
+ export { captureRequestError, init };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var chunkD6QAPQ7L_cjs = require('./chunk-D6QAPQ7L.cjs');
4
+ var chunkVEHZYLK6_cjs = require('./chunk-VEHZYLK6.cjs');
5
+ require('./chunk-A4WLNFMU.cjs');
6
+ var chunk2PM4FRM5_cjs = require('./chunk-2PM4FRM5.cjs');
7
+ require('./chunk-ALYFFOPR.cjs');
8
+ require('./chunk-6H5MOPTQ.cjs');
9
+ var chunkLXBXFOAP_cjs = require('./chunk-LXBXFOAP.cjs');
10
+ require('./chunk-CIHNKN62.cjs');
11
+ var chunkZS3K3SDR_cjs = require('./chunk-ZS3K3SDR.cjs');
12
+ require('./chunk-QV4HRIDD.cjs');
13
+ require('./chunk-N6R6BWHK.cjs');
14
+
15
+ // src/next/server-node.ts
16
+ function init(options) {
17
+ const release = options.release || chunkLXBXFOAP_cjs.buildTimeRelease() || chunkZS3K3SDR_cjs.getInjectedRelease();
18
+ const client = chunkVEHZYLK6_cjs.initNode(chunkD6QAPQ7L_cjs.withNextDefaults(release ? { ...options, release } : options), "starko.nextjs");
19
+ if (client) chunk2PM4FRM5_cjs.markServing();
20
+ return client;
21
+ }
22
+ function captureRequestError(error, request, context, flushTimeout) {
23
+ return chunkD6QAPQ7L_cjs.captureNextRequestError(error, request, context, flushTimeout, "nodejs");
24
+ }
25
+
26
+ exports.captureRequestError = captureRequestError;
27
+ exports.init = init;
@@ -0,0 +1,24 @@
1
+ import { withNextDefaults, captureNextRequestError } from './chunk-EROUORMY.js';
2
+ import { initNode } from './chunk-BVVFVRMO.js';
3
+ import './chunk-DUO5V6WZ.js';
4
+ import { markServing } from './chunk-N5R6ORIB.js';
5
+ import './chunk-UI5YC4TH.js';
6
+ import './chunk-CMGCH6HD.js';
7
+ import { buildTimeRelease } from './chunk-EC2WZ6PG.js';
8
+ import './chunk-VNCWOGTI.js';
9
+ import { getInjectedRelease } from './chunk-335HNCOJ.js';
10
+ import './chunk-WDKRKGYF.js';
11
+ import './chunk-3AW5B2WW.js';
12
+
13
+ // src/next/server-node.ts
14
+ function init(options) {
15
+ const release = options.release || buildTimeRelease() || getInjectedRelease();
16
+ const client = initNode(withNextDefaults(release ? { ...options, release } : options), "starko.nextjs");
17
+ if (client) markServing();
18
+ return client;
19
+ }
20
+ function captureRequestError(error, request, context, flushTimeout) {
21
+ return captureNextRequestError(error, request, context, flushTimeout, "nodejs");
22
+ }
23
+
24
+ export { captureRequestError, init };
@@ -0,0 +1,4 @@
1
+ /** Lower case: Node lower-cases incoming header names. */
2
+ declare const SESSION_HEADER = "x-starko-session-id";
3
+
4
+ export { SESSION_HEADER as S };
@@ -0,0 +1,4 @@
1
+ /** Lower case: Node lower-cases incoming header names. */
2
+ declare const SESSION_HEADER = "x-starko-session-id";
3
+
4
+ export { SESSION_HEADER as S };
@@ -0,0 +1,30 @@
1
+ import { O as Options, I as Integration, C as Client } from './api-DNrctwJu.cjs';
2
+
3
+ /** `init()` for browsers. */
4
+
5
+ type BrowserOptions = Options;
6
+ /** In order: filters first (cheap drops), then dedupe, then the data adders. */
7
+ declare function getDefaultIntegrations(): Integration[];
8
+ /**
9
+ * Browser in-app rule: `false` for frames that are certainly not the app's
10
+ * (native code, extensions, node_modules served by a dev server); undefined
11
+ * otherwise, because a minified bundle mixes app and library code and only
12
+ * the server can tell after resolving its source map.
13
+ */
14
+ declare function browserIsInApp(filename: string | undefined): boolean | undefined;
15
+ /**
16
+ * Sends what is queued with `keepalive` when the page is hidden or unloading
17
+ * (the requests start inside the event handler), and ends a pause after
18
+ * repeated send failures when the browser comes back `online`.
19
+ */
20
+ declare function flushOnHideIntegration(): Integration;
21
+ /**
22
+ * Start the SDK. Calling it again replaces the previous client (whose hooks
23
+ * are removed). Returns the client, or undefined when it could not start;
24
+ * never throws.
25
+ */
26
+ declare function init(options: BrowserOptions): Client | undefined;
27
+
28
+ declare function sessionPropagationIntegration(): Integration;
29
+
30
+ export { type BrowserOptions as B, browserIsInApp as b, flushOnHideIntegration as f, getDefaultIntegrations as g, init as i, sessionPropagationIntegration as s };
@@ -0,0 +1,30 @@
1
+ import { O as Options, I as Integration, C as Client } from './api-BAFm4Lxj.js';
2
+
3
+ /** `init()` for browsers. */
4
+
5
+ type BrowserOptions = Options;
6
+ /** In order: filters first (cheap drops), then dedupe, then the data adders. */
7
+ declare function getDefaultIntegrations(): Integration[];
8
+ /**
9
+ * Browser in-app rule: `false` for frames that are certainly not the app's
10
+ * (native code, extensions, node_modules served by a dev server); undefined
11
+ * otherwise, because a minified bundle mixes app and library code and only
12
+ * the server can tell after resolving its source map.
13
+ */
14
+ declare function browserIsInApp(filename: string | undefined): boolean | undefined;
15
+ /**
16
+ * Sends what is queued with `keepalive` when the page is hidden or unloading
17
+ * (the requests start inside the event handler), and ends a pause after
18
+ * repeated send failures when the browser comes back `online`.
19
+ */
20
+ declare function flushOnHideIntegration(): Integration;
21
+ /**
22
+ * Start the SDK. Calling it again replaces the previous client (whose hooks
23
+ * are removed). Returns the client, or undefined when it could not start;
24
+ * never throws.
25
+ */
26
+ declare function init(options: BrowserOptions): Client | undefined;
27
+
28
+ declare function sessionPropagationIntegration(): Integration;
29
+
30
+ export { type BrowserOptions as B, browserIsInApp as b, flushOnHideIntegration as f, getDefaultIntegrations as g, init as i, sessionPropagationIntegration as s };
@@ -0,0 +1,6 @@
1
+ "use strict";var Starko=(()=>{var Ee=Object.defineProperty;var pn=Object.getOwnPropertyDescriptor;var mn=Object.getOwnPropertyNames;var gn=Object.prototype.hasOwnProperty;var hn=(t,e)=>{for(var n in e)Ee(t,n,{get:e[n],enumerable:!0})},yn=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mn(e))!gn.call(t,i)&&i!==n&&Ee(t,i,{get:()=>e[i],enumerable:!(r=pn(e,i))||r.enumerable});return t};var bn=t=>yn(Ee({},"__esModule",{value:!0}),t);var Ir={};hn(Ir,{SDK_VERSION:()=>M,addBreadcrumb:()=>Ve,captureException:()=>Xe,captureMessage:()=>Fe,close:()=>Je,consoleErrorCaptureIntegration:()=>le,flush:()=>Qe,getClient:()=>E,identify:()=>$e,init:()=>De,setContext:()=>Ke,setExtra:()=>He,setExtras:()=>Ge,setTag:()=>qe,setTags:()=>ze,setUser:()=>We,withScope:()=>Ye});var l={MAX_EVENTS_PER_ENVELOPE:20,MAX_BODY_BYTES:524288,MAX_INFLATED_BYTES:2097152,MAX_EXCEPTIONS:10,MAX_FRAMES:50,MAX_CHUNK_IDS_PER_EVENT:8,MAX_JSON_DEPTH:20,MAX_TYPE:200,MAX_VALUE:2e3,MAX_FILENAME:1e3,MAX_FUNCTION:300,MAX_CONTEXT_LINE:300,MAX_CONTEXT_LINES:7,MAX_BREADCRUMBS:50,MAX_BREADCRUMB_BYTES:32768,MAX_TAGS:50,MAX_TAG_KEY:64,MAX_TAG_VALUE:256,MAX_EXTRA_BYTES:16384,MAX_FINGERPRINT:128,MAX_RELEASE:128,MAX_ENVIRONMENT:64,MAX_URL:2048},X=/^[A-Za-z0-9-]{8,70}$/,F={INGEST:"/api/v1/ingest/errors",CONFIG:"/api/v1/ingest/config",SOURCEMAPS_CHECK:"/api/v1/sourcemaps/check",SOURCEMAPS_UPLOAD:"/api/v1/sourcemaps/upload",SOURCEMAPS_COMPLETE:"/api/v1/sourcemaps/complete",SOURCEMAPS_BULK_CHECK:"/api/v1/sourcemaps/bulk/check",SOURCEMAPS_BULK_START:"/api/v1/sourcemaps/bulk/start",SOURCEMAPS_BULK_FINISH:"/api/v1/sourcemaps/bulk/finish"},Ze="https://v2.starko.one",et=["token","access_token","id_token","refresh_token","code","key","api_key","apikey","secret","password","passwd","pwd","auth","authorization","session","sessionid","sid","sig","signature","jwt","otp","pin","email","phone","ssn","x-amz-signature","x-amz-credential","x-amz-security-token"],tt="[redacted]",Or=3*1024*1024,En=64*1024*1024;var Cr=Math.ceil(En*1.01);var nt="_starkoDebugIds",rt="_debugIds",it="_starkoRelease";var kn="_sentryDebugIds",xn=[kn,rt,nt],K,ot=new Map;function wn(t){try{let e=globalThis[t];return e&&typeof e=="object"?e:void 0}catch(e){return}}function st(t){let e=xn.map(wn);if(!e.some(Boolean))return{};let n=e.map(a=>a?Object.keys(a):[]),r=n.map(a=>a.length).join(":");if(K&&K.parser===t&&K.sizes===r)return K.map;let i={},o=(a,s)=>{var c,u;for(let d of a){let f=s[d];if(typeof f!="string")continue;let m=ot.get(d);m===void 0&&(m=(u=(c=t(d).find(p=>p.filename))==null?void 0:c.filename)!=null?u:null,ot.set(d,m)),m&&(i[m]=f)}};return e.forEach((a,s)=>a&&o(n[s],a)),K={parser:t,sizes:r,map:i},i}function at(){let t=globalThis[it];if(typeof t=="string"&&t)return t;if(t&&typeof t=="object"&&typeof t.id=="string")return t.id}var ct="0.1.0-beta.1";var ut=Symbol.for("starko.sdk.instrument.v1");function dt(){let t=globalThis;return t[ut]||(t[ut]=new WeakMap)}var _n=(t,e)=>{let n=dt().get(t);return n&&n[e]};function re(t,e){let n=_n(t,e);return n?n.o:t[e]}function R(t,e,n){try{let r=t,i=dt(),o=i.get(r);o||i.set(r,o={});let a=o[e];if(!a){let c=r[e];if(typeof c!="function")return ke;let u={o:c,h:[],w:function(){let d=Array.prototype.slice.call(arguments),f=[];for(let p of u.h.slice())try{let g=p(this,d);g&&f.push(g)}catch(g){}let m=u.o.apply(this,d);for(let p of f)try{p(m)}catch(g){}return m}};if(r[e]=u.w,r[e]!==u.w)return ke;a=o[e]=u}let s=a;return s.h.push(n),()=>{try{let c=s.h.indexOf(n);if(c>=0&&s.h.splice(c,1),s.h.length||o[e]!==s)return;o[e]=void 0,r[e]===s.w&&(r[e]=s.o)}catch(c){}}}catch(r){return ke}}var ke=()=>{};var M=ct,xe=t=>Object.prototype.toString.call(t),we=(t,e)=>xe(t)===`[object ${e}]`,w=t=>typeof t=="string",ie=t=>xe(t)==="[object Object]",ft=t=>t===null||typeof t!="object"&&typeof t!="function";function A(t){if(/^\[object (?:Error|Exception|DOMException|WebAssembly\.Exception)\]$/.test(xe(t)))return!0;try{return t instanceof Error}catch(e){return!1}}function O(t){if(!t||typeof t!="object")return!1;try{return typeof Event!="undefined"&&t instanceof Event}catch(e){return!1}}var lt=t=>!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function";function b(t,e){if(t.length<=e)return t;let n=e,r=t.charCodeAt(n-1);return r>=55296&&r<=56319&&n--,t.slice(0,n)}function x(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);r<128?e+=1:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e}function V(){let t=globalThis.crypto;try{if(t&&typeof t.randomUUID=="function")return t.randomUUID()}catch(r){}let e;try{t&&typeof t.getRandomValues=="function"&&(e=t.getRandomValues(new Uint8Array(16)))}catch(r){}let n=0;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>{let i=e?e[n++>>1]>>(n&1)*4:Math.random()*16;return(+r^(i&15)>>+r/4).toString(16)})}function y(t){try{return String(t)}catch(e){return"[unserializable]"}}var W="[starko]",Se={};try{if(typeof console!="undefined")for(let t of["log","warn"])Se[t]=re(console,t).bind(console)}catch(t){}function _e(...t){try{let e=Se.warn;e&&e(W,...t)}catch(e){}}function oe(t=!1){let e=new Set,n=(i,o)=>{if(r.enabled)try{let a=Se[i];a&&a(W,...o)}catch(a){}},r={enabled:t,log:(...i)=>n("log",i),warn:(...i)=>n("warn",i),alert:(i,...o)=>{e.has(i)||(e.add(i),_e(...o))}};return r}function S(t,e,n,r){try{return n()}catch(i){return t&&t.warn(`${e} failed`,i),r}}function Y(t,e){if(!e)return!1;for(let n of e)try{if(w(n)?t.includes(n):n.test(t))return!0}catch(r){}return!1}function B(t){let e=t&&t.unref;typeof e=="function"&&e.call(t)}var Q=(t,e,n)=>Math.min(n,Math.max(e,t)),_=(t,e)=>typeof t=="number"&&isFinite(t)?t:e;var J=100,vn=2e3;function Z(t,e=5){return U(t,e,new WeakSet)}function U(t,e,n){try{if(t===null||typeof t=="boolean")return t;if(typeof t=="string")return b(t,vn);if(typeof t=="number")return isFinite(t)?t:`[${y(t)}]`;if(typeof t=="undefined")return"[undefined]";if(typeof t=="bigint")return`[BigInt: ${t.toString()}]`;if(typeof t=="symbol")return`[${y(t)}]`;if(typeof t=="function")return`[Function: ${t.name||"<anonymous>"}]`;let r=t;if(n.has(r))return"[Circular]";let i=r;if(typeof i.nodeType=="number"&&typeof i.nodeName=="string")return`[${i.nodeName}]`;if(r.window===r)return"[Window]";if(r instanceof Date)return isNaN(r.getTime())?"[Invalid Date]":r.toISOString();if(r instanceof RegExp)return y(r);if(e<=0)return Array.isArray(r)?"[Array]":"[Object]";n.add(r);let o;if(Array.isArray(r)){let a=[];for(let s=0;s<r.length&&s<J;s++)a.push(U(r[s],e-1,n));r.length>J&&a.push(`[\u2026 ${r.length-J} more]`),o=a}else if(A(r)){let a=r,s={name:U(a.name,1,n),message:U(a.message,1,n)};for(let c of Object.keys(a).slice(0,J))s[c]=U(a[c],e-1,n);o=s}else{let a=r.toJSON;if(typeof a=="function"&&!ie(r))o=U(a.call(r),e-1,n);else{let s={},c=0;for(let u in r){if(!Object.prototype.hasOwnProperty.call(r,u))continue;if(c++>=J){s["\u2026"]="[more keys]";break}let d;try{d=r[u]}catch(f){d="[unserializable]"}d!==void 0&&(s[u]=U(d,e-1,n))}o=s}}return n.delete(r),o}catch(r){return"[unserializable]"}}function k(t){var e;try{return(e=JSON.stringify(t))!=null?e:"null"}catch(n){return'"[unserializable]"'}}function j(t,e,n=5){for(let r=n;r>=1;r--){let i=Z(t,r);if(x(k(i))<=e)return i}return{_truncated:`[over ${e} bytes]`}}var Rn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/s,h=(t,e)=>{try{return t[e]}catch(n){return}};function se(t){var e,n;try{let r=(n=(e=Object.getPrototypeOf(t))==null?void 0:e.constructor)==null?void 0:n.name;return w(r)&&r?r:void 0}catch(r){return}}function An(t){let e=h(t,"name"),n=h(t,"message"),r=h(t,"stack"),i={type:w(e)&&e||se(t)||"Error",value:w(n)?n:n==null?"":y(n),stack:w(r)?r:void 0},o=[],a=h(t,"cause");a!=null&&o.push(["cause",a]);let s=h(t,"errors");return Array.isArray(s)&&s.forEach((c,u)=>o.push([`errors[${u}]`,c])),o.length&&(i.children=o),i}function ae(t,e,n){if(we(t,"ErrorEvent")||O(t)&&"error"in t&&"message"in t){let r=t,i=h(r,"filename"),o=h(r,"lineno"),a=h(r,"colno"),s=w(i)&&i&&typeof o=="number"&&o>0?`Error
2
+ at ${i}:${o}:${typeof a=="number"?a:0}`:void 0,c=h(r,"error");if(c!=null){let f=ae(c,{...e,synthetic:void 0},n);return!f.stack&&s&&(f.stack=s,f.synthetic=!1),f}let u=h(r,"message"),d=Rn.exec(w(u)?u:"")||[];return{type:d[1]||"Error",value:d[2]||"",stack:s}}if(we(t,"PromiseRejectionEvent")||O(t)&&("reason"in t||pt(t))){let r=h(t,"reason");return r===void 0&&pt(t)&&(r=h(h(t,"detail"),"reason")),ft(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${y(r)}`,...$(e)}:ae(r,e,n)}if(A(t)){let r=An(t);return r.stack||Object.assign(r,$(e)),r}if(O(t)){let r=h(t,"type");return{type:se(t)||"Event",value:`Event \`${se(t)||"Event"}\` (type=${w(r)?r:"unknown"}) captured as exception`,...$(e)}}if(t!==null&&typeof t=="object"){let r=t;if(ie(r))for(let u of Object.keys(r)){let d=h(r,u);if(A(d))return ae(d,e,n)}let i=h(r,"name"),o=h(r,"message"),a=h(r,"stack"),s;if(w(o)&&o)s=o;else{let d=Object.keys(r).sort().join(", ");d.length>40&&(d=b(d,40)+"\u2026");let f=se(r);s=`${f&&f!=="Object"?`'${f}'`:"Object"} captured as exception with keys: ${d||"[none]"}`}n&&(n.value=j(r,l.MAX_EXTRA_BYTES/2,3));let c={type:w(i)&&i||"Error",value:s};return w(a)&&a?c.stack=a:Object.assign(c,$(e)),c}return w(t)?{type:"Error",value:t,...$(e)}:{type:"Error",value:y(t),...$(e)}}function pt(t){let e=h(t,"detail");return!!e&&typeof e=="object"&&"reason"in e}function $(t){let e=t.synthetic;return!e||!e.stack?{}:{stack:e.stack,skip:e.skip,synthetic:!0}}function Tn(t,e){let n=st(e.parser);return t.map(r=>{let i={platform:e.framePlatform};r.filename!==void 0&&(i.filename=r.filename),r.function!==void 0&&(i.function=r.function),r.lineno!==void 0&&(i.lineno=r.lineno),r.colno!==void 0&&(i.colno=r.colno);try{let a=e.isInApp&&e.isInApp(r.filename);typeof a=="boolean"&&(i.in_app=a)}catch(a){}let o=r.filename?n[r.filename]:void 0;return o&&(i.chunk_id=o),i})}function mt(t,e,n){var c;let r={},i=[],o=new Set,a=(c=e==null?void 0:e.handled)!=null?c:!0,s=(u,d,f,m)=>{if(i.length>=l.MAX_EXCEPTIONS)return;if(u!==null&&typeof u=="object"){if(o.has(u))return;o.add(u)}let p=ae(u,f===void 0?n:{...n,synthetic:void 0},f===void 0?r:void 0),g=i.length,v={type:p.type||"Error",value:p.value||""},P=f===void 0?{type:(e==null?void 0:e.type)||"generic",handled:a,...In(e)}:{type:"chained",handled:a,source:d,exception_id:g,parent_id:f};if(p.synthetic&&(P.synthetic=!0),v.mechanism=P,p.stack){let ne=Tn(n.parser(p.stack,p.skip||0),n);ne.length&&(v.stacktrace={type:"raw",frames:ne})}if(i.push(v),!(m>=l.MAX_EXCEPTIONS))for(let[ne,ln]of p.children||[])s(ln,ne,g,m+1)};try{s(t,void 0,void 0,0)}catch(u){i.length||i.push({type:"Error",value:y(t),mechanism:{type:(e==null?void 0:e.type)||"generic",handled:a}})}return i.length>1&&(i[0].mechanism.exception_id=0),{exceptions:i,serialized:r.value}}function In(t){let e={};if(t)for(let n of Object.keys(t))t[n]!==void 0&&(e[n]=t[n]);return e}var ve=new WeakMap;function ee(t){if(!(!t||typeof t!="object"))try{return ve.get(t)}catch(e){return}}function gt(t,e){try{if(!t||typeof t!="object")return;ve.set(t,e);let n=h(t,"error")||h(t,"reason");O(t)&&n&&typeof n=="object"&&ve.set(n,e)}catch(n){}}function ht(t){if(O(t)){let e=h(t,"error")||h(t,"reason");if(e&&typeof e=="object")return e}return t}var ce=4*1024,Re=class t{constructor(e=l.MAX_BREADCRUMBS,n=l.MAX_BREADCRUMB_BYTES){this.maxItems=e;this.maxBytes=n;this.items=[];this.bytes=0;this.maxItems=Q(Math.floor(e),0,l.MAX_BREADCRUMBS)}add(e){if(this.maxItems===0)return;let n=Ae(e),r=x(k(n))+1;for(r>ce&&n.data&&(n.data=j(n.data,ce/2,3),r=x(k(n))+1),r>ce&&(delete n.data,n.message&&(n.message=b(n.message,1024)),r=x(k(n))+1),this.items.push({crumb:n,bytes:r}),this.bytes+=r;this.items.length>this.maxItems||this.bytes>this.maxBytes;){let i=this.items.shift();if(!i)break;this.bytes-=i.bytes}}setMaxItems(e){for(this.maxItems=Q(Math.floor(e),0,l.MAX_BREADCRUMBS);this.items.length>this.maxItems;)this.bytes-=this.items.shift().bytes}get(){return this.items.map(e=>e.crumb)}get byteSize(){return this.bytes}clear(){this.items=[],this.bytes=0}clone(){let e=new t(this.maxItems,this.maxBytes);return e.items=this.items.slice(),e.bytes=this.bytes,e}},Mn=["fatal","error","warning","info","debug"],D=t=>Mn.includes(t);function Ae(t){let e={timestamp:typeof t.timestamp=="number"&&isFinite(t.timestamp)?t.timestamp:Date.now(),type:typeof t.type=="string"&&t.type?b(t.type,32):"custom"};return t.category!=null&&(e.category=b(y(t.category),64)),t.message!=null&&(e.message=b(y(t.message),2048)),D(t.level)&&(e.level=t.level),t.data&&typeof t.data=="object"&&(e.data=j(t.data,ce,3)),e}var ue=class t{constructor(e=l.MAX_BREADCRUMBS){this.user=null;this.tags={};this.extra={};this.contexts={};this.breadcrumbs=new Re(e)}setUser(e){return this.user=e?{...e}:null,this}setTag(e,n){return this.tags={...this.tags,[e]:y(n)},this}setTags(e){for(let n of Object.keys(e||{}))this.setTag(n,e[n]);return this}setExtra(e,n){return this.extra={...this.extra,[e]:n},this}setExtras(e){return this.extra={...this.extra,...e},this}setContext(e,n){let r={...this.contexts};return n===null?delete r[e]:r[e]=n,this.contexts=r,this}setFingerprint(e){return this.fingerprint=e,this}setLevel(e){return this.level=e,this}addBreadcrumb(e){return this.breadcrumbs.add(e),this}clearBreadcrumbs(){return this.breadcrumbs.clear(),this}clear(){return this.user=null,this.tags={},this.extra={},this.contexts={},this.fingerprint=void 0,this.level=void 0,this.breadcrumbs.clear(),this}clone(){let e=new t(0);return e.user=this.user?{...this.user}:null,e.tags={...this.tags},e.extra={...this.extra},e.contexts={...this.contexts},e.fingerprint=this.fingerprint,e.level=this.level,e.breadcrumbs=this.breadcrumbs.clone(),e}applyToEvent(e){this.user&&Object.keys(this.user).length&&(e.user={...this.user,...e.user}),Object.keys(this.tags).length&&(e.tags={...this.tags,...e.tags}),Object.keys(this.extra).length&&(e.extra={...this.extra,...e.extra}),Object.keys(this.contexts).length&&(e.contexts={...this.contexts,...e.contexts}),this.fingerprint&&!e.fingerprint&&(e.fingerprint=this.fingerprint),this.level&&(e.level=this.level);let n=this.breadcrumbs.get();return n.length&&(e.breadcrumbs=[...n,...e.breadcrumbs||[]]),e}};function On(t){let e=/^(\d+)\.(\d+)/.exec(t);return e?e[1]==="0"?`0.${e[2]}`:e[1]:t}var yt=Symbol.for(`starko.sdk.carrier.v2/${On(M)}`);function q(){let t=globalThis,e=t[yt];return(!e||typeof e!="object")&&(e={version:M,client:void 0,globalScope:new ue,stack:[],manager:void 0},t[yt]=e),e}var bt={getScope:()=>{let t=q();return t.stack[t.stack.length-1]||t.globalScope},withScope(t){let e=q().stack,n=bt.getScope().clone();e.push(n);try{return t(n)}finally{let r=e.lastIndexOf(n);r>=0&&e.splice(r,1)}}},de=()=>q().manager||bt;function E(){return q().client}function Et(t){q().client=t}function z(t,e){try{let n=t&&t[e];return typeof n=="function"?n.bind(t):void 0}catch(n){return}}function C(){return de().getScope()}function Te(){return q().globalScope}function kt(t){return de().withScope(t)}function xt(){let t=de();return t.peekScope?t.peekScope():t.getScope()}function Ie(t){let e=de();return e.scopeForUser?e.scopeForUser(t):e.getScope()}var Me="__STARKO_BRIDGE__",Cn="starko:bridge",Ln=/^[\w-]+\.[\w-]+\.[\w-]+$/,Ce=t=>t!==null&&typeof t=="object";function fe(){try{let t=globalThis[Me];return Ce(t)?t:void 0}catch(t){return}}function St(t){try{return Ce(t)&&typeof t.version=="string"&&typeof t.getSessionId=="function"&&typeof t.captureException=="function"}catch(e){return!1}}function _t(t){try{let e=(fe()||{}).widget;return e&&e[t]()}catch(e){return}}function vt(){try{return Ce((fe()||{}).widget)}catch(t){return!1}}function Rt(){let t=_t("getReplaySessionId");return typeof t=="string"&&X.test(t)?t:void 0}function Pn(){let t=_t("getClientToken");return typeof t=="string"&&t.length<=2048&&Ln.test(t)?t:void 0}function Le(){try{let t=E();if(!t||!t.isEnabled())return!1;let e=t.getIntegration("GlobalHandlers");return!!e&&e.captures!==!1}catch(t){return!1}}var Bn=Object.freeze({version:M,get capturesErrors(){return Le()},getSessionId:()=>{try{let t=E();return t&&t.getSessionId()||""}catch(t){return""}},captureException:(t,e)=>{try{let n=E();return n?n.captureException(t,{mechanism:{type:"widget",handled:!0},...e}):""}catch(n){return""}}}),Pe;function Oe(){try{let t=Le();Pe=t,typeof window!="undefined"&&typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent(Cn,{detail:{side:"sdk",capturesErrors:t}}))}catch(t){}}function Be(){try{let t=fe();t&&St(t.sdk)&&Le()!==Pe&&Oe()}catch(t){}}function wt(t){try{let e=globalThis,n=fe();if(!n){if(e[Me]!=null)return t&&t("__STARKO_BRIDGE__ is not an object: running without the widget bridge"),0;e[Me]=n={}}return St(n.sdk)?1:(Object.defineProperty(n,"sdk",{value:Bn,enumerable:!0,writable:!1,configurable:!1}),2)}catch(e){return t&&t("the widget bridge's sdk slot could not be set"),0}}function At(){let t;return{name:"WidgetBridge",setup(e){t=e.logger.log,wt(t)?Oe():Pe=void 0},processEvent(e){if(wt(t)===2&&Oe(),!e.client_token){let n=Pn();n&&(e.client_token=n)}return e},teardown(){Be()}}}function le(t={}){let e;return{name:"ConsoleErrorCapture",setup(n){if(typeof console=="undefined")return;let r=!1;e=R(console,"error",(i,o)=>{if(r||o[0]===W||t.whenWidget&&!vt())return;let a=o.find(s=>A(s));if(!(!a||ee(a))){r=!0;try{n.captureException(a,{mechanism:{type:"console",handled:!0}})}finally{r=!1}}})},teardown(){e&&e(),e=void 0}}}var Nn=/^(?:<anonymous>|\[native code\]|native|<data:.*)$/,Un=/^(?:chrome|moz|safari|safari-web|ms-browser)-extension:\/\//i,jn=/(?:starko[^\s/]*\.(?:one|me|app)|localhost:\d+)\/(?:widget(?:[.-][^\s/]*)?\.js|replay\/rrweb-record)/i,Dn=/\/widget(?:[.-][A-Za-z0-9]+)?\.js\b/i,Xn=/^(?:\[object \w+\]|undefined|null|error|Non-Error promise rejection captured with value: (?:undefined|null)?)$/i,Fn=/^(?:uncaught\s+)?script error\.?$/i,Wn=/^resizeobserver loop|resizeobserver loop (?:limit exceeded|completed with undelivered notifications)/i,Tt=/\baborterror\b|^(?:the )?(?:user |operation was |request |fetch was |signal is )?aborted(?: a request| without reason)?\.?$|\bthe operation was aborted\b/i,It=/^(?:typeerror: )?(?:failed to fetch|networkerror when attempting to fetch resource\.?|load failed|network request failed|network error|the internet connection appears to be offline\.?)$/i,Mt=new Set;function Ot(t){t&&Mt.add(t)}function $n(t){let e=t.exception_list[0];if(!e)return null;let n=(e.value||"").replace(/\s+/g," ").trim(),r=e.type&&e.type!=="Error"?`${e.type}: ${n}`:n,i=e.mechanism&&e.mechanism.synthetic||!e.stacktrace?[]:e.stacktrace.frames,o=i.length>0,a=i.map(s=>s.filename||"").filter(s=>s&&!Nn.test(s));return(!n||Xn.test(n))&&!o?"empty message":Fn.test(n)&&!o?"cross-origin script error":i.slice(0,3).some(s=>s.filename&&Un.test(s.filename))?"browser extension":Wn.test(n)?"ResizeObserver loop":e.type==="AbortError"||Tt.test(n)||Tt.test(r)?"aborted request":It.test(n)||It.test(r)||/\bnetworkerror\b/i.test(r)&&!o?"network error":a.length&&a.every(s=>jn.test(s)||Mt.has(s)||Dn.test(s)&&/starko/i.test(s))?"Starko script":null}function Ct(){return{name:"InboundFilters",processEvent(t,e,n){let r=$n(t);return r?(n.logger.log("dropped",r),null):t}}}var qn=["unknown_workspace","disabled","origin_not_allowed"],Lt=1024,pe=class{constructor(e){this.items=[];this.running=null;this.sends=new Set;this.flying=new Set;this.retryAt=0;this.backoffUntil=0;this.pausedUntil=0;this.failures=0;this.disabled=!1;this.dropped=0;this.o={transport:e.transport,envelope:e.envelope,maxQueueSize:100,flushInterval:1e3,maxAttempts:3,pauseAfter:3,failurePauseMs:5*6e4,backoffMs:1e3,maxBackoffMs:6e4,sendTimeoutMs:3e4,random:Math.random,logger:oe()};for(let n of Object.keys(e))e[n]!==void 0&&(this.o[n]=e[n])}get size(){return this.items.length}get isSending(){return this.sends.size>0}get isDisabled(){return this.disabled}get isBlocked(){return this.blockedFor(!1)>0}filter(e){this.items=this.items.filter(n=>{try{return e(n.event)}catch(r){return!0}})}add(e){if(this.disabled)return;let n;try{n=JSON.stringify(e)}catch(i){}if(typeof n!="string"){this.o.logger.warn("unserializable event dropped");return}let r=x(n);if(r>l.MAX_BODY_BYTES-Lt){this.o.logger.warn("event too large",e.event_id);return}this.items.push({event:e,bytes:r,attempts:0,maxBatch:l.MAX_EVENTS_PER_ENVELOPE}),this.bound(),this.schedule(this.items.length>=l.MAX_EVENTS_PER_ENVELOPE?0:this.o.flushInterval)}disable(){this.disabled=!0,this.items=[],this.clearTimer()}holdOff(e){this.backoffUntil=Math.max(this.backoffUntil,Date.now()+e),this.clearTimer(),this.schedule(this.o.flushInterval)}resume(){this.disabled||(this.pausedUntil=this.backoffUntil=this.failures=0,this.schedule(0))}async flush(e=2e3,n=!1){this.clearTimer();let r=this.dropped;n&&this.sendAll();let i=(async()=>{for(let s=0;s<50;s++){for(;this.sends.size;)await Promise.all(this.sends);if(!this.items.length||this.disabled||this.blockedFor(n)>0)break;n?this.sendAll():await this.drain()}return!this.items.length&&!this.sends.size&&this.dropped===r})(),o,a=new Promise(s=>{o=setTimeout(()=>s(!1),Math.max(0,e))});try{return await Promise.race([i,a])}finally{clearTimeout(o),this.schedule(this.o.flushInterval)}}bound(){let e=this.items.length-this.o.maxQueueSize;e>0&&(this.items.splice(0,e),this.dropped++,this.o.logger.alert("queue",`events dropped: queue full (maxQueueSize ${this.o.maxQueueSize})`))}blockedFor(e){let n=Date.now();return Math.max(0,this.retryAt-n,this.pausedUntil-n,e?0:this.backoffUntil-n)}clearTimer(){clearTimeout(this.timer),this.timer=void 0}schedule(e){if(this.disabled||!this.items.length)return;let n=Math.max(e,this.blockedFor(!1));if(n<2**31-1){if(this.timer!==void 0){if(n>0)return;this.clearTimer()}this.timer=setTimeout(()=>{this.timer=void 0,this.drain()},n),B(this.timer)}}drain(){return this.running?this.running:(this.running=(async()=>{if(this.o.gate)try{await this.o.gate()}catch(e){}for(;this.items.length&&!this.disabled&&!this.blockedFor(!1)&&await this.send(this.take(),!1););})().catch(e=>this.o.logger.warn("send failed",e)).then(()=>{this.running=null,this.schedule(this.items.length>=l.MAX_EVENTS_PER_ENVELOPE?0:this.o.flushInterval)}),this.running)}sendAll(){let e=[];for(let n of this.flying)for(let r of n)r.done||r.rescued||this.items.includes(r)||(r.rescued=!0,e.push(r));for(this.items.unshift(...e);this.items.length&&!this.disabled&&!this.blockedFor(!0);)this.send(this.take(),!0)}take(){let e=[],n=Lt,r=l.MAX_EVENTS_PER_ENVELOPE;for(let i of this.items){if(r=Math.min(r,i.maxBatch),e.length>=r||e.length&&n+i.bytes+1>l.MAX_BODY_BYTES)break;e.push(i),n+=i.bytes+1}return this.items.splice(0,e.length),e}send(e,n){n||this.flying.add(e);let r;try{r=this.o.transport.send(this.o.envelope(e.map(a=>a.event)),{keepalive:n})}catch(a){this.o.logger.warn("send failed",a),r=Promise.resolve({status:0})}let i,o=Promise.race([Promise.resolve(r).then(void 0,a=>(this.o.logger.warn("send failed",a),{status:0})),new Promise(a=>{i=setTimeout(()=>a({status:0}),this.o.sendTimeoutMs),B(i)})]).then(a=>(clearTimeout(i),this.flying.delete(e),this.sends.delete(o),this.handle(e,a&&typeof a.status=="number"?a:{status:0}))).catch(()=>!1);return this.sends.add(o),o}requeue(e,n){this.items.unshift(...e.filter(r=>!r.done&&!this.items.includes(r)&&n(r))),this.bound()}handle(e,n){let{status:r,reason:i}=n,o=this.o.logger,a=Date.now(),s=typeof n.retryAfter=="number"&&isFinite(n.retryAfter)&&n.retryAfter>=0?n.retryAfter*1e3:void 0;if(r>=200&&r<300){this.failures=0;for(let p of e)p.done=!0;return this.items=this.items.filter(p=>!p.done),o.log(`sent ${e.length}`),!0}if((r===401||r===403)&&qn.includes(i)){o.warn(`${r} ${i}: off`),this.disable();try{this.o.onDisable&&this.o.onDisable(r)}catch(p){}return!1}if(r>=300&&r<400){this.dropped++;let p=n.location?` to ${n.location}`:"";return o.alert("redirect",`host answered ${r}, a redirect${p}: not followed, events not delivered. Set \`host\` to the final address.`),!0}if(r===413){if(e.length>1&&!e.some(p=>p.halved)){let p=Math.ceil(e.length/2);for(let g of e)g.halved=!0,g.maxBatch=p;this.requeue(e,()=>!0),o.warn("413: halving")}else this.dropped++,o.warn("413: dropped");return!0}if(r===429&&i==="quota")return this.retryAt=a+(s===void 0?36e5:s),this.dropped++,o.warn("429 quota: dropped"),this.schedule(0),!1;if((r===401||r===403)&&i==="invalid")return this.dropped++,o.alert("credentials",`${r}: secret key refused, events dropped. Check \`apiKey\`.`),!0;if(!(r===0||r===401||r===403||r===408||r===429||r>=500))return this.dropped++,o.warn(`${r}: dropped`),!0;let u=!1,d=1;this.requeue(e,p=>++p.attempts<this.o.maxAttempts?!!(d=p.attempts):(u=!0,!1)),u&&this.dropped++,u&&++this.failures>=this.o.pauseAfter&&(this.pausedUntil=a+this.o.failurePauseMs,o.warn("repeated failures: paused"));let f=Math.min(this.o.maxBackoffMs,this.o.backoffMs*2**(d-1)),m=Math.round(f*(.5+this.o.random()));return s!==void 0||r===429?this.retryAt=a+Math.max(m,s===void 0?6e4:s):this.backoffUntil=a+m,o.warn(`${r}: retry`),this.schedule(0),!1}};function Pt(t,e,n){let r=typeof t=="string"&&t?t:"Error",i=typeof e=="string"?e.slice(0,120):"";return i?`${r}: ${i.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\b(?=[0-9a-f]*\d)[0-9a-f]{8,}\b/gi,"<id>").replace(/\d+/g,"<n>")}`:n?`${r} @ ${n.filename}:${n.lineno}`:r}var zn=200,Hn=6e4,me=class{constructor(e={}){this.buckets=new Map;this.sent=0;this.recent=[];var r,i;let n=o=>typeof o=="number"&&!isNaN(o)?Math.max(0,o):1/0;this.burst=Math.max(1,(r=e.burst)!=null?r:10),this.refillMs=Math.max(1,(i=e.refillMs)!=null?i:1e4),this.lifetimeCap=n(e.lifetimeCap),this.perMinute=n(e.perMinute)}check(e,n=Date.now()){return this.test(e,n,!0)}peek(e,n=Date.now()){return this.test(e,n,!1)}test(e,n,r){if(this.sent>=this.lifetimeCap)return"lifetime cap";if(this.perMinute!==1/0){for(;this.recent.length&&this.recent[0]<=n-Hn;)this.recent.shift();if(this.recent.length>=this.perMinute)return"per-minute budget"}let i=this.buckets.get(e);if(!i)this.buckets.size>=zn&&this.buckets.delete(this.buckets.keys().next().value),i={tokens:this.burst,at:n},this.buckets.set(e,i);else{this.buckets.delete(e),this.buckets.set(e,i);let o=Math.floor((n-i.at)/this.refillMs);o>0&&(i.tokens=Math.min(this.burst,i.tokens+o),i.at+=o*this.refillMs)}return i.tokens<=0?"rate limited":(r&&(i.tokens--,i.tokens===this.burst-1&&(i.at=n),this.sent++,this.perMinute!==1/0&&this.recent.push(n)),null)}get count(){return this.sent}};var ge={enabled:!0,sample_rate:1,suppress:[]};function Bt(t){if(!t||typeof t!="object")return{...ge};let e=t,n=[];if(Array.isArray(e.suppress))for(let r of e.suppress.slice(0,100)){if(!r||typeof r!="object")continue;let i={};typeof r.type=="string"&&r.type&&(i.type=r.type),typeof r.value_contains=="string"&&r.value_contains&&(i.value_contains=r.value_contains),(i.type||i.value_contains)&&n.push(i)}return{enabled:e.enabled!==!1,sample_rate:typeof e.sample_rate=="number"&&isFinite(e.sample_rate)?Q(e.sample_rate,0,1):1,suppress:n}}function Nt(t,e){let n=t.exception_list[0];if(!n)return!1;let r=(n.value||"").toLowerCase();return e.some(i=>(i.type===void 0||i.type===n.type)&&(i.value_contains===void 0||r.includes(i.value_contains.toLowerCase())))}var Ut=new Set(et);function Gn(t){let e=t;try{e=decodeURIComponent(t.replace(/\+/g," "))}catch(n){}return Ut.has(e.toLowerCase())?!0:e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[\s_-]+/).some(n=>Ut.has(n))}function H(t){if(typeof t!="string")return t;let e=t.indexOf("#"),n=e>=0?t.slice(0,e):t,r=n.indexOf("//"),i=n.indexOf("?");if(r>=0&&(i<0||r<i)&&(r===0||n[r-1]===":")){let s=r+2,c=s;for(;c<n.length&&n[c]!=="/"&&n[c]!=="?";)c++;let u=n.lastIndexOf("@",c-1);u>=s&&(n=n.slice(0,s)+n.slice(u+1))}let o=n.indexOf("?");if(o<0)return n;let a=n.slice(o+1).split("&").map(s=>{let c=s.indexOf("=");return c>0&&Gn(s.slice(0,c))?`${s.slice(0,c)}=${tt}`:s}).join("&");return`${n.slice(0,o)}?${a}`}var Kn=`
3
+ \r\f\v"'\`<>()[]{}|\\^`;function Ne(t){if(typeof t!="string"||t.indexOf("://")<0)return t;let e=t.toLowerCase(),n="",r=0,i=0;for(;;){let o=e.indexOf("http",i);if(o<0)break;let a=e.startsWith("://",o+4)?7:e.startsWith("s://",o+4)?8:0;if(!a){i=o+4;continue}let s=o+a;for(;s<t.length&&Kn.indexOf(t[s])<0;)s++;n+=t.slice(r,o)+H(t.slice(o,s)),r=i=s}return n+t.slice(r)}function Ue(t){return/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?H(t):t}var he=200*1024,I=(t,e)=>t==null?void 0:b(y(t),e),jt=t=>typeof t=="number"&&isFinite(t)&&t>0?Math.floor(t):void 0,L=t=>!!t&&typeof t=="object";function je(t,e,n){for(let[r,i]of n)e[r]!=null&&(t[r]=I(e[r],i));return t}var Vn=[["lang",32],["filename",l.MAX_FILENAME],["abs_path",l.MAX_FILENAME],["function",l.MAX_FUNCTION],["module",l.MAX_FUNCTION],["chunk_id",128],["context_line",l.MAX_CONTEXT_LINE]],Dt=(t,e,n)=>t.slice(e,n).map(r=>I(r,l.MAX_CONTEXT_LINE)||"");function Yn(t){let e=je({platform:I(t.platform,32)},t,Vn);e.filename&&(e.filename=Ue(e.filename)),e.abs_path&&(e.abs_path=Ue(e.abs_path));let n=jt(t.lineno),r=jt(t.colno);return n&&(e.lineno=n),r&&(e.colno=r),typeof t.in_app=="boolean"&&(e.in_app=t.in_app),Array.isArray(t.pre_context)&&(e.pre_context=Dt(t.pre_context,-l.MAX_CONTEXT_LINES)),Array.isArray(t.post_context)&&(e.post_context=Dt(t.post_context,0,l.MAX_CONTEXT_LINES)),typeof t.resolved=="boolean"&&(e.resolved=t.resolved),e}function Qn(t){let e={type:I(t.type,64)||"generic",handled:t.handled!==!1};typeof t.synthetic=="boolean"&&(e.synthetic=t.synthetic),t.source!=null&&(e.source=I(t.source,64));for(let n of["exception_id","parent_id"]){let r=t[n];typeof r=="number"&&r>=0&&r<1e3&&(e[n]=Math.floor(r))}return e}function Jn(t,e){let n={type:I(t.type,l.MAX_TYPE)||"Error",value:Ne(I(t.value,l.MAX_VALUE)||"")};t.module!=null&&(n.module=I(t.module,l.MAX_TYPE)),L(t.mechanism)&&(n.mechanism=Qn(t.mechanism));let r=t.stacktrace&&t.stacktrace.frames;if(Array.isArray(r)&&r.length){let i=e>>1,o=r.length>e?[...r.slice(0,i),...r.slice(-(e-i))]:r;n.stacktrace={type:"raw",frames:o.filter(L).map(Yn)}}return n}var Zn=["url","from","to"];function er(t){let e=Ae(t);e.message&&(e.message=Ne(e.message));let n=e.data;if(n)for(let r of Zn)typeof n[r]=="string"&&(n[r]=H(n[r]));return e}function tr(t){let e=[];for(let i of t.slice(-l.MAX_BREADCRUMBS))try{L(i)&&e.push(er(i))}catch(o){}let n=e.map(i=>x(k(i))+1),r=n.reduce((i,o)=>i+o,2);for(;e.length&&r>l.MAX_BREADCRUMB_BYTES;)r-=n[0],e=e.slice(1),n=n.slice(1);return e}function Xt(t,e){if(!L(t))return;let n=j(t,e);return L(n)&&!Array.isArray(n)&&Object.keys(n).length?n:void 0}function Ft(t){let e=Array.isArray(t.exception_list)?t.exception_list.filter(L).slice(0,l.MAX_EXCEPTIONS):[],n={event_id:I(t.event_id,64)||"",timestamp:_(t.timestamp,Date.now()),platform:I(t.platform,32),level:D(t.level)?t.level:"error",exception_list:e.map(s=>Jn(s,l.MAX_FRAMES))};n.exception_list.length||(n.exception_list=[{type:"Error",value:""}]),je(n,t,[["fingerprint",l.MAX_FINGERPRINT],["release",l.MAX_RELEASE],["environment",l.MAX_ENVIRONMENT],["client_token",2048],["user_agent",512],["server_name",256]]),typeof t.session_id=="string"&&X.test(t.session_id)&&(n.session_id=t.session_id);let r=(s,c)=>{let u=t[s];if(!L(u))return;let d=je({},u,c);Object.keys(d).length&&(n[s]=d)};r("user",[["id",256],["email",256],["name",256],["hash",256]]),r("request",[["url",l.MAX_URL],["method",16],["route",l.MAX_URL],["referrer",l.MAX_URL]]),r("trace",[["trace_id",64],["span_id",64]]),n.request&&(n.request.url&&(n.request.url=b(H(n.request.url),l.MAX_URL)),n.request.referrer&&(n.request.referrer=b(H(n.request.referrer),l.MAX_URL)));let i=L(t.tags)?Z(t.tags,1):void 0;if(L(i)){let s={},c=0;for(let u of Object.keys(i)){if(c++>=l.MAX_TAGS)break;s[b(u,l.MAX_TAG_KEY)]=I(i[u],l.MAX_TAG_VALUE)||""}c&&(n.tags=s)}let o=Xt(t.extra,l.MAX_EXTRA_BYTES);o&&(n.extra=o);let a=Xt(t.contexts,l.MAX_EXTRA_BYTES);if(a){let s={};for(let c of Object.keys(a)){let u=a[c];L(u)&&!Array.isArray(u)&&(s[c]=u)}Object.keys(s).length&&(n.contexts=s)}if(Array.isArray(t.breadcrumbs)&&t.breadcrumbs.length){let s=tr(t.breadcrumbs);s.length&&(n.breadcrumbs=s)}return nr(n)}function nr(t){let e=()=>x(k(t));if(e()<=he)return t;for(let n of t.exception_list)for(let r of n.stacktrace?n.stacktrace.frames:[])delete r.pre_context,delete r.post_context;if(e()<=he)return t;for(let n of t.exception_list)n.stacktrace&&(n.stacktrace.frames=n.stacktrace.frames.slice(0,20));return e()<=he||(delete t.extra,delete t.contexts,delete t.breadcrumbs,e()<=he)||(t.exception_list=t.exception_list.slice(0,1)),t}var Wt=30,ir=1e4,$t=1e3,qt={},or={"rate limited":"rate limit per error (10, then 1 per 10 s)","per-minute budget":"maxEventsPerMinute","lifetime cap":"maxEventsPerLifetime"},sr=6e4,ar=/^(?:<anonymous>|\[native code\]|native)$/,ye=class{constructor(e){this.integrations=[];this.state="idle";this.remote=null;this.remoteReady=Promise.resolve();this.pending=[];this.inflight=new Set;this.drops={};let n={...e,host:(e.host||Ze).replace(/\/+$/,"")};this.options=n,this.logger=oe(!!n.debug);let r=(i,o)=>typeof i=="number"&&i>=0?i:o;this.limiter=new me({lifetimeCap:r(n.maxEventsPerLifetime,r(n.defaultMaxEventsPerLifetime,100)),perMinute:r(n.maxEventsPerMinute,n.defaultMaxEventsPerMinute)}),this.transport=n.transport({host:n.host,workspaceKey:n.workspaceKey,timeoutMs:n.requestTimeoutMs}),this.queue=new pe({transport:this.transport,envelope:i=>this.envelope(i),logger:this.logger,maxQueueSize:_(n.maxQueueSize,_(n.defaultMaxQueueSize,100)),flushInterval:_(n.flushInterval,1e3),failurePauseMs:n.failurePauseMs,onDisable:()=>this.shutdown("key refused"),gate:this.configGate()})}init(e){return S(this.logger,"init",()=>{if(this.state!=="idle")return;if(!this.options.workspaceKey||typeof this.options.workspaceKey!="string"){this.logger.warn("no workspaceKey"),this.state="disabled";return}if(this.options.enabled===!1){this.state="disabled";return}this.state="active",this.options.maxBreadcrumbs!==void 0&&Te().breadcrumbs.setMaxItems(_(this.options.maxBreadcrumbs,50)),this.options.user&&Te().setUser({...this.options.user,...this.options.userHash?{hash:this.options.userHash}:{}}),this.loadRemoteConfig();let n=new Map;for(let r of e)r&&r.name&&n.set(r.name,r);for(let r of n.values())try{r.setup&&r.setup(this),this.integrations.push(r)}catch(i){this.logger.warn(r.name,i)}this.logger.log("started")},void 0),this}isEnabled(){return this.state==="active"&&!this.queue.isDisabled}getIntegration(e){return this.integrations.find(n=>n.name===e)}getSessionId(){return S(this.logger,"session",()=>{let e=this.options.getSessionId;return e&&e()},void 0)}getRemoteConfig(){return this.remote}captureException(e,n,r){let i=cr(e)?new Error:void 0;return this.capture(e,n,r,i,!1)}captureMessage(e,n,r,i){let o=new Error;return this.capture(e,r,i,o,!0,n)}captureEvent(e,n,r){return S(this.logger,"capture",()=>{let i=e&&typeof e.event_id=="string"&&e.event_id||V();if(!this.isEnabled()||!e||typeof e!="object")return i;let o={...this.baseEvent(i,D(e.level)?e.level:"error"),...e,event_id:i};return Array.isArray(o.exception_list)||(o.exception_list=[]),this.process(o,zt(n),r),i},"")}addBreadcrumb(e,n,r){S(this.logger,"breadcrumb",()=>{if(this.state==="closed"||this.state==="disabled"||!e||typeof e!="object")return;let i={...e,timestamp:e.timestamp||Date.now()};this.options.beforeBreadcrumb&&(i=this.options.beforeBreadcrumb(i,n)),i&&(r||C()).addBreadcrumb(i)},void 0)}hasPending(){return this.pending.length>0||this.inflight.size>0||this.queue.size>0||this.queue.isSending}async flush(e,n=!1){try{let r=Math.max(0,_(e,2e3)),i=Date.now();n&&(this.release(),this.queue.flush(r,!0));let o,a=new Promise(s=>o=setTimeout(s,r));try{!this.remote&&this.state==="active"&&!n&&await Promise.race([this.remoteReady,a]),this.inflight.size&&await Promise.race([Promise.all(this.inflight),a])}finally{clearTimeout(o)}return await this.queue.flush(Math.max(0,r-(Date.now()-i)),n)}catch(r){return this.logger.warn("flush failed",r),!1}}resume(){S(this.logger,"resume",()=>this.queue.resume(),void 0)}async close(e){try{this.teardown();let n=this.state==="active"?await this.flush(e):!0;return this.state="closed",this.queue.disable(),n}catch(n){return this.logger.warn("close failed",n),!1}}capture(e,n,r,i,o,a){try{let s=zt(n),c=s.syntheticException;if(!o){let m=ee(e)||ee(ht(e));if(m)return m}let u=V();if(!this.isEnabled())return u;o||gt(e,u);let d=mt(o?y(e):e,{type:o?"message":"generic",handled:!0,...s.mechanism},this.buildContext(c||i,c?_(s.syntheticSkip,0):1)),f=this.baseEvent(u,o?D(a)?a:"info":D(s.level)?s.level:"error");return f.exception_list=d.exceptions,o?d.exceptions[0].type="Message":d.serialized!==void 0&&(f.extra={__serialized__:d.serialized}),this.process(f,{...s,originalException:e},r),u}catch(s){return this.logger.warn("capture failed",s),""}}buildContext(e,n){let r=this.options,i;try{i=e&&typeof e.stack=="string"?e.stack:void 0}catch(o){}return{parser:r.stackParser,framePlatform:r.framePlatform,isInApp:r.isInApp,synthetic:i?{stack:i,skip:n}:void 0}}baseEvent(e,n){return{event_id:e,timestamp:Date.now(),platform:this.options.platform,level:n,exception_list:[]}}envelope(e){return{v:1,workspace:this.options.workspaceKey,sdk:{name:this.options.sdkName,version:this.options.sdkVersion||M},sent_at:Date.now(),events:e}}process(e,n,r){let i=this.options;if(!e.release){let c=i.release||at();c&&(e.release=c)}if(i.environment&&!e.environment&&(e.environment=i.environment),!e.session_id){let c=this.getSessionId();c&&(e.session_id=c)}(r||xt()).applyToEvent(e),n.tags&&(e.tags={...e.tags,...n.tags}),n.extra&&(e.extra={...e.extra,...n.extra}),n.contexts&&(e.contexts={...e.contexts,...n.contexts}),n.fingerprint&&(e.fingerprint=y(n.fingerprint));let a=e;for(let c of this.integrations)if(c.processEvent){try{a=c.processEvent(a,n,this)}catch(u){this.logger.warn(c.name,u)}if(!a){this.logger.log("dropped",c.name);return}}let s=this.localFilter(a);if(s){this.logger.log("dropped",s);return}if(!this.remote){this.pending.length<Wt?this.pending.push([a,n]):this.logger.alert("pending",`events dropped: over ${Wt} before the remote config`);return}this.finish(a,n)}localFilter(e){let n=this.options,r=e.exception_list[0],i=n.ignoreErrors||[],o=n.allowUrls||[],a=n.denyUrls||[];if(i.length&&r){let s=r.value||"";if(Y(`${r.type}: ${s}`,i)||Y(s,i))return"ignoreErrors"}if(o.length||a.length){let s=ur(e);if(s&&Y(s,a))return"denyUrls";if(s&&o.length&&!Y(s,o))return"allowUrls"}return null}finish(e,n){let r=this.remote||ge;if(!this.isEnabled()||!r.enabled)return;if(Nt(e,r.suppress))return this.logger.log("dropped","suppress");let i=Math.min(1,Math.max(0,_(this.options.sampleRate,1)))*r.sample_rate;if(i<1&&Math.random()>=i)return this.logger.log("dropped","sample");let o=e.exception_list[0],a=Pt(o&&o.type,o&&o.value,o&&o.stacktrace?o.stacktrace.frames[0]:void 0),s=this.limiter.peek(a);if(s)return this.limitDrop(s,a);let c=f=>{if(!f||typeof f!="object"||!Array.isArray(f.exception_list))return this.logger.log("dropped","beforeSend");if(!this.isEnabled())return;let m=this.limiter.check(a);if(m)return this.limitDrop(m,a);this.queue.add(Ft(f))},u=this.options.beforeSend;if(!u)return c(e);let d;try{d=u(e,n)}catch(f){this.logger.warn("beforeSend",f);return}if(lt(d)){if(this.inflight.size>=$t){this.logger.alert("inflight",`events dropped: ${$t} async beforeSend calls pending`);return}let f,m=Math.max(0,_(this.options.beforeSendTimeoutMs,5e3)),p=new Promise(P=>{f=setTimeout(()=>P(qt),m),B(f)}),g=Promise.race([d,p]).then(P=>{if(clearTimeout(f),P===qt)return this.logger.alert("beforeSend",`event dropped: beforeSend did not settle in ${m} ms`);S(this.logger,"enqueue",()=>c(P),void 0)},P=>{clearTimeout(f),this.logger.warn("beforeSend",P)}),v=()=>this.inflight.delete(g);this.inflight.add(g),g.then(v,v)}else c(d)}limitDrop(e,n){this.logger.log("dropped",e,n);let r=this.drops[e]||(this.drops[e]={at:0,n:0});r.n++;let i=Date.now();r.at&&i-r.at<sr||(this.notice(`events dropped by ${or[e]}: ${r.n} ${r.at?`in ${Math.round((i-r.at)/1e3)} s`:"so far"}${e==="rate limited"?`, latest "${b(n,160)}"`:""}`),r.at=i,r.n=0)}notice(...e){_e(...e)}configGate(){}loadRemoteConfig(){if(this.options.remoteConfig===!1||!this.transport.fetchConfig)return this.applyRemoteConfig(ge);this.remoteReady=this.readConfig(ir,e=>this.applyRemoteConfig(e))}readConfig(e,n){return new Promise(r=>{let i=!1,o=s=>{i||(i=!0,clearTimeout(a),S(this.logger,"config",()=>n(Bt(s)),void 0),r())},a=setTimeout(()=>o(null),e);B(a);try{Promise.resolve(this.transport.fetchConfig()).then(o,s=>{this.logger.warn("config",s),o(null)})}catch(s){this.logger.warn("config",s),o(null)}})}release(){if(this.remote||!this.pending.length)return;let e=this.pending;this.pending=[];for(let[n,r]of e)S(this.logger,"capture",()=>this.finish(n,r),void 0)}applyRemoteConfig(e){this.remote=e;let n=this.pending;if(this.pending=[],!e.enabled){this.logger.log("config: disabled"),this.shutdown("config");return}for(let[r,i]of n)S(this.logger,"capture",()=>this.finish(r,i),void 0)}shutdown(e){this.state==="disabled"||this.state==="closed"||(this.logger.log("off",e),this.state="disabled",this.pending=[],this.queue.disable(),this.teardown())}teardown(){for(let e of this.integrations.splice(0).reverse())try{e.teardown&&e.teardown()}catch(n){this.logger.warn(e.name,n)}}};function zt(t){try{let e={...t};for(let n of["mechanism","tags","extra","contexts","data"])e[n]&&typeof e[n]=="object"&&(e[n]={...e[n]});return e.syntheticException&&!A(e.syntheticException)&&delete e.syntheticException,e}catch(e){return{}}}function cr(t){try{return!A(t)&&!O(t)}catch(e){return!1}}function ur(t){for(let e of t.exception_list)for(let n of e.stacktrace?e.stacktrace.frames:[])if(n.filename&&!ar.test(n.filename))return n.filename}function dr(t){let e=[t.fingerprint||"",JSON.stringify([t.user,t.session_id])];for(let n of t.exception_list){e.push(n.type,n.value);for(let r of n.stacktrace?n.stacktrace.frames:[])e.push(`${r.filename}|${r.function}|${r.lineno}|${r.colno}`)}return e.join(`
4
+ `)}function Ht(t={}){let e,n;return{name:"Dedupe",processEvent(r){let i=dr(r),o=t.requestKey&&t.requestKey();return i===e&&o===n?null:(e=i,n=o,r)},teardown(){e=void 0,n=void 0}}}var Gt=/^(.*?):(\d+)(?::(\d+))?$/;function Kt(t){let e=Gt.exec(t);return e?{filename:e[1]||void 0,lineno:+e[2],colno:e[3]?+e[3]:void 0}:{filename:t||void 0}}function N(t,e){let n={};return e.filename&&(n.filename=e.filename),t&&t!=="<anonymous>"&&t!=="?"&&(n.function=t),e.lineno&&(n.lineno=e.lineno),e.colno&&(n.colno=e.colno),n}var fr=/^\s*at (?:(.+?) \((.+)\)|(.+))\s*$/,lr=/\((\S+?):(\d+):(\d+)\)/,Vt=t=>{let e=fr.exec(t);if(!e)return;let n=e[1],r=(e[2]||e[3]||"").trim();if(!n&&/^async /.test(r)&&(r=r.slice(6)),n&&(n=n.replace(/^async /,"")),/^eval at /.test(r)){let i=lr.exec(r);return i?N(n,{filename:i[1],lineno:+i[2],colno:+i[3]}):N(n,{filename:"<anonymous>"})}return/^data:/.test(r)?N(n,{filename:"<data:"+r.slice(5,r.indexOf(",")>0?r.indexOf(","):40)+">"}):/^index \d+$/.test(r)?N(n,{}):N(n,Kt(r))},pr=/^(.*?) line (\d+)(?: > [A-Za-z]+(?: line \d+)?)* > (?:eval|Function)/,mr=t=>{let e=t.trim();if(!e)return;let n=e.indexOf("@"),r=n>=0?e.slice(0,n):void 0,i=n>=0?e.slice(n+1):e;if(n<0&&!Gt.test(i)&&i!=="[native code]")return;r&&(r=r.replace(/^async\*/,""));let o=pr.exec(i);return o?N(r||"eval",{filename:o[1],lineno:+o[2]}):i==="[native code]"?N(r,{filename:"[native code]"}):N(r,Kt(i))};function Yt(t=Vt,e=mr){return(n,r=0)=>{let i=[];if(typeof n!="string"||!n)return i;let o=n.split(`
5
+ `),a=o.some(s=>/^\s*at /.test(s));for(let s of o){if(i.length>=1e3+r)break;let c=s.replace(/\r$/,"");if(c.length>2048||a&&!/^\s*at /.test(c))continue;let u=(a?t:e)(c);u&&(u.filename||u.function)&&i.push(u)}return i.slice(r)}}var Qt=Yt(),Ui=Yt(Vt,()=>{});var te=t=>t.indexOf(F.INGEST)>=0||t.indexOf(F.CONFIG)>=0;var Jt={warn:"warning",error:"error"},gr=".starko-mask,[data-starko-mask],.starko-no-capture,[data-starko-no-capture]";function hr(t){let e=[],n=t;try{for(let i=0;n&&n.nodeType===1&&i<5;i++){let o=n.tagName.toLowerCase();n.id&&(o+=`#${n.id}`);let a=typeof n.className=="string"?n.className.trim().split(/\s+/).filter(s=>s&&/^[\w-]+$/.test(s)):[];for(let s of a.slice(0,2))o+=`.${s}`;for(let s of["type","name","role","data-testid"]){let c=n.getAttribute(s);c&&(o+=`[${s}="${b(c,30)}"]`)}if(e.unshift(o),n.id)break;n=n.parentElement}}catch(i){}let r=e.join(" > ");return r.length>120?"\u2026"+r.slice(r.length-119):r||"<unknown>"}var yr=t=>!t||t>=500?"error":t>=400?"warning":void 0;function Zt(t){if(!t)return t;try{let e=new URL(t,location.href);return e.origin===location.origin?e.pathname+e.search+e.hash:e.href}catch(e){return t}}function en(t={}){let e=[];return{name:"Breadcrumbs",setup(n){if(typeof window=="undefined")return;let r=!1,i=a=>{if(!r){r=!0;try{n.addBreadcrumb(a)}catch(s){}finally{r=!1}}},o=(a,s,c,u,d)=>i({timestamp:Date.now(),type:"http",category:a,level:d!==void 0?"error":yr(u),data:{method:s,url:b(c,2048),...d!==void 0?{error:b(y(d instanceof Error?d.message:d),200)}:{status_code:u}}});if(t.console!==!1&&typeof console!="undefined")for(let a of Object.keys(Jt))e.push(R(console,a,(s,c)=>{if(c[0]===W)return;let u=c.map(d=>typeof d=="string"?d:k(Z(d,2))).join(" ");i({timestamp:Date.now(),type:"console",category:"console",level:Jt[a],message:b(u,200)})}));if(t.dom!==!1&&typeof document!="undefined"){let a=s=>{try{let c=s.target;if(c&&typeof c.closest=="function"&&c.closest(gr))return;i({timestamp:Date.now(),type:"ui",category:"click",message:hr(c)})}catch(c){}};document.addEventListener("click",a,{capture:!0,passive:!0}),e.push(()=>document.removeEventListener("click",a,{capture:!0}))}if(t.fetch!==!1&&e.push(R(window,"fetch",(a,s)=>{let c=s[0],u=s[1],d=typeof c=="string"?c:c instanceof URL?c.href:String(c&&c.url||""),f=String(u&&u.method||(c&&typeof c=="object"&&"method"in c?c.method:"GET")).toUpperCase();if(!te(d))return m=>{let p=m;p&&typeof p.then=="function"&&p.then(g=>o("fetch",f,d,g.status),g=>o("fetch",f,d,0,g))}})),t.xhr!==!1&&typeof XMLHttpRequest=="function"){let a=XMLHttpRequest.prototype,s=new WeakMap;e.push(R(a,"open",(c,u)=>{s.set(c,[String(u[0]).toUpperCase(),String(u[1])])}),R(a,"send",c=>{let u=s.get(c);if(!u||te(u[1]))return;let d=c;d.addEventListener("loadend",()=>o("xhr",u[0],u[1],d.status))}))}if(t.history!==!1&&typeof history!="undefined"&&typeof location!="undefined"){let a=location.href,s=u=>{try{let d=u===void 0?location.href:new URL(String(u),location.href).href;if(d===a)return;i({timestamp:Date.now(),type:"navigation",category:"navigation",data:{from:Zt(a),to:Zt(d)}}),a=d}catch(d){}};for(let u of["pushState","replaceState"])e.push(R(history,u,(d,f)=>f[2]!=null?()=>s(f[2]):void 0));let c=()=>s(void 0);window.addEventListener("popstate",c),e.push(()=>window.removeEventListener("popstate",c))}},teardown(){for(let n of e.splice(0))try{n()}catch(r){}}}}function tn(t={}){let e=[],n={name:"GlobalHandlers",captures:!1,setup(r){if(typeof window=="undefined"||typeof window.addEventListener!="function")return;let i=(o,a)=>{let s=c=>{try{a(c)}catch(u){r.logger.warn(`${o} handler failed`,u)}};window.addEventListener(o,s),e.push(()=>window.removeEventListener(o,s))};t.onerror!==!1&&(i("error",o=>{let a=o;typeof a.message!="string"&&a.error==null||r.captureException(a,{mechanism:{type:"onerror",handled:!1},data:{event:a}})}),n.captures=!0),t.onunhandledrejection!==!1&&i("unhandledrejection",o=>{r.captureException(o,{mechanism:{type:"onunhandledrejection",handled:!1},data:{event:o}})})},teardown(){n.captures=!1;for(let r of e.splice(0))r();Be()}};return n}function nn(){return{name:"HttpContext",processEvent(t){if(typeof location=="undefined")return t;let e={...t.request};!e.url&&location.href&&(e.url=location.href);try{!e.referrer&&typeof document!="undefined"&&document.referrer&&(e.referrer=document.referrer)}catch(n){}return t.request=e,t}}}var be="x-starko-session-id";function rn(){let t=[];return{name:"SessionPropagation",setup(e){if(typeof window=="undefined"||typeof location=="undefined")return;let n=o=>{let a=new URL(String(o),typeof document!="undefined"&&document.baseURI||location.href);return a.origin===location.origin&&!te(a.href)&&e.isEnabled()&&e.getSessionId()||""};if(t.push(R(window,"fetch",(o,a)=>{let s=a[0],c=a[1],u=typeof Request=="function"&&s instanceof Request?s:void 0,d=n(u?u.url:s),f=d&&new Headers(c&&c.headers||u&&u.headers);f&&!f.has(be)&&(f.set(be,d),a[1]={...c,headers:f})})),typeof XMLHttpRequest!="function")return;let r=new WeakMap,i=XMLHttpRequest.prototype;t.push(R(i,"open",(o,a)=>{r.delete(o),r.set(o,n(a[1]))}),R(i,"send",o=>{let a=r.get(o);a&&o.setRequestHeader(be,a)}))},teardown(){for(let e of t.splice(0))e()}}}var on="starko:errors:session",G;function sn(){if(G)return G;try{let t=sessionStorage.getItem(on);if(t&&X.test(t))return G=t}catch(t){}G=V();try{sessionStorage.setItem(on,G)}catch(t){}return G}var an=60*1024,br=12e3;function cn(){try{let t=re(globalThis,"fetch");return typeof t=="function"?t.bind(globalThis):void 0}catch(t){return}}var Er=cn();function kr(t,e=Date.now()){if(!t)return;let n=Number(t);if(!isNaN(n))return Math.max(0,n);let r=Date.parse(t);return isNaN(r)?void 0:Math.max(0,Math.ceil((r-e)/1e3))}function xr(t){let e=n=>n===401||n===403?6:n===413?5:n===429?4:n===0||n>=500?3:n>=400?2:1;return t.reduce((n,r)=>e(r.status)>e(n.status)?r:n,{status:200})}function wr(t,e){let n=x(k({...t,events:[]})),r=[],i={...t,events:[]},o=n;for(let a of t.events){let s=x(k(a))+1;i.events.length&&o+s>e&&(r.push({env:i,bytes:o}),i={...t,events:[]},o=n),i.events.push(a),o+=s}return i.events.length&&r.push({env:i,bytes:o}),r}function un(t){let e=t.host.replace(/\/+$/,""),n=Math.max(1,_(t.timeoutMs,br)),r=()=>t.fetchImpl||Er||cn(),i=0,o=(s,c)=>{let u=r();if(!u)return Promise.resolve(s);let d;try{d=new AbortController}catch(g){}let f,m;try{m=c(u,d&&d.signal).catch(()=>s)}catch(g){m=Promise.resolve(s)}let p=new Promise(g=>{f=setTimeout(()=>{try{d&&d.abort()}catch(v){}g(s)},n),B(f)});return Promise.race([m,p]).then(g=>(clearTimeout(f),g))},a=(s,c)=>o({status:0},async(u,d)=>{var p,g;let f=await u(e+F.INGEST,{method:"POST",body:s,headers:{"Content-Type":"text/plain;charset=UTF-8"},keepalive:c,credentials:"omit",redirect:"manual",signal:d}),m={status:f.type==="opaqueredirect"?302:f.status};try{m.retryAfter=kr(f.headers.get("Retry-After"))}catch(v){}if(m.status>=400)try{let v=(g=(p=await f.json())==null?void 0:p.data)==null?void 0:g.reason;typeof v=="string"&&(m.reason=v)}catch(v){}return m});return{async send(s,c={}){if(!c||!c.keepalive)return a(k(s),!1);let u=await Promise.all(wr(s,an).map(({env:d,bytes:f})=>{let m=i+f<=an;return m&&(i+=f),a(k({...d,sent_at:Date.now()}),m).then(p=>(m&&(i-=f),p))}));return xr(u)},fetchConfig(){return o(null,async(s,c)=>{let u=await s(`${e}${F.CONFIG}?workspace=${encodeURIComponent(t.workspaceKey)}`,{method:"GET",credentials:"omit",redirect:"manual",signal:c});if(u.type==="opaqueredirect"||u.status>=300&&u.status<400)return null;let d=await u.json(),f=d&&typeof d=="object"?d.data:null;return f&&typeof f=="object"?f:null})}}}function Sr(){return[Ct(),Ht(),tn(),en(),nn(),At(),rn(),le({whenWidget:!0})]}var _r=/^(?:<anonymous>|\[native code\]|native|<data:.*|(?:chrome|moz|safari|safari-web|ms-browser)-extension:.*)$/i;function vr(t){return!t||_r.test(t)||/\/node_modules\//.test(t)?!1:void 0}function Rr(){let t=[];return{name:"FlushOnHide",setup(e){if(typeof window=="undefined"||typeof document=="undefined")return;let n=a=>()=>{try{a()}catch(s){}},r=n(()=>{e.flush(2e3,!0)}),i=n(()=>document.visibilityState==="hidden"&&r()),o=n(()=>e.resume());window.addEventListener("pagehide",r),window.addEventListener("online",o),document.addEventListener("visibilitychange",i),t.push(()=>window.removeEventListener("pagehide",r),()=>window.removeEventListener("online",o),()=>document.removeEventListener("visibilitychange",i))},teardown(){for(let e of t.splice(0))e()}}}function De(t){try{let e=E();e&&e.close(0);let n=t.defaultIntegrations===!1?[]:Array.isArray(t.defaultIntegrations)?t.defaultIntegrations:Sr(),r;typeof t.integrations=="function"?r=t.integrations(n):r=[...n,...t.integrations||[]],r.some(a=>a&&a.name==="FlushOnHide")||r.push(Rr());let i,o=()=>!!i.getIntegration("WidgetBridge");return i=new ye({...t,platform:"browser",framePlatform:"web:javascript",sdkName:"starko.browser",stackParser:Qt,isInApp:vr,getSessionId:()=>o()&&Rt()||sn(),defaultMaxEventsPerLifetime:100,transport:t.transport||un}),Et(i),i.init(r),i}catch(e){try{t&&t.debug&&console.warn("[starko] init failed",e)}catch(n){}return}}var dn=()=>{let t=E();return t&&t.logger},Ar=(t,e)=>{let n=dn();n&&n.warn(t,e)},T=(t,e)=>S(dn(),"API call",t,e),fn=t=>S(void 0,"",()=>t&&typeof t=="object"?{...t}:{},{});function Xe(t,e){let n;try{!(e&&e.syntheticException)&&!A(t)&&!O(t)&&(n=new Error)}catch(r){}return T(()=>{let r=z(E(),"captureException");if(!r)return"";let i=fn(e);return r(t,n?{...i,syntheticException:n,syntheticSkip:1}:i)},"")}function Fe(t,e){let n=new Error;return T(()=>{let r=z(E(),"captureMessage");if(!r)return"";let i=fn(e),o=typeof e=="string"?e:i.level||"info";return r(y(t),o,{...i,syntheticException:n,syntheticSkip:1})},"")}function We(t){T(()=>{let e=t&&typeof t=="object"?t:null,n=Ie(e);n&&n.setUser(e)},void 0)}function $e(t,e){T(()=>{let n=typeof t=="string"?{id:t}:{...t};e&&(n.hash=e);let r=Ie(n);r&&r.setUser(n)},void 0)}function qe(t,e){T(()=>{C().setTag(t,e)},void 0)}function ze(t){T(()=>{C().setTags(t)},void 0)}function He(t,e){T(()=>{C().setExtra(t,e)},void 0)}function Ge(t){T(()=>{C().setExtras(t)},void 0)}function Ke(t,e){T(()=>{C().setContext(t,e)},void 0)}function Ve(t,e){T(()=>{let n={timestamp:Date.now(),type:"custom",...t},r=z(E(),"addBreadcrumb");r?r(n,e):C().addBreadcrumb(n)},void 0)}function Ye(t){if(typeof t!="function")return;let e=!1;try{return kt(n=>(e=!0,t(n)))}catch(n){if(e)throw n;return Ar("withScope failed",n),t(C())}}function Qe(t){return T(()=>{let e=E(),n=z(e,"flush");return n?n(t):Promise.resolve(!e)},Promise.resolve(!1))}function Je(t){return T(()=>{let e=E(),n=z(e,"close");return n?n(t):Promise.resolve(!e)},Promise.resolve(!1))}function Tr(){let t=e=>document.querySelector(`script[data-workspace-key]${e}`);return document.currentScript||t('[src*="starko" i]')||t("")}(()=>{try{if(typeof document=="undefined")return;let t=Tr();if(!t)return;Ot(t.src);let e=t.getAttribute("data-workspace-key");if(!e)return;De({workspaceKey:e,release:t.getAttribute("data-release")||void 0,environment:t.getAttribute("data-environment")||void 0,host:t.getAttribute("data-host")||void 0,debug:t.hasAttribute("data-debug")})}catch(t){}})();return bn(Ir);})();
6
+ try{globalThis.Starko===void 0&&(globalThis.Starko=Starko)}catch(e){}