@keploy/capture-sdk 3.3.0 → 3.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/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";function e(e){return e.includes("%")?e.replace(Gn,e=>decodeURIComponent(e)):e}function t(t,n){return e(t).split("key"===n?/[[\]]+/:/[[\].]+/).map(e=>e.toLowerCase().replace(/[-_$+\s]/g,"")).filter(e=>""!==e)}function n(e,t){return!(tr.has(e)||"page"===t&&nr.has(e))&&(Qn.has(e)||Yn.has(e)||Xn.has(e)||er.test(e))}function r(e,n){return i(t(e,n),n)}function i(e,t){return e.some(e=>n(e,t))||e.length>1&&n(e.join(""),t)}function s(e){let t=e.replace(/\+/g," ");if(!/%/.test(t))return t;if(/%(?![0-9A-Fa-f]{2})/.test(t))return e;try{return decodeURIComponent(t)}catch{return e}}function o(e,t,n){let r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),s=i.indexOf("?"),o=-1===s?i:i.slice(0,s),l=-1===s?null:i.slice(s+1),a=-1===r?null:e.slice(r+1),d=c(o,t)+(null===l?"":`?${u(l,t,n,o)}`)+(null===a?"":`#${h(a,t,n,o)}`);return d===e?e:d}function l(e,t=!1){if(t){let t=e.search(/\s/);return-1===t?e.length:t}let n=0,r=0,i=0;for(let t=0;t<e.length;t++){let s=e[t];if(/[\s,;"'<>\\`]/.test(s))return t;if("("===s)n++;else if("["===s)r++;else if("{"===s)i++;else{if(")"===s&&0===n--)return t;if("]"===s&&0===r--)return t;if("}"===s&&0===i--)return t}}return e.length}function a(t,n){let i=t;for(let t=0;t<4;t++){let t=e(i);if(t===i)break;i=t}for(let e of i.matchAll(/(?:^|[?&;#])([^?&;#=/\s]+)=/g))if(r(e[1],n))return!0;return!1}function u(t,n,i=0,c=""){let h=t.split(n.whole?/(&)/:rr),f=h.filter((e,t)=>t%2==0),p={path:c,pairs:f,depth:i};return f.map(t=>{let c=t.indexOf("=");if(-1===c)return!0===n.bare?.(t)?"[REDACTED]":t;let h=t.slice(0,c),f=t.slice(c+1);if(""===f)return t;let g=s(f),y=()=>`${h}=[REDACTED]`,b=n.before?.(h,f,p)??null;if(null!==b)return`${h}=${b}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(rr);for(let e=0;e<n.length;e+=2){let r=n[e].indexOf("=");r>0&&t.push(n[e].slice(0,r))}return t}(t):[h]).some(e=>r(e,n.kind))||!0===n.value?.(h,f,g)){if(!0!==n.spaced)return y();let e=l(f,n.form),t=f.slice(e);return`${h}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(i>=1&&(ir.test(g)||sr.test(g)))return"page"===n.kind||a(g,n.kind)?y():t;let m=function(e,t,n){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?d(e,t,n+1):e.startsWith("/")?o(e,t,n+1):sr.test(e)?/[?#]/.test(e)?o(e,t,n+1):u(e,t,n+1):null}(g,n,i);return null!==m&&m!==g?n.whole?y():!0!==n.raw?`${h}=${encodeURIComponent(m)}`:f===g?`${h}=${m}`:encodeURIComponent(g)===f?`${h}=${encodeURIComponent(m)}`:y():e(g)!==g&&a(g,n.kind)?y():t}).map((e,t)=>(0===t?"":h[2*t-1])+e).join("")}function c(e,t){let n=e.split("/"),i=n.map(e=>e.split(";")[0]);return n.map((n,s)=>{if(!0===t.segment?.(n))return"[REDACTED]";let o=n.indexOf(";"),a=i[s],u=!0===t.head?.(e,a,s,i)?"[REDACTED]":a;return-1===o?u:u+n.slice(o).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?l(i,t.form):i.length;return s>0&&r(n,t.kind)?`;${n}=[REDACTED]${i.slice(s)}`:e})}).join("/")}function h(e,t,n,r=""){let i=e.indexOf("?");if(-1!==i){let s=e.slice(0,i);return`${c(s,t)}?${u(e.slice(i+1),t,n,`${r}/${s}`)}`}let s=e.indexOf("=");if(-1!==s&&!e.slice(0,s).includes("/"))return u(e,t,n,r);let o=-1===s?null:/^([^&;]*)([&;])/.exec(e);return null!==o?`${c(o[1],t)}${o[2]}${u(e.slice(o[0].length),t,n,`${r}/${o[1]}`)}`:c(e,t)}function d(e,t,n){if(t.whole||!0===t.raw||!or.test(e))return f(e,t,n);let r;try{r=new URL(e)}catch{return f(e,t,n)}let i=r.search.slice(1),s=r.hash.slice(1),o=c(r.pathname,t),l=r.search?u(i,t,n,r.pathname):"",a=r.hash?h(s,t,n,r.pathname):"";return o===r.pathname&&l===i&&a===s&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+o+(r.search?`?${l}`:"")+(r.hash?`#${a}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[i,s,l,a]=r,u=""===l?-1:a.lastIndexOf("@"),c=s+l+a.slice(u+1)+o(e.slice(i.length),t,n);return c===e?e:c}function p(e,t){let n,r=e.length-e.trimStart().length,i=e.length-e.trimEnd().length,s=e.slice(r,e.length-i);return/^(?:javascript|vbscript|data|blob):/i.test(s)?e:(n=/^[a-z][a-z0-9+.-]*:/i.test(s)?d(s,t,0):o(s,t,0),n===s?e:e.slice(0,r)+n+e.slice(e.length-i))}function g(e,t,n,r){let i=t,s=0,o=0;for(;i<e.length;i++){let t=e[i];if(ar.test(t)||r&&","===t&&(ur.lastIndex=i+1,ur.test(e)))break;if(n)if("("===t)s++;else if("["===t)o++;else if(")"===t||"]"===t){if(0===(")"===t?s:o))break;")"===t?s--:o--}}return function(e,t,n){let r=0,i=0;for(let s=t;s<n;s++){let t=e[s];"("===t?r++:")"===t?r--:"["===t?i++:"]"===t&&i--}for(;n>t;){let t=e[n-1];if(")"===t){if(r>=0)break;r++}else if("]"===t){if(i>=0)break;i++}else if(!".,;:!?".includes(t))break;n--}return n}(e,t,i)}function y(e){return{kind:"param",strict:e,whole:!0}}function b(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}function m(e,t){return`${b(0,e)}[Body not captured: ${hr[t]}]\n`}function v(e){return r(e,"key")}function w(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||46===e||95===e||37===e||43===e||45===e}function k(e){if(e.length<13||e.length>19)return!1;let t="4"===e[0]&&(13===e.length||16===e.length||19===e.length),n=/^(5[1-5]|2[2-7])/.test(e)&&16===e.length,r=/^3[47]/.test(e)&&15===e.length,i=/^6(?:011|5)/.test(e)&&16===e.length,s=/^(?:35|3[068])/.test(e)&&e.length>=14&&e.length<=19;return!!(t||n||r||i||s)&&function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;if(i<0||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}(e)}function S(e,t,n){for(let r of e.matchAll(t))""!==r[0]&&n.push([r.index,r.index+r[0].length])}function E(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);let n="",r=0,[i,s,o]=t[0];for(let l=1;l<=t.length;l++){let a=t[l];void 0!==a&&a[0]<s?(a[1]>s&&(s=a[1]),o=void 0):(n+=e.slice(r,i)+(o??dr),r=s,void 0!==a&&([i,s,o]=a))}return n+e.slice(r)}function x(e,t=[]){if(!e)return e;let n=[];return function(e,t,n){S(e,wr,n),S(e,br,n),function(e,t){let n=0,r=e.indexOf("@");for(;-1!==r;){let i=Math.max(n,r-64),s=r;for(;s>i&&w(e.charCodeAt(s-1));)s--;if(s<r){yr.lastIndex=r+1;let i=yr.exec(e);if(i){n=r+1+i[0].length,t.push([s,n]),r=e.indexOf("@",n);continue}}r=e.indexOf("@",r+1)}}(e,n),S(e,mr,n),S(e,vr,n),S(e,kr,n),function(e,t){for(let n of e.matchAll(/\b(?:\d[ -]?){12,18}\d\b/g))k(n[0].replace(/[^0-9]/g,""))&&t.push([n.index,n.index+n[0].length])}(e,n);for(let r of t)S(e,r,n)}(e,t,n),E(e,n)}function I(e){return e&&E(e,A(e))}function A(e){let t=[];return Sr.test(e)&&(S(e,wr,t),S(e,br,t)),t}function T(e,t=Er){let n=e.replace(_r,e=>Ar.test(Tr.exec(e)[0])?p(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];lr.lastIndex=0;for(let r=lr.exec(e);null!==r;r=lr.exec(e)){let i=r.index+(r.groups?.attr?.length??0);cr.lastIndex=i;let s=void 0!==r.groups?.attr&&cr.test(e);s&&(i=cr.lastIndex);let o=r.groups?.attr??"",l=g(e,i,!/["']$/.test(o)||/^url\(/i.test(o)||s,t);"{"===e[l]&&l>i&&"$"===e[l-1]&&l--,l>i&&n.push([i,l]),lr.lastIndex=Math.max(l,r.index+r[0].length,i+1)}return n}(e,!0===t.list)){let s=e.slice(r,i),o=p(s,t);o!==s&&n.push([r,i,o])}return n}(n,t);if(0===r.length)return _(n,t);let i="",s=0;for(let[e,t,o]of r)i+=n.slice(s,e)+o,s=t;return _(i+n.slice(s),t)}function _(e,t){return/:(?:\\\/|\\u002[fF])/.test(e)?e.replace(Cr,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=$r.exec(e.slice(t,t+6));n+=null===i?e[t]:"/",t+=null===i?1:i[0].length}r.push(e.length);let i=p(n,t);if(i===n)return e;let s=0;for(;s<i.length&&i[s]===n[s];)s++;let o=0;for(;o<i.length-s&&o<n.length-s&&i[i.length-1-o]===n[n.length-1-o];)o++;let l=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[s])+i.slice(s,i.length-o).replace(/\//g,l)+e.slice(r[n.length-o])}):e}function C(e){let t=T(e,xr),n=[];return function(e,t,n="text"){let i="code"===n?Or:"string"===n?Nr:"header"===n?zr:Dr,s="text"===n&&/<script/i.test(e)?function(e){let t=[],n=/<script\b/gi,r=/<\/script\s*>/gi;for(let i=n.exec(e);null!==i;i=n.exec(e)){let s=e.indexOf(">",i.index);if(-1===s)break;r.lastIndex=s+1;let o=r.exec(e),l=null===o?e.length:o.index;t.push([s+1,l]),n.lastIndex=l}return t}(e):[],o=0;i.lastIndex=0;for(let l=i.exec(e);null!==l;l=i.exec(e)){if(!r(l[2],"param"))continue;if(s.length>0&&(/^[ \t\r\f\v>]$/.test(l[1])||"#"===l[1]&&(!/[\w/%~-]/.test(e[l.index-1]??"")||e.startsWith("*/",l.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,l.index-9),l.index))))){for(;o<s.length&&s[o][1]<=l.index;)o++;if(o<s.length&&s[o][0]<=l.index)continue}let a=l.index+l[0].length;Lr.lastIndex=a;let u=Lr.exec(e);if(null===u)continue;"string"===n&&(Ur.lastIndex=a,u=Ur.exec(e)??u);let c=a+u[0].length;t.push([a,c]),i.lastIndex=c}}(t,n,"header"),E(t,n)}function $(e,t){return e.length>t?e.slice(0,t)+Rr:e}function R(e){return e+Rr}function D(e){return 47===e||38===e||59===e||63===e||35===e}function O(e,t){let n=e.length,r=0;for(;r<=n;){let i,s=r,o=0;for(;s<n&&61!==(o=e.charCodeAt(s))&&!D(o);)s++;i=s<n&&61===o?s>r?t(r,s):s+1:s;for(;i<n&&!D(e.charCodeAt(i));)i++;if(i>=n)return;r=i+1}}function N(e,t,n){let r=t;for(;r<e.length;r++){let t=e.charCodeAt(r);if(38===t||59===t||35===t||!n&&63===t)break}return r}function z(e){let t=[];return O(e,(n,r)=>{let i=N(e,r+1,!0);return t.push([e.slice(n,r),e.slice(r+1,i)]),i}),t}function L(e,n,r=!1){let s="",o=0;return O(e,(l,a)=>{let u=t(e.slice(l,a),"page"),c=a+1;if(!(i(u,"page")||r&&G(u,e.slice(c,c+256))))return c;let h=N(e,c,n);return s+=e.slice(o,c)+"[REDACTED]",o=h,h}),s+e.slice(o)}function U(e,t){let n=e.indexOf("?");return-1===n?L(e,!1):`${L(e.slice(0,n),!1)}?${L(e.slice(n+1),!0,t)}`}function j(e){return!(e.length<8)&&Number(/[a-z]/.test(e))+Number(/[A-Z]/.test(e))+Number(/\d/.test(e))>=2&&!/^[A-Z][a-z]+$/.test(e)&&!/^[A-Za-z][a-z]*(?:[-_](?:[A-Za-z][a-z]*|\d+))+$/.test(e)&&!/^[A-Za-z][a-z]{2,}(?:[A-Z][a-z]{2,})+$/.test(e)}function B(t,n=!0){return(n?/^(?:\/|[a-z][a-z\d+.-]*:\/\/)/i:/^[a-z][a-z\d+.-]*:\/\//i).test(e(t))}function P(t){return e(t).replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[\s\-_.]+/).filter(e=>""!==e).map(e=>e.toLowerCase())}function q(e,t){let n=P(e),r=n.join("");if(Mr.has(r))return 2;Fr.has(r)&&(n=[r]);let i=0;for(let e of n)if(qr.has(e))i=2;else if(Fr.has(e))i||=1;else if(!Wr.has(e))return 0;return 1===i&&(n.includes("accept")||n.includes("confirm")&&(Vr(n)||Vr(P(t))))?2:i}function M(e){return/^(?:\d+|[\da-f]{24}|[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})$/i.test(e)||/^(?:[0-7][\dA-HJKMNP-TV-Z]{25}|c[a-z\d]{24})$/.test(e)}function K(e){if(e.length%4==1||!/^[\w-]+$/.test(e))return!1;try{return/^[\x20-\x7e]+$/.test(atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)))}catch{return!1}}function Z(e){return e.length<=4||F(e)}function F(e){return P(e).every(e=>e.startsWith("confirm")||"accept"===e||"edit"===e)}function H(e,t){let n=e[t]??"";return Kr.has(P(e[t-1]??"").join(""))&&!F(n)&&!Zr.has(n.toLowerCase())&&!/\.[A-Za-z][A-Za-z\d]{0,4}$/.test(n)&&!(M(n)&&""!==(e[t+1]??""))}function W(e){return P(e).some(e=>e.startsWith("invit"))}function V(e,t){return/^(?:rp|resetpass)$/.test(t)||e.some(e=>e.some(e=>0!==q(e,"")))}function J(e){return e.find(([e])=>t(e,"page").includes("action"))?.[1]??""}function G(e,t){return e.some(e=>/^(?:key|t|hash|code)$/.test(e))&&!B(t,!1)}function Q(e){let t=P(e);return t.length>0&&t.every(e=>"accept"===e||"join"===e)}function Y(e,t=!1){if("string"!=typeof e||!/^\/[^?#]*$/.test(e))return null;let n=e.split("/").filter(e=>""!==e),r=e=>/^:\w+$/.test(e);return n.every(e=>"*"===e||r(e)||!/[:*]/.test(e))&&n.some(e=>t?"*"!==e&&!r(e):r(e))?n:null}function X(t,n){return"*"===t||":"===t[0]||e(n).toLowerCase()===e(t).toLowerCase()}function ee(e,t){let n=[];return e.every((e,r)=>{let i=t[r];return void 0!==i&&(":"===e[0]&&n.push([i,t[r-1]??"",r]),X(e,i))})?n:null}function te(e,t){return Qr.keep.some(n=>t<n.length&&"*"!==n[t]&&":"!==n[t][0]&&n.slice(0,t+1).every((t,n)=>X(t,e[n])))}function ne(e){let t=!1,n=new Set;for(let r of Qr.keep){let i=ee(r,e);if(null!==i){0===i.length&&(t||=r.length===e.length&&!r.includes("*"));for(let[e]of i)n.add(e)}}let r=[];for(let t of Qr.secret)for(let[n,i,s]of ee(t,e)??[])!te(e,s)&&re(n)&&r.push([n,i]);return{secret:r,kept:n,own:t}}function re(t){let n=t;for(let t=0;t<=ei;t++){let t=e(n);if(t===n)return/[\p{L}\p{N}]/u.test(n);n=t}return!1}function ie(e){let t=e.indexOf("#"),n=[e.slice(0,-1===t?e.length:t).replace(/^[a-z][a-z\d+.-]*:\/\/[^/?#]*/i,"")],r=-1===t?"":e.slice(t+1);return Pr.test(r)&&n.push(r.replace(/^!/,"")),n.map(e=>e.split(/[?#]/)[0].split("/").map(e=>e.split(";")[0]))}function se(t,n,r){let i=t.get(n);void 0===i&&t.set(n,i=new Set),i.add(function(t){return ce(e(t))}(r))}function oe(n,r,s,o,l,a){let u=ie(n);for(let t of u){let n=t.length,{secret:i,kept:u,own:c}=ne(t.filter(e=>""!==e));for(let[e,t]of i)s.add(e),se(o,e,t),0===r&&se(l,e,t);for(let r=0;r<n;r++){let i=q(t[r],t[r-1]??"");if(0===i)continue;let l=W(t[r]),h=t[r+1];H(t,r+1)&&!u.has(h)&&!c&&(s.add(h),j(e(h))||(o.has(h)||a.add(h),se(o,h,t[r])));let d="",f="",p=r+1;for(;p<n;p++){let e=t[p],n=t[p+1]??"";if(M(e)||(2===i||n.length>=16&&j(n))&&K(e)){f=e;continue}if(e.length>=(2===i?16:20)&&j(e)){d=e;break}if(l&&j(e)){f=e;continue}let r=q(e,t[p-1]);if(r>i)i=r,f="";else{if(""!==f&&Q(e)){d=f;break}if(!Z(e))break}}""===d&&2===i&&p===n&&(d=f),""!==d&&!u.has(d)&&!c&&s.add(d),r=""===d?p-1:p}}let c=z(n).map(([e,n])=>[t(e,"page"),n]),h=e=>c.find(([t])=>t.includes(e))?.[1]??"",d=V(u,h("action")),f=""!==h("organization"),p=h("code"),g=h("state"),y=!B(p)&&(p.length>=10&&j(g)&&!/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/.test(g)&&!B(g)||p.length>=20&&j(p)&&u.some(e=>e.some(e=>/callback|oauth/i.test(e)||[...P(e),P(e).join("")].some(e=>Jr.has(e)))));for(let[t,n]of c){let u=y&&(t.includes("code")||t.includes("state"));if((u||i(t,"page")||d&&G(t,n)||f&&t.includes("invitation")||t.includes("ticket")&&/^(?:ST|PT|TGT)-/.test(n))&&!B(n,u)){s.add(n);continue}let c=e(n);r<2&&(/[?#=]/.test(c)||B(c))&&oe(c,r+1,s,o,l,a)}}function le(e){try{return new URL(e).origin}catch{return""}}function ae(e){return ue(e)[0]}function ue(t){if(ti[0]===t)return[ti[1],ti[2],ti[3]];let n=new Set,r=new Map,i=new Map,s=new Set,o=t.indexOf("#"),l=-1===o?t:t.slice(0,o),a=-1===o?"":t.slice(o+1),u=Pr.test(a),c=l.length+(u?a.length:0)>65536;if(c)for(let e of ie(t))for(let[t,s]of ne(e.filter(e=>""!==e)).secret)n.add(t),se(r,t,s),se(i,t,s);else oe(t,0,n,r,i,s);let h=c,d=le(t),f=new Set,p=[],g=0,y=(e,t)=>null!==t&&!0===i.get(e)?.has(t)||(g<32?(g++,!0):(h=!0,!1));for(let t of[...i.keys(),...[...n].filter(e=>!i.has(e))]){let n=r.get(t),i=void 0===n?void 0:[...n].filter(e=>y(t,e));if(0===i?.length||void 0===i&&!y(t,null))break;if(void 0!==i){let n=e(t),r=n.length>=6&&!s.has(t),o=[];for(let e=t,n=0;n<ui;n++)o.push(e=encodeURIComponent(e));for(let e of new Set([t,n,...o,encodeURIComponent(n),n.replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)])){if(""===e)continue;let t=!d.includes(e),n=t&&j(e)&&!B(e,!1);if(r&&n&&p.push({kind:0,value:e}),r&&t)p.push({kind:1,value:e});else for(let t of i)p.push({kind:2,value:e,before:t})}continue}f.add(t);for(let e=t.lastIndexOf("/"),n=0;e>0&&n<4;e=t.lastIndexOf("/",e-1),n++)f.add(t.slice(0,e));f.add(encodeURIComponent(t));for(let e of[t,t.replace(/\+/g," ")])try{let t=decodeURIComponent(e);f.add(t),f.add(encodeURIComponent(t));for(let e=t.lastIndexOf("/"),n=0;e>0&&n<4;e=t.lastIndexOf("/",e-1),n++)f.add(t.slice(0,e))}catch{}}for(let e of f)j(e)&&!B(e,!1)&&!d.includes(e)&&p.push({kind:0,value:e});return p.sort((e,t)=>t.value.length-e.value.length),ti=[t,p,h,De(p)],[p,h,ti[3]]}function ce(e){if(!/[A-Z]/.test(e))return e;if(!/[^\0-\x7f]/.test(e))return e.toLowerCase();let t=new Uint16Array(Math.min(e.length,ni)),n="";for(let r=0;r<e.length;r+=ni){let i=Math.min(ni,e.length-r);for(let n=0;n<i;n++){let i=e.charCodeAt(r+n);t[n]=i>=65&&i<=90?i+32:i}n+=String.fromCharCode(...t.subarray(0,i))}return n}function he(e,t,n){if(!t.length)return;let r=new Int32Array(t.length);for(let e=1,n=0;e<t.length;e++){for(;n>0&&t.charCodeAt(e)!==t.charCodeAt(n);)n=r[n-1];t.charCodeAt(e)===t.charCodeAt(n)&&n++,r[e]=n}for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=r[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(n(i-s+1),s=r[s-1])}}function de(e,t){let n=[];return he(e,t,e=>n.push(e)),n}function fe(e){let t=ri;ri=1/0;try{return e()}finally{ri=t}}function pe(e){if(ii+e>ri)throw new bi(ii+e,ri)}function ge(e,t,n="[redacted]"){if(e.includes(t))return!0;if(!/[[\]]/.test(t))return!1;let r=t.split(n),i=r[0],s=i.lastIndexOf("[");s>=0&&n.startsWith(i.slice(s))&&(r[0]=i.slice(0,s));let o=r[r.length-1],l=o.indexOf("]");return l>=0&&n.endsWith(o.slice(0,l+1))&&(r[r.length-1]=o.slice(l+1)),r.every(t=>e.includes(t))}function ye(e,t){let n=e=>e.length>si&&/[[\]]/.test(e);if(e.plain.some(e=>n(e)&&ge(t,e,"[REDACTED]")))return!0;let r=ce(t);return[...e.bounded,...e.words.map(({value:e})=>e)].some(e=>n(e)&&ge(r,e))}function be(e,t,n,r,i=!1){let s=[],o=0,l=si-n.length;for(let a of de(t,n))a<o||!r(a,a+n.length)||(s.push(a),o=a+n.length,i&&pe(e.length+s.length*l));if(0===s.length)return[e,()=>t];let a,u=(e,t)=>{let r=[],i=0;for(let t of s)r.push(e.slice(i,t)),i=t+n.length;return r.push(e.slice(i)),r.join(t)};return[u(e,"[REDACTED]"),()=>a??=u(t,"[redacted]")]}function me(e,t,n){return(0===t||!oi.test(e[t-1])||li.test(e.slice(Math.max(0,t-16),t)))&&(n===e.length||!oi.test(e[n]))}function ve(e,t,n){return ai.find(([r,i])=>i<=n&&t>=r.length&&e.startsWith(r,t-r.length))}function we(e,t,n){if(";"===e[t])return!0;for(let r=1;r<=n;r++)if(e.startsWith(`%${"25".repeat(r-1)}3b`,t))return!0;return!1}function ke(t,n,r,i){if(r!==t.length&&/[a-z0-9_~-]/.test(t[r]))return!1;let s=ve(t,n,3);if(void 0===s)return!1;let[o,l]=s,a=function(e,t,n){let r=t;for(;;){let t=ve(e,r,n);if(void 0===t)return r;r-=t[0].length}}(t,n-o.length,l);return(a===n-o.length||!function(e,t){return 0===t||ci.test(e[t-1])||hi.test(e[t-1])||/(?::|%(?:25)*3a)$/.test(e.slice(Math.max(0,t-9),t))}(t,a))&&(!!i.befores.has("")||0!==i.longest&&function(t,n,r,i){let s=n;for(;s>0&&!ci.test(t[s-1])&&void 0===ve(t,s,r);)s--;let o=n,l="",a=!1;for(let u=n;u>=s;u--){if(u<n&&we(t,u,r)&&(o=u,l="",a=!1),a||u!==s&&!hi.test(t[u-1]))continue;let c=t.slice(u,o);for(let t=0;t<=r;t++)c=e(c);if(l=ce(c)+l,o=u,l.length>i.longest)a=!0;else if(i.lengths.has(l.length)&&i.befores.has(l))return!0}return!1}(t,a,l,i))}function Se(e,t){if(!Ee(e,t))return e;if(/^[ \t\n\r]*[{[]/.test(e)){let n=Ae(e,t);if(null!==n)return n}return Re(e,t)}function Ee(e,t){return!!xe(e,t)||e.includes("\\")&&xe(Ie(e),t)}function xe(e,t){if(t.plain.some(t=>e.includes(t)))return!0;if(0===t.bounded.length&&0===t.words.length)return!1;let n=ce(e);return t.bounded.some(e=>n.includes(e))||t.words.some(({value:e})=>n.includes(e))}function Ie(e){return e.replace(/\\+u([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\+\//g,"/")}function Ae(e,t){try{JSON.parse(e)}catch{return null}let n=function(e,t){let n=ce(e),r=e.includes("\\")?ce(Ie(e)):n,i=e=>n.includes(ce(e))||n.includes(ce(function(e){return JSON.stringify(e).slice(1,-1).replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(e)))||r.includes(ce(e));return{...t,plain:t.plain.filter(i),bounded:t.bounded.filter(i),words:t.words.filter(({value:e})=>i(e))}}(e,t),r=[],i=[];for(let t of e.matchAll(fi)){let n=t[0];"{"===n?(i.push(r.length),r.push(new Set)):"}"===n?i.pop():'"'===n[0]&&i.length>0&&(pi.lastIndex=t.index+n.length,pi.test(e)&&r[i[i.length-1]].add(JSON.parse(n)))}let s=ii,o="",l=0,a=0,u=[];for(let t of e.matchAll(fi)){let i=t[0];if("{"===i){u.push(new Set(r[a++]));continue}if("}"===i){u.pop();continue}let c=i;if('"'===i[0]){let r,a=JSON.parse(i);ii=s+o.length+(t.index-l);try{r=Se(a,n)}finally{ii=s}pi.lastIndex=t.index+i.length;let h=pi.test(e)?u[u.length-1]:void 0;if(void 0!==h&&r!==a){let e=r;for(let t=2;h.has(r);t++)r=`${e}#${t}`;h.add(r)}r!==a&&(c=JSON.stringify(r))}else fe(()=>Re(i,n))!==i&&(c='"[REDACTED]"');c!==i&&(o+=e.slice(l,t.index)+c,l=t.index+i.length,pe(o.length))}return o+e.slice(l)}function Te(e){let t="",n=[],r=0;for(let i of e.matchAll(/\\+u([0-9a-fA-F]{4})|\\+\//g))t+=e.slice(r,i.index),n.push(t.length,i.index+i[0].length),t+=void 0===i[1]?"/":String.fromCharCode(parseInt(i[1],16)),r=i.index+i[0].length;return[t+e.slice(r),n]}function _e(e,t){let n=0,r=e.length/2;for(;n<r;){let i=n+r>>1;e[2*i]<t?n=i+1:r=i}if(0===n)return t;let i=2*(n-1);return e[i+1]+(t-e[i]-1)}function Ce(e,t,n=!1){let r=[],i=[],s=(e,t,s)=>{let o=new Int32Array(e.length),l=0,a=t>si,u=-1,c=-1;for(let r of e)!n&&s(r)?o[l++]=r:a&&(r<c||(u>=0&&i.push(u,c),u=r),c=r+t);u>=0&&i.push(u,c),l>0&&r.push([o.subarray(0,l),t])};for(let n of t.plain)s(de(e,n),n.length,()=>!0);let o=ce(e);for(let n of t.bounded)s(de(o,n),n.length,t=>me(e,t,t+n.length));for(let e of t.words)s(de(o,e.value),e.value.length,t=>ke(o,t,t+e.value.length,e));return{lists:r,slack:$e(i)}}function $e(e){if(0===e.length)return 0;let t=Array.from({length:e.length/2},(e,t)=>t).sort((t,n)=>e[2*t]-e[2*n]),n=0,r=e[2*t[0]],i=e[2*t[0]+1],s=()=>{i-r>si&&(n+=i-r-si)};for(let n of t){let t=e[2*n],o=e[2*n+1];t<i?o>i&&(i=o):(s(),r=t,i=o)}return s(),n}function Re(e,t){e=function(e,t){let n=ri!==1/0&&ii+si*e.length>ri,[r,i]=e.includes("\\")?Te(e):[e,[]],s=Ce(r,t),{lists:o}=s;if(0===o.length)return e;let l=n&&!ye(t,e),a=s.slack+(l&&i.length>0?Ce(e,t,!0).slack:0),u=new Int32Array(o.length),c=e=>o[e][0][u[e]],h=[],d=(e,t)=>{let n=h[e];h[e]=h[t],h[t]=n},f=e=>{for(;;){let t=2*e+1,n=e;if(t<h.length&&c(h[t])<c(h[n])&&(n=t),t+1<h.length&&c(h[t+1])<c(h[n])&&(n=t+1),n===e)return;d(e,n),e=n}};for(let e=0;e<o.length;e++)h.push(e);for(let e=(h.length>>1)-1;e>=0;e--)f(e);let p=[],g=0,y=!1,b=0;for(;h.length>0;){let t=h[0],n=c(t),r=_e(i,n),s=_e(i,n+o[t][1]);if(u[t]=u[t]+1,u[t]>=o[t][0].length&&(h[0]=h[h.length-1],h.pop()),h.length>0&&f(0),!(s<=g)){if(y&&r<=g){g=s;continue}b+=r-g+si,l&&pe(b-a),p.push(e.slice(g,r),"[REDACTED]"),g=s,y=!0}}return l&&pe(b+e.length-g-a),p.push(e.slice(g)),p.join("")}(e,t);for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n=ce(e),r=()=>n,i=[...t.bounded,...t.words.map(({value:e})=>e)],s=new Array(i.length);for(let e=i.length-1,t=!0;e>=0;e--){let r=i[e];t=t&&(r.length<=si||!ge(n,r)),s[e]=t}let o=0;for(let n of t.bounded){if(r().includes(n)){let t=e;[e,r]=be(e,r(),n,(e,n)=>me(t,e,n),s[o])}o++}for(let n of t.words){if(r().includes(n.value)){let t=r();[e,r]=be(e,t,n.value,(e,r)=>ke(t,e,r,n),s[o])}o++}return e}function De(e){if(0===e.length)return null;let t=(e,t)=>t.length-e.length,n=[],r=[],i=new Map;for(let t of e){let e=ce(t.value);if(0===t.kind)n.push(t.value);else if(1===t.kind)r.push(e);else{let n=i.get(e);void 0===n&&i.set(e,n=new Set),n.add(t.before.length>di?"":t.before)}}n.sort(t),r.sort(t);let s=[...i].map(([e,t])=>{let n=new Set([...t].filter(e=>""!==e).map(e=>e.length));return{value:e,befores:t,lengths:n,longest:0===n.size?0:Math.max(...n)}}).sort((e,t)=>t.value.length-e.value.length);return{json:n.map(e=>JSON.stringify(e).slice(1,-1)),jsonLower:[...r,...s.flatMap(({value:e})=>ai.map(([t])=>t+e))].map(e=>JSON.stringify(e).slice(1,-1)),plain:n,bounded:r,words:s}}function Oe(e,t){let n=0;return he(e,t,()=>n++),n}function Ne(e,t,n){if(ri===1/0||ii+e.length<=ri||"body"===t||"text"===t&&/^[ \t\n\r]*[{[]/.test(e)||"css"===t&&e.includes("\\"))return;if(!e.includes("\\")&&function(e,t){let n=e=>e.length>si;if(e.plain.some(e=>n(e)&&ge(t,e,"[REDACTED]"))||e.plain.some(e=>t.includes(e)))return!1;let r=[...e.bounded,...e.words.map(({value:e})=>e)],i=r.filter(n),s=r.filter(e=>/[^a-z0-9]/.test(e));if(0===i.length&&0===s.length)return!0;let o=ce(t);return!i.some(e=>ge(o,e))&&!s.some(e=>o.includes(e))}(n,e)){pe(e.length);return}let r=function(e,t){if(ye(t,e))return null;let n=e.includes("\\"),r=n?Te(e)[0]:e,i=n?[r,e]:[r],s=r.length;for(let e of i){let n=ce(e);for(let n of t.plain)s-=Oe(e,n)*n.length;for(let e of t.bounded)s-=Oe(n,e)*e.length;for(let{value:e}of t.words)s-=Oe(n,e)*e.length}return s}(e,n);null!==r&&pe(r)}function ze(e,t,n="custom",r,i){function s(e,t){ri=i??1/0,ii=e;try{return t()}finally{ri=1/0,ii=0}}if("dom"===n&&r?.observe(e),null===t)return e;let o;try{o=JSON.stringify(e)}catch{return e}let l=o;if(void 0===l||!function(e,t){if(t.json.some(t=>e.includes(t)))return!0;let n=ce(e);if(t.jsonLower.some(e=>n.includes(e)))return!0;if(!e.includes("\\"))return!1;let r=Ie(e);if(t.plain.some(e=>r.includes(e)))return!0;let i=ce(r);return t.bounded.some(e=>i.includes(e))||t.words.some(({value:e})=>i.includes(e))}(l,t))return e;let a=JSON.parse(l);if("string"==typeof a)return s(0,()=>(Ne(a,"text",t),Se(a,t)));let u="dom"===n&&void 0!==r?r.recordsIn(a):new Set,c="dom"===n&&Le(a)&&3===a.type&&Le(a.data)&&13===a.data.source,h=(e,t,r,i,s)=>"network"===n?!s||"method"!==t&&"type"!==t?!s||"requestBody"!==t&&"responseBody"!==t?"text":"body":"keep":"dom"!==n?"text":"tagName"===t||c&&"property"===t||i&&gi.has(t)?"keep":r||i&&"style"===t||"_cssText"===t||"rule"===t||("replace"===t||"replaceSync"===t)&&8===e.source||c&&"value"===t||("textContent"===t||"value"===t)&&u.has(e)?"css":"text",d=new Map,f=![...t.plain,...t.bounded,...t.words.map(e=>e.value)].some(e=>e.includes("#")),p=0,g=e=>{if(p+=e.length,void 0!==i&&p>i)throw new bi(p,i);return e},y=(e,n)=>{if("keep"===n)return e;if("text"===n&&f){let t=e.indexOf("#");if(t>0&&!/^[ \t\n\r]*[{[]/.test(e))return y(e.slice(0,t),n)+y(e.slice(t),n)}Ne(e,n,t);let r=function(e,t){let n=`${e}\0${t}`;if(n.length<=16383)return n;let r=2166136261;for(let e=0;e<t.length;e++)r^=t.charCodeAt(e),r=Math.imul(r,16777619);return`${e}\x01${t.length}\0${r>>>0}`}(n,e),i=d.get(r),s=i?.find(([t])=>t===e);if(void 0!==s)return s[1];let o="css"===n?function(e,t){if(!Ee(e,t))return e;for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n="",r=0;return function(e,t){let n=e.length,r={},i=(t,i)=>{let s=r[i]??=new Int32Array(n+2).fill(-2),o=[],l=t,a=-1;for(;!(l>=n);){if(-2!==s[l]){a=s[l];break}o.push(l);let t=e[l];if(t===i){a=l+1;break}l+="\\"===t?2:1}for(let e of o)s[e]=a;return a},s=-1,o=t=>{for(s<t&&(s=t);s<n&&!")\"'".includes(e[s]);)s++;return s},l=t=>{let r=t;for(;r<n&&/\s/.test(e[r]);)r++;return r},a=0;for(;a<n;){let r=e[a];if("/"===r&&"*"===e[a+1]){let r=e.indexOf("*/",a+2),i=r<0?n:r+2;t(a,i),a=i;continue}if(("u"===r||"U"===r)&&"url("===e.slice(a,a+4).toLowerCase()){let n=l(a+4),r=e[n],s=-1;if('"'===r||"'"===r){let t=i(n+1,r);if(t>=0){let n=l(t);")"===e[n]&&(s=n+1)}}else{let t=o(a+4);")"===e[t]&&(s=t+1)}if(s>=0){t(a,s),a=s;continue}}if('"'===r||"'"===r){let e=i(a+1,r);if(e>=0){t(a,e),a=e;continue}}a++}}(e,(i,s)=>{let o=e.slice(i,s);n+=e.slice(r,i)+(o.startsWith("/*")?function(e,t){let n=e.length>=4&&e.endsWith("*/");return`/*${Re(e.slice(2,n?-2:void 0),t)}${n?"*/":""}`}(o,t):Re(o,t)),pe(n.length),r=s}),n+e.slice(r)}(e,t):"body"===n?function(e,t){return Ee(e,t)?Ae(e,t)??Re(e,t):e}(e,t):Se(e,t);return void 0!==i?i.push([e,o]):d.set(r,[[e,o]]),o},b=[[a,!1,!1,"custom"===n,!0]];for(;b.length>0;){let[e,r,i,o,l]=b.pop();if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i?e[t]=g(s(p,()=>y(i,r?"css":"text"))):null!==i&&"object"==typeof i&&b.push([i,r,!1,"custom"===n,!1])}else if(Le(e))for(let a of Object.keys(e)){let u=e[a];if("dom"===n&&o&&!a.startsWith("rr_")&&"_cssText"!==a&&t.plain.some(e=>a.includes(e))){delete e[a];continue}let c=h(e,a,r,i,l);if("string"==typeof u)e[a]=g(s(p,()=>y(u,c)));else if(null!==u&&"object"==typeof u){let e="dom"===n&&"attributes"===a;b.push([u,"css"===c,e,"custom"===n||e||"dom"===n&&i&&"style"===a||"network"===n&&l&&("requestHeaders"===a||"responseHeaders"===a),!1])}if(!o||a.startsWith("rr_")||"_cssText"===a)continue;let d=a;for(let e of t.plain)d.includes(e)&&(d=d.split(e).join("[REDACTED]"));if(d===a)continue;let f=e[a];delete e[a];let m=d;for(let t=2;Object.prototype.hasOwnProperty.call(e,m);t++)m=`${d}#${t}`;e[m]=f}}return a}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Ue(e){if(e)for(let[t,n]of Object.entries(e))if("content-type"===t.toLowerCase())return n}function je(e){return t(e,"page").join("")}function Be(e){return!!ki.test(e)||!(e.length<32||wi.test(e)||Si.test(e))&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[0-9]/.test(e)&&/[A-Za-z]/.test(e)}function Pe(e){return e.split("/").some(e=>{if(/callback|oauth/i.test(e))return!0;let t=P(e);return[...t,t.join("")].some(e=>Jr.has(e))})}function qe(e,t){let n=new Map;for(let t of e){let e=t.indexOf("=");if(-1===e)continue;let r=je(s(t.slice(0,e)));if(!xi.has(r))continue;let i=n.get(r),o=s(t.slice(e+1));void 0===i?n.set(r,[o]):i.push(o)}let r=e=>n.get(e)??[],i=new Set,o=r("code").filter(e=>""!==e&&!B(e)),l=r("state").filter(e=>""!==e&&!function(e){return!!fr.test(e)&&(e.length<=16||pr.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!B(e));return o.length>0&&(t||l.length>0)&&(i.add("code"),i.add("state"),i.add("sessionstate")),(r("accesstoken").length>0||r("idtoken").length>0||r("refreshtoken").length>0)&&(i.add("state"),i.add("sessionstate")),i}function Me(e,t,n){let r=Ti;Ti=e;try{return We(t,n)}finally{Ti=r}}function Ke(t,n,r,i,s=!1){if(!("content"===t?Bn?.(t,r,s,i):Oi.test(t)||Bn?.(t,r,s)||Ci.has(t)&&Ni.test(e(n))))return/[^*\s]/.test(n)?"":n}function Ze(e){return Li.test(e)||Ai&&_i.test(e)}function Fe(e){return(n,r,i)=>{let o=function(e){let t=Ui.get(e.pairs);return void 0===t&&(t=[qe([...e.pairs],Pe(e.path))],Ui.set(e.pairs,t)),t}(i);if(o[0].has(je(s(n)))||G(t(n,"page"),r)&&(o[1]??=function(e,t){let n=t.map(e=>{let t=e.indexOf("=");return-1===t?[e,""]:[e.slice(0,t),e.slice(t+1)]});return V([e.split("/").map(e=>e.split(";")[0])],J(n))}(i.path,[...i.pairs])))return"[REDACTED]";let l=e?0:function(e){let t=0,n=null;for(let r of Ii)if(!(r.length<=t||"/"!==e.charAt(r.length))){if(e.startsWith(r)){t=r.length;continue}null===n&&(n=ce(e)),n.startsWith(r)&&(t=r.length)}return t}(r);if(l>0){let e=s(r.slice(l));if(!Ei.test(e)||x(e)===e)return`[REDACTED]${r.slice(l)}`}return null}}function He(n){let r,i=null;return{kind:"page",strict:n,whole:!1,before:Fe(n),value:(n,r,i)=>{let s=t(n,"key");return!(!/[[\]]/.test(e(n))&&/ids?$/.test(s[0]??""))&&(function(e){return!!Be(e)||!/^(?:https?:|\/)[^\s"<>\\^`{|}[\]]*$/i.test(e)&&function(e){return e.split(/[^A-Za-z0-9_\-.~+/=]+/)}(e).some(Be)}(i)||Be(r))||Ei.test(i)&&x(i)!==i},bare:e=>Be(e)||Be(s(e)),segment:e=>ki.test(e),head:(t,n,s,o)=>{if(!Ai)return!1;o!==r&&(r=o,i=_i.test(t)?function(e){let t=new Set,n=e.startsWith("/")?e:`/${e}`;for(let e of ae(`https://link.invalid${n}`))t.add(e.value);return t}(t):null);return null!==i&&i.has(n)&&(function(t){let n=e(t);return!!wi.test(n)||n.split(/[-_.~]+/).some(j)}(n)||Ti&&H(o,s))}}}function We(e,t){return Ze(e)?p(e,t?Bi:ji):e}function Ve(e,t){return Pi.lastIndex=t,Pi.test(e)?Pi.lastIndex:t}function Je(e){return e.replace(/\\(?:([0-9A-Fa-f]{1,6})[ \t\n]?|([\s\S]))/g,(e,t,n)=>{if(void 0===t)return"\n"===n?"":n??"";let r=parseInt(t,16);return 0===r||r>1114111||r>=55296&&r<=57343?"\ufffd":String.fromCodePoint(r)})}function Ge(e,t){if(!/url\(|["'\\]/i.test(e)||!Ze(e)&&!e.includes("\\"))return e;let n=e.length,r=/[\t\n\f\r ]/,i="",s=0,o=(n,r,o)=>{let l=e.slice(n,r),a=l.includes("\\")?Je(l):l,u=We(a,t);u!==a&&(i+=e.slice(s,n)+(a===l?u:function(e,t){return e.replace(t?/[\\"'\n]/g:/[\\"'()\s]/g,e=>/\s/.test(e)?`\\${e.charCodeAt(0).toString(16)} `:`\\${e}`)}(u,o)),s=r)},l=0;for(;l<n;){let t=e[l];if("/"===t&&"*"===e[l+1]){let t=e.indexOf("*/",l+2);l=-1===t?n:t+2}else if(e.startsWith("\x3c!--",l))l+=4;else if('"'===t||"'"===t){let r=l+1;for(;r<n&&e[r]!==t&&"\n"!==e[r];)r+="\\"===e[r]?2:1;r=Math.min(r,n),o(l+1,r,!0),l=r+1}else{let t=Ve(e,l);if(t===l){l++;continue}if("("!==e[t]||"url"!==Je(e.slice(l,t)).toLowerCase()){l=t;continue}let i=t+1;for(;i<n&&r.test(e[i]);)i++;if('"'===e[i]||"'"===e[i]){l=i;continue}let s=i;for(;s<n&&")"!==e[s];)s+="\\"===e[s]?2:1;s=Math.min(s,n);let a=s;for(;a>i&&r.test(e[a-1]);)a--;o(i,a,!1),l=s+1}}return 0===s?e:i+e.slice(s)}function Qe(e,t){let n=e.replace(/&/g,"&amp;");return'"'===t?n.replace(/"/g,"&quot;"):"'"===t?n.replace(/'/g,"&#39;"):n.replace(/[\s"'`>]/g,e=>`&#${e.charCodeAt(0)};`)}function Ye(e,t,n=[],r="",i=!1,s=!1){let o=[Ii,Ai];Ii=n,Ai=!0;try{Xe(e,t,r,i,s)}finally{[Ii,Ai]=o}}function Xe(e,t,n="",r=!1,i=!1){for(let i of Object.keys(e)){let s=e[i],o=i.toLowerCase();if(t&&("checked"===o||"selected"===o)){delete e[i];continue}if("string"!=typeof s){"style"===o&&Le(s)&&et(s,t);continue}let l=(t?Ke(o,s,n,e,r):void 0)??tt(o,rt(o,s,t,n),n);l!==s&&(e[i]=l)}(i||t&&("html"===n||"a"===n))&&(e["data-keploy-mask"]="")}function et(e,t){let n=e=>tt("style",Ge(e,t),"");for(let[t,r]of Object.entries(e))"string"==typeof r?e[t]=n(r):Array.isArray(r)&&"string"==typeof r[0]&&(e[t]=[n(r[0]),...r.slice(1)])}function tt(e,t,n){return e.startsWith("rr_")?t:function(e,t){return"value"===e?""!==t&&!Di.has(t):$i.has(e)||e.startsWith("data-")&&!Ci.has(e)&&"data-srcset"!==e}(e,n)&&Ei.test(t)?x(t):I(t)}function nt(e){return I(e)}function rt(e,t,n,r){let i=t;return"srcset"===e||"data-srcset"===e||"imagesrcset"===e?i=function(e,t){if(!Ze(e))return e;let n=e.split(",").map(e=>{let n=/^(\s*)(\S+)([\s\S]*)$/.exec(e);return null===n?e:n[1]+We(n[2],t)+n[3]}).join(",");return n===e?e:n}(t,n):"style"===e||"_csstext"===e?i=Ge(t,n):"ping"===e?i=t.replace(/\S+/g,e=>We(e,n)):"srcdoc"===e?i=function(e,t){if(!t&&!Ze(e)&&!/url\(/i.test(e))return e;let n=e.length,r=/[\t\n\f\r ]/,i=[],s=new Set,o=(n,r,s,o,l="")=>{let a=function(e){return e.includes("&")?e.replace(/&(?:#(\d+);?|#[xX]([0-9A-Fa-f]+);?|([A-Za-z][A-Za-z0-9]*);|(amp|AMP|lt|LT|gt|GT|quot|QUOT)(?![A-Za-z0-9=]))/g,(e,t,n,r,i)=>{if(void 0!==t||void 0!==n){let e=void 0!==t?Number(t):parseInt(n,16);return 0===e||e>1114111||e>=55296&&e<=57343?"\ufffd":String.fromCodePoint(e)}return qi[r??i??""]??e}):e}(e.slice(r,s)),u=(t?Ke(n,a,l):void 0)??rt(n,a,t,"");u!==a&&i.push([r,s,Qe(u,o)])},l=(t,i,l="")=>{let a=t;for(;;){for(;a<n&&(r.test(e[a])||"/"===e[a]);)a++;if(a>=n||">"===e[a])return a;let t=a;for(a++;a<n&&!r.test(e[a])&&!"/>=".includes(e[a]);)a++;let u=e.slice(t,a).toLowerCase(),c=a;for(;c<n&&r.test(e[c]);)c++;if("="!==e[c]){a=c;continue}for(c++;c<n&&r.test(e[c]);)c++;let h='"'===e[c]||"'"===e[c]?e[c]:"",d=""===h?c:c+1,f=d;if(""!==h)f=e.indexOf(h,d),-1===f&&(f=n),a=Math.min(f+1,n);else{for(;f<n&&!r.test(e[f])&&">"!==e[f];)f++;a=f}i&&(s.add(`${d}:${f}`),o(u,d,f,h,l))}},a=(n,r)=>{let s=e.slice(n,r);t&&/\S/.test(s)&&i.push([n,r,s.replace(/\S/g,"*")])},u=0,c=e.indexOf("<");for(;-1!==c&&c<n;){let s,o=!0;if(e.startsWith("\x3c!--",c))if(e.startsWith(">",c+4))s=c+5;else if(e.startsWith("->",c+4))s=c+6;else{let t=/--!?>/g;t.lastIndex=c+4;let r=t.exec(e);s=null===r?n:r.index+r[0].length,a(c+4,null===r?n:r.index)}else if("!"===e[c+1]||"?"===e[c+1]){let t=e.indexOf(">",c+2);s=-1===t?n:t+1,/^<!doctype/i.test(e.slice(c,c+9))||a(c+2,-1===t?n:t)}else if("/"===e[c+1]&&/[A-Za-z]/.test(e[c+2]??"")){let t=c+2;for(;t<n&&!r.test(e[t])&&!"/>".includes(e[t]);)t++;s=l(t,!1)+1}else if(/[A-Za-z]/.test(e[c+1]??"")){let o=c+1;for(;o<n&&!r.test(e[o])&&!"/>".includes(e[o]);)o++;let u=e.slice(c+1,o).toLowerCase(),h=l(o,!0,u);if(s=h+1,Mi.has(u)&&h<n){let r=new RegExp(`</${u}[\\t\\n\\f\\r />]`,"gi");r.lastIndex=h+1;let o=r.exec(e),l=null===o?n:o.index;if("style"===u){let n=e.slice(h+1,l),r=Ge(n,t);r!==n&&i.push([h+1,l,r])}else a(h+1,l);s=l}}else s=c+1,o=!1;o&&(a(u,c),u=s),c=e.indexOf("<",s)}a(u,n),i.sort((e,t)=>e[0]-t[0]);let h=i.length,d=new RegExp(Ki.source,"gi"),f=0,p=0;for(let t=d.exec(e);null!==t;t=d.exec(e)){let e=t[3]??t[4]??t[5]??"",n=t.index+t[0].length-(void 0===t[5]?1:0),r=n-e.length;for(d.lastIndex=r;f<h&&i[f][1]<=r;)f++;if(s.has(`${r}:${n}`)||f<h&&i[f][0]<n||r<p)continue;let l=void 0!==t[3]?'"':void 0!==t[4]?"'":"",a=i.length;o(t[2].toLowerCase(),r,n,l),i.length>a&&(p=n)}if(0===i.length)return e;i.sort((e,t)=>e[0]-t[0]);let g="",y=0;for(let[t,n,r]of i)g+=e.slice(y,t)+r,y=n;return g+e.slice(y)}(t,n):"content"===e?i=function(e,t){if(!Ze(e))return e;let n=zi.exec(e);if(null!==n&&""!==n[3]){let r=Me(!0,n[3],t);return r===n[3]?e:n[1]+n[2]+r+n[4]}return/^\s*https?:\/\//i.test(e)?We(e,t):e}(t,n):Ci.has(e)?i=Me(function(e,t){return"href"===e||"xlink:href"===e?""===t||"a"===t||"area"===t:"action"===e||"formaction"===e}(e,r),t,n):Zi.test(t)&&(i=Me(!1,t,n)),i}function it(e,t,n=[]){let r=[Ii,Ai];Ii=n,Ai=!0;try{return Ge(e,t)}finally{[Ii,Ai]=r}}function st(e){let t=e.map(e=>e.textContent).join(""),n=A(t).sort((e,t)=>e[0]-t[0]),r=0,i=0;for(let s of e){let e=i+s.textContent.length,o="",l=i;for(;r<n.length&&n[r][0]<e;){let[i,s]=n[r];if(i>=l&&(o+=`${t.slice(l,i)}[REDACTED]`),l=Math.max(l,Math.min(s,e)),s>e)break;r++}s.textContent=o+t.slice(l,e),i=e}}function ot(e){let t=e;return 3===t?.type&&"string"==typeof t.textContent}function lt(e){let t=[];for(let n of e)ot(n)?t.push(n):5!==n?.type&&(t.length>1&&st(t),t=[]);t.length>1&&st(t)}function at(e,t,n=[],r){let i=[Ii,Ai];Ii=n,Ai=!0;try{!function(e,t,n){let r=[e],i=new Set;for(;r.length>0;){let e=r.pop();if(null===e||"object"!=typeof e||i.has(e))continue;if(i.add(e),"string"==typeof e.textContent){let n=!0===e.isStyle?Ge(e.textContent,t):t&&5===e.type?"":nt(e.textContent);n!==e.textContent&&(e.textContent=n)}let s=e.attributes;if(Le(s)&&Xe(s,t,"string"==typeof e.tagName?e.tagName.toLowerCase():"",!0===e.isSVG,n?.(e.id)),Array.isArray(e.childNodes)){lt(e.childNodes);for(let t of e.childNodes)r.push(t)}}}(e,t,r)}finally{[Ii,Ai]=i}}function ut(e,t,n){switch(e){case"location":case"content-location":return n(t);case"link":return t.replace(/<([^>]*)>/g,(e,t)=>`<${n(t)}>`);case"refresh":{let e=/^\s*(?:\d[\d.]*\s*[;,]\s*)?url\s*=\s*/i.exec(t);if(null===e)return C(t);let r=t.slice(e[0].length),i=/^(["'])(.*)\1$/.exec(r);return i?`${e[0]}${i[1]}${n(i[2])}${i[1]}`:`${e[0]}${n(r)}`}}return C(t)}function ct(e){if(e.startsWith("access-control-"))return!1;if(v(e))return!0;let t=e.split(/[-_\s]+/).filter(e=>""!==e);t.length>1&&/^v?\d+$/.test(t[t.length-1])&&t.pop();let n=t[t.length-1]??"",r=t[t.length-2]??"";return v(n)||""!==r&&v(r+n)}function ht(){return{maskSelectors:[],unmaskSelectors:[],blockSelectors:[],maskNetworkBodies:!1,sensitiveHeaders:[...vi],piiPatterns:[],secretRoutes:[],keepRoutes:[]}}function dt(e,t){let n={...e};for(let[e,r]of Object.entries(t))void 0!==r&&(n[e]=r);if(t.sensitiveHeaders){let r=new Set;n.sensitiveHeaders=[...vi,...e.sensitiveHeaders,...t.sensitiveHeaders].filter(e=>{let t=e.toLowerCase();return!r.has(t)&&(r.add(t),!0)})}return n}function ft(e){return e.map(({pattern:e})=>new RegExp(e.source,e.flags+(e.flags.includes("g")?"":"g")))}function pt(e){return"string"==typeof e&&e.length>0&&e.length<=200&&Gi.test(e)}function gt(e){let t={};for(let n of Object.keys(e)){let[r,i,s]=e[n],o="https://keploy.io/docs/ui-capture/errors#"+n.toLowerCase().replace(/_/g,"-");t[n]={summary:r,remedy:{command:null,manual:o,docs:o},evidence:i,optionalEvidence:s??[]}}return t}function yt(e){return e.replace(/\s+/g," ").trim()}function bt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: dropped an event: ${yt(t)} The capture continues; any further such events in this capture are dropped silently. evidence=${vt(r)}`}function mt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: ${yt(t)} evidence=${vt(r)}`}function vt(e){try{return JSON.stringify(e)}catch{let t={};for(let[n,r]of Object.entries(e))t[n]="string"==typeof r||"number"==typeof r?r:Et(r);return JSON.stringify(t)}}function wt(e){return 401===e||403===e?"KUI_E_INGEST_KEY_REJECTED":404===e||405===e?"KUI_E_INGEST_ENDPOINT_NOT_FOUND":409===e?"KUI_E_SESSION_CONFLICT":e>=400&&e<500&&429!==e?"KUI_E_INGEST_REJECTED":null}function kt(e){if(null===e)return ns;let t=e.trim();if(""===t)return ns;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e){let t=e;if("string"==typeof t.error){let e=t.error.trim();return{message:""===e?null:e.slice(0,rs),issues:St(t.issues)}}}}catch{}return{message:t.slice(0,rs),issues:null}}function St(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(t.length===is)break;if(null===n||"object"!=typeof n)continue;let{path:e,message:r}=n;"string"!=typeof e||"string"!=typeof r||t.push({path:e.slice(0,rs),message:r.slice(0,rs)})}return t.length>0?t:null}function Et(e){if("string"==typeof e)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if("function"==typeof e)return`[function ${e.name}]`;if("object"!=typeof e||null===e)return String(e);try{return JSON.stringify(e)}catch{let t=e.constructor;return`[${"string"==typeof t?.name?t.name:"object"} not JSON-serialisable]`}}function xt(e){if("threw"in e)return`threw ${Et(e.threw)}`;let t=e.returned;if("object"==typeof t&&null!==t){if("function"==typeof t.then)return"a Promise (sessionIdGenerator must return a string synchronously)";let e=t.constructor,n="string"==typeof e?.name?e.name:"";if(""!==n&&"Object"!==n)return`object ${n} ${Et(t)}`}return`${typeof t} ${Et(t)}`}function It(e=!0){if(!fs)return;for(let t of Es)t(e);fs=gs=ws=!1,Pn=qn=Mn=void 0;let t=ks;ks=[],_t(),setTimeout(()=>{for(let e of t)$t(e)||e()},0)}function At(){for(let e of xs)e();xs.clear()}function Tt(e){let t=fs&&!gs;return t&&ys.push(e),t}function _t(){let e=ys;ys=[];for(let t of e)t()}function Ct(){!fs||gs||(gs=!0,ks.length&&At(),_t())}function $t(e){return fs&&(ks.push(e),gs&&At()),fs}function Rt(e){return new Promise((t,n)=>{let r=()=>{new Promise(t=>t(e())).then(t,e=>{$t(r)||n(e)})};$t(r)||r()})}function Dt(e,t,n,r){let i=bs;setTimeout(()=>{if(!r){Pn===e&&t()&&It(n);return}if(ws||i!==bs||!fs)return;let s=r.defaultPrevented||vs.has(r);if(r===Mn&&Pn===r&&(s||t()))return It(n);r!==Mn&&s||(ws=!0,Ct())},0)}function Ot(e){let t=e.type,n=e;if("currententrychange"===t){qn&&(n.from!==As()?.currentEntry||n.navigationType)&&vs.add(qn);return}if("pageshow"===t){e.isTrusted&&e.persisted&&It();return}fs||(qn=void 0);let r=fs;"navigate"===t&&(qn=e),!n.destination?.sameDocument&&null==n.downloadRequest&&(r||bs++,fs=!0,Pn=e,"navigate"!==t?setTimeout(()=>{Pn===e&&(ws=!0,Ct())},0):(Dt(e,()=>As()?.transition,r&&gs,Mn=n),n.signal?.addEventListener("abort",()=>Dt(Pn,()=>qn===e,!1))))}function Nt(e,t=e){if(t&&It(),Ss===e||"function"!=typeof addEventListener)return;Ss=e;let n={capture:!0,passive:!0},r=(t,r)=>{for(let i of r)e?t?.addEventListener(i,Ot,n):t?.removeEventListener(i,Ot,n)};r(globalThis,Ts),r(As(),["navigate","currententrychange"])}function zt(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}function Lt(e){return"default"in e?e.default:e}function Ut(e,t){let n=e=>{let t=Lt(e),n=t.version;if(n!==_s)throw new Error(`a chunk of version ${String(n)}, not the SDK's ${_s}`);return t};return Rt(e).then(n).catch(e=>t?Rt(t).then(n).catch(t=>Promise.reject(new Error(`${String(e)}; beside the SDK: ${String(t)}`,{cause:e}))):Promise.reject(e))}function jt(e){(typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout)(e,{timeout:1e3,valueOf:()=>0})}function Bt(e,t){if(!Zs.includes(e)){Zs+=e;try{console.warn(function(e,t){return mt({code:"KUI_E_BODY_WORKER_UNAVAILABLE",part:e,reason:t},"body worker/chunk missing (evidence.part): >64 KiB cut or redacted bodies dropped (unproven); allow worker-src 'self' and serve dist/.")}(e,typeof Event<"u"&&t instanceof Event?t.message||"the worker's script did not load or run (refused by the page's CSP, a 404, or a script that does not parse)":Et(t)))}catch{}}}function Pt(e){if(typeof navigator>"u"||!1!==navigator.onLine||zt()||"function"!=typeof addEventListener)return!1;if(!Wn){Wn=[];let e=()=>{if(!1===navigator.onLine)return;Vn?.();let e=Wn??[];Wn=void 0;for(let t of e)t()};addEventListener("online",e);let t=setInterval(e,1e3);Vn=()=>{removeEventListener("online",e),clearInterval(t),Vn=void 0}}return Wn.push(e),!0}function qt(){return Zn??=new Promise(e=>{let t=()=>{Rs=!1,Cs().then(e=>{if("function"!=typeof e.redactBodies)throw new TypeError("the body chunk has no redactBodies export");return e}).then(t=>{Kn=t,Hi.redact=t.redactBodies,e()},t=>{Ds=!0,Bt("code",t),e()})};(Rs=Pt(t))||t()})}function Mt(){if(Os||void 0!==Fn)return;Os=!0;let e=()=>{$s().then(e=>Rt(()=>{if(!(Ns.size>0||Ms(Bs)))return void(Os=!1);let t=e.startBodyWorker();t.onmessage=({data:e})=>{Hn=t;let n=Ps.get(e.id);n&&(Ps.delete(e.id),Us-=n.owes,n.owner.answered(n,e.out))},t.onerror=e=>Ht(t,e),Fn=t,Os=!1;let n=Bs;Bs=new Set;for(let e of n)Ft(e)})).catch(e=>Ht(null,e))};Pt(e)||e()}function Kt(){qt(),Mt()}function Zt(e,t=!1){Ns.add(e),(!Zn||void 0===Fn)&&((t?Fs:Hs)||(t?Fs=!0:Hs=!0,(t?jt:setTimeout)(()=>{t?Fs=!1:Hs=!1,Ns.size&&Kt()})))}function Ft(e){if(!e.owner.has(e))return;let t=Fn?Fn===Hn:null===Fn&&Kn;if(t||!Ks(e)||!Tt(()=>Ft(e))){if(!t&&(e=>gs&&Ks(e))(e)){e.owner.answered(e,Gt(e.job)),e.job=null;return}if(Fn){Ps.set(++qs,e);try{Fn.postMessage({id:qs,job:e.job}),Us+=e.owes}catch{Ps.delete(qs),e.owner.alone(e)}}else null===Fn?e.owner.alone(e):(Bs.add(e),Kt())}}function Ht(e,t){if(e&&Fn!==e)return;Wt(e);let n=[...Ps.values(),...Bs].filter(e=>e.owner.has(e));if(Ps.clear(),Us=0,Fn=void 0,Bs=new Set(n),!Ns.size&&!n.length)return void(Os=!1);Os=!0;let r=()=>{Os=!1,Mt()};if(!Pt(r)&&!$t(r)){Os=!1,Fn=null,Bs.clear(),Bt("worker",t);for(let e of n)e.owner.alone(e)}}function Wt(e){if(e)try{e.terminate()}catch{}}function Vt(){if(Jn=void 0,!Fn||Ms(Ps.values()))return;let e=Fn;Hn===e||ps()?Wt(e):setTimeout(e.onmessage=e.onerror=()=>Wt(e),3e4),Us=0,Fn=void 0,Ps.clear()}function Jt(e=!0,t=()=>!1){e&&Wn&&(Vn?.(),Wn=void 0,Rs&&(Zn=void 0),void 0===Fn&&(Os=!1),Bs.clear()),t()&&void 0!==Hn&&Fn===Hn&&ps()?(Jn=t,addEventListener("pagehide",Ws)):Vt()}function Gt(e,t){let n=e=>e&&(t?b(0,e.length):m(e.length,Ds?"code-failed":"left"));return{requestBody:n(e.requestBody),responseBody:e.responseBody==Gs?Gs:n(e.responseBody)}}function Qt(e,t,n=t){try{return Kn.redactBodies(e,t,n)}catch{return null}}function Yt(e){return(e?.requestBody?.length??0)+(e?.responseBody?.length??0)}function Xt(e){try{let t=typeof document<"u"?document.baseURI:void 0;return new URL(e,t).href}catch{return e}}function en(e){let t={};if(!e)return t;if(e instanceof Headers)e.forEach((e,n)=>t[n]=e);else if(Array.isArray(e))for(let[n,r]of e)t[n]=r;else Object.assign(t,e);return t}function tn(e){let t=e=>encodeURIComponent(e).replace(/%20/g,"+"),n=[];return e.forEach((e,r)=>{n.push("string"==typeof e?`${t(r)}=${t(e)}`:`${t(r)}=${t(`[File: ${e.name}, ${e.size} bytes]`)}`)}),n.join("&")}function nn(e,t){return"string"==typeof e?$(e,t):e instanceof URLSearchParams?$(e.toString(),t):e instanceof ArrayBuffer||ArrayBuffer.isView(e)?function(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength<=t)try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{}return`[Binary: ${n.byteLength} bytes]`}(e,t):void 0}function rn(e,t){if(null==e)return null;try{if("string"==typeof e)return""===e?null:Wi;if(e instanceof URLSearchParams||e instanceof FormData)return e.keys().next().done?null:Wi;if(e instanceof Blob)return t||e.size>0?Wi:null;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength>0?Wi:null;if(t&&typeof Document<"u"&&e instanceof Document)return e.hasChildNodes()?Wi:null}catch{}return Wi}function sn(e){return"object"==typeof e&&null!==e&&"Request"===e[Symbol.toStringTag]}function on(e,t,n,r){for(let i=0;i<n.length&&t.length<=r;){let s=i+Math.max(1,r+1-t.length);t+=e.decode(n.subarray(i,s),{stream:!0}),i=s}return t}function ln(e){let t=typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"?location.href:void 0;return new URL(e,t).href}function an(e){try{e()}catch(e){setTimeout(()=>{throw e})}}function un(e){return(new TextEncoder).encode(e).length}function cn(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function hn(){return mo||(mo=Rt(()=>import("rrweb")).then(e=>(vo=!0,{record:Lt(e).record}),e=>(mo=null,{failed:Et(e)}))),mo}function dn(e){return e?Promise.all([hn(),wo??=Ut(()=>import("@keploy/capture-sdk/strict-attributes"),void 0).then(e=>{if("function"!=typeof e.kept)throw new TypeError("strict-attributes has no kept()");return function(e){Bn=e}(e.kept),ko=!0,null}).catch(e=>(wo=null,Et(e)))]).then(([e,t])=>null===t||"failed"in e?e:{failed:t,strict:!0}):hn()}function fn(){let e=document.documentElement,t=document.body;return{width:window.innerWidth||e?.clientWidth||t?.clientWidth||0,height:window.innerHeight||e?.clientHeight||t?.clientHeight||0}}function pn(e){return e.split("#").map(e=>e.split("?")[0]).join("#")}function gn(e){return 2===e.kind?`2${e.before}/${e.value}`:`${e.kind}${e.value}`}function yn(e,t,n,r){let i=0,s=!1;for(let t of e.keys())i+=t.length;for(let o of e.keys()){if(r(o)||e.size<=t&&i<=n)break;e.delete(o),i-=o.length,s=!0}return s}function bn(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=gn(e[n]);To.delete(r)||(t=!0),To.set(r,e[n])}let n=new Set(e.map(gn));return yn(To,Io,Ao,e=>n.has(e))||t}function mn(e){let t=Xr;if(e!==_o||t!==Co){let n=!1;if(""===_o||t!==Co){let e=globalThis.performance?.getEntriesByType?.("navigation");e?.[0]&&(n=bn(ae(e[0].name)));for(let e of Oo)bn(ae(e))&&(n=!0)}_o=e,Co=t,function(e){Oo.delete(e),Oo.add(e),yn(Oo,Ro,Do,t=>t===e)}(e),(bn(ae(e))||n)&&($o=De([...To.values()]))}return $o}function vn(e){let t=e,n=t.destination?.url;Uo="string"==typeof n&&"boolean"==typeof t.userInitiated?{href:n,userInitiated:t.userInitiated}:null;let r=t.destination?.key;if("replace"!==t.navigationType){if("traverse"===t.navigationType&&"string"==typeof r){let e=jo[0]===r&&!1===t.userInitiated;e||r===Po?qo.set(r,(qo.get(r)??0)+1):qo.delete(r),jo=e?jo.slice(1):[],Po=null}else{let n=[];if("push"===t.navigationType)try{let t=e.currentTarget;n=t.entries().slice(0,t.currentEntry.index).map(e=>e.key)}catch{}jo=jo.filter(e=>n.includes(e)),Bo=null,(!0!==t.userInitiated||!n.includes(Po))&&(Po=null),qo.clear()}Mo=!1}}function wn(e,t,n){if("object"==typeof t||"function"==typeof t)return null;let r=e;try{let e=0|Number(t),i=r?.entries()??[],s=null===n?Number(r?.currentEntry?.index):i.findIndex(e=>e.key===n);return s<0?null:i[s+e]?.key??null}catch{return null}}function kn(e,t){return function(...n){if(Mo)return Reflect.apply(e,this,n);let[r,i]=t(n);Po=i,null!==i&&null!==r&&(Bo=r,r!==wn(zo?.navigation??null,0,null)&&jo.push(r)),Mo=!0;try{return Reflect.apply(e,this,n)}catch(e){throw jo=[],Po=null,e}finally{Mo=!1}}}function Sn(e){let t=e,n=t.navigationType,r=function(){let e=Uo;return Uo=null,null!==e&&e.href===location.href?e.userInitiated:void 0}(),i=function(e){let t=e?.currentEntry?.key;if("string"!=typeof t)return;for(;jo[0]===t;)jo.shift();let n=qo.get(t)??0;return n>1?qo.set(t,n-1):qo.delete(t),n?"script":void 0}(zo?.navigation??null);if("traverse"===n)xn("traverse",r,i);else if("push"===n||"replace"===n){let e="string"==typeof t.from?.url?t.from.url:"";xn(Lo??(function(e,t){return e!==t&&e.split("#")[0]===t.split("#")[0]}(e,location.href)?"hash":n),r)}}function En(){let e=Reflect.get(window,"event")?.type;return"popstate"===e||"hashchange"===e?"traverse":"push"}function xn(e,t,n){mn(location.href);for(let r of No)try{r(e,t,n)}catch{}}function In([e,t,,n]){let r=Ko(e,t);return void 0!==r&&r.value===n.value&&r.configurable===n.configurable&&(!0===r.configurable||!0===r.writable)}function An([e,t,n]){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function Tn(e){if(typeof window>"u"||!window.history)return()=>{};No.add(e),function(){if(zo)return;let e=window.history,t=e.pushState,n=e.replaceState,r=Reflect.get(window,"navigation")??null;r?.addEventListener("currententrychange",Sn,{capture:!0}),r?.addEventListener("navigate",vn,{capture:!0});let i=e=>t=>{let n=e(t);return[wn(r,n,jo.length?Bo:null),wn(r,n,null)]},s=e=>t=>{let n=e(t);return[n,n]},o=[[e,"back",i(()=>-1)],[e,"forward",i(()=>1)],[e,"go",i(e=>e[0])],[r,"back",s(()=>wn(r,-1,null))],[r,"forward",s(()=>wn(r,1,null))],[r,"traverseTo",s(e=>"string"==typeof e[0]?wn(r,0,e[0]):null)]],l=[[e,"pushState",function(...e){let n=location.href,r=Lo;Lo="push";try{t.apply(this,e)}finally{Lo=r}xn(location.href===n?En():"push")}],[e,"replaceState",function(...e){let t=location.href,r=Lo;Lo="replace";try{n.apply(this,e)}finally{Lo=r}xn(location.href===t?En():"replace")}]];for(let[e,t,n]of o){let r=e&&Reflect.get(e,t);"function"==typeof r&&l.push([e,t,kn(r,n)])}let a=l.find(([e,t])=>!function(e,t){let n=Ko(e,t);return void 0===n?Object.isExtensible(e):!0===n.configurable||!0===n.writable}(e,t));zo={navigation:r,methods:a?[]:l.map(([e,t,n])=>function(e,t,n){let r=Ko(e,t);return Object.defineProperty(e,t,!1===r?.configurable?{value:n}:{value:n,writable:!0,enumerable:r?.enumerable??!0,configurable:!0}),[e,t,r,Ko(e,t)]}(e,t,n)),refused:a?`${a[0]===e?"history":"navigation"}.${a[1]}`:null}}();let t=()=>{mn(location.href),e("traverse")};return window.addEventListener("popstate",t,{capture:!0}),window.addEventListener("hashchange",t,{capture:!0}),()=>{No.delete(e),window.removeEventListener("popstate",t,{capture:!0}),window.removeEventListener("hashchange",t,{capture:!0}),function(){if(zo&&!(No.size>0)&&zo.methods.every(In)){for(let e of zo.methods)An(e);zo.navigation?.removeEventListener("currententrychange",Sn,{capture:!0}),zo.navigation?.removeEventListener("navigate",vn,{capture:!0}),Uo=null,jo=[],Po=null,qo.clear(),zo=null}}()}}function _n(e){return e.some(e=>"dom"===e.type&&2===e.data?.type)}function Cn(e){try{return!!e.trim()&&!!document.documentElement.closest(`${e},*`)}catch{return!1}}function $n(){let e=typeof crypto<"u"?crypto:void 0;if("function"!=typeof e?.getRandomValues)return null;let t="";for(let n of e.getRandomValues(new Uint8Array(16)))t+=n.toString(16).padStart(2,"0");return t}function Rn(){let e=typeof window<"u"?window.location?.origin:"";return"string"==typeof e&&""!==e&&"null"!==e?e:null}function Dn(e){e[0]=Math.max(e[0],performance.now());for(let[t,n,r,i]of e.splice(2)){try{r?.(new t(n.signal??n))}catch{}i()}}Object.create;var On,Nn=Object.defineProperty,zn=Object.getOwnPropertyDescriptor,Ln=Object.getOwnPropertyNames,Un=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),jn={};((e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})})(jn,{CaptureDeclined:()=>hs,CaptureError:()=>ss,CaptureIdentityBuilder:()=>Ho,DomRecorderRefusal:()=>us,IngestRejection:()=>os,KeployCapture:()=>Xo,KeployCaptureRecorder:()=>Fo,NetworkInterceptor:()=>ho,PrivacyConflict:()=>ds,PrivacyEngine:()=>Vi,PrivacyRouteRefusal:()=>cs,SDK_ERRORS:()=>es,SDK_WARNINGS:()=>ts,SESSION_ID_MAX_LENGTH:()=>Ji,SESSION_ID_PATTERN:()=>Gi,SESSION_ID_RULE:()=>Qi,SessionIdRefusal:()=>ls,StrictAttributesRefusal:()=>as,Transport:()=>bo,codeForStatus:()=>wt,currentOrigin:()=>Rn,defaultPrivacyConfig:()=>ht,describeValue:()=>Et,isValidSessionId:()=>pt,mintSessionNonce:()=>$n,parseServerError:()=>kt});module.exports=(On=jn,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of Ln(t))!Un.call(e,n)&&void 0!==n&&Nn(e,n,{get:()=>t[n],enumerable:!(r=zn(t,n))||r.enumerable});return e})(Nn({},"__esModule",{value:!0}),On));var Bn,Pn,qn,Mn,Kn,Zn,Fn,Hn,Wn,Vn,Jn,Gn=/%[0-7][\da-f]|%(?:c[2-9a-f]|d[\da-f])%[89ab][\da-f]|%e0%[ab][\da-f]%[89ab][\da-f]|%e[1-9a-ce-f](?:%[89ab][\da-f]){2}|%ed%[89][\da-f]%[89ab][\da-f]|%f0%[9ab][\da-f](?:%[89ab][\da-f]){2}|%f[1-3](?:%[89ab][\da-f]){3}|%f4%8[\da-f](?:%[89ab][\da-f]){2}/gi,Qn=new Set(["password","passwd","pwd","secret","token","accesstoken","refreshtoken","idtoken","authorization","auth","apikey","clientsecret","privatekey","session","sessionid","cookie","ssn","socialsecuritynumber","creditcard","cardnumber","cvv","cvc","pin","passphrase","pass1","pass2","currentpass","rpkey","codeverifier","rawkey","apikeyauth","setcookie","proxyauthorization","samlresponse","confirmkey","tokenhash","clerkticket","nonce","hmac","loginhash","magiclink","phpsessid","oauthverifier","sig","sid","sessid","csrf","xsrf","bearer","authentication","credentials","pass","tokenid","authkey","secretkey","accesskey","clientkey","signingkey","sessionkey","subscriptionkey","functionskey","factorcode","jwtassertion","samlassertion","clientassertion","secretaccesskey","accesskeysecret"]),Yn=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),Xn=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),er=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,tr=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),nr=new Set(["auth","session","cookie","pin","sig"]),rr=/(&|;(?=[^;&=#]+=|end$))/,ir=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,sr=/[&;?#][^&;=?#]+=/,or=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,lr=/[a-z][a-z0-9+.-]{0,31}:[/\\]{2}|(?<attr>\bcontent\s*=\s*(?:["']\s*)?\d[\d.]*\s*[;,]\s*url\s*=\s*["']?|\b(?:href|src|action|formaction|poster|cite|data|background|longdesc|content|data-src|data-href|xlink:href)\s*=\s*["']?|(?<![\w:.-])[\w:.-]{1,40}\s*=\s*["'](?=\.{0,2}\/|[?#]|[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):)|\burl\(\s*["']?)(?=[^\s"'<>])/gi,ar=/[\s"'<>\\^`{|}]/,ur=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,cr=/url\(\s*["']?/iy,hr={left:"the page left or the capture stopped before redaction was ready","code-failed":"the redaction code could not load",early:"the page took the body's stream before the redaction code had loaded"},dr="[REDACTED]",fr=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,pr=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,gr=new Set(["code","devicecode"]),yr=(new Set([...gr,"state"]),/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y),br=/(?<![A-Za-z0-9])(?:kep_[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[abprse]-[A-Za-z0-9-]{10,}|[sr]k_(?:live|test)_[A-Za-z0-9]{16,}|sk-(?:proj|ant)-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36,}|whsec_[A-Za-z0-9+/=]{24,}|(?:AKIA|ASIA)[0-9A-Z]{16,}|AIza[0-9A-Za-z_-]{35,})/g,mr=/\b\d{3}-\d{2}-\d{4}\b/g,vr=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,wr=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,kr=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,Sr=/eyJ|kep_|gh[pousr]_|github_pat_|glpat-|xox[abprse]-|[sr]k_(?:live|test)_|sk-(?:proj|ant)-|npm_|whsec_|AKIA|ASIA|AIza/,Er=(JSON.stringify(dr),{kind:"param",strict:!1,whole:!1,raw:!0}),xr={...Er,spaced:!0,tail:e=>T(e,Ir)},Ir={...Er,spaced:!0,list:!0},Ar=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[a-z][a-z0-9+.-]*:\/|[a-z][a-z0-9-]*[+.][a-z0-9+.-]*:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)[^\s?#]*[?#]|(?:[\w.~%-][\w.~%/-]*)?[?#][^\s=&#]+=|\.{0,2}\/[^\s?#;=]*;)/i,Tr=/^\S*/,_r=/^[^\r\n]*/gm,Cr=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,$r=/^(?:\\\/|\\u002[fF])/,Rr="...[truncated]",Dr=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Or=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Nr=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,zr=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Lr=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,Ur=/[^&]+/y,jr=y(!1),Br=y(!0),Pr=/^!?\//,qr=new Set(["reset","resets","verify","unlock","activate","invite","forgot","forgotten","recover","recovery"]),Mr=new Set(["passwordreset","passwordresets","resetpassword","verifyemail","emailverification","magiclink","magiclogin","emaillogin","loginlink","lostpassword","setpassword","createpassword"]),Kr=new Set(["setpassword","createpassword","resetpassword","passwordreset","forgotpassword","forgottenpassword","lostpassword","verifyemail","emailverification"]),Zr=new Set(["sent","done","success","complete","new","error","expired","failed","invalid"]),Fr=new Set(["confirm","confirmation","confirmations","invites","invitation","invitations","verification","verifications","activation","activations","password","passwords","signup","login"]),Hr=new Set(["email","account","registration","registrations","signup"]),Wr=new Set(["accept","link","new","old","sign","up","email","account","registration","admin","change","php","asp","aspx","htm","html","jsp","cgi"]),Vr=e=>e.some(e=>Hr.has(e))||e.join("").includes("signup"),Jr=new Set(["cb","auth","sso","signin","authorize","authorized","redirect"]),Gr="a route is `/`-separated segments from the path's start, each a literal, `*` (any one segment) or `:name` (the value it names), with no `?` or `#`; a secret route names at least one `:name`, a keep route has at least one literal",Qr={secret:[],keep:[]},Yr=new Set,Xr=0,ei=16,ti=["",[],!1,null],ni=8192,ri=1/0,ii=0,si=10,oi=/[A-Za-z0-9]/,li=/(?:%(?:25)*[\da-f]{2}|(?:\\|%(?:25)*5c)(?:[nrtbf]|u[\da-f]{4}))$/i,ai=[["%25252f",3],["%252f",2],["%2f",1],["\\/",0],["/",0]],ui=Math.max(...ai.map(([,e])=>e)),ci=/[/\\?#\s"<>`{}|^[\]]/,hi=/[!$&'()*+,;=:@]/,di=64,fi=/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}]/g,pi=/[ \t\n\r]*:/y,gi=new Set(["type","rel","method","enctype","autocomplete","inputmode","enterkeyhint","dir","role","crossorigin","referrerpolicy","loading","decoding","fetchpriority","contenteditable","draggable","spellcheck","translate"]),yi=class{o=new Map;F=new Map;D;constructor(e){this.D=e}aX(e){return void 0===this.D||!this.D.present(e)}get size(){let e=0;for(let t of this.o.values())e+=t.size;return this.o.size+this.F.size+e}bg(e,t){this.av(e),this.F.set(e,t),this.o.get(t)?.add(e),this.D?.note(e)}av(e){let t=this.F.get(e);void 0!==t&&this.o.get(t)?.delete(e),this.F.delete(e)&&this.D?.forget(e)}bj(e){let t=this.o.get(e);if(void 0!==t)for(let e of t)this.F.delete(e)&&this.D?.forget(e);this.o.delete(e)&&this.D?.forget(e),this.av(e)}observe(e){if(!Le(e)||!Le(e.data))return;let t=e.data;if(2===e.type){for(let e of[...this.o.keys(),...this.F.keys()])this.D?.forget(e);this.o.clear(),this.F.clear(),this.bQ(t.node,null);return}if(3!==e.type||0!==t.source)return;let n=Array.isArray(t.removes)?t.removes:[];for(let e of n)Le(e)&&"number"==typeof e.id&&this.aX(e.id)&&this.bj(e.id);let r=Array.isArray(t.adds)?t.adds.filter(Le):[];for(let e of r)this.bQ(e.node,null);for(let e of r){let t=e.node;Le(t)&&3===t.type&&"number"==typeof t.id&&("number"==typeof e.parentId&&this.o.has(e.parentId)?this.bg(t.id,e.parentId):this.av(t.id))}n.length>0&&void 0!==this.D&&this.b$()}b$(){for(let e of this.o.keys())this.aX(e)&&this.bj(e);for(let e of this.F.keys())this.aX(e)&&this.av(e)}bQ(e,t){let n=[[e,t]],r=new Set;for(;n.length>0;){let[e,t]=n.pop();if(r.has(e)||(r.add(e),!Le(e)||"number"!=typeof e.id))continue;let i=e.id,s=2===e.type&&"string"==typeof e.tagName&&"style"===e.tagName.toLowerCase();if(s&&!this.o.has(i)&&(this.o.set(i,new Set),this.D?.note(i)),3===e.type&&null!==t&&this.bg(i,t),Array.isArray(e.childNodes))for(let t of e.childNodes)n.push([t,s?i:null])}}recordsIn(e){let t=new Set;if(!Le(e)||!Le(e.data))return t;let n=e.data,r=[];if(2===e.type)r.push(n.node);else if(3===e.type&&0===n.source){if(Array.isArray(n.adds))for(let e of n.adds)Le(e)&&r.push(e.node);if(Array.isArray(n.texts))for(let e of n.texts)Le(e)&&"number"==typeof e.id&&this.F.has(e.id)&&t.add(e)}for(;r.length>0;){let e=r.pop();Le(e)&&(3===e.type&&"number"==typeof e.id&&this.F.has(e.id)&&t.add(e),Array.isArray(e.childNodes)&&r.push(...e.childNodes))}return t}},bi=class extends Error{constructor(e,t){super(`the scrubbed event passed ${t} units (at least ${e})`);this.atLeast=e;this.cap=t;this.name="ScrubOverCap"}},mi=[/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g],vi=["authorization","cookie","set-cookie","x-api-key","x-auth-token","proxy-authorization"],wi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ki=/^eyJ[\w-]+\.[\w-]+\.[\w-]*$/,Si=/(?:^|-)[A-Za-z]{3,}-(?:[A-Za-z0-9]+-)*[A-Za-z]{3,}(?:-|$)/,Ei=/@|\d[\d .()-]{5,}\d|\d\.\d|eyJ/,xi=new Set(["code","state","accesstoken","idtoken","refreshtoken"]),Ii=[],Ai=!1,Ti=!1,_i=/reset|verif|confirm|activat|invit|magic|log-?in|passw|unlock|forgot|recover|sign-?up/i,Ci=new Set(["href","xlink:href","src","action","formaction","srcset","poster","cite","data","data-src","data-href","background","longdesc"]),$i=new Set(["title","alt","placeholder","label","content","summary","abbr","aria-label","aria-description","aria-valuetext","aria-placeholder","aria-roledescription","aria-braillelabel","aria-brailleroledescription"]),Ri=e=>new Set(e.split(" ")),Di=Ri("input textarea select"),Oi=/^(?:style|_csstext|srcset|data-srcset|imagesrcset|ping|srcdoc)$/,Ni=/^[^\s"'`<>{}]*$/,zi=/^(\s*[\d.]*\s*[;,]\s*(?:url\s*=\s*)?)(['"]?)(.*?)(\2\s*)$/is,Li=/[?#;@]|eyJ/,Ui=new WeakMap,ji=He(!1),Bi=He(!0),Pi=/(?:[A-Za-z0-9_-]|[\u0080-\uffff]|\\(?:[0-9A-Fa-f]{1,6}[ \t\n]?|[^\n0-9A-Fa-f]))+/y,qi={AMP:"&",...Object.fromEntries('Tab\t NewLine\n excl! quot" QUOT" num# dollar$ percnt% amp& apos\' lpar( rpar) ast* midast* plus+ comma, period. sol/ colon: semi; lt< LT< equals= gt> GT> quest? commat@ lsqb[ lbrack[ bsol\\ rsqb] rbrack] Hat^ lowbar_ UnderBar_ grave` DiacriticalGrave` lcub{ lbrace{ verbar| vert| VerticalLine| rcub} rbrace} nbsp\xa0 NonBreakingSpace\xa0'.split(" ").map(e=>[e.slice(0,-1),e.slice(-1)]))},Mi=Ri("script style textarea title xmp iframe noembed noframes"),Ki=new RegExp(`(^|[\\s/"'])(${[...Ci].join("|")}|imagesrcset|data-srcset|ping|content|style|srcdoc)\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"gi"),Zi=/^(?:(?:[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)[^\s?#;]*[?#;]|[?#])\S*$/i,Fi=new Set(["accept","accept-encoding","accept-ranges","age","cache-control","connection","content-encoding","content-language","content-length","content-type","date","etag","expires","keep-alive","last-modified","pragma","transfer-encoding","vary"]),Hi={},Wi="[MASKED]",Vi=class{O;aU;aB;constructor(e={},t="balanced"){this.aB="strict"===t,this.O=this.bB(dt(ht(),e)),this.aU=ft(this.O.piiPatterns)}bB(e){return this.aB?{...e,maskNetworkBodies:!0}:e}maskText(e){if(!e)return e;let t=x(e,this.aU);for(let e of mi)t=t.replace(e,"[REDACTED]");return t}maskUrl(e){if(!e)return e;let t=e.indexOf("#");return function(e,t=!1){return p(e,t?Br:jr)}(-1===t?e:e.slice(0,t),this.aB)}maskNetworkData(e,t){let n={...e};n.requestHeaders=this.bu(e.requestHeaders),n.responseHeaders=this.bu(e.responseHeaders);let r=this.bodyJob(e),i=e=>e?Wi:null,s=r&&(t??Hi.redact?.(r));return n.requestBody=s?s.requestBody:i(e.requestBody),n.responseBody=s?s.responseBody:i(e.responseBody),n.url=this.maskUrl(e.url),n}bodyJob(e){return this.O.maskNetworkBodies?null:{requestBody:e.requestBody,responseBody:e.responseBody,requestType:Ue(e.requestHeaders),responseType:Ue(e.responseHeaders),patterns:this.aU}}getConfig(){return this.O}updateConfig(e){this.O=this.bB(dt(this.O,e)),this.aU=ft(this.O.piiPatterns)}bu(e){let t={},n=new Set(this.O.sensitiveHeaders.map(e=>e.toLowerCase()));for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();n.has(e)||ct(e)||this.aB&&!Fi.has(e)?t[r]="[REDACTED]":t[r]=this.maskText(ut(e,i,e=>this.maskUrl(e)))}return t}},Ji=200,Gi=/^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/,Qi="must be 1-200 characters of letters, digits, dot, dash and underscore, with no empty dot-separated segment",Yi=["status","serverMessage","endpoint","sessionId"],Xi=["issues"],es=gt({KUI_E_INGEST_KEY_REJECTED:["The ingest server refused the SDK's API key (401 or 403). Capture has stopped.",Yi,Xi],KUI_E_INGEST_ENDPOINT_NOT_FOUND:["The ingest server answered 404 or 405: nothing at `endpoint` accepts a POST. Capture has stopped.",Yi,Xi],KUI_E_SESSION_CONFLICT:["The ingest server answered 409: this session id is already claimed, or a batchId was re-used. Capture has stopped.",Yi,Xi],KUI_E_INGEST_REJECTED:["The ingest server refused a batch with a terminal 4xx (400, 413 or 415). Capture has stopped.",Yi,Xi],KUI_E_SESSION_ID_INVALID:["The configured `sessionIdGenerator` did not produce a session id the ingest server would accept. Capture did not start.",["sessionId","received","rule"]],KUI_E_DOM_RECORDER_UNAVAILABLE:["The capture SDK could not load rrweb, the library it records the page with. The capture ended before anything was sent.",["reason"]],KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE:["Under strict, the capture SDK could not load its attribute allow-list. The capture ended before anything was recorded or sent.",["reason"]],KUI_E_PRIVACY_ROUTE_INVALID:["A route in `privacy.secretRoutes` or `privacy.keepRoutes` is not one the SDK can match. Capture did not start.",["option","received","rule"]],KUI_E_CAPTURE_DECLINED:["The browser sent Do Not Track or Global Privacy Control, and `honorPrivacySignals` is on. Capture did not start; nothing was recorded or sent.",["signal"]],KUI_E_PRIVACY_CONFLICT:['`privacyMode: "strict"` records no body, and `privacy.maskNetworkBodies` is `false`, which asks for them. Capture did not start.',["privacyMode","option"]]}),ts=gt({KUI_E_EVENT_UNSERIALISABLE:["The SDK dropped one captured event because it could not be serialised to JSON. The capture continues without it.",["eventId","eventType","reason"]],KUI_E_EVENT_OVERSIZED:["The SDK dropped one captured event that alone is over the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.",["eventId","eventType","bytes","cap"]],KUI_E_EVENT_OVERSIZED_SCRUBBING:["The SDK dropped one captured event whose scrub of the page URL's credentials passed the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.",["eventType","atLeast","cap"]],KUI_E_NAVIGATION_UNWRAPPED:["The page made a History or Navigation API method the SDK wraps (`evidence.method`) impossible to replace and put back, so the SDK wrapped none of them. The capture continues.",["method"]],KUI_E_REQUEST_TERM_FAILED:["The SDK recorded a request without its canonical-key.v2 term (computing it threw: `evidence.reason`), or body:* (its term code did not load). The page's request was unaffected.",["method","reason"]],KUI_E_BODY_WORKER_UNAVAILABLE:["No body worker or chunk (`evidence.part`): no worker, a body over 64 KiB is recorded cut; no chunk, one the main thread redacts keeps nothing; tests over them are unproven.",["part","reason"]]}),ns={message:null,issues:null},rs=500,is=100,ss=class extends Error{code;status;serverMessage;issues;remedy;evidence;constructor(e,t,n,r,i){super(t),this.name="CaptureError",this.code=e,this.remedy=es[e].remedy,this.status=n,this.serverMessage=r.message,this.issues=r.issues,this.evidence=i}},os=class extends ss{constructor(e){let{message:t,issues:n}=e.server,r=`[keploy] capture stopped (${e.status}, ${e.code}); capture has stopped. ${null===t?"(no response body)":t}`;if(null!==n){let e=n.slice(0,5).map(e=>`${""===e.path?"body":e.path}: ${e.message}`).join("; "),t=n.length-5;r+=` -- ${e}${t>0?` (+${t} more)`:""}`}super(e.code,r,e.status,e.server,{status:e.status,serverMessage:t,endpoint:e.endpoint,sessionId:e.sessionId,...null!==n?{issues:n}:{}})}},ls=class extends ss{constructor(e){super("KUI_E_SESSION_ID_INVALID",`[keploy] capture did not start: sessionIdGenerator ${null!==e.sessionId?`returned invalid ${JSON.stringify(e.sessionId)}`:e.received.startsWith("threw ")?e.received:`returned ${e.received}, which is not a session id`} (KUI_E_SESSION_ID_INVALID). ${Qi}.`,null,ns,{sessionId:e.sessionId,received:e.received,rule:Qi})}},as=class extends ss{constructor(e){super("KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE",`[keploy] capture ended before anything was recorded: strict allow-list unavailable (KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE): ${e.reason}. ${es.KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE.remedy.docs}`,null,ns,{reason:e.reason})}},us=class extends ss{constructor(e){super("KUI_E_DOM_RECORDER_UNAVAILABLE",`[keploy] capture ended before anything was sent: rrweb could not be loaded (KUI_E_DOM_RECORDER_UNAVAILABLE): ${e.reason}. ${es.KUI_E_DOM_RECORDER_UNAVAILABLE.remedy.docs}`,null,ns,{reason:e.reason})}},cs=class extends ss{constructor(e){super("KUI_E_PRIVACY_ROUTE_INVALID",`[keploy] capture did not start: privacy.${e.option} ${e.received} (KUI_E_PRIVACY_ROUTE_INVALID). ${Gr}.`,null,ns,{option:e.option,received:e.received,rule:Gr})}},hs=class extends ss{constructor(e){super("KUI_E_CAPTURE_DECLINED",`[keploy] capture did not start: ${"doNotTrack"===e?"Do Not Track":"Global Privacy Control"} enabled (KUI_E_CAPTURE_DECLINED).`,null,ns,{signal:e})}},ds=class extends ss{constructor(){super("KUI_E_PRIVACY_CONFLICT","[keploy] capture did not start: strict conflicts with maskNetworkBodies: false (KUI_E_PRIVACY_CONFLICT).",null,ns,{privacyMode:"strict",option:"privacy.maskNetworkBodies"})}},fs=!1,ps=()=>fs,gs=!1,ys=[],bs=0,ms=()=>bs,vs=new WeakSet,ws=!1,ks=[],Ss=!1,Es=[],xs=new Set,Is=(e,t)=>new Promise((n,r)=>{let i=()=>{if(gs&&!t)return n(void 0);let i=()=>n(void 0);xs.add(i),e.then(e=>(xs.delete(i),n(e)),e=>(xs.delete(i),r(e)))};(t||!Tt(i))&&i()}),As=()=>globalThis.navigation,Ts=["beforeunload","pageshow"],_s="3.3.0",Cs=()=>Ut(()=>import("@keploy/capture-sdk/body-redact"),void 0),$s=()=>Ut(()=>import("@keploy/capture-sdk/body-worker-start"),void 0),Rs=!1,Ds=!1,Os=!1,Ns=new Set,zs=8388608,Ls=0,Us=0,js=e=>(e<=0||Ls+Us<zs)&&(Ls+=e,!0),Bs=new Set,Ps=new Map,qs=0,Ms=e=>[...e].some(e=>e.owner.has(e)),Ks=e=>e.mark===ms(),Zs="",Fs=!1,Hs=!1,Ws=()=>{Jn&&(Ps.clear(),Vt())};Es.push(e=>{e&&Fn&&Fn!==Hn&&Ht(Fn,"left"),Jn&&!Jn()&&Vt()});var Vs,Js,Gs="[Response body not read by the page]",Qs="\0[Response body not captured]",Ys=class{v=new Map;redact(e,t,n,r=ms(),i){if(e?.responseBody==Qs){e.responseBody=null;let n=t;t=e=>n(e&&{...e,responseBody:m(0,Ds?"code-failed":"early")})}let s={job:e,owner:this,after:n,mark:r};this.v.set(s,t),e&&(e.requestBody||e.responseBody)?!i&&Ls+Us>=zs?(s.out=Gt(e,!0),s.job=null):Ls+=s.owes=Yt(e)+1024:s.out={requestBody:e?e.requestBody:null,responseBody:e?e.responseBody:null},s.owes&&typeof requestIdleCallback>"u"&&(s.sent=!0,Ft(s)),Promise.resolve(n).then(()=>jt(()=>{this.v.has(s)&&(void 0!==s.out?this.S(s,s.out):s.sent||Ft(s))}))}holds(){return this.v.size>0}has(e){return this.v.has(e)}answered(e,t){this.v.has(e)&&(e.out=t,Promise.resolve(e.after).then(()=>jt(()=>this.S(e,e.out??null))))}S(e,t){let n=this.v.get(e);n&&(this.v.delete(e),Ls-=e.owes||0,Bs.delete(e),e.job=e.out=null,n(t))}alone(e){Promise.all([qt(),e.after]).then(()=>jt(()=>{if(!this.v.has(e))return;let t=e.job;this.S(e,Kn?Qt(t,65536):Gt(t))}))}drop(){for(let e of this.v.keys())this.S(e,null)}now(e){let t=65536;for(let n of e?[!0,!1]:[!0])for(let e of[...this.v.keys()]){if(void 0!==e.out){this.S(e,e.out);continue}let r=e.job;if(!r){this.S(e,{requestBody:null,responseBody:null});continue}let i=Yt(r);if(n&&!(Kn&&i<=t))continue;let s=Math.min(r.requestBody?.length??0,t);this.S(e,Kn?Qt(r,s,t-s):Gt(r)),t-=n?i:t}}},Xs=/^[\t\n\r ]*\{/,eo=/[^\t\n\r ]/,to=!1,no=()=>{let e;return[new Promise(t=>e=t),e]},ro=new Set,io=/^\s*multipart\/form-data\s*(?:;|$)/i,so=()=>new TextDecoder("utf-8",{ignoreBOM:!0}),oo=(e,t)=>t<4194304&&"{"!==(eo.exec(e)?.[0]??"{"),lo=["arrayBuffer","blob","bytes","formData","json","text"],ao=globalThis.Response?.prototype.json,uo=JSON.parse,co="function"==typeof FinalizationRegistry?new FinalizationRegistry(e=>e()):null,ho=class{aj=null;P;L;aZ;B=!1;ab=new Set;bf=new Set;aE=new Ys;bM;aV=null;T=0;aI=null;aJ=null;aK=null;aL=null;constructor(e={},t=524288,n=[],r="balanced"){this.P=new Vi(e,r),this.L=t,this.aZ=new Set(n.map(Xt))}br(e){return this.aZ.size>0&&this.aZ.has(Xt(e))}start(e,t,n,r){this.B||(this.B=!0,this.T++,this.aj=e,this.aV=t??null,this.bM=n,this.ba=!1,r||this.prepare(),this.bY(),this.bZ())}prepare(){this.B&&(this.P.getConfig().maskNetworkBodies||Zt(this,!0))}askForCode(){this.P.getConfig().maskNetworkBodies||qt()}stop(e){this.B&&(this.B=!1,function(e){Ns.delete(e)}(this),(e||0===this.ab.size)&&(this.aj=null),e&&(this.cutBodies(),this.aE.drop()),this.b5(),this.b6())}settle(e){let t,n=Promise.allSettled([...this.ab]),r=new Promise(n=>{t=setTimeout(n,e)});return Promise.race([n,r]).then(()=>{clearTimeout(t),!this.B&&(this.cutInflight(),this.aj=null)})}cutInflight(){this.cutBodies(),this.aE.now(!0)}cutBodies(e){for(let t of[...this.bf])t(e)}reportDue(e){e&&this.cutBodies(!0),this.aE.now(!1)}hasInflight(){return this.ab.size>0}aD(){if(!this.B)return!1;try{let e=!this.aV||this.aV();return e&&!this.P.getConfig().maskNetworkBodies&&Zt(this),e}catch{return!1}}bv(e){this.ab.add(e),e.finally(()=>{this.ab.delete(e),!this.B&&0===this.ab.size&&(this.aj=null)})}b1(e,t){let n=[e,null],r=Number(e.headers.get("content-length")??0);if(r>this.L)return t(`[Response body too large: ${r} bytes]`),n;if(null===e.body)return t(""),n;let i=null;if(void 0!==e.body)try{i=function(e,t,n){let r=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(r,"body")?.get,s=r.clone;if(!i||"function"!=typeof s)return null;let o,l=0,a=new Promise(e=>o=e),u=e=>{h.reported||(h.reported=!0,h.text="",n(e))},c=e=>{u(e),o()},h={touched:!1,reported:!1,text:"",say:u,end:c,finished:o},d=Gs,f=()=>{! --l&&!h.touched&&c(d)},p=e=>{l++,co?.register(e,f)},g=()=>c(R("")),y=e=>{let n=new TextDecoder;c($("string"==typeof e?e:on(n,"",e,t)+n.decode(),t))},b=e=>{let n=e.getReader(),r=new TextDecoder,i="",s=()=>n.read().then(e=>e.done?y(i+r.decode()):(i=on(r,i,e.value,t),i.length<=t?s():(y(i),n.cancel())));s().catch(g)},m=e=>{try{b(s.call(e).body)}catch{c(null)}},v=(e,n)=>{p(e);let o,l,a=(t,n)=>{Object.defineProperty(e,t,{...n,configurable:!0})};for(let t of lo){let n=r[t];"function"==typeof n&&a(t,{value(){return this!==e||h.reported?n.call(this):(h.touched=!0,"formData"==t||"json"==t&&n!=ao?(m(e),n.call(e)):("json"==t?r.text:n).call(e).then(e=>(h.reported||("blob"==t?b(e.stream()):y("arrayBuffer"==t?new Uint8Array(e):e)),"json"==t?uo(e):e),e=>{throw g(),e}))},writable:!0})}a("body",{get(){if(this!==e)return i.call(this);let r=i.call(e);if(r!==o&&(o=l=r,n&&r&&!r.locked&&!h.reported)){let e=Kn?.relayBody;e&&(l=e(r,t,h),p(l)),d=e?Gs:Qs}return l}}),a("clone",{value(){let t=s.call(this);return this===e&&v(t),t},writable:!0})};return v(e,!0),[e,e=>{(!e||!h.touched)&&c(h.touched?R(h.text):d)},a]}(e,this.L,t)}catch{return t(null),n}if(i)return i;try{e.clone().text().then(e=>t($(e,this.L)),()=>t(null))}catch{t(null)}return n}bY(){if("function"!=typeof globalThis.fetch)return;let e=globalThis.fetch;this.aI=e;globalThis.fetch=(t,n)=>{if(!this.B||!this.aD())return e.call(globalThis,t,n);let r;try{r=sn(t)?t.url:t instanceof URL?t.href:String(t)}catch{return e.call(globalThis,t,n)}if(this.br(r))return e.call(globalThis,t,n);let i,s=t;if(sn(t)&&null==n?.body)try{s=t.clone()}catch{return e.call(globalThis,t,n)}try{i=new Request(s,function(e){let t=e?.body,n=ArrayBuffer.isView(t)?t.buffer:t,r="string"==typeof t?"":t instanceof URLSearchParams?new URLSearchParams:t instanceof FormData?new FormData:n instanceof ArrayBuffer&&n.byteLength?new Uint8Array(n,0,0):t;return r===t||Object.getPrototypeOf(e)!=Object.prototype?e:Object.create(Object.prototype,{...Object.getOwnPropertyDescriptors(e),body:{value:r}})}(n))}catch{return e.call(globalThis,t,n)}let o=this.T,l=performance.now(),a=i.method,u=ln(i.url),c=en(i.headers),h=this.P.getConfig().maskNetworkBodies,d=e.call(globalThis,t,n),f=()=>this.B&&o===this.T,[p,g]=no(),y=null==n?.body&&sn(t)&&!/^(?:GET|HEAD)$/.test(a)?Promise.resolve().then(()=>{if(null!==i.body)return function(e,t,n,r){if(io.test(e.headers.get("content-type")??""))return e.formData().then(e=>r()?tn(e):null);let i=e.body;if(i)return async function(e,t,n,r){let i=e.getReader(),s=so(),o="",l="";try{for(;;){let e=await i.read();if(!r())return i.cancel().catch(()=>{}),null;if(e.done)return o+s.decode();let a=e.value,u=n&&!l&&a instanceof Uint8Array?[a.subarray(0,1024),a.subarray(1024)]:[a];for(let e of u){let r=s.decode(e,{stream:!0});if(l||(l=eo.exec(r)?.[0]??""),o+=r,n&&oo(l,t))return i.cancel().catch(()=>{}),o}if(o.length>t&&(o.length>4194304||""!==l&&"{"!==l))return i.cancel().catch(()=>{}),o}}catch{return null}}(i,t,n,r);let s=3*t+4;return e.blob().then(async e=>{if(0===e.size)return;let i=t=>(async(e,t)=>{let n=await e.arrayBuffer();if(!t())throw 0;return so().decode(n)})(e.slice(0,t),r);if(n){let e=await i(1024);if(oo(e,t))return e}let o=await i(s);return e.size>s&&/^[\t\n\r ]*(?:\{|$)/.test(o)?i(12582916):o}).catch(()=>null)}(i,this.L,h,()=>f());b=null,m=""}):null,b=null!=n?.body?h?Promise.resolve(rn(n.body,!1)):async function(e,t){if(null==e)return null;try{let n=nn(e,t);return void 0!==n?n:e instanceof FormData?$(tn(e),t):e instanceof Blob?e.size>t?`[Blob: ${e.size} bytes, truncated]`:await e.text():"[ReadableStream]"}catch{return"[Unreadable body]"}}(n.body,this.L):y?y.then(e=>null==e?null:$(e,this.L),()=>"[Unreadable body]"):Promise.resolve(null),m=null!=n?.body?this.aF(n.body,a,p):y?y.then(e=>null===e?"body:*":this.aF(e,a,p),()=>"body:*"):this.aF(null,a,p);return Promise.resolve(d).then(e=>{if(o!==this.T||!this.aD())return f=()=>0,g(),e;try{let t,n="HEAD"===a||[204,205,304].includes(e.status);return f=this.a1(o,Date.now(),{method:a,url:u,requestHeaders:c,requestBody:null,responseHeaders:en(e.headers),responseBody:null,statusCode:e.status,duration:performance.now()-l,type:"fetch"},b,m,p,g,r=>n||h?(r(n?"":function(e){return null===e.body||e.body?.locked||/^\s*0+\s*$/.test(e.headers.get("content-length")??"")?null:Wi}(e)),t=[e,null]):t=this.b1(e,r)),t[0]}catch{return g(),e}},e=>{throw o===this.T&&this.aD()?(f=this.a1(o,Date.now(),{method:a,url:u,requestHeaders:c,requestBody:null,responseHeaders:{},responseBody:null,statusCode:0,duration:performance.now()-l,type:"fetch"},b,m,p,g),e):(f=()=>0,g(),e)})}}b5(){this.aI&&(globalThis.fetch=this.aI,this.aI=null)}bZ(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,t=e.open,n=e.send;this.aJ=t,this.aK=n;let r=this.L,i=()=>this.aD(),s=()=>this.T,o=(...e)=>this.aF(...e),l=(...e)=>this.a1(...e),a=e=>this.br(e),u=()=>this.P.getConfig().maskNetworkBodies,c=new WeakMap,h=e.setRequestHeader;this.aL=h,e.setRequestHeader=function(e,t){let n=c.get(this);return n&&(n[2][e]=t),h.call(this,e,t)};let d=t;e.open=function(e,t,...n){let r="string"==typeof t?t:t.toString(),i=d.call(this,e,t,...n);return a(r)||c.set(this,[e,ln(r),{},0]),i},e.send=function(e){let t=c.get(this);t&&(t[3]=performance.now());let a,h=s(),d=i(),f=()=>{this.readyState<2||(a=ms(),this.removeEventListener("readystatechange",f))};t&&d&&this.addEventListener("readystatechange",f);let p=u();return this.addEventListener("loadend",()=>{if(!t||!d||!i())return;let n=performance.now()-t[3],s=this.getAllResponseHeaders(),u={};if(s)for(let e of s.trim().split(/[\r\n]+/)){let t=e.indexOf(": ");t>0&&(u[e.slice(0,t)]=e.slice(t+2))}let c=null;if(p)c=function(e){if(""!==e.responseType&&"text"!==e.responseType)return Wi;try{return e.responseText?Wi:null}catch{return Wi}}(this);else try{"string"==typeof this.responseText&&(c=$(this.responseText,r))}catch{c=`[${this.responseType} response]`}let f=p?rn(e,!0):function(e,t){if(null==e)return null;if(e instanceof FormData)return $(tn(e),t);let n=nn(e,t);if(void 0!==n)return n;if(typeof Blob<"u"&&e instanceof Blob)return`[Blob: ${e.size} bytes]`;if(typeof Document<"u"&&e instanceof Document)try{return $((new XMLSerializer).serializeToString(e),t)}catch{return"[Unreadable body]"}return"[Unreadable body]"}(e,r),[g,y]=no();l(h,Date.now(),{method:t[0],url:t[1],requestHeaders:t[2],requestBody:f,responseHeaders:u,responseBody:c,statusCode:this.status,duration:n,type:"xhr"},null,o(e,t[0],g),g,y,void 0,a)},{once:!0}),n.call(this,e)}}b6(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype;this.aJ&&(e.open=this.aJ,this.aJ=null),this.aK&&(e.send=this.aK,this.aK=null),this.aL&&(e.setRequestHeader=this.aL,this.aL=null)}a1(e,t,n,r,i,s,o,l,a=ms()){let u,c=performance.now()-(n.duration||0),h=r?null:{value:n.requestBody},d="object"==typeof i?null:{value:i},f=l?null:{value:n.responseBody},p=n,g=()=>p,y=0,b=(n,r,i)=>{if(!p)return;let s=p;p=h=d=f=null,this.bf.delete(v),o(),js(-y),e===this.T&&this.bV({...s,requestBody:n.value,responseBody:i.value,...void 0===r.value?{}:{requestTerm:r.value}},t,u?.done,a,y,c)},m=()=>{h&&d&&f?b(h,d,f):!to&&h&&f&&!y&&(y=1024+(h.value?.length??0),js(y+=f.value?.length??0)||(y=0,v()))},v=e=>{if(e)return u?.cut?.(!0);u?.cut?.(),b(h??{value:"[Unreadable body]"},d??{value:"body:*"},f??{value:null})};if(h&&d&&f)return m(),g;this.bf.add(v),this.bv(s),r?.then(e=>{h=p&&{value:e},m()}),"object"==typeof i&&i.then(e=>{d={value:e},m()});let w=l?.(e=>{f={value:e},m()});return u=w&&{cut:w[1],done:w[2]},m(),g}ba=!1;aF(e,t,n){try{let r=function(e){return null==e||""===e?"":"string"==typeof e?e.length>4194304?"body:*":function(e){return Xs.test(e)&&(e.includes('"query"')||e.includes("persistedQuery")||e.includes("\\u"))}(e)?null:"":e instanceof URLSearchParams||typeof FormData<"u"&&e instanceof FormData?"":"body:*"}(e);if(null!==r)return r;let i=globalThis.crypto?.subtle,s=to?0:e.length+1024;return js(s)?(e=>{if(!Js){let e=Js=Is((Vs||(Vs=Ut(()=>import("@keploy/capture-sdk/request-term"),void 0).then(e=>(to=!0,e)),Vs.catch(()=>{})),Vs),to),t=()=>{Js=void 0;for(let t of ro)t(e);ro.clear()};e.then(t,t)}return new Promise(t=>{ro.add(t),e.then(()=>(ro.delete(t),t(void 0)))})})(n).finally(()=>js(-s)).then(t=>t?t.recordTermFor(e,i):"body:*",e=>(this.a9(t,e),"body:*")).catch(e=>this.a9(t,e)):"body:*"}catch(e){return this.a9(t,e)}}a9(e,t){if(!this.ba){this.ba=!0;try{console.warn(function(e,t){return mt({code:"KUI_E_REQUEST_TERM_FAILED",method:e,reason:t},"recorded request without term/body:* (failed); request unaffected, further failures silent.")}(e,Et(t)))}catch{}}}bV(e,t,n,r,i,s){let o=this.aj;if(!o)return;let l,a,u=this.bM?.();this.bv(new Promise(e=>l=e));try{a=this.P.bodyJob(e)}catch{return l()}a&&(e.requestBody=e.responseBody=null),this.aE.redact(a,n=>{if(l(),n)try{o(this.P.maskNetworkData(e,n),t,u,s)}catch{}},n,r,i)}},fo=_s,po=32768,go=10485760,yo=16777216,bo=class{i;queue=[];retryQueue=[];bh=0;az=null;current=null;bc=null;ad=null;bi=null;get G(){return typeof navigator>"u"||!1!==navigator.onLine}ae=!1;bw=1;M=!1;j=!1;ao=0;am=!1;wakeSender=null;A=0;aa=0;bI=!1;bG=!1;bH=!1;bF=!1;aC=new WeakMap;J=null;aq=0;R=0;Z=!1;H=0;aG=0;constructor(e){this.i={...e,batchSize:Math.min(e.batchSize,5e3)}}cc(e,t,n){this.discard();let r=new os({code:e,status:t,server:kt(n),endpoint:this.i.endpoint,sessionId:this.bc??null});if(this.i.endsSessionOnly?.(e,function(e){if(null===e)return null;try{let t=JSON.parse(e)?.reason;return"string"==typeof t?t.slice(0,100):null}catch{return null}}(n))){this.stop();try{this.i.onSessionEnd?.()}catch{}}else{an(()=>console.error(r.message)),this.stop();try{this.i.onCaptureEnd?.()}catch{}try{this.i.onError?.(r)}catch{}}}start(e,t,n=null){this.ae||(this.ae=!0,this.bc=e,this.ad=t,this.bi=n,this.aa=un(JSON.stringify(this.bt([],this.a0()))),this.az=setInterval(()=>{this.bz||this.flush(this.am&&this.G)},this.i.batchInterval),typeof window<"u"&&(window.addEventListener("online",this.bm),window.addEventListener("pagehide",this.aA),window.addEventListener("beforeunload",this.aA),document.addEventListener("visibilitychange",this.bn)))}hold(){this.j=!0}release(e=!0){if(this.j=!1,e||this.am&&this.G)this.flush(!0);else if(this.G){let e=this.queue.length/this.i.batchSize|0;e&&(this.ao=e-1),(e||(this.Z=this.aM()))&&this.flush()}}discard(){this.queue=[],this.R=0,this.retryQueue=[]}stop(){if(!this.ae)return this.current??Promise.resolve();this.ae=!1,this.j&&this.discard(),this.az&&(clearInterval(this.az),this.az=null);let e=this.flush(!0);return typeof window<"u"&&(window.removeEventListener("online",this.bm),e.finally(()=>this.aW())),e}aW(){this.ae||this.V()>0||typeof window>"u"||(window.removeEventListener("pagehide",this.aA),window.removeEventListener("beforeunload",this.aA),document.removeEventListener("visibilitychange",this.bn))}enqueue(e){if(!this.ae)return;e.seq??=this.bw++;let t;try{let n=JSON.stringify(e),r=un(n);this.aC.set(e,[n,r]),t=this.aa+r}catch(t){this.b4(e,t),this.ap([e]);return}if(t>go){this.b3(e,t),this.ap([e]);return}this.queue.push(e),this.aq+=t,this.R+=this.p(e);let n=[];for(;this.queue.length>this.i.maxQueueSize;){let e=this.queue.shift();this.R-=this.p(e),n.push(e)}n.length>0&&this.ap(n),this.bl(),!this.bz&&(t>po?this.G&&!this.j?this.flush(!0):this.am=!0:this.queue.length>=this.i.batchSize?(null!==this.current&&this.ao++,this.flush()):!this.j&&this.G&&this.aM()&&(this.Z=!0,this.flush()))}place(){return this.bw++}get bz(){return performance.now()<this.aG}bl(){if(this.aq<=yo)return;let e=0;for(let t of this.retryQueue)e+=t.bytes;for(let t of this.queue)e+=this.p(t);let t=[];for(;e>yo;){let n=this.retryQueue.shift();if(n)e-=n.bytes,t.push(...n.events);else{let n=this.queue.shift();e-=this.p(n),this.R-=this.p(n),t.push(n)}}this.aq=e,t.length>0&&this.ap(t)}ap(e){!this.G&&0===this.H&&(this.H=1,an(()=>this.i.onFailing?.(!0)));let t=1/0;for(let n of e)"dom"===n.type&&(t=Math.min(t,n.seq??-1/0));let n=!1;if(t!==1/0){let r=[];for(let i of this.queue){let s=(i.seq??-1/0)>t,o="dom"===i.type?i.data?.type:void 0;s&&2===o&&(n=!0),s&&!n&&3===o?(e.push(i),this.R-=this.p(i)):r.push(i)}this.queue=r}an(()=>this.i.onDropped?.(e,n))}b4(e,t){if(this.bI)return;this.bI=!0;let n=t instanceof Error?t.message:String(t);this.a$(bt({code:"KUI_E_EVENT_UNSERIALISABLE",eventId:e.id,eventType:e.type,reason:n},"it cannot be serialised to JSON."))}b3(e,t){this.bG||(this.bG=!0,this.bR({code:"KUI_E_EVENT_OVERSIZED",eventId:e.id,eventType:e.type,bytes:t,cap:go},`${t} bytes in a body`,go))}reportScrubOversized(e,t,n){this.bH||(this.bH=!0,this.bR({code:"KUI_E_EVENT_OVERSIZED_SCRUBBING",eventType:e,atLeast:t,cap:n},`scrubbing the page URL's credentials out of it was certain to write at least ${t} characters`,n))}reportNavigationUnwrapped(e){this.bF||(this.bF=!0,this.a$(mt({code:"KUI_E_NAVIGATION_UNWRAPPED",method:e},"could not wrap History/Navigation API; capture continues with basic route tracking.")))}bR(e,t,n){this.a$(bt(e,`${t}, over the ingest server's ${n}-byte cap, so no batch could carry it.`))}a$(e){console.warn(e)}bt(e,t){return{sessionId:this.bc,batchId:t,events:e,metadata:this.ad,sdk:{name:"@keploy/capture-sdk",version:fo},captureIdentity:this.bi}}flush(e=!1){return this.j?Promise.resolve():(e&&(this.M=!0),this.current?this.current:0===this.V()||!this.G&&!this.M?(this.M=!1,this.H>0&&0===this.V()&&this.G&&(this.H=this.aG=0,an(()=>this.i.onFailing?.(!1))),Promise.resolve()):(this.current=this.ce(),this.current))}async ce(){let e=!1;try{do{let t=this.b8()??this.bS();if(null===t)return;this.J=t;try{await this.b_(t)}catch{this.aG=performance.now()+Math.min(2e3*2**this.H,6e4)*(1+Math.random()/2),0===this.H++&&an(()=>this.i.onFailing?.(!0)),this.aq+=t.bytes,this.retryQueue.unshift(t),this.bb();return}finally{this.J===t&&(this.J=null)}this.Z=!this.M&&this.G&&this.aM(),e=this.ao>0&&!this.j&&this.G&&this.queue.length>=this.i.batchSize,e&&this.ao--}while((this.M||this.Z||e)&&this.V()>0)}finally{this.M=!1,this.Z=!1,this.ao=0,0===this.V()&&(this.am=!1),this.current=null,this.aW()}}b7(e){return new Promise(t=>{let n=()=>{clearTimeout(r),this.wakeSender===n&&(this.wakeSender=null),t()},r=setTimeout(n,e);this.wakeSender=n})}async b_(e){let t=e.json,n=e.wire??=async function(e){let t=un(e);if(typeof CompressionStream<"u"&&typeof Response<"u")try{let n=new Response(e).body.pipeThrough(new CompressionStream("gzip")),r=await new Response(n).arrayBuffer();if(r.byteLength<t)return{body:r,bytes:r.byteLength,encoding:"gzip"}}catch{}return{body:e,bytes:t,encoding:null}}(t);for(let t=0;t<3;t++){if(e.abandoned)return;let r,i=null;try{let{body:t,bytes:s,encoding:o}=e.sent=await n;if(e.abandoned)return;let l={"Content-Type":"application/json","X-API-Key":this.i.apiKey,...o?{"Content-Encoding":o}:{}},a=!e.early&&s<=po-this.A;a&&(this.A+=s),e.onWire=!0,e.dispatched=!0;let u=typeof AbortController<"u"?new AbortController:void 0,c=u&&setTimeout(()=>u.abort(),15e3);try{r=await fetch(this.i.endpoint,{method:"POST",headers:l,body:t,keepalive:a,signal:u?.signal});try{i=await r.text()}catch{i=null}}finally{clearTimeout(c),e.onWire=!1,a&&(this.A-=s)}}catch{}if(r){if(r.ok){this.H>0&&(this.H=this.aG=0,this.M=!0,an(()=>this.i.onFailing?.(!1))),an(()=>this.i.onDelivered?.(e.events));return}let{status:t}=r,n=wt(t);if(null!==n){an(()=>this.cc(n,t,i));return}}if(this.H>0||2===t)break;await this.b7(1e3*2**t*(.5+.5*Math.random()))}throw new Error("Transport: all retry attempts failed")}b0(){let e=this.J;if(e&&!e.onWire&&!e.abandoned){if(e.abandoned=!0,this.J=null,this.aq+=e.bytes,e.dispatched){this.retryQueue.unshift(e),this.bb();return}this.queue.unshift(...e.events),this.bd(e.events,-1),this.bb()}}b8(){let e=this.retryQueue.shift();return e?{events:e.events,batchId:e.batchId,json:e.json,bytes:e.bytes,wire:e.wire,dispatched:e.dispatched,onWire:!1,abandoned:!1,early:e.early}:null}bS(){if(0===this.queue.length)return null;let e=this.aM(),t=this.Z&&!this.M&&e?po-this.A:go;this.Z=!1;let n=0,r=this.aa,i=0,s=Math.min(this.i.batchSize,this.queue.length);for(;i<s;){let e=this.p(this.queue[i])+(0===i?0:1);if(r+e>t)break;e>n&&(n=e),r+=e,i++}0===i&&(n=this.p(this.queue[0]),r+=n);let o=this.queue.splice(0,Math.max(i,1));this.bd(o);let l=this.a0(),a=this.bP(o,l);for(let e of o)this.aC.delete(e);return{events:o,batchId:l,json:a,dispatched:!1,onWire:!1,abandoned:!1,bytes:r,early:e&&this.aa+n<=po}}bP(e,t){return JSON.stringify(this.bt([],t)).replace('"events":[]',()=>`"events":[${e.map(e=>this.aC.get(e)?.[0]??JSON.stringify(e)).join()}]`)}p(e){return this.aC.get(e)?.[1]??un(JSON.stringify(e))}a0(){let e=typeof crypto<"u"?crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();this.bh+=1;let t=Math.floor(4294967295*Math.random()).toString(16).padStart(8,"0");return`${Date.now().toString(16).padStart(12,"0")}-${(this.bh%4294967296).toString(16).padStart(8,"0")}-`+t}bd(e,t=1){for(let n of e)this.R-=t*this.p(n)}aM(){return this.aa+this.R+this.queue.length>po-this.A}V(){let e=this.queue.length;for(let t of this.retryQueue)e+=t.events.length;return e}bb(){let e=this.V()-this.i.maxQueueSize,t=[];for(;e-- >0&&this.queue.length>0;){let e=this.queue.pop();this.R-=this.p(e),t.push(e)}t.length>0&&this.ap(t.reverse()),this.bl()}flushOnUnload(e=!1){if(this.j||(this.b0(),this.queue.sort((e,t)=>e.seq-t.seq),"function"!=typeof fetch))return;for(;this.retryQueue.length>0;){let e=this.retryQueue[0],t=e.sent,n=t?t.bytes:un(e.json);if(n>po-this.A)return;this.retryQueue.shift(),e.dispatched=!0,this.bA(t?t.body:e.json,n,t?.encoding)}if(0===this.queue.length)return;let t=po-this.A-(e&&this.J?.early&&this.J.onWire?this.J.sent?.bytes??this.J.bytes:0),n=this.a0(),r=this.aa,i=0;for(let e of this.queue){let n=this.p(e)+(0===i?0:1);if(r+n>t)break;r+=n,i++}if(0===i)return;let s=this.queue.splice(0,i);this.bd(s);let o=this.bP(s,n);this.bA(o,un(o))}bA(e,t,n){try{this.A+=t,fetch(this.i.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.i.apiKey,...n?{"Content-Encoding":n}:{}},body:e,keepalive:!0}).then(e=>e.arrayBuffer()).catch(()=>{}).finally(()=>{this.A-=t})}catch{this.A-=t}}bm=()=>{try{this.i.beforeOnlineFlush?.()}catch{}this.wakeSender?.(),this.flush(this.am)};aA=e=>{if(!this.j&&"pagehide"===e.type)try{this.i.beforeUnloadFlush?.()}catch{}this.flushOnUnload("beforeunload"===e.type),this.aW()};bn=()=>{this.j||"hidden"===document.visibilityState&&(this.i.beforeHiddenFlush?.(),this.flush(!0))};get queueSize(){return this.V()}},mo=null,vo=!1,wo=null,ko=!1,So=[new Map,new Map],Eo=[0,0],xo=e=>e.strict?new as({reason:e.failed}):new us({reason:e.failed}),Io=256,Ao=65536,To=new Map,_o="",Co=-1,$o=null,Ro=64,Do=524288,Oo=new Set,No=new Set,zo=null,Lo=null,Uo=null,jo=[],Bo=null,Po=null,qo=new Map,Mo=!1,Ko=Object.getOwnPropertyDescriptor,Zo=/\/(?:(?:log|sign)-?(?:in|out)|auth|oauth|session|tokens?)(?:\b|$)/i,Fo=class{h="idle";af=!1;aT=!1;N=!1;K=!1;l=null;bJ=!1;aP=5e3;a_=!1;failing(e){this.a_=e,null!==this.l&&clearTimeout(this.l),this.l=null,!e&&this.K&&this.a2(!1)}lost(e,t){t||!e.some(e=>"dom"===e.type)||(this.K=!0,this.a2(_n(e)))}a2(e){if(this.a_)return;if(null!==this.l){if(!e||!this.bJ)return;clearTimeout(this.l)}this.bJ=!e;let t=e?this.aP:0;e&&(this.aP=Math.min(2*this.aP,6e4)),this.l=setTimeout(()=>{if(this.l=null,!this.K||"recording"!==this.getState())return;let e=this.I?.takeFullSnapshot;if(e){this.N=!1;try{e.call(this.I)}catch{this.N=!0}}},t)}delivered(e){_n(e)&&(this.aP=5e3)}bD=new yi({note:e=>{let t=this.I?.mirror?.getNode(e);t&&this.a8.set(e,t)},present:e=>this.bT(e),forget:e=>{this.a8.delete(e)}});a8=new Map;ac=null;ad=null;k;a3=null;bN=null;bL=null;aQ=null;ak=!1;C=null;aH=null;al=null;I=null;W=!1;q=0;aS=null;ar=null;a6=null;ai="";aR="";ag=0;bC="";actAt=0;constructor(e){this.k=e}async start(e,t=null,n=!1,r=null,i=null,s=null){if("active"===this.h)return this.ac;"stopping"===this.h&&this.stop();let o={secretRoutes:[],keepRoutes:[]};for(let e of["secretRoutes","keepRoutes"]){let t=this.k.privacy?.[e]??[];if(!Array.isArray(t))throw this.h="stopped",new cs({option:e,received:xt({returned:t})});for(let n of t){let t=Y(n,"keepRoutes"===e);if(null===t)throw this.h="stopped",new cs({option:e,received:xt({returned:n})});o[e].push(t)}}!function(e,t){for(let[n,r]of[[Qr.secret,e],[Qr.keep,t]])for(let e of r){let t=`${n===Qr.keep}${e.join("/")}`;Yr.has(t)||(Yr.add(t),n.push(e),Xr++,ti=["",[],!1,null])}}(o.secretRoutes,o.keepRoutes);let l,a=this.k.sampleRate??1;if(Math.random()>a)return this.h="stopped","";this.a3=e,this.bN=t,this.bL=r,this.aQ=i;try{l=this.k.sessionIdGenerator?this.k.sessionIdGenerator():cn()}catch(e){throw this.h="stopped",new ls({sessionId:null,received:xt({threw:e})})}if(!pt(l))throw this.h="stopped",new ls({sessionId:"string"==typeof l?l:null,received:xt({returned:l})});this.ac=l,this.ad=function(e){let t=typeof window<"u"?window:void 0,n=typeof navigator<"u"?navigator:void 0,r=t?.location?.href??"",i=r?mn(r):null;return{url:ze(e(r),i),userAgent:n?.userAgent??"",viewport:{width:t?.innerWidth??0,height:t?.innerHeight??0},referrer:typeof document<"u"&&document.referrer?ze(e(document.referrer),i):"",language:n?.language??"",devicePixelRatio:t?.devicePixelRatio??1,timestamp:Date.now()}}(this.aN),this.h="active",this.af=n,this.N=!1,this.ag=0,this.actAt=0,this.aT=typeof document<"u"&&"hidden"===document.visibilityState,this.W=!1;let u=++this.q;typeof document<"u"&&(this.ar=()=>{this.aT="hidden"===document.visibilityState,"recording"===this.getState()&&this.by()},document.addEventListener("visibilitychange",this.ar)),this.aR=typeof location<"u"?location.href:"",this.ai=typeof location<"u"?this.aN(location.href):"",this.a6=Tn((e,t,n)=>this.bx(e,t,n));let c=await this.a5();if(u!==this.q||"active"!==this.h)return"";if(null!==c&&typeof window<"u")throw this.stop(),xo(c);let h=this.k.maxSessionDuration??6e5;return this.aS=setTimeout(()=>{try{this.bN?.()}finally{"active"===this.h&&this.stop()}},h),zo?.refused&&s?.(zo.refused),this.ac}stopDom(){"active"===this.h&&(this.h="stopping"),this.al&&(this.al(),this.al=null),this.aS&&(clearTimeout(this.aS),this.aS=null)}stop(){if("active"===this.h||"stopping"===this.h){null!==this.C&&(window.removeEventListener("online",this.C),this.C=null,this.a7()),this.ak=!1;for(let e of So)e.delete(this);this.stopDom(),this.I=null,this.l&&(clearTimeout(this.l),this.l=null),this.ar&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.ar),this.ar=null),this.a6?.(),this.a6=null,this.h="stopped"}}bx(e,t,n){if("active"!==this.h)return;this.aR=location.href;let r=this.aN(location.href);pn(r)!==pn(this.ai)&&(this.ai=r,this.emitEvent("dom",{type:4,data:{href:r,...fn(),cause:e,...void 0===t?{}:{userInitiated:t},...void 0===n?{}:{initiator:n}},timestamp:Date.now()}))}b2(e){if("object"!=typeof e||null===e)return e;let t=e,n=t.data?.href;if(4!==t.type||"string"!=typeof n)return e;this.ai=this.aN(n);let r=this.ad?.timestamp,i=1===this.ag&&r<t.timestamp&&t.timestamp-r<=1e4;return this.ag=2,{...t,...i?{timestamp:r}:{},data:{...t.data,href:this.ai}}}isUserPaused(){return this.af}pause(){"active"===this.h&&(this.af=!0)}resume(){"active"===this.h&&(this.af=!1,"recording"===this.getState()&&this.by())}by(){if(!this.al){this.N=!1;let e=this.q;this.a5().then(t=>{null!==t?this.bE(e,t):this.bU(e)});return}if(!this.N&&!this.K)return;let e=this.I?.takeFullSnapshot;if(e){if(this.a_){this.K=!0;return}this.N=!1;try{e.call(this.I)}catch{this.N=!0}}}getSessionId(){return"active"===this.h?this.ac:null}get bO(){return"active"===this.h&&!this.af}getState(){return"idle"===this.h?"idle":"stopped"===this.h||"stopping"===this.h?"stopped":this.af||this.aT?"paused":"recording"}getMetadata(){return this.ad}async a5(){if(this.W)return null;this.W=!0;let e=this.q;if(!this.a4()&&typeof window<"u"&&!1===navigator.onLine&&!zt())return this.W=!1,this.bK(e),null;let t=+("strict"===this.k.privacyMode),n=()=>{let e=this.q;return So[t].set(this,t=>{this.ak&&this.bs(e,t)}),this.bX()};if(Eo[t])return n();let r=dn(t>0),i=await Is(r,this.a4());if(!i)return e===this.q&&"active"===this.h&&(n(),Eo[t]||function(e,t){Eo[e]++,t.then(t=>{Eo[e]--;let n=[...So[e].values()];So[e].clear();for(let e of n)e(t)})}(t,r)),null;if(e!==this.q)return null;if("failed"in i)return this.W=!1,i;let s=i.record;return"recording"!==this.getState()?(this.W=!1,null):(this.I=s,this.al=s(this.b9())??null,null)}bK(e){if(null!==this.C)return;let t=()=>{if(window.removeEventListener("online",t),this.a7(),this.C=null,e===this.q&&"active"===this.h){if(!1===navigator.onLine){this.bK(e);return}dn("strict"===this.k.privacyMode).then(t=>this.bs(e,t))}};this.C=t,window.addEventListener("online",t,{once:!0}),this.aH=setInterval(()=>{!1!==navigator.onLine&&t()},1e3)}bX(){return this.W=!1,this.ak=!0,null}bs(e,t){if(e===this.q&&"active"===this.h){if(this.ak=!1,"failed"in t){this.bE(e,t);return}this.a5(),this.aQ?.(null)}}a7(){null!==this.aH&&(clearInterval(this.aH),this.aH=null)}bE(e,t){e!==this.q||"active"!==this.h||(this.stop(),this.aQ?.(xo(t)))}bU(e){e!==this.q||"active"!==this.h||!this.a4()||null===this.C||(window.removeEventListener("online",this.C),this.C=null,this.a7(),this.aQ?.(null))}a4(){return vo&&(ko||"strict"!==this.k.privacyMode)}awaitingRRWeb(){return null!==this.C||this.ak}b9(){let e=this.k.privacyMode??"balanced",t=this.k.privacy??{},n=[...this.k.maskSelectors??[],...t.maskSelectors??[]].filter(Cn);this.bC=n.join(",");let r=[...this.k.unmaskSelectors??[],...t.unmaskSelectors??[]],i="off"!==e,s={color:i,date:i,"datetime-local":i,email:i,file:i,month:i,number:i,range:i,search:i,tel:i,text:i,time:i,url:i,week:i,textarea:i,select:i,password:!0,hidden:!0},o='[contenteditable]:not([contenteditable="false"])',l=i?[o]:[],a=[...n,'[data-keploy-mask]:not([data-keploy-mask="false"]),[data-clarity-mask]',...l].join(","),u=r.join(","),c=u?(e,t)=>{try{if(i&&t?.closest(o))return e.replace(/[\S]/g,"*");if(t?.closest(u))return e}catch{}return e.replace(/[\S]/g,"*")}:void 0;return{emit:e=>this.emitEvent("dom",e,e=>this.b2(e)),maskTextSelector:"strict"===e?"*":a||void 0,...c?{maskTextFn:c}:{},blockSelector:t.blockSelectors?.join(",")||void 0,maskInputOptions:s,userTriggeredOnInput:!0}}bT(e){let t=this.I?.mirror;if(void 0===t)return!0;let n=this.a8.get(e)??t.getNode(e);if(!n||!n.isConnected)return!1;for(let e=n.ownerDocument;null!==e&&e!==document;){let t=e.defaultView?.frameElement??null;if(null===t||!t.isConnected)return!1;e=t.ownerDocument}return!0}bW(e){if(!(typeof location>"u"||location.href===this.aR)){if(4===e?.type){this.aR=location.href;return}this.bx(En())}}aN=e=>function(e,t=!1){return e&&p(e,t?Bi:ji)}(function(e){let[,t,n]=ue(e);if(t)return`${le(e)}/[REDACTED]`;let r=e.indexOf("#"),i=V(ie(e),J(z(e))),s=U(-1===r?e:e.slice(0,r),i);if(-1!==r){let t=e.slice(r+1).split("#")[0];Pr.test(t)&&(s+=`#${U(t,i)}`)}return null===n?s:Se(s,n)}(e),"strict"===this.k.privacyMode);ca(e,t){let n=e;if(null===n||"object"!=typeof n)return e;let r=n.data;if(null===r||"object"!=typeof r)return e;let i="strict"===this.k.privacyMode,s=null===t?[]:[...t.plain,...t.bounded],o=this.I?.mirror,l=this.bC,a=l?e=>!!o?.getNode(e)?.closest?.(l):void 0;if(2===n.type&&at(r.node,i,s,a),3!==n.type)return e;if(0===r.source){if(Array.isArray(r.adds)){!function(e){let t=new Map;for(let n of e){let e=n?.node?.type;(3===e||5===e)&&t.set(n.node.id,n)}let n=new Set;for(let e of t.values())n.add(t.get(e.nextId));for(let e of t.values()){if(n.has(e))continue;let r=[];for(let n=e;n;n=t.get(n.nextId))ot(n.node)&&r.push(n.node);r.length>1&&st(r)}}(r.adds);for(let e of r.adds)null!==e&&"object"==typeof e&&at(e.node,i,s,a)}if(Array.isArray(r.attributes))for(let e of r.attributes){let t=e?.attributes;if(null!==t&&"object"==typeof t){let n=i?o?.getNode(e.id??-1):null;Ye(t,i,s,n?.localName??"","http://www.w3.org/2000/svg"===n?.namespaceURI,a?.(e.id))}}if(Array.isArray(r.texts)){let e=this.bD.recordsIn(n);for(let t of r.texts)"string"==typeof t?.value&&(t.value=e.has(t)?it(t.value,i,s):nt(t.value))}}if(8===r.source||15===r.source){let e=[...Array.isArray(r.adds)?r.adds:[],...Array.isArray(r.styles)?r.styles.flatMap(e=>Array.isArray(e?.rules)?e.rules:[]):[]];for(let t of e)"string"==typeof t?.rule&&(t.rule=it(t.rule,i,s));"string"==typeof r.replace&&(r.replace=it(r.replace,i,s)),"string"==typeof r.replaceSync&&(r.replaceSync=it(r.replaceSync,i,s))}if(5===r.source&&"string"==typeof r.text&&(r.text=i?r.text.replace(/\S/g,"*"):nt(r.text)),9===r.source&&"string"==typeof r.fontSource&&(r.fontSource=it(r.fontSource,i,s)),13===r.source){let e=r.set;"string"==typeof e?.value&&(e.value=it(e.value,i,s))}return e}acceptsNetwork(){return this.bO}emitEvent(e,t,n,r=!1,i,s){if("dom"===e&&"active"===this.h&&"recording"!==this.getState()&&(this.N=!0),(r?"active"!==this.h&&"stopping"!==this.h:!this.bO)||"dom"===e&&this.aT||!this.a3||!this.ac)return;"network"===e&&!this.ag&&(this.ag=1),this.bW("dom"===e?t:null);let o=n?n(t):t,l="dom"===e&&null!==o&&"object"==typeof o?o.type:void 0,a=o?.data;if(3===l?!this.actAt&&(2===a?.source||5===a?.source)&&(this.actAt=Math.max(1,performance.now())):4===l&&"string"==typeof a?.href&&Zo.test(a.href)&&(this.actAt=-1),this.K&&3===l)return;let u=o;if(typeof location<"u")try{"dom"===e&&(u=this.ca(o,mn(location.href))),u=ze(u,mn(location.href),e,this.bD,go)}catch(t){"dom"===e&&(this.K=!0,this.a2(2===l)),t instanceof bi&&this.bL?.(e,t.atLeast,t.cap);return}2===l&&(this.K=!1,null!==this.l&&(clearTimeout(this.l),this.l=null));let c={id:cn(),sessionId:this.ac,timestamp:i??Date.now(),type:e,data:u,seq:s};this.a3(c)}},Ho=class{bo;aY;bq;bp;constructor(e,t=Date.now()){this.bo=e,this.aY=$n(),this.bq=t;let n=Rn();this.bp=null===n?[]:[n]}build(){return null===this.aY?{refusal:"no-csprng"}:{identity:{captureId:this.bo,sessionNonce:this.aY,t0WallMs:this.bq,appOrigins:[...this.bp]}}}},Wo={},Vo=()=>{},Jo=!1,Go=!1,Qo=null,Yo=null,Xo=class e{static ending=new Set;recorder;m;transport;au;ah=!1;j=!1;capIdent=null;constructor(e){this.au=e,this.recorder=new Fo(e),this.m=new ho(e.privacy??{},e.maxBodySize??524288,[e.endpoint],e.privacyMode);let t={endpoint:e.endpoint,apiKey:e.apiKey,batchSize:e.batchSize??50,batchInterval:e.batchInterval??5e3,maxQueueSize:e.maxQueueSize??5e3,...void 0!==e.onError?{onError:e.onError}:{},onCaptureEnd:()=>this.aw(),endsSessionOnly:(t,n)=>!0===e.continuous&&void 0===e.sessionIdGenerator&&("KUI_E_SESSION_CONFLICT"===t&&"session_completed"===n||"KUI_E_INGEST_REJECTED"===t&&"session_full"===n),onSessionEnd:()=>this.bk(),onDropped:(e,t)=>this.recorder.lost(e,t),onDelivered:e=>this.recorder.delivered(e),onFailing:e=>this.recorder.failing(e),beforeUnloadFlush:()=>this.m.cutInflight(),beforeHiddenFlush:()=>this.m.reportDue(!0),beforeOnlineFlush:()=>this.m.reportDue()};this.transport=new bo(t)}static async init(t){if(Yo)return Yo;let n=Jo;return Vo(),Jo=!1,Qo=null,e.begin(t,n)}static async begin(t,n,r=!1){let i=new e(t);Yo=i;try{await i.start(n,r)}catch(e){throw i.stop(),Yo===i&&(Yo=null),e}return i}static stop(){Vo(),Jo=!1;let t=Yo;Yo=null,Qo=null;let n=new Promise(t=>{let n=setTimeout(t,1e4);Promise.all(e.ending).then(()=>{clearTimeout(n),t()})});return t||n.then(()=>{!Yo&&!Go&&(Nt(!1),Jt())}),Promise.all([t?.stop(),n]).then(()=>{})}static pause(){Yo?.pause(),null===Yo&&Go&&(Jo=!0)}static resume(){Yo?.resume(),Jo=!1}static getSessionId(){return Yo?.recorder.getSessionId()??""}static getInstance(){return Yo}static getCaptureIdentity(){return Yo?.capIdent?.build()??null}async start(e,t=!1){if(this.ah)return;let n=this.au;if(this.ah=!0,"strict"===n.privacyMode&&!1===n.privacy?.maskNetworkBodies)return this.aO(new ds);let r,i=!1!==n.honorPrivacySignals?function(){try{if(typeof navigator>"u")return null;let e=navigator;if(!0===e.globalPrivacyControl)return"globalPrivacyControl";if("1"===e.doNotTrack||"yes"===e.doNotTrack||typeof window<"u"&&"1"===window.doNotTrack||"1"===e.msDoNotTrack)return"doNotTrack"}catch{}return null}():null;if(null!==i)return this.aO(new hs(i),!0);try{Nt(!0,!t);let i=!0===n.continuous&&void 0===n.sessionIdGenerator,s=this.recorder.start(e=>this.transport.enqueue(e),()=>i?this.bk():this.aw(),e,(e,t,n)=>this.transport.reportScrubOversized(e,t,n),e=>{null===e?(this.j=!1,this.transport.release()):this.aO(e)},e=>this.transport.reportNavigationUnwrapped(e)),o=this.recorder.getSessionId();if(null!==o){this.capIdent=new Ho(o);let r=this.capIdent.build();this.j=!0,this.transport.hold();let s=this.recorder.getMetadata();this.transport.start(o,s,"identity"in r?r.identity:null),!1!==n.networkCapture&&(this.m.askForCode(),i&&!t&&(Qo=[new Map,performance.now()+5e3]),this.m.start((e,n,r,i)=>{let{method:s,statusCode:o,url:l,responseBody:a}=e,u=this.recorder.actAt,c="GET"===s||"HEAD"===s;(u<0||401===o||!c&&Zo.test(l))&&(Qo=null);let h=c?Qo?.[0]:void 0,d=s+l,f=h?.get(d);f?(f.statusCode!==o||f.responseBody!==a)&&h.delete(d):!t&&h&&(!u||i<=u)&&i<=Qo[1]&&h.size<16&&o>=200&&o<400&&(!a||a.length<=65536)&&h.set(d,{...e,optional:!0}),this.recorder.emitEvent("network",e,void 0,!0,n,r)},()=>this.recorder.acceptsNetwork(),()=>this.transport.place(),!0),i&&t&&Qo&&!e&&setTimeout(()=>{let e=this.recorder;if(this.ah&&Qo&&e.actAt>=0&&!e.isUserPaused())for(let t of Qo[0].values())e.emitEvent("network",t,void 0,!1,s.timestamp)},0))}r=await s}catch(e){if(e instanceof ls||e instanceof us||e instanceof as||e instanceof cs)return this.aO(e);throw e}r?(this.m.prepare(),this.recorder.awaitingRRWeb()||(this.j=!1,this.transport.release(!1))):(this.ah=!1,(Yo??this)===this&&Nt(!1))}stop(){let e=this.j;return e||this.m.reportDue(),this.recorder.stopDom(),this.m.stop(e),this.ah=!1,(e?Promise.resolve():this.m.settle(1e3)).then(()=>{let e=null===Yo;return Jt(e,()=>null!==Yo||Go),e&&!Go&&(Nt(!1),Qo=null),this.recorder.stop(),this.transport.stop()})}aO(e,t){Qo=null;let n=Wo[e.code];return n||(console[t?"info":"error"](e.message),n=Wo[e.code]=[-1e9,0]),this.aw().then(()=>{this.recorder=this.m=this.transport=null}),new Promise(t=>{let r=performance.now(),i=n.length>2;if((i?Math.abs(r-n[0]):n[0]-r)>31e3)if(i){let t=n.splice(2);n=Wo[e.code]=[r,n[1],...t],setTimeout(Dn,0,n)}else n[0]=-1e9;n.length>=18?t():n.push([e.constructor,e.evidence,this.au.onError,t])<4&&(n[1]=r-n[0]<n[1]+1e3?Math.min(2*n[1]||50,3e4):0,n[0]=Math.max(r,n[0]+n[1]),setTimeout(Dn,Math.ceil(n[0]-r),n))})}aw(){let t=this.stop().catch(()=>{}).finally(()=>e.ending.delete(t));return e.ending.add(t),Yo===this&&(Yo=null),t}bk(){let t=Yo===this,n=this.recorder.isUserPaused();if(this.aw(),!t||typeof document>"u")return;Vo(),Jo=n;let r={...this.au,sampleRate:1};(n||this.recorder.actAt<0)&&(Qo=null);let i=()=>{let t=Jo;Vo(),Jo=!1,t&&(Qo=null),null===Yo&&e.begin(r,t,!0).catch(e=>{console.warn("[keploy] the capture's next session could not start:",e)})},s={capture:!0,passive:!0};document.addEventListener("pointerdown",i,s),document.addEventListener("keydown",i,s);let o=Tn(()=>{});Go=!0,Vo=()=>{o(),document.removeEventListener("pointerdown",i,s),document.removeEventListener("keydown",i,s),Go=!1,Vo=()=>{}}}pause(){Qo=null,this.recorder.pause(),this.m.cutBodies()}resume(){this.recorder.resume()}};//# sourceMappingURL=index.js.map
1
+ "use strict";function e(e){return e.includes("%")?e.replace(Gn,e=>decodeURIComponent(e)):e}function t(t,n){return e(t).split("key"===n?/[[\]]+/:/[[\].]+/).map(e=>e.toLowerCase().replace(/[-_$+\s]/g,"")).filter(e=>""!==e)}function n(e,t){return!(tr.has(e)||"page"===t&&nr.has(e))&&(Qn.has(e)||Xn.has(e)||Yn.has(e)||er.test(e))}function r(e,n){return i(t(e,n),n)}function i(e,t){return e.some(e=>n(e,t))||e.length>1&&n(e.join(""),t)}function s(e){let t=e.replace(/\+/g," ");if(!/%/.test(t))return t;if(/%(?![0-9A-Fa-f]{2})/.test(t))return e;try{return decodeURIComponent(t)}catch{return e}}function o(e,t,n){let r=e.indexOf("#"),i=-1===r?e:e.slice(0,r),s=i.indexOf("?"),o=-1===s?i:i.slice(0,s),l=-1===s?null:i.slice(s+1),a=-1===r?null:e.slice(r+1),d=c(o,t)+(null===l?"":`?${u(l,t,n,o)}`)+(null===a?"":`#${h(a,t,n,o)}`);return d===e?e:d}function l(e,t=!1){if(t){let t=e.search(/\s/);return-1===t?e.length:t}let n=0,r=0,i=0;for(let t=0;t<e.length;t++){let s=e[t];if(/[\s,;"'<>\\`]/.test(s))return t;if("("===s)n++;else if("["===s)r++;else if("{"===s)i++;else{if(")"===s&&0===n--)return t;if("]"===s&&0===r--)return t;if("}"===s&&0===i--)return t}}return e.length}function a(t,n){let i=t;for(let t=0;t<4;t++){let t=e(i);if(t===i)break;i=t}for(let e of i.matchAll(/(?:^|[?&;#])([^?&;#=/\s]+)=/g))if(r(e[1],n))return!0;return!1}function u(t,n,i=0,c=""){let h=t.split(n.whole?/(&)/:rr),f=h.filter((e,t)=>t%2==0),p={path:c,pairs:f,depth:i};return f.map(t=>{let c=t.indexOf("=");if(-1===c)return!0===n.bare?.(t)?"[REDACTED]":t;let h=t.slice(0,c),f=t.slice(c+1);if(""===f)return t;let g=s(f),y=()=>`${h}=[REDACTED]`,b=n.before?.(h,f,p)??null;if(null!==b)return`${h}=${b}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(rr);for(let e=0;e<n.length;e+=2){let r=n[e].indexOf("=");r>0&&t.push(n[e].slice(0,r))}return t}(t):[h]).some(e=>r(e,n.kind))||!0===n.value?.(h,f,g)){if(!0!==n.spaced)return y();let e=l(f,n.form),t=f.slice(e);return`${h}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(i>=1&&(ir.test(g)||sr.test(g)))return"page"===n.kind||a(g,n.kind)?y():t;let m=function(e,t,n){return/^[a-z][a-z0-9+.-]*:\/\//i.test(e)?d(e,t,n+1):e.startsWith("/")?o(e,t,n+1):sr.test(e)?/[?#]/.test(e)?o(e,t,n+1):u(e,t,n+1):null}(g,n,i);return null!==m&&m!==g?n.whole?y():!0!==n.raw?`${h}=${encodeURIComponent(m)}`:f===g?`${h}=${m}`:encodeURIComponent(g)===f?`${h}=${encodeURIComponent(m)}`:y():e(g)!==g&&a(g,n.kind)?y():t}).map((e,t)=>(0===t?"":h[2*t-1])+e).join("")}function c(e,t){let n=e.split("/"),i=n.map(e=>e.split(";")[0]);return n.map((n,s)=>{if(!0===t.segment?.(n))return"[REDACTED]";let o=n.indexOf(";"),a=i[s],u=!0===t.head?.(e,a,s,i)?"[REDACTED]":a;return-1===o?u:u+n.slice(o).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?l(i,t.form):i.length;return s>0&&r(n,t.kind)?`;${n}=[REDACTED]${i.slice(s)}`:e})}).join("/")}function h(e,t,n,r=""){let i=e.indexOf("?");if(-1!==i){let s=e.slice(0,i);return`${c(s,t)}?${u(e.slice(i+1),t,n,`${r}/${s}`)}`}let s=e.indexOf("=");if(-1!==s&&!e.slice(0,s).includes("/"))return u(e,t,n,r);let o=-1===s?null:/^([^&;]*)([&;])/.exec(e);return null!==o?`${c(o[1],t)}${o[2]}${u(e.slice(o[0].length),t,n,`${r}/${o[1]}`)}`:c(e,t)}function d(e,t,n){if(t.whole||!0===t.raw||!or.test(e))return f(e,t,n);let r;try{r=new URL(e)}catch{return f(e,t,n)}let i=r.search.slice(1),s=r.hash.slice(1),o=c(r.pathname,t),l=r.search?u(i,t,n,r.pathname):"",a=r.hash?h(s,t,n,r.pathname):"";return o===r.pathname&&l===i&&a===s&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+o+(r.search?`?${l}`:"")+(r.hash?`#${a}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[i,s,l,a]=r,u=""===l?-1:a.lastIndexOf("@"),c=s+l+a.slice(u+1)+o(e.slice(i.length),t,n);return c===e?e:c}function p(e,t){let n,r=e.length-e.trimStart().length,i=e.length-e.trimEnd().length,s=e.slice(r,e.length-i);return/^(?:javascript|vbscript|data|blob):/i.test(s)?e:(n=/^[a-z][a-z0-9+.-]*:/i.test(s)?d(s,t,0):o(s,t,0),n===s?e:e.slice(0,r)+n+e.slice(e.length-i))}function g(e,t,n,r){let i=t,s=0,o=0;for(;i<e.length;i++){let t=e[i];if(ar.test(t)||r&&","===t&&(ur.lastIndex=i+1,ur.test(e)))break;if(n)if("("===t)s++;else if("["===t)o++;else if(")"===t||"]"===t){if(0===(")"===t?s:o))break;")"===t?s--:o--}}return function(e,t,n){let r=0,i=0;for(let s=t;s<n;s++){let t=e[s];"("===t?r++:")"===t?r--:"["===t?i++:"]"===t&&i--}for(;n>t;){let t=e[n-1];if(")"===t){if(r>=0)break;r++}else if("]"===t){if(i>=0)break;i++}else if(!".,;:!?".includes(t))break;n--}return n}(e,t,i)}function y(e){return{kind:"param",strict:e,whole:!0}}function b(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}function m(e,t){return`${b(0,e)}[Body not captured: ${hr[t]}]\n`}function v(e){return r(e,"key")}function w(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||46===e||95===e||37===e||43===e||45===e}function k(e){if(e.length<13||e.length>19)return!1;let t="4"===e[0]&&(13===e.length||16===e.length||19===e.length),n=/^(5[1-5]|2[2-7])/.test(e)&&16===e.length,r=/^3[47]/.test(e)&&15===e.length,i=/^6(?:011|5)/.test(e)&&16===e.length,s=/^(?:35|3[068])/.test(e)&&e.length>=14&&e.length<=19;return!!(t||n||r||i||s)&&function(e){let t=0,n=!1;for(let r=e.length-1;r>=0;r--){let i=e.charCodeAt(r)-48;if(i<0||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),t+=i,n=!n}return t%10==0}(e)}function x(e,t,n){for(let r of e.matchAll(t))""!==r[0]&&n.push([r.index,r.index+r[0].length])}function S(e,t){if(0===t.length)return e;t.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);let n="",r=0,[i,s,o]=t[0];for(let l=1;l<=t.length;l++){let a=t[l];void 0!==a&&a[0]<s?(a[1]>s&&(s=a[1]),o=void 0):(n+=e.slice(r,i)+(o??dr),r=s,void 0!==a&&([i,s,o]=a))}return n+e.slice(r)}function E(e,t=[]){if(!e)return e;let n=[];return function(e,t,n){x(e,wr,n),x(e,br,n),function(e,t){let n=0,r=e.indexOf("@");for(;-1!==r;){let i=Math.max(n,r-64),s=r;for(;s>i&&w(e.charCodeAt(s-1));)s--;if(s<r){yr.lastIndex=r+1;let i=yr.exec(e);if(i){n=r+1+i[0].length,t.push([s,n]),r=e.indexOf("@",n);continue}}r=e.indexOf("@",r+1)}}(e,n),x(e,mr,n),x(e,vr,n),x(e,kr,n),function(e,t){for(let n of e.matchAll(/\b(?:\d[ -]?){12,18}\d\b/g))k(n[0].replace(/[^0-9]/g,""))&&t.push([n.index,n.index+n[0].length])}(e,n);for(let r of t)x(e,r,n)}(e,t,n),S(e,n)}function A(e){return e&&S(e,I(e))}function I(e){let t=[];return xr.test(e)&&(x(e,wr,t),x(e,br,t)),t}function T(e,t=Sr){let n=e.replace($r,e=>function(e){let t=e.search(/[?#]/),n=e.indexOf(";");if(t<0&&n<0)return!1;let r=e.indexOf("=");if(/[{}<>"'\\^`|]/.test(r<0?e:e.slice(0,r)))return!1;let i=Ir.exec(e);return t>=0&&(!!i&&/[?#]/.test(e.slice(i[0].length))||(!t||!/[^\w.~%/-]/.test(e.slice(0,t)))&&r>t+1&&!/[&#]/.test(e.slice(t+1,r)))||n>0&&!!i&&e[0]<="/"&&(r<0||r>n)}(Tr.exec(e)[0])?p(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];for(lr.lastIndex=0;;){let r=lr.lastIndex,i=lr.exec(e);if(null===i)break;let s=i.index+(i.groups?.attr?.length??-(i[1]?.length??0));if(s<r){let t=e.slice(r,i.index).search(/[a-z]/i);if(t<0)continue;s=r+t}let o=i.groups?.attr??"";cr.lastIndex=s;let l=""!==o&&cr.test(e);l&&(s=cr.lastIndex);let a=g(e,s,!/["']$/.test(o)||/^url\(/i.test(o)||l,t);"{"===e[a]&&a>s&&"$"===e[a-1]&&a--,a>s&&n.push([s,a]),lr.lastIndex=Math.max(a,i.index+i[0].length,s+1)}return n}(e,!0===t.list)){let s=e.slice(r,i),o=p(s,t);o!==s&&n.push([r,i,o])}return n}(n,t);if(0===r.length)return $(n,t);let i="",s=0;for(let[e,t,o]of r)i+=n.slice(s,e)+o,s=t;return $(i+n.slice(s),t)}function $(e,t){return/:(?:\\\/|\\u002[fF])/.test(e)?e.replace(Cr,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=_r.exec(e.slice(t,t+6));n+=null===i?e[t]:"/",t+=null===i?1:i[0].length}r.push(e.length);let i=p(n,t);if(i===n)return e;let s=0;for(;s<i.length&&i[s]===n[s];)s++;let o=0;for(;o<i.length-s&&o<n.length-s&&i[i.length-1-o]===n[n.length-1-o];)o++;let l=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[s])+i.slice(s,i.length-o).replace(/\//g,l)+e.slice(r[n.length-o])}):e}function C(e){let t=T(e,Er),n=[];return function(e,t,n="text"){let i="code"===n?Dr:"string"===n?Nr:"header"===n?zr:Or,s="text"===n&&/<script/i.test(e)?function(e){let t=[],n=/<script\b/gi,r=/<\/script\s*>/gi;for(let i=n.exec(e);null!==i;i=n.exec(e)){let s=e.indexOf(">",i.index);if(-1===s)break;r.lastIndex=s+1;let o=r.exec(e),l=null===o?e.length:o.index;t.push([s+1,l]),n.lastIndex=l}return t}(e):[],o=0;i.lastIndex=0;for(let l=i.exec(e);null!==l;l=i.exec(e)){if(!r(l[2],"param"))continue;if(s.length>0&&(/^[ \t\r\f\v>]$/.test(l[1])||"#"===l[1]&&(!/[\w/%~-]/.test(e[l.index-1]??"")||e.startsWith("*/",l.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,l.index-9),l.index))))){for(;o<s.length&&s[o][1]<=l.index;)o++;if(o<s.length&&s[o][0]<=l.index)continue}let a=l.index+l[0].length;Lr.lastIndex=a;let u=Lr.exec(e);if(null===u)continue;"string"===n&&(jr.lastIndex=a,u=jr.exec(e)??u);let c=a+u[0].length;t.push([a,c]),i.lastIndex=c}}(t,n,"header"),S(t,n)}function _(e,t){return e.length>t?e.slice(0,t)+Rr:e}function R(e){return e+Rr}function O(e){return 47===e||38===e||59===e||63===e||35===e}function D(e,t){let n=e.length,r=0;for(;r<=n;){let i,s=r,o=0;for(;s<n&&61!==(o=e.charCodeAt(s))&&!O(o);)s++;i=s<n&&61===o?s>r?t(r,s):s+1:s;for(;i<n&&!O(e.charCodeAt(i));)i++;if(i>=n)return;r=i+1}}function N(e,t,n){let r=t;for(;r<e.length;r++){let t=e.charCodeAt(r);if(38===t||59===t||35===t||!n&&63===t)break}return r}function z(e){let t=[];return D(e,(n,r)=>{let i=N(e,r+1,!0);return t.push([e.slice(n,r),e.slice(r+1,i)]),i}),t}function L(e,n,r=!1){let s="",o=0;return D(e,(l,a)=>{let u=t(e.slice(l,a),"page"),c=a+1;if(!(i(u,"page")||r&&G(u,e.slice(c,c+256))))return c;let h=N(e,c,n);return s+=e.slice(o,c)+"[REDACTED]",o=h,h}),s+e.slice(o)}function j(e,t){let n=e.indexOf("?");return-1===n?L(e,!1):`${L(e.slice(0,n),!1)}?${L(e.slice(n+1),!0,t)}`}function B(e){return!(e.length<8)&&Number(/[a-z]/.test(e))+Number(/[A-Z]/.test(e))+Number(/\d/.test(e))>=2&&!/^[A-Z][a-z]+$/.test(e)&&!/^[A-Za-z][a-z]*(?:[-_](?:[A-Za-z][a-z]*|\d+))+$/.test(e)&&!/^[A-Za-z][a-z]{2,}(?:[A-Z][a-z]{2,})+$/.test(e)}function U(t,n=!0){return(n?/^(?:\/|[a-z][a-z\d+.-]*:\/\/)/i:/^[a-z][a-z\d+.-]*:\/\//i).test(e(t))}function P(t){return e(t).replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[\s\-_.]+/).filter(e=>""!==e).map(e=>e.toLowerCase())}function q(e,t){let n=P(e),r=n.join("");if(Kr.has(r))return 2;Hr.has(r)&&(n=[r]);let i=0;for(let e of n)if(Mr.has(e))i=2;else if(Hr.has(e))i||=1;else if(!Jr.has(e))return 0;return 1===i&&(n.includes("accept")||n.includes("confirm")&&(Vr(n)||Vr(P(t))))?2:i}function M(e){return/^(?:\d+|[\da-f]{24}|[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})$/i.test(e)||/^(?:[0-7][\dA-HJKMNP-TV-Z]{25}|c[a-z\d]{24})$/.test(e)}function K(e){if(e.length%4==1||!/^[\w-]+$/.test(e))return!1;try{return/^[\x20-\x7e]+$/.test(atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)))}catch{return!1}}function Z(e){return e.length<=4||F(e)}function F(e){return P(e).every(e=>e.startsWith("confirm")||"accept"===e||"edit"===e)}function H(e,t){let n=e[t]??"";return Zr.has(P(e[t-1]??"").join(""))&&!F(n)&&!Fr.has(n.toLowerCase())&&!/\.[A-Za-z][A-Za-z\d]{0,4}$/.test(n)&&!(M(n)&&""!==(e[t+1]??""))}function W(e){return P(e).some(e=>e.startsWith("invit"))}function J(e,t){return/^(?:rp|resetpass)$/.test(t)||e.some(e=>e.some(e=>0!==q(e,"")))}function V(e){return e.find(([e])=>t(e,"page").includes("action"))?.[1]??""}function G(e,t){return e.some(e=>/^(?:key|t|hash|code)$/.test(e))&&!U(t,!1)}function Q(e){let t=P(e);return t.length>0&&t.every(e=>"accept"===e||"join"===e)}function X(e,t=!1){if("string"!=typeof e||!/^\/[^?#]*$/.test(e))return null;let n=e.split("/").filter(e=>""!==e),r=e=>/^:\w+$/.test(e);return n.every(e=>"*"===e||r(e)||!/[:*]/.test(e))&&n.some(e=>t?"*"!==e&&!r(e):r(e))?n:null}function Y(t,n){return"*"===t||":"===t[0]||e(n).toLowerCase()===e(t).toLowerCase()}function ee(e,t){let n=[];return e.every((e,r)=>{let i=t[r];return void 0!==i&&(":"===e[0]&&n.push([i,t[r-1]??"",r]),Y(e,i))})?n:null}function te(e,t){return Xr.keep.some(n=>t<n.length&&"*"!==n[t]&&":"!==n[t][0]&&n.slice(0,t+1).every((t,n)=>Y(t,e[n])))}function ne(e){let t=!1,n=new Set;for(let r of Xr.keep){let i=ee(r,e);if(null!==i){0===i.length&&(t||=r.length===e.length&&!r.includes("*"));for(let[e]of i)n.add(e)}}let r=[];for(let t of Xr.secret)for(let[n,i,s]of ee(t,e)??[])!te(e,s)&&re(n)&&r.push([n,i]);return{secret:r,kept:n,own:t}}function re(t){let n=t;for(let t=0;t<=ti;t++){let t=e(n);if(t===n)return/[\p{L}\p{N}]/u.test(n);n=t}return!1}function ie(e){let t=e.indexOf("#"),n=[e.slice(0,-1===t?e.length:t).replace(/^[a-z][a-z\d+.-]*:\/\/[^/?#]*/i,"")],r=-1===t?"":e.slice(t+1);return Pr.test(r)&&n.push(r.replace(/^!/,"")),n.map(e=>e.split(/[?#]/)[0].split("/").map(e=>e.split(";")[0]))}function se(t,n,r){let i=t.get(n);void 0===i&&t.set(n,i=new Set),i.add(function(t){return ce(e(t))}(r))}function oe(n,r,s,o,l,a){let u=ie(n);for(let t of u){let n=t.length,{secret:i,kept:u,own:c}=ne(t.filter(e=>""!==e));for(let[e,t]of i)s.add(e),se(o,e,t),0===r&&se(l,e,t);for(let r=0;r<n;r++){let i=q(t[r],t[r-1]??"");if(0===i)continue;let l=W(t[r]),h=t[r+1];H(t,r+1)&&!u.has(h)&&!c&&(s.add(h),B(e(h))||(o.has(h)||a.add(h),se(o,h,t[r])));let d="",f="",p=r+1;for(;p<n;p++){let e=t[p],n=t[p+1]??"";if(M(e)||(2===i||n.length>=16&&B(n))&&K(e)){f=e;continue}if(e.length>=(2===i?16:20)&&B(e)){d=e;break}if(l&&B(e)){f=e;continue}let r=q(e,t[p-1]);if(r>i)i=r,f="";else{if(""!==f&&Q(e)){d=f;break}if(!Z(e))break}}""===d&&2===i&&p===n&&(d=f),""!==d&&!u.has(d)&&!c&&s.add(d),r=""===d?p-1:p}}let c=z(n).map(([e,n])=>[t(e,"page"),n]),h=e=>c.find(([t])=>t.includes(e))?.[1]??"",d=J(u,h("action")),f=""!==h("organization"),p=h("code"),g=h("state"),y=!U(p)&&(p.length>=10&&B(g)&&!/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/.test(g)&&!U(g)||p.length>=20&&B(p)&&u.some(e=>e.some(e=>/callback|oauth/i.test(e)||[...P(e),P(e).join("")].some(e=>Gr.has(e)))));for(let[t,n]of c){let u=y&&(t.includes("code")||t.includes("state"));if((u||i(t,"page")||d&&G(t,n)||f&&t.includes("invitation")||t.includes("ticket")&&/^(?:ST|PT|TGT)-/.test(n))&&!U(n,u)){s.add(n);continue}let c=e(n);r<2&&(/[?#=]/.test(c)||U(c))&&oe(c,r+1,s,o,l,a)}}function le(e){try{return new URL(e).origin}catch{return""}}function ae(e){return ue(e)[0]}function ue(t){if(ni[0]===t)return[ni[1],ni[2],ni[3]];let n=new Set,r=new Map,i=new Map,s=new Set,o=t.indexOf("#"),l=-1===o?t:t.slice(0,o),a=-1===o?"":t.slice(o+1),u=Pr.test(a),c=l.length+(u?a.length:0)>65536;if(c)for(let e of ie(t))for(let[t,s]of ne(e.filter(e=>""!==e)).secret)n.add(t),se(r,t,s),se(i,t,s);else oe(t,0,n,r,i,s);let h=c,d=le(t),f=new Set,p=[],g=0,y=(e,t)=>null!==t&&!0===i.get(e)?.has(t)||(g<32?(g++,!0):(h=!0,!1));for(let t of[...i.keys(),...[...n].filter(e=>!i.has(e))]){let n=r.get(t),i=void 0===n?void 0:[...n].filter(e=>y(t,e));if(0===i?.length||void 0===i&&!y(t,null))break;if(void 0!==i){let n=e(t),r=n.length>=6&&!s.has(t),o=[];for(let e=t,n=0;n<ci;n++)o.push(e=encodeURIComponent(e));for(let e of new Set([t,n,...o,encodeURIComponent(n),n.replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)])){if(""===e)continue;let t=!d.includes(e),n=t&&B(e)&&!U(e,!1);if(r&&n&&p.push({kind:0,value:e}),r&&t)p.push({kind:1,value:e});else for(let t of i)p.push({kind:2,value:e,before:t})}continue}f.add(t);for(let e=t.lastIndexOf("/"),n=0;e>0&&n<4;e=t.lastIndexOf("/",e-1),n++)f.add(t.slice(0,e));f.add(encodeURIComponent(t));for(let e of[t,t.replace(/\+/g," ")])try{let t=decodeURIComponent(e);f.add(t),f.add(encodeURIComponent(t));for(let e=t.lastIndexOf("/"),n=0;e>0&&n<4;e=t.lastIndexOf("/",e-1),n++)f.add(t.slice(0,e))}catch{}}for(let e of f)B(e)&&!U(e,!1)&&!d.includes(e)&&p.push({kind:0,value:e});return p.sort((e,t)=>t.value.length-e.value.length),ni=[t,p,h,Oe(p)],[p,h,ni[3]]}function ce(e){if(!/[A-Z]/.test(e))return e;if(!/[^\0-\x7f]/.test(e))return e.toLowerCase();let t=new Uint16Array(Math.min(e.length,ri)),n="";for(let r=0;r<e.length;r+=ri){let i=Math.min(ri,e.length-r);for(let n=0;n<i;n++){let i=e.charCodeAt(r+n);t[n]=i>=65&&i<=90?i+32:i}n+=String.fromCharCode(...t.subarray(0,i))}return n}function he(e,t,n){if(!t.length)return;let r=new Int32Array(t.length);for(let e=1,n=0;e<t.length;e++){for(;n>0&&t.charCodeAt(e)!==t.charCodeAt(n);)n=r[n-1];t.charCodeAt(e)===t.charCodeAt(n)&&n++,r[e]=n}for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=r[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(n(i-s+1),s=r[s-1])}}function de(e,t){let n=[];return he(e,t,e=>n.push(e)),n}function fe(e){let t=ii;ii=1/0;try{return e()}finally{ii=t}}function pe(e){if(si+e>ii)throw new mi(si+e,ii)}function ge(e,t,n="[redacted]"){if(e.includes(t))return!0;if(!/[[\]]/.test(t))return!1;let r=t.split(n),i=r[0],s=i.lastIndexOf("[");s>=0&&n.startsWith(i.slice(s))&&(r[0]=i.slice(0,s));let o=r[r.length-1],l=o.indexOf("]");return l>=0&&n.endsWith(o.slice(0,l+1))&&(r[r.length-1]=o.slice(l+1)),r.every(t=>e.includes(t))}function ye(e,t){let n=e=>e.length>oi&&/[[\]]/.test(e);if(e.plain.some(e=>n(e)&&ge(t,e,"[REDACTED]")))return!0;let r=ce(t);return[...e.bounded,...e.words.map(([e])=>e)].some(e=>n(e)&&ge(r,e))}function be(e,t,n,r,i=!1){let s=[],o=0,l=oi-n.length;for(let a of de(t,n))a<o||!r(a,a+n.length)||(s.push(a),o=a+n.length,i&&pe(e.length+s.length*l));if(0===s.length)return[e,()=>t];let a,u=(e,t)=>{let r=[],i=0;for(let t of s)r.push(e.slice(i,t)),i=t+n.length;return r.push(e.slice(i)),r.join(t)};return[u(e,"[REDACTED]"),()=>a??=u(t,"[redacted]")]}function me(e,t,n){return(0===t||!li.test(e[t-1])||ai.test(e.slice(Math.max(0,t-16),t)))&&(n===e.length||!li.test(e[n]))}function ve(e,t,n){return ui.find(([r,i])=>i<=n&&t>=r.length&&e.startsWith(r,t-r.length))}function we(e,t,n){if(";"===e[t])return!0;for(let r=1;r<=n;r++)if(e.startsWith(`%${"25".repeat(r-1)}3b`,t))return!0;return!1}function ke(t,n,r,i){if(r!==t.length&&/[a-z0-9_~-]/.test(t[r]))return!1;let s=ve(t,n,3);if(void 0===s)return!1;let[o,l]=s,a=function(e,t,n){let r=t;for(;;){let t=ve(e,r,n);if(void 0===t)return r;r-=t[0].length}}(t,n-o.length,l);return(a===n-o.length||!function(e,t){return 0===t||hi.test(e[t-1])||di.test(e[t-1])||/(?::|%(?:25)*3a)$/.test(e.slice(Math.max(0,t-9),t))}(t,a))&&(!!i[1].has("")||0!==i[3]&&function(t,n,r,i){let s=n;for(;s>0&&!hi.test(t[s-1])&&void 0===ve(t,s,r);)s--;let o=n,l="",a=!1;for(let u=n;u>=s;u--){if(u<n&&we(t,u,r)&&(o=u,l="",a=!1),a||u!==s&&!di.test(t[u-1]))continue;let c=t.slice(u,o);for(let t=0;t<=r;t++)c=e(c);if(l=ce(c)+l,o=u,l.length>i[3])a=!0;else if(i[2].has(l.length)&&i[1].has(l))return!0}return!1}(t,a,l,i))}function xe(e,t){if(!Se(e,t))return e;if(/^[ \t\n\r]*[{[]/.test(e)){let n=Ie(e,t);if(null!==n)return n}return Re(e,t)}function Se(e,t){return!!Ee(e,t)||e.includes("\\")&&Ee(Ae(e),t)}function Ee(e,t){if(t.plain.some(t=>e.includes(t)))return!0;if(0===t.bounded.length&&0===t.words.length)return!1;let n=ce(e);return t.bounded.some(e=>n.includes(e))||t.words.some(([e])=>n.includes(e))}function Ae(e){return e.replace(/\\+u([0-9a-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\+\//g,"/")}function Ie(e,t){try{JSON.parse(e)}catch{return null}let n=function(e,t){let n=ce(e),r=e.includes("\\")?ce(Ae(e)):n,i=e=>n.includes(ce(e))||n.includes(ce(function(e){return JSON.stringify(e).slice(1,-1).replace(/[\u0080-\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(e)))||r.includes(ce(e));return{...t,plain:t.plain.filter(i),bounded:t.bounded.filter(i),words:t.words.filter(([e])=>i(e))}}(e,t),r=[],i=[];for(let t of e.matchAll(pi)){let n=t[0];"{"===n?(i.push(r.length),r.push(new Set)):"}"===n?i.pop():'"'===n[0]&&i.length>0&&(gi.lastIndex=t.index+n.length,gi.test(e)&&r[i[i.length-1]].add(JSON.parse(n)))}let s=si,o="",l=0,a=0,u=[];for(let t of e.matchAll(pi)){let i=t[0];if("{"===i){u.push(new Set(r[a++]));continue}if("}"===i){u.pop();continue}let c=i;if('"'===i[0]){let r,a=JSON.parse(i);si=s+o.length+(t.index-l);try{r=xe(a,n)}finally{si=s}gi.lastIndex=t.index+i.length;let h=gi.test(e)?u[u.length-1]:void 0;if(void 0!==h&&r!==a){let e=r;for(let t=2;h.has(r);t++)r=`${e}#${t}`;h.add(r)}r!==a&&(c=JSON.stringify(r))}else fe(()=>Re(i,n))!==i&&(c='"[REDACTED]"');c!==i&&(o+=e.slice(l,t.index)+c,l=t.index+i.length,pe(o.length))}return o+e.slice(l)}function Te(e){let t="",n=[],r=0;for(let i of e.matchAll(/\\+u([0-9a-fA-F]{4})|\\+\//g))t+=e.slice(r,i.index),n.push(t.length,i.index+i[0].length),t+=void 0===i[1]?"/":String.fromCharCode(parseInt(i[1],16)),r=i.index+i[0].length;return[t+e.slice(r),n]}function $e(e,t){let n=0,r=e.length/2;for(;n<r;){let i=n+r>>1;e[2*i]<t?n=i+1:r=i}if(0===n)return t;let i=2*(n-1);return e[i+1]+(t-e[i]-1)}function Ce(e,t,n=!1){let r=[],i=[],s=(e,t,s)=>{let o=new Int32Array(e.length),l=0,a=t>oi,u=-1,c=-1;for(let r of e)!n&&s(r)?o[l++]=r:a&&(r<c||(u>=0&&i.push(u,c),u=r),c=r+t);u>=0&&i.push(u,c),l>0&&r.push([o.subarray(0,l),t])};for(let n of t.plain)s(de(e,n),n.length,()=>!0);let o=ce(e);for(let n of t.bounded)s(de(o,n),n.length,t=>me(e,t,t+n.length));for(let e of t.words)s(de(o,e[0]),e[0].length,t=>ke(o,t,t+e[0].length,e));return{lists:r,slack:_e(i)}}function _e(e){if(0===e.length)return 0;let t=Array.from({length:e.length/2},(e,t)=>t).sort((t,n)=>e[2*t]-e[2*n]),n=0,r=e[2*t[0]],i=e[2*t[0]+1],s=()=>{i-r>oi&&(n+=i-r-oi)};for(let n of t){let t=e[2*n],o=e[2*n+1];t<i?o>i&&(i=o):(s(),r=t,i=o)}return s(),n}function Re(e,t){e=function(e,t){let n=ii!==1/0&&si+oi*e.length>ii,[r,i]=e.includes("\\")?Te(e):[e,[]],s=Ce(r,t),{lists:o}=s;if(0===o.length)return e;let l=n&&!ye(t,e),a=s.slack+(l&&i.length>0?Ce(e,t,!0).slack:0),u=new Int32Array(o.length),c=e=>o[e][0][u[e]],h=[],d=(e,t)=>{let n=h[e];h[e]=h[t],h[t]=n},f=e=>{for(;;){let t=2*e+1,n=e;if(t<h.length&&c(h[t])<c(h[n])&&(n=t),t+1<h.length&&c(h[t+1])<c(h[n])&&(n=t+1),n===e)return;d(e,n),e=n}};for(let e=0;e<o.length;e++)h.push(e);for(let e=(h.length>>1)-1;e>=0;e--)f(e);let p=[],g=0,y=!1,b=0;for(;h.length>0;){let t=h[0],n=c(t),r=$e(i,n),s=$e(i,n+o[t][1]);if(u[t]=u[t]+1,u[t]>=o[t][0].length&&(h[0]=h[h.length-1],h.pop()),h.length>0&&f(0),!(s<=g)){if(y&&r<=g){g=s;continue}b+=r-g+oi,l&&pe(b-a),p.push(e.slice(g,r),"[REDACTED]"),g=s,y=!0}}return l&&pe(b+e.length-g-a),p.push(e.slice(g)),p.join("")}(e,t);for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n=ce(e),r=()=>n,i=[...t.bounded,...t.words.map(([e])=>e)],s=new Array(i.length);for(let e=i.length-1,t=!0;e>=0;e--){let r=i[e];t=t&&(r.length<=oi||!ge(n,r)),s[e]=t}let o=0;for(let n of t.bounded){if(r().includes(n)){let t=e;[e,r]=be(e,r(),n,(e,n)=>me(t,e,n),s[o])}o++}for(let n of t.words){if(r().includes(n[0])){let t=r();[e,r]=be(e,t,n[0],(e,r)=>ke(t,e,r,n),s[o])}o++}return e}function Oe(e){if(0===e.length)return null;let t=(e,t)=>t.length-e.length,n=[],r=[],i=new Map;for(let t of e){let e=ce(t.value);if(0===t.kind)n.push(t.value);else if(1===t.kind)r.push(e);else{let n=i.get(e);void 0===n&&i.set(e,n=new Set),n.add(t.before.length>fi?"":t.before)}}n.sort(t),r.sort(t);let s=[...i].map(([e,t])=>{let n=new Set([...t].filter(e=>""!==e).map(e=>e.length));return[e,t,n,0===n.size?0:Math.max(...n)]}).sort((e,t)=>t[0].length-e[0].length);return{json:n.map(e=>JSON.stringify(e).slice(1,-1)),jsonLower:[...r,...s.flatMap(([e])=>ui.map(([t])=>t+e))].map(e=>JSON.stringify(e).slice(1,-1)),plain:n,bounded:r,words:s}}function De(e,t){let n=0;return he(e,t,()=>n++),n}function Ne(e,t,n){if(ii===1/0||si+e.length<=ii||"body"===t||"text"===t&&/^[ \t\n\r]*[{[]/.test(e)||"css"===t&&e.includes("\\"))return;if(!e.includes("\\")&&function(e,t){let n=e=>e.length>oi;if(e.plain.some(e=>n(e)&&ge(t,e,"[REDACTED]"))||e.plain.some(e=>t.includes(e)))return!1;let r=[...e.bounded,...e.words.map(([e])=>e)],i=r.filter(n),s=r.filter(e=>/[^a-z0-9]/.test(e));if(0===i.length&&0===s.length)return!0;let o=ce(t);return!i.some(e=>ge(o,e))&&!s.some(e=>o.includes(e))}(n,e)){pe(e.length);return}let r=function(e,t){if(ye(t,e))return null;let n=e.includes("\\"),r=n?Te(e)[0]:e,i=n?[r,e]:[r],s=r.length;for(let e of i){let n=ce(e);for(let n of t.plain)s-=De(e,n)*n.length;for(let e of t.bounded)s-=De(n,e)*e.length;for(let[e]of t.words)s-=De(n,e)*e.length}return s}(e,n);null!==r&&pe(r)}function ze(e,t,n="custom",r,i){function s(e,t){ii=i??1/0,si=e;try{return t()}finally{ii=1/0,si=0}}if("dom"===n&&r?.observe(e),null===t)return e;let o;try{o=JSON.stringify(e)}catch{return e}let l=o;if(void 0===l||!function(e,t){if(t.json.some(t=>e.includes(t)))return!0;let n=ce(e);if(t.jsonLower.some(e=>n.includes(e)))return!0;if(!e.includes("\\"))return!1;let r=Ae(e);if(t.plain.some(e=>r.includes(e)))return!0;let i=ce(r);return t.bounded.some(e=>i.includes(e))||t.words.some(([e])=>i.includes(e))}(l,t))return e;let a=JSON.parse(l);if("string"==typeof a)return s(0,()=>(Ne(a,"text",t),xe(a,t)));let u="dom"===n&&void 0!==r?r.recordsIn(a):new Set,c="dom"===n&&Le(a)&&3===a.type&&Le(a.data)&&13===a.data.source,h=(e,t,r,i,s)=>"network"===n?!s||"method"!==t&&"type"!==t?!s||"requestBody"!==t&&"responseBody"!==t?"text":"body":"keep":"dom"!==n?"text":"tagName"===t||c&&"property"===t||i&&yi.has(t)?"keep":r||i&&"style"===t||"_cssText"===t||"rule"===t||("replace"===t||"replaceSync"===t)&&8===e.source||c&&"value"===t||("textContent"===t||"value"===t)&&u.has(e)?"css":"text",d=new Map,f=![...t.plain,...t.bounded,...t.words.map(([e])=>e)].some(e=>e.includes("#")),p=0,g=e=>{if(p+=e.length,void 0!==i&&p>i)throw new mi(p,i);return e},y=(e,n)=>{if("keep"===n)return e;if("text"===n&&f){let t=e.indexOf("#");if(t>0&&!/^[ \t\n\r]*[{[]/.test(e))return y(e.slice(0,t),n)+y(e.slice(t),n)}Ne(e,n,t);let r=function(e,t){let n=`${e}\0${t}`;if(n.length<=16383)return n;let r=2166136261;for(let e=0;e<t.length;e++)r^=t.charCodeAt(e),r=Math.imul(r,16777619);return`${e}\x01${t.length}\0${r>>>0}`}(n,e),i=d.get(r),s=i?.find(([t])=>t===e);if(void 0!==s)return s[1];let o="css"===n?function(e,t){if(!Se(e,t))return e;for(let n of t.plain)e.includes(n)&&(e=e.split(n).join("[REDACTED]"));let n="",r=0;return function(e,t){let n=e.length,r={},i=(t,i)=>{let s=r[i]??=new Int32Array(n+2).fill(-2),o=[],l=t,a=-1;for(;!(l>=n);){if(-2!==s[l]){a=s[l];break}o.push(l);let t=e[l];if(t===i){a=l+1;break}l+="\\"===t?2:1}for(let e of o)s[e]=a;return a},s=-1,o=t=>{for(s<t&&(s=t);s<n&&!")\"'".includes(e[s]);)s++;return s},l=t=>{let r=t;for(;r<n&&/\s/.test(e[r]);)r++;return r},a=0;for(;a<n;){let r=e[a];if("/"===r&&"*"===e[a+1]){let r=e.indexOf("*/",a+2),i=r<0?n:r+2;t(a,i),a=i;continue}if(("u"===r||"U"===r)&&"url("===e.slice(a,a+4).toLowerCase()){let n=l(a+4),r=e[n],s=-1;if('"'===r||"'"===r){let t=i(n+1,r);if(t>=0){let n=l(t);")"===e[n]&&(s=n+1)}}else{let t=o(a+4);")"===e[t]&&(s=t+1)}if(s>=0){t(a,s),a=s;continue}}if('"'===r||"'"===r){let e=i(a+1,r);if(e>=0){t(a,e),a=e;continue}}a++}}(e,(i,s)=>{let o=e.slice(i,s);n+=e.slice(r,i)+(o.startsWith("/*")?function(e,t){let n=e.length>=4&&e.endsWith("*/");return`/*${Re(e.slice(2,n?-2:void 0),t)}${n?"*/":""}`}(o,t):Re(o,t)),pe(n.length),r=s}),n+e.slice(r)}(e,t):"body"===n?function(e,t){return Se(e,t)?Ie(e,t)??Re(e,t):e}(e,t):xe(e,t);return void 0!==i?i.push([e,o]):d.set(r,[[e,o]]),o},b=[[a,!1,!1,"custom"===n,!0]];for(;b.length>0;){let[e,r,i,o,l]=b.pop();if(Array.isArray(e))for(let t=0;t<e.length;t++){let i=e[t];"string"==typeof i?e[t]=g(s(p,()=>y(i,r?"css":"text"))):null!==i&&"object"==typeof i&&b.push([i,r,!1,"custom"===n,!1])}else if(Le(e))for(let a of Object.keys(e)){let u=e[a];if("dom"===n&&o&&!a.startsWith("rr_")&&"_cssText"!==a&&t.plain.some(e=>a.includes(e))){delete e[a];continue}let c=h(e,a,r,i,l);if("string"==typeof u)e[a]=g(s(p,()=>y(u,c)));else if(null!==u&&"object"==typeof u){let e="dom"===n&&"attributes"===a;b.push([u,"css"===c,e,"custom"===n||e||"dom"===n&&i&&"style"===a||"network"===n&&l&&("requestHeaders"===a||"responseHeaders"===a),!1])}if(!o||a.startsWith("rr_")||"_cssText"===a)continue;let d=a;for(let e of t.plain)d.includes(e)&&(d=d.split(e).join("[REDACTED]"));if(d===a)continue;let f=e[a];delete e[a];let m=d;for(let t=2;Object.prototype.hasOwnProperty.call(e,m);t++)m=`${d}#${t}`;e[m]=f}}return a}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function je(e){if(e)for(let[t,n]of Object.entries(e))if("content-type"===t.toLowerCase())return n}function Be(e){return t(e,"page").join("")}function Ue(e){return!!xi.test(e)||!(e.length<32||ki.test(e)||Si.test(e))&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[0-9]/.test(e)&&/[A-Za-z]/.test(e)}function Pe(e){return e.split("/").some(e=>{if(/callback|oauth/i.test(e))return!0;let t=P(e);return[...t,t.join("")].some(e=>Gr.has(e))})}function qe(e,t){let n=new Map;for(let t of e){let e=t.indexOf("=");if(-1===e)continue;let r=Be(s(t.slice(0,e)));if(!Ai.has(r))continue;let i=n.get(r),o=s(t.slice(e+1));void 0===i?n.set(r,[o]):i.push(o)}let r=e=>n.get(e)??[],i=new Set,o=r("code").filter(e=>""!==e&&!U(e)),l=r("state").filter(e=>""!==e&&!function(e){return!!fr.test(e)&&(e.length<=16||pr.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!U(e));return o.length>0&&(t||l.length>0)&&(i.add("code"),i.add("state"),i.add("sessionstate")),(r("accesstoken").length>0||r("idtoken").length>0||r("refreshtoken").length>0)&&(i.add("state"),i.add("sessionstate")),i}function Me(e,t,n){let r=$i;$i=e;try{return We(t,n)}finally{$i=r}}function Ke(t,n,r,i,s=!1){if(!("content"===t?Un?.(t,r,s,i):Di.test(t)||Un?.(t,r,s)||_i.has(t)&&Ni.test(e(n))))return/[^*\s]/.test(n)?"":n}function Ze(e){return Li.test(e)||Ti&&Ci.test(e)}function Fe(e){return(n,r,i)=>{let o=function(e){let t=ji.get(e.pairs);return void 0===t&&(t=[qe([...e.pairs],Pe(e.path))],ji.set(e.pairs,t)),t}(i);if(o[0].has(Be(s(n)))||G(t(n,"page"),r)&&(o[1]??=function(e,t){let n=t.map(e=>{let t=e.indexOf("=");return-1===t?[e,""]:[e.slice(0,t),e.slice(t+1)]});return J([e.split("/").map(e=>e.split(";")[0])],V(n))}(i.path,[...i.pairs])))return"[REDACTED]";let l=e?0:function(e){let t=0,n=null;for(let r of Ii)if(!(r.length<=t||"/"!==e.charAt(r.length))){if(e.startsWith(r)){t=r.length;continue}null===n&&(n=ce(e)),n.startsWith(r)&&(t=r.length)}return t}(r);if(l>0){let e=s(r.slice(l));if(!Ei.test(e)||E(e)===e)return`[REDACTED]${r.slice(l)}`}return null}}function He(n){let r,i=null;return{kind:"page",strict:n,whole:!1,before:Fe(n),value:(n,r,i)=>{let s=t(n,"key");return!(!/[[\]]/.test(e(n))&&/ids?$/.test(s[0]??""))&&(function(e){return!!Ue(e)||!/^(?:https?:|\/)[^\s"<>\\^`{|}[\]]*$/i.test(e)&&function(e){return e.split(/[^A-Za-z0-9_\-.~+/=]+/)}(e).some(Ue)}(i)||Ue(r))||Ei.test(i)&&E(i)!==i},bare:e=>Ue(e)||Ue(s(e)),segment:e=>xi.test(e),head:(t,n,s,o)=>{if(!Ti)return!1;o!==r&&(r=o,i=Ci.test(t)?function(e){let t=new Set,n=e.startsWith("/")?e:`/${e}`;for(let e of ae(`https://link.invalid${n}`))t.add(e.value);return t}(t):null);return null!==i&&i.has(n)&&(function(t){let n=e(t);return!!ki.test(n)||n.split(/[-_.~]+/).some(B)}(n)||$i&&H(o,s))}}}function We(e,t){return Ze(e)?p(e,t?Ui:Bi):e}function Je(e,t){return Pi.lastIndex=t,Pi.test(e)?Pi.lastIndex:t}function Ve(e){return e.replace(/\\(?:([0-9A-Fa-f]{1,6})[ \t\n]?|([\s\S]))/g,(e,t,n)=>{if(void 0===t)return"\n"===n?"":n??"";let r=parseInt(t,16);return 0===r||r>1114111||r>=55296&&r<=57343?"\ufffd":String.fromCodePoint(r)})}function Ge(e,t){if(!/url\(|["'\\]/i.test(e)||!Ze(e)&&!e.includes("\\"))return e;let n=e.length,r=/[\t\n\f\r ]/,i="",s=0,o=(n,r,o)=>{let l=e.slice(n,r),a=l.includes("\\")?Ve(l):l,u=We(a,t);u!==a&&(i+=e.slice(s,n)+(a===l?u:function(e,t){return e.replace(t?/[\\"'\n]/g:/[\\"'()\s]/g,e=>/\s/.test(e)?`\\${e.charCodeAt(0).toString(16)} `:`\\${e}`)}(u,o)),s=r)},l=0;for(;l<n;){let t=e[l];if("/"===t&&"*"===e[l+1]){let t=e.indexOf("*/",l+2);l=-1===t?n:t+2}else if(e.startsWith("\x3c!--",l))l+=4;else if('"'===t||"'"===t){let r=l+1;for(;r<n&&e[r]!==t&&"\n"!==e[r];)r+="\\"===e[r]?2:1;r=Math.min(r,n),o(l+1,r,!0),l=r+1}else{let t=Je(e,l);if(t===l){l++;continue}if("("!==e[t]||"url"!==Ve(e.slice(l,t)).toLowerCase()){l=t;continue}let i=t+1;for(;i<n&&r.test(e[i]);)i++;if('"'===e[i]||"'"===e[i]){l=i;continue}let s=i;for(;s<n&&")"!==e[s];)s+="\\"===e[s]?2:1;s=Math.min(s,n);let a=s;for(;a>i&&r.test(e[a-1]);)a--;o(i,a,!1),l=s+1}}return 0===s?e:i+e.slice(s)}function Qe(e,t){let n=e.replace(/&/g,"&amp;");return'"'===t?n.replace(/"/g,"&quot;"):"'"===t?n.replace(/'/g,"&#39;"):n.replace(/[\s"'`>]/g,e=>`&#${e.charCodeAt(0)};`)}function Xe(e,t,n=[],r="",i=!1,s=!1){let o=[Ii,Ti];Ii=n,Ti=!0;try{Ye(e,t,r,i,s)}finally{[Ii,Ti]=o}}function Ye(e,t,n="",r=!1,i=!1){for(let i of Object.keys(e)){let s=e[i],o=i.toLowerCase();if(t&&("checked"===o||"selected"===o)){delete e[i];continue}if("string"!=typeof s){"style"===o&&Le(s)&&et(s,t);continue}let l=(t?Ke(o,s,n,e,r):void 0)??tt(o,rt(o,s,t,n),n);l!==s&&(e[i]=l)}(i||t&&("html"===n||"a"===n))&&(e["data-keploy-mask"]="")}function et(e,t){let n=e=>tt("style",Ge(e,t),"");for(let[t,r]of Object.entries(e))"string"==typeof r?e[t]=n(r):Array.isArray(r)&&"string"==typeof r[0]&&(e[t]=[n(r[0]),...r.slice(1)])}function tt(e,t,n){return e.startsWith("rr_")?t:function(e,t){return"value"===e?""!==t&&!Oi.has(t):Ri.has(e)||e.startsWith("data-")&&!_i.has(e)&&"data-srcset"!==e}(e,n)&&Ei.test(t)?E(t):A(t)}function nt(e){return A(e)}function rt(e,t,n,r){let i=t;return"srcset"===e||"data-srcset"===e||"imagesrcset"===e?i=function(e,t){if(!Ze(e))return e;let n=e.split(",").map(e=>{let n=/^(\s*)(\S+)([\s\S]*)$/.exec(e);return null===n?e:n[1]+We(n[2],t)+n[3]}).join(",");return n===e?e:n}(t,n):"style"===e||"_csstext"===e?i=Ge(t,n):"ping"===e?i=t.replace(/\S+/g,e=>We(e,n)):"srcdoc"===e?i=function(e,t){if(!t&&!Ze(e)&&!/url\(/i.test(e))return e;let n=e.length,r=/[\t\n\f\r ]/,i=[],s=new Set,o=(n,r,s,o,l="")=>{let a=function(e){return e.includes("&")?e.replace(/&(?:#(\d+);?|#[xX]([0-9A-Fa-f]+);?|([A-Za-z][A-Za-z0-9]*);|(amp|AMP|lt|LT|gt|GT|quot|QUOT)(?![A-Za-z0-9=]))/g,(e,t,n,r,i)=>{if(void 0!==t||void 0!==n){let e=void 0!==t?Number(t):parseInt(n,16);return 0===e||e>1114111||e>=55296&&e<=57343?"\ufffd":String.fromCodePoint(e)}return qi[r??i??""]??e}):e}(e.slice(r,s)),u=(t?Ke(n,a,l):void 0)??rt(n,a,t,"");u!==a&&i.push([r,s,Qe(u,o)])},l=(t,i,l="")=>{let a=t;for(;;){for(;a<n&&(r.test(e[a])||"/"===e[a]);)a++;if(a>=n||">"===e[a])return a;let t=a;for(a++;a<n&&!r.test(e[a])&&!"/>=".includes(e[a]);)a++;let u=e.slice(t,a).toLowerCase(),c=a;for(;c<n&&r.test(e[c]);)c++;if("="!==e[c]){a=c;continue}for(c++;c<n&&r.test(e[c]);)c++;let h='"'===e[c]||"'"===e[c]?e[c]:"",d=""===h?c:c+1,f=d;if(""!==h)f=e.indexOf(h,d),-1===f&&(f=n),a=Math.min(f+1,n);else{for(;f<n&&!r.test(e[f])&&">"!==e[f];)f++;a=f}i&&(s.add(`${d}:${f}`),o(u,d,f,h,l))}},a=(n,r)=>{let s=e.slice(n,r);t&&/\S/.test(s)&&i.push([n,r,s.replace(/\S/g,"*")])},u=0,c=e.indexOf("<");for(;-1!==c&&c<n;){let s,o=!0;if(e.startsWith("\x3c!--",c))if(e.startsWith(">",c+4))s=c+5;else if(e.startsWith("->",c+4))s=c+6;else{let t=/--!?>/g;t.lastIndex=c+4;let r=t.exec(e);s=null===r?n:r.index+r[0].length,a(c+4,null===r?n:r.index)}else if("!"===e[c+1]||"?"===e[c+1]){let t=e.indexOf(">",c+2);s=-1===t?n:t+1,/^<!doctype/i.test(e.slice(c,c+9))||a(c+2,-1===t?n:t)}else if("/"===e[c+1]&&/[A-Za-z]/.test(e[c+2]??"")){let t=c+2;for(;t<n&&!r.test(e[t])&&!"/>".includes(e[t]);)t++;s=l(t,!1)+1}else if(/[A-Za-z]/.test(e[c+1]??"")){let o=c+1;for(;o<n&&!r.test(e[o])&&!"/>".includes(e[o]);)o++;let u=e.slice(c+1,o).toLowerCase(),h=l(o,!0,u);if(s=h+1,Mi.has(u)&&h<n){let r=new RegExp(`</${u}[\\t\\n\\f\\r />]`,"gi");r.lastIndex=h+1;let o=r.exec(e),l=null===o?n:o.index;if("style"===u){let n=e.slice(h+1,l),r=Ge(n,t);r!==n&&i.push([h+1,l,r])}else a(h+1,l);s=l}}else s=c+1,o=!1;o&&(a(u,c),u=s),c=e.indexOf("<",s)}a(u,n),i.sort((e,t)=>e[0]-t[0]);let h=i.length,d=new RegExp(Ki.source,"gi"),f=0,p=0;for(let t=d.exec(e);null!==t;t=d.exec(e)){let e=t[3]??t[4]??t[5]??"",n=t.index+t[0].length-(void 0===t[5]?1:0),r=n-e.length;for(d.lastIndex=r;f<h&&i[f][1]<=r;)f++;if(s.has(`${r}:${n}`)||f<h&&i[f][0]<n||r<p)continue;let l=void 0!==t[3]?'"':void 0!==t[4]?"'":"",a=i.length;o(t[2].toLowerCase(),r,n,l),i.length>a&&(p=n)}if(0===i.length)return e;i.sort((e,t)=>e[0]-t[0]);let g="",y=0;for(let[t,n,r]of i)g+=e.slice(y,t)+r,y=n;return g+e.slice(y)}(t,n):"content"===e?i=function(e,t){if(!Ze(e))return e;let n=zi.exec(e);if(null!==n&&""!==n[3]){let r=Me(!0,n[3],t);return r===n[3]?e:n[1]+n[2]+r+n[4]}return/^\s*https?:\/\//i.test(e)?We(e,t):e}(t,n):_i.has(e)?i=Me(function(e,t){return"href"===e||"xlink:href"===e?""===t||"a"===t||"area"===t:"action"===e||"formaction"===e}(e,r),t,n):Zi.test(t)&&(i=Me(!1,t,n)),i}function it(e,t,n=[]){let r=[Ii,Ti];Ii=n,Ti=!0;try{return Ge(e,t)}finally{[Ii,Ti]=r}}function st(e){let t=e.map(e=>e.textContent).join(""),n=I(t).sort((e,t)=>e[0]-t[0]),r=0,i=0;for(let s of e){let e=i+s.textContent.length,o="",l=i;for(;r<n.length&&n[r][0]<e;){let[i,s]=n[r];if(i>=l&&(o+=`${t.slice(l,i)}[REDACTED]`),l=Math.max(l,Math.min(s,e)),s>e)break;r++}s.textContent=o+t.slice(l,e),i=e}}function ot(e){let t=e;return 3===t?.type&&"string"==typeof t.textContent}function lt(e){let t=[];for(let n of e)ot(n)?t.push(n):5!==n?.type&&(t.length>1&&st(t),t=[]);t.length>1&&st(t)}function at(e,t,n=[],r){let i=[Ii,Ti];Ii=n,Ti=!0;try{!function(e,t,n){let r=[e],i=new Set;for(;r.length>0;){let e=r.pop();if(null===e||"object"!=typeof e||i.has(e))continue;if(i.add(e),"string"==typeof e.textContent){let n=!0===e.isStyle?Ge(e.textContent,t):t&&5===e.type?"":nt(e.textContent);n!==e.textContent&&(e.textContent=n)}let s=e.attributes;if(Le(s)&&Ye(s,t,"string"==typeof e.tagName?e.tagName.toLowerCase():"",!0===e.isSVG,n?.(e.id)),Array.isArray(e.childNodes)){lt(e.childNodes);for(let t of e.childNodes)r.push(t)}}}(e,t,r)}finally{[Ii,Ti]=i}}function ut(e,t,n){switch(e){case"location":case"content-location":return n(t);case"link":return t.replace(/<([^>]*)>/g,(e,t)=>`<${n(t)}>`);case"refresh":{let e=/^\s*(?:\d[\d.]*\s*[;,]\s*)?url\s*=\s*/i.exec(t);if(null===e)return C(t);let r=t.slice(e[0].length),i=/^(["'])(.*)\1$/.exec(r);return i?`${e[0]}${i[1]}${n(i[2])}${i[1]}`:`${e[0]}${n(r)}`}}return C(t)}function ct(e){if(e.startsWith("access-control-"))return!1;if(v(e))return!0;let t=e.split(/[-_\s]+/).filter(e=>""!==e);t.length>1&&/^v?\d+$/.test(t[t.length-1])&&t.pop();let n=t[t.length-1]??"",r=t[t.length-2]??"";return v(n)||""!==r&&v(r+n)}function ht(){return{maskSelectors:[],unmaskSelectors:[],blockSelectors:[],maskNetworkBodies:!1,sensitiveHeaders:[...wi],piiPatterns:[],secretRoutes:[],keepRoutes:[]}}function dt(e,t){let n={...e};for(let[e,r]of Object.entries(t))void 0!==r&&(n[e]=r);if(t.sensitiveHeaders){let r=new Set;n.sensitiveHeaders=[...wi,...e.sensitiveHeaders,...t.sensitiveHeaders].filter(e=>{let t=e.toLowerCase();return!r.has(t)&&(r.add(t),!0)})}return n}function ft(e){return e.map(({pattern:e})=>new RegExp(e.source,e.flags+(e.flags.includes("g")?"":"g")))}function pt(e){return"string"==typeof e&&e.length>0&&e.length<=200&&Gi.test(e)}function gt(e){let t={};for(let n of Object.keys(e)){let[r,i]=e[n],s="https://keploy.io/docs/ui-capture/errors#"+n.toLowerCase().replace(/_/g,"-");t[n]={summary:r,remedy:{command:null,manual:s,docs:s},evidence:i?i.split(" "):Xi,optionalEvidence:i?[]:Yi}}return t}function yt(e){return e.replace(/\s+/g," ").trim()}function bt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: dropped an event: ${yt(t)} The capture continues; any further such events in this capture are dropped silently. evidence=${vt(r)}`}function mt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: ${yt(t)} evidence=${vt(r)}`}function vt(e){try{return JSON.stringify(e)}catch{let t={};for(let[n,r]of Object.entries(e))t[n]="string"==typeof r||"number"==typeof r?r:St(r);return JSON.stringify(t)}}function wt(e){return 401===e||403===e?"KUI_E_INGEST_KEY_REJECTED":404===e||405===e?"KUI_E_INGEST_ENDPOINT_NOT_FOUND":409===e?"KUI_E_SESSION_CONFLICT":e>=400&&e<500&&429!==e?"KUI_E_INGEST_REJECTED":null}function kt(e){if(null===e)return ns;let t=e.trim();if(""===t)return ns;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e){let t=e;if("string"==typeof t.error){let e=t.error.trim();return{message:""===e?null:e.slice(0,rs),issues:xt(t.issues)}}}}catch{}return{message:t.slice(0,rs),issues:null}}function xt(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(t.length===is)break;if(null===n||"object"!=typeof n)continue;let{path:e,message:r}=n;"string"!=typeof e||"string"!=typeof r||t.push({path:e.slice(0,rs),message:r.slice(0,rs)})}return t.length>0?t:null}function St(e){if("string"==typeof e)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if("function"==typeof e)return`[function ${e.name}]`;if("object"!=typeof e||null===e)return String(e);try{return JSON.stringify(e)}catch{let t=e.constructor;return`[${"string"==typeof t?.name?t.name:"object"} not JSON-serialisable]`}}function Et(e){if("threw"in e)return`threw ${St(e.threw)}`;let t=e.returned;if("object"==typeof t&&null!==t){if("function"==typeof t.then)return"a Promise (sessionIdGenerator must return a string synchronously)";let e=t.constructor,n="string"==typeof e?.name?e.name:"";if(""!==n&&"Object"!==n)return`object ${n} ${St(t)}`}return`${typeof t} ${St(t)}`}function At(e=!0){if(!fs)return;for(let t of Ss)t(e);fs=gs=ws=!1,Pn=qn=Mn=void 0;let t=ks;ks=[],$t(),setTimeout(()=>{for(let e of t)_t(e)||e()},0)}function It(){for(let e of Es)e();Es.clear()}function Tt(e){let t=fs&&!gs;return t&&ys.push(e),t}function $t(){let e=ys;ys=[];for(let t of e)t()}function Ct(){!fs||gs||(gs=!0,ks.length&&It(),$t())}function _t(e){return fs&&(ks.push(e),gs&&It()),fs}function Rt(e){return new Promise((t,n)=>{let r=()=>{new Promise(t=>t(e())).then(t,e=>{_t(r)||n(e)})};_t(r)||r()})}function Ot(e,t,n,r){let i=bs;setTimeout(()=>{if(!r){Pn===e&&t()&&At(n);return}if(ws||i!==bs||!fs)return;let s=r.defaultPrevented||vs.has(r);if(r===Mn&&Pn===r&&(s||t()))return At(n);r!==Mn&&s||(ws=!0,Ct())},0)}function Dt(e){let t=e.type,n=e;if("currententrychange"===t){qn&&(n.from!==Is()?.currentEntry||n.navigationType)&&vs.add(qn);return}if("pageshow"===t){e.isTrusted&&e.persisted&&At();return}fs||(qn=void 0);let r=fs;"navigate"===t&&(qn=e),!n.destination?.sameDocument&&null==n.downloadRequest&&(r||bs++,fs=!0,Pn=e,"navigate"!==t?setTimeout(()=>{Pn===e&&(ws=!0,Ct())},0):(Ot(e,()=>Is()?.transition,r&&gs,Mn=n),n.signal?.addEventListener("abort",()=>Ot(Pn,()=>qn===e,!1))))}function Nt(e,t=e){if(t&&At(),xs===e||"function"!=typeof addEventListener)return;xs=e;let n={capture:!0,passive:!0},r=(t,r)=>{for(let i of r)e?t?.addEventListener(i,Dt,n):t?.removeEventListener(i,Dt,n)};r(globalThis,Ts),r(Is(),["navigate","currententrychange"])}function zt(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}function Lt(e){return"default"in e?e.default:e}function jt(e,t){let n=e=>{let t=Lt(e),n=t.version;if(n!==$s)throw new Error(`a chunk of version ${String(n)}, not the SDK's ${$s}`);return t};return Rt(e).then(n).catch(e=>t?Rt(t).then(n).catch(t=>Promise.reject(new Error(`${String(e)}; beside the SDK: ${String(t)}`,{cause:e}))):Promise.reject(e))}function Bt(e){(typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout)(e,{timeout:1e3,valueOf:()=>0})}function Ut(e,t){if(!Zs.includes(e)){Zs+=e;try{console.warn(function(e,t){return mt({code:"KUI_E_BODY_WORKER_UNAVAILABLE",part:e,reason:t},"body worker/chunk missing (evidence.part): >64 KiB cut or redacted bodies dropped (unproven); allow worker-src 'self' and serve dist/.")}(e,typeof Event<"u"&&t instanceof Event?t.message||"the worker's script did not load or run (refused by the page's CSP, a 404, or a script that does not parse)":St(t)))}catch{}}}function Pt(e){if(typeof navigator>"u"||!1!==navigator.onLine||zt()||"function"!=typeof addEventListener)return!1;if(!Wn){Wn=[];let e=()=>{if(!1===navigator.onLine)return;Jn?.();let e=Wn??[];Wn=void 0;for(let t of e)t()};addEventListener("online",e);let t=setInterval(e,1e3);Jn=()=>{removeEventListener("online",e),clearInterval(t),Jn=void 0}}return Wn.push(e),!0}function qt(){return Zn??=new Promise(e=>{let t=()=>{Rs=!1,Cs().then(e=>{if("function"!=typeof e.redactBodies)throw new TypeError("the body chunk has no redactBodies export");return e}).then(t=>{Kn=t,Hi.redact=t.redactBodies,e()},t=>{Os=!0,Ut("code",t),e()})};(Rs=Pt(t))||t()})}function Mt(){if(Ds||void 0!==Fn)return;Ds=!0;let e=()=>{_s().then(e=>Rt(()=>{if(!(Ns.size>0||Ms(Us)))return void(Ds=!1);let t=e.startBodyWorker();t.onmessage=({data:e})=>{Hn=t;let n=Ps.get(e.id);n&&(Ps.delete(e.id),js-=n.owes,n.owner.answered(n,e.out))},t.onerror=e=>Ht(t,e),Fn=t,Ds=!1;let n=Us;Us=new Set;for(let e of n)Ft(e)})).catch(e=>Ht(null,e))};Pt(e)||e()}function Kt(){qt(),Mt()}function Zt(e,t=!1){Ns.add(e),(!Zn||void 0===Fn)&&((t?Fs:Hs)||(t?Fs=!0:Hs=!0,(t?Bt:setTimeout)(()=>{t?Fs=!1:Hs=!1,Ns.size&&Kt()})))}function Ft(e){if(!e.owner.has(e))return;let t=Fn?Fn===Hn:null===Fn&&Kn;if(t||!Ks(e)||!Tt(()=>Ft(e))){if(!t&&(e=>gs&&Ks(e))(e)){e.owner.answered(e,Gt(e.job)),e.job=null;return}if(Fn){Ps.set(++qs,e);try{Fn.postMessage({id:qs,job:e.job}),js+=e.owes}catch{Ps.delete(qs),e.owner.alone(e)}}else null===Fn?e.owner.alone(e):(Us.add(e),Kt())}}function Ht(e,t){if(e&&Fn!==e)return;Wt(e);let n=[...Ps.values(),...Us].filter(e=>e.owner.has(e));if(Ps.clear(),js=0,Fn=void 0,Us=new Set(n),!Ns.size&&!n.length)return void(Ds=!1);Ds=!0;let r=()=>{Ds=!1,Mt()};if(!Pt(r)&&!_t(r)){Ds=!1,Fn=null,Us.clear(),Ut("worker",t);for(let e of n)e.owner.alone(e)}}function Wt(e){if(e)try{e.terminate()}catch{}}function Jt(){if(Vn=void 0,!Fn||Ms(Ps.values()))return;let e=Fn;Hn===e||ps()?Wt(e):setTimeout(e.onmessage=e.onerror=()=>Wt(e),3e4),js=0,Fn=void 0,Ps.clear()}function Vt(e=!0,t=()=>!1){e&&Wn&&(Jn?.(),Wn=void 0,Rs&&(Zn=void 0),void 0===Fn&&(Ds=!1),Us.clear()),t()&&void 0!==Hn&&Fn===Hn&&ps()?(Vn=t,addEventListener("pagehide",Ws)):Jt()}function Gt(e,t){let n=e=>e&&(t?b(0,e.length):m(e.length,Os?"code-failed":"left"));return{requestBody:n(e.requestBody),responseBody:e.responseBody==Gs?Gs:n(e.responseBody)}}function Qt(e,t,n=t){try{return Kn.redactBodies(e,t,n)}catch{return null}}function Xt(e){return(e?.requestBody?.length??0)+(e?.responseBody?.length??0)}function Yt(e){try{let t=typeof document<"u"?document.baseURI:void 0;return new URL(e,t).href}catch{return e}}function en(e){let t={};if(!e)return t;if(e instanceof Headers)e.forEach((e,n)=>t[n]=e);else if(Array.isArray(e))for(let[n,r]of e)t[n]=r;else Object.assign(t,e);return t}function tn(e){let t=e=>encodeURIComponent(e).replace(/%20/g,"+"),n=[];return e.forEach((e,r)=>{n.push("string"==typeof e?`${t(r)}=${t(e)}`:`${t(r)}=${t(`[File: ${e.name}, ${e.size} bytes]`)}`)}),n.join("&")}function nn(e,t){return"string"==typeof e?_(e,t):e instanceof URLSearchParams?_(e.toString(),t):e instanceof ArrayBuffer||ArrayBuffer.isView(e)?function(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength<=t)try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{}return`[Binary: ${n.byteLength} bytes]`}(e,t):void 0}function rn(e,t){if(null==e)return null;try{if("string"==typeof e)return""===e?null:Wi;if(e instanceof URLSearchParams||e instanceof FormData)return e.keys().next().done?null:Wi;if(e instanceof Blob)return t||e.size>0?Wi:null;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength>0?Wi:null;if(t&&typeof Document<"u"&&e instanceof Document)return e.hasChildNodes()?Wi:null}catch{}return Wi}function sn(e){return"object"==typeof e&&null!==e&&"Request"===e[Symbol.toStringTag]}function on(e,t,n,r){for(let i=0;i<n.length&&t.length<=r;){let s=i+Math.max(1,r+1-t.length);t+=e.decode(n.subarray(i,s),{stream:!0}),i=s}return t}function ln(e){let t=typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"?location.href:void 0;return new URL(e,t).href}function an(e){try{e()}catch(e){setTimeout(()=>{throw e})}}function un(e){return(new TextEncoder).encode(e).length}function cn(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function hn(){return mo||(mo=Rt(()=>import("rrweb")).then(e=>(vo=!0,{record:Lt(e).record}),e=>(mo=null,{failed:St(e)}))),mo}function dn(e){return e?Promise.all([hn(),wo??=jt(()=>import("@keploy/capture-sdk/strict-attributes"),void 0).then(e=>{if("function"!=typeof e.kept)throw new TypeError("strict-attributes has no kept()");return function(e){Un=e}(e.kept),ko=!0,null}).catch(e=>(wo=null,St(e)))]).then(([e,t])=>null===t||"failed"in e?e:{failed:t,strict:!0}):hn()}function fn(){let e=document.documentElement,t=document.body;return{width:window.innerWidth||e?.clientWidth||t?.clientWidth||0,height:window.innerHeight||e?.clientHeight||t?.clientHeight||0}}function pn(e){return e.split("#").map(e=>e.split("?")[0]).join("#")}function gn(e){return 2===e.kind?`2${e.before}/${e.value}`:`${e.kind}${e.value}`}function yn(e,t,n,r){let i=0,s=!1;for(let t of e.keys())i+=t.length;for(let o of e.keys()){if(r(o)||e.size<=t&&i<=n)break;e.delete(o),i-=o.length,s=!0}return s}function bn(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=gn(e[n]);To.delete(r)||(t=!0),To.set(r,e[n])}let n=new Set(e.map(gn));return yn(To,Ao,Io,e=>n.has(e))||t}function mn(e){let t=ei;if(e!==$o||t!==Co){let n=!1;if(""===$o||t!==Co){let e=globalThis.performance?.getEntriesByType?.("navigation");e?.[0]&&(n=bn(ae(e[0].name)));for(let e of Do)bn(ae(e))&&(n=!0)}$o=e,Co=t,function(e){Do.delete(e),Do.add(e),yn(Do,Ro,Oo,t=>t===e)}(e),(bn(ae(e))||n)&&(_o=Oe([...To.values()]))}return _o}function vn(e){let t=e,n=t.destination?.url;jo="string"==typeof n&&"boolean"==typeof t.userInitiated?{href:n,userInitiated:t.userInitiated}:null;let r=t.destination?.key;if("replace"!==t.navigationType){if("traverse"===t.navigationType&&"string"==typeof r){let e=Bo[0]===r&&!1===t.userInitiated;e||r===Po?qo.set(r,(qo.get(r)??0)+1):qo.delete(r),Bo=e?Bo.slice(1):[],Po=null}else{let n=[];if("push"===t.navigationType)try{let t=e.currentTarget;n=t.entries().slice(0,t.currentEntry.index).map(e=>e.key)}catch{}Bo=Bo.filter(e=>n.includes(e)),Uo=null,(!0!==t.userInitiated||!n.includes(Po))&&(Po=null),qo.clear()}Mo=!1}}function wn(e,t,n){if("object"==typeof t||"function"==typeof t)return null;let r=e;try{let e=0|Number(t),i=r?.entries()??[],s=null===n?Number(r?.currentEntry?.index):i.findIndex(e=>e.key===n);return s<0?null:i[s+e]?.key??null}catch{return null}}function kn(e,t){return function(...n){if(Mo)return Reflect.apply(e,this,n);let[r,i]=t(n);Po=i,null!==i&&null!==r&&(Uo=r,r!==wn(zo?.navigation??null,0,null)&&Bo.push(r)),Mo=!0;try{return Reflect.apply(e,this,n)}catch(e){throw Bo=[],Po=null,e}finally{Mo=!1}}}function xn(e){let t=e,n=t.navigationType,r=function(){let e=jo;return jo=null,null!==e&&e.href===location.href?e.userInitiated:void 0}(),i=function(e){let t=e?.currentEntry?.key;if("string"!=typeof t)return;for(;Bo[0]===t;)Bo.shift();let n=qo.get(t)??0;return n>1?qo.set(t,n-1):qo.delete(t),n?"script":void 0}(zo?.navigation??null);if("traverse"===n)En("traverse",r,i);else if("push"===n||"replace"===n){let e="string"==typeof t.from?.url?t.from.url:"";En(Lo??(function(e,t){return e!==t&&e.split("#")[0]===t.split("#")[0]}(e,location.href)?"hash":n),r)}}function Sn(){let e=Reflect.get(window,"event")?.type;return"popstate"===e||"hashchange"===e?"traverse":"push"}function En(e,t,n){mn(location.href);for(let r of No)try{r(e,t,n)}catch{}}function An([e,t,,n]){let r=Ko(e,t);return void 0!==r&&r.value===n.value&&r.configurable===n.configurable&&(!0===r.configurable||!0===r.writable)}function In([e,t,n]){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function Tn(e){if(typeof window>"u"||!window.history)return()=>{};No.add(e),function(){if(zo)return;let e=window.history,t=e.pushState,n=e.replaceState,r=Reflect.get(window,"navigation")??null;r?.addEventListener("currententrychange",xn,{capture:!0}),r?.addEventListener("navigate",vn,{capture:!0});let i=e=>t=>{let n=e(t);return[wn(r,n,Bo.length?Uo:null),wn(r,n,null)]},s=e=>t=>{let n=e(t);return[n,n]},o=[[e,"back",i(()=>-1)],[e,"forward",i(()=>1)],[e,"go",i(e=>e[0])],[r,"back",s(()=>wn(r,-1,null))],[r,"forward",s(()=>wn(r,1,null))],[r,"traverseTo",s(e=>"string"==typeof e[0]?wn(r,0,e[0]):null)]],l=[[e,"pushState",function(...e){let n=location.href,r=Lo;Lo="push";try{t.apply(this,e)}finally{Lo=r}En(location.href===n?Sn():"push")}],[e,"replaceState",function(...e){let t=location.href,r=Lo;Lo="replace";try{n.apply(this,e)}finally{Lo=r}En(location.href===t?Sn():"replace")}]];for(let[e,t,n]of o){let r=e&&Reflect.get(e,t);"function"==typeof r&&l.push([e,t,kn(r,n)])}let a=l.find(([e,t])=>!function(e,t){let n=Ko(e,t);return void 0===n?Object.isExtensible(e):!0===n.configurable||!0===n.writable}(e,t));zo={navigation:r,methods:a?[]:l.map(([e,t,n])=>function(e,t,n){let r=Ko(e,t);return Object.defineProperty(e,t,!1===r?.configurable?{value:n}:{value:n,writable:!0,enumerable:r?.enumerable??!0,configurable:!0}),[e,t,r,Ko(e,t)]}(e,t,n)),refused:a?`${a[0]===e?"history":"navigation"}.${a[1]}`:null}}();let t=()=>{mn(location.href),e("traverse")};return window.addEventListener("popstate",t,{capture:!0}),window.addEventListener("hashchange",t,{capture:!0}),()=>{No.delete(e),window.removeEventListener("popstate",t,{capture:!0}),window.removeEventListener("hashchange",t,{capture:!0}),function(){if(zo&&!(No.size>0)&&zo.methods.every(An)){for(let e of zo.methods)In(e);zo.navigation?.removeEventListener("currententrychange",xn,{capture:!0}),zo.navigation?.removeEventListener("navigate",vn,{capture:!0}),jo=null,Bo=[],Po=null,qo.clear(),zo=null}}()}}function $n(e){return e.some(e=>"dom"===e.type&&2===e.data?.type)}function Cn(e){try{return!!e.trim()&&!!document.documentElement.closest(`${e},*`)}catch{return!1}}function _n(){let e=typeof crypto<"u"?crypto:void 0;if("function"!=typeof e?.getRandomValues)return null;let t="";for(let n of e.getRandomValues(new Uint8Array(16)))t+=n.toString(16).padStart(2,"0");return t}function Rn(){let e=typeof window<"u"?window.location?.origin:"";return"string"==typeof e&&""!==e&&"null"!==e?e:null}function On(e){e[0]=Math.max(e[0],performance.now());for(let[t,n,r,i]of e.splice(2)){try{r?.(new t(n.signal??n))}catch{}i()}}Object.create;var Dn,Nn=Object.defineProperty,zn=Object.getOwnPropertyDescriptor,Ln=Object.getOwnPropertyNames,jn=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),Bn={};((e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})})(Bn,{CaptureDeclined:()=>hs,CaptureError:()=>ss,CaptureIdentityBuilder:()=>Ho,DomRecorderRefusal:()=>us,IngestRejection:()=>os,KeployCapture:()=>Yo,KeployCaptureRecorder:()=>Fo,NetworkInterceptor:()=>ho,PrivacyConflict:()=>ds,PrivacyEngine:()=>Ji,PrivacyRouteRefusal:()=>cs,SDK_ERRORS:()=>es,SDK_WARNINGS:()=>ts,SESSION_ID_MAX_LENGTH:()=>Vi,SESSION_ID_PATTERN:()=>Gi,SESSION_ID_RULE:()=>Qi,SessionIdRefusal:()=>ls,StrictAttributesRefusal:()=>as,Transport:()=>bo,codeForStatus:()=>wt,currentOrigin:()=>Rn,defaultPrivacyConfig:()=>ht,describeValue:()=>St,isValidSessionId:()=>pt,mintSessionNonce:()=>_n,parseServerError:()=>kt});module.exports=(Dn=Bn,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of Ln(t))!jn.call(e,n)&&void 0!==n&&Nn(e,n,{get:()=>t[n],enumerable:!(r=zn(t,n))||r.enumerable});return e})(Nn({},"__esModule",{value:!0}),Dn));var Un,Pn,qn,Mn,Kn,Zn,Fn,Hn,Wn,Jn,Vn,Gn=/%[0-7][\da-f]|%(?:c[2-9a-f]|d[\da-f])%[89ab][\da-f]|%e0%[ab][\da-f]%[89ab][\da-f]|%e[1-9a-ce-f](?:%[89ab][\da-f]){2}|%ed%[89][\da-f]%[89ab][\da-f]|%f0%[9ab][\da-f](?:%[89ab][\da-f]){2}|%f[1-3](?:%[89ab][\da-f]){3}|%f4%8[\da-f](?:%[89ab][\da-f]){2}/gi,Qn=new Set(["password","passwd","pwd","secret","token","accesstoken","refreshtoken","idtoken","authorization","auth","apikey","clientsecret","privatekey","session","sessionid","cookie","ssn","socialsecuritynumber","creditcard","cardnumber","cvv","cvc","pin","passphrase","pass1","pass2","currentpass","rpkey","codeverifier","rawkey","apikeyauth","setcookie","proxyauthorization","samlresponse","confirmkey","tokenhash","clerkticket","nonce","hmac","loginhash","magiclink","phpsessid","oauthverifier","sig","sid","sessid","csrf","xsrf","bearer","authentication","credentials","pass","tokenid","authkey","secretkey","accesskey","clientkey","signingkey","sessionkey","subscriptionkey","functionskey","factorcode","jwtassertion","samlassertion","clientassertion","secretaccesskey","accesskeysecret"]),Xn=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),Yn=new Set("cardexpiry cardexpiration cardexpirydate cardexpirationdate cardexp cardexpdate cardexpmonth cardexpyear ccexp ccexpiry ccexpiration ccexpdate ccexpmonth ccexpyear creditcardexpiry creditcardexpiration expmonth expyear expirymonth expiryyear expirationmonth expirationyear".split(" ")),er=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,tr=new Set("page nextpage prevpage previouspage paging pagination next prev previous continuation nextcontinuation cursor sync nextsync starting start skip delta resumption scroll after before".split(" ").map(e=>`${e}token`)),nr=new Set(["auth","session","cookie","pin","sig"]),rr=/(&|;(?=[^;&=#]+=|end$))/,ir=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,sr=/[&;?#][^&;=?#]+=/,or=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,lr=/(?<=([a-z][a-z0-9+.-]{0,31})):[/\\]{2}|(?<attr>\bcontent\s*=\s*(?:["']\s*)?\d[\d.]*\s*[;,]\s*url\s*=\s*["']?|\b(?:href|src|action|formaction|poster|cite|data|background|longdesc|content|data-src|data-href|xlink:href)\s*=\s*["']?|(?<![\w:.-])[\w:.-]{1,40}\s*=\s*["'](?=\.{0,2}\/|[?#]|[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):)|\burl\(\s*["']?)(?=[^\s"'<>])/gi,ar=/[\s"'<>\\^`{|}]/,ur=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,cr=/url\(\s*["']?/iy,hr={left:"the page left or the capture stopped before redaction was ready","code-failed":"the redaction code could not load",early:"the page took the body's stream before the redaction code had loaded"},dr="[REDACTED]",fr=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,pr=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,gr=new Set(["code","devicecode"]),yr=(new Set([...gr,"state"]),/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y),br=/(?<![A-Za-z0-9])(?:kep_[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[abprse]-[A-Za-z0-9-]{10,}|[sr]k_(?:live|test)_[A-Za-z0-9]{16,}|sk-(?:proj|ant)-[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{36,}|whsec_[A-Za-z0-9+/=]{24,}|(?:AKIA|ASIA)[0-9A-Z]{16,}|AIza[0-9A-Za-z_-]{35,})/g,mr=/\b\d{3}-\d{2}-\d{4}\b/g,vr=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,wr=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,kr=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,xr=/eyJ|kep_|gh[pousr]_|github_pat_|glpat-|xox[abprse]-|[sr]k_(?:live|test)_|sk-(?:proj|ant)-|npm_|whsec_|AKIA|ASIA|AIza/,Sr=(JSON.stringify(dr),{kind:"param",strict:!1,whole:!1,raw:!0}),Er={...Sr,spaced:!0,tail:e=>T(e,Ar)},Ar={...Sr,spaced:!0,list:!0},Ir=/^(?:[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)/i,Tr=/^\S*/,$r=/^[^\r\n]*/gm,Cr=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,_r=/^(?:\\\/|\\u002[fF])/,Rr="...[truncated]",Or=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Dr=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Nr=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,zr=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Lr=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,jr=/[^&]+/y,Br=y(!1),Ur=y(!0),Pr=/^!?\//,qr=e=>new Set(e.split(" ")),Mr=qr("reset resets verify unlock activate invite forgot forgotten recover recovery"),Kr=new Set(["passwordreset","passwordresets","resetpassword","verifyemail","emailverification","magiclink","magiclogin","emaillogin","loginlink","lostpassword","setpassword","createpassword"]),Zr=new Set(["setpassword","createpassword","resetpassword","passwordreset","forgotpassword","forgottenpassword","lostpassword","verifyemail","emailverification"]),Fr=new Set(["sent","done","success","complete","new","error","expired","failed","invalid"]),Hr=qr("confirm confirmation confirmations invites invitation invitations verification verifications activation activations password passwords signup login"),Wr=qr("email account registration registrations signup"),Jr=new Set(["accept","link","new","old","sign","up","email","account","registration","admin","change","php","asp","aspx","htm","html","jsp","cgi"]),Vr=e=>e.some(e=>Wr.has(e))||e.join("").includes("signup"),Gr=new Set(["cb","auth","sso","signin","authorize","authorized","redirect"]),Qr="a route is `/`-separated segments from the path's start, each a literal, `*` (any one segment) or `:name` (the value it names), with no `?` or `#`; a secret route names at least one `:name`, a keep route has at least one literal",Xr={secret:[],keep:[]},Yr=new Set,ei=0,ti=16,ni=["",[],!1,null],ri=8192,ii=1/0,si=0,oi=10,li=/[A-Za-z0-9]/,ai=/(?:%(?:25)*[\da-f]{2}|(?:\\|%(?:25)*5c)(?:[nrtbf]|u[\da-f]{4}))$/i,ui=[["%25252f",3],["%252f",2],["%2f",1],["\\/",0],["/",0]],ci=Math.max(...ui.map(([,e])=>e)),hi=/[/\\?#\s"<>`{}|^[\]]/,di=/[!$&'()*+,;=:@]/,fi=64,pi=/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}]/g,gi=/[ \t\n\r]*:/y,yi=qr("type rel method enctype autocomplete inputmode enterkeyhint dir role crossorigin referrerpolicy loading decoding fetchpriority contenteditable draggable spellcheck translate"),bi=class{o=new Map;F=new Map;D;constructor(e){this.D=e}aX(e){return void 0===this.D||!this.D.present(e)}get size(){let e=0;for(let t of this.o.values())e+=t.size;return this.o.size+this.F.size+e}bg(e,t){this.av(e),this.F.set(e,t),this.o.get(t)?.add(e),this.D?.note(e)}av(e){let t=this.F.get(e);void 0!==t&&this.o.get(t)?.delete(e),this.F.delete(e)&&this.D?.forget(e)}bj(e){let t=this.o.get(e);if(void 0!==t)for(let e of t)this.F.delete(e)&&this.D?.forget(e);this.o.delete(e)&&this.D?.forget(e),this.av(e)}observe(e){if(!Le(e)||!Le(e.data))return;let t=e.data;if(2===e.type){for(let e of[...this.o.keys(),...this.F.keys()])this.D?.forget(e);this.o.clear(),this.F.clear(),this.bQ(t.node,null);return}if(3!==e.type||0!==t.source)return;let n=Array.isArray(t.removes)?t.removes:[];for(let e of n)Le(e)&&"number"==typeof e.id&&this.aX(e.id)&&this.bj(e.id);let r=Array.isArray(t.adds)?t.adds.filter(Le):[];for(let e of r)this.bQ(e.node,null);for(let e of r){let t=e.node;Le(t)&&3===t.type&&"number"==typeof t.id&&("number"==typeof e.parentId&&this.o.has(e.parentId)?this.bg(t.id,e.parentId):this.av(t.id))}n.length>0&&void 0!==this.D&&this.b$()}b$(){for(let e of this.o.keys())this.aX(e)&&this.bj(e);for(let e of this.F.keys())this.aX(e)&&this.av(e)}bQ(e,t){let n=[[e,t]],r=new Set;for(;n.length>0;){let[e,t]=n.pop();if(r.has(e)||(r.add(e),!Le(e)||"number"!=typeof e.id))continue;let i=e.id,s=2===e.type&&"string"==typeof e.tagName&&"style"===e.tagName.toLowerCase();if(s&&!this.o.has(i)&&(this.o.set(i,new Set),this.D?.note(i)),3===e.type&&null!==t&&this.bg(i,t),Array.isArray(e.childNodes))for(let t of e.childNodes)n.push([t,s?i:null])}}recordsIn(e){let t=new Set;if(!Le(e)||!Le(e.data))return t;let n=e.data,r=[];if(2===e.type)r.push(n.node);else if(3===e.type&&0===n.source){if(Array.isArray(n.adds))for(let e of n.adds)Le(e)&&r.push(e.node);if(Array.isArray(n.texts))for(let e of n.texts)Le(e)&&"number"==typeof e.id&&this.F.has(e.id)&&t.add(e)}for(;r.length>0;){let e=r.pop();Le(e)&&(3===e.type&&"number"==typeof e.id&&this.F.has(e.id)&&t.add(e),Array.isArray(e.childNodes)&&r.push(...e.childNodes))}return t}},mi=class extends Error{constructor(e,t){super(`the scrubbed event passed ${t} units (at least ${e})`);this.atLeast=e;this.cap=t;this.name="ScrubOverCap"}},vi=[/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g],wi="authorization cookie set-cookie x-api-key x-auth-token proxy-authorization".split(" "),ki=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,xi=/^eyJ[\w-]+\.[\w-]+\.[\w-]*$/,Si=/(?:^|-)[A-Za-z]{3,}-(?:[A-Za-z0-9]+-)*[A-Za-z]{3,}(?:-|$)/,Ei=/@|\d[\d .()-]{5,}\d|\d\.\d|eyJ/,Ai=new Set(["code","state","accesstoken","idtoken","refreshtoken"]),Ii=[],Ti=!1,$i=!1,Ci=/reset|verif|confirm|activat|invit|magic|log-?in|passw|unlock|forgot|recover|sign-?up/i,_i=new Set(["href","xlink:href","src","action","formaction","srcset","poster","cite","data","data-src","data-href","background","longdesc"]),Ri=new Set(["title","alt","placeholder","label","content","summary","abbr","aria-label","aria-description","aria-valuetext","aria-placeholder","aria-roledescription","aria-braillelabel","aria-brailleroledescription"]),Oi=qr("input textarea select"),Di=/^(?:style|_csstext|srcset|data-srcset|imagesrcset|ping|srcdoc)$/,Ni=/^[^\s"'`<>{}]*$/,zi=/^(\s*[\d.]*\s*[;,]\s*(?:url\s*=\s*)?)(['"]?)(.*?)(\2\s*)$/is,Li=/[?#;@]|eyJ/,ji=new WeakMap,Bi=He(!1),Ui=He(!0),Pi=/(?:[A-Za-z0-9_-]|[\u0080-\uffff]|\\(?:[0-9A-Fa-f]{1,6}[ \t\n]?|[^\n0-9A-Fa-f]))+/y,qi=Object.fromEntries('AMP& Tab\t NewLine\n excl! quot" QUOT" num# dollar$ percnt% amp& apos\' lpar( rpar) ast* midast* plus+ comma, period. sol/ colon: semi; lt< LT< equals= gt> GT> quest? commat@ lsqb[ lbrack[ bsol\\ rsqb] rbrack] Hat^ lowbar_ UnderBar_ grave` DiacriticalGrave` lcub{ lbrace{ verbar| vert| VerticalLine| rcub} rbrace} nbsp\xa0 NonBreakingSpace\xa0'.split(" ").map(e=>[e.slice(0,-1),e.slice(-1)])),Mi=qr("script style textarea title xmp iframe noembed noframes"),Ki=new RegExp(`(^|[\\s/"'])(${[..._i].join("|")}|imagesrcset|data-srcset|ping|content|style|srcdoc)\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"gi"),Zi=/^(?:(?:[a-z][a-z0-9+.-]{0,31}:\/|[a-z][a-z0-9-]{0,30}[+.][a-z0-9+.-]{0,30}:|localhost:\d{1,5}[/?#]|(?:mailto|tel|sms|urn|data|javascript|vbscript|blob|about|xmpp|sip|sips|magnet|intent|bitcoin|geo|market|news):|\.{0,2}\/)[^\s?#;]*[?#;]|[?#])\S*$/i,Fi=new Set(["accept","accept-encoding","accept-ranges","age","cache-control","connection","content-encoding","content-language","content-length","content-type","date","etag","expires","keep-alive","last-modified","pragma","transfer-encoding","vary"]),Hi={},Wi="[MASKED]",Ji=class{O;aU;aB;constructor(e={},t="balanced"){this.aB="strict"===t,this.O=this.bB(dt(ht(),e)),this.aU=ft(this.O.piiPatterns)}bB(e){return this.aB?{...e,maskNetworkBodies:!0}:e}maskText(e){if(!e)return e;let t=E(e,this.aU);for(let e of vi)t=t.replace(e,"[REDACTED]");return t}maskUrl(e){if(!e)return e;let t=e.indexOf("#");return function(e,t=!1){return p(e,t?Ur:Br)}(-1===t?e:e.slice(0,t),this.aB)}maskNetworkData(e,t){let n={...e};n.requestHeaders=this.bu(e.requestHeaders),n.responseHeaders=this.bu(e.responseHeaders);let r=this.bodyJob(e),i=e=>e?Wi:null,s=r&&(t??Hi.redact?.(r));return n.requestBody=s?s.requestBody:i(e.requestBody),n.responseBody=s?s.responseBody:i(e.responseBody),n.url=this.maskUrl(e.url),n}bodyJob(e){return this.O.maskNetworkBodies?null:{requestBody:e.requestBody,responseBody:e.responseBody,requestType:je(e.requestHeaders),responseType:je(e.responseHeaders),patterns:this.aU}}getConfig(){return this.O}updateConfig(e){this.O=this.bB(dt(this.O,e)),this.aU=ft(this.O.piiPatterns)}bu(e){let t={},n=new Set(this.O.sensitiveHeaders.map(e=>e.toLowerCase()));for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();n.has(e)||ct(e)||this.aB&&!Fi.has(e)?t[r]="[REDACTED]":t[r]=this.maskText(ut(e,i,e=>this.maskUrl(e)))}return t}},Vi=200,Gi=/^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/,Qi="must be 1-200 characters of letters, digits, dot, dash and underscore, with no empty dot-separated segment",Xi=["status","serverMessage","endpoint","sessionId"],Yi=["issues"],es=gt({KUI_E_INGEST_KEY_REJECTED:["The ingest server refused the SDK's API key (401 or 403). Capture has stopped."],KUI_E_INGEST_ENDPOINT_NOT_FOUND:["The ingest server answered 404 or 405: nothing at `endpoint` accepts a POST. Capture has stopped."],KUI_E_SESSION_CONFLICT:["The ingest server answered 409: this session id is already claimed, or a batchId was re-used. Capture has stopped."],KUI_E_INGEST_REJECTED:["The ingest server refused a batch with a terminal 4xx (400, 413 or 415). Capture has stopped."],KUI_E_SESSION_ID_INVALID:["The configured `sessionIdGenerator` did not produce a session id the ingest server would accept. Capture did not start.","sessionId received rule"],KUI_E_DOM_RECORDER_UNAVAILABLE:["The capture SDK could not load rrweb, the library it records the page with. The capture ended before anything was sent.","reason"],KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE:["Under strict, the capture SDK could not load its attribute allow-list. The capture ended before anything was recorded or sent.","reason"],KUI_E_PRIVACY_ROUTE_INVALID:["A route in `privacy.secretRoutes` or `privacy.keepRoutes` is not one the SDK can match. Capture did not start.","option received rule"],KUI_E_CAPTURE_DECLINED:["The browser sent Do Not Track or Global Privacy Control, and `honorPrivacySignals` is on. Capture did not start; nothing was recorded or sent.","signal"],KUI_E_PRIVACY_CONFLICT:['`privacyMode: "strict"` records no body, and `privacy.maskNetworkBodies` is `false`, which asks for them. Capture did not start.',"privacyMode option"]}),ts=gt({KUI_E_EVENT_UNSERIALISABLE:["The SDK dropped one captured event because it could not be serialised to JSON. The capture continues without it.","eventId eventType reason"],KUI_E_EVENT_OVERSIZED:["The SDK dropped one captured event that alone is over the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.","eventId eventType bytes cap"],KUI_E_EVENT_OVERSIZED_SCRUBBING:["The SDK dropped one captured event whose scrub of the page URL's credentials passed the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.","eventType atLeast cap"],KUI_E_NAVIGATION_UNWRAPPED:["The page made a History or Navigation API method the SDK wraps (`evidence.method`) impossible to replace and put back, so the SDK wrapped none of them. The capture continues.","method"],KUI_E_REQUEST_TERM_FAILED:["The SDK recorded a request without its canonical-key.v2 term (computing it threw: `evidence.reason`), or body:* (its term code did not load). The page's request was unaffected.","method reason"],KUI_E_BODY_WORKER_UNAVAILABLE:["No body worker or chunk (`evidence.part`): no worker, a body over 64 KiB is recorded cut; no chunk, one the main thread redacts keeps nothing; tests over them are unproven.","part reason"]}),ns={message:null,issues:null},rs=500,is=100,ss=class extends Error{code;status;serverMessage;issues;remedy;evidence;constructor(e,t,n,r=null,i=ns){super(t),this.name="CaptureError",this.code=e,this.remedy=es[e].remedy,this.status=r,this.serverMessage=i.message,this.issues=i.issues,this.evidence=n}},os=class extends ss{constructor({code:e,status:t,server:n,endpoint:r,sessionId:i}){let{message:s,issues:o}=n,l=`[keploy] capture stopped (${t}, ${e}); capture has stopped. ${s??"(no response body)"}`;if(o){let e=o.slice(0,5).map(e=>`${e.path||"body"}: ${e.message}`).join("; "),t=o.length-5;l+=` -- ${e}${t>0?` (+${t} more)`:""}`}super(e,l,{status:t,serverMessage:s,endpoint:r,sessionId:i,...o?{issues:o}:{}},t,n)}},ls=class extends ss{constructor({sessionId:e,received:t}){let n="KUI_E_SESSION_ID_INVALID";super(n,`[keploy] capture did not start: sessionIdGenerator ${null!==e?`returned invalid ${JSON.stringify(e)}`:t.startsWith("threw ")?t:`returned ${t}, which is not a session id`} (${n}). ${Qi}.`,{sessionId:e,received:t,rule:Qi})}},as=class extends ss{constructor({reason:e}){let t="KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE";super(t,`[keploy] capture ended before anything was recorded: strict allow-list unavailable (${t}): ${e}. ${es[t].remedy.docs}`,{reason:e})}},us=class extends ss{constructor({reason:e}){let t="KUI_E_DOM_RECORDER_UNAVAILABLE";super(t,`[keploy] capture ended before anything was sent: rrweb could not be loaded (${t}): ${e}. ${es[t].remedy.docs}`,{reason:e})}},cs=class extends ss{constructor({option:e,received:t}){let n="KUI_E_PRIVACY_ROUTE_INVALID";super(n,`[keploy] capture did not start: privacy.${e} ${t} (${n}). ${Qr}.`,{option:e,received:t,rule:Qr})}},hs=class extends ss{constructor(e){let t="KUI_E_CAPTURE_DECLINED";super(t,`[keploy] capture did not start: ${"doNotTrack"===e?"Do Not Track":"Global Privacy Control"} enabled (${t}).`,{signal:e})}},ds=class extends ss{constructor(){super("KUI_E_PRIVACY_CONFLICT","[keploy] capture did not start: strict conflicts with maskNetworkBodies: false (KUI_E_PRIVACY_CONFLICT).",{privacyMode:"strict",option:"privacy.maskNetworkBodies"})}},fs=!1,ps=()=>fs,gs=!1,ys=[],bs=0,ms=()=>bs,vs=new WeakSet,ws=!1,ks=[],xs=!1,Ss=[],Es=new Set,As=(e,t)=>new Promise((n,r)=>{let i=()=>{if(gs&&!t)return n(void 0);let i=()=>n(void 0);Es.add(i),e.then(e=>(Es.delete(i),n(e)),e=>(Es.delete(i),r(e)))};(t||!Tt(i))&&i()}),Is=()=>globalThis.navigation,Ts=["beforeunload","pageshow"],$s="3.3.1",Cs=()=>jt(()=>import("@keploy/capture-sdk/body-redact"),void 0),_s=()=>jt(()=>import("@keploy/capture-sdk/body-worker-start"),void 0),Rs=!1,Os=!1,Ds=!1,Ns=new Set,zs=8388608,Ls=0,js=0,Bs=e=>(e<=0||Ls+js<zs)&&(Ls+=e,!0),Us=new Set,Ps=new Map,qs=0,Ms=e=>[...e].some(e=>e.owner.has(e)),Ks=e=>e.mark===ms(),Zs="",Fs=!1,Hs=!1,Ws=()=>{Vn&&(Ps.clear(),Jt())};Ss.push(e=>{e&&Fn&&Fn!==Hn&&Ht(Fn,"left"),Vn&&!Vn()&&Jt()});var Js,Vs,Gs="[Response body not read by the page]",Qs="\0[Response body not captured]",Xs=class{v=new Map;redact(e,t,n,r=ms(),i){if(e?.responseBody==Qs){e.responseBody=null;let n=t;t=e=>n(e&&{...e,responseBody:m(0,Os?"code-failed":"early")})}let s={job:e,owner:this,after:n,mark:r};this.v.set(s,t),e&&(e.requestBody||e.responseBody)?!i&&Ls+js>=zs?(s.out=Gt(e,!0),s.job=null):Ls+=s.owes=Xt(e)+1024:s.out={requestBody:e?e.requestBody:null,responseBody:e?e.responseBody:null},s.owes&&typeof requestIdleCallback>"u"&&(s.sent=!0,Ft(s)),Promise.resolve(n).then(()=>Bt(()=>{this.v.has(s)&&(void 0!==s.out?this.S(s,s.out):s.sent||Ft(s))}))}holds(){return this.v.size>0}has(e){return this.v.has(e)}answered(e,t){this.v.has(e)&&(e.out=t,Promise.resolve(e.after).then(()=>Bt(()=>this.S(e,e.out??null))))}S(e,t){let n=this.v.get(e);n&&(this.v.delete(e),Ls-=e.owes||0,Us.delete(e),e.job=e.out=null,n(t))}alone(e){Promise.all([qt(),e.after]).then(()=>Bt(()=>{if(!this.v.has(e))return;let t=e.job;this.S(e,Kn?Qt(t,65536):Gt(t))}))}drop(){for(let e of this.v.keys())this.S(e,null)}now(e){let t=65536;for(let n of e?[!0,!1]:[!0])for(let e of[...this.v.keys()]){if(void 0!==e.out){this.S(e,e.out);continue}let r=e.job;if(!r){this.S(e,{requestBody:null,responseBody:null});continue}let i=Xt(r);if(n&&!(Kn&&i<=t))continue;let s=Math.min(r.requestBody?.length??0,t);this.S(e,Kn?Qt(r,s,t-s):Gt(r)),t-=n?i:t}}},Ys=/^[\t\n\r ]*\{/,eo=/[^\t\n\r ]/,to=!1,no=()=>{let e;return[new Promise(t=>e=t),e]},ro=new Set,io=/^\s*multipart\/form-data\s*(?:;|$)/i,so=()=>new TextDecoder("utf-8",{ignoreBOM:!0}),oo=(e,t)=>t<4194304&&"{"!==(eo.exec(e)?.[0]??"{"),lo=["arrayBuffer","blob","bytes","formData","json","text"],ao=globalThis.Response?.prototype.json,uo=JSON.parse,co="function"==typeof FinalizationRegistry?new FinalizationRegistry(e=>e()):null,ho=class{aj=null;P;L;aZ;B=!1;ab=new Set;bf=new Set;aE=new Xs;bM;aV=null;T=0;aI=null;aJ=null;aK=null;aL=null;constructor(e={},t=524288,n=[],r="balanced"){this.P=new Ji(e,r),this.L=t,this.aZ=new Set(n.map(Yt))}br(e){return this.aZ.size>0&&this.aZ.has(Yt(e))}start(e,t,n,r){this.B||(this.B=!0,this.T++,this.aj=e,this.aV=t??null,this.bM=n,this.ba=!1,r||this.prepare(),this.bY(),this.bZ())}prepare(){this.B&&(this.P.getConfig().maskNetworkBodies||Zt(this,!0))}askForCode(){this.P.getConfig().maskNetworkBodies||qt()}stop(e){this.B&&(this.B=!1,function(e){Ns.delete(e)}(this),(e||0===this.ab.size)&&(this.aj=null),e&&(this.cutBodies(),this.aE.drop()),this.b5(),this.b6())}settle(e){let t,n=Promise.allSettled([...this.ab]),r=new Promise(n=>{t=setTimeout(n,e)});return Promise.race([n,r]).then(()=>{clearTimeout(t),!this.B&&(this.cutInflight(),this.aj=null)})}cutInflight(){this.cutBodies(),this.aE.now(!0)}cutBodies(e){for(let t of[...this.bf])t(e)}reportDue(e){e&&this.cutBodies(!0),this.aE.now(!1)}hasInflight(){return this.ab.size>0}aD(e){if(!this.B)return!1;try{let t=!this.aV||this.aV(e);return t&&!this.P.getConfig().maskNetworkBodies&&Zt(this),t}catch{return!1}}bv(e){this.ab.add(e),e.finally(()=>{this.ab.delete(e),!this.B&&0===this.ab.size&&(this.aj=null)})}b1(e,t){let n=[e,null],r=Number(e.headers.get("content-length")??0);if(r>this.L)return t(`[Response body too large: ${r} bytes]`),n;if(null===e.body)return t(""),n;let i=null;if(void 0!==e.body)try{i=function(e,t,n){let r=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(r,"body")?.get,s=r.clone;if(!i||"function"!=typeof s)return null;let o,l=0,a=new Promise(e=>o=e),u=e=>{h.reported||(h.reported=!0,h.text="",n(e))},c=e=>{u(e),o()},h={touched:!1,reported:!1,text:"",say:u,end:c,finished:o},d=Gs,f=()=>{! --l&&!h.touched&&c(d)},p=e=>{l++,co?.register(e,f)},g=()=>c(R("")),y=e=>{let n=new TextDecoder;c(_("string"==typeof e?e:on(n,"",e,t)+n.decode(),t))},b=e=>{let n=e.getReader(),r=new TextDecoder,i="",s=()=>n.read().then(e=>e.done?y(i+r.decode()):(i=on(r,i,e.value,t),i.length<=t?s():(y(i),n.cancel())));s().catch(g)},m=e=>{try{b(s.call(e).body)}catch{c(null)}},v=(e,n)=>{p(e);let o,l,a=(t,n)=>{Object.defineProperty(e,t,{...n,configurable:!0})};for(let t of lo){let n=r[t];"function"==typeof n&&a(t,{value(){return this!==e||h.reported?n.call(this):(h.touched=!0,"formData"==t||"json"==t&&n!=ao?(m(e),n.call(e)):("json"==t?r.text:n).call(e).then(e=>(h.reported||("blob"==t?b(e.stream()):y("arrayBuffer"==t?new Uint8Array(e):e)),"json"==t?uo(e):e),e=>{throw g(),e}))},writable:!0})}a("body",{get(){if(this!==e)return i.call(this);let r=i.call(e);if(r!==o&&(o=l=r,n&&r&&!r.locked&&!h.reported)){let e=Kn?.relayBody;e&&(l=e(r,t,h),p(l)),d=e?Gs:Qs}return l}}),a("clone",{value(){let t=s.call(this);return this===e&&v(t),t},writable:!0})};return v(e,!0),[e,e=>{(!e||!h.touched)&&c(h.touched?R(h.text):d)},a]}(e,this.L,t)}catch{return t(null),n}if(i)return i;try{e.clone().text().then(e=>t(_(e,this.L)),()=>t(null))}catch{t(null)}return n}bY(){if("function"!=typeof globalThis.fetch)return;let e=globalThis.fetch;this.aI=e;globalThis.fetch=(t,n)=>{if(!this.B||!this.aD())return e.call(globalThis,t,n);let r;try{r=sn(t)?t.url:t instanceof URL?t.href:String(t)}catch{return e.call(globalThis,t,n)}if(this.br(r))return e.call(globalThis,t,n);let i,s=t;if(sn(t)&&null==n?.body)try{s=t.clone()}catch{return e.call(globalThis,t,n)}try{i=new Request(s,function(e){let t=e?.body,n=ArrayBuffer.isView(t)?t.buffer:t,r="string"==typeof t?"":t instanceof URLSearchParams?new URLSearchParams:t instanceof FormData?new FormData:n instanceof ArrayBuffer&&n.byteLength?new Uint8Array(n,0,0):t;return r===t||Object.getPrototypeOf(e)!=Object.prototype?e:Object.create(Object.prototype,{...Object.getOwnPropertyDescriptors(e),body:{value:r}})}(n))}catch{return e.call(globalThis,t,n)}let o=this.T,l=performance.now(),a=i.method,u=ln(i.url),c=en(i.headers),h=this.P.getConfig().maskNetworkBodies,d=e.call(globalThis,t,n),f=()=>this.B&&o===this.T,[p,g]=no(),y=null==n?.body&&sn(t)&&!/^(?:GET|HEAD)$/.test(a)?Promise.resolve().then(()=>{if(null!==i.body)return function(e,t,n,r){if(io.test(e.headers.get("content-type")??""))return e.formData().then(e=>r()?tn(e):null);let i=e.body;if(i)return async function(e,t,n,r){let i=e.getReader(),s=so(),o="",l="";try{for(;;){let e=await i.read();if(!r())return i.cancel().catch(()=>{}),null;if(e.done)return o+s.decode();let a=e.value,u=n&&!l&&a instanceof Uint8Array?[a.subarray(0,1024),a.subarray(1024)]:[a];for(let e of u){let r=s.decode(e,{stream:!0});if(l||(l=eo.exec(r)?.[0]??""),o+=r,n&&oo(l,t))return i.cancel().catch(()=>{}),o}if(o.length>t&&(o.length>4194304||""!==l&&"{"!==l))return i.cancel().catch(()=>{}),o}}catch{return null}}(i,t,n,r);let s=3*t+4;return e.blob().then(async e=>{if(0===e.size)return;let i=t=>(async(e,t)=>{let n=await e.arrayBuffer();if(!t())throw 0;return so().decode(n)})(e.slice(0,t),r);if(n){let e=await i(1024);if(oo(e,t))return e}let o=await i(s);return e.size>s&&/^[\t\n\r ]*(?:\{|$)/.test(o)?i(12582916):o}).catch(()=>null)}(i,this.L,h,()=>f());b=null,m=""}):null,b=null!=n?.body?h?Promise.resolve(rn(n.body,!1)):async function(e,t){if(null==e)return null;try{let n=nn(e,t);return void 0!==n?n:e instanceof FormData?_(tn(e),t):e instanceof Blob?e.size>t?`[Blob: ${e.size} bytes, truncated]`:await e.text():"[ReadableStream]"}catch{return"[Unreadable body]"}}(n.body,this.L):y?y.then(e=>null==e?null:_(e,this.L),()=>"[Unreadable body]"):Promise.resolve(null),m=null!=n?.body?this.aF(n.body,a,p):y?y.then(e=>null===e?"body:*":this.aF(e,a,p),()=>"body:*"):this.aF(null,a,p);return Promise.resolve(d).then(e=>{if(o!==this.T||!this.aD(!0))return f=()=>0,g(),e;try{let t,n="HEAD"===a||[204,205,304].includes(e.status);return f=this.a1(o,Date.now(),{method:a,url:u,requestHeaders:c,requestBody:null,responseHeaders:en(e.headers),responseBody:null,statusCode:e.status,duration:performance.now()-l,type:"fetch"},b,m,p,g,r=>n||h?(r(n?"":function(e){return null===e.body||e.body?.locked||/^\s*0+\s*$/.test(e.headers.get("content-length")??"")?null:Wi}(e)),t=[e,null]):t=this.b1(e,r)),t[0]}catch{return g(),e}},e=>{throw o===this.T&&this.aD(!0)?(f=this.a1(o,Date.now(),{method:a,url:u,requestHeaders:c,requestBody:null,responseHeaders:{},responseBody:null,statusCode:0,duration:performance.now()-l,type:"fetch"},b,m,p,g),e):(f=()=>0,g(),e)})}}b5(){this.aI&&(globalThis.fetch=this.aI,this.aI=null)}bZ(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,t=e.open,n=e.send;this.aJ=t,this.aK=n;let r=this.L,i=e=>this.aD(e),s=()=>this.T,o=(...e)=>this.aF(...e),l=(...e)=>this.a1(...e),a=e=>this.br(e),u=()=>this.P.getConfig().maskNetworkBodies,c=new WeakMap,h=e.setRequestHeader;this.aL=h,e.setRequestHeader=function(e,t){let n=c.get(this);return n&&(n[2][e]=t),h.call(this,e,t)};let d=t;e.open=function(e,t,...n){let r="string"==typeof t?t:t.toString(),i=d.call(this,e,t,...n);return a(r)||c.set(this,[e,ln(r),{},0]),i},e.send=function(e){let t=c.get(this);t&&(t[3]=performance.now());let a,h=s(),d=i(),f=()=>{this.readyState<2||(a=ms(),this.removeEventListener("readystatechange",f))};t&&d&&this.addEventListener("readystatechange",f);let p=u();return this.addEventListener("loadend",()=>{if(!t||!d||!i(!0))return;let n=performance.now()-t[3],s=this.getAllResponseHeaders(),u={};if(s)for(let e of s.trim().split(/[\r\n]+/)){let t=e.indexOf(": ");t>0&&(u[e.slice(0,t)]=e.slice(t+2))}let c=null;if(p)c=function(e){if(""!==e.responseType&&"text"!==e.responseType)return Wi;try{return e.responseText?Wi:null}catch{return Wi}}(this);else try{"string"==typeof this.responseText&&(c=_(this.responseText,r))}catch{c=`[${this.responseType} response]`}let f=p?rn(e,!0):function(e,t){if(null==e)return null;if(e instanceof FormData)return _(tn(e),t);let n=nn(e,t);if(void 0!==n)return n;if(typeof Blob<"u"&&e instanceof Blob)return`[Blob: ${e.size} bytes]`;if(typeof Document<"u"&&e instanceof Document)try{return _((new XMLSerializer).serializeToString(e),t)}catch{return"[Unreadable body]"}return"[Unreadable body]"}(e,r),[g,y]=no();l(h,Date.now(),{method:t[0],url:t[1],requestHeaders:t[2],requestBody:f,responseHeaders:u,responseBody:c,statusCode:this.status,duration:n,type:"xhr"},null,o(e,t[0],g),g,y,void 0,a)},{once:!0}),n.call(this,e)}}b6(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype;this.aJ&&(e.open=this.aJ,this.aJ=null),this.aK&&(e.send=this.aK,this.aK=null),this.aL&&(e.setRequestHeader=this.aL,this.aL=null)}a1(e,t,n,r,i,s,o,l,a=ms()){let u,c=performance.now()-(n.duration||0),h=r?null:{value:n.requestBody},d="object"==typeof i?null:{value:i},f=l?null:{value:n.responseBody},p=n,g=()=>p,y=0,b=(n,r,i)=>{if(!p)return;let s=p;p=h=d=f=null,this.bf.delete(v),o(),Bs(-y),e===this.T&&this.bV({...s,requestBody:n.value,responseBody:i.value,...void 0===r.value?{}:{requestTerm:r.value}},t,u?.done,a,y,c)},m=()=>{h&&d&&f?b(h,d,f):!to&&h&&f&&!y&&(y=1024+(h.value?.length??0),Bs(y+=f.value?.length??0)||(y=0,v()))},v=e=>{if(e)return u?.cut?.(!0);u?.cut?.(),b(h??{value:"[Unreadable body]"},d??{value:"body:*"},f??{value:null})};if(h&&d&&f)return m(),g;this.bf.add(v),this.bv(s),r?.then(e=>{h=p&&{value:e},m()}),"object"==typeof i&&i.then(e=>{d={value:e},m()});let w=l?.(e=>{f={value:e},m()});return u=w&&{cut:w[1],done:w[2]},m(),g}ba=!1;aF(e,t,n){try{let r=function(e){return null==e||""===e?"":"string"==typeof e?e.length>4194304?"body:*":function(e){return Ys.test(e)&&(e.includes('"query"')||e.includes("persistedQuery")||e.includes("\\u"))}(e)?null:"":e instanceof URLSearchParams||typeof FormData<"u"&&e instanceof FormData?"":"body:*"}(e);if(null!==r)return r;let i=globalThis.crypto?.subtle,s=to?0:e.length+1024;return Bs(s)?(e=>{if(!Vs){let e=Vs=As((Js||(Js=jt(()=>import("@keploy/capture-sdk/request-term"),void 0).then(e=>(to=!0,e)),Js.catch(()=>{})),Js),to),t=()=>{Vs=void 0;for(let t of ro)t(e);ro.clear()};e.then(t,t)}return new Promise(t=>{ro.add(t),e.then(()=>(ro.delete(t),t(void 0)))})})(n).finally(()=>Bs(-s)).then(t=>t?t.recordTermFor(e,i):"body:*",e=>(this.a9(t,e),"body:*")).catch(e=>this.a9(t,e)):"body:*"}catch(e){return this.a9(t,e)}}a9(e,t){if(!this.ba){this.ba=!0;try{console.warn(function(e,t){return mt({code:"KUI_E_REQUEST_TERM_FAILED",method:e,reason:t},"recorded request without term/body:* (failed); request unaffected, further failures silent.")}(e,St(t)))}catch{}}}bV(e,t,n,r,i,s){let o=this.aj;if(!o)return;let l,a,u=this.bM?.();this.bv(new Promise(e=>l=e));try{a=this.P.bodyJob(e)}catch{return l()}a&&(e.requestBody=e.responseBody=null),this.aE.redact(a,n=>{if(l(),n)try{o(this.P.maskNetworkData(e,n),t,u,s)}catch{}},n,r,i)}},fo=$s,po=32768,go=10485760,yo=16777216,bo=class{i;queue=[];retryQueue=[];bh=0;az=null;current=null;bc=null;ad=null;bi=null;get G(){return typeof navigator>"u"||!1!==navigator.onLine}ae=!1;bw=1;M=!1;j=!1;ao=0;am=!1;wakeSender=null;A=0;aa=0;bI=!1;bG=!1;bH=!1;bF=!1;aC=new WeakMap;J=null;aq=0;R=0;Z=!1;H=0;aG=0;constructor(e){this.i={...e,batchSize:Math.min(e.batchSize,5e3)}}cc(e,t,n){this.discard();let r=new os({code:e,status:t,server:kt(n),endpoint:this.i.endpoint,sessionId:this.bc??null});if(this.i.endsSessionOnly?.(e,function(e){if(null===e)return null;try{let t=JSON.parse(e)?.reason;return"string"==typeof t?t.slice(0,100):null}catch{return null}}(n))){this.stop();try{this.i.onSessionEnd?.()}catch{}}else{an(()=>console.error(r.message)),this.stop();try{this.i.onCaptureEnd?.()}catch{}try{this.i.onError?.(r)}catch{}}}start(e,t,n=null){this.ae||(this.ae=!0,this.bc=e,this.ad=t,this.bi=n,this.aa=un(JSON.stringify(this.bt([],this.a0()))),this.az=setInterval(()=>{this.bz||this.flush(this.am&&this.G)},this.i.batchInterval),typeof window<"u"&&(window.addEventListener("online",this.bm),window.addEventListener("pagehide",this.aA),window.addEventListener("beforeunload",this.aA),document.addEventListener("visibilitychange",this.bn)))}hold(){this.j=!0}release(e=!0){if(this.j=!1,e||this.am&&this.G)this.flush(!0);else if(this.G){let e=this.queue.length/this.i.batchSize|0;e&&(this.ao=e-1),(e||(this.Z=this.aM()))&&this.flush()}}discard(){this.queue=[],this.R=0,this.retryQueue=[]}stop(){if(!this.ae)return this.current??Promise.resolve();this.ae=!1,this.j&&this.discard(),this.az&&(clearInterval(this.az),this.az=null);let e=this.flush(!0);return typeof window<"u"&&(window.removeEventListener("online",this.bm),e.finally(()=>this.aW())),e}aW(){this.ae||this.V()>0||typeof window>"u"||(window.removeEventListener("pagehide",this.aA),window.removeEventListener("beforeunload",this.aA),document.removeEventListener("visibilitychange",this.bn))}enqueue(e){if(!this.ae)return;e.seq??=this.bw++;let t;try{let n=JSON.stringify(e),r=un(n);this.aC.set(e,[n,r]),t=this.aa+r}catch(t){this.b4(e,t),this.ap([e]);return}if(t>go){this.b3(e,t),this.ap([e]);return}this.queue.push(e),this.aq+=t,this.R+=this.p(e);let n=[];for(;this.queue.length>this.i.maxQueueSize;){let e=this.queue.shift();this.R-=this.p(e),n.push(e)}n.length>0&&this.ap(n),this.bl(),!this.bz&&(t>po?this.G&&!this.j?this.flush(!0):this.am=!0:this.queue.length>=this.i.batchSize?(null!==this.current&&this.ao++,this.flush()):!this.j&&this.G&&this.aM()&&(this.Z=!0,this.flush()))}place(){return this.bw++}get bz(){return performance.now()<this.aG}bl(){if(this.aq<=yo)return;let e=0;for(let t of this.retryQueue)e+=t.bytes;for(let t of this.queue)e+=this.p(t);let t=[];for(;e>yo;){let n=this.retryQueue.shift();if(n)e-=n.bytes,t.push(...n.events);else{let n=this.queue.shift();e-=this.p(n),this.R-=this.p(n),t.push(n)}}this.aq=e,t.length>0&&this.ap(t)}ap(e){!this.G&&0===this.H&&(this.H=1,an(()=>this.i.onFailing?.(!0)));let t=1/0;for(let n of e)"dom"===n.type&&(t=Math.min(t,n.seq??-1/0));let n=!1;if(t!==1/0){let r=[];for(let i of this.queue){let s=(i.seq??-1/0)>t,o="dom"===i.type?i.data?.type:void 0;s&&2===o&&(n=!0),s&&!n&&3===o?(e.push(i),this.R-=this.p(i)):r.push(i)}this.queue=r}an(()=>this.i.onDropped?.(e,n))}b4(e,t){if(this.bI)return;this.bI=!0;let n=t instanceof Error?t.message:String(t);this.a$(bt({code:"KUI_E_EVENT_UNSERIALISABLE",eventId:e.id,eventType:e.type,reason:n},"it cannot be serialised to JSON."))}b3(e,t){this.bG||(this.bG=!0,this.bR({code:"KUI_E_EVENT_OVERSIZED",eventId:e.id,eventType:e.type,bytes:t,cap:go},`${t} bytes in a body`,go))}reportScrubOversized(e,t,n){this.bH||(this.bH=!0,this.bR({code:"KUI_E_EVENT_OVERSIZED_SCRUBBING",eventType:e,atLeast:t,cap:n},`scrubbing the page URL's credentials out of it was certain to write at least ${t} characters`,n))}reportNavigationUnwrapped(e){this.bF||(this.bF=!0,this.a$(mt({code:"KUI_E_NAVIGATION_UNWRAPPED",method:e},"could not wrap History/Navigation API; capture continues with basic route tracking.")))}bR(e,t,n){this.a$(bt(e,`${t}, over the ingest server's ${n}-byte cap, so no batch could carry it.`))}a$(e){console.warn(e)}bt(e,t){return{sessionId:this.bc,batchId:t,events:e,metadata:this.ad,sdk:{name:"@keploy/capture-sdk",version:fo},captureIdentity:this.bi}}flush(e=!1){return this.j?Promise.resolve():(e&&(this.M=!0),this.current?this.current:0===this.V()||!this.G&&!this.M?(this.M=!1,this.H>0&&0===this.V()&&this.G&&(this.H=this.aG=0,an(()=>this.i.onFailing?.(!1))),Promise.resolve()):(this.current=this.ce(),this.current))}async ce(){let e=!1;try{do{let t=this.b8()??this.bS();if(null===t)return;this.J=t;try{await this.b_(t)}catch{this.aG=performance.now()+Math.min(2e3*2**this.H,6e4)*(1+Math.random()/2),0===this.H++&&an(()=>this.i.onFailing?.(!0)),this.aq+=t.bytes,this.retryQueue.unshift(t),this.bb();return}finally{this.J===t&&(this.J=null)}this.Z=!this.M&&this.G&&this.aM(),e=this.ao>0&&!this.j&&this.G&&this.queue.length>=this.i.batchSize,e&&this.ao--}while((this.M||this.Z||e)&&this.V()>0)}finally{this.M=!1,this.Z=!1,this.ao=0,0===this.V()&&(this.am=!1),this.current=null,this.aW()}}b7(e){return new Promise(t=>{let n=()=>{clearTimeout(r),this.wakeSender===n&&(this.wakeSender=null),t()},r=setTimeout(n,e);this.wakeSender=n})}async b_(e){let t=e.json,n=e.wire??=async function(e){let t=un(e);if(typeof CompressionStream<"u"&&typeof Response<"u")try{let n=new Response(e).body.pipeThrough(new CompressionStream("gzip")),r=await new Response(n).arrayBuffer();if(r.byteLength<t)return{body:r,bytes:r.byteLength,encoding:"gzip"}}catch{}return{body:e,bytes:t,encoding:null}}(t);for(let t=0;t<3;t++){if(e.abandoned)return;let r,i=null;try{let{body:t,bytes:s,encoding:o}=e.sent=await n;if(e.abandoned)return;let l={"Content-Type":"application/json","X-API-Key":this.i.apiKey,...o?{"Content-Encoding":o}:{}},a=!e.early&&s<=po-this.A;a&&(this.A+=s),e.onWire=!0,e.dispatched=!0;let u=typeof AbortController<"u"?new AbortController:void 0,c=u&&setTimeout(()=>u.abort(),15e3);try{r=await fetch(this.i.endpoint,{method:"POST",headers:l,body:t,keepalive:a,signal:u?.signal});try{i=await r.text()}catch{i=null}}finally{clearTimeout(c),e.onWire=!1,a&&(this.A-=s)}}catch{}if(r){if(r.ok){this.H>0&&(this.H=this.aG=0,this.M=!0,an(()=>this.i.onFailing?.(!1))),an(()=>this.i.onDelivered?.(e.events));return}let{status:t}=r,n=wt(t);if(null!==n){an(()=>this.cc(n,t,i));return}}if(this.H>0||2===t)break;await this.b7(1e3*2**t*(.5+.5*Math.random()))}throw new Error("Transport: all retry attempts failed")}b0(){let e=this.J;if(e&&!e.onWire&&!e.abandoned){if(e.abandoned=!0,this.J=null,this.aq+=e.bytes,e.dispatched){this.retryQueue.unshift(e),this.bb();return}this.queue.unshift(...e.events),this.bd(e.events,-1),this.bb()}}b8(){let e=this.retryQueue.shift();return e?{events:e.events,batchId:e.batchId,json:e.json,bytes:e.bytes,wire:e.wire,dispatched:e.dispatched,onWire:!1,abandoned:!1,early:e.early}:null}bS(){if(0===this.queue.length)return null;let e=this.aM(),t=this.Z&&!this.M&&e?po-this.A:go;this.Z=!1;let n=0,r=this.aa,i=0,s=Math.min(this.i.batchSize,this.queue.length);for(;i<s;){let e=this.p(this.queue[i])+(0===i?0:1);if(r+e>t)break;e>n&&(n=e),r+=e,i++}0===i&&(n=this.p(this.queue[0]),r+=n);let o=this.queue.splice(0,Math.max(i,1));this.bd(o);let l=this.a0(),a=this.bP(o,l);for(let e of o)this.aC.delete(e);return{events:o,batchId:l,json:a,dispatched:!1,onWire:!1,abandoned:!1,bytes:r,early:e&&this.aa+n<=po}}bP(e,t){return JSON.stringify(this.bt([],t)).replace('"events":[]',()=>`"events":[${e.map(e=>this.aC.get(e)?.[0]??JSON.stringify(e)).join()}]`)}p(e){return this.aC.get(e)?.[1]??un(JSON.stringify(e))}a0(){let e=typeof crypto<"u"?crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();this.bh+=1;let t=Math.floor(4294967295*Math.random()).toString(16).padStart(8,"0");return`${Date.now().toString(16).padStart(12,"0")}-${(this.bh%4294967296).toString(16).padStart(8,"0")}-`+t}bd(e,t=1){for(let n of e)this.R-=t*this.p(n)}aM(){return this.aa+this.R+this.queue.length>po-this.A}V(){let e=this.queue.length;for(let t of this.retryQueue)e+=t.events.length;return e}bb(){let e=this.V()-this.i.maxQueueSize,t=[];for(;e-- >0&&this.queue.length>0;){let e=this.queue.pop();this.R-=this.p(e),t.push(e)}t.length>0&&this.ap(t.reverse()),this.bl()}flushOnUnload(e=!1){if(this.j||(this.b0(),this.queue.sort((e,t)=>e.seq-t.seq),"function"!=typeof fetch))return;for(;this.retryQueue.length>0;){let e=this.retryQueue[0],t=e.sent,n=t?t.bytes:un(e.json);if(n>po-this.A)return;this.retryQueue.shift(),e.dispatched=!0,this.bA(t?t.body:e.json,n,t?.encoding)}if(0===this.queue.length)return;let t=po-this.A-(e&&this.J?.early&&this.J.onWire?this.J.sent?.bytes??this.J.bytes:0),n=this.a0(),r=this.aa,i=0;for(let e of this.queue){let n=this.p(e)+(0===i?0:1);if(r+n>t)break;r+=n,i++}if(0===i)return;let s=this.queue.splice(0,i);this.bd(s);let o=this.bP(s,n);this.bA(o,un(o))}bA(e,t,n){try{this.A+=t,fetch(this.i.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.i.apiKey,...n?{"Content-Encoding":n}:{}},body:e,keepalive:!0}).then(e=>e.arrayBuffer()).catch(()=>{}).finally(()=>{this.A-=t})}catch{this.A-=t}}bm=()=>{try{this.i.beforeOnlineFlush?.()}catch{}this.wakeSender?.(),this.flush(this.am)};aA=e=>{if(!this.j&&"pagehide"===e.type)try{this.i.beforeUnloadFlush?.()}catch{}this.flushOnUnload("beforeunload"===e.type),this.aW()};bn=()=>{this.j||"hidden"===document.visibilityState&&(this.i.beforeHiddenFlush?.(),this.flush(!0))};get queueSize(){return this.V()}},mo=null,vo=!1,wo=null,ko=!1,xo=[new Map,new Map],So=[0,0],Eo=e=>e.strict?new as({reason:e.failed}):new us({reason:e.failed}),Ao=256,Io=65536,To=new Map,$o="",Co=-1,_o=null,Ro=64,Oo=524288,Do=new Set,No=new Set,zo=null,Lo=null,jo=null,Bo=[],Uo=null,Po=null,qo=new Map,Mo=!1,Ko=Object.getOwnPropertyDescriptor,Zo=/\/(?:(?:log|sign)-?(?:in|out)|auth|oauth|session|tokens?)(?:\b|$)/i,Fo=class{h="idle";af=!1;aT=!1;N=!1;K=!1;l=null;bJ=!1;aP=5e3;a_=!1;failing(e){this.a_=e,null!==this.l&&clearTimeout(this.l),this.l=null,!e&&this.K&&this.a2(!1)}lost(e,t){t||!e.some(e=>"dom"===e.type)||(this.K=!0,this.a2($n(e)))}a2(e){if(this.a_)return;if(null!==this.l){if(!e||!this.bJ)return;clearTimeout(this.l)}this.bJ=!e;let t=e?this.aP:0;e&&(this.aP=Math.min(2*this.aP,6e4)),this.l=setTimeout(()=>{if(this.l=null,!this.K||"recording"!==this.getState())return;let e=this.I?.takeFullSnapshot;if(e){this.N=!1;try{e.call(this.I)}catch{this.N=!0}}},t)}delivered(e){$n(e)&&(this.aP=5e3)}bD=new bi({note:e=>{let t=this.I?.mirror?.getNode(e);t&&this.a8.set(e,t)},present:e=>this.bT(e),forget:e=>{this.a8.delete(e)}});a8=new Map;ac=null;ad=null;k;a3=null;bN=null;bL=null;aQ=null;ak=!1;C=null;aH=null;al=null;I=null;W=!1;q=0;aS=null;ar=null;a6=null;ai="";aR="";ag=0;bC="";actAt=0;constructor(e){this.k=e}async start(e,t=null,n=!1,r=null,i=null,s=null){if("active"===this.h)return this.ac;"stopping"===this.h&&this.stop();let o={secretRoutes:[],keepRoutes:[]};for(let e of["secretRoutes","keepRoutes"]){let t=this.k.privacy?.[e]??[];if(!Array.isArray(t))throw this.h="stopped",new cs({option:e,received:Et({returned:t})});for(let n of t){let t=X(n,"keepRoutes"===e);if(null===t)throw this.h="stopped",new cs({option:e,received:Et({returned:n})});o[e].push(t)}}!function(e,t){for(let[n,r]of[[Xr.secret,e],[Xr.keep,t]])for(let e of r){let t=`${n===Xr.keep}${e.join("/")}`;Yr.has(t)||(Yr.add(t),n.push(e),ei++,ni=["",[],!1,null])}}(o.secretRoutes,o.keepRoutes);let l,a=this.k.sampleRate??1;if(Math.random()>a)return this.h="stopped","";this.a3=e,this.bN=t,this.bL=r,this.aQ=i;try{l=this.k.sessionIdGenerator?this.k.sessionIdGenerator():cn()}catch(e){throw this.h="stopped",new ls({sessionId:null,received:Et({threw:e})})}if(!pt(l))throw this.h="stopped",new ls({sessionId:"string"==typeof l?l:null,received:Et({returned:l})});this.ac=l,this.ad=function(e){let t=typeof window<"u"?window:void 0,n=typeof navigator<"u"?navigator:void 0,r=t?.location?.href??"",i=r?mn(r):null;return{url:ze(e(r),i),userAgent:n?.userAgent??"",viewport:{width:t?.innerWidth??0,height:t?.innerHeight??0},referrer:typeof document<"u"&&document.referrer?ze(e(document.referrer),i):"",language:n?.language??"",devicePixelRatio:t?.devicePixelRatio??1,timestamp:Date.now()}}(this.aN),this.h="active",this.af=n,this.N=!1,this.ag=0,this.actAt=0,this.aT=typeof document<"u"&&"hidden"===document.visibilityState,this.W=!1;let u=++this.q;typeof document<"u"&&(this.ar=()=>{this.aT="hidden"===document.visibilityState,"recording"===this.getState()&&this.by()},document.addEventListener("visibilitychange",this.ar)),this.aR=typeof location<"u"?location.href:"",this.ai=typeof location<"u"?this.aN(location.href):"",this.a6=Tn((e,t,n)=>this.bx(e,t,n));let c=await this.a5();if(u!==this.q||"active"!==this.h)return"";if(null!==c&&typeof window<"u")throw this.stop(),Eo(c);let h=this.k.maxSessionDuration??6e5;return this.aS=setTimeout(()=>{try{this.bN?.()}finally{"active"===this.h&&this.stop()}},h),zo?.refused&&s?.(zo.refused),this.ac}stopDom(){"active"===this.h&&(this.h="stopping"),this.al&&(this.al(),this.al=null),this.aS&&(clearTimeout(this.aS),this.aS=null)}stop(){if("active"===this.h||"stopping"===this.h){null!==this.C&&(window.removeEventListener("online",this.C),this.C=null,this.a7()),this.ak=!1;for(let e of xo)e.delete(this);this.stopDom(),this.I=null,this.l&&(clearTimeout(this.l),this.l=null),this.ar&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.ar),this.ar=null),this.a6?.(),this.a6=null,this.h="stopped"}}bx(e,t,n){if("active"!==this.h)return;this.aR=location.href;let r=this.aN(location.href);pn(r)!==pn(this.ai)&&(this.ai=r,this.emitEvent("dom",{type:4,data:{href:r,...fn(),cause:e,...void 0===t?{}:{userInitiated:t},...void 0===n?{}:{initiator:n}},timestamp:Date.now()}))}b2(e){if("object"!=typeof e||null===e)return e;let t=e,n=t.data?.href;if(4!==t.type||"string"!=typeof n)return e;this.ai=this.aN(n);let r=this.ad?.timestamp,i=1===this.ag&&r<t.timestamp&&t.timestamp-r<=1e4;return this.ag=2,{...t,...i?{timestamp:r}:{},data:{...t.data,href:this.ai}}}isUserPaused(){return this.af}pause(){"active"===this.h&&(this.af=!0)}resume(){"active"===this.h&&(this.af=!1,"recording"===this.getState()&&this.by())}by(){if(!this.al){this.N=!1;let e=this.q;this.a5().then(t=>{null!==t?this.bE(e,t):this.bU(e)});return}if(!this.N&&!this.K)return;let e=this.I?.takeFullSnapshot;if(e){if(this.a_){this.K=!0;return}this.N=!1;try{e.call(this.I)}catch{this.N=!0}}}getSessionId(){return"active"===this.h?this.ac:null}get bO(){return"active"===this.h&&!this.af}getState(){return"idle"===this.h?"idle":"stopped"===this.h||"stopping"===this.h?"stopped":this.af||this.aT?"paused":"recording"}getMetadata(){return this.ad}async a5(){if(this.W)return null;this.W=!0;let e=this.q;if(!this.a4()&&typeof window<"u"&&!1===navigator.onLine&&!zt())return this.W=!1,this.bK(e),null;let t=+("strict"===this.k.privacyMode),n=()=>{let e=this.q;return xo[t].set(this,t=>{this.ak&&this.bs(e,t)}),this.bX()};if(So[t])return n();let r=dn(t>0),i=await As(r,this.a4());if(!i)return e===this.q&&"active"===this.h&&(n(),So[t]||function(e,t){So[e]++,t.then(t=>{So[e]--;let n=[...xo[e].values()];xo[e].clear();for(let e of n)e(t)})}(t,r)),null;if(e!==this.q)return null;if("failed"in i)return this.W=!1,i;let s=i.record;return"recording"!==this.getState()?(this.W=!1,null):(this.I=s,this.al=s(this.b9())??null,null)}bK(e){if(null!==this.C)return;let t=()=>{if(window.removeEventListener("online",t),this.a7(),this.C=null,e===this.q&&"active"===this.h){if(!1===navigator.onLine){this.bK(e);return}dn("strict"===this.k.privacyMode).then(t=>this.bs(e,t))}};this.C=t,window.addEventListener("online",t,{once:!0}),this.aH=setInterval(()=>{!1!==navigator.onLine&&t()},1e3)}bX(){return this.W=!1,this.ak=!0,null}bs(e,t){if(e===this.q&&"active"===this.h){if(this.ak=!1,"failed"in t){this.bE(e,t);return}this.a5(),this.aQ?.(null)}}a7(){null!==this.aH&&(clearInterval(this.aH),this.aH=null)}bE(e,t){e!==this.q||"active"!==this.h||(this.stop(),this.aQ?.(Eo(t)))}bU(e){e!==this.q||"active"!==this.h||!this.a4()||null===this.C||(window.removeEventListener("online",this.C),this.C=null,this.a7(),this.aQ?.(null))}a4(){return vo&&(ko||"strict"!==this.k.privacyMode)}awaitingRRWeb(){return null!==this.C||this.ak}b9(){let e=this.k.privacyMode??"balanced",t=this.k.privacy??{},n=[...this.k.maskSelectors??[],...t.maskSelectors??[]].filter(Cn);this.bC=n.join(",");let r=[...this.k.unmaskSelectors??[],...t.unmaskSelectors??[]],i="off"!==e,s={color:i,date:i,"datetime-local":i,email:i,file:i,month:i,number:i,range:i,search:i,tel:i,text:i,time:i,url:i,week:i,textarea:i,select:i,password:!0,hidden:!0},o='[contenteditable]:not([contenteditable="false"])',l=i?[o]:[],a=[...n,'[data-keploy-mask]:not([data-keploy-mask="false"]),[data-clarity-mask]',...l].join(","),u=r.join(","),c=u?(e,t)=>{try{if(i&&t?.closest(o))return e.replace(/[\S]/g,"*");if(t?.closest(u))return e}catch{}return e.replace(/[\S]/g,"*")}:void 0;return{emit:e=>this.emitEvent("dom",e,e=>this.b2(e)),maskTextSelector:"strict"===e?"*":a||void 0,...c?{maskTextFn:c}:{},blockSelector:t.blockSelectors?.join(",")||void 0,maskInputOptions:s,userTriggeredOnInput:!0}}bT(e){let t=this.I?.mirror;if(void 0===t)return!0;let n=this.a8.get(e)??t.getNode(e);if(!n||!n.isConnected)return!1;for(let e=n.ownerDocument;null!==e&&e!==document;){let t=e.defaultView?.frameElement??null;if(null===t||!t.isConnected)return!1;e=t.ownerDocument}return!0}bW(e){if(!(typeof location>"u"||location.href===this.aR)){if(4===e?.type){this.aR=location.href;return}this.bx(Sn())}}aN=e=>function(e,t=!1){return e&&p(e,t?Ui:Bi)}(function(e){let[,t,n]=ue(e);if(t)return`${le(e)}/[REDACTED]`;let r=e.indexOf("#"),i=J(ie(e),V(z(e))),s=j(-1===r?e:e.slice(0,r),i);if(-1!==r){let t=e.slice(r+1).split("#")[0];Pr.test(t)&&(s+=`#${j(t,i)}`)}return null===n?s:xe(s,n)}(e),"strict"===this.k.privacyMode);ca(e,t){let n=e;if(null===n||"object"!=typeof n)return e;let r=n.data;if(null===r||"object"!=typeof r)return e;let i="strict"===this.k.privacyMode,s=null===t?[]:[...t.plain,...t.bounded],o=this.I?.mirror,l=this.bC,a=l?e=>!!o?.getNode(e)?.closest?.(l):void 0;if(2===n.type&&at(r.node,i,s,a),3!==n.type)return e;if(0===r.source){if(Array.isArray(r.adds)){!function(e){let t=new Map;for(let n of e){let e=n?.node?.type;(3===e||5===e)&&t.set(n.node.id,n)}let n=new Set;for(let e of t.values())n.add(t.get(e.nextId));for(let e of t.values()){if(n.has(e))continue;let r=[];for(let n=e;n;n=t.get(n.nextId))ot(n.node)&&r.push(n.node);r.length>1&&st(r)}}(r.adds);for(let e of r.adds)null!==e&&"object"==typeof e&&at(e.node,i,s,a)}if(Array.isArray(r.attributes))for(let e of r.attributes){let t=e?.attributes;if(null!==t&&"object"==typeof t){let n=i?o?.getNode(e.id??-1):null;Xe(t,i,s,n?.localName??"","http://www.w3.org/2000/svg"===n?.namespaceURI,a?.(e.id))}}if(Array.isArray(r.texts)){let e=this.bD.recordsIn(n);for(let t of r.texts)"string"==typeof t?.value&&(t.value=e.has(t)?it(t.value,i,s):nt(t.value))}}if(8===r.source||15===r.source){let e=[...Array.isArray(r.adds)?r.adds:[],...Array.isArray(r.styles)?r.styles.flatMap(e=>Array.isArray(e?.rules)?e.rules:[]):[]];for(let t of e)"string"==typeof t?.rule&&(t.rule=it(t.rule,i,s));"string"==typeof r.replace&&(r.replace=it(r.replace,i,s)),"string"==typeof r.replaceSync&&(r.replaceSync=it(r.replaceSync,i,s))}if(5===r.source&&"string"==typeof r.text&&(r.text=i?r.text.replace(/\S/g,"*"):nt(r.text)),9===r.source&&"string"==typeof r.fontSource&&(r.fontSource=it(r.fontSource,i,s)),13===r.source){let e=r.set;"string"==typeof e?.value&&(e.value=it(e.value,i,s))}return e}acceptsNetwork(e){return!!this.bO&&(e&&!this.ag&&(this.ag=1),!0)}emitEvent(e,t,n,r=!1,i,s){if("dom"===e&&"active"===this.h&&"recording"!==this.getState()&&(this.N=!0),(r?"active"!==this.h&&"stopping"!==this.h:!this.bO)||"dom"===e&&this.aT||!this.a3||!this.ac)return;"network"===e&&!this.ag&&(this.ag=1),this.bW("dom"===e?t:null);let o=n?n(t):t,l="dom"===e&&null!==o&&"object"==typeof o?o.type:void 0,a=o?.data;if(3===l?!this.actAt&&(2===a?.source||5===a?.source)&&(this.actAt=Math.max(1,performance.now())):4===l&&"string"==typeof a?.href&&Zo.test(a.href)&&(this.actAt=-1),this.K&&3===l)return;let u=o;if(typeof location<"u")try{"dom"===e&&(u=this.ca(o,mn(location.href))),u=ze(u,mn(location.href),e,this.bD,go)}catch(t){"dom"===e&&(this.K=!0,this.a2(2===l)),t instanceof mi&&this.bL?.(e,t.atLeast,t.cap);return}2===l&&(this.K=!1,null!==this.l&&(clearTimeout(this.l),this.l=null));let c={id:cn(),sessionId:this.ac,timestamp:i??Date.now(),type:e,data:u,seq:s};this.a3(c)}},Ho=class{bo;aY;bq;bp;constructor(e,t=Date.now()){this.bo=e,this.aY=_n(),this.bq=t;let n=Rn();this.bp=null===n?[]:[n]}build(){return null===this.aY?{refusal:"no-csprng"}:{identity:{captureId:this.bo,sessionNonce:this.aY,t0WallMs:this.bq,appOrigins:[...this.bp]}}}},Wo={},Jo=()=>{},Vo=!1,Go=!1,Qo=null,Xo=null,Yo=class e{static ending=new Set;recorder;m;transport;au;ah=!1;j=!1;capIdent=null;constructor(e){this.au=e,this.recorder=new Fo(e),this.m=new ho(e.privacy??{},e.maxBodySize??524288,[e.endpoint],e.privacyMode);let t={endpoint:e.endpoint,apiKey:e.apiKey,batchSize:e.batchSize??50,batchInterval:e.batchInterval??5e3,maxQueueSize:e.maxQueueSize??5e3,...void 0!==e.onError?{onError:e.onError}:{},onCaptureEnd:()=>this.aw(),endsSessionOnly:(t,n)=>!0===e.continuous&&void 0===e.sessionIdGenerator&&("KUI_E_SESSION_CONFLICT"===t&&"session_completed"===n||"KUI_E_INGEST_REJECTED"===t&&"session_full"===n),onSessionEnd:()=>this.bk(),onDropped:(e,t)=>this.recorder.lost(e,t),onDelivered:e=>this.recorder.delivered(e),onFailing:e=>this.recorder.failing(e),beforeUnloadFlush:()=>this.m.cutInflight(),beforeHiddenFlush:()=>this.m.reportDue(!0),beforeOnlineFlush:()=>this.m.reportDue()};this.transport=new bo(t)}static async init(t){if(Xo)return Xo;let n=Vo;return Jo(),Vo=!1,Qo=null,e.begin(t,n)}static async begin(t,n,r=!1){let i=new e(t);Xo=i;try{await i.start(n,r)}catch(e){throw i.stop(),Xo===i&&(Xo=null),e}return i}static stop(){Jo(),Vo=!1;let t=Xo;Xo=null,Qo=null;let n=new Promise(t=>{let n=setTimeout(t,1e4);Promise.all(e.ending).then(()=>{clearTimeout(n),t()})});return t||n.then(()=>{!Xo&&!Go&&(Nt(!1),Vt())}),Promise.all([t?.stop(),n]).then(()=>{})}static pause(){Xo?.pause(),null===Xo&&Go&&(Vo=!0)}static resume(){Xo?.recorder.resume(),Vo=!1}static getSessionId(){return Xo?.recorder.getSessionId()??""}static getInstance(){return Xo}static getCaptureIdentity(){return Xo?.capIdent?.build()??null}async start(e,t=!1){if(this.ah)return;let n=this.au;if(this.ah=!0,"strict"===n.privacyMode&&!1===n.privacy?.maskNetworkBodies)return this.aO(new ds);let r=!1!==n.honorPrivacySignals?function(){try{if(typeof navigator>"u")return null;let e=navigator;if(!0===e.globalPrivacyControl)return"globalPrivacyControl";if("1"===e.doNotTrack||"yes"===e.doNotTrack||typeof window<"u"&&"1"===window.doNotTrack||"1"===e.msDoNotTrack)return"doNotTrack"}catch{}return null}():null;if(null!==r)return this.aO(new hs(r),!0);let i,s=performance.now();try{Nt(!0,!t);let r=!0===n.continuous&&void 0===n.sessionIdGenerator,s=this.recorder.start(e=>this.transport.enqueue(e),()=>r?this.bk():this.aw(),e,(e,t,n)=>this.transport.reportScrubOversized(e,t,n),e=>{null===e?(this.j=!1,this.transport.release()):this.aO(e)},e=>this.transport.reportNavigationUnwrapped(e)),o=this.recorder.getSessionId();if(null!==o){this.capIdent=new Ho(o);let i=this.capIdent.build();this.j=!0,this.transport.hold();let s=this.recorder.getMetadata();this.transport.start(o,s,"identity"in i?i.identity:null),!1!==n.networkCapture&&(this.m.askForCode(),r&&!t&&(Qo=[new Map,performance.now()+5e3]),this.m.start((e,n,r,i)=>{let{method:s,statusCode:o,url:l,responseBody:a}=e,u=this.recorder.actAt,c="GET"===s||"HEAD"===s;(u<0||401===o||!c&&Zo.test(l))&&(Qo=null);let h=c?Qo?.[0]:void 0,d=s+l,f=h?.get(d);f?(f.statusCode!==o||f.responseBody!==a)&&h.delete(d):!t&&h&&(!u||i<=u)&&i<=Qo[1]&&h.size<16&&o>=200&&o<400&&(!a||a.length<=65536)&&h.set(d,{...e,optional:!0}),this.recorder.emitEvent("network",e,void 0,!0,n,r)},e=>this.recorder.acceptsNetwork(e),()=>this.transport.place(),!0),r&&t&&Qo&&!e&&setTimeout(()=>{let e=this.recorder;if(this.ah&&Qo&&e.actAt>=0&&!e.isUserPaused())for(let t of Qo[0].values())e.emitEvent("network",t,void 0,!1,s.timestamp)},0))}i=await s}catch(e){if(e instanceof ls||e instanceof us||e instanceof as||e instanceof cs)return this.aO(e,!1,s);throw e}i?(this.m.prepare(),this.recorder.awaitingRRWeb()||(this.j=!1,this.transport.release(!1))):(this.ah=!1,(Xo??this)===this&&Nt(!1))}stop(){let e=this.j;return e||this.m.reportDue(),this.recorder.stopDom(),this.m.stop(e),this.ah=!1,(e?Promise.resolve():this.m.settle(1e3)).then(()=>{let e=null===Xo;return Vt(e,()=>null!==Xo||Go),e&&!Go&&(Nt(!1),Qo=null),this.recorder.stop(),this.transport.stop()})}aO(e,t,n){Qo=null;let r=Wo[e.code];return r||(console[t?"info":"error"](e.message),r=Wo[e.code]=[-1e9,0]),this.aw().then(()=>{this.recorder=this.m=this.transport=null}),new Promise(t=>{let i=performance.now(),s=r.length>2;if((s?Math.abs(i-r[0]):r[0]-i)>31e3)if(s){let t=r.splice(2);r=Wo[e.code]=[i,r[1],...t],setTimeout(On,0,r)}else r[0]=-1e9;r.length>=18?t():r.push([e.constructor,e.evidence,this.au.onError,t])<4&&(r[1]=(n??i)-r[0]<r[1]+1e3?Math.min(2*r[1]||50,3e4):0,r[0]=Math.max(i,r[0]+r[1]),setTimeout(On,Math.ceil(r[0]-i),r))})}aw(){let t=this.stop().catch(()=>{}).finally(()=>e.ending.delete(t));return e.ending.add(t),Xo===this&&(Xo=null),t}bk(){let t=Xo===this,n=this.recorder.isUserPaused();if(this.aw(),!t||typeof document>"u")return;Jo(),Vo=n;let r={...this.au,sampleRate:1};(n||this.recorder.actAt<0)&&(Qo=null);let i=()=>{let t=Vo;Jo(),Vo=!1,t&&(Qo=null),null===Xo&&e.begin(r,t,!0).catch(e=>{console.warn("[keploy] the capture's next session could not start:",e)})},s={capture:!0,passive:!0};document.addEventListener("pointerdown",i,s),document.addEventListener("keydown",i,s);let o=Tn(()=>{});Go=!0,Jo=()=>{o(),document.removeEventListener("pointerdown",i,s),document.removeEventListener("keydown",i,s),Go=!1,Jo=()=>{}}}pause(){Qo=null,this.recorder.pause(),this.m.cutBodies()}};//# sourceMappingURL=index.js.map