import{n as e}from"./shop-CbXpYlKn.js";import{t}from"./init-vTxIv4PY.js";var n=async(e={})=>{let n={};e.accountId&&(n.account_id=e.accountId),e.spcCds&&(n.SPC_CDS=e.spcCds);try{let e=await t.get(`/api/selleraccount/subaccount/get/`,{params:n});return e&&!e.code?e:null}catch{return null}},r=async()=>{try{let e=await t.get(`/api/forward/accountservice/v2/shop/`);return e.shop_id?e:null}catch{return null}},i=async()=>{try{let e=await t.get(`/api/selleraccount/shop_info/`);return e.data&&e.data.shop_id?e.data:null}catch{return null}},a=async()=>{try{let e=await t.get(`/api/framework/selleraccount/shop_info/`);return e.data&&e.data.shop_id?e.data:null}catch{return null}},o=async(e=``)=>{try{let n={};return e&&(n.SPC_CDS=e),await t.get(`/api/v2/login/`,{params:n})}catch{return null}},s=async()=>{if(typeof window<`u`&&window?.location?.href?.includes(`shopee.vn`)){let t=await e();if(t&&t.shopid)return{shopId:t.shopid,username:t.username,shopName:t.username,isPrimary:!0,isSubAccount:!1}}let t=await r();if(t&&t.shop_id)return{shopId:t.shop_id,username:t.username,shopName:t.shop_name,isPrimary:!0,isSubAccount:!1};let s=await o();if(s&&s.shopid)return{shopId:s.shopid,username:s.username,shopName:s.username,isPrimary:!1,isSubAccount:!1};let c=await i();if(c&&c.shop_id)return{shopId:c.shop_id,username:c.shop_id.toString(),shopName:c.name,isPrimary:!1,isSubAccount:!0};let l=await a();if(l&&l.shop_id)return{shopId:l.shop_id,username:l.shop_id.toString(),shopName:l.name,isPrimary:!1,isSubAccount:!0};let u=await n();if(u&&u.sub_account_id)return{shopId:u.sub_account_id,username:u.username,shopName:u.shop_name,isPrimary:!1,isSubAccount:!0};throw Error(`Get seller info failed`)};export{r as n,o as r,s as t};