1import{s as e}from"./C_sqNbxw.js";import{r as t}from"./BGcio49n.js";import{t as n}from"./BCPJH2Vc.js";import{t as r}from"./DCwfypGc.js";import{n as i}from"./DNLmiEgi.js";import{t as a}from"./CGKP0RqB.js";import{t as o}from"./fOh9oLUB.js";function s(){let s=e(),c=n();async function l(e={}){let n=new URLSearchParams;e.type&&n.set(`type`,e.type),e.active!==void 0&&n.set(`active`,e.active?`1`:`0`),e.parent_id!==void 0&&n.set(`parent_id`,String(e.parent_id));let i=n.toString(),o=`/api/v1/categories${i?`?${i}`:``}`,{url:l,headers:u}=a(s,o,`/_core/categories${i?`?${i}`:``}`,c.accessToken.value);try{let e=await t(l,{method:`GET`,timeout:r,headers:u});return Array.isArray(e.data)?e.data:[]}catch{return[]}}async function u(e,n={}){let i=new URLSearchParams;e&&i.set(`type`,e),n.active===!0&&i.set(`active`,`1`),n.active===!1&&i.set(`active`,`0`),n.exclude?.length&&i.set(`exclude`,n.exclude.filter(e=>e.trim()).join(`,`)),n.compact&&i.set(`compact`,`1`),n.includeCounts===!1&&i.set(`include_counts`,`0`);let o=i.toString(),l=`/api/v1/categories/tree${o?`?${o}`:``}`,{url:u,headers:d}=a(s,l,`/_core/categories/tree${o?`?${o}`:``}`,n.authenticated===!1?null:c.accessToken.value);try{let e=await t(u,{method:`GET`,timeout:r,headers:d});return Array.isArray(e.data)?e.data:[]}catch{return[]}}async function d(e,n){let r=new URLSearchParams;n&&r.set(`type`,n);let l=r.toString(),u=encodeURIComponent(e),d=`/api/v1/categories/${u}${l?`?${l}`:``}`,{url:f,headers:p}=a(s,d,`/_core/categories/${u}${l?`?${l}`:``}`,c.accessToken.value);return await o(async()=>{try{return(await t(f,{method:`GET`,timeout:12e3,headers:p})).data??null}catch(e){if(i(e)===404)return null;throw e}},{maxAttempts:3})}return{getCategories:l,getCategoriesTree:u,getCategory:d}}export{s as t};
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.