1import{r as e}from"./retry.z6vAG-e.js";import{d as r,u as t}from"./schemas.BARhQst.js";import{t as o}from"./frontendLogger.CVSg6Mj.js";var n=function(e){return e.INFO="info",e.WARN="warn",e.DEBUG="debug",e.ERROR="error",e.TRACE="trace",e}({}),s=function(e){return e.RUNTIME_ERROR="RuntimeError",e.UNHANDLED_REJECTION="UnhandledRejection",e.ZOD_ERROR="ZodError",e.FETCH_ERROR="FetchError",e.XHR_ERROR="XHRError",e}({}),a=class{format(e){const r={type:s.RUNTIME_ERROR,url:e.filename,message:e.message,lineNo:e.lineno,colNo:e.colno,error:e.error&&JSON.stringify(e.error,Object.getOwnPropertyNames(e.error))};return[[n.ERROR,r]]}},i=class{formatZodError(e){const t={type:s.ZOD_ERROR,message:e.message,error:JSON.stringify(e.issues),formated:JSON.stringify(r(e))};return[[n.ERROR,t]]}formatUnspecifiedError(e){const r={type:s.UNHANDLED_REJECTION,name:e?.name,message:e?.message,stack:e?.stack};return[[n.ERROR,r]]}format({reason:e}){return!0==e instanceof t?this.formatZodError(e):this.formatUnspecifiedError(e)}};function c(e){return e.split("; ").reduce((e,r)=>{const[t,o]=r.split("=");return{...e,[t]:o}},{})}var u=class{extractFetchHeaders(e){return[...e.entries()].reduce((e,[r,t])=>({...e,[r]:t}),{})}format(e,r,t){if(r.ok)return[];const o=new Request(e,t),[{headers:a,cookies:i=""},{headers:u,cookies:R=""}]=[{cookieHeader:"Cookie",obj:o},{cookieHeader:"Set-Cookie",obj:r}].map(({cookieHeader:e,obj:r})=>{const t=this.extractFetchHeaders(r.headers);let o;try{const r=t[e]||t[e.toLowerCase()]||void 0;r&&(o=c(r))}catch(n){console.info(`Could not extract cookies from header ${e}`)}return{headers:t,cookies:o}}),d={type:s.FETCH_ERROR,url:o.url,method:o.method,status:r.status,requestHeaders:a,responseHeaders:u,requestCookies:i,responseCookies:R};return[[n.ERROR,d]]}};var R=class{getXHRResponseHeaders(e){const r=e.getAllResponseHeaders();return r?r.split("\r\n").reduce((e,r)=>{const[t,o]=r.split(": ");return{...e,[t]:o}},{}):{}}format(e,r,t){try{if(e.status>=400){const o=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0,a=o?c(o):"",i=this.getXHRResponseHeaders(e),u=t,R={type:s.XHR_ERROR,url:e.responseURL,method:r,status:e.status,requestHeaders:u,responseHeaders:i,responseCookies:a};return[[n.ERROR,R]]}return[]}catch(o){return[]}}};function d(){return{url:location.href}}var p=function(e){return e.BIG_SUCCESS="ok",e.FAILED="fail",e}({}),f=class{loggerConfig;fetchFunction;constructor(e,r){this.loggerConfig=e,this.fetchFunction=r}getHeaders(){const e=new Headers;return e.append("Content-Type","application/json"),e.append("x-api-key",this.loggerConfig.token),e}getUrl(){return new URL("/api/v1/log",this.loggerConfig.server).toString()}log(e,r){return this.fetchFunction(this.getUrl(),{method:"POST",headers:this.getHeaders(),body:JSON.stringify({level:e,...r})}).then(({ok:e})=>e?p.BIG_SUCCESS:p.FAILED).catch(()=>p.FAILED)}};function l(){const r=o.parse(window.loggingServiceConfig),t=new f(r,(r,t)=>e(()=>fetch(r,t),3,3e3)),n=e=>(...r)=>{const o=e.format(...r),n=d();o.map(([e,r])=>t.log(e,{...r,userAgent:navigator.userAgent,...n}))};window.addEventListener("error",n(new a)),window.addEventListener("unhandledrejection",n(new i)),function(e){const r=fetch;window.fetch=async function(...t){const[o,n]=t,s=await r.apply(this,t);return e(o,s,n),s}}(n(new u)),function(e){const r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(...t){const o=this,n=t[0],s={},a=o.setRequestHeader;o.setRequestHeader=function(...e){const[r,t]=e;return s[r]=t,a.apply(o,e)};const i=o.onloadend;return o.onloadend=function(...r){if(e(o,n,s),i)return i.apply(o,r)},r.apply(this,t)}}(n(new R))}export{l as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.