import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Mi as t,Pi as n}from"./control-ui-foundation-CeFMP1Ly.js";async function r(e,r){try{let t=r?.signal?await e.request(`usage.status`,void 0,{signal:r.signal}):await e.request(`usage.status`);return n(t)}catch(e){if(r?.signal?.aborted)throw e;return t({kind:`request-failed`})}}function i(){return(i=e((()=>{})))()}function a(e){let t=-e,n=t>=0?`+`:`-`,r=Math.abs(t),i=Math.floor(r/60),a=r%60;return a===0?`UTC${n}${i}`:`UTC${n}${i}:${a.toString().padStart(2,`0`)}`}function o(e){return e===`utc`?{mode:`utc`}:{mode:`specific`,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,utcOffset:a(new Date().getTimezoneOffset())}}function s(e,t){return{startDate:e.startDate,endDate:e.endDate,...e.agentId?{agentId:e.agentId}:t?{}:{agentScope:`all`},...o(e.timeZone),groupBy:e.scope,...t?{key:t,limit:1}:{limit:1e3},includeContextWeight:!1}}function c(e,t,n){let r={...s(t,n?.key),includeContextWeight:n?.includeContextWeight===!0};return n?.signal?e.request(`sessions.usage`,r,{signal:n.signal}):e.request(`sessions.usage`,r)}async function l(e,t,n,r){return(await c(e,t,{key:n,includeContextWeight:!0,signal:r})).sessions[0]?.contextWeight}function u(e,t){return e.request(`sessions.usage.timeseries`,{key:t}).then(e=>e??null)}function d(e,t){return e.request(`sessions.usage.logs`,{key:t,limit:1e3})}function f(){return(f=e((()=>{})))()}export{d as a,r as c,l as i,f as n,u as o,c as r,i as s,o as t};
//# sourceMappingURL=usage-ClT4QiBm.js.map