@packstub/session-replay 0.0.0-stage → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +84 -2
- package/npm/dist/index.js +142 -0
- package/npm/index.d.ts +41 -0
- package/package.json +56 -5
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Packstub <support@packstub.dev>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @packstub/session-replay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The browser recorder of [Session Replay for Laravel](https://github.com/packstub/session-replay), for a frontend that runs on its own origin: a Vue or React app on `app.example.com` that talks to your Laravel API on `api.example.com`. It records the page with [rrweb](https://github.com/rrweb-io/rrweb) and uploads to your own Laravel app, where the recordings are stored and watched. Nothing goes to a third party.
|
|
4
|
+
|
|
5
|
+
If Laravel renders your pages (Blade, Livewire, Inertia), you don't need this package: the `@sessionReplay` directive of the Composer package loads the same recorder.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
A Laravel app with [`packstub/session-replay`](https://packagist.org/packages/packstub/session-replay) installed, the token route turned on and your frontend's origin listed:
|
|
10
|
+
|
|
11
|
+
```dotenv
|
|
12
|
+
SESSION_REPLAY_TOKEN_ENDPOINT=true
|
|
13
|
+
SESSION_REPLAY_ORIGINS=https://app.example.com
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use the same version of both packages: this one is released with the Composer package, under the same version number.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @packstub/session-replay
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import { start } from '@packstub/session-replay';
|
|
28
|
+
|
|
29
|
+
start({ endpoint: 'https://api.example.com/session-replay/token' });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`start()` fetches the recorder's config and a signed token from your app, behind your app's own sign-in, and resolves to `true` once the tab records. Call it again whenever the person signs in or out (the options of the first call carry over): a token for someone else ends the current recording and starts a new one.
|
|
33
|
+
|
|
34
|
+
The token is renewed for you before it expires, so a tab that stays open for days keeps recording to its last moment.
|
|
35
|
+
|
|
36
|
+
With a bearer token instead of the session cookie:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
start({
|
|
40
|
+
endpoint: 'https://api.example.com/session-replay/token',
|
|
41
|
+
credentials: 'omit',
|
|
42
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Option | Default | Meaning |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| `endpoint` | required | The token route's URL. |
|
|
49
|
+
| `credentials` | `'include'` | Sent with the token request. Use `'omit'` with a bearer token. |
|
|
50
|
+
| `headers` | `{}` | Extra headers for the token request only, such as `Authorization`. |
|
|
51
|
+
| `fetch` | the browser's | The `fetch` the token request goes through. |
|
|
52
|
+
| `global` | `false` | Also expose the recorder as `window.SessionReplay`. |
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
| Function | What it does |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `start(options)` | Fetches a token and records. Resolves to whether this tab records. |
|
|
59
|
+
| `stop()` | Stops recording until `start()` or `consent(true)`. |
|
|
60
|
+
| `mark(label, payload)` | Puts a moment of your own on the recording's timeline. |
|
|
61
|
+
| `send(label, payload)` | Sends the replay now, for a "report a problem" button. |
|
|
62
|
+
| `consent(given)` | `true` remembers the answer and starts recording, `false` forgets it and stops. |
|
|
63
|
+
| `sessionId()` | The running recording's id, or `null`. |
|
|
64
|
+
| `isRecording()` | Whether this tab uploads right now. |
|
|
65
|
+
| `header()` | `{ 'X-Session-Replay': '…' }` to link your API's log lines to the replay, `{}` while nothing records. |
|
|
66
|
+
|
|
67
|
+
`header()` carries the recording's write key: send it to your own API only.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
api.interceptors.request.use((config) => {
|
|
71
|
+
Object.assign(config.headers, header());
|
|
72
|
+
|
|
73
|
+
return config;
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The package ships TypeScript declarations and can be imported during server-side rendering; it records only in a browser.
|
|
78
|
+
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
The full guide, with the Laravel side, Vue and React examples, CORS and the limits: [Standalone frontend](https://packstub.dev/docs/session-replay/standalone).
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var Ni=Object.defineProperty;var Ri=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var se=(e,t,n)=>Ri(e,typeof t!="symbol"?t+"":t,n);var Oi=Object.defineProperty,Li=(e,t,n)=>t in e?Oi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t,n)=>Li(e,typeof t!="symbol"?t+"":t,n),Vr,k=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(k||{}),N=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(N||{}),K=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(K||{}),me=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(me||{}),Ze=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ze||{}),Ge=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ge||{}),W=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(W||{}),qr={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},jr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={},Cn={},Gr=0,Ai=()=>!!globalThis.Zone;function Hn(e){if(pt[e])return pt[e];let t=globalThis[e],n=t.prototype,r=e in qr?qr[e]:void 0,o=!!(r&&r.every(l=>{var a,d;return!!((d=(a=Object.getOwnPropertyDescriptor(n,l))==null?void 0:a.get)!=null&&d.toString().includes("[native code]"))})),s=e in jr?jr[e]:void 0,i=!!(s&&s.every(l=>{var a;return typeof n[l]=="function"&&((a=n[l])==null?void 0:a.toString().includes("[native code]"))}));if(o&&i&&!Ai())return pt[e]=t.prototype,t.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let a=l.contentWindow;if(!a)return t.prototype;let d=a[e].prototype;if(!d)return l.remove(),n;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),Cn[e]=()=>l.remove()):l.remove(),pt[e]=d}catch{return n}}var En={};function ee(e,t,n){var r,o;let s=(r=En[e])==null?void 0:r[n];if(s)return s.call(t);let i=Hn(e),l=(o=Object.getOwnPropertyDescriptor(i,n))==null?void 0:o.get;return l?((En[e]||(En[e]={}))[n]=l,l.call(t)):t[n]}var vn={};function so(e,t,n){let r=`${e}.${String(n)}`;if(vn[r])return vn[r].bind(t);let s=Hn(e)[n];return typeof s!="function"?t[n]:(vn[r]=s,s.bind(t))}function _i(e){return ee("Node",e,"ownerDocument")}function Di(e){return ee("Node",e,"childNodes")}function Pi(e){return ee("Node",e,"parentNode")}function Ui(e){return ee("Node",e,"parentElement")}function Fi(e){return ee("Node",e,"textContent")}function Hi(e){return ee("Node",e,"firstChild")}function Bi(e){return ee("Node",e,"lastChild")}function Wi(e){return ee("Node",e,"nextSibling")}function zi(e){return ee("Node",e,"previousSibling")}function $i(e,t){return so("Node",e,"contains")(t)}function Vi(e){return so("Node",e,"getRootNode")()}function qi(e){return!e||!("host"in e)?null:ee("ShadowRoot",e,"host")}function ji(e){return e.styleSheets}function Gi(e){return!e||!("shadowRoot"in e)?null:ee("Element",e,"shadowRoot")}function Xi(e,t){return ee("Element",e,"querySelector")(t)}function Yi(e,t){return ee("Element",e,"querySelectorAll")(t)}function io(){let e=Hn("MutationObserver");Gr++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--Gr!==0))return;let n=Cn.MutationObserver;if(n)try{n()}finally{delete pt.MutationObserver,delete Cn.MutationObserver}}]}var yt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(yt=()=>new Date().getTime());function Le(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}var T={ownerDocument:_i,childNodes:Di,parentNode:Pi,parentElement:Ui,textContent:Fi,firstChild:Hi,lastChild:Bi,nextSibling:Wi,previousSibling:zi,contains:$i,getRootNode:Vi,host:qi,styleSheets:ji,shadowRoot:Gi,querySelector:Xi,querySelectorAll:Yi,nowTimestamp:yt,mutationObserverCtor:io,patch:Le};function ao(e){return e.nodeType===e.ELEMENT_NODE}function ht(e){let t=e&&"host"in e&&"mode"in e&&T.host(e)||null;return!!(t&&"shadowRoot"in t&&T.shadowRoot(t)===e)}function mt(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Ji(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Ki(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let n=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function Mn(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;!n&&e.ownerNode&&(n=e.ownerNode.baseURI);let r=Array.from(t,o=>lo(o,n)).join("");return Ji(r)}catch{return null}}function lo(e,t){if(Zi(e)){let n;try{n=Mn(e.styleSheet)||Ki(e)}catch{n=e.cssText}return e.styleSheet.href?jt(n,e.styleSheet.href):n}else{let n=e.cssText;return ea(e)&&e.selectorText.includes(":")&&(n=Qi(n)),t?jt(n,t):n}}function Qi(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Zi(e){return"styleSheet"in e}function ea(e){return"selectorText"in e}var $t=class{constructor(){b(this,"idNodeMap",new Map),b(this,"nodeMetaMap",new WeakMap)}getId(t){var n;return t?((n=this.getMeta(t))==null?void 0:n.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o));let r=T.shadowRoot(t);r&&this.removeNodeFromMap(r)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,n){let r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)}replace(t,n){let r=this.getNode(t);if(r){let o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function ta(){return new $t}function Vt({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:s}){let i=o||"",l=r&&xe(r);return(t[n.toLowerCase()]||l&&t[l])&&(s?i=s(i,e):i="*".repeat(i.length)),i}function xe(e){return e.toLowerCase()}var Xr="__rrweb_original__";function na(e){let t=e.getContext("2d");if(!t)return!0;let n=50;for(let r=0;r<e.width;r+=n)for(let o=0;o<e.height;o+=n){let s=t.getImageData,i=Xr in s?s[Xr]:s;if(new Uint32Array(i.call(t,r,o,Math.min(n,e.width-r),Math.min(n,e.height-o)).data.buffer).some(a=>a!==0))return!1}return!0}function qt(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?xe(t):null}function co(e,t){let n;try{n=new URL(e,t??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,o=n.pathname.match(r);return o?.[1]??null}function ra(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var oa=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,sa=/^(?:[a-z+]+:)?\/\//i,ia=/^www\..*/i,aa=/^(data:)([^,]*),(.*)/i;function jt(e,t){return(e||"").replace(oa,(n,r,o,s,i,l)=>{let a=o||i||l,d=r||s||"";if(!a)return n;if(sa.test(a)||ia.test(a))return`url(${d}${a}${d})`;if(aa.test(a))return`url(${d}${a}${d})`;if(a[0]==="/")return`url(${d}${ra(t)+a}${d})`;let u=a.split("#")[0],h=a.substring(u.length),m=t.split("#")[0].split("/"),p=u.split("/");m.pop();for(let f of p)f!=="."&&(f===".."?m.pop():m.push(f));return`url(${d}${m.join("/")}${h}${d})`})}var uo="(?:/\\*[^*]*\\*/)|[\\s;]",la=new RegExp(`${uo}|\\b(0)px?`,"g"),ca=new RegExp(uo,"g");function Ft(e,t=!1){return t?e.replace(ca,""):e.replace(la,"$1")}function ua(e,t,n=!1){let r=Array.from(t.childNodes),o=[],s=0;if(r.length>1&&e&&typeof e=="string"){let i=Ft(e,n),l=i.length/e.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){let d=Ft(r[a].textContent,n),u=100,h=3;for(;h<d.length&&(d[h].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,h),1)!==-1);h++);for(;h<d.length;h++){let m=d.substring(0,h),p=i.split(m),f=-1;if(p.length===2)f=p[0].length;else if(p.length>2&&p[0]===""&&r[a-1].textContent!=="")f=i.indexOf(m,1);else if(p.length===1){if(m=m.substring(0,m.length-1),p=i.split(m),p.length<=1)return o.push(e),o;h=u+1}else h===d.length-1&&(f=i.indexOf(m));if(p.length>=2&&h>u){let c=r[a-1].textContent;if(c&&typeof c=="string"){let y=Ft(c).length;f=i.indexOf(m,y)}f===-1&&(f=p[0].length)}if(f!==-1){let c=Math.floor(f/l);for(;c>0&&c<e.length;){if(s+=1,s>50*r.length)return o.push(e),o;let y=Ft(e.substring(0,c),n);if(y.length===f){o.push(e.substring(0,c)),e=e.substring(c),i=i.substring(f);break}else y.length<f?c+=Math.max(1,Math.floor((f-y.length)/l)):c-=Math.max(1,Math.floor((y.length-f)*l))}break}}}}return o.push(e),o}function da(e,t){return ua(e,t).join("/* rr_split */")}var fa=1,pa=new RegExp("[^a-z0-9-_:]"),Gt=-2;function fo(){return fa++}function ha(e){if(e instanceof HTMLFormElement)return"form";let t=xe(e.tagName);return pa.test(t)?"div":t}var je,Yr,ma=/^[^ \t\n\r\u000c]+/,ga=/^[, \t\n\r\u000c]+/;function ya(e,t){if(t.trim()==="")return t;let n=0;function r(s){let i,l=s.exec(t.substring(n));return l?(i=l[0],n+=i.length,i):""}let o=[];for(;r(ga),!(n>=t.length);){let s=r(ma);if(s.slice(-1)===",")s=Ye(e,s.substring(0,s.length-1)),o.push(s);else{let i="";s=Ye(e,s);let l=!1;for(;;){let a=t.charAt(n);if(a===""){o.push((s+i).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){n+=1,o.push((s+i).trim());break}else a==="("&&(l=!0);i+=a,n+=1}}}return o.join(", ")}var Jr=new WeakMap;function Ye(e,t){return!t||t.trim()===""?t:Bn(e,t)}function Sa(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Bn(e,t){let n=Jr.get(e);if(n||(n=e.createElement("a"),Jr.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function po(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&["table","td","th"].includes(t)?Ye(e,r):n==="srcset"?ya(e,r):n==="style"?jt(r,Bn(e)):t==="object"&&n==="data"?Ye(e,r):r)}function ho(e,t,n){return["video","audio"].includes(e)&&xe(t)==="autoplay"}function ba(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){let o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch{}return!1}function Xt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Xt(T.parentNode(e),t,n):!1;for(let r=e.classList.length;r--;){let o=e.classList[r];if(t.test(o))return!0}return n?Xt(T.parentNode(e),t,n):!1}function mo(e,t,n,r){let o;if(ao(e)){if(o=e,!T.childNodes(o).length)return!1}else{if(T.parentElement(e)===null)return!1;o=T.parentElement(e)}try{if(typeof t=="string"){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(Xt(o,t,r))return!0;if(n){if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}}catch{}return!1}function wa(e,t,n){let r=e.contentWindow;if(!r)return;let o=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){let l=setTimeout(()=>{o||(t(),o=!0)},n);e.addEventListener("load",()=>{clearTimeout(l),o=!0,t()});return}let i="about:blank";if(r.location.href!==i||e.src===i||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Ea(e,t,n){let r=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{clearTimeout(s),r=!0,t()})}function va(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:i,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:d,maskInputFn:u,dataURLOptions:h={},inlineImages:m,recordCanvas:p,keepIframeSrcFn:f,newlyAddedElement:c=!1,cssCaptured:y=!1}=t,w=Ta(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:W.Document,childNodes:[],compatMode:e.compatMode}:{type:W.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:W.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return Ca(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:a,maskInputFn:u,dataURLOptions:h,inlineImages:m,recordCanvas:p,keepIframeSrcFn:f,newlyAddedElement:c,rootId:w});case e.TEXT_NODE:return xa(e,{doc:n,needsMask:i,maskTextFn:d,rootId:w,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:W.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:W.Comment,textContent:T.textContent(e)||"",rootId:w};default:return!1}}function Ta(e,t){if(!t.hasNode(e))return;let n=t.getId(e);return n===1?void 0:n}function xa(e,t){let{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:s}=t,i=T.parentNode(e),l=i&&i.tagName,a="",d=l==="STYLE"?!0:void 0,u=l==="SCRIPT"?!0:void 0;return u?a="SCRIPT_PLACEHOLDER":s||(a=T.textContent(e),d&&a&&(a=jt(a,Bn(t.doc)))),!d&&!u&&a&&n&&(a=r?r(a,T.parentElement(e)):a.replace(/[\S]/g,"*")),{type:W.Text,textContent:a||"",rootId:o}}function Ca(e,t){let{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:s,maskInputOptions:i={},maskInputFn:l,dataURLOptions:a={},inlineImages:d,recordCanvas:u,keepIframeSrcFn:h,newlyAddedElement:m=!1,rootId:p}=t,f=ba(e,r,o),c=ha(e),y={},w=e.attributes.length;for(let g=0;g<w;g++){let C=e.attributes[g];ho(c,C.name,C.value)||(y[C.name]=po(n,c,xe(C.name),C.value))}if(c==="link"&&s){let g=Array.from(n.styleSheets).find(A=>A.href===e.href),C=null;g&&(C=Mn(g)),C&&(delete y.rel,delete y.href,y._cssText=C)}if(c==="style"&&e.sheet){let g=Mn(e.sheet);g&&(e.childNodes.length>1&&(g=da(g,e)),y._cssText=g)}if(["input","textarea","select"].includes(c)){let g=e.value,C=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&g?y.value=Vt({element:e,type:qt(e),tagName:c,value:g,maskInputOptions:i,maskInputFn:l}):C&&(y.checked=C)}if(c==="option"&&(e.selected&&!i.select?y.selected=!0:delete y.selected),c==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&u){if(e.__context==="2d")na(e)||(y.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){let g=e.toDataURL(a.type,a.quality),C=n.createElement("canvas");C.width=e.width,C.height=e.height;let A=C.toDataURL(a.type,a.quality);g!==A&&(y.rr_dataURL=g)}}if(c==="img"&&d){je||(je=n.createElement("canvas"),Yr=je.getContext("2d"));let g=e,C=g.currentSrc||g.getAttribute("src")||"<unknown-src>",A=g.crossOrigin,M=()=>{g.removeEventListener("load",M);try{je.width=g.naturalWidth,je.height=g.naturalHeight,Yr.drawImage(g,0,0),y.rr_dataURL=je.toDataURL(a.type,a.quality)}catch(x){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?M():g.addEventListener("load",M);return}else console.warn(`Cannot inline img src=${C}! Error: ${x}`)}g.crossOrigin==="anonymous"&&(A?y.crossOrigin=A:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?M():g.addEventListener("load",M)}if(["audio","video"].includes(c)){let g=y;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(m||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),f){let{width:g,height:C}=e.getBoundingClientRect();y={class:y.class,rr_width:`${g}px`,rr_height:`${C}px`}}c==="iframe"&&!h(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let E;try{customElements.get(c)&&(E=!0)}catch{}return{type:W.Element,tagName:c,attributes:y,childNodes:[],isSVG:Sa(e)||void 0,needBlock:f,rootId:p,isCustom:E}}function P(e){return e==null?"":e.toLowerCase()}function go(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Ma(e,t){if(t.comment&&e.type===W.Comment)return!0;if(e.type===W.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&co(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(P(e.attributes.name).match(/^msapplication-tile(image|color)$/)||P(e.attributes.name)==="application-name"||P(e.attributes.rel)==="icon"||P(e.attributes.rel)==="apple-touch-icon"||P(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&P(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(P(e.attributes.property).match(/^(og|twitter|fb):/)||P(e.attributes.name).match(/^(og|twitter):/)||P(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(P(e.attributes.name)==="robots"||P(e.attributes.name)==="googlebot"||P(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(P(e.attributes.name)==="author"||P(e.attributes.name)==="generator"||P(e.attributes.name)==="framework"||P(e.attributes.name)==="publisher"||P(e.attributes.name)==="progid"||P(e.attributes.property).match(/^article:/)||P(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(P(e.attributes.name)==="google-site-verification"||P(e.attributes.name)==="yandex-verification"||P(e.attributes.name)==="csrf-token"||P(e.attributes.name)==="p:domain_verify"||P(e.attributes.name)==="verify-v1"||P(e.attributes.name)==="verification"||P(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Je(e,t){let{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:d=!0,maskInputOptions:u={},maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f={},inlineImages:c=!1,recordCanvas:y=!1,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:M=()=>!1,newlyAddedElement:x=!1,cssCaptured:B=!1}=t,{needsMask:te}=t,{preserveWhiteSpace:ae=!0}=t;te||(te=mo(e,i,l,te===void 0));let ne=va(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,dataURLOptions:f,inlineImages:c,recordCanvas:y,keepIframeSrcFn:M,newlyAddedElement:x,cssCaptured:B});if(!ne)return console.warn(e,"not serialized"),null;let de;r.hasNode(e)?de=r.getId(e):Ma(ne,p)||!ae&&ne.type===W.Text&&!ne.textContent.replace(/^\s+|\s+$/gm,"").length?de=Gt:de=fo();let O=Object.assign(ne,{id:de});if(r.add(e,O),de===Gt)return null;w&&w(e);let ut=!a;if(O.type===W.Element){ut=ut&&!O.needBlock,delete O.needBlock;let z=T.shadowRoot(e);z&&mt(z)&&(O.isShadowHost=!0)}if((O.type===W.Document||O.type===W.Element)&&ut){p.headWhitespace&&O.type===W.Element&&O.tagName==="head"&&(ae=!1);let z={doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:a,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:C,stylesheetLoadTimeout:A,keepIframeSrcFn:M,cssCaptured:!1};if(!(O.type===W.Element&&O.tagName==="textarea"&&O.attributes.value!==void 0)){O.type===W.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText=="string"&&(z.cssCaptured=!0);for(let Re of Array.from(T.childNodes(e))){let fe=Je(Re,z);fe&&O.childNodes.push(fe)}}let re=null;if(ao(e)&&(re=T.shadowRoot(e)))for(let Re of Array.from(T.childNodes(re))){let fe=Je(Re,z);fe&&(mt(re)&&(fe.isShadow=!0),O.childNodes.push(fe))}}let dt=T.parentNode(e);return dt&&ht(dt)&&mt(dt)&&(O.isShadow=!0),O.type===W.Element&&O.tagName==="iframe"&&wa(e,()=>{let z=e.contentDocument;if(z&&E){let re=Je(z,{doc:z,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:C,stylesheetLoadTimeout:A,keepIframeSrcFn:M});re&&E(e,re)}},g),O.type===W.Element&&O.tagName==="link"&&typeof O.attributes.rel=="string"&&(O.attributes.rel==="stylesheet"||O.attributes.rel==="preload"&&typeof O.attributes.href=="string"&&co(O.attributes.href)==="css")&&Ea(e,()=>{if(C){let z=Je(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:te,maskTextClass:i,maskTextSelector:l,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:m,slimDOMOptions:p,dataURLOptions:f,inlineImages:c,recordCanvas:y,preserveWhiteSpace:ae,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:g,onStylesheetLoad:C,stylesheetLoadTimeout:A,keepIframeSrcFn:M});z&&C(e,z)}},A),O}function Ia(e,t){let{mirror:n=new $t,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:i=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:d=!1,maskAllInputs:u=!1,maskTextFn:h,maskInputFn:m,slimDOM:p=!1,dataURLOptions:f,preserveWhiteSpace:c,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:g,stylesheetLoadTimeout:C,keepIframeSrcFn:A=()=>!1}=t,M=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,x=go(p);return Je(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:s,maskTextSelector:i,skipChild:!1,inlineStylesheet:l,maskInputOptions:M,maskTextFn:h,maskInputFn:m,slimDOMOptions:x,dataURLOptions:f,inlineImages:a,recordCanvas:d,preserveWhiteSpace:c,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:g,stylesheetLoadTimeout:C,keepIframeSrcFn:A,newlyAddedElement:!1})}var In=class e{constructor(...t){b(this,"parentElement",null),b(this,"parentNode",null),b(this,"ownerDocument"),b(this,"firstChild",null),b(this,"lastChild",null),b(this,"previousSibling",null),b(this,"nextSibling",null),b(this,"ELEMENT_NODE",1),b(this,"TEXT_NODE",3),b(this,"nodeType"),b(this,"nodeName"),b(this,"RRNodeType")}get childNodes(){let t=[],n=this.firstChild;for(;n;)t.push(n),n=n.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function V(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var Xe=`Please stop import mirror directly. Instead of that,\r
|
|
2
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,Kr={map:{},getId(){return console.error(Xe),-1},getNode(){return console.error(Xe),null},removeNodeFromMap(){console.error(Xe)},has(){return console.error(Xe),!1},reset(){console.error(Xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Kr=new Proxy(Kr,{get(e,t,n){return t==="map"&&console.error(Xe),Reflect.get(e,t,n)}}));function St(e,t,n={}){let r=null,o=0;return function(...s){let i=Date.now();!o&&n.leading===!1&&(o=i);let l=t-(i-o),a=this;l<=0||l>t?(r&&(clearTimeout(r),r=null),o=i,e.apply(a,s)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{o=n.leading===!1?0:Date.now(),r=null,e.apply(a,s)},l))}}function Kt(e,t,n,r,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(i){setTimeout(()=>{n.set.call(this,i)},0),s&&s.set&&s.set.call(this,i)}}),()=>Kt(e,t,s||{},!0)}function yo(e){var t,n,r,o;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=T.parentElement(s.body))==null?void 0:t.scrollLeft)||((n=s?.body)==null?void 0:n.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((r=T.parentElement(s.body))==null?void 0:r.scrollTop)||((o=s?.body)==null?void 0:o.scrollTop)||0}}function So(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function bo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function wo(e){return e?e.nodeType===e.ELEMENT_NODE?e:T.parentElement(e):null}function j(e,t,n,r){if(!e)return!1;let o=wo(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||r&&o.closest("."+t)!==null)return!0}else if(Xt(o,t,r))return!0}catch{}return!!(n&&(o.matches(n)||r&&o.closest(n)!==null))}function ka(e,t){return t.getId(e)!==-1}function Tn(e,t,n){return e.tagName==="TITLE"&&n.headTitleMutations?!0:t.getId(e)===Gt}function Eo(e,t){if(ht(e))return!1;let n=t.getId(e);if(!t.has(n))return!0;let r=T.parentNode(e);return r&&r.nodeType===e.DOCUMENT_NODE?!1:r?Eo(r,t):!0}function kn(e){return!!e.changedTouches}function Na(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function vo(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function To(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Nn(e){return e?e instanceof In&&"shadowRoot"in e?!!e.shadowRoot:!!T.shadowRoot(e):!1}var Rn=class{constructor(){b(this,"id",1),b(this,"styleIDMap",new WeakMap),b(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function xo(e){var t;let n=null;return"getRootNode"in e&&((t=T.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&T.host(T.getRootNode(e))&&(n=T.host(T.getRootNode(e))),n}function Ra(e){let t=e,n;for(;n=xo(t);)t=n;return t}function Oa(e){let t=T.ownerDocument(e);if(!t)return!1;let n=Ra(e);return T.contains(t,n)}function On(e){let t=T.ownerDocument(e);return t?T.contains(t,e)||Oa(e):!1}var Qr=(e,t)=>`${e}@${t}`,Ln=class{constructor(){b(this,"frozen",!1),b(this,"locked",!1),b(this,"texts",[]),b(this,"attributes",[]),b(this,"attributeMap",new WeakMap),b(this,"removes",[]),b(this,"mapRemoves",[]),b(this,"movedMap",{}),b(this,"addedSet",new Set),b(this,"movedSet",new Set),b(this,"droppedSet",new Set),b(this,"removesSubTreeCache",new Set),b(this,"mutationCb"),b(this,"blockClass"),b(this,"blockSelector"),b(this,"maskTextClass"),b(this,"maskTextSelector"),b(this,"inlineStylesheet"),b(this,"maskInputOptions"),b(this,"maskTextFn"),b(this,"maskInputFn"),b(this,"keepIframeSrcFn"),b(this,"recordCanvas"),b(this,"inlineImages"),b(this,"slimDOMOptions"),b(this,"dataURLOptions"),b(this,"doc"),b(this,"mirror"),b(this,"iframeManager"),b(this,"stylesheetManager"),b(this,"shadowDomManager"),b(this,"processedNodeManager"),b(this,"unattachedDoc"),b(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),b(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],n=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let m of this.movedSet){let p=T.parentNode(m);this.removesSubTreeCache.has(p)&&!this.movedSet.has(p)||this.addedSet.add(m)}let r=null,o=null,s=-1,i=null,l=!1,a=new Set,d=this.addedSet.values(),u=d.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(T.previousSibling(r)))i=r,r=T.previousSibling(r);else{for(this.addedSet.has(u.value)||(u=d.next()),r=u.value;;){if(o=T.parentNode(r),this.addedSet.has(o)){r=o;continue}break}if(a.has(o))o=null;else if(o){if(On(o)?(l=Zr(this.droppedSet,o)||this.removesSubTreeCache.has(o),l&&Zr(this.movedSet,r)&&(l=!1)):l=!0,this.addedSet.has(T.lastChild(o)))r=T.lastChild(o),i=null;else for(;;){if(i=T.nextSibling(r),this.addedSet.has(i)){r=i;continue}break}if(s=ht(o)?this.mirror.getId(xo(r)):this.mirror.getId(o),s===-1&&o.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let c=T.host(o);s=this.mirror.getId(c)}}}if(this.addedSet.delete(r),!o||s===-1){a.add(r);continue}else if(l){this.droppedSet.add(r);continue}let m=!1;if(r.nodeType===Node.TEXT_NODE){let c=o.tagName;if(c==="TEXTAREA")continue;c==="STYLE"&&n.has(s)&&(m=!0)}let p=i?this.mirror.getId(i):null;for(;p===Gt;)i=i&&T.nextSibling(i),p=i&&this.mirror.getId(i);if(p===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",i),r=null;continue}let f=Je(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:c=>{vo(c,this.mirror)&&this.iframeManager.addIframe(c),To(c,this.mirror)&&this.stylesheetManager.trackLinkElement(c),Nn(r)&&this.shadowDomManager.addShadowRoot(T.shadowRoot(r),this.doc)},onIframeLoad:(c,y)=>{this.iframeManager.attachIframe(c,y),this.shadowDomManager.observeAttachShadow(c)},onStylesheetLoad:(c,y)=>{this.stylesheetManager.attachLinkElement(c,y)},cssCaptured:m});f&&(t.push({parentId:s,nextId:p,node:f}),n.add(f.id))}let h={texts:this.texts.map(m=>{let p=m.node,f=T.parentNode(p);return f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f),{id:this.mirror.getId(p),value:m.value}}).filter(m=>!n.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{let{attributes:p}=m;if(typeof p.style=="string"){let f=JSON.stringify(m.styleDiff),c=JSON.stringify(m._unchangedStyles);f.length<p.style.length&&(f+c).split("var(").length===p.style.split("var(").length&&(p.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:p}}).filter(m=>!n.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h))}),b(this,"genTextAreaValueMutation",t=>{let n=this.attributeMap.get(t);n||(n={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(t,n));let r=Array.from(T.childNodes(t),o=>T.textContent(o)||"").join("");n.attributes.value=Vt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:qt(t),value:r,maskInputFn:this.maskInputFn})}),b(this,"processMutation",t=>{if(!Tn(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let n=T.textContent(t.target);!j(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:mo(t.target,this.maskTextClass,this.maskTextSelector,!0)&&n?this.maskTextFn?this.maskTextFn(n,wo(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=xe(n.tagName),o=t.attributeName,s=t.target.getAttribute(o);if(o==="value"){let l=qt(n);s=Vt({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:l,value:s,maskInputFn:this.maskInputFn})}if(j(t.target,this.blockClass,this.blockSelector,!1)||s===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r==="iframe"&&o==="src"&&!this.keepIframeSrcFn(s))if(!n.contentDocument)o="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),o==="type"&&r==="input"&&(t.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!ho(r,o))if(i.attributes[o]=po(this.doc,r,xe(o),s),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");t.oldValue&&l.setAttribute("style",t.oldValue);for(let a of Array.from(n.style)){let d=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);d!==l.style.getPropertyValue(a)||u!==l.style.getPropertyPriority(a)?u===""?i.styleDiff[a]=d:i.styleDiff[a]=[d,u]:i._unchangedStyles[a]=[d,u]}for(let a of Array.from(l.style))n.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else o==="open"&&n.tagName==="DIALOG"&&(n.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(j(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{On(n)||this.shadowDomManager.removeShadowRootsIn(n);let r=this.mirror.getId(n),o=ht(t.target)?this.mirror.getId(T.host(t.target)):this.mirror.getId(t.target);j(t.target,this.blockClass,this.blockSelector,!1)||Tn(n,this.mirror,this.slimDOMOptions)||!ka(n,this.mirror)||(this.addedSet.has(n)?(An(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Eo(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Qr(r,o)]?An(this.movedSet,n):(this.removes.push({parentId:o,id:r,isShadow:ht(t.target)&&mt(t.target)?!0:void 0}),La(n,this.removesSubTreeCache))),this.mapRemoves.push(n))});break}}}),b(this,"genAdds",(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Tn(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Qr(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);j(t,this.blockClass,this.blockSelector,!1)||(T.childNodes(t).forEach(r=>this.genAdds(r)),Nn(t)&&T.childNodes(T.shadowRoot(t)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function An(e,t){e.delete(t),T.childNodes(t).forEach(n=>An(e,n))}function La(e,t){let n=[e];for(;n.length;){let r=n.pop();t.has(r)||(t.add(r),T.childNodes(r).forEach(o=>n.push(o)))}}function Zr(e,t){return e.size===0?!1:Co(e,t)}function Co(e,t){if(e.has(t))return!0;let n=T.parentNode(t);return n?Co(e,n):!1}var gt;function Aa(e){gt=e}function _a(){gt=void 0}var R=e=>gt?(...n)=>{try{return e(...n)}catch(r){if(gt&>(r)===!0)return;throw r}}:e,Qe=new Set;function wt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Mo(e,t){let n=new Ln;Qe.add(n),n.init(e);let[r,o]=io(),s=new r(R(n.processMutations.bind(n)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{s.disconnect(),Qe.delete(n),o()}}function Da({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,i=[],l,a=St(R(h=>{let m=Date.now()-l;e(i.map(p=>(p.timeOffset-=m,p)),h),i=[],l=null}),s),d=R(St(R(h=>{let m=wt(h),{clientX:p,clientY:f}=kn(h)?h.changedTouches[0]:h;l||(l=yt()),i.push({x:p,y:f,id:r.getId(m),timeOffset:yt()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?N.Drag:h instanceof MouseEvent?N.MouseMove:N.TouchMove)}),o,{trailing:!1})),u=[V("mousemove",d,n),V("touchmove",d,n),V("drag",d,n)];return R(()=>{u.forEach(h=>h())})}function Pa({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let i=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[],a=null,d=u=>h=>{let m=wt(h);if(j(m,r,o,!0))return;let p=null,f=u;if("pointerType"in h){switch(h.pointerType){case"mouse":p=me.Mouse;break;case"touch":p=me.Touch;break;case"pen":p=me.Pen;break}p===me.Touch?K[u]===K.MouseDown?f="TouchStart":K[u]===K.MouseUp&&(f="TouchEnd"):me.Pen}else kn(h)&&(p=me.Touch);p!==null?(a=p,(f.startsWith("Touch")&&p===me.Touch||f.startsWith("Mouse")&&p===me.Mouse)&&(p=null)):K[u]===K.Click&&(p=a,a=null);let c=kn(h)?h.changedTouches[0]:h;if(!c)return;let y=n.getId(m),{clientX:w,clientY:E}=c;R(e)({type:K[f],id:y,x:w,y:E,...p!==null&&{pointerType:p}})};return Object.keys(K).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&i[u]!==!1).forEach(u=>{let h=xe(u),m=d(u);if(window.PointerEvent)switch(K[u]){case K.MouseDown:case K.MouseUp:h=h.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}l.push(V(h,m,t))}),R(()=>{l.forEach(u=>u())})}function Io({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){let i=R(St(R(l=>{let a=wt(l);if(!a||j(a,r,o,!0))return;let d=n.getId(a);if(a===t&&t.defaultView){let u=yo(t.defaultView);e({id:d,x:u.left,y:u.top})}else e({id:d,x:a.scrollLeft,y:a.scrollTop})}),s.scroll||100));return V("scroll",i,t)}function Ua({viewportResizeCb:e},{win:t}){let n=-1,r=-1,o=R(St(R(()=>{let s=So(),i=bo();(n!==s||r!==i)&&(e({width:Number(i),height:Number(s)}),n=s,r=i)}),200));return V("resize",o,t)}var Fa=["INPUT","TEXTAREA","SELECT"],eo=new WeakMap;function Ha({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:i,maskInputOptions:l,maskInputFn:a,sampling:d,userTriggeredOnInput:u}){function h(E){let g=wt(E),C=E.isTrusted,A=g&&g.tagName;if(g&&A==="OPTION"&&(g=T.parentElement(g)),!g||!A||Fa.indexOf(A)<0||j(g,r,o,!0)||g.classList.contains(s)||i&&g.matches(i))return;let M=g.value,x=!1,B=qt(g)||"";B==="radio"||B==="checkbox"?x=g.checked:(l[A.toLowerCase()]||l[B])&&(M=Vt({element:g,maskInputOptions:l,tagName:A,type:B,value:M,maskInputFn:a})),m(g,u?{text:M,isChecked:x,userTriggered:C}:{text:M,isChecked:x});let te=g.name;B==="radio"&&te&&x&&t.querySelectorAll(`input[type="radio"][name="${te}"]`).forEach(ae=>{if(ae!==g){let ne=ae.value;m(ae,u?{text:ne,isChecked:!x,userTriggered:!1}:{text:ne,isChecked:!x})}})}function m(E,g){let C=eo.get(E);if(!C||C.text!==g.text||C.isChecked!==g.isChecked){eo.set(E,g);let A=n.getId(E);R(e)({...g,id:A})}}let f=(d.input==="last"?["change"]:["input","change"]).map(E=>V(E,R(h),t)),c=t.defaultView;if(!c)return()=>{f.forEach(E=>E())};let y=c.Object.getOwnPropertyDescriptor(c.HTMLInputElement.prototype,"value"),w=[[c.HTMLInputElement.prototype,"value"],[c.HTMLInputElement.prototype,"checked"],[c.HTMLSelectElement.prototype,"value"],[c.HTMLTextAreaElement.prototype,"value"],[c.HTMLSelectElement.prototype,"selectedIndex"],[c.HTMLOptionElement.prototype,"selected"]];return y&&y.set&&f.push(...w.map(E=>Kt(E[0],E[1],{set(){R(h)({target:this,isTrusted:!1})}},!1,c))),R(()=>{f.forEach(E=>E())})}function Yt(e){let t=[];function n(r,o){if(Ht("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ht("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ht("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ht("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let i=Array.from(r.parentRule.cssRules).indexOf(r);return o.unshift(i),n(r.parentRule,o)}else if(r.parentStyleSheet){let i=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(i)}return o}return n(e,t)}function Te(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function Ba({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:R((u,h,m)=>{let[p,f]=m,{id:c,styleId:y}=Te(h,t,n.styleMirror);return(c&&c!==-1||y&&y!==-1)&&e({id:c,styleId:y,adds:[{rule:p,index:f}]}),u.apply(h,m)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,m=this.cssRules.length){let p=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,m])};let s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:R((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Te(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,removes:[{index:p}]}),u.apply(h,m)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let i;r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:R((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Te(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,replace:p}),u.apply(h,m)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:R((u,h,m)=>{let[p]=m,{id:f,styleId:c}=Te(h,t,n.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,replaceSync:p}),u.apply(h,m)})}));let a={};Bt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Bt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Bt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Bt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let d={};return Object.entries(a).forEach(([u,h])=>{d[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(d[u].insertRule,{apply:R((m,p,f)=>{let[c,y]=f,{id:w,styleId:E}=Te(p.parentStyleSheet,t,n.styleMirror);return(w&&w!==-1||E&&E!==-1)&&e({id:w,styleId:E,adds:[{rule:c,index:[...Yt(p),y||0]}]}),m.apply(p,f)})}),h.prototype.deleteRule=new Proxy(d[u].deleteRule,{apply:R((m,p,f)=>{let[c]=f,{id:y,styleId:w}=Te(p.parentStyleSheet,t,n.styleMirror);return(y&&y!==-1||w&&w!==-1)&&e({id:y,styleId:w,removes:[{index:[...Yt(p),c]}]}),m.apply(p,f)})})}),R(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=d[u].insertRule,h.prototype.deleteRule=d[u].deleteRule})})}function ko({mirror:e,stylesheetManager:t},n){var r,o,s;let i=null;n.nodeName==="#document"?i=e.getId(n):i=e.getId(T.host(n));let l=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(s=(o=n.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return i===null||i===-1||!l||!a?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var d;return(d=a.get)==null?void 0:d.call(this)},set(d){var u;let h=(u=a.set)==null?void 0:u.call(this,d);if(i!==null&&i!==-1)try{t.adoptStyleSheets(d,i)}catch{}return h}}),R(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Wa({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:R((l,a,d)=>{var u;let[h,m,p]=d;if(n.has(h))return s.apply(a,[h,m,p]);let{id:f,styleId:c}=Te((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||c&&c!==-1)&&e({id:f,styleId:c,set:{property:h,value:m,priority:p},index:Yt(a.parentRule)}),l.apply(a,d)})});let i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:R((l,a,d)=>{var u;let[h]=d;if(n.has(h))return i.apply(a,[h]);let{id:m,styleId:p}=Te((u=a.parentRule)==null?void 0:u.parentStyleSheet,t,r.styleMirror);return(m&&m!==-1||p&&p!==-1)&&e({id:m,styleId:p,remove:{property:h},index:Yt(a.parentRule)}),l.apply(a,d)})}),R(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=i})}function za({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){let i=R(a=>St(R(d=>{let u=wt(d);if(!u||j(u,t,n,!0))return;let{currentTime:h,volume:m,muted:p,playbackRate:f,loop:c}=u;e({type:a,id:r.getId(u),currentTime:h,volume:m,muted:p,playbackRate:f,loop:c})}),o.media||500)),l=[V("play",i(Ge.Play),s),V("pause",i(Ge.Pause),s),V("seeked",i(Ge.Seeked),s),V("volumechange",i(Ge.VolumeChange),s),V("ratechange",i(Ge.RateChange),s)];return R(()=>{l.forEach(a=>a())})}function $a({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(a,d,u){let h=new s(a,d,u);return o.set(h,{family:a,buffer:typeof d!="string",descriptors:u,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),h};let i=Le(t.fonts,"add",function(l){return function(a){return setTimeout(R(()=>{let d=o.get(a);d&&(e(d),o.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{n.FontFace=s}),r.push(i),R(()=>{r.forEach(l=>l())})}function Va(e){let{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e,i=!0,l=R(()=>{let a=t.getSelection();if(!a||i&&a?.isCollapsed)return;i=a.isCollapsed||!1;let d=[],u=a.rangeCount||0;for(let h=0;h<u;h++){let m=a.getRangeAt(h),{startContainer:p,startOffset:f,endContainer:c,endOffset:y}=m;j(p,r,o,!0)||j(c,r,o,!0)||d.push({start:n.getId(p),startOffset:f,end:n.getId(c),endOffset:y})}s({ranges:d})});return l(),V("selectionchange",l)}function qa({doc:e,customElementCb:t}){let n=e.defaultView;return!n||!n.customElements?()=>{}:Le(n.customElements,"define",function(o){return function(s,i,l){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,i,l])}})}function ja(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:i,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:d,styleDeclarationCb:u,canvasMutationCb:h,fontCb:m,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...c)=>{t.mutation&&t.mutation(...c),n(...c)},e.mousemoveCb=(...c)=>{t.mousemove&&t.mousemove(...c),r(...c)},e.mouseInteractionCb=(...c)=>{t.mouseInteraction&&t.mouseInteraction(...c),o(...c)},e.scrollCb=(...c)=>{t.scroll&&t.scroll(...c),s(...c)},e.viewportResizeCb=(...c)=>{t.viewportResize&&t.viewportResize(...c),i(...c)},e.inputCb=(...c)=>{t.input&&t.input(...c),l(...c)},e.mediaInteractionCb=(...c)=>{t.mediaInteaction&&t.mediaInteaction(...c),a(...c)},e.styleSheetRuleCb=(...c)=>{t.styleSheetRule&&t.styleSheetRule(...c),d(...c)},e.styleDeclarationCb=(...c)=>{t.styleDeclaration&&t.styleDeclaration(...c),u(...c)},e.canvasMutationCb=(...c)=>{t.canvasMutation&&t.canvasMutation(...c),h(...c)},e.fontCb=(...c)=>{t.font&&t.font(...c),m(...c)},e.selectionCb=(...c)=>{t.selection&&t.selection(...c),p(...c)},e.customElementCb=(...c)=>{t.customElement&&t.customElement(...c),f(...c)}}function Ga(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};ja(e,t);let r;e.recordDOM&&(r=Mo(e,e.doc));let o=Da(e),s=Pa(e),i=Io(e),l=Ua(e,{win:n}),a=Ha(e),d=za(e),u=()=>{},h=()=>{},m=()=>{},p=()=>{};e.recordDOM&&(u=Ba(e,{win:n}),h=ko(e,e.doc),m=Wa(e,{win:n}),e.collectFonts&&(p=$a(e)));let f=Va(e),c=qa(e),y=[];for(let w of e.plugins)y.push(w.observer(w.callback,n,w.options));return R(()=>{r?.(),o(),s(),i(),l(),a(),d(),u(),h(),m(),p(),f(),c(),y.forEach(w=>w())})}function Ht(e){return typeof window[e]<"u"}function Bt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Jt=class{constructor(t){b(this,"iframeIdToRemoteIdMap",new WeakMap),b(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,n,r,o){let s=r||this.getIdToRemoteIdMap(t),i=o||this.getRemoteIdToIdMap(t),l=s.get(n);return l||(l=this.generateIdFn(),s.set(n,l),i.set(l,n)),l}getIds(t,n){let r=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return n.map(s=>this.getId(t,s,r,o))}getRemoteId(t,n,r){let o=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let s=o.get(n);return s||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(o=>this.getRemoteId(t,o,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}},_n=class{constructor(t){b(this,"iframes",new WeakMap),b(this,"crossOriginIframeMap",new WeakMap),b(this,"crossOriginIframeMirror",new Jt(fo)),b(this,"crossOriginIframeStyleMirror"),b(this,"crossOriginIframeRootIdMap",new WeakMap),b(this,"mirror"),b(this,"mutationCb"),b(this,"wrappedEmit"),b(this,"loadListener"),b(this,"unloadListener"),b(this,"attachedWindows",new Map),b(this,"messageHandler",n=>this.handleMessage(n)),b(this,"stylesheetManager"),b(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Jt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(r=this.loadListener)==null||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let n=t.contentWindow;if(!n||this.attachedWindows.has(n))return;let r=[],o=()=>{this.attachedWindows.delete(n),r.forEach(s=>{try{s()}catch{}})};this.attachedWindows.set(n,o),this.recordCrossOriginIframes&&r.push(V("message",this.messageHandler,n)),r.push(V("pagehide",s=>{var i;if(s.persisted)return;let l=n.document;o(),(i=this.unloadListener)==null||i.call(this,l)},n))}handleMessage(t){let n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let s=this.transformCrossOriginEvent(o,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case k.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);let o=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(n.data.node,o),{timestamp:n.timestamp,type:k.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case k.Meta:case k.Load:case k.DomContentLoaded:return!1;case k.Annotation:case k.Plugin:return n;case k.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case k.IncrementalSnapshot:switch(n.data.source){case N.Mutation:return n.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(o.node,s)}),n.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),n.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),n.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case N.Drag:case N.TouchMove:case N.MouseMove:return n.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(n.data,t,["id"]),n;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case N.Font:return n;case N.Selection:return n.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),n;case N.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)==null||r.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),n}}return!1}replace(t,n,r,o){for(let s of o)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=t.getIds(r,n[s]):n[s]=t.getId(r,n[s]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==W.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}},Dn=class{constructor(t){b(this,"shadowDoms",new Map),b(this,"mutationCb"),b(this,"scrollCb"),b(this,"bypassOptions"),b(this,"mirror"),b(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!mt(t)||this.shadowDoms.has(t))return;let r=[];this.shadowDoms.set(t,r);let o=Mo({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);r.push(o),r.push(Io({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===r&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(T.host(t))),r.push(ko({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let n=T.shadowRoot(t);n&&(this.shadowDoms.has(n)&&this.removeShadowRoot(n),this.removeShadowRootsIn(n)),T.childNodes(t).forEach(r=>this.removeShadowRootsIn(r))}removeShadowRoot(t){let n=this.shadowDoms.get(t);this.shadowDoms.delete(t),n?.forEach(xn)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){let r=this;this.restoreHandlers.push(Le(t.prototype,"attachShadow",function(o){return function(s){let i=o.call(this,s),l=T.shadowRoot(this);return l&&On(this)&&r.addShadowRoot(l,n),i}}))}reset(){this.restoreHandlers.forEach(xn),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(n=>n.forEach(xn))}};function xn(e){try{e()}catch{}}var Ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ft=0;ft<Ke.length;ft++)Xa[Ke.charCodeAt(ft)]=ft;var ft,Ya=function(e){var t=new Uint8Array(e),n,r=t.length,o="";for(n=0;n<r;n+=3)o+=Ke[t[n]>>2],o+=Ke[(t[n]&3)<<4|t[n+1]>>4],o+=Ke[(t[n+1]&15)<<2|t[n+2]>>6],o+=Ke[t[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o},to=new Map;function Ja(e,t){let n=to.get(e);return n||(n=new Map,to.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var No=(e,t,n)=>{if(!e||!(Oo(e,t)||typeof e=="object"))return;let r=e.constructor.name,o=Ja(n,r),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function Wt(e,t,n){if(e instanceof Array)return e.map(r=>Wt(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,o=Ya(e);return{rr_type:r,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Wt(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:o}=e;return{rr_type:r,src:o}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",o=e.toDataURL();return{rr_type:r,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Wt(e.data,t,n),e.width,e.height]};if(Oo(e,t)||typeof e=="object"){let r=e.constructor.name,o=No(e,t,n);return{rr_type:r,index:o}}}}return e}var Ro=(e,t,n)=>e.map(r=>Wt(r,t,n)),Oo=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function Ka(e,t,n,r){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let i of s)try{if(typeof t.CanvasRenderingContext2D.prototype[i]!="function")continue;let l=Le(t.CanvasRenderingContext2D.prototype,i,function(a){return function(...d){return j(this.canvas,n,r,!0)||setTimeout(()=>{let u=Ro(d,t,this);e(this.canvas,{type:Ze["2D"],property:i,args:u})},0),a.apply(this,d)}});o.push(l)}catch{let l=Kt(t.CanvasRenderingContext2D.prototype,i,{set(a){e(this.canvas,{type:Ze["2D"],property:i,args:[a],setter:!0})}});o.push(l)}return()=>{o.forEach(i=>i())}}function Qa(e){return e==="experimental-webgl"?"webgl":e}function no(e,t,n,r){let o=[];try{let s=Le(e.HTMLCanvasElement.prototype,"getContext",function(i){return function(l,...a){if(!j(this,t,n,!0)){let d=Qa(l);if("__context"in this||(this.__context=d),r&&["webgl","webgl2"].includes(d))if(a[0]&&typeof a[0]=="object"){let u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return i.apply(this,[l,...a])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function ro(e,t,n,r,o,s){let i=[],l=Object.getOwnPropertyNames(e);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof e[a]!="function")continue;let d=Le(e,a,function(u){return function(...h){let m=u.apply(this,h);if(No(m,s,this),"tagName"in this.canvas&&!j(this.canvas,r,o,!0)){let p=Ro(h,s,this),f={type:t,property:a,args:p};n(this.canvas,f)}return m}});i.push(d)}catch{let d=Kt(e,a,{set(u){n(this.canvas,{type:t,property:a,args:[u],setter:!0})}});i.push(d)}return i}function Za(e,t,n,r){let o=[];return typeof t.WebGLRenderingContext<"u"&&o.push(...ro(t.WebGLRenderingContext.prototype,Ze.WebGL,e,n,r,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...ro(t.WebGL2RenderingContext.prototype,Ze.WebGL2,e,n,r,t)),()=>{o.forEach(s=>s())}}var Lo=`(function() {
|
|
4
|
+
"use strict";
|
|
5
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
|
+
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
7
|
+
for (var i = 0; i < chars.length; i++) {
|
|
8
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
9
|
+
}
|
|
10
|
+
var encode = function(arraybuffer) {
|
|
11
|
+
var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
|
|
12
|
+
for (i2 = 0; i2 < len; i2 += 3) {
|
|
13
|
+
base64 += chars[bytes[i2] >> 2];
|
|
14
|
+
base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
|
|
15
|
+
base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
|
|
16
|
+
base64 += chars[bytes[i2 + 2] & 63];
|
|
17
|
+
}
|
|
18
|
+
if (len % 3 === 2) {
|
|
19
|
+
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
20
|
+
} else if (len % 3 === 1) {
|
|
21
|
+
base64 = base64.substring(0, base64.length - 2) + "==";
|
|
22
|
+
}
|
|
23
|
+
return base64;
|
|
24
|
+
};
|
|
25
|
+
const lastBlobMap = /* @__PURE__ */ new Map();
|
|
26
|
+
const transparentBlobMap = /* @__PURE__ */ new Map();
|
|
27
|
+
async function getTransparentBlobFor(width, height, dataURLOptions) {
|
|
28
|
+
const id = \`\${width}-\${height}\`;
|
|
29
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
30
|
+
if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
|
|
31
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
32
|
+
offscreen.getContext("2d");
|
|
33
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
34
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
35
|
+
const base64 = encode(arrayBuffer);
|
|
36
|
+
transparentBlobMap.set(id, base64);
|
|
37
|
+
return base64;
|
|
38
|
+
} else {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const worker = self;
|
|
43
|
+
worker.onmessage = async function(e) {
|
|
44
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
45
|
+
const { id, bitmap, width, height, dataURLOptions } = e.data;
|
|
46
|
+
const transparentBase64 = getTransparentBlobFor(
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
dataURLOptions
|
|
50
|
+
);
|
|
51
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
52
|
+
const ctx = offscreen.getContext("2d");
|
|
53
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
54
|
+
bitmap.close();
|
|
55
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
56
|
+
const type = blob.type;
|
|
57
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
58
|
+
const base64 = encode(arrayBuffer);
|
|
59
|
+
if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
|
|
60
|
+
lastBlobMap.set(id, base64);
|
|
61
|
+
return worker.postMessage({ id });
|
|
62
|
+
}
|
|
63
|
+
if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
|
|
64
|
+
worker.postMessage({
|
|
65
|
+
id,
|
|
66
|
+
type,
|
|
67
|
+
base64,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
});
|
|
71
|
+
lastBlobMap.set(id, base64);
|
|
72
|
+
} else {
|
|
73
|
+
return worker.postMessage({ id: e.data.id });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
})();
|
|
77
|
+
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
+
`,oo=typeof self<"u"&&self.Blob&&new Blob([Lo],{type:"text/javascript;charset=utf-8"});function el(e){let t;try{if(t=oo&&(self.URL||self.webkitURL).createObjectURL(oo),!t)throw"";let n=new Worker(t,{name:e?.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Lo),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Pn=class{constructor(t){b(this,"pendingCanvasMutations",new Map),b(this,"rafStamps",{latestId:0,invokeId:null}),b(this,"mirror"),b(this,"mutationCb"),b(this,"resetObservers"),b(this,"frozen",!1),b(this,"locked",!1),b(this,"processMutation",(a,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(d)});let{sampling:n="all",win:r,blockClass:o,blockSelector:s,recordCanvas:i,dataURLOptions:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,i&&n==="all"&&this.initCanvasMutationObserver(r,o,s),i&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,o,s,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,n,r,o,s){let i=no(n,r,o,!0),l=new Map,a=new el;a.onmessage=f=>{let{id:c}=f.data;if(l.set(c,!1),!("base64"in f.data))return;let{base64:y,type:w,width:E,height:g}=f.data;this.mutationCb({id:c,type:Ze["2D"],commands:[{property:"clearRect",args:[0,0,E,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:w}]},0,0]}]})};let d=1e3/t,u=0,h,m=()=>{let f=[];return n.document.querySelectorAll("canvas").forEach(c=>{j(c,r,o,!0)||f.push(c)}),f},p=f=>{if(u&&f-u<d){h=requestAnimationFrame(p);return}u=f,m().forEach(async c=>{var y;let w=this.mirror.getId(c);if(l.get(w)||c.width===0||c.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(c.__context)){let g=c.getContext(c.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let E=await createImageBitmap(c);a.postMessage({id:w,bitmap:E,width:c.width,height:c.height,dataURLOptions:s.dataURLOptions},[E])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{i(),cancelAnimationFrame(h)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=no(t,n,r,!1),s=Ka(this.processMutation.bind(this),t,n,r),i=Za(this.processMutation.bind(this),t,n,r);this.resetObservers=()=>{o(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;let o=r.map(i=>{let{type:l,...a}=i;return a}),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}},Un=class{constructor(t){b(this,"trackedLinkElements",new WeakSet),b(this,"mutationCb"),b(this,"adoptedStyleSheetCb"),b(this,"styleMirror",new Rn),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;let r={id:n,styleIds:[]},o=[];for(let s of t){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),o.push({styleId:i,rules:Array.from(s.rules||CSSRule,(l,a)=>({rule:lo(l,s.href),index:a}))})),r.styleIds.push(i)}o.length>0&&(r.styles=o),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Fn=class{constructor(){b(this,"nodeMap",new WeakMap),b(this,"active",!1)}inOtherBuffer(t,n){let r=this.nodeMap.get(t);return r&&Array.from(r).some(o=>o!==n)}add(t,n){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}},F,zt,ve,bt=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Vr=e.contentWindow)==null?void 0:Vr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ie=ta();function Q(e={}){let{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:d=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:m,slimDOMOptions:p,maskInputFn:f,maskTextFn:c,hooks:y,packFn:w,sampling:E={},dataURLOptions:g={},mousemoveWait:C,recordDOM:A=!0,recordCanvas:M=!1,recordCrossOriginIframes:x=!1,recordAfter:B=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:te=!1,collectFonts:ae=!1,inlineImages:ne=!1,plugins:de,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:ut=new Set([]),errorHandler:dt}=e;Aa(dt);let z=x?window.parent===window:!0,re=!1;if(!z)try{window.parent.document&&(re=!1)}catch{re=!0}if(z&&!t)throw new Error("emit function is required");if(!z&&!re)return()=>{};C!==void 0&&E.mousemove===void 0&&(E.mousemove=C),ie.reset();let Re=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m!==void 0?m:{password:!0},fe=go(p);Na();let Br,Sn=0,Wr=_=>{for(let le of de||[])le.eventProcessor&&(_=le.eventProcessor(_));return w&&!re&&(_=w(_)),_};F=(_,le)=>{let I=_;if(I.timestamp=yt(),I.type!==k.FullSnapshot&&!(I.type===k.IncrementalSnapshot&&I.data.source===N.Mutation)){ve.unfreeze();for(let Y of Qe)if(Y.isFrozen())Y.unfreeze();else break}if(z)t?.(Wr(I),le);else if(re){let Y={type:"rrweb",event:Wr(I),origin:window.location.origin,isCheckout:le};window.parent.postMessage(Y,"*")}if(I.type===k.FullSnapshot)Br=I,Sn=0;else if(I.type===k.IncrementalSnapshot){if(I.data.source===N.Mutation&&I.data.isAttachIframe)return;Sn++;let Y=r&&Sn>=r,oe=n&&I.timestamp-Br.timestamp>n;(Y||oe)&&zt(!0)}};let Ut=_=>{F({type:k.IncrementalSnapshot,data:{source:N.Mutation,..._}})},zr=_=>F({type:k.IncrementalSnapshot,data:{source:N.Scroll,..._}}),$r=_=>F({type:k.IncrementalSnapshot,data:{source:N.CanvasMutation,..._}}),ki=_=>F({type:k.IncrementalSnapshot,data:{source:N.AdoptedStyleSheet,..._}}),Oe=new Un({mutationCb:Ut,adoptedStyleSheetCb:ki}),he=new _n({mirror:ie,mutationCb:Ut,stylesheetManager:Oe,recordCrossOriginIframes:x,wrappedEmit:F});for(let _ of de||[])_.getMirror&&_.getMirror({nodeMirror:ie,crossOriginIframeMirror:he.crossOriginIframeMirror,crossOriginIframeStyleMirror:he.crossOriginIframeStyleMirror});let bn=new Fn;ve=new Pn({recordCanvas:M,mutationCb:$r,win:window,blockClass:o,blockSelector:s,mirror:ie,sampling:E.canvas,dataURLOptions:g});let qe=new Dn({mutationCb:Ut,scrollCb:zr,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:d,inlineStylesheet:u,maskInputOptions:Re,dataURLOptions:g,maskTextFn:c,maskInputFn:f,recordCanvas:M,inlineImages:ne,sampling:E,slimDOMOptions:fe,iframeManager:he,stylesheetManager:Oe,canvasManager:ve,keepIframeSrcFn:O,processedNodeManager:bn},mirror:ie});zt=(_=!1)=>{if(!A)return;F({type:k.Meta,data:{href:window.location.href,width:bo(),height:So()}},_),Oe.reset(),qe.init(),ve.lock(),Qe.forEach(I=>I.lock());let le=Ia(document,{mirror:ie,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:d,inlineStylesheet:u,maskAllInputs:Re,maskTextFn:c,maskInputFn:f,slimDOM:fe,dataURLOptions:g,recordCanvas:M,inlineImages:ne,onSerialize:I=>{vo(I,ie)&&he.addIframe(I),To(I,ie)&&Oe.trackLinkElement(I),Nn(I)&&qe.addShadowRoot(T.shadowRoot(I),document)},onIframeLoad:(I,Y)=>{he.attachIframe(I,Y),qe.observeAttachShadow(I)},onStylesheetLoad:(I,Y)=>{Oe.attachLinkElement(I,Y)},keepIframeSrcFn:O});if(!le)return console.warn("Failed to snapshot the document");F({type:k.FullSnapshot,data:{node:le,initialOffset:yo(window)}},_),ve.unlock(),Qe.forEach(I=>I.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Oe.adoptStyleSheets(document.adoptedStyleSheets,ie.getId(document))};try{let _=[],le=oe=>{var J;return R(Ga)({mutationCb:Ut,mousemoveCb:(D,wn)=>F({type:k.IncrementalSnapshot,data:{source:wn,positions:D}}),mouseInteractionCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.MouseInteraction,...D}}),scrollCb:zr,viewportResizeCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.ViewportResize,...D}}),inputCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.Input,...D}}),mediaInteractionCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.MediaInteraction,...D}}),styleSheetRuleCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.StyleSheetRule,...D}}),styleDeclarationCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.StyleDeclaration,...D}}),canvasMutationCb:$r,fontCb:D=>F({type:k.IncrementalSnapshot,data:{source:N.Font,...D}}),selectionCb:D=>{F({type:k.IncrementalSnapshot,data:{source:N.Selection,...D}})},customElementCb:D=>{F({type:k.IncrementalSnapshot,data:{source:N.CustomElement,...D}})},blockClass:o,ignoreClass:i,ignoreSelector:l,maskTextClass:a,maskTextSelector:d,maskInputOptions:Re,inlineStylesheet:u,sampling:E,recordDOM:A,recordCanvas:M,inlineImages:ne,userTriggeredOnInput:te,collectFonts:ae,doc:oe,maskInputFn:f,maskTextFn:c,keepIframeSrcFn:O,blockSelector:s,slimDOMOptions:fe,dataURLOptions:g,mirror:ie,iframeManager:he,stylesheetManager:Oe,shadowDomManager:qe,processedNodeManager:bn,canvasManager:ve,ignoreCSSAttributes:ut,plugins:((J=de?.filter(D=>D.observer))==null?void 0:J.map(D=>({observer:D.observer,options:D.options,callback:wn=>F({type:k.Plugin,data:{plugin:D.name,payload:wn}})})))||[]},y)},I=new Map;he.addLoadListener(oe=>{try{let J=oe.contentDocument;if(I.has(J))return;I.set(J,le(J))}catch(J){console.warn(J)}}),he.addUnloadListener(oe=>{let J=I.get(oe);J&&(I.delete(oe),J(),qe.removeShadowRootsIn(oe),ie.removeNodeFromMap(oe))});let Y=()=>{zt(),_.push(le(document)),bt=!0};return["interactive","complete"].includes(document.readyState)?Y():(_.push(V("DOMContentLoaded",()=>{F({type:k.DomContentLoaded,data:{}}),B==="DOMContentLoaded"&&Y()})),_.push(V("load",()=>{F({type:k.Load,data:{}}),B==="load"&&Y()},window))),()=>{[..._,...I.values()].forEach(oe=>{try{oe()}catch(J){String(J).toLowerCase().includes("cross-origin")||console.warn(J)}}),I.clear(),he.destroy(),bn.destroy(),qe.reset(),ve.reset(),bt=!1,_a()}}catch(_){console.warn(_)}}Q.addCustomEvent=(e,t)=>{if(!bt)throw new Error("please add custom event after start recording");F({type:k.Custom,data:{tag:e,payload:t}})};Q.addAnnotation=e=>{if(!bt)throw new Error("please add annotation after recording started");F({type:k.Annotation,data:e})};Q.freezePage=()=>{ve.freeze(),Qe.forEach(e=>e.freeze())};Q.takeFullSnapshot=e=>{if(!bt)throw new Error("please take full snapshot after start recording");zt(e)};Q.mirror=ie;var tl=Object.defineProperty,nl=(e,t,n)=>t in e?tl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qt=(e,t,n)=>nl(e,typeof t!="symbol"?t+"":t,n);Date.now().toString();function rl(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}var Ce=class{constructor(t){Qt(this,"fileName"),Qt(this,"functionName"),Qt(this,"lineNumber"),Qt(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){let t=this.lineNumber||"",n=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${n})`:`${this.fileName}:${t}:${n}`}},ol=/(^|@)\S+:\d+/,Ao=/^\s*at .*(\S+:\d+|\(native\))/m,sl=/^(eval@)?(\[native code])?$/,Wn={parse:function(e){return e?typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u"?this.parseOpera(e):e.stack&&e.stack.match(Ao)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];let n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!n)throw new Error(`Cannot parse given url: ${e}`);return[n[1],n[2]||void 0,n[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
|
|
79
|
+
`).filter(function(n){return!!n.match(Ao)},this).map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let r=n.replace(/^\s+/,"").replace(/\(eval code/g,"("),o=r.match(/ (\((.+):(\d+):(\d+)\)$)/);r=o?r.replace(o[0],""):r;let s=r.split(/\s+/).slice(1),i=this.extractLocation(o?o[1]:s.pop()),l=s.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Ce({functionName:l,fileName:a,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
|
|
80
|
+
`).filter(function(n){return!n.match(sl)},this).map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new Ce({functionName:n});{let r=/((.*".+"[^@]*)?[^@]*)(?:@)/,o=n.match(r),s=o&&o[1]?o[1]:void 0,i=this.extractLocation(n.replace(r,""));return new Ce({functionName:s,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
|
|
81
|
+
`)>-1&&e.message.split(`
|
|
82
|
+
`).length>e.stacktrace.split(`
|
|
83
|
+
`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){let t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split(`
|
|
84
|
+
`),r=[];for(let o=2,s=n.length;o<s;o+=2){let i=t.exec(n[o]);i&&r.push(new Ce({fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera10:function(e){let t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split(`
|
|
85
|
+
`),r=[];for(let o=0,s=n.length;o<s;o+=2){let i=t.exec(n[o]);i&&r.push(new Ce({functionName:i[3]||void 0,fileName:i[2],lineNumber:parseFloat(i[1])}))}return r},parseOpera11:function(e){return e.stack.split(`
|
|
86
|
+
`).filter(function(n){return!!n.match(ol)&&!n.match(/^Error created at/)},this).map(function(n){let r=n.split("@"),o=this.extractLocation(r.pop()),i=(r.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Ce({functionName:i,fileName:o[0],lineNumber:o[1],columnNumber:o[2]})},this)}};function il(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();let r=e.parentElement,o=[];if(r.children&&r.children.length>0)for(let s=0;s<r.children.length;s++){let i=r.children[s];i.localName&&i.localName.toLowerCase&&i.localName.toLowerCase()===n&&o.push(i)}o.length>1&&(n+=`:eq(${o.indexOf(e)})`),t=n+(t?">"+t:""),e=r}return t}function zn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Do(e,t){if(t===0)return!0;let n=Object.keys(e);for(let r of n)if(zn(e[r])&&Do(e[r],t-1))return!0;return!1}function et(e,t){let n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);let r=[],o=[];return JSON.stringify(e,function(l,a){if(r.length>0){let d=r.indexOf(this);~d?r.splice(d+1):r.push(this),~d?o.splice(d,1/0,l):o.push(l),~r.indexOf(a)&&(r[0]===a?a="[Circular ~]":a="[Circular ~."+o.slice(0,r.indexOf(a)).join(".")+"]")}else r.push(a);if(a===null)return a;if(a===void 0)return"undefined";if(s(a))return i(a);if(typeof a=="bigint")return a.toString()+"n";if(a instanceof Event){let d={};for(let u in a){let h=a[u];Array.isArray(h)?d[u]=il(h.length?h[0]:null):d[u]=h}return d}else{if(a instanceof Node)return a instanceof HTMLElement?a?a.outerHTML:"":a.nodeName;if(a instanceof Error)return a.stack?a.stack+`
|
|
87
|
+
End of stack for Error object`:a.name+": "+a.message}return a});function s(l){return!!(zn(l)&&Object.keys(l).length>n.numOfKeysLimit||typeof l=="function"||zn(l)&&Do(l,n.depthOfLimit))}function i(l){let a=l.toString();return n.stringLengthLimit&&a.length>n.stringLengthLimit&&(a=`${a.slice(0,n.stringLengthLimit)}...`),a}}var _o={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function al(e,t,n){let r=n?Object.assign({},_o,n):_o,o=r.logger;if(!o)return()=>{};let s;typeof o=="string"?s=t[o]:s=o;let i=0,l=!1,a=[];if(r.level.includes("error")){let u=m=>{let p=m.message,f=m.error,c=Wn.parse(f).map(w=>w.toString()),y=[et(p,r.stringifyOptions)];e({level:"error",trace:c,payload:y})};t.addEventListener("error",u),a.push(()=>{t.removeEventListener("error",u)});let h=m=>{let p,f;m.reason instanceof Error?(p=m.reason,f=[et(`Uncaught (in promise) ${p.name}: ${p.message}`,r.stringifyOptions)]):(p=new Error,f=[et("Uncaught (in promise)",r.stringifyOptions),et(m.reason,r.stringifyOptions)]);let c=Wn.parse(p).map(y=>y.toString());e({level:"error",trace:c,payload:f})};t.addEventListener("unhandledrejection",h),a.push(()=>{t.removeEventListener("unhandledrejection",h)})}for(let u of r.level)a.push(d(s,u));return()=>{a.forEach(u=>u())};function d(u,h){return u[h]?rl(u,h,m=>(...p)=>{if(m.apply(u,p),!(h==="assert"&&p[0])&&!l){l=!0;try{let f=Wn.parse(new Error).map(w=>w.toString()).splice(1),y=(h==="assert"?p.slice(1):p).map(w=>et(w,r.stringifyOptions));i++,i<r.lengthThreshold?e({level:h,trace:f,payload:y}):i===r.lengthThreshold&&e({level:"warn",trace:[],payload:[et("The number of log records reached the threshold.")]})}catch(f){m.apply(u,["rrweb logger error:",f,...p])}finally{l=!1}}}):()=>{}}}var ll="rrweb/console@1",Po=e=>({name:ll,observer:al,options:e});var zo=-1,vt=()=>zo,Tt=e=>{addEventListener("pageshow",t=>{t.persisted&&(zo=t.timeStamp,e(t))},!0)},pe=(e,t,n,r)=>{let o,s;return i=>{t.value>=0&&(i||r)&&(s=t.value-(o??0),(s||o===void 0)&&(o=t.value,t.delta=s,t.rating=((l,a)=>l>a[1]?"poor":l>a[0]?"needs-improvement":"good")(t.value,n),e(t)))}},Qn=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},$o=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},en=()=>$o()?.activationStart??0,Ae=-1,Vo=new Set,Uo=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,jn=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of Vo)t();isFinite(Ae)||(Ae=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",jn,!0))}},Et=(e=!1)=>{if(e&&(Ae=1/0),Ae<0){let t=en();Ae=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(r=>r.name==="hidden"&&r.startTime>=t)?.startTime)??Uo(),addEventListener("visibilitychange",jn,!0),addEventListener("prerenderingchange",jn,!0),Tt(()=>{setTimeout(()=>{Ae=Uo()})})}return{get firstHiddenTime(){return Ae},onHidden(t){Vo.add(t)}}},ge=(e,t=-1,n,r=0,o,s,i)=>{let l=$o(),a=l?.navigationId||0,d="navigate";return n?d=n:vt()>=0?d="back-forward-cache":l&&(document.prerendering||en()>0?d="prerender":document.wasDiscarded?d="restore":l.type&&(d=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:d,navigationId:r||a,navigationInteractionId:o,navigationURL:s||l?.name,navigationStartTime:i||0}},Fo=new WeakMap;function tn(e,t){let n=Fo.get(t);return n||(n=new WeakMap,Fo.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var Gn=class{constructor(){se(this,"t");se(this,"i",0);se(this,"o",[])}h(t){if(t.hadRecentInput)return;let n=this.o[0],r=this.o.at(-1);this.i&&n&&r&&t.startTime-r.startTime<1e3&&t.startTime-n.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),this.t?.(t)}},tt=(e,t,n={})=>{try{let r=e.filter(o=>PerformanceObserver.supportedEntryTypes.includes(o));if(r.length>0){let o=new PerformanceObserver(s=>{queueMicrotask(()=>{let i=s.getEntries();r.length>1&&i.sort((l,a)=>l.startTime+l.duration-(a.startTime+a.duration)),t(i)})});for(let s of r)o.observe({type:s,buffered:!0,...n});return o}}catch{}},nn=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint=="function"&&e&&e.reportSoftNavs,qo=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let n=e.keys().next().value;n!==void 0&&e.delete(n)}},jo=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Xn=class{constructor(){se(this,"l")}},Zn=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},$n=[1800,3e3],cl=(e,t={})=>{let n=nn(t);Zn(()=>{let r=tn(t,Xn),o=Et(),s,i=ge("FCP"),l=tt(["paint"],a=>{for(let d of a)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<o.firstHiddenTime&&(i.value=Math.max(d.startTime-en(),0),i.entries.push(d),i.navigationId=d.navigationId||i.navigationId,s(!0)))});l&&(s=pe(e,i,$n,t.reportAllChanges),Tt(a=>{i=ge("FCP",-1,"back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,vt()),s=pe(e,i,$n,t.reportAllChanges),Qn(()=>{i.value=performance.now()-a.timeStamp,s(!0)})})),n&&tt(["soft-navigation"],a=>{a.forEach(d=>{r.l&&d.navigationId&&qo(r.l,d);let u=Math.max((d.presentationTime||d.paintTime||0)-d.startTime,0);i=ge("FCP",u,"soft-navigation",d.navigationId,d.interactionId,d.name,d.startTime),s=pe(e,i,$n,t.reportAllChanges),s(!0)})},t)})},Ho=[.1,.25],Go=(e,t={})=>{let n=Et();cl(jo(()=>{let r,o=ge("CLS",0),s=tn(t,Gn),i=(m,p,f,c,y)=>{o=ge("CLS",0,m,p,f,c,y),s.i=0,r=pe(e,o,Ho,t.reportAllChanges)},l=(m=!1)=>{s.i>o.value&&(o.value=s.i,o.entries=s.o),r(m)},a=m=>{l(!0),i("soft-navigation",m.navigationId,m.interactionId,m.name,m.startTime)},d=m=>{for(let p of m)p.entryType!=="soft-navigation"?s.h(p):a(p);l()},u=["layout-shift"];nn(t)&&u.push("soft-navigation");let h=tt(u,d);h&&(r=pe(e,o,Ho,t.reportAllChanges),n.onHidden(()=>{d(h.takeRecords()),r(!0)}),Tt(()=>{i("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,vt()),Qn(r)}),setTimeout(r))}))},Xo=0,Vn=1/0,Zt=0,ul=e=>{for(let t of e)t.interactionId&&(Vn=Math.min(Vn,t.interactionId),Zt=Math.max(Zt,t.interactionId),Xo=Zt?(Zt-Vn)/7+1:0)},Yn,Bo=()=>Yn?Xo:performance.interactionCount??0,dl=()=>{"interactionCount"in performance||Yn||(Yn=tt(["event"],ul,{durationThreshold:0}))},Jn=class{constructor(){se(this,"u",0);se(this,"v",[]);se(this,"m",new Map);se(this,"p");se(this,"T")}_(){return Bo()-this.u}M(){this.u=Bo(),this.v.length=0,this.m.clear()}L(t){let n=this._(),r=Math.min(this.v.length-1,Math.floor(n/50));return!n||r!==-1||t!=="soft-navigation"&&t!=="back-forward-cache"?this.v[r]:{P:8,id:-1,entries:[]}}h(t){if(this.p?.(t),!t.interactionId)return;let n=this.v.at(-1),r=this.m.get(t.interactionId);if(r||this.v.length<10||t.duration>n.P){if(r?t.duration>r.P?(r.entries=[t],r.P=t.duration):t.duration===r.P&&t.startTime===r.entries[0].startTime&&r.entries.push(t):(r={id:t.interactionId,entries:[t],P:t.duration},this.m.set(r.id,r),this.v.push(r)),this.v.sort((o,s)=>s.P-o.P),this.v.length>10){let o=this.v.splice(10);for(let s of o)this.m.delete(s.id)}this.T?.(r)}}},Yo=e=>{let t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let o=jo(e),s=-1,i=()=>{r(s),o()};addEventListener("visibilitychange",i,{once:!0,capture:!0}),s=n(()=>{removeEventListener("visibilitychange",i,{capture:!0}),o()},{timeout:t})}},Wo=[200,500],Jo=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=Et();Zn(()=>{dl();let r,o=ge("INP"),s=tn(t,Jn),i=(m,p,f,c,y)=>{s.M(),o=ge("INP",-1,m,p,f,c,y),r=pe(e,o,Wo,t.reportAllChanges)},l=()=>{let m=s.L(o.navigationType);m&&m.P!==o.value&&(o.value=m.P,o.entries=m.entries,r())},a=m=>{l(),r(!0),i("soft-navigation",m.navigationId,m.interactionId,m.name,m.startTime)},d=(m,p=!1)=>{Yo(()=>{for(let f of m)f.entryType!=="soft-navigation"?s.h(f):a(f);l(),p&&r(!0)})},u=["event","first-input"];nn(t)&&u.push("soft-navigation");let h=tt(u,d,{...t,durationThreshold:t.durationThreshold??40});r=pe(e,o,Wo,t.reportAllChanges),h&&(n.onHidden(()=>{d(h.takeRecords(),!0)}),Tt(()=>{i("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,vt())}))})},Kn=class{constructor(){se(this,"p");se(this,"l")}h(t){this.p?.(t)}},qn=[2500,4e3],Ko=(e,t={})=>{let n=!1,r=nn(t);Zn(()=>{let o,s=Et(),i=ge("LCP"),l=tn(t,Kn),a=(p,f,c,y,w)=>{i=ge("LCP",-1,p,f,c,y,w),o=pe(e,i,qn,t.reportAllChanges),n=!1,p==="soft-navigation"&&(s=Et(!0))},d=p=>{l.l&&p.navigationId&&qo(l.l,p),n||o(!0),a("soft-navigation",p.navigationId,p.interactionId,p.name,p.startTime);let f=p.getLargestInteractionContentfulPaint?.();f&&u([f])},u=p=>{t.reportAllChanges||r||(p=p.slice(-1));for(let f of p){if(!f)continue;if(f.entryType==="soft-navigation"){d(f);continue}let c=0,y=[],w=f.startTime;if(f.entryType==="largest-contentful-paint")c=Math.max(f.startTime-en(),0),l.h(f),y=[f];else if(f.entryType==="interaction-contentful-paint"){let E=f;if(!i.navigationId||"interactionId"in E&&E.interactionId!=i.navigationInteractionId)continue;w=E.largestContentfulPaint?.renderTime||0,c=Math.max(w-f.startTime,0),E.largestContentfulPaint&&(l.h(E.largestContentfulPaint),y=[E.largestContentfulPaint])}w<s.firstHiddenTime&&(i.value=c,i.entries=y,o())}},h=["largest-contentful-paint"];r&&h.push("interaction-contentful-paint","soft-navigation");let m=tt(h,u);if(m){o=pe(e,i,qn,t.reportAllChanges);let p=["keydown","click","visibilitychange"],f=c=>{if(c.isTrusted&&!n){let y=i.id;Yo(()=>{if(!n){if(!r){m.disconnect();for(let w of p)removeEventListener(w,f,{capture:!0})}y===i.id&&(n=!0,o(!0))}})}};for(let c of p)addEventListener(c,f,{capture:!0});Tt(c=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,vt()),o=pe(e,i,qn,t.reportAllChanges),Qn(()=>{i.value=performance.now()-c.timeStamp,n=!0,o(!0)})})}})};var Qo="redacted";function rn(e){return new Set((e||[]).map(t=>String(t).toLowerCase()))}function nt(e,t,n=void 0){let r=rn(t);if(!e||r.size===0)return e;let o;try{o=new URL(e,n)}catch{return e}let s=!1;for(let i of[...o.searchParams.keys()])r.has(i.toLowerCase())&&o.searchParams.get(i)!==Qo&&(o.searchParams.set(i,Qo),s=!0);return s?o.toString():e}function _e(e,t){return!e||rn(t).size===0?e:String(e).replace(/(https?:\/\/[^\s"'<>()]+?)((?::\d+){1,2})?(?=[\s"'<>()]|$)/g,(n,r,o="")=>nt(r,t)+o)}var fl=["href","src","action","formaction","poster","xlink:href"],pl=["srcset","imagesrcset"];function hl(e,t,n){return e.split(",").map(r=>{let[,o="",s="",i=""]=r.match(/^(\s*)(\S*)(.*)$/s)||[];return o+nt(s,t,n)+i}).join(",")}function Zo(e,t,n=void 0){if(rn(t).size===0)return e;let r=o=>{if(o){for(let s of fl)typeof o[s]=="string"&&o[s].includes("?")&&(o[s]=nt(o[s],t,n));for(let s of pl)typeof o[s]=="string"&&o[s].includes("?")&&(o[s]=hl(o[s],t,n));typeof o.ping=="string"&&o.ping.includes("?")&&(o.ping=o.ping.split(/\s+/).map(s=>nt(s,t,n)).join(" "))}};for(let o of tr(e))nr(o,s=>s.type===2&&r(s.attributes));if(e.type===3&&e.data&&e.data.source===0)for(let o of e.data.attributes||[])r(o.attributes);return e}function tr(e){let t=[];if(e.type===2&&e.data&&e.data.node&&t.push(e.data.node),e.type===3&&e.data&&e.data.source===0)for(let n of e.data.adds||[])n.node&&t.push(n.node);return t}function nr(e,t){let n=[e];for(;n.length;){let r=n.pop();if(t(r),r.childNodes)for(let o of r.childNodes)n.push(o)}}function es(e){for(let t of tr(e))nr(t,n=>{n.type===2&&n.tagName==="input"&&n.attributes&&String(n.attributes.type||"").toLowerCase()==="hidden"&&delete n.attributes.value});return e}function ts(e){return e?{input:!0,textarea:!0,select:!0,password:!0,hidden:!0,file:!0}:{password:!0,hidden:!0,file:!0}}var ml=["alt","title","aria-label","aria-description","aria-valuetext","placeholder","download","label"],gl=new Set(["submit","button","reset"]);function er(e){return typeof e=="string"?e.replace(/\S/g,"*"):e}function ns(e,t,n=null){let r=(o,s,i,l)=>{if(!o)return;let a=ml.filter(h=>typeof o[h]=="string"),d=i==="input"&&typeof o.value=="string"&&gl.has(String(l||"").toLowerCase()),u=i==="meta"&&typeof o.content=="string";if(!(a.length===0&&!d&&!u||!t(s))){for(let h of a)o[h]=er(o[h]);d&&(o.value=er(o.value)),u&&(o.content=er(o.content))}};for(let o of tr(e))nr(o,s=>s.type===2&&r(s.attributes,s.id,s.tagName,s.attributes?.type));if(e.type===3&&e.data&&e.data.source===0)for(let o of e.data.attributes||[]){let s=typeof n=="function"?n(o.id):null;r(o.attributes,o.id,s?.tagName??null,s?.type??o.attributes?.type)}return e}function rs(e,t){if(e.type!==6||!e.data||!e.data.payload||rn(t).size===0)return e;let n=e.data.payload;for(let r of["payload","trace"])Array.isArray(n[r])&&(n[r]=n[r].map(o=>typeof o=="string"?_e(o,t):o));return e}function rr(e,t,n){if(!e||!t||typeof e.closest!="function")return!1;try{return!!e.closest(t)&&!(n&&e.closest(n))}catch{return!1}}function os(e,t){return(n,r)=>rr(r,e,t)?n:String(n??"").replace(/\S/g,"*")}function ss(e){if(typeof e!="string"||e.includes("("))return e;let t=e.split(",").map(r=>r.trim()).filter(Boolean),n=new Set(t);return t.filter(r=>!(r.endsWith(" *")&&n.has(r.slice(0,-2).trim()))).join(", ")}var ls="/*sr-asset:";var yl=/^\/\*sr-asset:([a-f0-9]{64})\*\/$/;function cs(e){return ls+e+"*/"}function Sl(e){let t=typeof e=="string"&&e.length===ls.length+64+2?yl.exec(e):null;return t?t[1]:null}function is(e){let t=new Set,n=[];for(let r of e)typeof r!="string"||r===""||r==="*"||(r.endsWith("*")?n.push(r.slice(0,-1)):t.add(r));return t.size===0&&n.length===0?null:r=>t.has(r)||n.some(o=>r.startsWith(o))}function us(e=[],t=[]){let n=is(e),r=is(t);return n===null?null:o=>n(o)&&!(r&&r(o))}function ds(e){return e.type===2&&e.data&&e.data.node?[e.data.node]:e.type===3&&e.data&&e.data.source===0?(e.data.adds||[]).map(t=>t.node).filter(Boolean):[]}function rt(e,t){let n=[e];for(;n.length;){let r=n.pop();if(t(r),r.childNodes)for(let o of r.childNodes)n.push(o)}}function fs(e,t){if(!t)return e;for(let n of ds(e))rt(n,r=>{if(!(r.type!==2||!r.attributes))for(let o of Object.keys(r.attributes))o!=="_cssText"&&t(o)&&delete r.attributes[o]});return e.type===3&&e.data&&e.data.source===0&&e.data.attributes&&(e.data.attributes=e.data.attributes.filter(n=>{for(let r of Object.keys(n.attributes||{}))r!=="_cssText"&&t(r)&&delete n.attributes[r];return Object.keys(n.attributes||{}).length>0||n.styleDiff||n._unchangedStyles})),e}function or(e,t=0){let n=[];if(e.type===3&&e.data&&e.data.source===0&&Array.isArray(e.data.attributes))for(let r of e.data.attributes)r&&r.attributes&&typeof r.attributes._cssText=="string"&&r.attributes._cssText.length>=t&&n.push({holder:r.attributes,key:"_cssText",text:r.attributes._cssText});for(let r of ds(e))rt(r,o=>{o.type===2&&o.attributes&&typeof o.attributes._cssText=="string"&&o.attributes._cssText.length>=t&&n.push({holder:o.attributes,key:"_cssText",text:o.attributes._cssText}),o.type===3&&o.isStyle&&typeof o.textContent=="string"&&o.textContent.length>=t&&n.push({holder:o,key:"textContent",text:o.textContent})});return n}function ps(e){let t=new Set;for(let n of e)for(let r of or(n)){let o=Sl(r.text);o&&t.add(o)}return[...t]}var hs="srSnapshot",bl=/^[a-f0-9]{64}$/,wl=["id","for","form","list","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns","popovertarget"];function El(e){let t=e&&e.type===2&&e.data?e.data[hs]:null;return typeof t=="string"&&bl.test(t)?t:null}function ms(e,t){return delete e.data.node,e.data[hs]=t,e}function gs(e){let t=new Set;for(let n of e){let r=El(n);r&&t.add(r)}return[...t]}function ys(e,t=[]){let n=t.filter(s=>typeof s=="string"&&s.length>1&&s.endsWith("*")).map(s=>s.slice(0,-1));if(!e||n.length===0)return e;let r=new Map,o=s=>{let i=n.find(l=>s.length>l.length&&s.startsWith(l));return i?(r.has(s)||r.set(s,`${i}sr${r.size+1}`),r.get(s)):s};return rt(e,s=>{if(!(s.type!==2||!s.attributes))for(let i of wl){let l=s.attributes[i];if(typeof l!="string"||l==="")continue;let a=l.trim().split(/\s+/),d=a.map(o);d.some((u,h)=>u!==a[h])&&(s.attributes[i]=d.join(" "))}}),e}var vl="data-replay-skip";function on(e){return!!e&&e.type===2&&!!e.attributes&&Object.prototype.hasOwnProperty.call(e.attributes,vl)}function Ss(e,t){rt(e,n=>{typeof n.id=="number"&&t.add(n.id)})}function as(e,t){rt(e,n=>{Array.isArray(n.childNodes)&&(n.childNodes=n.childNodes.filter(r=>on(r)?(Ss(r,t),!1):!0))})}function bs(e,t){if(!e||!e.data)return!0;if(e.type===2)return e.data.node&&(t.clear(),as(e.data.node,t)),!0;if(e.type!==3)return!0;let n=e.data;if(n.source!==0)return!(typeof n.id=="number"&&t.has(n.id));let r=Array.isArray(n.adds)?n.adds:[];if(t.size===0&&!r.some(l=>l&&l.node&&(on(l.node)||Tl(l.node))))return!0;let o=r.length+(n.removes?.length||0)+(n.attributes?.length||0)+(n.texts?.length||0),s=!0;for(;s;){s=!1;for(let l of r)!l||!l.node||t.has(l.node.id)||(on(l.node)||t.has(l.parentId))&&(Ss(l.node,t),s=!0)}n.adds=r.filter(l=>!l||!l.node?!0:t.has(l.node.id)?!1:(as(l.node,t),t.has(l.nextId)&&(l.nextId=null),t.has(l.previousId)&&(l.previousId=null),!0)),Array.isArray(n.removes)&&(n.removes=n.removes.filter(l=>!t.has(l.id)&&!t.has(l.parentId))),Array.isArray(n.attributes)&&(n.attributes=n.attributes.filter(l=>!t.has(l.id))),Array.isArray(n.texts)&&(n.texts=n.texts.filter(l=>!t.has(l.id)));let i=n.adds.length+(n.removes?.length||0)+(n.attributes?.length||0)+(n.texts?.length||0);return o===0||i>0}function Tl(e){let t=!1;return rt(e,n=>{on(n)&&(t=!0)}),t}var xl=["error","request","console","rage-click","custom"],ir=new Set([1,2,3,5,6,12]);function Es(e){return Math.min(3e4,Math.max(5e3,Math.round(e/2)))}function ar(e,t){return Array.isArray(t)&&xl.includes(e)&&t.includes(e)}function vs(e,t){let n=null;for(let s of e)s.type===2&&s.timestamp<=t&&(n===null||s.timestamp>n.timestamp)&&(n=s);if(n===null)return null;let r=n.timestamp,o=-1/0;for(let s of e)s.type===4&&s.timestamp<=n.timestamp&&s.timestamp>o&&(o=s.timestamp);return o>-1/0&&(r=o),r}function Ts(e,t,n){if(n===null)return{events:e,markers:t};let r=e.filter(i=>i.timestamp>=n),o=null,s=[];for(let i of t)i.at>=n?s.push(i):i.type==="navigation"&&(o===null||i.at>=o.at)&&(o=i);return o!==null&&s.unshift({...o,at:n}),{events:r,markers:s}}var sr=120;function ws(e){let t=0,n=e?[e]:[];for(;n.length;){let r=n.pop();if(t++,r.childNodes)for(let o of r.childNodes)n.push(o)}return t}function sn(e){if(e.type===2)return Math.max(2e5,ws(e.data?.node)*sr);let t=e.type===3&&e.data?.source===0?e.data:null;if(t&&((t.adds?.length||0)>10||(t.texts?.length||0)>20||(t.attributes?.length||0)>20)){let n=300+(t.texts?.length||0)*80+(t.attributes?.length||0)*sr+(t.removes?.length||0)*30;for(let r of t.adds||[])n+=ws(r?.node)*sr;return n}return 300}function xs(e){let t=0;for(let n of e)t+=sn(n);return t}function Cs(e){let t=0;for(let n of e)n.type===2?t=0:t+=sn(n);return t}function Ms(e){let t=0,n=0;for(let r of e)r.type!==3||!ir.has(r.data?.source)||(n&&r.timestamp-n<5e3&&r.timestamp>n&&(t+=r.timestamp-n),n=Math.max(n,r.timestamp));return t}function Is({pause:e,resume:t,current:n,skipped:r=null,setTimer:o=setTimeout,clearTimer:s=clearTimeout,now:i=Date.now,timeoutMs:l=5e3}){let a=!1,d=null,u=!1,h=!1,m=!1,p=null,f=[];function c(){d!==null&&s(d),d=null}function y(w){if(!h)return!1;let E=n();if(!E)return a&&!m&&(p=i()),m=!0,f=[],w?(h=!1,c()):d=null,!1;let g=a,C=g?p:null,A=f;h=!1,m=!1,p=null,a=!1,f=[],c();let M=t(E,g);C!==null&&M!==!1&&r?.(C,i());for(let x of A)x();return g}return{navigating(w){u=!0,h=!0;let E=!1;return!a&&w&&e()!==!1&&(a=!0,E=!0),d===null&&(d=o(()=>y(!1),l)),E},navigated:()=>y(!0),defer(w){return m?!0:h?(f.push(w),!0):!1},stop(){c(),a=!1,p=null,f=[]},isPaused:()=>a,isExcluded:()=>m,isAwaiting:()=>h,swapped:()=>u}}function ks(e,t,n){let r=null,o=null;return{plugin:{...e,observer(s,i,l){return i!==n?e.observer(s,i,l):(r=s,o||(o=e.observer(a=>r?r(a):t(a),i,l)),()=>{r===s&&(r=null)})}},stop(){let s=o;r=null,o=null,s?.()}}}function Ns({url:e,method:t="GET",status:n=0,duration:r=0,threshold:o=500,page:s,skip:i=[],type:l=null,origins:a=[]}){if(l==="opaque"||l==="opaqueredirect")return null;let d,u;try{d=new URL(e,s),u=new URL(s).origin}catch{return null}if(d.origin!==u&&!a.includes(d.origin)||i.some(m=>m&&d.href.startsWith(m))||n!==0&&n<o)return null;let h=String(t||"GET").toUpperCase();return{label:`${h} ${d.pathname} ${n?`failed (${n})`:"got no answer"}`,payload:{method:h,status:n||null,url:d.href,duration:Math.round(r)}}}function lr(e,t){if(!e)return!1;let n=t.toLowerCase();try{return typeof e.has=="function"?e.has(t):Array.isArray(e)?e.some(r=>String(r?.[0]).toLowerCase()===n):Object.keys(e).some(r=>r.toLowerCase()===n)}catch{return!1}}function Rs(e,t,n){return e.then(r=>{try{t(r)}catch{}return r},r=>{try{n(r)}catch{}throw r})}function Ls(e,t=Math.random){let n=Math.min(6e4,1e3*2**Math.max(1,e));return Math.round(n*(.5+dr(t())))}var Os=3e4,cr=12e4;function As(e){let t=Number(e)||0;return t===0||t===502||t===503||t===504}function _s(e=Math.random){return Math.round(Os+(cr-Os)*dr(e()))}var De=10*6e4,Ds=10;function Ps(e,t=Date.now(),n=Math.random){if(e==null)return null;let r=String(e).trim();if(r==="")return null;let o;if(/^\d+$/.test(r))o=Number(r)*1e3;else{let s=/[a-z]{3}/i.test(r)?Date.parse(r):Number.NaN;if(Number.isNaN(s))return null;o=s-t}return o=Math.min(De,Math.max(1e3,o)),Math.min(De,Math.round(o*(1+.2*dr(n()))))}function ur(e,t,n){let r=Number(e)-t;return Number.isFinite(r)?Math.min(n,Math.max(0,r)):0}function dr(e){let t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):.5}function fr(e,t){return`${e}:${t}`}function pr(e,{sessionId:t,identity:n,now:r,idleTimeout:o}){return!e||typeof e.session!="string"||typeof e.savedAt!="number"||r-e.savedAt>o||e.savedAt>r+6e4||(e.identity??null)!==(n??null)?"drop":e.session===t?"send":"keep"}var an=null;function xt(){an?.()}var Cl=`
|
|
88
|
+
:host { all: initial; }
|
|
89
|
+
dialog {
|
|
90
|
+
box-sizing: border-box; width: calc(100% - 32px); max-width: 26rem; max-height: calc(100% - 32px); margin: auto; padding: 20px;
|
|
91
|
+
overflow: auto; border: 0; border-radius: 12px; background: #fff; color: #0f172a;
|
|
92
|
+
box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); outline: none;
|
|
93
|
+
font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
94
|
+
color-scheme: light dark;
|
|
95
|
+
}
|
|
96
|
+
dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
|
|
97
|
+
.toast {
|
|
98
|
+
box-sizing: border-box; position: fixed; inset: auto 16px 16px auto; margin: 0; width: calc(100% - 32px); max-width: 24rem;
|
|
99
|
+
max-height: calc(100% - 32px); overflow: auto; padding: 16px; border: 0; border-radius: 12px; background: #fff; color: #0f172a;
|
|
100
|
+
box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); z-index: 2147483647;
|
|
101
|
+
font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
102
|
+
color-scheme: light dark;
|
|
103
|
+
}
|
|
104
|
+
.toast h2 { font-size: 15px; }
|
|
105
|
+
.toast p { margin-bottom: 12px; }
|
|
106
|
+
.toast label { margin-bottom: 12px; }
|
|
107
|
+
/* A browser without showModal(): the same place, over the page, without the top layer. */
|
|
108
|
+
dialog[open]:not(:modal) { position: fixed; inset: 0; z-index: 2147483647; }
|
|
109
|
+
h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.35; }
|
|
110
|
+
.error { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; font-size: 13px; color: #64748b; }
|
|
111
|
+
.code { padding: 1px 7px; border-radius: 6px; background: #f1f5f9; color: #475569; font-weight: 600; font-variant-numeric: tabular-nums; }
|
|
112
|
+
.message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
113
|
+
p { margin: 0 0 16px; color: #334155; }
|
|
114
|
+
p.failed { margin-bottom: 8px; }
|
|
115
|
+
.notice {
|
|
116
|
+
position: fixed; inset: auto 16px 16px; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); z-index: 2147483647;
|
|
117
|
+
padding: 10px 14px; border: 0; border-radius: 10px; background: #0f172a; color: #f8fafc;
|
|
118
|
+
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
|
|
119
|
+
font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
120
|
+
}
|
|
121
|
+
label { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 16px; cursor: pointer; }
|
|
122
|
+
input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: #2563eb; }
|
|
123
|
+
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
|
|
124
|
+
button {
|
|
125
|
+
font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; cursor: pointer;
|
|
126
|
+
border: 1px solid #cbd5e1; background: #fff; color: #0f172a;
|
|
127
|
+
}
|
|
128
|
+
button.share { border-color: #2563eb; background: #2563eb; color: #fff; }
|
|
129
|
+
button:focus-visible, input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
|
|
130
|
+
@media (prefers-color-scheme: dark) {
|
|
131
|
+
dialog::backdrop { background: rgba(2, 6, 23, 0.6); }
|
|
132
|
+
dialog { background: #0f172a; color: #e2e8f0; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
|
|
133
|
+
p { color: #cbd5e1; }
|
|
134
|
+
.error { color: #94a3b8; }
|
|
135
|
+
.code { background: #1e293b; color: #cbd5e1; }
|
|
136
|
+
.notice { background: #f1f5f9; color: #0f172a; }
|
|
137
|
+
.toast { background: #0f172a; color: #e2e8f0; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
|
|
138
|
+
button { background: #1e293b; color: #e2e8f0; border-color: #334155; }
|
|
139
|
+
button.share { background: #3b82f6; border-color: #3b82f6; color: #fff; }
|
|
140
|
+
button:focus-visible, input:focus-visible { outline-color: #93c5fd; }
|
|
141
|
+
}
|
|
142
|
+
`;function q(e,t={},n=null){let r=document.createElement(e);for(let[o,s]of Object.entries(t))r.setAttribute(o,s);return n!==null&&(r.textContent=n),r}var Us=typeof document<"u"&&document.currentScript?.nonce||"";function Fs(){let e=q("style",{},Cl);return Us&&(e.nonce=Us),e}function Hs(e,{offerAnonymous:t=!1,error:n=null,toast:r=!1,timeoutMs:o=6e4}={}){return new Promise(s=>{let i=q("div",{"data-session-replay-ask":""}),l=i.attachShadow({mode:"closed"}),a=document.activeElement,d=Fs(),u=r?q("div",{class:"toast",role:"dialog","aria-live":"polite",popover:"manual","aria-labelledby":"sr-ask-title","aria-describedby":"sr-ask-body"}):q("dialog",{"aria-labelledby":"sr-ask-title","aria-describedby":"sr-ask-body",tabindex:"-1"}),h=q("input",{type:"checkbox",id:"sr-ask-anonymous"}),m=q("button",{type:"button",class:"decline"},e.decline),p=q("button",{type:"button",class:"share"},e.share),f=q("div",{class:"actions"});if(u.append(q("h2",{id:"sr-ask-title"},e.title)),n){let g=q("div",{class:"error"});n.status&&g.append(q("span",{class:"code"},String(n.status))),n.message&&g.append(q("span",{class:"message",title:n.message},n.message)),g.childElementCount&&u.append(g),e.failed&&u.append(q("p",{class:"failed"},e.failed))}if(u.append(q("p",{id:"sr-ask-body"},e.body)),t){let g=q("label",{for:"sr-ask-anonymous"});g.append(h,document.createTextNode(e.anonymous)),u.append(g)}f.append(m,p),u.append(f),l.append(d,u);let c=!1,y=null,w=()=>E({share:!1,anonymous:!1});an=w;let E=g=>{if(!c){c=!0,clearTimeout(y),an===w&&(an=null),i.remove();try{(!r||l.activeElement)&&a?.focus?.({preventScroll:!0})}catch{}s(g)}};if(m.addEventListener("click",()=>E({share:!1,anonymous:!1})),p.addEventListener("click",()=>E({share:!0,anonymous:t&&h.checked})),r){document.documentElement.append(i);try{u.showPopover()}catch{}o>0&&(y=setTimeout(()=>E({share:!1,anonymous:!1}),o));return}u.addEventListener("cancel",g=>{g.preventDefault(),E({share:!1,anonymous:!1})}),l.addEventListener("keydown",g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),E({share:!1,anonymous:!1}))}),u.addEventListener("close",()=>E({share:!1,anonymous:!1})),document.documentElement.append(i),setTimeout(()=>{c||(typeof u.showModal=="function"?u.showModal():u.setAttribute("open",""),u.focus())},0)})}function Bs(e){if(!e)return;let t=q("div",{"data-session-replay-notice":""}),n=t.attachShadow({mode:"closed"}),r=q("div",{class:"notice",role:"status",popover:"manual"},e);n.append(Fs(),r),document.documentElement.append(t);try{r.showPopover()}catch{}setTimeout(()=>t.remove(),4e3)}var Ws="session-replay",hr="pending",Ct=null;function Ml(){return Ct||(Ct=new Promise(e=>{let t;try{t=window.indexedDB.open(Ws,1)}catch{e(null);return}t.onupgradeneeded=()=>{try{t.result.createObjectStore(hr,{keyPath:"key"})}catch{}},t.onsuccess=()=>{let n=t.result;n.onversionchange=()=>{n.close(),Ct=null},e(n)},t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Ct)}async function zs(){try{return typeof window.indexedDB?.databases!="function"?null:(await window.indexedDB.databases()).some(e=>e.name===Ws)}catch{return null}}async function mr(e,t){let n=await Ml();return n?new Promise(r=>{try{let o=n.transaction(hr,e).objectStore(hr),s=t(o);s.onsuccess=()=>r(s.result??null),s.onerror=()=>r(null)}catch{r(null)}}):null}function $s(e,t,n,r,o){return mr("readwrite",s=>s.put({key:fr(e,t.seq),session:e,seq:t.seq,meta:t.meta,anonymous:!!t.anonymous,identity:o??null,assets:r,blob:n,notBefore:t.notBefore||0,savedAt:Date.now()}))}function Mt(e,t){return mr("readwrite",n=>n.delete(fr(e,t)))}async function gr(){let e=await mr("readonly",t=>t.getAll());return Array.isArray(e)?e:[]}var Il="sr:assist",Vs="sr:tab";function kl(){let e=new Uint8Array(12),t=globalThis.crypto;if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return[...e].map(n=>n.toString(16).padStart(2,"0")).join("")}function Nl(e,t){let n=e(Vs);if(typeof n=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(n))return n;let r=kl();return t(Vs,r),r}function Rl(e){try{let t=JSON.parse(e(Il)||"null");return t&&typeof t.id=="string"&&typeof t.secret=="string"?t:null}catch{return null}}var qs=["cancelled","declined","expired","withdrawn","ended"];function Ol(e,t){let n;try{n=new URL(String(e??""),t?.href)}catch{throw new Error("The Assist module URL is not a URL.")}if(!t?.origin||n.origin!==t.origin||!["http:","https:"].includes(n.protocol))throw new Error("The Assist module must come from the page's own origin.");return n.href}function js({settings:e,token:t,recording:n,read:r,write:o,load:s,lend:i,fetch:l,document:a=globalThis.document,location:d=globalThis.location}){let u=Nl(r,o),h=l||((...x)=>globalThis.fetch(...x)),m=s||(x=>import(x)),p=null,f=null,c=null;function y(){return p?Promise.resolve(p):(f||(f=Promise.resolve().then(()=>m(Ol(e().module,d))).then(x=>(p=x.installAssist({...i,tab:u}),p)).catch(x=>{throw f=null,x})),f)}function w(x){!x||typeof x.id!="string"||y().then(B=>B.knock(x)).catch(()=>{})}async function E(){clearTimeout(c),c=setTimeout(E,e().heartbeatMs||15e3);let x=n();if(!(a?.visibilityState!=="visible"||!x||!e().routes?.heartbeat))try{let B=await h(e().routes.heartbeat,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:t(),session:x.id,key:x.key??null})});if(!B.ok)return;w((await B.json())?.assist)}catch{}}let g=()=>Rl(r),C=()=>{let x=g();return!!x&&!qs.includes(x.status)},A={request:x=>y().then(B=>B.api.request(x)),cancel:()=>p||C()?y().then(x=>x.api.cancel()):Promise.resolve(),end:()=>p||C()?y().then(x=>x.api.end()):Promise.resolve(),status(){if(p)return p.api.status();let x=g();return x&&!qs.includes(x.status)?{id:x.id,status:x.status??null,agent:x.agent?{name:x.agent.name,avatar:x.agent.avatar}:null}:{id:null,status:null,agent:null}}};function M(){a?.addEventListener?.("visibilitychange",()=>{a.visibilityState==="visible"&&E()}),E(),(C()||e().button)&&y().catch(()=>{})}return{tab:u,api:A,ensure:y,knock:w,heartbeat:E,start:M,tap:x=>p?.tap(x),loaded:()=>!!p,stop:()=>clearTimeout(c)}}var S=null,Ue={},Qs=4,Al=3,_l=5,Dl=6,Cr="sr:session",Zs=800,ei="sr:consent",Pl="rrweb/console@1",yr=60*1024,Ul=40,ti="sr:pause",Fl=400,Hl=15e5,v=null,$=null,G=null,Me=null,cn=new WeakSet,L=!1,U=[],We=0,ct=0,ze=0,ke=[],at=new Set,ce=new Map,ln=new Set,un=0,kt=Promise.resolve(!1),Sr=0,dn=null,Nt=5e3,Ot=0,It=0,fn={at:0,label:""},st=0,br=!1,ot=!1,Z=!1,Er=null,Lt=new Set,ye=0,vr=null,Tr=0,it=0,pn=!1,Bl=new Set,Pe=null,Ie=!1,$e=0,ni=0,At=!1,xr=0,ri=null,Mr=!1;function oi(e){try{return window[e]}catch{return null}}function lt(e,t){try{return oi(e)?.getItem(t)??null}catch{return null}}function Fe(e,t,n){try{oi(e)?.setItem(t,n)}catch{}}function Wl(){if(window.crypto?.randomUUID)return window.crypto.randomUUID();let e=new Uint8Array(16);(window.crypto||{getRandomValues:n=>n.forEach((r,o)=>n[o]=Math.floor(Math.random()*256))}).getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function zl(){let e=new Uint8Array(16);return(window.crypto||{getRandomValues:t=>t.forEach((n,r)=>t[r]=Math.floor(Math.random()*256))}).getRandomValues(e),[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function $l(){let e=Date.now(),t=null;try{t=JSON.parse(lt("sessionStorage",Cr)||"null")}catch{t=null}return(!t||typeof t.id!="string"||e-t.lastActivity>S.idleTimeout||(t.identity??null)!==(S.identity??null))&&(t={id:Wl(),key:zl(),seq:0,lastActivity:e,sampled:Math.random()<S.sampleRate,identity:S.identity??null}),typeof t.key!="string"&&(t.key=null),["buffering","recording","declined","stopped"].includes(t.phase)||(t.phase=Ie&&t.seq===0?"buffering":"recording"),!Ie&&t.phase==="buffering"&&(t.phase="recording"),t}function Se(){if(v&&(v.lastActivity=Date.now(),Fe("sessionStorage",Cr,JSON.stringify(v)),S.cookie&&!["declined","stopped"].includes(v.phase)&&v.sampled)){let e=location.protocol==="https:"?"; Secure":"",t=v.key?`${v.id}.${v.key}`:v.id;document.cookie=`${S.cookie}=${t}; path=/; max-age=${Math.round(S.idleTimeout/1e3)}; SameSite=Lax${e}`}}function Vl(){S.cookie&&(document.cookie=`${S.cookie}=; path=/; max-age=0; SameSite=Lax`)}function ql(){return S.respectGpc&&navigator.globalPrivacyControl?!1:S.consent!=="opt-in"||lt("localStorage",ei)==="1"}function ue(e,t,n={},r=null){if(!$||L)return!1;let o=r??Date.now();return X.defer(()=>ue(e,t,n,o))?!1:(si(e,t,n,o,r===null),ar(e,S.onError?.triggers)?ii(e==="request"&&As(n?.status)):!1)}function si(e,t,n,r,o){let s=String(t??"").slice(0,480)||e;ke.push({type:e,label:s,payload:n,at:r});try{G&&o?Q.addCustomEvent(`sr:${e}`,{label:s,...n}):Ir({type:_l,data:{tag:`sr:${e}`,payload:{label:s,...n}},timestamp:r})}catch{}}function jl(e,t={}){if(!$||L||!v)return Promise.resolve(!1);let n=Date.now();return X.defer(()=>ue("report",e,t,n))||si("report",e,t,n,!0),v.phase==="buffering"&&(Z&&xt(),Z=!1,_t(n-$e),hn(!1)),v.phase!=="recording"?Promise.resolve(!1):(vr?.(),Ne())}async function Gl(e){let t=await window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return[...new Uint8Array(t)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function Xl(e,t){for(let n of t){let r=await Gl(n.text);n.holder[n.key]=cs(r),at.add(r),ce.has(r)||ce.set(r,n.text)}return e}function Gs(e){let t=sn(e);if(U.push(e),We+=t,e.type===2?(ct++,ze=0):ze+=t,v?.phase==="buffering"){Yl(e);return}(U.length>=Fl||We>=Hl)&&Ne()}function Yl(e){if(e.type===2){st=Math.max(st,e.timestamp),(!Z||ot)&&_t(ot?1/0:Date.now()-$e),ot=!1;return}We>=xr&&(ot=!0);let t=ct>1||ze>=xr/2;e.type===Al&&(ot&&t||st&&e.timestamp-st>ni&&!Z)&&Jl()}function Jl(){br||(br=!0,setTimeout(()=>{br=!1;try{G&&!L&&v?.phase==="buffering"&&(Q.takeFullSnapshot(!0),st=Date.now())}catch{}},0))}function _t(e){let t=Ts(U,ke,vs(U,e));if(U=t.events,ke=t.markers,We=xs(U),ct=U.filter(n=>n.type===2).length,ze=Cs(U),Ot=Ms(U),un===0){at=new Set(ps(U));for(let n of ce.keys())at.has(n)||ce.delete(n)}Se()}function ii(e=!1){if(!v||v.phase!=="buffering"||Z||L||v.declinedAt&&Date.now()-v.declinedAt<$e)return!1;if(_t(Date.now()-$e),!S.onError.ask)return hn(!1,e),!1;Z=!0;let t=v;return Hs(S.onError.labels,{offerAnonymous:!!S.onError.offerAnonymous,error:Er,toast:S.onError.ask==="toast",timeoutMs:S.onError.askTimeoutMs??6e4}).then(n=>{if(Z=!1,!(L||v!==t||v.phase!=="buffering")){if(n.share){hn(n.anonymous,e),Bs(S.onError.labels.sent);return}if(S.onError.askAgain){v.declinedAt=Date.now(),_t(1/0),Se();return}Dt(),v.phase="declined",Se()}}).catch(()=>{Z=!1}),!0}function hn(e,t=!1){if(v.phase="recording",v.anonymous=!!e,Se(),U.length){let n=Nr();n.window=At,t&&At&&(n.notBefore=Date.now()+_s()),Lr(n)}Ar()}function Kl(e){e.type!==3||!ir.has(e.data?.source)||(It&&e.timestamp-It<5e3&&(Ot+=e.timestamp-It),It=e.timestamp)}function Ql(e){if(e.type!==6||e.data?.plugin!==Pl||e.data.payload?.level!=="error")return;let t=_e((e.data.payload.payload||[]).join(" "),S.privacy.redactQuery).slice(0,480);e.timestamp-fn.at<250&&t.includes(fn.label.slice(0,80))||(ke.push({type:"console",label:t||"console.error",payload:{},at:e.timestamp}),ar("console",S.onError?.triggers)&&setTimeout(ii,0))}function Zl(){return!!(S.privacy.maskAllText||S.privacy.maskTextSelector)}function ec(e){try{let t=Q.mirror.getNode(e),n=t&&t.nodeType===1?t:t?.parentElement;return ai(n)}catch{return!0}}function tc(e){try{let t=Q.mirror.getNode(e);return t&&t.nodeType===1?{tagName:t.tagName.toLowerCase(),type:t.getAttribute("type")||""}:null}catch{return null}}function ai(e){return S.privacy.maskAllText?!rr(e,S.privacy.unmaskTextSelector,S.privacy.maskTextSelector):!!e?.closest?.(S.privacy.maskTextSelector)}function Ir(e){if(L||!bs(e,Bl))return;Kl(e),Ql(e),fs(e,ri),es(e),Zo(e,S.privacy.redactQuery,location.href),rs(e,S.privacy.redactQuery),Zl()&&ns(e,ec,tc),e.type===Qs&&e.data&&e.data.href&&(e.data.href=Ve(e.data.href)),e.type===2&&X.swapped()&&cn.add(e),e.type===2&&!S.snapshots?.share&&cn.add(e),Pe?.tap(e);let t=S.size.dedupeStylesheets&&Mr?or(e,S.size.dedupeMinBytes):[];if(t.length===0){Gs(e);return}let n=Tr;un++,Xl(e,t).catch(()=>e).then(r=>{un--,n===Tr&&Gs(r)})}async function kr(e){if(typeof CompressionStream>"u")return new Blob([e],{type:"application/json"});let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Blob([await new Response(t).arrayBuffer()],{type:"application/gzip"})}function Nr(){let e={seq:v.seq++,events:U,meta:{url:U.find(t=>t.type===Qs)?.data?.href||Ve(location.href),viewport:{width:window.innerWidth,height:window.innerHeight},from:U[0].timestamp,to:U[U.length-1].timestamp,events:U.length,activeMs:Math.round(Ot),markers:ke,assets:[...at]},anonymous:!!v.anonymous,session:v,token:S.token,identity:S.identity??null,tries:0,blob:null,window:!1,kept:!1};return U=[],We=0,ct=0,ze=0,ke=[],at=new Set,Ot=0,Se(),e}function li(e,t){let n=new FormData;return n.append("token",e.token),n.append("session",e.session.id),e.session.key&&n.append("key",e.session.key),n.append("seq",String(e.seq)),e.anonymous&&n.append("anonymous","1"),n.append("meta",JSON.stringify(e.meta)),n.append("events",t,"events"),n}async function nc(e,t,n){let r=[];for(let o of e){let s=ce.get(o);if(s===void 0)continue;if(Or()){r.push(o);continue}let i=new FormData;i.append("token",t),i.append("hash",o),i.append("session",n.id),n.key&&i.append("key",n.key),i.append("content",await kr(s),"content");try{let l=await fetch(S.assetUrl,{method:"POST",body:i});if(l.status===429&&(await di(l)).stop)return Dt(!0),r;(l.status===429||l.status>=500)&&(Rr(l),r.push(o))}catch{r.push(o)}}return r}var ci="sr:shared",rc=3600*1e3;function oc(){try{let e=Date.now(),t=JSON.parse(lt("sessionStorage",ci)||"{}");return(t.identity??null)!==(S.identity??null)?{}:Object.fromEntries(Object.entries(t.hashes||{}).filter(([,n])=>e-n<rc))}catch{return{}}}async function sc(e){for(let t of e.events)if(!(t.type!==2||!t.data||!t.data.node||cn.has(t)))try{ys(t.data.node,S.snapshots.volatileIds);let n=JSON.stringify(t.data.node),r=await window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(n)),o=[...new Uint8Array(r)].map(i=>i.toString(16).padStart(2,"0")).join(""),s=oc();if(!s[o]){if(Or())continue;let i=new FormData;i.append("token",e.token),i.append("hash",o),i.append("content",await kr(n),"content");let l=await fetch(S.snapshots.url,{method:"POST",body:i});if(!l.ok){Rr(l);continue}s[o]=Date.now(),Fe("sessionStorage",ci,JSON.stringify({identity:S.identity??null,hashes:Object.fromEntries(Object.entries(s).slice(-50))}))}ms(t,o)}catch{}e.meta.snapshots=gs(e.events)}async function ui(e){e.blob||(S.snapshots&&Mr&&e.events.some(t=>t.type===2&&!cn.has(t))&&await sc(e),e.blob=await kr(JSON.stringify(e.events))),(e.blob.size<=S.maxBatchBytes||e.events.length<=1)&&(e.events=[])}async function He(e){if(L||e.era!==it)return!1;await ui(e);let t=e.blob;if(t.size>S.maxBatchBytes&&e.events.length>1){let o=Math.ceil(e.events.length/2),s={...e,seq:e.session.seq++,events:e.events.slice(o),meta:{...e.meta,markers:[],assets:[],activeMs:0},blob:null};e.blob=null,e.events=e.events.slice(0,o),e.meta.events=e.events.length,e.meta.to=e.events[e.events.length-1].timestamp,s.meta.events=s.events.length,s.meta.from=s.events[0].timestamp,Se();let i=await He(e);return await He(s)&&i}if(e.window&&!e.kept&&!L&&await pi(e),e.notBefore&&(await new Promise(o=>{vr=o,fi(e.notBefore,cr).then(o)}),vr=null,e.notBefore=0),await ic(),L||e.era!==it)return!1;let n;try{n=await fetch(S.ingestUrl,{method:"POST",body:li(e,t)})}catch{return wr(e)}if(n.status===401&&Ue.refreshToken&&!e.refreshed){e.refreshed=!0;let o=null;try{o=await Ue.refreshToken(e.identity)}catch{o=null}if(typeof o=="string"&&o&&!L&&e.era===it)return e.token=o,He(e)}let r=await di(n);if(r.stop)return e.kept&&Xs(e),Dt(!0),!1;if(n.status===429||n.status>=500)return n.status===429&&(Nt=Math.min(Nt*2,6e4)),Rr(n)&&(e.pauses||0)<Ds?(e.pauses=(e.pauses||0)+1,wr(e,!0)):wr(e);if(e.kept&&Xs(e),n.ok){Nt=S.flushInterval,Pe&&r.assist&&Pe.knock(r.assist),ln=new Set(await nc([...new Set([...r.missing_assets||[],...ln])],e.token,e.session));for(let o of e.meta.assets)ln.has(o)||ce.delete(o)}return n.ok}async function di(e){try{let t=await e.json();return t&&typeof t=="object"?t:{}}catch{return{}}}async function wr(e,t=!1){return e.window&&!e.kept&&!L&&await pi(e),t?L?!1:He(e):ac(e)}function Rr(e){if(e.status!==503&&e.status!==429)return!1;let t=null;try{t=Ps(e.headers.get("Retry-After"))}catch{}return t===null?!1:(ye=Math.max(ye,Date.now()+t),Fe("sessionStorage",ti,String(ye)),!0)}function Or(){let e=Date.now();return ye||(ye=Number(lt("sessionStorage",ti))||0),ye>e+De&&(ye=e+De),ur(ye,e,De)>0}async function ic(){for(;Or()&&!L;)await fi(ye,De)}function fi(e,t){let n=ur(e,Date.now(),t);return n>0?new Promise(r=>setTimeout(r,n)):Promise.resolve()}async function pi(e){e.kept=!0,Lt.add(e);let t={};for(let n of e.meta.assets)ce.has(n)&&(t[n]=ce.get(n));await $s(e.session.id,e,e.blob,t,e.identity)}function Xs(e){e.kept=!1,Lt.delete(e),Mt(e.session.id,e.seq)}function ac(e){return++e.tries>8||L?!1:lc(Ls(e.tries)).then(()=>L?!1:He(e))}function lc(e){return new Promise(t=>{let n=()=>{clearTimeout(r),window.removeEventListener("online",n),t()},r=setTimeout(n,e);window.addEventListener("online",n)})}function Lr(e){if(Sr>=Ul)return Promise.resolve(!1);Sr++,e.era=it;let t=ui(e).catch(()=>{});return kt=kt.then(()=>t).then(()=>He(e)).catch(()=>!1).finally(()=>Sr--),kt}function Ne(){return L||!v||v.phase!=="recording"||U.length===0?Promise.resolve(!1):Lr(Nr())}async function cc(){let e=[];for(let t of await gr()){let n=pr(t,{sessionId:v.id,identity:S.identity,now:Date.now(),idleTimeout:S.idleTimeout});n==="drop"&&Mt(t.session,t.seq),n==="send"&&e.push(t)}e.sort((t,n)=>t.seq-n.seq);for(let t of e){if(L)return;for(let[r,o]of Object.entries(t.assets||{}))ce.has(r)||ce.set(r,o);let n={seq:t.seq,events:[],meta:t.meta,anonymous:!!t.anonymous,session:v,token:S.token,identity:S.identity??null,tries:0,blob:t.blob,window:!0,kept:!0,era:it,notBefore:Number(t.notBefore)||0};Lt.add(n),await He(n)}}function Ys(e=!0){if(L||!v||v.phase!=="recording"||U.length===0)return;let t=Nr(),n=new Blob([JSON.stringify(t.events)],{type:"application/json"}),r=n.size+JSON.stringify(t.meta).length+String(t.token).length+1024;if(!e&&r>=yr){Lr(t);return}try{let o=li(t,n);if(r<yr&&!("keepalive"in Request.prototype)&&navigator.sendBeacon?.(S.ingestUrl,o))return;fetch(S.ingestUrl,{method:"POST",body:o,keepalive:r<yr}).catch(()=>{})}catch{}}function Ar(){clearTimeout(dn),dn=setTimeout(()=>{Ne(),Ar()},Nt)}function Ve(e){return nt(e,S.privacy.redactQuery,location.href)}function uc(e,t){let n=t.filter(Boolean).join(", ");if(!n)return!1;try{return!!e.querySelector(n)}catch{return!0}}function dc(e){if(!(e instanceof Element))return"unknown";if(e=e.closest('button, a, [role="button"], summary, label, input, select, textarea')||e,S.privacy.blockSelector&&e.closest(S.privacy.blockSelector))return e.tagName.toLowerCase();let t=(S.privacy.maskAllText||S.privacy.maskTextSelector)&&ai(e),n=e.tagName.toLowerCase(),r=(e.getAttribute("alt")||e.getAttribute("aria-label")||e.getAttribute("title")||"").trim();if(!r&&!uc(e,[S.privacy.maskTextSelector,S.privacy.blockSelector])&&(n==="button"||e.getAttribute("role")==="button")&&(r=(e.textContent||"").replace(/\s+/g," ").trim()),r&&!t)return`${n} "${r.slice(0,60)}"`;let o=e.id?`#${e.id}`:"",s=typeof e.className=="string"&&e.className?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"";return`${n}${o}${s}`.slice(0,120)}var Js=null;function _r(){if(Js===location.pathname+location.search)return;Js=location.pathname+location.search;let e=new URL(Ve(location.href));ue("navigation",e.pathname+e.search,S.privacy.maskAllText?{url:e.href}:{url:e.href,title:document.title.slice(0,200)})}function fc(){window.addEventListener("error",e=>{if(!e.message)return;let t=_e(e.message,S.privacy.redactQuery);fn={at:Date.now(),label:t},ue("error",t,{source:Ve(e.filename),line:e.lineno,column:e.colno,stack:_e(String(e.error?.stack||""),S.privacy.redactQuery).slice(0,2e3)})}),window.addEventListener("unhandledrejection",e=>{let t=_e(String(e.reason?.message||e.reason||"Unhandled promise rejection"),S.privacy.redactQuery);fn={at:Date.now(),label:t},ue("error",t,{stack:_e(String(e.reason?.stack||""),S.privacy.redactQuery).slice(0,2e3)})})}function pc(e){if(typeof e!="string"||!e)return null;try{let t=new DOMParser().parseFromString(e.slice(0,2e4),"text/html").title.trim().replace(/\s+/g," ");return!t||t===String(S.appName||"").trim()?null:t.slice(0,120)}catch{return null}}function hc(){let e=()=>{try{window.Livewire.hook("request",({url:t,fail:n})=>{n(({status:r,content:o,preventDefault:s})=>{Er={status:Number(r)||null,message:pc(o)};let i=ue("request",`Livewire request failed (${r})`,{status:r,url:Ve(String(t||"")).slice(0,500)});Er=null,i&&S.onError?.replaceLivewireModal&&r!==419&&s?.()})})}catch{}};window.Livewire?e():document.addEventListener("livewire:init",e,{once:!0}),document.addEventListener("livewire:navigated",()=>_r())}function mc(){let e=S.capture.requests,t=[S.ingestUrl],n=Array.isArray(Ue.requestOrigins)?Ue.requestOrigins:[],r=!1,o=null,s=()=>{r=!0,clearTimeout(o),o=setTimeout(()=>r=!1,3e3)};window.addEventListener("beforeunload",s),window.addEventListener("pagehide",s);let i=f=>{if(r)return;let c=Ns({...f,threshold:e,page:location.href,skip:t,origins:n});c&&ue("request",c.label,{...c.payload,url:Ve(c.payload.url)})},l=window.fetch;if(typeof l=="function"&&(window.fetch=function(f,c){let y=performance.now(),w=l.apply(this,arguments);try{let E=typeof f=="string"||f instanceof URL?String(f):f?.url,g=c?.method||f?.method||"GET";if(!lr(c?.headers,"X-Livewire")&&!lr(f?.headers,"X-Livewire"))return Rs(w,C=>i({url:C.url||E,method:g,status:C.status,type:C.type,duration:performance.now()-y}),C=>C?.name!=="AbortError"&&i({url:E,method:g,status:0,duration:performance.now()-y}))}catch{}return w}),typeof XMLHttpRequest>"u")return;let a=new WeakMap,d=new WeakSet,u=XMLHttpRequest.prototype,h=u.open,m=u.setRequestHeader,p=u.send;u.open=function(f,c){return a.set(this,{method:f,url:String(c),livewire:!1,aborted:!1,started:0}),h.apply(this,arguments)},u.setRequestHeader=function(f){let c=a.get(this);return c&&String(f).toLowerCase()==="x-livewire"&&(c.livewire=!0),m.apply(this,arguments)},u.send=function(){let f=a.get(this);return f&&(f.started=performance.now()),f&&!d.has(this)&&(d.add(this),this.addEventListener("abort",()=>{let c=a.get(this);c&&(c.aborted=!0)}),this.addEventListener("loadend",()=>{let c=a.get(this);!c||c.livewire||c.aborted||i({url:this.responseURL||c.url,method:c.method,status:this.status,duration:performance.now()-c.started})})),p.apply(this,arguments)}}function gc(){let e=()=>{X.isAwaiting()||setTimeout(()=>X.isAwaiting()||_r(),0)},t=history.pushState;history.pushState=function(){let n=t.apply(this,arguments);return e(),n},window.addEventListener("popstate",e)}function yc(){let e=[],t=0;document.addEventListener("click",n=>{if(n.detail===0)return;let r=Date.now();e=e.filter(s=>r-s.at<700),e.push({at:r,x:n.clientX,y:n.clientY}),e.filter(s=>Math.hypot(s.x-n.clientX,s.y-n.clientY)<30).length>=3&&r>t&&(t=r+2e3,e=[],ue("rage-click",dc(n.target),{x:n.clientX,y:n.clientY}))},!0)}function Sc(){let e=t=>ue("vital",`${t.name} ${t.name==="CLS"?t.value.toFixed(3):Math.round(t.value)+" ms"}`,{name:t.name,value:t.value,rating:t.rating});Ko(e),Jo(e),Go(e)}function hi(){return{emit:Ir,plugins:Me?[Me.plugin]:[],maskAllInputs:!1,maskInputOptions:ts(S.privacy.maskAllInputs),maskTextSelector:S.privacy.maskAllText?"*":ss(S.privacy.maskTextSelector)||void 0,maskTextFn:S.privacy.maskAllText&&S.privacy.unmaskTextSelector?os(S.privacy.unmaskTextSelector,S.privacy.maskTextSelector):void 0,blockSelector:S.privacy.blockSelector||void 0,ignoreSelector:S.privacy.ignoreSelector||void 0,slimDOMOptions:"all",inlineStylesheet:!0,recordCanvas:!1,collectFonts:!1,sampling:S.size.sampling}}var X=Is({current:()=>window.__sessionReplay||null,pause(){try{G?.()}catch{}G=null},resume(e,t){if($&&!L&&v&&((e.identity??null)!==(v.identity??null)||Date.now()-v.lastActivity>e.idleTimeout))return gi(e),!1;if(S=e,pn&&!$){Rt();return}if(!(!t||L||!$)){try{G=Q(hi())||null}catch{G=null}G&&v?.phase==="recording"&&setTimeout(()=>{!L&&U.length&&Ne()},Zs)}},skipped(e,t){ue("navigation","Page not recorded",{skipped:!0,durationMs:Math.max(0,t-e)},e)}});function bc(){document.addEventListener("livewire:navigating",()=>{window.__sessionReplay=void 0,X.navigating(!!G&&!L)}),document.addEventListener("livewire:navigated",()=>X.navigated())}async function mn({all:e=!1,recording:t=null}={}){let n=await zs();if(n===!1||n===null&&!Ie)return;let r=Date.now();for(let o of await gr())(e||o.session===t||pr(o,{sessionId:v?.id??"",identity:S.identity,now:r,idleTimeout:S.idleTimeout})==="drop")&&Mt(o.session,o.seq)}var Ks=null;function mi(){let e=$&&v?v.id:null;if(e!==Ks){Ks=e;try{window.dispatchEvent(new CustomEvent("session-replay:session",{detail:{id:e}}))}catch{}}}function Rt(){let e=wc();return mi(),e}function wc(){if($||!S)return!1;if(!ql())return mn({all:!0}).catch(()=>{}),!1;if(X.isExcluded()||X.isAwaiting())return pn=!0,!1;if(pn=!1,v=$l(),Se(),mn({all:!At}).catch(()=>{}),!v.sampled||v.phase==="declined"||v.phase==="stopped")return!1;if(L=!1,st=0,Me=null,S.capture.console.length){let e=Po({level:S.capture.console,lengthThreshold:1e3,logger:window.console}),t=(n,r=Date.now())=>{X.defer(()=>t(n,r))||Ir({type:Dl,data:{plugin:e.name,payload:n},timestamp:r})};Me=ks(e,t,window)}return G=Q(hi())||null,G?($=()=>{let e=G;G=null,e?.(),Me?.stop(),Me=null},_r(),v.phase==="buffering"||(At&&(kt=kt.then(cc).catch(()=>{})),Ar(),setTimeout(()=>{!L&&U.length&&Ne()},Zs)),!0):(Me?.stop(),Me=null,!1)}function gi(e){Ne(),clearTimeout(dn),Fe("sessionStorage",Cr,"null"),Z&&xt(),Z=!1;try{$?.()}catch{}$=null,Tr++,U=[],We=0,ct=0,ze=0,ke=[],at=new Set,Ot=0,It=0,ot=!1,v=null,S=e,Rt()}function Ec(){!$||L||!v||v.phase!=="buffering"||(Z&&xt(),Z=!1,_t(Date.now()-$e),hn(!1))}function Dt(e=!1){L=!0,pn=!1,clearTimeout(dn),X.stop(),Z&&xt(),Z=!1,e&&v&&(v.phase="stopped",Se());try{$?.()}catch{}$=null,it++,U=[],We=0,ct=0,ze=0,ke=[],ce=new Map,ln=new Set,Vl();for(let t of Lt)Mt(t.session.id,t.seq);Lt=new Set,v&&mn({recording:v.id}).catch(()=>{}),mi()}function vc(e,{renewal:t=!1}={}){if(e){if(t){(e.identity??null)===(S.identity??null)&&(S=e);return}if($&&!L&&v&&((e.identity??null)!==(v.identity??null)||Date.now()-v.lastActivity>e.idleTimeout)){gi(e);return}S=e}}function yi(e,t={}){S=e,Ue=t||{},Nt=S.flushInterval,Ie=S.mode==="on_error",$e=Ie?S.onError.bufferMs:0,ni=Ie?Es($e):0,At=Ie&&!!S.onError.keepPending,xr=Ie?S.onError.maxWindowChars||5e6:0,ri=us(S.size.stripAttributes,S.size.keepAttributes),Mr=!!(window.crypto&&window.crypto.subtle&&window.TextEncoder),Ue.pageConfig&&bc(),S.capture.vitals&&Sc(),S.capture.errors&&fc(),S.capture.livewire&&hc(),S.capture.requests&&mc(),gc(),S.capture.rageClicks&&yc(),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&(un===0?Ys(!1):Ne())}),window.addEventListener("pagehide",()=>Ys());let n={start:Rt,stop:()=>Dt(),flush:Ne,mark:(r,o={})=>ue("custom",r,o),send:(r="Problem reported",o={})=>jl(r,o),consent(r){return Fe("localStorage",ei,r?"1":"0"),r?Rt():(Dt(),mn({all:!0}).catch(()=>{}),!1)},isRecording:()=>!!$&&!L&&!X.isExcluded()&&v?.phase==="recording",isBuffering:()=>!!$&&!L&&!X.isExcluded()&&v?.phase==="buffering",sessionId:()=>$&&v?v.id:null};if(Ue.global&&(window.SessionReplay=n),S.assist)try{let r=()=>$&&!L&&v&&v.phase==="recording"?{id:v.id,key:v.key}:null;Pe=js({settings:()=>S.assist||{},token:()=>S.token,recording:r,read:o=>lt("sessionStorage",o),write:(o,s)=>Fe("sessionStorage",o,s),lend:{config:()=>S,recording:r,snapshot(){try{return G?(Q.takeFullSnapshot(),!0):!1}catch{return!1}},mirrors:()=>!!G&&!L&&!X.isExcluded()&&!X.isAwaiting(),node:o=>{try{return G?Q.mirror.getNode(o):null}catch{return null}},goLive:Ec,touch:()=>Se(),redacted:Ve,read:o=>lt("sessionStorage",o),write:(o,s)=>Fe("sessionStorage",o,s)}}),n.assist=Pe.api,Pe.start()}catch{Pe=null}return Rt(),{api:n,update:vc,recording:()=>$&&!L&&v&&v.sampled&&!["declined","stopped"].includes(v.phase)?{id:v.id,key:v.key}:null}}var Tc="X-Session-Replay";var xc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Cc=/^[A-Za-z0-9]{1,128}$/;function Pr(e,t){if(typeof e!="string"||e.trim()==="")throw new TypeError('Session Replay: start() needs the token endpoint, e.g. "https://api.example.com/session-replay/token".');let n=new URL(e.trim(),t);if(n.protocol!=="https:"&&n.protocol!=="http:")throw new TypeError("Session Replay: the token endpoint must be an http or https URL.");if(n.username||n.password)throw new TypeError("Session Replay: the token endpoint must not carry a user name or password.");return n.hash="",n.href}function Dr(e,t){if(typeof e!="string"||e==="")return!1;try{let n=new URL(e);return(n.protocol==="https:"||n.protocol==="http:")&&n.origin===t}catch{return!1}}var be=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Pt=e=>typeof e=="number"&&Number.isFinite(e),Mc=e=>e==null||typeof e=="string",gn=e=>Array.isArray(e)&&e.every(t=>typeof t=="string");function Ic(e,t){return be(e)?typeof e.token!="string"||e.token===""||e.token.length>16384?"token":Mc(e.identity)?Dr(e.ingestUrl,t)?Dr(e.assetUrl,t)?!Pt(e.sampleRate)||e.sampleRate<0||e.sampleRate>1?"sampleRate":!Pt(e.idleTimeout)||e.idleTimeout<=0?"idleTimeout":!Pt(e.flushInterval)||e.flushInterval<1e3?"flushInterval":!Pt(e.maxBatchBytes)||e.maxBatchBytes<=0?"maxBatchBytes":e.consent!=="always"&&e.consent!=="opt-in"?"consent":e.mode!=="session"&&e.mode!=="on_error"?"mode":e.mode==="on_error"&&!be(e.onError)?"onError":!be(e.privacy)||!gn(e.privacy.redactQuery)?"privacy":!be(e.capture)||!gn(e.capture.console)?"capture":!be(e.size)||!gn(e.size.stripAttributes)||!gn(e.size.keepAttributes)?"size":!be(e.snapshots)||!Dr(e.snapshots.url,t)?"snapshots":null:"assetUrl":"ingestUrl":"identity":"no config"}function kc(e,t=Date.now()){if(!be(e))return null;if(Pt(e.expires_in))return e.expires_in>0?e.expires_in*1e3:null;let n=typeof e.expires_at=="string"?Date.parse(e.expires_at):NaN;return Number.isFinite(n)&&n>t?n-t:null}function bi(e,t,n,r=Date.now()){if(!be(e)||typeof e.record!="boolean")return null;if(!e.record)return{record:!1};let o=new URL(t).origin;if(Ic(e.config,o)!==null)return null;let s=typeof e.expires_at=="string"?Date.parse(e.expires_at):NaN;return{record:!0,config:{...e.config,identity:e.config.identity??null,assist:null,snapshots:{...e.config.snapshots,share:!1},cookie:o===n&&typeof e.config.cookie=="string"?e.config.cookie:null},expiresAt:Number.isFinite(s)?s:null,lifetime:kc(e,r)}}function wi(e){if(!e||typeof e.id!="string"||!xc.test(e.id))return{};let t=typeof e.key=="string"&&Cc.test(e.key)?e.key:null;return{[Tc]:t?`${e.id}.${t}`:e.id}}function Ei(e){let t={Accept:"application/json","X-Requested-With":"XMLHttpRequest"};if(be(e))for(let[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return t}var Nc=.5,Rc=1e3,Si=5*6e4,Oc=3e4,Lc=15*6e4;function Ac(e){return Math.max(Rc,Math.floor(e*Nc))}function _c(e){return Math.min(Lc,Oc*2**Math.max(0,Math.min(e,20)-1))}function vi({load:e,ready:t=()=>!0,now:n=()=>Date.now(),setTimer:r=(s,i)=>setTimeout(s,i),clearTimer:o=s=>clearTimeout(s)}){let s=null,i=0,l=0,a=0,d=!1,u=null,h=null,m=0,p=()=>Math.max(i+Ac(s),l);function f(){u!==null&&o(u),u=null}function c(){if(f(),!d||s===null)return;let M=p()-n();u=r(y,M>0?Math.min(M,Si):Si)}function y(){!d||s===null||h||(n()>=p()&&t()?g():c())}function w(M,x=n()){m++,s=typeof M=="number"&&Number.isFinite(M)&&M>0?M:null,i=x,l=0,a=0,d=!0,c()}function E(M,x,B){return h=null,x!==m?(c(),M):(M&&typeof M=="object"?w(M.lifetime,B):M===!1?(s=null,f()):s!==null&&(a++,n()>=i+s?s=null:l=n()+_c(a),c()),M)}function g(){if(h)return h;let M=m,x=n();return f(),h=Promise.resolve().then(e).catch(()=>null).then(B=>E(B===void 0?null:B,M,x)),h}function C(){m++,d=!1,f()}function A(){d=!0,y()}return{set:w,stop:C,resume:A,check:y,refresh:g,pending:()=>h!==null,scheduled:()=>u!==null}}var Dc=typeof fetch=="function"?fetch.bind(globalThis):null,Pc="sr:consent",H=null,we={},Ci=null,yn=0,Hr=!1,Ti=!1,xi=Promise.resolve(!1);function Ur(e){try{console.warn(`Session Replay: ${e}`)}catch{}}async function Mi(){let e=Pr(we.endpoint,location.href),t=typeof we.fetch=="function"?we.fetch:Dc;if(!t)return null;let n=await t(e,{method:"GET",credentials:we.credentials??"include",headers:Ei(we.headers),cache:"no-store",redirect:"error"});if(n.status===401||n.status===403)return{record:!1};if(!n.ok)return null;let r=null;try{r=await n.json()}catch{r=null}let o=bi(r,e,location.origin);return o===null&&Ur("the token route answered something that is not a recorder config for its own origin; nothing is recorded."),o}async function Uc(){let e=yn,t=await Mi();return t===null?null:!t.record||(t.config.identity??null)!==Ci?(e===yn&&Ii(),!1):(H?.update(t.config,{renewal:!0}),{config:t.config,lifetime:t.lifetime})}async function Fc(e){let t=await Ee.refresh();return!t||(t.config.identity??null)!==(e??null)?null:(H?.update(t.config),t.config.token)}function Ii(){Hr=!0,Ee.stop(),H?.api.stop()}function Fr(){return!!H&&(H.api.isRecording()||H.api.isBuffering())}var Ee=vi({load:Uc,ready:Fr});function Hc(){Ti||(Ti=!0,document.addEventListener("visibilitychange",()=>Ee.check()),window.addEventListener("pageshow",()=>Ee.check()),window.addEventListener("online",()=>Ee.check()))}async function Bc(e){if(we={...we,...e||{}},typeof window>"u"||typeof document>"u")return!1;if(!H&&window.SessionReplay)return Ur("window.SessionReplay is already there (the @sessionReplay directive?); start() does nothing."),!1;let t,n=Date.now();try{t=await Mi()}catch(r){return Ur(r?.message||"the token could not be fetched."),!1}return t===null?!1:(yn++,t.record?(Hr=!1,Ci=t.config.identity??null,Ee.set(t.lifetime,n),Hc(),H?(H.update(t.config),H.api.start(),Fr()):(H=yi(t.config,{global:!!we.global,refreshToken:Fc,requestOrigins:[new URL(Pr(we.endpoint,location.href)).origin]}),Fr())):(Ii(),!1))}function Su(e={}){let t=xi.then(()=>Bc(e));return xi=t.catch(()=>!1),t}function bu(){yn++,Ee.stop(),H?.api.stop()}function wu(e,t={}){return H?H.api.mark(e,t):!1}function Eu(e="Problem reported",t={}){return H?H.api.send(e,t):Promise.resolve(!1)}function vu(e){if(H&&!(e&&Hr)){let t=H.api.consent(e);return e?Ee.resume():Ee.stop(),t}try{window.localStorage.setItem(Pc,e?"1":"0")}catch{}return!1}function Tu(){return H?H.api.sessionId():null}function xu(){return H?H.api.isRecording():!1}function Cu(){return wi(H?.recording()??null)}export{vu as consent,Cu as header,xu as isRecording,wu as mark,Eu as send,Tu as sessionId,Su as start,bu as stop};
|
package/npm/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packstub/session-replay: the Session Replay for Laravel recorder for a frontend served apart from the Laravel app.
|
|
3
|
+
* See https://packstub.dev/docs/session-replay (Standalone frontend).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface StartOptions {
|
|
7
|
+
/** The app's token route, e.g. "https://api.example.com/session-replay/token". */
|
|
8
|
+
endpoint: string;
|
|
9
|
+
/** Sent with the token request: "include" (the default) for a session cookie, "omit" with a bearer token. */
|
|
10
|
+
credentials?: RequestCredentials;
|
|
11
|
+
/** Extra headers for the token request only, e.g. { Authorization: `Bearer ${token}` }. */
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
/** The fetch the token request goes through; the browser's own by default. */
|
|
14
|
+
fetch?: (input: string, init: RequestInit) => Promise<Response>;
|
|
15
|
+
/** Also put the recorder on window.SessionReplay. */
|
|
16
|
+
global?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Fetches a token and records; resolves to whether this tab records. Call it again after a sign-in or sign-out. */
|
|
20
|
+
export function start(options?: StartOptions): Promise<boolean>;
|
|
21
|
+
|
|
22
|
+
/** Stops recording until start() or consent(true). */
|
|
23
|
+
export function stop(): void;
|
|
24
|
+
|
|
25
|
+
/** Records a moment of your own on the timeline. */
|
|
26
|
+
export function mark(label: string, payload?: Record<string, unknown>): boolean;
|
|
27
|
+
|
|
28
|
+
/** Sends the replay now (a "report a problem" button); resolves to whether anything went up. */
|
|
29
|
+
export function send(label?: string, payload?: Record<string, unknown>): Promise<boolean>;
|
|
30
|
+
|
|
31
|
+
/** true remembers the answer and starts recording, false forgets it and stops. */
|
|
32
|
+
export function consent(given: boolean): boolean;
|
|
33
|
+
|
|
34
|
+
/** The running recording's id, or null. */
|
|
35
|
+
export function sessionId(): string | null;
|
|
36
|
+
|
|
37
|
+
/** Whether this tab uploads right now. */
|
|
38
|
+
export function isRecording(): boolean;
|
|
39
|
+
|
|
40
|
+
/** The header that links your API's log lines to the replay; {} while nothing records. Send it to your own API only. */
|
|
41
|
+
export function header(): { 'X-Session-Replay'?: string };
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@packstub/session-replay",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "Session Replay for Laravel: the rrweb recorder for a frontend on its own origin (Vue, React), uploading to your Laravel app.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://packstub.dev/docs/session-replay",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/packstub/session-replay.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/packstub/session-replay/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"session-replay",
|
|
16
|
+
"rrweb",
|
|
17
|
+
"laravel",
|
|
18
|
+
"vue",
|
|
19
|
+
"react"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./npm/dist/index.js",
|
|
23
|
+
"module": "./npm/dist/index.js",
|
|
24
|
+
"types": "./npm/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./npm/index.d.ts",
|
|
28
|
+
"import": "./npm/dist/index.js",
|
|
29
|
+
"default": "./npm/dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"npm/dist",
|
|
34
|
+
"npm/index.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"sideEffects": [
|
|
37
|
+
"./resources/js/**"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "node build.mjs",
|
|
41
|
+
"dev": "node build.mjs --watch",
|
|
42
|
+
"test": "node --test resources/js/tests/*.test.js",
|
|
43
|
+
"test:types": "tsc -p npm",
|
|
44
|
+
"test:e2e": "playwright test"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@packstub/holler": "^1.0",
|
|
48
|
+
"@playwright/test": "^1.64.1",
|
|
49
|
+
"@rrweb/record": "^2.2.0",
|
|
50
|
+
"@rrweb/replay": "^2.2.0",
|
|
51
|
+
"@rrweb/rrweb-plugin-console-record": "^2.2.0",
|
|
52
|
+
"esbuild": "^0.28.2",
|
|
53
|
+
"rrweb-player": "^2.2.0",
|
|
54
|
+
"typescript": "^7.0.2",
|
|
55
|
+
"web-vitals": "^6.2.2"
|
|
56
|
+
}
|
|
57
|
+
}
|