luckytri 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/luckytri.js +5 -1
- package/docs/en/CHANGELOG.md +20 -0
- package/docs/en/guide.md +8 -0
- package/docs/en/her-life.md +2 -0
- package/docs/en/webui.md +4 -0
- package/docs/zh/CHANGELOG.md +20 -0
- package/docs/zh/guide.md +9 -1
- package/docs/zh/her-life.md +4 -2
- package/docs/zh/webui.md +4 -0
- package/package.json +111 -110
- package/public/app/assets/ChatsPage-CshdtTzV.js +3 -0
- package/public/app/assets/{Empty-DP6WMGHi.js → Empty-C7yzOBzy.js} +1 -1
- package/public/app/assets/{Field-CtbdqaiB.js → Field-BjFv4Rfn.js} +1 -1
- package/public/app/assets/HeartPage-eqo6ru16.js +1 -0
- package/public/app/assets/LifePage-CN8GE5NK.js +1 -0
- package/public/app/assets/MemoryPage-CCpMN4Wg.js +1 -0
- package/public/app/assets/NaturePage-C0JqdBTR.js +3 -0
- package/public/app/assets/{NaturePage-CTXHCE2D.css → NaturePage-CHkpb5NK.css} +1 -1
- package/public/app/assets/PeoplePage-BTU0H1pM.css +1 -0
- package/public/app/assets/PeoplePage-BXGBbO4u.js +1 -0
- package/public/app/assets/{PluginsPage-DksEZbUU.js → PluginsPage-Dksp5AV5.js} +1 -1
- package/public/app/assets/{SystemPage-BkRu0Rvx.css → SystemPage-BenIyTvk.css} +1 -1
- package/public/app/assets/SystemPage-Cd7aa8eE.js +1 -0
- package/public/app/assets/TimePage-Bs_zImb4.js +3 -0
- package/public/app/assets/{index-DY4e15Kh.css → index-BHZcHUMh.css} +1 -1
- package/public/app/assets/index-CyRtYxP3.js +4 -0
- package/public/app/assets/{knowledge-C6_HvoyB.js → knowledge-BJOIyuJo.js} +1 -1
- package/public/app/assets/{media-SMfTT-yc.js → media-Bwtx8blz.js} +1 -1
- package/public/app/assets/mind-DtTVrW6Z.js +1 -0
- package/public/app/index.html +4 -4
- package/public/guide.en.html +32 -3
- package/public/guide.html +19 -4
- package/public/tutorial.en.md +8 -0
- package/public/tutorial.md +9 -1
- package/scripts/launch.js +11 -4
- package/scripts/service.js +57 -7
- package/scripts/start-server.js +4 -1
- package/scripts/update-instance.js +201 -0
- package/server/app.js +3 -0
- package/server/core/context-builder.js +2 -2
- package/server/core/context-compactor.js +2 -2
- package/server/core/orchestrator.js +1 -0
- package/server/core/persona-manager.js +30 -5
- package/server/core/reply-delivery.js +10 -0
- package/server/core/response-validator.js +20 -0
- package/server/i18n/errors.js +38 -2
- package/server/index.js +45 -2
- package/server/mind/api.js +26 -0
- package/server/mind/bonds.js +9 -2
- package/server/mind/faces.js +257 -22
- package/server/mind/index.js +2 -0
- package/server/mind/initiative.js +6 -1
- package/server/mind/life/context.js +23 -9
- package/server/mind/life/growth.js +5 -3
- package/server/mind/nature.js +100 -4
- package/server/mind/relationships.js +279 -0
- package/server/mind/schema.js +5 -0
- package/server/mind/time/tasks.js +2 -1
- package/server/mind/view.js +5 -0
- package/server/runtime/installation.js +116 -0
- package/server/runtime/update-execution.js +127 -0
- package/server/runtime/update-manager.js +140 -0
- package/server/startup-lock.js +12 -12
- package/server/storage/archive.js +10 -2
- package/server/storage/backup-lock.js +23 -5
- package/server/storage/data-transfer.js +2 -1
- package/server/studio/display-names.js +1 -0
- package/server/studio/settings.js +1 -0
- package/server/studio/updates.js +144 -0
- package/public/app/assets/ChatsPage-BhlJHseG.js +0 -3
- package/public/app/assets/HeartPage-32BeTPn2.js +0 -1
- package/public/app/assets/LifePage-CxSm0XKI.js +0 -1
- package/public/app/assets/MemoryPage-BeKBcPCY.js +0 -1
- package/public/app/assets/NaturePage-NEPYl2HS.js +0 -3
- package/public/app/assets/PeoplePage-BmUxkrOU.css +0 -1
- package/public/app/assets/PeoplePage-DxtpekwM.js +0 -1
- package/public/app/assets/SystemPage-BvzJlHuY.js +0 -1
- package/public/app/assets/TimePage-7-awH5XL.js +0 -3
- package/public/app/assets/formatters-ZmW_xFHw.js +0 -1
- package/public/app/assets/index-4rItIkD-.js +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatsPage-CshdtTzV.js","assets/Empty-C7yzOBzy.js","assets/Empty-DmUB2-Bk.css","assets/mind-DtTVrW6Z.js","assets/media-Bwtx8blz.js","assets/Field-BjFv4Rfn.js","assets/ChatsPage-DfyPCS9N.css","assets/HeartPage-eqo6ru16.js","assets/HeartPage-Bft9wZp5.css","assets/PeoplePage-BXGBbO4u.js","assets/knowledge-BJOIyuJo.js","assets/PeoplePage-BTU0H1pM.css","assets/LifePage-CN8GE5NK.js","assets/LifePage-BUi5euBF.css","assets/TimePage-Bs_zImb4.js","assets/TimePage-BOms_n4I.css","assets/MemoryPage-CCpMN4Wg.js","assets/MemoryPage-cZvXfkXb.css","assets/NaturePage-C0JqdBTR.js","assets/NaturePage-CHkpb5NK.css","assets/SystemPage-Cd7aa8eE.js","assets/SystemPage-BenIyTvk.css","assets/PluginsPage-Dksp5AV5.js","assets/PluginsPage-CVVQwEBI.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,A as t,B as n,C as r,Ct as i,Et as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,St as ee,T as te,Tt as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as ne,_t as D,a as O,at as re,bt as k,c as A,ct as j,d as ie,dt as M,et as N,ft as P,g as ae,gt as F,h as oe,ht as se,i as I,it as ce,j as L,k as le,l as ue,lt as de,m as fe,mt as pe,n as R,nt as z,ot as me,pt as he,q as B,r as ge,rt as _e,s as V,st as ve,t as ye,tt as be,u as xe,ut as H,v as U,vt as W,wt as G,x as Se,xt as K,y as q,yt as Ce}from"./Empty-C7yzOBzy.js";import{g as we,i as Te,m as Ee,n as De,p as Oe,t as ke,u as Ae,y as je}from"./mind-DtTVrW6Z.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var J=g({calm:{key:`calm`,label:L(`平静`),feel:L(`像一杯温水`),particle:`mote`,tempo:1},sweet:{key:`sweet`,label:L(`甜甜`),feel:L(`心里软软的`),particle:`bubble`,tempo:1.05},bright:{key:`bright`,label:L(`雀跃`),feel:L(`想蹦起来`),particle:`sparkle`,tempo:1.45},blue:{key:`blue`,label:L(`低落`),feel:L(`有点灰灰的`),particle:`rain`,tempo:.7},stormy:{key:`stormy`,label:L(`烦躁`),feel:L(`心里起风了`),particle:`fluff`,tempo:1.25},drowsy:{key:`drowsy`,label:L(`困倦`),feel:L(`眼皮在打架`),particle:`dust`,tempo:.6},night:{key:`night`,label:L(`夜晚`),feel:L(`睡着了`),particle:`star`,tempo:.45}}),Me=Object.keys(J);function Ne(e){return typeof e==`string`&&e in J}function Pe(e){if(!e)return`calm`;let t=e.valence??0,n=e.arousal??.35;return e.phase===`asleep`?`night`:e.phase===`sleepy`||e.phase===`waking`||(e.energy??1)<.25?`drowsy`:t>.45?n>.5?`bright`:`sweet`:t>.22?`sweet`:t>-.12?`calm`:n>.5?`stormy`:`blue`}function Fe(e){if(!e)return .45;if(e.phase===`asleep`)return .6;let t=.25+Math.abs(e.valence??0)*.5+(e.arousal??.35)*.35;return Math.min(1,Math.max(.2,t))}var Ie=`luckyTheme`,Le=`luckyQuietMotion`;function Re(e){try{return localStorage.getItem(e)}catch{return null}}function ze(e,t){try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}var Be=typeof matchMedia==`function`?matchMedia(`(prefers-reduced-motion: reduce)`):null,Ve=Re(Ie),Y=k({affect:null,pinned:Ne(Ve)?Ve:null,quiet:Re(Le)===`true`,reduced:!!Be?.matches});Be?.addEventListener?.(`change`,e=>{Y.reduced=e.matches});var X=B(()=>Pe(Y.affect)),He=B(()=>Y.pinned??X.value),Z=B(()=>!Y.quiet&&!Y.reduced),Ue=B(()=>Y.pinned?.6:Fe(Y.affect));function We(e){Y.affect=e}function Ge(e){Y.pinned=e,ze(Ie,e)}function Ke(e){Y.quiet=e,ze(Le,String(e))}function qe(){D(()=>{let e=document.documentElement,t=He.value,n=Y.affect?.phase||`awake`,r=Z.value?`full`:`quiet`;e.dataset.mood!==t&&(e.dataset.mood=t),e.dataset.phase!==n&&(e.dataset.phase=n),e.dataset.motion!==r&&(e.dataset.motion=r);let i=String(J[t].tempo),a=Ue.value.toFixed(2);e.style.getPropertyValue(`--tempo`)!==i&&e.style.setProperty(`--tempo`,i),e.style.getPropertyValue(`--intensity`)!==a&&e.style.setProperty(`--intensity`,a)})}var Q=k({data:null,error:``}),Je=null,Ye=0;function Xe(){return Je??=fe(`/mind/presence`).then(e=>{Q.data=e,Q.error=``,We({...e.affect})}).catch(e=>{Q.error=e.message}).finally(()=>{Je=null}),Je}function Ze(){Xe(),clearInterval(Ye),Ye=window.setInterval(()=>{document.hidden||Xe()},3e4);let e=()=>{document.hidden||Xe()};return document.addEventListener(`visibilitychange`,e),()=>{clearInterval(Ye),document.removeEventListener(`visibilitychange`,e)}}async function Qe(e,t={}){let{session:n=``,signal:r,reconnectMs:i=3e3}=t,a=e=>new Promise(t=>{if(r?.aborted)return t();let n=setTimeout(i,e);function i(){clearTimeout(n),r?.removeEventListener(`abort`,i),t()}r?.addEventListener(`abort`,i,{once:!0})});for(;!r?.aborted;){try{await te();let t=new URL(`/api/core/stream`,location.origin);n&&t.searchParams.set(`session`,n);let i=await fetch(t,{credentials:`same-origin`,signal:r});if(i.status===401&&y(),!i.ok)throw Error(`stream unavailable`);let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{value:t,done:n}=await a.read();if(n)break;s+=o.decode(t,{stream:!0});let r;for(;(r=s.indexOf(`
|
|
3
|
+
|
|
4
|
+
`))>=0;){let t=s.slice(0,r);s=s.slice(r+2),t.startsWith(`data: `)&&await e(JSON.parse(t.slice(6)))}}}catch{}r?.aborted||await a(i)}}var $e=`/app/assets/luckytri-home-95QKeMtc.png`,et=`luckytri-wallpapers`,tt=`files`,nt=`luckytri-sky-opacity-v1`,rt=.22,it=.4,$=k({hero:$e,sky:``,skyOpacity:ot()}),at=null;function ot(){try{let e=Number(localStorage.getItem(nt));return Number.isFinite(e)?st(e):rt}catch{return rt}}function st(e){return Math.min(.82,Math.max(.08,e))}function ct(){return new Promise((e,t)=>{let n=indexedDB.open(et,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(tt)||n.result.createObjectStore(tt)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function lt(e){return ct().then(t=>new Promise((n,r)=>{let i=t.transaction(tt).objectStore(tt).get(e);i.onsuccess=()=>n(i.result||null),i.onerror=()=>r(i.error)}))}function ut(e,t){return ct().then(n=>new Promise((r,i)=>{let a=n.transaction(tt,`readwrite`).objectStore(tt),o=t?a.put(t,e):a.delete(e);o.onsuccess=()=>r(),o.onerror=()=>i(o.error)}))}function dt(e,t){let n=$[e];n.startsWith(`blob:`)&&URL.revokeObjectURL(n),$[e]=t?URL.createObjectURL(t):e===`hero`?$e:``}async function ft(e,t){if(!e.type.startsWith(`image/`))throw Error(l(`请选择一张图片`));if(e.size>20971520)throw Error(l(`图片太大了,请换一张 20MB 以内的`));try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(n.width*r)),i.height=Math.max(1,Math.round(n.height*r));let a=i.getContext(`2d`);if(!a)throw Error(l(`无法处理这张图片`));a.drawImage(n,0,0,i.width,i.height),n.close();let o=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));if(!o)throw Error(l(`无法处理这张图片`));return o}catch(t){if(t instanceof Error&&t.message!==l(`请选择一张图片`)&&e.size<=6291456)return e;throw t instanceof Error?t:Error(l(`无法处理这张图片`))}}function pt(){return at??=(async()=>{try{let[e,t]=await Promise.all([lt(`hero`),lt(`sky`)]);e&&dt(`hero`,e),t&&dt(`sky`,t)}catch{}})(),at}async function mt(e){let t=await ft(e,1600);await ut(`hero`,t),dt(`hero`,t)}async function ht(){await ut(`hero`,null),dt(`hero`,null)}async function gt(e){let t=await ft(e,1920);await ut(`sky`,t),dt(`sky`,t);let n=null;try{n=localStorage.getItem(nt)}catch{n=null}n||vt(it)}async function _t(){await ut(`sky`,null),dt(`sky`,null)}function vt(e){let t=st(e);$.skyOpacity=t;try{localStorage.setItem(nt,String(t))}catch{}}var yt=g({idle:L(`闲着`),speaking:L(`刚说完话`),thinking:L(`在想怎么回`),solitude:L(`在独处`),reading:L(`在读资料`),diary:L(`在写日记`),review:L(`在回顾这段日子`),night:L(`在夜里整理今天`),asleep:L(`睡着了`),busy:L(`在忙自己的事`)});function bt(e){if(!e)return``;if(e.phase===`asleep`)return l(`睡着了,呼吸很轻`);let t=[e.phaseLabel,e.energyLabel,e.mood].filter(Boolean).join(`,`);return e.cause?l(`{line},因为{cause}`,{line:t,cause:e.cause}):t}function xt(e){return e?.lately||``}function St(e){if(!e)return``;if(e.currentLife?.current)return e.currentLife.current.label+(e.currentLife.current.title?` · `+e.currentLife.current.title:``);let{kind:t,sessionName:n}=e.activity||{kind:`idle`},r=yt[t]||yt.idle;return(t===`speaking`||t===`thinking`)&&n?`${r} · ${n}`:r}var Ct={mote:16,sparkle:12,bubble:10,rain:28,fluff:8,dust:18,star:24},wt=36,Tt=class{canvas;ctx;parts=[];kind=`mote`;intensity=.5;colors={particle:`#ffffff`,accent:`#2c8465`,cheek:`#ff9db1`};w=0;h=0;raf=0;last=0;running=!1;shooting=null;nextShot=0;constructor(e){this.canvas=e;let t=e.getContext(`2d`,{alpha:!0,desynchronized:!0});if(!t)throw Error(`canvas unavailable`);this.ctx=t}configure(e,t){let n=e!==this.kind||Math.abs(t-this.intensity)>.15||!this.parts.length;this.kind=e,this.intensity=t,this.readColors(),n&&this.seed()}readColors(){let e=getComputedStyle(document.documentElement),t=(t,n)=>e.getPropertyValue(t).trim()||n;this.colors={particle:t(`--particle`,`#ffffff`),accent:t(`--accent`,`#2c8465`),cheek:t(`--cheek`,`#ff9db1`)}}resize(){let e=this.canvas.getBoundingClientRect();this.w=e.width,this.h=e.height,this.canvas.width=Math.round(e.width*1),this.canvas.height=Math.round(e.height*1),this.ctx.setTransform(1,0,0,1,0,0),this.seed()}start(){if(this.running)return;this.running=!0,this.last=performance.now();let e=t=>{if(!this.running)return;this.raf=requestAnimationFrame(e);let n=t-this.last;n<1e3/60-1||(this.last=t,this.step(Math.min(.05,n/1e3),t/1e3))};this.raf=requestAnimationFrame(e)}stop(){this.running=!1,cancelAnimationFrame(this.raf),this.ctx.clearRect(0,0,this.w,this.h)}count(){let e=Math.min(1.25,Math.max(.4,this.w*this.h/1296e3));return Math.min(wt,Math.round(Ct[this.kind]*e*(.55+this.intensity*.9)))}seed(){this.parts=Array.from({length:this.count()},()=>this.spawn(!0))}spawn(e){let t=Math.random,n={x:t()*this.w,y:t()*this.h,vx:0,vy:0,r:2,a:1,phase:t()*Math.PI*2,spin:(t()-.5)*.6,alt:!1};switch(this.kind){case`mote`:Object.assign(n,{r:2+t()*4,vx:(t()-.5)*8,vy:-4-t()*8,a:.25+t()*.45}),e||(n.y=this.h+10);break;case`sparkle`:Object.assign(n,{r:2.5+t()*4.5,vx:(t()-.5)*14,vy:-6-t()*14,a:.5+t()*.5,alt:t()<.35}),e||(n.y=this.h+10);break;case`bubble`:Object.assign(n,{r:3+t()*8,vx:(t()-.5)*10,vy:-10-t()*18,a:.35+t()*.4,alt:t()<.3}),e||(n.y=this.h+14);break;case`rain`:Object.assign(n,{x:t()*(this.w+120),r:10+t()*14,vx:-40,vy:380+t()*180,a:.12+t()*.2}),e||(n.y=-24);break;case`fluff`:Object.assign(n,{r:14+t()*26,vx:(t()-.5)*30,vy:(t()-.5)*18,a:.06+t()*.08});break;case`dust`:Object.assign(n,{r:.8+t()*1.8,vx:(t()-.5)*6,vy:(t()-.5)*6,a:.3+t()*.5});break;case`star`:Object.assign(n,{r:.6+t()*1.6,a:.4+t()*.6,y:t()*this.h*.8})}return n}step(e,t){let{ctx:n,w:r,h:i,colors:a}=this;n.clearRect(0,0,r,i);let o=.6+this.intensity*.8;for(let n=0;n<this.parts.length;n++){let s=this.parts[n];switch(s.phase+=e,s.x+=s.vx*e*o,s.y+=s.vy*e*o,this.kind){case`mote`:case`sparkle`:case`bubble`:s.x+=Math.sin(t*.6+s.phase)*.25,s.y<-24&&(this.parts[n]=this.spawn(!1));break;case`rain`:s.y>i+24&&(this.parts[n]=this.spawn(!1));break;default:this.kind===`fluff`&&(s.vx+=Math.sin(t*.7+s.phase*3)*12*e,s.vy+=Math.cos(t*.5+s.phase*2)*8*e,s.vx=Math.max(-24,Math.min(24,s.vx)),s.vy=Math.max(-16,Math.min(16,s.vy))),s.x<-40&&(s.x=r+40),s.x>r+40&&(s.x=-40),s.y<-40&&(s.y=i+40),s.y>i+40&&(s.y=-40)}this.draw(this.parts[n],t,a)}this.kind===`star`&&this.shoot(e,t),n.globalAlpha=1}draw(e,t,n){let r=this.ctx;switch(this.kind){case`mote`:{let t=e.a*(.7+.3*Math.sin(e.phase*1.3));r.fillStyle=n.particle,r.globalAlpha=t*.25,this.circle(e.x,e.y,e.r*2.4),r.globalAlpha=t,this.circle(e.x,e.y,e.r);break}case`sparkle`:r.fillStyle=e.alt?n.accent:n.particle,r.globalAlpha=e.a*(.35+.65*(.5+.5*Math.sin(e.phase*2.2))),this.star(e.x,e.y,e.r,t*e.spin);break;case`bubble`:r.globalAlpha=e.a,e.alt?(r.fillStyle=n.cheek,this.heart(e.x,e.y,e.r*.8)):(r.strokeStyle=n.particle,r.lineWidth=1.2,r.beginPath(),r.arc(e.x,e.y,e.r,0,Math.PI*2),r.stroke(),r.globalAlpha=e.a*.8,r.beginPath(),r.arc(e.x-e.r*.35,e.y-e.r*.35,e.r*.25,0,Math.PI*2),r.fillStyle=n.particle,r.fill());break;case`rain`:r.strokeStyle=n.particle,r.globalAlpha=e.a,r.lineWidth=1,r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(e.x-e.r*.1,e.y+e.r),r.stroke();break;case`fluff`:{let t=r.createRadialGradient(e.x,e.y,0,e.x,e.y,e.r);t.addColorStop(0,n.particle),t.addColorStop(1,`transparent`),r.fillStyle=t,r.globalAlpha=e.a,this.circle(e.x,e.y,e.r);break}case`dust`:r.fillStyle=n.particle,r.globalAlpha=e.a*(.75+.25*Math.sin(e.phase*.9)),this.circle(e.x,e.y,e.r);break;case`star`:r.fillStyle=n.particle,r.globalAlpha=e.a*(.55+.45*Math.sin(t*(.6+e.spin)+e.phase)),this.circle(e.x,e.y,e.r),e.r>1.8&&(r.globalAlpha*=.35,this.star(e.x,e.y,e.r*3.2,0))}}shoot(e,t){!this.shooting&&t>this.nextShot&&(this.nextShot=t+9+Math.random()*10,this.shooting={x:this.w*(.3+Math.random()*.6),y:this.h*Math.random()*.3,life:0});let n=this.shooting;if(!n)return;n.life+=e;let r=n.life/1.4;if(r>=1){this.shooting=null;return}let i=n.x-r*220,a=n.y+r*110,o=this.ctx,s=o.createLinearGradient(i,a,i+60,a-30);s.addColorStop(0,this.colors.particle),s.addColorStop(1,`transparent`),o.strokeStyle=s,o.globalAlpha=Math.sin(r*Math.PI)*.7,o.lineWidth=1.4,o.beginPath(),o.moveTo(i,a),o.lineTo(i+60,a-30),o.stroke()}circle(e,t,n){this.ctx.beginPath(),this.ctx.arc(e,t,n,0,Math.PI*2),this.ctx.fill()}star(e,t,n,r){let i=this.ctx;i.save(),i.translate(e,t),i.rotate(r),i.beginPath(),i.moveTo(0,-n),i.quadraticCurveTo(0,0,n,0),i.quadraticCurveTo(0,0,0,n),i.quadraticCurveTo(0,0,-n,0),i.quadraticCurveTo(0,0,0,-n),i.fill(),i.restore()}heart(e,t,n){let r=this.ctx;r.beginPath(),r.moveTo(e,t+n*.9),r.bezierCurveTo(e-n*1.6,t-n*.2,e-n*.6,t-n*1.3,e,t-n*.45),r.bezierCurveTo(e+n*.6,t-n*1.3,e+n*1.6,t-n*.2,e,t+n*.9),r.fill()}},Et=[`data-particles`],Dt={key:0,class:`moon`},Ot=R(z({__name:`MoodSky`,setup(e){let t=K(),n=B(()=>$.sky?{backgroundImage:`url("${$.sky}")`,opacity:String($.skyOpacity)}:void 0),r=B(()=>Z.value?J[He.value].particle:`off`),a=null,o=0;function s(){a&&(a.configure(J[He.value].particle,Ue.value),clearTimeout(o),o=window.setTimeout(()=>a?.readColors(),1500),Z.value&&!document.hidden?a.start():a.stop())}function c(){a?.resize()}function l(){a&&(document.hidden?a.stop():Z.value&&a.start())}return j(()=>{if(t.value){try{a=new Tt(t.value)}catch{return}a.resize(),s(),window.addEventListener(`resize`,c,{passive:!0}),document.addEventListener(`visibilitychange`,l)}}),F([He,Ue,Z],s),me(()=>{a?.stop(),clearTimeout(o),window.removeEventListener(`resize`,c),document.removeEventListener(`visibilitychange`,l)}),(e,a)=>(H(),E(`div`,{class:`sky`,"aria-hidden":`true`,"data-particles":r.value},[a[0]||=u(`div`,{class:`sky-base`},null,-1),u(`div`,{class:G([`garden`,{custom:!!i($).sky}]),style:b(n.value)},null,6),a[1]||=_(`<div class="glow g1" data-v-d7604463></div><div class="glow g2" data-v-d7604463></div><div class="glow g3" data-v-d7604463></div><div class="glow g4" data-v-d7604463></div><div class="horizon" data-v-d7604463></div><div class="landscape" data-v-d7604463><i data-v-d7604463></i><i data-v-d7604463></i><i data-v-d7604463></i><i data-v-d7604463></i></div><div class="sheen" data-v-d7604463></div>`,7),i(He)===`night`?(H(),E(`div`,Dt)):w(``,!0),a[2]||=u(`div`,{class:`vignette`},null,-1),u(`canvas`,{ref_key:`canvas`,ref:t,class:G([`particles`,{off:!i(Z)}])},null,2)],8,Et))}}),[[`__scopeId`,`data-v-d7604463`]]),kt=g({calm:[L(`嗯?`),L(`我在这儿。`),L(`有什么事吗?`),L(`戳我做什么呀`)],sweet:[L(`在呢~`),L(`被你发现啦`),L(`嘿嘿,找我呀`),L(`今天心情不错哦`)],bright:[L(`哇!干嘛呀~`),L(`今天超开心的!`),L(`再戳我也还是好开心`),L(`嘿嘿嘿`)],blue:[L(`……嗯`),L(`我没事,就是有点低落`),L(`陪我待一会儿就好`),L(`唔……`)],stormy:[L(`别戳啦!`),L(`我现在有点烦……`),L(`让我静一静嘛`),L(`哼`)],drowsy:[L(`唔……好困`),L(`再让我眯一会儿`),L(`嗯……?`),L(`哈——欠`)],night:[L(`呼……呼……`),L(`(翻了个身)`),`zzz……`,L(`(嘟囔了一句梦话)`)]}),At=g({calm:[L(`……有点痒`),L(`嗯,这样挺好`),L(`谢谢你`)],sweet:[L(`嘿嘿,好舒服`),L(`再摸一下嘛`),L(`脸要红了……`)],bright:[L(`哈哈哈好痒!`),L(`最喜欢这样了!`),L(`嘿嘿,开心加倍`)],blue:[L(`……谢谢你`),L(`好像好一点了`),L(`嗯,别走开`)],stormy:[L(`……好吧,就一下`),L(`哼,勉强接受`),L(`嗯……好像没那么烦了`)],drowsy:[L(`呼……要睡着了`),L(`好温暖……`),L(`嗯……`)],night:[L(`(在梦里笑了一下)`),L(`(蹭了蹭)`),`zzz……`]}),jt=g({thinking:[L(`等等,我在想怎么回……`),L(`嘘,我在看大家聊什么`)],speaking:[L(`刚刚在说话来着`),L(`你看到我说的了吗`)],solitude:[L(`我在想事情,一会儿就好`),L(`让我安静一下下`)],reading:[L(`我在看书呢`),L(`这一页好有意思`)],diary:[L(`我在写日记,不许偷看`),L(`今天的事,写下来`)],review:[L(`在翻以前的日记呢`),L(`原来那时候我是这样想的`)],night:[L(`在整理今天的事……`),L(`嘘,快整理完了`)]}),Mt=0;function Nt(e,t,n=`idle`){let r=e===`poke`&&n!==`asleep`&&jt[n]?jt[n]:(e===`pet`?At:kt)[n===`asleep`?`night`:t]||kt.calm;return Mt+=1,r[Mt%r.length]}var Pt=[`role`,`tabindex`,`aria-label`,`data-mood`,`data-activity`,`onKeydown`],Ft=[`id`],It=[`id`],Lt=[`id`],Rt=[`fill`],zt={key:0,class:`halo`},Bt={class:`squish`},Vt=[`d`,`fill`],Ht=[`d`,`fill`],Ut=[`transform`],Wt={key:0,class:`brows`},Gt=[`d`],Kt=[`d`],qt=[`cx`,`cy`,`ry`],Jt=[`cx`,`cy`],Yt=[`d`],Xt=[`d`],Zt={key:3},Qt=[`d`],$t=[`d`],en={class:`mouth`},tn=[`d`],nn={key:1,class:`line`,d:`M94 125Q100 129.5 106 125`},rn={key:2},an={key:3,class:`line`,d:`M89 123Q94.5 129 100 123.5Q105.5 129 111 123`},on={key:4,class:`line`,d:`M91 130Q100 122.5 109 130`},sn={key:5,class:`line`,d:`M88 127q3 -3.4 6 0t6 0t6 0t6 0`},cn={key:6,class:`ink yawn`,cx:`100`,cy:`127`,rx:`4.6`,ry:`5.6`},ln={key:7,class:`ink`,cx:`100`,cy:`127`,rx:`2.6`,ry:`3`},un={key:8,class:`ink talk`,cx:`100`,cy:`126`,rx:`5`,ry:`4.5`},dn={key:9,class:`line`,d:`M91 127Q102 130 110 121`},fn={key:10,class:`line`,d:`M93 126L107 126`},pn={key:0,class:`held`},mn={key:1,class:`held`},hn={key:1,class:`fx`},gn=[`d`],_n={key:2,class:`fx`},vn=[`d`],yn={key:3,class:`fx rain`},bn={key:4,class:`fx storm`},xn={key:5,class:`fx`},Sn={key:6,class:`fx`},Cn={key:7,class:`fx`},wn={key:8,class:`fx`},Tn={key:9,class:`fx think`},En={key:10,class:`fx talkwaves`},Dn=R(z({__name:`TaOrb`,props:{mood:{default:`calm`},activity:{default:`idle`},size:{default:160},interactive:{type:Boolean,default:!1},speech:{default:``},traits:{default:null},bubbleSide:{default:`top`},label:{default:``}},emits:[`open-chat`,`react`],setup(e,{expose:t,emit:n}){let r=e,o=n,s={calm:{wobble:.6,speed:.8,bounce:0,droop:0,jitter:0,eyes:`open`,mouth:`small`,cheeks:.25},sweet:{wobble:.8,speed:1,bounce:1.6,droop:0,jitter:0,eyes:`happy`,mouth:`cat`,cheeks:.8},bright:{wobble:1,speed:1.5,bounce:7,droop:0,jitter:0,eyes:`happy`,mouth:`grin`,cheeks:.55},blue:{wobble:.35,speed:.5,bounce:0,droop:4,jitter:0,eyes:`sad`,mouth:`frown`,cheeks:.1},stormy:{wobble:1.1,speed:1.2,bounce:0,droop:0,jitter:.9,eyes:`cross`,mouth:`wavy`,cheeks:.15},drowsy:{wobble:.45,speed:.45,bounce:0,droop:2,jitter:0,eyes:`sleepy`,mouth:`yawn`,cheeks:.35},night:{wobble:.3,speed:.35,bounce:0,droop:3,jitter:0,eyes:`closed`,mouth:`sleep`,cheeks:.3}},d=new Set([`open`,`sad`,`cross`,`up`,`down`]),p=[{x:28,y:48,r:8,d:0},{x:176,y:36,r:6,d:.8},{x:184,y:128,r:7,d:1.5},{x:18,y:138,r:5,d:2.1}],m=[{x:164,y:70,s:7,d:0},{x:34,y:84,s:5.5,d:1.4},{x:178,y:118,s:4.5,d:2.6}],h=`orb`+Math.random().toString(36).slice(2,8),g={fill:h+`-fill`,aura:h+`-aura`,rim:h+`-rim`},v=`${(Math.random()*3).toFixed(2)}s`,y=K(),ee=K(),te=K(),S=K(),T=K(),ne=K({x:0,y:0}),D=K(``),O=K(``),k=B(()=>{let e={...s[r.mood]},t=r.traits;if(t){let n=t.warmth??65,r=t.activity??40;e.eyes=(t.humor??25)>60?`happy`:`open`,e.mouth=(t.sarcasm??5)>40?`smirk`:n>35?`smile`:`flat`,e.cheeks=Math.max(0,(n-30)/70)*.9,e.bounce=r/100*8,e.speed=.5+r/100*1.2,e.wobble=.4+r/100*.8,e.jitter=0,e.droop=0}switch(r.activity){case`asleep`:Object.assign(e,{eyes:`closed`,mouth:`sleep`,bounce:0,speed:.35,wobble:.3,jitter:0});break;case`solitude`:case`night`:case`review`:Object.assign(e,{eyes:`closed`,mouth:`small`,bounce:0,jitter:0});break;case`diary`:case`reading`:e.eyes=`down`,e.bounce=0,(e.mouth===`grin`||e.mouth===`wavy`)&&(e.mouth=`small`);break;case`thinking`:e.eyes=`up`,e.mouth===`grin`&&(e.mouth=`small`);break;case`speaking`:e.mouth=`talk`}return D.value===`pet`&&e.eyes!==`closed`?Object.assign(e,{eyes:`happy`,mouth:`cat`,cheeks:1}):D.value===`pet`&&(e.cheeks=1),D.value===`poke`&&e.eyes===`happy`&&(e.eyes=`open`),e}),A=B(()=>r.size<72),ie=B(()=>k.value.eyes===`up`?{x:2,y:-3}:k.value.eyes===`down`?{x:0,y:2.5}:{x:0,y:0}),P=B(()=>r.traits?.3+(r.traits.warmth??65)/100*1.1:1),ae=B(()=>(r.traits?.humor??0)>45),oe=B(()=>{let{eyes:e,mouth:t}=k.value;return e===`sad`?[`M70 95 Q78 92 87 90`,`M113 90 Q122 92 130 95`]:e===`cross`?[`M71 90 L87 95.5`,`M113 95.5 L129 90`]:t===`smirk`?[`M71 94 L87 93`,`M113 90 Q121 85.5 129 89`]:null}),se=B(()=>{let e=r.traits;if(!e)return;let t=((e.warmth??65)-50)/50,n=(e.initiative??25)/100;return{filter:`hue-rotate(${Math.round(-t*28)}deg) saturate(${(1+t*.18).toFixed(2)})`,transform:`scale(${(.92+n*.14).toFixed(3)}) rotate(${((n-.25)*8).toFixed(1)}deg)`}}),I=B(()=>O.value||r.speech),ce=B(()=>r.label||(r.interactive?l(`TA:轻触互动,按住摸摸头,双击和 TA 聊聊`):`TA`)),L=B(()=>A.value?``:r.activity===`asleep`?`night`:r.mood);function le(e,t,n,r){let i=[];for(let a=0;a<8;a++){let o=a/8*Math.PI*2-Math.PI/2,s=62*(1+(Math.sin(e*1.3+a*1.7)*.6+Math.sin(e*.7+a*2.9)*.4)*.055*t),c=Math.sin(o)>0?.92:1.02;i.push([100+Math.cos(o)*s*n,112+Math.sin(o)*s*r*c])}let a=`M${i[0][0].toFixed(2)},${i[0][1].toFixed(2)}`;for(let e=0;e<8;e++){let t=i[(e-1+8)%8],n=i[e],r=i[(e+1)%8],o=i[(e+2)%8];a+=`C${(n[0]+(r[0]-t[0])/6).toFixed(2)},${(n[1]+(r[1]-t[1])/6).toFixed(2)} ${(r[0]-(o[0]-n[0])/6).toFixed(2)},${(r[1]-(o[1]-n[1])/6).toFixed(2)} ${r[0].toFixed(2)},${r[1].toFixed(2)}`}return a+`Z`}let ue=le(0,0,1,1),de=performance.now()-Math.random()*1e4,fe=0,pe=0;function R(e,t=!1){let n=k.value,r=(e-de)/1e3,i=r*n.speed,a=t?0:Math.sin(i*1.7)*.022,o=t||!n.bounce?0:Math.max(0,Math.sin(i*2.6))**1.5*n.bounce,s=t||!n.jitter||Math.sin(r*.8)<.55?0:Math.sin(r*38)*n.jitter,c=t?ue:le(i,n.wobble,1+a-o*.004,1-a*.7+o*.006);ee.value?.setAttribute(`d`,c),te.value?.setAttribute(`d`,c),S.value?.setAttribute(`transform`,`translate(${s.toFixed(2)} ${(n.droop-o).toFixed(2)})`),T.value?.setAttribute(`rx`,(46*(1-o/30)).toFixed(2))}function z(e){fe=requestAnimationFrame(z),!(e-pe<1e3/60-1)&&(pe=e,R(e))}let he=!0,ge=!0,_e=null;function V(){cancelAnimationFrame(fe),fe=0,Z.value&&he&&ge&&!document.hidden?fe=requestAnimationFrame(z):R(performance.now(),!0)}let ye=0;function be(e){ye||=requestAnimationFrame(()=>{ye=0;let t=y.value;if(!t||k.value.eyes===`closed`){ne.value={x:0,y:0};return}let n=t.getBoundingClientRect(),r=e.clientX-(n.left+n.width/2),i=e.clientY-(n.top+n.height/2),a=Math.hypot(r,i)||1,o=Math.min(1,a/360);ne.value={x:Math.round(r/a*4*o*10)/10,y:Math.round(i/a*3*o*10)/10}})}function xe(e){window.removeEventListener(`pointermove`,be),e&&he&&ge&&!document.hidden&&r.size>=56?window.addEventListener(`pointermove`,be,{passive:!0}):ne.value={x:0,y:0}}let U=0,Se=0,q=0;function Ce(e){O.value=e,clearTimeout(U),U=window.setTimeout(()=>O.value=``,2800)}function we(e){D.value=e,clearTimeout(Se),Se=window.setTimeout(()=>D.value=``,e===`pet`?1500:650),Ce(Nt(e,r.mood,r.activity)),o(`react`,e)}function Te(){r.interactive&&we(`poke`)}function Ee(){r.interactive&&we(`pet`)}function De(e){!r.interactive||e.button>0||(D.value=`press`,clearTimeout(q),q=window.setTimeout(()=>{q=0,we(`pet`)},520))}function Oe(){r.interactive&&q&&(clearTimeout(q),q=0,we(`poke`))}function ke(){q&&clearTimeout(q),q=0,D.value===`press`&&(D.value=``)}function Ae(e,t,n){return`M${e} ${t-n}Q${e} ${t} ${e+n} ${t}Q${e} ${t} ${e} ${t+n}Q${e} ${t} ${e-n} ${t}Q${e} ${t} ${e} ${t-n}Z`}function je(e,t,n){return`M${e} ${t+n*.9}C${e-n*1.6} ${t-n*.2} ${e-n*.6} ${t-n*1.3} ${e} ${t-n*.45}C${e+n*.6} ${t-n*1.3} ${e+n*1.6} ${t-n*.2} ${e} ${t+n*.9}Z`}F([k,Z],V),F(Z,xe);function J(){V(),xe(Z.value)}return re(()=>{ge=!0,J()}),ve(()=>{ge=!1,J()}),j(()=>{V(),xe(Z.value),y.value&&`IntersectionObserver`in window&&(_e=new IntersectionObserver(e=>{he=e[0].isIntersecting,J()}),_e.observe(y.value)),document.addEventListener(`visibilitychange`,J)}),me(()=>{cancelAnimationFrame(fe),cancelAnimationFrame(ye),window.removeEventListener(`pointermove`,be),_e?.disconnect(),document.removeEventListener(`visibilitychange`,J),clearTimeout(U),clearTimeout(Se),clearTimeout(q)}),t({poke:Te,pet:Ee,cancel:ke}),(t,n)=>(H(),E(`div`,{ref_key:`root`,ref:y,class:G([`ta-orb`,[`mood-${e.mood}`,`act-${e.activity}`,D.value&&`is-${D.value}`,{interactive:e.interactive,small:A.value}]]),style:b({width:e.size+`px`,height:e.size+`px`,"--blink-delay":v}),role:e.interactive?`button`:`img`,tabindex:e.interactive?0:void 0,"aria-label":ce.value,"data-mood":e.mood,"data-activity":e.activity,onPointerdown:De,onPointerup:Oe,onPointerleave:ke,onPointercancel:ke,onDblclick:n[0]||=e=>o(`open-chat`),onKeydown:[c(x(Te,[`prevent`]),[`enter`]),c(x(Ee,[`prevent`]),[`space`])],onContextmenu:n[1]||=x(()=>{},[`prevent`])},[(H(),E(`svg`,{viewBox:`0 0 200 200`,style:b(se.value),"aria-hidden":`true`},[u(`defs`,null,[u(`radialGradient`,{id:g.fill,cx:`38%`,cy:`30%`,r:`78%`},[...n[2]||=[u(`stop`,{offset:`0%`,style:{"stop-color":`var(--orb-a)`}},null,-1),u(`stop`,{offset:`58%`,style:{"stop-color":`var(--orb-b)`}},null,-1),u(`stop`,{offset:`100%`,style:{"stop-color":`var(--orb-c)`}},null,-1)]],8,Ft),u(`radialGradient`,{id:g.aura},[...n[3]||=[u(`stop`,{offset:`45%`,style:{"stop-color":`var(--orb-b)`,"stop-opacity":`0.5`}},null,-1),u(`stop`,{offset:`100%`,style:{"stop-color":`var(--orb-b)`,"stop-opacity":`0`}},null,-1)]],8,It),u(`radialGradient`,{id:g.rim,cx:`50%`,cy:`50%`,r:`50%`},[...n[4]||=[u(`stop`,{offset:`72%`,style:{"stop-color":`#ffffff`,"stop-opacity":`0`}},null,-1),u(`stop`,{offset:`100%`,style:{"stop-color":`#ffffff`,"stop-opacity":`0.4`}},null,-1)]],8,Lt)]),u(`circle`,{class:`aura`,cx:`100`,cy:`112`,r:`94`,fill:`url(#${g.aura})`},null,8,Rt),e.activity===`solitude`?(H(),E(`g`,zt,[...n[5]||=[u(`circle`,{cx:`100`,cy:`112`,r:`86`},null,-1),u(`circle`,{class:`halo-soft`,cx:`100`,cy:`112`,r:`76`},null,-1)]])):w(``,!0),u(`ellipse`,{ref_key:`shadow`,ref:T,class:`shadow`,cx:`100`,cy:`186`,rx:`46`,ry:`6`},null,512),u(`g`,Bt,[u(`g`,{ref_key:`whole`,ref:S},[u(`path`,{ref_key:`body`,ref:ee,class:`body`,d:i(ue),fill:`url(#${g.fill})`},null,8,Vt),u(`path`,{ref_key:`rim`,ref:te,class:`rim`,d:i(ue),fill:`url(#${g.rim})`},null,8,Ht),n[10]||=u(`ellipse`,{class:`shine`,cx:`76`,cy:`80`,rx:`17`,ry:`10`,transform:`rotate(-28 76 80)`},null,-1),n[11]||=u(`ellipse`,{class:`shine dot`,cx:`98`,cy:`68`,rx:`4`,ry:`3`},null,-1),u(`g`,{class:`face`,transform:`translate(${ne.value.x} ${ne.value.y})`},[oe.value?(H(),E(`g`,Wt,[u(`path`,{class:`line thin`,d:oe.value[0]},null,8,Gt),u(`path`,{class:`line thin`,d:oe.value[1]},null,8,Kt)])):w(``,!0),u(`g`,{class:G([`eyes`,{blinks:i(d).has(k.value.eyes)}])},[(H(),E(C,null,M([80,120],(e,t)=>u(`g`,{key:t,class:G([`eye`,{wink:ae.value&&t===1&&i(d).has(k.value.eyes)}])},[i(d).has(k.value.eyes)?(H(),E(C,{key:0},[u(`ellipse`,{class:`ink`,cx:e+ie.value.x,cy:106+ie.value.y,rx:`5.4`,ry:k.value.eyes===`sad`?6:7.2},null,8,qt),u(`circle`,{class:`glint`,cx:e+ie.value.x+1.8,cy:106+ie.value.y-2.6,r:`1.9`},null,8,Jt)],64)):k.value.eyes===`happy`?(H(),E(`path`,{key:1,class:`line`,d:`M${e-7} 108Q${e} 98 ${e+7} 108`},null,8,Yt)):k.value.eyes===`closed`?(H(),E(`path`,{key:2,class:`line`,d:`M${e-7} 105Q${e} 111 ${e+7} 105`},null,8,Xt)):(H(),E(`g`,Zt,[u(`path`,{class:`ink`,d:`M${e-6} 106A6 5 0 0 0 ${e+6} 106Z`},null,8,Qt),u(`path`,{class:`line thin`,d:`M${e-7.5} 106L${e+7.5} 106`},null,8,$t)]))],2)),64))],2),u(`g`,{class:`cheeks`,style:b({opacity:k.value.cheeks})},[...n[6]||=[u(`ellipse`,{cx:`70`,cy:`119`,rx:`9`,ry:`5.2`},null,-1),u(`ellipse`,{cx:`130`,cy:`119`,rx:`9`,ry:`5.2`},null,-1)]],4),u(`g`,en,[k.value.mouth===`smile`?(H(),E(`path`,{key:0,class:`line`,d:`M89 124Q100 ${(124+9*P.value).toFixed(1)} 111 124`},null,8,tn)):k.value.mouth===`small`?(H(),E(`path`,nn)):k.value.mouth===`grin`?(H(),E(`g`,rn,[...n[7]||=[u(`path`,{class:`ink`,d:`M87 121Q100 140 113 121Z`},null,-1),u(`path`,{class:`tongue`,d:`M94 129.5Q100 135 106 129.5Q100 127.5 94 129.5Z`},null,-1)]])):k.value.mouth===`cat`?(H(),E(`path`,an)):k.value.mouth===`frown`?(H(),E(`path`,on)):k.value.mouth===`wavy`?(H(),E(`path`,sn)):k.value.mouth===`yawn`?(H(),E(`ellipse`,cn)):k.value.mouth===`sleep`?(H(),E(`ellipse`,ln)):k.value.mouth===`talk`?(H(),E(`ellipse`,un)):k.value.mouth===`smirk`?(H(),E(`path`,dn)):(H(),E(`path`,fn))])],8,Ut),e.activity===`reading`?(H(),E(`g`,pn,[...n[8]||=[u(`path`,{class:`page`,d:`M100 150L72 142L72 167L100 175Z`},null,-1),u(`path`,{class:`page`,d:`M100 150L128 142L128 167L100 175Z`},null,-1),u(`path`,{class:`line thin`,d:`M100 150L100 175`},null,-1)]])):e.activity===`diary`?(H(),E(`g`,mn,[...n[9]||=[_(`<rect class="page" x="118" y="150" width="50" height="34" rx="5" transform="rotate(-8 143 167)" data-v-3fb60aa5></rect><path class="line hair" d="M126 163L156 159M127 171L150 168" data-v-3fb60aa5></path><g class="pen" transform="rotate(38 152 146)" data-v-3fb60aa5><rect x="148" y="112" width="9" height="40" rx="3.5" data-v-3fb60aa5></rect><path d="M148 152L152.5 163L157 152Z" data-v-3fb60aa5></path></g>`,3)]])):w(``,!0)],512)]),L.value===`bright`?(H(),E(`g`,hn,[(H(),E(C,null,M(p,(e,t)=>u(`path`,{key:t,class:`sparkle`,d:Ae(e.x,e.y,e.r),style:b({animationDelay:e.d+`s`})},null,12,gn)),64))])):L.value===`sweet`?(H(),E(`g`,_n,[(H(),E(C,null,M(m,(e,t)=>u(`path`,{key:t,class:`heart`,d:je(e.x,e.y,e.s),style:b({animationDelay:e.d+`s`})},null,12,vn)),64))])):L.value===`blue`?(H(),E(`g`,yn,[...n[12]||=[_(`<g class="cloud" data-v-3fb60aa5><circle cx="30" cy="36" r="9" data-v-3fb60aa5></circle><circle cx="42" cy="30" r="11" data-v-3fb60aa5></circle><circle cx="54" cy="36" r="8" data-v-3fb60aa5></circle><rect x="22" y="35" width="40" height="10" rx="5" data-v-3fb60aa5></rect></g><path class="drop" d="M31 50l-1.5 6" data-v-3fb60aa5></path><path class="drop" d="M42 50l-1.5 6" style="animation-delay:0.45s;" data-v-3fb60aa5></path><path class="drop" d="M53 50l-1.5 6" style="animation-delay:0.9s;" data-v-3fb60aa5></path>`,4)]])):L.value===`stormy`?(H(),E(`g`,bn,[...n[13]||=[_(`<g class="cloud" data-v-3fb60aa5><circle cx="156" cy="34" r="9" data-v-3fb60aa5></circle><circle cx="168" cy="28" r="11" data-v-3fb60aa5></circle><circle cx="180" cy="34" r="8" data-v-3fb60aa5></circle><rect x="148" y="33" width="40" height="10" rx="5" data-v-3fb60aa5></rect></g><path class="scribble" d="M154 54q4 -5 8 0t8 0t8 0" data-v-3fb60aa5></path>`,2)]])):L.value===`drowsy`&&e.activity===`idle`?(H(),E(`g`,xn,[...n[14]||=[u(`text`,{class:`zz`,x:`158`,y:`58`},`z`,-1)]])):w(``,!0),L.value===`night`||e.activity===`review`||e.activity===`night`?(H(),E(`g`,Sn,[...n[15]||=[u(`path`,{class:`moon`,d:`M40 20a18 18 0 1 0 16 28a14 14 0 1 1 -16 -28Z`},null,-1)]])):w(``,!0),e.activity===`asleep`||e.mood===`night`&&e.activity===`idle`?(H(),E(`g`,Cn,[...n[16]||=[u(`text`,{class:`zz`,x:`150`,y:`64`},`z`,-1),u(`text`,{class:`zz`,x:`162`,y:`48`,style:{"animation-delay":`1s`,"font-size":`16px`}},` z `,-1),u(`text`,{class:`zz`,x:`174`,y:`30`,style:{"animation-delay":`2s`,"font-size":`20px`}},` Z `,-1)]])):w(``,!0),e.activity===`review`||e.activity===`night`?(H(),E(`g`,wn,[...n[17]||=[u(`g`,{class:`floating-page`},[u(`rect`,{class:`page`,x:`156`,y:`92`,width:`30`,height:`38`,rx:`4`}),u(`path`,{class:`line hair`,d:`M162 103h18M162 111h18M162 119h11`})],-1)]])):w(``,!0),e.activity===`thinking`?(H(),E(`g`,Tn,[...n[18]||=[_(`<circle class="puff" cx="146" cy="58" r="3.5" data-v-3fb60aa5></circle><circle class="puff" cx="156" cy="45" r="5" data-v-3fb60aa5></circle><ellipse class="puff" cx="176" cy="24" rx="21" ry="14" data-v-3fb60aa5></ellipse><circle class="dot" cx="167" cy="24" r="2.6" data-v-3fb60aa5></circle><circle class="dot" cx="176" cy="24" r="2.6" style="animation-delay:0.18s;" data-v-3fb60aa5></circle><circle class="dot" cx="185" cy="24" r="2.6" style="animation-delay:0.36s;" data-v-3fb60aa5></circle>`,6)]])):w(``,!0),e.activity===`speaking`&&!A.value?(H(),E(`g`,En,[...n[19]||=[u(`path`,{class:`line thin`,d:`M170 94q8 9 0 18`},null,-1),u(`path`,{class:`line thin`,d:`M180 88q13 15 0 30`,style:{"animation-delay":`0.3s`}},null,-1)]])):w(``,!0)],4)),N(f,{name:`orb-say`},{default:W(()=>[I.value?(H(),E(`p`,{key:I.value,class:G([`orb-say`,`say-`+e.bubbleSide]),role:`status`},a(I.value),3)):w(``,!0)]),_:1})],46,Pt))}}),[[`__scopeId`,`data-v-3fb60aa5`]]);function On(e,t=`Asia/Shanghai`){return e?je(p(),{timeZone:t,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e):``}function kn(e){let[,t,n]=e.split(`-`).map(Number);return t&&n?l(`{month} 月 {date} 日`,{month:t,date:n}):e}function An(e){let t=new Date(e+`T12:00:00`);return Number.isNaN(t.getTime())?``:je(p(),{weekday:`short`}).format(t)}function jn(e,t=Date.now()){if(!e)return``;let n=Math.round((t-e)/6e4);if(n<1)return l(`刚刚`);if(n<60)return l(`{minutes} 分钟前`,{minutes:n});let r=Math.round(n/60);if(r<24)return l(`{hours} 小时前`,{hours:r});let i=Math.round(r/24);if(i<30)return l(`{days} 天前`,{days:i});let a=Math.round(i/30);return a<12?l(`{months} 个月前`,{months:a}):l(`{v} 年前`,{v:Math.round(a/12)})}function Mn(e){return Number(e||0).toLocaleString(p())}var Nn=/^\d{4,20}$/;function Pn(e){let t=String(e||``).split(`:`);return t[t.length-1]||``}function Fn(e){let t=Pn(e.id||``),n=String(e.name||``).trim(),r=n.replace(/^(群聊|私聊)\s+/,``),i=e.kind||(String(e.id||``).startsWith(`private:`)?`private`:`group`);return!n||r===t||Nn.test(r)?l(i===`private`?`未命名的人`:`未命名的群`):n}function In(e,t=``){let n=e.map(e=>({value:e.id,label:Fn(e)}));return t?[{value:``,label:t,disabled:!0},...n]:n}function Ln(e){let t=String(e||`?`).trim();return/^[\x00-\x7f]/.test(t)?t.slice(0,2).toUpperCase():t.slice(-2)}function Rn(e){let t=0;for(let n of String(e))t=(t*31+n.codePointAt(0))%360;return t}var zn=[`id`,`aria-controls`,`aria-activedescendant`,`aria-label`,`aria-expanded`,`disabled`],Bn=[`id`,`aria-labelledby`],Vn=[`id`,`tabindex`,`aria-selected`,`onClick`],Hn={key:0,class:`empty`},Un=[`id`,`name`,`value`,`disabled`],Wn=[`value`,`disabled`],Gn=R(z({__name:`Select`,props:{modelValue:{default:``},options:{},id:{default:``},name:{default:``},ariaLabel:{default:``},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let n=e,r=t,o=K(!1),s=K(),c=K(),f=K(),p=K(),m=pe(),h=K(0),g=K({top:0,bottom:0,left:0,width:220,maxHeight:280,upward:!1}),_=B(()=>n.options.filter(e=>!e.disabled)),v=B(()=>n.options.find(e=>String(e.value)===String(n.modelValue))?.label||_.value[0]?.label||l(`请选择`));function y(){let e=c.value?.getBoundingClientRect();if(!e)return;let t=n.options.reduce((e,t)=>Math.max(e,String(t.label||``).length),0),r=Math.min(window.innerWidth-16,Math.max(e.width,Math.min(t*15+32,420),220)),i=Math.max(8,Math.min(e.left,window.innerWidth-r-8)),a=window.innerHeight-e.bottom-6-8,o=e.top-6-8,s=a<220&&o>a;g.value={top:e.bottom+6,bottom:window.innerHeight-e.top+6,left:i,width:r,maxHeight:Math.max(96,Math.min(320,s?o:a)),upward:s}}function ee(){n.disabled||(o.value=!o.value,o.value&&y())}function te(){let e=p.value?.querySelectorAll(`[role="option"]`)[h.value];e?.focus({preventScroll:!0}),e?.scrollIntoView({block:`nearest`})}function S(e){if(e.key===`Tab`){o.value=!1;return}if([`Escape`,`ArrowDown`,`ArrowUp`,`Home`,`End`,`Enter`,` `].includes(e.key)){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){o.value=!1,c.value?.focus();return}if(_.value.length){if(e.key===`Enter`||e.key===` `){D(_.value[h.value].value);return}h.value=e.key===`Home`?0:e.key===`End`?_.value.length-1:(h.value+(e.key===`ArrowUp`?-1:1)+_.value.length)%_.value.length,te()}}}function ne(e){[`ArrowDown`,`ArrowUp`].includes(e.key)&&!o.value&&(e.preventDefault(),ee())}function D(e){let t=String(e);if(o.value=!1,!f.value){r(`update:modelValue`,t);return}f.value.value=t;let n=new Event(`change`,{bubbles:!0});f.value.dispatchEvent(n),c.value?.focus()}function O(e){s.value&&!s.value.contains(e.target)&&(o.value=!1)}function re(){o.value&&y()}function k(){document.removeEventListener(`pointerdown`,O),window.removeEventListener(`scroll`,re,!0),window.removeEventListener(`resize`,re),document.removeEventListener(`keydown`,S,!0)}return F(o,async e=>{k(),e&&(h.value=Math.max(0,_.value.findIndex(e=>String(e.value)===String(n.modelValue))),document.addEventListener(`pointerdown`,O),window.addEventListener(`scroll`,re,!0),window.addEventListener(`resize`,re),document.addEventListener(`keydown`,S,!0),await ce(),o.value&&te())}),F(()=>n.disabled,e=>{e&&(o.value=!1)}),ve(()=>{o.value=!1,k()}),me(k),(t,n)=>(H(),E(`div`,{ref_key:`root`,ref:s,class:G([`menu-select`,{open:o.value,disabled:e.disabled}])},[u(`button`,{ref_key:`face`,ref:c,type:`button`,class:`menu-face`,id:i(m)+`-face`,role:`combobox`,"aria-haspopup":`listbox`,"aria-controls":i(m),"aria-activedescendant":o.value&&_.value.length?i(m)+`-`+h.value:void 0,"aria-label":e.ariaLabel||void 0,"aria-expanded":o.value,disabled:e.disabled,onClick:ee,onKeydown:ne},[u(`span`,null,a(v.value),1),n[2]||=u(`i`,{"aria-hidden":`true`},null,-1)],40,zn),(H(),T(d,{to:`body`},[o.value?(H(),E(`ul`,{key:0,ref_key:`menu`,ref:p,id:i(m),class:G([`menu-list`,{up:g.value.upward}]),role:`listbox`,"aria-labelledby":i(m)+`-face`,onPointerdown:n[0]||=x(()=>{},[`stop`]),style:b({top:g.value.upward?`auto`:g.value.top+`px`,bottom:g.value.upward?g.value.bottom+`px`:`auto`,left:g.value.left+`px`,width:g.value.width+`px`,maxHeight:g.value.maxHeight+`px`})},[(H(!0),E(C,null,M(_.value,(t,n)=>(H(),E(`li`,{key:String(t.value)},[u(`button`,{type:`button`,role:`option`,id:i(m)+`-`+n,tabindex:n===h.value?0:-1,"aria-selected":String(t.value)===String(e.modelValue),onClick:e=>D(t.value)},a(t.label),9,Vn)]))),128)),_.value.length?w(``,!0):(H(),E(`li`,Hn,a(i(l)(`没有可选项`)),1))],46,Bn)):w(``,!0)])),u(`select`,{ref_key:`native`,ref:f,class:`native`,id:e.id||void 0,name:e.name||void 0,value:e.modelValue,disabled:e.disabled,tabindex:`-1`,"aria-hidden":`true`,onChange:n[1]||=e=>{o.value=!1,r(`update:modelValue`,e.target.value),r(`change`,e)}},[(H(!0),E(C,null,M(e.options,e=>(H(),E(`option`,{key:`n-`+String(e.value),value:e.value,disabled:e.disabled},a(e.label),9,Wn))),128))],40,Un)],2))}}),[[`__scopeId`,`data-v-fc4ee90c`]]),Kn=[`id`],qn={class:`preview-meta`,role:`status`},Jn=[`id`],Yn={key:1},Xn={key:2,class:`why`},Zn=[`aria-label`],Qn=[`id`],$n={class:`ta-chat-options`},er={class:`where`},tr=[`disabled`],nr={class:`composer`},rr=[`placeholder`],ir=[`disabled`],ar=R(z({__name:`TaChat`,props:{sessions:{default:()=>[]},nature:{default:null},anchored:{type:Boolean,default:!1},starter:{default:``}},setup(e){let t=e,n=K([]),r=K(t.starter),o=K(``),s=K(!1),c=K(``),d=K();async function f(){await ce(),d.value?.scrollTo({top:d.value.scrollHeight})}async function p(){let e=r.value.trim();if(!s.value&&e){s.value=!0,n.value.push({role:`user`,text:e}),r.value=``,f();try{let r=await we.preview({text:e,history:n.value.slice(0,-1).slice(-12).map(({role:e,text:t})=>({role:e,text:t})),...t.nature?{nature:t.nature}:{},viewSession:o.value});r.reply?n.value.push({role:`assistant`,text:r.reply,bubbles:r.bubbles?.length?r.bubbles:[r.reply],note:[Te[r.choice]||r.choice,r.appraisal].filter(Boolean).join(` · `),why:r.reason}):n.value.push({role:`assistant`,text:l(`(TA 没有出声)`),note:Te[r.choice]||l(`没出声`),why:r.reason}),c.value=l(`{v} · 心情{v2} · {latency} ms`,{v:r.mode===`model`?l(`真实模型`):l(`本地样例(没有模型档案)`),v2:r.mood||l(`平静`),latency:r.latency})}catch(t){n.value.pop(),r.value=e,c.value=t.message}finally{s.value=!1,f()}}}function m(){n.value=[]}return(t,f)=>(H(),E(`div`,{class:`ta-chat`,id:e.anchored?`ta-preview`:void 0},[u(`p`,qn,a(c.value||i(l)(`试聊走真实链路:读取 TA 此刻的心智和记忆,但不写入,也不发 QQ。配置了模型时会消耗 Token。`)),1),u(`div`,{id:e.anchored?`previewMessages`:void 0,ref_key:`log`,ref:d,class:`ta-chat-log scroll-pane`},[!n.value.length&&!s.value?(H(),T(ye,{key:0,title:i(l)(`TA 会先理解,再决定说不说`),text:i(l)(`回应会显示 TA 的选择和当时的想法。`)},null,8,[`title`,`text`])):w(``,!0),(H(!0),E(C,null,M(n.value,(e,t)=>(H(),E(`article`,{key:t,class:G([`preview-bubble`,e.role===`assistant`?`bot`:`me`])},[e.bubbles?(H(!0),E(C,{key:0},M(e.bubbles,(e,t)=>(H(),E(`p`,{key:t},a(e),1))),128)):(H(),E(`p`,Yn,a(e.text),1)),e.note||e.why?(H(),E(`details`,Xn,[u(`summary`,null,a(e.note||i(l)(`为什么`)),1),u(`p`,null,a(e.why||i(l)(`没有留下理由。`)),1)])):w(``,!0)],2))),128)),s.value?(H(),E(`div`,{key:1,class:`typing`,"aria-label":i(l)(`TA 在想`)},[...f[2]||=[u(`i`,null,null,-1),u(`i`,null,null,-1),u(`i`,null,null,-1)]],8,Zn)):w(``,!0)],8,Jn),u(`form`,{id:e.anchored?`previewForm`:void 0,class:`ta-chat-form`,onSubmit:x(p,[`prevent`])},[u(`div`,$n,[u(`label`,er,[u(`span`,null,a(i(l)(`想象在这里`)),1),N(Gn,{modelValue:o.value,"onUpdate:modelValue":f[0]||=e=>o.value=e,name:`viewSession`,"aria-label":i(l)(`想象在这里`),options:[{value:``,label:i(l)(`一段新的私聊`)},...i(In)(e.sessions)]},null,8,[`modelValue`,`aria-label`,`options`])]),P(t.$slots,`options`,{},void 0,!0),u(`button`,{type:`button`,class:`text-button`,disabled:!n.value.length,onClick:m},a(i(l)(`清空`)),9,tr)]),u(`div`,nr,[Ce(u(`input`,{"onUpdate:modelValue":f[1]||=e=>r.value=e,name:`text`,placeholder:i(l)(`说一句试试…`),required:``,maxlength:`1000`,autocomplete:`off`},null,8,rr),[[S,r.value]]),u(`button`,{class:`primary`,disabled:s.value},a(s.value?i(l)(`TA 在想…`):i(l)(`说`)),9,ir)])],40,Qn)],8,Kn))}}),[[`__scopeId`,`data-v-235059b5`]]),or={class:`companion`},sr=[`aria-label`],cr=[`aria-label`],lr={class:`drawer-head`},ur={class:`drawer-title`},dr={class:`chip`,"data-tone":`quiet`},fr=[`aria-label`],pr={key:0,class:`companion-dock`},mr=[`aria-expanded`],hr=R(z({__name:`TaCompanion`,props:{hideOrb:{type:Boolean}},setup(e){let t=K(),n=B(()=>Q.data?.activity?.kind||`idle`),r=B(()=>Q.data?.name||`TA`);return F(()=>V.chatOpen,async e=>{e&&(await ce(),t.value?.querySelector(`input[name=text]`)?.focus())}),(o,s)=>(H(),E(`div`,or,[N(f,{name:`scrim`},{default:W(()=>[i(V).chatOpen?(H(),E(`button`,{key:0,class:`scrim`,type:`button`,"aria-label":i(l)(`收起聊天`),onClick:s[0]||=e=>i(V).chatOpen=!1},null,8,sr)):w(``,!0)]),_:1}),N(f,{name:`drawer`},{default:W(()=>[i(V).chatOpen?(H(),E(`section`,{key:0,ref_key:`drawer`,ref:t,class:`ta-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":i(l)(`和 {name} 聊聊(试聊)`,{name:r.value}),onKeydown:s[2]||=c(e=>i(V).chatOpen=!1,[`esc`])},[u(`header`,lr,[N(Dn,{mood:i(X),activity:n.value,size:42},null,8,[`mood`,`activity`]),u(`div`,ur,[u(`h2`,null,a(i(l)(`和 {name} 聊聊`,{name:r.value})),1),u(`span`,dr,a(i(l)(`试聊 · 什么都不写入`)),1)]),u(`button`,{class:`icon-button ghost`,"aria-label":i(l)(`收起聊天`),onClick:s[1]||=e=>i(V).chatOpen=!1},` ✕ `,8,fr)]),N(ar,{sessions:i(V).core?.sessions||[]},null,8,[`sessions`])],40,cr)):w(``,!0)]),_:1}),!e.hideOrb&&!i(V).chatOpen?(H(),E(`div`,pr,[u(`button`,{class:`companion-talk`,"aria-expanded":i(V).chatOpen,onClick:s[3]||=e=>i(V).chatOpen=!i(V).chatOpen},a(i(V).chatOpen?i(l)(`收起`):i(l)(`聊聊`)),9,mr),N(Dn,{mood:i(X),activity:n.value,size:44,interactive:``,"bubble-side":`left`,onOpenChat:s[4]||=e=>i(V).chatOpen=!0},null,8,[`mood`,`activity`])])):w(``,!0)]))}}),[[`__scopeId`,`data-v-038fa72e`]]),gr=[`aria-label`],_r=[`lang`,`aria-pressed`,`aria-label`,`title`,`data-locale`,`onClick`],vr=R(z({__name:`LocaleSwitch`,setup(e){return(e,n)=>(H(),E(`div`,{id:`locale`,class:`seg locale-switch`,role:`group`,"aria-label":i(l)(`语言`)},[(H(!0),E(C,null,M(i(t),e=>(H(),E(`button`,{key:e.code,type:`button`,lang:e.code===`zh`?`zh-CN`:`en`,class:G({active:i(m)===e.code}),"aria-pressed":i(m)===e.code,"aria-label":e.label,title:e.label,"data-locale":e.code,onClick:t=>i(o)(e.code)},a(e.short),11,_r))),128))],8,gr))}}),[[`__scopeId`,`data-v-bc942b38`]]),yr=[`aria-expanded`,`title`],br=[`data-mood`],xr={class:`rail-label`},Sr=[`aria-label`],Cr=[`aria-checked`],wr=[`data-mood`],Tr=[`data-theme-choice`,`aria-checked`,`onClick`],Er=[`data-mood`],Dr=R(z({__name:`ThemePicker`,props:{inline:{type:Boolean,default:!1}},setup(e){let t=K(!1),n=K();function r(e){Ge(e),t.value=!1}function o(e){t.value&&n.value&&!n.value.contains(e.target)&&!e.target.closest(`.theme-menu`)&&(t.value=!1)}return j(()=>document.addEventListener(`pointerdown`,o)),me(()=>document.removeEventListener(`pointerdown`,o)),(o,s)=>(H(),E(`div`,{ref_key:`root`,ref:n,class:G([`theme-picker`,{inline:e.inline}]),onKeydown:s[2]||=c(e=>t.value=!1,[`esc`])},[e.inline?w(``,!0):(H(),E(`button`,{key:0,class:`theme-toggle`,type:`button`,"aria-expanded":t.value,"aria-haspopup":`true`,title:i(Y).pinned?i(l)(`主题固定为「{v}」`,{v:i(J)[i(Y).pinned].label}):i(l)(`主题跟随 TA 的心情`),onClick:s[0]||=e=>t.value=!t.value},[u(`span`,{class:`swatch`,"data-mood":i(Y).pinned??i(X),"aria-hidden":`true`},null,8,br),u(`span`,xr,a(i(Y).pinned?i(l)(`固定:{v}`,{v:i(J)[i(Y).pinned].label}):i(l)(`跟随 TA · {v}`,{v:i(J)[i(X)].label})),1)],8,yr)),(H(),T(d,{to:`body`,disabled:e.inline},[N(f,{name:`pop`},{default:W(()=>[t.value||e.inline?(H(),E(`div`,{key:0,class:G([`theme-menu`,{"inline-menu":e.inline}]),role:`radiogroup`,"aria-label":i(l)(`界面主题`)},[u(`button`,{type:`button`,role:`radio`,"data-theme-choice":`auto`,"aria-checked":!i(Y).pinned,onClick:s[1]||=e=>r(null)},[u(`span`,{class:`swatch auto`,"data-mood":i(X),"aria-hidden":`true`},null,8,wr),u(`span`,null,[u(`b`,null,a(i(l)(`跟随 TA 的心情`)),1),u(`small`,null,a(i(l)(`现在是「{v}」`,{v:i(J)[i(X)].label})),1)])],8,Cr),(H(!0),E(C,null,M(i(Me),e=>(H(),E(`button`,{key:e,type:`button`,role:`radio`,"data-theme-choice":e,"aria-checked":i(Y).pinned===e,onClick:t=>r(e)},[u(`span`,{class:`swatch`,"data-mood":e,"aria-hidden":`true`},null,8,Er),u(`span`,null,[u(`b`,null,a(i(J)[e].label),1),u(`small`,null,a(i(J)[e].feel),1)])],8,Tr))),128))],10,Sr)):w(``,!0)]),_:1})],8,[`disabled`]))],34))}}),[[`__scopeId`,`data-v-4e5670d2`]]),Or=[`aria-label`],kr={class:`presence-detail`},Ar={class:`eyebrow`},jr={class:`mood-word`},Mr={class:`lede`},Nr={class:`row chips`},Pr=[`data-activity`],Fr={key:0,class:`chip`,"data-tone":`quiet`},Ir={key:1,class:`chip`,"data-tone":`quiet`},Lr={key:2,class:`chip`,"data-tone":`quiet`},Rr={class:`row actions`},zr=[`disabled`],Br=[`disabled`],Vr={class:`faint`},Hr={key:0,class:`aside-bit`},Ur={class:`eyebrow`},Wr={key:1,class:`aside-bit`},Gr={class:`eyebrow`},Kr={key:0},qr={key:2,class:`aside-bit`},Jr={class:`eyebrow`},Yr={key:0},Xr=R(z({__name:`NowStatusDock`,setup(t){let n=B(()=>Q.data),r=K(!1),o=B(()=>Q.data),s=B(()=>o.value?.affect||n.value?.affect||{}),c=B(()=>o.value?.activity?.kind||`idle`),d=B(()=>o.value?.expecting?.[0]||null),f=B(()=>r.value||!!n.value?.busy||[`solitude`,`diary`,`review`,`night`].includes(c.value));async function p(e){r.value=!0;try{let t=await we[e]();U(t.reason||l(`完成了`),t.status===`error`)}catch(e){U(e.message,!0)}finally{r.value=!1,await Xe()}}return(t,r)=>(H(),E(`aside`,{class:`presence-dock`,"aria-label":i(l)(`TA 的此刻状态`)},[u(`div`,kr,[u(`span`,Ar,[e(a(i(l)(`第 {v} 天`,{v:o.value?.dayOfLife??n.value?.dayOfLife??1}))+` `,1),o.value?.clock?(H(),E(C,{key:0},[e(` · `+a(o.value.clock.period)+` `+a(o.value.clock.local.slice(11)),1)],64)):w(``,!0)]),u(`h2`,jr,a(s.value.mood||i(l)(`平静`)),1),u(`p`,Mr,a(i(bt)(s.value)||i(l)(`没有特别牵动 TA 的事,心情慢慢回到平常。`)),1),u(`div`,Nr,[u(`span`,{class:`chip activity-chip`,"data-activity":c.value},a(i(St)(o.value)),9,Pr),i(xt)(s.value)?(H(),E(`span`,Fr,a(i(l)(`这阵子 · {v}`,{v:i(xt)(s.value)})),1)):w(``,!0),s.value.energyLabel?(H(),E(`span`,Ir,a(i(l)(`精力 · {energyLabel}`,{energyLabel:s.value.energyLabel})),1)):w(``,!0),n.value?.nature?.rhythm?.enabled?(H(),E(`span`,Lr,a(i(l)(`{wake} 醒 / {sleep} 睡`,{wake:n.value.nature.rhythm.wake,sleep:n.value.nature.rhythm.sleep})),1)):w(``,!0)]),u(`div`,Rr,[o.value?.currentLife?.current?(H(),E(`button`,{key:0,class:`text-button`,onClick:r[0]||=e=>i(I)(`time`)},a(i(l)(`看看进度`)),1)):w(``,!0),u(`button`,{class:`primary`,onClick:r[1]||=e=>i(V).chatOpen=!0},a(i(l)(`和 TA 聊聊`)),1),u(`button`,{disabled:f.value,onClick:r[2]||=e=>p(`reflect`)},a(f.value?i(l)(`TA 正在想…`):i(l)(`让 TA 独处一会儿`)),9,zr),u(`button`,{disabled:f.value,onClick:r[3]||=e=>p(`review`)},a(i(l)(`写下今天的日记`)),9,Br)]),u(`small`,Vr,a(n.value?.reason||i(l)(`安静下来时,TA 会自己独处。`)),1),o.value?.lastWords?(H(),E(`div`,Hr,[u(`span`,Ur,a(i(l)(`最近说`)),1),u(`p`,null,`“`+a(o.value.lastWords.text)+`”`,1),u(`small`,null,a(i(Fn)({name:o.value.lastWords.sessionName,id:o.value.lastWords.session}))+` · `+a(i(jn)(o.value.lastWords.time,o.value.now)),1)])):w(``,!0),o.value?.thought?(H(),E(`div`,Wr,[u(`span`,Gr,a(i(l)(`放在心上`)),1),u(`p`,null,a(o.value.thought.content),1),o.value.thought.when?(H(),E(`small`,Kr,a(o.value.thought.when),1)):w(``,!0)])):w(``,!0),d.value?(H(),E(`div`,qr,[u(`span`,Jr,a(i(l)(`在等`)),1),u(`p`,null,a(d.value.name?`${d.value.name}:`:``)+a(d.value.content),1),d.value.when?(H(),E(`small`,Yr,a(d.value.when),1)):w(``,!0)])):w(``,!0)])],8,Or))}}),[[`__scopeId`,`data-v-4625711b`]]),Zr=[`onKeydown`],Qr=[`aria-label`],$r={key:0},ei=[`type`,`placeholder`,`autocomplete`],ti={class:`row end`},ni=R(z({__name:`Confirm`,setup(e){let t=B(()=>h.queue[0]||null),r=K(``),i=K(),o=K(),s=null;F(t,async(e,t)=>{if(e&&!t&&(s=document.activeElement),!e){s?.focus?.(),s=null;return}r.value=e.value,await ce(),e.kind===`prompt`?i.value?.focus():o.value?.focus()});function l(){t.value&&le(t.value.kind===`prompt`?r.value.trim():`ok`)}function p(){le(null)}return(e,s)=>(H(),T(d,{to:`body`},[N(f,{name:`dialog`},{default:W(()=>[t.value?(H(),E(`div`,{key:0,class:`dialog-layer`,onKeydown:c(x(p,[`prevent`]),[`esc`])},[u(`form`,{class:`dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-label":t.value.title,onSubmit:x(l,[`prevent`])},[s[1]||=u(`span`,{class:`dialog-orb`,"aria-hidden":`true`},null,-1),u(`h2`,null,a(t.value.title),1),t.value.message?(H(),E(`p`,$r,a(t.value.message),1)):w(``,!0),t.value.kind===`prompt`?Ce((H(),E(`input`,{key:1,ref_key:`input`,ref:i,"onUpdate:modelValue":s[0]||=e=>r.value=e,type:t.value.secret?`password`:`text`,placeholder:t.value.placeholder,autocomplete:t.value.secret?`current-password`:`off`},null,8,ei)),[[n,r.value]]):w(``,!0),u(`div`,ti,[u(`button`,{type:`button`,class:`dialog-cancel ghost`,onClick:p},a(t.value.cancelText),1),u(`button`,{ref_key:`confirmButton`,ref:o,type:`submit`,class:G([`dialog-confirm`,t.value.danger?`danger`:`primary`])},a(t.value.confirmText),3)])],40,Qr)],40,Zr)):w(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-2339e49c`]]),ri={class:`icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},ii={key:6,d:`M4.5 19.5h15M6 19.5V6.5h3v13M10.5 19.5V4.5h3v15M15.2 19.2l-.6-11.8 2.9-.4 1.2 11.8`},ai={key:14,d:`M12 5.5v13M5.5 12h13`},oi={key:15,d:`M14.5 6 8.5 12l6 6`},si={key:19,cx:`12`,cy:`12`,r:`7`},ci=R(z({__name:`Icon`,props:{name:{}},setup(e){return(t,n)=>(H(),E(`svg`,ri,[e.name===`now`?(H(),E(C,{key:0},[n[0]||=u(`path`,{d:`M12 4.5c4.2 0 7 2.9 7 7.2 0 4.6-3 7.8-7 7.8s-7-3.2-7-7.8c0-4.3 2.8-7.2 7-7.2Z`},null,-1),n[1]||=u(`path`,{d:`M9.4 11.4v.6M14.6 11.4v.6M10 15c1.2.9 2.8.9 4 0`},null,-1)],64)):e.name===`time`?(H(),E(C,{key:1},[n[2]||=u(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1),n[3]||=u(`path`,{d:`M12 7v5l3 2`},null,-1)],64)):e.name===`chats`?(H(),E(C,{key:2},[n[4]||=u(`path`,{d:`M4.5 6.5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H11l-4 3.5v-3.5h-.5a2 2 0 0 1-2-2v-7Z`},null,-1),n[5]||=u(`path`,{d:`M8.5 10h.01M12 10h.01M15.5 10h.01`},null,-1)],64)):e.name===`heart`?(H(),E(C,{key:3},[n[6]||=u(`path`,{d:`M12 3.5l1.6 4.4 4.6.2-3.6 2.9 1.3 4.5L12 12.9l-3.9 2.6 1.3-4.5-3.6-2.9 4.6-.2L12 3.5Z`},null,-1),n[7]||=u(`path`,{d:`M5 19.5h.01M19 18.5h.01M18.5 4.5h.01`},null,-1)],64)):e.name===`people`?(H(),E(C,{key:4},[n[8]||=_(`<circle cx="12" cy="12" r="2.6" data-v-69e2db74></circle><circle cx="5.2" cy="7.2" r="1.7" data-v-69e2db74></circle><circle cx="18.6" cy="8.4" r="1.4" data-v-69e2db74></circle><circle cx="16.8" cy="18" r="1.9" data-v-69e2db74></circle><path d="M6.6 8.4l3.3 2.1M17.3 9.1l-3 1.7M15.6 16.4l-1.7-2.3" data-v-69e2db74></path>`,5)],64)):e.name===`life`?(H(),E(C,{key:5},[n[9]||=u(`path`,{d:`M12 6.5c-2-1.4-4.6-1.8-7.5-1.5v12.6c2.9-.3 5.5.1 7.5 1.5 2-1.4 4.6-1.8 7.5-1.5V5c-2.9-.3-5.5.1-7.5 1.5Z`},null,-1),n[10]||=u(`path`,{d:`M12 6.5v12.6`},null,-1)],64)):e.name===`memory`?(H(),E(`path`,ii)):e.name===`nature`?(H(),E(C,{key:7},[n[11]||=u(`path`,{d:`M12 20v-7.5`},null,-1),n[12]||=u(`path`,{d:`M12 12.5c0-4 2.6-6.8 6.8-7-.1 4.2-2.8 7-6.8 7Z`},null,-1),n[13]||=u(`path`,{d:`M12 14.5c0-3-2-5.1-5.3-5.2.1 3.1 2.2 5.2 5.3 5.2Z`},null,-1)],64)):e.name===`system`?(H(),E(C,{key:8},[n[14]||=u(`circle`,{cx:`12`,cy:`12`,r:`3`},null,-1),n[15]||=u(`path`,{d:`M12 3.5v2.3M12 18.2v2.3M20.5 12h-2.3M5.8 12H3.5M18 6l-1.6 1.6M7.6 16.4 6 18M18 18l-1.6-1.6M7.6 7.6 6 6`},null,-1)],64)):e.name===`more`?(H(),E(C,{key:9},[n[16]||=u(`circle`,{cx:`6`,cy:`12`,r:`1.3`},null,-1),n[17]||=u(`circle`,{cx:`12`,cy:`12`,r:`1.3`},null,-1),n[18]||=u(`circle`,{cx:`18`,cy:`12`,r:`1.3`},null,-1)],64)):e.name===`refresh`?(H(),E(C,{key:10},[n[19]||=u(`path`,{d:`M19 12a7 7 0 1 1-2.1-5`},null,-1),n[20]||=u(`path`,{d:`M19 4.5V9h-4.5`},null,-1)],64)):e.name===`send`?(H(),E(C,{key:11},[n[21]||=u(`path`,{d:`M4.5 11.8 19.5 5l-4.8 14.5-3.2-6.2-7-1.5Z`},null,-1),n[22]||=u(`path`,{d:`m11.5 13.3 3.4-3.6`},null,-1)],64)):e.name===`palette`?(H(),E(C,{key:12},[n[23]||=u(`path`,{d:`M12 4a8 8 0 1 0 0 16c1.2 0 1.8-.8 1.8-1.6 0-1.3-1.3-1.6-1.3-2.7 0-.9.7-1.5 1.7-1.5H16a4 4 0 0 0 4-4C20 6.9 16.4 4 12 4Z`},null,-1),n[24]||=u(`path`,{d:`M8 11h.01M10 7.8h.01M14 7.8h.01M16.2 11h.01`},null,-1)],64)):e.name===`search`?(H(),E(C,{key:13},[n[25]||=u(`circle`,{cx:`11`,cy:`11`,r:`6`},null,-1),n[26]||=u(`path`,{d:`m20 20-4.5-4.5`},null,-1)],64)):e.name===`plus`?(H(),E(`path`,ai)):e.name===`back`?(H(),E(`path`,oi)):e.name===`motion`?(H(),E(C,{key:16},[n[27]||=u(`path`,{d:`M4 14c2.5-4 5.5-4 8 0s5.5 4 8 0`},null,-1),n[28]||=u(`path`,{d:`M4 9c2.5-4 5.5-4 8 0s5.5 4 8 0`},null,-1)],64)):e.name===`plugins`?(H(),E(C,{key:17},[n[29]||=u(`path`,{d:`M8 7h8v4H8zM6 11h12v6H6z`},null,-1),n[30]||=u(`path`,{d:`M9 11V7M15 11V7M12 14v3`},null,-1)],64)):e.name===`guide`?(H(),E(C,{key:18},[n[31]||=u(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1),n[32]||=u(`path`,{d:`M9.8 9.6a2.3 2.3 0 1 1 3.3 2.1c-.7.3-1.1.9-1.1 1.6v.3M12 16.5h.01`},null,-1)],64)):(H(),E(`circle`,si))]))}}),[[`__scopeId`,`data-v-69e2db74`]]),li=[`aria-label`],ui={class:`sheet-head`},di={key:0,class:`eyebrow`},fi=[`aria-label`],pi={class:`sheet-body`},mi=R(z({__name:`Sheet`,props:{open:{type:Boolean},title:{},eyebrow:{default:``},width:{default:`520px`}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,o=K(),s=K(!0),c=B(()=>n.open&&s.value);re(()=>{s.value=!0}),ve(()=>{s.value=!1});let p=null;function m(e){e.key===`Escape`&&r(`close`)}return F(c,async e=>{e?(p=document.activeElement,document.addEventListener(`keydown`,m),await ce(),o.value?.focus()):(document.removeEventListener(`keydown`,m),p?.focus?.())},{immediate:!0}),me(()=>document.removeEventListener(`keydown`,m)),(t,n)=>(H(),T(d,{to:`body`},[N(f,{name:`sheet`},{default:W(()=>[c.value?(H(),E(`div`,{key:0,class:`sheet-layer`,onClick:n[1]||=x(e=>r(`close`),[`self`])},[u(`aside`,{ref_key:`panel`,ref:o,class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title,tabindex:`-1`,style:b({"--sheet-w":e.width})},[u(`header`,ui,[u(`div`,null,[e.eyebrow?(H(),E(`span`,di,a(e.eyebrow),1)):w(``,!0),u(`h2`,null,a(e.title),1)]),u(`button`,{class:`icon-button ghost sheet-close`,"aria-label":i(l)(`关闭`),onClick:n[0]||=e=>r(`close`)},` ✕ `,8,fi)]),u(`div`,pi,[P(t.$slots,`default`,{},void 0,!0)])],12,li)])):w(``,!0)]),_:3})]))}}),[[`__scopeId`,`data-v-2c804a0d`]]);function hi(e,t){let n=!1,r=!1,i=!1,a=B(()=>V.page===e),o=()=>{if(a.value){if(r){i=!0;return}r=!0,t().catch(e=>U(e.message,!0)).finally(()=>{r=!1,i&&(i=!1,o())})}};return j(o),re(()=>{n&&o(),n=!0}),F(()=>[V.tick,V.pulse],o),a}var gi={class:`card`},_i={key:0,class:`card-head`},vi={key:0,class:`eyebrow`},yi={key:1},bi={key:2},xi={key:0,class:`row`},Si=R(z({__name:`Card`,props:{title:{},eyebrow:{},sub:{}},setup(e){return(t,n)=>(H(),E(`section`,gi,[e.title||e.eyebrow||t.$slots.actions?(H(),E(`header`,_i,[u(`div`,null,[e.eyebrow?(H(),E(`span`,vi,a(e.eyebrow),1)):w(``,!0),e.title?(H(),E(`h2`,yi,a(e.title),1)):w(``,!0),e.sub?(H(),E(`p`,bi,a(e.sub),1)):w(``,!0)]),t.$slots.actions?(H(),E(`div`,xi,[P(t.$slots,`actions`,{},void 0,!0)])):w(``,!0)])):w(``,!0),P(t.$slots,`default`,{},void 0,!0)]))}}),[[`__scopeId`,`data-v-2c88637b`]]),Ci={class:`meter-row`},wi={class:`meter-label`},Ti=[`aria-label`,`aria-valuenow`],Ei={class:`meter-value`},Di=R(z({__name:`Meter`,props:{label:{},value:{},text:{},warn:{type:Boolean}},setup(e){let t=e,n=B(()=>Math.round(Math.max(0,Math.min(1,Number(t.value)||0))*100));return(t,r)=>(H(),E(`div`,Ci,[u(`span`,wi,a(e.label),1),u(`div`,{class:G([`meter`,{warn:e.warn}]),role:`meter`,"aria-label":e.label,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-valuenow":n.value},[u(`i`,{style:b({width:n.value+`%`})},null,4)],10,Ti),u(`b`,Ei,a(e.text??n.value+`%`),1)]))}}),[[`__scopeId`,`data-v-4f51518c`]]),Oi=[`aria-label`],ki=[`data-tab`,`aria-selected`,`tabindex`,`onClick`],Ai={key:0,class:`count`},ji=R(z({__name:`Tabs`,props:_e({items:{},label:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(t){let n=se(t,`modelValue`);function r(e,t){let r=t.findIndex(e=>e.key===n.value),i=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!i)return;e.preventDefault();let a=t[(r+i+t.length)%t.length];n.value=a.key;let o=e.currentTarget.closest(`[role="tablist"]`);requestAnimationFrame(()=>o?.querySelector(`[data-tab="${a.key}"]`)?.focus())}return(i,o)=>(H(),E(`div`,{class:`seg tabs`,role:`tablist`,"aria-label":t.label},[(H(!0),E(C,null,M(t.items,i=>(H(),E(`button`,{key:i.key,type:`button`,role:`tab`,"data-tab":i.key,"aria-selected":n.value===i.key,tabindex:n.value===i.key?0:-1,onClick:e=>n.value=i.key,onKeydown:o[0]||=e=>r(e,t.items)},[e(a(i.label),1),i.count!==void 0&&i.count!==``?(H(),E(`small`,Ai,a(i.count),1)):w(``,!0)],40,ki))),128))],8,Oi))}}),[[`__scopeId`,`data-v-e8e03a3b`]]),Mi=[`aria-label`],Ni=[`data-tone`],Pi={class:`entry`},Fi=R(z({__name:`Timeline`,props:{items:{},label:{}},setup(e){return(t,n)=>(H(),E(`ol`,{class:`timeline`,"aria-label":e.label},[(H(!0),E(C,null,M(e.items,(e,r)=>(H(),E(`li`,{key:e.id??r,"data-tone":e.tone||void 0},[n[0]||=u(`span`,{class:`stem`,"aria-hidden":`true`},[u(`i`)],-1),u(`div`,Pi,[P(t.$slots,`default`,{item:e,index:r},void 0,!0)])],8,Ni))),128))],8,Mi))}}),[[`__scopeId`,`data-v-e79d18a9`]]),Ii=[`aria-label`],Li={class:`choice`},Ri={class:`row`},zi=[`disabled`],Bi=[`disabled`],Vi={class:`choice`},Hi={class:`row`},Ui=[`disabled`],Wi=[`disabled`],Gi={key:0,class:`opacity`},Ki=[`value`,`aria-label`],qi=R(z({__name:`WallpaperPicker`,props:{open:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let n=t,r=K(),o=K(),s=K(``);async function c(e,t){let n=t.target,r=n.files?.[0];if(n.value=``,r){s.value=e;try{e===`hero`?await mt(r):await gt(r),U(l(e===`hero`?`中间这张已换上`:`后面的壁纸已换上`))}catch(e){U(e.message,!0)}finally{s.value=``}}}async function d(e){s.value=e;try{e===`hero`?await ht():await _t(),U(l(`已恢复原来的壁纸`))}catch(e){U(e.message,!0)}finally{s.value=``}}return(t,f)=>e.open?(H(),E(`section`,{key:0,class:`wallpaper-picker`,"aria-label":i(l)(`换壁纸`)},[u(`header`,null,[u(`b`,null,a(i(l)(`换壁纸`)),1),u(`button`,{type:`button`,class:`text-button`,onClick:f[0]||=e=>n(`close`)},a(i(l)(`收起`)),1)]),u(`div`,Li,[u(`span`,null,a(i(l)(`中间这张`)),1),u(`div`,Ri,[u(`button`,{type:`button`,disabled:!!s.value,onClick:f[1]||=e=>r.value?.click()},a(s.value===`hero`?i(l)(`处理中…`):i(l)(`选择图片`)),9,zi),u(`button`,{type:`button`,disabled:!!s.value,onClick:f[2]||=e=>d(`hero`)},a(i(l)(`恢复默认`)),9,Bi)])]),u(`div`,Vi,[u(`span`,null,a(i(l)(`后面的大壁纸`)),1),u(`div`,Hi,[u(`button`,{type:`button`,disabled:!!s.value,onClick:f[3]||=e=>o.value?.click()},a(s.value===`sky`?i(l)(`处理中…`):i(l)(`选择图片`)),9,Ui),u(`button`,{type:`button`,disabled:!!s.value,onClick:f[4]||=e=>d(`sky`)},a(i(l)(`恢复默认`)),9,Wi)]),i($).sky?(H(),E(`label`,Gi,[u(`span`,null,a(i(l)(`透明度 {v}%`,{v:Math.round(i($).skyOpacity*100)})),1),u(`input`,{type:`range`,min:`0.08`,max:`0.82`,step:`0.02`,value:i($).skyOpacity,"aria-label":i(l)(`后面壁纸的透明度`),onInput:f[5]||=e=>i(vt)(Number(e.target.value))},null,40,Ki),u(`small`,null,a(i(l)(`越透明,心情的颜色越清楚。`)),1)])):w(``,!0)]),u(`input`,{ref_key:`heroInput`,ref:r,"data-wallpaper":`hero`,type:`file`,accept:`image/*`,hidden:``,onChange:f[6]||=e=>c(`hero`,e)},null,544),u(`input`,{ref_key:`skyInput`,ref:o,"data-wallpaper":`sky`,type:`file`,accept:`image/*`,hidden:``,onChange:f[7]||=e=>c(`sky`,e)},null,544)],8,Ii)):w(``,!0)}}),[[`__scopeId`,`data-v-01d9dcb6`]]),Ji=`luckytri-home-wallpaper-position-v3`;function Yi(e,t){try{let n=JSON.parse(localStorage.getItem(e)||`null`);return!n||!Number.isFinite(n.x)||!Number.isFinite(n.y)?null:{x:Math.min(t.x[1],Math.max(t.x[0],n.x)),y:Math.min(t.y[1],Math.max(t.y[0],n.y))}}catch{return null}}function Xi(e,t,n){try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return U(n,!0),!1}}function Zi(){let e=K(!1),t=K(null),n=K(null),r=K(Yi(Ji,{x:[0,100],y:[0,100]})||{x:50,y:50}),i=B(()=>({objectPosition:`${r.value.x}% ${r.value.y}%`})),a=K(null);function o(e){let t=e.currentTarget,i=n.value;if(!i?.naturalWidth||!i.naturalHeight)return;let o=t.getBoundingClientRect(),s=Math.max(o.width/i.naturalWidth,o.height/i.naturalHeight);a.value={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startPositionX:r.value.x,startPositionY:r.value.y,overflowX:Math.max(0,i.naturalWidth*s-o.width),overflowY:Math.max(0,i.naturalHeight*s-o.height)},t.setPointerCapture(e.pointerId)}function s(e){let t=a.value;t&&t.pointerId===e.pointerId&&(t.overflowX>0&&(r.value.x=Math.min(100,Math.max(0,t.startPositionX-(e.clientX-t.startX)/t.overflowX*100))),t.overflowY>0&&(r.value.y=Math.min(100,Math.max(0,t.startPositionY-(e.clientY-t.startY)/t.overflowY*100))))}function c(e){a.value?.pointerId===e.pointerId&&(a.value=null)}function u(){r.value={x:50,y:50}}function d(){Xi(Ji,r.value,l(`浏览器没有保存这次构图`))&&(e.value=!1,a.value=null,U(l(`首页壁纸构图已记住`)))}return{adjusting:e,heroRef:t,imageRef:n,pictureStyle:i,beginPictureDrag:o,movePicture:s,endPictureDrag:c,resetPicture:u,finishPicture:d}}var Qi={class:`page now`},$i={class:`now-presentation`},ea={class:`wallpaper-layer`,"aria-hidden":`true`},ta=[`src`],na=[`aria-label`],ra={class:`wallpaper-tip`},ia={class:`wallpaper-controls`},aa={class:`wallpaper-tip-inline`},oa={class:`notes`},sa={class:`note words`},ca={class:`eyebrow`},la={key:0,class:`recent-list`},ua={class:`quote`},da={key:1,class:`muted`},fa={class:`note thought`},pa={class:`eyebrow`},ma={key:1,class:`muted`},ha={key:2,class:`will-line`},ga={key:3},_a={key:4,class:`muted`},va={key:5},ya={class:`note ahead`},ba={class:`eyebrow`},xa={key:0,class:`list`},Sa={key:1,class:`muted`},Ca={class:`now-grid`},wa={class:`today-scroll scroll-pane`},Ta={class:`entry-head`},Ea={key:0},Da={key:1},Oa={key:2},ka={key:3},Aa={key:4},ja={key:5,class:`chip`,"data-tone":`quiet`},Ma={key:6,class:`chip`,"data-tone":`quiet`},Na={key:0},Pa={key:0},Fa={key:1,class:`muted`},Ia={key:2},La={key:3,class:`muted`},Ra={key:4},za={key:0},Ba={class:`stack side`},Va={class:`stack tight`},Ha={class:`faint ledger-note`},Ua={key:0,class:`list`},Wa={class:`grow`},Ga=[`data-tone`],Ka={key:1,class:`muted small-text`},qa={class:`counts`},Ja=R(z({__name:`NowPage`,setup(t){let n=ee(ne(`/mind`)||null),r=ee(ne(`/mind/today`)||null),o=K(`all`),s=K(!1),{adjusting:c,heroRef:d,imageRef:f,pictureStyle:p,beginPictureDrag:m,movePicture:h,endPictureDrag:_,resetPicture:v,finishPicture:y}=Zi(),te=g([{id:`conversation`,label:L(`对话`)},{id:`inner`,label:L(`独处与日记`)},{id:`upkeep`,label:L(`整理记忆`)}]),S=B(()=>Q.data),D=B(()=>{let e=S.value?.recentWords?.filter(e=>e.text?.trim())||[];return e.length?e.slice(0,3):S.value?.lastWords?[S.value.lastWords]:[]}),O=B(()=>S.value?.clock?.timeZone||n.value?.clock?.timeZone||`Asia/Shanghai`),re=B(()=>{let e=r.value?.items||[],t=[];for(let[n,r]of e.entries()){let e=r.type===`choice`||r.type===`glance`?`talk`:r.type===`feeling`?`feel`:`inner`;if(o.value!==`all`&&o.value!==e)continue;let i=t[t.length-1];if(r.type===`glance`&&i?.type===`glance`){i.count+=1;let e=Fn({name:r.sessionName,id:r.session});i.places.includes(e)||i.places.push(e);continue}t.push({...r,id:`${r.type}-${r.time}-${n}`,tone:r.type===`glance`||r.type===`choice`&&r.choice===`silent`?`quiet`:r.type===`feeling`?r.valence>=0?`warm`:`night`:r.type===`run`?`night`:`glow`,count:1,places:r.type===`glance`?[Fn({name:r.sessionName,id:r.session})]:[]})}return t}),k=B(()=>{let e=r.value?.items||[];return{all:e.length,talk:e.filter(e=>e.type===`choice`||e.type===`glance`).length,feel:e.filter(e=>e.type===`feeling`).length,inner:e.filter(e=>e.type===`run`||e.type===`ahead`).length}}),A=B(()=>n.value?.budget?.usage||{}),j=B(()=>n.value?.budget?.limits||{}),ie=B(()=>(S.value?.expecting||[]).filter(e=>e.content?.trim()).slice(0,5));function P(e){let t=j.value[e];return t?(A.value[e]||0)/t:A.value.total?(A.value[e]||0)/A.value.total:0}let ae=0;async function F(){let e=++ae,[t,i]=await Promise.all([we.overview(),we.today()]);e===ae&&(n.value=t,r.value=i)}return hi(`now`,F),(t,g)=>(H(),E(`div`,Qi,[u(`div`,$i,[u(`section`,{ref_key:`heroRef`,ref:d,class:G([`now-hero`,{"wallpaper-adjusting":i(c)}])},[u(`div`,ea,[u(`img`,{ref_key:`imageRef`,ref:f,src:i($).hero,style:b(i(p)),alt:``,draggable:`false`},null,12,ta)]),i(c)?(H(),E(`div`,{key:0,class:`wallpaper-drag-layer`,role:`application`,"aria-label":i(l)(`拖动调整首页壁纸构图`),onPointerdown:g[0]||=x((...e)=>i(m)&&i(m)(...e),[`prevent`]),onPointermove:g[1]||=x((...e)=>i(h)&&i(h)(...e),[`prevent`]),onPointerup:g[2]||=(...e)=>i(_)&&i(_)(...e),onPointercancel:g[3]||=(...e)=>i(_)&&i(_)(...e),onLostpointercapture:g[4]||=(...e)=>i(_)&&i(_)(...e)},[u(`span`,ra,a(i(l)(`按住并拖动图片,调整人物位置`)),1)],40,na)):w(``,!0),u(`div`,ia,[i(c)?(H(),E(C,{key:0},[u(`span`,aa,a(i(l)(`拖动背景调整构图`)),1),u(`button`,{type:`button`,onClick:g[5]||=(...e)=>i(v)&&i(v)(...e)},a(i(l)(`恢复默认`)),1),u(`button`,{type:`button`,class:`primary`,onClick:g[6]||=(...e)=>i(y)&&i(y)(...e)},a(i(l)(`完成`)),1)],64)):(H(),E(`button`,{key:1,type:`button`,onClick:g[7]||=e=>c.value=!0},a(i(l)(`调整构图`)),1)),i(c)?w(``,!0):(H(),E(`button`,{key:2,type:`button`,onClick:g[8]||=e=>s.value=!s.value},a(i(l)(`换壁纸`)),1))]),N(qi,{open:s.value&&!i(c),onClose:g[9]||=e=>s.value=!1},null,8,[`open`])],2)]),u(`section`,oa,[u(`article`,sa,[u(`span`,ca,a(i(l)(`TA 最近说`)),1),D.value.length?(H(),E(`ul`,la,[(H(!0),E(C,null,M(D.value,(e,t)=>(H(),E(`li`,{key:`${e.time}-${t}`},[u(`p`,ua,`“`+a(e.text)+`”`,1),u(`small`,null,a(i(Fn)({name:e.sessionName,id:e.session}))+` · `+a(i(jn)(e.time,S.value?.now)),1)]))),128))])):(H(),E(`p`,da,a(i(l)(`TA 还没在哪里开过口。`)),1))]),u(`article`,fa,[u(`span`,pa,a(i(l)(`放在心上`)),1),S.value?.thought?(H(),E(C,{key:0},[u(`p`,null,a(S.value.thought.content),1),u(`small`,null,a(S.value.thought.when),1)],64)):(H(),E(`p`,ma,a(i(l)(`心里暂时没有挂着的事。`)),1)),S.value?.will?(H(),E(`p`,ha,a(i(l)(`正在为自己而活:{content}`,{content:S.value.will.content})),1)):w(``,!0),S.value?.will?.touched?(H(),E(`small`,ga,a(i(l)(`被别人的话碰到过 {touched} 次,上次{v}`,{touched:S.value.will.touched,v:S.value.will.lastSpoke?i(l)(`出了声`):i(l)(`没出声`)})),1)):w(``,!0),S.value?.meaning?(H(),E(`p`,_a,[e(a(i(l)(`上次相遇:{text}`,{text:S.value.meaning.text})),1),S.value.meaning.spoke?w(``,!0):(H(),E(C,{key:0},[e(a(i(l)(`(没出声)`)),1)],64))])):w(``,!0),S.value?.meaning?.when&&!S.value.meaning.recent?(H(),E(`small`,va,a(S.value.meaning.when),1)):w(``,!0),u(`button`,{class:`text-button`,onClick:g[10]||=e=>i(I)(`heart`,`notes`)},a(i(l)(`看看 TA 的便签`)),1)]),u(`article`,ya,[u(`span`,ba,a(i(l)(`在等的事`)),1),ie.value.length?(H(),E(`ul`,xa,[(H(!0),E(C,null,M(ie.value,e=>(H(),E(`li`,{key:e.id},[u(`b`,null,a(e.when),1),u(`span`,null,a(e.name?`${e.name}:`:``)+a(e.content),1),u(`small`,null,a(i(ke)[e.kind]||e.kind),1)]))),128))])):(H(),E(`p`,Sa,a(i(l)(`这几天没有 TA 特别在等的事。`)),1)),u(`button`,{class:`text-button`,onClick:g[11]||=e=>i(I)(`life`,`ahead`)},a(i(l)(`约定与期待`)),1)])]),u(`section`,Ca,[N(Si,{class:`today`,title:i(l)(`今天的 TA`),sub:r.value?i(l)(`{v},按时间排在一起`,{v:i(kn)(r.value.day)}):``},{actions:W(()=>[N(ji,{modelValue:o.value,"onUpdate:modelValue":g[12]||=e=>o.value=e,label:i(l)(`筛选今天的事`),items:[{key:`all`,label:i(l)(`全部`),count:k.value.all},{key:`talk`,label:i(l)(`开口与沉默`),count:k.value.talk},{key:`feel`,label:i(l)(`心情`),count:k.value.feel},{key:`inner`,label:i(l)(`独处与日记`),count:k.value.inner}]},null,8,[`modelValue`,`label`,`items`])]),default:W(()=>[u(`div`,wa,[re.value.length?(H(),T(Fi,{key:0,items:re.value,label:i(l)(`今天的 TA`)},{default:W(({item:t})=>[u(`div`,Ta,[u(`time`,null,a(i(On)(t.time,O.value)),1),t.type===`choice`?(H(),E(`b`,Ea,a(i(Te)[t.choice]||t.choice),1)):t.type===`glance`?(H(),E(`b`,Da,a(t.count>1?i(l)(`扫了 {count} 眼`,{count:t.count}):i(l)(`扫了一眼`)),1)):t.type===`feeling`?(H(),E(`b`,Oa,a(i(l)(`心情 · {feeling}`,{feeling:t.feeling})),1)):t.type===`run`?(H(),E(`b`,ka,a(i(Oe)[t.kind]||t.kind)+` · `+a(i(Ee)[t.status]||t.status),1)):(H(),E(`b`,Aa,a(i(l)(`约定 · {v}`,{v:i(De)[t.status]||t.status})),1)),t.type===`choice`?(H(),E(`span`,ja,a(i(Fn)({name:t.sessionName})),1)):t.type===`glance`?(H(),E(`span`,Ma,a(t.places.join(`、`)),1)):w(``,!0)]),t.type===`choice`?(H(),E(`p`,Na,[e(a(t.reason),1),t.appraisal?(H(),E(`small`,Pa,` · `+a(t.appraisal),1)):w(``,!0)])):t.type===`glance`?(H(),E(`p`,Fa,a(t.reason||i(l)(`没什么需要 TA 细看的`)),1)):t.type===`feeling`?(H(),E(`p`,Ia,[e(a(t.cause||i(l)(`说不清为什么`))+` `,1),u(`small`,null,`· `+a(i(Ae)[t.origin]||t.origin),1)])):t.type===`run`?(H(),E(`p`,La,a(t.reason),1)):(H(),E(`p`,Ra,[e(a(t.content),1),t.note?(H(),E(`small`,za,` · `+a(t.note),1)):w(``,!0)]))]),_:1},8,[`items`,`label`])):(H(),T(ye,{key:1,title:i(l)(`今天还很安静`),text:i(l)(`TA 扫一眼、开口、没出声、心情变化、独处、写日记,都会按时间排在这里。`)},null,8,[`title`,`text`]))])]),_:1},8,[`title`,`sub`]),u(`div`,Ba,[N(Si,{title:i(l)(`今天的注意力`),eyebrow:i(l)(`这一天`)},{default:W(()=>[u(`div`,Va,[(H(!0),E(C,null,M(i(te),e=>(H(),T(Di,{key:e.id,label:e.label,value:P(e.id),warn:!!j.value[e.id]&&P(e.id)>=.8,text:i(Mn)(A.value[e.id])},null,8,[`label`,`value`,`warn`,`text`]))),128))]),u(`p`,Ha,a(i(l)(`共 {v} 次调用、{v2} Token,缓存命中 {v3}。 {v4}`,{v:i(Mn)(A.value.calls),v2:i(Mn)(A.value.total),v3:i(Mn)(A.value.cached),v4:j.value.total?i(l)(`每日上限 {v}。`,{v:i(Mn)(j.value.total)}):i(l)(`没有设置每日上限。`)})),1)]),_:1},8,[`title`,`eyebrow`]),N(Si,{title:i(l)(`还没细看的消息`),eyebrow:i(l)(`留意`)},{default:W(()=>[n.value?.attention?.length?(H(),E(`ul`,Ua,[(H(!0),E(C,null,M(n.value.attention,e=>(H(),E(`li`,{key:e.session,class:`list-row`},[u(`span`,Wa,a(e.name),1),u(`span`,{class:`chip`,"data-tone":e.unread?void 0:`quiet`},a(i(l)(`{unread} 条未读`,{unread:e.unread})),9,Ga)]))),128))])):(H(),E(`p`,Ka,a(i(l)(`被叫到、聊到 TA 在意的事、熟人说话或攒了不少消息时,TA 才会细看。`)),1))]),_:1},8,[`title`,`eyebrow`]),N(Si,{title:i(l)(`TA 的这一生`),eyebrow:i(l)(`到现在`)},{default:W(()=>[u(`div`,qa,[u(`button`,{onClick:g[13]||=e=>i(I)(`heart`)},[u(`b`,null,a(n.value?.counts?.self??0),1),u(`span`,null,a(i(l)(`自我线索`)),1)]),u(`button`,{onClick:g[14]||=e=>i(I)(`people`)},[u(`b`,null,a(n.value?.counts?.people??0),1),u(`span`,null,a(i(l)(`认识的人`)),1)]),u(`button`,{onClick:g[15]||=e=>i(I)(`life`)},[u(`b`,null,a(n.value?.counts?.diaries??0),1),u(`span`,null,a(i(l)(`天日记`)),1)]),u(`button`,{onClick:g[16]||=e=>i(I)(`life`,`ahead`)},[u(`b`,null,a(n.value?.counts?.anticipations??0),1),u(`span`,null,a(i(l)(`件在等的事`)),1)])])]),_:1},8,[`title`,`eyebrow`])])])]))}}),[[`__scopeId`,`data-v-663ff302`]]),Ya=`modulepreload`,Xa=function(e){return`/app/`+e},Za={},Qa=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Xa(t,n),t=s(t),t in Za)return;Za[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Ya,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$a={chats:()=>Qa(()=>import(`./ChatsPage-CshdtTzV.js`),__vite__mapDeps([0,1,2,3,4,5,6])),heart:()=>Qa(()=>import(`./HeartPage-eqo6ru16.js`),__vite__mapDeps([7,1,2,3,4,8])),people:()=>Qa(()=>import(`./PeoplePage-BXGBbO4u.js`),__vite__mapDeps([9,1,2,3,10,11])),life:()=>Qa(()=>import(`./LifePage-CN8GE5NK.js`),__vite__mapDeps([12,1,2,3,13])),time:()=>Qa(()=>import(`./TimePage-Bs_zImb4.js`),__vite__mapDeps([14,1,2,3,15])),memory:()=>Qa(()=>import(`./MemoryPage-CCpMN4Wg.js`),__vite__mapDeps([16,1,2,3,10,17])),nature:()=>Qa(()=>import(`./NaturePage-C0JqdBTR.js`),__vite__mapDeps([18,1,2,3,19])),system:()=>Qa(()=>import(`./SystemPage-Cd7aa8eE.js`),__vite__mapDeps([20,1,2,3,21])),plugins:()=>Qa(()=>import(`./PluginsPage-Dksp5AV5.js`),__vite__mapDeps([22,1,2,5,23]))},eo=new Map;function to(e){let t=$a[e];return t?(eo.has(e)||eo.set(e,t().catch(t=>{throw eo.delete(e),t})),eo.get(e)):Promise.resolve()}var no=Object.fromEntries([[`now`,Ja],...Object.keys($a).map(e=>[e,be(()=>to(e))])]);function ro(){navigator.connection?.saveData||document.hidden||Promise.all(Object.keys($a).map(e=>to(e).catch(()=>{})))}var io={key:1,class:`access-gate`},ao={class:`access-language`},oo={class:`access-card`},so={key:0},co=[`autocomplete`],lo={key:0},uo={key:1},fo={key:2,class:`access-error`,role:`alert`},po=[`disabled`],mo={class:`access-error`,role:`alert`},ho=R(z({__name:`AccessGate`,setup(t){let n=B(()=>q.phase===`setup`),o=K(``),s=K(``),c=K(``),d=K(!1);async function f(){c.value=``;try{await Se()}catch{c.value=l(`暂时无法连接,请重试`)}}j(f);async function p(){if(!d.value){if(c.value=``,n.value&&o.value!==s.value){c.value=l(`两次输入的密码不一致`);return}d.value=!0;try{await r(o.value),o.value=``,s.value=``}catch(e){c.value=e.message}finally{d.value=!1}}}return(t,r)=>i(q).phase===`ready`?P(t.$slots,`default`,{},void 0,!0,0):(H(),E(`main`,io,[u(`div`,ao,[N(vr)]),u(`section`,oo,[r[2]||=u(`div`,{class:`access-orb`,"aria-hidden":`true`},`✦`,-1),r[3]||=u(`p`,{class:`eyebrow`},`LuckyTri`,-1),u(`h1`,null,a(n.value?i(l)(`为这个小世界设置密码`):i(l)(`欢迎回来`)),1),i(q).phase===`checking`?(H(),E(`p`,so,a(i(l)(`正在连接小世界…`)),1)):(H(),E(C,{key:1},[u(`p`,null,a(n.value?i(l)(`只需设置一个管理密码,以后用它登录。`):i(l)(`输入管理密码,继续陪伴 TA。`)),1),u(`form`,{class:`access-form`,onSubmit:x(p,[`prevent`])},[u(`label`,null,[e(a(i(l)(`管理密码`))+` `,1),Ce(u(`input`,{"onUpdate:modelValue":r[0]||=e=>o.value=e,name:`managementPassword`,type:`password`,autocomplete:n.value?`new-password`:`current-password`,minlength:`8`,maxlength:`256`,required:``,autofocus:``},null,8,co),[[S,o.value]])]),n.value?(H(),E(`label`,lo,[e(a(i(l)(`确认密码`))+` `,1),Ce(u(`input`,{"onUpdate:modelValue":r[1]||=e=>s.value=e,name:`confirmPassword`,type:`password`,autocomplete:`new-password`,minlength:`8`,maxlength:`256`,required:``},null,512),[[S,s.value]])])):w(``,!0),n.value?(H(),E(`small`,uo,a(i(l)(`至少 8 个字符。密码只保存在本机的加密校验记录中。`)),1)):w(``,!0),c.value?(H(),E(`p`,fo,a(c.value),1)):w(``,!0),u(`button`,{class:`primary`,disabled:d.value},a(d.value?i(l)(`请稍候…`):n.value?i(l)(`设置密码并进入`):i(l)(`登录`)),9,po)],32)],64)),c.value&&i(q).phase===`checking`?(H(),E(C,{key:2},[u(`p`,mo,a(c.value),1),u(`button`,{class:`primary`,onClick:f},a(i(l)(`重试`)),1)],64)):w(``,!0)])]))}}),[[`__scopeId`,`data-v-299ced1e`]]),go={key:0,class:`startup`},_o={class:`eyebrow`},vo=[`aria-label`],yo=[`aria-current`,`aria-label`],bo={class:`dock-ta-text rail-label`},xo={class:`dock-groups`},So={class:`rail-label`},Co=[`data-page`,`aria-current`,`title`,`onClick`,`onPointerenter`,`onFocus`],wo={class:`rail-label`},To={class:`dock-foot`},Eo=[`aria-pressed`,`title`],Do={class:`rail-label`},Oo=[`href`,`title`],ko={class:`rail-label`},Ao={class:`workspace`},jo={id:`main`,tabindex:`-1`},Mo={class:`topbar`},No={class:`topbar-title`},Po={key:0,class:`eyebrow`},Fo={class:`topbar-actions`},Io=[`title`],Lo=[`aria-label`,`title`,`disabled`],Ro={key:0,class:`draft-banner`,role:`status`},zo=[`aria-label`],Bo=[`data-page`,`aria-current`,`onClick`],Vo=[`aria-expanded`],Ho={class:`more-grid`},Uo=[`data-page`,`onClick`],Wo={class:`more-title`},Go={class:`row more-tools`},Ko=[`aria-pressed`],qo=[`href`],Jo={key:2,class:`startup`,role:`status`},Yo=v(R(z({__name:`App`,setup(t){qe();let n=B(()=>A[V.page]),r=B(()=>!!V.health?.connection?.online),o=B(()=>Q.data?.name||V.core?.nature?.name||`TA`),c=B(()=>Q.data?.activity?.kind||`idle`),d=B(()=>ue.includes(V.page)),f=B(()=>m.value===`en`?`/guide.en.html`:`/guide.html`),p=0,h=!1,g=new AbortController,_=()=>{},v=K(!1);function y(e){!h&&(h=!0,e?.revision===V.core?.revision)||(p||=(ae(),window.setTimeout(()=>{p=0,!document.hidden&&(ae(),Xe(),!V.dirty&&V.page!==`chats`&&O().catch(()=>{}),V.pulse+=1)},2e3)))}async function ee(){if(!v.value){if(V.dirty){U(l(`请先保存草稿`));return}v.value=!0;try{oe(),await Promise.all([O(),Xe()]),V.tick+=1}finally{v.value=!1}}}F(m,async()=>{if(oe(),V.core&&!V.dirty)try{await Promise.all([O(),Xe()]),V.tick+=1}catch{}});function te(){document.getElementById(`main`)?.focus()}function b(){window.location.reload()}function S(){document.documentElement.dataset.visibility=document.hidden?`hidden`:`visible`,document.hidden||(ae(),!V.dirty&&V.page!==`chats`&&O().catch(()=>{}),V.pulse++)}return j(async()=>{pt(),ge(),window.addEventListener(`hashchange`,ge),window.addEventListener(`popstate`,ge),to(V.page).catch(()=>{}),ro();try{await O()}catch(e){V.error=e.message;return}_=Ze(),document.addEventListener(`visibilitychange`,S),Qe(y,{signal:g.signal})}),de(()=>{window.removeEventListener(`hashchange`,ge),window.removeEventListener(`popstate`,ge),g.abort(),clearTimeout(p),_(),document.removeEventListener(`visibilitychange`,S)}),(t,p)=>(H(),T(ho,null,{default:W(()=>[N(Ot),i(V).error?(H(),E(`div`,go,[N(Dn,{mood:`blue`,size:128}),u(`span`,_o,a(i(l)(`暂未连接`)),1),u(`h1`,null,a(i(l)(`TA 在等你回来`)),1),u(`p`,null,a(i(V).error),1),u(`button`,{class:`primary`,onClick:b},a(i(l)(`重新连接`)),1)])):i(V).core&&i(V).health?(H(),E(`div`,{key:1,class:G([`shell`,`at-`+i(V).page])},[u(`a`,{class:`skip-link`,href:`#main`,onClick:x(te,[`prevent`])},a(i(l)(`跳到主要内容`)),1),u(`nav`,{class:`dock primary-nav`,"aria-label":i(l)(`主要功能`)},[u(`button`,{class:G([`dock-ta`,{active:i(V).page===`now`}]),"data-page":`now`,"aria-current":i(V).page===`now`?`page`:void 0,"aria-label":i(l)(`{name}:回到此刻`,{name:o.value}),onClick:p[0]||=e=>i(I)(`now`)},[N(Dn,{mood:i(X),activity:c.value,size:50},null,8,[`mood`,`activity`]),u(`span`,bo,[p[6]||=u(`b`,null,`LuckyTri`,-1),u(`small`,null,a(o.value===`LuckyTri`?``:o.value+` · `)+a(i(J)[i(X)].label)+` · `+a(i(yt)[c.value]||i(l)(`闲着`)),1)])],10,yo),u(`div`,xo,[(H(!0),E(C,null,M(i(ie),e=>(H(),E(`section`,{key:e.label,class:`dock-group`},[u(`h2`,So,a(e.label),1),(H(!0),E(C,null,M(e.pages,e=>(H(),E(`button`,{key:e,class:G([`dock-link`,{active:i(V).page===e}]),"data-page":e,"aria-current":i(V).page===e?`page`:void 0,title:i(A)[e].label,onClick:t=>i(I)(e),onPointerenter:t=>i(to)(e).catch(()=>{}),onFocus:t=>i(to)(e).catch(()=>{})},[N(ci,{name:e},null,8,[`name`]),u(`span`,wo,a(i(A)[e].label),1)],42,Co))),128))]))),128))]),u(`div`,To,[N(Dr),u(`button`,{class:`dock-tool`,"aria-pressed":i(Y).quiet,title:i(Y).quiet?i(l)(`开启灵动效果`):i(l)(`减少动画`),onClick:p[1]||=e=>i(Ke)(!i(Y).quiet)},[N(ci,{name:`motion`}),u(`span`,Do,a(i(Y).quiet?i(l)(`开启灵动效果`):i(l)(`减少动画`)),1)],8,Eo),u(`a`,{class:`dock-tool`,href:f.value,target:`_blank`,rel:`noopener`,title:i(l)(`使用教程`)},[N(ci,{name:`guide`}),u(`span`,ko,a(i(l)(`使用教程 ↗`)),1)],8,Oo)])],8,vo),u(`div`,Ao,[N(Xr),u(`main`,jo,[u(`header`,Mo,[u(`div`,No,[i(m)===`zh`?(H(),E(`span`,Po,a(n.value.en),1)):w(``,!0),u(`h1`,null,a(n.value.label),1),u(`p`,null,a(n.value.tagline),1)]),u(`div`,Fo,[N(vr),u(`button`,{id:`connection`,class:G([`pill`,{offline:!r.value}]),title:r.value?i(l)(`QQ 已连接`):i(l)(`去连接 QQ`),onClick:p[2]||=e=>r.value||i(I)(`system`,`connect`)},[u(`span`,{class:G([`dot`,{off:!r.value}])},null,2),e(a(r.value?i(l)(`QQ 已连接`):i(l)(`QQ 未连接`)),1)],10,Io),u(`button`,{id:`refresh`,class:G([`icon-button`,{spinning:v.value}]),"aria-label":i(l)(`刷新当前数据`),title:i(l)(`刷新`),disabled:v.value,onClick:ee},[N(ci,{name:`refresh`})],10,Lo)])]),i(V).dirty?(H(),E(`div`,Ro,[p[7]||=u(`span`,{class:`dot warn`},null,-1),e(a(i(l)(`草稿还没保存,保存后才会生效`)),1)])):w(``,!0),u(`div`,{class:G([`view`,`page-`+i(V).page])},[(H(),T(s,{max:5,include:[`NowPage`,`HeartPage`,`PeoplePage`,`LifePage`,`TimePage`]},[(H(),T(he(i(no)[i(V).page]),{key:i(V).page,class:`route-page`}))],1024))],2)])]),u(`nav`,{class:`tabbar`,"aria-label":i(l)(`主要功能`)},[(H(!0),E(C,null,M(i(xe),e=>(H(),E(`button`,{key:e,"data-page":e,class:G({active:i(V).page===e}),"aria-current":i(V).page===e?`page`:void 0,onClick:t=>i(I)(e)},[N(ci,{name:e},null,8,[`name`]),u(`span`,null,a(i(A)[e].label),1)],10,Bo))),128)),u(`button`,{class:G([`tabbar-more`,{active:d.value}]),"aria-expanded":i(V).moreOpen,onClick:p[3]||=e=>i(V).moreOpen=!i(V).moreOpen},[N(ci,{name:`more`}),u(`span`,null,a(i(l)(`更多`)),1)],10,Vo)],8,zo),N(mi,{open:i(V).moreOpen,title:i(l)(`更多`),eyebrow:i(l)(`更多`),width:`420px`,onClose:p[5]||=e=>i(V).moreOpen=!1},{default:W(()=>[u(`div`,Ho,[(H(!0),E(C,null,M(i(ue),e=>(H(),E(`button`,{key:e,"data-page":e,class:G({active:i(V).page===e}),onClick:t=>i(I)(e)},[N(ci,{name:e},null,8,[`name`]),u(`b`,null,a(i(A)[e].label),1),u(`small`,null,a(i(A)[e].tagline),1)],10,Uo))),128))]),u(`h3`,Wo,a(i(l)(`界面主题`)),1),N(Dr,{inline:``}),u(`div`,Go,[u(`button`,{"aria-pressed":i(Y).quiet,onClick:p[4]||=e=>i(Ke)(!i(Y).quiet)},a(i(Y).quiet?i(l)(`开启灵动效果`):i(l)(`减少动画`)),9,Ko),u(`a`,{href:f.value,target:`_blank`,rel:`noopener`},a(i(l)(`使用教程 ↗`)),9,qo)])]),_:1},8,[`open`,`title`,`eyebrow`]),N(hr,{"hide-orb":i(V).page===`now`},null,8,[`hide-orb`])],2)):(H(),E(`div`,Jo,[N(Dn,{mood:i(X),activity:`idle`,size:128},null,8,[`mood`]),u(`h1`,null,a(i(l)(`正在进入 TA 的小世界`)),1),u(`p`,null,a(i(l)(`连接会话与记忆…`)),1)])),N(ni)]),_:1}))}}),[[`__scopeId`,`data-v-0e622eac`]]));Yo.config.errorHandler=e=>{U(e instanceof Error?e.message:l(`操作失败,请重试`),!0)},Yo.mount(`#app`);export{An as _,hi as a,Q as b,Gn as c,kn as d,Rn as f,In as g,Fn as h,Si as i,jn as l,Mn as m,ji as n,mi as o,Ln as p,Di as r,ar as s,Fi as t,On as u,Dn as v,X as x,Qe as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./Empty-
|
|
1
|
+
import{m as e}from"./Empty-C7yzOBzy.js";async function t(t){return e(`/core/memories?session=`+encodeURIComponent(t))}async function n(t){return e(`/core/memories`,`POST`,t)}async function r(t,n){return e(`/core/memories/`+t,`PATCH`,n)}async function i(t){return e(`/core/memories/batch-delete`,`POST`,t)}async function a(t){return e(`/core/memory-summary?session=`+encodeURIComponent(t))}async function o(t){return e(`/core/memory/consolidate`,`POST`,{session:t})}async function s(t){return e(`/core/knowledge/collections?session=`+encodeURIComponent(t))}async function c(t){return e(`/core/knowledge/documents?collection=`+encodeURIComponent(t))}async function l(t){return e(`/core/knowledge/documents`,`POST`,t)}async function u(t,n){return e(`/core/knowledge/search`,`POST`,{session:t,text:n})}export{s as a,a as c,l as i,r as l,o as n,c as o,i as r,t as s,n as t,u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ot as e,xt as t}from"./Empty-
|
|
1
|
+
import{ot as e,xt as t}from"./Empty-C7yzOBzy.js";function n(n){let r=matchMedia(n),i=t(r.matches),a=e=>i.value=e.matches;return r.addEventListener(`change`,a),e(()=>r.removeEventListener(`change`,a)),i}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e,M as t,P as n,j as r,m as i}from"./Empty-C7yzOBzy.js";var a=new Map;function o(e,t){let n=JSON.stringify([e,t]),r=a.get(n);return r||(r=new Intl.DateTimeFormat(e,t),a.set(n,r),a.size>64&&a.delete(a.keys().next().value)),r}var s={overview:()=>i(`/mind`),mood:()=>i(`/mind/mood`),notes:(e=``)=>i(`/mind/thoughts?q=`+encodeURIComponent(e)),presence:()=>i(`/mind/presence`),today:()=>i(`/mind/today`),person:e=>i(`/mind/people/`+encodeURIComponent(e)),self:()=>i(`/mind/self`),thread:e=>i(`/mind/self/`+encodeURIComponent(e)),bonds:()=>i(`/mind/bonds`),relationships:()=>i(`/mind/relationships`),saveRelationship:e=>i(`/mind/relationships`,`PUT`,e),endRelationship:(e,t)=>i(`/mind/relationships/`+encodeURIComponent(e),`DELETE`,t),bondChanges:(e,t)=>i(`/mind/bonds/${e}/`+encodeURIComponent(t)),faces:e=>i(`/mind/faces/`+encodeURIComponent(e)),life:(e=``,t)=>i(`/mind/life?q=`+encodeURIComponent(e)+(t?`&before=`+t:``)),day:e=>i(`/mind/day/`+e),chapter:e=>i(`/mind/chapters/`+e),story:()=>i(`/mind/story`),nature:()=>i(`/mind/nature`),saveNature:e=>i(`/mind/nature`,`PUT`,e),saveSettings:e=>i(`/mind/settings`,`PUT`,e),reflect:()=>i(`/mind/reflect`,`POST`,{}),review:()=>i(`/mind/review`,`POST`,{}),revoke:(e,t,n=``)=>i(`/mind/revoke`,`POST`,{kind:e,id:t,reason:n}),thought:(e,t)=>i(`/mind/thoughts/`+encodeURIComponent(e),`PATCH`,t),removeThought:e=>i(`/mind/thoughts/`+encodeURIComponent(e),`DELETE`,{}),preview:e=>i(`/mind/preview`,`POST`,e),savePrompts:e=>i(`/core/prompts`,`PUT`,e)},c=n({promise:r(`答应的事`),plan:r(`想做的事`),event:r(`别人的安排`),date:r(`每年的日子`)}),l=n({pending:r(`还在等`),lapsed:r(`悄悄错过了`),done:r(`做到了`),missed:r(`错过了`),let_go:r(`不再惦记`),revoked:r(`已撤销`)}),u=n({turn:r(`聊天时`),direct:r(`聊天时`),group:r(`聊天时`),solitude:r(`独处时`),daily:r(`写日记时`),weekly:r(`回顾时`),memory:r(`从 TA 说过的话里`),migration:r(`旧版本`)}),d=n({activity:r(`做自己的事`),solitude:r(`独处`),expression:r(`自己的念头`),daily:r(`写日记`),weekly:r(`回顾这段日子`),night:r(`夜里整理`)}),f=n({running:r(`进行中`),written:r(`留下了东西`),state:r(`心情变了`),empty:r(`没什么新的`),error:r(`出了点问题`),skipped:r(`跳过了`),cancelled:r(`作废了`),interrupted:r(`重启中断`)}),p=n({active:r(`已经是 TA 的一部分`),emerging:r(`刚开始有这种感觉`),closed:r(`已经放下`)}),m={interest:`#ffc15f`,view:`#7fc8ff`,trait:`#ff9a8b`,habit:`#b9a4ff`,intention:`#6fe0b8`,care:`#ff8fbf`,curiosity:`#9ef0ff`},h=n({warmer:r(`更亲近了一点`),closer:r(`走近了`),trust_up:r(`更信任了`),trust_down:r(`有点失望`),friction:r(`有了别扭`),repair:r(`和好了`),distance:r(`疏远了一点`),impression:r(`印象`)}),g=new Set([`friction`,`trust_down`,`distance`]),_=n([[`familiarity`,r(`熟悉`)],[`closeness`,r(`亲近`)],[`trust`,r(`信任`)],[`tension`,r(`别扭`)]]),v=n({open:r(`公开`),private:r(`私下知道`),secret:r(`要 TA 保密`)}),y=n({妹妹:r(`妹妹`),姐姐:r(`姐姐`),弟弟:r(`弟弟`),哥哥:r(`哥哥`),朋友:r(`朋友`),伙伴:r(`伙伴`),年长手足:r(`年长手足`),年幼手足:r(`年幼手足`)}),b=n({confirmed:r(`TA 这样认为`),superseded:r(`已被新的取代`),candidate:r(`旧版待确认`),disputed:r(`有争议`),expired:r(`已过期`),deleted:r(`已撤销`)}),x=n({planned:r(`等合适的时候`),sending:r(`正在发`),sent:r(`说出口了`),declined:r(`TA 后来决定不说`),skipped:r(`时机不合适`),cancelled:r(`没有发`),uncertain:r(`投递未确认`)}),S=n({speak:r(`开口`),react:r(`简短反应`),decline:r(`说不想聊`),silent:r(`没出声`)});function C(n,r=`Asia/Shanghai`){return n?o(t(),{timeZone:r,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(n):e(`还没有`)}function w(e){return`${Math.round(Math.max(0,Math.min(1,Number(e)||0))*100)}%`}export{w as _,g as a,m as c,x as d,y as f,s as g,p as h,S as i,b as l,f as m,l as n,_ as o,d as p,h as r,v as s,c as t,u,C as v,o as y};
|
package/public/app/index.html
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
if (pinned) document.documentElement.dataset.mood = pinned;
|
|
15
15
|
} catch (e) {}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/app/assets/index-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/app/assets/Empty-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/app/assets/
|
|
17
|
+
<script type="module" crossorigin src="/app/assets/index-CyRtYxP3.js"></script>
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/app/assets/Empty-C7yzOBzy.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/app/assets/mind-DtTVrW6Z.js">
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/app/assets/Empty-DmUB2-Bk.css">
|
|
21
|
-
<link rel="stylesheet" crossorigin href="/app/assets/index-
|
|
21
|
+
<link rel="stylesheet" crossorigin href="/app/assets/index-BHZcHUMh.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body>
|
|
24
24
|
<div id="app"></div>
|
package/public/guide.en.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0.
|
|
6
|
+
<title>LuckyTri v1.0.4 · Getting Started</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.
|
|
272
|
+
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0.4</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">Back to the studio</a
|
|
@@ -1016,11 +1016,40 @@ npm start
|
|
|
1016
1016
|
Never post API keys, <code>.env</code> or private chat text anywhere
|
|
1017
1017
|
public.
|
|
1018
1018
|
</p>
|
|
1019
|
+
<h3>Thoughts about places and update checks</h3>
|
|
1020
|
+
<p>
|
|
1021
|
+
People → Thoughts about this place keeps her own impressions, wishes
|
|
1022
|
+
and questions, selectively updated from real encounters. Details show
|
|
1023
|
+
reasons, sources and history; copied group personas remain history
|
|
1024
|
+
only.
|
|
1025
|
+
</p>
|
|
1026
|
+
<p>
|
|
1027
|
+
People → Relationships binds a person or another robot by account,
|
|
1028
|
+
with reciprocal roles, an optional name and reason, and visibility.
|
|
1029
|
+
The relationship informs conversation, solitude, diaries and action
|
|
1030
|
+
choices. Trust and closeness still come from real encounters; a
|
|
1031
|
+
binding creates no shared history. Changes and removal retain history
|
|
1032
|
+
and memories. Private relationships are used only in private chats
|
|
1033
|
+
with that account. Equal names never merge accounts.
|
|
1034
|
+
</p>
|
|
1035
|
+
<p>
|
|
1036
|
+
System → Runtime → Version and updates checks npm and links release
|
|
1037
|
+
notes. Update and restart downloads and validates the new program
|
|
1038
|
+
while the instance keeps running, then saves a verified backup and
|
|
1039
|
+
switches. Failed startup attempts recovery of the previous program and
|
|
1040
|
+
data. Managed programs live under the instance's
|
|
1041
|
+
<code>runtime/releases/</code>, leaving source and global npm
|
|
1042
|
+
installations untouched; launch commands select the updated program. A
|
|
1043
|
+
manually installed equal or newer source/global package takes
|
|
1044
|
+
precedence. The Nature page uses the server's remaining edit
|
|
1045
|
+
allowance; locally granted extra opportunities are recorded without
|
|
1046
|
+
clearing history.
|
|
1047
|
+
</p>
|
|
1019
1048
|
</article>
|
|
1020
1049
|
</div>
|
|
1021
1050
|
<footer>
|
|
1022
1051
|
LuckyTri · so that experience and choice stay coherent. This guide matches
|
|
1023
|
-
the v1.0.
|
|
1052
|
+
the v1.0.4 interface.
|
|
1024
1053
|
</footer>
|
|
1025
1054
|
</body>
|
|
1026
1055
|
</html>
|
package/public/guide.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0.
|
|
6
|
+
<title>LuckyTri v1.0.4 · 使用教程</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.
|
|
272
|
+
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0.4</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">返回管理台</a
|
|
@@ -626,7 +626,7 @@ luckytri
|
|
|
626
626
|
<p>
|
|
627
627
|
其余的都从经历里长出来:TA 的自我是「内心」星图里的一颗颗星,TA
|
|
628
628
|
对每个人的感觉在「人际」,TA
|
|
629
|
-
|
|
629
|
+
对各处的独特想法在「人际」下方的「在这里的想法」里。点开可以看到每次变化的来源,觉得不对可以撤销;撤销过的内容之后不会被写回来。很久没被触及的线索会慢慢淡出,退到星图的「远方」;它们没有被删除,被聊到时会重新想起。TA
|
|
630
630
|
独处、写日记、夜里整理、回顾和改写自传的记录,以及 TA
|
|
631
631
|
在等的事(别人说的安排、TA 答应的事,可以撤销),都在「一生」。每日
|
|
632
632
|
Token 上限、后台份额、夜里整理和回顾间隔在「天性 → TA 的日子」里设置。
|
|
@@ -844,8 +844,23 @@ npm start
|
|
|
844
844
|
</tbody>
|
|
845
845
|
</table>
|
|
846
846
|
<p>不要把 API 密钥、<code>.env</code> 或私聊原文发到公开位置。</p>
|
|
847
|
+
<h3>群里的独特想法与检查更新</h3>
|
|
848
|
+
<p>
|
|
849
|
+
「人际 →
|
|
850
|
+
在这里的想法」保存她在各处自己想留下的印象、愿望或疑问。由她根据实际相处选择更新,详情显示理由、来源和历史;旧群人格只留在历史里。
|
|
851
|
+
</p>
|
|
852
|
+
<p>
|
|
853
|
+
「人际 →
|
|
854
|
+
彼此的关系」可按账号绑定人或另一位机器人,设置妹妹、姐姐、朋友等双向称呼、名字、缘由和公开范围。她在交流、独处、日记与行动选择中知道这份关系;信任和亲近仍依据实际相处,绑定不会制造共同经历。修改和解除保留历史及原有记忆。私下关系只在与对方的私聊中使用,不按同名合并账号。
|
|
855
|
+
</p>
|
|
856
|
+
<p>
|
|
857
|
+
「系统 → 运行开关 → 版本与更新」可检查 npm
|
|
858
|
+
最新版本、查看发布说明,随后点击「更新并重启」。下载检查期间继续运行,切换前保留校验备份,启动失败时尝试恢复原版本和数据。新程序装在实例的
|
|
859
|
+
<code>runtime/releases/</code>,源码和全局 npm
|
|
860
|
+
安装保持原样;启动命令会选择已更新的程序。安装了同版本或更新版本的全局包或源码后,以该安装为准。天性页的剩余修改次数以服务端额度为准;本地维护额外授予的机会有独立记录,不清空原版本。
|
|
861
|
+
</p>
|
|
847
862
|
</article>
|
|
848
863
|
</div>
|
|
849
|
-
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.
|
|
864
|
+
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0.4 界面同步。</footer>
|
|
850
865
|
</body>
|
|
851
866
|
</html>
|
package/public/tutorial.en.md
CHANGED
|
@@ -198,3 +198,11 @@ The server removes the export copy after download. Cancelled, expired and interr
|
|
|
198
198
|
| Too much motion | "Reduce motion" at the bottom left; when the system asks for reduced motion, particles and morphing switch off automatically |
|
|
199
199
|
|
|
200
200
|
Never post API keys, `.env` or private chat text anywhere public.
|
|
201
|
+
|
|
202
|
+
### Thoughts about places and update checks
|
|
203
|
+
|
|
204
|
+
People → Thoughts about this place keeps her own impressions, wishes and questions, selectively updated from real encounters. Details show reasons, sources and history; copied group personas remain history only.
|
|
205
|
+
|
|
206
|
+
People → Relationships binds a person or another robot by account, with reciprocal roles, an optional name and reason, and visibility. The relationship informs conversation, solitude, diaries and action choices. Trust and closeness still come from real encounters; a binding creates no shared history. Changes and removal retain history and memories. Private relationships are used only in private chats with that account. Equal names never merge accounts.
|
|
207
|
+
|
|
208
|
+
System → Runtime → Version and updates checks npm and links release notes. Update and restart downloads and validates the new program while the instance keeps running, then saves a verified backup and switches. Failed startup attempts recovery of the previous program and data. Managed programs live under the instance's `runtime/releases/`, leaving source and global npm installations untouched; launch commands select the updated program. A manually installed equal or newer source/global package takes precedence. The Nature page uses the server's remaining edit allowance; locally granted extra opportunities are recorded without clearing history.
|
package/public/tutorial.md
CHANGED
|
@@ -130,7 +130,7 @@ TA 默认 02:00 睡、08:00 醒,在「天性 → 作息」里拖动月亮和
|
|
|
130
130
|
|
|
131
131
|
「天性」是唯一由你编写的部分:名字、性格、兴趣、边界、底线和作息,每次保存为新的一版。拖动性格刻度时,旁边的光团会跟着变:温柔让颜色变暖、嘴角上扬,活泼让它跳得更快。
|
|
132
132
|
|
|
133
|
-
其余的都从经历里长出来:TA 的自我是「内心」星图里的一颗颗星,TA 对每个人的感觉在「人际」,TA
|
|
133
|
+
其余的都从经历里长出来:TA 的自我是「内心」星图里的一颗颗星,TA 对每个人的感觉在「人际」,TA 对各处的独特想法在「人际」下方的「在这里的想法」里。点开可以看到每次变化的来源,觉得不对可以撤销;撤销过的内容之后不会被写回来。很久没被触及的线索会慢慢淡出,退到星图的「远方」;它们没有被删除,被聊到时会重新想起。TA 独处、写日记、夜里整理、回顾和改写自传的记录,以及 TA 在等的事(别人说的安排、TA 答应的事,可以撤销),都在「一生」。每日 Token 上限、后台份额、夜里整理和回顾间隔在「天性 → TA 的日子」里设置。
|
|
134
134
|
|
|
135
135
|
「记忆」里先选择会话,也可以按人筛选。
|
|
136
136
|
|
|
@@ -198,3 +198,11 @@ TA 的一切都存在这一个数据库里,所以服务运行时会自动备
|
|
|
198
198
|
| 界面动得太多 | 左下角「减少动画」;系统开启了减少动态效果时会自动关闭粒子和形变 |
|
|
199
199
|
|
|
200
200
|
不要把 API 密钥、`.env` 或私聊原文发到公开位置。
|
|
201
|
+
|
|
202
|
+
### 群里的独特想法与检查更新
|
|
203
|
+
|
|
204
|
+
「人际 → 在这里的想法」保存她在各处自己想留下的印象、愿望或疑问。由她根据实际相处选择更新,详情显示理由、来源和历史;旧群人格只留在历史里。
|
|
205
|
+
|
|
206
|
+
「人际 → 彼此的关系」可按账号绑定人或另一位机器人,设置妹妹、姐姐、朋友等双向称呼、名字、缘由和公开范围。她在交流、独处、日记与行动选择中知道这份关系;信任和亲近仍依据实际相处,绑定不会制造共同经历。修改和解除保留历史及原有记忆。私下关系只在与对方的私聊中使用,不按同名合并账号。
|
|
207
|
+
|
|
208
|
+
「系统 → 运行开关 → 版本与更新」可检查 npm 最新版本、查看发布说明,随后点击「更新并重启」。下载检查期间继续运行,切换前保留校验备份,启动失败时尝试恢复原版本和数据。新程序装在实例的 `runtime/releases/`,源码和全局 npm 安装保持原样;启动命令会选择已更新的程序。安装了同版本或更新版本的全局包或源码后,以该安装为准。天性页的剩余修改次数以服务端额度为准;本地维护额外授予的机会有独立记录,不清空原版本。
|
package/scripts/launch.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { openSync, closeSync, mkdirSync } from "node:fs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { join } from "node:path";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
4
|
import { prepareRuntime } from "./runtime.js";
|
|
5
5
|
import { running, serviceUrl } from "./service.js";
|
|
6
6
|
import { openBrowser } from "./browser.js";
|
|
7
7
|
import { VERSION } from "../server/version.js";
|
|
8
|
+
import { resolveInstallation } from "../server/runtime/installation.js";
|
|
8
9
|
import {
|
|
9
10
|
claimLaunch,
|
|
10
11
|
clearStarting,
|
|
@@ -17,11 +18,17 @@ import {
|
|
|
17
18
|
|
|
18
19
|
try {
|
|
19
20
|
const paths = prepareRuntime();
|
|
21
|
+
const selected = resolveInstallation(paths.home, paths.package, VERSION);
|
|
20
22
|
const proxy = await resolveProxyEnvironment(process.env);
|
|
21
23
|
const base = serviceUrl();
|
|
22
24
|
const existing = await running({ base });
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
+
if (
|
|
26
|
+
existing &&
|
|
27
|
+
existing.version &&
|
|
28
|
+
(existing.version !== selected.version ||
|
|
29
|
+
resolve(existing.workspace || "") !== resolve(selected.package))
|
|
30
|
+
) {
|
|
31
|
+
console.log(`正在将运行中的 LuckyTri 更新到 ${selected.version}…`);
|
|
25
32
|
await import("./stop.js");
|
|
26
33
|
if (process.exitCode) throw Error("旧服务未停止,请稍后重试");
|
|
27
34
|
}
|
|
@@ -44,7 +51,7 @@ try {
|
|
|
44
51
|
const log = openSync(paths.log, "a", 0o600);
|
|
45
52
|
const args = [
|
|
46
53
|
...(proxy.enabled ? ["--use-env-proxy"] : []),
|
|
47
|
-
join(
|
|
54
|
+
join(selected.package, "server", "index.js"),
|
|
48
55
|
];
|
|
49
56
|
const child = spawn(process.execPath, args, {
|
|
50
57
|
cwd: paths.home,
|
package/scripts/service.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { runtimePaths } from "../server/paths.js";
|
|
2
2
|
import { localServiceKey } from "../server/local-access.js";
|
|
3
|
+
import http from "node:http";
|
|
3
4
|
let legacy = false;
|
|
4
5
|
|
|
5
6
|
export function serviceUrl(env = process.env) {
|
|
@@ -17,15 +18,64 @@ export const serviceHeaders = () => ({
|
|
|
17
18
|
Authorization: `Bearer ${legacy ? process.env.ADMIN_TOKEN : localServiceKey()}`,
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
+
export function localServiceRequest(
|
|
22
|
+
url,
|
|
23
|
+
{ headers, method = "GET", body, timeout = 5000 } = {},
|
|
24
|
+
) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const request = http.request(url, { method, headers }, (response) => {
|
|
27
|
+
const chunks = [];
|
|
28
|
+
let bytes = 0;
|
|
29
|
+
response.on("data", (chunk) => {
|
|
30
|
+
bytes += chunk.length;
|
|
31
|
+
if (bytes > 65536) request.destroy(Error("服务状态响应过大"));
|
|
32
|
+
else chunks.push(chunk);
|
|
33
|
+
});
|
|
34
|
+
response.on("end", () => {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
try {
|
|
37
|
+
resolve(
|
|
38
|
+
new Response(Buffer.concat(chunks), {
|
|
39
|
+
status: response.statusCode,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
reject(error);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
response.on("error", (error) => {
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
reject(error);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const timer = setTimeout(
|
|
52
|
+
() => request.destroy(Error("服务请求超时")),
|
|
53
|
+
timeout,
|
|
54
|
+
);
|
|
55
|
+
request.once("error", (error) => {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
reject(error);
|
|
58
|
+
});
|
|
59
|
+
request.end(body);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export async function running({
|
|
63
|
+
base = serviceUrl(),
|
|
64
|
+
lenient = false,
|
|
65
|
+
local = false,
|
|
66
|
+
} = {}) {
|
|
21
67
|
let response;
|
|
22
68
|
try {
|
|
23
|
-
response = await
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
69
|
+
response = await (local ? localServiceRequest : fetch)(
|
|
70
|
+
base + "/api/service/status",
|
|
71
|
+
{
|
|
72
|
+
headers: serviceHeaders(),
|
|
73
|
+
signal: AbortSignal.timeout(1500),
|
|
74
|
+
...(local ? { timeout: 1500 } : {}),
|
|
75
|
+
},
|
|
76
|
+
);
|
|
27
77
|
} catch (error) {
|
|
28
|
-
if (lenient || error.cause?.code === "ECONNREFUSED") {
|
|
78
|
+
if (lenient || (error.cause?.code || error.code) === "ECONNREFUSED") {
|
|
29
79
|
legacy = false;
|
|
30
80
|
return false;
|
|
31
81
|
}
|
|
@@ -34,7 +84,7 @@ export async function running({ base = serviceUrl(), lenient = false } = {}) {
|
|
|
34
84
|
if (response.status === 401 && !legacy && process.env.ADMIN_TOKEN) {
|
|
35
85
|
// Allow the new CLI to gracefully stop a still-running 1.0.0 instance.
|
|
36
86
|
legacy = true;
|
|
37
|
-
return running({ base, lenient });
|
|
87
|
+
return running({ base, lenient, local });
|
|
38
88
|
}
|
|
39
89
|
if (!response.ok) throw Error("端口已被占用或不是当前实例,请检查本机配置。");
|
|
40
90
|
let info;
|
package/scripts/start-server.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { prepareRuntime } from "./runtime.js";
|
|
4
|
+
import { VERSION } from "../server/version.js";
|
|
5
|
+
import { resolveInstallation } from "../server/runtime/installation.js";
|
|
4
6
|
import {
|
|
5
7
|
resolveProxyEnvironment,
|
|
6
8
|
supportsNodeEnvironmentProxy,
|
|
7
9
|
} from "./proxy-config.js";
|
|
8
10
|
|
|
9
11
|
const paths = prepareRuntime();
|
|
12
|
+
const selected = resolveInstallation(paths.home, paths.package, VERSION);
|
|
10
13
|
const proxy = await resolveProxyEnvironment(process.env);
|
|
11
14
|
if (proxy.enabled && !supportsNodeEnvironmentProxy())
|
|
12
15
|
throw new Error(
|
|
@@ -15,7 +18,7 @@ if (proxy.enabled && !supportsNodeEnvironmentProxy())
|
|
|
15
18
|
|
|
16
19
|
const args = [
|
|
17
20
|
...(proxy.enabled ? ["--use-env-proxy"] : []),
|
|
18
|
-
join(
|
|
21
|
+
join(selected.package, "server", "index.js"),
|
|
19
22
|
];
|
|
20
23
|
const env = { ...process.env, ...proxy.env };
|
|
21
24
|
if (proxy.enabled) console.log("已启用系统代理,外部 API 请求将经代理转发。");
|