Files
appco_dist/.output/public/_nuxt/B66a40Xd.js
T

8 lines
34 KiB
JavaScript
Raw Normal View History

2025-07-27 10:51:22 +03:30
import{d as V,bm as Je,s as ae,e as et,C as b,k as J,aI as C,bD as tt,aX as Q,aY as ot,aK as Re,r as F,K as _e,b7 as nt,bn as st,bY as Le,bW as it,ae as ie,a$ as Ae,aP as xe,aQ as de,ct as Y,aW as at,aV as rt,bc as lt,be as Pe,cz as ut,aL as dt,a1 as He,bT as ct,b$ as pt,u as be,G,o as me,ak as fe,y as L,z as _,A as r,H as d,D as X,a2 as ee,a3 as ce,F as re,al as le,a7 as ue,aj as Ce,B as A,U as mt,J as te,S as Z,E as Oe,I as Ie,cG as De,az as Ve,ay as ke,N as ft,a5 as vt,a4 as ve,a9 as ge,a8 as gt,Q as ht}from"./vNwORUzZ.js";import{e as se}from"./DWEdiVkG.js";import{f as wt,a as Ue}from"./BY2xK23z.js";import{S as yt,a as xt}from"./BPXlpqFK.js";/* empty css *//* empty css */import{P as _t}from"./DPKLCRhs.js";import{i as Te}from"./hIAbPA16.js";import{B as pe}from"./DSh6TMV1.js";import{_ as bt}from"./DlAUqK2U.js";import{_ as Se}from"./C-jpo4dy.js";import{C as We}from"./B952oZ7B.js";import{B as Ct}from"./B7_GJxBp.js";import{U as kt}from"./Cp4vHarM.js";/* empty css */import{_ as St}from"./CLfv5Oag.js";/* empty css */import{T as $t}from"./CwW7ictx.js";import{M as Lt,_ as he,u as Pt}from"./DthsPRuY.js";import{S as Ke}from"./I3pYu3kF.js";import{B as Ot}from"./Bx0AlLRd.js";import{u as It,a as Tt}from"./C1A0Ol0M.js";import{g as Mt,a as Me}from"./CBmaeoJK.js";import{i as Bt,g as Ft,c as Nt,d as Et,a as jt,e as zt}from"./CW2jPw-_.js";function Rt(e){const{selectionStart:i}=e;return e.value.slice(0,i)}function At(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(i)?i:[i]).reduce((t,s)=>{const l=e.lastIndexOf(s);return l>t.location?{location:l,prefix:s}:t},{location:-1,prefix:""})}function Be(e){return(e||"").toLowerCase()}function Ht(e,i,o){const t=e[0];if(!t||t===o)return e;let s=e;const l=i.length;for(let a=0;a<l;a+=1)if(Be(s[a])!==Be(i[a])){s=s.slice(a);break}else a===l-1&&(s=s.slice(l));return s}function Dt(e,i){const{measureLocation:o,prefix:t,targetText:s,selectionStart:l,split:a}=i;let u=e.slice(0,o);u[u.length-a.length]===a&&(u=u.slice(0,u.length-a.length)),u&&(u=`${u}${a}`);let p=Ht(e.slice(l),s.slice(l-o-t.length),a);p.slice(0,a.length)===a&&(p=p.slice(a.length));const m=`${u}${t}${s}${a}`;return{text:`${m}${p}`,selectionLocation:m.length}}function Vt(e,i){e.setSelectionRange(i,i),e.blur(),e.focus()}function Ut(e,i){const{split:o}=i;return!o||e.indexOf(o)===-1}function Wt(e,i){let{value:o=""}=i;const t=e.toLowerCase();return o.toLowerCase().indexOf(t)!==-1}const qe=Symbol("MentionsContextKey");function Kt(){}const qt=V({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(e,i){let{slots:o}=i;const{activeIndex:t,setActiveIndex:s,selectOption:l,onFocus:a=Kt,loading:u}=Je(qe,{activeIndex:ae(),loading:ae(!1)});let p;const m=y=>{clearTimeout(p),p=setTimeout(()=>{a(y)})};return et(()=>{clearTimeout(p)}),()=>{var y;const{prefixCls:k,options:$}=e,n=$[t.value]||{};return b(Lt,{prefixCls:`${k}-menu`,activeKey:n.value,onSelect:h=>{let{key:N}=h;const P=$.find(T=>{let{value:M}=T;return M===N});l(P)},onMousedown:m},{default:()=>[!u.value&&$.map((h,N)=>{var P,T;const{value:M,disabled:j,label:D=h.value,class:U,style:K}=h;return b(he,{key:M,disabled:j,onMouseenter:()=>{s(N)},class:U,style:K},{default:()=>[(T=(P=o.option)===null||P===void 0?void 0:P.call(o,h))!==null&&T!==void 0?T:typeof D=="function"?D(h):D]})}),!u.value&&$.length===0?b(he,{key:"notFoundContent",disabled:!0},{default:()=>[(y=o.notFoundContent)===null||y===void 0?void 0:y.call(o)]}):null,u.value&&b(he,{key:"loading",disabled:!0},{default:()=>[b(Ke,{size:"small"},null)]})]})}}}),Yt={bottomRight:{points:["tl","br"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},bottomLeft:{points:["tr","bl"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["bl","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topLeft:{points:["br","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}},Xt=V({compatConfig:{MODE:3},name:"KeywordTrigger",props:{loading:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},prefixCls:String,placement:String,visible:{type
2025-07-26 22:08:43 +03:30
user:users(name, avatar),
like:likes(user_id),
replies:comments(*,
user:users(name, avatar),
like:likes(user_id)
)`).eq("product_id",e).is("parent_id",null).range(t,s).order("created_at",{ascending:!1}))==null?void 0:l.data},ze=async(e,i,o=void 0)=>await ke.post("/media/add-comment",{message:e,product_id:i,parent_id:o}),_n={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},bn={"mt-1":"","font-semibold":""},Cn={class:"flex items-center"},kn={class:"me-1"},Sn={class:"flex items-center p1"},es=V({__name:"CommentAddEdit",props:{open:{type:Boolean},id:{}},emits:["update:open"],setup(e,{emit:i}){const o=be(),t=G(),s=te(),l=F(null),a=F(!0),u=F(null),p=F(!1),m=F(!1),y=F(!1);te();const k=F(void 0),$=()=>{a.value=u.value.scrollTop<=5};function n(){k.value=void 0}function h(){setTimeout(()=>{var f;(f=document.activeElement)==null||f.scrollIntoView({behavior:"smooth",block:"center"}),p.value=!0},300)}me(()=>{ie(()=>{u.value&&$()})});const N=e,P=i,T=F(!1),M=F([]),j=F(""),D=F(null),U=F(!1),K=F(0),q=F(20),W=async()=>{try{if(!U.value){T.value=!0;const f=await xn(N.id,++K.value,q.value);(f==null?void 0:f.length)<q.value&&(U.value=!0),M.value.push(...f)}}catch(f){console.log("e ===>",f)}finally{T.value=!1}};async function oe(){var f,x;await W(),await ie(),await((f=l.value)==null?void 0:f.setOpen()),await((x=D.value)==null?void 0:x.focus())}async function ne(){var f;await ie(),await((f=l.value)==null?void 0:f.setClose()),v(),n()}function v(){M.value=[],K.value=0,U.value=!1}const c=async()=>{var f,x,H,z;try{if(((f=j.value)==null?void 0:f.length)>0){if(m.value=!0,k.value){const R=await ze(j.value,N.id,k.value.id);(x=k.value)!=null&&x.replies||(k.value.replies=[]),(H=k.value)==null||H.replies.push({message:j.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],...R})}else{const R=await ze(j.value,N.id);(z=M.value)==null||z.unshift({message:j.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],replies:[],...R})}await ie(()=>{j.value="",k.value=void 0})}}catch(R){console.log(R)}finally{m.value=!1}};function S(f,x,H,z){var R,E,w;try{if(y.value=!0,ge())if(f)if(Jo(x),H){const g=M.value.find(B=>B.id===z),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.splice((R=I.like)==null?void 0:R.findIndex(B=>{var $e;return B.user_id===(($e=s.user)==null?void 0:$e.id)}))}else{const g=M.value.find(I=>I.id===z);g==null||g.like.splice((E=g==null?void 0:g.like)==null?void 0:E.findIndex(I=>{var B;return I.user_id===((B=s.user)==null?void 0:B.id)}))}else if(Qo(x),H){const g=M.value.find(B=>B.id===z),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.push({product_id:x,user_id:s.user.id})}else{const g=M.value.find(I=>I.id===z);(w=g==null?void 0:g.like)==null||w.push({product_id:x,user_id:s.user.id})}else o.push({name:"auth-login"}),ht.warn(t.useString("pleaseLoginOrRegister"))}catch(g){console.log(g)}finally{y.value=!1}}const O=F();return vt(O,([{isIntersecting:f}])=>{f&&N.open&&setTimeout(()=>{W()},100)}),He(N,f=>{f.open?oe():ne()}),(f,x)=>{const H=so;return _(),re(Ct,{title:"",ref_key:"sheetRef",ref:l,headerCls:"",allowCloseScrollup:a.value,closeOnClickOutside:"",onOnClickOutside:x[3]||(x[3]=z=>P("update:open",!1)),onOnClose:x[4]||(x[4]=z=>P("update:open",!1))},{header:X(()=>[r("div",_n,[x[5]||(x[5]=r("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),r("div",bn,A(d(t).useString("comments")),1)])]),default:X(()=>{var z,R,E;return[r("div",{class:ve(["h-70vh w-full relative relative",d(ge)()?"pb-4rem":""])},[r("div",{class:"h-full px-4 overflow-auto",ref_key:"scrollArea",ref:u,onScroll:$},[(_(!0),L(ee,null,ce(M.value,w=>(_(),re(hn,{item:w,onLikeComment:S,onReply:g=>k.value=w,addLikeLoading:y.value},null,8,["item","onReply","addLikeLoading"]))),256)),T.value?(_(),L(ee,{key:0},ce(5,w=>b(yn)),64)):Z("",!0),ue(r("div",{ref_key:"observer",ref:O,class:"w-full opacity-0 relative"}," load ",512),[[gt,!T.value]])],544),d(ge)()?(_(),L("div",{key:0,class:"flex w-inherit fixed gap-2 items-end my-2 px4 py-1 bottom-1",onFocusin:h,onFocusout:x[2]||(x[2]=w=>p.value=!1)},[b(kt,{width:"40",src:(z=d(s).user)==null?void 0:z.avatar,"just-show-profile":""},null,8,["src"]),r("div",{class:ve(["border-solid w-full border-1 comment