import{t as e}from"./api-Bo-YILWU.js";var t=`/shop-manager/shopee-video`,n=async n=>{try{return(await e.post(`${t}/campaign/list`,{shopId:`${n}`})).data||[]}catch{return[]}},r=async n=>{try{return(await e.post(`${t}/campaign/stats`,{shopId:`${n}`})).data||{campaigns:0,items:0,done:0,error:0,pending:0}}catch{return{campaigns:0,items:0,done:0,error:0,pending:0}}},i=async n=>{try{return(await e.post(`${t}/campaign/create`,{name:n.name,shopId:`${n.shopId}`,shopName:n.shopName||``})).data||null}catch{return null}},a=async n=>{try{return(await e.post(`${t}/item/list`,{campaignId:n})).data||[]}catch{return[]}},o=async(n,r)=>{try{return(await e.post(`${t}/item/bulk-create`,{campaignId:n,items:r})).data||[]}catch{return[]}},s=async(n,r)=>{try{return(await e.post(`${t}/item/update`,{itemId:n,patch:r})).data||null}catch{return null}},c=async(n,r)=>{try{return(await e.post(`${t}/campaign/update`,{campaignId:n,patch:r})).data||null}catch{return null}},l=async n=>{try{let r=await e.post(`${t}/campaign/remove`,{campaignId:n});return!!(r&&r.data&&r.data.removed)}catch{return!1}},u=async n=>{try{let r=await e.post(`${t}/item/remove`,{itemId:n});return!!(r&&r.data&&r.data.removed)}catch{return!1}},d=async n=>{try{return(await e.post(`${t}/library/presign`,{fileName:n.fileName,contentType:n.contentType})).data||null}catch{return null}},f=async(e,t)=>{let n=e.type||`video/mp4`,r=await d({fileName:t,contentType:n});if(!(r&&r.uploadUrl&&r.publicUrl))return``;try{return(await fetch(r.uploadUrl,{method:`PUT`,body:e,headers:{"Content-Type":n}})).ok?r.publicUrl:``}catch{return``}};export{c as a,u as c,r as i,s as l,n,o,l as r,a as s,i as t,f as u};