1import{c as d}from"./BCe0dVLk.js";import{aA as C}from"./Dvx63mQ5.js";import"./wi1W1bep.js";import"./B0XwC4Ot.js";const w=location.origin;function A(n){const o=n.headers.get("X-CSRF-Token");o&&localStorage.setItem("csrfToken",o)}function T(){return localStorage.getItem("csrfToken")}function k(){async function n({endpoint:o,method:r,data:e={},v2:s=!1,signal:h,rawResponse:u}){const y=w+`/api${s?"/v2":""}/console`;o.startsWith("/")||(o="/"+o);let g=y+o;r==="get"&&(g+="?"+m(e));const c={};e instanceof FormData||(c["Content-Type"]="application/json");const l=T();if(l&&(c["X-CSRF-Token"]=l),o.startsWith("/organization")){const t=C(d);t&&(c["X-Organization-ID"]=String(t.organization.id))}const p={cache:"no-cache",credentials:"same-origin",method:r.toUpperCase(),headers:c,signal:h};r!=="get"&&(p.body=e instanceof FormData?e:JSON.stringify(e));const a=await fetch(g,p);if(!a.ok){let t;try{t=await a.json()}catch{t={}}const f=t&&t.message?t.message:"Something went wrong",i=new Error(f);throw i.message=f,i.code=t&&t.code?t.code:500,i.data=t&&t.data?t.data:{},f==="org_mismatch"?(location.href="/account",new Error("Current organization changed, redirecting...")):i}return A(a),u?a:await a.json()}return{call:n,get:async o=>n({...o,method:"get"}),post:async o=>n({...o,method:"post"}),patch:async o=>n({...o,method:"patch"}),delete:async o=>n({...o,method:"delete"})}}function m(n){const o=[];for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const e=n[r];if(e==null)continue;if(typeof e=="object"&&e!==null&&!Array.isArray(e))o.push(m(e));else if(Array.isArray(e))for(let s=0;s<e.length;s++)o.push(`${encodeURIComponent(r)}[]=${encodeURIComponent(e[s])}`);else o.push(`${encodeURIComponent(r)}=${encodeURIComponent(e)}`)}return o.join("&")}const z=k();export{w as A,z as c};
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.