@keploy/capture-sdk 3.2.0 → 3.2.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.
@@ -1 +1 @@
1
- function e(e){return e.includes("%")?e.replace(jn,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!(Fn.has(e)||"page"===t&&Wn.has(e))&&(qn.has(e)||Mn.has(e)||Pn.has(e)||Kn.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),a=-1===s?null:i.slice(s+1),l=-1===r?null:e.slice(r+1),d=c(o,t)+(null===a?"":`?${u(a,t,n,o)}`)+(null===l?"":`#${h(l,t,n,o)}`);return d===e?e:d}function a(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 l(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?/(&)/:Zn),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]`,m=n.before?.(h,f,p)??null;if(null!==m)return`${h}=${m}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(Zn);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=a(f,n.form),t=f.slice(e);return`${h}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(i>=1&&(Hn.test(g)||Vn.test(g)))return"page"===n.kind||l(g,n.kind)?y():t;let v=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):Vn.test(e)?/[?#]/.test(e)?o(e,t,n+1):u(e,t,n+1):null}(g,n,i);return null!==v&&v!==g?n.whole?y():!0!==n.raw?`${h}=${encodeURIComponent(v)}`:f===g?`${h}=${v}`:encodeURIComponent(g)===f?`${h}=${encodeURIComponent(v)}`:y():e(g)!==g&&l(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(";"),l=i[s],u=!0===t.head?.(e,l,s,i)?"[REDACTED]":l;return-1===o?u:u+n.slice(o).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?a(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||!Jn.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),a=r.search?u(i,t,n,r.pathname):"",l=r.hash?h(s,t,n,r.pathname):"";return o===r.pathname&&a===i&&l===s&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+o+(r.search?`?${a}`:"")+(r.hash?`#${l}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[i,s,a,l]=r,u=""===a?-1:l.lastIndexOf("@"),c=s+a+l.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(Qn.test(t)||r&&","===t&&(Xn.lastIndex=i+1,Xn.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 m(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}function v(e,t){return`${m(0,e)}[Body not captured: ${er[t]}]\n`}function w(e){return r(e,"key")}function b(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 a=1;a<=t.length;a++){let l=t[a];void 0!==l&&l[0]<s?(l[1]>s&&(s=l[1]),o=void 0):(n+=e.slice(r,i)+(o??tr),r=s,void 0!==l&&([i,s,o]=l))}return n+e.slice(r)}function E(e,t=[]){if(!e)return e;let n=[];return function(e,t,n){x(e,ur,n),x(e,or,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&&b(e.charCodeAt(s-1));)s--;if(s<r){sr.lastIndex=r+1;let i=sr.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,ar,n),x(e,lr,n),x(e,cr,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 I(e){return e&&S(e,A(e))}function A(e){let t=[];return hr.test(e)&&(x(e,ur,t),x(e,or,t)),t}function T(e,t=dr){let n=e.replace(mr,e=>gr.test(yr.exec(e)[0])?p(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];Gn.lastIndex=0;for(let r=Gn.exec(e);null!==r;r=Gn.exec(e)){let i=r.index+(r.groups?.attr?.length??0);Yn.lastIndex=i;let s=void 0!==r.groups?.attr&&Yn.test(e);s&&(i=Yn.lastIndex);let o=r.groups?.attr??"",a=g(e,i,!/["']$/.test(o)||/^url\(/i.test(o)||s,t);"{"===e[a]&&a>i&&"$"===e[a-1]&&a--,a>i&&n.push([i,a]),Gn.lastIndex=Math.max(a,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(vr,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=wr.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 a=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[s])+i.slice(s,i.length-o).replace(/\//g,a)+e.slice(r[n.length-o])}):e}function C(e){let t=T(e,fr),n=[];return function(e,t,n="text"){let i="code"===n?xr:"string"===n?Sr:"header"===n?Er:kr,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),a=null===o?e.length:o.index;t.push([s+1,a]),n.lastIndex=a}return t}(e):[],o=0;i.lastIndex=0;for(let a=i.exec(e);null!==a;a=i.exec(e)){if(!r(a[2],"param"))continue;if(s.length>0&&(/^[ \t\r\f\v>]$/.test(a[1])||"#"===a[1]&&(!/[\w/%~-]/.test(e[a.index-1]??"")||e.startsWith("*/",a.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,a.index-9),a.index))))){for(;o<s.length&&s[o][1]<=a.index;)o++;if(o<s.length&&s[o][0]<=a.index)continue}let l=a.index+a[0].length;Ir.lastIndex=l;let u=Ir.exec(e);if(null===u)continue;"string"===n&&(Ar.lastIndex=l,u=Ar.exec(e)??u);let c=l+u[0].length;t.push([l,c]),i.lastIndex=c}}(t,n,"header"),S(t,n)}function $(e,t){return e.length>t?e.slice(0,t)+br:e}function R(e){return e+br}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 L(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 z(e,n,r=!1){let s="",o=0;return O(e,(a,l)=>{let u=t(e.slice(a,l),"page"),c=l+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?z(e,!1):`${z(e.slice(0,n),!1)}?${z(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 j(t,n=!0){return(n?/^(?:\/|[a-z][a-z\d+.-]*:\/\/)/i:/^[a-z][a-z\d+.-]*:\/\//i).test(e(t))}function q(t){return e(t).replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[\s\-_.]+/).filter(e=>""!==e).map(e=>e.toLowerCase())}function M(e,t){let n=q(e),r=n.join("");if(Rr.has(r))return 2;Nr.has(r)&&(n=[r]);let i=0;for(let e of n)if($r.has(e))i=2;else if(Nr.has(e))i||=1;else if(!zr.has(e))return 0;return 1===i&&(n.includes("accept")||n.includes("confirm")&&(Ur(n)||Ur(q(t))))?2:i}function P(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 F(e){return e.length<=4||W(e)}function W(e){return q(e).every(e=>e.startsWith("confirm")||"accept"===e||"edit"===e)}function Z(e,t){let n=e[t]??"";return Dr.has(q(e[t-1]??"").join(""))&&!W(n)&&!Or.has(n.toLowerCase())&&!/\.[A-Za-z][A-Za-z\d]{0,4}$/.test(n)&&!(P(n)&&""!==(e[t+1]??""))}function H(e){return q(e).some(e=>e.startsWith("invit"))}function V(e,t){return/^(?:rp|resetpass)$/.test(t)||e.some(e=>e.some(e=>0!==M(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))&&!j(t,!1)}function Q(e){let t=q(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 qr.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 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<=Kr;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 Cr.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,a,l){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(a,e,t);for(let r=0;r<n;r++){let i=M(t[r],t[r-1]??"");if(0===i)continue;let a=H(t[r]),h=t[r+1];Z(t,r+1)&&!u.has(h)&&!c&&(s.add(h),B(e(h))||(o.has(h)||l.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(P(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(a&&B(e)){f=e;continue}let r=M(e,t[p-1]);if(r>i)i=r,f="";else{if(""!==f&&Q(e)){d=f;break}if(!F(e))break}}""===d&&2===i&&p===n&&(d=f),""!==d&&!u.has(d)&&!c&&s.add(d),r=""===d?p-1:p}}let c=L(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=!j(p)&&(p.length>=10&&B(g)&&!/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/.test(g)&&!j(g)||p.length>=20&&B(p)&&u.some(e=>e.some(e=>/callback|oauth/i.test(e)||[...q(e),q(e).join("")].some(e=>Br.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))&&!j(n,u)){s.add(n);continue}let c=e(n);r<2&&(/[?#=]/.test(c)||j(c))&&oe(c,r+1,s,o,a,l)}}function ae(e){try{return new URL(e).origin}catch{return""}}function le(e){return ue(e)[0]}function ue(t){if(Fr[0]===t)return[Fr[1],Fr[2],Fr[3]];let n=new Set,r=new Map,i=new Map,s=new Set,o=t.indexOf("#"),a=-1===o?t:t.slice(0,o),l=-1===o?"":t.slice(o+1),u=Cr.test(l),c=a.length+(u?l.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=ae(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<Xr;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)&&!j(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)&&!j(e,!1)&&!d.includes(e)&&p.push({kind:0,value:e});return p.sort((e,t)=>t.value.length-e.value.length),Fr=[t,p,h,Re(p)],[p,h,Fr[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,Wr)),n="";for(let r=0;r<e.length;r+=Wr){let i=Math.min(Wr,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){let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=[];for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r.push(i-s+1),s=n[s-1])}return r}function de(e){let t=Zr;Zr=1/0;try{return e()}finally{Zr=t}}function fe(e){if(Hr+e>Zr)throw new oi(Hr+e,Zr)}function pe(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],a=o.indexOf("]");return a>=0&&n.endsWith(o.slice(0,a+1))&&(r[r.length-1]=o.slice(a+1)),r.every(t=>e.includes(t))}function ge(e,t){let n=e=>e.length>Vr&&/[[\]]/.test(e);if(e.plain.some(e=>n(e)&&pe(t,e,"[REDACTED]")))return!0;let r=ce(t);return[...e.bounded,...e.words.map(({value:e})=>e)].some(e=>n(e)&&pe(r,e))}function ye(e,t,n,r,i=!1){let s=[],o=0,a=Vr-n.length;for(let l of he(t,n))l<o||!r(l,l+n.length)||(s.push(l),o=l+n.length,i&&fe(e.length+s.length*a));if(0===s.length)return[e,()=>t];let l,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]"),()=>l??=u(t,"[redacted]")]}function me(e,t,n){return(0===t||!Jr.test(e[t-1])||Gr.test(e.slice(Math.max(0,t-16),t)))&&(n===e.length||!Jr.test(e[n]))}function ve(e,t,n){return Qr.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 be(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,a]=s,l=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,a);return(l===n-o.length||!function(e,t){return 0===t||Yr.test(e[t-1])||ei.test(e[t-1])||/(?::|%(?:25)*3a)$/.test(e.slice(Math.max(0,t-9),t))}(t,l))&&(!!i.befores.has("")||0!==i.longest&&function(t,n,r,i){let s=n;for(;s>0&&!Yr.test(t[s-1])&&void 0===ve(t,s,r);)s--;let o=n,a="",l=!1;for(let u=n;u>=s;u--){if(u<n&&we(t,u,r)&&(o=u,a="",l=!1),l||u!==s&&!ei.test(t[u-1]))continue;let c=t.slice(u,o);for(let t=0;t<=r;t++)c=e(c);if(a=ce(c)+a,o=u,a.length>i.longest)l=!0;else if(i.lengths.has(a.length)&&i.befores.has(a))return!0}return!1}(t,l,a,i))}function ke(e,t){if(!xe(e,t))return e;if(/^[ \t\n\r]*[{[]/.test(e)){let n=Ie(e,t);if(null!==n)return n}return $e(e,t)}function xe(e,t){return!!Se(e,t)||e.includes("\\")&&Se(Ee(e),t)}function Se(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 Ee(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(Ee(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(ni)){let n=t[0];"{"===n?(i.push(r.length),r.push(new Set)):"}"===n?i.pop():'"'===n[0]&&i.length>0&&(ri.lastIndex=t.index+n.length,ri.test(e)&&r[i[i.length-1]].add(JSON.parse(n)))}let s=Hr,o="",a=0,l=0,u=[];for(let t of e.matchAll(ni)){let i=t[0];if("{"===i){u.push(new Set(r[l++]));continue}if("}"===i){u.pop();continue}let c=i;if('"'===i[0]){let r,l=JSON.parse(i);Hr=s+o.length+(t.index-a);try{r=ke(l,n)}finally{Hr=s}ri.lastIndex=t.index+i.length;let h=ri.test(e)?u[u.length-1]:void 0;if(void 0!==h&&r!==l){let e=r;for(let t=2;h.has(r);t++)r=`${e}#${t}`;h.add(r)}r!==l&&(c=JSON.stringify(r))}else de(()=>$e(i,n))!==i&&(c='"[REDACTED]"');c!==i&&(o+=e.slice(a,t.index)+c,a=t.index+i.length,fe(o.length))}return o+e.slice(a)}function Ae(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{text:t+e.slice(r),escapes:n}}function Te(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 _e(e,t,n=!1){let r=[],i=[],s=(e,t,s)=>{let o=new Int32Array(e.length),a=0,l=t>Vr,u=-1,c=-1;for(let r of e)!n&&s(r)?o[a++]=r:l&&(r<c||(u>=0&&i.push(u,c),u=r),c=r+t);u>=0&&i.push(u,c),a>0&&r.push({at:o.subarray(0,a),length:t})};for(let n of t.plain)s(he(e,n),n.length,()=>!0);let o=ce(e);for(let n of t.bounded)s(he(o,n),n.length,t=>me(e,t,t+n.length));for(let e of t.words)s(he(o,e.value),e.value.length,t=>be(o,t,t+e.value.length,e));return{lists:r,slack:Ce(i)}}function Ce(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>Vr&&(n+=i-r-Vr)};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 $e(e,t){e=function(e,t){let n=Zr!==1/0&&Hr+Vr*e.length>Zr,{text:r,escapes:i}=e.includes("\\")?Ae(e):{text:e,escapes:[]},s=_e(r,t),{lists:o}=s;if(0===o.length)return e;let a=n&&!ge(t,e),l=s.slack+(a&&i.length>0?_e(e,t,!0).slack:0),u=new Int32Array(o.length),c=e=>o[e].at[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,m=0;for(;h.length>0;){let t=h[0],n=c(t),r=Te(i,n),s=Te(i,n+o[t].length);if(u[t]=u[t]+1,u[t]>=o[t].at.length&&(h[0]=h[h.length-1],h.pop()),h.length>0&&f(0),!(s<=g)){if(y&&r<=g){g=s;continue}m+=r-g+Vr,a&&fe(m-l),p.push(e.slice(g,r),"[REDACTED]"),g=s,y=!0}}return a&&fe(m+e.length-g-l),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<=Vr||!pe(n,r)),s[e]=t}let o=0;for(let n of t.bounded){if(r().includes(n)){let t=e;[e,r]=ye(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]=ye(e,t,n.value,(e,r)=>be(t,e,r,n),s[o])}o++}return e}function Re(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>ti?"":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})=>Qr.map(([t])=>t+e))].map(e=>JSON.stringify(e).slice(1,-1)),plain:n,bounded:r,words:s}}function De(e,t){if(0===t.length)return 0;let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=0;for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r++,s=n[s-1])}return r}function Oe(e,t,n){if(Zr===1/0||Hr+e.length<=Zr||"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>Vr;if(e.plain.some(e=>n(e)&&pe(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=>pe(o,e))&&!s.some(e=>o.includes(e))}(n,e)){fe(e.length);return}let r=function(e,t){if(ge(t,e))return null;let n=e.includes("\\"),r=n?Ae(e).text: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{value:e}of t.words)s-=De(n,e)*e.length}return s}(e,n);null!==r&&fe(r)}function Ne(e,t,n="custom",r,i){function s(e,t){Zr=i??1/0,Hr=e;try{return t()}finally{Zr=1/0,Hr=0}}if("dom"===n&&r?.observe(e),null===t)return e;let o;try{o=JSON.stringify(e)}catch{return e}let a=o;if(void 0===a||!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=Ee(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))}(a,t))return e;let l=JSON.parse(a);if("string"==typeof l)return s(0,()=>(Oe(l,"text",t),ke(l,t)));let u="dom"===n&&void 0!==r?r.recordsIn(l):new Set,c="dom"===n&&Le(l)&&3===l.type&&Le(l.data)&&13===l.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&&ii.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 oi(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)}Oe(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(!xe(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=[],a=t,l=-1;for(;!(a>=n);){if(-2!==s[a]){l=s[a];break}o.push(a);let t=e[a];if(t===i){l=a+1;break}a+="\\"===t?2:1}for(let e of o)s[e]=l;return l},s=-1,o=t=>{for(s<t&&(s=t);s<n&&!")\"'".includes(e[s]);)s++;return s},a=t=>{let r=t;for(;r<n&&/\s/.test(e[r]);)r++;return r},l=0;for(;l<n;){let r=e[l];if("/"===r&&"*"===e[l+1]){let r=e.indexOf("*/",l+2),i=r<0?n:r+2;t(l,i),l=i;continue}if(("u"===r||"U"===r)&&"url("===e.slice(l,l+4).toLowerCase()){let n=a(l+4),r=e[n],s=-1;if('"'===r||"'"===r){let t=i(n+1,r);if(t>=0){let n=a(t);")"===e[n]&&(s=n+1)}}else{let t=o(l+4);")"===e[t]&&(s=t+1)}if(s>=0){t(l,s),l=s;continue}}if('"'===r||"'"===r){let e=i(l+1,r);if(e>=0){t(l,e),l=e;continue}}l++}}(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`/*${$e(e.slice(2,n?-2:void 0),t)}${n?"*/":""}`}(o,t):$e(o,t)),fe(n.length),r=s}),n+e.slice(r)}(e,t):"body"===n?function(e,t){return xe(e,t)?Ie(e,t)??$e(e,t):e}(e,t):ke(e,t);return void 0!==i?i.push([e,o]):d.set(r,[[e,o]]),o},m=[{node:l,css:!1,attributes:!1,names:"custom"===n,root:!0}];for(;m.length>0;){let{node:e,css:r,attributes:i,names:o,root:a}=m.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&&m.push({node:i,css:r,attributes:!1,names:"custom"===n,root:!1})}else if(Le(e))for(let l of Object.keys(e)){let u=e[l];if("dom"===n&&o&&!l.startsWith("rr_")&&"_cssText"!==l&&t.plain.some(e=>l.includes(e))){delete e[l];continue}let c=h(e,l,r,i,a);if("string"==typeof u)e[l]=g(s(p,()=>y(u,c)));else if(null!==u&&"object"==typeof u){let e="dom"===n&&"attributes"===l;m.push({node:u,css:"css"===c,attributes:e,names:"custom"===n||e||"dom"===n&&i&&"style"===l||"network"===n&&a&&("requestHeaders"===l||"responseHeaders"===l),root:!1})}if(!o||l.startsWith("rr_")||"_cssText"===l)continue;let d=l;for(let e of t.plain)d.includes(e)&&(d=d.split(e).join("[REDACTED]"));if(d===l)continue;let f=e[l];delete e[l];let v=d;for(let t=2;Object.prototype.hasOwnProperty.call(e,v);t++)v=`${d}#${t}`;e[v]=f}}return l}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ze(e){if(e)for(let[t,n]of Object.entries(e))if("content-type"===t.toLowerCase())return n}function Ue(e){return t(e,"page").join("")}function Be(e){return!!ci.test(e)||!(e.length<32||ui.test(e)||hi.test(e))&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[0-9]/.test(e)&&/[A-Za-z]/.test(e)}function je(e){return e.split("/").some(e=>{if(/callback|oauth/i.test(e))return!0;let t=q(e);return[...t,t.join("")].some(e=>Br.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=Ue(s(t.slice(0,e)));if(!fi.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&&!j(e)),a=r("state").filter(e=>""!==e&&!function(e){return!!nr.test(e)&&(e.length<=16||rr.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!j(e));return o.length>0&&(t||a.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=yi;yi=e;try{return Ze(t,n)}finally{yi=r}}function Pe(t,n,r,i,s=!1){if(!("content"===t?_n?.(t,r,s,i):ki.test(t)||_n?.(t,r,s)||vi.has(t)&&xi.test(e(n))))return/[^*\s]/.test(n)?"":n}function Ke(e){return Ei.test(e)||gi&&mi.test(e)}function Fe(e){return(n,r,i)=>{let o=function(e){let t=Ii.get(e.pairs);return void 0===t&&(t={oauth:qe([...e.pairs],je(e.path))},Ii.set(e.pairs,t)),t}(i);if(o.oauth.has(Ue(s(n)))||G(t(n,"page"),r)&&(o.linkPage??=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 a=e?0:function(e){let t=0,n=null;for(let r of pi)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(a>0){let e=s(r.slice(a));if(!di.test(e)||E(e)===e)return`[REDACTED]${r.slice(a)}`}return null}}function We(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))||di.test(i)&&E(i)!==i},bare:e=>Be(e)||Be(s(e)),segment:e=>ci.test(e),head:(t,n,s,o)=>{if(!gi)return!1;o!==r&&(r=o,i=mi.test(t)?function(e){let t=new Set,n=e.startsWith("/")?e:`/${e}`;for(let e of le(`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!!ui.test(n)||n.split(/[-_.~]+/).some(B)}(n)||yi&&Z(o,s))}}}function Ze(e,t){return Ke(e)?p(e,t?Ti:Ai):e}function He(e,t){return _i.lastIndex=t,_i.test(e)?_i.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 Je(e,t){if(!/url\(|["'\\]/i.test(e)||!Ke(e)&&!e.includes("\\"))return e;let n=e.length,r=/[\t\n\f\r ]/,i="",s=0,o=(n,r,o)=>{let a=e.slice(n,r),l=a.includes("\\")?Ve(a):a,u=Ze(l,t);u!==l&&(i+=e.slice(s,n)+(l===a?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)},a=0;for(;a<n;){let t=e[a];if("/"===t&&"*"===e[a+1]){let t=e.indexOf("*/",a+2);a=-1===t?n:t+2}else if(e.startsWith("\x3c!--",a))a+=4;else if('"'===t||"'"===t){let r=a+1;for(;r<n&&e[r]!==t&&"\n"!==e[r];)r+="\\"===e[r]?2:1;r=Math.min(r,n),o(a+1,r,!0),a=r+1}else{let t=He(e,a);if(t===a){a++;continue}if("("!==e[t]||"url"!==Ve(e.slice(a,t)).toLowerCase()){a=t;continue}let i=t+1;for(;i<n&&r.test(e[i]);)i++;if('"'===e[i]||"'"===e[i]){a=i;continue}let s=i;for(;s<n&&")"!==e[s];)s+="\\"===e[s]?2:1;s=Math.min(s,n);let l=s;for(;l>i&&r.test(e[l-1]);)l--;o(i,l,!1),a=s+1}}return 0===s?e:i+e.slice(s)}function Ge(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 Qe(e,t,n=[],r="",i=!1){let s=[pi,gi];pi=n,gi=!0;try{Xe(e,t,r,i)}finally{[pi,gi]=s}}function Xe(e,t,n="",r=!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)&&Ye(s,t);continue}let a=(t?Pe(o,s,n,e,r):void 0)??et(o,nt(o,s,t,n),n);a!==s&&(e[i]=a)}}function Ye(e,t){let n=e=>et("style",Je(e,t),"");for(let t of Object.keys(e)){let r=e[t];if("string"==typeof r){let i=n(r);i!==r&&(e[t]=i)}else if(Array.isArray(r)&&"string"==typeof r[0]){let i=n(r[0]);i!==r[0]&&(e[t]=[i,...r.slice(1)])}}}function et(e,t,n){return e.startsWith("rr_")?t:function(e,t){return"value"===e?""!==t&&!bi.has(t):wi.has(e)||e.startsWith("data-")&&!vi.has(e)&&"data-srcset"!==e}(e,n)&&di.test(t)?E(t):I(t)}function tt(e){return I(e)}function nt(e,t,n,r){let i=t;return"srcset"===e||"data-srcset"===e||"imagesrcset"===e?i=function(e,t){if(!Ke(e))return e;let n=e.split(",").map(e=>{let n=/^(\s*)(\S+)([\s\S]*)$/.exec(e);return null===n?e:n[1]+Ze(n[2],t)+n[3]}).join(",");return n===e?e:n}(t,n):"style"===e||"_csstext"===e?i=Je(t,n):"ping"===e?i=t.replace(/\S+/g,e=>Ze(e,n)):"srcdoc"===e?i=function(e,t){if(!t&&!Ke(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,a="")=>{let l=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 Ci[r??i??""]??e}):e}(e.slice(r,s)),u=(t?Pe(n,l,a):void 0)??nt(n,l,t,"");u!==l&&i.push([r,s,Ge(u,o)])},a=(t,i,a="")=>{let l=t;for(;;){for(;l<n&&(r.test(e[l])||"/"===e[l]);)l++;if(l>=n||">"===e[l])return l;let t=l;for(l++;l<n&&!r.test(e[l])&&!"/>=".includes(e[l]);)l++;let u=e.slice(t,l).toLowerCase(),c=l;for(;c<n&&r.test(e[c]);)c++;if("="!==e[c]){l=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),l=Math.min(f+1,n);else{for(;f<n&&!r.test(e[f])&&">"!==e[f];)f++;l=f}i&&(s.add(`${d}:${f}`),o(u,d,f,h,a))}},l=(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,l(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))||l(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=a(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=a(o,!0,u);if(s=h+1,$i.has(u)&&h<n){let r=new RegExp(`</${u}[\\t\\n\\f\\r />]`,"gi");r.lastIndex=h+1;let o=r.exec(e),a=null===o?n:o.index;if("style"===u){let n=e.slice(h+1,a),r=Je(n,t);r!==n&&i.push([h+1,a,r])}else l(h+1,a);s=a}}else s=c+1,o=!1;o&&(l(u,c),u=s),c=e.indexOf("<",s)}l(u,n),i.sort((e,t)=>e[0]-t[0]);let h=i.length,d=new RegExp(Ri.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 a=void 0!==t[3]?'"':void 0!==t[4]?"'":"",l=i.length;o(t[2].toLowerCase(),r,n,a),i.length>l&&(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(!Ke(e))return e;let n=Si.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)?Ze(e,t):e}(t,n):vi.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):Di.test(t)&&(i=Me(!1,t,n)),i}function rt(e,t,n=[]){let r=[pi,gi];pi=n,gi=!0;try{return Je(e,t)}finally{[pi,gi]=r}}function it(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="",a=i;for(;r<n.length&&n[r][0]<e;){let[i,s]=n[r];if(i>=a&&(o+=`${t.slice(a,i)}[REDACTED]`),a=Math.max(a,Math.min(s,e)),s>e)break;r++}s.textContent=o+t.slice(a,e),i=e}}function st(e){let t=e;return 3===t?.type&&"string"==typeof t.textContent}function ot(e){let t=[];for(let n of e)st(n)?t.push(n):5!==n?.type&&(t.length>1&&it(t),t=[]);t.length>1&&it(t)}function at(e,t,n=[]){let r=[pi,gi];pi=n,gi=!0;try{!function(e,t){let n=[e],r=new Set;for(;n.length>0;){let e=n.pop();if(null===e||"object"!=typeof e||r.has(e))continue;if(r.add(e),"string"==typeof e.textContent){let n=!0===e.isStyle?Je(e.textContent,t):t&&5===e.type?"":tt(e.textContent);n!==e.textContent&&(e.textContent=n)}let i=e.attributes;if(null!==i&&"object"==typeof i&&Xe(i,t,"string"==typeof e.tagName?e.tagName.toLowerCase():"",!0===e.isSVG),Array.isArray(e.childNodes)){ot(e.childNodes);for(let t of e.childNodes)n.push(t)}}}(e,t)}finally{[pi,gi]=r}}function lt(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 ut(e){if(e.startsWith("access-control-"))return!1;if(w(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 w(n)||""!==r&&w(r+n)}function ct(){return{maskSelectors:[],unmaskSelectors:[],blockSelectors:[],maskNetworkBodies:!1,sensitiveHeaders:[...li],piiPatterns:[],secretRoutes:[],keepRoutes:[]}}function ht(e,t){let n=Object.fromEntries(Object.entries(t).filter(([,e])=>void 0!==e)),r={...e,...n};if(n.sensitiveHeaders){let t=new Set;r.sensitiveHeaders=[...li,...e.sensitiveHeaders,...n.sensitiveHeaders].filter(e=>{let n=e.toLowerCase();return!t.has(n)&&(t.add(n),!0)})}return r}function dt(e){return e.map(({pattern:e})=>e.flags.includes("g")?new RegExp(e.source,e.flags):new RegExp(e.source,e.flags+"g"))}function ft(e){return"string"==typeof e&&e.length>0&&e.length<=200&&Bi.test(e)}function pt(e){let t={};for(let n of Object.keys(e)){let r=e[n],i="https://keploy.io/docs/ui-capture/errors#"+n.toLowerCase().replace(/_/g,"-");t[n]={summary:r.summary,remedy:{command:null,manual:i,docs:i},evidence:r.evidence,optionalEvidence:r.optionalEvidence??[]}}return t}function gt(e){return e.replace(/\s+/g," ").trim()}function yt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: dropped an event: ${gt(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}: ${gt(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:xt(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 bt(e){if(null===e)return Fi;let t=e.trim();if(""===t)return Fi;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,Wi),issues:kt(t.issues)}}}}catch{}return{message:t.slice(0,Wi),issues:null}}function kt(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(t.length===Zi)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,Wi),message:r.slice(0,Wi)})}return t.length>0?t:null}function xt(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 St(e){if("threw"in e)return`threw ${xt(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} ${xt(t)}`}return`${typeof t} ${xt(t)}`}function Et(e=!0){if(!ts)return;for(let t of cs)t(e);ts=ns=as=!1,Cn=$n=Rn=void 0;let t=ls;ls=[],Tt(),setTimeout(()=>{for(let e of t)Ct(e)||e()},0)}function It(){for(let e of hs)e();hs.clear()}function At(e){let t=ts&&!ns;return t&&rs.push(e),t}function Tt(){let e=rs;rs=[];for(let t of e)t()}function _t(){!ts||ns||(ns=!0,ls.length&&It(),Tt())}function Ct(e){return ts&&(ls.push(e),ns&&It()),ts}function $t(e){return new Promise((t,n)=>{let r=()=>{new Promise(t=>t(e())).then(t,e=>{Ct(r)||n(e)})};Ct(r)||r()})}function Rt(e,t,n,r){let i=is;setTimeout(()=>{if(!r){Cn===e&&t()&&Et(n);return}if(as||i!==is||!ts)return;let s=r.defaultPrevented||os.has(r);if(r===Rn&&Cn===r&&(s||t()))return Et(n);r!==Rn&&s||(as=!0,_t())},0)}function Dt(e){let t=e.type,n=e;if("currententrychange"===t){$n&&(n.from!==fs()?.currentEntry||n.navigationType)&&os.add($n);return}if("pageshow"===t){e.isTrusted&&e.persisted&&Et();return}ts||($n=void 0);let r=ts;"navigate"===t&&($n=e),!n.destination?.sameDocument&&null==n.downloadRequest&&(r||is++,ts=!0,Cn=e,"navigate"!==t?setTimeout(()=>{Cn===e&&(as=!0,_t())},0):(Rt(e,()=>fs()?.transition,r&&ns,Rn=n),n.signal?.addEventListener("abort",()=>Rt(Cn,()=>$n===e,!1))))}function Ot(e,t=e){if(t&&Et(),us===e||"function"!=typeof addEventListener)return;us=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,ps),r(fs(),["navigate","currententrychange"])}function Nt(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}function Lt(e){return"default"in e?e.default:e}function zt(e,t){let n=e=>{let t=Lt(e),n=t.version;if(n!==gs)throw new Error(`a chunk of version ${String(n)}, not the SDK's ${gs}`);return t};return $t(e).then(n).catch(e=>t?$t(t).then(n).catch(t=>Promise.reject(new Error(`${String(e)}; beside the SDK: ${String(t)}`,{cause:e}))):Promise.reject(e))}function Ut(e){(typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout)(e,{timeout:1e3,valueOf:()=>0})}function Bt(e,t){if(!Rs.includes(e)){Rs+=e;try{console.warn(function(e,t){return mt({code:"KUI_E_BODY_WORKER_UNAVAILABLE",part:e,reason:t},"could not run the body worker or load the body chunk (evidence.part): without the worker, a body over 64 KiB is recorded cut; without the chunk, a body the main thread must redact is recorded with nothing kept; replay reports a test over a cut body unproven. Allow worker-src 'self' in the page's CSP, use a bundler that emits the worker (or copy dist/body-worker.js beside the bundle), serve it from the page's origin, or serve the SDK's dist/ as it is. Said once per page for each part.")}(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)":xt(t)))}catch{}}}function jt(e){if(typeof navigator>"u"||!1!==navigator.onLine||Nt()||"function"!=typeof addEventListener)return!1;if(!zn){zn=[];let e=()=>{if(!1===navigator.onLine)return;Un?.();let e=zn??[];zn=void 0;for(let t of e)t()};addEventListener("online",e);let t=setInterval(e,1e3);Un=()=>{removeEventListener("online",e),clearInterval(t),Un=void 0}}return zn.push(e),!0}function qt(){return On??=new Promise(e=>{let t=()=>{vs=!1,ys().then(e=>{if("function"!=typeof e.redactBodies)throw new TypeError("the body chunk has no redactBodies export");return e}).then(t=>{Dn=t,Ni.redact=e=>t.redactBodies(e),e()},t=>{ws=!0,Bt("code",t),e()})};(vs=jt(t))||t()})}function Mt(){if(bs||void 0!==Nn)return;bs=!0;let e=()=>{ms().then(e=>$t(()=>{if(!(ks.size>0||Cs(As)))return void(bs=!1);let t=e.startBodyWorker();t.onmessage=({data:e})=>{Ln=t;let n=Ts.get(e.id);n&&(Ts.delete(e.id),Es-=n.owes,n.owner.answered(n,e.out))},t.onerror=e=>Wt(t,e),Nn=t,bs=!1;let n=As;As=new Set;for(let e of n)Ft(e)})).catch(e=>Wt(null,e))};jt(e)||e()}function Pt(){qt(),Mt()}function Kt(e,t=!1){ks.add(e),(!On||void 0===Nn)&&((t?Ds:Os)||(t?Ds=!0:Os=!0,(t?Ut:e=>setTimeout(e,0))(()=>{t?Ds=!1:Os=!1,ks.size&&Pt()})))}function Ft(e){if(!e.owner.has(e))return;let t=Nn?Nn===Ln:null===Nn&&Dn;if(t||!$s(e)||!At(()=>Ft(e))){if(!t&&(e=>ns&&$s(e))(e)){e.owner.answered(e,Vt(e.job)),e.job=null;return}if(Nn){Ts.set(++_s,e);try{Nn.postMessage({id:_s,job:e.job}),Es+=e.owes}catch{Ts.delete(_s),e.owner.alone(e)}}else null===Nn?e.owner.alone(e):(As.add(e),Pt())}}function Wt(e,t){if(e&&Nn!==e)return;try{e?.terminate()}catch{}let n=[...Ts.values(),...As].filter(e=>e.owner.has(e));if(Ts.clear(),Es=0,Nn=void 0,As=new Set(n),!ks.size&&!n.length)return void(bs=!1);bs=!0;let r=()=>{bs=!1,Mt()};if(!jt(r)&&!Ct(r)){bs=!1,Nn=null,As=new Set,Bt("worker",t);for(let e of n)e.owner.alone(e)}}function Zt(){if(Bn=void 0,Nn&&!Cs(Ts.values())){try{Nn.terminate()}catch{}Es=0,Nn=void 0,Ts.clear()}}function Ht(e=!0,t=()=>!1){e&&zn&&(Un?.(),zn=void 0,vs&&(On=void 0),void 0===Nn&&(bs=!1),As=new Set),t()&&void 0!==Ln&&Nn===Ln&&ts?(Bn=t,addEventListener("pagehide",Ns)):Zt()}function Vt(e,t){let n=e=>e&&(t?m(0,e.length):v(e.length,ws?"code-failed":"left"));return{requestBody:n(e.requestBody),responseBody:e.responseBody==Us?Us:n(e.responseBody)}}function Jt(e,t,n=t){try{return Dn.redactBodies(e,t,n)}catch{return null}}function Gt(e){return(e?.requestBody?.length??0)+(e?.responseBody?.length??0)}function Qt(e){try{let t=typeof document<"u"?document.baseURI:void 0;return new URL(e,t).href}catch{return e}}function Xt(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 Yt(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 en(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength>t)return`[Binary: ${n.byteLength} bytes]`;try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return`[Binary: ${n.byteLength} bytes]`}}function tn(e,t){if(null==e)return null;try{if("string"==typeof e)return""===e?null:Li;if(e instanceof URLSearchParams||e instanceof FormData)return e.keys().next().done?null:Li;if(e instanceof Blob)return t||e.size>0?Li:null;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength>0?Li:null;if(t&&typeof Document<"u"&&e instanceof Document)return e.hasChildNodes()?Li:null}catch{}return Li}function nn(e){return"object"==typeof e&&null!==e&&"Request"===e[Symbol.toStringTag]}function rn(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 sn(e){let t=typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"?location.href:void 0;return new URL(e,t).href}function on(e){try{e()}catch(e){setTimeout(()=>{throw e})}}function an(e){return(new TextEncoder).encode(e).length}function ln(){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 un(){return so||(so=$t(()=>import("rrweb")).then(e=>(oo=!0,{record:Lt(e).record}),e=>(so=null,{failed:xt(e)}))),so}function cn(e){return e?Promise.all([un(),ao??=zt(()=>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){_n=e}(e.kept),lo=!0,null}).catch(e=>(ao=null,xt(e)))]).then(([e,t])=>null===t||"failed"in e?e:{failed:t,strict:!0}):un()}function hn(){let e=document.documentElement;return{width:window.innerWidth||e?.clientWidth||document.body?.clientWidth||0,height:window.innerHeight||e?.clientHeight||document.body?.clientHeight||0}}function dn(e){return e.split("#").map(e=>{let t=e.indexOf("?");return-1===t?e:e.slice(0,t)}).join("#")}function fn(e){return 2===e.kind?`2${e.before}/${e.value}`:`${e.kind}${e.value}`}function pn(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=fn(e[n]);go.delete(r)||(t=!0),go.set(r,e[n])}let n=new Set(e.map(fn)),r=0;for(let e of go.keys())r+=e.length;for(let e of go.keys()){if(n.has(e)||go.size<=fo&&r<=po)break;go.delete(e),r-=e.length,t=!0}return t}function gn(e){let t=Pr;if(e!==yo||t!==mo){let n=!1;if(""===yo||t!==mo){let e=globalThis.performance?.getEntriesByType?.("navigation");e?.[0]&&(n=pn(le(e[0].name)));for(let e of ko)pn(le(e))&&(n=!0)}yo=e,mo=t,function(e){ko.delete(e),ko.add(e);let t=0;for(let e of ko)t+=e.length;for(let n of ko){if(n===e||ko.size<=wo&&t<=bo)break;ko.delete(n),t-=n.length}}(e),(pn(le(e))||n)&&(vo=Re([...go.values()]))}return vo}function yn(e){let t=e,n=t.destination?.url;Io="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=Ao[0]===r&&!1===t.userInitiated;e||r===_o?Co.set(r,(Co.get(r)??0)+1):Co.delete(r),Ao=e?Ao.slice(1):[],_o=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{}Ao=Ao.filter(e=>n.includes(e)),To=null,(!0!==t.userInitiated||!n.includes(_o))&&(_o=null),Co.clear()}$o=!1}}function mn(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 vn(e,t){return function(...n){if($o)return Reflect.apply(e,this,n);let{next:r,now:i}=t(n);_o=i,null!==i&&null!==r&&(To=r,r!==mn(So?.navigation??null,0,null)&&Ao.push(r)),$o=!0;try{return Reflect.apply(e,this,n)}catch(e){throw Ao=[],_o=null,e}finally{$o=!1}}}function wn(e){let t=e,n=t.navigationType,r=function(){let e=Io;return Io=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(;Ao[0]===t;)Ao.shift();let n=Co.get(t)??0;return n>1?Co.set(t,n-1):Co.delete(t),n?"script":void 0}(So?.navigation??null);if("traverse"===n)kn("traverse",r,i);else if("push"===n||"replace"===n){let e="string"==typeof t.from?.url?t.from.url:"";kn(Eo??(function(e,t){return e!==t&&e.split("#")[0]===t.split("#")[0]}(e,location.href)?"hash":n),r)}}function bn(){let e=Reflect.get(window,"event")?.type;return"popstate"===e||"hashchange"===e?"traverse":"push"}function kn(e,t,n){gn(location.href);for(let r of xo)try{r(e,t,n)}catch{}}function xn([e,t,,n]){let r=Object.getOwnPropertyDescriptor(e,t);return void 0!==r&&r.value===n.value&&r.configurable===n.configurable&&(!0===r.configurable||!0===r.writable)}function Sn([e,t,n]){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function En(e){if(typeof window>"u"||!window.history)return()=>{};xo.add(e),function(){if(So)return;let e=window.history,t=e.pushState,n=e.replaceState,r=Reflect.get(window,"navigation")??null;r?.addEventListener("currententrychange",wn,{capture:!0}),r?.addEventListener("navigate",yn,{capture:!0});let i=e=>t=>{let n=e(t);return{next:mn(r,n,Ao.length?To:null),now:mn(r,n,null)}},s=e=>t=>{let n=e(t);return{next:n,now:n}},o=[[e,"back",i(()=>-1)],[e,"forward",i(()=>1)],[e,"go",i(e=>e[0])],[r,"back",s(()=>mn(r,-1,null))],[r,"forward",s(()=>mn(r,1,null))],[r,"traverseTo",s(e=>"string"==typeof e[0]?mn(r,0,e[0]):null)]],a=[[e,"pushState",function(...e){let n=location.href,r=Eo;Eo="push";try{t.apply(this,e)}finally{Eo=r}kn(location.href===n?bn():"push")}],[e,"replaceState",function(...e){let t=location.href,r=Eo;Eo="replace";try{n.apply(this,e)}finally{Eo=r}kn(location.href===t?bn():"replace")}]];for(let[e,t,n]of o){let r=e&&Reflect.get(e,t);"function"==typeof r&&a.push([e,t,vn(r,n)])}let l=a.find(([e,t])=>!function(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return void 0===n?Object.isExtensible(e):!0===n.configurable||!0===n.writable}(e,t));So={navigation:r,methods:l?[]:a.map(([e,t,n])=>function(e,t,n){let r=Object.getOwnPropertyDescriptor(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,Object.getOwnPropertyDescriptor(e,t)]}(e,t,n)),refused:l?`${l[0]===e?"history":"navigation"}.${l[1]}`:null}}();let t=()=>{gn(location.href),e("traverse")};return window.addEventListener("popstate",t,{capture:!0}),window.addEventListener("hashchange",t,{capture:!0}),()=>{xo.delete(e),window.removeEventListener("popstate",t,{capture:!0}),window.removeEventListener("hashchange",t,{capture:!0}),function(){if(So&&!(xo.size>0)&&So.methods.every(xn)){for(let e of So.methods)Sn(e);So.navigation?.removeEventListener("currententrychange",wn,{capture:!0}),So.navigation?.removeEventListener("navigate",yn,{capture:!0}),Io=null,Ao=[],_o=null,Co.clear(),So=null}}()}}function In(){let e=typeof crypto<"u"?crypto:void 0;if(!e||"function"!=typeof e.getRandomValues)return null;let t=new Uint8Array(16);e.getRandomValues(t);let n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return n}function An(){if(typeof window>"u"||!window.location)return null;let e=window.location.origin;return"string"!=typeof e||""===e||"null"===e?null:e}function Tn(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()}}var _n,Cn,$n,Rn,Dn,On,Nn,Ln,zn,Un,Bn,jn=/%[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"]),Mn=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),Pn=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),Kn=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,Fn=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),Wn=new Set(["auth","session","cookie","pin","sig"]),Zn=/(&|;(?=[^;&=#]+=|end$))/,Hn=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,Vn=/[&;?#][^&;=?#]+=/,Jn=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,Gn=/[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,Qn=/[\s"'<>\\^`{|}]/,Xn=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,Yn=/url\(\s*["']?/iy,er={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"},tr="[REDACTED]",nr=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,rr=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,ir=new Set(["code","devicecode"]),sr=(new Set([...ir,"state"]),/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y),or=/(?<![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,ar=/\b\d{3}-\d{2}-\d{4}\b/g,lr=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,ur=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,cr=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,hr=/eyJ|kep_|gh[pousr]_|github_pat_|glpat-|xox[abprse]-|[sr]k_(?:live|test)_|sk-(?:proj|ant)-|npm_|whsec_|AKIA|ASIA|AIza/,dr=(JSON.stringify(tr),{kind:"param",strict:!1,whole:!1,raw:!0}),fr={...dr,spaced:!0,tail:e=>T(e,pr)},pr={...dr,spaced:!0,list:!0},gr=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[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,yr=/^\S*/,mr=/^[^\r\n]*/gm,vr=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,wr=/^(?:\\\/|\\u002[fF])/,br="...[truncated]",kr=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,xr=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Sr=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Er=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Ir=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,Ar=/[^&]+/y,Tr=y(!1),_r=y(!0),Cr=/^!?\//,$r=new Set(["reset","resets","verify","unlock","activate","invite","forgot","forgotten","recover","recovery"]),Rr=new Set(["passwordreset","passwordresets","resetpassword","verifyemail","emailverification","magiclink","magiclogin","emaillogin","loginlink","lostpassword","setpassword","createpassword"]),Dr=new Set(["setpassword","createpassword","resetpassword","passwordreset","forgotpassword","forgottenpassword","lostpassword","verifyemail","emailverification"]),Or=new Set(["sent","done","success","complete","new","error","expired","failed","invalid"]),Nr=new Set(["confirm","confirmation","confirmations","invites","invitation","invitations","verification","verifications","activation","activations","password","passwords","signup","login"]),Lr=new Set(["email","account","registration","registrations","signup"]),zr=new Set(["accept","link","new","old","sign","up","email","account","registration","admin","change","php","asp","aspx","htm","html","jsp","cgi"]),Ur=e=>e.some(e=>Lr.has(e))||e.join("").includes("signup"),Br=new Set(["cb","auth","sso","signin","authorize","authorized","redirect"]),jr="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:[]},Mr=new Set,Pr=0,Kr=16,Fr=["",[],!1,null],Wr=8192,Zr=1/0,Hr=0,Vr=10,Jr=/[A-Za-z0-9]/,Gr=/(?:%(?:25)*[\da-f]{2}|(?:\\|%(?:25)*5c)(?:[nrtbf]|u[\da-f]{4}))$/i,Qr=[["%25252f",3],["%252f",2],["%2f",1],["\\/",0],["/",0]],Xr=Math.max(...Qr.map(([,e])=>e)),Yr=/[/\\?#\s"<>`{}|^[\]]/,ei=/[!$&'()*+,;=:@]/,ti=64,ni=/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}]/g,ri=/[ \t\n\r]*:/y,ii=new Set(["type","rel","method","enctype","autocomplete","inputmode","enterkeyhint","dir","role","crossorigin","referrerpolicy","loading","decoding","fetchpriority","contenteditable","draggable","spellcheck","translate"]),si=class{constructor(e){this.page=e}styles=new Map;texts=new Map;gone(e){return void 0===this.page||!this.page.present(e)}get size(){let e=0;for(let t of this.styles.values())e+=t.size;return this.styles.size+this.texts.size+e}aE(e,t){this.P(e),this.texts.set(e,t),this.styles.get(t)?.add(e),this.page?.note(e)}P(e){let t=this.texts.get(e);void 0!==t&&this.styles.get(t)?.delete(e),this.texts.delete(e)&&this.page?.forget(e)}drop(e){let t=this.styles.get(e);if(void 0!==t)for(let e of t)this.texts.delete(e)&&this.page?.forget(e);this.styles.delete(e)&&this.page?.forget(e),this.P(e)}observe(e){if(!Le(e)||!Le(e.data))return;let t=e.data;if(2===e.type){for(let e of[...this.styles.keys(),...this.texts.keys()])this.page?.forget(e);this.styles.clear(),this.texts.clear(),this.walk(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.gone(e.id)&&this.drop(e.id);let r=Array.isArray(t.adds)?t.adds.filter(Le):[];for(let e of r)this.walk(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.styles.has(e.parentId)?this.aE(t.id,e.parentId):this.P(t.id))}n.length>0&&void 0!==this.page&&this.prune()}prune(){for(let e of this.styles.keys())this.gone(e)&&this.drop(e);for(let e of this.texts.keys())this.gone(e)&&this.P(e)}walk(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.styles.has(i)&&(this.styles.set(i,new Set),this.page?.note(i)),3===e.type&&null!==t&&this.aE(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.texts.has(e.id)&&t.add(e)}for(;r.length>0;){let e=r.pop();Le(e)&&(3===e.type&&"number"==typeof e.id&&this.texts.has(e.id)&&t.add(e),Array.isArray(e.childNodes)&&r.push(...e.childNodes))}return t}},oi=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"}},ai=[{name:"phone_us",pattern:/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g},{name:"ssn",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},{name:"ipv4",pattern:/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g}],li=["authorization","cookie","set-cookie","x-api-key","x-auth-token","proxy-authorization"],ui=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ci=/^eyJ[\w-]+\.[\w-]+\.[\w-]*$/,hi=/(?:^|-)[A-Za-z]{3,}-(?:[A-Za-z0-9]+-)*[A-Za-z]{3,}(?:-|$)/,di=/@|\d[\d .()-]{5,}\d|\d\.\d|eyJ/,fi=new Set(["code","state","accesstoken","idtoken","refreshtoken"]),pi=[],gi=!1,yi=!1,mi=/reset|verif|confirm|activat|invit|magic|log-?in|passw|unlock|forgot|recover|sign-?up/i,vi=new Set(["href","xlink:href","src","action","formaction","srcset","poster","cite","data","data-src","data-href","background","longdesc"]),wi=new Set(["title","alt","placeholder","label","content","summary","abbr","aria-label","aria-description","aria-valuetext","aria-placeholder","aria-roledescription","aria-braillelabel","aria-brailleroledescription"]),bi=new Set(["input","textarea","select"]),ki=/^(?:style|_csstext|srcset|data-srcset|imagesrcset|ping|srcdoc)$/,xi=/^[^\s"'`<>{}]*$/,Si=/^(\s*[\d.]*\s*[;,]\s*(?:url\s*=\s*)?)(['"]?)(.*?)(\2\s*)$/is,Ei=/[?#;@]|eyJ/,Ii=new WeakMap,Ai=We(!1),Ti=We(!0),_i=/(?:[A-Za-z0-9_-]|[\u0080-\uffff]|\\(?:[0-9A-Fa-f]{1,6}[ \t\n]?|[^\n0-9A-Fa-f]))+/y,Ci={Tab:"\t",NewLine:"\n",excl:"!",quot:'"',QUOT:'"',num:"#",dollar:"$",percnt:"%",amp:"&",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"},$i=new Set(["script","style","textarea","title","xmp","iframe","noembed","noframes"]),Ri=/(^|[\s/"'])(href|xlink:href|src|action|formaction|poster|cite|data|background|longdesc|data-src|data-href|srcset|imagesrcset|data-srcset|ping|content|style|srcdoc)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi,Di=/^(?:(?:[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,Oi=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"]),Ni={},Li="[MASKED]",zi=class{config;aG;ak;strict;constructor(e={},t="balanced"){this.strict="strict"===t,this.config=this.settle(ht(ct(),e)),this.aG=dt(ai),this.ak=dt(this.config.piiPatterns)}settle(e){return this.strict?{...e,maskNetworkBodies:!0}:e}maskText(e){if(!e)return e;let t=E(e,this.ak);for(let e of this.aG)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?_r:Tr)}(-1===t?e:e.slice(0,t),this.strict)}maskNetworkData(e,t){let n={...e};n.requestHeaders=this.aM(e.requestHeaders),n.responseHeaders=this.aM(e.responseHeaders);let r=this.bodyJob(e),i=r&&(t??Ni.redact?.(r)??{requestBody:e.requestBody?Li:null,responseBody:e.responseBody?Li:null});return n.requestBody=i?i.requestBody:e.requestBody?Li:null,n.responseBody=i?i.responseBody:e.responseBody?Li:null,n.url=this.maskUrl(e.url),n}bodyJob(e){return this.config.maskNetworkBodies?null:{requestBody:e.requestBody,responseBody:e.responseBody,requestType:ze(e.requestHeaders),responseType:ze(e.responseHeaders),patterns:this.ak}}getConfig(){return this.config}updateConfig(e){this.config=this.settle(ht(this.config,e)),this.ak=dt(this.config.piiPatterns)}aM(e){let t={},n=new Set(this.config.sensitiveHeaders.map(e=>e.toLowerCase()));for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();n.has(e)||ut(e)||this.strict&&!Oi.has(e)?t[r]="[REDACTED]":t[r]=this.maskText(lt(e,i,e=>this.maskUrl(e)))}return t}},Ui=200,Bi=/^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/,ji="must be 1-200 characters of letters, digits, dot, dash and underscore, with no empty dot-separated segment",qi=["status","serverMessage","endpoint","sessionId"],Mi=["issues"],Pi=pt({KUI_E_INGEST_KEY_REJECTED:{summary:"The ingest server refused the SDK's API key (401 or 403). Capture has stopped.",evidence:qi,optionalEvidence:Mi},KUI_E_INGEST_ENDPOINT_NOT_FOUND:{summary:"The ingest server answered 404 or 405: nothing at `endpoint` accepts a POST. Capture has stopped.",evidence:qi,optionalEvidence:Mi},KUI_E_SESSION_CONFLICT:{summary:"The ingest server answered 409: this session id is already claimed, or a batchId was re-used. Capture has stopped.",evidence:qi,optionalEvidence:Mi},KUI_E_INGEST_REJECTED:{summary:"The ingest server refused a batch with a terminal 4xx (400, 413 or 415). Capture has stopped.",evidence:qi,optionalEvidence:Mi},KUI_E_SESSION_ID_INVALID:{summary:"The configured `sessionIdGenerator` did not produce a session id the ingest server would accept. Capture did not start.",evidence:["sessionId","received","rule"]},KUI_E_DOM_RECORDER_UNAVAILABLE:{summary:"The capture SDK could not load rrweb, the library it records the page with. The capture ended before anything was sent.",evidence:["reason"]},KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE:{summary:"Under strict, the capture SDK could not load its attribute allow-list. The capture ended before anything was recorded or sent.",evidence:["reason"]},KUI_E_PRIVACY_ROUTE_INVALID:{summary:"A route in `privacy.secretRoutes` or `privacy.keepRoutes` is not one the SDK can match. Capture did not start.",evidence:["option","received","rule"]},KUI_E_CAPTURE_DECLINED:{summary:"The browser sent Do Not Track or Global Privacy Control, and `honorPrivacySignals` is on. Capture did not start; nothing was recorded or sent.",evidence:["signal"]},KUI_E_PRIVACY_CONFLICT:{summary:'`privacyMode: "strict"` records no body, and `privacy.maskNetworkBodies` is `false`, which asks for them. Capture did not start.',evidence:["privacyMode","option"]}}),Ki=pt({KUI_E_EVENT_UNSERIALISABLE:{summary:"The SDK dropped one captured event because it could not be serialised to JSON. The capture continues without it.",evidence:["eventId","eventType","reason"]},KUI_E_EVENT_OVERSIZED:{summary:"The SDK dropped one captured event that alone is over the ingest server's decoded cap (`evidence.cap` bytes). The capture continues without it.",evidence:["eventId","eventType","bytes","cap"]},KUI_E_EVENT_OVERSIZED_SCRUBBING:{summary:"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.",evidence:["eventType","atLeast","cap"]},KUI_E_NAVIGATION_UNWRAPPED:{summary:"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.",evidence:["method"]},KUI_E_REQUEST_TERM_FAILED:{summary:"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.",evidence:["method","reason"]},KUI_E_BODY_WORKER_UNAVAILABLE:{summary:"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.",evidence:["part","reason"]}}),Fi={message:null,issues:null},Wi=500,Zi=100,Hi=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=Pi[e].remedy,this.status=n,this.serverMessage=r.message,this.issues=r.issues,this.evidence=i}},Vi=class extends Hi{constructor(e){let{message:t,issues:n}=e.server,r=`[keploy] capture stopped: the server rejected this batch with ${e.status} and will reject the rest, so capture has stopped (${e.code}). ${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}:{}})}},Ji=class extends Hi{constructor(e){super("KUI_E_SESSION_ID_INVALID",`[keploy] capture did not start: sessionIdGenerator ${null!==e.sessionId?`returned ${JSON.stringify(e.sessionId)}, which the ingest server would refuse`:e.received.startsWith("threw ")?e.received:`returned ${e.received}, which is not a session id`} (KUI_E_SESSION_ID_INVALID). A session id ${ji}.`,null,Fi,{sessionId:e.sessionId,received:e.received,rule:ji})}},Gi=class extends Hi{constructor(e){super("KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE",`[keploy] capture ended before anything was recorded: privacyMode "strict" could not load its attribute allow-list (KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE): ${e.reason}. What to do: ${Pi.KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE.remedy.docs}`,null,Fi,{reason:e.reason})}},Qi=class extends Hi{constructor(e){super("KUI_E_DOM_RECORDER_UNAVAILABLE",`[keploy] capture ended before anything was sent: rrweb, the library the SDK records the page with, could not be loaded (KUI_E_DOM_RECORDER_UNAVAILABLE): ${e.reason}. What to do: ${Pi.KUI_E_DOM_RECORDER_UNAVAILABLE.remedy.docs}`,null,Fi,{reason:e.reason})}},Xi=class extends Hi{constructor(e){super("KUI_E_PRIVACY_ROUTE_INVALID",`[keploy] capture did not start: privacy.${e.option} has ${e.received}, which is no route (KUI_E_PRIVACY_ROUTE_INVALID). ${jr}.`,null,Fi,{option:e.option,received:e.received,rule:jr})}},Yi=class extends Hi{constructor(e){super("KUI_E_CAPTURE_DECLINED",`[keploy] capture did not start: the browser sent ${"doNotTrack"===e?"Do Not Track":"Global Privacy Control"}, and honorPrivacySignals is on (KUI_E_CAPTURE_DECLINED). Nothing was recorded or sent.`,null,Fi,{signal:e})}},es=class extends Hi{constructor(){super("KUI_E_PRIVACY_CONFLICT",'[keploy] capture did not start: privacyMode "strict" records no request or response body, and privacy.maskNetworkBodies is false, which asks for them (KUI_E_PRIVACY_CONFLICT). Remove privacy.maskNetworkBodies, or use privacyMode "balanced".',null,Fi,{privacyMode:"strict",option:"privacy.maskNetworkBodies"})}},ts=!1,ns=!1,rs=[],is=0,ss=()=>is,os=new WeakSet,as=!1,ls=[],us=!1,cs=[],hs=new Set,ds=(e,t)=>new Promise((n,r)=>{let i=()=>{if(ns&&!t)return n(void 0);let i=()=>n(void 0);hs.add(i),e.then(e=>(hs.delete(i),n(e)),e=>(hs.delete(i),r(e)))};(t||!At(i))&&i()}),fs=()=>globalThis.navigation,ps=["beforeunload","pageshow"],gs="3.2.0",ys=()=>zt(()=>import("@keploy/capture-sdk/body-redact"),void 0),ms=()=>zt(()=>import("@keploy/capture-sdk/body-worker-start"),void 0),vs=!1,ws=!1,bs=!1,ks=new Set,xs=8388608,Ss=0,Es=0,Is=e=>(e<=0||Ss+Es<xs)&&(Ss+=e,!0),As=new Set,Ts=new Map,_s=0,Cs=e=>[...e].some(e=>e.owner.has(e)),$s=e=>e.mark===ss(),Rs="",Ds=!1,Os=!1,Ns=()=>{Bn&&(Ts.clear(),Zt())};cs.push(e=>{e&&Nn&&Nn!==Ln&&Wt(Nn,"left"),Bn&&!Bn()&&Zt()});var Ls,zs,Us="[Response body not read by the page]",Bs="\0[Response body not captured]",js=class{held=new Map;redact(e,t,n,r=ss(),i){if(e?.responseBody==Bs){e.responseBody=null;let n=t;t=e=>n(e&&{...e,responseBody:v(0,ws?"code-failed":"early")})}let s={job:e,owner:this,after:n,mark:r};this.held.set(s,t),e&&(e.requestBody||e.responseBody)?!i&&Ss+Es>=xs?(s.out=Vt(e,!0),s.job=null):Ss+=s.owes=Gt(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(()=>Ut(()=>{this.held.has(s)&&(void 0!==s.out?this.answer(s,s.out):s.sent||Ft(s))}))}holds(){return this.held.size>0}has(e){return this.held.has(e)}answered(e,t){this.held.has(e)&&(e.out=t,Promise.resolve(e.after).then(()=>Ut(()=>this.answer(e,e.out??null))))}answer(e,t){let n=this.held.get(e);n&&(this.held.delete(e),Ss-=e.owes||0,As.delete(e),e.job=e.out=null,n(t))}alone(e){Promise.all([qt(),e.after]).then(()=>Ut(()=>{if(!this.held.has(e))return;let t=e.job;this.answer(e,Dn?Jt(t,65536):Vt(t))}))}drop(){for(let e of this.held.keys())this.answer(e,null)}now(e){let t=65536;for(let n of e?[!0,!1]:[!0])for(let e of[...this.held.keys()]){if(void 0!==e.out){this.answer(e,e.out);continue}let r=e.job;if(!r){this.answer(e,{requestBody:null,responseBody:null});continue}let i=Gt(r);if(n&&!(Dn&&i<=t))continue;let s=Math.min(r.requestBody?.length??0,t);this.answer(e,Dn?Jt(r,s,t-s):Vt(r)),t-=n?i:t}}},qs=/^[\t\n\r ]*\{/,Ms=/[^\t\n\r ]/,Ps=!1,Ks=()=>{let e;return[new Promise(t=>e=t),e]},Fs=new Set,Ws=/^\s*multipart\/form-data\s*(?:;|$)/i,Zs=()=>new TextDecoder("utf-8",{ignoreBOM:!0}),Hs=(e,t)=>t<4194304&&"{"!==(Ms.exec(e)?.[0]??"{"),Vs=async(e,t)=>{let n=await e.arrayBuffer();if(!t())throw 0;return Zs().decode(n)},Js=["arrayBuffer","blob","bytes","formData","json","text"],Gs=globalThis.Response?.prototype.json,Qs=JSON.parse,Xs="function"==typeof FinalizationRegistry?new FinalizationRegistry(e=>e()):null,Ys=class{L=null;C;q;ao;active=!1;H=new Set;aD=new Set;bodies=new js;place;al=null;run=0;aa=null;ab=null;ac=null;ad=null;constructor(e={},t=524288,n=[],r="balanced"){this.C=new zi(e,r),this.q=t,this.ao=new Set(n.map(Qt))}aK(e){return this.ao.size>0&&this.ao.has(Qt(e))}start(e,t,n,r){this.active||(this.active=!0,this.run++,this.L=e,this.al=t??null,this.place=n,this.aA=!1,r||this.prepare(),this.a4(),this.a5())}prepare(){this.active&&(this.C.getConfig().maskNetworkBodies||Kt(this,!0))}askForCode(){this.C.getConfig().maskNetworkBodies||qt()}stop(e){this.active&&(this.active=!1,ks.delete(this),(e||0===this.H.size)&&(this.L=null),e&&(this.cutBodies(),this.bodies.drop()),this.bc(),this.bd())}settle(e){let t,n=Promise.allSettled([...this.H]),r=new Promise(n=>{t=setTimeout(n,e)});return Promise.race([n,r]).then(()=>{clearTimeout(t),!this.active&&(this.cutInflight(),this.L=null)})}cutInflight(){this.cutBodies(),this.bodies.now(!0)}cutBodies(e){for(let t of[...this.aD])t(e)}reportDue(e){e&&this.cutBodies(!0),this.bodies.now(!1)}hasInflight(){return this.H.size>0}admits(){if(!this.active)return!1;try{let e=!this.al||this.al();return e&&!this.C.getConfig().maskNetworkBodies&&Kt(this),e}catch{return!1}}track(e){this.H.add(e),e.finally(()=>{this.H.delete(e),!this.active&&0===this.H.size&&(this.L=null)})}a8(e,t){let n=Number(e.headers.get("content-length")??0);if(n>this.q)return t(`[Response body too large: ${n} bytes]`),{page:e,cut:null};if(null===e.body)return t(""),{page:e,cut:null};let r=null;if(void 0!==e.body)try{r=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,a=0,l=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=Us,f=()=>{! --a&&!h.touched&&c(d)},p=e=>{a++,Xs?.register(e,f)},g=()=>c(R("")),y=e=>{let n=new TextDecoder;c($("string"==typeof e?e:rn(n,"",e,t)+n.decode(),t))},m=e=>{let n=e.getReader(),r=new TextDecoder,i="",s=()=>n.read().then(e=>e.done?y(i+r.decode()):(i=rn(r,i,e.value,t),i.length<=t?s():(y(i),n.cancel())));s().catch(g)},v=e=>{try{m(s.call(e).body)}catch{c(null)}},w=(e,n)=>{p(e);let o,a,l=(t,n)=>{Object.defineProperty(e,t,{...n,configurable:!0})};for(let t of Js){let n=r[t];"function"==typeof n&&l(t,{value(){return this!==e||h.reported?n.call(this):(h.touched=!0,"formData"==t||"json"==t&&n!=Gs?(v(e),n.call(e)):("json"==t?r.text:n).call(e).then(e=>(h.reported||("blob"==t?m(e.stream()):y("arrayBuffer"==t?new Uint8Array(e):e)),"json"==t?Qs(e):e),e=>{throw g(),e}))},writable:!0})}l("body",{get(){if(this!==e)return i.call(this);let r=i.call(e);if(r!==o&&(o=a=r,n&&r&&!r.locked&&!h.reported)){let e=Dn?.relayBody;e&&(a=e(r,t,h),p(a)),d=e?Us:Bs}return a}}),l("clone",{value(){let t=s.call(this);return this===e&&w(t),t},writable:!0})};return w(e,!0),{page:e,cut:e=>{(!e||!h.touched)&&c(h.touched?R(h.text):d)},done:l}}(e,this.q,t)}catch{return t(null),{page:e,cut:null}}if(r)return r;try{e.clone().text().then(e=>t($(e,this.q)),()=>t(null))}catch{t(null)}return{page:e,cut:null}}a4(){if("function"!=typeof globalThis.fetch)return;let e=globalThis.fetch;this.aa=e;globalThis.fetch=(t,n)=>{if(!this.active||!this.admits())return e.call(globalThis,t,n);let r;try{r=nn(t)?t.url:t instanceof URL?t.href:String(t)}catch{return e.call(globalThis,t,n)}if(this.aK(r))return e.call(globalThis,t,n);let i,s=t;if(nn(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.run,a=performance.now(),l=i.method,u=sn(i.url),c=Xt(i.headers),h=this.C.getConfig().maskNetworkBodies,d=e.call(globalThis,t,n),f=()=>this.active&&o===this.run,[p,g]=Ks(),y=null==n?.body&&nn(t)&&!/^(?:GET|HEAD)$/.test(l)?Promise.resolve().then(()=>{if(null!==i.body)return function(e,t,n,r){if(Ws.test(e.headers.get("content-type")??""))return e.formData().then(e=>r()?Yt(e):null);let i=e.body;if(i)return async function(e,t,n,r){let i=e.getReader(),s=Zs(),o="",a="";try{for(;;){let e=await i.read();if(!r())return i.cancel().catch(()=>{}),null;if(e.done)return o+s.decode();let l=e.value,u=n&&!a&&l instanceof Uint8Array?[l.subarray(0,1024),l.subarray(1024)]:[l];for(let e of u){let r=s.decode(e,{stream:!0});if(a||(a=Ms.exec(r)?.[0]??""),o+=r,n&&Hs(a,t))return i.cancel().catch(()=>{}),o}if(o.length>t&&(o.length>4194304||""!==a&&"{"!==a))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;if(n){let n=await Vs(e.slice(0,1024),r);if(Hs(n,t))return n}let i=await Vs(e.slice(0,s),r);return e.size>s&&/^[\t\n\r ]*(?:\{|$)/.test(i)?Vs(e.slice(0,12582916),r):i}).catch(()=>null)}(i,this.q,h,()=>f());m=null,v=""}):null,m=null!=n?.body?h?Promise.resolve(tn(n.body,!1)):async function(e,t){if(null==e)return null;try{return"string"==typeof e?$(e,t):e instanceof URLSearchParams?$(e.toString(),t):e instanceof FormData?$(Yt(e),t):e instanceof Blob?e.size>t?`[Blob: ${e.size} bytes, truncated]`:await e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?en(e,t):"[ReadableStream]"}catch{return"[Unreadable body]"}}(n.body,this.q):y?y.then(e=>null==e?null:$(e,this.q),()=>"[Unreadable body]"):Promise.resolve(null),v=null!=n?.body?this.termFor(n.body,l,p):y?y.then(e=>null===e?"body:*":this.termFor(e,l,p),()=>"body:*"):this.termFor(null,l,p);return Promise.resolve(d).then(e=>{if(o!==this.run||!this.admits())return f=()=>0,g(),e;try{let t,n="HEAD"===l||[204,205,304].includes(e.status);return f=this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:Xt(e.headers),responseBody:null,statusCode:e.status,duration:performance.now()-a,type:"fetch"},m,v,p,g,r=>{return n?(r(""),t={page:e,cut:null}):h?(r(null===(i=e).body||i.body?.locked||/^\s*0+\s*$/.test(i.headers.get("content-length")??"")?null:Li),t={page:e,cut:null}):t=this.a8(e,r);var i}),t.page}catch{return g(),e}},e=>{throw o===this.run&&this.admits()?(f=this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:{},responseBody:null,statusCode:0,duration:performance.now()-a,type:"fetch"},m,v,p,g),e):(f=()=>0,g(),e)})}}bc(){this.aa&&(globalThis.fetch=this.aa,this.aa=null)}a5(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;this.ab=e,this.ac=t;let n=this.q,r=()=>this.admits(),i=()=>this.run,s=(...e)=>this.termFor(...e),o=(...e)=>this.reportWhenKnown(...e),a=e=>this.aK(e),l=()=>this.C.getConfig().maskNetworkBodies,u=new WeakMap,c=XMLHttpRequest.prototype.setRequestHeader;this.ad=c,XMLHttpRequest.prototype.setRequestHeader=function(e,t){let n=u.get(this);return n&&(n.requestHeaders[e]=t),c.call(this,e,t)};let h=e;XMLHttpRequest.prototype.open=function(e,t,...n){let r="string"==typeof t?t:t.toString(),i=h.call(this,e,t,...n);return a(r)||u.set(this,{method:e,url:sn(r),requestHeaders:{},startTime:0}),i},XMLHttpRequest.prototype.send=function(e){let a=u.get(this);a&&(a.startTime=performance.now());let c,h=i(),d=r(),f=()=>{this.readyState<2||(c=ss(),this.removeEventListener("readystatechange",f))};a&&d&&this.addEventListener("readystatechange",f);let p=l();return this.addEventListener("loadend",()=>{if(!a||!d||!r())return;let t=performance.now()-a.startTime,i=this.getAllResponseHeaders(),l={};if(i)for(let e of i.trim().split(/[\r\n]+/)){let t=e.indexOf(": ");t>0&&(l[e.slice(0,t)]=e.slice(t+2))}let u=null;if(p)u=function(e){if(""!==e.responseType&&"text"!==e.responseType)return Li;try{return e.responseText?Li:null}catch{return Li}}(this);else try{"string"==typeof this.responseText&&(u=$(this.responseText,n))}catch{u=`[${this.responseType} response]`}let f=p?tn(e,!0):function(e,t){if(null==e)return null;if("string"==typeof e)return $(e,t);if(e instanceof FormData)return $(Yt(e),t);if(e instanceof URLSearchParams)return $(e.toString(),t);if(typeof Blob<"u"&&e instanceof Blob)return`[Blob: ${e.size} bytes]`;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return en(e,t);if(typeof Document<"u"&&e instanceof Document)try{return $((new XMLSerializer).serializeToString(e),t)}catch{return"[Unreadable body]"}return"[Unreadable body]"}(e,n),[g,y]=Ks();o(h,Date.now(),{method:a.method,url:a.url,requestHeaders:a.requestHeaders,requestBody:f,responseHeaders:l,responseBody:u,statusCode:this.status,duration:t,type:"xhr"},null,s(e,a.method,g),g,y,void 0,c)},{once:!0}),t.call(this,e)}}bd(){typeof XMLHttpRequest>"u"||(this.ab&&(XMLHttpRequest.prototype.open=this.ab,this.ab=null),this.ac&&(XMLHttpRequest.prototype.send=this.ac,this.ac=null),this.ad&&(XMLHttpRequest.prototype.setRequestHeader=this.ad,this.ad=null))}reportWhenKnown(e,t,n,r,i,s,o,a,l=ss()){let u,c=r?null:{value:n.requestBody},h="object"==typeof i?null:{value:i},d=a?null:{value:n.responseBody},f=n,p=()=>f,g=0,y=(n,r,i)=>{if(!f)return;let s=f;f=c=h=d=null,this.aD.delete(v),o(),Is(-g),e===this.run&&this.emit({...s,requestBody:n.value,responseBody:i.value,...void 0===r.value?{}:{requestTerm:r.value}},t,u?.done,l,g)},m=()=>{c&&h&&d?y(c,h,d):!Ps&&c&&d&&!g&&(g=1024+(c.value?.length??0),Is(g+=d.value?.length??0)||(g=0,v()))},v=e=>{if(e)return u?.cut?.(!0);u?.cut?.(),y(c??{value:"[Unreadable body]"},h??{value:"body:*"},d??{value:null})};if(c&&h&&d)return m(),p;this.aD.add(v),this.track(s),r?.then(e=>{c=f&&{value:e},m()}),"object"==typeof i&&i.then(e=>{h={value:e},m()});let w=a?.(e=>{d={value:e},m()});return u=w&&{cut:w.cut,done:w.done},m(),p}aA=!1;termFor(e,t,n){try{let i=null==(r=e)||""===r?"":"string"==typeof r?r.length>4194304?"body:*":function(e){return qs.test(e)&&(e.includes('"query"')||e.includes("persistedQuery")||e.includes("\\u"))}(r)?null:"":r instanceof URLSearchParams||typeof FormData<"u"&&r instanceof FormData?"":"body:*";if(null!==i)return i;let s=globalThis.crypto?.subtle,o=Ps?0:e.length+1024;return Is(o)?(e=>{if(!zs){let e=zs=ds((Ls||(Ls=zt(()=>import("@keploy/capture-sdk/request-term"),void 0).then(e=>(Ps=!0,e))).catch(()=>{}),Ls),Ps),t=()=>{zs=void 0;for(let t of Fs)t(e);Fs.clear()};e.then(t,t)}return new Promise(t=>{Fs.add(t),e.then(()=>(Fs.delete(t),t(void 0)))})})(n).finally(()=>Is(-o)).then(t=>t?t.recordTermFor(e,s):"body:*",e=>(this.az(t,e),"body:*")).catch(e=>this.az(t,e)):"body:*"}catch(e){return this.az(t,e)}var r}az(e,t){if(!this.aA){this.aA=!0;try{console.warn(function(e,t){return mt({code:"KUI_E_REQUEST_TERM_FAILED",method:e,reason:t},"recorded a request without its term, or body:*: computing it failed; the request itself was not affected. The capture continues; any further such requests in this capture are recorded that way, silently.")}(e,xt(t)))}catch{}}}emit(e,t,n,r,i){let s=this.L;if(!s)return;let o,a,l=this.place?.();this.track(new Promise(e=>o=e));try{a=this.C.bodyJob(e)}catch{return o()}a&&(e.requestBody=e.responseBody=null),this.bodies.redact(a,n=>{if(o(),n)try{s(this.C.maskNetworkData(e,n),t,l)}catch{}},n,r,i)}},eo=gs,to=32768,no=10485760,ro=16777216,io=class{config;queue=[];retryQueue=[];aF=0;S=null;current=null;sessionId=null;metadata=null;captureIdentity=null;get online(){return typeof navigator>"u"||!1!==navigator.onLine}started=!1;aN=1;v=!1;h=!1;asked=0;N=!1;wakeSender=null;k=0;G=0;aV=!1;aT=!1;aU=!1;aS=!1;V=new WeakMap;inFlight=null;held=0;queued=0;F=!1;m=0;W=0;constructor(e){this.config={...e,batchSize:Math.min(e.batchSize,5e3)}}fail(e,t,n){this.discard();let r=new Vi({code:e,status:t,server:bt(n),endpoint:this.config.endpoint,sessionId:this.sessionId??null});if(this.config.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.config.onSessionEnd?.()}catch{}}else{on(()=>console.error(r.message)),this.stop();try{this.config.onCaptureEnd?.()}catch{}try{this.config.onError?.(r)}catch{}}}start(e,t,n=null){this.started||(this.started=!0,this.sessionId=e,this.metadata=t,this.captureIdentity=n,this.G=an(JSON.stringify(this.aL([],this.ap()))),this.S=setInterval(()=>{this.aP||this.flush(this.N&&this.online)},this.config.batchInterval),typeof window<"u"&&(window.addEventListener("online",this.aI),window.addEventListener("pagehide",this.T),window.addEventListener("beforeunload",this.T),document.addEventListener("visibilitychange",this.aJ)))}hold(){this.h=!0}release(e=!0){if(this.h=!1,e||this.N&&this.online)this.flush(!0);else if(this.online){let e=this.queue.length/this.config.batchSize|0;e&&(this.asked=e-1),(e||(this.F=this.ae()))&&this.flush()}}discard(){this.queue=[],this.queued=0,this.retryQueue=[]}stop(){if(!this.started)return this.current??Promise.resolve();this.started=!1,this.h&&this.discard(),this.S&&(clearInterval(this.S),this.S=null);let e=this.flush(!0);return typeof window<"u"&&(window.removeEventListener("online",this.aI),e.finally(()=>this.am())),e}am(){this.started||this.I()>0||typeof window>"u"||(window.removeEventListener("pagehide",this.T),window.removeEventListener("beforeunload",this.T),document.removeEventListener("visibilitychange",this.aJ))}enqueue(e){if(!this.started)return;e.seq??=this.aN++;let t;try{let n=JSON.stringify(e),r=an(n);this.V.set(e,[n,r]),t=this.G+r}catch(t){this.bb(e,t),this.dropped([e]);return}if(t>no){this.ba(e,t),this.dropped([e]);return}this.queue.push(e),this.held+=t,this.queued+=this.j(e);let n=[];for(;this.queue.length>this.config.maxQueueSize;){let e=this.queue.shift();this.queued-=this.j(e),n.push(e)}n.length>0&&this.dropped(n),this.fit(),!this.aP&&(t>to?this.online&&!this.h?this.flush(!0):this.N=!0:this.queue.length>=this.config.batchSize?(null!==this.current&&this.asked++,this.flush()):!this.h&&this.online&&this.ae()&&(this.F=!0,this.flush()))}place(){return this.aN++}get aP(){return performance.now()<this.W}fit(){if(this.held<=ro)return;let e=0;for(let t of this.retryQueue)e+=t.bytes;for(let t of this.queue)e+=this.j(t);let t=[];for(;e>ro;){let n=this.retryQueue.shift();if(n)e-=n.bytes,t.push(...n.events);else{let n=this.queue.shift();e-=this.j(n),this.queued-=this.j(n),t.push(n)}}this.held=e,t.length>0&&this.dropped(t)}dropped(e){!this.online&&0===this.m&&(this.m=1,on(()=>this.config.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.queued-=this.j(i)):r.push(i)}this.queue=r}on(()=>this.config.onDropped?.(e,n))}bb(e,t){if(this.aV)return;this.aV=!0;let n=t instanceof Error?t.message:String(t);console.warn(yt({code:"KUI_E_EVENT_UNSERIALISABLE",eventId:e.id,eventType:e.type,reason:n},"it cannot be serialised to JSON."))}ba(e,t){this.aT||(this.aT=!0,this.a$({code:"KUI_E_EVENT_OVERSIZED",eventId:e.id,eventType:e.type,bytes:t,cap:no},`${t} bytes in a body, over the ingest server's ${no}-byte cap, so no batch could carry it.`))}reportScrubOversized(e,t,n){this.aU||(this.aU=!0,this.a$({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, over the ingest server's ${n}-byte cap, so no batch could carry it.`))}reportNavigationUnwrapped(e){this.aS||(this.aS=!0,this.warn(mt({code:"KUI_E_NAVIGATION_UNWRAPPED",method:e},"the page made a History or Navigation API method impossible to replace and put back, so the SDK wrapped none of them. The capture continues: route changes are still recorded, with less detail, and none says that the page's script asked for it.")))}a$(e,t){this.warn(yt(e,t))}warn(e){console.warn(e)}aL(e,t){return{sessionId:this.sessionId,batchId:t,events:e,metadata:this.metadata,sdk:{name:"@keploy/capture-sdk",version:eo},captureIdentity:this.captureIdentity}}flush(e=!1){return this.h?Promise.resolve():(e&&(this.v=!0),this.current?this.current:0===this.I()||!this.online&&!this.v?(this.v=!1,this.m>0&&0===this.I()&&this.online&&(this.m=this.W=0,on(()=>this.config.onFailing?.(!1))),Promise.resolve()):(this.current=this.run(),this.current))}async run(){let e=!1;try{do{let t=this.bg()??this.a0();if(null===t)return;this.inFlight=t;try{await this.a6(t)}catch{this.W=performance.now()+Math.min(2e3*2**this.m,6e4)*(1+Math.random()/2),0===this.m++&&on(()=>this.config.onFailing?.(!0)),this.held+=t.bytes,this.retryQueue.unshift(t),this.aB();return}finally{this.inFlight===t&&(this.inFlight=null)}this.F=!this.v&&this.online&&this.ae(),e=this.asked>0&&!this.h&&this.online&&this.queue.length>=this.config.batchSize,e&&this.asked--}while((this.v||this.F||e)&&this.I()>0)}finally{this.v=!1,this.F=!1,this.asked=0,0===this.I()&&(this.N=!1),this.current=null,this.am()}}bf(e){return new Promise(t=>{let n=()=>{clearTimeout(r),this.wakeSender===n&&(this.wakeSender=null),t()},r=setTimeout(n,e);this.wakeSender=n})}async a6(e){let t=e.json,n=e.wire??=async function(e){if(typeof CompressionStream<"u"&&typeof Response<"u")try{let t=new Response(e).body.pipeThrough(new CompressionStream("gzip")),n=await new Response(t).arrayBuffer(),r=an(e);return n.byteLength<r?{body:n,bytes:n.byteLength,encoding:"gzip"}:{body:e,bytes:r,encoding:null}}catch{}return{body:e,bytes:an(e),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 a={"Content-Type":"application/json","X-API-Key":this.config.apiKey};o&&(a["Content-Encoding"]=o);let l=!e.early&&s<=to-this.k;l&&(this.k+=s),e.onWire=!0,e.dispatched=!0;try{r=await fetch(this.config.endpoint,{method:"POST",headers:a,body:t,keepalive:l});try{i=await r.text()}catch{i=null}}finally{e.onWire=!1,l&&(this.k-=s)}}catch{}if(r){if(r.ok){this.m>0&&(this.m=this.W=0,this.v=!0,on(()=>this.config.onFailing?.(!1))),on(()=>this.config.onDelivered?.(e.events));return}let{status:t}=r,n=wt(t);if(null!==n){on(()=>this.fail(n,t,i));return}}if(this.m>0||2===t)break;let s=1e3*Math.pow(2,t)*(.5+.5*Math.random());await this.bf(s)}throw new Error("Transport: all retry attempts failed")}a7(){let e=this.inFlight;if(e&&!e.onWire&&!e.abandoned){if(e.abandoned=!0,this.inFlight=null,this.held+=e.bytes,e.dispatched){this.retryQueue.unshift(e),this.aB();return}this.queue.unshift(...e.events),this.aC(e.events,-1),this.aB()}}bg(){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}a0(){if(0===this.queue.length)return null;let e=this.ae(),t=this.F&&!this.v&&e?to-this.k:no;this.F=!1;let n=0,r=this.G,i=0,s=Math.min(this.config.batchSize,this.queue.length);for(;i<s;){let e=this.j(this.queue[i])+(0===i?0:1);if(r+e>t)break;e>n&&(n=e),r+=e,i++}0===i&&(n=this.j(this.queue[0]),r+=n);let o=this.queue.splice(0,Math.max(i,1));this.aC(o);let a=this.ap(),l=this.body(o,a);for(let e of o)this.V.delete(e);return{events:o,batchId:a,json:l,dispatched:!1,onWire:!1,abandoned:!1,bytes:r,early:e&&this.G+n<=to}}body(e,t){return JSON.stringify(this.aL([],t)).replace('"events":[]',()=>`"events":[${e.map(e=>this.V.get(e)?.[0]??JSON.stringify(e)).join()}]`)}j(e){return this.V.get(e)?.[1]??an(JSON.stringify(e))}ap(){let e=typeof crypto<"u"?crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();this.aF+=1;let t=Math.floor(4294967295*Math.random()).toString(16).padStart(8,"0");return`${Date.now().toString(16).padStart(12,"0")}-${(this.aF%4294967296).toString(16).padStart(8,"0")}-`+t}aC(e,t=1){for(let n of e)this.queued-=t*this.j(n)}ae(){return this.G+this.queued+this.queue.length>to-this.k}I(){let e=this.queue.length;for(let t of this.retryQueue)e+=t.events.length;return e}aB(){let e=0;for(let t of this.retryQueue)e+=t.events.length;let t=[];for(;this.queue.length>0&&e+this.queue.length>this.config.maxQueueSize;){let e=this.queue.pop();this.queued-=this.j(e),t.push(e)}t.length>0&&this.dropped(t.reverse()),this.fit()}flushOnUnload(e=!1){if(this.h||(this.a7(),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:an(e.json);if(n>to-this.k)return;this.retryQueue.shift(),e.dispatched=!0,this.aQ(t?t.body:e.json,n,t?.encoding)}if(0===this.queue.length)return;let t=to-this.k-(e&&this.inFlight?.early&&this.inFlight.onWire?this.inFlight.sent?.bytes??this.inFlight.bytes:0),n=this.ap(),r=this.G,i=0;for(let e of this.queue){let n=this.j(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.aC(s);let o=this.body(s,n);this.aQ(o,an(o))}aQ(e,t,n){try{this.k+=t,fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey,...n?{"Content-Encoding":n}:{}},body:e,keepalive:!0}).then(e=>e.arrayBuffer()).catch(()=>{}).finally(()=>{this.k-=t})}catch{this.k-=t}}aI=()=>{try{this.config.beforeOnlineFlush?.()}catch{}this.wakeSender?.(),this.flush(this.N)};T=e=>{if(!this.h&&"pagehide"===e.type)try{this.config.beforeUnloadFlush?.()}catch{}this.flushOnUnload("beforeunload"===e.type),this.am()};aJ=()=>{this.h||"hidden"===document.visibilityState&&(this.config.beforeHiddenFlush?.(),this.flush(!0))};get queueSize(){return this.I()}},so=null,oo=!1,ao=null,lo=!1,uo=[new Set,new Set],co=[0,0],ho=e=>e.strict?new Gi({reason:e.failed}):new Qi({reason:e.failed}),fo=256,po=65536,go=new Map,yo="",mo=-1,vo=null,wo=64,bo=524288,ko=new Set,xo=new Set,So=null,Eo=null,Io=null,Ao=[],To=null,_o=null,Co=new Map,$o=!1,Ro=class e{phase="idle";J=!1;hidden=!1;B=!1;p=!1;i=null;aW=!1;ag=5e3;outage=!1;failing(e){this.outage=e,null!==this.i&&clearTimeout(this.i),this.i=null,!e&&this.p&&this.aq(!1)}lost(e,t){t||!e.some(e=>"dom"===e.type)||(this.p=!0,this.aq(e.some(e=>"dom"===e.type&&2===e.data?.type)))}aq(e){if(this.outage)return;if(null!==this.i){if(!e||!this.aW)return;clearTimeout(this.i)}this.aW=!e;let t=e?this.ag:0;e&&(this.ag=Math.min(2*this.ag,6e4)),this.i=setTimeout(()=>{if(this.i=null,!this.p||"recording"!==this.getState())return;let e=this.o?.takeFullSnapshot;if(e){this.B=!1;try{e.call(this.o)}catch{this.B=!0}}},t)}delivered(e){e.some(e=>"dom"===e.type&&2===e.data?.type)&&(this.ag=5e3)}styles=new si({note:e=>{let t=this.o?.mirror?.getNode(e);t&&this.aw.set(e,t)},present:e=>this.a1(e),forget:e=>{this.aw.delete(e)}});aw=new Map;sessionId=null;metadata=null;config;onEvent=null;aZ=null;aY=null;ah=null;landing=!1;l=null;Z=null;M=null;o=null;D=!1;generation=0;aj=null;O=null;au=null;K="";ai="";constructor(e){this.config=e}async start(e,t=null,n=!1,r=null,i=null,s=null){if("active"===this.phase)return this.sessionId;"stopping"===this.phase&&this.stop();let o={secretRoutes:[],keepRoutes:[]};for(let e of["secretRoutes","keepRoutes"]){let t=this.config.privacy?.[e]??[];if(!Array.isArray(t))throw this.phase="stopped",new Xi({option:e,received:St({returned:t})});for(let n of t){let t=X(n,"keepRoutes"===e);if(null===t)throw this.phase="stopped",new Xi({option:e,received:St({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("/")}`;Mr.has(t)||(Mr.add(t),n.push(e),Pr++,Fr=["",[],!1,null])}}(o.secretRoutes,o.keepRoutes);let a,l=this.config.sampleRate??1;if(Math.random()>l)return this.phase="stopped","";this.onEvent=e,this.aZ=t,this.aY=r,this.ah=i;try{a=this.config.sessionIdGenerator?this.config.sessionIdGenerator():ln()}catch(e){throw this.phase="stopped",new Ji({sessionId:null,received:St({threw:e})})}if(!ft(a))throw this.phase="stopped",new Ji({sessionId:"string"==typeof a?a:null,received:St({returned:a})});this.sessionId=a,this.metadata=function(e){let t=typeof window<"u"?window:void 0,n=t?.location?.href??"",r=""===n?null:gn(n);return{url:Ne(e(n),r),userAgent:typeof navigator<"u"?navigator.userAgent:"",viewport:{width:t?.innerWidth??0,height:t?.innerHeight??0},referrer:typeof document<"u"&&document.referrer?Ne(e(document.referrer),r):"",language:typeof navigator<"u"?navigator.language:"",devicePixelRatio:t?.devicePixelRatio??1,timestamp:Date.now()}}(this.scrubUrl),this.phase="active",this.J=n,this.B=!1,this.hidden=typeof document<"u"&&"hidden"===document.visibilityState,this.D=!1;let u=++this.generation;typeof document<"u"&&(this.O=()=>{this.hidden="hidden"===document.visibilityState,"recording"===this.getState()&&this.aO()},document.addEventListener("visibilitychange",this.O)),this.ai=typeof location<"u"?location.href:"",this.K=typeof location<"u"?this.scrubUrl(location.href):"",this.au=En((e,t,n)=>this.navigated(e,t,n));let c=await this.ar();if(u!==this.generation||"active"!==this.phase)return"";if(null!==c&&typeof window<"u")throw this.stop(),ho(c);let h=this.config.maxSessionDuration??6e5;return this.aj=setTimeout(()=>{try{this.aZ?.()}finally{"active"===this.phase&&this.stop()}},h),So?.refused&&s?.(So.refused),this.sessionId}stopDom(){"active"===this.phase&&(this.phase="stopping"),this.M&&(this.M(),this.M=null),this.aj&&(clearTimeout(this.aj),this.aj=null)}stop(){if("active"===this.phase||"stopping"===this.phase){null!==this.l&&(window.removeEventListener("online",this.l),this.l=null,this.av()),this.landing=!1;for(let e of uo)e.delete(this);this.stopDom(),this.o=null,this.i&&(clearTimeout(this.i),this.i=null),this.O&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.O),this.O=null),this.au?.(),this.au=null,this.phase="stopped"}}navigated(e,t,n){if("active"!==this.phase)return;this.ai=location.href;let r=this.scrubUrl(location.href);dn(r)!==dn(this.K)&&(this.K=r,this.emitEvent("dom",{type:4,data:{href:r,...hn(),cause:e,...void 0===t?{}:{userInitiated:t},...void 0===n?{}:{initiator:n}},timestamp:Date.now()}))}a9(e){if("object"!=typeof e||null===e)return e;let t=e,n=t.data?.href;return 4!==t.type||"string"!=typeof n?e:(this.K=this.scrubUrl(n),{...t,data:{...t.data,href:this.K}})}isUserPaused(){return this.J}pause(){"active"===this.phase&&(this.J=!0)}resume(){"active"===this.phase&&(this.J=!1,"recording"===this.getState()&&this.aO())}aO(){if(!this.M){this.B=!1;let e=this.generation;this.ar().then(t=>{null!==t?this.aR(e,t):this.a2(e)});return}if(!this.B&&!this.p)return;let e=this.o?.takeFullSnapshot;if(e){if(this.outage){this.p=!0;return}this.B=!1;try{e.call(this.o)}catch{this.B=!0}}}getSessionId(){return"active"===this.phase?this.sessionId:null}get a_(){return"active"===this.phase&&!this.J}getState(){return"idle"===this.phase?"idle":"stopped"===this.phase||"stopping"===this.phase?"stopped":this.J||this.hidden?"paused":"recording"}getMetadata(){return this.metadata}async ar(){if(this.D)return null;this.D=!0;let t=this.generation;if(!this.loaded()&&typeof window<"u"&&!1===navigator.onLine&&!Nt())return this.D=!1,this.aX(t),null;let n=+("strict"===this.config.privacyMode);if(co[n])return uo[n].add(this),this.land();let r=cn(n>0),i=await ds(r,this.loaded());if(!i)return t===this.generation&&"active"===this.phase&&(uo[n].add(this),this.land(),co[n]||e.whenLanded(n,r)),null;if(t!==this.generation)return null;if("failed"in i)return this.D=!1,i;let s=i.record;return"recording"!==this.getState()?(this.D=!1,null):(this.o=s,this.M=s(this.bh())??null,null)}aX(e){if(null!==this.l)return;let t=()=>{if(window.removeEventListener("online",t),this.av(),this.l=null,e===this.generation&&"active"===this.phase){if(!1===navigator.onLine){this.aX(e);return}cn("strict"===this.config.privacyMode).then(t=>this.loadedLate(e,t))}};this.l=t,window.addEventListener("online",t,{once:!0}),this.Z=setInterval(()=>{!1!==navigator.onLine&&t()},1e3)}static whenLanded(e,t){co[e]++,t.then(t=>{co[e]--;let n=[...uo[e]];uo[e].clear();for(let e of n)e.landing&&e.loadedLate(e.generation,t)})}land(){return this.D=!1,this.landing=!0,null}loadedLate(e,t){if(e===this.generation&&"active"===this.phase){if(this.landing=!1,"failed"in t){this.aR(e,t);return}this.ar(),this.ah?.(null)}}av(){null!==this.Z&&(clearInterval(this.Z),this.Z=null)}aR(e,t){e!==this.generation||"active"!==this.phase||(this.stop(),this.ah?.(ho(t)))}a2(e){e!==this.generation||"active"!==this.phase||!this.loaded()||null===this.l||(window.removeEventListener("online",this.l),this.l=null,this.av(),this.ah?.(null))}loaded(){return oo&&(lo||"strict"!==this.config.privacyMode)}awaitingRRWeb(){return null!==this.l||this.landing}bh(){let e=this.config.privacyMode??"balanced",t=this.config.privacy??{},n=[...this.config.maskSelectors??[],...t.maskSelectors??[]],r=[...this.config.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"])',a=[...n,...i?[o]:[]].join(","),l=r.join(","),u=l?(e,t)=>{try{if(i&&t?.closest(o))return e.replace(/[\S]/g,"*");if(t?.closest(l))return e}catch{}return e.replace(/[\S]/g,"*")}:void 0;return{emit:e=>this.emitEvent("dom",e,e=>this.a9(e)),maskTextSelector:"strict"===e?"*":a||void 0,...u?{maskTextFn:u}:{},blockSelector:t.blockSelectors?.join(",")||void 0,maskInputOptions:s,userTriggeredOnInput:!0}}a1(e){let t=this.o?.mirror;if(void 0===t)return!0;let n=this.aw.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}a3(e){if(!(typeof location>"u"||location.href===this.ai)){if(4===e?.type){this.ai=location.href;return}this.navigated(bn())}}scrubUrl=e=>function(e,t=!1){return e&&p(e,t?Ti:Ai)}(function(e){let[,t,n]=ue(e);if(t)return`${ae(e)}/[REDACTED]`;let r=e.indexOf("#"),i=V(ie(e),J(L(e))),s=U(-1===r?e:e.slice(0,r),i);if(-1!==r){let t=e.slice(r+1).split("#")[0];Cr.test(t)&&(s+=`#${U(t,i)}`)}return null===n?s:ke(s,n)}(e),"strict"===this.config.privacyMode);bi(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.config.privacyMode,s=null===t?[]:[...t.plain,...t.bounded];if(2===n.type&&at(r.node,i,s),3===n.type&&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))st(n.node)&&r.push(n.node);r.length>1&&it(r)}}(r.adds);for(let e of r.adds)null!==e&&"object"==typeof e&&at(e.node,i,s)}if(Array.isArray(r.attributes))for(let e of r.attributes){let t=e?.attributes;if(null!==t&&"object"==typeof t){let n=i?this.o?.mirror?.getNode(e.id??-1):null;Qe(t,i,s,n?.localName??"","http://www.w3.org/2000/svg"===n?.namespaceURI)}}if(Array.isArray(r.texts)){let e=this.styles.recordsIn(n);for(let t of r.texts)"string"==typeof t?.value&&(t.value=e.has(t)?rt(t.value,i,s):tt(t.value))}}if(3===n.type&&(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)null!==t&&"string"==typeof t?.rule&&(t.rule=rt(t.rule,i,s));"string"==typeof r.replace&&(r.replace=rt(r.replace,i,s)),"string"==typeof r.replaceSync&&(r.replaceSync=rt(r.replaceSync,i,s))}if(3===n.type&&5===r.source&&"string"==typeof r.text&&(r.text=i?r.text.replace(/\S/g,"*"):tt(r.text)),3===n.type&&9===r.source&&"string"==typeof r.fontSource&&(r.fontSource=rt(r.fontSource,i,s)),3===n.type&&13===r.source){let e=r.set;null!==e&&"string"==typeof e?.value&&(e.value=rt(e.value,i,s))}return e}acceptsNetwork(){return this.a_}emitEvent(e,t,n,r=!1,i,s){if("dom"===e&&"active"===this.phase&&"recording"!==this.getState()&&(this.B=!0),(r?"active"!==this.phase&&"stopping"!==this.phase:!this.a_)||"dom"===e&&this.hidden||!this.onEvent||!this.sessionId)return;this.a3("dom"===e?t:null);let o=n?n(t):t,a="dom"===e&&null!==o&&"object"==typeof o?o.type:void 0;if(this.p&&3===a)return;let l=o;if(typeof location<"u")try{"dom"===e&&(l=this.bi(o,gn(location.href))),l=Ne(l,gn(location.href),e,this.styles,no)}catch(t){"dom"===e&&(this.p=!0,this.aq(2===a)),t instanceof oi&&this.aY?.(e,t.atLeast,t.cap);return}2===a&&(this.p=!1,null!==this.i&&(clearTimeout(this.i),this.i=null));let u={id:ln(),sessionId:this.sessionId,timestamp:i??Date.now(),type:e,data:l,seq:s};this.onEvent(u)}},Do=class{captureId;nonce;t0WallMs;origins;constructor(e,t=Date.now()){this.captureId=e,this.nonce=In(),this.t0WallMs=t;let n=An();this.origins=null===n?[]:[n]}build(){return null===this.nonce?{refusal:"no-csprng"}:{identity:{captureId:this.captureId,sessionNonce:this.nonce,t0WallMs:this.t0WallMs,appOrigins:[...this.origins]}}}},Oo={},No=()=>{},Lo=!1,zo=!1,Uo=class e{static instance=null;static ending=new Set;recorder;network;transport;config;started=!1;h=!1;identity=null;constructor(e){this.config=e,this.recorder=new Ro(e),this.network=new Ys(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.R(),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.aH(),onDropped:(e,t)=>this.recorder.lost(e,t),onDelivered:e=>this.recorder.delivered(e),onFailing:e=>this.recorder.failing(e),beforeUnloadFlush:()=>this.network.cutInflight(),beforeHiddenFlush:()=>this.network.reportDue(!0),beforeOnlineFlush:()=>this.network.reportDue()};this.transport=new io(t)}static async init(t){if(e.instance)return e.instance;let n=Lo;return No(),Lo=!1,e.begin(t,n)}static async begin(t,n,r=!1){let i=new e(t);e.instance=i;try{await i.start(n,r)}catch(t){throw i.stop(),e.instance===i&&(e.instance=null),t}return i}static stop(){No(),Lo=!1;let t=e.instance;e.instance=null;let n=Promise.all(e.ending),r=new Promise(e=>{let t=setTimeout(e,1e4);n.then(()=>{clearTimeout(t),e()})});return t||r.then(()=>{!e.instance&&!zo&&(Ot(!1),Ht())}),Promise.all([t?t.stop():void 0,r]).then(()=>{})}static pause(){e.instance?.pause(),null===e.instance&&zo&&(Lo=!0)}static resume(){e.instance?.resume(),Lo=!1}static getSessionId(){return e.instance?.recorder.getSessionId()??""}static getInstance(){return e.instance}static getCaptureIdentity(){let t=e.instance?.identity;return t?t.build():null}async start(t,n=!1){if(this.started)return;if(this.started=!0,"strict"===this.config.privacyMode&&!1===this.config.privacy?.maskNetworkBodies)return this.af(new es);let r,i=!1!==this.config.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.af(new Yi(i),!0);try{Ot(!0,!n);let e=this.recorder.start(e=>this.transport.enqueue(e),()=>!0===this.config.continuous&&void 0===this.config.sessionIdGenerator?this.aH():this.R(),t,(e,t,n)=>this.transport.reportScrubOversized(e,t,n),e=>{null===e?(this.h=!1,this.transport.release()):this.af(e)},e=>this.transport.reportNavigationUnwrapped(e)),i=this.recorder.getSessionId();if(null!==i){this.identity=new Do(i);let e=this.identity.build();this.h=!0,this.transport.hold(),this.transport.start(i,this.recorder.getMetadata(),"identity"in e?e.identity:null),!1!==this.config.networkCapture&&(this.network.askForCode(),this.network.start((e,t,n)=>{this.recorder.emitEvent("network",e,void 0,!0,t,n)},()=>this.recorder.acceptsNetwork(),()=>this.transport.place(),!0))}r=await e}catch(e){if(e instanceof Ji||e instanceof Qi||e instanceof Gi||e instanceof Xi)return this.af(e);throw e}r?(this.network.prepare(),this.recorder.awaitingRRWeb()||(this.h=!1,this.transport.release(!1))):(this.started=!1,(e.instance??this)===this&&Ot(!1))}stop(){let t=this.h;return t||this.network.reportDue(),this.recorder.stopDom(),this.network.stop(t),this.started=!1,(t?Promise.resolve():this.network.settle(1e3)).then(()=>{let t=null===e.instance;return Ht(t,()=>null!==e.instance||zo),t&&!zo&&Ot(!1),this.recorder.stop(),this.transport.stop()})}af(e,t){let n=Oo[e.code];return n||(console[t?"info":"error"](e.message),n=Oo[e.code]=[-1e9,0]),this.R().then(()=>{this.recorder=this.network=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=Oo[e.code]=[r,n[1],...t],setTimeout(Tn,0,n)}else n[0]=-1e9;n.length>=18?t():n.push([e.constructor,e.evidence,this.config.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(Tn,Math.ceil(n[0]-r),n))})}R(){let t=this.stop().catch(()=>{}).finally(()=>e.ending.delete(t));return e.ending.add(t),e.instance===this&&(e.instance=null),t}aH(){let t=e.instance===this,n=this.recorder.isUserPaused();if(this.R(),!t||typeof document>"u")return;No(),Lo=n;let r={...this.config,sampleRate:1},i=()=>{let t=Lo;No(),Lo=!1,null===e.instance&&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=En(()=>{});zo=!0,No=()=>{o(),document.removeEventListener("pointerdown",i,s),document.removeEventListener("keydown",i,s),zo=!1,No=()=>{}}}pause(){this.recorder.pause(),this.network.cutBodies()}resume(){this.recorder.resume()}};export{Yi as CaptureDeclined,Hi as CaptureError,Do as CaptureIdentityBuilder,Qi as DomRecorderRefusal,Vi as IngestRejection,Uo as KeployCapture,Ro as KeployCaptureRecorder,Ys as NetworkInterceptor,es as PrivacyConflict,zi as PrivacyEngine,Xi as PrivacyRouteRefusal,Pi as SDK_ERRORS,Ki as SDK_WARNINGS,Ui as SESSION_ID_MAX_LENGTH,Bi as SESSION_ID_PATTERN,ji as SESSION_ID_RULE,Ji as SessionIdRefusal,Gi as StrictAttributesRefusal,io as Transport,wt as codeForStatus,An as currentOrigin,ct as defaultPrivacyConfig,xt as describeValue,ft as isValidSessionId,In as mintSessionNonce,bt as parseServerError};//# sourceMappingURL=index.bundler.mjs.map
1
+ function e(e){return e.includes("%")?e.replace(jn,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!(Fn.has(e)||"page"===t&&Zn.has(e))&&(qn.has(e)||Pn.has(e)||Mn.has(e)||Kn.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),a=-1===s?null:i.slice(s+1),l=-1===r?null:e.slice(r+1),d=c(o,t)+(null===a?"":`?${u(a,t,n,o)}`)+(null===l?"":`#${h(l,t,n,o)}`);return d===e?e:d}function a(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 l(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?/(&)/:Hn),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]`,m=n.before?.(h,f,p)??null;if(null!==m)return`${h}=${m}`;if(n.strict||(n.whole?function(e){let t=[],n=e.split(Hn);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=a(f,n.form),t=f.slice(e);return`${h}=${0!==e||n.form?"[REDACTED]":""}${n.tail?.(t)??t}`}if(i>=1&&(Wn.test(g)||Vn.test(g)))return"page"===n.kind||l(g,n.kind)?y():t;let w=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):Vn.test(e)?/[?#]/.test(e)?o(e,t,n+1):u(e,t,n+1):null}(g,n,i);return null!==w&&w!==g?n.whole?y():!0!==n.raw?`${h}=${encodeURIComponent(w)}`:f===g?`${h}=${w}`:encodeURIComponent(g)===f?`${h}=${encodeURIComponent(w)}`:y():e(g)!==g&&l(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(";"),l=i[s],u=!0===t.head?.(e,l,s,i)?"[REDACTED]":l;return-1===o?u:u+n.slice(o).replace(/;([^;=]+)=([^;]*)/g,(e,n,i)=>{let s=!0===t.spaced?a(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||!Jn.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),a=r.search?u(i,t,n,r.pathname):"",l=r.hash?h(s,t,n,r.pathname):"";return o===r.pathname&&a===i&&l===s&&""===r.username&&""===r.password?e:`${r.protocol}//${r.host}`+o+(r.search?`?${a}`:"")+(r.hash?`#${l}`:"")}function f(e,t,n){let r=/^([a-z][a-z0-9+.-]*:)([/\\]*)([^/\\?#]*)/i.exec(e),[i,s,a,l]=r,u=""===a?-1:l.lastIndexOf("@"),c=s+a+l.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(Qn.test(t)||r&&","===t&&(Xn.lastIndex=i+1,Xn.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 m(e,t){return`[Body cut: ${e} of ${t} characters kept, unverified]\n`}function w(e,t){return`${m(0,e)}[Body not captured: ${er[t]}]\n`}function v(e){return r(e,"key")}function b(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 a=1;a<=t.length;a++){let l=t[a];void 0!==l&&l[0]<s?(l[1]>s&&(s=l[1]),o=void 0):(n+=e.slice(r,i)+(o??tr),r=s,void 0!==l&&([i,s,o]=l))}return n+e.slice(r)}function E(e,t=[]){if(!e)return e;let n=[];return function(e,t,n){x(e,ur,n),x(e,or,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&&b(e.charCodeAt(s-1));)s--;if(s<r){sr.lastIndex=r+1;let i=sr.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,ar,n),x(e,lr,n),x(e,cr,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 I(e){return e&&S(e,A(e))}function A(e){let t=[];return hr.test(e)&&(x(e,ur,t),x(e,or,t)),t}function T(e,t=dr){let n=e.replace(mr,e=>gr.test(yr.exec(e)[0])?p(e,t):e),r=function(e,t){let n=[];for(let[r,i]of function(e,t=!1){let n=[];Gn.lastIndex=0;for(let r=Gn.exec(e);null!==r;r=Gn.exec(e)){let i=r.index+(r.groups?.attr?.length??0);Yn.lastIndex=i;let s=void 0!==r.groups?.attr&&Yn.test(e);s&&(i=Yn.lastIndex);let o=r.groups?.attr??"",a=g(e,i,!/["']$/.test(o)||/^url\(/i.test(o)||s,t);"{"===e[a]&&a>i&&"$"===e[a-1]&&a--,a>i&&n.push([i,a]),Gn.lastIndex=Math.max(a,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(wr,e=>{let n="",r=[];for(let t=0;t<e.length;){r.push(t);let i=vr.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 a=/\\\/|\\u002[fF]/.exec(e)[0];return e.slice(0,r[s])+i.slice(s,i.length-o).replace(/\//g,a)+e.slice(r[n.length-o])}):e}function C(e){let t=T(e,fr),n=[];return function(e,t,n="text"){let i="code"===n?xr:"string"===n?Sr:"header"===n?Er:kr,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),a=null===o?e.length:o.index;t.push([s+1,a]),n.lastIndex=a}return t}(e):[],o=0;i.lastIndex=0;for(let a=i.exec(e);null!==a;a=i.exec(e)){if(!r(a[2],"param"))continue;if(s.length>0&&(/^[ \t\r\f\v>]$/.test(a[1])||"#"===a[1]&&(!/[\w/%~-]/.test(e[a.index-1]??"")||e.startsWith("*/",a.index-2)||/(?:^|[^\w$/%~.-])(?:static|accessor)$/.test(e.slice(Math.max(0,a.index-9),a.index))))){for(;o<s.length&&s[o][1]<=a.index;)o++;if(o<s.length&&s[o][0]<=a.index)continue}let l=a.index+a[0].length;Ir.lastIndex=l;let u=Ir.exec(e);if(null===u)continue;"string"===n&&(Ar.lastIndex=l,u=Ar.exec(e)??u);let c=l+u[0].length;t.push([l,c]),i.lastIndex=c}}(t,n,"header"),S(t,n)}function $(e,t){return e.length>t?e.slice(0,t)+br:e}function R(e){return e+br}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 L(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 z(e,n,r=!1){let s="",o=0;return O(e,(a,l)=>{let u=t(e.slice(a,l),"page"),c=l+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?z(e,!1):`${z(e.slice(0,n),!1)}?${z(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 j(t,n=!0){return(n?/^(?:\/|[a-z][a-z\d+.-]*:\/\/)/i:/^[a-z][a-z\d+.-]*:\/\//i).test(e(t))}function q(t){return e(t).replace(/([a-z\d])([A-Z])/g,"$1 $2").split(/[\s\-_.]+/).filter(e=>""!==e).map(e=>e.toLowerCase())}function P(e,t){let n=q(e),r=n.join("");if(Rr.has(r))return 2;Nr.has(r)&&(n=[r]);let i=0;for(let e of n)if($r.has(e))i=2;else if(Nr.has(e))i||=1;else if(!zr.has(e))return 0;return 1===i&&(n.includes("accept")||n.includes("confirm")&&(Ur(n)||Ur(q(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 F(e){return e.length<=4||Z(e)}function Z(e){return q(e).every(e=>e.startsWith("confirm")||"accept"===e||"edit"===e)}function H(e,t){let n=e[t]??"";return Dr.has(q(e[t-1]??"").join(""))&&!Z(n)&&!Or.has(n.toLowerCase())&&!/\.[A-Za-z][A-Za-z\d]{0,4}$/.test(n)&&!(M(n)&&""!==(e[t+1]??""))}function W(e){return q(e).some(e=>e.startsWith("invit"))}function V(e,t){return/^(?:rp|resetpass)$/.test(t)||e.some(e=>e.some(e=>0!==P(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))&&!j(t,!1)}function Q(e){let t=q(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 qr.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 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<=Kr;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 Cr.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,a,l){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(a,e,t);for(let r=0;r<n;r++){let i=P(t[r],t[r-1]??"");if(0===i)continue;let a=W(t[r]),h=t[r+1];H(t,r+1)&&!u.has(h)&&!c&&(s.add(h),B(e(h))||(o.has(h)||l.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(a&&B(e)){f=e;continue}let r=P(e,t[p-1]);if(r>i)i=r,f="";else{if(""!==f&&Q(e)){d=f;break}if(!F(e))break}}""===d&&2===i&&p===n&&(d=f),""!==d&&!u.has(d)&&!c&&s.add(d),r=""===d?p-1:p}}let c=L(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=!j(p)&&(p.length>=10&&B(g)&&!/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/.test(g)&&!j(g)||p.length>=20&&B(p)&&u.some(e=>e.some(e=>/callback|oauth/i.test(e)||[...q(e),q(e).join("")].some(e=>Br.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))&&!j(n,u)){s.add(n);continue}let c=e(n);r<2&&(/[?#=]/.test(c)||j(c))&&oe(c,r+1,s,o,a,l)}}function ae(e){try{return new URL(e).origin}catch{return""}}function le(e){return ue(e)[0]}function ue(t){if(Fr[0]===t)return[Fr[1],Fr[2],Fr[3]];let n=new Set,r=new Map,i=new Map,s=new Set,o=t.indexOf("#"),a=-1===o?t:t.slice(0,o),l=-1===o?"":t.slice(o+1),u=Cr.test(l),c=a.length+(u?l.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=ae(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<Xr;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)&&!j(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)&&!j(e,!1)&&!d.includes(e)&&p.push({kind:0,value:e});return p.sort((e,t)=>t.value.length-e.value.length),Fr=[t,p,h,Re(p)],[p,h,Fr[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,Zr)),n="";for(let r=0;r<e.length;r+=Zr){let i=Math.min(Zr,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){let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=[];for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r.push(i-s+1),s=n[s-1])}return r}function de(e){let t=Hr;Hr=1/0;try{return e()}finally{Hr=t}}function fe(e){if(Wr+e>Hr)throw new oi(Wr+e,Hr)}function pe(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],a=o.indexOf("]");return a>=0&&n.endsWith(o.slice(0,a+1))&&(r[r.length-1]=o.slice(a+1)),r.every(t=>e.includes(t))}function ge(e,t){let n=e=>e.length>Vr&&/[[\]]/.test(e);if(e.plain.some(e=>n(e)&&pe(t,e,"[REDACTED]")))return!0;let r=ce(t);return[...e.bounded,...e.words.map(({value:e})=>e)].some(e=>n(e)&&pe(r,e))}function ye(e,t,n,r,i=!1){let s=[],o=0,a=Vr-n.length;for(let l of he(t,n))l<o||!r(l,l+n.length)||(s.push(l),o=l+n.length,i&&fe(e.length+s.length*a));if(0===s.length)return[e,()=>t];let l,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]"),()=>l??=u(t,"[redacted]")]}function me(e,t,n){return(0===t||!Jr.test(e[t-1])||Gr.test(e.slice(Math.max(0,t-16),t)))&&(n===e.length||!Jr.test(e[n]))}function we(e,t,n){return Qr.find(([r,i])=>i<=n&&t>=r.length&&e.startsWith(r,t-r.length))}function ve(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 be(t,n,r,i){if(r!==t.length&&/[a-z0-9_~-]/.test(t[r]))return!1;let s=we(t,n,3);if(void 0===s)return!1;let[o,a]=s,l=function(e,t,n){let r=t;for(;;){let t=we(e,r,n);if(void 0===t)return r;r-=t[0].length}}(t,n-o.length,a);return(l===n-o.length||!function(e,t){return 0===t||Yr.test(e[t-1])||ei.test(e[t-1])||/(?::|%(?:25)*3a)$/.test(e.slice(Math.max(0,t-9),t))}(t,l))&&(!!i.befores.has("")||0!==i.longest&&function(t,n,r,i){let s=n;for(;s>0&&!Yr.test(t[s-1])&&void 0===we(t,s,r);)s--;let o=n,a="",l=!1;for(let u=n;u>=s;u--){if(u<n&&ve(t,u,r)&&(o=u,a="",l=!1),l||u!==s&&!ei.test(t[u-1]))continue;let c=t.slice(u,o);for(let t=0;t<=r;t++)c=e(c);if(a=ce(c)+a,o=u,a.length>i.longest)l=!0;else if(i.lengths.has(a.length)&&i.befores.has(a))return!0}return!1}(t,l,a,i))}function ke(e,t){if(!xe(e,t))return e;if(/^[ \t\n\r]*[{[]/.test(e)){let n=Ie(e,t);if(null!==n)return n}return $e(e,t)}function xe(e,t){return!!Se(e,t)||e.includes("\\")&&Se(Ee(e),t)}function Se(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 Ee(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(Ee(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(ni)){let n=t[0];"{"===n?(i.push(r.length),r.push(new Set)):"}"===n?i.pop():'"'===n[0]&&i.length>0&&(ri.lastIndex=t.index+n.length,ri.test(e)&&r[i[i.length-1]].add(JSON.parse(n)))}let s=Wr,o="",a=0,l=0,u=[];for(let t of e.matchAll(ni)){let i=t[0];if("{"===i){u.push(new Set(r[l++]));continue}if("}"===i){u.pop();continue}let c=i;if('"'===i[0]){let r,l=JSON.parse(i);Wr=s+o.length+(t.index-a);try{r=ke(l,n)}finally{Wr=s}ri.lastIndex=t.index+i.length;let h=ri.test(e)?u[u.length-1]:void 0;if(void 0!==h&&r!==l){let e=r;for(let t=2;h.has(r);t++)r=`${e}#${t}`;h.add(r)}r!==l&&(c=JSON.stringify(r))}else de(()=>$e(i,n))!==i&&(c='"[REDACTED]"');c!==i&&(o+=e.slice(a,t.index)+c,a=t.index+i.length,fe(o.length))}return o+e.slice(a)}function Ae(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{text:t+e.slice(r),escapes:n}}function Te(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 _e(e,t,n=!1){let r=[],i=[],s=(e,t,s)=>{let o=new Int32Array(e.length),a=0,l=t>Vr,u=-1,c=-1;for(let r of e)!n&&s(r)?o[a++]=r:l&&(r<c||(u>=0&&i.push(u,c),u=r),c=r+t);u>=0&&i.push(u,c),a>0&&r.push({at:o.subarray(0,a),length:t})};for(let n of t.plain)s(he(e,n),n.length,()=>!0);let o=ce(e);for(let n of t.bounded)s(he(o,n),n.length,t=>me(e,t,t+n.length));for(let e of t.words)s(he(o,e.value),e.value.length,t=>be(o,t,t+e.value.length,e));return{lists:r,slack:Ce(i)}}function Ce(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>Vr&&(n+=i-r-Vr)};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 $e(e,t){e=function(e,t){let n=Hr!==1/0&&Wr+Vr*e.length>Hr,{text:r,escapes:i}=e.includes("\\")?Ae(e):{text:e,escapes:[]},s=_e(r,t),{lists:o}=s;if(0===o.length)return e;let a=n&&!ge(t,e),l=s.slack+(a&&i.length>0?_e(e,t,!0).slack:0),u=new Int32Array(o.length),c=e=>o[e].at[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,m=0;for(;h.length>0;){let t=h[0],n=c(t),r=Te(i,n),s=Te(i,n+o[t].length);if(u[t]=u[t]+1,u[t]>=o[t].at.length&&(h[0]=h[h.length-1],h.pop()),h.length>0&&f(0),!(s<=g)){if(y&&r<=g){g=s;continue}m+=r-g+Vr,a&&fe(m-l),p.push(e.slice(g,r),"[REDACTED]"),g=s,y=!0}}return a&&fe(m+e.length-g-l),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<=Vr||!pe(n,r)),s[e]=t}let o=0;for(let n of t.bounded){if(r().includes(n)){let t=e;[e,r]=ye(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]=ye(e,t,n.value,(e,r)=>be(t,e,r,n),s[o])}o++}return e}function Re(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>ti?"":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})=>Qr.map(([t])=>t+e))].map(e=>JSON.stringify(e).slice(1,-1)),plain:n,bounded:r,words:s}}function De(e,t){if(0===t.length)return 0;let n=new Int32Array(t.length);for(let e=1,r=0;e<t.length;e++){for(;r>0&&t.charCodeAt(e)!==t.charCodeAt(r);)r=n[r-1];t.charCodeAt(e)===t.charCodeAt(r)&&r++,n[e]=r}let r=0;for(let i=0,s=0;i<e.length;i++){for(;s>0&&e.charCodeAt(i)!==t.charCodeAt(s);)s=n[s-1];e.charCodeAt(i)===t.charCodeAt(s)&&s++,s===t.length&&(r++,s=n[s-1])}return r}function Oe(e,t,n){if(Hr===1/0||Wr+e.length<=Hr||"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>Vr;if(e.plain.some(e=>n(e)&&pe(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=>pe(o,e))&&!s.some(e=>o.includes(e))}(n,e)){fe(e.length);return}let r=function(e,t){if(ge(t,e))return null;let n=e.includes("\\"),r=n?Ae(e).text: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{value:e}of t.words)s-=De(n,e)*e.length}return s}(e,n);null!==r&&fe(r)}function Ne(e,t,n="custom",r,i){function s(e,t){Hr=i??1/0,Wr=e;try{return t()}finally{Hr=1/0,Wr=0}}if("dom"===n&&r?.observe(e),null===t)return e;let o;try{o=JSON.stringify(e)}catch{return e}let a=o;if(void 0===a||!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=Ee(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))}(a,t))return e;let l=JSON.parse(a);if("string"==typeof l)return s(0,()=>(Oe(l,"text",t),ke(l,t)));let u="dom"===n&&void 0!==r?r.recordsIn(l):new Set,c="dom"===n&&Le(l)&&3===l.type&&Le(l.data)&&13===l.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&&ii.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 oi(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)}Oe(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(!xe(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=[],a=t,l=-1;for(;!(a>=n);){if(-2!==s[a]){l=s[a];break}o.push(a);let t=e[a];if(t===i){l=a+1;break}a+="\\"===t?2:1}for(let e of o)s[e]=l;return l},s=-1,o=t=>{for(s<t&&(s=t);s<n&&!")\"'".includes(e[s]);)s++;return s},a=t=>{let r=t;for(;r<n&&/\s/.test(e[r]);)r++;return r},l=0;for(;l<n;){let r=e[l];if("/"===r&&"*"===e[l+1]){let r=e.indexOf("*/",l+2),i=r<0?n:r+2;t(l,i),l=i;continue}if(("u"===r||"U"===r)&&"url("===e.slice(l,l+4).toLowerCase()){let n=a(l+4),r=e[n],s=-1;if('"'===r||"'"===r){let t=i(n+1,r);if(t>=0){let n=a(t);")"===e[n]&&(s=n+1)}}else{let t=o(l+4);")"===e[t]&&(s=t+1)}if(s>=0){t(l,s),l=s;continue}}if('"'===r||"'"===r){let e=i(l+1,r);if(e>=0){t(l,e),l=e;continue}}l++}}(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`/*${$e(e.slice(2,n?-2:void 0),t)}${n?"*/":""}`}(o,t):$e(o,t)),fe(n.length),r=s}),n+e.slice(r)}(e,t):"body"===n?function(e,t){return xe(e,t)?Ie(e,t)??$e(e,t):e}(e,t):ke(e,t);return void 0!==i?i.push([e,o]):d.set(r,[[e,o]]),o},m=[{node:l,css:!1,attributes:!1,names:"custom"===n,root:!0}];for(;m.length>0;){let{node:e,css:r,attributes:i,names:o,root:a}=m.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&&m.push({node:i,css:r,attributes:!1,names:"custom"===n,root:!1})}else if(Le(e))for(let l of Object.keys(e)){let u=e[l];if("dom"===n&&o&&!l.startsWith("rr_")&&"_cssText"!==l&&t.plain.some(e=>l.includes(e))){delete e[l];continue}let c=h(e,l,r,i,a);if("string"==typeof u)e[l]=g(s(p,()=>y(u,c)));else if(null!==u&&"object"==typeof u){let e="dom"===n&&"attributes"===l;m.push({node:u,css:"css"===c,attributes:e,names:"custom"===n||e||"dom"===n&&i&&"style"===l||"network"===n&&a&&("requestHeaders"===l||"responseHeaders"===l),root:!1})}if(!o||l.startsWith("rr_")||"_cssText"===l)continue;let d=l;for(let e of t.plain)d.includes(e)&&(d=d.split(e).join("[REDACTED]"));if(d===l)continue;let f=e[l];delete e[l];let w=d;for(let t=2;Object.prototype.hasOwnProperty.call(e,w);t++)w=`${d}#${t}`;e[w]=f}}return l}function Le(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ze(e){if(e)for(let[t,n]of Object.entries(e))if("content-type"===t.toLowerCase())return n}function Ue(e){return t(e,"page").join("")}function Be(e){return!!ci.test(e)||!(e.length<32||ui.test(e)||hi.test(e))&&/^[A-Za-z0-9_\-.~+/=]+$/.test(e)&&/[0-9]/.test(e)&&/[A-Za-z]/.test(e)}function je(e){return e.split("/").some(e=>{if(/callback|oauth/i.test(e))return!0;let t=q(e);return[...t,t.join("")].some(e=>Br.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=Ue(s(t.slice(0,e)));if(!fi.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&&!j(e)),a=r("state").filter(e=>""!==e&&!function(e){return!!nr.test(e)&&(e.length<=16||rr.test(e)||/^[A-Za-z][a-z]+(?:[-_][A-Za-z][a-z]+)+$/.test(e))}(e)&&!j(e));return o.length>0&&(t||a.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 Pe(e,t,n){let r=yi;yi=e;try{return He(t,n)}finally{yi=r}}function Me(t,n,r,i,s=!1){if(!("content"===t?_n?.(t,r,s,i):ki.test(t)||_n?.(t,r,s)||wi.has(t)&&xi.test(e(n))))return/[^*\s]/.test(n)?"":n}function Ke(e){return Ei.test(e)||gi&&mi.test(e)}function Fe(e){return(n,r,i)=>{let o=function(e){let t=Ii.get(e.pairs);return void 0===t&&(t={oauth:qe([...e.pairs],je(e.path))},Ii.set(e.pairs,t)),t}(i);if(o.oauth.has(Ue(s(n)))||G(t(n,"page"),r)&&(o.linkPage??=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 a=e?0:function(e){let t=0,n=null;for(let r of pi)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(a>0){let e=s(r.slice(a));if(!di.test(e)||E(e)===e)return`[REDACTED]${r.slice(a)}`}return null}}function Ze(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))||di.test(i)&&E(i)!==i},bare:e=>Be(e)||Be(s(e)),segment:e=>ci.test(e),head:(t,n,s,o)=>{if(!gi)return!1;o!==r&&(r=o,i=mi.test(t)?function(e){let t=new Set,n=e.startsWith("/")?e:`/${e}`;for(let e of le(`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!!ui.test(n)||n.split(/[-_.~]+/).some(B)}(n)||yi&&H(o,s))}}}function He(e,t){return Ke(e)?p(e,t?Ti:Ai):e}function We(e,t){return _i.lastIndex=t,_i.test(e)?_i.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 Je(e,t){if(!/url\(|["'\\]/i.test(e)||!Ke(e)&&!e.includes("\\"))return e;let n=e.length,r=/[\t\n\f\r ]/,i="",s=0,o=(n,r,o)=>{let a=e.slice(n,r),l=a.includes("\\")?Ve(a):a,u=He(l,t);u!==l&&(i+=e.slice(s,n)+(l===a?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)},a=0;for(;a<n;){let t=e[a];if("/"===t&&"*"===e[a+1]){let t=e.indexOf("*/",a+2);a=-1===t?n:t+2}else if(e.startsWith("\x3c!--",a))a+=4;else if('"'===t||"'"===t){let r=a+1;for(;r<n&&e[r]!==t&&"\n"!==e[r];)r+="\\"===e[r]?2:1;r=Math.min(r,n),o(a+1,r,!0),a=r+1}else{let t=We(e,a);if(t===a){a++;continue}if("("!==e[t]||"url"!==Ve(e.slice(a,t)).toLowerCase()){a=t;continue}let i=t+1;for(;i<n&&r.test(e[i]);)i++;if('"'===e[i]||"'"===e[i]){a=i;continue}let s=i;for(;s<n&&")"!==e[s];)s+="\\"===e[s]?2:1;s=Math.min(s,n);let l=s;for(;l>i&&r.test(e[l-1]);)l--;o(i,l,!1),a=s+1}}return 0===s?e:i+e.slice(s)}function Ge(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 Qe(e,t,n=[],r="",i=!1){let s=[pi,gi];pi=n,gi=!0;try{Xe(e,t,r,i)}finally{[pi,gi]=s}}function Xe(e,t,n="",r=!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)&&Ye(s,t);continue}let a=(t?Me(o,s,n,e,r):void 0)??et(o,nt(o,s,t,n),n);a!==s&&(e[i]=a)}}function Ye(e,t){let n=e=>et("style",Je(e,t),"");for(let t of Object.keys(e)){let r=e[t];if("string"==typeof r){let i=n(r);i!==r&&(e[t]=i)}else if(Array.isArray(r)&&"string"==typeof r[0]){let i=n(r[0]);i!==r[0]&&(e[t]=[i,...r.slice(1)])}}}function et(e,t,n){return e.startsWith("rr_")?t:function(e,t){return"value"===e?""!==t&&!bi.has(t):vi.has(e)||e.startsWith("data-")&&!wi.has(e)&&"data-srcset"!==e}(e,n)&&di.test(t)?E(t):I(t)}function tt(e){return I(e)}function nt(e,t,n,r){let i=t;return"srcset"===e||"data-srcset"===e||"imagesrcset"===e?i=function(e,t){if(!Ke(e))return e;let n=e.split(",").map(e=>{let n=/^(\s*)(\S+)([\s\S]*)$/.exec(e);return null===n?e:n[1]+He(n[2],t)+n[3]}).join(",");return n===e?e:n}(t,n):"style"===e||"_csstext"===e?i=Je(t,n):"ping"===e?i=t.replace(/\S+/g,e=>He(e,n)):"srcdoc"===e?i=function(e,t){if(!t&&!Ke(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,a="")=>{let l=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 Ci[r??i??""]??e}):e}(e.slice(r,s)),u=(t?Me(n,l,a):void 0)??nt(n,l,t,"");u!==l&&i.push([r,s,Ge(u,o)])},a=(t,i,a="")=>{let l=t;for(;;){for(;l<n&&(r.test(e[l])||"/"===e[l]);)l++;if(l>=n||">"===e[l])return l;let t=l;for(l++;l<n&&!r.test(e[l])&&!"/>=".includes(e[l]);)l++;let u=e.slice(t,l).toLowerCase(),c=l;for(;c<n&&r.test(e[c]);)c++;if("="!==e[c]){l=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),l=Math.min(f+1,n);else{for(;f<n&&!r.test(e[f])&&">"!==e[f];)f++;l=f}i&&(s.add(`${d}:${f}`),o(u,d,f,h,a))}},l=(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,l(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))||l(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=a(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=a(o,!0,u);if(s=h+1,$i.has(u)&&h<n){let r=new RegExp(`</${u}[\\t\\n\\f\\r />]`,"gi");r.lastIndex=h+1;let o=r.exec(e),a=null===o?n:o.index;if("style"===u){let n=e.slice(h+1,a),r=Je(n,t);r!==n&&i.push([h+1,a,r])}else l(h+1,a);s=a}}else s=c+1,o=!1;o&&(l(u,c),u=s),c=e.indexOf("<",s)}l(u,n),i.sort((e,t)=>e[0]-t[0]);let h=i.length,d=new RegExp(Ri.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 a=void 0!==t[3]?'"':void 0!==t[4]?"'":"",l=i.length;o(t[2].toLowerCase(),r,n,a),i.length>l&&(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(!Ke(e))return e;let n=Si.exec(e);if(null!==n&&""!==n[3]){let r=Pe(!0,n[3],t);return r===n[3]?e:n[1]+n[2]+r+n[4]}return/^\s*https?:\/\//i.test(e)?He(e,t):e}(t,n):wi.has(e)?i=Pe(function(e,t){return"href"===e||"xlink:href"===e?""===t||"a"===t||"area"===t:"action"===e||"formaction"===e}(e,r),t,n):Di.test(t)&&(i=Pe(!1,t,n)),i}function rt(e,t,n=[]){let r=[pi,gi];pi=n,gi=!0;try{return Je(e,t)}finally{[pi,gi]=r}}function it(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="",a=i;for(;r<n.length&&n[r][0]<e;){let[i,s]=n[r];if(i>=a&&(o+=`${t.slice(a,i)}[REDACTED]`),a=Math.max(a,Math.min(s,e)),s>e)break;r++}s.textContent=o+t.slice(a,e),i=e}}function st(e){let t=e;return 3===t?.type&&"string"==typeof t.textContent}function ot(e){let t=[];for(let n of e)st(n)?t.push(n):5!==n?.type&&(t.length>1&&it(t),t=[]);t.length>1&&it(t)}function at(e,t,n=[]){let r=[pi,gi];pi=n,gi=!0;try{!function(e,t){let n=[e],r=new Set;for(;n.length>0;){let e=n.pop();if(null===e||"object"!=typeof e||r.has(e))continue;if(r.add(e),"string"==typeof e.textContent){let n=!0===e.isStyle?Je(e.textContent,t):t&&5===e.type?"":tt(e.textContent);n!==e.textContent&&(e.textContent=n)}let i=e.attributes;if(null!==i&&"object"==typeof i&&Xe(i,t,"string"==typeof e.tagName?e.tagName.toLowerCase():"",!0===e.isSVG),Array.isArray(e.childNodes)){ot(e.childNodes);for(let t of e.childNodes)n.push(t)}}}(e,t)}finally{[pi,gi]=r}}function lt(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 ut(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 ct(){return{maskSelectors:[],unmaskSelectors:[],blockSelectors:[],maskNetworkBodies:!1,sensitiveHeaders:[...li],piiPatterns:[],secretRoutes:[],keepRoutes:[]}}function ht(e,t){let n=Object.fromEntries(Object.entries(t).filter(([,e])=>void 0!==e)),r={...e,...n};if(n.sensitiveHeaders){let t=new Set;r.sensitiveHeaders=[...li,...e.sensitiveHeaders,...n.sensitiveHeaders].filter(e=>{let n=e.toLowerCase();return!t.has(n)&&(t.add(n),!0)})}return r}function dt(e){return e.map(({pattern:e})=>e.flags.includes("g")?new RegExp(e.source,e.flags):new RegExp(e.source,e.flags+"g"))}function ft(e){return"string"==typeof e&&e.length>0&&e.length<=200&&Bi.test(e)}function pt(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 gt(e){return e.replace(/\s+/g," ").trim()}function yt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: dropped an event: ${gt(t)} The capture continues; any further such events in this capture are dropped silently. evidence=${wt(r)}`}function mt(e,t){let{code:n,...r}=e;return`[keploy] ${n}: ${gt(t)} evidence=${wt(r)}`}function wt(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:xt(r);return JSON.stringify(t)}}function vt(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 bt(e){if(null===e)return Fi;let t=e.trim();if(""===t)return Fi;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,Zi),issues:kt(t.issues)}}}}catch{}return{message:t.slice(0,Zi),issues:null}}function kt(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(t.length===Hi)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,Zi),message:r.slice(0,Zi)})}return t.length>0?t:null}function xt(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 St(e){if("threw"in e)return`threw ${xt(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} ${xt(t)}`}return`${typeof t} ${xt(t)}`}function Et(e=!0){if(!ts)return;for(let t of cs)t(e);ts=ns=as=!1,Cn=$n=Rn=void 0;let t=ls;ls=[],Tt(),setTimeout(()=>{for(let e of t)Ct(e)||e()},0)}function It(){for(let e of hs)e();hs.clear()}function At(e){let t=ts&&!ns;return t&&rs.push(e),t}function Tt(){let e=rs;rs=[];for(let t of e)t()}function _t(){!ts||ns||(ns=!0,ls.length&&It(),Tt())}function Ct(e){return ts&&(ls.push(e),ns&&It()),ts}function $t(e){return new Promise((t,n)=>{let r=()=>{new Promise(t=>t(e())).then(t,e=>{Ct(r)||n(e)})};Ct(r)||r()})}function Rt(e,t,n,r){let i=is;setTimeout(()=>{if(!r){Cn===e&&t()&&Et(n);return}if(as||i!==is||!ts)return;let s=r.defaultPrevented||os.has(r);if(r===Rn&&Cn===r&&(s||t()))return Et(n);r!==Rn&&s||(as=!0,_t())},0)}function Dt(e){let t=e.type,n=e;if("currententrychange"===t){$n&&(n.from!==fs()?.currentEntry||n.navigationType)&&os.add($n);return}if("pageshow"===t){e.isTrusted&&e.persisted&&Et();return}ts||($n=void 0);let r=ts;"navigate"===t&&($n=e),!n.destination?.sameDocument&&null==n.downloadRequest&&(r||is++,ts=!0,Cn=e,"navigate"!==t?setTimeout(()=>{Cn===e&&(as=!0,_t())},0):(Rt(e,()=>fs()?.transition,r&&ns,Rn=n),n.signal?.addEventListener("abort",()=>Rt(Cn,()=>$n===e,!1))))}function Ot(e,t=e){if(t&&Et(),us===e||"function"!=typeof addEventListener)return;us=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,ps),r(fs(),["navigate","currententrychange"])}function Nt(){try{return!!navigator.serviceWorker?.controller}catch{return!1}}function Lt(e){return"default"in e?e.default:e}function zt(e,t){let n=e=>{let t=Lt(e),n=t.version;if(n!==gs)throw new Error(`a chunk of version ${String(n)}, not the SDK's ${gs}`);return t};return $t(e).then(n).catch(e=>t?$t(t).then(n).catch(t=>Promise.reject(new Error(`${String(e)}; beside the SDK: ${String(t)}`,{cause:e}))):Promise.reject(e))}function Ut(e){(typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout)(e,{timeout:1e3,valueOf:()=>0})}function Bt(e,t){if(!Rs.includes(e)){Rs+=e;try{console.warn(function(e,t){return mt({code:"KUI_E_BODY_WORKER_UNAVAILABLE",part:e,reason:t},"could not run the body worker or load the body chunk (evidence.part): without the worker, a body over 64 KiB is recorded cut; without the chunk, a body the main thread must redact is recorded with nothing kept; replay reports a test over a cut body unproven. Allow worker-src 'self' in the page's CSP, use a bundler that emits the worker (or copy dist/body-worker.js beside the bundle), serve it from the page's origin, or serve the SDK's dist/ as it is. Said once per page for each part.")}(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)":xt(t)))}catch{}}}function jt(e){if(typeof navigator>"u"||!1!==navigator.onLine||Nt()||"function"!=typeof addEventListener)return!1;if(!zn){zn=[];let e=()=>{if(!1===navigator.onLine)return;Un?.();let e=zn??[];zn=void 0;for(let t of e)t()};addEventListener("online",e);let t=setInterval(e,1e3);Un=()=>{removeEventListener("online",e),clearInterval(t),Un=void 0}}return zn.push(e),!0}function qt(){return On??=new Promise(e=>{let t=()=>{ws=!1,ys().then(e=>{if("function"!=typeof e.redactBodies)throw new TypeError("the body chunk has no redactBodies export");return e}).then(t=>{Dn=t,Ni.redact=e=>t.redactBodies(e),e()},t=>{vs=!0,Bt("code",t),e()})};(ws=jt(t))||t()})}function Pt(){if(bs||void 0!==Nn)return;bs=!0;let e=()=>{ms().then(e=>$t(()=>{if(!(ks.size>0||Cs(As)))return void(bs=!1);let t=e.startBodyWorker();t.onmessage=({data:e})=>{Ln=t;let n=Ts.get(e.id);n&&(Ts.delete(e.id),Es-=n.owes,n.owner.answered(n,e.out))},t.onerror=e=>Zt(t,e),Nn=t,bs=!1;let n=As;As=new Set;for(let e of n)Ft(e)})).catch(e=>Zt(null,e))};jt(e)||e()}function Mt(){qt(),Pt()}function Kt(e,t=!1){ks.add(e),(!On||void 0===Nn)&&((t?Ds:Os)||(t?Ds=!0:Os=!0,(t?Ut:e=>setTimeout(e,0))(()=>{t?Ds=!1:Os=!1,ks.size&&Mt()})))}function Ft(e){if(!e.owner.has(e))return;let t=Nn?Nn===Ln:null===Nn&&Dn;if(t||!$s(e)||!At(()=>Ft(e))){if(!t&&(e=>ns&&$s(e))(e)){e.owner.answered(e,Vt(e.job)),e.job=null;return}if(Nn){Ts.set(++_s,e);try{Nn.postMessage({id:_s,job:e.job}),Es+=e.owes}catch{Ts.delete(_s),e.owner.alone(e)}}else null===Nn?e.owner.alone(e):(As.add(e),Mt())}}function Zt(e,t){if(e&&Nn!==e)return;try{e?.terminate()}catch{}let n=[...Ts.values(),...As].filter(e=>e.owner.has(e));if(Ts.clear(),Es=0,Nn=void 0,As=new Set(n),!ks.size&&!n.length)return void(bs=!1);bs=!0;let r=()=>{bs=!1,Pt()};if(!jt(r)&&!Ct(r)){bs=!1,Nn=null,As=new Set,Bt("worker",t);for(let e of n)e.owner.alone(e)}}function Ht(){if(Bn=void 0,Nn&&!Cs(Ts.values())){try{Nn.terminate()}catch{}Es=0,Nn=void 0,Ts.clear()}}function Wt(e=!0,t=()=>!1){e&&zn&&(Un?.(),zn=void 0,ws&&(On=void 0),void 0===Nn&&(bs=!1),As=new Set),t()&&void 0!==Ln&&Nn===Ln&&ts?(Bn=t,addEventListener("pagehide",Ns)):Ht()}function Vt(e,t){let n=e=>e&&(t?m(0,e.length):w(e.length,vs?"code-failed":"left"));return{requestBody:n(e.requestBody),responseBody:e.responseBody==Us?Us:n(e.responseBody)}}function Jt(e,t,n=t){try{return Dn.redactBodies(e,t,n)}catch{return null}}function Gt(e){return(e?.requestBody?.length??0)+(e?.responseBody?.length??0)}function Qt(e){try{let t=typeof document<"u"?document.baseURI:void 0;return new URL(e,t).href}catch{return e}}function Xt(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 Yt(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 en(e,t){let n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength>t)return`[Binary: ${n.byteLength} bytes]`;try{return new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{return`[Binary: ${n.byteLength} bytes]`}}function tn(e,t){if(null==e)return null;try{if("string"==typeof e)return""===e?null:Li;if(e instanceof URLSearchParams||e instanceof FormData)return e.keys().next().done?null:Li;if(e instanceof Blob)return t||e.size>0?Li:null;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return e.byteLength>0?Li:null;if(t&&typeof Document<"u"&&e instanceof Document)return e.hasChildNodes()?Li:null}catch{}return Li}function nn(e){return"object"==typeof e&&null!==e&&"Request"===e[Symbol.toStringTag]}function rn(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 sn(e){let t=typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"?location.href:void 0;return new URL(e,t).href}function on(e){try{e()}catch(e){setTimeout(()=>{throw e})}}function an(e){return(new TextEncoder).encode(e).length}function ln(){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 un(){return so||(so=$t(()=>import("rrweb")).then(e=>(oo=!0,{record:Lt(e).record}),e=>(so=null,{failed:xt(e)}))),so}function cn(e){return e?Promise.all([un(),ao??=zt(()=>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){_n=e}(e.kept),lo=!0,null}).catch(e=>(ao=null,xt(e)))]).then(([e,t])=>null===t||"failed"in e?e:{failed:t,strict:!0}):un()}function hn(){let e=document.documentElement;return{width:window.innerWidth||e?.clientWidth||document.body?.clientWidth||0,height:window.innerHeight||e?.clientHeight||document.body?.clientHeight||0}}function dn(e){return e.split("#").map(e=>{let t=e.indexOf("?");return-1===t?e:e.slice(0,t)}).join("#")}function fn(e){return 2===e.kind?`2${e.before}/${e.value}`:`${e.kind}${e.value}`}function pn(e){let t=!1;for(let n=e.length-1;n>=0;n--){let r=fn(e[n]);go.delete(r)||(t=!0),go.set(r,e[n])}let n=new Set(e.map(fn)),r=0;for(let e of go.keys())r+=e.length;for(let e of go.keys()){if(n.has(e)||go.size<=fo&&r<=po)break;go.delete(e),r-=e.length,t=!0}return t}function gn(e){let t=Mr;if(e!==yo||t!==mo){let n=!1;if(""===yo||t!==mo){let e=globalThis.performance?.getEntriesByType?.("navigation");e?.[0]&&(n=pn(le(e[0].name)));for(let e of ko)pn(le(e))&&(n=!0)}yo=e,mo=t,function(e){ko.delete(e),ko.add(e);let t=0;for(let e of ko)t+=e.length;for(let n of ko){if(n===e||ko.size<=vo&&t<=bo)break;ko.delete(n),t-=n.length}}(e),(pn(le(e))||n)&&(wo=Re([...go.values()]))}return wo}function yn(e){let t=e,n=t.destination?.url;Io="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=Ao[0]===r&&!1===t.userInitiated;e||r===_o?Co.set(r,(Co.get(r)??0)+1):Co.delete(r),Ao=e?Ao.slice(1):[],_o=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{}Ao=Ao.filter(e=>n.includes(e)),To=null,(!0!==t.userInitiated||!n.includes(_o))&&(_o=null),Co.clear()}$o=!1}}function mn(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 wn(e,t){return function(...n){if($o)return Reflect.apply(e,this,n);let{next:r,now:i}=t(n);_o=i,null!==i&&null!==r&&(To=r,r!==mn(So?.navigation??null,0,null)&&Ao.push(r)),$o=!0;try{return Reflect.apply(e,this,n)}catch(e){throw Ao=[],_o=null,e}finally{$o=!1}}}function vn(e){let t=e,n=t.navigationType,r=function(){let e=Io;return Io=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(;Ao[0]===t;)Ao.shift();let n=Co.get(t)??0;return n>1?Co.set(t,n-1):Co.delete(t),n?"script":void 0}(So?.navigation??null);if("traverse"===n)kn("traverse",r,i);else if("push"===n||"replace"===n){let e="string"==typeof t.from?.url?t.from.url:"";kn(Eo??(function(e,t){return e!==t&&e.split("#")[0]===t.split("#")[0]}(e,location.href)?"hash":n),r)}}function bn(){let e=Reflect.get(window,"event")?.type;return"popstate"===e||"hashchange"===e?"traverse":"push"}function kn(e,t,n){gn(location.href);for(let r of xo)try{r(e,t,n)}catch{}}function xn([e,t,,n]){let r=Object.getOwnPropertyDescriptor(e,t);return void 0!==r&&r.value===n.value&&r.configurable===n.configurable&&(!0===r.configurable||!0===r.writable)}function Sn([e,t,n]){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function En(e){if(typeof window>"u"||!window.history)return()=>{};xo.add(e),function(){if(So)return;let e=window.history,t=e.pushState,n=e.replaceState,r=Reflect.get(window,"navigation")??null;r?.addEventListener("currententrychange",vn,{capture:!0}),r?.addEventListener("navigate",yn,{capture:!0});let i=e=>t=>{let n=e(t);return{next:mn(r,n,Ao.length?To:null),now:mn(r,n,null)}},s=e=>t=>{let n=e(t);return{next:n,now:n}},o=[[e,"back",i(()=>-1)],[e,"forward",i(()=>1)],[e,"go",i(e=>e[0])],[r,"back",s(()=>mn(r,-1,null))],[r,"forward",s(()=>mn(r,1,null))],[r,"traverseTo",s(e=>"string"==typeof e[0]?mn(r,0,e[0]):null)]],a=[[e,"pushState",function(...e){let n=location.href,r=Eo;Eo="push";try{t.apply(this,e)}finally{Eo=r}kn(location.href===n?bn():"push")}],[e,"replaceState",function(...e){let t=location.href,r=Eo;Eo="replace";try{n.apply(this,e)}finally{Eo=r}kn(location.href===t?bn():"replace")}]];for(let[e,t,n]of o){let r=e&&Reflect.get(e,t);"function"==typeof r&&a.push([e,t,wn(r,n)])}let l=a.find(([e,t])=>!function(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return void 0===n?Object.isExtensible(e):!0===n.configurable||!0===n.writable}(e,t));So={navigation:r,methods:l?[]:a.map(([e,t,n])=>function(e,t,n){let r=Object.getOwnPropertyDescriptor(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,Object.getOwnPropertyDescriptor(e,t)]}(e,t,n)),refused:l?`${l[0]===e?"history":"navigation"}.${l[1]}`:null}}();let t=()=>{gn(location.href),e("traverse")};return window.addEventListener("popstate",t,{capture:!0}),window.addEventListener("hashchange",t,{capture:!0}),()=>{xo.delete(e),window.removeEventListener("popstate",t,{capture:!0}),window.removeEventListener("hashchange",t,{capture:!0}),function(){if(So&&!(xo.size>0)&&So.methods.every(xn)){for(let e of So.methods)Sn(e);So.navigation?.removeEventListener("currententrychange",vn,{capture:!0}),So.navigation?.removeEventListener("navigate",yn,{capture:!0}),Io=null,Ao=[],_o=null,Co.clear(),So=null}}()}}function In(){let e=typeof crypto<"u"?crypto:void 0;if(!e||"function"!=typeof e.getRandomValues)return null;let t=new Uint8Array(16);e.getRandomValues(t);let n="";for(let e of t)n+=e.toString(16).padStart(2,"0");return n}function An(){if(typeof window>"u"||!window.location)return null;let e=window.location.origin;return"string"!=typeof e||""===e||"null"===e?null:e}function Tn(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()}}var _n,Cn,$n,Rn,Dn,On,Nn,Ln,zn,Un,Bn,jn=/%[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"]),Pn=new Set(["invitecode","invitationcode","authcode","authorizationcode","verificationcode","verifycode","confirmationcode","confirmcode","resetcode","mfacode","smscode","otpcode","totpcode","twofactorcode","2facode","logincode","passcode","oobcode","linkcode"]),Mn=new Set(["cardexpiry","cardexpiration","cardexpirydate","cardexpirationdate","cardexp","cardexpdate","cardexpmonth","cardexpyear","ccexp","ccexpiry","ccexpiration","ccexpdate","ccexpmonth","ccexpyear","creditcardexpiry","creditcardexpiration","expmonth","expyear","expirymonth","expiryyear","expirationmonth","expirationyear"]),Kn=/(?:password(?:\d|confirm|confirmation|new|old|repeat|again|verify|retype)?|passwd|secret|token|apikey|privatekey|passphrase|signature|sessionid|jwt|otp|credential|curl)$/,Fn=new Set(["pagetoken","nextpagetoken","prevpagetoken","previouspagetoken","pagingtoken","paginationtoken","nexttoken","prevtoken","previoustoken","continuationtoken","nextcontinuationtoken","cursortoken","synctoken","nextsynctoken","startingtoken","starttoken","skiptoken","deltatoken","resumptiontoken","scrolltoken","aftertoken","beforetoken"]),Zn=new Set(["auth","session","cookie","pin","sig"]),Hn=/(&|;(?=[^;&=#]+=|end$))/,Wn=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)[^?#]*[?#]./i,Vn=/[&;?#][^&;=?#]+=/,Jn=/^(?:https?:|[a-z][a-z0-9+.-]*:[/\\]{2})/i,Gn=/[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,Qn=/[\s"'<>\\^`{|}]/,Xn=/[a-z][a-z0-9+.-]{0,31}:\/\//iy,Yn=/url\(\s*["']?/iy,er={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"},tr="[REDACTED]",nr=/^[A-Za-z]+(?:[-_][A-Za-z]+)*$/,rr=/^[A-Za-z][a-z]+(?:[A-Z][a-z]+)+$/,ir=new Set(["code","devicecode"]),sr=(new Set([...ir,"state"]),/[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,63}/y),or=/(?<![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,ar=/\b\d{3}-\d{2}-\d{4}\b/g,lr=/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g,ur=/(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,cr=/(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\d.])/g,hr=/eyJ|kep_|gh[pousr]_|github_pat_|glpat-|xox[abprse]-|[sr]k_(?:live|test)_|sk-(?:proj|ant)-|npm_|whsec_|AKIA|ASIA|AIza/,dr=(JSON.stringify(tr),{kind:"param",strict:!1,whole:!1,raw:!0}),fr={...dr,spaced:!0,tail:e=>T(e,pr)},pr={...dr,spaced:!0,list:!0},gr=/^(?=[^={}<>"'\\^`|]*(?:=|$))(?:(?:[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,yr=/^\S*/,mr=/^[^\r\n]*/gm,wr=/[a-z][a-z0-9+.-]{0,31}:(?:\\\/|\\u002[fF]){2}(?:[^\s"'<>\\^`{|}()[\]/]|\/(?![dgimsuvy]*(?![\w$]))|\\\/|\\u002[fF])*/gi,vr=/^(?:\\\/|\\u002[fF])/,br="...[truncated]",kr=/(^|[?&;\n>#]|(?<!\b(?:var|let|const)|[(){}])[ \t\r\f\v])([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,xr=/(^|[?&;\n]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Sr=/(^|[?&]|(?<=[\w/%~-])(?<!\*\/|(?:^|[^\w$/%~.-])(?:static|accessor))#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Er=/(^|[?&;,\s]|(?<=[\w/%~-])#)([\w%-]*(?:\[[\w%-]*\][\w%-]*)*)=/g,Ir=/(?:[^\s&"'`<>\\,;(){}[\]$]|\$(?!\{))+/y,Ar=/[^&]+/y,Tr=y(!1),_r=y(!0),Cr=/^!?\//,$r=new Set(["reset","resets","verify","unlock","activate","invite","forgot","forgotten","recover","recovery"]),Rr=new Set(["passwordreset","passwordresets","resetpassword","verifyemail","emailverification","magiclink","magiclogin","emaillogin","loginlink","lostpassword","setpassword","createpassword"]),Dr=new Set(["setpassword","createpassword","resetpassword","passwordreset","forgotpassword","forgottenpassword","lostpassword","verifyemail","emailverification"]),Or=new Set(["sent","done","success","complete","new","error","expired","failed","invalid"]),Nr=new Set(["confirm","confirmation","confirmations","invites","invitation","invitations","verification","verifications","activation","activations","password","passwords","signup","login"]),Lr=new Set(["email","account","registration","registrations","signup"]),zr=new Set(["accept","link","new","old","sign","up","email","account","registration","admin","change","php","asp","aspx","htm","html","jsp","cgi"]),Ur=e=>e.some(e=>Lr.has(e))||e.join("").includes("signup"),Br=new Set(["cb","auth","sso","signin","authorize","authorized","redirect"]),jr="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:[]},Pr=new Set,Mr=0,Kr=16,Fr=["",[],!1,null],Zr=8192,Hr=1/0,Wr=0,Vr=10,Jr=/[A-Za-z0-9]/,Gr=/(?:%(?:25)*[\da-f]{2}|(?:\\|%(?:25)*5c)(?:[nrtbf]|u[\da-f]{4}))$/i,Qr=[["%25252f",3],["%252f",2],["%2f",1],["\\/",0],["/",0]],Xr=Math.max(...Qr.map(([,e])=>e)),Yr=/[/\\?#\s"<>`{}|^[\]]/,ei=/[!$&'()*+,;=:@]/,ti=64,ni=/"(?:[^"\\]|\\[\s\S])*"|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}]/g,ri=/[ \t\n\r]*:/y,ii=new Set(["type","rel","method","enctype","autocomplete","inputmode","enterkeyhint","dir","role","crossorigin","referrerpolicy","loading","decoding","fetchpriority","contenteditable","draggable","spellcheck","translate"]),si=class{constructor(e){this.page=e}styles=new Map;texts=new Map;gone(e){return void 0===this.page||!this.page.present(e)}get size(){let e=0;for(let t of this.styles.values())e+=t.size;return this.styles.size+this.texts.size+e}aG(e,t){this.R(e),this.texts.set(e,t),this.styles.get(t)?.add(e),this.page?.note(e)}R(e){let t=this.texts.get(e);void 0!==t&&this.styles.get(t)?.delete(e),this.texts.delete(e)&&this.page?.forget(e)}drop(e){let t=this.styles.get(e);if(void 0!==t)for(let e of t)this.texts.delete(e)&&this.page?.forget(e);this.styles.delete(e)&&this.page?.forget(e),this.R(e)}observe(e){if(!Le(e)||!Le(e.data))return;let t=e.data;if(2===e.type){for(let e of[...this.styles.keys(),...this.texts.keys()])this.page?.forget(e);this.styles.clear(),this.texts.clear(),this.walk(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.gone(e.id)&&this.drop(e.id);let r=Array.isArray(t.adds)?t.adds.filter(Le):[];for(let e of r)this.walk(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.styles.has(e.parentId)?this.aG(t.id,e.parentId):this.R(t.id))}n.length>0&&void 0!==this.page&&this.prune()}prune(){for(let e of this.styles.keys())this.gone(e)&&this.drop(e);for(let e of this.texts.keys())this.gone(e)&&this.R(e)}walk(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.styles.has(i)&&(this.styles.set(i,new Set),this.page?.note(i)),3===e.type&&null!==t&&this.aG(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.texts.has(e.id)&&t.add(e)}for(;r.length>0;){let e=r.pop();Le(e)&&(3===e.type&&"number"==typeof e.id&&this.texts.has(e.id)&&t.add(e),Array.isArray(e.childNodes)&&r.push(...e.childNodes))}return t}},oi=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"}},ai=[{name:"phone_us",pattern:/(?:\+\d{1,3}[ .-]?)?(?:\(\d{3}\)[ .-]?|\b\d{3}[ .-])\d{3}[ .-]\d{4}\b/g},{name:"ssn",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},{name:"ipv4",pattern:/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g}],li=["authorization","cookie","set-cookie","x-api-key","x-auth-token","proxy-authorization"],ui=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ci=/^eyJ[\w-]+\.[\w-]+\.[\w-]*$/,hi=/(?:^|-)[A-Za-z]{3,}-(?:[A-Za-z0-9]+-)*[A-Za-z]{3,}(?:-|$)/,di=/@|\d[\d .()-]{5,}\d|\d\.\d|eyJ/,fi=new Set(["code","state","accesstoken","idtoken","refreshtoken"]),pi=[],gi=!1,yi=!1,mi=/reset|verif|confirm|activat|invit|magic|log-?in|passw|unlock|forgot|recover|sign-?up/i,wi=new Set(["href","xlink:href","src","action","formaction","srcset","poster","cite","data","data-src","data-href","background","longdesc"]),vi=new Set(["title","alt","placeholder","label","content","summary","abbr","aria-label","aria-description","aria-valuetext","aria-placeholder","aria-roledescription","aria-braillelabel","aria-brailleroledescription"]),bi=new Set(["input","textarea","select"]),ki=/^(?:style|_csstext|srcset|data-srcset|imagesrcset|ping|srcdoc)$/,xi=/^[^\s"'`<>{}]*$/,Si=/^(\s*[\d.]*\s*[;,]\s*(?:url\s*=\s*)?)(['"]?)(.*?)(\2\s*)$/is,Ei=/[?#;@]|eyJ/,Ii=new WeakMap,Ai=Ze(!1),Ti=Ze(!0),_i=/(?:[A-Za-z0-9_-]|[\u0080-\uffff]|\\(?:[0-9A-Fa-f]{1,6}[ \t\n]?|[^\n0-9A-Fa-f]))+/y,Ci={Tab:"\t",NewLine:"\n",excl:"!",quot:'"',QUOT:'"',num:"#",dollar:"$",percnt:"%",amp:"&",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"},$i=new Set(["script","style","textarea","title","xmp","iframe","noembed","noframes"]),Ri=/(^|[\s/"'])(href|xlink:href|src|action|formaction|poster|cite|data|background|longdesc|data-src|data-href|srcset|imagesrcset|data-srcset|ping|content|style|srcdoc)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi,Di=/^(?:(?:[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,Oi=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"]),Ni={},Li="[MASKED]",zi=class{config;aI;al;strict;constructor(e={},t="balanced"){this.strict="strict"===t,this.config=this.settle(ht(ct(),e)),this.aI=dt(ai),this.al=dt(this.config.piiPatterns)}settle(e){return this.strict?{...e,maskNetworkBodies:!0}:e}maskText(e){if(!e)return e;let t=E(e,this.al);for(let e of this.aI)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?_r:Tr)}(-1===t?e:e.slice(0,t),this.strict)}maskNetworkData(e,t){let n={...e};n.requestHeaders=this.aU(e.requestHeaders),n.responseHeaders=this.aU(e.responseHeaders);let r=this.bodyJob(e),i=r&&(t??Ni.redact?.(r)??{requestBody:e.requestBody?Li:null,responseBody:e.responseBody?Li:null});return n.requestBody=i?i.requestBody:e.requestBody?Li:null,n.responseBody=i?i.responseBody:e.responseBody?Li:null,n.url=this.maskUrl(e.url),n}bodyJob(e){return this.config.maskNetworkBodies?null:{requestBody:e.requestBody,responseBody:e.responseBody,requestType:ze(e.requestHeaders),responseType:ze(e.responseHeaders),patterns:this.al}}getConfig(){return this.config}updateConfig(e){this.config=this.settle(ht(this.config,e)),this.al=dt(this.config.piiPatterns)}aU(e){let t={},n=new Set(this.config.sensitiveHeaders.map(e=>e.toLowerCase()));for(let[r,i]of Object.entries(e)){let e=r.toLowerCase();n.has(e)||ut(e)||this.strict&&!Oi.has(e)?t[r]="[REDACTED]":t[r]=this.maskText(lt(e,i,e=>this.maskUrl(e)))}return t}},Ui=200,Bi=/^[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*$/,ji="must be 1-200 characters of letters, digits, dot, dash and underscore, with no empty dot-separated segment",qi=["status","serverMessage","endpoint","sessionId"],Pi=["issues"],Mi=pt({KUI_E_INGEST_KEY_REJECTED:["The ingest server refused the SDK's API key (401 or 403). Capture has stopped.",qi,Pi],KUI_E_INGEST_ENDPOINT_NOT_FOUND:["The ingest server answered 404 or 405: nothing at `endpoint` accepts a POST. Capture has stopped.",qi,Pi],KUI_E_SESSION_CONFLICT:["The ingest server answered 409: this session id is already claimed, or a batchId was re-used. Capture has stopped.",qi,Pi],KUI_E_INGEST_REJECTED:["The ingest server refused a batch with a terminal 4xx (400, 413 or 415). Capture has stopped.",qi,Pi],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"]]}),Ki=pt({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"]]}),Fi={message:null,issues:null},Zi=500,Hi=100,Wi=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=Mi[e].remedy,this.status=n,this.serverMessage=r.message,this.issues=r.issues,this.evidence=i}},Vi=class extends Wi{constructor(e){let{message:t,issues:n}=e.server,r=`[keploy] capture stopped: the server rejected this batch with ${e.status} and will reject the rest, so capture has stopped (${e.code}). ${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}:{}})}},Ji=class extends Wi{constructor(e){super("KUI_E_SESSION_ID_INVALID",`[keploy] capture did not start: sessionIdGenerator ${null!==e.sessionId?`returned ${JSON.stringify(e.sessionId)}, which the ingest server would refuse`:e.received.startsWith("threw ")?e.received:`returned ${e.received}, which is not a session id`} (KUI_E_SESSION_ID_INVALID). A session id ${ji}.`,null,Fi,{sessionId:e.sessionId,received:e.received,rule:ji})}},Gi=class extends Wi{constructor(e){super("KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE",`[keploy] capture ended before anything was recorded: privacyMode "strict" could not load its attribute allow-list (KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE): ${e.reason}. What to do: ${Mi.KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE.remedy.docs}`,null,Fi,{reason:e.reason})}},Qi=class extends Wi{constructor(e){super("KUI_E_DOM_RECORDER_UNAVAILABLE",`[keploy] capture ended before anything was sent: rrweb, the library the SDK records the page with, could not be loaded (KUI_E_DOM_RECORDER_UNAVAILABLE): ${e.reason}. What to do: ${Mi.KUI_E_DOM_RECORDER_UNAVAILABLE.remedy.docs}`,null,Fi,{reason:e.reason})}},Xi=class extends Wi{constructor(e){super("KUI_E_PRIVACY_ROUTE_INVALID",`[keploy] capture did not start: privacy.${e.option} has ${e.received}, which is no route (KUI_E_PRIVACY_ROUTE_INVALID). ${jr}.`,null,Fi,{option:e.option,received:e.received,rule:jr})}},Yi=class extends Wi{constructor(e){super("KUI_E_CAPTURE_DECLINED",`[keploy] capture did not start: the browser sent ${"doNotTrack"===e?"Do Not Track":"Global Privacy Control"}, and honorPrivacySignals is on (KUI_E_CAPTURE_DECLINED). Nothing was recorded or sent.`,null,Fi,{signal:e})}},es=class extends Wi{constructor(){super("KUI_E_PRIVACY_CONFLICT",'[keploy] capture did not start: privacyMode "strict" records no request or response body, and privacy.maskNetworkBodies is false, which asks for them (KUI_E_PRIVACY_CONFLICT). Remove privacy.maskNetworkBodies, or use privacyMode "balanced".',null,Fi,{privacyMode:"strict",option:"privacy.maskNetworkBodies"})}},ts=!1,ns=!1,rs=[],is=0,ss=()=>is,os=new WeakSet,as=!1,ls=[],us=!1,cs=[],hs=new Set,ds=(e,t)=>new Promise((n,r)=>{let i=()=>{if(ns&&!t)return n(void 0);let i=()=>n(void 0);hs.add(i),e.then(e=>(hs.delete(i),n(e)),e=>(hs.delete(i),r(e)))};(t||!At(i))&&i()}),fs=()=>globalThis.navigation,ps=["beforeunload","pageshow"],gs="3.2.1",ys=()=>zt(()=>import("@keploy/capture-sdk/body-redact"),void 0),ms=()=>zt(()=>import("@keploy/capture-sdk/body-worker-start"),void 0),ws=!1,vs=!1,bs=!1,ks=new Set,xs=8388608,Ss=0,Es=0,Is=e=>(e<=0||Ss+Es<xs)&&(Ss+=e,!0),As=new Set,Ts=new Map,_s=0,Cs=e=>[...e].some(e=>e.owner.has(e)),$s=e=>e.mark===ss(),Rs="",Ds=!1,Os=!1,Ns=()=>{Bn&&(Ts.clear(),Ht())};cs.push(e=>{e&&Nn&&Nn!==Ln&&Zt(Nn,"left"),Bn&&!Bn()&&Ht()});var Ls,zs,Us="[Response body not read by the page]",Bs="\0[Response body not captured]",js=class{held=new Map;redact(e,t,n,r=ss(),i){if(e?.responseBody==Bs){e.responseBody=null;let n=t;t=e=>n(e&&{...e,responseBody:w(0,vs?"code-failed":"early")})}let s={job:e,owner:this,after:n,mark:r};this.held.set(s,t),e&&(e.requestBody||e.responseBody)?!i&&Ss+Es>=xs?(s.out=Vt(e,!0),s.job=null):Ss+=s.owes=Gt(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(()=>Ut(()=>{this.held.has(s)&&(void 0!==s.out?this.answer(s,s.out):s.sent||Ft(s))}))}holds(){return this.held.size>0}has(e){return this.held.has(e)}answered(e,t){this.held.has(e)&&(e.out=t,Promise.resolve(e.after).then(()=>Ut(()=>this.answer(e,e.out??null))))}answer(e,t){let n=this.held.get(e);n&&(this.held.delete(e),Ss-=e.owes||0,As.delete(e),e.job=e.out=null,n(t))}alone(e){Promise.all([qt(),e.after]).then(()=>Ut(()=>{if(!this.held.has(e))return;let t=e.job;this.answer(e,Dn?Jt(t,65536):Vt(t))}))}drop(){for(let e of this.held.keys())this.answer(e,null)}now(e){let t=65536;for(let n of e?[!0,!1]:[!0])for(let e of[...this.held.keys()]){if(void 0!==e.out){this.answer(e,e.out);continue}let r=e.job;if(!r){this.answer(e,{requestBody:null,responseBody:null});continue}let i=Gt(r);if(n&&!(Dn&&i<=t))continue;let s=Math.min(r.requestBody?.length??0,t);this.answer(e,Dn?Jt(r,s,t-s):Vt(r)),t-=n?i:t}}},qs=/^[\t\n\r ]*\{/,Ps=/[^\t\n\r ]/,Ms=!1,Ks=()=>{let e;return[new Promise(t=>e=t),e]},Fs=new Set,Zs=/^\s*multipart\/form-data\s*(?:;|$)/i,Hs=()=>new TextDecoder("utf-8",{ignoreBOM:!0}),Ws=(e,t)=>t<4194304&&"{"!==(Ps.exec(e)?.[0]??"{"),Vs=async(e,t)=>{let n=await e.arrayBuffer();if(!t())throw 0;return Hs().decode(n)},Js=["arrayBuffer","blob","bytes","formData","json","text"],Gs=globalThis.Response?.prototype.json,Qs=JSON.parse,Xs="function"==typeof FinalizationRegistry?new FinalizationRegistry(e=>e()):null,Ys=class{L=null;C;q;aq;active=!1;H=new Set;aF=new Set;bodies=new js;a5;am=null;run=0;ab=null;ac=null;ad=null;ae=null;constructor(e={},t=524288,n=[],r="balanced"){this.C=new zi(e,r),this.q=t,this.aq=new Set(n.map(Qt))}aR(e){return this.aq.size>0&&this.aq.has(Qt(e))}start(e,t,n,r){this.active||(this.active=!0,this.run++,this.L=e,this.am=t??null,this.a5=n,this.aC=!1,r||this.prepare(),this.bd(),this.bf())}prepare(){this.active&&(this.C.getConfig().maskNetworkBodies||Kt(this,!0))}askForCode(){this.C.getConfig().maskNetworkBodies||qt()}stop(e){this.active&&(this.active=!1,ks.delete(this),(e||0===this.H.size)&&(this.L=null),e&&(this.cutBodies(),this.bodies.drop()),this.bm(),this.bn())}settle(e){let t,n=Promise.allSettled([...this.H]),r=new Promise(n=>{t=setTimeout(n,e)});return Promise.race([n,r]).then(()=>{clearTimeout(t),!this.active&&(this.cutInflight(),this.L=null)})}cutInflight(){this.cutBodies(),this.bodies.now(!0)}cutBodies(e){for(let t of[...this.aF])t(e)}reportDue(e){e&&this.cutBodies(!0),this.bodies.now(!1)}hasInflight(){return this.H.size>0}admits(){if(!this.active)return!1;try{let e=!this.am||this.am();return e&&!this.C.getConfig().maskNetworkBodies&&Kt(this),e}catch{return!1}}track(e){this.H.add(e),e.finally(()=>{this.H.delete(e),!this.active&&0===this.H.size&&(this.L=null)})}bi(e,t){let n=Number(e.headers.get("content-length")??0);if(n>this.q)return t(`[Response body too large: ${n} bytes]`),{page:e,cut:null};if(null===e.body)return t(""),{page:e,cut:null};let r=null;if(void 0!==e.body)try{r=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,a=0,l=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=Us,f=()=>{! --a&&!h.touched&&c(d)},p=e=>{a++,Xs?.register(e,f)},g=()=>c(R("")),y=e=>{let n=new TextDecoder;c($("string"==typeof e?e:rn(n,"",e,t)+n.decode(),t))},m=e=>{let n=e.getReader(),r=new TextDecoder,i="",s=()=>n.read().then(e=>e.done?y(i+r.decode()):(i=rn(r,i,e.value,t),i.length<=t?s():(y(i),n.cancel())));s().catch(g)},w=e=>{try{m(s.call(e).body)}catch{c(null)}},v=(e,n)=>{p(e);let o,a,l=(t,n)=>{Object.defineProperty(e,t,{...n,configurable:!0})};for(let t of Js){let n=r[t];"function"==typeof n&&l(t,{value(){return this!==e||h.reported?n.call(this):(h.touched=!0,"formData"==t||"json"==t&&n!=Gs?(w(e),n.call(e)):("json"==t?r.text:n).call(e).then(e=>(h.reported||("blob"==t?m(e.stream()):y("arrayBuffer"==t?new Uint8Array(e):e)),"json"==t?Qs(e):e),e=>{throw g(),e}))},writable:!0})}l("body",{get(){if(this!==e)return i.call(this);let r=i.call(e);if(r!==o&&(o=a=r,n&&r&&!r.locked&&!h.reported)){let e=Dn?.relayBody;e&&(a=e(r,t,h),p(a)),d=e?Us:Bs}return a}}),l("clone",{value(){let t=s.call(this);return this===e&&v(t),t},writable:!0})};return v(e,!0),{page:e,cut:e=>{(!e||!h.touched)&&c(h.touched?R(h.text):d)},done:l}}(e,this.q,t)}catch{return t(null),{page:e,cut:null}}if(r)return r;try{e.clone().text().then(e=>t($(e,this.q)),()=>t(null))}catch{t(null)}return{page:e,cut:null}}bd(){if("function"!=typeof globalThis.fetch)return;let e=globalThis.fetch;this.ab=e;globalThis.fetch=(t,n)=>{if(!this.active||!this.admits())return e.call(globalThis,t,n);let r;try{r=nn(t)?t.url:t instanceof URL?t.href:String(t)}catch{return e.call(globalThis,t,n)}if(this.aR(r))return e.call(globalThis,t,n);let i,s=t;if(nn(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.run,a=performance.now(),l=i.method,u=sn(i.url),c=Xt(i.headers),h=this.C.getConfig().maskNetworkBodies,d=e.call(globalThis,t,n),f=()=>this.active&&o===this.run,[p,g]=Ks(),y=null==n?.body&&nn(t)&&!/^(?:GET|HEAD)$/.test(l)?Promise.resolve().then(()=>{if(null!==i.body)return function(e,t,n,r){if(Zs.test(e.headers.get("content-type")??""))return e.formData().then(e=>r()?Yt(e):null);let i=e.body;if(i)return async function(e,t,n,r){let i=e.getReader(),s=Hs(),o="",a="";try{for(;;){let e=await i.read();if(!r())return i.cancel().catch(()=>{}),null;if(e.done)return o+s.decode();let l=e.value,u=n&&!a&&l instanceof Uint8Array?[l.subarray(0,1024),l.subarray(1024)]:[l];for(let e of u){let r=s.decode(e,{stream:!0});if(a||(a=Ps.exec(r)?.[0]??""),o+=r,n&&Ws(a,t))return i.cancel().catch(()=>{}),o}if(o.length>t&&(o.length>4194304||""!==a&&"{"!==a))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;if(n){let n=await Vs(e.slice(0,1024),r);if(Ws(n,t))return n}let i=await Vs(e.slice(0,s),r);return e.size>s&&/^[\t\n\r ]*(?:\{|$)/.test(i)?Vs(e.slice(0,12582916),r):i}).catch(()=>null)}(i,this.q,h,()=>f());m=null,w=""}):null,m=null!=n?.body?h?Promise.resolve(tn(n.body,!1)):async function(e,t){if(null==e)return null;try{return"string"==typeof e?$(e,t):e instanceof URLSearchParams?$(e.toString(),t):e instanceof FormData?$(Yt(e),t):e instanceof Blob?e.size>t?`[Blob: ${e.size} bytes, truncated]`:await e.text():e instanceof ArrayBuffer||ArrayBuffer.isView(e)?en(e,t):"[ReadableStream]"}catch{return"[Unreadable body]"}}(n.body,this.q):y?y.then(e=>null==e?null:$(e,this.q),()=>"[Unreadable body]"):Promise.resolve(null),w=null!=n?.body?this.termFor(n.body,l,p):y?y.then(e=>null===e?"body:*":this.termFor(e,l,p),()=>"body:*"):this.termFor(null,l,p);return Promise.resolve(d).then(e=>{if(o!==this.run||!this.admits())return f=()=>0,g(),e;try{let t,n="HEAD"===l||[204,205,304].includes(e.status);return f=this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:Xt(e.headers),responseBody:null,statusCode:e.status,duration:performance.now()-a,type:"fetch"},m,w,p,g,r=>{return n?(r(""),t={page:e,cut:null}):h?(r(null===(i=e).body||i.body?.locked||/^\s*0+\s*$/.test(i.headers.get("content-length")??"")?null:Li),t={page:e,cut:null}):t=this.bi(e,r);var i}),t.page}catch{return g(),e}},e=>{throw o===this.run&&this.admits()?(f=this.reportWhenKnown(o,Date.now(),{method:l,url:u,requestHeaders:c,requestBody:null,responseHeaders:{},responseBody:null,statusCode:0,duration:performance.now()-a,type:"fetch"},m,w,p,g),e):(f=()=>0,g(),e)})}}bm(){this.ab&&(globalThis.fetch=this.ab,this.ab=null)}bf(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;this.ac=e,this.ad=t;let n=this.q,r=()=>this.admits(),i=()=>this.run,s=(...e)=>this.termFor(...e),o=(...e)=>this.reportWhenKnown(...e),a=e=>this.aR(e),l=()=>this.C.getConfig().maskNetworkBodies,u=new WeakMap,c=XMLHttpRequest.prototype.setRequestHeader;this.ae=c,XMLHttpRequest.prototype.setRequestHeader=function(e,t){let n=u.get(this);return n&&(n.requestHeaders[e]=t),c.call(this,e,t)};let h=e;XMLHttpRequest.prototype.open=function(e,t,...n){let r="string"==typeof t?t:t.toString(),i=h.call(this,e,t,...n);return a(r)||u.set(this,{method:e,url:sn(r),requestHeaders:{},startTime:0}),i},XMLHttpRequest.prototype.send=function(e){let a=u.get(this);a&&(a.startTime=performance.now());let c,h=i(),d=r(),f=()=>{this.readyState<2||(c=ss(),this.removeEventListener("readystatechange",f))};a&&d&&this.addEventListener("readystatechange",f);let p=l();return this.addEventListener("loadend",()=>{if(!a||!d||!r())return;let t=performance.now()-a.startTime,i=this.getAllResponseHeaders(),l={};if(i)for(let e of i.trim().split(/[\r\n]+/)){let t=e.indexOf(": ");t>0&&(l[e.slice(0,t)]=e.slice(t+2))}let u=null;if(p)u=function(e){if(""!==e.responseType&&"text"!==e.responseType)return Li;try{return e.responseText?Li:null}catch{return Li}}(this);else try{"string"==typeof this.responseText&&(u=$(this.responseText,n))}catch{u=`[${this.responseType} response]`}let f=p?tn(e,!0):function(e,t){if(null==e)return null;if("string"==typeof e)return $(e,t);if(e instanceof FormData)return $(Yt(e),t);if(e instanceof URLSearchParams)return $(e.toString(),t);if(typeof Blob<"u"&&e instanceof Blob)return`[Blob: ${e.size} bytes]`;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return en(e,t);if(typeof Document<"u"&&e instanceof Document)try{return $((new XMLSerializer).serializeToString(e),t)}catch{return"[Unreadable body]"}return"[Unreadable body]"}(e,n),[g,y]=Ks();o(h,Date.now(),{method:a.method,url:a.url,requestHeaders:a.requestHeaders,requestBody:f,responseHeaders:l,responseBody:u,statusCode:this.status,duration:t,type:"xhr"},null,s(e,a.method,g),g,y,void 0,c)},{once:!0}),t.call(this,e)}}bn(){typeof XMLHttpRequest>"u"||(this.ac&&(XMLHttpRequest.prototype.open=this.ac,this.ac=null),this.ad&&(XMLHttpRequest.prototype.send=this.ad,this.ad=null),this.ae&&(XMLHttpRequest.prototype.setRequestHeader=this.ae,this.ae=null))}reportWhenKnown(e,t,n,r,i,s,o,a,l=ss()){let u,c=r?null:{value:n.requestBody},h="object"==typeof i?null:{value:i},d=a?null:{value:n.responseBody},f=n,p=()=>f,g=0,y=(n,r,i)=>{if(!f)return;let s=f;f=c=h=d=null,this.aF.delete(w),o(),Is(-g),e===this.run&&this.emit({...s,requestBody:n.value,responseBody:i.value,...void 0===r.value?{}:{requestTerm:r.value}},t,u?.done,l,g)},m=()=>{c&&h&&d?y(c,h,d):!Ms&&c&&d&&!g&&(g=1024+(c.value?.length??0),Is(g+=d.value?.length??0)||(g=0,w()))},w=e=>{if(e)return u?.cut?.(!0);u?.cut?.(),y(c??{value:"[Unreadable body]"},h??{value:"body:*"},d??{value:null})};if(c&&h&&d)return m(),p;this.aF.add(w),this.track(s),r?.then(e=>{c=f&&{value:e},m()}),"object"==typeof i&&i.then(e=>{h={value:e},m()});let v=a?.(e=>{d={value:e},m()});return u=v&&{cut:v.cut,done:v.done},m(),p}aC=!1;termFor(e,t,n){try{let i=null==(r=e)||""===r?"":"string"==typeof r?r.length>4194304?"body:*":function(e){return qs.test(e)&&(e.includes('"query"')||e.includes("persistedQuery")||e.includes("\\u"))}(r)?null:"":r instanceof URLSearchParams||typeof FormData<"u"&&r instanceof FormData?"":"body:*";if(null!==i)return i;let s=globalThis.crypto?.subtle,o=Ms?0:e.length+1024;return Is(o)?(e=>{if(!zs){let e=zs=ds((Ls||(Ls=zt(()=>import("@keploy/capture-sdk/request-term"),void 0).then(e=>(Ms=!0,e))).catch(()=>{}),Ls),Ms),t=()=>{zs=void 0;for(let t of Fs)t(e);Fs.clear()};e.then(t,t)}return new Promise(t=>{Fs.add(t),e.then(()=>(Fs.delete(t),t(void 0)))})})(n).finally(()=>Is(-o)).then(t=>t?t.recordTermFor(e,s):"body:*",e=>(this.aB(t,e),"body:*")).catch(e=>this.aB(t,e)):"body:*"}catch(e){return this.aB(t,e)}var r}aB(e,t){if(!this.aC){this.aC=!0;try{console.warn(function(e,t){return mt({code:"KUI_E_REQUEST_TERM_FAILED",method:e,reason:t},"recorded a request without its term, or body:*: computing it failed; the request itself was not affected. The capture continues; any further such requests in this capture are recorded that way, silently.")}(e,xt(t)))}catch{}}}emit(e,t,n,r,i){let s=this.L;if(!s)return;let o,a,l=this.a5?.();this.track(new Promise(e=>o=e));try{a=this.C.bodyJob(e)}catch{return o()}a&&(e.requestBody=e.responseBody=null),this.bodies.redact(a,n=>{if(o(),n)try{s(this.C.maskNetworkData(e,n),t,l)}catch{}},n,r,i)}},eo=gs,to=32768,no=10485760,ro=16777216,io=class{config;queue=[];retryQueue=[];aH=0;T=null;current=null;sessionId=null;O=null;aJ=null;get online(){return typeof navigator>"u"||!1!==navigator.onLine}started=!1;aV=1;v=!1;h=!1;asked=0;N=!1;wakeSender=null;k=0;G=0;a1=!1;a$=!1;a0=!1;a_=!1;W=new WeakMap;inFlight=null;held=0;queued=0;F=!1;m=0;Z=0;constructor(e){this.config={...e,batchSize:Math.min(e.batchSize,5e3)}}fail(e,t,n){this.discard();let r=new Vi({code:e,status:t,server:bt(n),endpoint:this.config.endpoint,sessionId:this.sessionId??null});if(this.config.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.config.onSessionEnd?.()}catch{}}else{on(()=>console.error(r.message)),this.stop();try{this.config.onCaptureEnd?.()}catch{}try{this.config.onError?.(r)}catch{}}}start(e,t,n=null){this.started||(this.started=!0,this.sessionId=e,this.O=t,this.aJ=n,this.G=an(JSON.stringify(this.aT([],this.ar()))),this.T=setInterval(()=>{this.aX||this.flush(this.N&&this.online)},this.config.batchInterval),typeof window<"u"&&(window.addEventListener("online",this.aM),window.addEventListener("pagehide",this.V),window.addEventListener("beforeunload",this.V),document.addEventListener("visibilitychange",this.aN)))}hold(){this.h=!0}release(e=!0){if(this.h=!1,e||this.N&&this.online)this.flush(!0);else if(this.online){let e=this.queue.length/this.config.batchSize|0;e&&(this.asked=e-1),(e||(this.F=this.af()))&&this.flush()}}discard(){this.queue=[],this.queued=0,this.retryQueue=[]}stop(){if(!this.started)return this.current??Promise.resolve();this.started=!1,this.h&&this.discard(),this.T&&(clearInterval(this.T),this.T=null);let e=this.flush(!0);return typeof window<"u"&&(window.removeEventListener("online",this.aM),e.finally(()=>this.ao())),e}ao(){this.started||this.I()>0||typeof window>"u"||(window.removeEventListener("pagehide",this.V),window.removeEventListener("beforeunload",this.V),document.removeEventListener("visibilitychange",this.aN))}enqueue(e){if(!this.started)return;e.seq??=this.aV++;let t;try{let n=JSON.stringify(e),r=an(n);this.W.set(e,[n,r]),t=this.G+r}catch(t){this.bl(e,t),this.dropped([e]);return}if(t>no){this.bk(e,t),this.dropped([e]);return}this.queue.push(e),this.held+=t,this.queued+=this.j(e);let n=[];for(;this.queue.length>this.config.maxQueueSize;){let e=this.queue.shift();this.queued-=this.j(e),n.push(e)}n.length>0&&this.dropped(n),this.aL(),!this.aX&&(t>to?this.online&&!this.h?this.flush(!0):this.N=!0:this.queue.length>=this.config.batchSize?(null!==this.current&&this.asked++,this.flush()):!this.h&&this.online&&this.af()&&(this.F=!0,this.flush()))}place(){return this.aV++}get aX(){return performance.now()<this.Z}aL(){if(this.held<=ro)return;let e=0;for(let t of this.retryQueue)e+=t.bytes;for(let t of this.queue)e+=this.j(t);let t=[];for(;e>ro;){let n=this.retryQueue.shift();if(n)e-=n.bytes,t.push(...n.events);else{let n=this.queue.shift();e-=this.j(n),this.queued-=this.j(n),t.push(n)}}this.held=e,t.length>0&&this.dropped(t)}dropped(e){!this.online&&0===this.m&&(this.m=1,on(()=>this.config.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.queued-=this.j(i)):r.push(i)}this.queue=r}on(()=>this.config.onDropped?.(e,n))}bl(e,t){if(this.a1)return;this.a1=!0;let n=t instanceof Error?t.message:String(t);console.warn(yt({code:"KUI_E_EVENT_UNSERIALISABLE",eventId:e.id,eventType:e.type,reason:n},"it cannot be serialised to JSON."))}bk(e,t){this.a$||(this.a$=!0,this.a8({code:"KUI_E_EVENT_OVERSIZED",eventId:e.id,eventType:e.type,bytes:t,cap:no},`${t} bytes in a body, over the ingest server's ${no}-byte cap, so no batch could carry it.`))}reportScrubOversized(e,t,n){this.a0||(this.a0=!0,this.a8({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, over the ingest server's ${n}-byte cap, so no batch could carry it.`))}reportNavigationUnwrapped(e){this.a_||(this.a_=!0,this.aS(mt({code:"KUI_E_NAVIGATION_UNWRAPPED",method:e},"the page made a History or Navigation API method impossible to replace and put back, so the SDK wrapped none of them. The capture continues: route changes are still recorded, with less detail, and none says that the page's script asked for it.")))}a8(e,t){this.aS(yt(e,t))}aS(e){console.warn(e)}aT(e,t){return{sessionId:this.sessionId,batchId:t,events:e,metadata:this.O,sdk:{name:"@keploy/capture-sdk",version:eo},captureIdentity:this.aJ}}flush(e=!1){return this.h?Promise.resolve():(e&&(this.v=!0),this.current?this.current:0===this.I()||!this.online&&!this.v?(this.v=!1,this.m>0&&0===this.I()&&this.online&&(this.m=this.Z=0,on(()=>this.config.onFailing?.(!1))),Promise.resolve()):(this.current=this.run(),this.current))}async run(){let e=!1;try{do{let t=this.bp()??this.a9();if(null===t)return;this.inFlight=t;try{await this.bg(t)}catch{this.Z=performance.now()+Math.min(2e3*2**this.m,6e4)*(1+Math.random()/2),0===this.m++&&on(()=>this.config.onFailing?.(!0)),this.held+=t.bytes,this.retryQueue.unshift(t),this.aD();return}finally{this.inFlight===t&&(this.inFlight=null)}this.F=!this.v&&this.online&&this.af(),e=this.asked>0&&!this.h&&this.online&&this.queue.length>=this.config.batchSize,e&&this.asked--}while((this.v||this.F||e)&&this.I()>0)}finally{this.v=!1,this.F=!1,this.asked=0,0===this.I()&&(this.N=!1),this.current=null,this.ao()}}bo(e){return new Promise(t=>{let n=()=>{clearTimeout(r),this.wakeSender===n&&(this.wakeSender=null),t()},r=setTimeout(n,e);this.wakeSender=n})}async bg(e){let t=e.json,n=e.wire??=async function(e){if(typeof CompressionStream<"u"&&typeof Response<"u")try{let t=new Response(e).body.pipeThrough(new CompressionStream("gzip")),n=await new Response(t).arrayBuffer(),r=an(e);return n.byteLength<r?{body:n,bytes:n.byteLength,encoding:"gzip"}:{body:e,bytes:r,encoding:null}}catch{}return{body:e,bytes:an(e),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 a={"Content-Type":"application/json","X-API-Key":this.config.apiKey};o&&(a["Content-Encoding"]=o);let l=!e.early&&s<=to-this.k;l&&(this.k+=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.config.endpoint,{method:"POST",headers:a,body:t,keepalive:l,signal:u?.signal});try{i=await r.text()}catch{i=null}}finally{clearTimeout(c),e.onWire=!1,l&&(this.k-=s)}}catch{}if(r){if(r.ok){this.m>0&&(this.m=this.Z=0,this.v=!0,on(()=>this.config.onFailing?.(!1))),on(()=>this.config.onDelivered?.(e.events));return}let{status:t}=r,n=vt(t);if(null!==n){on(()=>this.fail(n,t,i));return}}if(this.m>0||2===t)break;let s=1e3*Math.pow(2,t)*(.5+.5*Math.random());await this.bo(s)}throw new Error("Transport: all retry attempts failed")}bh(){let e=this.inFlight;if(e&&!e.onWire&&!e.abandoned){if(e.abandoned=!0,this.inFlight=null,this.held+=e.bytes,e.dispatched){this.retryQueue.unshift(e),this.aD();return}this.queue.unshift(...e.events),this.aE(e.events,-1),this.aD()}}bp(){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}a9(){if(0===this.queue.length)return null;let e=this.af(),t=this.F&&!this.v&&e?to-this.k:no;this.F=!1;let n=0,r=this.G,i=0,s=Math.min(this.config.batchSize,this.queue.length);for(;i<s;){let e=this.j(this.queue[i])+(0===i?0:1);if(r+e>t)break;e>n&&(n=e),r+=e,i++}0===i&&(n=this.j(this.queue[0]),r+=n);let o=this.queue.splice(0,Math.max(i,1));this.aE(o);let a=this.ar(),l=this.body(o,a);for(let e of o)this.W.delete(e);return{events:o,batchId:a,json:l,dispatched:!1,onWire:!1,abandoned:!1,bytes:r,early:e&&this.G+n<=to}}body(e,t){return JSON.stringify(this.aT([],t)).replace('"events":[]',()=>`"events":[${e.map(e=>this.W.get(e)?.[0]??JSON.stringify(e)).join()}]`)}j(e){return this.W.get(e)?.[1]??an(JSON.stringify(e))}ar(){let e=typeof crypto<"u"?crypto:void 0;if(e&&"function"==typeof e.randomUUID)return e.randomUUID();this.aH+=1;let t=Math.floor(4294967295*Math.random()).toString(16).padStart(8,"0");return`${Date.now().toString(16).padStart(12,"0")}-${(this.aH%4294967296).toString(16).padStart(8,"0")}-`+t}aE(e,t=1){for(let n of e)this.queued-=t*this.j(n)}af(){return this.G+this.queued+this.queue.length>to-this.k}I(){let e=this.queue.length;for(let t of this.retryQueue)e+=t.events.length;return e}aD(){let e=0;for(let t of this.retryQueue)e+=t.events.length;let t=[];for(;this.queue.length>0&&e+this.queue.length>this.config.maxQueueSize;){let e=this.queue.pop();this.queued-=this.j(e),t.push(e)}t.length>0&&this.dropped(t.reverse()),this.aL()}flushOnUnload(e=!1){if(this.h||(this.bh(),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:an(e.json);if(n>to-this.k)return;this.retryQueue.shift(),e.dispatched=!0,this.aY(t?t.body:e.json,n,t?.encoding)}if(0===this.queue.length)return;let t=to-this.k-(e&&this.inFlight?.early&&this.inFlight.onWire?this.inFlight.sent?.bytes??this.inFlight.bytes:0),n=this.ar(),r=this.G,i=0;for(let e of this.queue){let n=this.j(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.aE(s);let o=this.body(s,n);this.aY(o,an(o))}aY(e,t,n){try{this.k+=t,fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.config.apiKey,...n?{"Content-Encoding":n}:{}},body:e,keepalive:!0}).then(e=>e.arrayBuffer()).catch(()=>{}).finally(()=>{this.k-=t})}catch{this.k-=t}}aM=()=>{try{this.config.beforeOnlineFlush?.()}catch{}this.wakeSender?.(),this.flush(this.N)};V=e=>{if(!this.h&&"pagehide"===e.type)try{this.config.beforeUnloadFlush?.()}catch{}this.flushOnUnload("beforeunload"===e.type),this.ao()};aN=()=>{this.h||"hidden"===document.visibilityState&&(this.config.beforeHiddenFlush?.(),this.flush(!0))};get queueSize(){return this.I()}},so=null,oo=!1,ao=null,lo=!1,uo=[new Set,new Set],co=[0,0],ho=e=>e.strict?new Gi({reason:e.failed}):new Qi({reason:e.failed}),fo=256,po=65536,go=new Map,yo="",mo=-1,wo=null,vo=64,bo=524288,ko=new Set,xo=new Set,So=null,Eo=null,Io=null,Ao=[],To=null,_o=null,Co=new Map,$o=!1,Ro=class e{phase="idle";J=!1;hidden=!1;B=!1;p=!1;i=null;a2=!1;ah=5e3;outage=!1;failing(e){this.outage=e,null!==this.i&&clearTimeout(this.i),this.i=null,!e&&this.p&&this.au(!1)}lost(e,t){t||!e.some(e=>"dom"===e.type)||(this.p=!0,this.au(e.some(e=>"dom"===e.type&&2===e.data?.type)))}au(e){if(this.outage)return;if(null!==this.i){if(!e||!this.a2)return;clearTimeout(this.i)}this.a2=!e;let t=e?this.ah:0;e&&(this.ah=Math.min(2*this.ah,6e4)),this.i=setTimeout(()=>{if(this.i=null,!this.p||"recording"!==this.getState())return;let e=this.o?.takeFullSnapshot;if(e){this.B=!1;try{e.call(this.o)}catch{this.B=!0}}},t)}delivered(e){e.some(e=>"dom"===e.type&&2===e.data?.type)&&(this.ah=5e3)}styles=new si({note:e=>{let t=this.o?.mirror?.getNode(e);t&&this.aA.set(e,t)},present:e=>this.ba(e),forget:e=>{this.aA.delete(e)}});aA=new Map;sessionId=null;O=null;config;onEvent=null;a6=null;a4=null;ai=null;landing=!1;l=null;aa=null;M=null;o=null;D=!1;generation=0;ak=null;P=null;aw=null;K="";aj="";constructor(e){this.config=e}async start(e,t=null,n=!1,r=null,i=null,s=null){if("active"===this.phase)return this.sessionId;"stopping"===this.phase&&this.stop();let o={secretRoutes:[],keepRoutes:[]};for(let e of["secretRoutes","keepRoutes"]){let t=this.config.privacy?.[e]??[];if(!Array.isArray(t))throw this.phase="stopped",new Xi({option:e,received:St({returned:t})});for(let n of t){let t=X(n,"keepRoutes"===e);if(null===t)throw this.phase="stopped",new Xi({option:e,received:St({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("/")}`;Pr.has(t)||(Pr.add(t),n.push(e),Mr++,Fr=["",[],!1,null])}}(o.secretRoutes,o.keepRoutes);let a,l=this.config.sampleRate??1;if(Math.random()>l)return this.phase="stopped","";this.onEvent=e,this.a6=t,this.a4=r,this.ai=i;try{a=this.config.sessionIdGenerator?this.config.sessionIdGenerator():ln()}catch(e){throw this.phase="stopped",new Ji({sessionId:null,received:St({threw:e})})}if(!ft(a))throw this.phase="stopped",new Ji({sessionId:"string"==typeof a?a:null,received:St({returned:a})});this.sessionId=a,this.O=function(e){let t=typeof window<"u"?window:void 0,n=t?.location?.href??"",r=""===n?null:gn(n);return{url:Ne(e(n),r),userAgent:typeof navigator<"u"?navigator.userAgent:"",viewport:{width:t?.innerWidth??0,height:t?.innerHeight??0},referrer:typeof document<"u"&&document.referrer?Ne(e(document.referrer),r):"",language:typeof navigator<"u"?navigator.language:"",devicePixelRatio:t?.devicePixelRatio??1,timestamp:Date.now()}}(this.scrubUrl),this.phase="active",this.J=n,this.B=!1,this.hidden=typeof document<"u"&&"hidden"===document.visibilityState,this.D=!1;let u=++this.generation;typeof document<"u"&&(this.P=()=>{this.hidden="hidden"===document.visibilityState,"recording"===this.getState()&&this.aW()},document.addEventListener("visibilitychange",this.P)),this.aj=typeof location<"u"?location.href:"",this.K=typeof location<"u"?this.scrubUrl(location.href):"",this.aw=En((e,t,n)=>this.navigated(e,t,n));let c=await this.av();if(u!==this.generation||"active"!==this.phase)return"";if(null!==c&&typeof window<"u")throw this.stop(),ho(c);let h=this.config.maxSessionDuration??6e5;return this.ak=setTimeout(()=>{try{this.a6?.()}finally{"active"===this.phase&&this.stop()}},h),So?.refused&&s?.(So.refused),this.sessionId}stopDom(){"active"===this.phase&&(this.phase="stopping"),this.M&&(this.M(),this.M=null),this.ak&&(clearTimeout(this.ak),this.ak=null)}stop(){if("active"===this.phase||"stopping"===this.phase){null!==this.l&&(window.removeEventListener("online",this.l),this.l=null,this.az()),this.landing=!1;for(let e of uo)e.delete(this);this.stopDom(),this.o=null,this.i&&(clearTimeout(this.i),this.i=null),this.P&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.P),this.P=null),this.aw?.(),this.aw=null,this.phase="stopped"}}navigated(e,t,n){if("active"!==this.phase)return;this.aj=location.href;let r=this.scrubUrl(location.href);dn(r)!==dn(this.K)&&(this.K=r,this.emitEvent("dom",{type:4,data:{href:r,...hn(),cause:e,...void 0===t?{}:{userInitiated:t},...void 0===n?{}:{initiator:n}},timestamp:Date.now()}))}bj(e){if("object"!=typeof e||null===e)return e;let t=e,n=t.data?.href;return 4!==t.type||"string"!=typeof n?e:(this.K=this.scrubUrl(n),{...t,data:{...t.data,href:this.K}})}isUserPaused(){return this.J}pause(){"active"===this.phase&&(this.J=!0)}resume(){"active"===this.phase&&(this.J=!1,"recording"===this.getState()&&this.aW())}aW(){if(!this.M){this.B=!1;let e=this.generation;this.av().then(t=>{null!==t?this.aZ(e,t):this.bb(e)});return}if(!this.B&&!this.p)return;let e=this.o?.takeFullSnapshot;if(e){if(this.outage){this.p=!0;return}this.B=!1;try{e.call(this.o)}catch{this.B=!0}}}getSessionId(){return"active"===this.phase?this.sessionId:null}get a7(){return"active"===this.phase&&!this.J}getState(){return"idle"===this.phase?"idle":"stopped"===this.phase||"stopping"===this.phase?"stopped":this.J||this.hidden?"paused":"recording"}getMetadata(){return this.O}async av(){if(this.D)return null;this.D=!0;let t=this.generation;if(!this.loaded()&&typeof window<"u"&&!1===navigator.onLine&&!Nt())return this.D=!1,this.a3(t),null;let n=+("strict"===this.config.privacyMode);if(co[n])return uo[n].add(this),this.land();let r=cn(n>0),i=await ds(r,this.loaded());if(!i)return t===this.generation&&"active"===this.phase&&(uo[n].add(this),this.land(),co[n]||e.whenLanded(n,r)),null;if(t!==this.generation)return null;if("failed"in i)return this.D=!1,i;let s=i.record;return"recording"!==this.getState()?(this.D=!1,null):(this.o=s,this.M=s(this.bq())??null,null)}a3(e){if(null!==this.l)return;let t=()=>{if(window.removeEventListener("online",t),this.az(),this.l=null,e===this.generation&&"active"===this.phase){if(!1===navigator.onLine){this.a3(e);return}cn("strict"===this.config.privacyMode).then(t=>this.loadedLate(e,t))}};this.l=t,window.addEventListener("online",t,{once:!0}),this.aa=setInterval(()=>{!1!==navigator.onLine&&t()},1e3)}static whenLanded(e,t){co[e]++,t.then(t=>{co[e]--;let n=[...uo[e]];uo[e].clear();for(let e of n)e.landing&&e.loadedLate(e.generation,t)})}land(){return this.D=!1,this.landing=!0,null}loadedLate(e,t){if(e===this.generation&&"active"===this.phase){if(this.landing=!1,"failed"in t){this.aZ(e,t);return}this.av(),this.ai?.(null)}}az(){null!==this.aa&&(clearInterval(this.aa),this.aa=null)}aZ(e,t){e!==this.generation||"active"!==this.phase||(this.stop(),this.ai?.(ho(t)))}bb(e){e!==this.generation||"active"!==this.phase||!this.loaded()||null===this.l||(window.removeEventListener("online",this.l),this.l=null,this.az(),this.ai?.(null))}loaded(){return oo&&(lo||"strict"!==this.config.privacyMode)}awaitingRRWeb(){return null!==this.l||this.landing}bq(){let e=this.config.privacyMode??"balanced",t=this.config.privacy??{},n=[...this.config.maskSelectors??[],...t.maskSelectors??[]],r=[...this.config.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"])',a=[...n,...i?[o]:[]].join(","),l=r.join(","),u=l?(e,t)=>{try{if(i&&t?.closest(o))return e.replace(/[\S]/g,"*");if(t?.closest(l))return e}catch{}return e.replace(/[\S]/g,"*")}:void 0;return{emit:e=>this.emitEvent("dom",e,e=>this.bj(e)),maskTextSelector:"strict"===e?"*":a||void 0,...u?{maskTextFn:u}:{},blockSelector:t.blockSelectors?.join(",")||void 0,maskInputOptions:s,userTriggeredOnInput:!0}}ba(e){let t=this.o?.mirror;if(void 0===t)return!0;let n=this.aA.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}bc(e){if(!(typeof location>"u"||location.href===this.aj)){if(4===e?.type){this.aj=location.href;return}this.navigated(bn())}}scrubUrl=e=>function(e,t=!1){return e&&p(e,t?Ti:Ai)}(function(e){let[,t,n]=ue(e);if(t)return`${ae(e)}/[REDACTED]`;let r=e.indexOf("#"),i=V(ie(e),J(L(e))),s=U(-1===r?e:e.slice(0,r),i);if(-1!==r){let t=e.slice(r+1).split("#")[0];Cr.test(t)&&(s+=`#${U(t,i)}`)}return null===n?s:ke(s,n)}(e),"strict"===this.config.privacyMode);br(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.config.privacyMode,s=null===t?[]:[...t.plain,...t.bounded];if(2===n.type&&at(r.node,i,s),3===n.type&&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))st(n.node)&&r.push(n.node);r.length>1&&it(r)}}(r.adds);for(let e of r.adds)null!==e&&"object"==typeof e&&at(e.node,i,s)}if(Array.isArray(r.attributes))for(let e of r.attributes){let t=e?.attributes;if(null!==t&&"object"==typeof t){let n=i?this.o?.mirror?.getNode(e.id??-1):null;Qe(t,i,s,n?.localName??"","http://www.w3.org/2000/svg"===n?.namespaceURI)}}if(Array.isArray(r.texts)){let e=this.styles.recordsIn(n);for(let t of r.texts)"string"==typeof t?.value&&(t.value=e.has(t)?rt(t.value,i,s):tt(t.value))}}if(3===n.type&&(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)null!==t&&"string"==typeof t?.rule&&(t.rule=rt(t.rule,i,s));"string"==typeof r.replace&&(r.replace=rt(r.replace,i,s)),"string"==typeof r.replaceSync&&(r.replaceSync=rt(r.replaceSync,i,s))}if(3===n.type&&5===r.source&&"string"==typeof r.text&&(r.text=i?r.text.replace(/\S/g,"*"):tt(r.text)),3===n.type&&9===r.source&&"string"==typeof r.fontSource&&(r.fontSource=rt(r.fontSource,i,s)),3===n.type&&13===r.source){let e=r.set;null!==e&&"string"==typeof e?.value&&(e.value=rt(e.value,i,s))}return e}acceptsNetwork(){return this.a7}emitEvent(e,t,n,r=!1,i,s){if("dom"===e&&"active"===this.phase&&"recording"!==this.getState()&&(this.B=!0),(r?"active"!==this.phase&&"stopping"!==this.phase:!this.a7)||"dom"===e&&this.hidden||!this.onEvent||!this.sessionId)return;this.bc("dom"===e?t:null);let o=n?n(t):t,a="dom"===e&&null!==o&&"object"==typeof o?o.type:void 0;if(this.p&&3===a)return;let l=o;if(typeof location<"u")try{"dom"===e&&(l=this.br(o,gn(location.href))),l=Ne(l,gn(location.href),e,this.styles,no)}catch(t){"dom"===e&&(this.p=!0,this.au(2===a)),t instanceof oi&&this.a4?.(e,t.atLeast,t.cap);return}2===a&&(this.p=!1,null!==this.i&&(clearTimeout(this.i),this.i=null));let u={id:ln(),sessionId:this.sessionId,timestamp:i??Date.now(),type:e,data:l,seq:s};this.onEvent(u)}},Do=class{aO;ap;aQ;aP;constructor(e,t=Date.now()){this.aO=e,this.ap=In(),this.aQ=t;let n=An();this.aP=null===n?[]:[n]}build(){return null===this.ap?{refusal:"no-csprng"}:{identity:{captureId:this.aO,sessionNonce:this.ap,t0WallMs:this.aQ,appOrigins:[...this.aP]}}}},Oo={},No=()=>{},Lo=!1,zo=!1,Uo=class e{static instance=null;static ending=new Set;recorder;network;transport;config;started=!1;h=!1;identity=null;constructor(e){this.config=e,this.recorder=new Ro(e),this.network=new Ys(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.S(),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.aK(),onDropped:(e,t)=>this.recorder.lost(e,t),onDelivered:e=>this.recorder.delivered(e),onFailing:e=>this.recorder.failing(e),beforeUnloadFlush:()=>this.network.cutInflight(),beforeHiddenFlush:()=>this.network.reportDue(!0),beforeOnlineFlush:()=>this.network.reportDue()};this.transport=new io(t)}static async init(t){if(e.instance)return e.instance;let n=Lo;return No(),Lo=!1,e.begin(t,n)}static async begin(t,n,r=!1){let i=new e(t);e.instance=i;try{await i.start(n,r)}catch(t){throw i.stop(),e.instance===i&&(e.instance=null),t}return i}static stop(){No(),Lo=!1;let t=e.instance;e.instance=null;let n=Promise.all(e.ending),r=new Promise(e=>{let t=setTimeout(e,1e4);n.then(()=>{clearTimeout(t),e()})});return t||r.then(()=>{!e.instance&&!zo&&(Ot(!1),Wt())}),Promise.all([t?t.stop():void 0,r]).then(()=>{})}static pause(){e.instance?.pause(),null===e.instance&&zo&&(Lo=!0)}static resume(){e.instance?.resume(),Lo=!1}static getSessionId(){return e.instance?.recorder.getSessionId()??""}static getInstance(){return e.instance}static getCaptureIdentity(){let t=e.instance?.identity;return t?t.build():null}async start(t,n=!1){if(this.started)return;if(this.started=!0,"strict"===this.config.privacyMode&&!1===this.config.privacy?.maskNetworkBodies)return this.ag(new es);let r,i=!1!==this.config.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.ag(new Yi(i),!0);try{Ot(!0,!n);let e=this.recorder.start(e=>this.transport.enqueue(e),()=>!0===this.config.continuous&&void 0===this.config.sessionIdGenerator?this.aK():this.S(),t,(e,t,n)=>this.transport.reportScrubOversized(e,t,n),e=>{null===e?(this.h=!1,this.transport.release()):this.ag(e)},e=>this.transport.reportNavigationUnwrapped(e)),i=this.recorder.getSessionId();if(null!==i){this.identity=new Do(i);let e=this.identity.build();this.h=!0,this.transport.hold(),this.transport.start(i,this.recorder.getMetadata(),"identity"in e?e.identity:null),!1!==this.config.networkCapture&&(this.network.askForCode(),this.network.start((e,t,n)=>{this.recorder.emitEvent("network",e,void 0,!0,t,n)},()=>this.recorder.acceptsNetwork(),()=>this.transport.place(),!0))}r=await e}catch(e){if(e instanceof Ji||e instanceof Qi||e instanceof Gi||e instanceof Xi)return this.ag(e);throw e}r?(this.network.prepare(),this.recorder.awaitingRRWeb()||(this.h=!1,this.transport.release(!1))):(this.started=!1,(e.instance??this)===this&&Ot(!1))}stop(){let t=this.h;return t||this.network.reportDue(),this.recorder.stopDom(),this.network.stop(t),this.started=!1,(t?Promise.resolve():this.network.settle(1e3)).then(()=>{let t=null===e.instance;return Wt(t,()=>null!==e.instance||zo),t&&!zo&&Ot(!1),this.recorder.stop(),this.transport.stop()})}ag(e,t){let n=Oo[e.code];return n||(console[t?"info":"error"](e.message),n=Oo[e.code]=[-1e9,0]),this.S().then(()=>{this.recorder=this.network=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=Oo[e.code]=[r,n[1],...t],setTimeout(Tn,0,n)}else n[0]=-1e9;n.length>=18?t():n.push([e.constructor,e.evidence,this.config.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(Tn,Math.ceil(n[0]-r),n))})}S(){let t=this.stop().catch(()=>{}).finally(()=>e.ending.delete(t));return e.ending.add(t),e.instance===this&&(e.instance=null),t}aK(){let t=e.instance===this,n=this.recorder.isUserPaused();if(this.S(),!t||typeof document>"u")return;No(),Lo=n;let r={...this.config,sampleRate:1},i=()=>{let t=Lo;No(),Lo=!1,null===e.instance&&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=En(()=>{});zo=!0,No=()=>{o(),document.removeEventListener("pointerdown",i,s),document.removeEventListener("keydown",i,s),zo=!1,No=()=>{}}}pause(){this.recorder.pause(),this.network.cutBodies()}resume(){this.recorder.resume()}};export{Yi as CaptureDeclined,Wi as CaptureError,Do as CaptureIdentityBuilder,Qi as DomRecorderRefusal,Vi as IngestRejection,Uo as KeployCapture,Ro as KeployCaptureRecorder,Ys as NetworkInterceptor,es as PrivacyConflict,zi as PrivacyEngine,Xi as PrivacyRouteRefusal,Mi as SDK_ERRORS,Ki as SDK_WARNINGS,Ui as SESSION_ID_MAX_LENGTH,Bi as SESSION_ID_PATTERN,ji as SESSION_ID_RULE,Ji as SessionIdRefusal,Gi as StrictAttributesRefusal,io as Transport,vt as codeForStatus,An as currentOrigin,ct as defaultPrivacyConfig,xt as describeValue,ft as isValidSessionId,In as mintSessionNonce,bt as parseServerError};//# sourceMappingURL=index.bundler.mjs.map