@sentry/replay 8.0.0-alpha.2 → 8.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -86
- package/cjs/index.js +38 -54
- package/cjs/index.js.map +1 -1
- package/esm/index.js +40 -55
- package/esm/index.js.map +1 -1
- package/esm/package.json +1 -0
- package/package.json +20 -7
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/integration.d.ts +19 -3
- package/types/integration.d.ts.map +1 -1
- package/types/replay.d.ts +3 -3
- package/types/replay.d.ts.map +1 -1
- package/types/types/replay.d.ts +13 -8
- package/types/types/replay.d.ts.map +1 -1
- package/types-ts3.8/index.d.ts +1 -1
- package/types-ts3.8/integration.d.ts +19 -3
- package/types-ts3.8/replay.d.ts +3 -3
- package/types-ts3.8/types/replay.d.ts +13 -8
package/README.md
CHANGED
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
Replay can be imported from `@sentry/browser`, or a respective SDK package like `@sentry/react` or `@sentry/vue`.
|
|
20
|
-
|
|
19
|
+
Replay can be imported from `@sentry/browser`, or a respective SDK package like `@sentry/react` or `@sentry/vue`. You
|
|
20
|
+
don't need to install anything in order to use Session Replay. The minimum version that includes Replay is 7.27.0.
|
|
21
21
|
|
|
22
22
|
For details on using Replay when using Sentry via the CDN bundles, see [CDN bundle](#loading-replay-as-a-cdn-bundle).
|
|
23
23
|
|
|
24
24
|
## Setup
|
|
25
25
|
|
|
26
|
-
To set up the integration, add the following to your Sentry initialization. Several options are supported and passable
|
|
27
|
-
See the [configuration section](#configuration) below for more details.
|
|
26
|
+
To set up the integration, add the following to your Sentry initialization. Several options are supported and passable
|
|
27
|
+
via the integration constructor. See the [configuration section](#configuration) below for more details.
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
30
|
import * as Sentry from '@sentry/browser';
|
|
@@ -42,12 +42,12 @@ Sentry.init({
|
|
|
42
42
|
replaysOnErrorSampleRate: 1.0,
|
|
43
43
|
|
|
44
44
|
integrations: [
|
|
45
|
-
|
|
45
|
+
Sentry.replayIntegration({
|
|
46
46
|
// Additional SDK configuration goes in here, for example:
|
|
47
47
|
maskAllText: true,
|
|
48
|
-
blockAllMedia: true
|
|
48
|
+
blockAllMedia: true,
|
|
49
49
|
// See below for all available options
|
|
50
|
-
})
|
|
50
|
+
}),
|
|
51
51
|
],
|
|
52
52
|
// ...
|
|
53
53
|
});
|
|
@@ -55,9 +55,8 @@ Sentry.init({
|
|
|
55
55
|
|
|
56
56
|
### Lazy loading Replay
|
|
57
57
|
|
|
58
|
-
Replay will start automatically when you add the integration.
|
|
59
|
-
|
|
60
|
-
you can also use `addIntegration` to load it later:
|
|
58
|
+
Replay will start automatically when you add the integration. If you do not want to start Replay immediately (e.g. if
|
|
59
|
+
you want to lazy-load it), you can also use `addIntegration` to load it later:
|
|
61
60
|
|
|
62
61
|
```js
|
|
63
62
|
import * as Sentry from "@sentry/react";
|
|
@@ -73,28 +72,31 @@ const { Replay } = await import('@sentry/browser');
|
|
|
73
72
|
const client = Sentry.getCurrentHub().getClient<BrowserClient>();
|
|
74
73
|
|
|
75
74
|
// Client can be undefined
|
|
76
|
-
client?.addIntegration(
|
|
75
|
+
client?.addIntegration(Sentry.replayIntegration());
|
|
77
76
|
```
|
|
78
77
|
|
|
79
78
|
### Identifying Users
|
|
80
79
|
|
|
81
|
-
If you have only followed the above instructions to setup session replays, you will only see IP addresses in Sentry's
|
|
80
|
+
If you have only followed the above instructions to setup session replays, you will only see IP addresses in Sentry's
|
|
81
|
+
UI. In order to associate a user identity to a session replay, use
|
|
82
|
+
[`setUser`](https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/).
|
|
82
83
|
|
|
83
84
|
```javascript
|
|
84
|
-
import * as Sentry from
|
|
85
|
+
import * as Sentry from '@sentry/browser';
|
|
85
86
|
|
|
86
|
-
Sentry.setUser({ email:
|
|
87
|
+
Sentry.setUser({ email: 'jane.doe@example.com' });
|
|
87
88
|
```
|
|
88
89
|
|
|
89
90
|
### Stopping & starting Replays manually
|
|
90
91
|
|
|
91
|
-
Replay recording only starts when it is included in the `integrations` array when calling `Sentry.init` or calling
|
|
92
|
+
Replay recording only starts when it is included in the `integrations` array when calling `Sentry.init` or calling
|
|
93
|
+
`addIntegration` from the a Sentry client instance. To stop recording you can call `stop()`.
|
|
92
94
|
|
|
93
95
|
```js
|
|
94
96
|
import * as Sentry from "@sentry/react";
|
|
95
97
|
import { BrowserClient } from "@sentry/browser";
|
|
96
98
|
|
|
97
|
-
const replay =
|
|
99
|
+
const replay = Sentry.replayIntegration();
|
|
98
100
|
|
|
99
101
|
Sentry.init({
|
|
100
102
|
integrations: [replay]
|
|
@@ -109,20 +111,19 @@ client?.addIntegration(replay);
|
|
|
109
111
|
replay.stop();
|
|
110
112
|
```
|
|
111
113
|
|
|
112
|
-
When both `replaysSessionSampleRate` and `replaysOnErrorSampleRate` are `0`, recording will _not_ start.
|
|
113
|
-
|
|
114
|
+
When both `replaysSessionSampleRate` and `replaysOnErrorSampleRate` are `0`, recording will _not_ start. In this case,
|
|
115
|
+
you can manually start recording:
|
|
114
116
|
|
|
115
117
|
```js
|
|
116
118
|
replay.start(); // Will start a session in "session" mode, regardless of sample rates
|
|
117
119
|
replay.startBuffering(); // Will start a session in "buffer" mode, regardless of sample rates
|
|
118
120
|
```
|
|
119
121
|
|
|
120
|
-
|
|
121
|
-
|
|
122
122
|
## Loading Replay as a CDN Bundle
|
|
123
123
|
|
|
124
|
-
As an alternative to the NPM package, you can use Replay as a CDN bundle.
|
|
125
|
-
|
|
124
|
+
As an alternative to the NPM package, you can use Replay as a CDN bundle. Please refer to the
|
|
125
|
+
[Session Replay installation guide](https://docs.sentry.io/platforms/javascript/session-replay/#install) for CDN bundle
|
|
126
|
+
instructions.
|
|
126
127
|
|
|
127
128
|
<details>
|
|
128
129
|
<summary>Deprecated Replay integration bundle</summary>
|
|
@@ -131,44 +132,47 @@ complete CDN bundles that already contain the replay integration. No need to kee
|
|
|
131
132
|
The `replay.(min.)js` bundle will be removed in v8 of the JS SDKs.
|
|
132
133
|
|
|
133
134
|
```html
|
|
134
|
-
<script
|
|
135
|
-
|
|
136
|
-
crossorigin="anonymous"
|
|
137
|
-
></script>
|
|
138
|
-
<script
|
|
139
|
-
src="https://browser.sentry-cdn.com/7.41.0/replay.min.js"
|
|
140
|
-
crossorigin="anonymous"
|
|
141
|
-
></script>
|
|
135
|
+
<script src="https://browser.sentry-cdn.com/7.41.0/bundle.min.js" crossorigin="anonymous"></script>
|
|
136
|
+
<script src="https://browser.sentry-cdn.com/7.41.0/replay.min.js" crossorigin="anonymous"></script>
|
|
142
137
|
```
|
|
138
|
+
|
|
143
139
|
</details>
|
|
144
140
|
|
|
145
141
|
## Sessions
|
|
146
142
|
|
|
147
|
-
A session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes
|
|
143
|
+
A session starts when the Session Replay SDK is first loaded and initialized. The session will continue until 5 minutes
|
|
144
|
+
passes without any user interactions[^1] with the application _OR_ until a maximum of 30 minutes have elapsed. Closing
|
|
145
|
+
the browser tab will end the session immediately according to the rules for
|
|
146
|
+
[SessionStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage).
|
|
148
147
|
|
|
149
148
|
[^1]: An 'interaction' refers to either a mouse click or a browser navigation event.
|
|
150
149
|
|
|
151
150
|
### Accessing the Replay Session ID
|
|
152
151
|
|
|
153
|
-
You can get the ID of the currently running session via `replay.getReplayId()`.
|
|
154
|
-
|
|
152
|
+
You can get the ID of the currently running session via `replay.getReplayId()`. This will return `undefined` if no
|
|
153
|
+
session is ongoing.
|
|
155
154
|
|
|
156
155
|
### Replay Captures Only on Errors
|
|
157
156
|
|
|
158
|
-
Alternatively, rather than recording an entire session, you can capture a replay only when an error occurs. In this
|
|
157
|
+
Alternatively, rather than recording an entire session, you can capture a replay only when an error occurs. In this
|
|
158
|
+
case, the integration will buffer up to one minute worth of events prior to the error being thrown. It will continue to
|
|
159
|
+
record the session following the rules above regarding session life and activity. Read the [sampling](#Sampling) section
|
|
160
|
+
for configuration options.
|
|
159
161
|
|
|
160
162
|
## Sampling
|
|
161
163
|
|
|
162
|
-
Sampling allows you to control how much of your website's traffic will result in a Session Replay. There are two sample
|
|
164
|
+
Sampling allows you to control how much of your website's traffic will result in a Session Replay. There are two sample
|
|
165
|
+
rates you can adjust to get the replays more relevant to your interests:
|
|
163
166
|
|
|
164
|
-
- `replaysSessionSampleRate` - The sample rate for replays that begin recording immediately and last the entirety of the
|
|
165
|
-
|
|
167
|
+
- `replaysSessionSampleRate` - The sample rate for replays that begin recording immediately and last the entirety of the
|
|
168
|
+
user's session.
|
|
169
|
+
- `replaysOnErrorSampleRate` - The sample rate for replays that are recorded when an error happens. This type of replay
|
|
170
|
+
will record up to a minute of events prior to the error and continue recording until the session ends.
|
|
166
171
|
|
|
167
|
-
When Replay is initialized, we check the `replaysSessionSampleRate`.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
If it is sampled, when we'll upload the Replay to Sentry and continue recording normally.
|
|
172
|
+
When Replay is initialized, we check the `replaysSessionSampleRate`. If it is sampled, then we start recording & sending
|
|
173
|
+
Replay data immediately. Else, if `replaysOnErrorSampleRate > 0`, we'll start recording in buffering mode. In this mode,
|
|
174
|
+
whenever an error occurs we'll check `replaysOnErrorSampleRate`. If it is sampled, when we'll upload the Replay to
|
|
175
|
+
Sentry and continue recording normally.
|
|
172
176
|
|
|
173
177
|
## Configuration
|
|
174
178
|
|
|
@@ -176,76 +180,87 @@ If it is sampled, when we'll upload the Replay to Sentry and continue recording
|
|
|
176
180
|
|
|
177
181
|
The following options can be configured on the root level of your browser-based Sentry SDK, in `init({})`:
|
|
178
182
|
|
|
179
|
-
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
| replaysOnErrorSampleRate | number | `0` |The sample rate for replays that are recorded when an error happens. This type of replay will record up to a minute of events prior to the error and continue recording until the session ends. 1.0 capturing all sessions with an error, and 0 capturing none.
|
|
183
|
+
| key | type | default | description |
|
|
184
|
+
| ------------------------ | ------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
185
|
+
| replaysSessionSampleRate | number | `0` | The sample rate for replays that begin recording immediately and last the entirety of the user's session. 1.0 will collect all replays, 0 will collect no replays. |
|
|
186
|
+
| replaysOnErrorSampleRate | number | `0` | The sample rate for replays that are recorded when an error happens. This type of replay will record up to a minute of events prior to the error and continue recording until the session ends. 1.0 capturing all sessions with an error, and 0 capturing none. |
|
|
184
187
|
|
|
185
188
|
### General Integration Configuration
|
|
186
189
|
|
|
187
|
-
The following options can be configured as options to the integration, in `
|
|
188
|
-
|
|
189
|
-
| key | type | default | description |
|
|
190
|
-
| ------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
191
|
-
| stickySession | boolean | `true` | Keep track of the user across page loads. Note a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. |
|
|
190
|
+
The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`:
|
|
192
191
|
|
|
192
|
+
| key | type | default | description |
|
|
193
|
+
| ------------- | ------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
194
|
+
| stickySession | boolean | `true` | Keep track of the user across page loads. Note a single user using multiple tabs will result in multiple sessions. Closing a tab will result in the session being closed as well. |
|
|
193
195
|
|
|
194
196
|
### Privacy Configuration
|
|
195
197
|
|
|
196
|
-
The following options can be configured as options to the integration, in `
|
|
198
|
+
The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`:
|
|
197
199
|
|
|
198
|
-
| key
|
|
199
|
-
|
|
|
200
|
-
| maskAllText
|
|
201
|
-
| maskAllInputs
|
|
202
|
-
| blockAllMedia
|
|
203
|
-
| maskFn
|
|
204
|
-
| block
|
|
205
|
-
| unblock
|
|
206
|
-
| mask
|
|
207
|
-
| unmask
|
|
208
|
-
| ignore
|
|
200
|
+
| key | type | default | description |
|
|
201
|
+
| ------------- | ------------------------ | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
|
|
203
|
+
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
|
|
204
|
+
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
|
|
205
|
+
| maskFn | (text: string) => string | `(text) => '*'.repeat(text.length)` | Function to customize how text content is masked before sending to server. By default, masks text with `*`. |
|
|
206
|
+
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
|
|
207
|
+
| unblock | Array<string> | [] | Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example. |
|
|
208
|
+
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
|
|
209
|
+
| unmask | Array<string> | [] | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
|
|
210
|
+
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
|
|
209
211
|
|
|
210
212
|
#### Deprecated options
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
213
|
+
|
|
214
|
+
In order to streamline our privacy options, the following have been deprecated in favor for the respective options
|
|
215
|
+
above.
|
|
216
|
+
|
|
217
|
+
| deprecated key | replaced by | description |
|
|
218
|
+
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
219
|
+
| maskInputOptions | mask | Use CSS selectors in `mask` in order to mask all inputs of a certain type. For example, `input[type="address"]` |
|
|
220
|
+
| blockSelector | block | The selector(s) can be moved directly in the `block` array. |
|
|
221
|
+
| blockClass | block | Convert the class name to a CSS selector and add to `block` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
|
|
222
|
+
| maskClass | mask | Convert the class name to a CSS selector and add to `mask` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
|
|
223
|
+
| maskSelector | mask | The selector(s) can be moved directly in the `mask` array. |
|
|
220
224
|
| ignoreClass | ignore | Convert the class name to a CSS selector and add to `ignore` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
|
|
221
225
|
|
|
222
226
|
## Privacy
|
|
223
|
-
|
|
227
|
+
|
|
228
|
+
There are several ways to deal with PII. By default, the integration will mask all text content with `*` and block all
|
|
229
|
+
media elements (`img, svg, video, object, picture, embed, map, audio`). This can be disabled by setting `maskAllText` to
|
|
230
|
+
`false`. It is also possible to add the following CSS classes to specific DOM elements to prevent recording its
|
|
231
|
+
contents: `sentry-block`, `sentry-ignore`, and `sentry-mask`. The following sections will show examples of how content
|
|
232
|
+
is handled by the differing methods.
|
|
224
233
|
|
|
225
234
|
### Masking
|
|
226
|
-
|
|
235
|
+
|
|
236
|
+
Masking replaces the text content with something else. The default masking behavior is to replace each character with a
|
|
237
|
+
`*`. In this example the relevant html code is: `<table class="sentry-mask">...</table>`.
|
|
227
238
|

|
|
228
239
|
|
|
229
240
|
### Blocking
|
|
230
|
-
|
|
241
|
+
|
|
242
|
+
Blocking replaces the element with a placeholder that has the same dimensions. The recording will show an empty space
|
|
243
|
+
where the content was. In this example the relevant html code is: `<table data-sentry-block>...</table>`.
|
|
231
244
|

|
|
232
245
|
|
|
233
246
|
### Ignoring
|
|
234
|
-
|
|
247
|
+
|
|
248
|
+
Ignoring only applies to form inputs. Events will be ignored on the input element so that the replay does not show what
|
|
249
|
+
occurs inside of the input. In the below example, notice how the results in the table below the input changes, but no
|
|
250
|
+
text is visible in the input.
|
|
235
251
|
|
|
236
252
|
https://user-images.githubusercontent.com/79684/192815134-a6451c3f-d3cb-455f-a699-7c3fe04d0a2e.mov
|
|
237
253
|
|
|
238
254
|
## Error Linking
|
|
239
255
|
|
|
240
|
-
Currently, errors that happen on the page while a replay is running are linked to the Replay,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
This should not happen to often, but be aware that it is theoretically possible.
|
|
256
|
+
Currently, errors that happen on the page while a replay is running are linked to the Replay, making it as easy as
|
|
257
|
+
possible to jump between related issues/replays. However, please note that it is _possible_ that the error count
|
|
258
|
+
reported on the Replay Detail page does not match the actual errors that have been captured. The reason for that is that
|
|
259
|
+
errors _can_ be lost, e.g. a network request fails, or similar. This should not happen to often, but be aware that it is
|
|
260
|
+
theoretically possible.
|
|
246
261
|
|
|
247
262
|
## Manually sending replay data
|
|
248
263
|
|
|
249
|
-
You can use `replay.flush()` to immediately send all currently captured replay data.
|
|
250
|
-
|
|
251
|
-
|
|
264
|
+
You can use `replay.flush()` to immediately send all currently captured replay data. When Replay is currently in
|
|
265
|
+
buffering mode, this will send up to the last 60 seconds of replay data, and also continue sending afterwards, similar
|
|
266
|
+
to when an error happens & is recorded.
|
package/cjs/index.js
CHANGED
|
@@ -4835,7 +4835,7 @@ function setupPerformanceObserver(replay) {
|
|
|
4835
4835
|
*/
|
|
4836
4836
|
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
|
4837
4837
|
|
|
4838
|
-
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});`;
|
|
4838
|
+
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;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=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)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(r){for(var e=new t(n.length),i=0;i<n.length;++i)e[i]=n.charCodeAt(i);return e}if(J)return J.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)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(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 H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`;
|
|
4839
4839
|
|
|
4840
4840
|
function e(){const e=new Blob([r]);return URL.createObjectURL(e)}
|
|
4841
4841
|
|
|
@@ -7042,14 +7042,14 @@ function addGlobalListeners(replay) {
|
|
|
7042
7042
|
}
|
|
7043
7043
|
});
|
|
7044
7044
|
|
|
7045
|
-
client.on('
|
|
7046
|
-
replay.
|
|
7045
|
+
client.on('spanStart', span => {
|
|
7046
|
+
replay.lastActiveSpan = span;
|
|
7047
7047
|
});
|
|
7048
7048
|
|
|
7049
|
-
// We may be missing the initial
|
|
7049
|
+
// We may be missing the initial spanStart due to timing issues,
|
|
7050
7050
|
// so we capture it on finish again.
|
|
7051
|
-
client.on('
|
|
7052
|
-
replay.
|
|
7051
|
+
client.on('spanEnd', span => {
|
|
7052
|
+
replay.lastActiveSpan = span;
|
|
7053
7053
|
});
|
|
7054
7054
|
|
|
7055
7055
|
// We want to flush replay
|
|
@@ -7700,7 +7700,7 @@ class ReplayContainer {
|
|
|
7700
7700
|
*/
|
|
7701
7701
|
|
|
7702
7702
|
/**
|
|
7703
|
-
* The current or last active
|
|
7703
|
+
* The current or last active span.
|
|
7704
7704
|
* This is only available when performance is enabled.
|
|
7705
7705
|
*/
|
|
7706
7706
|
|
|
@@ -8309,16 +8309,16 @@ class ReplayContainer {
|
|
|
8309
8309
|
* This is only available if performance is enabled, and if an instrumented router is used.
|
|
8310
8310
|
*/
|
|
8311
8311
|
getCurrentRoute() {
|
|
8312
|
-
|
|
8313
|
-
const
|
|
8312
|
+
const lastActiveSpan = this.lastActiveSpan || core.getActiveSpan();
|
|
8313
|
+
const lastRootSpan = lastActiveSpan && core.getRootSpan(lastActiveSpan);
|
|
8314
8314
|
|
|
8315
|
-
const attributes = (
|
|
8315
|
+
const attributes = (lastRootSpan && core.spanToJSON(lastRootSpan).data) || {};
|
|
8316
8316
|
const source = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
8317
|
-
if (!
|
|
8317
|
+
if (!lastRootSpan || !source || !['route', 'custom'].includes(source)) {
|
|
8318
8318
|
return undefined;
|
|
8319
8319
|
}
|
|
8320
8320
|
|
|
8321
|
-
return core.spanToJSON(
|
|
8321
|
+
return core.spanToJSON(lastRootSpan).description;
|
|
8322
8322
|
}
|
|
8323
8323
|
|
|
8324
8324
|
/**
|
|
@@ -8925,7 +8925,7 @@ function getPrivacyOptions({
|
|
|
8925
8925
|
const defaultBlockedElements = ['base[href="/"]'];
|
|
8926
8926
|
|
|
8927
8927
|
const maskSelector = getOption(mask, ['.sentry-mask', '[data-sentry-mask]'], maskTextClass, maskTextSelector);
|
|
8928
|
-
const unmaskSelector = getOption(unmask, [
|
|
8928
|
+
const unmaskSelector = getOption(unmask, []);
|
|
8929
8929
|
|
|
8930
8930
|
const options = {
|
|
8931
8931
|
// We are making the decision to make text and input selectors the same
|
|
@@ -8938,7 +8938,7 @@ function getPrivacyOptions({
|
|
|
8938
8938
|
blockClass,
|
|
8939
8939
|
blockSelector,
|
|
8940
8940
|
),
|
|
8941
|
-
unblockSelector: getOption(unblock, [
|
|
8941
|
+
unblockSelector: getOption(unblock, []),
|
|
8942
8942
|
ignoreSelector: getOption(ignore, ['.sentry-ignore', '[data-sentry-ignore]', 'input[type="file"]'], ignoreClass),
|
|
8943
8943
|
};
|
|
8944
8944
|
|
|
@@ -8993,14 +8993,29 @@ const DEFAULT_NETWORK_HEADERS = ['content-length', 'content-type', 'accept'];
|
|
|
8993
8993
|
|
|
8994
8994
|
let _initialized = false;
|
|
8995
8995
|
|
|
8996
|
+
/**
|
|
8997
|
+
* Sentry integration for [Session Replay](https://sentry.io/for/session-replay/).
|
|
8998
|
+
*
|
|
8999
|
+
* See the [Replay documentation](https://docs.sentry.io/platforms/javascript/guides/session-replay/) for more information.
|
|
9000
|
+
*
|
|
9001
|
+
* @example
|
|
9002
|
+
*
|
|
9003
|
+
* ```
|
|
9004
|
+
* Sentry.init({
|
|
9005
|
+
* dsn: '__DSN__',
|
|
9006
|
+
* integrations: [Sentry.replayIntegration()],
|
|
9007
|
+
* });
|
|
9008
|
+
* ```
|
|
9009
|
+
*/
|
|
8996
9010
|
const replayIntegration = ((options) => {
|
|
8997
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
8998
9011
|
return new Replay(options);
|
|
8999
9012
|
}) ;
|
|
9000
9013
|
|
|
9001
9014
|
/**
|
|
9002
|
-
*
|
|
9003
|
-
*
|
|
9015
|
+
* Replay integration
|
|
9016
|
+
*
|
|
9017
|
+
* TODO: Rewrite this to be functional integration
|
|
9018
|
+
* Exported for tests.
|
|
9004
9019
|
*/
|
|
9005
9020
|
class Replay {
|
|
9006
9021
|
/**
|
|
@@ -9033,8 +9048,6 @@ class Replay {
|
|
|
9033
9048
|
useCompression = true,
|
|
9034
9049
|
workerUrl,
|
|
9035
9050
|
_experiments = {},
|
|
9036
|
-
sessionSampleRate,
|
|
9037
|
-
errorSampleRate,
|
|
9038
9051
|
maskAllText = true,
|
|
9039
9052
|
maskAllInputs = true,
|
|
9040
9053
|
blockAllMedia = true,
|
|
@@ -9075,7 +9088,6 @@ class Replay {
|
|
|
9075
9088
|
// eslint-disable-next-line deprecation/deprecation
|
|
9076
9089
|
ignoreClass,
|
|
9077
9090
|
} = {}) {
|
|
9078
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
9079
9091
|
this.name = Replay.id;
|
|
9080
9092
|
|
|
9081
9093
|
const privacyOptions = getPrivacyOptions({
|
|
@@ -9133,8 +9145,6 @@ class Replay {
|
|
|
9133
9145
|
minReplayDuration: Math.min(minReplayDuration, MIN_REPLAY_DURATION_LIMIT),
|
|
9134
9146
|
maxReplayDuration: Math.min(maxReplayDuration, MAX_REPLAY_DURATION),
|
|
9135
9147
|
stickySession,
|
|
9136
|
-
sessionSampleRate,
|
|
9137
|
-
errorSampleRate,
|
|
9138
9148
|
useCompression,
|
|
9139
9149
|
workerUrl,
|
|
9140
9150
|
blockAllMedia,
|
|
@@ -9155,30 +9165,6 @@ class Replay {
|
|
|
9155
9165
|
_experiments,
|
|
9156
9166
|
};
|
|
9157
9167
|
|
|
9158
|
-
if (typeof sessionSampleRate === 'number') {
|
|
9159
|
-
// eslint-disable-next-line
|
|
9160
|
-
console.warn(
|
|
9161
|
-
`[Replay] You are passing \`sessionSampleRate\` to the Replay integration.
|
|
9162
|
-
This option is deprecated and will be removed soon.
|
|
9163
|
-
Instead, configure \`replaysSessionSampleRate\` directly in the SDK init options, e.g.:
|
|
9164
|
-
Sentry.init({ replaysSessionSampleRate: ${sessionSampleRate} })`,
|
|
9165
|
-
);
|
|
9166
|
-
|
|
9167
|
-
this._initialOptions.sessionSampleRate = sessionSampleRate;
|
|
9168
|
-
}
|
|
9169
|
-
|
|
9170
|
-
if (typeof errorSampleRate === 'number') {
|
|
9171
|
-
// eslint-disable-next-line
|
|
9172
|
-
console.warn(
|
|
9173
|
-
`[Replay] You are passing \`errorSampleRate\` to the Replay integration.
|
|
9174
|
-
This option is deprecated and will be removed soon.
|
|
9175
|
-
Instead, configure \`replaysOnErrorSampleRate\` directly in the SDK init options, e.g.:
|
|
9176
|
-
Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
|
|
9177
|
-
);
|
|
9178
|
-
|
|
9179
|
-
this._initialOptions.errorSampleRate = errorSampleRate;
|
|
9180
|
-
}
|
|
9181
|
-
|
|
9182
9168
|
if (this._initialOptions.blockAllMedia) {
|
|
9183
9169
|
// `blockAllMedia` is a more user friendly option to configure blocking
|
|
9184
9170
|
// embedded media elements
|
|
@@ -9345,7 +9331,11 @@ function loadReplayOptionsFromClient(initialOptions) {
|
|
|
9345
9331
|
const client = core.getClient();
|
|
9346
9332
|
const opt = client && (client.getOptions() );
|
|
9347
9333
|
|
|
9348
|
-
const finalOptions = {
|
|
9334
|
+
const finalOptions = {
|
|
9335
|
+
sessionSampleRate: 0,
|
|
9336
|
+
errorSampleRate: 0,
|
|
9337
|
+
...utils.dropUndefinedKeys(initialOptions),
|
|
9338
|
+
};
|
|
9349
9339
|
|
|
9350
9340
|
if (!opt) {
|
|
9351
9341
|
utils.consoleSandbox(() => {
|
|
@@ -9355,12 +9345,7 @@ function loadReplayOptionsFromClient(initialOptions) {
|
|
|
9355
9345
|
return finalOptions;
|
|
9356
9346
|
}
|
|
9357
9347
|
|
|
9358
|
-
if (
|
|
9359
|
-
initialOptions.sessionSampleRate == null && // TODO remove once deprecated rates are removed
|
|
9360
|
-
initialOptions.errorSampleRate == null && // TODO remove once deprecated rates are removed
|
|
9361
|
-
opt.replaysSessionSampleRate == null &&
|
|
9362
|
-
opt.replaysOnErrorSampleRate == null
|
|
9363
|
-
) {
|
|
9348
|
+
if (opt.replaysSessionSampleRate == null && opt.replaysOnErrorSampleRate == null) {
|
|
9364
9349
|
utils.consoleSandbox(() => {
|
|
9365
9350
|
// eslint-disable-next-line no-console
|
|
9366
9351
|
console.warn(
|
|
@@ -9392,7 +9377,6 @@ function getReplay() {
|
|
|
9392
9377
|
return client && client.getIntegrationByName('Replay');
|
|
9393
9378
|
}
|
|
9394
9379
|
|
|
9395
|
-
exports.Replay = Replay;
|
|
9396
9380
|
exports.getReplay = getReplay;
|
|
9397
9381
|
exports.replayIntegration = replayIntegration;
|
|
9398
9382
|
//# sourceMappingURL=index.js.map
|