import{i as e}from"./chunk-B3pr0VN8.js";import{n as t,t as n}from"./jsx-runtime-wTfS3W87.js";import{d as r,i,o as a,u as o}from"./chunk-6CSD65Y2-Dj7xjS5D.js";import{r as s}from"./authSession-CrP9lMPq.js";import{t as c}from"./menu-i-Q_PERc.js";import{t as l}from"./x-BDqDXavd.js";import{t as u}from"./SiteHeader-CPWey4U9.js";var d=e(t(),1),f=[{section:`个人`,items:[{path:`/me/profile`,title:`个人资料`}]},{section:`按量付费`,items:[{path:`/me/wallet`,title:`账户钱包`},{path:`/me/recharge`,title:`充值记录`},{path:`/me/api-usage`,title:`API 用量`},{path:`/me/api-keys`,title:`请求管理`},{path:`/me/resource-packs`,title:`资源包`},{path:`/me/invoices`,title:`发票管理`}]},{section:`订阅付费`,items:[{path:`/me/plan`,title:`套餐详情`},{path:`/me/plan-usage`,title:`套餐用量`}]},{section:`文档与历史`,items:[{path:`/me/favorites`,title:`岗位收藏`},{path:`/me/resume-web`,title:`网页简历`},{path:`/me/reports`,title:`报告`}]},{section:`设置`,items:[{path:`/me/password`,title:`修改密码`},{path:`/me/notifications`,title:`通知`},{path:`/me/integrations`,title:`飞书/钉钉`}]}],p=n(),m=()=>{let e=o(),t=r(),[n,m]=(0,d.useState)(!1),[h,g]=(0,d.useState)(null),[_,v]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{let n=!0;return(async()=>{let r=await s();if(n){if(!r?.token){t(`/auth`,{replace:!0,state:{returnTo:e.pathname+e.search}});return}g(r),v(!0)}})(),()=>{n=!1}},[]),(0,d.useEffect)(()=>{m(!1)},[e.pathname,e.hash]),_?(0,p.jsxs)(`div`,{className:`me-shell`,children:[(0,p.jsx)(u,{variant:`cream`,hideCta:!0}),(0,p.jsxs)(`div`,{className:`me-body`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`me-sidebar-toggle`,onClick:()=>m(e=>!e),"aria-label":`切换导航`,children:[n?(0,p.jsx)(l,{size:16,strokeWidth:1.8}):(0,p.jsx)(c,{size:16,strokeWidth:1.8}),`导航`]}),(0,p.jsxs)(`aside`,{className:`me-sidebar${n?` me-sidebar-open`:``}`,children:[(0,p.jsxs)(`div`,{className:`me-sidebar-head`,children:[(0,p.jsx)(`span`,{className:`me-sidebar-title`,children:`用户中心`}),(0,p.jsx)(`span`,{className:`me-sidebar-sub`,children:`账号、额度与个人数据`})]}),(0,p.jsx)(`nav`,{className:`me-nav`,"aria-label":`用户中心导航`,children:f.map(e=>(0,p.jsxs)(`div`,{className:`me-nav-section`,children:[(0,p.jsx)(`p`,{className:`me-nav-group-title`,children:e.section}),(0,p.jsx)(`ul`,{className:`me-nav-list`,children:e.items.map(e=>(0,p.jsx)(`li`,{children:(0,p.jsx)(i,{to:e.path,className:({isActive:e})=>`me-nav-link${e?` me-nav-link-active`:``}`,children:e.title})},e.path))})]},e.section))})]}),n?(0,p.jsx)(`div`,{className:`me-overlay`,onClick:()=>m(!1),"aria-hidden":`true`}):null,(0,p.jsx)(`main`,{className:`me-content`,children:(0,p.jsx)(a,{context:{sess:h,setSess:g}})})]})]}):(0,p.jsx)(`div`,{className:`me-loading`,children:`加载中…`})};export{m as MeLayout,m as default};