PageSourceSearch

https://app.cinevva.com/assets/chunks/SidebarCommunityChat.DvEiIDPU.js

js cinevva.com collected 2026-09-25 20:01:39 UTC 4,350 bytes, 1 lines download raw bytes

1import{g as N,r as u,o as j,f as D,j as a,h as n,y as s,L as E,p as k,G as H,H as O,t as p,z as i,a1 as V,a3 as A,a4 as I,U as T,q as P,l as M,k as R}from"./framework.D4MCK8Cu.js";import{C as K,u as U,a as J}from"./CommunityIrc.B_dxxEvs.js";import{u as q}from"./theme.CJQQ1m_G.js";import"./PhArrowUpRight.vue.o3VPkiOJ.js";import"./PhArrowsOut.vue.46xwbuyf.js";import"./PhChatsCircle.vue.D6J8BEeU.js";import"./PhPaperPlaneTilt.vue.z7KtFT8I.js";import"./PhX.vue.DNDVUtuZ.js";import"./PhBroadcast.vue.DsZyQjOi.js";import"./PhChatCircle.vue.CLpT9H8L.js";import"./PhDiscordLogo.vue.8l5qX5jK.js";import"./useLiveSharing.B891PubX.js";import"./PhCaretDown.vue.D47GU3mp.js";import"./useChatOverlay.Cx035ggC.js";const z={class:"community-chat","aria-label":"Community chat"},F={key:0,class:"chat-note"},G={key:1,class:"chat-note"},W={key:0,class:"chat-note",role:"status"},Y=["disabled"],Q={key:0,class:"chat-error",role:"alert"},X=["disabled"],_="https://api.cinevva.com",Z=N({__name:"LegacySidebarCommunityChat",setup(B){const{isAuthenticated:d,login:h}=q(),m=u([]),c=u(""),r=u(!1),v=u(!0),f=u(""),y=u(""),l=u(null);let b,g=!1,C=0;async function w(){if(!(document.hidden||g))try{const o=await fetch(`${_}/chat/rooms/general/messages?limit=30`,{credentials:"include"});if(!o.ok)throw new Error;const e=await o.json();if(g)return;const t=!l.value||l.value.scrollHeight-l.value.scrollTop-l.value.clientHeight<40;m.value=(e.messages||[]).filter($=>$.message_type==="text"),y.value="",t&&(await T(),l.value?.scrollTo({top:l.value.scrollHeight})),d.value&&Date.now()-C>=6e4&&(C=Date.now(),await fetch(`${_}/chat/presence`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:"general"})}))}catch{y.value="Chat could not refresh. Retrying shortly."}finally{v.value=!1}}async function x(){await w(),g||(b=setTimeout(x,15e3))}async function S(){const o=c.value.trim();if(!(r.value||!d.value||!o||o.length>2e3)){r.value=!0,f.value="";try{const e=await fetch(`${_}/chat/rooms/general/messages`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:o})}),t=await e.json();if(!e.ok){f.value=t.error||"Message could not be sent.";return}c.value="",await w(),await T(),l.value?.scrollTo({top:l.value.scrollHeight})}catch{f.value="Message could not be sent. Your draft is saved here."}finally{r.value=!1}}}function L(o){o.key==="Enter"&&!o.shiftKey&&!o.isComposing&&(o.preventDefault(),S())}return j(()=>{x()}),D(()=>{g=!0,clearTimeout(b)}),(o,e)=>(a(),n("section",z,[e[3]||(e[3]=s("div",{class:"section-header"},[s("span",{class:"section-title"},"Community Chat"),s("a",{class:"section-link",href:"/chat"},"Open ↗")],-1)),E(K,{onReply:e[0]||(e[0]=t=>c.value=t)}),e[4]||(e[4]=s("p",{class:"chat-note"},"Say hello, share ideas, or ask for help.",-1)),s("div",{ref_key:"feed",ref:l,class:"chat-feed",role:"log","aria-label":"Recent chat messages",tabindex:"0"},[v.value?(a(),n("p",F,"Loading chat…")):!m.value.length&&!y.value?(a(),n("p",G,"Start a conversation.")):k("",!0),(a(!0),n(H,null,O(m.value,t=>(a(),n("div",{key:t.id,class:"chat-message"},[s("strong",null,p(t.user.name),1),s("p",null,p(t.content),1)]))),128))],512),y.value?(a(),n("p",W,p(y.value),1)):k("",!0),i(d)?(a(),n("form",{key:1,onSubmit:V(S,["prevent"])},[A(s("textarea",{"onUpdate:modelValue":e[1]||(e[1]=t=>c.value=t),"aria-label":"Message to creator chat",placeholder:"Write a message…",rows:"2",maxlength:"2000",disabled:r.value,onKeydown:L},null,40,Y),[[I,c.value]]),f.value?(a(),n("p",Q,p(f.value),1)):k("",!0),s("button",{type:"submit",disabled:r.value||!c.value.trim()},p(r.value?"Checking…":"Send"),9,X)],32)):(a(),n("button",{key:2,type:"button",onClick:e[2]||(e[2]=(...t)=>i(h)&&i(h)(...t))},"Sign in to chat")),e[5]||(e[5]=s("p",{class:"chat-note rules"},"Keep it friendly. No sexual content, harassment, hate, or spam.",-1))]))}}),ee=P(Z,[["__scopeId","data-v-48044e8a"]]),te={key:2,role:"status"},ae={key:3,role:"status"},ve=N({__name:"SidebarCommunityChat",setup(B){const{enabled:d,configError:h,retry:m}=U();return(c,r)=>i(d)===!0?(a(),M(J,{key:0,compact:""})):i(d)===!1?(a(),M(ee,{key:1})):i(h)?(a(),n("p",te,[R(p(i(h))+" ",1),s("button",{onClick:r[0]||(r[0]=(...v)=>i(m)&&i(m)(...v))},"Retry")])):(a(),n("p",ae,"Loading community chat…"))}});
1export{ve as default};

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.