import{d as C,as as l,m as M,r as F,E as L}from"./vendor-D8NNcBCx.js";import{g as f,s as $,c4 as q,c5 as x,c6 as S,c7 as D,L as c,c8 as g}from"./index-ID5VX6TZ.js";async function R(){const{storeId:o,userId:t,cultureName:d,currencyCode:n}=f,{data:a}=await $.query({query:q,variables:{storeId:o,userId:t,cultureName:d,currencyCode:n}});return a?.getSavedForLater}function k(){const{storeId:o,currencyCode:t,cultureName:d,userId:n}=f,a=F(),{mutate:y,loading:h}=l(x),{add:w,overflowed:_,loading:p}=S(y);async function u(r,s){try{const e=await w({command:{storeId:o,userId:n,cultureName:d,currencyCode:t,cartId:r,lineItemIds:s}});a.value=e?.data?.moveToSavedForLater?.list}catch(e){if(e instanceof L&&e.networkError?.toString()===g.Explicit)return;c.error(`useSavedForLater.${u.name}`,e)}}const{mutate:I,loading:T}=l(D),{add:E,overflowed:B,loading:b}=S(I);async function m(r,s){try{const e=await E({command:{storeId:o,userId:n,cultureName:d,currencyCode:t,cartId:r,lineItemIds:s}});a.value=e?.data?.moveFromSavedForLater?.list}catch(e){if(e instanceof L&&e.networkError?.toString()===g.Explicit)return;c.error(`useSavedForLater.${m.name}`,e)}}const v=F(!1);async function i(){try{v.value=!0,a.value=await R()}catch(r){c.error(`useSavedForLater.${i.name}`,r)}finally{v.value=!1}}return{savedForLaterList:a,moveToSavedForLater:u,moveToSavedForLaterOverflowed:_,moveFromSavedForLater:m,moveFromSavedForLaterOverflowed:B,getSavedForLater:i,loading:M(()=>h.value||p.value||T.value||b.value||v.value)}}const O=C(k);export{O as u};
//# sourceMappingURL=useSaveForLater-DWQgy-P3.js.map
