@steadphast/connector-nextjs 0.7.0 → 0.7.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.
- package/README.md +21 -18
- package/dist/behavioral-collector.d.ts +2 -1
- package/dist/config.d.ts +7 -0
- package/dist/index.js +23 -4
- package/dist/page-probes.d.ts +27 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +165 -29
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -10,14 +10,11 @@ The package is one connector with two modes: **Next.js on Vercel** (`kind: "verc
|
|
|
10
10
|
**Next.js self-hosted** (`kind: "self-hosted"`).
|
|
11
11
|
|
|
12
12
|
The optional App Router `DiscoverCollector` component has independent T0 and Family C controls.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
defaults false and needs both the site and the workspace switch. See
|
|
19
|
-
[Family C own collection](#family-c-own-collection-unreleased); this is not a claim that the
|
|
20
|
-
published 0.6.0 artifact already contains Family C.
|
|
13
|
+
Family C requires API enablement, workspace policy and an exact nonsensitive route. Own mode
|
|
14
|
+
is not visitor permission: affirmative consent is the default. A no-prompt `notice` basis
|
|
15
|
+
applies only where Steadphast has recorded it for the workspace and `behavioral.consentBasis`
|
|
16
|
+
is also `"notice"`. Timing defaults false and needs both the site and the workspace switch.
|
|
17
|
+
See [Family C own collection](#family-c-own-collection).
|
|
21
18
|
|
|
22
19
|
```text
|
|
23
20
|
Visitor / bot Your Next.js deployment Steadphast
|
|
@@ -414,6 +411,7 @@ type DiscoverNextConfig = (
|
|
|
414
411
|
| `recordIdPrefix` | No | A short label that prefixes the record IDs Steadphast assigns, useful for telling deployments apart. Defaults to `vercel-routing-middleware` or `nextjs-self-hosted`. Limit: 128 UTF-8 bytes. A longer value is not rejected at startup but makes every capture drop silently. |
|
|
415
412
|
| `timeoutMs` | No | Delivery timeout in milliseconds. Defaults to `5000`. |
|
|
416
413
|
| `collector` | No | T0 remains explicit opt-in with `true`. An explicit `false` also vetoes Family C; leaving it undefined permits independently configured Family C without T0. |
|
|
414
|
+
| `environment.rendering` | No | Enables the site's optional rendering category. It also requires workspace authorization and the server component's `environmentPermitted` prop for this request. Set the prop only on an approved origin and route after checking this visitor's applicable permission server-side; never derive it from a visitor-provided header. Omission or a failed policy check leaves ordinary collection unchanged. |
|
|
417
415
|
| `behavioral` | No | Inert until Steadphast enables the API switch (`BEHAVIORAL_ENABLED` defaults false); until then approved routes only add `no-store` and a policy fetch that answers off. Once enabled: own mode, timing/default-false, exact nonsensitive `routes` required. `off` and `partner` install no own collector. Workspace/API OFF and visitor consent remain independent controls. `consentBasis: "notice"` starts the window without a consent callback only when Steadphast has also set the workspace's audited consent basis to `notice`; the default is `affirmative`. `pathCapture: true` adds click target geometry (no label, text or element identity) to click records, and only when the workspace's path capture setting is also on; default off. |
|
|
418
416
|
|
|
419
417
|
`kind`, `publicOrigin`, `apiUrl`, and the `NEXT_PUBLIC_*` rule for `apiKeyEnvVar` are validated
|
|
@@ -568,11 +566,10 @@ Delivery does not block the visitor response: the connector serializes the recor
|
|
|
568
566
|
changes the response status, headers, or body, and never propagates an error into your composed
|
|
569
567
|
handler.
|
|
570
568
|
|
|
571
|
-
## Family C own collection
|
|
569
|
+
## Family C own collection
|
|
572
570
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
approved route only adds `no-store` delivery and a policy fetch that answers off.
|
|
571
|
+
The API switch `BEHAVIORAL_ENABLED` defaults to false. While it is off, an approved route
|
|
572
|
+
only adds `no-store` delivery and a policy fetch that answers off.
|
|
576
573
|
|
|
577
574
|
After enablement, use the existing `DiscoverCollector` server component on supported uncached Node
|
|
578
575
|
App Router documents and add `behavioral: { routes: ["/catalog"], timing: false }` to its shared
|
|
@@ -643,7 +640,10 @@ of safety. There is no closed-root probing or prototype instrumentation. If you
|
|
|
643
640
|
and mark the boundary, leave that route unapproved or explicitly OFF. Unmarked opaque installs
|
|
644
641
|
are unsupported; workspace own mode is separate from route approval and visitor consent.
|
|
645
642
|
|
|
646
|
-
The API derives a summary in memory and
|
|
643
|
+
The API derives a summary in memory and discards the raw record array. One exception: when
|
|
644
|
+
path capture is enabled for the workspace and approved site, it can retain trusted pointer
|
|
645
|
+
samples, click points and click-target boxes (page-relative geometry, not text or selectors)
|
|
646
|
+
for at most 30 days and never longer than the summary. Pending summaries expire at
|
|
647
647
|
23 hours and attached summaries at 179 days from original receipt; event/subject deletion removes
|
|
648
648
|
linked evidence earlier. Physical purge must remain within the 24-hour/180-day ceilings, including
|
|
649
649
|
outage recovery and lock/pool starvation; the safety margins are one hour and one day, and reader
|
|
@@ -654,7 +654,7 @@ evaluation. Customer install/privacy wording and consent review remain required
|
|
|
654
654
|
|
|
655
655
|
## Optional: the T0 client collector
|
|
656
656
|
|
|
657
|
-
|
|
657
|
+
The optional **T0 client collector** is a small clean-room script, inlined into
|
|
658
658
|
document HTML, that observes browser realms and posts one beacon to `POST /v1/client/t0`.
|
|
659
659
|
The server joins the beacon to its event by the envelope's `record_id_prefix:request_id` identity
|
|
660
660
|
and records `client_environment`; the six client-side flags are derived from that evidence.
|
|
@@ -723,13 +723,13 @@ server-side HMAC path. Missing configuration, missing context and forged context
|
|
|
723
723
|
Visitor endpoint, nonce and enablement headers are never trusted. The component needs the App
|
|
724
724
|
Router (`next/headers`); the Pages Router is not supported. `react` ^19 is a peer for `./server`.
|
|
725
725
|
|
|
726
|
-
The collector observes the main window, a Blob worker, and a sandboxed `srcdoc` iframe, and reports
|
|
726
|
+
The T0 collector in this package version observes the main window, a Blob worker, and a sandboxed `srcdoc` iframe, and reports
|
|
727
727
|
realm cross-checks (a spoofed `navigator` that disagrees across realms), native-function integrity,
|
|
728
728
|
headless and automation markers, a coarse screen/WebGL/feature profile, and interaction *counts*
|
|
729
729
|
(untrusted clicks, whether any trusted input happened). It registers no listener that reads what
|
|
730
730
|
was typed, and it never touches form contents, pointer coordinates, the clipboard, storage,
|
|
731
|
-
cookies,
|
|
732
|
-
|
|
731
|
+
cookies, or any persistent identifier. Its one keepalive `text/plain` POST explicitly uses
|
|
732
|
+
`credentials: "omit"`, with a UTF-8 body capped at 2000 bytes. It sends at
|
|
733
733
|
`DOMContentLoaded` plus a short realm grace, on early exit/backgrounding, or at the 1500 ms cap,
|
|
734
734
|
then removes its listeners, worker, Blob URL and iframe. The bundle is gated below 8 KB gzipped.
|
|
735
735
|
|
|
@@ -802,7 +802,10 @@ verification remains separate.
|
|
|
802
802
|
|
|
803
803
|
## Upgrading
|
|
804
804
|
|
|
805
|
-
- **
|
|
805
|
+
- **0.7.1** adds optional rendering evidence. Installing it does not grant permission:
|
|
806
|
+
`environment.rendering`, server-checked per-visit `environmentPermitted`, and a current
|
|
807
|
+
workspace rendering grant are all required. Without them ordinary T0 is unchanged.
|
|
808
|
+
- **0.7.0** never sends cookie values (only the
|
|
806
809
|
`x-steadphast-cookie-names` marker),
|
|
807
810
|
empties query values in `external_url` except for a request carrying signature headers that
|
|
808
811
|
cover the query, and reduces `Referer` to its origin. See
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { ProbeRunner } from "./page-probes.js";
|
|
1
2
|
/** Stringified after compilation; every runtime dependency lives inside this function. */
|
|
2
|
-
export declare function behavioralCollector(nonce: string, endpoint: string, timing: boolean, issuedAt: number, route: string, notice?: boolean, pathCapture?: boolean): void;
|
|
3
|
+
export declare function behavioralCollector(sdk: ProbeRunner, nonce: string, endpoint: string, timing: boolean, issuedAt: number, route: string, notice?: boolean, pathCapture?: boolean, timingRoute?: "customer-host" | "steadphast-host"): void;
|
|
3
4
|
/** Call from the customer's consent callback; revocation closes this document permanently. */
|
|
4
5
|
export declare function setBehavioralConsent(granted: boolean, revoked?: boolean): void;
|
|
5
6
|
/** Synchronous browser-local OFF: listeners removed and unsent buffers discarded. */
|
package/dist/config.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ export interface DiscoverNextCommonConfig {
|
|
|
29
29
|
* from visitor headers. Disabled requests have no collector output or envelope keys.
|
|
30
30
|
*/
|
|
31
31
|
collector?: boolean;
|
|
32
|
+
/** Optional site authorization, separate from the workspace and per-render permission. */
|
|
33
|
+
environment?: {
|
|
34
|
+
rendering?: boolean;
|
|
35
|
+
};
|
|
32
36
|
/**
|
|
33
37
|
* Family C defaults to own, independently of T0. An explicit collector:false or mode:"off"
|
|
34
38
|
* wins. Only exact approved pathnames are eligible; an empty route list collects nothing.
|
|
@@ -43,6 +47,9 @@ export interface DiscoverNextCommonConfig {
|
|
|
43
47
|
behavioral?: {
|
|
44
48
|
mode?: "own" | "off" | "partner";
|
|
45
49
|
timing?: boolean;
|
|
50
|
+
/** Provenance of the configured Discover receiver, not an extra destination or permission.
|
|
51
|
+
* Defaults to the Steadphast API. Set customer-host for a customer-provisioned receiver hostname. */
|
|
52
|
+
timingRoute?: "customer-host" | "steadphast-host";
|
|
46
53
|
routes?: ReadonlyArray<string>;
|
|
47
54
|
consentBasis?: "affirmative" | "notice";
|
|
48
55
|
pathCapture?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1041,7 +1041,7 @@ function createNonceMinter(apiKey) {
|
|
|
1041
1041
|
context.set(tag, header.byteLength);
|
|
1042
1042
|
return base64UrlNoPad(context);
|
|
1043
1043
|
},
|
|
1044
|
-
async nonceFromRenderContext(context) {
|
|
1044
|
+
async nonceFromRenderContext(context, rendering) {
|
|
1045
1045
|
if (context.length > 850 || !/^[A-Za-z0-9_-]+$/.test(context)) {
|
|
1046
1046
|
return void 0;
|
|
1047
1047
|
}
|
|
@@ -1064,10 +1064,29 @@ function createNonceMinter(apiKey) {
|
|
|
1064
1064
|
concat(utf8(RENDER_CONTEXT_DOMAIN), header)
|
|
1065
1065
|
))
|
|
1066
1066
|
return void 0;
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
let signed = header;
|
|
1068
|
+
if (rendering !== void 0) {
|
|
1069
|
+
const { revision, catalog } = rendering;
|
|
1070
|
+
if (![revision, catalog].every(
|
|
1071
|
+
(n) => Number.isInteger(n) && n >= 0 && n <= 4294967295
|
|
1072
|
+
) || revision === 0)
|
|
1073
|
+
return void 0;
|
|
1074
|
+
const extended = bytes(header.byteLength + 9 + TAG_BYTES);
|
|
1075
|
+
extended.set(header);
|
|
1076
|
+
extended[0] = 2;
|
|
1077
|
+
extended[header.byteLength] = 4;
|
|
1078
|
+
const view = new DataView(extended.buffer);
|
|
1079
|
+
view.setUint32(header.byteLength + 1, revision);
|
|
1080
|
+
view.setUint32(header.byteLength + 5, catalog);
|
|
1081
|
+
decoded = extended;
|
|
1082
|
+
signed = extended.subarray(0, -TAG_BYTES);
|
|
1083
|
+
}
|
|
1084
|
+
decoded.set(
|
|
1085
|
+
new Uint8Array(
|
|
1086
|
+
await crypto.subtle.sign("HMAC", await nonceKey, signed)
|
|
1087
|
+
),
|
|
1088
|
+
signed.byteLength
|
|
1069
1089
|
);
|
|
1070
|
-
decoded.set(tag, header.byteLength);
|
|
1071
1090
|
return base64UrlNoPad(decoded);
|
|
1072
1091
|
}
|
|
1073
1092
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ProbeRoute = "page" | "customer-host" | "steadphast-host" | "steadphast-host-dns-fallback";
|
|
2
|
+
type ProbeModule = "environment" | "behavior" | "device" | "network";
|
|
3
|
+
type Outcome = {
|
|
4
|
+
state: "not-observed";
|
|
5
|
+
value: null;
|
|
6
|
+
} | {
|
|
7
|
+
state: "observed" | "differs";
|
|
8
|
+
value: number;
|
|
9
|
+
};
|
|
10
|
+
type Reading = {
|
|
11
|
+
module: ProbeModule;
|
|
12
|
+
name: string;
|
|
13
|
+
route: ProbeRoute;
|
|
14
|
+
} & Outcome;
|
|
15
|
+
export interface ProbeJob {
|
|
16
|
+
reading: Reading;
|
|
17
|
+
cancel(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface ProbeRunner {
|
|
20
|
+
run(module: ProbeModule, name: string, route: ProbeRoute, permitted: boolean, start: (finish: (value?: number, state?: "observed" | "differs") => void, signal: AbortSignal) => void): ProbeJob;
|
|
21
|
+
}
|
|
22
|
+
/** Stringified into the server-rendered script. The budget covers active work, not time waiting for consent. */
|
|
23
|
+
export declare function createProbeRunner(): ProbeRunner;
|
|
24
|
+
/** One installation per Document, including duplicate tags and bfcache restores. Only a boolean
|
|
25
|
+
* lives on the document; neither credentials, readings nor callable probes are exposed there. */
|
|
26
|
+
export declare function pageScript(invocations: string): string;
|
|
27
|
+
export {};
|
package/dist/server.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { type DiscoverNextConfig } from "./config.js";
|
|
|
8
8
|
export interface DiscoverCollectorProps {
|
|
9
9
|
/** Server-owned tenant settings shared with withDiscover. Missing settings fail closed. */
|
|
10
10
|
config?: DiscoverNextConfig;
|
|
11
|
+
/** Server decision for this visitor, approved origin and route; omission denies. */
|
|
12
|
+
environmentPermitted?: boolean;
|
|
11
13
|
/** Optional server-owned Content Security Policy nonce. Never copied from visitor headers. */
|
|
12
14
|
nonce?: string;
|
|
13
15
|
}
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { headers } from "next/headers";
|
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
|
|
5
5
|
// src/behavioral-collector.ts
|
|
6
|
-
function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice = false, pathCapture = false) {
|
|
6
|
+
function behavioralCollector(sdk, nonce, endpoint, timing, issuedAt, route, notice = false, pathCapture = false, timingRoute = "steadphast-host") {
|
|
7
7
|
let closed = false;
|
|
8
8
|
let started = false;
|
|
9
9
|
let start = 0;
|
|
@@ -56,7 +56,6 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
56
56
|
const inputPosition = [0, 0];
|
|
57
57
|
let forwarded;
|
|
58
58
|
let roundTrip;
|
|
59
|
-
let roundTripWatcher;
|
|
60
59
|
let quantum = null;
|
|
61
60
|
let lastClock;
|
|
62
61
|
const listeners = [];
|
|
@@ -119,8 +118,7 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
119
118
|
listeners.length = 0;
|
|
120
119
|
observer?.disconnect();
|
|
121
120
|
observer = void 0;
|
|
122
|
-
|
|
123
|
-
roundTripWatcher = void 0;
|
|
121
|
+
roundTrip?.cancel();
|
|
124
122
|
instant = [];
|
|
125
123
|
forwarded = void 0;
|
|
126
124
|
records.length = 0;
|
|
@@ -195,7 +193,7 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
195
193
|
other_activation_position: otherPosition,
|
|
196
194
|
input_position: inputPosition
|
|
197
195
|
},
|
|
198
|
-
...roundTrip ===
|
|
196
|
+
...roundTrip?.reading.state === "observed" ? { page_round_trip_ms: roundTrip.reading.value } : {}
|
|
199
197
|
};
|
|
200
198
|
const body = JSON.stringify(payload);
|
|
201
199
|
discard();
|
|
@@ -320,30 +318,43 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
320
318
|
function bound(value) {
|
|
321
319
|
return Math.max(-1e7, Math.min(1e7, Math.round(value)));
|
|
322
320
|
}
|
|
323
|
-
function probe() {
|
|
324
|
-
if (typeof PerformanceObserver === "undefined") return;
|
|
321
|
+
function probe(finish2, signal) {
|
|
322
|
+
if (typeof PerformanceObserver === "undefined") return finish2();
|
|
323
|
+
let accepted = false;
|
|
324
|
+
let duration;
|
|
325
325
|
const watcher = new PerformanceObserver((list) => {
|
|
326
326
|
for (const entry of list.getEntriesByName(endpoint)) {
|
|
327
327
|
const request = entry;
|
|
328
328
|
if (request.initiatorType !== "fetch") continue;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
roundTrip = Math.min(
|
|
329
|
+
if (!closed && request.requestStart > 0 && request.responseStart >= request.requestStart) {
|
|
330
|
+
duration = Math.min(
|
|
332
331
|
3e4,
|
|
333
332
|
Math.round(request.responseStart - request.requestStart)
|
|
334
333
|
);
|
|
334
|
+
if (accepted) finish2(duration);
|
|
335
|
+
} else finish2();
|
|
335
336
|
return;
|
|
336
337
|
}
|
|
337
338
|
});
|
|
338
|
-
|
|
339
|
+
signal.addEventListener("abort", () => watcher.disconnect(), {
|
|
340
|
+
once: true
|
|
341
|
+
});
|
|
339
342
|
watcher.observe({ type: "resource" });
|
|
340
343
|
void fetch(endpoint, {
|
|
341
344
|
method: "GET",
|
|
342
345
|
credentials: "omit",
|
|
343
346
|
mode: "cors",
|
|
344
|
-
cache: "no-store"
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
cache: "no-store",
|
|
348
|
+
signal,
|
|
349
|
+
redirect: "error"
|
|
350
|
+
}).then(
|
|
351
|
+
(response) => {
|
|
352
|
+
if (!response.ok) return finish2();
|
|
353
|
+
accepted = true;
|
|
354
|
+
if (duration !== void 0) finish2(duration);
|
|
355
|
+
},
|
|
356
|
+
() => finish2()
|
|
357
|
+
);
|
|
347
358
|
}
|
|
348
359
|
function action() {
|
|
349
360
|
if (!closed && ++actions >= 100) finish("action-limit");
|
|
@@ -449,7 +460,14 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
449
460
|
focused.add(focusedNow);
|
|
450
461
|
focusedNow = focusedNow.shadowRoot?.activeElement ?? null;
|
|
451
462
|
}
|
|
452
|
-
if (timing)
|
|
463
|
+
if (timing)
|
|
464
|
+
roundTrip = sdk.run(
|
|
465
|
+
"network",
|
|
466
|
+
"page_round_trip_ms",
|
|
467
|
+
timingRoute,
|
|
468
|
+
timing,
|
|
469
|
+
probe
|
|
470
|
+
);
|
|
453
471
|
for (const name of [
|
|
454
472
|
"keydown",
|
|
455
473
|
"pointerdown",
|
|
@@ -749,7 +767,7 @@ function behavioralCollector(nonce, endpoint, timing, issuedAt, route, notice =
|
|
|
749
767
|
}
|
|
750
768
|
|
|
751
769
|
// src/collector/bundle.ts
|
|
752
|
-
var COLLECTOR_SOURCE = `(function(J,ue){var le=2e3,fe=1500,de=250,pe=500,me=Date.now(),ve=typeof performance<"u"?performance.now():0;function z(e,t){var a=typeof globalThis<"u"?globalThis:self,o=a.navigator,i={},f=[],r=null,S=!1,h=/^function (?:get |set )?[\\w$]*\\(\\) \\{\\s*\\[native code\\]\\s*\\}$/;function s(c,u){try{return c()}catch{return u}}function y(){S||(S=!0,clearTimeout(r),t(i))}function p(c,u){if(typeof u=="function"){var l=Function.prototype.toString,m=!1,E,x,W=!1,N=!1;try{h.test(l.call(u))||(m=!0),E=Reflect.ownKeys(u),(E.length!==2||E.indexOf("length")===-1||E.indexOf("name")===-1)&&(m=!0),x=Object.getOwnPropertyDescriptor(u,"name"),(!x||x.writable!==!1)&&(m=!0);try{new u}catch(b){W=b instanceof TypeError}W||(m=!0);try{Object.setPrototypeOf(u,u)}catch{N=!0}N||(m=!0,Object.setPrototypeOf(u,Function.prototype))}catch{m=!0}m&&f.push(c)}}function Ce(c,u){var l=c?Object.getOwnPropertyDescriptor(c.prototype,u):void 0;return l?l.get:void 0}function U(c,u){return c?c.prototype[u]:void 0}i.ua=s(()=>String(o.userAgent)),i.platform=s(()=>String(o.platform)),i.languages=s(()=>Array.prototype.slice.call(o.languages,0,8).map(String)),i.tz=s(()=>Intl.DateTimeFormat().resolvedOptions().timeZone),i.cores=s(()=>o.hardwareConcurrency),i.memory=s(()=>o.deviceMemory),i.brands=s(()=>o.userAgentData.brands.map(c=>c.brand+" "+c.version)),i.webdriver=s(()=>o.webdriver),i.webdriver_own=s(()=>Object.prototype.hasOwnProperty.call(o,"webdriver")),i.headless_ua=s(()=>/HeadlessChrome|PhantomJS|SlimerJS/.test(o.userAgent)),i.clock={date_native:s(()=>h.test(Function.prototype.toString.call(Date.now))),perf_native:s(()=>h.test(Function.prototype.toString.call(a.performance.now)))},i.webgl=s(()=>{var c=e==="worker"?new OffscreenCanvas(8,8):a.document.createElement("canvas"),u=c.getContext("webgl")||c.getContext("webgl2");if(!u)return{ctx:!1};var l=u.getExtension("WEBGL_debug_renderer_info");return{vendor:l?u.getParameter(l.UNMASKED_VENDOR_WEBGL):void 0,renderer:l?u.getParameter(l.UNMASKED_RENDERER_WEBGL):void 0,ctx:!0}},{ctx:!1});var De=e==="worker"?a.WorkerNavigator:a.Navigator;p("Function.prototype.toString",Function.prototype.toString),p("Date.now",Date.now),p("performance.now",a.performance&&a.performance.now),["webdriver","plugins","languages","hardwareConcurrency","deviceMemory","platform","userAgent"].forEach(c=>{p((e==="worker"?"WorkerNavigator.":"Navigator.")+c+"#get",Ce(De,c))}),e!=="worker"&&(p("WebGLRenderingContext.getParameter",U(a.WebGLRenderingContext,"getParameter")),p("Permissions.query",U(a.Permissions,"query")),p("HTMLCanvasElement.toDataURL",U(a.HTMLCanvasElement,"toDataURL")),p("CanvasRenderingContext2D.getImageData",U(a.CanvasRenderingContext2D,"getImageData"))),e!=="worker"&&(i.plugins=s(()=>o.plugins.length),i.screen=s(()=>({w:a.screen.width,h:a.screen.height,dpr:a.devicePixelRatio,outer_zero:a.outerWidth===0||a.outerHeight===0}))),e==="main"&&(i.chrome=s(()=>typeof a.chrome=="object"&&a.chrome!==null),i.rtt=s(()=>o.connection.rtt),i.pdf_viewer=s(()=>o.pdfViewerEnabled),i.share=s(()=>typeof o.share=="function"),i.feature_major=Pe(a),i.os_fonts=s(()=>Re(a.document))),i.proto=f;var G=s(()=>o.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","fullVersionList"]));return G&&typeof G.then=="function"?(r=setTimeout(y,300),G.then(c=>{i.uach={arch:c.architecture,bitness:c.bitness,platform_version:c.platformVersion,full_version_list:(c.fullVersionList||[]).map(u=>u.brand+" "+u.version)},y()},()=>{y()})):y(),()=>{S=!0,clearTimeout(r)};function Pe(c){for(var u=[[141,()=>typeof Math.sumPrecise=="function"],[140,()=>typeof Uint8Array.fromBase64=="function"],[136,()=>typeof RegExp.escape=="function"],[135,()=>typeof c.Float16Array=="function"],[134,()=>typeof Error.isError=="function"],[128,()=>typeof Promise.try=="function"],[126,()=>typeof URL.parse=="function"],[122,()=>typeof Set.prototype.union=="function"],[122,()=>typeof c.Iterator=="function"&&typeof c.Iterator.prototype.map=="function"],[121,()=>typeof Array.fromAsync=="function"],[120,()=>typeof URL.canParse=="function"],[119,()=>typeof Promise.withResolvers=="function"],[117,()=>typeof Object.groupBy=="function"],[110,()=>typeof Array.prototype.toSorted=="function"],[98,()=>typeof c.structuredClone=="function"]],l=0;l<u.length;l+=1)if(s(u[l][1],!1))return u[l][0];return 0}function Re(c){var u={mac:["Helvetica Neue","Menlo","Monaco","Apple Color Emoji","SF Pro","Geneva","Avenir"],win:["Segoe UI","Calibri","Consolas","Tahoma","Cambria","Candara"],linux:["DejaVu Sans","Liberation Sans","Ubuntu","Noto Sans","Cantarell","Liberation Mono"]},l=c.createElement("canvas"),m=l.getContext("2d"),E="mmmmmmmmmmlli WAVE 0123 @#%",x=["monospace","sans-serif","serif"],W=x.map(b=>(m.font="24px "+b,m.measureText(E).width)),N={};return Object.keys(u).forEach(b=>{var ce=0;u[b].forEach(Le=>{var Ne=x.some((Me,Te)=>(m.font="24px '"+Le+"', "+Me,m.measureText(E).width!==W[Te]));Ne&&(ce+=1)}),N[b]=ce}),N}}var n={v:1,nonce:J,t:{}},_=null,C=null,D=null,H=!1,P=!1,w=!1,K=!1,q=0,Z=0,$=0,Y=!1,R=null,A=null,M=null,d=null,F=null,Q=[],X=[],V=null,ee,re=v(()=>document.currentScript.nonce,""),te=/^[A-Za-z0-9+/_-]+={0,2}$/.test(re)?re:J,ge=document.scripts.length,he=document.styleSheets.length,ne=v(()=>Object.getOwnPropertyNames(window),[]);function v(e,t){try{return e()}catch{return t}}function T(e,t){Q.push(setTimeout(()=>{w||e()},t))}function O(e,t,a,o){e.addEventListener(t,a,o),X.push([e,t,a,o])}function we(){Q.forEach(clearTimeout),X.forEach(e=>{e[0].removeEventListener(e[1],e[2],e[3])}),V!==null&&v(()=>cancelAnimationFrame(V)),R&&R.disconnect(),F&&F(),A&&A.terminate(),M&&URL.revokeObjectURL(M),d&&d.parentNode&&d.parentNode.removeChild(d)}var ye=/pptr:|__puppeteer_evaluation_script__|__pyppeteer_evaluation_script__|puppeteer-extra|playwright|__playwright_utility_world__|utility|selenium|webdriver/i,be=/cdc_|selenium|webdriver|__nightmare|callPhantom|domAutomationController|__pw|__playwright|_phantom|__fxdriver|__driver|__lastWatirAlert|__webdriver_script|puppeteer|_Selenium_IDE_Recorder/i,I=[];function j(e){var t=v(()=>String(new Error().stack||""),"");ye.test(t)&&I.indexOf(e)===-1&&I.push(e)}j("sync"),v(()=>{var e={};Object.defineProperty(e,"marker",{get:()=>(j("getter"),0)}),e.marker}),T(()=>{j("timeout")},0),v(()=>{V=requestAnimationFrame(()=>{j("raf")})}),v(()=>{var e=new Proxy({},{ownKeys:()=>(q+=1,[])});console.debug(e)}),v(()=>{R=new MutationObserver(e=>{Z+=e.length}),R.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),T(()=>{R.disconnect()},pe)}),O(window,"click",e=>{e.isTrusted===!1&&($+=1)},!0),["keydown","pointerdown","mousedown","touchstart","input"].forEach(e=>{O(window,e,t=>{t.isTrusted&&(Y=!0)},!0)}),F=z("main",e=>{w||(_=e,k())});var ae="("+z.toString()+")";if(typeof Worker!="function"||typeof Blob!="function"||typeof URL.createObjectURL!="function")H=!0;else try{var _e="var s=Date.now()-"+Date.now()+";"+ae+'("worker",function(r){r.started=s;r.clock_delta=Date.now();postMessage(r)})';M=URL.createObjectURL(new Blob([_e],{type:"text/javascript"})),A=new Worker(M),A.onmessage=e=>{if(!w){var t=e.data;t.clock_delta-=Date.now(),t.started=Math.max(0,t.started),C=t,A.terminate(),k()}},A.onerror=()=>{w||(P=!0,A.terminate(),k())}}catch{P=!0}try{d=document.createElement("iframe"),d.setAttribute("sandbox","allow-scripts"),d.style.display="none",d.setAttribute("aria-hidden","true");var Ae='var b=document.createElement("script");b.text="window.__sp_t0_csp=1";document.head.appendChild(b);var bypass=window.__sp_t0_csp===1;delete window.__sp_t0_csp;b.parentNode.removeChild(b);'+ae+'("iframe",function(r){r.clock_delta=Date.now();parent.postMessage({__sp_t0:r,csp_bypass:bypass},"*")})';d.srcdoc=\`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-\`+te+\`'"><script nonce="\`+te+'">'+Ae+"<\\/script>",O(window,"message",e=>{if(!(w||e.source!==d.contentWindow||!e.data||!e.data.__sp_t0)){var t=e.data.__sp_t0;t.clock_delta-=Date.now(),D=t,typeof e.data.csp_bypass=="boolean"&&(ee=e.data.csp_bypass),k()}}),d.onerror=()=>{w||(P=!0,k())},(document.body||document.documentElement).appendChild(d)}catch{P=!0}function oe(){K=!0,T(L,de),k()}document.readyState==="loading"?O(window,"DOMContentLoaded",oe):oe(),T(L,fe),O(window,"pagehide",()=>L("early-exit"));function ie(){document.visibilityState==="hidden"&&L("background-tab")}O(document,"visibilitychange",ie),ie();function k(){K&&_&&C&&D&&L()}function Se(e,t,a){var o=[];if(!e)return o;function i(r,S,h){r&&Object.keys(h).forEach(s=>{var y=h[s](e),p=h[s](r);y!=null&&p!==void 0&&p!==null&&JSON.stringify(y)!==JSON.stringify(p)&&o.push(S+s)})}var f={platform:r=>r.platform,languages:r=>r.languages,hardwareConcurrency:r=>r.cores,deviceMemory:r=>r.memory,brands:r=>r.brands};return i(t,"A7.",f),i(t,"",{"A10.vendor":r=>r.webgl&&r.webgl.vendor,"A10.renderer":r=>r.webgl&&r.webgl.renderer,"A3w.userAgent":r=>r.ua,"A29w.timeZone":r=>r.tz,"A4w.architecture":r=>r.uach&&r.uach.arch,"A4w.bitness":r=>r.uach&&r.uach.bitness,"A4w.platformVersion":r=>r.uach&&r.uach.platform_version,"A4w.fullVersionList":r=>r.uach&&r.uach.full_version_list}),i(a,"A8.",f),i(a,"",{"A8.userAgent":r=>r.ua,"A8.webdriver":r=>r.webdriver,"A8.timeZone":r=>r.tz,"A8.plugins":r=>r.plugins,"A8.dpr":r=>r.screen&&r.screen.dpr,"A8.screenW":r=>r.screen&&r.screen.w,"A8.renderer":r=>r.webgl&&r.webgl.renderer}),o}function se(e){return!e||!_||["ua","uach","webgl"].forEach(t=>{JSON.stringify(e[t])===JSON.stringify(_[t])&&delete e[t]}),e}function B(e){if(e){var t=e.proto;return delete e.proto,t}}function Ee(){var e=v(()=>{var f=Object.getOwnPropertyNames(window);return f.filter(r=>ne.indexOf(r)===-1)},[]),t=v(()=>ne.concat(e,Object.getOwnPropertyNames(document)).filter(f=>be.test(f)),[]),a=B(_),o=B(C),i=B(D);n.t.exec=Math.max(0,Math.round(ve)),n.t.sent=Math.max(0,Date.now()-me),n.main=_||void 0,n.worker=se(C)||void 0,n.iframe=se(D)||void 0,Oe(),n.proto={main:a||[],worker:o,iframe:i},n.globals={late:e.slice(0,32),automation:t.slice(0,16)},n.markers={stack:I,console_trap:q,csp_bypass:ee},n.dom={mutations_500:Z,sheets_added:Math.max(0,document.styleSheets.length-he),scripts_added:Math.max(0,document.scripts.length-ge)},n.events={untrusted_clicks:$,any_input:Y}}function Oe(){n.main&&n.main.uach&&!(n.worker&&n.worker.uach)&&delete n.main.uach.full_version_list}function ke(e){for(var t=0,a=0;a<e.length;a+=1){var o=e.charCodeAt(a);o<128?t+=1:o<2048?t+=2:o>=55296&&o<=56319?(t+=4,a+=1):t+=3}return t}function g(e,t){n[e]&&delete n[e][t]}function xe(){var e="compared",t="input";function a(){return n.xrealm=Se(n.main,n.worker,n.iframe),JSON.stringify(n)}for(var o=a(),i=[[e,()=>{["main","worker","iframe"].forEach(s=>{n[s]&&n[s].uach&&delete n[s].uach.full_version_list})}],[t,()=>{n.globals.late=n.globals.late.slice(0,8)}],[e,()=>g("iframe","uach")],[e,()=>g("worker","uach")],[e,()=>g("main","uach")],[e,()=>g("iframe","webgl")],[e,()=>g("worker","webgl")],[e,()=>g("iframe","ua")],[e,()=>g("worker","ua")],[t,()=>{n.proto.main=n.proto.main.slice(0,4)}],[t,()=>delete n.iframe],[t,()=>delete n.worker],[t,()=>g("main","webgl")],[t,()=>g("main","ua")],[t,()=>delete n.globals],[t,()=>delete n.main],[t,()=>delete n.proto]],f=0;f<i.length&&ke(o)>le;f+=1){var r=o,S=JSON.stringify(n.xrealm);i[f][1](),o=a();var h=o!==r&&(i[f][0]===t||JSON.stringify(n.xrealm)!==S);h&&n.availability==="available"&&(n.availability="insufficient-observation",o=a())}return o}function L(e){if(!w){w=!0,n.availability=e||(document.visibilityState==="hidden"?"background-tab":H?"unsupported-api":P?"script-failure":_&&C&&D?"available":"insufficient-observation"),we(),Ee();var t=xe();v(()=>{fetch(ue,{method:"POST",body:t,keepalive:!0,credentials:"omit",headers:{"content-type":"text/plain"}}).catch(()=>{})})}}})`;
|
|
770
|
+
var COLLECTOR_SOURCE = `(function(be,$,ye,G,_e){var J=2e3,Ae=1500,Se=250,Oe=500,Ee=Date.now(),ke=typeof performance<"u"?performance.now():0;function Y(e,t,l){var a=typeof globalThis<"u"?globalThis:self,c=a.navigator,o={},r=[],E=null,g=!1,m=/^function (?:get |set )?[\\w$]*\\(\\) \\{\\s*\\[native code\\]\\s*\\}$/;function u(i,s){try{return i()}catch{return s}}function b(){g||(g=!0,clearTimeout(E),t(o))}function y(i,s){if(typeof s=="function"){var f=Function.prototype.toString,h=!1,_,M,j=!1,U=!1;try{m.test(f.call(s))||(h=!0),_=Reflect.ownKeys(s),(_.length!==2||_.indexOf("length")===-1||_.indexOf("name")===-1)&&(h=!0),M=Object.getOwnPropertyDescriptor(s,"name"),(!M||M.writable!==!1)&&(h=!0);try{new s}catch(C){j=C instanceof TypeError}j||(h=!0);try{Object.setPrototypeOf(s,s)}catch{U=!0}U||(h=!0,Object.setPrototypeOf(s,Function.prototype))}catch{h=!0}h&&r.push(i)}}function Fe(i,s){var f=i?Object.getOwnPropertyDescriptor(i.prototype,s):void 0;return f?f.get:void 0}function I(i,s){return i?i.prototype[s]:void 0}o.ua=u(()=>String(c.userAgent)),o.platform=u(()=>String(c.platform)),o.languages=u(()=>Array.prototype.slice.call(c.languages,0,8).map(String)),o.tz=u(()=>Intl.DateTimeFormat().resolvedOptions().timeZone),o.cores=u(()=>c.hardwareConcurrency),o.memory=u(()=>c.deviceMemory),o.brands=u(()=>c.userAgentData.brands.map(i=>i.brand+" "+i.version)),o.webdriver=u(()=>c.webdriver),o.webdriver_own=u(()=>Object.prototype.hasOwnProperty.call(c,"webdriver")),o.headless_ua=u(()=>/HeadlessChrome|PhantomJS|SlimerJS/.test(c.userAgent)),o.clock={date_native:u(()=>m.test(Function.prototype.toString.call(Date.now))),perf_native:u(()=>m.test(Function.prototype.toString.call(a.performance.now)))},o.webgl=u(()=>{var i=e==="worker"?new OffscreenCanvas(8,8):a.document.createElement("canvas"),s=i.getContext("webgl")||i.getContext("webgl2");if(!s)return{ctx:!1};var f=s.getExtension("WEBGL_debug_renderer_info");return{vendor:f?s.getParameter(f.UNMASKED_VENDOR_WEBGL):void 0,renderer:f?s.getParameter(f.UNMASKED_RENDERER_WEBGL):void 0,ctx:!0}},{ctx:!1});var We=e==="worker"?a.WorkerNavigator:a.Navigator;y("Function.prototype.toString",Function.prototype.toString),y("Date.now",Date.now),y("performance.now",a.performance&&a.performance.now),["webdriver","plugins","languages","hardwareConcurrency","deviceMemory","platform","userAgent"].forEach(i=>{y((e==="worker"?"WorkerNavigator.":"Navigator.")+i+"#get",Fe(We,i))}),e!=="worker"&&(y("WebGLRenderingContext.getParameter",I(a.WebGLRenderingContext,"getParameter")),y("Permissions.query",I(a.Permissions,"query")),y("HTMLCanvasElement.toDataURL",I(a.HTMLCanvasElement,"toDataURL")),y("CanvasRenderingContext2D.getImageData",I(a.CanvasRenderingContext2D,"getImageData"))),e!=="worker"&&(o.plugins=u(()=>c.plugins.length),o.screen=u(()=>({w:a.screen.width,h:a.screen.height,dpr:a.devicePixelRatio,outer_zero:a.outerWidth===0||a.outerHeight===0}))),e==="main"&&(o.chrome=u(()=>typeof a.chrome=="object"&&a.chrome!==null),o.rtt=u(()=>c.connection.rtt),o.pdf_viewer=u(()=>c.pdfViewerEnabled),o.share=u(()=>typeof c.share=="function"),o.feature_major=Ve(a),o.os_fonts=u(()=>l?l(i=>me(a.document,i)):me(a.document))),o.proto=r;var Z=u(()=>c.userAgentData.getHighEntropyValues(["architecture","bitness","platformVersion","fullVersionList"]));return Z&&typeof Z.then=="function"?(E=setTimeout(b,300),Z.then(i=>{o.uach={arch:i.architecture,bitness:i.bitness,platform_version:i.platformVersion,full_version_list:(i.fullVersionList||[]).map(s=>s.brand+" "+s.version)},b()},()=>{b()})):b(),()=>{g=!0,clearTimeout(E)};function Ve(i){for(var s=[[141,()=>typeof Math.sumPrecise=="function"],[140,()=>typeof Uint8Array.fromBase64=="function"],[136,()=>typeof RegExp.escape=="function"],[135,()=>typeof i.Float16Array=="function"],[134,()=>typeof Error.isError=="function"],[128,()=>typeof Promise.try=="function"],[126,()=>typeof URL.parse=="function"],[122,()=>typeof Set.prototype.union=="function"],[122,()=>typeof i.Iterator=="function"&&typeof i.Iterator.prototype.map=="function"],[121,()=>typeof Array.fromAsync=="function"],[120,()=>typeof URL.canParse=="function"],[119,()=>typeof Promise.withResolvers=="function"],[117,()=>typeof Object.groupBy=="function"],[110,()=>typeof Array.prototype.toSorted=="function"],[98,()=>typeof i.structuredClone=="function"]],f=0;f<s.length;f+=1)if(u(s[f][1],!1))return s[f][0];return 0}function me(i,s){var f={mac:["Helvetica Neue","Menlo","Monaco","Apple Color Emoji","SF Pro","Geneva","Avenir"],win:["Segoe UI","Calibri","Consolas","Tahoma","Cambria","Candara"],linux:["DejaVu Sans","Liberation Sans","Ubuntu","Noto Sans","Cantarell","Liberation Mono"]},h=i.createElement("canvas"),_=h.getContext("2d"),M="mmmmmmmmmmlli WAVE 0123 @#%",j=["monospace","sans-serif","serif"],U=!0;function C(){var A=_.measureText(M).width;return(!Number.isFinite(A)||A<=0)&&(U=!1),A}var Ie=j.map(A=>(_.font="24px "+A,C())),ve={},ge=1,he=0;return Object.keys(f).forEach(A=>{var we=0;f[A].forEach(Ge=>{var Je=j.some((Be,ze)=>(_.font="24px '"+Ge+"', "+Be,C()!==Ie[ze]));Je&&(we+=1,s&&(he|=ge)),s&&(ge<<=1)}),ve[A]=we}),s&&s(U?he:void 0),ve}}var n={v:1,nonce:$,t:{}},D,S=null,P=null,L=null,Q=!1,R=!1,w=!1,X=!1,ee=0,re=0,te=0,ne=!1,N=null,O=null,F=null,d=null,B=null,ae=[],oe=[],z=null,ie,se=p(()=>document.currentScript.nonce,""),ue=/^[A-Za-z0-9+/_-]+={0,2}$/.test(se)?se:$,xe=document.scripts.length,Ce=document.styleSheets.length,ce=p(()=>Object.getOwnPropertyNames(window),[]);function p(e,t){try{return e()}catch{return t}}function W(e,t){ae.push(setTimeout(()=>{w||e()},t))}function k(e,t,l,a){e.addEventListener(t,l,a),oe.push([e,t,l,a])}function De(){ae.forEach(clearTimeout),oe.forEach(e=>{e[0].removeEventListener(e[1],e[2],e[3])}),z!==null&&p(()=>cancelAnimationFrame(z)),N&&N.disconnect(),B&&B(),O&&O.terminate(),F&&URL.revokeObjectURL(F),d&&d.parentNode&&d.parentNode.removeChild(d)}var Pe=/pptr:|__puppeteer_evaluation_script__|__pyppeteer_evaluation_script__|puppeteer-extra|playwright|__playwright_utility_world__|utility|selenium|webdriver/i,Le=/cdc_|selenium|webdriver|__nightmare|callPhantom|domAutomationController|__pw|__playwright|_phantom|__fxdriver|__driver|__lastWatirAlert|__webdriver_script|puppeteer|_Selenium_IDE_Recorder/i,H=[];function V(e){var t=p(()=>String(new Error().stack||""),"");Pe.test(t)&&H.indexOf(e)===-1&&H.push(e)}V("sync"),p(()=>{var e={};Object.defineProperty(e,"marker",{get:()=>(V("getter"),0)}),e.marker}),W(()=>{V("timeout")},0),p(()=>{z=requestAnimationFrame(()=>{V("raf")})}),p(()=>{var e=new Proxy({},{ownKeys:()=>(ee+=1,[])});console.debug(e)}),p(()=>{N=new MutationObserver(e=>{re+=e.length}),N.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),W(()=>{N.disconnect()},Oe)}),k(window,"click",e=>{e.isTrusted===!1&&(te+=1)},!0),["keydown","pointerdown","mousedown","touchstart","input"].forEach(e=>{k(window,e,t=>{t.isTrusted&&(ne=!0)},!0)}),B=Y("main",e=>{w||(S=e,x())},G?e=>{var t,l=!1;return D=be.run("environment","fonts","page",!0,a=>{l=!0,t=e(a)}),l?t:(D.cancel(),e())}:void 0);var le="("+Y.toString()+")";if(typeof Worker!="function"||typeof Blob!="function"||typeof URL.createObjectURL!="function")Q=!0;else try{var Re="var s=Date.now()-"+Date.now()+";"+le+'("worker",function(r){r.started=s;r.clock_delta=Date.now();postMessage(r)})';F=URL.createObjectURL(new Blob([Re],{type:"text/javascript"})),O=new Worker(F),O.onmessage=e=>{if(!w){var t=e.data;t.clock_delta-=Date.now(),t.started=Math.max(0,t.started),P=t,O.terminate(),x()}},O.onerror=()=>{w||(R=!0,O.terminate(),x())}}catch{R=!0}try{d=document.createElement("iframe"),d.setAttribute("sandbox","allow-scripts"),d.style.display="none",d.setAttribute("aria-hidden","true");var Ne='var b=document.createElement("script");b.text="window.__sp_t0_csp=1";document.head.appendChild(b);var bypass=window.__sp_t0_csp===1;delete window.__sp_t0_csp;b.parentNode.removeChild(b);'+le+'("iframe",function(r){r.clock_delta=Date.now();parent.postMessage({__sp_t0:r,csp_bypass:bypass},"*")})';d.srcdoc=\`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-\`+ue+\`'"><script nonce="\`+ue+'">'+Ne+"<\\/script>",k(window,"message",e=>{if(!(w||e.source!==d.contentWindow||!e.data||!e.data.__sp_t0)){var t=e.data.__sp_t0;t.clock_delta-=Date.now(),L=t,typeof e.data.csp_bypass=="boolean"&&(ie=e.data.csp_bypass),x()}}),d.onerror=()=>{w||(R=!0,x())},(document.body||document.documentElement).appendChild(d)}catch{R=!0}function fe(){X=!0,W(T,Se),x()}document.readyState==="loading"?k(window,"DOMContentLoaded",fe):fe(),W(T,Ae),k(window,"pagehide",()=>T("early-exit"));function de(){document.visibilityState==="hidden"&&T("background-tab")}k(document,"visibilitychange",de),de();function x(){X&&S&&P&&L&&T()}function Te(e,t,l){var a=[];if(!e)return a;function c(r,E,g){r&&Object.keys(g).forEach(m=>{var u=g[m](e),b=g[m](r);u!=null&&b!==void 0&&b!==null&&JSON.stringify(u)!==JSON.stringify(b)&&a.push(E+m)})}var o={platform:r=>r.platform,languages:r=>r.languages,hardwareConcurrency:r=>r.cores,deviceMemory:r=>r.memory,brands:r=>r.brands};return c(t,"A7.",o),c(t,"",{"A10.vendor":r=>r.webgl&&r.webgl.vendor,"A10.renderer":r=>r.webgl&&r.webgl.renderer,"A3w.userAgent":r=>r.ua,"A29w.timeZone":r=>r.tz,"A4w.architecture":r=>r.uach&&r.uach.arch,"A4w.bitness":r=>r.uach&&r.uach.bitness,"A4w.platformVersion":r=>r.uach&&r.uach.platform_version,"A4w.fullVersionList":r=>r.uach&&r.uach.full_version_list}),c(l,"A8.",o),c(l,"",{"A8.userAgent":r=>r.ua,"A8.webdriver":r=>r.webdriver,"A8.timeZone":r=>r.tz,"A8.plugins":r=>r.plugins,"A8.dpr":r=>r.screen&&r.screen.dpr,"A8.screenW":r=>r.screen&&r.screen.w,"A8.renderer":r=>r.webgl&&r.webgl.renderer}),a}function pe(e){return!e||!S||["ua","uach","webgl"].forEach(t=>{JSON.stringify(e[t])===JSON.stringify(S[t])&&delete e[t]}),e}function K(e){if(e){var t=e.proto;return delete e.proto,t}}function Me(){var e=p(()=>{var o=Object.getOwnPropertyNames(window);return o.filter(r=>ce.indexOf(r)===-1)},[]),t=p(()=>ce.concat(e,Object.getOwnPropertyNames(document)).filter(o=>Le.test(o)),[]),l=K(S),a=K(P),c=K(L);n.t.exec=Math.max(0,Math.round(ke)),n.t.sent=Math.max(0,Date.now()-Ee),n.main=S||void 0,n.worker=pe(P)||void 0,n.iframe=pe(L)||void 0,je(),n.proto={main:l||[],worker:a,iframe:c},n.globals={late:e.slice(0,32),automation:t.slice(0,16)},n.markers={stack:H,console_trap:ee,csp_bypass:ie},n.dom={mutations_500:re,sheets_added:Math.max(0,document.styleSheets.length-Ce),scripts_added:Math.max(0,document.scripts.length-xe)},n.events={untrusted_clicks:te,any_input:ne}}function je(){n.main&&n.main.uach&&!(n.worker&&n.worker.uach)&&delete n.main.uach.full_version_list}function q(e){for(var t=0,l=0;l<e.length;l+=1){var a=e.charCodeAt(l);a<128?t+=1:a<2048?t+=2:a>=55296&&a<=56319?(t+=4,l+=1):t+=3}return t}function v(e,t){n[e]&&delete n[e][t]}function Ue(){var e="compared",t="input";function l(){return n.xrealm=Te(n.main,n.worker,n.iframe),JSON.stringify(n)}for(var a=l(),c=[[e,()=>{["main","worker","iframe"].forEach(u=>{n[u]&&n[u].uach&&delete n[u].uach.full_version_list})}],[t,()=>{n.globals.late=n.globals.late.slice(0,8)}],[e,()=>v("iframe","uach")],[e,()=>v("worker","uach")],[e,()=>v("main","uach")],[e,()=>v("iframe","webgl")],[e,()=>v("worker","webgl")],[e,()=>v("iframe","ua")],[e,()=>v("worker","ua")],[t,()=>{n.proto.main=n.proto.main.slice(0,4)}],[t,()=>delete n.iframe],[t,()=>delete n.worker],[t,()=>v("main","webgl")],[t,()=>v("main","ua")],[t,()=>delete n.globals],[t,()=>delete n.main],[t,()=>delete n.proto]],o=0;o<c.length&&q(a)>J;o+=1){var r=a,E=JSON.stringify(n.xrealm);c[o][1](),a=l();var g=a!==r&&(c[o][0]===t||JSON.stringify(n.xrealm)!==E);g&&n.availability==="available"&&(n.availability="insufficient-observation",a=l())}if(G&&D&&D.reading.state==="observed"&&n.main&&n.main.os_fonts){n.nonce=G,n.env={rev:_e,fonts:D.reading.value},delete n.main.os_fonts;var m=JSON.stringify(n);if(q(m)<=J)return m}return a}function T(e){if(!w){w=!0,n.availability=e||(document.visibilityState==="hidden"?"background-tab":Q?"unsupported-api":R?"script-failure":S&&P&&L?"available":"insufficient-observation"),De(),Me();var t=Ue();q(t)>J||p(()=>{fetch(ye,{method:"POST",body:t,keepalive:!0,credentials:"omit",headers:{"content-type":"text/plain"}}).catch(()=>{})})}}})`;
|
|
753
771
|
|
|
754
772
|
// ../connector-core/src/api-environment.ts
|
|
755
773
|
var STEADPHAST_API_KEY_ENV_VAR = "STEADPHAST_API_KEY";
|
|
@@ -953,7 +971,7 @@ function createNonceMinter(apiKey) {
|
|
|
953
971
|
context.set(tag, header.byteLength);
|
|
954
972
|
return base64UrlNoPad(context);
|
|
955
973
|
},
|
|
956
|
-
async nonceFromRenderContext(context) {
|
|
974
|
+
async nonceFromRenderContext(context, rendering) {
|
|
957
975
|
if (context.length > 850 || !/^[A-Za-z0-9_-]+$/.test(context)) {
|
|
958
976
|
return void 0;
|
|
959
977
|
}
|
|
@@ -976,10 +994,29 @@ function createNonceMinter(apiKey) {
|
|
|
976
994
|
concat(utf8(RENDER_CONTEXT_DOMAIN), header)
|
|
977
995
|
))
|
|
978
996
|
return void 0;
|
|
979
|
-
|
|
980
|
-
|
|
997
|
+
let signed = header;
|
|
998
|
+
if (rendering !== void 0) {
|
|
999
|
+
const { revision, catalog } = rendering;
|
|
1000
|
+
if (![revision, catalog].every(
|
|
1001
|
+
(n) => Number.isInteger(n) && n >= 0 && n <= 4294967295
|
|
1002
|
+
) || revision === 0)
|
|
1003
|
+
return void 0;
|
|
1004
|
+
const extended = bytes(header.byteLength + 9 + TAG_BYTES);
|
|
1005
|
+
extended.set(header);
|
|
1006
|
+
extended[0] = 2;
|
|
1007
|
+
extended[header.byteLength] = 4;
|
|
1008
|
+
const view = new DataView(extended.buffer);
|
|
1009
|
+
view.setUint32(header.byteLength + 1, revision);
|
|
1010
|
+
view.setUint32(header.byteLength + 5, catalog);
|
|
1011
|
+
decoded = extended;
|
|
1012
|
+
signed = extended.subarray(0, -TAG_BYTES);
|
|
1013
|
+
}
|
|
1014
|
+
decoded.set(
|
|
1015
|
+
new Uint8Array(
|
|
1016
|
+
await crypto.subtle.sign("HMAC", await nonceKey, signed)
|
|
1017
|
+
),
|
|
1018
|
+
signed.byteLength
|
|
981
1019
|
);
|
|
982
|
-
decoded.set(tag, header.byteLength);
|
|
983
1020
|
return base64UrlNoPad(decoded);
|
|
984
1021
|
}
|
|
985
1022
|
};
|
|
@@ -1073,13 +1110,77 @@ var NonceMinterCache = class {
|
|
|
1073
1110
|
}
|
|
1074
1111
|
};
|
|
1075
1112
|
|
|
1113
|
+
// src/page-probes.ts
|
|
1114
|
+
function createProbeRunner() {
|
|
1115
|
+
let remaining = 1500;
|
|
1116
|
+
let busy = false;
|
|
1117
|
+
const queue = [];
|
|
1118
|
+
const jobs = /* @__PURE__ */ new Map();
|
|
1119
|
+
function next() {
|
|
1120
|
+
if (!busy) queue.shift()?.();
|
|
1121
|
+
}
|
|
1122
|
+
return {
|
|
1123
|
+
run(module, name, route, permitted, start) {
|
|
1124
|
+
const key = `${module}:${name}`;
|
|
1125
|
+
const job = {
|
|
1126
|
+
reading: { module, name, route, state: "not-observed", value: null },
|
|
1127
|
+
cancel() {
|
|
1128
|
+
cancelled = true;
|
|
1129
|
+
stop?.();
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
let cancelled = false;
|
|
1133
|
+
let stop;
|
|
1134
|
+
if (permitted !== true) return job;
|
|
1135
|
+
const prior = jobs.get(key);
|
|
1136
|
+
if (prior) return prior;
|
|
1137
|
+
jobs.set(key, job);
|
|
1138
|
+
queue.push(() => {
|
|
1139
|
+
if (cancelled || remaining <= 0 || typeof AbortController === "undefined") {
|
|
1140
|
+
next();
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
busy = true;
|
|
1144
|
+
const controller = new AbortController();
|
|
1145
|
+
const began = performance.now();
|
|
1146
|
+
const timer = setTimeout(() => {
|
|
1147
|
+
remaining = 0;
|
|
1148
|
+
finish();
|
|
1149
|
+
}, remaining);
|
|
1150
|
+
function finish(value, state = "observed") {
|
|
1151
|
+
if (!stop) return;
|
|
1152
|
+
stop = void 0;
|
|
1153
|
+
clearTimeout(timer);
|
|
1154
|
+
remaining -= Math.max(0, performance.now() - began);
|
|
1155
|
+
if (remaining > 0 && value !== void 0 && Number.isFinite(value))
|
|
1156
|
+
job.reading = { module, name, route, state, value };
|
|
1157
|
+
controller.abort();
|
|
1158
|
+
busy = false;
|
|
1159
|
+
next();
|
|
1160
|
+
}
|
|
1161
|
+
stop = () => finish();
|
|
1162
|
+
try {
|
|
1163
|
+
start(finish, controller.signal);
|
|
1164
|
+
} catch {
|
|
1165
|
+
finish();
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
next();
|
|
1169
|
+
return job;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
function pageScript(invocations) {
|
|
1174
|
+
return `(()=>{const key=Symbol.for("steadphast.page-sdk");if(Object.prototype.hasOwnProperty.call(document,key))return;Object.defineProperty(document,key,{value:true});const sdk=(${createProbeRunner.toString()})();${invocations}})()`;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1076
1177
|
// src/collector-render.ts
|
|
1077
1178
|
var minters = new NonceMinterCache();
|
|
1078
|
-
function collectorScript(nonce, endpoint) {
|
|
1079
|
-
const
|
|
1080
|
-
return `${COLLECTOR_SOURCE}(
|
|
1179
|
+
function collectorScript(nonce, endpoint, rendering) {
|
|
1180
|
+
const args = rendering ? [nonce, endpoint, rendering.nonce, rendering.catalog] : [nonce, endpoint];
|
|
1181
|
+
return `${COLLECTOR_SOURCE}(sdk,${args.map((v) => JSON.stringify(v).replace(/</g, "\\u003c")).join(",")});`;
|
|
1081
1182
|
}
|
|
1082
|
-
async function renderCollector(config, endpoint, cspNonce) {
|
|
1183
|
+
async function renderCollector(config, endpoint, cspNonce, environmentPermitted = false) {
|
|
1083
1184
|
if (config.collector === false || config.collector !== true && (config.behavioral?.mode ?? "own") !== "own")
|
|
1084
1185
|
return null;
|
|
1085
1186
|
validateApiKeyEnvVar(config.apiKeyEnvVar);
|
|
@@ -1092,7 +1193,36 @@ async function renderCollector(config, endpoint, cspNonce) {
|
|
|
1092
1193
|
const minter = minters.for(apiKey);
|
|
1093
1194
|
if (minter === void 0) return null;
|
|
1094
1195
|
const nonce = context === null ? void 0 : await minter.nonceFromRenderContext(context);
|
|
1095
|
-
let script =
|
|
1196
|
+
let script = "";
|
|
1197
|
+
if (config.collector === true && context !== null && nonce !== void 0) {
|
|
1198
|
+
let rendering;
|
|
1199
|
+
if (environmentPermitted === true && config.environment?.rendering === true) {
|
|
1200
|
+
try {
|
|
1201
|
+
const response = await fetch(
|
|
1202
|
+
new URL("/v1/connectors/nextjs/environment-policy", endpoint),
|
|
1203
|
+
{
|
|
1204
|
+
headers: { authorization: `Bearer ${apiKey}` },
|
|
1205
|
+
cache: "no-store",
|
|
1206
|
+
redirect: "error",
|
|
1207
|
+
signal: AbortSignal.timeout(250)
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
if (response.ok) {
|
|
1211
|
+
const policy = await response.json();
|
|
1212
|
+
if (policy?.rendering_enabled === true) {
|
|
1213
|
+
const extended = await minter.nonceFromRenderContext(context, {
|
|
1214
|
+
revision: policy.revision,
|
|
1215
|
+
catalog: policy.catalog_revision
|
|
1216
|
+
});
|
|
1217
|
+
if (extended)
|
|
1218
|
+
rendering = { nonce: extended, catalog: policy.catalog_revision };
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
} catch {
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
script = collectorScript(nonce, endpoint, rendering);
|
|
1225
|
+
}
|
|
1096
1226
|
if ((config.behavioral?.mode ?? "own") === "own" && behavioralContext !== null) {
|
|
1097
1227
|
try {
|
|
1098
1228
|
const response = await fetch(
|
|
@@ -1121,9 +1251,10 @@ async function renderCollector(config, endpoint, cspNonce) {
|
|
|
1121
1251
|
config.behavioral.consentBasis === "notice" && policy.consent_basis === "notice",
|
|
1122
1252
|
// Target boxes only when both the site and the workspace turn path capture on; a
|
|
1123
1253
|
// policy without the field (a server before path capture) reads as off.
|
|
1124
|
-
config.behavioral.pathCapture === true && "path_capture_enabled" in policy && policy.path_capture_enabled === true
|
|
1254
|
+
config.behavioral.pathCapture === true && "path_capture_enabled" in policy && policy.path_capture_enabled === true,
|
|
1255
|
+
config.behavioral.timingRoute ?? "steadphast-host"
|
|
1125
1256
|
]).replace(/</g, "\\u003c");
|
|
1126
|
-
script += `;(${behavioralCollector.toString()})(
|
|
1257
|
+
script += `;(${behavioralCollector.toString()})(sdk,...${args});`;
|
|
1127
1258
|
}
|
|
1128
1259
|
}
|
|
1129
1260
|
} catch {
|
|
@@ -1133,7 +1264,7 @@ async function renderCollector(config, endpoint, cspNonce) {
|
|
|
1133
1264
|
return createElement("script", {
|
|
1134
1265
|
nonce: cspNonce ?? nonce,
|
|
1135
1266
|
// biome-ignore lint/security/noDangerouslySetInnerHtml: package-owned collector with JSON-encoded, script-escaped arguments; no visitor nonce or destination is used.
|
|
1136
|
-
dangerouslySetInnerHTML: { __html: script }
|
|
1267
|
+
dangerouslySetInnerHTML: { __html: pageScript(script) }
|
|
1137
1268
|
});
|
|
1138
1269
|
}
|
|
1139
1270
|
|
|
@@ -1142,7 +1273,12 @@ async function DiscoverCollector(props = {}) {
|
|
|
1142
1273
|
if (!props.config || props.config.collector === false || props.config.collector !== true && ((props.config.behavioral?.mode ?? "own") !== "own" || !props.config.behavioral?.routes?.length))
|
|
1143
1274
|
return null;
|
|
1144
1275
|
const endpoint = `${new URL(resolveProductionIngestUrl(props.config.apiUrl)).origin}${BEACON_PATHNAME}`;
|
|
1145
|
-
return renderCollector(
|
|
1276
|
+
return renderCollector(
|
|
1277
|
+
props.config,
|
|
1278
|
+
endpoint,
|
|
1279
|
+
props.nonce,
|
|
1280
|
+
props.environmentPermitted
|
|
1281
|
+
);
|
|
1146
1282
|
}
|
|
1147
1283
|
export {
|
|
1148
1284
|
DiscoverCollector
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steadphast/connector-nextjs",
|
|
3
3
|
"description": "Next.js Middleware and Proxy connector for Steadphast: captures request metadata before it reaches your app and sends it to Steadphast for AI and bot traffic classification, without touching the response.",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Steadphast",
|
|
7
7
|
"homepage": "https://steadphast.ai",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dist/config.d.ts",
|
|
27
27
|
"dist/middleware.d.ts",
|
|
28
28
|
"dist/behavioral-collector.d.ts",
|
|
29
|
+
"dist/page-probes.d.ts",
|
|
29
30
|
"dist/client.js",
|
|
30
31
|
"dist/client.d.ts",
|
|
31
32
|
"dist/server.js",
|