import{h as E}from"./index.DvDH6DOc.js";import{A as F,at as r,E as O,aG as $}from"./entry.DV6a5_Hb.js";import{u as x}from"./asyncData.StC_7AGX.js";function q(a,c,i){const[t={},u]=typeof c=="string"?[{},c]:[c,i],e=F(()=>{let n=a;return typeof n=="function"&&(n=n()),r(n)}),o=t.key||E([u,typeof e.value=="string"?e.value:"",...A(t)]);if(!o||typeof o!="string")throw new TypeError("[nuxt] [useFetch] key must be a string: "+o);if(!a)throw new Error("[nuxt] [useFetch] request is missing.");const f=o===u?"$f"+o:o;if(!t.baseURL&&typeof e.value=="string"&&e.value[0]==="/"&&e.value[1]==="/")throw new Error('[nuxt] [useFetch] the request URL must not start with "//".');const{server:m,lazy:y,default:b,transform:d,pick:g,watch:h,immediate:w,getCachedData:v,deep:_,...k}=t,p=O({...$,...k,cache:typeof t.cache=="boolean"?void 0:t.cache}),D={server:m,lazy:y,default:b,transform:d,pick:g,immediate:w,getCachedData:v,deep:_,watch:h===!1?[]:[p,e,...h||[]]};let s;return x(f,()=>{var l;(l=s==null?void 0:s.abort)==null||l.call(s),s=typeof AbortController<"u"?new AbortController:{};const n=r(t.timeout);return n&&setTimeout(()=>s.abort(),n),(t.$fetch||globalThis.$fetch)(e.value,{signal:s.signal,...p})},D)}function A(a){var i;const c=[((i=r(a.method))==null?void 0:i.toUpperCase())||"GET",r(a.baseURL)];for(const t of[a.params||a.query]){const u=r(t);if(!u)continue;const e={};for(const[o,f]of Object.entries(u))e[r(o)]=r(f);c.push(e)}return c}export{q as u};