Files
appco_dist/.output/public/_nuxt/4G7ALCH-.js
T
2025-08-25 15:52:41 +03:30

2 lines
6.4 KiB
JavaScript

import{d as g,C as u,dy as j,a3 as L,K as N,k as R,r as h,a2 as H,o as U,y,z as c,a4 as F,e3 as O,af as E,a5 as k,A as l,B as S,u as K,H as G,d7 as J,e4 as Q,e5 as X,F as w,D as I,I as p,T as Y,V as Z,ak as ee,e6 as te}from"./CYzE2ijA.js";import{b as x,c as b,h as z,w as T,m as D,k as ae,t as W,l as se}from"./D_v9xIQL.js";import{s as re}from"./CAptaKtV.js";import{_ as ne}from"./m5rKCcpG.js";import{B as A}from"./DD5Ys7CO.js";import{U as oe}from"./CF-aW0C7.js";import{B as le}from"./DiwVHmYu.js";import{_ as M}from"./DlAUqK2U.js";import"./DWEdiVkG.js";import"./DJ83mdXo.js";import"./BaWKP4Oo.js";import"./MNTfBqFg.js";import"./CbhVGPK6.js";import"./CiQmnpgl.js";import"./Dq6rkBjt.js";import"./Cd8lqI2K.js";import"./D6qJbdzf.js";import"./DDcn0TAH.js";const[ie,ue]=b("skeleton-title"),ce={round:Boolean,titleWidth:x};var de=g({name:ie,props:ce,setup(e){return()=>u("h3",{class:ue([{round:e.round}]),style:{width:z(e.titleWidth)}},null)}});const ve=T(de);var me=ve;const[fe,he]=b("skeleton-avatar"),_e={avatarSize:x,avatarShape:D("round")};var pe=g({name:fe,props:_e,setup(e){return()=>u("div",{class:he([e.avatarShape]),style:ae(e.avatarSize)},null)}});const ge=T(pe);var we=ge;const $="100%",ye={round:Boolean,rowWidth:{type:x,default:$}},[ke,xe]=b("skeleton-paragraph");var Se=g({name:ke,props:ye,setup(e){return()=>u("div",{class:xe([{round:e.round}]),style:{width:e.rowWidth}},null)}});const be=T(Se);var Ce=be;const[Te,P]=b("skeleton"),$e="60%",Be={row:se(0),round:Boolean,title:Boolean,titleWidth:x,avatar:Boolean,avatarSize:x,avatarShape:D("round"),loading:W,animate:W,rowWidth:{type:[Number,String,Array],default:$}};var Ie=g({name:Te,inheritAttrs:!1,props:Be,setup(e,{slots:i,attrs:s}){const m=()=>{if(e.avatar)return u(we,{avatarShape:e.avatarShape,avatarSize:e.avatarSize},null)},d=()=>{if(e.title)return u(me,{round:e.round,titleWidth:e.titleWidth},null)},f=n=>{const{rowWidth:t}=e;return t===$&&n===+e.row-1?$e:Array.isArray(t)?t[n]:t},r=()=>Array(+e.row).fill("").map((n,t)=>u(Ce,{key:t,round:e.round,rowWidth:z(f(t))},null)),_=()=>i.template?i.template():u(L,null,[m(),u("div",{class:P("content")},[d(),r()])]);return()=>{var n;return e.loading?u("div",j({class:P({animate:e.animate,round:e.round})},s),[_()]):(n=i.default)==null?void 0:n.call(i)}}});const We="data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='white'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='%23733af9'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",Ae={class:"message-bubble"},Pe={class:"time"},Le=g({__name:"Conversation",props:{chatId:{}},setup(e,{expose:i}){const s=e,m=N(),d=R(()=>m.user),f=h([]),r=h(null),_=v=>new Date(v).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});async function n(){if(!s.chatId)return;const v=await O(s.chatId,1,1e3);f.value=Array.isArray(v)?v:v.data||[]}function t(){r.value&&E(()=>{const v=r.value;v.scrollTo({top:v.scrollHeight,behavior:"smooth"})})}return H(f,()=>{t()}),i({request:n,scrollToBottom:t}),U(async()=>{await n()}),(v,o)=>(c(),y("div",{class:"chat-container",ref_key:"chatContainer",ref:r},[(c(!0),y(L,null,F(f.value,a=>(c(),y("div",{key:a.id,class:k(["message",{sent:a.sender_id===d.value.id,received:a.sender_id!==d.value.id}])},[l("div",Ae,[l("p",null,S(a.text),1),l("span",Pe,S(_(a.created_at)),1)])],2))),128))],512))}}),Ne=M(Le,[["__scopeId","data-v-3b999e95"]]),Re={class:"flex justify-between items-center w-full p4"},Ue={class:"flex items-center gap-5"},ze={key:0,class:"flex gap-24px items-center"},De={class:"font-semibold flex items-center"},Me={class:"flex font-200 text-xs items-center"},qe={dir:"ltr",class:"h-98vh pb-10 overflow-hidden"},Ve=["alt"],je=g({__name:"index",setup(e){const i=K(),s=G(),m=N(),d=h(""),f=h(null),r=h(void 0);R(()=>s.sellerConfig?.store?.main&&m.user.id!==s.sellerConfig?.store?.id);const _=h(!1),n=h(!1),t=h(void 0);U(async()=>{try{if(_.value=!0,i.currentRoute.value.query?.id?.length){const o=await J(i.currentRoute.value.query?.id);m.user.id===o?.user1_id?r.value=o?.user2:o.user1&&(r.value=o?.user1),t.value={chat_id:i.currentRoute.value.query.id}}else{const o=i.currentRoute.value.query?.user_id??s.sellerConfig?.store?.id,a=await Q(o,m.user.id);if(a?.length)t.value=a[0];else{const C=await X(o,m.user.id);t.value=C}m.user.id===t.value?.user1_id?r.value=t.value?.user2:t.value.user1&&(r.value=t.value?.user1)}}catch(o){console.log("e ===>",o)}finally{_.value=!1}});const v=async()=>{if(d.value.length)try{n.value=!0;const o=await te(t.value.chat_id,d.value);await f.value.request(),f.value.scrollToBottom(),setTimeout(()=>{d.value=""},100)}catch(o){console.log("e ===>",o)}finally{n.value=!1}};return(o,a)=>{const C=Ie,q=re,V=ne;return c(),w(V,null,{default:I(()=>[l("div",null,[l("div",{class:k(["fixed top-0 w-inherit right-0 left-0",p(s).isNightStore?"bg-black":"bg-white"])},[l("div",Re,[l("div",Ue,[u(A,{icon:p(s).isRTL?"vuesax-linear:arrow-right":"vuesax-linear:arrow-left",onClick:a[0]||(a[0]=B=>p(i).back())},null,8,["icon"]),r.value?.id?(c(),y("div",ze,[u(oe,{width:"40",src:r.value?.avatar,justShowProfile:""},null,8,["src"]),l("div",null,[l("div",De,S(r.value?.name),1),l("div",Me,S(r.value?.username),1)])])):Y("",!0)]),a[2]||(a[2]=l("div",{class:"flex w-fit gap-4 h-1.3rem items-center"},null,-1))])],2),l("div",qe,[_.value?(c(),w(C,{key:0})):(c(),w(Ne,{key:1,ref_key:"conversation",ref:f,chatId:t.value?.chat_id},null,8,["chatId"]))]),l("div",{class:k(["fixed bottom-0 w-inherit right-0 left-0 p-3",p(s).isNightStore?"bg-black":"bg-white"])},[l("div",{class:k(["flex items-center gap-5 rounded-full px-2",p(s).isNightStore?"bg-gray-700":"bg-gray-100"])},[u(le,{value:d.value,"onUpdate:value":a[1]||(a[1]=B=>d.value=B),"place-holder":`${p(s).useString("message")}...`,class:"!rounded-full border-transparent !bg-transparent message-placeholder !py-3 flex-1",rows:1},null,8,["value","place-holder"]),u(Z,{name:"fade",mode:"out-in"},{default:I(()=>[d.value===""?(c(),w(A,{key:0,icon:"vuesax-linear:add-circle"})):(c(),y("div",{key:1,class:k(["w-4rem h-2rem bg-#733af9 flex items-center rounded-full p-1 pt-2 text-white justify-center",{"bg-gray-500":n.value}]),onClick:v},[n.value?(c(),w(q,{key:1,class:"!text-white",type:"spinner",size:"20px"})):(c(),y("img",{key:0,src:We,alt:p(ee),class:"h-full rtl:-scale-x-100"},null,8,Ve))],2))]),_:1})],2)],2)])]),_:1})}}}),He=M(je,[["__scopeId","data-v-423afc3d"]]),it=g({__name:"detail_message",setup(e){return(i,s)=>(c(),w(He))}});export{it as default};