@goodfish/jarvy 0.11.0 → 0.11.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to Jarvy. Versions follow [semantic versioning](https://semver.org/) as used before 1.0: a patch release only fixes bugs; a minor release adds features or upgrades the database.
4
4
 
5
+ ## 0.11.1 — 2026-11-03
6
+
7
+ No database change: the schema stays v29.
8
+
9
+ ### Fixed
10
+
11
+ - A Bot no longer fails its turn when, after its conversation is compacted, a batch carries a message in one of the threads it follows. The followed-thread list defined that thread and its channel a second time, differently from the batch's own definitions, and building the batch was refused: the turn failed before it reached the model, and the pending reminder failed every later turn too. The list now keeps the definition a batch already has, as the other notices do.
12
+
5
13
  ## 0.11.0 — 2026-11-02
6
14
 
7
15
  No database change: the schema stays v29, and upgrading from 0.10.x needs nothing else. The live events stream (`/api/events`) and `GET /threads` changed shape; see **API** below.
@@ -9869,8 +9869,8 @@ function noticeTail(notices, chats, members) {
9869
9869
  if (notice.kind === "task") continue;
9870
9870
  if (notice.kind === "followed") {
9871
9871
  for (const thread of notice.threads) {
9872
- remember(chats, thread.channel.id, `<chat${attribute("id", thread.channel.id)}${attribute("type", "channel")}${attribute("title", thread.channel.title)}/>`);
9873
- remember(chats, thread.id, `<chat${attribute("id", thread.id)}${attribute("type", "thread")}${attribute("title", thread.title)}${attribute("parent", thread.channel.id)}${attribute("status", "open")}/>`);
9872
+ if (!chats.has(thread.channel.id)) chats.set(thread.channel.id, `<chat${attribute("id", thread.channel.id)}${attribute("type", "channel")}${attribute("title", thread.channel.title)}/>`);
9873
+ if (!chats.has(thread.id)) chats.set(thread.id, `<chat${attribute("id", thread.id)}${attribute("type", "thread")}${attribute("title", thread.title)}${attribute("parent", thread.channel.id)}${attribute("status", "open")}/>`);
9874
9874
  }
9875
9875
  continue;
9876
9876
  }
@@ -570,7 +570,7 @@ ${e.tail}`:e.head+e.tail:""}const Lb=e=>e.omitted?`${x("npc.live.omitted",{count
570
570
  `),title:e.state==="running"?x("npc.step.ask.running"):y?x("npc.step.ask.ok",{answer:y}):x(e.state==="failed"?"npc.live.askFailed":"npc.live.askClosed")}}if(u==="environments.switch")return{...a,look:"action",icon:"tool",title:x(`npc.live.switch.${Ri(e)}`),detail:r};const m=d?zb(d):"",p=kp.has(u)?m?x(`npc.live.browse.${e.state==="running"?"running":"ok"}`,{chat:m}):x(`npc.live.browseAll.${e.state==="running"?"running":"ok"}`):x(`npc.live.tool.${Ri(e)}`,{tool:u||"chat"});return{...a,look:"action",icon:kp.has(u)?"chat":"tool",title:e.state==="failed"&&kp.has(u)?x("npc.live.tool.failed",{tool:u}):p,detail:r}}function FI(e){try{const a=JSON.parse(e.output?e.output.head+e.output.tail:"");return a.status!=="answered"?null:[...(a.selected??[]).map(i=>i.label??""),a.custom??""].filter(Boolean).join(x("common.listSeparator"))}catch{return null}}function Ib(e,a){const i=new Map(e.steps.map(s=>[s.id,s.parentId])),r=s=>{let u=0,d=s.parentId;for(;d&&u<4;)u++,d=i.get(d)??null;return u};return e.steps.map(s=>UI(s,r(s),a))}function wd(e){var i;const a=((i=e.line)==null?void 0:i.length)??0;if(e.look==="speech"){const r=Math.min(7e3,Math.max(2500,1500+50*a))+Math.min(1500,a/.06);return{firm:r,light:r}}return e.look==="mutter"?{firm:1500,light:Math.min(3500,Math.max(1500,800+30*a))}:e.state==="failed"?{firm:2e3,light:2e3}:{firm:0,light:e.look==="action"?900:0}}const VI=4e3,Bb=1500;function Pb(e,a,i,r){var b;const s=S=>S-i;let u=null;for(const S of e)S.state==="running"&&(!u||S.startedAt>=u.startedAt)&&(u=S);const d=[];for(const S of e.filter(k=>k.state!=="running"&&k.endedAt!==null&&wd(k).firm).sort((k,C)=>k.endedAt-C.endedAt)){const k=s(S.endedAt),C=d.at(-1);C&&S.look==="speech"&&(C.end=Math.min(C.end,Math.max(C.start+Bb,k)));const T=Math.max(k,(C==null?void 0:C.end)??0);T-k>VI||d.push({step:S,start:T,end:T+wd(S).firm})}const f=(u==null?void 0:u.look)==="speech"?u:null;if(f){const S=s(f.startedAt);for(let k=d.length-1;k>=0;k--){const C=d[k];C.start>=S&&C.start>a?d.splice(k,1):C.end>S&&(C.end=Math.max(C.start+Bb,S))}}let m=null;for(const S of e){if(S.state==="running"||S.endedAt===null||!wd(S).light)continue;const k=s(S.endedAt)+wd(S).light;k>a&&(!m||S.endedAt>=m.step.endedAt)&&(m={step:S,end:k})}const p=d.find(S=>S.start<=a&&a<S.end),y=(p==null?void 0:p.step)??(f||u&&u.look!=="thought"||m==null?void 0:m.step),g=y??f??u??(r?e.at(-1)??null:null),j=[...d.flatMap(S=>[S.start,S.end]),(m==null?void 0:m.end)??0].filter(S=>S>a);return{shown:g,lingering:!!y,next:j.length?Math.min(...j):0,wordsEnd:((b=d.at(-1))==null?void 0:b.end)??0}}const Hb=6e3,Ub=500,qb=2200,$I=2e4,GI=10*6e4,Fb=3e4,YI=2e4,XI=2800;function KI(e,a,i,r,s){var q;const{turn:u,last:d,skew:f}=PI(e),[m,p]=w.useState(null),[y,g]=w.useState(0),[j,b]=w.useState(0),[,S]=w.useState(0),k=w.useRef(new Set),C=w.useRef(Date.now()),T=w.useMemo(()=>u?Ib(u,a):d?Ib(d,a):[],[u,d,a]);w.useEffect(()=>{for(const F of(u==null?void 0:u.steps)??[])F.state==="failed"&&!k.current.has(F.id)&&(k.current.add(F.id),g(W=>W+1),p({mood:"dizzy",until:Date.now()+2600}))},[u]),w.useEffect(()=>{d&&(k.current.clear(),C.current=Date.now(),b(Math.max(Date.now(),Pb(T,Date.now(),f,!1).wordsEnd)+Hb),d.outcome==="completed"&&d.endedAt-d.startedAt>$I&&p({mood:"happy",until:Date.now()+3200}))},[d]),w.useEffect(()=>{u&&(C.current=Date.now())},[u!==null]);const O=Date.now(),N=Pb(T,O,f,u!==null),M=N.shown,R=T.filter(F=>F.state==="running").sort((F,W)=>W.startedAt-F.startedAt)[0],A=!u&&(d==null?void 0:d.outcome)==="completed"&&O+f-d.endedAt<qb,B=O-C.current,P=!u&&(i==null?void 0:i.status)==="idle"&&B>Fb&&(B-Fb)%YI<XI,G=R&&R.look!=="thought"?Ep(R):N.lingering&&M?Ep(M):R?Ep(R):u?{motion:"think",fast:!1}:A?{motion:"stretch",fast:!1}:P?{motion:"groom",fast:!1}:s,L=!u&&!M&&d!==null&&O<j;return w.useEffect(()=>{const F=[(m==null?void 0:m.until)??0,j-Ub,j,((d==null?void 0:d.endedAt)??0)-f+qb,N.next].filter($=>$>Date.now()),W=setTimeout(()=>S($=>$+1),F.length?Math.min(...F)-Date.now()+20:1e3);return()=>clearTimeout(W)}),{view:{steps:T,shown:M,skew:f,startedAt:((q=u??d)==null?void 0:q.startedAt)??0,endedAt:u?null:(d==null?void 0:d.endedAt)??null,done:L?{ms:d.endedAt-d.startedAt,outcome:d.outcome,fading:O>=j-Ub}:null},motion:G.motion,fast:G.fast,mood:m&&m.until>O?m.mood:r,shake:y,canRecap:!u&&d!==null&&!L&&O+f-d.endedAt<GI,showRecap:()=>b(Date.now()+Hb)}}const R5="jarvy-floating-bot",is=10,QI=4,Sd=new URLSearchParams(location.search).get("npc")==="demo";function ZI(e){return!e||e.status==="stop"?{motion:"sleep",fast:!1}:e.status!=="running"||e.activity==="asking"?{motion:"idle",fast:!1}:["compacting","retrying","aborting"].includes(e.phase)?{motion:"busy",fast:!1}:e.activity==="tool_calling"||e.phase==="tool"?{motion:"work",fast:!0}:e.activity==="texting"||e.phase==="texting"?{motion:"work",fast:!1}:{motion:"think",fast:!1}}function JI(){try{const e=JSON.parse(localStorage.getItem(R5)??"");if(e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1)return e}catch{}return{x:1,y:0}}function WI({bot:e,chatId:a,status:i,area:r,avoid:s,onOpen:u}){const d=w.useRef(null),f=w.useRef(null),m=w.useRef(JI()),p=w.useRef(null),y=w.useRef(!1),g=w.useRef(null),j=w.useRef({motion:"sleep",mood:"normal",lookX:0,lookY:0}),b=w.useRef(null),[S,k]=w.useState(!1),C=w.useRef(null),T=LI(Sd,e.mood),O=KI(Sd?null:e.id,a,i,e.mood,ZI(i)),N=Sd?T:O;j.current.motion=N.motion,j.current.fast=N.fast,j.current.mood=N.mood;function M(){const P=r.current.getBoundingClientRect(),G=d.current.offsetWidth,L=s.current?s.current.getBoundingClientRect().top-P.top:P.height,q=Math.max(is,P.width-G-is),F=Math.max(is,L-G-is);return{minX:is,minY:is,maxX:q,maxY:F}}function R(){var q;const P=(q=r.current)==null?void 0:q.getBoundingClientRect(),G=d.current;if(!P||!G)return 0;const L=P.width/2-G.offsetWidth/2;return L>0?Math.max(-1,Math.min(1,(L-G.offsetLeft)/L)):0}function A(){var L;if(!d.current||!r.current)return;const P=M(),G=d.current;G.style.left=`${P.minX+m.current.x*(P.maxX-P.minX)}px`,G.style.top=`${P.minY+m.current.y*(P.maxY-P.minY)}px`,(L=C.current)==null||L.call(C)}w.useLayoutEffect(()=>{A();const P=new ResizeObserver(A);for(const G of[r.current,s.current,d.current])G&&P.observe(G);return()=>P.disconnect()},[]),w.useEffect(()=>{var P;(P=b.current)==null||P.setColor(($a[e.color]??$a.gray).hex)},[e.color]),w.useEffect(()=>{var P;(P=b.current)==null||P.setCrown(e.agent)},[e.agent]);const B=i!=null&&i.error?`${i.runId??""}:${i.error}`:null;return w.useEffect(()=>{var P;B&&((P=b.current)==null||P.shake(performance.now()))},[B]),w.useEffect(()=>{var P;N.shake&&((P=b.current)==null||P.shake(performance.now()))},[N.shake]),w.useEffect(()=>{const P=q=>{(q.pointerType==="mouse"||q.type==="pointerdown")&&(g.current={x:q.clientX,y:q.clientY})},G=q=>{q.relatedTarget||(g.current=null)},L=q=>{const F=q.target;if(F.id!=="jarvy-composer")return;const W=F.getBoundingClientRect();g.current={x:W.left+W.width/2,y:W.top+W.height/2}};return window.addEventListener("pointermove",P),window.addEventListener("pointerdown",P),document.addEventListener("pointerout",G),document.addEventListener("input",L),document.addEventListener("focusin",L),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerdown",P),document.removeEventListener("pointerout",G),document.removeEventListener("input",L),document.removeEventListener("focusin",L)}},[]),w.useEffect(()=>{let P=!0,G=0,L=()=>{};const q=matchMedia("(prefers-reduced-motion: reduce)");return Promise.all([Yd(()=>import("./three.module-BdMZo7zQ.js"),[]),Yd(()=>import("./figure-DQGUDG-4.js"),[])]).then(([F,W])=>{if(!P||!f.current)return;const $=new F.WebGLRenderer({canvas:f.current,antialias:!0,alpha:!0});W.configureRenderer(F,$);const{scene:Y,camera:K}=W.createStage(F),U=new W.CatFigure(F,($a[e.color]??$a.gray).hex);U.setCrown(e.agent),U.pose(j.current.mood),Y.add(U.root),W.frameCamera(K,1,3.3),b.current=U;let H=0;const Q=ne=>{var D;const ee=d.current;if(ee){const I=Math.round(ee.offsetWidth*Math.min(2,devicePixelRatio||1));I!==H&&(H=I,$.setSize(I,I,!1));const de=ee.getBoundingClientRect(),be=g.current;j.current.lookX=be?Math.max(-1,Math.min(1,(be.x-de.left-de.width/2)/320)):0,j.current.lookY=be?Math.max(-1,Math.min(1,(be.y-de.top-de.height/2)/320)):0,j.current.reduced=q.matches;const je=j.current.motion,we=!!((D=p.current)!=null&&D.moved)&&(je==="idle"||je==="groom"||je==="stretch");(j.current.faceX===void 0||!(we||je==="sleep"))&&(j.current.faceX=R()),U.frame(ne,j.current),$.render(Y,K)}G=requestAnimationFrame(Q)},_=()=>{cancelAnimationFrame(G),document.hidden||(G=requestAnimationFrame(Q))};document.addEventListener("visibilitychange",_),_(),k(!0),L=()=>{document.removeEventListener("visibilitychange",_),cancelAnimationFrame(G),U.dispose(),$.dispose(),$.forceContextLoss(),b.current=null}}).catch(()=>{}),()=>{P=!1,L()}},[]),o.jsxs(o.Fragment,{children:[o.jsxs("button",{ref:d,type:"button",className:"jv-floating-bot","data-live":S||void 0,"data-motion":N.motion,title:e.name,"aria-label":x("avatar.openInfo",{name:e.name}),onPointerDown:P=>{if(P.button!==0)return;const G=P.currentTarget;G.setPointerCapture(P.pointerId),p.current={id:P.pointerId,x:P.clientX,y:P.clientY,left:G.offsetLeft,top:G.offsetTop,moved:!1}},onPointerMove:P=>{const G=p.current;if(!G||G.id!==P.pointerId)return;const L=P.clientX-G.x,q=P.clientY-G.y;if(!G.moved&&Math.hypot(L,q)<QI)return;G.moved=!0;const F=M(),W=Math.min(F.maxX,Math.max(F.minX,G.left+L)),$=Math.min(F.maxY,Math.max(F.minY,G.top+q));m.current={x:F.maxX>F.minX?(W-F.minX)/(F.maxX-F.minX):0,y:F.maxY>F.minY?($-F.minY)/(F.maxY-F.minY):0},A()},onPointerUp:P=>{const G=p.current;!G||G.id!==P.pointerId||(p.current=null,y.current=G.moved,G.moved&&localStorage.setItem(R5,JSON.stringify(m.current)))},onPointerCancel:()=>{p.current=null},onClick:()=>{if(y.current){y.current=!1;return}N.canRecap?N.showRecap():u()},style:{"--jv-avatar-size":"100%"},children:[o.jsx("canvas",{ref:f,"aria-hidden":"true"}),!S&&o.jsx(co,{color:e.color,mood:e.mood,size:88,crown:e.agent})]}),o.jsx(CI,{view:N.view,name:e.name,cat:d,area:r,avoid:s,layout:C,facing:R,toolbar:Sd?(P,G)=>o.jsx(MI,{controls:T.controls,toolbar:P,onReplay:()=>{G(),T.controls.replay()}}):void 0})]})}function eB({className:e,...a}){return o.jsx("div",{"data-slot":"card",className:dn("flex flex-col gap-4 rounded-xl border bg-card py-5 text-card-foreground shadow-sm",e),...a})}function tB({className:e,...a}){return o.jsx("div",{"data-slot":"card-header",className:dn("grid gap-1 px-5",e),...a})}function nB({className:e,...a}){return o.jsx("div",{"data-slot":"card-title",className:dn("font-semibold leading-none",e),...a})}function aB({className:e,...a}){return o.jsx("div",{"data-slot":"card-content",className:dn("px-5",e),...a})}function iB({bot:e,connections:a,onSaved:i,onManage:r}){return o.jsxs(eB,{className:"jarvy-model-picker jv-ui",children:[o.jsx(tB,{children:o.jsx(nB,{children:x("botModel.pickFor",{name:e.name})})}),o.jsx(aB,{children:o.jsx(qS,{bot:e,connections:a,onSaved:i,onManage:r})})]})}function rB({chat:e,inChannel:a,bots:i,members:r,meId:s,drafts:u,composeReady:d,botName:f,activeBot:m,status:p,connections:y,activity:g,history:j,divider:b,activeQuestion:S,pane:k,onPane:C,onToggleInfo:T,find:O,onNav:N,onBot:M,hasBotDirects:R,onInvite:A,onQuote:B,onReply:P,onReact:G,onFold:L,onJump:q,onSettled:F,onSend:W,onPreview:$,onSaveNote:Y,notice:K,createBot:U,creating:H,updateBot:Q,onManageModels:_,error:ne,chatArea:ee,transcript:D,composeWrap:I,hidden:de,onOpenThread:be}){const{messages:je,loading:we,hasOlder:Ae,loadingOlder:Re,top:xe,away:oe,unseen:Ee,toLatest:Ke}=j;return o.jsxs("main",{className:"ui-chat","aria-label":x("chat.area"),ref:ee,hidden:de,children:[!a&&o.jsx(ut,{icon:"layout-sidebar-left",className:"ui-mobile-only jv-floating-nav",label:x("common.openNav"),onClick:N}),!a&&R&&o.jsx(ut,{icon:"people",className:"jv-floating-dms",label:x("chat.botDms",{name:f}),"aria-pressed":(k==null?void 0:k.kind)==="botdms",onClick:()=>C((k==null?void 0:k.kind)==="botdms"?null:{kind:"botdms"})}),o.jsx("span",{className:"sr-only",role:"status","aria-label":x("chat.botStatus"),children:a?"":g}),e?o.jsxs(o.Fragment,{children:[a?o.jsx(KL,{chat:e,members:ui(r),bots:i,onNav:N,infoOpen:(k==null?void 0:k.kind)==="info"&&k.page==="main",onInfo:()=>T("main"),membersOpen:(k==null?void 0:k.kind)==="info"&&k.page==="members",onMembers:()=>T("members"),threadsOpen:(k==null?void 0:k.kind)==="threads",onThreads:()=>C((k==null?void 0:k.kind)==="threads"?null:{kind:"threads"}),searchOpen:(k==null?void 0:k.kind)==="search",onSearch:()=>(k==null?void 0:k.kind)==="search"?C(null):O.search(e)}):m&&o.jsx(WI,{bot:m,chatId:e.id,status:p,area:ee,avoid:I,onOpen:()=>M(m.id)}),a&&o.jsx(QL,{chat:e,onSave:Y}),o.jsxs("div",{className:`ui-transcript jarvy-transcript${a?" jv-channel-transcript":""}`,ref:D,"aria-label":x("chat.transcript"),role:"log",children:[!a&&!(m!=null&&m.connectionId)&&m&&o.jsx("div",{className:"jarvy-model-onboarding",children:o.jsx(iB,{bot:m,connections:y,onSaved:Q,onManage:_})}),we?o.jsx("p",{className:"jarvy-empty-text",children:x("chat.loading")}):je.length===0?a?o.jsx("div",{className:"jarvy-empty-chat",children:o.jsx("p",{children:x("chat.empty")})}):m!=null&&m.connectionId?o.jsx("div",{className:"jarvy-empty-chat",children:o.jsx("h2",{children:x("chat.start",{name:f})})}):null:o.jsxs(o.Fragment,{children:[Ae&&o.jsx("div",{ref:xe,className:"jv-history-more","aria-live":"polite",children:Re?x("chat.loadingOlder"):""}),a?o.jsx(Xd,{messages:je,members:r,bots:i,me:s,divider:b,activeQuestion:S,onSettled:F,onPreview:$,onReply:P,onOpenThread:be,onQuote:B,onReact:G,onFold:L,onJump:q,onError:ne}):o.jsx(bI,{messages:je,members:r,me:s,activeQuestion:S,bot:m,onSettled:F,onPreview:$,onQuote:B,onReact:G,onFold:L,onJump:q,onError:ne})]}),oe&&je.length>0&&o.jsx("div",{className:"jv-to-latest",children:o.jsxs("button",{type:"button",onClick:Ke,"aria-label":x("chat.toLatest"),children:[Ee>0&&o.jsx("span",{children:x("chat.unseen",{count:Ee})}),o.jsx(qe,{name:"chevron-down"})]})})]}),o.jsx(A5,{chatId:e.id,id:"jarvy-composer",drafts:u,formRef:I,scrollRef:D,disabled:!d,placeholder:a?x("chat.toChannel",{name:e.title}):m!=null&&m.connectionId?x("chat.toBot",{name:f}):x("chat.pickModel"),mention:a?{bots:i,inside:ui(r).filter(Le=>Le.id!==s&&e.memberIds.includes(Le.id)),outside:ui(r).filter(Le=>!e.memberIds.includes(Le.id)),onInvite:Le=>A(e.id,Le)}:void 0,onSend:W,onError:ne,onNotice:K})]}):o.jsx("div",{className:"jarvy-empty-chat jarvy-first-chat",children:i.length?o.jsx("p",{children:x("chat.pick")}):o.jsxs("button",{className:"ui-button ui-primary",onClick:U,disabled:H,children:[o.jsx(qe,{name:"person-add"}),x("sidebar.newBot")]})}),e&&o.jsx(c5,{container:D,drafts:u,chatId:e.id,source:Le=>je.find(Ye=>Ye.id===Le),members:r,onNotice:K})]})}class lB{constructor(){Fl(this,"listeners",new Set)}emit(a){for(const i of this.listeners)i(a)}on(a){return this.listeners.add(a),()=>{this.listeners.delete(a)}}}function O5(e,a){const i=w.useRef(a);i.current=a,w.useEffect(()=>e.on(r=>i.current(r)),[e])}const xf=(e,a)=>e.some(i=>i.id===a.id)?e.map(i=>i.id===a.id?a:i):e;function Rg(e,a){if(e.some(r=>r.id===a.id))return xf(e,a);if(e[0]&&a.sequence<e[0].sequence)return e;const i=e.findIndex(r=>r.sequence>a.sequence);return i<0?[...e,a]:[...e.slice(0,i),a,...e.slice(i)]}const D5=(e,a)=>e.sequence>a+1;function z5(e,a,i){var s;const r=((s=a.at(-1))==null?void 0:s.sequence)??i;return[...e.filter(u=>u.sequence<=i),...a,...e.filter(u=>u.sequence>r)]}const oB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function sB(e,a){const[i,r]=w.useState([]);return w.useEffect(()=>{if(r([]),!e)return;let s=!0;return he.botDirects(e).then(u=>{s&&r(u.chats)}).catch(()=>{}),()=>{s=!1}},[e,a]),i}function cB({bot:e,chats:a,members:i,bots:r,me:s,live:u,onClose:d,onPreview:f,onError:m}){const[p,y]=w.useState(null),[g,j]=w.useState(null);w.useEffect(()=>{if(j(null),!p)return;let k=!0;return he.messages(p).then(C=>{k&&j(C.messages)}).catch(C=>{k&&m(C)}),()=>{k=!1}},[p]),O5(u,k=>{if(k.kind==="chat"||k.message.chatId!==p)return;const C=k.message;j(T=>T&&(k.kind==="message"?Rg(T,C):xf(T,C)))});const b=k=>i.find(C=>C.id!==e.id&&k.memberIds.includes(C.id)),S=a.find(k=>k.id===p);return o.jsxs("aside",{className:"ui-pane jv-pane","aria-label":x("chat.botDms",{name:e.name}),children:[o.jsxs("header",{className:"ui-pane-header jv-pane-header",children:[S&&o.jsx(ut,{icon:"chevron-left",label:x("directs.back"),onClick:()=>y(null)}),o.jsx("strong",{children:S?x("directs.between",{name:e.name,other:qi(b(S))}):x("chat.botDms",{name:e.name})}),o.jsx("span",{className:"jv-spacer"}),o.jsx(ut,{icon:"close",label:x("common.close"),onClick:d})]}),S?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"ui-pane-body jv-pane-body",children:g===null?o.jsx("p",{className:"jv-picker-empty",children:x("threads.loading")}):g.length===0?o.jsx("p",{className:"jv-picker-empty",children:x("chat.empty")}):o.jsx(Xd,{messages:g,members:i,bots:r,me:s,divider:Number.MAX_SAFE_INTEGER,onSettled:()=>{},onPreview:f})}),o.jsx("p",{className:"jv-readonly",children:x("directs.readOnly")})]}):o.jsx("div",{className:"ui-pane-body jv-pane-body",children:a.length===0?o.jsx("p",{className:"jv-picker-empty",children:x("sidebar.noDms")}):a.map(k=>{const C=b(k);return o.jsxs("button",{type:"button",className:"jv-thread-item",onClick:()=>y(k.id),children:[o.jsxs("span",{className:"jv-thread-item-head",children:[o.jsx(wr,{member:C,bots:r,size:20}),o.jsx("strong",{children:qi(C)}),o.jsx("span",{className:"jv-muted",children:oB(k.updatedAt)})]}),k.lastMessage&&o.jsx("span",{className:"jv-muted jv-thread-item-meta",children:js(k.lastMessage)})]},k.id)})})]})}function uB(e,a){return e!=null&&e.connectionId?a!=null&&a.error?{label:x("activity.error"),tone:"error"}:(a==null?void 0:a.status)==="running"?{label:r5(a.activity),tone:"busy"}:{label:x((a==null?void 0:a.status)==="idle"?"activity.idle":"activity.stopped")}:{label:x("activity.noModel")}}function dB({channel:e,members:a,bots:i,statuses:r,me:s,onAdd:u,onBot:d,onChanged:f,onError:m}){const[p,y]=w.useState(null),g=a.filter(k=>e.memberIds.includes(k.id)),j=g.filter(k=>k.kind!=="bot").sort((k,C)=>+(C.id===s)-+(k.id===s)),b=g.filter(k=>k.kind==="bot"),S=k=>{const C=k.kind==="bot"?i.find(M=>M.id===k.id):void 0,T=r[k.id],O=k.kind==="bot"?uB(C,T):void 0,N=o.jsxs(o.Fragment,{children:[o.jsx(wr,{member:k,bots:i,size:28,working:(T==null?void 0:T.status)==="running"&&T.activity!=="asking"}),o.jsxs("span",{className:"jv-member-name",children:[k.name,k.id===s&&o.jsx("span",{className:"jv-role",children:x("common.you")})]}),O&&o.jsx("span",{className:"jv-member-state","data-tone":O.tone,children:O.label})]});return o.jsxs("div",{className:"jv-member-row",children:[C?o.jsx("button",{type:"button",className:"jv-member-main","aria-label":x("members.view",{name:k.name}),onClick:()=>d(k.id),children:N}):o.jsx("div",{className:"jv-member-main",children:N}),k.id!==s&&o.jsx(ut,{icon:"close",label:x("members.remove",{name:k.name}),className:"jv-member-remove",onClick:()=>y(k)})]},k.id)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"jv-member-bar",children:[o.jsx("span",{children:x("members.count",{count:g.length})}),o.jsxs("button",{type:"button",className:"ui-button ui-primary jv-member-pane-add",onClick:u,children:[o.jsx(qe,{name:"person-add"}),x("common.add")]})]}),o.jsx("div",{className:"ui-pane-body jv-pane-body",children:[["people",x("members.people"),j],["bots","Bot",b]].map(([k,C,T])=>T.length>0&&o.jsxs("section",{className:"jv-member-group","aria-label":C,children:[o.jsxs("h3",{children:[C," · ",T.length]}),T.map(S)]},k))}),p&&o.jsx(b5,{title:x("members.removeTitle",{name:p.name,channel:e.title}),body:x("members.removeBody"),confirm:x("members.removeConfirm"),onClose:()=>y(null),onConfirm:async()=>{try{f(await he.removeMember(e.id,p.id)),y(null)}catch(k){m(k)}}})]})}function Vb({label:e,value:a,empty:i,maxLength:r,required:s=!1,onSave:u}){const d=w.useId(),[f,m]=w.useState(null),[p,y]=w.useState(!1);w.useEffect(()=>m(null),[a]);const g=async()=>{if(!(f===null||p||s&&!f.trim())){if(f.trim()===a){m(null);return}y(!0);try{await u(f.trim()),m(null)}catch{}finally{y(!1)}}};return o.jsxs("div",{className:"jv-info-field",children:[o.jsxs("div",{className:"jv-info-label",children:[o.jsx("label",{htmlFor:d,children:e}),f===null&&o.jsx(ut,{icon:"pencil",label:x("info.edit",{name:e}),className:"jv-info-edit",onClick:()=>m(a)})]}),f===null?o.jsx("p",{className:"jv-info-value","data-empty":!a||void 0,children:a||i}):o.jsxs("div",{className:"jv-inline-edit",children:[o.jsx("input",{id:d,value:f,maxLength:r,autoFocus:!0,placeholder:i,onChange:j=>m(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),g()),j.key==="Escape"&&(j.stopPropagation(),m(null))}}),o.jsx("button",{type:"button",className:"ui-button",onClick:()=>m(null),children:x("common.cancel")}),o.jsx("button",{type:"button",className:"ui-button ui-primary",disabled:p||s&&!f.trim(),onClick:()=>void g(),children:x("common.save")})]})]})}function fB({channel:e,page:a,sections:i,members:r,bots:s,statuses:u,me:d,onPage:f,onPin:m,onMute:p,onAdd:y,onBot:g,onDelete:j,onChanged:b,onClose:S,onError:k}){const C=w.useId(),T=async N=>{try{b(await he.updateChannel(e.id,N))}catch(M){throw k(M),M}},O=r.filter(N=>e.memberIds.includes(N.id)).length;return o.jsxs("aside",{className:"ui-pane jv-pane","aria-label":x(a==="members"?"info.memberList":"entry.channelInfo"),children:[o.jsxs("header",{className:"ui-pane-header jv-pane-header",children:[a==="members"&&o.jsx(ut,{icon:"chevron-left",label:x("info.back"),className:"jv-pane-back",onClick:()=>f("main")}),o.jsx("strong",{children:x(a==="members"?"channel.members":"entry.channelInfo")}),o.jsxs("span",{className:"jv-muted jv-pane-sub",children:["#",e.title]}),o.jsx("span",{className:"jv-spacer"}),o.jsx(ut,{icon:"close",label:x("common.close"),onClick:S})]}),a==="members"?o.jsx(dB,{channel:e,members:r,bots:s,statuses:u,me:d,onAdd:y,onBot:g,onChanged:b,onError:k}):o.jsxs("div",{className:"ui-pane-body jv-pane-body jv-info",children:[o.jsxs("div",{className:"jv-info-actions",children:[o.jsxs("button",{type:"button","aria-pressed":e.pinned,onClick:m,children:[o.jsx(qe,{name:"pin"}),x("entry.pin")]}),o.jsxs("button",{type:"button","aria-pressed":e.muted,onClick:p,children:[o.jsx(qe,{name:e.muted?"bell-slash":"bell"}),x("entry.mute")]}),o.jsxs("button",{type:"button",onClick:y,children:[o.jsx(qe,{name:"person-add"}),x("info.addMembers")]})]}),o.jsx(Vb,{label:x("info.name"),value:e.title,empty:x("info.newChannel"),maxLength:80,required:!0,onSave:N=>T({name:N})}),o.jsx(Vb,{label:x("info.topic"),value:e.topic,empty:x("info.noTopic"),maxLength:200,onSave:N=>T({topic:N})}),o.jsxs("div",{className:"jv-info-field",children:[o.jsx("div",{className:"jv-info-label",children:o.jsx("label",{htmlFor:C,children:x("info.section")})}),o.jsx(GS,{id:C,value:e.sectionId,sections:i,onChange:N=>void T({sectionId:N}).catch(()=>{})})]}),o.jsxs("nav",{className:"jv-info-menu","aria-label":x("info.menu"),children:[o.jsxs("button",{type:"button",className:"ui-menu-item",onClick:()=>f("members"),children:[o.jsx(qe,{name:"people"}),o.jsx("span",{className:"ui-menu-copy",children:x("channel.members")}),o.jsx("span",{className:"jv-muted",children:O}),o.jsx(qe,{name:"chevron-right"})]}),o.jsxs("button",{type:"button",className:"ui-menu-item jv-menu-danger",onClick:j,children:[o.jsx(qe,{name:"trash"}),o.jsx("span",{className:"ui-menu-copy",children:x("entry.deleteChannel")})]})]})]})]})}function hB({chat:e,chats:a,members:i,focusKey:r,onOpenMessage:s,onClose:u,onError:d}){const[f,m]=w.useState(""),p=w.useRef(null);w.useEffect(()=>{var b,S;(b=p.current)==null||b.focus(),(S=p.current)==null||S.select()},[r,e.id]);const{result:y,loading:g}=j5(f,e.id,d),j=e.type==="channel"?`#${e.title}`:x(e.type==="thread"?"search.inThread":"search.inDm");return o.jsxs("aside",{className:"ui-pane jv-pane jv-search-pane","aria-label":x("search.paneLabel"),children:[o.jsxs("header",{className:"ui-pane-header jv-pane-header",children:[o.jsx("strong",{children:x("search.title")}),o.jsx("span",{className:"jv-muted jv-pane-sub",children:j}),o.jsx("span",{className:"jv-spacer"}),o.jsx(ut,{icon:"close",label:x("search.close"),onClick:u})]}),o.jsx("div",{className:"jv-pane-search",children:o.jsx("input",{ref:p,type:"search",value:f,placeholder:x(e.type==="channel"?"search.channelPlaceholder":"search.placeholder"),"aria-label":x("search.placeholder"),onChange:b=>m(b.target.value),onKeyDown:b=>{b.key==="Escape"&&(b.preventDefault(),f?m(""):u())}})}),o.jsx("div",{className:"ui-pane-body jv-pane-body jv-results","aria-live":"polite",children:f.trim()?y?y.messages.length?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"jv-result-count",children:x(y.messages.length>=60?"search.countLatest":"search.count",{count:y.messages.length})}),y.messages.map(({message:b,chat:S})=>o.jsx(k5,{message:b,chat:S,chats:a,members:i,query:f,showPlace:S.id!==e.id,onOpen:s},b.id))]}):o.jsx("p",{className:"jv-result-empty",children:x("search.noMessages")}):g&&o.jsx("p",{className:"jv-result-empty",children:x("search.searching")}):o.jsx("p",{className:"jv-result-empty",children:x("search.prompt")})})]})}const mB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function pB({chat:e,channelName:a,expanded:i=!1,onTitle:r,onStatus:s,onSummary:u,onConclude:d}){var N;const[f,m]=w.useState(null),[p,y]=w.useState(null),[g,j]=w.useState(!1),[b,S]=w.useState(i);w.useEffect(()=>{m(null),y(null),S(i)},[e.id,i]);const k=async(M,R)=>{j(!0);try{await M(),R()}catch{}finally{j(!1)}},C=e.status==="done",T=e.note,O=((N=T==null?void 0:T.text.split(`
571
571
  `).find(M=>M.trim()&&!M.startsWith("#")))==null?void 0:N.replace(/[*`|>-]/g,"").trim())??"";return o.jsxs("div",{className:"jv-thread-meta","data-open":b||void 0,children:[o.jsxs("div",{className:"jv-thread-title-row",children:[f===null?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"jv-thread-title",title:e.title,children:e.title}),o.jsx(ut,{icon:"pencil",label:x("thread.rename"),onClick:()=>m(e.title)})]}):o.jsxs("form",{className:"jv-inline-edit",onSubmit:M=>{M.preventDefault(),f.trim()&&k(()=>r(f.trim()),()=>m(null))},children:[o.jsx("input",{value:f,autoFocus:!0,maxLength:80,"aria-label":x("thread.title"),onChange:M=>m(M.target.value),onKeyDown:M=>{M.key==="Escape"&&m(null)}}),o.jsx("button",{type:"submit",className:"ui-button ui-primary",disabled:g||!f.trim(),children:x("common.save")})]}),o.jsx("button",{type:"button",className:"jv-thread-status","data-done":C||void 0,disabled:g,title:x("thread.toggleStatus"),onClick:()=>void k(()=>s(C?"open":"done"),()=>{}),children:C?o.jsxs(o.Fragment,{children:[o.jsx(qe,{name:"check"}),x("channel.threadDone")]}):x("threads.open")})]}),p!==null?o.jsxs("div",{className:"jv-summary","data-editing":!0,children:[o.jsx("textarea",{className:"jv-notice-input",value:p,autoFocus:!0,"aria-label":x("thread.summary"),onChange:M=>y(M.target.value)}),o.jsxs("div",{className:"jv-notice-actions",children:[o.jsx("button",{type:"button",className:"ui-button",onClick:()=>y(null),children:x("common.cancel")}),o.jsx("button",{type:"button",className:"ui-button ui-primary",disabled:g||!p.trim(),onClick:()=>void k(()=>u(p.trim()),()=>y(null)),children:x("common.save")})]})]}):T?o.jsxs("div",{className:"jv-summary",children:[o.jsxs("div",{className:"jv-summary-head",children:[o.jsxs("button",{type:"button",className:"jv-summary-toggle","aria-expanded":b,onClick:()=>S(!b),children:[o.jsx("strong",{children:x("thread.summary")}),!b&&o.jsx("span",{className:"jv-summary-first",children:O}),o.jsx(qe,{name:b?"chevron-down":"chevron-right"})]}),b&&o.jsxs("span",{className:"jv-muted jv-summary-meta",children:[T.updatedBy.name," · ",mB(T.updatedAt)," · ",x("notice.version",{version:T.version})]}),o.jsx(ut,{icon:"pencil",label:x("thread.editSummary"),onClick:()=>y(T.text)})]}),b&&o.jsx("div",{className:"jv-summary-body ui-bubble jv-flat",children:o.jsx(Fc,{text:T.text})}),b&&!C&&o.jsxs("button",{type:"button",className:"ui-button jv-conclude",disabled:g,onClick:()=>void k(d,()=>{}),children:[o.jsx(qe,{name:"check"}),x("thread.conclude",{channel:a})]})]}):o.jsxs("button",{type:"button",className:"jv-summary-empty",onClick:()=>y(""),children:[o.jsx(qe,{name:"add"}),x("thread.addSummary")]})]})}const Tp=50;function $b({threadId:e,mode:a,showSummary:i=!1,focus:r,onSearch:s,channel:u,drafts:d,members:f,bots:m,me:p,live:y,onClose:g,onToggleMode:j,onNav:b,onChanged:S,onInvite:k,onPreview:C,onError:T,onNotice:O}){var fe;const[N,M]=w.useState(null),[R,A]=w.useState(null),[B,P]=w.useState([]),[G,L]=w.useState(null),[q,F]=w.useState(!1),[W,$]=w.useState(!1),Y=w.useRef(B),K=w.useRef(q),U=w.useRef(null),H=w.useRef(null),Q=w.useRef(!1);Y.current=B,K.current=q;const _=w.useRef(null),ne=w.useRef(null),ee=w.useRef(null),D=w.useRef(!1),I=w.useRef(!0),[de,be]=w.useState(!1),je=w.useRef(0),we=w.useRef(0),Ae=w.useRef(0);w.useEffect(()=>{M(null),A(null),P([]),F(!1),L(null),D.current=!1,I.current=!0,be(!1),je.current=0,we.current=0,Ae.current=0},[e]);const Re=async J=>{const ge=await he.message(J).catch(()=>null);if(!ge||ge.chatId!==e)return null;const ke=Math.max(0,ge.sequence-1-Tp/2);return{...await he.messages(e,ke),hasOlder:ke>0}},xe=async()=>{const J=Y.current[0];return(J==null?void 0:J.chatId)===e?{...await he.messages(e,J.sequence-1),after:J.sequence-1}:(r&&ee.current!==e?await Re(r.id):null)??await he.latestMessages(e,Tp)},oe=J=>{const ge=J.after;P(ke=>ge===void 0?J.messages:z5(ke.filter(Oe=>Oe.chatId===e),J.messages,ge)),J.hasOlder!==void 0&&F(J.hasOlder)},Ee=J=>{const ge=Y.current,ke=ge.at(-1),Oe=Math.max((ke==null?void 0:ke.chatId)===e?ke.sequence:0,Ae.current);if(D5(J,Oe)&&!ge.some(Pe=>Pe.id===J.id)){xe().then(oe).catch(T);return}Ae.current=Math.max(Ae.current,J.sequence),P(Pe=>Rg(Pe,J))};O5(y,J=>{if(J.kind==="chat"){const ke=J.chat;ke.id===e&&M(Oe=>Oe&&{...ke,readSequence:Math.max(Oe.readSequence,ke.readSequence)});return}const ge=J.message;ge.id===(R==null?void 0:R.id)?A(ge):ge.chatId===e&&(J.kind==="message"?Ee(ge):P(ke=>xf(ke,ge)))});const Ke=async()=>{var ke;const J=Y.current[0],ge=_.current;if(!(!J||!K.current||Q.current)){Q.current=!0,$(!0);try{const Oe=await he.olderMessages(e,J.sequence,Tp);if(((ke=Y.current[0])==null?void 0:ke.id)!==J.id)return;H.current=ge?ge.scrollHeight-ge.scrollTop:null,P(Pe=>{var vt;return((vt=Pe[0])==null?void 0:vt.id)===J.id?[...Oe.messages,...Pe]:Pe}),F(Oe.hasOlder)}catch(Oe){T(Oe)}finally{Q.current=!1,$(!1)}}};w.useEffect(()=>{let J=!0;return Promise.all([he.chat(e),xe()]).then(async([ge,ke])=>{if(J&&(M(ge),oe(ke),ee.current!==e&&(ee.current=e,L(ge.readSequence)),ge.rootMessageId)){const Oe=await he.message(ge.rootMessageId);J&&A(Oe)}}).catch(ge=>{J&&T(ge)}),()=>{J=!1}},[e]),w.useLayoutEffect(()=>{const J=_.current;if(!J||!N)return;if(H.current!==null){J.scrollTo({top:J.scrollHeight-H.current,behavior:"instant"}),H.current=null;return}const ge=()=>J.scrollTo({top:J.scrollHeight,behavior:"instant"}),ke=B.at(-1),Oe=(ke==null?void 0:ke.senderId)===p&&ke.sequence>we.current;if(we.current=Math.max(we.current,(ke==null?void 0:ke.sequence)??0),D.current)(I.current||Oe)&&J.scrollTo({top:J.scrollHeight,behavior:"smooth"});else{if(!B.length&&!R)return;D.current=!0;const Pe=r?J.querySelector(`[data-message="${r.id}"]`):null;if(Pe){if(I.current=!1,Pe.scrollIntoView({block:"center"}),r!=null&&r.passage&&s5(Pe,r.passage))return;Pe.classList.add("jv-jump"),setTimeout(()=>Pe.classList.remove("jv-jump"),1600);return}ge(),requestAnimationFrame(ge)}(I.current||Oe)&&(je.current=(ke==null?void 0:ke.sequence)??0)},[B,R,N]),w.useEffect(()=>{D.current&&r&&Ze(r.id,r.passage)},[r]),w.useEffect(()=>{const J=_.current,ge=U.current;if(!J||!ge||!q||!D.current)return;const ke=new IntersectionObserver(Oe=>{var Pe;(Pe=Oe[0])!=null&&Pe.isIntersecting&&D.current&&Ke()},{root:J,rootMargin:"400px 0px 0px 0px"});return ke.observe(ge),()=>ke.disconnect()},[q,B,e,N]),w.useEffect(()=>{const J=_.current,ge=ne.current;if(!J||!ge)return;const ke=new ResizeObserver(()=>{!D.current||!I.current||J.scrollHeight-J.scrollTop-J.clientHeight<8||J.scrollTo({top:J.scrollHeight,behavior:"instant"})});ke.observe(ge);const Oe=()=>{var Pe;I.current=J.scrollHeight-J.scrollTop-J.clientHeight<120,I.current&&(je.current=Math.max(je.current,((Pe=Y.current.at(-1))==null?void 0:Pe.sequence)??0)),be(!I.current)};return Oe(),J.addEventListener("scroll",Oe,{passive:!0}),()=>{ke.disconnect(),J.removeEventListener("scroll",Oe)}},[_.current,e,N]),w.useEffect(()=>{const J=B.at(-1);if(!N||!J||J.chatId!==N.id)return;const ge=()=>{if(document.visibilityState!=="visible"||N.readSequence>=J.sequence)return;const ke={...N,readSequence:J.sequence,unread:0,mentions:0,alerts:0,atMe:!1,hint:null};M(ke),he.markRead(N.id,J.sequence).then(()=>S(ke)).catch(T)};return ge(),document.addEventListener("visibilitychange",ge),()=>document.removeEventListener("visibilitychange",ge)},[B,N]);const Le=async J=>{try{const ge=await J();M(ge),S(ge)}catch(ge){throw T(ge),ge}},Ye=async(J,ge,ke)=>{try{const Oe=await he.react(J.id,ge,ke),Pe=vt=>vt.id===Oe.id?{...vt,reactions:Oe.reactions}:vt;P(vt=>vt.map(Pe)),A(vt=>vt&&Pe(vt))}catch(Oe){T(Oe)}},et=async(J,ge)=>{try{const ke=await he.fold(J.id,ge),Oe=Pe=>Pe.id===ke.id?{...Pe,folded:ke.folded}:Pe;P(Pe=>Pe.map(Oe)),A(Pe=>Pe&&Oe(Pe))}catch(ke){T(ke)}},Ze=(J,ge)=>{const ke=()=>{var Pe;return J?(Pe=_.current)==null?void 0:Pe.querySelector(`[data-message="${J}"]`):null},Oe=ke();if(Oe){p0(Oe,ge);return}if(!J){O(x("app.sourceGone"));return}Re(J).then(Pe=>{if(!Pe){O(x("thread.sourceElsewhere"));return}oe(Pe),requestAnimationFrame(()=>{const vt=ke();vt&&p0(vt,ge)})})},It={onQuote:J=>T5(d,J,f),onReact:Ye,onFold:et,onJump:Ze,onError:T},en=async(J,ge,ke,Oe,Pe=[],vt=!1)=>{const Tt=await he.send(e,J,ge,ke,vt,Oe,Pe),hn=u?[...new Set(Ag(J,ui(f)).filter(tn=>!u.memberIds.includes(tn.member.id)).map(tn=>tn.member.name))]:[];hn.length&&O(x("app.notInChannel",{names:hn.join(x("common.listSeparator")),count:hn.length})),Ee(Tt)},qt=(u==null?void 0:u.title)??x("search.channel"),fn=f.find(J=>J.id===(R==null?void 0:R.senderId)),Ln=de?B.filter(J=>J.sequence>je.current&&J.senderId!==p).length:0,ea=a==="pane"?"aside":a==="embed"?"section":"main",ha=new Set([...R?[R.senderId,...R.mentions]:[],...B.flatMap(J=>[J.senderId,...J.mentions])]);return ha.delete(p),o.jsxs(ea,{className:a==="pane"?"ui-pane jv-pane":a==="embed"?"ui-chat jv-thread-full jv-thread-embed":"ui-chat jv-thread-full","aria-label":x("thread.label"),onKeyDown:J=>{N&&s&&(J.ctrlKey||J.metaKey)&&J.key.toLowerCase()==="f"&&(J.preventDefault(),s(N))},children:[o.jsxs("header",{className:a==="pane"?"ui-pane-header jv-pane-header":"ui-chat-header jv-pane-header",children:[a==="full"&&o.jsx(ut,{icon:"layout-sidebar-left",className:"ui-mobile-only",label:x("common.openNav"),onClick:b}),a==="embed"&&o.jsx(ut,{icon:"chevron-left",className:"ui-mobile-only",label:x("thread.backToList"),onClick:g}),a==="full"?o.jsxs("button",{type:"button",className:"jv-crumb",onClick:g,children:[o.jsx(qe,{name:"chevron-left"}),o.jsx("span",{className:"jv-hash",children:"#"}),qt]}):a==="embed"?o.jsxs("button",{type:"button",className:"jv-crumb",title:x("thread.inChannel"),onClick:j,children:[o.jsx("span",{className:"jv-hash",children:"#"}),qt]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:x("thread.label")}),o.jsxs("span",{className:"jv-muted jv-pane-sub",children:["#",qt]})]}),o.jsx("span",{className:"jv-spacer"}),N&&s&&o.jsx(ut,{icon:"search",label:x("thread.search"),onClick:()=>s(N)}),N&&o.jsxs("button",{type:"button",className:"ui-button jv-follow","data-on":N.following||void 0,title:x(N.following?"thread.followingHint":"thread.notFollowingHint"),onClick:()=>void Le(()=>he.follow(e,!N.following)).catch(()=>{}),children:[o.jsx(qe,{name:"bell"}),x(N.following?"threads.following":"thread.follow")]}),a!=="embed"&&o.jsx(ut,{icon:a==="pane"?"arrows-expand":"arrows-contract",className:"jv-desktop-only",label:x(a==="pane"?"thread.expand":"thread.collapse"),onClick:j}),a==="pane"&&o.jsx(ut,{icon:"close",label:x("thread.close"),onClick:g})]}),N&&o.jsx("div",{className:a==="pane"?"jv-thread-pin":"jv-thread-pin jv-thread-pin-wide",children:o.jsx(pB,{chat:N,channelName:qt,expanded:i,onTitle:J=>Le(()=>he.updateThread(e,{title:J})),onStatus:J=>Le(()=>he.updateThread(e,{status:J})),onSummary:J=>Le(()=>he.setNote(e,J)),onConclude:async()=>{var J;try{await en(`${x("thread.conclusion")}
572
572
 
573
- ${((J=N.note)==null?void 0:J.text)??""}`,[],Array.from(crypto.getRandomValues(new Uint8Array(16)),ge=>ge.toString(16).padStart(2,"0")).join(""),void 0,[],!0),await Le(()=>he.updateThread(e,{status:"done"})),O(x("thread.concluded",{channel:qt}))}catch(ge){throw T(ge),ge}}})}),o.jsxs("div",{ref:_,className:a==="pane"?"ui-pane-body jv-pane-body":"ui-transcript jv-thread-wide",children:[o.jsxs("div",{ref:ne,children:[R&&o.jsx(Xd,{messages:[{...R,thread:null}],members:f,bots:m,me:p,divider:Number.MAX_SAFE_INTEGER,onSettled:()=>{},onPreview:C,onReact:Ye,onFold:et,onJump:Ze,onError:T}),o.jsx("div",{className:"jv-divider","data-tone":"count",role:"separator",children:o.jsx("span",{children:B.length?x("channel.replies",{count:((fe=R==null?void 0:R.thread)==null?void 0:fe.replies)??B.length}):x("thread.noReplies")})}),q&&o.jsx("div",{ref:U,className:"jv-history-more","aria-live":"polite",children:W?x("chat.loadingOlder"):""}),o.jsx(Xd,{messages:B,members:f,bots:m,me:p,divider:G??Number.MAX_SAFE_INTEGER,before:R==null?void 0:R.createdAt,onSettled:J=>P(ge=>ge.map(ke=>ke.id===J.id?J:ke)),onPreview:C,...It})]}),de&&B.length>0&&o.jsx("div",{className:"jv-to-latest",children:o.jsxs("button",{type:"button","aria-label":x("thread.toLatest"),onClick:()=>{var J;return(J=_.current)==null?void 0:J.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},children:[Ln>0&&o.jsx("span",{children:x("chat.unseen",{count:Ln})}),o.jsx(qe,{name:"chevron-down"})]})})]}),o.jsx(A5,{chatId:e,id:"jarvy-thread-composer",drafts:d,placeholder:x("thread.reply"),scrollRef:_,disabled:!N,initialText:B.length===0&&R&&R.senderId!==p&&fn&&!fn.deleted?`@${fn.name} `:void 0,mention:{bots:m,inside:ui(f).filter(J=>J.id!==p&&!!(u!=null&&u.memberIds.includes(J.id))),outside:ui(f).filter(J=>!(u!=null&&u.memberIds.includes(J.id))),onInvite:k,participants:ha},onSend:en,onError:T,onNotice:O}),o.jsx(c5,{container:_,drafts:d,chatId:e,members:f,onNotice:O,source:J=>J===(R==null?void 0:R.id)?R:B.find(ge=>ge.id===J)})]})}function Gb(e,a){const i=e.lastReplyAt??e.createdAt;return a==="created"?[0,-e.createdAt,e.id]:a==="status"?[e.status==="done"?1:0,-i,e.id]:[0,-i,e.id]}function gB(e,a){return e[0]-a[0]||e[1]-a[1]||(e[2]<a[2]?-1:e[2]>a[2]?1:0)}const Qd=e=>(a,i)=>gB(Gb(a,e),Gb(i,e)),Ap={updated:"threadSort.updated",created:"threadSort.created",status:"threadSort.status"},vB=(e,a)=>[...e].sort(Qd(a));function L5(e){const a=`jarvy-thread-sort-${e}`,[i,r]=w.useState(()=>{const s=localStorage.getItem(a);return s==="created"||s==="status"?s:"updated"});return[i,s=>{r(s),localStorage.setItem(a,s)}]}function I5({value:e,onChange:a}){return o.jsxs(hr,{value:e,onValueChange:i=>a(i),children:[o.jsxs(pr,{className:"jv-thread-sort","aria-label":x("threadSort.current",{order:x(Ap[e])}),title:x("threadSort.title"),children:[o.jsx(S8,{}),o.jsx(mr,{})]}),o.jsx(gr,{className:"jv-select-menu",position:"popper",sideOffset:4,align:"end",children:Object.keys(Ap).map(i=>o.jsx(ua,{value:i,children:x(Ap[i])},i))})]})}const Yb={epoch:0,unlisted:0,counts:{}},yB=(e,a,i)=>({epoch:e.epoch,unlisted:e.unlisted+(i?1:0),counts:{...e.counts,[a]:(e.counts[a]??0)+1}}),xB=e=>({...e,epoch:e.epoch+1}),bB=(e,a)=>`${e.epoch}:${a?e.counts[a]??0:0}`,jB=e=>`${e.epoch}:${e.unlisted}`,wB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function SB({channel:e,members:a,bots:i,changes:r,onOpen:s,onClose:u,onError:d}){const[f,m]=w.useState(null),[p,y]=w.useState("open"),[g,j]=L5("channel");w.useEffect(()=>{let k=!0;return he.channelThreads(e.id).then(C=>{k&&m(C.threads)}).catch(C=>{k&&d(C)}),()=>{k=!1}},[e.id,bB(r,e.id)]);const b=vB((f??[]).filter(k=>p==="all"||k.status===p),g),S=k=>(f??[]).filter(C=>C.status===k).length;return o.jsxs("aside",{className:"ui-pane jv-pane","aria-label":x("threads.list"),children:[o.jsxs("header",{className:"ui-pane-header jv-pane-header",children:[o.jsx("strong",{children:x("channel.threads")}),o.jsxs("span",{className:"jv-muted jv-pane-sub",children:["#",e.title]}),o.jsx("span",{className:"jv-spacer"}),o.jsx(I5,{value:g,onChange:j}),o.jsx(ut,{icon:"close",label:x("threads.closeList"),onClick:u})]}),o.jsx("div",{className:"jv-tabs",role:"tablist","aria-label":x("threads.byStatus"),children:[["open",x("threads.openCount",{count:S("open")})],["done",x("threads.doneCount",{count:S("done")})],["all",x("threads.all")]].map(([k,C])=>o.jsx("button",{type:"button",role:"tab","aria-selected":p===k,onClick:()=>y(k),children:C},k))}),o.jsx("div",{className:"ui-pane-body jv-pane-body",children:f===null?o.jsx("p",{className:"jv-picker-empty",children:x("threads.loading")}):b.length===0?o.jsx("p",{className:"jv-picker-empty",children:x("threads.none")}):b.map(k=>{const C=a.find(T=>{var O;return T.id===((O=k.root)==null?void 0:O.senderId)});return o.jsxs("button",{type:"button",className:"jv-thread-item","data-unread":k.unread>0||void 0,onClick:()=>s(k.id),children:[o.jsxs("span",{className:"jv-thread-item-head",children:[o.jsx("strong",{children:k.title}),k.alerts>0?o.jsx("span",{className:"jv-badge",children:k.alerts}):k.unread>0&&o.jsx("span",{className:"jv-count",children:k.unread}),o.jsx("span",{className:"jv-thread-status","data-done":k.status==="done"||void 0,children:x(k.status==="done"?"channel.threadDone":"threads.open")})]}),k.root&&o.jsxs("span",{className:"jv-thread-item-root",children:[o.jsx(wr,{member:C,bots:i,size:16}),o.jsx("span",{children:js(k.root)})]}),o.jsxs("span",{className:"jv-muted jv-thread-item-meta",children:[x("channel.replies",{count:k.replies}),k.lastReplyAt?` · ${wB(k.lastReplyAt)}`:"",k.following?` · ${x("threads.following")}`:""]})]},k.id)})})]})}class kB{constructor(){Fl(this,"listeners",new Set)}emit(a){for(const i of this.listeners)i(a)}on(a){return this.listeners.add(a),()=>{this.listeners.delete(a)}}}const Mp=(e,a)=>a==="all"||(a==="unread"?e.unread>0:e.status===a),kd=(e,a)=>[...new Map(e.map(i=>[i.id,i])).values()].sort(Qd(a));function CB(e,a,i){const[r,s]=w.useState({items:[],next:null,ready:!1}),[u,d]=w.useState(!1),[f,m]=w.useState(!1),p=w.useRef({filter:a,sort:i,generation:0}),y=w.useRef(r),g=w.useRef(new Map);y.current=r;const j=N=>{y.current=N,s(N)};async function b(N){const M=p.current.generation;d(!0),m(!1);try{const R=await he.followedThreads({filter:a,sort:i,cursor:N});if(M!==p.current.generation)return;const A=y.current,B=R.next?R.threads.at(-1):void 0,P=[...g.current.values()].filter(G=>Mp(G,a)&&(!B||Qd(i)(G,B)<=0));j({items:kd([...N?A.items:[],...R.threads,...P],i),next:R.next,ready:!0})}catch{M===p.current.generation&&m(!0)}finally{M===p.current.generation&&d(!1)}}w.useEffect(()=>{p.current={filter:a,sort:i,generation:p.current.generation+1},j({items:[],next:null,ready:!1}),b()},[a,i]);const S=w.useRef(new Map);function k(N){if(S.current.has(N)){S.current.set(N,!0);return}S.current.set(N,!1);const M=p.current.generation;he.followedThread(N).then(R=>C(R,M),R=>{R instanceof Bi&&R.status===404&&M===p.current.generation&&j({...y.current,items:y.current.items.filter(A=>A.id!==N)})}).finally(()=>{const R=S.current.get(N);S.current.delete(N),R&&k(N)})}function C(N,M){if(M!==p.current.generation)return;T(N);const R=y.current,A=R.items.some(G=>G.id===N.id),B=R.items.at(-1),P=N.following&&Mp(N,p.current.filter)&&(R.next===null||!B||Qd(p.current.sort)(N,B)<0);(A||R.ready&&P)&&j({...R,items:kd([...R.items,N],p.current.sort)})}w.useEffect(()=>e.on(N=>{if(N.kind==="changed")k(N.id);else if(N.kind==="reconnected")O();else{const M=N.chat,R=y.current,A=R.items.find(P=>P.id===M.id);if(!A){M.following&&k(M.id);return}const B={...A,title:M.title,status:M.status??A.status,unread:M.unread,mentions:M.mentions,alerts:M.alerts,following:M.following};T(B),j({...R,items:kd([...R.items,B],p.current.sort)})}}),[e]);function T(N){N.following?g.current.delete(N.id):y.current.items.some(M=>M.id===N.id)&&g.current.set(N.id,N)}async function O(){const N=p.current.generation,M=await he.followedThreads({filter:p.current.filter,sort:p.current.sort}).catch(()=>null);if(!M||N!==p.current.generation)return;const R=y.current,A=R.items.length>M.threads.length;j({items:kd([...R.items,...M.threads],p.current.sort),next:A?R.next:M.next,ready:!0})}return{items:r.items.filter(N=>Mp(N,a)),find:N=>r.items.find(M=>M.id===N),ready:r.ready,more:r.next!==null,loading:u,failed:f,loadMore:()=>{r.next&&!u&&b(r.next)},retry:()=>void b(r.next??void 0)}}const NB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}),EB={all:"threads.none",unread:"threads.noneUnread",open:"threads.noneOpen",done:"threads.noneDone"};function TB({events:e,summary:a,chats:i,members:r,bots:s,onNav:u,renderThread:d}){const[f,m]=w.useState(null),[p,y]=w.useState("all"),[g,j]=L5("followed"),b=CB(e,p,g),S=f?b.find(f.id)??f:void 0,k=w.useRef(null),C=w.useRef(null);w.useEffect(()=>{if(!k.current||!C.current||!b.more||b.loading||b.failed)return;const O=new IntersectionObserver(N=>{var M;(M=N[0])!=null&&M.isIntersecting&&b.loadMore()},{root:k.current,rootMargin:"0px 0px 400px 0px"});return O.observe(C.current),()=>O.disconnect()},[b.more,b.loading,b.failed,b.items]);const T=[["all",x("threads.all")],["unread",a!=null&&a.unreadThreads?x("threads.unreadCount",{count:a.unreadThreads}):x("threads.unread")],["open",x("threads.openCount",{count:(a==null?void 0:a.open)??0})],["done",x("threads.doneCount",{count:(a==null?void 0:a.done)??0})]];return o.jsxs("main",{className:"ui-chat jv-followed-page","aria-label":x("sidebar.followed"),"data-open":S?"":void 0,children:[o.jsxs("section",{className:"jv-followed-list","aria-label":x("threads.list"),children:[o.jsxs("header",{className:"ui-chat-header jv-channel-header",children:[o.jsxs("div",{className:"ui-header-left",children:[o.jsx(ut,{icon:"layout-sidebar-left",className:"ui-mobile-only",label:x("common.openNav"),onClick:u}),o.jsx("strong",{className:"jv-channel-title",children:x("sidebar.followed")})]}),o.jsx(I5,{value:g,onChange:j})]}),o.jsx("div",{className:"jv-tabs",role:"tablist","aria-label":x("threads.filter"),children:T.map(([O,N])=>o.jsx("button",{type:"button",role:"tab","aria-selected":p===O,onClick:()=>y(O),children:N},O))}),o.jsxs("div",{className:"jv-followed-items",ref:k,children:[b.ready&&b.items.length===0&&!b.more?o.jsx("p",{className:"jv-picker-empty",children:x(EB[p])}):b.items.map(O=>{const N=r.find(R=>{var A;return R.id===((A=O.root)==null?void 0:A.senderId)}),M=i.find(R=>R.id===O.parentId);return o.jsxs("button",{type:"button",className:"jv-thread-item","data-unread":O.unread>0||void 0,"aria-current":O.id===(f==null?void 0:f.id)||void 0,onClick:()=>m(O),children:[o.jsxs("span",{className:"jv-thread-item-head",children:[o.jsx("strong",{children:O.title}),O.alerts>0?o.jsx("span",{className:"jv-badge",children:O.alerts}):O.unread>0&&o.jsx("span",{className:"jv-count",children:O.unread}),o.jsx("span",{className:"jv-thread-status","data-done":O.status==="done"||void 0,children:x(O.status==="done"?"channel.threadDone":"threads.open")})]}),O.root&&o.jsxs("span",{className:"jv-thread-item-root",children:[o.jsx(wr,{member:N,bots:s,size:16}),o.jsx("span",{children:js(O.root)})]}),o.jsxs("span",{className:"jv-muted jv-thread-item-meta",children:["#",(M==null?void 0:M.title)??""," · ",x("channel.replies",{count:O.replies}),O.lastReplyAt?` · ${NB(O.lastReplyAt)}`:"",O.following?"":` · ${x("threads.notFollowing")}`]})]},O.id)}),o.jsx("div",{ref:C,className:"jv-followed-end",children:b.failed?o.jsxs(o.Fragment,{children:[o.jsx("p",{role:"alert",children:x("threads.loadFailed")}),o.jsx(Me,{variant:"outline",size:"sm",onClick:b.retry,children:x("common.retry")})]}):(b.loading||!b.ready)&&o.jsx("p",{role:"status",children:x("threads.loading")})})]})]}),S?d(S,()=>m(null)):o.jsx("div",{className:"jv-followed-empty",children:o.jsx("p",{children:x("threads.pick")})})]})}function AB({pane:e,followedView:a,threadEvents:i,followed:r,chats:s,sections:u,members:d,bots:f,statuses:m,meId:p,drafts:y,changes:g,live:j,paneChannel:b,activeBot:S,botDirects:k,find:C,onPane:T,onNav:O,onBackToChannel:N,onAddMembers:M,onOpenBot:R,onPin:A,onMute:B,onDeleteChannel:P,onChannelSaved:G,onThreadChanged:L,onInvite:q,onPreview:F,onNotice:W,onError:$,paneWidth:Y,onResize:K}){var _,ne;const U=(e==null?void 0:e.kind)==="thread"?e:null,H=(U==null?void 0:U.mode)==="full",Q=()=>T(null);return o.jsxs(o.Fragment,{children:[a&&!H&&o.jsx(TB,{events:i,summary:r,chats:s,members:d,bots:f,onNav:O,renderThread:(ee,D)=>o.jsx($b,{threadId:ee.id,mode:"embed",channel:s.find(I=>I.id===ee.parentId),drafts:y,members:d,bots:f,me:p,live:j,onNav:O,onChanged:L,onClose:D,onToggleMode:()=>N({id:ee.id,parentId:ee.parentId},!0),onInvite:I=>q(ee.parentId,I),onPreview:F,onError:$,onNotice:W},ee.id)}),U&&o.jsx($b,{threadId:U.id,mode:U.mode,showSummary:U.summary,focus:U.focus,onSearch:C.search,channel:s.find(ee=>ee.id===U.parentId),drafts:y,members:d,bots:f,me:p,live:j,onNav:O,onChanged:L,onClose:()=>H?N(U,!1):Q(),onToggleMode:()=>H?N(U,!0):T({...U,mode:"full"}),onInvite:ee=>q(U.parentId,ee),onPreview:F,onError:$,onNotice:W},`${U.id}:${((_=U.focus)==null?void 0:_.id)??""}:${((ne=U.focus)==null?void 0:ne.passage)??""}`),(e==null?void 0:e.kind)==="search"&&o.jsx(hB,{chat:e.chat,chats:s,members:d,focusKey:C.focusKey,onOpenMessage:C.openMessage,onClose:Q,onError:$}),(e==null?void 0:e.kind)==="threads"&&b&&o.jsx(SB,{channel:b,members:d,bots:f,changes:g,onOpen:ee=>T({kind:"thread",id:ee,parentId:b.id,mode:"pane"}),onClose:Q,onError:$}),(e==null?void 0:e.kind)==="info"&&b&&o.jsx(fB,{channel:b,page:e.page,sections:u,members:ui(d),bots:f,statuses:m,me:p,onPage:ee=>T({kind:"info",page:ee}),onPin:()=>A(b),onMute:()=>B(b),onAdd:()=>M(b),onBot:R,onDelete:()=>P(b),onChanged:G,onClose:Q,onError:$}),(e==null?void 0:e.kind)==="botdms"&&S&&!b&&o.jsx(cB,{bot:S,chats:k,members:d,bots:f,me:p,live:j,onClose:Q,onPreview:F,onError:$}),e&&!H&&o.jsx("div",{className:"jv-resize",style:{right:Y-4},onPointerDown:K,role:"separator","aria-orientation":"vertical","aria-label":x("app.resizePane")})]})}const Xb="@goodfish/jarvy",B5="0.11.0",MB={url:"git+https://github.com/AzzzGoodFish/Jarvy.git"},_B="Apache-2.0",x0=MB.url.replace(/^git\+/,"").replace(/\.git$/,""),Kb=`${x0}/blob/v${B5}`,RB=[{label:"about.source",detail:x0.replace(/^https:\/\//,""),href:x0},{label:"about.package",detail:Xb,href:`https://www.npmjs.com/package/${Xb}`},{label:"about.license",detail:_B,href:`${Kb}/LICENSE`},{label:"about.notices",detail:"THIRD_PARTY_NOTICE.md",href:`${Kb}/THIRD_PARTY_NOTICE.md`}];function OB(){return o.jsxs("div",{className:"jv-page",children:[o.jsx("header",{className:"jv-page-header",children:o.jsx("h2",{children:x("settings.about")})}),o.jsxs("div",{className:"jv-list",children:[o.jsxs("div",{className:"jv-list-row jv-static-row jv-about-intro",children:[o.jsxs("div",{className:"jv-row-text",children:[o.jsx("strong",{children:"Jarvy"}),o.jsx("span",{children:x("about.tagline")})]}),o.jsx("span",{className:"jv-row-meta",children:x("about.version",{version:B5})})]}),RB.map(e=>o.jsxs("a",{className:"jv-list-row jv-link-row",href:e.href,target:"_blank",rel:"noreferrer",children:[o.jsxs("div",{className:"jv-row-text",children:[o.jsx("strong",{children:x(e.label)}),o.jsx("span",{children:e.detail})]}),o.jsx(R8,{"aria-hidden":"true"})]},e.label))]})]})}function DB(){const[e,a]=w.useState(document.documentElement.classList.contains("dark")),i=s=>{Gd(s?"dark":"light"),a(s)},r=(s,u,d,f,m)=>o.jsxs("button",{type:"button",role:"radio","aria-checked":d,lang:m,className:"jv-list-row jv-choice-row",onClick:f,children:[o.jsx("span",{className:"jv-row-text",children:o.jsx("strong",{children:u})}),d&&o.jsx(Oa,{"aria-hidden":"true"})]},s);return o.jsxs("div",{className:"jv-page",children:[o.jsx("header",{className:"jv-page-header",children:o.jsx("h2",{children:x("settings.general")})}),o.jsxs("section",{className:"jv-section","aria-labelledby":"general-language",children:[o.jsx("h3",{id:"general-language",className:"jv-section-title",children:x("general.language")}),o.jsx("div",{className:"jv-list",role:"radiogroup","aria-labelledby":"general-language",children:lj.map(s=>r(s,Dp(s,"name"),no()===s,()=>cj(s),s))})]}),o.jsxs("section",{className:"jv-section","aria-labelledby":"general-theme",children:[o.jsx("h3",{id:"general-theme",className:"jv-section-title",children:x("general.theme")}),o.jsxs("div",{className:"jv-list",role:"radiogroup","aria-labelledby":"general-theme",children:[r("light",x("general.light"),!e,()=>i(!1)),r("dark",x("general.dark"),e,()=>i(!0))]})]})]})}const zB=`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M9.797 6.282a.451.451 0 01-.336-.315 1.019 1.019 0 010-.505c.156-.86.3-1.725.501-2.577.14-.7.42-1.367.823-1.96.305-.431.75-.746 1.262-.89.877-.217 1.24.629.937 1.348-.259.593-.877.914-1.334 1.348-.835.795-1.096 2.14-1.336 3.212a.427.427 0 01-.186.277.437.437 0 01-.331.062z" fill="url(#lobe-icons-ant-group-0-_R_0_)" transform="translate(3)"></path><path d="M6.334 4.672c.33-.121.682.146.946.297.278.145.587.219.901.214.231.01.466 0 .688.018 4.098.176 7.484 3.22 8.05 7.237.565 4.016-1.852 7.859-5.745 9.134-3.894 1.276-8.153-.38-10.126-3.935A8.339 8.339 0 013.133 7.081c.348-.278.716-.53 1.102-.755a8.404 8.404 0 001.318-.79c.28-.243.45-.742.781-.864zm4.406 2.15c-2.841.003-4.898 2.533-4.628 5.642.27 3.109 2.781 5.641 5.613 5.665 2.832.024 4.932-2.512 4.658-5.644-.273-3.133-2.802-5.666-5.643-5.663zm.357.57a4.707 4.707 0 013.304 1.446 5.703 5.703 0 011.643 3.49 4.841 4.841 0 01-1.141 3.705v.015a3.923 3.923 0 01-2.808 1.303 4.664 4.664 0 01-3.367-1.387 5.678 5.678 0 01-1.71-3.518 4.832 4.832 0 011.14-3.753 3.923 3.923 0 012.813-1.3h.126z" fill="url(#lobe-icons-ant-group-1-_R_0_)" transform="translate(3)"></path><path d="M2.346 2.054a1.26 1.26 0 01.384-.594.842.842 0 011.165.11c.694.82.169 2.078.142 3.02.013.805.208 1.597.57 2.318.084.134.147.279.186.43a.539.539 0 01-.3.577c-.345.17-.568-.19-.709-.446-.324-.6-.617-1.216-.877-1.846a8.698 8.698 0 01-.618-1.987 7.523 7.523 0 01-.051-.37 3.717 3.717 0 01-.024-.34 2.506 2.506 0 01.132-.872z" fill="url(#lobe-icons-ant-group-2-_R_0_)" transform="translate(3)"></path><defs><linearGradient id="lobe-icons-ant-group-0-_R_0_" x1="31.373%" x2="61.365%" y1="95.551%" y2="-.348%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient><linearGradient id="lobe-icons-ant-group-1-_R_0_" x1="4.366%" x2="94.359%" y1="65.982%" y2="32.918%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient><linearGradient id="lobe-icons-ant-group-2-_R_0_" x1="56.255%" x2="45.986%" y1="99.257%" y2="1.384%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient></defs></svg>
573
+ ${((J=N.note)==null?void 0:J.text)??""}`,[],Array.from(crypto.getRandomValues(new Uint8Array(16)),ge=>ge.toString(16).padStart(2,"0")).join(""),void 0,[],!0),await Le(()=>he.updateThread(e,{status:"done"})),O(x("thread.concluded",{channel:qt}))}catch(ge){throw T(ge),ge}}})}),o.jsxs("div",{ref:_,className:a==="pane"?"ui-pane-body jv-pane-body":"ui-transcript jv-thread-wide",children:[o.jsxs("div",{ref:ne,children:[R&&o.jsx(Xd,{messages:[{...R,thread:null}],members:f,bots:m,me:p,divider:Number.MAX_SAFE_INTEGER,onSettled:()=>{},onPreview:C,onReact:Ye,onFold:et,onJump:Ze,onError:T}),o.jsx("div",{className:"jv-divider","data-tone":"count",role:"separator",children:o.jsx("span",{children:B.length?x("channel.replies",{count:((fe=R==null?void 0:R.thread)==null?void 0:fe.replies)??B.length}):x("thread.noReplies")})}),q&&o.jsx("div",{ref:U,className:"jv-history-more","aria-live":"polite",children:W?x("chat.loadingOlder"):""}),o.jsx(Xd,{messages:B,members:f,bots:m,me:p,divider:G??Number.MAX_SAFE_INTEGER,before:R==null?void 0:R.createdAt,onSettled:J=>P(ge=>ge.map(ke=>ke.id===J.id?J:ke)),onPreview:C,...It})]}),de&&B.length>0&&o.jsx("div",{className:"jv-to-latest",children:o.jsxs("button",{type:"button","aria-label":x("thread.toLatest"),onClick:()=>{var J;return(J=_.current)==null?void 0:J.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},children:[Ln>0&&o.jsx("span",{children:x("chat.unseen",{count:Ln})}),o.jsx(qe,{name:"chevron-down"})]})})]}),o.jsx(A5,{chatId:e,id:"jarvy-thread-composer",drafts:d,placeholder:x("thread.reply"),scrollRef:_,disabled:!N,initialText:B.length===0&&R&&R.senderId!==p&&fn&&!fn.deleted?`@${fn.name} `:void 0,mention:{bots:m,inside:ui(f).filter(J=>J.id!==p&&!!(u!=null&&u.memberIds.includes(J.id))),outside:ui(f).filter(J=>!(u!=null&&u.memberIds.includes(J.id))),onInvite:k,participants:ha},onSend:en,onError:T,onNotice:O}),o.jsx(c5,{container:_,drafts:d,chatId:e,members:f,onNotice:O,source:J=>J===(R==null?void 0:R.id)?R:B.find(ge=>ge.id===J)})]})}function Gb(e,a){const i=e.lastReplyAt??e.createdAt;return a==="created"?[0,-e.createdAt,e.id]:a==="status"?[e.status==="done"?1:0,-i,e.id]:[0,-i,e.id]}function gB(e,a){return e[0]-a[0]||e[1]-a[1]||(e[2]<a[2]?-1:e[2]>a[2]?1:0)}const Qd=e=>(a,i)=>gB(Gb(a,e),Gb(i,e)),Ap={updated:"threadSort.updated",created:"threadSort.created",status:"threadSort.status"},vB=(e,a)=>[...e].sort(Qd(a));function L5(e){const a=`jarvy-thread-sort-${e}`,[i,r]=w.useState(()=>{const s=localStorage.getItem(a);return s==="created"||s==="status"?s:"updated"});return[i,s=>{r(s),localStorage.setItem(a,s)}]}function I5({value:e,onChange:a}){return o.jsxs(hr,{value:e,onValueChange:i=>a(i),children:[o.jsxs(pr,{className:"jv-thread-sort","aria-label":x("threadSort.current",{order:x(Ap[e])}),title:x("threadSort.title"),children:[o.jsx(S8,{}),o.jsx(mr,{})]}),o.jsx(gr,{className:"jv-select-menu",position:"popper",sideOffset:4,align:"end",children:Object.keys(Ap).map(i=>o.jsx(ua,{value:i,children:x(Ap[i])},i))})]})}const Yb={epoch:0,unlisted:0,counts:{}},yB=(e,a,i)=>({epoch:e.epoch,unlisted:e.unlisted+(i?1:0),counts:{...e.counts,[a]:(e.counts[a]??0)+1}}),xB=e=>({...e,epoch:e.epoch+1}),bB=(e,a)=>`${e.epoch}:${a?e.counts[a]??0:0}`,jB=e=>`${e.epoch}:${e.unlisted}`,wB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"});function SB({channel:e,members:a,bots:i,changes:r,onOpen:s,onClose:u,onError:d}){const[f,m]=w.useState(null),[p,y]=w.useState("open"),[g,j]=L5("channel");w.useEffect(()=>{let k=!0;return he.channelThreads(e.id).then(C=>{k&&m(C.threads)}).catch(C=>{k&&d(C)}),()=>{k=!1}},[e.id,bB(r,e.id)]);const b=vB((f??[]).filter(k=>p==="all"||k.status===p),g),S=k=>(f??[]).filter(C=>C.status===k).length;return o.jsxs("aside",{className:"ui-pane jv-pane","aria-label":x("threads.list"),children:[o.jsxs("header",{className:"ui-pane-header jv-pane-header",children:[o.jsx("strong",{children:x("channel.threads")}),o.jsxs("span",{className:"jv-muted jv-pane-sub",children:["#",e.title]}),o.jsx("span",{className:"jv-spacer"}),o.jsx(I5,{value:g,onChange:j}),o.jsx(ut,{icon:"close",label:x("threads.closeList"),onClick:u})]}),o.jsx("div",{className:"jv-tabs",role:"tablist","aria-label":x("threads.byStatus"),children:[["open",x("threads.openCount",{count:S("open")})],["done",x("threads.doneCount",{count:S("done")})],["all",x("threads.all")]].map(([k,C])=>o.jsx("button",{type:"button",role:"tab","aria-selected":p===k,onClick:()=>y(k),children:C},k))}),o.jsx("div",{className:"ui-pane-body jv-pane-body",children:f===null?o.jsx("p",{className:"jv-picker-empty",children:x("threads.loading")}):b.length===0?o.jsx("p",{className:"jv-picker-empty",children:x("threads.none")}):b.map(k=>{const C=a.find(T=>{var O;return T.id===((O=k.root)==null?void 0:O.senderId)});return o.jsxs("button",{type:"button",className:"jv-thread-item","data-unread":k.unread>0||void 0,onClick:()=>s(k.id),children:[o.jsxs("span",{className:"jv-thread-item-head",children:[o.jsx("strong",{children:k.title}),k.alerts>0?o.jsx("span",{className:"jv-badge",children:k.alerts}):k.unread>0&&o.jsx("span",{className:"jv-count",children:k.unread}),o.jsx("span",{className:"jv-thread-status","data-done":k.status==="done"||void 0,children:x(k.status==="done"?"channel.threadDone":"threads.open")})]}),k.root&&o.jsxs("span",{className:"jv-thread-item-root",children:[o.jsx(wr,{member:C,bots:i,size:16}),o.jsx("span",{children:js(k.root)})]}),o.jsxs("span",{className:"jv-muted jv-thread-item-meta",children:[x("channel.replies",{count:k.replies}),k.lastReplyAt?` · ${wB(k.lastReplyAt)}`:"",k.following?` · ${x("threads.following")}`:""]})]},k.id)})})]})}class kB{constructor(){Fl(this,"listeners",new Set)}emit(a){for(const i of this.listeners)i(a)}on(a){return this.listeners.add(a),()=>{this.listeners.delete(a)}}}const Mp=(e,a)=>a==="all"||(a==="unread"?e.unread>0:e.status===a),kd=(e,a)=>[...new Map(e.map(i=>[i.id,i])).values()].sort(Qd(a));function CB(e,a,i){const[r,s]=w.useState({items:[],next:null,ready:!1}),[u,d]=w.useState(!1),[f,m]=w.useState(!1),p=w.useRef({filter:a,sort:i,generation:0}),y=w.useRef(r),g=w.useRef(new Map);y.current=r;const j=N=>{y.current=N,s(N)};async function b(N){const M=p.current.generation;d(!0),m(!1);try{const R=await he.followedThreads({filter:a,sort:i,cursor:N});if(M!==p.current.generation)return;const A=y.current,B=R.next?R.threads.at(-1):void 0,P=[...g.current.values()].filter(G=>Mp(G,a)&&(!B||Qd(i)(G,B)<=0));j({items:kd([...N?A.items:[],...R.threads,...P],i),next:R.next,ready:!0})}catch{M===p.current.generation&&m(!0)}finally{M===p.current.generation&&d(!1)}}w.useEffect(()=>{p.current={filter:a,sort:i,generation:p.current.generation+1},j({items:[],next:null,ready:!1}),b()},[a,i]);const S=w.useRef(new Map);function k(N){if(S.current.has(N)){S.current.set(N,!0);return}S.current.set(N,!1);const M=p.current.generation;he.followedThread(N).then(R=>C(R,M),R=>{R instanceof Bi&&R.status===404&&M===p.current.generation&&j({...y.current,items:y.current.items.filter(A=>A.id!==N)})}).finally(()=>{const R=S.current.get(N);S.current.delete(N),R&&k(N)})}function C(N,M){if(M!==p.current.generation)return;T(N);const R=y.current,A=R.items.some(G=>G.id===N.id),B=R.items.at(-1),P=N.following&&Mp(N,p.current.filter)&&(R.next===null||!B||Qd(p.current.sort)(N,B)<0);(A||R.ready&&P)&&j({...R,items:kd([...R.items,N],p.current.sort)})}w.useEffect(()=>e.on(N=>{if(N.kind==="changed")k(N.id);else if(N.kind==="reconnected")O();else{const M=N.chat,R=y.current,A=R.items.find(P=>P.id===M.id);if(!A){M.following&&k(M.id);return}const B={...A,title:M.title,status:M.status??A.status,unread:M.unread,mentions:M.mentions,alerts:M.alerts,following:M.following};T(B),j({...R,items:kd([...R.items,B],p.current.sort)})}}),[e]);function T(N){N.following?g.current.delete(N.id):y.current.items.some(M=>M.id===N.id)&&g.current.set(N.id,N)}async function O(){const N=p.current.generation,M=await he.followedThreads({filter:p.current.filter,sort:p.current.sort}).catch(()=>null);if(!M||N!==p.current.generation)return;const R=y.current,A=R.items.length>M.threads.length;j({items:kd([...R.items,...M.threads],p.current.sort),next:A?R.next:M.next,ready:!0})}return{items:r.items.filter(N=>Mp(N,a)),find:N=>r.items.find(M=>M.id===N),ready:r.ready,more:r.next!==null,loading:u,failed:f,loadMore:()=>{r.next&&!u&&b(r.next)},retry:()=>void b(r.next??void 0)}}const NB=e=>Wn(e,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}),EB={all:"threads.none",unread:"threads.noneUnread",open:"threads.noneOpen",done:"threads.noneDone"};function TB({events:e,summary:a,chats:i,members:r,bots:s,onNav:u,renderThread:d}){const[f,m]=w.useState(null),[p,y]=w.useState("all"),[g,j]=L5("followed"),b=CB(e,p,g),S=f?b.find(f.id)??f:void 0,k=w.useRef(null),C=w.useRef(null);w.useEffect(()=>{if(!k.current||!C.current||!b.more||b.loading||b.failed)return;const O=new IntersectionObserver(N=>{var M;(M=N[0])!=null&&M.isIntersecting&&b.loadMore()},{root:k.current,rootMargin:"0px 0px 400px 0px"});return O.observe(C.current),()=>O.disconnect()},[b.more,b.loading,b.failed,b.items]);const T=[["all",x("threads.all")],["unread",a!=null&&a.unreadThreads?x("threads.unreadCount",{count:a.unreadThreads}):x("threads.unread")],["open",x("threads.openCount",{count:(a==null?void 0:a.open)??0})],["done",x("threads.doneCount",{count:(a==null?void 0:a.done)??0})]];return o.jsxs("main",{className:"ui-chat jv-followed-page","aria-label":x("sidebar.followed"),"data-open":S?"":void 0,children:[o.jsxs("section",{className:"jv-followed-list","aria-label":x("threads.list"),children:[o.jsxs("header",{className:"ui-chat-header jv-channel-header",children:[o.jsxs("div",{className:"ui-header-left",children:[o.jsx(ut,{icon:"layout-sidebar-left",className:"ui-mobile-only",label:x("common.openNav"),onClick:u}),o.jsx("strong",{className:"jv-channel-title",children:x("sidebar.followed")})]}),o.jsx(I5,{value:g,onChange:j})]}),o.jsx("div",{className:"jv-tabs",role:"tablist","aria-label":x("threads.filter"),children:T.map(([O,N])=>o.jsx("button",{type:"button",role:"tab","aria-selected":p===O,onClick:()=>y(O),children:N},O))}),o.jsxs("div",{className:"jv-followed-items",ref:k,children:[b.ready&&b.items.length===0&&!b.more?o.jsx("p",{className:"jv-picker-empty",children:x(EB[p])}):b.items.map(O=>{const N=r.find(R=>{var A;return R.id===((A=O.root)==null?void 0:A.senderId)}),M=i.find(R=>R.id===O.parentId);return o.jsxs("button",{type:"button",className:"jv-thread-item","data-unread":O.unread>0||void 0,"aria-current":O.id===(f==null?void 0:f.id)||void 0,onClick:()=>m(O),children:[o.jsxs("span",{className:"jv-thread-item-head",children:[o.jsx("strong",{children:O.title}),O.alerts>0?o.jsx("span",{className:"jv-badge",children:O.alerts}):O.unread>0&&o.jsx("span",{className:"jv-count",children:O.unread}),o.jsx("span",{className:"jv-thread-status","data-done":O.status==="done"||void 0,children:x(O.status==="done"?"channel.threadDone":"threads.open")})]}),O.root&&o.jsxs("span",{className:"jv-thread-item-root",children:[o.jsx(wr,{member:N,bots:s,size:16}),o.jsx("span",{children:js(O.root)})]}),o.jsxs("span",{className:"jv-muted jv-thread-item-meta",children:["#",(M==null?void 0:M.title)??""," · ",x("channel.replies",{count:O.replies}),O.lastReplyAt?` · ${NB(O.lastReplyAt)}`:"",O.following?"":` · ${x("threads.notFollowing")}`]})]},O.id)}),o.jsx("div",{ref:C,className:"jv-followed-end",children:b.failed?o.jsxs(o.Fragment,{children:[o.jsx("p",{role:"alert",children:x("threads.loadFailed")}),o.jsx(Me,{variant:"outline",size:"sm",onClick:b.retry,children:x("common.retry")})]}):(b.loading||!b.ready)&&o.jsx("p",{role:"status",children:x("threads.loading")})})]})]}),S?d(S,()=>m(null)):o.jsx("div",{className:"jv-followed-empty",children:o.jsx("p",{children:x("threads.pick")})})]})}function AB({pane:e,followedView:a,threadEvents:i,followed:r,chats:s,sections:u,members:d,bots:f,statuses:m,meId:p,drafts:y,changes:g,live:j,paneChannel:b,activeBot:S,botDirects:k,find:C,onPane:T,onNav:O,onBackToChannel:N,onAddMembers:M,onOpenBot:R,onPin:A,onMute:B,onDeleteChannel:P,onChannelSaved:G,onThreadChanged:L,onInvite:q,onPreview:F,onNotice:W,onError:$,paneWidth:Y,onResize:K}){var _,ne;const U=(e==null?void 0:e.kind)==="thread"?e:null,H=(U==null?void 0:U.mode)==="full",Q=()=>T(null);return o.jsxs(o.Fragment,{children:[a&&!H&&o.jsx(TB,{events:i,summary:r,chats:s,members:d,bots:f,onNav:O,renderThread:(ee,D)=>o.jsx($b,{threadId:ee.id,mode:"embed",channel:s.find(I=>I.id===ee.parentId),drafts:y,members:d,bots:f,me:p,live:j,onNav:O,onChanged:L,onClose:D,onToggleMode:()=>N({id:ee.id,parentId:ee.parentId},!0),onInvite:I=>q(ee.parentId,I),onPreview:F,onError:$,onNotice:W},ee.id)}),U&&o.jsx($b,{threadId:U.id,mode:U.mode,showSummary:U.summary,focus:U.focus,onSearch:C.search,channel:s.find(ee=>ee.id===U.parentId),drafts:y,members:d,bots:f,me:p,live:j,onNav:O,onChanged:L,onClose:()=>H?N(U,!1):Q(),onToggleMode:()=>H?N(U,!0):T({...U,mode:"full"}),onInvite:ee=>q(U.parentId,ee),onPreview:F,onError:$,onNotice:W},`${U.id}:${((_=U.focus)==null?void 0:_.id)??""}:${((ne=U.focus)==null?void 0:ne.passage)??""}`),(e==null?void 0:e.kind)==="search"&&o.jsx(hB,{chat:e.chat,chats:s,members:d,focusKey:C.focusKey,onOpenMessage:C.openMessage,onClose:Q,onError:$}),(e==null?void 0:e.kind)==="threads"&&b&&o.jsx(SB,{channel:b,members:d,bots:f,changes:g,onOpen:ee=>T({kind:"thread",id:ee,parentId:b.id,mode:"pane"}),onClose:Q,onError:$}),(e==null?void 0:e.kind)==="info"&&b&&o.jsx(fB,{channel:b,page:e.page,sections:u,members:ui(d),bots:f,statuses:m,me:p,onPage:ee=>T({kind:"info",page:ee}),onPin:()=>A(b),onMute:()=>B(b),onAdd:()=>M(b),onBot:R,onDelete:()=>P(b),onChanged:G,onClose:Q,onError:$}),(e==null?void 0:e.kind)==="botdms"&&S&&!b&&o.jsx(cB,{bot:S,chats:k,members:d,bots:f,me:p,live:j,onClose:Q,onPreview:F,onError:$}),e&&!H&&o.jsx("div",{className:"jv-resize",style:{right:Y-4},onPointerDown:K,role:"separator","aria-orientation":"vertical","aria-label":x("app.resizePane")})]})}const Xb="@goodfish/jarvy",B5="0.11.1",MB={url:"git+https://github.com/AzzzGoodFish/Jarvy.git"},_B="Apache-2.0",x0=MB.url.replace(/^git\+/,"").replace(/\.git$/,""),Kb=`${x0}/blob/v${B5}`,RB=[{label:"about.source",detail:x0.replace(/^https:\/\//,""),href:x0},{label:"about.package",detail:Xb,href:`https://www.npmjs.com/package/${Xb}`},{label:"about.license",detail:_B,href:`${Kb}/LICENSE`},{label:"about.notices",detail:"THIRD_PARTY_NOTICE.md",href:`${Kb}/THIRD_PARTY_NOTICE.md`}];function OB(){return o.jsxs("div",{className:"jv-page",children:[o.jsx("header",{className:"jv-page-header",children:o.jsx("h2",{children:x("settings.about")})}),o.jsxs("div",{className:"jv-list",children:[o.jsxs("div",{className:"jv-list-row jv-static-row jv-about-intro",children:[o.jsxs("div",{className:"jv-row-text",children:[o.jsx("strong",{children:"Jarvy"}),o.jsx("span",{children:x("about.tagline")})]}),o.jsx("span",{className:"jv-row-meta",children:x("about.version",{version:B5})})]}),RB.map(e=>o.jsxs("a",{className:"jv-list-row jv-link-row",href:e.href,target:"_blank",rel:"noreferrer",children:[o.jsxs("div",{className:"jv-row-text",children:[o.jsx("strong",{children:x(e.label)}),o.jsx("span",{children:e.detail})]}),o.jsx(R8,{"aria-hidden":"true"})]},e.label))]})]})}function DB(){const[e,a]=w.useState(document.documentElement.classList.contains("dark")),i=s=>{Gd(s?"dark":"light"),a(s)},r=(s,u,d,f,m)=>o.jsxs("button",{type:"button",role:"radio","aria-checked":d,lang:m,className:"jv-list-row jv-choice-row",onClick:f,children:[o.jsx("span",{className:"jv-row-text",children:o.jsx("strong",{children:u})}),d&&o.jsx(Oa,{"aria-hidden":"true"})]},s);return o.jsxs("div",{className:"jv-page",children:[o.jsx("header",{className:"jv-page-header",children:o.jsx("h2",{children:x("settings.general")})}),o.jsxs("section",{className:"jv-section","aria-labelledby":"general-language",children:[o.jsx("h3",{id:"general-language",className:"jv-section-title",children:x("general.language")}),o.jsx("div",{className:"jv-list",role:"radiogroup","aria-labelledby":"general-language",children:lj.map(s=>r(s,Dp(s,"name"),no()===s,()=>cj(s),s))})]}),o.jsxs("section",{className:"jv-section","aria-labelledby":"general-theme",children:[o.jsx("h3",{id:"general-theme",className:"jv-section-title",children:x("general.theme")}),o.jsxs("div",{className:"jv-list",role:"radiogroup","aria-labelledby":"general-theme",children:[r("light",x("general.light"),!e,()=>i(!1)),r("dark",x("general.dark"),e,()=>i(!0))]})]})]})}const zB=`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M9.797 6.282a.451.451 0 01-.336-.315 1.019 1.019 0 010-.505c.156-.86.3-1.725.501-2.577.14-.7.42-1.367.823-1.96.305-.431.75-.746 1.262-.89.877-.217 1.24.629.937 1.348-.259.593-.877.914-1.334 1.348-.835.795-1.096 2.14-1.336 3.212a.427.427 0 01-.186.277.437.437 0 01-.331.062z" fill="url(#lobe-icons-ant-group-0-_R_0_)" transform="translate(3)"></path><path d="M6.334 4.672c.33-.121.682.146.946.297.278.145.587.219.901.214.231.01.466 0 .688.018 4.098.176 7.484 3.22 8.05 7.237.565 4.016-1.852 7.859-5.745 9.134-3.894 1.276-8.153-.38-10.126-3.935A8.339 8.339 0 013.133 7.081c.348-.278.716-.53 1.102-.755a8.404 8.404 0 001.318-.79c.28-.243.45-.742.781-.864zm4.406 2.15c-2.841.003-4.898 2.533-4.628 5.642.27 3.109 2.781 5.641 5.613 5.665 2.832.024 4.932-2.512 4.658-5.644-.273-3.133-2.802-5.666-5.643-5.663zm.357.57a4.707 4.707 0 013.304 1.446 5.703 5.703 0 011.643 3.49 4.841 4.841 0 01-1.141 3.705v.015a3.923 3.923 0 01-2.808 1.303 4.664 4.664 0 01-3.367-1.387 5.678 5.678 0 01-1.71-3.518 4.832 4.832 0 011.14-3.753 3.923 3.923 0 012.813-1.3h.126z" fill="url(#lobe-icons-ant-group-1-_R_0_)" transform="translate(3)"></path><path d="M2.346 2.054a1.26 1.26 0 01.384-.594.842.842 0 011.165.11c.694.82.169 2.078.142 3.02.013.805.208 1.597.57 2.318.084.134.147.279.186.43a.539.539 0 01-.3.577c-.345.17-.568-.19-.709-.446-.324-.6-.617-1.216-.877-1.846a8.698 8.698 0 01-.618-1.987 7.523 7.523 0 01-.051-.37 3.717 3.717 0 01-.024-.34 2.506 2.506 0 01.132-.872z" fill="url(#lobe-icons-ant-group-2-_R_0_)" transform="translate(3)"></path><defs><linearGradient id="lobe-icons-ant-group-0-_R_0_" x1="31.373%" x2="61.365%" y1="95.551%" y2="-.348%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient><linearGradient id="lobe-icons-ant-group-1-_R_0_" x1="4.366%" x2="94.359%" y1="65.982%" y2="32.918%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient><linearGradient id="lobe-icons-ant-group-2-_R_0_" x1="56.255%" x2="45.986%" y1="99.257%" y2="1.384%"><stop offset="0%" stop-color="#06F"></stop><stop offset="20%" stop-color="#1677FF"></stop><stop offset="100%" stop-color="#04A6FF"></stop></linearGradient></defs></svg>
574
574
  `,LB=`<svg fill="currentColor" fill-rule="evenodd" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>
575
575
  `,IB=`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7.242 1.613A1.11 1.11 0 018.295.857h6.977L8.03 22.316a1.11 1.11 0 01-1.052.755h-5.43a1.11 1.11 0 01-1.053-1.466L7.242 1.613z" fill="url(#lobe-icons-azure-0-_R_0_)"></path><path d="M18.397 15.296H7.4a.51.51 0 00-.347.882l7.066 6.595c.206.192.477.298.758.298h6.226l-2.706-7.775z" fill="#0078D4"></path><path d="M15.272.857H7.497L0 23.071h7.775l1.596-4.73 5.068 4.73h6.665l-2.707-7.775h-7.998L15.272.857z" fill="url(#lobe-icons-azure-1-_R_0_)"></path><path d="M17.193 1.613a1.11 1.11 0 00-1.052-.756h-7.81.035c.477 0 .9.304 1.052.756l6.748 19.992a1.11 1.11 0 01-1.052 1.466h-.12 7.895a1.11 1.11 0 001.052-1.466L17.193 1.613z" fill="url(#lobe-icons-azure-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-0-_R_0_" x1="8.247" x2="1.002" y1="1.626" y2="23.03"><stop stop-color="#114A8B"></stop><stop offset="1" stop-color="#0669BC"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-1-_R_0_" x1="14.042" x2="12.324" y1="15.302" y2="15.888"><stop stop-opacity=".3"></stop><stop offset=".071" stop-opacity=".2"></stop><stop offset=".321" stop-opacity=".1"></stop><stop offset=".623" stop-opacity=".05"></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-azure-2-_R_0_" x1="12.841" x2="20.793" y1="1.626" y2="22.814"><stop stop-color="#3CCBF4"></stop><stop offset="1" stop-color="#2892DF"></stop></linearGradient></defs></svg>
576
576
  `,BB=`<svg fill="currentColor" fill-rule="evenodd" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M2.316 4.8h14.682v4.8H7.31a.302.302 0 00-.308.3v4.2c0 .171.14.3.308.3h9.688v4.8h-4.686a.302.302 0 00-.308.3v4.2c0 .171.141.3.308.3h4.378a.297.297 0 00.308-.3v-4.5h4.694a.302.302 0 00.308-.3v-4.2c0-.171-.14-.3-.308-.3h-4.694V9.6h4.694A.302.302 0 0022 9.3V5.1c0-.171-.14-.3-.308-.3h-4.694V.3c0-.171-.14-.3-.308-.3H2.316A.31.31 0 002 .3v4.2c0 .171.14.3.316.3z"></path></svg>
@@ -1,4 +1,4 @@
1
1
  <!doctype html>
2
- <html lang="zh-CN"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="theme-color" content="#fdfdfe"/><title>Jarvy</title><link rel="icon" href="/favicon.svg" type="image/svg+xml"/><link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png"/><link rel="apple-touch-icon" href="/apple-touch-icon.png"/><link rel="manifest" href="/manifest.webmanifest"/> <script type="module" crossorigin src="/assets/index-DxvWbAau.js"></script>
2
+ <html lang="zh-CN"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="theme-color" content="#fdfdfe"/><title>Jarvy</title><link rel="icon" href="/favicon.svg" type="image/svg+xml"/><link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png"/><link rel="apple-touch-icon" href="/apple-touch-icon.png"/><link rel="manifest" href="/manifest.webmanifest"/> <script type="module" crossorigin src="/assets/index-BjM7C3Rt.js"></script>
3
3
  <link rel="stylesheet" crossorigin href="/assets/index-B20LxZ-9.css">
4
4
  </head><body><div id="root"></div></body></html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodfish/jarvy",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "A local chat where people and AI Bots work together: DMs, channels and threads, with long-running Pi agents as members.",
5
5
  "keywords": [
6
6
  "chat",