@sentry/replay 7.77.0 → 7.78.0
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/cjs/index.js +170 -1163
- package/cjs/index.js.map +1 -1
- package/esm/index.js +171 -1164
- package/esm/index.js.map +1 -1
- package/package.json +9 -8
- package/types/coreHandlers/handleClick.d.ts +10 -2
- package/types/coreHandlers/handleClick.d.ts.map +1 -1
- package/types/coreHandlers/handleScope.d.ts.map +1 -1
- package/types/coreHandlers/util/domUtils.d.ts +2 -0
- package/types/coreHandlers/util/domUtils.d.ts.map +1 -1
- package/types/coreHandlers/util/networkUtils.d.ts.map +1 -1
- package/types/integration.d.ts +1 -1
- package/types/integration.d.ts.map +1 -1
- package/types/types/replay.d.ts +17 -1
- package/types/types/replay.d.ts.map +1 -1
- package/types/types/request.d.ts +1 -1
- package/types/types/request.d.ts.map +1 -1
- package/types/util/handleRecordingEmit.d.ts.map +1 -1
- package/types/util/sendReplayRequest.d.ts +8 -0
- package/types/util/sendReplayRequest.d.ts.map +1 -1
- package/types-ts3.8/coreHandlers/handleClick.d.ts +10 -2
- package/types-ts3.8/coreHandlers/util/domUtils.d.ts +2 -0
- package/types-ts3.8/integration.d.ts +1 -1
- package/types-ts3.8/types/replay.d.ts +17 -1
- package/types-ts3.8/types/request.d.ts +1 -1
- package/types-ts3.8/util/sendReplayRequest.d.ts +8 -0
- package/types/util/truncateJson/completeJson.d.ts +0 -9
- package/types/util/truncateJson/completeJson.d.ts.map +0 -1
- package/types/util/truncateJson/constants.d.ts +0 -12
- package/types/util/truncateJson/constants.d.ts.map +0 -1
- package/types/util/truncateJson/evaluateJson.d.ts +0 -6
- package/types/util/truncateJson/evaluateJson.d.ts.map +0 -1
- package/types/util/truncateJson/fixJson.d.ts +0 -6
- package/types/util/truncateJson/fixJson.d.ts.map +0 -1
- package/types-ts3.8/util/truncateJson/completeJson.d.ts +0 -9
- package/types-ts3.8/util/truncateJson/constants.d.ts +0 -12
- package/types-ts3.8/util/truncateJson/evaluateJson.d.ts +0 -6
- package/types-ts3.8/util/truncateJson/fixJson.d.ts +0 -6
package/cjs/index.js
CHANGED
|
@@ -1587,12 +1587,6 @@ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
|
1587
1587
|
PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
|
|
1588
1588
|
return PointerTypes2;
|
|
1589
1589
|
})(PointerTypes || {});
|
|
1590
|
-
var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
|
|
1591
|
-
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
1592
|
-
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
1593
|
-
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
1594
|
-
return CanvasContext2;
|
|
1595
|
-
})(CanvasContext || {});
|
|
1596
1590
|
|
|
1597
1591
|
function isNodeInLinkedList(n) {
|
|
1598
1592
|
return '__ln' in n;
|
|
@@ -2425,12 +2419,6 @@ function initViewportResizeObserver({ viewportResizeCb }, { win }) {
|
|
|
2425
2419
|
}), 200));
|
|
2426
2420
|
return on('resize', updateDimension, win);
|
|
2427
2421
|
}
|
|
2428
|
-
function wrapEventWithUserTriggeredFlag(v, enable) {
|
|
2429
|
-
const value = Object.assign({}, v);
|
|
2430
|
-
if (!enable)
|
|
2431
|
-
delete value.userTriggered;
|
|
2432
|
-
return value;
|
|
2433
|
-
}
|
|
2434
2422
|
const INPUT_TAGS = ['INPUT', 'TEXTAREA', 'SELECT'];
|
|
2435
2423
|
const lastInputValueMap = new WeakMap();
|
|
2436
2424
|
function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, }) {
|
|
@@ -2469,7 +2457,9 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
|
|
|
2469
2457
|
value: text,
|
|
2470
2458
|
maskInputFn,
|
|
2471
2459
|
});
|
|
2472
|
-
cbWithDedup(target,
|
|
2460
|
+
cbWithDedup(target, userTriggeredOnInput
|
|
2461
|
+
? { text, isChecked, userTriggered }
|
|
2462
|
+
: { text, isChecked });
|
|
2473
2463
|
const name = target.name;
|
|
2474
2464
|
if (type === 'radio' && name && isChecked) {
|
|
2475
2465
|
doc
|
|
@@ -2482,11 +2472,9 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
|
|
|
2482
2472
|
value: getInputValue(el, tagName, type),
|
|
2483
2473
|
maskInputFn,
|
|
2484
2474
|
});
|
|
2485
|
-
cbWithDedup(el,
|
|
2486
|
-
text,
|
|
2487
|
-
isChecked: !isChecked
|
|
2488
|
-
userTriggered: false,
|
|
2489
|
-
}, userTriggeredOnInput));
|
|
2475
|
+
cbWithDedup(el, userTriggeredOnInput
|
|
2476
|
+
? { text, isChecked: !isChecked, userTriggered: false }
|
|
2477
|
+
: { text, isChecked: !isChecked });
|
|
2490
2478
|
}
|
|
2491
2479
|
});
|
|
2492
2480
|
}
|
|
@@ -2931,94 +2919,12 @@ function initCustomElementObserver({ doc, customElementCb, }) {
|
|
|
2931
2919
|
});
|
|
2932
2920
|
return restoreHandler;
|
|
2933
2921
|
}
|
|
2934
|
-
function
|
|
2935
|
-
const { mutationCb, mousemoveCb, mouseInteractionCb, scrollCb, viewportResizeCb, inputCb, mediaInteractionCb, styleSheetRuleCb, styleDeclarationCb, canvasMutationCb, fontCb, selectionCb, customElementCb, } = o;
|
|
2936
|
-
o.mutationCb = (...p) => {
|
|
2937
|
-
if (hooks.mutation) {
|
|
2938
|
-
hooks.mutation(...p);
|
|
2939
|
-
}
|
|
2940
|
-
mutationCb(...p);
|
|
2941
|
-
};
|
|
2942
|
-
o.mousemoveCb = (...p) => {
|
|
2943
|
-
if (hooks.mousemove) {
|
|
2944
|
-
hooks.mousemove(...p);
|
|
2945
|
-
}
|
|
2946
|
-
mousemoveCb(...p);
|
|
2947
|
-
};
|
|
2948
|
-
o.mouseInteractionCb = (...p) => {
|
|
2949
|
-
if (hooks.mouseInteraction) {
|
|
2950
|
-
hooks.mouseInteraction(...p);
|
|
2951
|
-
}
|
|
2952
|
-
mouseInteractionCb(...p);
|
|
2953
|
-
};
|
|
2954
|
-
o.scrollCb = (...p) => {
|
|
2955
|
-
if (hooks.scroll) {
|
|
2956
|
-
hooks.scroll(...p);
|
|
2957
|
-
}
|
|
2958
|
-
scrollCb(...p);
|
|
2959
|
-
};
|
|
2960
|
-
o.viewportResizeCb = (...p) => {
|
|
2961
|
-
if (hooks.viewportResize) {
|
|
2962
|
-
hooks.viewportResize(...p);
|
|
2963
|
-
}
|
|
2964
|
-
viewportResizeCb(...p);
|
|
2965
|
-
};
|
|
2966
|
-
o.inputCb = (...p) => {
|
|
2967
|
-
if (hooks.input) {
|
|
2968
|
-
hooks.input(...p);
|
|
2969
|
-
}
|
|
2970
|
-
inputCb(...p);
|
|
2971
|
-
};
|
|
2972
|
-
o.mediaInteractionCb = (...p) => {
|
|
2973
|
-
if (hooks.mediaInteaction) {
|
|
2974
|
-
hooks.mediaInteaction(...p);
|
|
2975
|
-
}
|
|
2976
|
-
mediaInteractionCb(...p);
|
|
2977
|
-
};
|
|
2978
|
-
o.styleSheetRuleCb = (...p) => {
|
|
2979
|
-
if (hooks.styleSheetRule) {
|
|
2980
|
-
hooks.styleSheetRule(...p);
|
|
2981
|
-
}
|
|
2982
|
-
styleSheetRuleCb(...p);
|
|
2983
|
-
};
|
|
2984
|
-
o.styleDeclarationCb = (...p) => {
|
|
2985
|
-
if (hooks.styleDeclaration) {
|
|
2986
|
-
hooks.styleDeclaration(...p);
|
|
2987
|
-
}
|
|
2988
|
-
styleDeclarationCb(...p);
|
|
2989
|
-
};
|
|
2990
|
-
o.canvasMutationCb = (...p) => {
|
|
2991
|
-
if (hooks.canvasMutation) {
|
|
2992
|
-
hooks.canvasMutation(...p);
|
|
2993
|
-
}
|
|
2994
|
-
canvasMutationCb(...p);
|
|
2995
|
-
};
|
|
2996
|
-
o.fontCb = (...p) => {
|
|
2997
|
-
if (hooks.font) {
|
|
2998
|
-
hooks.font(...p);
|
|
2999
|
-
}
|
|
3000
|
-
fontCb(...p);
|
|
3001
|
-
};
|
|
3002
|
-
o.selectionCb = (...p) => {
|
|
3003
|
-
if (hooks.selection) {
|
|
3004
|
-
hooks.selection(...p);
|
|
3005
|
-
}
|
|
3006
|
-
selectionCb(...p);
|
|
3007
|
-
};
|
|
3008
|
-
o.customElementCb = (...c) => {
|
|
3009
|
-
if (hooks.customElement) {
|
|
3010
|
-
hooks.customElement(...c);
|
|
3011
|
-
}
|
|
3012
|
-
customElementCb(...c);
|
|
3013
|
-
};
|
|
3014
|
-
}
|
|
3015
|
-
function initObservers(o, hooks = {}) {
|
|
2922
|
+
function initObservers(o, _hooks = {}) {
|
|
3016
2923
|
const currentWindow = o.doc.defaultView;
|
|
3017
2924
|
if (!currentWindow) {
|
|
3018
2925
|
return () => {
|
|
3019
2926
|
};
|
|
3020
2927
|
}
|
|
3021
|
-
mergeHooks(o, hooks);
|
|
3022
2928
|
const mutationObserver = initMutationObserver(o, o.doc);
|
|
3023
2929
|
const mousemoveHandler = initMoveObserver(o);
|
|
3024
2930
|
const mouseInteractionHandler = initMouseInteractionObserver(o);
|
|
@@ -3039,10 +2945,6 @@ function initObservers(o, hooks = {}) {
|
|
|
3039
2945
|
};
|
|
3040
2946
|
const selectionObserver = initSelectionObserver(o);
|
|
3041
2947
|
const customElementObserver = initCustomElementObserver(o);
|
|
3042
|
-
const pluginHandlers = [];
|
|
3043
|
-
for (const plugin of o.plugins) {
|
|
3044
|
-
pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
|
|
3045
|
-
}
|
|
3046
2948
|
return callbackWrapper(() => {
|
|
3047
2949
|
mutationBuffers.forEach((b) => b.reset());
|
|
3048
2950
|
mutationObserver.disconnect();
|
|
@@ -3058,7 +2960,6 @@ function initObservers(o, hooks = {}) {
|
|
|
3058
2960
|
fontObserver();
|
|
3059
2961
|
selectionObserver();
|
|
3060
2962
|
customElementObserver();
|
|
3061
|
-
pluginHandlers.forEach((h) => h());
|
|
3062
2963
|
});
|
|
3063
2964
|
}
|
|
3064
2965
|
function hasNestedCSSRule(prop) {
|
|
@@ -3427,369 +3328,6 @@ class ShadowDomManager {
|
|
|
3427
3328
|
}
|
|
3428
3329
|
}
|
|
3429
3330
|
|
|
3430
|
-
/*! *****************************************************************************
|
|
3431
|
-
Copyright (c) Microsoft Corporation.
|
|
3432
|
-
|
|
3433
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3434
|
-
purpose with or without fee is hereby granted.
|
|
3435
|
-
|
|
3436
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3437
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3438
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3439
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3440
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3441
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3442
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3443
|
-
***************************************************************************** */
|
|
3444
|
-
|
|
3445
|
-
function __rest(s, e) {
|
|
3446
|
-
var t = {};
|
|
3447
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3448
|
-
t[p] = s[p];
|
|
3449
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3450
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3451
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3452
|
-
t[p[i]] = s[p[i]];
|
|
3453
|
-
}
|
|
3454
|
-
return t;
|
|
3455
|
-
}
|
|
3456
|
-
|
|
3457
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
3458
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3459
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3460
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3461
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3462
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3463
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3464
|
-
});
|
|
3465
|
-
}
|
|
3466
|
-
|
|
3467
|
-
/*
|
|
3468
|
-
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
3469
|
-
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
3470
|
-
* Released under MIT License
|
|
3471
|
-
*/
|
|
3472
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
3473
|
-
// Use a lookup table to find the index.
|
|
3474
|
-
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
3475
|
-
for (var i = 0; i < chars.length; i++) {
|
|
3476
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
3477
|
-
}
|
|
3478
|
-
var encode = function (arraybuffer) {
|
|
3479
|
-
var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
|
|
3480
|
-
for (i = 0; i < len; i += 3) {
|
|
3481
|
-
base64 += chars[bytes[i] >> 2];
|
|
3482
|
-
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
3483
|
-
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
3484
|
-
base64 += chars[bytes[i + 2] & 63];
|
|
3485
|
-
}
|
|
3486
|
-
if (len % 3 === 2) {
|
|
3487
|
-
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
3488
|
-
}
|
|
3489
|
-
else if (len % 3 === 1) {
|
|
3490
|
-
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
3491
|
-
}
|
|
3492
|
-
return base64;
|
|
3493
|
-
};
|
|
3494
|
-
|
|
3495
|
-
const canvasVarMap = new Map();
|
|
3496
|
-
function variableListFor(ctx, ctor) {
|
|
3497
|
-
let contextMap = canvasVarMap.get(ctx);
|
|
3498
|
-
if (!contextMap) {
|
|
3499
|
-
contextMap = new Map();
|
|
3500
|
-
canvasVarMap.set(ctx, contextMap);
|
|
3501
|
-
}
|
|
3502
|
-
if (!contextMap.has(ctor)) {
|
|
3503
|
-
contextMap.set(ctor, []);
|
|
3504
|
-
}
|
|
3505
|
-
return contextMap.get(ctor);
|
|
3506
|
-
}
|
|
3507
|
-
const saveWebGLVar = (value, win, ctx) => {
|
|
3508
|
-
if (!value ||
|
|
3509
|
-
!(isInstanceOfWebGLObject(value, win) || typeof value === 'object'))
|
|
3510
|
-
return;
|
|
3511
|
-
const name = value.constructor.name;
|
|
3512
|
-
const list = variableListFor(ctx, name);
|
|
3513
|
-
let index = list.indexOf(value);
|
|
3514
|
-
if (index === -1) {
|
|
3515
|
-
index = list.length;
|
|
3516
|
-
list.push(value);
|
|
3517
|
-
}
|
|
3518
|
-
return index;
|
|
3519
|
-
};
|
|
3520
|
-
function serializeArg(value, win, ctx) {
|
|
3521
|
-
if (value instanceof Array) {
|
|
3522
|
-
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
3523
|
-
}
|
|
3524
|
-
else if (value === null) {
|
|
3525
|
-
return value;
|
|
3526
|
-
}
|
|
3527
|
-
else if (value instanceof Float32Array ||
|
|
3528
|
-
value instanceof Float64Array ||
|
|
3529
|
-
value instanceof Int32Array ||
|
|
3530
|
-
value instanceof Uint32Array ||
|
|
3531
|
-
value instanceof Uint8Array ||
|
|
3532
|
-
value instanceof Uint16Array ||
|
|
3533
|
-
value instanceof Int16Array ||
|
|
3534
|
-
value instanceof Int8Array ||
|
|
3535
|
-
value instanceof Uint8ClampedArray) {
|
|
3536
|
-
const name = value.constructor.name;
|
|
3537
|
-
return {
|
|
3538
|
-
rr_type: name,
|
|
3539
|
-
args: [Object.values(value)],
|
|
3540
|
-
};
|
|
3541
|
-
}
|
|
3542
|
-
else if (value instanceof ArrayBuffer) {
|
|
3543
|
-
const name = value.constructor.name;
|
|
3544
|
-
const base64 = encode(value);
|
|
3545
|
-
return {
|
|
3546
|
-
rr_type: name,
|
|
3547
|
-
base64,
|
|
3548
|
-
};
|
|
3549
|
-
}
|
|
3550
|
-
else if (value instanceof DataView) {
|
|
3551
|
-
const name = value.constructor.name;
|
|
3552
|
-
return {
|
|
3553
|
-
rr_type: name,
|
|
3554
|
-
args: [
|
|
3555
|
-
serializeArg(value.buffer, win, ctx),
|
|
3556
|
-
value.byteOffset,
|
|
3557
|
-
value.byteLength,
|
|
3558
|
-
],
|
|
3559
|
-
};
|
|
3560
|
-
}
|
|
3561
|
-
else if (value instanceof HTMLImageElement) {
|
|
3562
|
-
const name = value.constructor.name;
|
|
3563
|
-
const { src } = value;
|
|
3564
|
-
return {
|
|
3565
|
-
rr_type: name,
|
|
3566
|
-
src,
|
|
3567
|
-
};
|
|
3568
|
-
}
|
|
3569
|
-
else if (value instanceof HTMLCanvasElement) {
|
|
3570
|
-
const name = 'HTMLImageElement';
|
|
3571
|
-
const src = value.toDataURL();
|
|
3572
|
-
return {
|
|
3573
|
-
rr_type: name,
|
|
3574
|
-
src,
|
|
3575
|
-
};
|
|
3576
|
-
}
|
|
3577
|
-
else if (value instanceof ImageData) {
|
|
3578
|
-
const name = value.constructor.name;
|
|
3579
|
-
return {
|
|
3580
|
-
rr_type: name,
|
|
3581
|
-
args: [serializeArg(value.data, win, ctx), value.width, value.height],
|
|
3582
|
-
};
|
|
3583
|
-
}
|
|
3584
|
-
else if (isInstanceOfWebGLObject(value, win) || typeof value === 'object') {
|
|
3585
|
-
const name = value.constructor.name;
|
|
3586
|
-
const index = saveWebGLVar(value, win, ctx);
|
|
3587
|
-
return {
|
|
3588
|
-
rr_type: name,
|
|
3589
|
-
index: index,
|
|
3590
|
-
};
|
|
3591
|
-
}
|
|
3592
|
-
return value;
|
|
3593
|
-
}
|
|
3594
|
-
const serializeArgs = (args, win, ctx) => {
|
|
3595
|
-
return [...args].map((arg) => serializeArg(arg, win, ctx));
|
|
3596
|
-
};
|
|
3597
|
-
const isInstanceOfWebGLObject = (value, win) => {
|
|
3598
|
-
const webGLConstructorNames = [
|
|
3599
|
-
'WebGLActiveInfo',
|
|
3600
|
-
'WebGLBuffer',
|
|
3601
|
-
'WebGLFramebuffer',
|
|
3602
|
-
'WebGLProgram',
|
|
3603
|
-
'WebGLRenderbuffer',
|
|
3604
|
-
'WebGLShader',
|
|
3605
|
-
'WebGLShaderPrecisionFormat',
|
|
3606
|
-
'WebGLTexture',
|
|
3607
|
-
'WebGLUniformLocation',
|
|
3608
|
-
'WebGLVertexArrayObject',
|
|
3609
|
-
'WebGLVertexArrayObjectOES',
|
|
3610
|
-
];
|
|
3611
|
-
const supportedWebGLConstructorNames = webGLConstructorNames.filter((name) => typeof win[name] === 'function');
|
|
3612
|
-
return Boolean(supportedWebGLConstructorNames.find((name) => value instanceof win[name]));
|
|
3613
|
-
};
|
|
3614
|
-
|
|
3615
|
-
function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, unblockSelector) {
|
|
3616
|
-
const handlers = [];
|
|
3617
|
-
const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
|
|
3618
|
-
for (const prop of props2D) {
|
|
3619
|
-
try {
|
|
3620
|
-
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== 'function') {
|
|
3621
|
-
continue;
|
|
3622
|
-
}
|
|
3623
|
-
const restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function (original) {
|
|
3624
|
-
return function (...args) {
|
|
3625
|
-
if (!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) {
|
|
3626
|
-
setTimeout(() => {
|
|
3627
|
-
const recordArgs = serializeArgs([...args], win, this);
|
|
3628
|
-
cb(this.canvas, {
|
|
3629
|
-
type: CanvasContext['2D'],
|
|
3630
|
-
property: prop,
|
|
3631
|
-
args: recordArgs,
|
|
3632
|
-
});
|
|
3633
|
-
}, 0);
|
|
3634
|
-
}
|
|
3635
|
-
return original.apply(this, args);
|
|
3636
|
-
};
|
|
3637
|
-
});
|
|
3638
|
-
handlers.push(restoreHandler);
|
|
3639
|
-
}
|
|
3640
|
-
catch (_a) {
|
|
3641
|
-
const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
|
|
3642
|
-
set(v) {
|
|
3643
|
-
cb(this.canvas, {
|
|
3644
|
-
type: CanvasContext['2D'],
|
|
3645
|
-
property: prop,
|
|
3646
|
-
args: [v],
|
|
3647
|
-
setter: true,
|
|
3648
|
-
});
|
|
3649
|
-
},
|
|
3650
|
-
});
|
|
3651
|
-
handlers.push(hookHandler);
|
|
3652
|
-
}
|
|
3653
|
-
}
|
|
3654
|
-
return () => {
|
|
3655
|
-
handlers.forEach((h) => h());
|
|
3656
|
-
};
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
|
-
function getNormalizedContextName(contextType) {
|
|
3660
|
-
return contextType === 'experimental-webgl' ? 'webgl' : contextType;
|
|
3661
|
-
}
|
|
3662
|
-
function initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) {
|
|
3663
|
-
const handlers = [];
|
|
3664
|
-
try {
|
|
3665
|
-
const restoreHandler = patch(win.HTMLCanvasElement.prototype, 'getContext', function (original) {
|
|
3666
|
-
return function (contextType, ...args) {
|
|
3667
|
-
if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) {
|
|
3668
|
-
const ctxName = getNormalizedContextName(contextType);
|
|
3669
|
-
if (!('__context' in this))
|
|
3670
|
-
this.__context = ctxName;
|
|
3671
|
-
if (setPreserveDrawingBufferToTrue &&
|
|
3672
|
-
['webgl', 'webgl2'].includes(ctxName)) {
|
|
3673
|
-
if (args[0] && typeof args[0] === 'object') {
|
|
3674
|
-
const contextAttributes = args[0];
|
|
3675
|
-
if (!contextAttributes.preserveDrawingBuffer) {
|
|
3676
|
-
contextAttributes.preserveDrawingBuffer = true;
|
|
3677
|
-
}
|
|
3678
|
-
}
|
|
3679
|
-
else {
|
|
3680
|
-
args.splice(0, 1, {
|
|
3681
|
-
preserveDrawingBuffer: true,
|
|
3682
|
-
});
|
|
3683
|
-
}
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
return original.apply(this, [contextType, ...args]);
|
|
3687
|
-
};
|
|
3688
|
-
});
|
|
3689
|
-
handlers.push(restoreHandler);
|
|
3690
|
-
}
|
|
3691
|
-
catch (_a) {
|
|
3692
|
-
console.error('failed to patch HTMLCanvasElement.prototype.getContext');
|
|
3693
|
-
}
|
|
3694
|
-
return () => {
|
|
3695
|
-
handlers.forEach((h) => h());
|
|
3696
|
-
};
|
|
3697
|
-
}
|
|
3698
|
-
|
|
3699
|
-
function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, unblockSelector, mirror, win) {
|
|
3700
|
-
const handlers = [];
|
|
3701
|
-
const props = Object.getOwnPropertyNames(prototype);
|
|
3702
|
-
for (const prop of props) {
|
|
3703
|
-
if ([
|
|
3704
|
-
'isContextLost',
|
|
3705
|
-
'canvas',
|
|
3706
|
-
'drawingBufferWidth',
|
|
3707
|
-
'drawingBufferHeight',
|
|
3708
|
-
].includes(prop)) {
|
|
3709
|
-
continue;
|
|
3710
|
-
}
|
|
3711
|
-
try {
|
|
3712
|
-
if (typeof prototype[prop] !== 'function') {
|
|
3713
|
-
continue;
|
|
3714
|
-
}
|
|
3715
|
-
const restoreHandler = patch(prototype, prop, function (original) {
|
|
3716
|
-
return function (...args) {
|
|
3717
|
-
const result = original.apply(this, args);
|
|
3718
|
-
saveWebGLVar(result, win, this);
|
|
3719
|
-
if ('tagName' in this.canvas &&
|
|
3720
|
-
!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) {
|
|
3721
|
-
const recordArgs = serializeArgs([...args], win, this);
|
|
3722
|
-
const mutation = {
|
|
3723
|
-
type,
|
|
3724
|
-
property: prop,
|
|
3725
|
-
args: recordArgs,
|
|
3726
|
-
};
|
|
3727
|
-
cb(this.canvas, mutation);
|
|
3728
|
-
}
|
|
3729
|
-
return result;
|
|
3730
|
-
};
|
|
3731
|
-
});
|
|
3732
|
-
handlers.push(restoreHandler);
|
|
3733
|
-
}
|
|
3734
|
-
catch (_a) {
|
|
3735
|
-
const hookHandler = hookSetter(prototype, prop, {
|
|
3736
|
-
set(v) {
|
|
3737
|
-
cb(this.canvas, {
|
|
3738
|
-
type,
|
|
3739
|
-
property: prop,
|
|
3740
|
-
args: [v],
|
|
3741
|
-
setter: true,
|
|
3742
|
-
});
|
|
3743
|
-
},
|
|
3744
|
-
});
|
|
3745
|
-
handlers.push(hookHandler);
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
return handlers;
|
|
3749
|
-
}
|
|
3750
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, unblockSelector, mirror) {
|
|
3751
|
-
const handlers = [];
|
|
3752
|
-
handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, unblockSelector, mirror, win));
|
|
3753
|
-
if (typeof win.WebGL2RenderingContext !== 'undefined') {
|
|
3754
|
-
handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, unblockSelector, mirror, win));
|
|
3755
|
-
}
|
|
3756
|
-
return () => {
|
|
3757
|
-
handlers.forEach((h) => h());
|
|
3758
|
-
};
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
function decodeBase64(base64, enableUnicode) {
|
|
3762
|
-
var binaryString = atob(base64);
|
|
3763
|
-
if (enableUnicode) {
|
|
3764
|
-
var binaryView = new Uint8Array(binaryString.length);
|
|
3765
|
-
for (var i = 0, n = binaryString.length; i < n; ++i) {
|
|
3766
|
-
binaryView[i] = binaryString.charCodeAt(i);
|
|
3767
|
-
}
|
|
3768
|
-
return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
|
|
3769
|
-
}
|
|
3770
|
-
return binaryString;
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3773
|
-
function createURL(base64, sourcemapArg, enableUnicodeArg) {
|
|
3774
|
-
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
3775
|
-
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
3776
|
-
var source = decodeBase64(base64, enableUnicode);
|
|
3777
|
-
var start = source.indexOf('\n', 10) + 1;
|
|
3778
|
-
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
3779
|
-
var blob = new Blob([body], { type: 'application/javascript' });
|
|
3780
|
-
return URL.createObjectURL(blob);
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
3784
|
-
var url;
|
|
3785
|
-
return function WorkerFactory(options) {
|
|
3786
|
-
url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
|
|
3787
|
-
return new Worker(url, options);
|
|
3788
|
-
};
|
|
3789
|
-
}
|
|
3790
|
-
|
|
3791
|
-
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false);
|
|
3792
|
-
|
|
3793
3331
|
class CanvasManagerNoop {
|
|
3794
3332
|
reset() {
|
|
3795
3333
|
}
|
|
@@ -3802,180 +3340,6 @@ class CanvasManagerNoop {
|
|
|
3802
3340
|
unlock() {
|
|
3803
3341
|
}
|
|
3804
3342
|
}
|
|
3805
|
-
class CanvasManager {
|
|
3806
|
-
reset() {
|
|
3807
|
-
this.pendingCanvasMutations.clear();
|
|
3808
|
-
this.resetObservers && this.resetObservers();
|
|
3809
|
-
}
|
|
3810
|
-
freeze() {
|
|
3811
|
-
this.frozen = true;
|
|
3812
|
-
}
|
|
3813
|
-
unfreeze() {
|
|
3814
|
-
this.frozen = false;
|
|
3815
|
-
}
|
|
3816
|
-
lock() {
|
|
3817
|
-
this.locked = true;
|
|
3818
|
-
}
|
|
3819
|
-
unlock() {
|
|
3820
|
-
this.locked = false;
|
|
3821
|
-
}
|
|
3822
|
-
constructor(options) {
|
|
3823
|
-
this.pendingCanvasMutations = new Map();
|
|
3824
|
-
this.rafStamps = { latestId: 0, invokeId: null };
|
|
3825
|
-
this.frozen = false;
|
|
3826
|
-
this.locked = false;
|
|
3827
|
-
this.processMutation = (target, mutation) => {
|
|
3828
|
-
const newFrame = this.rafStamps.invokeId &&
|
|
3829
|
-
this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
3830
|
-
if (newFrame || !this.rafStamps.invokeId)
|
|
3831
|
-
this.rafStamps.invokeId = this.rafStamps.latestId;
|
|
3832
|
-
if (!this.pendingCanvasMutations.has(target)) {
|
|
3833
|
-
this.pendingCanvasMutations.set(target, []);
|
|
3834
|
-
}
|
|
3835
|
-
this.pendingCanvasMutations.get(target).push(mutation);
|
|
3836
|
-
};
|
|
3837
|
-
const { sampling = 'all', win, blockClass, blockSelector, unblockSelector, recordCanvas, dataURLOptions, } = options;
|
|
3838
|
-
this.mutationCb = options.mutationCb;
|
|
3839
|
-
this.mirror = options.mirror;
|
|
3840
|
-
if (recordCanvas && sampling === 'all')
|
|
3841
|
-
this.initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector);
|
|
3842
|
-
if (recordCanvas && typeof sampling === 'number')
|
|
3843
|
-
this.initCanvasFPSObserver(sampling, win, blockClass, blockSelector, unblockSelector, {
|
|
3844
|
-
dataURLOptions,
|
|
3845
|
-
});
|
|
3846
|
-
}
|
|
3847
|
-
initCanvasFPSObserver(fps, win, blockClass, blockSelector, unblockSelector, options) {
|
|
3848
|
-
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, true);
|
|
3849
|
-
const snapshotInProgressMap = new Map();
|
|
3850
|
-
const worker = new WorkerFactory();
|
|
3851
|
-
worker.onmessage = (e) => {
|
|
3852
|
-
const { id } = e.data;
|
|
3853
|
-
snapshotInProgressMap.set(id, false);
|
|
3854
|
-
if (!('base64' in e.data))
|
|
3855
|
-
return;
|
|
3856
|
-
const { base64, type, width, height } = e.data;
|
|
3857
|
-
this.mutationCb({
|
|
3858
|
-
id,
|
|
3859
|
-
type: CanvasContext['2D'],
|
|
3860
|
-
commands: [
|
|
3861
|
-
{
|
|
3862
|
-
property: 'clearRect',
|
|
3863
|
-
args: [0, 0, width, height],
|
|
3864
|
-
},
|
|
3865
|
-
{
|
|
3866
|
-
property: 'drawImage',
|
|
3867
|
-
args: [
|
|
3868
|
-
{
|
|
3869
|
-
rr_type: 'ImageBitmap',
|
|
3870
|
-
args: [
|
|
3871
|
-
{
|
|
3872
|
-
rr_type: 'Blob',
|
|
3873
|
-
data: [{ rr_type: 'ArrayBuffer', base64 }],
|
|
3874
|
-
type,
|
|
3875
|
-
},
|
|
3876
|
-
],
|
|
3877
|
-
},
|
|
3878
|
-
0,
|
|
3879
|
-
0,
|
|
3880
|
-
],
|
|
3881
|
-
},
|
|
3882
|
-
],
|
|
3883
|
-
});
|
|
3884
|
-
};
|
|
3885
|
-
const timeBetweenSnapshots = 1000 / fps;
|
|
3886
|
-
let lastSnapshotTime = 0;
|
|
3887
|
-
let rafId;
|
|
3888
|
-
const getCanvas = () => {
|
|
3889
|
-
const matchedCanvas = [];
|
|
3890
|
-
win.document.querySelectorAll('canvas').forEach((canvas) => {
|
|
3891
|
-
if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector, true)) {
|
|
3892
|
-
matchedCanvas.push(canvas);
|
|
3893
|
-
}
|
|
3894
|
-
});
|
|
3895
|
-
return matchedCanvas;
|
|
3896
|
-
};
|
|
3897
|
-
const takeCanvasSnapshots = (timestamp) => {
|
|
3898
|
-
if (lastSnapshotTime &&
|
|
3899
|
-
timestamp - lastSnapshotTime < timeBetweenSnapshots) {
|
|
3900
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3901
|
-
return;
|
|
3902
|
-
}
|
|
3903
|
-
lastSnapshotTime = timestamp;
|
|
3904
|
-
getCanvas()
|
|
3905
|
-
.forEach((canvas) => __awaiter(this, void 0, void 0, function* () {
|
|
3906
|
-
var _a;
|
|
3907
|
-
const id = this.mirror.getId(canvas);
|
|
3908
|
-
if (snapshotInProgressMap.get(id))
|
|
3909
|
-
return;
|
|
3910
|
-
snapshotInProgressMap.set(id, true);
|
|
3911
|
-
if (['webgl', 'webgl2'].includes(canvas.__context)) {
|
|
3912
|
-
const context = canvas.getContext(canvas.__context);
|
|
3913
|
-
if (((_a = context === null || context === void 0 ? void 0 : context.getContextAttributes()) === null || _a === void 0 ? void 0 : _a.preserveDrawingBuffer) === false) {
|
|
3914
|
-
context.clear(context.COLOR_BUFFER_BIT);
|
|
3915
|
-
}
|
|
3916
|
-
}
|
|
3917
|
-
const bitmap = yield createImageBitmap(canvas);
|
|
3918
|
-
worker.postMessage({
|
|
3919
|
-
id,
|
|
3920
|
-
bitmap,
|
|
3921
|
-
width: canvas.width,
|
|
3922
|
-
height: canvas.height,
|
|
3923
|
-
dataURLOptions: options.dataURLOptions,
|
|
3924
|
-
}, [bitmap]);
|
|
3925
|
-
}));
|
|
3926
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3927
|
-
};
|
|
3928
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
3929
|
-
this.resetObservers = () => {
|
|
3930
|
-
canvasContextReset();
|
|
3931
|
-
cancelAnimationFrame(rafId);
|
|
3932
|
-
};
|
|
3933
|
-
}
|
|
3934
|
-
initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) {
|
|
3935
|
-
this.startRAFTimestamping();
|
|
3936
|
-
this.startPendingCanvasMutationFlusher();
|
|
3937
|
-
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, false);
|
|
3938
|
-
const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector);
|
|
3939
|
-
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector, this.mirror);
|
|
3940
|
-
this.resetObservers = () => {
|
|
3941
|
-
canvasContextReset();
|
|
3942
|
-
canvas2DReset();
|
|
3943
|
-
canvasWebGL1and2Reset();
|
|
3944
|
-
};
|
|
3945
|
-
}
|
|
3946
|
-
startPendingCanvasMutationFlusher() {
|
|
3947
|
-
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
3948
|
-
}
|
|
3949
|
-
startRAFTimestamping() {
|
|
3950
|
-
const setLatestRAFTimestamp = (timestamp) => {
|
|
3951
|
-
this.rafStamps.latestId = timestamp;
|
|
3952
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
3953
|
-
};
|
|
3954
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
3955
|
-
}
|
|
3956
|
-
flushPendingCanvasMutations() {
|
|
3957
|
-
this.pendingCanvasMutations.forEach((values, canvas) => {
|
|
3958
|
-
const id = this.mirror.getId(canvas);
|
|
3959
|
-
this.flushPendingCanvasMutationFor(canvas, id);
|
|
3960
|
-
});
|
|
3961
|
-
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
3962
|
-
}
|
|
3963
|
-
flushPendingCanvasMutationFor(canvas, id) {
|
|
3964
|
-
if (this.frozen || this.locked) {
|
|
3965
|
-
return;
|
|
3966
|
-
}
|
|
3967
|
-
const valuesWithType = this.pendingCanvasMutations.get(canvas);
|
|
3968
|
-
if (!valuesWithType || id === -1)
|
|
3969
|
-
return;
|
|
3970
|
-
const values = valuesWithType.map((value) => {
|
|
3971
|
-
const rest = __rest(value, ["type"]);
|
|
3972
|
-
return rest;
|
|
3973
|
-
});
|
|
3974
|
-
const { type } = valuesWithType[0];
|
|
3975
|
-
this.mutationCb({ id, type, commands: values });
|
|
3976
|
-
this.pendingCanvasMutations.delete(canvas);
|
|
3977
|
-
}
|
|
3978
|
-
}
|
|
3979
3343
|
|
|
3980
3344
|
class StylesheetManager {
|
|
3981
3345
|
constructor(options) {
|
|
@@ -4071,17 +3435,16 @@ class ProcessedNodeManager {
|
|
|
4071
3435
|
}
|
|
4072
3436
|
|
|
4073
3437
|
function wrapEvent(e) {
|
|
4074
|
-
|
|
3438
|
+
const eWithTime = e;
|
|
3439
|
+
eWithTime.timestamp = nowTimestamp();
|
|
3440
|
+
return eWithTime;
|
|
4075
3441
|
}
|
|
4076
|
-
let
|
|
4077
|
-
let takeFullSnapshot;
|
|
4078
|
-
let canvasManager;
|
|
4079
|
-
let recording = false;
|
|
3442
|
+
let _takeFullSnapshot;
|
|
4080
3443
|
const mirror = createMirror();
|
|
4081
3444
|
function record(options = {}) {
|
|
4082
|
-
const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = 'rr-block', blockSelector = null, unblockSelector = null, ignoreClass = 'rr-ignore', ignoreSelector = null, maskAllText = false, maskTextClass = 'rr-mask', unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn,
|
|
3445
|
+
const { emit, checkoutEveryNms, checkoutEveryNth, blockClass = 'rr-block', blockSelector = null, unblockSelector = null, ignoreClass = 'rr-ignore', ignoreSelector = null, maskAllText = false, maskTextClass = 'rr-mask', unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options.recordAfter === 'DOMContentLoaded'
|
|
4083
3446
|
? options.recordAfter
|
|
4084
|
-
: 'load', userTriggeredOnInput = false, collectFonts = false, inlineImages = false,
|
|
3447
|
+
: 'load', userTriggeredOnInput = false, collectFonts = false, inlineImages = false, keepIframeSrcFn = () => false, ignoreCSSAttributes = new Set([]), errorHandler, onMutation, getCanvasManager, } = options;
|
|
4085
3448
|
registerErrorHandler(errorHandler);
|
|
4086
3449
|
const inEmittingFrame = recordCrossOriginIframes
|
|
4087
3450
|
? window.parent === window
|
|
@@ -4147,18 +3510,13 @@ function record(options = {}) {
|
|
|
4147
3510
|
let lastFullSnapshotEvent;
|
|
4148
3511
|
let incrementalSnapshotCount = 0;
|
|
4149
3512
|
const eventProcessor = (e) => {
|
|
4150
|
-
for (const plugin of plugins || []) {
|
|
4151
|
-
if (plugin.eventProcessor) {
|
|
4152
|
-
e = plugin.eventProcessor(e);
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
4155
3513
|
if (packFn &&
|
|
4156
3514
|
!passEmitsToParent) {
|
|
4157
3515
|
e = packFn(e);
|
|
4158
3516
|
}
|
|
4159
3517
|
return e;
|
|
4160
3518
|
};
|
|
4161
|
-
wrappedEmit = (e, isCheckout) => {
|
|
3519
|
+
const wrappedEmit = (e, isCheckout) => {
|
|
4162
3520
|
var _a;
|
|
4163
3521
|
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
4164
3522
|
e.type !== EventType.FullSnapshot &&
|
|
@@ -4227,29 +3585,17 @@ function record(options = {}) {
|
|
|
4227
3585
|
recordCrossOriginIframes,
|
|
4228
3586
|
wrappedEmit,
|
|
4229
3587
|
});
|
|
4230
|
-
for (const plugin of plugins || []) {
|
|
4231
|
-
if (plugin.getMirror)
|
|
4232
|
-
plugin.getMirror({
|
|
4233
|
-
nodeMirror: mirror,
|
|
4234
|
-
crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,
|
|
4235
|
-
crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror,
|
|
4236
|
-
});
|
|
4237
|
-
}
|
|
4238
3588
|
const processedNodeManager = new ProcessedNodeManager();
|
|
4239
|
-
canvasManager =
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
mirror,
|
|
4250
|
-
sampling: sampling.canvas,
|
|
4251
|
-
dataURLOptions,
|
|
4252
|
-
});
|
|
3589
|
+
const canvasManager = getCanvasManager
|
|
3590
|
+
? getCanvasManager({
|
|
3591
|
+
recordCanvas,
|
|
3592
|
+
blockClass,
|
|
3593
|
+
blockSelector,
|
|
3594
|
+
unblockSelector,
|
|
3595
|
+
sampling: sampling['canvas'],
|
|
3596
|
+
dataURLOptions,
|
|
3597
|
+
})
|
|
3598
|
+
: new CanvasManagerNoop();
|
|
4253
3599
|
const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === 'boolean' &&
|
|
4254
3600
|
__RRWEB_EXCLUDE_SHADOW_DOM__
|
|
4255
3601
|
? new ShadowDomManagerNoop()
|
|
@@ -4284,7 +3630,7 @@ function record(options = {}) {
|
|
|
4284
3630
|
},
|
|
4285
3631
|
mirror,
|
|
4286
3632
|
});
|
|
4287
|
-
takeFullSnapshot = (isCheckout = false) => {
|
|
3633
|
+
const takeFullSnapshot = (isCheckout = false) => {
|
|
4288
3634
|
wrappedEmit(wrapEvent({
|
|
4289
3635
|
type: EventType.Meta,
|
|
4290
3636
|
data: {
|
|
@@ -4349,10 +3695,10 @@ function record(options = {}) {
|
|
|
4349
3695
|
if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
|
|
4350
3696
|
stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document));
|
|
4351
3697
|
};
|
|
3698
|
+
_takeFullSnapshot = takeFullSnapshot;
|
|
4352
3699
|
try {
|
|
4353
3700
|
const handlers = [];
|
|
4354
3701
|
const observe = (doc) => {
|
|
4355
|
-
var _a;
|
|
4356
3702
|
return callbackWrapper(initObservers)({
|
|
4357
3703
|
onMutation,
|
|
4358
3704
|
mutationCb: wrappedMutationEmit,
|
|
@@ -4436,18 +3782,8 @@ function record(options = {}) {
|
|
|
4436
3782
|
processedNodeManager,
|
|
4437
3783
|
canvasManager,
|
|
4438
3784
|
ignoreCSSAttributes,
|
|
4439
|
-
plugins:
|
|
4440
|
-
|
|
4441
|
-
options: p.options,
|
|
4442
|
-
callback: (payload) => wrappedEmit(wrapEvent({
|
|
4443
|
-
type: EventType.Plugin,
|
|
4444
|
-
data: {
|
|
4445
|
-
plugin: p.name,
|
|
4446
|
-
payload,
|
|
4447
|
-
},
|
|
4448
|
-
})),
|
|
4449
|
-
}))) || [],
|
|
4450
|
-
}, hooks);
|
|
3785
|
+
plugins: [],
|
|
3786
|
+
}, {});
|
|
4451
3787
|
};
|
|
4452
3788
|
iframeManager.addLoadListener((iframeEl) => {
|
|
4453
3789
|
try {
|
|
@@ -4460,7 +3796,6 @@ function record(options = {}) {
|
|
|
4460
3796
|
const init = () => {
|
|
4461
3797
|
takeFullSnapshot();
|
|
4462
3798
|
handlers.push(observe(document));
|
|
4463
|
-
recording = true;
|
|
4464
3799
|
};
|
|
4465
3800
|
if (document.readyState === 'interactive' ||
|
|
4466
3801
|
document.readyState === 'complete') {
|
|
@@ -4487,7 +3822,7 @@ function record(options = {}) {
|
|
|
4487
3822
|
return () => {
|
|
4488
3823
|
handlers.forEach((h) => h());
|
|
4489
3824
|
processedNodeManager.destroy();
|
|
4490
|
-
|
|
3825
|
+
_takeFullSnapshot = undefined;
|
|
4491
3826
|
unregisterErrorHandler();
|
|
4492
3827
|
};
|
|
4493
3828
|
}
|
|
@@ -4495,28 +3830,17 @@ function record(options = {}) {
|
|
|
4495
3830
|
console.warn(error);
|
|
4496
3831
|
}
|
|
4497
3832
|
}
|
|
4498
|
-
|
|
4499
|
-
if (!
|
|
4500
|
-
throw new Error('please add custom event after start recording');
|
|
4501
|
-
}
|
|
4502
|
-
wrappedEmit(wrapEvent({
|
|
4503
|
-
type: EventType.Custom,
|
|
4504
|
-
data: {
|
|
4505
|
-
tag,
|
|
4506
|
-
payload,
|
|
4507
|
-
},
|
|
4508
|
-
}));
|
|
4509
|
-
};
|
|
4510
|
-
record.freezePage = () => {
|
|
4511
|
-
mutationBuffers.forEach((buf) => buf.freeze());
|
|
4512
|
-
};
|
|
4513
|
-
record.takeFullSnapshot = (isCheckout) => {
|
|
4514
|
-
if (!recording) {
|
|
3833
|
+
function takeFullSnapshot(isCheckout) {
|
|
3834
|
+
if (!_takeFullSnapshot) {
|
|
4515
3835
|
throw new Error('please take full snapshot after start recording');
|
|
4516
3836
|
}
|
|
4517
|
-
|
|
4518
|
-
}
|
|
3837
|
+
_takeFullSnapshot(isCheckout);
|
|
3838
|
+
}
|
|
4519
3839
|
record.mirror = mirror;
|
|
3840
|
+
record.takeFullSnapshot = takeFullSnapshot;
|
|
3841
|
+
|
|
3842
|
+
const ReplayEventTypeIncrementalSnapshot = 3;
|
|
3843
|
+
const ReplayEventTypeCustom = 5;
|
|
4520
3844
|
|
|
4521
3845
|
/**
|
|
4522
3846
|
* Converts a timestamp to ms, if it was in s, or keeps it as ms.
|
|
@@ -4568,6 +3892,12 @@ function addBreadcrumbEvent(replay, breadcrumb) {
|
|
|
4568
3892
|
|
|
4569
3893
|
const INTERACTIVE_SELECTOR = 'button,a';
|
|
4570
3894
|
|
|
3895
|
+
/** Get the closest interactive parent element, or else return the given element. */
|
|
3896
|
+
function getClosestInteractive(element) {
|
|
3897
|
+
const closestInteractive = element.closest(INTERACTIVE_SELECTOR);
|
|
3898
|
+
return closestInteractive || element;
|
|
3899
|
+
}
|
|
3900
|
+
|
|
4571
3901
|
/**
|
|
4572
3902
|
* For clicks, we check if the target is inside of a button or link
|
|
4573
3903
|
* If so, we use this as the target instead
|
|
@@ -4581,8 +3911,7 @@ function getClickTargetNode(event) {
|
|
|
4581
3911
|
return target;
|
|
4582
3912
|
}
|
|
4583
3913
|
|
|
4584
|
-
|
|
4585
|
-
return closestInteractive || target;
|
|
3914
|
+
return getClosestInteractive(target);
|
|
4586
3915
|
}
|
|
4587
3916
|
|
|
4588
3917
|
/** Get the event target node. */
|
|
@@ -4667,48 +3996,14 @@ class ClickDetector {
|
|
|
4667
3996
|
|
|
4668
3997
|
/** Register click detection handlers on mutation or scroll. */
|
|
4669
3998
|
addListeners() {
|
|
4670
|
-
const mutationHandler = () => {
|
|
4671
|
-
this._lastMutation = nowInSeconds();
|
|
4672
|
-
};
|
|
4673
|
-
|
|
4674
|
-
const scrollHandler = () => {
|
|
4675
|
-
this._lastScroll = nowInSeconds();
|
|
4676
|
-
};
|
|
4677
|
-
|
|
4678
3999
|
const cleanupWindowOpen = onWindowOpen(() => {
|
|
4679
4000
|
// Treat window.open as mutation
|
|
4680
4001
|
this._lastMutation = nowInSeconds();
|
|
4681
4002
|
});
|
|
4682
4003
|
|
|
4683
|
-
const clickHandler = (event) => {
|
|
4684
|
-
if (!event.target) {
|
|
4685
|
-
return;
|
|
4686
|
-
}
|
|
4687
|
-
|
|
4688
|
-
const node = getClickTargetNode(event);
|
|
4689
|
-
if (node) {
|
|
4690
|
-
this._handleMultiClick(node );
|
|
4691
|
-
}
|
|
4692
|
-
};
|
|
4693
|
-
|
|
4694
|
-
const obs = new MutationObserver(mutationHandler);
|
|
4695
|
-
|
|
4696
|
-
obs.observe(WINDOW.document.documentElement, {
|
|
4697
|
-
attributes: true,
|
|
4698
|
-
characterData: true,
|
|
4699
|
-
childList: true,
|
|
4700
|
-
subtree: true,
|
|
4701
|
-
});
|
|
4702
|
-
|
|
4703
|
-
WINDOW.addEventListener('scroll', scrollHandler, { passive: true });
|
|
4704
|
-
WINDOW.addEventListener('click', clickHandler, { passive: true });
|
|
4705
|
-
|
|
4706
4004
|
this._teardown = () => {
|
|
4707
|
-
WINDOW.removeEventListener('scroll', scrollHandler);
|
|
4708
|
-
WINDOW.removeEventListener('click', clickHandler);
|
|
4709
4005
|
cleanupWindowOpen();
|
|
4710
4006
|
|
|
4711
|
-
obs.disconnect();
|
|
4712
4007
|
this._clicks = [];
|
|
4713
4008
|
this._lastMutation = 0;
|
|
4714
4009
|
this._lastScroll = 0;
|
|
@@ -4726,7 +4021,7 @@ class ClickDetector {
|
|
|
4726
4021
|
}
|
|
4727
4022
|
}
|
|
4728
4023
|
|
|
4729
|
-
/**
|
|
4024
|
+
/** @inheritDoc */
|
|
4730
4025
|
handleClick(breadcrumb, node) {
|
|
4731
4026
|
if (ignoreElement(node, this._ignoreSelector) || !isClickBreadcrumb(breadcrumb)) {
|
|
4732
4027
|
return;
|
|
@@ -4755,6 +4050,22 @@ class ClickDetector {
|
|
|
4755
4050
|
}
|
|
4756
4051
|
}
|
|
4757
4052
|
|
|
4053
|
+
/** @inheritDoc */
|
|
4054
|
+
registerMutation(timestamp = Date.now()) {
|
|
4055
|
+
this._lastMutation = timestampToS(timestamp);
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4058
|
+
/** @inheritDoc */
|
|
4059
|
+
registerScroll(timestamp = Date.now()) {
|
|
4060
|
+
this._lastScroll = timestampToS(timestamp);
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
/** @inheritDoc */
|
|
4064
|
+
registerClick(element) {
|
|
4065
|
+
const node = getClosestInteractive(element);
|
|
4066
|
+
this._handleMultiClick(node );
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4758
4069
|
/** Count multiple clicks on elements. */
|
|
4759
4070
|
_handleMultiClick(node) {
|
|
4760
4071
|
this._getClicks(node).forEach(click => {
|
|
@@ -4909,6 +4220,53 @@ function nowInSeconds() {
|
|
|
4909
4220
|
return Date.now() / 1000;
|
|
4910
4221
|
}
|
|
4911
4222
|
|
|
4223
|
+
/** Update the click detector based on a recording event of rrweb. */
|
|
4224
|
+
function updateClickDetectorForRecordingEvent(clickDetector, event) {
|
|
4225
|
+
try {
|
|
4226
|
+
// note: We only consider incremental snapshots here
|
|
4227
|
+
// This means that any full snapshot is ignored for mutation detection - the reason is that we simply cannot know if a mutation happened here.
|
|
4228
|
+
// E.g. think that we are buffering, an error happens and we take a full snapshot because we switched to session mode -
|
|
4229
|
+
// in this scenario, we would not know if a dead click happened because of the error, which is a key dead click scenario.
|
|
4230
|
+
// Instead, by ignoring full snapshots, we have the risk that we generate a false positive
|
|
4231
|
+
// (if a mutation _did_ happen but was "swallowed" by the full snapshot)
|
|
4232
|
+
// But this should be more unlikely as we'd generally capture the incremental snapshot right away
|
|
4233
|
+
|
|
4234
|
+
if (!isIncrementalEvent(event)) {
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
const { source } = event.data;
|
|
4239
|
+
if (source === IncrementalSource.Mutation) {
|
|
4240
|
+
clickDetector.registerMutation(event.timestamp);
|
|
4241
|
+
}
|
|
4242
|
+
|
|
4243
|
+
if (source === IncrementalSource.Scroll) {
|
|
4244
|
+
clickDetector.registerScroll(event.timestamp);
|
|
4245
|
+
}
|
|
4246
|
+
|
|
4247
|
+
if (isIncrementalMouseInteraction(event)) {
|
|
4248
|
+
const { type, id } = event.data;
|
|
4249
|
+
const node = record.mirror.getNode(id);
|
|
4250
|
+
|
|
4251
|
+
if (node instanceof HTMLElement && type === MouseInteractions.Click) {
|
|
4252
|
+
clickDetector.registerClick(node);
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
} catch (e) {
|
|
4256
|
+
// ignore errors here, e.g. if accessing something that does not exist
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4259
|
+
|
|
4260
|
+
function isIncrementalEvent(event) {
|
|
4261
|
+
return event.type === ReplayEventTypeIncrementalSnapshot;
|
|
4262
|
+
}
|
|
4263
|
+
|
|
4264
|
+
function isIncrementalMouseInteraction(
|
|
4265
|
+
event,
|
|
4266
|
+
) {
|
|
4267
|
+
return event.data.source === IncrementalSource.MouseInteraction;
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4912
4270
|
/**
|
|
4913
4271
|
* Create a breadcrumb for a replay.
|
|
4914
4272
|
*/
|
|
@@ -5315,7 +4673,7 @@ function setupPerformanceObserver(replay) {
|
|
|
5315
4673
|
};
|
|
5316
4674
|
}
|
|
5317
4675
|
|
|
5318
|
-
const r = `var t={},e={};function a(t){let e=t.length;for(;--e>=0;)t[e]=0}const s=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),r=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),n=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_=new Array(576);a(_);const l=new Array(60);a(l);const h=new Array(512);a(h);const o=new Array(256);a(o);const d=new Array(29);a(d);const u=new Array(30);function f(t,e,a,s,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=s,this.max_length=r,this.has_stree=t&&t.length}let c,p,g;function w(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}a(u);const m=t=>t<256?h[t]:h[256+(t>>>7)],b=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},y=(t,e,a)=>{t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,b(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},v=(t,e,a)=>{y(t,a[2*e],a[2*e+1])},z=(t,e)=>{let a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},k=(t,e,a)=>{const s=new Array(16);let r,n,i=0;for(r=1;r<=15;r++)i=i+a[r-1]<<1,s[r]=i;for(n=0;n<=e;n++){let e=t[2*n+1];0!==e&&(t[2*n]=z(s[e]++,e))}},x=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},A=t=>{t.bi_valid>8?b(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},E=(t,e,a,s)=>{const r=2*e,n=2*a;return t[r]<t[n]||t[r]===t[n]&&s[e]<=s[a]},Z=(t,e,a)=>{const s=t.heap[a];let r=a<<1;for(;r<=t.heap_len&&(r<t.heap_len&&E(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!E(e,s,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=s},S=(t,e,a)=>{let n,i,_,l,h=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+h++],n+=(255&t.pending_buf[t.sym_buf+h++])<<8,i=t.pending_buf[t.sym_buf+h++],0===n?v(t,i,e):(_=o[i],v(t,_+256+1,e),l=s[_],0!==l&&(i-=d[_],y(t,i,l)),n--,_=m(n),v(t,_,a),l=r[_],0!==l&&(n-=u[_],y(t,n,l)))}while(h<t.sym_next);v(t,256,e)},U=(t,e)=>{const a=e.dyn_tree,s=e.stat_desc.static_tree,r=e.stat_desc.has_stree,n=e.stat_desc.elems;let i,_,l,h=-1;for(t.heap_len=0,t.heap_max=573,i=0;i<n;i++)0!==a[2*i]?(t.heap[++t.heap_len]=h=i,t.depth[i]=0):a[2*i+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=h<2?++h:0,a[2*l]=1,t.depth[l]=0,t.opt_len--,r&&(t.static_len-=s[2*l+1]);for(e.max_code=h,i=t.heap_len>>1;i>=1;i--)Z(t,a,i);l=n;do{i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Z(t,a,1),_=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=_,a[2*l]=a[2*i]+a[2*_],t.depth[l]=(t.depth[i]>=t.depth[_]?t.depth[i]:t.depth[_])+1,a[2*i+1]=a[2*_+1]=l,t.heap[1]=l++,Z(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const a=e.dyn_tree,s=e.max_code,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,i=e.stat_desc.extra_bits,_=e.stat_desc.extra_base,l=e.stat_desc.max_length;let h,o,d,u,f,c,p=0;for(u=0;u<=15;u++)t.bl_count[u]=0;for(a[2*t.heap[t.heap_max]+1]=0,h=t.heap_max+1;h<573;h++)o=t.heap[h],u=a[2*a[2*o+1]+1]+1,u>l&&(u=l,p++),a[2*o+1]=u,o>s||(t.bl_count[u]++,f=0,o>=_&&(f=i[o-_]),c=a[2*o],t.opt_len+=c*(u+f),n&&(t.static_len+=c*(r[2*o+1]+f)));if(0!==p){do{for(u=l-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[l]--,p-=2}while(p>0);for(u=l;0!==u;u--)for(o=t.bl_count[u];0!==o;)d=t.heap[--h],d>s||(a[2*d+1]!==u&&(t.opt_len+=(u-a[2*d+1])*a[2*d],a[2*d+1]=u),o--)}})(t,e),k(a,h,t.bl_count)},R=(t,e,a)=>{let s,r,n=-1,i=e[1],_=0,l=7,h=4;for(0===i&&(l=138,h=3),e[2*(a+1)+1]=65535,s=0;s<=a;s++)r=i,i=e[2*(s+1)+1],++_<l&&r===i||(_<h?t.bl_tree[2*r]+=_:0!==r?(r!==n&&t.bl_tree[2*r]++,t.bl_tree[32]++):_<=10?t.bl_tree[34]++:t.bl_tree[36]++,_=0,n=r,0===i?(l=138,h=3):r===i?(l=6,h=3):(l=7,h=4))},L=(t,e,a)=>{let s,r,n=-1,i=e[1],_=0,l=7,h=4;for(0===i&&(l=138,h=3),s=0;s<=a;s++)if(r=i,i=e[2*(s+1)+1],!(++_<l&&r===i)){if(_<h)do{v(t,r,t.bl_tree)}while(0!=--_);else 0!==r?(r!==n&&(v(t,r,t.bl_tree),_--),v(t,16,t.bl_tree),y(t,_-3,2)):_<=10?(v(t,17,t.bl_tree),y(t,_-3,3)):(v(t,18,t.bl_tree),y(t,_-11,7));_=0,n=r,0===i?(l=138,h=3):r===i?(l=6,h=3):(l=7,h=4)}};let T=!1;const F=(t,e,a,s)=>{y(t,0+(s?1:0),3),A(t),b(t,a),b(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a};e._tr_init=t=>{T||((()=>{let t,e,a,i,w;const m=new Array(16);for(a=0,i=0;i<28;i++)for(d[i]=a,t=0;t<1<<s[i];t++)o[a++]=i;for(o[a-1]=i,w=0,i=0;i<16;i++)for(u[i]=w,t=0;t<1<<r[i];t++)h[w++]=i;for(w>>=7;i<30;i++)for(u[i]=w<<7,t=0;t<1<<r[i]-7;t++)h[256+w++]=i;for(e=0;e<=15;e++)m[e]=0;for(t=0;t<=143;)_[2*t+1]=8,t++,m[8]++;for(;t<=255;)_[2*t+1]=9,t++,m[9]++;for(;t<=279;)_[2*t+1]=7,t++,m[7]++;for(;t<=287;)_[2*t+1]=8,t++,m[8]++;for(k(_,287,m),t=0;t<30;t++)l[2*t+1]=5,l[2*t]=z(t,5);c=new f(_,s,257,286,15),p=new f(l,r,0,30,15),g=new f(new Array(0),n,0,19,7)})(),T=!0),t.l_desc=new w(t.dyn_ltree,c),t.d_desc=new w(t.dyn_dtree,p),t.bl_desc=new w(t.bl_tree,g),t.bi_buf=0,t.bi_valid=0,x(t)},e._tr_stored_block=F,e._tr_flush_block=(t,e,a,s)=>{let r,n,h=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),U(t,t.l_desc),U(t,t.d_desc),h=(t=>{let e;for(R(t,t.dyn_ltree,t.l_desc.max_code),R(t,t.dyn_dtree,t.d_desc.max_code),U(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*i[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),r=t.opt_len+3+7>>>3,n=t.static_len+3+7>>>3,n<=r&&(r=n)):r=n=a+5,a+4<=r&&-1!==e?F(t,e,a,s):4===t.strategy||n===r?(y(t,2+(s?1:0),3),S(t,_,l)):(y(t,4+(s?1:0),3),((t,e,a,s)=>{let r;for(y(t,e-257,5),y(t,a-1,5),y(t,s-4,4),r=0;r<s;r++)y(t,t.bl_tree[2*i[r]+1],3);L(t,t.dyn_ltree,e-1),L(t,t.dyn_dtree,a-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,h+1),S(t,t.dyn_ltree,t.dyn_dtree)),x(t),s&&A(t)},e._tr_tally=(t,e,a)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=a,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(o[a]+256+1)]++,t.dyn_dtree[2*m(e)]++),t.sym_next===t.sym_end),e._tr_align=t=>{y(t,2,3),v(t,256,_),(t=>{16===t.bi_valid?(b(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)};var O=(t,e,a,s)=>{let r=65535&t|0,n=t>>>16&65535|0,i=0;for(;0!==a;){i=a>2e3?2e3:a,a-=i;do{r=r+e[s++]|0,n=n+r|0}while(--i);r%=65521,n%=65521}return r|n<<16|0};const D=new Uint32Array((()=>{let t,e=[];for(var a=0;a<256;a++){t=a;for(var s=0;s<8;s++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e})());var N=(t,e,a,s)=>{const r=D,n=s+a;t^=-1;for(let a=s;a<n;a++)t=t>>>8^r[255&(t^e[a])];return-1^t},C={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},I={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:H,_tr_stored_block:B,_tr_flush_block:M,_tr_tally:P,_tr_align:Y}=e,K=O,j=N,G=C,{Z_NO_FLUSH:X,Z_PARTIAL_FLUSH:W,Z_FULL_FLUSH:q,Z_FINISH:J,Z_BLOCK:Q,Z_OK:V,Z_STREAM_END:$,Z_STREAM_ERROR:tt,Z_DATA_ERROR:et,Z_BUF_ERROR:at,Z_DEFAULT_COMPRESSION:st,Z_FILTERED:rt,Z_HUFFMAN_ONLY:nt,Z_RLE:it,Z_FIXED:_t,Z_DEFAULT_STRATEGY:lt,Z_UNKNOWN:ht,Z_DEFLATED:ot}=I,dt=(t,e)=>(t.msg=G[e],e),ut=t=>2*t-(t>4?9:0),ft=t=>{let e=t.length;for(;--e>=0;)t[e]=0},ct=t=>{let e,a,s,r=t.w_size;e=t.hash_size,s=e;do{a=t.head[--s],t.head[s]=a>=r?a-r:0}while(--e);e=r,s=e;do{a=t.prev[--s],t.prev[s]=a>=r?a-r:0}while(--e)};let pt=(t,e,a)=>(e<<t.hash_shift^a)&t.hash_mask;const gt=t=>{const e=t.state;let a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},wt=(t,e)=>{M(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,gt(t.strm)},mt=(t,e)=>{t.pending_buf[t.pending++]=e},bt=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},yt=(t,e,a,s)=>{let r=t.avail_in;return r>s&&(r=s),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),a),1===t.state.wrap?t.adler=K(t.adler,e,r,a):2===t.state.wrap&&(t.adler=j(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)},vt=(t,e)=>{let a,s,r=t.max_chain_length,n=t.strstart,i=t.prev_length,_=t.nice_match;const l=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,h=t.window,o=t.w_mask,d=t.prev,u=t.strstart+258;let f=h[n+i-1],c=h[n+i];t.prev_length>=t.good_match&&(r>>=2),_>t.lookahead&&(_=t.lookahead);do{if(a=e,h[a+i]===c&&h[a+i-1]===f&&h[a]===h[n]&&h[++a]===h[n+1]){n+=2,a++;do{}while(h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&h[++n]===h[++a]&&n<u);if(s=258-(u-n),n=u-258,s>i){if(t.match_start=e,i=s,s>=_)break;f=h[n+i-1],c=h[n+i]}}}while((e=d[e&o])>l&&0!=--r);return i<=t.lookahead?i:t.lookahead},zt=t=>{const e=t.w_size;let a,s,r;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-262)&&(t.window.set(t.window.subarray(e,e+e-s),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),ct(t),s+=e),0===t.strm.avail_in)break;if(a=yt(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=a,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=pt(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=pt(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)},kt=(t,e)=>{let a,s,r,n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i=0,_=t.strm.avail_in;do{if(a=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r)break;if(r=t.strm.avail_out-r,s=t.strstart-t.block_start,a>s+t.strm.avail_in&&(a=s+t.strm.avail_in),a>r&&(a=r),a<n&&(0===a&&e!==J||e===X||a!==s+t.strm.avail_in))break;i=e===J&&a===s+t.strm.avail_in?1:0,B(t,0,0,i),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,gt(t.strm),s&&(s>a&&(s=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+s),t.strm.next_out),t.strm.next_out+=s,t.strm.avail_out-=s,t.strm.total_out+=s,t.block_start+=s,a-=s),a&&(yt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a)}while(0===i);return _-=t.strm.avail_in,_&&(_>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=_&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-_,t.strm.next_in),t.strstart),t.strstart+=_,t.insert+=_>t.w_size-t.insert?t.w_size-t.insert:_),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),i?4:e!==X&&e!==J&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(yt(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,n=r>t.w_size?t.w_size:r,s=t.strstart-t.block_start,(s>=n||(s||e===J)&&e!==X&&0===t.strm.avail_in&&s<=r)&&(a=s>r?r:s,i=e===J&&0===t.strm.avail_in&&a===s?1:0,B(t,t.block_start,a,i),t.block_start+=a,gt(t.strm)),i?3:1)},xt=(t,e)=>{let a,s;for(;;){if(t.lookahead<262){if(zt(t),t.lookahead<262&&e===X)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-262&&(t.match_length=vt(t,a)),t.match_length>=3)if(s=P(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=pt(t,t.ins_h,t.window[t.strstart+1]);else s=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(s&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2},At=(t,e)=>{let a,s,r;for(;;){if(t.lookahead<262){if(zt(t),t.lookahead<262&&e===X)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-262&&(t.match_length=vt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,s=P(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=pt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,s&&(wt(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(s=P(t,0,t.window[t.strstart-1]),s&&wt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(s=P(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2};function Et(t,e,a,s,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=s,this.func=r}const Zt=[new Et(0,0,0,0,kt),new Et(4,4,8,4,xt),new Et(4,5,16,8,xt),new Et(4,6,32,32,xt),new Et(4,4,16,16,At),new Et(8,16,32,32,At),new Et(8,16,128,128,At),new Et(8,32,128,256,At),new Et(32,128,258,1024,At),new Et(32,258,258,4096,At)];function St(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ot,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),ft(this.dyn_ltree),ft(this.dyn_dtree),ft(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),ft(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ft(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ut=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||42!==e.status&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&113!==e.status&&666!==e.status?1:0},Rt=t=>{if(Ut(t))return dt(t,tt);t.total_in=t.total_out=0,t.data_type=ht;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=-2,H(e),V},Lt=t=>{const e=Rt(t);var a;return e===V&&((a=t.state).window_size=2*a.w_size,ft(a.head),a.max_lazy_match=Zt[a.level].max_lazy,a.good_match=Zt[a.level].good_length,a.nice_match=Zt[a.level].nice_length,a.max_chain_length=Zt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e},Tt=(t,e,a,s,r,n)=>{if(!t)return tt;let i=1;if(e===st&&(e=6),s<0?(i=0,s=-s):s>15&&(i=2,s-=16),r<1||r>9||a!==ot||s<8||s>15||e<0||e>9||n<0||n>_t||8===s&&1!==i)return dt(t,tt);8===s&&(s=9);const _=new St;return t.state=_,_.strm=t,_.status=42,_.wrap=i,_.gzhead=null,_.w_bits=s,_.w_size=1<<_.w_bits,_.w_mask=_.w_size-1,_.hash_bits=r+7,_.hash_size=1<<_.hash_bits,_.hash_mask=_.hash_size-1,_.hash_shift=~~((_.hash_bits+3-1)/3),_.window=new Uint8Array(2*_.w_size),_.head=new Uint16Array(_.hash_size),_.prev=new Uint16Array(_.w_size),_.lit_bufsize=1<<r+6,_.pending_buf_size=4*_.lit_bufsize,_.pending_buf=new Uint8Array(_.pending_buf_size),_.sym_buf=_.lit_bufsize,_.sym_end=3*(_.lit_bufsize-1),_.level=e,_.strategy=n,_.method=a,Lt(t)};t.deflateInit=(t,e)=>Tt(t,e,ot,15,8,lt),t.deflateInit2=Tt,t.deflateReset=Lt,t.deflateResetKeep=Rt,t.deflateSetHeader=(t,e)=>Ut(t)||2!==t.state.wrap?tt:(t.state.gzhead=e,V),t.deflate=(t,e)=>{if(Ut(t)||e>Q||e<0)return t?dt(t,tt):tt;const a=t.state;if(!t.output||0!==t.avail_in&&!t.input||666===a.status&&e!==J)return dt(t,0===t.avail_out?at:tt);const s=a.last_flush;if(a.last_flush=e,0!==a.pending){if(gt(t),0===t.avail_out)return a.last_flush=-1,V}else if(0===t.avail_in&&ut(e)<=ut(s)&&e!==J)return dt(t,at);if(666===a.status&&0!==t.avail_in)return dt(t,at);if(42===a.status&&0===a.wrap&&(a.status=113),42===a.status){let e=ot+(a.w_bits-8<<4)<<8,s=-1;if(s=a.strategy>=nt||a.level<2?0:a.level<6?1:6===a.level?2:3,e|=s<<6,0!==a.strstart&&(e|=32),e+=31-e%31,bt(a,e),0!==a.strstart&&(bt(a,t.adler>>>16),bt(a,65535&t.adler)),t.adler=1,a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V}if(57===a.status)if(t.adler=0,mt(a,31),mt(a,139),mt(a,8),a.gzhead)mt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),mt(a,255&a.gzhead.time),mt(a,a.gzhead.time>>8&255),mt(a,a.gzhead.time>>16&255),mt(a,a.gzhead.time>>24&255),mt(a,9===a.level?2:a.strategy>=nt||a.level<2?4:0),mt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(mt(a,255&a.gzhead.extra.length),mt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=j(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(mt(a,0),mt(a,0),mt(a,0),mt(a,0),mt(a,0),mt(a,9===a.level?2:a.strategy>=nt||a.level<2?4:0),mt(a,3),a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V;if(69===a.status){if(a.gzhead.extra){let e=a.pending,s=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+s>a.pending_buf_size;){let r=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+r),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>e&&(t.adler=j(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex+=r,gt(t),0!==a.pending)return a.last_flush=-1,V;e=0,s-=r}let r=new Uint8Array(a.gzhead.extra);a.pending_buf.set(r.subarray(a.gzindex,a.gzindex+s),a.pending),a.pending+=s,a.gzhead.hcrc&&a.pending>e&&(t.adler=j(t.adler,a.pending_buf,a.pending-e,e)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let e,s=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),gt(t),0!==a.pending)return a.last_flush=-1,V;s=0}e=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,mt(a,e)}while(0!==e);a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let e,s=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s)),gt(t),0!==a.pending)return a.last_flush=-1,V;s=0}e=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,mt(a,e)}while(0!==e);a.gzhead.hcrc&&a.pending>s&&(t.adler=j(t.adler,a.pending_buf,a.pending-s,s))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(gt(t),0!==a.pending))return a.last_flush=-1,V;mt(a,255&t.adler),mt(a,t.adler>>8&255),t.adler=0}if(a.status=113,gt(t),0!==a.pending)return a.last_flush=-1,V}if(0!==t.avail_in||0!==a.lookahead||e!==X&&666!==a.status){let s=0===a.level?kt(a,e):a.strategy===nt?((t,e)=>{let a;for(;;){if(0===t.lookahead&&(zt(t),0===t.lookahead)){if(e===X)return 1;break}if(t.match_length=0,a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2})(a,e):a.strategy===it?((t,e)=>{let a,s,r,n;const i=t.window;for(;;){if(t.lookahead<=258){if(zt(t),t.lookahead<=258&&e===X)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=t.strstart-1,s=i[r],s===i[++r]&&s===i[++r]&&s===i[++r])){n=t.strstart+258;do{}while(s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&s===i[++r]&&r<n);t.match_length=258-(n-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=P(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=P(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(wt(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===J?(wt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(wt(t,!1),0===t.strm.avail_out)?1:2})(a,e):Zt[a.level].func(a,e);if(3!==s&&4!==s||(a.status=666),1===s||3===s)return 0===t.avail_out&&(a.last_flush=-1),V;if(2===s&&(e===W?Y(a):e!==Q&&(B(a,0,0,!1),e===q&&(ft(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),gt(t),0===t.avail_out))return a.last_flush=-1,V}return e!==J?V:a.wrap<=0?$:(2===a.wrap?(mt(a,255&t.adler),mt(a,t.adler>>8&255),mt(a,t.adler>>16&255),mt(a,t.adler>>24&255),mt(a,255&t.total_in),mt(a,t.total_in>>8&255),mt(a,t.total_in>>16&255),mt(a,t.total_in>>24&255)):(bt(a,t.adler>>>16),bt(a,65535&t.adler)),gt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?V:$)},t.deflateEnd=t=>{if(Ut(t))return tt;const e=t.state.status;return t.state=null,113===e?dt(t,et):V},t.deflateSetDictionary=(t,e)=>{let a=e.length;if(Ut(t))return tt;const s=t.state,r=s.wrap;if(2===r||1===r&&42!==s.status||s.lookahead)return tt;if(1===r&&(t.adler=K(t.adler,e,a,0)),s.wrap=0,a>=s.w_size){0===r&&(ft(s.head),s.strstart=0,s.block_start=0,s.insert=0);let t=new Uint8Array(s.w_size);t.set(e.subarray(a-s.w_size,a),0),e=t,a=s.w_size}const n=t.avail_in,i=t.next_in,_=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,zt(s);s.lookahead>=3;){let t=s.strstart,e=s.lookahead-2;do{s.ins_h=pt(s,s.ins_h,s.window[t+3-1]),s.prev[t&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=t,t++}while(--e);s.strstart=t,s.lookahead=2,zt(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=2,s.match_available=0,t.next_in=i,t.input=_,t.avail_in=n,s.wrap=r,V},t.deflateInfo="pako deflate (from Nodeca project)";var Ft={};const Ot=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);Ft.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const a=e.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const e in a)Ot(a,e)&&(t[e]=a[e])}}return t},Ft.flattenChunks=t=>{let e=0;for(let a=0,s=t.length;a<s;a++)e+=t[a].length;const a=new Uint8Array(e);for(let e=0,s=0,r=t.length;e<r;e++){let r=t[e];a.set(r,s),s+=r.length}return a};var Dt={};let Nt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Nt=!1}const Ct=new Uint8Array(256);for(let t=0;t<256;t++)Ct[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ct[254]=Ct[254]=1,Dt.string2buf=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,s,r,n,i=t.length,_=0;for(r=0;r<i;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<i&&(s=t.charCodeAt(r+1),56320==(64512&s)&&(a=65536+(a-55296<<10)+(s-56320),r++)),_+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(_),n=0,r=0;n<_;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<i&&(s=t.charCodeAt(r+1),56320==(64512&s)&&(a=65536+(a-55296<<10)+(s-56320),r++)),a<128?e[n++]=a:a<2048?(e[n++]=192|a>>>6,e[n++]=128|63&a):a<65536?(e[n++]=224|a>>>12,e[n++]=128|a>>>6&63,e[n++]=128|63&a):(e[n++]=240|a>>>18,e[n++]=128|a>>>12&63,e[n++]=128|a>>>6&63,e[n++]=128|63&a);return e};Dt.buf2string=(t,e)=>{const a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let s,r;const n=new Array(2*a);for(r=0,s=0;s<a;){let e=t[s++];if(e<128){n[r++]=e;continue}let i=Ct[e];if(i>4)n[r++]=65533,s+=i-1;else{for(e&=2===i?31:3===i?15:7;i>1&&s<a;)e=e<<6|63&t[s++],i--;i>1?n[r++]=65533:e<65536?n[r++]=e:(e-=65536,n[r++]=55296|e>>10&1023,n[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Nt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let a="";for(let s=0;s<e;s++)a+=String.fromCharCode(t[s]);return a})(n,r)},Dt.utf8border=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Ct[t[a]]>e?a:e};const It=t,Ht=Ft,Bt=Dt,Mt=C,Pt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},Yt=Object.prototype.toString,{Z_NO_FLUSH:Kt,Z_SYNC_FLUSH:jt,Z_FULL_FLUSH:Gt,Z_FINISH:Xt,Z_OK:Wt,Z_STREAM_END:qt,Z_DEFAULT_COMPRESSION:Jt,Z_DEFAULT_STRATEGY:Qt,Z_DEFLATED:Vt}=I;function $t(t){this.options=Ht.assign({level:Jt,method:Vt,chunkSize:16384,windowBits:15,memLevel:8,strategy:Qt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Pt,this.strm.avail_out=0;let a=It.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==Wt)throw new Error(Mt[a]);if(e.header&&It.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?Bt.string2buf(e.dictionary):"[object ArrayBuffer]"===Yt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=It.deflateSetDictionary(this.strm,t),a!==Wt)throw new Error(Mt[a]);this._dict_set=!0}}$t.prototype.push=function(t,e){const a=this.strm,s=this.options.chunkSize;let r,n;if(this.ended)return!1;for(n=e===~~e?e:!0===e?Xt:Kt,"string"==typeof t?a.input=Bt.string2buf(t):"[object ArrayBuffer]"===Yt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(s),a.next_out=0,a.avail_out=s),(n===jt||n===Gt)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(r=It.deflate(a,n),r===qt)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),r=It.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Wt;if(0!==a.avail_out){if(n>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},$t.prototype.onData=function(t){this.chunks.push(t)},$t.prototype.onEnd=function(t){t===Wt&&(this.result=Ht.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const te=$t,ee=function(t,e){const a=new $t(e);if(a.push(t,!0),a.err)throw a.msg||Mt[a.err];return a.result},ae=I;const se=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const e=this._hasEvents?",":"";this.deflate.push(e+t,ae.Z_SYNC_FLUSH),this._hasEvents=!0}finish(){if(this.deflate.push("]",ae.Z_FINISH),this.deflate.err)throw this.deflate.err;const t=this.deflate.result;return this._init(),t}_init(){this._hasEvents=!1,this.deflate=new te,this.deflate.push("[",ae.Z_NO_FLUSH)}},re={clear:()=>{se.clear()},addEvent:t=>se.addEvent(t),finish:()=>se.finish(),compress:t=>function(t){return ee(t)}(t)};addEventListener("message",(function(t){const e=t.data.method,a=t.data.id,s=t.data.arg;if(e in re&&"function"==typeof re[e])try{const t=re[e](s);postMessage({id:a,method:e,success:!0,response:t})}catch(t){postMessage({id:a,method:e,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
|
|
4676
|
+
const r = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==r||r<0)&&(r=0),(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},A=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},_=function(r,e){for(var i=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=x(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},x=function(t,n,r){return-1==t.s?Math.max(x(t.l,n,r+1),x(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},C=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=_(f,15),M=b.t,E=b.l,x=_(h,15),C=x.t,U=x.l,F=D(M),I=F.c,S=F.n,L=D(C),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=_(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,C)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(C,U,0),R=C;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){A(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;A(r,m,Q[et]),m+=R[et],et>3&&(A(r,m,rt>>5&8191),m+=i[et])}else A(r,m,N[rt]),m+=P[rt]}return A(r,m,N[256]),m+P[256]},U=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},L=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=U[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,A=c.p||new n(32768),_=c.h||new n(z+1),x=Math.ceil(o/3),D=2*x,T=function(t){return(a[t]^a[t+1]<<x^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=_[H];if(A[J]=K,_[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=C(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-A[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=A[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=C(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=_,c.p=A,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},O=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},j=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(L(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();function q(t,n){n||(n={});var r=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}}(),e=t.length;r.p(t);var i,a=L(t,n,10+((i=n).filename?i.filename.length+1:0),8),s=a.length;return function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&O(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}}(a,n),O(a,s-8,r.d()),O(a,s-4,e),a}var B=function(){function t(t,n){this.c=S(),this.v=1,j.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),j.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=L(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=S();i.p(n.dictionary),O(t,2,i.d())}}(r,this.o),this.v=0),n&&O(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),G="undefined"!=typeof TextEncoder&&new TextEncoder,H="undefined"!=typeof TextDecoder&&new TextDecoder;try{H.decode(F,{stream:!0})}catch(t){}var J=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(K(t),this.d=n||!1)},t}();function K(n,r){if(r){for(var e=new t(n.length),i=0;i<n.length;++i)e[i]=n.charCodeAt(i);return e}if(G)return G.encode(n);var a=n.length,s=new t(n.length+(n.length>>1)),o=0,f=function(t){s[o++]=t};for(i=0;i<a;++i){if(o+5>s.length){var h=new t(o+8+(a-i<<1));h.set(s),s=h}var l=n.charCodeAt(i);l<128||r?f(l):l<2048?(f(192|l>>6),f(128|63&l)):l>55295&&l<57344?(f(240|(l=65536+(1047552&l)|1023&n.charCodeAt(++i))>>18),f(128|l>>12&63),f(128|l>>6&63),f(128|63&l)):(f(224|l>>12),f(128|l>>6&63),f(128|63&l))}return b(s,0,o)}const N=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(let r=0,e=t.length;r<e;r++)n+=t[r].length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new B,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new J(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},P={clear:()=>{N.clear()},addEvent:t=>N.addEvent(t),finish:()=>N.finish(),compress:t=>function(t){return q(K(t))}(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in P&&"function"==typeof P[n])try{const t=P[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
|
|
5319
4677
|
|
|
5320
4678
|
function e(){const e=new Blob([r]);return URL.createObjectURL(e)}
|
|
5321
4679
|
|
|
@@ -6041,8 +5399,6 @@ function loadOrCreateSession(
|
|
|
6041
5399
|
return createSession(sessionOptions, { previousSessionId: existingSession.id });
|
|
6042
5400
|
}
|
|
6043
5401
|
|
|
6044
|
-
const ReplayEventTypeCustom = 5;
|
|
6045
|
-
|
|
6046
5402
|
function isCustomEvent(event) {
|
|
6047
5403
|
return event.type === EventType.Custom;
|
|
6048
5404
|
}
|
|
@@ -6241,12 +5597,19 @@ function handleErrorEvent(replay, event) {
|
|
|
6241
5597
|
|
|
6242
5598
|
// If error event is tagged with replay id it means it was sampled (when in buffer mode)
|
|
6243
5599
|
// Need to be very careful that this does not cause an infinite loop
|
|
6244
|
-
if (replay.recordingMode
|
|
6245
|
-
|
|
6246
|
-
// Capture current event buffer as new replay
|
|
6247
|
-
void replay.sendBufferedReplayOrFlush();
|
|
6248
|
-
});
|
|
5600
|
+
if (replay.recordingMode !== 'buffer' || !event.tags || !event.tags.replayId) {
|
|
5601
|
+
return;
|
|
6249
5602
|
}
|
|
5603
|
+
|
|
5604
|
+
const { beforeErrorSampling } = replay.getOptions();
|
|
5605
|
+
if (typeof beforeErrorSampling === 'function' && !beforeErrorSampling(event)) {
|
|
5606
|
+
return;
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5609
|
+
setTimeout(() => {
|
|
5610
|
+
// Capture current event buffer as new replay
|
|
5611
|
+
void replay.sendBufferedReplayOrFlush();
|
|
5612
|
+
});
|
|
6250
5613
|
}
|
|
6251
5614
|
|
|
6252
5615
|
function isBaseTransportSend() {
|
|
@@ -6564,393 +5927,6 @@ function handleXhrSpanListener(replay) {
|
|
|
6564
5927
|
};
|
|
6565
5928
|
}
|
|
6566
5929
|
|
|
6567
|
-
const OBJ = 10;
|
|
6568
|
-
const OBJ_KEY = 11;
|
|
6569
|
-
const OBJ_KEY_STR = 12;
|
|
6570
|
-
const OBJ_VAL = 13;
|
|
6571
|
-
const OBJ_VAL_STR = 14;
|
|
6572
|
-
const OBJ_VAL_COMPLETED = 15;
|
|
6573
|
-
|
|
6574
|
-
const ARR = 20;
|
|
6575
|
-
const ARR_VAL = 21;
|
|
6576
|
-
const ARR_VAL_STR = 22;
|
|
6577
|
-
const ARR_VAL_COMPLETED = 23;
|
|
6578
|
-
|
|
6579
|
-
const ALLOWED_PRIMITIVES = ['true', 'false', 'null'];
|
|
6580
|
-
|
|
6581
|
-
/**
|
|
6582
|
-
* Complete an incomplete JSON string.
|
|
6583
|
-
* This will ensure that the last element always has a `"~~"` to indicate it was truncated.
|
|
6584
|
-
* For example, `[1,2,` will be completed to `[1,2,"~~"]`
|
|
6585
|
-
* and `{"aa":"b` will be completed to `{"aa":"b~~"}`
|
|
6586
|
-
*/
|
|
6587
|
-
function completeJson(incompleteJson, stack) {
|
|
6588
|
-
if (!stack.length) {
|
|
6589
|
-
return incompleteJson;
|
|
6590
|
-
}
|
|
6591
|
-
|
|
6592
|
-
let json = incompleteJson;
|
|
6593
|
-
|
|
6594
|
-
// Most checks are only needed for the last step in the stack
|
|
6595
|
-
const lastPos = stack.length - 1;
|
|
6596
|
-
const lastStep = stack[lastPos];
|
|
6597
|
-
|
|
6598
|
-
json = _fixLastStep(json, lastStep);
|
|
6599
|
-
|
|
6600
|
-
// Complete remaining steps - just add closing brackets
|
|
6601
|
-
for (let i = lastPos; i >= 0; i--) {
|
|
6602
|
-
const step = stack[i];
|
|
6603
|
-
|
|
6604
|
-
switch (step) {
|
|
6605
|
-
case OBJ:
|
|
6606
|
-
json = `${json}}`;
|
|
6607
|
-
break;
|
|
6608
|
-
case ARR:
|
|
6609
|
-
json = `${json}]`;
|
|
6610
|
-
break;
|
|
6611
|
-
}
|
|
6612
|
-
}
|
|
6613
|
-
|
|
6614
|
-
return json;
|
|
6615
|
-
}
|
|
6616
|
-
|
|
6617
|
-
function _fixLastStep(json, lastStep) {
|
|
6618
|
-
switch (lastStep) {
|
|
6619
|
-
// Object cases
|
|
6620
|
-
case OBJ:
|
|
6621
|
-
return `${json}"~~":"~~"`;
|
|
6622
|
-
case OBJ_KEY:
|
|
6623
|
-
return `${json}:"~~"`;
|
|
6624
|
-
case OBJ_KEY_STR:
|
|
6625
|
-
return `${json}~~":"~~"`;
|
|
6626
|
-
case OBJ_VAL:
|
|
6627
|
-
return _maybeFixIncompleteObjValue(json);
|
|
6628
|
-
case OBJ_VAL_STR:
|
|
6629
|
-
return `${json}~~"`;
|
|
6630
|
-
case OBJ_VAL_COMPLETED:
|
|
6631
|
-
return `${json},"~~":"~~"`;
|
|
6632
|
-
|
|
6633
|
-
// Array cases
|
|
6634
|
-
case ARR:
|
|
6635
|
-
return `${json}"~~"`;
|
|
6636
|
-
case ARR_VAL:
|
|
6637
|
-
return _maybeFixIncompleteArrValue(json);
|
|
6638
|
-
case ARR_VAL_STR:
|
|
6639
|
-
return `${json}~~"`;
|
|
6640
|
-
case ARR_VAL_COMPLETED:
|
|
6641
|
-
return `${json},"~~"`;
|
|
6642
|
-
}
|
|
6643
|
-
|
|
6644
|
-
return json;
|
|
6645
|
-
}
|
|
6646
|
-
|
|
6647
|
-
function _maybeFixIncompleteArrValue(json) {
|
|
6648
|
-
const pos = _findLastArrayDelimiter(json);
|
|
6649
|
-
|
|
6650
|
-
if (pos > -1) {
|
|
6651
|
-
const part = json.slice(pos + 1);
|
|
6652
|
-
|
|
6653
|
-
if (ALLOWED_PRIMITIVES.includes(part.trim())) {
|
|
6654
|
-
return `${json},"~~"`;
|
|
6655
|
-
}
|
|
6656
|
-
|
|
6657
|
-
// Everything else is replaced with `"~~"`
|
|
6658
|
-
return `${json.slice(0, pos + 1)}"~~"`;
|
|
6659
|
-
}
|
|
6660
|
-
|
|
6661
|
-
// fallback, this shouldn't happen, to be save
|
|
6662
|
-
return json;
|
|
6663
|
-
}
|
|
6664
|
-
|
|
6665
|
-
function _findLastArrayDelimiter(json) {
|
|
6666
|
-
for (let i = json.length - 1; i >= 0; i--) {
|
|
6667
|
-
const char = json[i];
|
|
6668
|
-
|
|
6669
|
-
if (char === ',' || char === '[') {
|
|
6670
|
-
return i;
|
|
6671
|
-
}
|
|
6672
|
-
}
|
|
6673
|
-
|
|
6674
|
-
return -1;
|
|
6675
|
-
}
|
|
6676
|
-
|
|
6677
|
-
function _maybeFixIncompleteObjValue(json) {
|
|
6678
|
-
const startPos = json.lastIndexOf(':');
|
|
6679
|
-
|
|
6680
|
-
const part = json.slice(startPos + 1);
|
|
6681
|
-
|
|
6682
|
-
if (ALLOWED_PRIMITIVES.includes(part.trim())) {
|
|
6683
|
-
return `${json},"~~":"~~"`;
|
|
6684
|
-
}
|
|
6685
|
-
|
|
6686
|
-
// Everything else is replaced with `"~~"`
|
|
6687
|
-
// This also means we do not have incomplete numbers, e.g `[1` is replaced with `["~~"]`
|
|
6688
|
-
return `${json.slice(0, startPos + 1)}"~~"`;
|
|
6689
|
-
}
|
|
6690
|
-
|
|
6691
|
-
/**
|
|
6692
|
-
* Evaluate an (incomplete) JSON string.
|
|
6693
|
-
*/
|
|
6694
|
-
function evaluateJson(json) {
|
|
6695
|
-
const stack = [];
|
|
6696
|
-
|
|
6697
|
-
for (let pos = 0; pos < json.length; pos++) {
|
|
6698
|
-
_evaluateJsonPos(stack, json, pos);
|
|
6699
|
-
}
|
|
6700
|
-
|
|
6701
|
-
return stack;
|
|
6702
|
-
}
|
|
6703
|
-
|
|
6704
|
-
function _evaluateJsonPos(stack, json, pos) {
|
|
6705
|
-
const curStep = stack[stack.length - 1];
|
|
6706
|
-
|
|
6707
|
-
const char = json[pos];
|
|
6708
|
-
|
|
6709
|
-
const whitespaceRegex = /\s/;
|
|
6710
|
-
|
|
6711
|
-
if (whitespaceRegex.test(char)) {
|
|
6712
|
-
return;
|
|
6713
|
-
}
|
|
6714
|
-
|
|
6715
|
-
if (char === '"' && !_isEscaped(json, pos)) {
|
|
6716
|
-
_handleQuote(stack, curStep);
|
|
6717
|
-
return;
|
|
6718
|
-
}
|
|
6719
|
-
|
|
6720
|
-
switch (char) {
|
|
6721
|
-
case '{':
|
|
6722
|
-
_handleObj(stack, curStep);
|
|
6723
|
-
break;
|
|
6724
|
-
case '[':
|
|
6725
|
-
_handleArr(stack, curStep);
|
|
6726
|
-
break;
|
|
6727
|
-
case ':':
|
|
6728
|
-
_handleColon(stack, curStep);
|
|
6729
|
-
break;
|
|
6730
|
-
case ',':
|
|
6731
|
-
_handleComma(stack, curStep);
|
|
6732
|
-
break;
|
|
6733
|
-
case '}':
|
|
6734
|
-
_handleObjClose(stack, curStep);
|
|
6735
|
-
break;
|
|
6736
|
-
case ']':
|
|
6737
|
-
_handleArrClose(stack, curStep);
|
|
6738
|
-
break;
|
|
6739
|
-
}
|
|
6740
|
-
}
|
|
6741
|
-
|
|
6742
|
-
function _handleQuote(stack, curStep) {
|
|
6743
|
-
// End of obj value
|
|
6744
|
-
if (curStep === OBJ_VAL_STR) {
|
|
6745
|
-
stack.pop();
|
|
6746
|
-
stack.push(OBJ_VAL_COMPLETED);
|
|
6747
|
-
return;
|
|
6748
|
-
}
|
|
6749
|
-
|
|
6750
|
-
// End of arr value
|
|
6751
|
-
if (curStep === ARR_VAL_STR) {
|
|
6752
|
-
stack.pop();
|
|
6753
|
-
stack.push(ARR_VAL_COMPLETED);
|
|
6754
|
-
return;
|
|
6755
|
-
}
|
|
6756
|
-
|
|
6757
|
-
// Start of obj value
|
|
6758
|
-
if (curStep === OBJ_VAL) {
|
|
6759
|
-
stack.push(OBJ_VAL_STR);
|
|
6760
|
-
return;
|
|
6761
|
-
}
|
|
6762
|
-
|
|
6763
|
-
// Start of arr value
|
|
6764
|
-
if (curStep === ARR_VAL) {
|
|
6765
|
-
stack.push(ARR_VAL_STR);
|
|
6766
|
-
return;
|
|
6767
|
-
}
|
|
6768
|
-
|
|
6769
|
-
// Start of obj key
|
|
6770
|
-
if (curStep === OBJ) {
|
|
6771
|
-
stack.push(OBJ_KEY_STR);
|
|
6772
|
-
return;
|
|
6773
|
-
}
|
|
6774
|
-
|
|
6775
|
-
// End of obj key
|
|
6776
|
-
if (curStep === OBJ_KEY_STR) {
|
|
6777
|
-
stack.pop();
|
|
6778
|
-
stack.push(OBJ_KEY);
|
|
6779
|
-
return;
|
|
6780
|
-
}
|
|
6781
|
-
}
|
|
6782
|
-
|
|
6783
|
-
function _handleObj(stack, curStep) {
|
|
6784
|
-
// Initial object
|
|
6785
|
-
if (!curStep) {
|
|
6786
|
-
stack.push(OBJ);
|
|
6787
|
-
return;
|
|
6788
|
-
}
|
|
6789
|
-
|
|
6790
|
-
// New object as obj value
|
|
6791
|
-
if (curStep === OBJ_VAL) {
|
|
6792
|
-
stack.push(OBJ);
|
|
6793
|
-
return;
|
|
6794
|
-
}
|
|
6795
|
-
|
|
6796
|
-
// New object as array element
|
|
6797
|
-
if (curStep === ARR_VAL) {
|
|
6798
|
-
stack.push(OBJ);
|
|
6799
|
-
}
|
|
6800
|
-
|
|
6801
|
-
// New object as first array element
|
|
6802
|
-
if (curStep === ARR) {
|
|
6803
|
-
stack.push(OBJ);
|
|
6804
|
-
return;
|
|
6805
|
-
}
|
|
6806
|
-
}
|
|
6807
|
-
|
|
6808
|
-
function _handleArr(stack, curStep) {
|
|
6809
|
-
// Initial array
|
|
6810
|
-
if (!curStep) {
|
|
6811
|
-
stack.push(ARR);
|
|
6812
|
-
stack.push(ARR_VAL);
|
|
6813
|
-
return;
|
|
6814
|
-
}
|
|
6815
|
-
|
|
6816
|
-
// New array as obj value
|
|
6817
|
-
if (curStep === OBJ_VAL) {
|
|
6818
|
-
stack.push(ARR);
|
|
6819
|
-
stack.push(ARR_VAL);
|
|
6820
|
-
return;
|
|
6821
|
-
}
|
|
6822
|
-
|
|
6823
|
-
// New array as array element
|
|
6824
|
-
if (curStep === ARR_VAL) {
|
|
6825
|
-
stack.push(ARR);
|
|
6826
|
-
stack.push(ARR_VAL);
|
|
6827
|
-
}
|
|
6828
|
-
|
|
6829
|
-
// New array as first array element
|
|
6830
|
-
if (curStep === ARR) {
|
|
6831
|
-
stack.push(ARR);
|
|
6832
|
-
stack.push(ARR_VAL);
|
|
6833
|
-
return;
|
|
6834
|
-
}
|
|
6835
|
-
}
|
|
6836
|
-
|
|
6837
|
-
function _handleColon(stack, curStep) {
|
|
6838
|
-
if (curStep === OBJ_KEY) {
|
|
6839
|
-
stack.pop();
|
|
6840
|
-
stack.push(OBJ_VAL);
|
|
6841
|
-
}
|
|
6842
|
-
}
|
|
6843
|
-
|
|
6844
|
-
function _handleComma(stack, curStep) {
|
|
6845
|
-
// Comma after obj value
|
|
6846
|
-
if (curStep === OBJ_VAL) {
|
|
6847
|
-
stack.pop();
|
|
6848
|
-
return;
|
|
6849
|
-
}
|
|
6850
|
-
if (curStep === OBJ_VAL_COMPLETED) {
|
|
6851
|
-
// Pop OBJ_VAL_COMPLETED & OBJ_VAL
|
|
6852
|
-
stack.pop();
|
|
6853
|
-
stack.pop();
|
|
6854
|
-
return;
|
|
6855
|
-
}
|
|
6856
|
-
|
|
6857
|
-
// Comma after arr value
|
|
6858
|
-
if (curStep === ARR_VAL) {
|
|
6859
|
-
// do nothing - basically we'd pop ARR_VAL but add it right back
|
|
6860
|
-
return;
|
|
6861
|
-
}
|
|
6862
|
-
|
|
6863
|
-
if (curStep === ARR_VAL_COMPLETED) {
|
|
6864
|
-
// Pop ARR_VAL_COMPLETED
|
|
6865
|
-
stack.pop();
|
|
6866
|
-
|
|
6867
|
-
// basically we'd pop ARR_VAL but add it right back
|
|
6868
|
-
return;
|
|
6869
|
-
}
|
|
6870
|
-
}
|
|
6871
|
-
|
|
6872
|
-
function _handleObjClose(stack, curStep) {
|
|
6873
|
-
// Empty object {}
|
|
6874
|
-
if (curStep === OBJ) {
|
|
6875
|
-
stack.pop();
|
|
6876
|
-
}
|
|
6877
|
-
|
|
6878
|
-
// Object with element
|
|
6879
|
-
if (curStep === OBJ_VAL) {
|
|
6880
|
-
// Pop OBJ_VAL, OBJ
|
|
6881
|
-
stack.pop();
|
|
6882
|
-
stack.pop();
|
|
6883
|
-
}
|
|
6884
|
-
|
|
6885
|
-
// Obj with element
|
|
6886
|
-
if (curStep === OBJ_VAL_COMPLETED) {
|
|
6887
|
-
// Pop OBJ_VAL_COMPLETED, OBJ_VAL, OBJ
|
|
6888
|
-
stack.pop();
|
|
6889
|
-
stack.pop();
|
|
6890
|
-
stack.pop();
|
|
6891
|
-
}
|
|
6892
|
-
|
|
6893
|
-
// if was obj value, complete it
|
|
6894
|
-
if (stack[stack.length - 1] === OBJ_VAL) {
|
|
6895
|
-
stack.push(OBJ_VAL_COMPLETED);
|
|
6896
|
-
}
|
|
6897
|
-
|
|
6898
|
-
// if was arr value, complete it
|
|
6899
|
-
if (stack[stack.length - 1] === ARR_VAL) {
|
|
6900
|
-
stack.push(ARR_VAL_COMPLETED);
|
|
6901
|
-
}
|
|
6902
|
-
}
|
|
6903
|
-
|
|
6904
|
-
function _handleArrClose(stack, curStep) {
|
|
6905
|
-
// Empty array []
|
|
6906
|
-
if (curStep === ARR) {
|
|
6907
|
-
stack.pop();
|
|
6908
|
-
}
|
|
6909
|
-
|
|
6910
|
-
// Array with element
|
|
6911
|
-
if (curStep === ARR_VAL) {
|
|
6912
|
-
// Pop ARR_VAL, ARR
|
|
6913
|
-
stack.pop();
|
|
6914
|
-
stack.pop();
|
|
6915
|
-
}
|
|
6916
|
-
|
|
6917
|
-
// Array with element
|
|
6918
|
-
if (curStep === ARR_VAL_COMPLETED) {
|
|
6919
|
-
// Pop ARR_VAL_COMPLETED, ARR_VAL, ARR
|
|
6920
|
-
stack.pop();
|
|
6921
|
-
stack.pop();
|
|
6922
|
-
stack.pop();
|
|
6923
|
-
}
|
|
6924
|
-
|
|
6925
|
-
// if was obj value, complete it
|
|
6926
|
-
if (stack[stack.length - 1] === OBJ_VAL) {
|
|
6927
|
-
stack.push(OBJ_VAL_COMPLETED);
|
|
6928
|
-
}
|
|
6929
|
-
|
|
6930
|
-
// if was arr value, complete it
|
|
6931
|
-
if (stack[stack.length - 1] === ARR_VAL) {
|
|
6932
|
-
stack.push(ARR_VAL_COMPLETED);
|
|
6933
|
-
}
|
|
6934
|
-
}
|
|
6935
|
-
|
|
6936
|
-
function _isEscaped(str, pos) {
|
|
6937
|
-
const previousChar = str[pos - 1];
|
|
6938
|
-
|
|
6939
|
-
return previousChar === '\\' && !_isEscaped(str, pos - 1);
|
|
6940
|
-
}
|
|
6941
|
-
|
|
6942
|
-
/* eslint-disable max-lines */
|
|
6943
|
-
|
|
6944
|
-
/**
|
|
6945
|
-
* Takes an incomplete JSON string, and returns a hopefully valid JSON string.
|
|
6946
|
-
* Note that this _can_ fail, so you should check the return value is valid JSON.
|
|
6947
|
-
*/
|
|
6948
|
-
function fixJson(incompleteJson) {
|
|
6949
|
-
const stack = evaluateJson(incompleteJson);
|
|
6950
|
-
|
|
6951
|
-
return completeJson(incompleteJson, stack);
|
|
6952
|
-
}
|
|
6953
|
-
|
|
6954
5930
|
/** Get the size of a body. */
|
|
6955
5931
|
function getBodySize(
|
|
6956
5932
|
body,
|
|
@@ -7085,7 +6061,7 @@ function buildNetworkRequestOrResponse(
|
|
|
7085
6061
|
|
|
7086
6062
|
const { body: normalizedBody, warnings } = normalizeNetworkBody(body);
|
|
7087
6063
|
info.body = normalizedBody;
|
|
7088
|
-
if (warnings.length > 0) {
|
|
6064
|
+
if (warnings && warnings.length > 0) {
|
|
7089
6065
|
info._meta = {
|
|
7090
6066
|
warnings,
|
|
7091
6067
|
};
|
|
@@ -7119,31 +6095,42 @@ function normalizeNetworkBody(body)
|
|
|
7119
6095
|
if (!body || typeof body !== 'string') {
|
|
7120
6096
|
return {
|
|
7121
6097
|
body,
|
|
7122
|
-
warnings: [],
|
|
7123
6098
|
};
|
|
7124
6099
|
}
|
|
7125
6100
|
|
|
7126
6101
|
const exceedsSizeLimit = body.length > NETWORK_BODY_MAX_SIZE;
|
|
7127
6102
|
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
6103
|
+
const isProbablyJson = _strIsProbablyJson(body);
|
|
6104
|
+
|
|
6105
|
+
if (exceedsSizeLimit) {
|
|
6106
|
+
const truncatedBody = body.slice(0, NETWORK_BODY_MAX_SIZE);
|
|
6107
|
+
|
|
6108
|
+
if (isProbablyJson) {
|
|
7132
6109
|
return {
|
|
7133
|
-
body:
|
|
7134
|
-
warnings:
|
|
6110
|
+
body: truncatedBody,
|
|
6111
|
+
warnings: ['MAYBE_JSON_TRUNCATED'],
|
|
7135
6112
|
};
|
|
7136
|
-
}
|
|
6113
|
+
}
|
|
6114
|
+
|
|
6115
|
+
return {
|
|
6116
|
+
body: `${truncatedBody}…`,
|
|
6117
|
+
warnings: ['TEXT_TRUNCATED'],
|
|
6118
|
+
};
|
|
6119
|
+
}
|
|
6120
|
+
|
|
6121
|
+
if (isProbablyJson) {
|
|
6122
|
+
try {
|
|
6123
|
+
const jsonBody = JSON.parse(body);
|
|
7137
6124
|
return {
|
|
7138
|
-
body:
|
|
7139
|
-
warnings: exceedsSizeLimit ? ['INVALID_JSON', 'TEXT_TRUNCATED'] : ['INVALID_JSON'],
|
|
6125
|
+
body: jsonBody,
|
|
7140
6126
|
};
|
|
6127
|
+
} catch (e3) {
|
|
6128
|
+
// fall back to just send the body as string
|
|
7141
6129
|
}
|
|
7142
6130
|
}
|
|
7143
6131
|
|
|
7144
6132
|
return {
|
|
7145
|
-
body
|
|
7146
|
-
warnings: exceedsSizeLimit ? ['TEXT_TRUNCATED'] : [],
|
|
6133
|
+
body,
|
|
7147
6134
|
};
|
|
7148
6135
|
}
|
|
7149
6136
|
|
|
@@ -7696,11 +6683,9 @@ function normalizeConsoleBreadcrumb(
|
|
|
7696
6683
|
const normalizedArg = utils.normalize(arg, 7);
|
|
7697
6684
|
const stringified = JSON.stringify(normalizedArg);
|
|
7698
6685
|
if (stringified.length > CONSOLE_ARG_MAX_SIZE) {
|
|
7699
|
-
const fixedJson = fixJson(stringified.slice(0, CONSOLE_ARG_MAX_SIZE));
|
|
7700
|
-
const json = JSON.parse(fixedJson);
|
|
7701
|
-
// We only set this after JSON.parse() was successfull, so we know we didn't run into `catch`
|
|
7702
6686
|
isTruncated = true;
|
|
7703
|
-
|
|
6687
|
+
// We use the pretty printed JSON string here as a base
|
|
6688
|
+
return `${JSON.stringify(normalizedArg, null, 2).slice(0, CONSOLE_ARG_MAX_SIZE)}…`;
|
|
7704
6689
|
}
|
|
7705
6690
|
return normalizedArg;
|
|
7706
6691
|
} catch (e) {
|
|
@@ -7898,6 +6883,10 @@ function getHandleRecordingEmit(replay) {
|
|
|
7898
6883
|
const isCheckout = _isCheckout || !hadFirstEvent;
|
|
7899
6884
|
hadFirstEvent = true;
|
|
7900
6885
|
|
|
6886
|
+
if (replay.clickDetector) {
|
|
6887
|
+
updateClickDetectorForRecordingEvent(replay.clickDetector, event);
|
|
6888
|
+
}
|
|
6889
|
+
|
|
7901
6890
|
// The handler returns `true` if we do not want to trigger debounced flush, `false` if we want to debounce flush.
|
|
7902
6891
|
replay.addUpdate(() => {
|
|
7903
6892
|
// The session is always started immediately on pageload/init, but for
|
|
@@ -8243,6 +7232,11 @@ async function sendReplayRequest({
|
|
|
8243
7232
|
throw new TransportStatusCodeError(response.statusCode);
|
|
8244
7233
|
}
|
|
8245
7234
|
|
|
7235
|
+
const rateLimits = utils.updateRateLimits({}, response);
|
|
7236
|
+
if (utils.isRateLimited(rateLimits, 'replay')) {
|
|
7237
|
+
throw new RateLimitError(rateLimits);
|
|
7238
|
+
}
|
|
7239
|
+
|
|
8246
7240
|
return response;
|
|
8247
7241
|
}
|
|
8248
7242
|
|
|
@@ -8255,6 +7249,17 @@ class TransportStatusCodeError extends Error {
|
|
|
8255
7249
|
}
|
|
8256
7250
|
}
|
|
8257
7251
|
|
|
7252
|
+
/**
|
|
7253
|
+
* This error indicates that we hit a rate limit API error.
|
|
7254
|
+
*/
|
|
7255
|
+
class RateLimitError extends Error {
|
|
7256
|
+
|
|
7257
|
+
constructor(rateLimits) {
|
|
7258
|
+
super('Rate limit hit');
|
|
7259
|
+
this.rateLimits = rateLimits;
|
|
7260
|
+
}
|
|
7261
|
+
}
|
|
7262
|
+
|
|
8258
7263
|
/**
|
|
8259
7264
|
* Finalize and send the current replay event to Sentry
|
|
8260
7265
|
*/
|
|
@@ -8276,7 +7281,7 @@ async function sendReplay(
|
|
|
8276
7281
|
await sendReplayRequest(replayData);
|
|
8277
7282
|
return true;
|
|
8278
7283
|
} catch (err) {
|
|
8279
|
-
if (err instanceof TransportStatusCodeError) {
|
|
7284
|
+
if (err instanceof TransportStatusCodeError || err instanceof RateLimitError) {
|
|
8280
7285
|
throw err;
|
|
8281
7286
|
}
|
|
8282
7287
|
|
|
@@ -9710,6 +8715,7 @@ class Replay {
|
|
|
9710
8715
|
maskFn,
|
|
9711
8716
|
|
|
9712
8717
|
beforeAddRecordingEvent,
|
|
8718
|
+
beforeErrorSampling,
|
|
9713
8719
|
|
|
9714
8720
|
// eslint-disable-next-line deprecation/deprecation
|
|
9715
8721
|
blockClass,
|
|
@@ -9798,6 +8804,7 @@ class Replay {
|
|
|
9798
8804
|
networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders),
|
|
9799
8805
|
networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders),
|
|
9800
8806
|
beforeAddRecordingEvent,
|
|
8807
|
+
beforeErrorSampling,
|
|
9801
8808
|
|
|
9802
8809
|
_experiments,
|
|
9803
8810
|
};
|