1const o="An error occurred. Please try again later or contact support.",c="Your session has expired. Please sign in again.",l=new Set(["USER_INPUT_ERROR","BAD_USER_INPUT","ILLEGAL_OPERATION"]),g=new Set(["FORBIDDEN","UNAUTHENTICATED"]),p=new Set(["bad request","unauthorized","payment required","forbidden","not found","method not allowed","not acceptable","request timeout","conflict","gone","unprocessable entity","too many requests","internal server error","not implemented","bad gateway","service unavailable","gateway timeout","gateway time-out","unknown error","error"]),m=[/^\[[A-Z]+\]\s+"/,/\bfetch failed\b/i,/failed to fetch/i,/networkerror/i,/network request failed/i,/\bload failed\b/i,/\b(?:ECONN[A-Z]*|ENOTFOUND|ETIMEDOUT|EAI_AGAIN|EPIPE|ERR_[A-Z_]+)\b/,/\b(?:internal server error|bad gateway|service unavailable|gateway time-?out)\b/i,/\b(?:cannot read propert|is not a function|is not defined|is not iterable|of undefined|of null)\b/i,/\b(?:TypeError|ReferenceError|RangeError|SyntaxError|EvalError|URIError)\b/,/\bunexpected (?:token|end of (?:json|input))\b/i,/\bJSON\b/,/\bGraphQL\b/i,/\bstatus ?code\b/i,/\b(?:stack ?trace|at [\w$.<>]+ \()/i,/<\/?[a-z!][^>]*>/i,/https?:\/\//i,/\/(?:api|bff|vendure|shop-api|admin-api)\b/i,/\bnull\b|\bundefined\b/],d=/not (?:currently )?authori[sz]ed/i;function f(r){const e=r.trim();return!e||p.has(e.toLowerCase())?!0:m.some(n=>n.test(e))}function i(r){console.warn("[error] hidden from the customer:",r)}function S(r){return Array.isArray(r)&&r.length>0&&r.every(e=>e&&typeof e=="object"&&("message"in e||"extensions"in e))}function R(r){if(r==null)return o;if(typeof r=="string")return f(r)?(i(r),o):r;const e=r,n=typeof e.message=="string"?e.message:"";if(S(e.data)){const s=e.data.map(t=>{var E;return String(((E=t.extensions)==null?void 0:E.code)??"").toUpperCase()});if(s.some(t=>g.has(t)))return c;const a=e.data.filter((t,E)=>l.has(s[E])&&typeof t.message=="string").map(t=>String(t.message).trim()).filter(t=>t&&!f(t));return a.length>0?a.join(" "):e.data.some(t=>d.test(String(t.message??"")))?c:(i(r),o)}const u=Number(e.statusCode??e.status??NaN);if(Number.isFinite(u)||e.response!==void 0||e.request!==void 0){if(u===401)return c;if(u>=400&&u<500){const s=e.data&&typeof e.data=="object"?e.data:{},a=[s.message,s.statusMessage,e.statusMessage].filter(t=>typeof t=="string").map(t=>t.trim()).filter(t=>t&&!f(t));if(a.length>0)return a[0]}return i(r),o}const b=typeof e.name=="string"?e.name:"";return/^(?:TypeError|ReferenceError|RangeError|SyntaxError|EvalError|URIError|DOMException|MediaError|AbortError)$/.test(b)?(i(r),o):d.test(n)?c:n&&!f(n)?n:(n&&i(r),o)}export{R as u};
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.