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=` `);const r=document.querySelector("#auth-link"),L=w(),f='';function m(e){r&&(e?(r.classList.add("is-authenticated"),r.setAttribute("aria-label","我的 X19ART"),r.setAttribute("title","我的 X19ART"),r.innerHTML=`${f}我的 X19ART`):(r.classList.remove("is-authenticated"),r.setAttribute("aria-label","登录"),r.setAttribute("title","登录"),r.innerHTML=`${f}登录`))}m(L);S().then(m);const y=document.querySelector("#site-footer");y&&(y.innerHTML=` `);const i="",b=/^[\w.+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i.test(i);if(b){for(const e of document.querySelectorAll("[data-site-contact]"))e.href="mailto:"+i,e.textContent=i,e.hidden=!1;document.querySelector("[data-site-contact-pending]")?.remove()}const v=document.querySelector("[data-privacy-preview]");if(v){const e={operator:void 0,retention:void 0,providers:void 0};for(const a of document.querySelectorAll("[data-privacy-field]")){const t=e[a.dataset.privacyField];t&&(a.textContent=t)}v.hidden=b&&Object.values(e).every(Boolean)}const s=document.createElement("div");s.className="search-overlay";s.innerHTML=` `;document.body.append(s);const R=document.querySelector(".search-trigger"),q=s.querySelector(".search-close"),u=s.querySelector("input"),$=s.querySelector(".search-results"),E=()=>{s.classList.add("is-open"),document.body.classList.add("has-modal"),window.setTimeout(()=>u.focus(),100)},h=()=>{s.classList.remove("is-open"),document.body.classList.remove("has-modal")};R?.addEventListener("click",E);q.addEventListener("click",h);s.addEventListener("click",e=>{e.target===s&&h()});document.addEventListener("keydown",e=>{e.key==="Escape"&&h()});u.addEventListener("input",()=>{const e=u.value.trim().toLowerCase(),a=A.filter(t=>`${t.title} ${t.type}`.toLowerCase().includes(e));$.innerHTML=e&&a.length?a.map(t=>`${t.type}${t.title}↗`).join(""):e?'

没有找到匹配内容,换个词试试。

':'

搜索作品、工具文档或教程。

'});export{X as a,x as b,I as c,S as h,U as l,C as r};