import{d as p}from"./index-GzDS9i1d.js";import{r as c,X as d}from"./element-plus-B_5dJQ4L.js";import{s as a}from"./http-yKPN8Mxt.js";const w=p("user",()=>{const t=c(""),o=c(!1),r=n=>{t.value=n,o.value=!0;const h=Date.now()+31536e3*1e3;localStorage.setItem("token",n),localStorage.setItem("tokenExpiry",h.toString())},e=n=>{localStorage.setItem("mobilePhone",n)},i=()=>{localStorage.removeItem("mobilePhone")},s=()=>{try{t.value="",o.value=!1,localStorage.removeItem("token"),localStorage.removeItem("tokenExpiry")}catch(n){console.error("Error clearing token from localStorage:",n)}},l=()=>{try{const n=localStorage.getItem("tokenExpiry");return n?Date.now()>parseInt(n,10):!0}catch(n){return console.error("Error checking token expiry:",n),!0}},m=n=>{localStorage.setItem("Identity",n)},u=()=>{localStorage.removeItem("Identity")};return d(()=>{try{const n=localStorage.getItem("token");n&&!l()?(t.value=n,o.value=!0):s()}catch(n){console.error("Error retrieving token from localStorage:",n)}}),{token:t,isLoggedIn:o,setToken:r,clearToken:s,setMobilePhone:e,removeMobilePhone:i,setIdentity:m,removeIdentity:u}});function y(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/account/login/doMerchSmsRegisterAndLogin",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function v(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/account/login/sendVerifyCode",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function S(){return new Promise((t,o)=>{a({url:"/api/mobile/shop/store/biz-category/list",method:"post"}).then(r=>{t(r)}).catch(r=>o(console.warn(r)))})}function k(t){return t.map(o=>({value:o.id,label:o.category_name,children:o.children?[{value:o.id,label:`${o.category_name} 分割比率(${o.split_ratio}%)`},...o.children.map(r=>({value:r.id,label:`${r.category_name} 分割比率(${r.split_ratio}%)`}))]:[]}))}function I(t){return t.isFilter=!0,new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/baidu/place/v2/suggestion",method:"get",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function P(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/lakala/tk/bank/search",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function G(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/apply",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function x(){const t={mobile:localStorage.getItem("mobilePhone")};return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/fresh/approval/status",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function E(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/re-apply",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function A(t){return new Promise((o,r)=>{a({url:"/api/mobile/shop/merch/detail",method:"post",data:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function _(t){return new Promise((o,r)=>{a({url:"/api/admin/account/account-user-base/doLogin",method:"post",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function T(t){return new Promise((o,r)=>{a({url:"/api/admin/shop/shop-base-config/image",method:"GET",params:t}).then(e=>{o(e)}).catch(e=>r(console.warn(e)))})}function C(){return new Promise((t,o)=>{a({url:"/api/mobile/shop/shop-base-district/getAppDistrict",method:"get"}).then(r=>{t(r)}).catch(r=>o(console.warn(r)))})}export{S as G,C as a,P as b,I as c,A as d,_ as e,T as f,y as g,x as h,v as i,G as m,E as r,k as t,w as u};