const c="x19.auth.user";function w(){try{const e=window.localStorage.getItem(c);return e?JSON.parse(e):null}catch{return null}}function n(e){return e?window.localStorage.setItem(c,JSON.stringify(e)):window.localStorage.removeItem(c),e}async function d(e,a){const t=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(a)}),o=await t.json();if(!t.ok)throw new Error(o.error||"Authentication service is unavailable.");return o}async function g(e,a){const t=await d(e,a);return n(t.user)}function U(e,a){return g("/api/auth/login",{identity:e,password:a})}function X(e,a,t,o){return g("/api/auth/register",{email:e,password:a,name:t,username:o})}function C(e){return d("/api/auth/password-reset/request",{email:e})}function I(e,a){return d("/api/auth/password-reset/confirm",{token:e,password:a})}async function S(){try{const e=await fetch("/api/auth/me",{credentials:"include"});if(!e.ok)return n(null),null;const a=await e.json();return n(a.user)}catch{return n(null),null}}async function x(){try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}finally{n(null)}}const k=[{key:"home",label:"首页",english:"Home",href:"/"},{key:"tutorials",label:"教程",english:"Tutorials",href:"/tutorials/"},{key:"docs",label:"文档",english:"Docs",href:"/docs/"},{key:"ue5",label:"UE5",english:"Unreal",href:"/ue5/"},{key:"events",label:"参考",english:"Labs",href:"/events/"},{key:"cases",label:"案例",english:"Cases",href:"/cases/"},{key:"about",label:"关于",english:"About",href:"/about/"}],A=[{title:"从零开始做一个 p5.js 粒子场",type:"视频教程",href:"/tutorials/video/#particle-field"},{title:"建筑室内:从透视线到会呼吸的空间",type:"文档教程",href:"/tutorials/document/#room-study"},{title:"X19 视觉实验 API",type:"文档",href:"/docs/#visual-api"},{title:"城市在浏览器里生长",type:"案例",href:"/cases/#city-grows"},{title:"UE5 室内实时可视化工作流",type:"UE5",href:"/ue5/"},{title:"界面与动效参考样稿",type:"参考",href:"/events/"},{title:"关于 X19ART",type:"关于",href:"/about/"}],l=(document.body.dataset.page||"home").split(" ")[0],T=l==="case-detail"?"cases":l,p=document.querySelector("#site-header");p&&(p.innerHTML=`
搜索作品、工具文档或教程。
没有找到匹配内容,换个词试试。
':'搜索作品、工具文档或教程。
'});export{X as a,x as b,I as c,S as h,U as l,C as r};