PageSourceSearch

https://www.dzmm.ai/assets/B-wTDFQR.js

js dzmm.ai collected 2026-10-05 13:37:50 UTC 89,240 bytes, 4 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Cmodtjqe2.js","assets/NdgU7Of3.js","assets/DDNK083l.js","assets/5LU_szd1.js","assets/hK5xWk9i.js","assets/BBdYOH0d2.js","assets/DqwdK7Nv.js","assets/BqQVkilT.js","assets/DNB9n0vk.js","assets/BS6kPrX2.js","assets/CgtKIIuy.js","assets/BOm4-4o2.js","assets/RGSQzDVj.js","assets/k6V2gq5G.js","assets/C9JdCCKc.js","assets/DtCUQqVf.js","assets/C-qhNxfA.js","assets/CM8qli7Z.js","assets/BAuCZAPv.js","assets/BkfyGHml.js","assets/DVUQqO0q.js","assets/BmiMmIGA.js","assets/TPWchaVi.js","assets/Q-QzO3q62.js","assets/DySqDGRt.js","assets/D0YEXaqm.js","assets/CyTDxP5K.js","assets/BdOIIWmp.js","assets/BJ_ULl2R2.js","assets/cx8RASAP.js","assets/VJQQOgBd2.js","assets/C6zKsjS7.js","assets/CNDCZoYW.js","assets/DLiNC5zb.js","assets/TPuAJvQy.js","assets/B7_dWJcp.js","assets/BRSPVSYK.js","assets/Cwsy_hQ8.js","assets/BGbb5igS.js","assets/DCGCuLWB.js","assets/C5dCSHRX.js","assets/Ch-Z8kGa.js","assets/BW7bqU2n.js","assets/CdA5R_Rp.js","assets/C9I8aJxG.js","assets/BOMZqWic.js","assets/D2I6xgAn.js","assets/DFyLBuwe2.js","assets/B1oRO5zn2.js","assets/COKRMuG4.js","assets/B6v88Q5_.js","assets/CIcjtxAX.js","assets/D3l7oYvC.js","assets/BxjLultr.js","assets/LAV-n0x2.js","assets/CQWmvldy.js","assets/DzKYphyp.js","assets/DYIiC-Z7.js","assets/vdFQZZHF2.js","assets/6tSHa1gC.js","assets/BG9OxGbl.js","assets/BAfyimI4.js","assets/Cr5ZCaLa.js","assets/q1pjr9dJ.js","assets/C8LsK5lf.js","assets/B2m1qbS4.css","assets/DJgSKA4i.js","assets/C8g4EdKb.js","assets/CaRN0shx.js","assets/bxYejleY.js","assets/Bh4zeivF.js","assets/DcvZTs5I2.js","assets/D3yFj4Tx2.js","assets/DobK293x2.js","assets/Do2Ov7wf2.js","assets/CFnA8oQO.js","assets/CbUvjbU6.js","assets/BhIWfcyT.js","assets/D946RrH8.js","assets/BE6P9mR2.js","assets/CNFGYF9U.js","assets/B9D3OWbh.js","assets/bRB5r-FQ.js","assets/DS6DK_lg.js","assets/CakEdC_k.js","assets/BXjk0erO.js","assets/CN9NW_A8.js","assets/FQKOVEmN.js","assets/B3ybD-AO.js","assets/BmwpCHaP.js","assets/BC4pb_Wm.js","assets/D-OJGdfu.js","assets/CBgYVVL2.js","assets/DEgEJVS9.js","assets/FSt5RkZj.js","assets/wt-1mPRB.js","assets/CqZKaZgg.js","assets/B-JrT1ny.js","assets/BQmlnDTC.js","assets/DVn2DqFs2.js","assets/B2sf1IG-.js","assets/ChbqqAmk.js","assets/jwK1CMZ1.js","assets/ClNXl51n2.js","assets/a-od5RRK2.js","assets/BHK9vadI.css"])))=>i.map(i=>d[i]);
2(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`7f6104efdd47da0bb2857cdb8a677ea4f62df042`},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:dzmm-web":!0});var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`c798cbb1-840f-4cca-9d17-20011584e766`,e._sentryDebugIdIdentifier=`sentry-dbid-c798cbb1-840f-4cca-9d17-20011584e766`)}catch{}})();import{a as e}from"./DDNK083l.js";import{o as t,r as n}from"./5LU_szd1.js";import{D as r,Gr as i,Jn as a,Jt as o,Kr as s,Kt as c,L as l,Mt as u,Nr as d,Tt as f,Ur as p,Ut as m,W as h,X as g,Yr as _,_ as v,_i as y,en as b,gi as x,h as S,ji as C,mi as w,nn as T,oi as E,r as D,s as O,st as k,v as A,vr as j,xn as M,yr as N}from"./DNB9n0vk.js";import{r as ee,t as te}from"./C-rayzS-.js";import{$c as ne,Af as P,Bf as re,Bp as F,Cl as I,Df as L,Dp as R,Ep as ie,Gf as z,Go as ae,Gr as oe,Hp as B,Ip as se,Js as ce,Kf as V,Kr as le,Lp as H,Mf as ue,Ms as de,Na as fe,Nf as U,Ns as pe,Pa as me,Pl as he,Qc as ge,Qf as _e,Qo as ve,Tf as W,Tl as ye,Xf as be,Xr as xe,Yc as Se,Yr as Ce,Zf as we,Zr as Te,Zt as Ee,_n as De,ac as Oe,al as ke,as as Ae,cm as je,cr as Me,ds as Ne,ei as G,er as Pe,es as Fe,fn as Ie,gi as Le,gp as Re,ha as ze,hs as Be,ii as Ve,il as He,io as Ue,jf as We,js as Ge,kp as Ke,mn as qe,ms as Je,nc as Ye,nl as K,nm as Xe,ol as q,or as J,os as Ze,pr as Y,ps as Qe,qc as $e,qf as et,qr as tt,ri as nt,tm as rt,um as X,un as it,us as at,vi as ot,vr as st,wl as ct,wo as lt,wp as ut,xl as dt,xo as ft,xp as pt,yi as mt,yp as ht,zf as Z}from"./NdgU7Of3.js";import{t as gt}from"./CgtKIIuy.js";import{o as _t,t as vt}from"./BtU7izNi.js";import{t as yt}from"./CdA5R_Rp.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./COKRMuG4.js";import{t as Et}from"./B1oRO5zn2.js";import{t as Dt}from"./VJQQOgBd2.js";import{t as Ot}from"./DcvZTs5I2.js";import{t as kt}from"./BJ_ULl2R2.js";import{a as At}from"./BBdYOH0d2.js";import{T as jt}from"./BS6kPrX2.js";import{t as Mt}from"./k6V2gq5G.js";import{i as Nt,r as Pt,s as Ft}
2from"./BAuCZAPv.js";import{t as It}from"./DVUQqO0q.js";import{n as Lt}from"./BkfyGHml.js";import{a as Rt,r as zt,t as Bt}from"./BqQVkilT.js";import{t as Vt}from"./BmiMmIGA.js";import{a as Ht,i as Ut,n as Wt,o as Gt,r as Kt,t as qt}from"./C6zKsjS7.js";import{n as Jt,r as Yt,t as Xt}from"./B6v88Q5_.js";import{n as Zt}from"./DQOzXZ012.js";import{h as Qt}from"./D3yFj4Tx2.js";import{n as $t}from"./Do2Ov7wf2.js";import{r as en,t as tn}from"./3nM7akzV2.js";import{n as nn}from"./jc7E_w0s2.js";import{t as rn}from"./BAfyimI4.js";import{a as an,c as on,i as sn,l as cn,n as ln,r as un,s as dn}from"./CNFGYF9U.js";import{t as fn}from"./B2sf1IG-.js";import{t as pn}from"./ChbqqAmk.js";import{o as mn,p as hn}from"./D-erTA4v2.js";import{n as gn}from"./DNWFg4kF2.js";import{t as _n}from"./CAY0EWN92.js";import{n as vn,r as yn,t as bn}from"./Bh7CtLol2.js";import{t as xn}from"./BHbVEYWl2.js";import{n as Sn}from"./Dp8VbNPH2.js";import{i as Cn,n as wn,r as Tn,t as En}from"./IsOd1cr8.js";import{t as Dn}from"./DEVp22Sf.js";import{n as On,r as kn,t as An}from"./C2knoP0_.js";import{t as jn}from"./C9qdbf7e.js";import{t as Mn}from"./CJrjSoL0.js";import{n as Nn,t as Pn}from"./DUkkGsE0.js";import{t as Fn}from"./DWcDF591.js";var In=Ke(`circle-user-round`,[[`path`,{d:`M18 20a6 6 0 0 0-12 0`,key:`1qehca`}],[`circle`,{cx:`12`,cy:`10`,r:`4`,key:`1h16sb`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ln=Ke(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),Rn=[`card_detail`,`home`,`search`,`recommendation`,`home_newbie`,`chat_list`,`share_link`,`quick_chat`,`profile`,`checkpoint`,`telegram`,`summon`,`import`,`general_chat`,`green_featured`,`other`],Q=e(t()),zn=e(Zt()),Bn={character_card:`character`,checkpoint_session:`checkpoint`,tweet:`tweet`,dream_story:`story`,dream_book:`book`,draw:`draw`,gallery:`gallery`,preset_market:`preset`,scenario:`scenario`,verification:`verification`};function Vn(e){var t;return e?(t=Bn[e])==null?null:t:null}function Hn(e,t){if(!e||!t)return null;switch(e){case`character_card`:return ln(t);case`checkpoint_session`:return un(t);case`tweet`:return`/post/${t}`;case`dream_story`:return on(t);case`dream_book`:return dn(t);case`draw`:return sn(t);case`gallery`:return an(t);case`preset_market`:return cn(t);case`scenario`:return`/scenario/${t}`;case`verification`:return`/user/${t}`;default:return null}}var Un={character:`notification.action.likedPost.character`,tweet:`notification.action.likedPost.tweet`,draw:`notification.action.likedPost.draw`,gallery:`notification.action.likedPost.gallery`,story:`notification.action.likedPost.story`,book:`notification.action.likedPost.book`,preset:`notification.action.likedPost.preset`},Wn={character:`notification.action.commentedPost.character`,tweet:`notification.action.commentedPost.tweet`,draw:`notification.action.commentedPost.draw`,gallery:`notification.action.commentedPost.gallery`,story:`notification.action.commentedPost.story`,book:`notification.action.commentedPost.book`,preset:`notification.action.commentedPost.preset`};function Gn(e,t,n,r=!1){switch(t){case`post_liked`:case`tweet_liked`:return Kn(e,n,Un,`notification.action.likedPost.default`);case`comment_liked`:return e(`notification.action.likedComment`);case`post_commented`:return r?e(`notification.action.repliedForumTopic`):Kn(e,n,Wn,`notification.action.commentedPost.default`);case`comment_replied`:return e(`notification.action.repliedForumComment`);case`user_followed`:return e(`notification.action.followed`);case`bounty_status`:return e(`notification.action.bountyCompleted`);default:return e(`notification.action.interacted`)}}function Kn(e,t,n,r){let i=Vn(t),a=i?n[i]:void 0;return e(a==null?r:a)}
2function qn(e,t,n){let r=e==null?`???`:e;return t<=1?r:`${r} ${n(`notification.aggregatedSuffix`,{count:t-1,total:t})}`}function Jn(e,t,n){var r;return qn((r=e[0])==null?void 0:r.fullName,t,n)}function Yn({type:e,contentPreview:t}){if((t==null?void 0:t.postType)!==`tweet`||t.contentId)return!1;switch(e){case`tweet_liked`:case`post_liked`:case`post_commented`:case`comment_replied`:case`comment_liked`:return!0;default:return!1}}function Xn(e){if(!e)return null;let t=Hn(e.postType,e.contentId);return t?e.commentId?`${t}?comment=${e.commentId}`:t:null}function Zn({type:e,targetType:t,targetId:n,actorId:r,contentPreview:i}){switch(e){case`user_followed`:return`/user/${r}`;case`bounty_status`:return`/quests/${n}`;case`tweet_liked`:case`post_liked`:case`post_commented`:case`comment_replied`:case`comment_liked`:var a;return(a=Xn(i))==null?`/explore`:a;default:return t===`post`||t===`character_card`?ln(n):`/`}}var $=n();function Qn({unseenCount:e,latestType:t,latestPostType:n,latestIsForum:r,latestActorName:i,latestActorCount:a,latestTime:o,onClick:s}){let{t:c}=z(),l=et(),u=(0,Q.useMemo)(()=>!t||!i?null:`${qn(i,a,c)} ${Gn(c,t,n,r)}`,[t,n,r,i,a,c]);return(0,$.jsx)(`div`,{className:`flex flex-col overflow-hidden cursor-pointer px-3 py-3`,onClick:s,children:(0,$.jsxs)(`div`,{className:`flex flex-row items-start w-full`,children:[(0,$.jsx)(`div`,{className:`relative size-10 mr-4`,children:(0,$.jsx)(`div`,{className:`size-10 bg-gradient-to-br from-blue-400 to-blue-600 dark:from-blue-500 dark:to-indigo-600 rounded-full flex items-center justify-center`,children:(0,$.jsx)(x,{className:`size-5 text-white`})})}),(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 items-stretch w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium whitespace-nowrap text-ellipsis overflow-hidden mr-1`,children:c(`notification.interactionMessages`)}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(`div`,{className:`text-[10px] leading-3 text-muted-foreground/60 shrink-0`,children:mt(o,{detailed:!1,locale:l})})]}),(0,$.jsxs)(`div`,{className:`flex flex-row items-center mt-1`,children:[(0,$.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center text-xs text-muted-foreground`,children:(0,$.jsx)(`span`,{className:`truncate block min-w-0`,children:u})}),e>0&&(0,$.jsx)(`div`,{className:`h-full flex items-center ml-2 shrink-0`,children:(0,$.jsx)(`div`,{className:`rounded-full bg-dzmm-500 dark:bg-pink-500 text-background text-[10px] px-1.5 mr-1`,children:e>=100?`99+`:e})})]})]})]})})}function $n(){return F(q().notification.latestPreview.queryOptions(void 0,{refetchInterval:e=>{var t;return(t=e.state.data)!=null&&t.hasForumNotifications?mn:!1}}))}function er({onFileSelect:e,disabled:t}){let{t:n}=z(),[r,i]=(0,Q.useState)(null);(0,Q.useEffect)(()=>()=>{r&&URL.revokeObjectURL(r)},[r]);let a=t=>{var a;let o=(a=t.target.files)==null?void 0:a[0];if(r&&(URL.revokeObjectURL(r),i(null)),!o){e(null);return}if(![`image/jpeg`,`image/png`,`image/webp`].includes(o.type)){I.error(n(`chat.groupCreate.avatar.uploadFormatError`)),t.target.value=``;return}if(o.size>5*1024*1024){I.error(n(`chat.groupCreate.avatar.uploadSizeError`,{size:5})),t.target.value=``;return}i(URL.createObjectURL(o)),e(o)};return(0,$.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative group`,children:[(0,$.jsxs)(`label`,{className:Z(`block cursor-pointer relative`,t&&`pointer-events-none`),children:[(0,$.jsx)(`div`,{className:`relative size-20 rounded-full overflow-hidden`,children:r?(0,$.jsx)(J,{url:r,className:Z(`size-20`,t&&`opacity-50`)}):(0,$.jsx)(`div`,{className:Z(`size-20 bg-gradient-to-br from-pink-400 to-rose-600`,`dark:from-pink-500 dark:to-purple-600`,`rounded-full flex items-center justify-center`,t&&`opacity-50`),children:(0,$.jsx)(we,{className:`size-8 text-white`})})}),!t&&(0,$.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-black/0 group-hover:bg-black/30 transition-colors`}),(0,$.jsx)(`input`,{id:`avatar-upload`,type:`file`,accept:`image/jpeg,image/png,image/webp`,onChange:a,disabled:t,className:`hidden`})]}),(0,$.jsxs)(`label`,{className:Z(`absolute bottom-0 right-0 size-7 bg-card rounded-full`,`flex items-center justify-center cursor-pointer transition shadow`,`hover:bg-accent`,t&&`pointer-events-none opacity-50`),children:[(0,$.jsx)(_,{className:`size-3.5 text-foreground`}),(0,$.jsx)(`input`,{type:`file`,accept:`image/jpeg,image/png,image/webp`,onChange:a,disabled:t,className:`hidden`})]})]}),r&&!t&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>{r&&(URL.revokeObjectURL(r),i(null)),e(null);let t=document.getElementById(`avatar-upload`);t&&(t.value=``)},className:`text-xs text-muted-foreground hover:text-foreground`,children:n(`chat.groupCreate.avatar.removeAvatar`)})]})}var tr=20;function nr(){let{t:e}=z(),{toast:t}=ct(),n=X(),r=q(),i=B(),{emitWithAck:a}=pe(),[o,s]=We(Rt),{register:c,handleSubmit:l,formState:{errors:u,isValid:d},watch:f,reset:p,control:m}=_t({defaultValues:{title:``,isPublic:!1,tags:[]},mode:`onChange`}),h=f(`title`),g=tr-((h==null?void 0:h.length)||0)<0,_=H(r.groupChat.create.mutationOptions({onSuccess:async e=>{await i.refetchQueries({queryKey:r.chat.listAll.queryKey()}),s(!1),await a(`message:join-room`,{chatroomId:e.chatroomId}),n.navigate({to:`/chat`,search:{c:e.chatroomId}}),p()},onError:n=>{t({variant:`destructive`,title:e(`chat.groupCreate.createFailed`),description:n.message||e(`chat.groupCreate.tryAgain`)})}}));return(0,$.jsx)(qt,{open:o,onOpenChange:e=>{s(e),e||p()},children:(0,$.jsxs)(Kt,{className:`sm:max-w-[425px] p-6`,children:[(0,$.jsxs)(Ht,{className:`p-0 mb-2`,children:[(0,$.jsx)(Gt,{children:e(`chat.menu.createGroup`)}),(0,$.jsx)(Ut,{children:e(`chat.menu.createGroupDescription`)})]}),(0,$.jsxs)(`form`,{onSubmit:l(e=>{let t=new FormData;t.append(`title`,e.title),t.append(`isPublic`,String(e.isPublic)),t.append(`tags`,JSON.stringify(e.tags)),e.avatar&&t.append(`avatar`,e.avatar),_.mutate(t)}),className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`mx-auto mb-4`,children:(0,$.jsx)(vt,{control:m,name:`avatar`,render:({field:e})=>(0,$.jsx)(er,{onFileSelect:e.onChange,disabled:_.isPending})})}),(0,$.jsxs)(`div`,{className:`w-full`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,$.jsx)(Ot,{htmlFor:`title`,className:`truncate text-xs text-secondary-foreground`,children:e(`chat.groupCreate.groupName`)}),(0,$.jsxs)(`span`,{className:`text-xs ${g?`text-red-500`:`text-muted-foreground`}`,children:[(h==null?void 0:h.length)||0,`/`,tr]})]}
2),(0,$.jsx)(yt,{id:`title`,...c(`title`,{required:e(`chat.groupCreate.groupNameRequired`),maxLength:{value:tr,message:e(`chat.groupCreate.groupNameMaxLength`,{max:tr})}}),placeholder:e(`chat.groupCreate.groupNamePlaceholder`),className:`w-full mt-1 ${u.title?`border-red-500 focus-visible:ring-red-500`:``}`}),u.title&&(0,$.jsx)(`p`,{className:`text-xs text-red-500 mt-1`,children:u.title.message})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between pb-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(Ot,{htmlFor:`isPublic`,className:`text-sm font-medium`,children:e(`chat.groupCreate.isPublic`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`chat.groupCreate.isPublicDescription`)})]}),(0,$.jsx)(vt,{name:`isPublic`,control:m,render:({field:e})=>(0,$.jsx)(rn,{id:`isPublic`,checked:e.value,onCheckedChange:e.onChange})})]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between pb-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,$.jsx)(Ot,{className:`text-sm font-medium`,children:e(`chat.settings.group.groupTags`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`chat.settings.group.groupTagsDescription`)})]}),(0,$.jsx)(vt,{name:`tags`,control:m,render:({field:t})=>(0,$.jsx)(_n,{selectedTags:t.value,onTagsChange:t.onChange,placeholder:e(`chat.settings.group.selectGroupTags`),disabled:_.isPending,isUpdating:!1,onBlur:()=>{}})})]}),(0,$.jsx)(`div`,{className:`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,children:(0,$.jsx)(W,{type:`submit`,disabled:!d||g,loading:_.isPending,children:e(`chat.menu.createGroup`)})})]})]})})}var rr=e=>e.type===`user`&&e.data.chatType===`group`&&!(`scenarioId`in e.data&&e.data.scenarioId),ir=e=>e.type===`user`&&e.data.chatType===`group`&&!!(`scenarioId`in e.data&&e.data.scenarioId),ar=e=>e.type===`user`&&e.data.chatType===`one_on_one`&&!e.data.otherUserIsBot,or=e=>e.type===`user`&&e.data.chatType===`one_on_one`&&!!e.data.otherUserIsBot,sr=e=>e.type===`ai`&&!e.data.isGamefy,cr=e=>e.type===`ai`&&!!e.data.isGamefy,lr=e=>e.type===`agent`,ur=e=>e.filter(e=>sr(e)||cr(e)),dr=e=>e.filter(e=>sr(e)||cr(e)||lr(e)),fr=(e,t)=>{switch(t){case`all`:return e;case`group`:return e.filter(rr);case`single`:return e.filter(ar);case`humanlike`:return e.filter(or);case`ai`:return e.filter(e=>sr(e)||lr(e));case`game`:return e.filter(cr);case`agent`:return e.filter(lr);case`scenario`:return e.filter(ir);default:return e}},pr=20*1024*1024;function mr(e){if(e.size>pr)throw Error(`导入文件不能超过20MB`)}var hr=()=>{let{t:e}=z(),{setChatroomId:t}=Ce(),n=q(),r=B(),{mutate:i,isPending:a,mutateAsync:o}=H(n.chat.importChat.mutationOptions({onSuccess:({chatId:i})=>{I({title:e(`chat.import.success`)}),t(i),r.refetchQueries({queryKey:n.chat.listAll.queryKey()})},onError:t=>{I({title:e(`chat.import.failed`),description:t instanceof Error?t.message:String(t),variant:`destructive`})}}));return{importChat:t=>{try{mr(t)}catch(t){I({title:e(`chat.import.failed`),description:t instanceof Error?t.message:String(t),variant:`destructive`});return}let n=new FormData;n.append(`file`,t),i(n)},importChatAsync:async e=>{mr(e);let t=new FormData;return t.append(`file`,e),o(t)},isImporting:a}};function gr(){let{t:e}=z(),{importChat:t,isImporting:n}=hr(),{data:r}=K(),i=(0,Q.useRef)(null);return(0,$.jsxs)(W,{variant:`outline`,disabled:n,onClick:()=>{var t;if(!(r!=null&&r.membershipLevel)||r.membershipLevel<1){I({title:e(`chat.import.vipRequired`),description:e(`chat.import.vipRequiredDescription`),variant:`destructive`,action:(0,$.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>window.location.href=`/profile`,children:[(0,$.jsx)(ht,{}),e(`chat.archiveManagement.upgradeVip`)]})});return}(t=i.current)==null||t.click()},children:[(0,$.jsx)(`input`,{className:`hidden`,ref:i,type:`file`,accept:`.json`,onChange:e=>{var n;let r=(n=e.target.files)==null?void 0:n[0];r&&t(r),e.target.value=``}}),(0,$.jsx)(d,{}),e(n?`chat.import.importing`:`chat.import.button`)]})}function _r({className:e}){let t=X(),{t:n}=z();return(0,$.jsxs)(Tt,{className:e,children:[(0,$.jsxs)(xt,{children:[(0,$.jsx)(bt,{variant:`icon`,children:(0,$.jsx)(c,{})}),(0,$.jsx)(Ct,{children:n(`chat.emptyState.noChats`)}),(0,$.jsx)(wt,{children:n(`chat.emptyState.noChatsDescription`)})]}),(0,$.jsx)(St,{children:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(W,{onClick:()=>t.navigate({to:`/`}),children:n(`chat.emptyState.selectCharacter`)}),(0,$.jsx)(gr,{})]})})]})}function vr(e={}){let t=q(),n=B(),{t:r}=z(),[i,a]=(0,Q.useState)(!1),{startChat:o,isCreating:s}=tn(void 0,{entryPoint:`general_chat`,onSuccess:()=>{var t;return(t=e.onSuccess)==null?void 0:t.call(e)}});return{startGeneralChat:(0,Q.useCallback)(async()=>{a(!0);try{let e=await n.fetchQuery(t.assistant.list.queryOptions());if(!(e!=null&&e.length)){I({description:r(`chat.createChat.noAssistant`),variant:`destructive`});return}o({cardId:e[0].id})}finally{a(!1)}},[n,t,o,r]),isLoading:i||s}}function yr({className:e}){let{waitingTime:t}=de();return(0,$.jsx)(`span`,{className:`text-xs ${e==null?``:e}`.trim(),children:br(t)})}function br(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}function xr(){let e=q(),t=On();return H(e.studio.createFromTheater.mutationOptions({onSuccess:()=>{t()}}))}var Sr=dt(`summon-active-task`,null),Cr=`quick-summon-draft`;function wr(){try{let e=localStorage.getItem(Cr);if(e){let t=JSON.parse(e);if(t&&typeof t.instruction==`string`)return{instruction:t.instruction,outline:t.outline||``,tier:t.tier===`slow`?`slow`:`fast`}}}catch{}return{instruction:``,outline:``,tier:`fast`}}function Tr(e){try{!e.instruction&&!e.outline?localStorage.removeItem(Cr):localStorage.setItem(Cr,JSON.stringify(e))}catch{}}function Er(){let{toast:e}=ct(),{t}=z([`app`,`error`]),[n,r]=We(Sr),i=U(fe),[a,o]=(0,Q.useState)(()=>n?n.phase===`generating`?`generating`:n.phase:`form`),[s,c]=(0,Q.useState)(()=>(n==null?void 0:n.taskId)||null),[l,u]=(0,Q.useState)(wr),d=(0,Q.useCallback)(e=>{u(t=>{let n=typeof e==`function`?e(t):e;return Tr(n),n})},[]),f=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{f.current=!1},[]);let{createMutation:p}=Dn(),m=En(`instruction`,s||``,{enabled:!!s&&a===`generating`}),h=m.data;(0,Q.useEffect)(()=>{a!==`generating`||!s||m.isError&&(o(`failed`),r(e=>({taskId:s,type:`instruction`,phase:`failed`,startedAt:(e==null?void 0:e.startedAt)||Date.now(),errorMessage:m.error instanceof Error?m.error.message:t(`error:draw.queryTaskStatusFailed`)})))},[a,s,m.isError,m.error,r]),(0,Q.useEffect)(()=>{f.current||n&&n.phase===`generating`&&!s&&(c(n.taskId),o(`generating`))},[n,s]);let g=(0,Q.useCallback)(()=>{l.instruction.trim()&&p.mutate(l,{onSuccess:e=>{let t=String(e.task);f.current=!1,c(t),o(`generating`),r({taskId:t,type:`instruction`,phase:`generating`,startedAt:Date.now()})},onError:n=>{if(Lt(n)){e({variant:`destructive`,title:t(`summon.dialog.insufficientCredit`)}),i(!0);return}e({variant:`destructive`,title:t(`summon.dialog.createFailed`),description:n instanceof Error?n.message:t(`summon.dialog.createFailedRetry`)})}})},[l,p,e,r,i]);(0,Q.useEffect)(()=>
2{if(!h||a!==`generating`||!s)return;let{status:e,characterCardId:t,errorMessage:n,progress:i}=h;e===`completed`&&t?(o(`completed`),r(e=>({taskId:s,type:`instruction`,phase:`completed`,startedAt:(e==null?void 0:e.startedAt)||Date.now(),characterCardId:t}))):Cn(e)===`failed`?(o(`failed`),r(e=>({taskId:s,type:`instruction`,phase:`failed`,startedAt:(e==null?void 0:e.startedAt)||Date.now(),errorMessage:n}))):r(t=>t&&t.taskId===s?{...t,progress:i,detailedStatus:e}:t)},[h,a,s,r]);let _=(0,Q.useCallback)((e={})=>{let{clearForm:t=!0,clearTask:n=!0}=e;n||(f.current=!0),o(`form`),c(null),t&&d({instruction:``,outline:``,tier:`fast`}),n&&(r(null),f.current=!1)},[r,d]);return{phase:a,formData:l,setFormData:d,taskId:s,taskStatus:h,isSubmitting:p.isPending,characterCardId:(h==null?void 0:h.characterCardId)||(n==null?void 0:n.characterCardId),errorMessage:(h==null?void 0:h.errorMessage)||(n==null?void 0:n.errorMessage),progress:h==null?void 0:h.progress,hasActiveTask:!!n&&n.phase===`generating`,actions:{submit:g,reset:()=>_({clearForm:!1,clearTask:!0}),retry:()=>_({clearForm:!1,clearTask:!0}),backToForm:()=>_({clearForm:!1,clearTask:!1}),clearDraft:()=>{d({instruction:``,outline:``,tier:`fast`})}}}}function Dr(){let{data:e}=F(q().draw.image.quota.queryOptions(void 0,{staleTime:30*1e3,refetchInterval:60*1e3,retry:2}));return{quota:e}}function Or({formData:e,onFormDataChange:t,onSubmit:n,onBatchSubmit:r,onClear:a,isSubmitting:o,isBatchSubmitting:s,membershipLevel:c}){var l,u,d,f;let{t:m}=z(),{quota:h}=Dr(),g=(0,Q.useMemo)(()=>[m(`summon.dialog.example0`),m(`summon.dialog.example1`),m(`summon.dialog.example2`),m(`summon.dialog.example3`),m(`summon.dialog.example4`)],[m]),[_]=(0,Q.useState)(()=>Math.floor(Math.random()*5)),v=g[_],y=n=>{t({...e,instruction:n})},b=n=>{t({...e,outline:n})},x=o||s,S=e.instruction.trim().length>0&&!x,C=e.instruction.length>0||((l=(u=e.outline)==null?void 0:u.length)==null?0:l)>0,w=c>=2,[E,k]=(0,Q.useState)(()=>!!e.outline);return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h&&h.remaining<=0&&(0,$.jsx)(`p`,{className:`text-xs text-destructive text-center font-medium`,children:m(`summon.dialog.quotaExhausted`)}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:m(`summon.dialog.instructionLabel`)}),C&&(0,$.jsxs)(`button`,{type:`button`,onClick:a,className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(j,{className:`size-3`}),m(`summon.dialog.clearDraft`)]})]}),(0,$.jsx)(kt,{value:e.instruction,onChange:e=>y(e.target.value),placeholder:v,className:`min-h-24 resize-none rounded-xl bg-muted/30`,maxLength:1e3}),(0,$.jsx)(`div`,{className:`flex justify-end mt-1`,children:(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono tabular-nums`,children:[e.instruction.length,` `,`/ 1,000`]})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>k(!E),className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors mb-2`,children:[m(`summon.dialog.detailsTitle`),E?(0,$.jsx)(p,{className:`size-4`}):(0,$.jsx)(i,{className:`size-4`})]}),E&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kt,{value:e.outline||``,onChange:e=>b(e.target.value),placeholder:m(`summon.dialog.outlinePlaceholder`),className:`min-h-32 resize-none rounded-xl bg-muted/30`,maxLength:2e3}),(0,$.jsx)(`div`,{className:`flex justify-end mt-1`,children:(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-mono tabular-nums`,children:[((d=e.outline)==null?void 0:d.length)||0,` `,`/ 2,000`]})})]})]}),(0,$.jsx)(jn,{value:(f=e.tier)==null?`fast`:f,onChange:n=>t({...e,tier:n}),disabled:x,fastLabel:m(`summon.dialog.tier.fast`),fastHint:m(`summon.dialog.tier.fastHint`),slowLabel:m(`summon.dialog.tier.slow`),slowHint:m(`summon.dialog.tier.slowHint`)}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(W,{onClick:n,disabled:!S||h!=null&&h.remaining<=0,loading:o,className:`flex-[2] h-11`,children:[(0,$.jsx)(O,{className:`size-4`}),m(`summon.dialog.submit`)]}),w?(0,$.jsxs)(W,{onClick:r,disabled:!S||h!=null&&h.remaining<6,loading:s,variant:`default`,className:`flex-1 h-11`,children:[(0,$.jsx)(D,{className:`size-4`}),m(`summon.dialog.batchCreate`)]}):(0,$.jsxs)(W,{disabled:!0,variant:`secondary`,className:`flex-1 h-11`,children:[(0,$.jsx)(T,{className:`size-4`}),m(`summon.dialog.batchCreate`)]})]}),!w&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground text-center`,children:m(`summon.dialog.batchVipHint`)})]})]})}function kr({phase:e,detailedStatus:t,progress:n,errorMessage:r,card:i,hasTaskId:a,onStartChat:o,onViewCharacter:s,onRetry:c,onContinueCreating:l,onBackToForm:u,isStartingChat:d,retryLabel:p}){let{t:h}=z(),g=e===`generating`&&t?wn(t,h):h(`summon.dialog.generating`);return(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 space-y-6`,children:[e===`generating`&&(0,$.jsx)(`div`,{className:`size-20 rounded-full flex items-center justify-center bg-primary/10`,children:(0,$.jsx)(L,{size:40,className:`text-primary`})}),e===`completed`&&i&&(0,$.jsx)(`div`,{className:`relative size-24 rounded-full overflow-hidden ring-4 ring-emerald-500/20`,children:(0,$.jsx)(Mt,{src:i.avatarUrl,alt:i.name,fill:!0,className:`object-cover`})}),e===`failed`&&(0,$.jsx)(`div`,{className:`size-20 rounded-full flex items-center justify-center bg-destructive/10`,children:(0,$.jsx)(pt,{className:`size-10 text-destructive`})}),(0,$.jsxs)(`div`,{className:`text-center space-y-1`,children:[e===`generating`&&(0,$.jsx)(`h3`,{className:`text-lg font-medium text-foreground`,children:g}),e===`completed`&&i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:i.name}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:h(`summon.dialog.success`)})]}),e===`failed`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-lg font-medium text-foreground`,children:h(`summon.dialog.failed`)}),r&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-xs`,children:r})]}),e===`generating`&&n!==void 0&&(0,$.jsx)(`div`,{className:`w-48 mx-auto pt-2`,children:(0,$.jsx)(`div`,{className:`h-1.5 bg-muted rounded-full overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full bg-primary rounded-full transition-all duration-500`,style:{width:`${n}%`}})})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 w-full max-w-sm`,children:[e===`generating`&&a&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2 text-xs text-muted-foreground bg-muted/50 rounded-lg px-3 py-2 w-fit mx-auto`,children:[(0,$.jsx)(M,{className:`size-3.5 mt-0.5 shrink-0`}),(0,$.jsx)(`span`,{children:h(`summon.dialog.generatingTip`)})]}),u&&(0,$.jsxs)(W,{onClick:u,variant:`ghost`,className:`mx-auto`,children:[(0,$.jsx)(f,{className:`size-4`}),h(`summon.dialog.continueCreating`)]})]}),e===`completed`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-3 justify-center`,children:[(0,$.jsxs)(W,{onClick:o,loading:d,className:`min-w-32 whitespace-nowrap`,children:[(0,$.jsx)(m,{className:`size-4`}),h(`summon.dialog.startChat`)]}),(0,$.jsxs)(W,{onClick:s,variant:`outline`,children:[(0,$.jsx)(_e,{className:`size-4`}),h(`summon.dialog.viewCharacter`)]})]}),(0,$.jsxs)(W,{onClick:l,variant:`ghost`,className:`mx-auto`,children:[(0,$.jsx)(f,{className:`size-4`}),h(`summon.dialog.continueCreating`)]})]}),e===`failed`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(W,{onClick:c,variant:`outline`,className:`mx-auto`,children:p==null?h(`summon.dialog.tryAgain`):p}),(0,$.jsxs)(W,{onClick:l,variant:`ghost`,className:`mx-auto`,children:[(0,$.jsx)(f,{className:`size-4`}),h(`summon.dialog.continueCreating`)]})]})]})]})}function Ar({open:e,onOpenChange:t}){var n,r,i,a,o;let{t:s,i18n:c}=z(),l=X(),[u,d]=(0,Q.useState)(`create`),[f,p]=(0,Q.useState)(null),m=xr(
2),{data:h}=K(),{batchMutation:g}=Dn(),_=U(fe),{phase:v,formData:y,setFormData:b,taskId:x,taskStatus:S,isSubmitting:C,characterCardId:w,errorMessage:T,progress:E,hasActiveTask:D,actions:O}=Er(),{data:k,isLoading:A}=kn({enabled:e&&u===`history`}),j=(0,Q.useMemo)(()=>k?k.map(e=>({...e,taskPath:`/studio/summon/${e.summonType}/${e.id}`})):[],[k]),M=En((n=f==null?void 0:f.type)==null?`instruction`:n,(r=f==null?void 0:f.id)==null?``:r,{enabled:!!f}),N=M.data,ee=(0,Q.useMemo)(()=>M.isError?`failed`:N?N.status===`completed`&&N.characterCardId?`completed`:Tn(N.status)?`generating`:`failed`:`generating`,[M.isError,N]),te=N!=null&&N.characterCardId?Number(N.characterCardId):void 0,P=N!=null&&N.name?{name:N.name,avatarUrl:N.imageUrl||``}:null,{startChat:re,isCreating:F}=tn(te,{entryPoint:`summon`,onSuccess:()=>{t(!1),p(null)}}),L=(0,Q.useCallback)(e=>{p({id:e.id,type:e.summonType})},[]),R=(0,Q.useCallback)(()=>{p(null)},[]),{startChat:ie}=tn(void 0,{entryPoint:`summon`,onSuccess:()=>t(!1)}),ae=(0,Q.useCallback)(e=>{ie({cardId:Number(e)})},[ie]),oe=(0,Q.useCallback)(()=>{N!=null&&N.characterCardId&&(t(!1),p(null),l.navigate({to:`/character/$id`,params:{id:String(N.characterCardId)}}))},[N==null?void 0:N.characterCardId,l,t]);(0,Q.useEffect)(()=>{v!==`form`&&d(`create`)},[v]);let B=w?Number(w):void 0,se=S!=null&&S.name?{name:S.name,avatarUrl:S.imageUrl||``}:null,{startChat:ce,isCreating:V}=tn(B,{entryPoint:`summon`,onSuccess:()=>{t(!1),O.reset()}}),le=(0,Q.useCallback)(()=>{B&&ce()},[B,ce]),H=(0,Q.useCallback)(()=>{w&&(t(!1),O.reset(),l.navigate({to:`/character/$id`,params:{id:String(w)}}))},[w,l,t,O]),ue=(0,Q.useCallback)(()=>{var e;if(y.instruction.trim()){if(((e=h==null?void 0:h.membershipLevel)==null?0:e)<2){I.error(s(`summon.dialog.batchVipRequired`),{description:s(`summon.dialog.batchVipRequiredDesc`)});return}g.mutate(y,{onSuccess:e=>{I.success(s(`summon.dialog.batchSuccess`),{description:e.message}),d(`history`)},onError:e=>{if(Lt(e)){I.error(s(`summon.dialog.insufficientCredit`)),_(!0);return}I.error(s(`summon.dialog.batchFailed`),{description:e instanceof Error?e.message:s(`summon.dialog.batchFailed`)})}})}},[y,h==null?void 0:h.membershipLevel,g,s,_]),de=(0,Q.useCallback)((e,n)=>{m.mutate({parsedChatId:e,selectedRole:n},{onSuccess:e=>{t(!1);let n=e.result.id;I.success(s(`summon.dialog.createSuccess`),{action:{label:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[s(`summon.dialog.viewCharacter`),(0,$.jsx)(ut,{className:`size-4`})]}),onClick:()=>l.navigate({to:`/character/$id`,params:{id:String(n)}})}})},onError:e=>{if(Lt(e)){I.error(s(`summon.dialog.insufficientCredit`)),_(!0);return}I.error(s(`summon.dialog.createFailed`),{description:e instanceof Error?e.message:`Unknown error`})}})},[m,l,s,t,_]),pe=m.isPending&&m.variables?{id:m.variables.parsedChatId,role:m.variables.selectedRole}:null,me=v===`form`&&!f;return(0,$.jsx)($e,{open:e,onOpenChange:t,children:(0,$.jsxs)(Se,{className:`sm:max-w-[500px]`,"aria-describedby":void 0,children:[(0,$.jsx)(ge,{children:(0,$.jsx)(ne,{children:s(`summon.dialog.title`)})}),f?(0,$.jsx)(kr,{phase:ee,detailedStatus:N==null?void 0:N.status,progress:N==null?void 0:N.progress,errorMessage:(i=N==null?void 0:N.errorMessage)==null?M.isError?(a=M.error)==null?void 0:a.message:void 0:i,card:P,hasTaskId:!0,onStartChat:re,onViewCharacter:oe,onRetry:R,onContinueCreating:R,onBackToForm:R,isStartingChat:F,retryLabel:s(`summon.dialog.backToList`)}):me?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Xt,{value:u,onValueChange:e=>d(e),children:[(0,$.jsx)(Jt,{value:`create`,children:s(`summon.dialog.tabs.create`)}),(0,$.jsx)(Jt,{value:`history`,children:s(`summon.dialog.tabs.history`)})]}),u===`create`&&(0,$.jsxs)($.Fragment,{children:[D&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-primary bg-primary/10 rounded-lg px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-primary animate-pulse shrink-0`}),s(`summon.dialog.backgroundTaskRunning`)]}),(0,$.jsx)(Or,{formData:y,onFormDataChange:b,onSubmit:O.submit,onBatchSubmit:ue,onClear:O.clearDraft,isSubmitting:C,isBatchSubmitting:g.isPending,membershipLevel:(o=h==null?void 0:h.membershipLevel)==null?0:o})]}),u===`history`&&(0,$.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto`,children:(0,$.jsx)(An,{records:j,isLoading:A,language:c.language,creatingRole:pe,onCreateCard:de,onViewTask:L,onStartChat:ae})})]}):(0,$.jsx)(kr,{phase:v,detailedStatus:S==null?void 0:S.status,progress:E,errorMessage:T,card:se,hasTaskId:!!x,onStartChat:le,onViewCharacter:H,onRetry:O.retry,onContinueCreating:O.reset,onBackToForm:O.backToForm,isStartingChat:V})]})})}var jr=1;function Mr(){let{t:e}=z(),{profile:t,isLoading:n}=K(),r=U(Rt),{openLoginDialog:i}=ze();return(0,Q.useCallback)(()=>{var a;
2if(!n){if(Pn(t)){i({trigger:`other`});return}if(((a=t==null?void 0:t.membershipLevel)==null?0:a)<jr){I({variant:`destructive`,title:e(`chat.groupCreate.vipRequired.title`),description:e(`chat.groupCreate.vipRequired.description`),action:(0,$.jsxs)(W,{variant:`secondary`,size:`sm`,onClick:()=>window.location.href=`/profile`,children:[(0,$.jsx)(ht,{}),e(`chat.groupCreate.vipRequired.upgradeButton`)]})});return}r(!0)}},[n,t==null?void 0:t.isLoggedIn,t==null?void 0:t.email,t==null?void 0:t.membershipLevel,r,i,e])}var Nr=[{value:`all`,icon:(0,$.jsx)(c,{className:`size-3.5 shrink-0`})},{value:`group`,icon:(0,$.jsx)(we,{className:`size-3.5 shrink-0`})},{value:`single`,icon:(0,$.jsx)(_e,{className:`size-3.5 shrink-0`})},{value:`humanlike`,icon:(0,$.jsx)(In,{className:`size-3.5 shrink-0`})},{value:`ai`,icon:(0,$.jsx)(E,{className:`size-3.5 shrink-0`})},{value:`game`,icon:(0,$.jsx)(Re,{className:`size-3.5 shrink-0`})},{value:`scenario`,icon:(0,$.jsx)(l,{className:`size-3.5 shrink-0`})}],Pr=[{value:`all`,icon:(0,$.jsx)(c,{className:`size-3.5 shrink-0`})},{value:`ai`,icon:(0,$.jsx)(E,{className:`size-3.5 shrink-0`})},{value:`game`,icon:(0,$.jsx)(Re,{className:`size-3.5 shrink-0`})}],Fr=({value:e,onChange:t})=>{let{t:n}=z(),r=It(),i=Ge(),a={all:n(`chat.filters.all`),group:n(`chat.filters.group`),single:n(`chat.filters.single`),humanlike:n(`chat.filters.humanlike`),ai:n(`chat.filters.ai`),game:n(`chat.filters.game`),agent:n(`chat.filters.agent`),scenario:n(`chat.filters.scenario`)};return(0,$.jsx)($.Fragment,{children:(0,Q.useMemo)(()=>r||i?Pr:Nr,[r,i]).map(n=>{let r=e===n.value;return(0,$.jsx)(`button`,{onClick:()=>t(n.value),className:Z(`flex-1 min-w-fit relative flex items-center justify-center rounded-full text-[10px] leading-3 font-medium`,`transition-all duration-300`,r?`bg-primary/10 text-primary pl-4 pr-5 py-1.5`:`bg-muted text-muted-foreground dark:text-muted-foreground hover:text-primary px-1.5 py-1.5`),children:(0,$.jsxs)(`div`,{className:`flex items-center overflow-hidden`,children:[(0,$.jsx)(`span`,{className:`mx-1`,children:n.icon}),(0,$.jsx)(st,{initial:!1,children:r&&(0,$.jsx)(Y.span,{className:`whitespace-nowrap`,initial:{opacity:0,width:0},animate:{opacity:1,width:`auto`},exit:{opacity:0,width:0},transition:{duration:.3,ease:`easeInOut`},children:a[n.value]})})]})},n.value)})})},Ir=[{id:`create-group`,icon:S,action:`dialog`,value:`createGroup`},{id:`manage-chats`,icon:C,action:`dialog`,value:`manage-chats`},{id:`create-character`,icon:A,action:`route`,value:`/studio`},{id:`post-topic`,icon:u,action:`function`,value:`forumComposer`}],Lr=[{id:`general-chat`,icon:ie,action:`dialog`,value:`generalChat`},{id:`humanlike-ai`,icon:h,action:`dialog`,value:`humanlikeAI`},{id:`agent-chat`,icon:h,action:`function`,value:`agentChat`},{id:`join-group`,icon:Ln,action:`dialog`,value:`publicGroups`},{id:`import-chat`,icon:d,action:`function`,value:`importChat`}],Rr=e=>{let t={"create-group":e(`chat.menu.createGroup`),"manage-chats":e(`chat.menu.manageArchive`),"create-character":e(`chat.menu.createCharacter`),"post-topic":e(`chat.menu.postTopic`),"general-chat":e(`chat.menu.generalChat`),"humanlike-ai":e(`chat.menu.humanlikeAIChat`),"agent-chat":e(`chat.menu.agentChat`),"join-group":e(`chat.menu.explorePublicGroups`),"import-chat":e(`chat.menu.importChat`)};return Ir.map(e=>({...e,title:t[e.id]}))},zr=e=>{let t={"create-group":e(`chat.menu.createGroup`),"manage-chats":e(`chat.menu.manageArchive`),"create-character":e(`chat.menu.createCharacter`),"post-topic":e(`chat.menu.postTopic`),"general-chat":e(`chat.menu.generalChat`),"humanlike-ai":e(`chat.menu.humanlikeAIChat`),"agent-chat":e(`chat.menu.agentChat`),"join-group":e(`chat.menu.explorePublicGroups`),"import-chat":e(`chat.menu.importChat`)};return Lr.map(e=>({...e,title:t[e.id]}))},Br=({isLoading:e})=>(0,$.jsx)(st,{children:e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y.div,{className:`absolute bottom-0 left-0 right-0 h-1 overflow-hidden bg-dzmm-200 dark:bg-pink-700/30`,initial:{opacity:0}
2,animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:`easeInOut`},children:(0,$.jsx)(Y.div,{className:`absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r from-transparent via-dzmm-500 to-transparent dark:via-pink-600`,initial:{x:`-100%`},animate:{x:`400%`},transition:{duration:1.5,ease:`easeInOut`,repeat:1/0,repeatDelay:.5}})}),(0,$.jsx)(Y.div,{className:`absolute bottom-0 left-0 right-0 h-1 bg-dzmm-400 dark:bg-pink-500`,initial:{opacity:0},animate:{opacity:0},exit:{opacity:[0,.8,0]},transition:{duration:.6,ease:`easeInOut`}})]})});function Vr({item:e,onClick:t,className:n,isFirst:r=!1,isLast:i=!1,showDescription:a=!1,iconSize:o=`sm`}){let s=e.icon,c=o===`sm`?`size-4`:`size-5`;return(0,$.jsxs)(qe,{onClick:()=>{t()},className:Z(`cursor-pointer py-2.5 px-3 hover:bg-white/10 dark:hover:bg-white/5`,r&&`first:rounded-t-xl`,i&&`last:rounded-b-xl`,n),children:[(0,$.jsx)(s,{className:Z(c,`text-muted-foreground`)}),a&&e.description?(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground leading-4`,children:e.description})]}):(0,$.jsx)(`span`,{children:e.title}),e.badge&&(0,$.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary`,children:e.badge})]})}function Hr({filter:e,onFilterChange:t,searchMode:n=!1,onToggleSearch:r,searchQuery:i=``,onSearchQueryChange:a,isRefetching:o=!1,isScrolled:s=!1,chatCount:c=0}){let{t:l}=z(),u=X(),d=de(),f=It(),p=Ge(),{importChatAsync:m,isImporting:h}=hr(),_=(0,Q.useRef)(null),v=(0,Q.useRef)(null),y=U(pn),b=U(Ye),x=Mr(),{open:C,composer:T}=Sn(),[E,D]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1);ee({chatCount:c});let{startGeneralChat:M,isLoading:N}=vr(),{startAgentChat:te,isLoading:ne}=Mn(),[P,re]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1),[L,R]=nt(`open`);(0,Q.useEffect)(()=>{L===`humanlike-ai`?(D(!0),R(null)):L===`summon`&&(j(!0),R(null))},[L,R]),(0,Q.useEffect)(()=>{if(I(!0),d.isMatching){let e=setInterval(()=>{I(!1)},1e3);return()=>clearInterval(e)}},[d.isMatching]);let ie=(0,Q.useCallback)(()=>{d.isMatching?F||d.cancelMatching():y(!0)},[d,F,y]),ae=(0,Q.useCallback)(e=>{var t;let n=(t=e.target.files)==null?void 0:t[0];n&&(m(n),e.target.value=``)},[m]),oe=(0,Q.useCallback)(e=>{switch(e.value){case`createGroup`:x();break;case`forumComposer`:C();break;case`manage-chats`:u.navigate({to:`/chat/manage`});break;case`/studio`:u.navigate({href:e.value});break}},[u,x,C]),B=(0,Q.useCallback)(e=>{switch(e.value){case`generalChat`:M();break;case`humanlikeAI`:D(!0);break;case`agentChat`:te();break;case`publicGroups`:b(!0);break;case`importChat`:var t;(t=_.current)==null||t.click();break}},[b,M,te,!0,l]),se=f||p,{combinedItems:ce,newChatIdSet:V}=Q.useMemo(()=>{let e=new Set([`create-group`,`create-character`,`join-group`]);(f||p)&&e.add(`post-topic`);let t=Rr(l).filter(t=>!e.has(t.id)),n=zr(l).filter(t=>t.id!==`humanlike-ai`&&!e.has(t.id)).map(e=>(e.id,e)),r=new Set(n.map(e=>e.id));return{combinedItems:[...n,...t],newChatIdSet:r}},[l,f,p,!0]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:Z(`px-3 pb-3 space-y-2 relative transition-colors`,s?`border-b`:`border-b border-transparent`),children:[(0,$.jsx)(`input`,{ref:_,type:`file`,accept:`.json`,onChange:ae,className:`hidden`,"aria-label":l(`chat.header.importFileLabel`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsxs)(`div`,{className:`grid flex-1 gap-1 ${se?`grid-cols-2`:`grid-cols-4`}`,children:[!se&&(0,$.jsx)(Wr,{icon:d.isMatching?P&&!F?null:(0,$.jsx)(yr,{className:`text-[11px] font-medium font-mono`}):(0,$.jsx)(g,{className:`size-4 shrink-0`}),label:d.isMatching?P&&!F?l(`chat.header.cancel`):void 0:l(`chat.header.actionMatch`),forceShowLabel:d.isMatching&&P&&!F,variant:d.isMatching?`active`:`matching`,onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onClick:ie}),!se&&(0,$.jsx)(Wr,{icon:(0,$.jsx)(S,{className:`size-4 shrink-0`}),label:l(`chat.header.actionGroup`),onClick:()=>b(!0)}),(0,$.jsx)(`div`,{id:`onboarding-summon`,children:(0,$.jsx)(Wr,{icon:(0,$.jsx)(O,{className:`size-4 shrink-0`}),label:l(`chat.header.actionSummon`),onClick:()=>j(!0)})}),(0,$.jsx)(Wr,{icon:(0,$.jsx)(w,{className:`size-4 shrink-0`}),label:l(`chat.header.actionPreset`),onClick:()=>u.navigate({to:`/presets`})})]}),(0,$.jsx)(Gr,{disabled:h||N||ne,menuItems:ce,newChatIdSet:V,onNewChat:B,onMoreAction:oe})]}),(0,$.jsxs)(`div`,{className:`relative w-full`,children:[(0,$.jsx)(`div`,{ref:v,className:`flex items-center gap-2 h-9 overflow-x-auto no-scrollbar`,children:(0,$.jsx)(st,{mode:`wait`,initial:!1,children:n?(0,$.jsxs)(Y.div,{className:`flex items-center gap-2 flex-1`,initial:{opacity:0}
2,animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[(0,$.jsxs)(`div`,{className:`relative flex-1`,children:[(0,$.jsx)(yt,{value:i,onChange:e=>a==null?void 0:a(e.target.value),placeholder:l(`chat.header.searchPlaceholder`),className:`pl-9 h-min rounded-full text-xs focus-visible:ring-0 focus-visible:ring-transparent`,autoFocus:!0}),(0,$.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 px-3 h-full flex items-center justify-center`,children:(0,$.jsx)(k,{className:`size-4 text-muted-foreground`})})]}),(0,$.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 rounded-full text-muted-foreground hover:bg-accent hover:text-accent-foreground focus:outline-none focus-visible:ring-0 shrink-0`,title:l(`chat.header.closeSearch`),onClick:()=>r==null?void 0:r(),children:(0,$.jsx)(be,{className:`size-4`})})]},`search-input`):(0,$.jsxs)(Y.div,{className:`flex items-center gap-2 flex-1`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[(0,$.jsx)(Fr,{value:e,onChange:t}),(0,$.jsx)(W,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 rounded-full text-muted-foreground hover:bg-accent hover:text-accent-foreground focus:outline-none focus-visible:ring-0 shrink-0`,title:l(`chat.header.search`),onClick:()=>r==null?void 0:r(),children:(0,$.jsx)(k,{className:`size-4`,strokeWidth:2})})]},`filter-bar`)})}),(0,$.jsx)(Yt,{containerRef:v})]}),(0,$.jsx)(Br,{isLoading:o})]}),(0,$.jsx)(fn,{open:E,onOpenChange:D}),(0,$.jsx)(Ar,{open:A,onOpenChange:j}),T]})}var Ur=P(`flex h-9 w-full min-w-9 items-center justify-center gap-1 rounded-md px-2 text-[11px] font-semibold transition duration-200 focus:outline-none focus-visible:ring-2`,{variants:{variant:{default:`border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:ring-ring`,matching:`text-white bg-gradient-to-r from-pink-500 via-pink-500 to-rose-500 shadow-[0_4px_12px_rgba(249,114,149,0.2)] hover:shadow-[0_6px_16px_rgba(249,114,149,0.3)] focus-visible:ring-white/50`,active:`text-white bg-gradient-to-r from-dzmm-400 via-pink-500 to-pink-600 shadow-[0_4px_12px_rgba(249,114,149,0.25)] focus-visible:ring-white/50`}},defaultVariants:{variant:`default`}}),Wr=({icon:e,label:t,forceShowLabel:n=!1,variant:r=`default`,onClick:i,onMouseEnter:a,onMouseLeave:o})=>{let s=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(!0);(0,Q.useEffect)(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(e=>{var t,n;l(((t=(n=e[0])==null?void 0:n.contentRect.width)==null?0:t)>=56)});return t.observe(e),()=>t.disconnect()},[]);let u=t&&(c||n);return(0,$.jsxs)(`button`,{ref:s,type:`button`,onClick:i,onMouseEnter:a,onMouseLeave:o,title:t,className:Ur({variant:r}),children:[e,u&&(0,$.jsx)(`span`,{children:t})]})},Gr=({disabled:e,menuItems:t,newChatIdSet:n,onNewChat:r,onMoreAction:i})=>(0,$.jsxs)(it,{children:[(0,$.jsx)(De,{render:(0,$.jsx)(`button`,{type:`button`,disabled:e,className:`flex size-9 shrink-0 items-center justify-center rounded-xl text-muted-foreground transition duration-200 focus:outline-none hover:bg-accent hover:text-accent-foreground disabled:opacity-50`}),children:(0,$.jsx)(N,{className:`size-4`,strokeWidth:2})}),(0,$.jsx)(Ie,{align:`end`,sideOffset:10,className:`w-max rounded-2xl backdrop-blur-xl bg-background/90 text-foreground bg-blend-multiply`,children:t.map((e,a)=>(0,$.jsx)(Vr,{item:e,onClick:()=>n.has(e.id)?r(e):i(e),isFirst:a===0,isLast:a===t.length-1,showDescription:!0,iconSize:`md`},e.id))})]});function Kr(e){let{t}=z(),n=lt(),i=q(),a=B(),o=Qe(),c=U(Fe),l=at(),{emitWithAck:u}=pe(),[d,f]=xe(),{data:p}=K(),m=(e,t=!1)=>{c(e),a.setQueryData(i.chat.listAll.queryKey(),t=>t==null?void 0:t.filter(t=>t.id!==e)),t?o():a.invalidateQueries({queryKey:i.chat.listAll.queryKey()}),d===e&&f(null)},h=H({mutationFn:e=>ke.chat.deleteChat.mutate({chatId:e}),onSuccess:(e,n)=>{I({title:t(`chat.list.contextMenu.deleteSuccess`)}),m(n,!0)},onError:()=>{I({title:t(`chat.list.contextMenu.deleteFailed`),variant:`destructive`})}}),g=H({mutationFn:e=>ke.agent.remove.mutate({conversationId:e}),onSuccess:(e,n)=>{I({title:t(`chat.list.contextMenu.deleteSuccess`)}),m(n)},onError:()=>{I({title:t(`chat.list.contextMenu.deleteFailed`),variant:`destructive`})}}),_=H({mutationFn:async({id:e,isGroup:t,isOwner:n})=>{if(t)return gn({client:ke.groupChat,chatroomId:e,accountId:p==null?void 0:p.id,isOwner:n});let r=await u(`message:leave-room`,{chatroomId:e});if(!r.success)throw Error(r.error);return r},onSuccess:(e,{id:n})=>{I({title:t(`chat.list.contextMenu.leaveSuccess`)}),m(n)},onError:()=>{I({title:t(`chat.list.contextMenu.leaveFailed`),variant:`destructive`})}}),v=H({mutationFn:({chatroomId:e,muted:t})=>ke.groupChat.toggleMute.mutate({chatroomId:e,muted:t}),scope:{id:`toggle-mute-${e.id}`},onMutate:({chatroomId:e,muted:t})=>{l(e,()=>({data:{isMuted:t}}))},onSuccess:(e,{muted:n})=>{I({title:t(n?`chat.list.contextMenu.muteSuccess`:`chat.list.contextMenu.unmuteSuccess`)})},onError:(e,{chatroomId:n,muted:r})=>{l(n,()=>({data:{isMuted:!r}})),I({title:t(`chat.list.contextMenu.muteFailed`),variant:`destructive`})},onSettled:()=>a.invalidateQueries({queryKey:i.chat.listAll.queryKey()})});return(0,Q.useMemo)(()=>{let i=[];if(e.type===`user`){let n=e.data;n.unreadMessages>0&&i.push({key:`mark-as-read`,label:t(`chat.list.contextMenu.markAsRead`),icon:(0,$.jsx)(s,{className:`size-4`}),onClick:()=>{n.lastMessageId&&u(`message:read`,{chatroomId:n.chatroomId,messageId:n.lastMessageId}).then(e=>{e.success&&l(n.chatroomId,()=>({data:{unreadMessages:0}}))}).catch(()=>void 0)}})}if(e.type===`user`){let n=e.data;if(n.chatType===`group`&&!n.dissolvedAt){let e=!!n.isMuted;i.push({key:`toggle-mute`,label:t(e?`chat.list.contextMenu.unmute`:`chat.list.contextMenu.mute`),icon:e?(0,$.jsx)(x,{className:`size-4`}):(0,$.jsx)(y,{className:`size-4`}),onClick:()=>{v.mutate({chatroomId:n.chatroomId,muted:!e})}})}}if(e.type===`user`){let a=e.data,o=a.chatType===`group`,s=o&&!!(p!=null&&p.id)&&a.creatorId===p.id;i.push({key:`delete`,label:t(o?`chat.list.contextMenu.leaveChat`:`chat.list.contextMenu.deleteChat`),icon:o?(0,$.jsx)(b,{className:`size-4`}):(0,$.jsx)(r,{className:`size-4`}),onClick:async()=>{let r=t(o?`chat.list.contextMenu.confirmLeave`:`chat.list.contextMenu.confirmDelete`);if(o&&s&&!a.dissolvedAt){r=t(`chat.settings.delete.group.willDisband`);try{let e=await ke.groupChat.previewLeave.query({chatroomId:a.chatroomId});if(!e.willDisband){var i;r=t(`chat.settings.delete.group.willTransfer`,{name:((i=e.nextOwnerCandidate)==null?void 0:i.fullName)||``})}}catch{}}await n({title:t(o?`chat.list.contextMenu.leaveChat`:`chat.list.contextMenu.deleteChat`),description:r,destructive:!0})&&_.mutate({id:e.id,isGroup:o,isOwner:s})},variant:`destructive`})}else i.push({key:`delete`,label:t(`chat.list.contextMenu.deleteChat`),icon:(0,$.jsx)(r,{className:`size-4`}),onClick:async()=>{await n({title:t(`chat.list.contextMenu.deleteChat`),description:t(`chat.list.contextMenu.confirmDelete`),destructive:!0})&&(e.type===`agent`?g.mutate(e.id):h.mutate(e.id))},variant:`destructive`});return i},[e,t,p==null?void 0:p.id])}function qr(e){return(e==null?void 0:e.replace(/\s+/g,` `).trim())||null}function Jr(e){if(e==null)return null;let t=e instanceof Date?e:new Date(e);return Number.isFinite(t.getTime())?t:null}function Yr(e,t){return mt(e,{detailed:!0,locale:t})}function Xr(e,t,n){let r=qr(e.title);if(r&&!jt(r))return r;let i=qr(e.lastMessagePreview);if(i)return i;let a=Jr(e.createdAt);return a?t(a):n}function Zr(e,t,n,r){return e.lastMessageContent?Pe(e.lastMessageContent,t,n,e):r}var Qr=({chat:e,showIcon:t})=>{let n=Kr(e),r=e.type===`agent`?(0,$.jsx)(ei,{chat:e,showIcon:t}):e.type===`ai`?(0,$.jsx)(ti,{id:e.id,chat:e.data,time:e.time,showIcon:t}):(0,$.jsx)(ni,{chat:e.data,showIcon:t});return n.length===0?r:(0,$.jsx)(gt,{mode:`context`,items:n,title:e.type===`user`?e.data.title:void 0,children:(0,$.jsx)(`div`,{children:r})})},$r=()=>(0,$.jsx)(`img`,{src:`/images/avatars/nianbai.png`,alt:``,className:`size-10 rounded-full object-cover`}),ei=({chat:e,showIcon:t})=>{let{t:n}=z();return(0,$.jsx)(ii,{id:e.id,avatarUrl:null,isTyping:!1,title:e.data.title||n(`chat.agent.defaultTitle`),desc:n(`chat.agent.subtitle`),datetime:e.time,chatType:`ai`,isOnline:!1,Icon:t?o:void 0,avatarElement:(0,$.jsx)($r,{})})},ti=({id:e,chat:t,time:n,showIcon:r})=>{let{t:i}=z(),o=et(),s=ue(me(e));if(!t)return(0,$.jsx)(`div`,{className:`flex flex-row h-16 items-stretch overflow-hidden`});let c=t.cardName||i(`character.page.unavailable.name`),l=t.cardAvatarUrl,u=Xr(t,e=>i(`chat.list.startedAt`,{time:Yr(e,o)}),t.isGamefy?i(`chat.defaultTitle.game`):i(`chat.defaultTitle.session`));return(0,$.jsx)(ii,{id:e,avatarUrl:l,isTyping:s!==null,title:c,desc:u,datetime:n,chatType:`ai`,isOnline:!1,Icon:r?t.isGamefy?a:ie:void 0})},ni=({chat:e,showIcon:t})=>{var n,r,i;let{t:a}=z(),{data:o}=K(),s=ue(ce),c=ve(e.chatroomId),u=s[e.chatroomId]||0,d=e.chatType===`one_on_one`&&u>1,f=Zr(e,(n=o==null?void 0:o.id)==null?void 0:n,(r=o==null?void 0:o.fullName)==null?void 0:r,a(`chat.list.noMessages`));if(e.chatType===`one_on_one`)return(0,$.jsx)(ii,{id:e.chatroomId,avatarUrl:e.otherUserAvatarUrl,isTyping:!1,title:e.otherUserName||(e==null?void 0:e.title)||a(`chat.list.unknown`),desc:f,sentBy:null,datetime:e.lastMessageSentAt,chatType:`one_on_one`,Icon:t?v:void 0,unreadMessages:e.unreadMessages,isOnline:d});let p=e,m=!!p.scenarioId;return(0,$.jsx)(ii,{id:e.chatroomId,avatarUrl:e.avatarUrl||null,isTyping:!1,title:(e==null?void 0:e.title)||a(`chat.list.unknown`),desc:f,sentBy:((i=e.lastMessageContent)==null?void 0:i.type)===`system`?null:e.lastMessageSentBy,datetime:e.lastMessageSentAt,chatType:`group`,Icon:t?m?l:we:void 0,unreadMessages:e.unreadMessages,isMuted:p.isMuted,isOnline:d,voiceParticipantCount:c==null?void 0:c.participants.length})},ri=({chatroomId:e,isActive:t})=>{var n;let{t:r}=z(),i=Ne(e),{users:a,isLoading:o}=$t(e);return(0,$.jsx)(`div`,{className:`pl-14 mt-1.5 flex items-center`,children:(0,$.jsxs)(Qt,{loading:o,skeleton:(0,$.jsx)(Me,{className:`h-4 w-16 rounded-md`}),className:`flex items-center`,children:[(0,$.jsx)(`div`,{className:`flex -sp
2ace-x-1.5`,children:a==null||(n=a.members)==null?void 0:n.map(e=>(0,$.jsx)(J,{url:e.avatarUrl,displayName:e.fullName,size:16,className:`size-4 border ${t?`border-dzmm-50 dark:border-pink-950`:`border-background`}`},e.id))}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground ml-1`,children:(i==null?void 0:i.memberCount)-3<=0?r(`chat.list.memberCount`,{count:i==null?void 0:i.memberCount}):r(`chat.list.memberCountMore`,{count:(i==null?void 0:i.memberCount)-3})})]})})},ii=Q.memo(({id:e,avatarUrl:t,isTyping:n,title:r,desc:i,sentBy:a,datetime:o,chatType:s,unreadMessages:c,isMuted:l,isOnline:u,Icon:d,avatarElement:f,voiceParticipantCount:p})=>{let[m,h]=xe(),g=m===e,_=et(),{t:v}=z(),{data:b}=Ee(a==null?null:a,e),x=a&&b!=null&&b.fullName?`${b.fullName}:${i}`:i;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ai,{}),(0,$.jsxs)(`button`,{type:`button`,"aria-current":g?`page`:void 0,"aria-label":`${r},${x}${c?`,${c} 条未读`:``}`,className:Z(`flex w-full flex-col overflow-hidden cursor-pointer text-left`,g&&`bg-dzmm-50 dark:bg-pink-950/50`,`px-3 py-3`),onClick:()=>{le()?h(e,{history:`push`}):h(e,{history:`push`,shallow:!0})},children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-start w-full`,children:[(0,$.jsxs)(`div`,{className:`relative size-10 mr-4`,children:[f==null?s===`group`?t?(0,$.jsx)(J,{url:t,className:`size-10`,displayName:r,size:40}):(0,$.jsx)(`div`,{className:`size-10 bg-gradient-to-br
3                  from-pink-400 to-rose-600
4                  dark:from-pink-500 dark:to-purple-600 border-pink-300/20 shadow-pink-500/10 rounded-full flex items-center justify-center`,children:(0,$.jsx)(we,{className:`size-4 text-white`})}):(0,$.jsx)(J,{url:t||``,className:`size-10`,displayName:r,size:40}):f,(0,$.jsx)(st,{children:u&&(0,$.jsx)(Y.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.5},transition:{duration:.2},className:`absolute -bottom-1 -right-1`,children:(0,$.jsx)(`div`,{className:Z(`box-content size-3 bg-green-500 dark:bg-green-600 rounded-full border-2`,g?`border-dzmm-50 dark:border-[#330d1d]`:`border-[hsl(var(--sidebar-background))]`)})})}),n&&(0,$.jsxs)(`div`,{className:`absolute inset-0 flex items-center rounded-full justify-center bg-black/50`,children:[(0,$.jsx)(`span`,{className:`inline-block animate-bounce`,children:`•`}),(0,$.jsx)(`span`,{className:`inline-block animate-bounce delay-100`,children:`•`}),(0,$.jsx)(`span`,{className:`inline-block animate-bounce delay-200`,children:`•`})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 items-stretch w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-center min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[d&&(0,$.jsx)(d,{className:`size-3 mr-1 shrink-0`,strokeWidth:2}),(0,$.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium`,children:r}),l&&(0,$.jsx)(y,{className:`ml-1 size-3 shrink-0 text-muted-foreground`}),p!==void 0&&p>0&&(0,$.jsxs)(`span`,{className:`ml-1.5 flex shrink-0 items-center gap-0.5 rounded-full bg-primary/12 px-1.5 py-0.5 text-[9px] leading-none text-primary`,children:[(0,$.jsx)(R,{className:`size-2.5`}),p]})]}),(0,$.jsx)(`div`,{className:`ml-2 shrink-0 text-[10px] leading-3 text-muted-foreground/60`,children:o?mt(o,{detailed:!1,locale:_}):v(`chat.list.unknownTime`)})]}),(0,$.jsxs)(`div`,{className:`flex flex-row items-center mt-1`,children:[(0,$.jsx)(`div`,{className:`flex flex-1 min-w-0 items-center overflow-hidden text-xs text-muted-foreground`,children:(0,$.jsx)(`span`,{className:`block min-w-0 truncate`,children:x})}),s!==`ai`&&c!==void 0&&c>0&&(0,$.jsx)(`div`,{className:`h-full flex items-center ml-2 shrink-0`,children:(0,$.jsx)(`div`,{className:Z(`rounded-full text-background text-[10px] px-1.5 mr-1`,l?`bg-muted-foreground/50`:`bg-dzmm-500 dark:bg-pink-500`),children:c>=100?`99+`:c})})]})]})]}),s===`group`&&(0,$.jsx)(ri,{chatroomId:e,isActive:g})]})]})});ii.displayName=`BaseChatsListItem`;var ai=()=>(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`ml-14 h-px bg-border/30`});function oi(e=`all`){var t;let n=q(),r=B(),i=F(n.forum.status.queryOptions(void 0,{retry:!1,staleTime:mn,refetchInterval:mn})),a=!i.error&&((t=i.data)==null?void 0:t.enabled)===!0,o=se(n.notification.list.infiniteQueryOptions({filter:e},{getNextPageParam:e=>e.nextCursor})),s=(0,Q.useCallback)(()=>{r.invalidateQueries({queryKey:n.notification.latestPreview.queryKey()}),r.invalidateQueries(n.notification.list.pathFilter()),r.invalidateQueries(n.notification.unseenCounts.pathFilter())},[r,n]),c=H(n.notification.markInteractionSeen.mutationOptions({onSuccess:s})),l=(0,Q.useRef)(c);l.current=c;let u=(0,Q.useCallback)(()=>{l.current.mutate()},[]);return{query:o,items:(0,Q.useMemo)(()=>{var e,t;return((e=(t=o.data)==null?void 0:t.pages.flatMap(e=>e.items))==null?[]:e).filter(e=>hn(e.contentPreview,a))},[a,o.data]),markInteractiveSeen:u}}function si(e){let{t}=z(),n=lt(),r=B(),i=q(),{data:a=!1}=F(i.user.relations.checkFollowing.queryOptions({targetUserId:e},{staleTime:1e3*60*5})),o=H(i.user.relations.toggleFollow.mutationOptions({onSuccess:t=>{r.setQueryData(He.user.relations.checkFollowing.queryKey({targetUserId:e}),t),ft(r)}})),s=(0,Q.useCallback)(async()=>{a&&!await n({title:t(`user-profile.relation.confirmUnfollowTitle`),description:t(`user-profile.relation.confirmUnfollowDesc`),confirmText:t(`user-profile.relation.confirmUnfollow`),cancelText:t
4(`user-profile.relation.cancel`),destructive:!0})||o.mutate({targetUserId:e,follow:!a})},[n,a,t,e,o]);return{isFollowing:a,isPending:o.isPending,toggleFollow:s}}var ci=2;function li({notification:e,onNavigate:t}){var n,r,i,a,o,s;let{t:c}=z(),l=et(),[u,d]=(0,Q.useState)(!1),{type:f,recentActors:p,actorCount:m,contentPreview:h,updatedAt:g}=e,_=Jn(p,m,c),v=Gn(c,f,h==null?void 0:h.postType,!!(h!=null&&h.forumRootPostId)),y=p.slice(0,ci),b=m>1,x=f===`user_followed`,S=h==null?void 0:h.imageUrl,C=!x&&(S||(h==null?void 0:h.text)),w=async()=>{if(!u){if(!Yn(e)){await t(e);return}d(!0);try{await t(e)}finally{d(!1)}}};return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex flex-row items-center px-6 py-3.5 cursor-pointer hover:bg-accent transition-colors`,onClick:w,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),w())},children:[(0,$.jsx)(`div`,{className:`relative size-11 mr-3 shrink-0`,children:b&&y[1]?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{url:y[1].avatarUrl,displayName:(n=y[1].fullName)==null?void 0:n,className:`absolute top-0 left-0 size-6 border border-background`,size:24}),(0,$.jsx)(J,{url:y[0].avatarUrl,displayName:(r=y[0].fullName)==null?void 0:r,className:`absolute bottom-0 right-0 size-8 border-2 border-background`,size:32})]}):(0,$.jsx)(J,{url:(i=p[0])==null?void 0:i.avatarUrl,displayName:(a=(o=p[0])==null?void 0:o.fullName)==null?void 0:a,className:`size-11`,size:44})}),(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:_}),u?(0,$.jsx)(L,{size:12,className:`shrink-0 text-muted-foreground`}):null]}),(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2 mt-0.5`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate`,children:[v,!C&&h!=null&&h.text?`:${h.text}`:``]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground/50 shrink-0`,children:ot(g,l)})]})]}),x&&!b&&(s=p[0])!=null&&s.userId?(0,$.jsx)(ui,{targetUserId:p[0].userId}):S?(0,$.jsx)(`div`,{className:`h-12 w-10 rounded-md overflow-hidden ml-3 shrink-0 bg-muted`,children:(0,$.jsx)(Mt,{src:S,alt:``,width:40,height:48,className:`size-full object-cover`,unoptimized:!0})}):h!=null&&h.text?(0,$.jsx)(`div`,{className:`w-32 overflow-hidden ml-3 shrink-0 rounded-lg bg-muted/60 px-2 py-1.5`,children:(0,$.jsx)(`p`,{className:`text-[11px] leading-[15px] text-muted-foreground line-clamp-3 [overflow-wrap:anywhere]`,children:h.text})}):null]})}function ui({targetUserId:e}){let{t}=z(),{isFollowing:n,isPending:r,toggleFollow:i}=si(e);return(0,$.jsx)(W,{variant:n?`secondary`:`default`,size:`sm`,className:`ml-3 shrink-0 h-7 text-xs px-3`,loading:r,onClick:async e=>{e.stopPropagation(),await i()},children:t(n?`user-profile.relation.following`:`user-profile.relation.follow`)})}var di=[`all`,`follow`,`like`,`comment`,`bounty`];function fi({open:e,onOpenChange:t}){let{t:n}=z(),r=X(),i=B(),a=q(),[o,s]=(0,Q.useState)(`all`),{query:c,items:l,markInteractiveSeen:u}=oi(o),d=(0,Q.useRef)(null),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(!e){f.current=!1;return}!c.isSuccess||f.current||(f.current=!0,u())},[e,c.isSuccess,u]);let m=(0,Q.useCallback)(e=>{var t;(t=d.current)==null||t.scrollTo({top:0}),s(e)},[]),h=(0,Q.useCallback)(e=>{var n;(n=window.history.state)!=null&&n.responsiveDialog&&window.history.replaceState({},``),t(!1),r.navigate({href:e})},[t,r]),g=(0,Q.useCallback)(async e=>{let t=e.contentPreview;if(Yn(e)){if(p.current.has(e.id))return;p.current.add(e.id);try{var r;let o=await i.fetchQuery(a.notification.resolveTarget.queryOptions({notificationId:e.id},{staleTime:1/0}));if(!o){ye.error(n(`notification.loadError`));return}t={...t,contentId:o.contentId,commentId:(r=o.commentId)==null?t==null?void 0:t.commentId:r}}catch{ye.error(n(`notification.loadError`));return}finally{p.current.delete(e.id)}}h(Zn({type:e.type,targetType:e.targetType,targetId:e.targetId,actorId:e.actorId,contentPreview:t}))},[h,i,n,a]);return(0,$.jsx)(qt,{open:e,onOpenChange:t,children:(0,$.jsxs)(Kt,{className:`flex flex-col gap-0 p-0 overflow-hidden max-w-md 
4sm:max-w-lg max-h-[70vh] sm:max-h-[80vh] sm:min-h-[70vh]`,children:[(0,$.jsxs)(Ht,{className:`px-5 py-5`,children:[(0,$.jsx)(Gt,{className:`text-base font-semibold`,children:n(`notification.interactionMessages`)}),(0,$.jsx)(Ut,{className:`sr-only`,children:n(`notification.interactionMessages`)})]}),(0,$.jsx)(mi,{value:o,onSelect:m}),c.isLoading?(0,$.jsx)(gi,{}):c.isError?(0,$.jsx)(_i,{message:n(`notification.loadError`),description:n(`notification.loadErrorDesc`)}):l.length===0?(0,$.jsx)(_i,{message:n(`notification.empty`),description:n(`notification.emptyDesc`)}):(0,$.jsx)(hi,{items:l,query:c,scrollContainerRef:d,onNavigate:g})]})})}function pi(e,t){switch(t){case`all`:return e(`notification.filter.all`);case`follow`:return e(`notification.filter.follow`);case`like`:return e(`notification.filter.like`);case`comment`:return e(`notification.filter.comment`);case`bounty`:return e(`notification.filter.bounty`)}}function mi({value:e,onSelect:t}){let{t:n}=z();return(0,$.jsx)(`div`,{className:`flex gap-2 px-5 pb-3 overflow-x-auto no-scrollbar [&::-webkit-scrollbar]:h-0 [&::-webkit-scrollbar]:w-0 [scrollbar-width:none]`,children:di.map(r=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>t(r),"aria-pressed":e===r,className:Z(`shrink-0 whitespace-nowrap rounded-full px-3.5 py-1.5 text-xs font-medium transition-colors`,e===r?`bg-secondary text-primary`:`bg-muted text-muted-foreground hover:bg-accent`),children:pi(n,r)},r))})}var hi=({items:e,query:t,scrollContainerRef:n,onNavigate:r})=>{var i;let a=At({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>60,overscan:5}),o=a.getVirtualItems(),s=(i=o.at(-1))==null?void 0:i.index;return(0,Q.useEffect)(()=>{s!=null&&s>=e.length-5&&t.hasNextPage&&!t.isFetchingNextPage&&t.fetchNextPage()},[s,e.length,t.hasNextPage,t.isFetchingNextPage,t.fetchNextPage]),(0,$.jsxs)(`div`,{ref:n,className:`flex-1 overflow-y-auto min-h-0`,children:[(0,$.jsx)(`div`,{style:{height:a.getTotalSize(),width:`100%`,position:`relative`},children:o.map(t=>(0,$.jsxs)(`div`,{"data-index":t.index,ref:a.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${t.start}px)`},children:[t.index>0&&(0,$.jsx)(`div`,{className:`ml-12 h-px bg-border/30`}),(0,$.jsx)(li,{notification:e[t.index],onNavigate:r})]},t.key))}),t.isFetchingNextPage&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,$.jsx)(L,{size:20,className:`text-muted-foreground`})})]})};function gi(){return(0,$.jsx)(`div`,{className:`flex flex-col`,children:Array.from({length:6}).map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-start px-3 py-3`,children:[(0,$.jsx)(Me,{className:`size-9 rounded-full shrink-0 mr-4`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,$.jsx)(Me,{className:`h-4 w-3/4`}),(0,$.jsx)(Me,{className:`h-3 w-1/2`})]})]},t))})}function _i({message:e,description:t}){return(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 px-6 text-center`,children:[(0,$.jsx)(`div`,{className:`size-12 rounded-full bg-muted/50 flex items-center justify-center mb-4`,children:(0,$.jsx)(x,{className:`size-5 text-muted-foreground`})}),(0,$.jsx)(`p`,{className:`text-sm font-medium text-foreground mb-1`,children:e}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]})}function vi({open:e,onOpenChange:t}){return e?(0,$.jsx)(fi,{open:!0,onOpenChange:t}):null}var yi=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ai,{}),(0,$.jsx)(`div`,{className:`flex flex-col overflow-hidden px-3 py-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-row items-start w-full`,children:[(0,$.jsx)(`div`,{className:`relative size-9 mr-4`,children:(0,$.jsx)(`div`,{className:`size-9 bg-muted rounded-full animate-pulse`})}),(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 items-stretch w-0 gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row items-center`,children:[(0,$.jsx)(`div`,{className:`h-4 w-24 bg-muted rounded animate-pulse`}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsx)(`div`,{className:`h-3 w-12 bg-muted rounded animate-pulse`})]}),(0,$.jsx)(`div`,{className:`flex flex-row items-center mt-1`,children:(0,$.jsx)(`div`,{className:`h-3 w-40 bg-muted rounded animate-pulse`})})]})]})})]}),bi=()=>(0,$.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,$.jsx)(yi,{}),(0,$.jsx)(yi,{}),(0,$.jsx)(yi,{}),(0,$.jsx)(yi,{}),(0,$.jsx)(yi,{})]}),xi=e=>{let t=(0,zn.default)().startOf(`day`),n=(0,zn.default)().subtract(1,`day`).startOf(`day`),r=(0,zn.default)().subtract(1,`week`).startOf(`day`),i={today:[],yesterday:[],lastWeek:[],older:[]};for(let a of e){if(!a.time){i.older.push(a);continue}let e=(0,zn.default)(a.time);e.isAfter(t)?i.today.push(a):e.isAfter(n)?i.yesterday.push(a):e.isAfter(r)?i.lastWeek.push(a):i.older.push(a)}return i},Si=200,Ci=`bottom-tab-chat-list`,wi=e=>e.type===`label`?`label:${e.title}`:e.type===`notification`?`notification`:`${e.type}:${e.id}
4`,Ti=({filteredChats:e,filter:t,scrollContainerRef:n,onScroll:r,historyFooter:i,notifPreview:a,onNotificationClick:o})=>{let s=rt({id:Ci,getKey:re}),c=At({count:e.length,getScrollElement:()=>n.current,initialOffset:()=>{var e;return(e=s==null?void 0:s.scrollY)==null?0:e},getItemKey:t=>{let n=e[t];return n?wi(n):t},estimateSize:()=>72,overscan:5}),l=c.getVirtualItems(),u=-1;for(let t=e.length-1;t>=0;t--)if(e[t].type===`ai`){u=t;break}return(0,$.jsxs)(`div`,{ref:n,"data-scroll-restoration-id":Ci,className:`relative flex-1 overflow-y-auto`,style:{paddingBottom:`var(--app-bottom-inset, 0px)`},onScroll:()=>{var e,t;r(((e=(t=l.at(-1))==null?void 0:t.index)==null?-1:e)>=u)},children:[(0,$.jsx)(`div`,{style:{height:c.getTotalSize(),width:`100%`,position:`relative`},children:l.map(n=>{var r,i,s,l,u,d;let f=e[n.index];return(0,$.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:f.type===`label`?(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1 mt-3`,children:(0,$.jsx)(`span`,{className:`px-3`,children:f.title})}):f.type===`notification`?(0,$.jsx)(Qn,{unseenCount:(r=a==null?void 0:a.unseenCount)==null?0:r,latestType:(i=a==null?void 0:a.latestType)==null?null:i,latestPostType:(s=a==null?void 0:a.latestPostType)==null?null:s,latestIsForum:(l=a==null?void 0:a.latestIsForum)==null?!1:l,latestActorName:(u=a==null?void 0:a.latestActorName)==null?null:u,latestActorCount:(d=a==null?void 0:a.latestActorCount)==null?0:d,latestTime:f.time,onClick:o}):(0,$.jsx)(Qr,{chat:f,showIcon:t===`all`})},n.key)})}),i]})},Ei=()=>{var e;let{t}=z(),{t:n}=z(),r=oe(),i=ue(Bt),a=U(Bt),o=It(),s=Ge(),c=tt(),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(o?`ai`:`all`),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(null),{data:S,isLoading:C,isFetching:w,hasMore:T,loadMore:E,isLoadingMore:D}=Ze({loadHistory:y}),{data:O}=$n(),[k,A]=(0,Q.useState)(!1),j=(0,Q.useMemo)(()=>h.trim().toLowerCase(),[h]),M=xn(j,250),N=Je(p?M:``),ee=Ae();(0,Q.useEffect)(()=>{var e;(e=N.data)!=null&&e.length&&ee(N.data)},[N.data,ee]);let te=(0,Q.useCallback)(()=>{m(e=>{let t=!e;return t||g(``),t})},[]),ne=!p&&(d===`all`||d===`ai`||d===`game`),P=(0,Q.useCallback)(()=>{!ne||C||T===!1||D||(y?E():b(!0))},[ne,T,C,D,y,E]),re=(0,Q.useCallback)(e=>{let t=x.current;if(!t)return;v(t.scrollTop>0);let n=t.scrollHeight-t.scrollTop-t.clientHeight;if(p){n<=600&&M.length>0&&M===j&&N.hasNextPage&&!N.isFetchingNextPage&&N.fetchNextPage();return}(e||n<=600)&&P()},[N.fetchNextPage,N.hasNextPage,N.isFetchingNextPage,M,P,j,p]),F=ne&&!C&&T!==!1?(0,$.jsx)(`div`,{className:`flex justify-center p-3`,children:(0,$.jsx)(W,{variant:`ghost`,loading:D,onClick:P,children:t(`chat.list.loadMoreHistory`)})}):null;(0,Q.useEffect)(()=>{(!C||S&&S.length>0)&&u(!1)},[C,S]),(0,Q.useEffect)(()=>{if(!r||!i)return;let e=window.setTimeout(()=>{a(!1)},Si);return()=>window.clearTimeout(e)},[r,i,a]);let I=(0,Q.useMemo)(()=>{if(!S)return[];let e=p&&M===j&&N.data?[...new Map([...S,...N.data].map(e=>[`${e.type}:${e.id}`,e])).values()]:S,n=o?ur(e):s?dr(e):e,r=p?n:fr(n,d);if(p){let e=j;e!==``&&(r=r.filter(t=>{var n,r;if(t.type===`ai`){var i,a,o;let n=(i=(a=t.data)==null?void 0:a.title)==null?``:i,r=(o=t.data.cardName)==null?``:o;return n.toLowerCase().includes(e)||r.toLowerCase().includes(e)}if(t.type===`agent`){var s;return((s=t.data.title)==null?``:s).toLowerCase().includes(e)||t.data.persona.toLowerCase().includes(e)}let c=t.data;return[(n=c==null?void 0:c.title)==null?``:n,(r=c==null?void 0:c.otherUserName)==null?``:r].some(t=>t.toLowerCase().includes(e))}))}let i=[...r],a=!1;if(O!=null&&O.latestTime){let e={type:`notification`,time:O.latestTime,searchText:t(`notification.interactionMessages`).toLowerCase()};(p?j===``||e.searchText.includes(j):d===`all`)&&(i.push(e),a=!0)}a&&i.sort((e,t)=>{var n,r,i,a;return((n=(r=t.time)==null?void 0:r.getTime())==null?-1/0:n)-((i=(a=e.time)==null?void 0:a.getTime())==null?-1/0:i)});let c=xi(i),l=[];return c.today.length>0&&(l.push({type:`label`,title:t(`chat.list.timeLabels.today`)}),l.push(...c.today)),c.yesterday.length>0&&(l.push({type:`label`,title:t(`chat.list.timeLabels.yesterday`)}),l.push(...c.yesterday)),c.lastWeek.length>0&&(l.push({type:`label`,title:t(`chat.list.timeLabels.lastWeek`)}),l.push(...c.lastWeek)),c.older.length>0&&(l.push({type:`label`,title:t(`chat.list.timeLabels.older`)}),l.push(...c.older)),l},[d,S,p,j,M,N.data,o,s,t,O]);return(0,$.jsxs)(vn,{minSize:20,defaultSize:25,className:Z(`absolute left-0 z-[20] flex h-full w-full flex-col bg-background lg:static lg:w-auto`,!r||i?`transition-transform`:`transition-none`,!r&&`-translate-x-full lg:translate-x-0`),children:[c&&r&&(0,$.jsx)(Vt,{title:n(`navbar.NavBar.navItems.chats`)}),(0,$.jsx)(Hr,{filter:d,onFilterChange:f,searchMode:p,onToggleSearch:te,searchQuery:h,onSearchQueryChange:g,isRefetching:w,isScrolled:_,chatCount:(e=S==null?void 0:S.length)==null?0:e}),(0,$.jsx)(nr,{}),(0,$.jsx)(Qt,{loading:l,skeleton:(0,$.jsx)(bi,{}),className:`flex-1 min-h-0 flex flex-col overflow-hidden`,children:c&&!p&&d===`all`&&S&&S.length===0&&!(O!=null&&O.latestTime)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_r,{className:`h-full`}),F]}):I.length===0?(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center`,children:[(0,$.jsx)(`div`,{className:`text-lg text-muted-foreground dark:text-muted-foreground mb-4`,children:t(p||d!==`all`?`chat.list.emptySearch`:`chat.list.emptyChats`)}),F]}):(0,$.jsx)(Ti,{filteredChats:I,filter:d,scrollContainerRef:x,onScroll:re,historyFooter:F,notifPreview:O,onNotificationClick:()=>A(!0)})}),(0,$.jsx)(vi,{open:k,onOpenChange:A})]})},Di=()=>(0,$.jsxs)(`div`,{className:`w-full h-full flex flex-col relative bg-background`,children:[(0,$.jsxs)(`div`,{className:`hidden lg:flex h-14 border-b border-border items-center px-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`size-9 rounded-full bg-muted animate-pulse`}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`h-4 bg-muted rounded animate-pulse w-32`}),(0,$.jsx)(`div`,{className:`h-3 bg-muted rounded animate-pulse w-20`})]})]}),(0,$.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,$.jsx)(`div`,{className:`w-8 h-8 rounded bg-muted animate-pulse`}),(0,$.jsx)(`div`,{className:`w-8 h-8 rounded bg-muted animate-pulse`})]})]}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,$.jsx)(`div`,{className:`flex flex-col items-center gap-4`})}),(0,$.jsxs)(`div`,{className:`h-20 border-border flex items-center px-4`,children:[(0,$.jsx)(`div`,{className:`flex-1 h-12 rounded-full bg-muted animate-pulse flex items-center px-4`}),(0,$.jsx)(`div`,{className:`ml-3 w-10 h-10 rounded-full bg-muted animate-pulse`})]})]}),Oi=`/api/heartbeat`;function ki(e,t=fetch){return t(Oi,{signal:e})}function Ai(e){let{emitWithAck:t}=pe();return()=>t(`message:join-room`,{chatroomId:e})}function ji({chatroomId:e,groupTitle:t,hasJoined:n=!1,onSuccess:r}){let{t:i}=z(),{toast:a}=ct(),o=X(),s=q(),c=B(),{profile:l,isLoading:u}=K(),{openLoginDialog:d}=ze(),[f,p]=(0,Q.useState)(!1),m=Ai(e),h=H(s.groupChat.joinPublic.mutationOptions({onSuccess:async()=>{await c.refetchQueries({queryKey:s.chat.listAll.queryKey()}),await m(),a({title:i(`chat.groupChat.joinSuccess`),description:i(`chat.groupChat.joinSuccessDescription`,{groupTitle:t})}
4),r==null||r(),o.navigate({to:`/chat`,search:{c:e}})},onError:()=>{a({variant:`destructive`,title:i(`chat.groupChat.joinFailed`),description:i(`chat.groupChat.tryAgainLater`)})},onSettled:()=>{p(!1)}}));return n?(0,$.jsx)(W,{onClick:()=>{o.navigate({to:`/chat`,search:{c:e}}),r==null||r()},size:`sm`,variant:`outline`,children:i(`chat.groupChat.enterGroup`)}):(0,$.jsx)(W,{onClick:()=>{if(!u){if(Nn(l)){d({trigger:`other`});return}p(!0),h.mutate({chatroomId:e})}},disabled:f||u,size:`sm`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{size:16,className:`mr-2`}),i(`chat.groupChat.joining`)]}):i(`chat.groupChat.joinGroup`)})}function Mi(){var e;let t=q(),{t:n}=z(),r=et(),[i,a]=We(Ye),o=Mr(),[s,c]=(0,Q.useState)(``),l=(0,Q.useRef)(null),{data:u,isLoading:d,error:f,refetch:p,fetchNextPage:h,hasNextPage:g,isFetchingNextPage:_}=se(t.groupChat.listPublic.infiniteQueryOptions({tag:s||void 0},{getNextPageParam:e=>e.nextCursor,staleTime:1e3*60,enabled:i})),v=(e=u==null?void 0:u.pages.flatMap(e=>e.groups))==null?[]:e;(0,Q.useEffect)(()=>{if(!l.current||!g||_)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&h()},{threshold:.1});return e.observe(l.current),()=>e.disconnect()},[g,_,h]);let y=e=>{a(e)},b=e=>{c(e===`all`?``:e)},{data:x=[]}=F(t.chatroom.getTags.queryOptions(void 0,{staleTime:1/0})),[C,w]=(0,Q.useState)(!1);return(0,$.jsx)(qt,{open:i,onOpenChange:y,children:(0,$.jsxs)(Kt,{className:`max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-0`,children:[(0,$.jsxs)(Ht,{className:`flex-row items-center justify-between gap-2 px-6 pt-6 pb-4`,children:[(0,$.jsx)(Gt,{children:n(`chat.publicGroups.dialogTitle`)}),(0,$.jsx)(Ut,{className:`sr-only`,children:n(`chat.publicGroups.dialogTitle`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 ml-auto`,children:[(0,$.jsxs)(W,{variant:`outline`,size:`sm`,className:`h-8 gap-1`,onClick:()=>{a(!1),o()},children:[(0,$.jsx)(A,{}),(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:n(`chat.menu.createGroup`)})]}),(0,$.jsxs)(Wt,{render:(0,$.jsx)(W,{variant:`ghost`,size:`icon`,className:`size-8`}),className:`hidden md:flex`,children:[(0,$.jsx)(be,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-6`,children:[(0,$.jsx)(Dt,{variant:!s||s===`all`?`default`:`outline`,className:`cursor-pointer`,onClick:()=>b(`all`),children:n(`chat.publicGroups.allGroups`)}),x.slice(0,C?x.length:5).map(e=>(0,$.jsx)(Dt,{variant:s===e?`default`:`outline`,className:`cursor-pointer`,onClick:()=>b(e),children:e},e)),x.length>5&&(0,$.jsx)(`button`,{className:`text-xs text-muted-foreground`,onClick:()=>w(!C),children:n(C?`chat.publicGroups.showLess`:`chat.publicGroups.showMore`)})]}),(0,$.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:d?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,$.jsx)(L,{size:32})}):f?(0,$.jsx)(Et,{onRetry:()=>p()}):v.length===0?(0,$.jsx)(`div`,{className:`text-center py-10 text-muted-foreground`,children:n(`chat.publicGroups.emptyState`)}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[v.map(e=>{var t;return(0,$.jsx)(`div`,{className:`bg-secondary/50 rounded-lg p-4 hover:bg-secondary/70 transition-colors`,children:(0,$.jsx)(`div`,{className:`flex items-start justify-between`,children:(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-lg font-semibold mb-1 break-words`,children:e.title}),e.description?(0,$.jsx)(`p`,{className:`mb-2 line-clamp-2 whitespace-pre-wrap break-words text-sm text-muted-foreground`,children:e.description}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground mb-2 flex-wrap`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,$.jsx)(S,{className:`size-3 shrink-0`}),e.memberCount,` `,n(`chat.publicGroups.members`)]}),e.lastMessageAt&&(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,$.jsx)(m,{className:`size-3 shrink-0`}),n(`chat.publicGroups.activeTime`),` `,Le(e.lastMessageAt,r)]}),e.tags&&e.tags.length>0&&e.tags.map(e=>(0,$.jsx)(Dt,{variant:`secondary`,className:`text-xs h-5 px-2`,children:e},e))]}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs text-muted-foreground whitespace-nowrap min-w-0`,children:[(0,$.jsx)(`span`,{className:`relative size-5 shrink-0`,children:e.creator.avatar?(0,$.jsx)(Mt,{src:Ue(e.creator.avatar),alt:(t=e.creator.name)==null?``:t,fill:!0,className:`rounded-full object-cover`}):(0,$.jsx)(`span`,{className:`size-5 rounded-full bg-primary/20 block`})}),(0,$.jsxs)(`span`,{className:`truncate`,children:[n(`chat.publicGroups.creator`),` `,e.creator.name]})]}),(0,$.jsx)(ji,{chatroomId:e.chatroomId,groupTitle:e.title,hasJoined:e.hasJoined,onSuccess:()=>a(!1)})]})]})})},e.chatroomId)}),(0,$.jsx)(`div`,{ref:l,className:`py-4 flex justify-center`,children:_&&(0,$.jsx)(L,{size:20})})]})})]})})}
4var Ni=`green_arrived:`;function Pi(e){try{let t=`${Ni}${e}`;return sessionStorage.getItem(t)?!1:(sessionStorage.setItem(t,`1`),!0)}catch{return!0}}function Fi(e,t){let n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!e||!t||n.current===e||!ae())return;let r=nn(t);(r==null?void 0:r.source_placement)===`home_green_featured`&&(n.current=e,Pi(e)&&Be(`green_chat_arrived`,{card_id:t,chat_session_id:e}))},[e,t])}var Ii=()=>{let{t:e}=z();return(0,$.jsx)(Tt,{className:`h-full border-none`,children:(0,$.jsxs)(xt,{children:[(0,$.jsx)(bt,{variant:`icon`,children:(0,$.jsx)(c,{})}),(0,$.jsx)(Ct,{children:e(`chat.empty.selectChat.title`)}),(0,$.jsx)(wt,{children:e(`chat.empty.selectChat.description`)})]})})},Li=3e4,Ri=Q.lazy(()=>V(()=>import(`./Cmodtjqe2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59]))),zi=Q.lazy(()=>V(()=>import(`./BG9OxGbl.js`),__vite__mapDeps([60,1,2,3,4,10,11,8,15,61,62,12,5,53,13,63,64,65,66,6,7,14,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,20,47,67,17,68,48,49,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88]))),Bi=Q.lazy(()=>V(()=>import(`./BmwpCHaP.js`),__vite__mapDeps([89,1,2,3,15,61,62,6,7,8,90,91,32,21,22,23,24,12,13,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,20,47,80,18,92,78,11,93,94,95,96]))),Vi=Q.lazy(()=>V(()=>import(`./B-JrT1ny.js`),__vite__mapDeps([97,1,2,3,61,62,98,99,13,8,100,101,102]))),Hi=({initialChatId:e})=>{var t,n,r,i,a;let o=X(),s=B(),c=q(),{profile:l}=K(),{data:u,queryData:d,isLoading:f,isFetching:p}=Ze(),m=he(),[h,g]=xe({history:`replace`}),_=U(Oe),v=Q.useRef(!1),y=Q.useRef(null),{t:b}=z(`error`);We(Ft),Q.useEffect(()=>{!e||v.current||(v.current=!0,g(e))},[e,g]);let x=h||e||void 0,S=u==null?void 0:u.find(e=>e.id===x),C=(t=d==null?void 0:d.some(e=>e.id===x))==null?!1:t,w=!!(x&&d&&!C),T=Pt(w?x:void 0),E=Wi(T.error),D=w&&!Nt(x),O=D||w&&T.isError&&E===`NOT_FOUND`,k=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{var e;(S==null?void 0:S.id)===x?k.current=S:((e=k.current)==null?void 0:e.id)!==x&&(k.current=void 0)},[x,S]);let A=((n=k.current)==null?void 0:n.id)===x?k.current:void 0,j=Q.useMemo(()=>{var e;let t=T.data;if(!(!t||t.chatId!==x))return{type:`ai`,id:t.chatId,time:(e=t.lastVisited)==null?t.createdAt:e,data:{cardId:t.cardId,title:t.title,isGamefy:t.isGamefy,gameOrientation:null,cardName:t.cardName,cardAvatarUrl:t.cardAvatarUrl,lastMessagePreview:null}}},[x,T.data]),M=(r=S==null?j?A==null?j:A:void 0:S)==null?w&&!O?A:void 0:r;(0,Q.useEffect)(()=>{var t,n;if(f||p)return;if(!x){y.current=null;return}if(e&&x===e){y.current=null;return}if(d===void 0){y.current=null;return}if(C){y.current=null;return}if(w&&((t=T.data)==null?void 0:t.chatId)===x){y.current=null;return}if(w&&!D&&(T.isPending||T.isFetching))return;if(w&&!O){y.current=null;return}let r=((n=y.current)==null?void 0:n.chatId)===x?y.current:null,i=r==null?{chatId:x,firstSeenAt:Date.now(),hasRefetched:!1,reported:!1}:r;if(y.current=i,!i.hasRefetched){i.hasRefetched=!0,s.invalidateQueries({queryKey:c.chat.listAll.queryKey()});return}let a=Date.now()-i.firstSeenAt;if(a<1200){let e=window.setTimeout(()=>{s.invalidateQueries({queryKey:c.chat.listAll.queryKey()})},1200-a);return()=>window.clearTimeout(e)}i.reported||(i.reported=!0,I.error(b(`chat.unableToLoad`),{description:x}),o.navigate({to:`/chat`,replace:!0}))},[x,O,(i=T.data)==null?void 0:i.chatId,T.isFetching,T.isPending,e,f,p,D,w,C,d,b,o,s,c.chat.listAll]),(0,Q.useEffect)(()=>{M&&M.type===`user`&&_(void 0)},[M,_]);let N=l!=null&&l.isLoggedIn&&(M==null?void 0:M.type)===`ai`?M:void 0;return Fi(N==null?void 0:N.id,(a=N==null?void 0:N.data.cardId)==null?void 0:a),!l||!l.isLoggedIn||f||e&&!h?(0,$.jsx)(Di,{}):x?M?M.type===`agent`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Di,{}),children:(0,$.jsx)(Ri,{conversationId:M.id})}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Di,{}),children:M.type===`user`?(0,$.jsx)(zi,{userId:l.id}):M.data.isGamefy?(0,$.jsx)(Bi,{chatId:M.id,data:M.data},M.id):(0,$.jsx)(te,{chatId:M.id,chat:M.data})}):(0,$.jsx)(Di,{}):u&&u.length===0&&!m?(0,$.jsx)(_r,{className:`h-full`}):(0,$.jsx)(Ii,{})};function Ui(e){return e&&Rn.includes(e)?e:void 0}function Wi(e){var t;return e==null||(t=e.data)==null?void 0:t.code}var Gi=()=>{let e=X(),t=Q.useRef(!1),[n,r]=(0,Q.useState)(!1),{profile:i,isLoading:a}=K(),o=U(pn),s=U(zt),c=B(),l=q(),[u,d]=nt(`match`,G),[f,p]=(0,Q.useState)(),[m,h]=Ve({c:G,card:G,entry:G,model:G,ridx:G,checkpoint:G,relay:G,rr:G},{history:`replace`,shallow:!0}),g=H(l.chat.createByCard.mutationOptions()),_=H(l.chat.createByCheckpoint.mutationOptions());(0,Q.useEffect)(()=>
4{if(!(a||!i)&&!i.isLoggedIn){let t=window.location.pathname+window.location.search;e.navigate({to:`/sign-in`,search:{next:t},replace:!0})}},[a,i,e]);let v=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(v.current||!(i!=null&&i.isLoggedIn))return;let{card:t,checkpoint:n}=m;if(!(!t&&!n))if(v.current=!0,t){var r;let n=m.ridx?Number(m.ridx):NaN;g.mutate({cardId:Number(t),defaultModel:(r=m.model)==null?void 0:r,fixedRandomIndex:Number.isInteger(n)?n:void 0,entryPoint:Ui(m.entry),recallRef:m.rr&&/^[0-9a-f]{32}$/.test(m.rr)?m.rr:void 0},{onSuccess:({chatId:e})=>{en(e),p(e)},onError:n=>{let r=Wi(n);r===`TOO_MANY_REQUESTS`?e.navigate({to:`/character/$id`,params:{id:t},search:{error:`rate_limited`},replace:!0}):r===`NOT_FOUND`?e.navigate({to:`/character/$id`,params:{id:t},replace:!0}):(I.error(n.message),h({card:null,entry:null,model:null,ridx:null,rr:null}))}})}else n&&_.mutate({shareCode:n,relayOptionIndex:m.relay?Number(m.relay):void 0},{onSuccess:({chatId:e,relayPrompt:t})=>{en(e),t&&s({chatId:e,message:t}),p(e)},onError:t=>{let r=Wi(t);r===`NOT_FOUND`?e.navigate({to:`/share/$id`,params:{id:n},replace:!0}):r===`FORBIDDEN`?e.navigate({to:`/share/$id`,params:{id:n},search:{error:`user_type_denied`},replace:!0}):r===`TOO_MANY_REQUESTS`?e.navigate({to:`/share/$id`,params:{id:n},search:{error:`rate_limited`},replace:!0}):(I.error(t.message),h({checkpoint:null,relay:null}))}})},[i==null?void 0:i.isLoggedIn,m,g,_,e,s,h]),(0,Q.useEffect)(()=>{u&&(o(!0),d(null))},[u,o,d]),(0,Q.useEffect)(()=>{f&&c.invalidateQueries({queryKey:l.chat.listAll.queryKey()})},[f,c,l]),(0,Q.useEffect)(()=>{f&&h({c:f,card:null,entry:null,model:null,ridx:null,checkpoint:null,relay:null,rr:null})},[f,h]),(0,Q.useEffect)(()=>{let e=setTimeout(()=>{V(()=>import(`./B-JrT1ny.js`),__vite__mapDeps([97,1,2,3,61,62,98,99,13,8,100,101,102])),V(()=>import(`./ClNXl51n2.js`),__vite__mapDeps([103,1,2,3,104,8,14,15,105])),V(()=>import(`./D3l7oYvC.js`).then(e=>e.n),__vite__mapDeps([52,1,2,3,53,17,54,55]))},1e3);return()=>clearTimeout(e)},[]),F({queryKey:[`heartbeat`],queryFn:async({signal:e})=>{let n=await ki(e);return n.status===429||n.status===403?(t.current||(t.current=!0,r(!0),setTimeout(()=>window.location.reload(),Math.random()*3e4)),null):n.json()},refetchInterval:Li,enabled:!n}),i&&!i.isLoggedIn?null:(0,$.jsx)(Ki,{children:(0,$.jsxs)(yn,{direction:`horizontal`,className:`h-full`,children:[(0,$.jsx)(Ei,{}),(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vi,{})}),(0,$.jsx)(Mi,{}),(0,$.jsx)(bn,{className:`hidden lg:flex`}),(0,$.jsx)(vn,{className:`h-full`,minSize:50,defaultSize:75,children:(0,$.jsx)(Hi,{initialChatId:f})})]})})},Ki=({children:e})=>(0,$.jsx)(Fn,{className:`bg-background`,children:e});function qi({chatId:e,children:t}){return(0,$.jsx)(Te,{value:e,children:t})}function Ji(){let e=je({strict:!1});return(0,$.jsxs)(qi,{chatId:typeof e.id==`string`?e.id:void 0,children:[(0,$.jsx)(Gi,{}),(0,$.jsx)(Xe,{})]})}export{Ji as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.