import{a as s}from"./chunk-CP4WO7MM.mjs";import{a as u}from"./chunk-IHX4EDUF.mjs";async function D(r,t,i={}){let{timeout:p=5e3,maxRetries:e=10,retryDelay:f=1e3}=i;for(let n=0;n<e;n++)try{let m=new AbortController,a=setTimeout(()=>{m.abort()},p),o=await fetch(r,{...t,signal:m.signal});if(clearTimeout(a),o.ok)return o;if(o.status===429||o.status>=500){let x=f+Math.pow(n,2)*50;await new Promise(c=>setTimeout(c,x));continue}if(o.status===403)throw new Error("Unauthorized");if(!o.ok){let x=await o.json().catch(()=>({error:"Unknown error"}));throw new Error(x.error||`HTTP error ${o.status}`)}}catch(m){if(n===e-1)throw m;let a=f+Math.pow(n,2)*50;await new Promise(o=>setTimeout(o,a))}throw new Error(`Failed after ${e} retries`)}function U({domain:r,key:t,pretty:i,searchParams:p}){if(!r)return"";let e=`https://${u(r)}${t&&t!=="_root"?`/${u(t)}`:""}`;if(p){let f=new URLSearchParams;for(let[n,m]of Object.entries(p))f.set(n,m);e+=`?${f.toString()}`}return i?e.replace(/^https?:\/\//,""):e}function k({domain:r,key:t}){return`https://${r}${t==="_root"?"":`/${t}`}`}var dr=r=>!r.periodStart||!r.periodEnd?"-":`${s(r.periodStart,{month:"short",year:new Date(r.periodStart).getUTCFullYear()===new Date(r.periodEnd).getUTCFullYear()?void 0:"numeric",timeZone:"utc"})}-${s(r.periodEnd,{month:"short",timeZone:"utc"})}`;export{dr as a,D as b,U as c,k as d};
