PageSourceSearch

https://www.yenisafak.com/assets/useReactionProcess-B-5hEN2i.js

js yenisafak.com collected 2026-09-24 08:46:19 UTC 11,221 bytes, 1 lines download raw bytes

1import{r as p,j as s,B as q,a8 as be,V as ve,c as L,U as X,T as F,F as P,S as z}from"./vendor-mantine-CdXp4ZqI.js";import{Y as ie}from"./YsCommentCard-4ep4eMh6.js";import{q as Z,U as de,V as Ce,B as pe,u as ye}from"./nodes-BD4JLVU8.js";import{Y as me}from"./YsIcon-DXziTzas.js";import{C as j}from"./content.types-CvrdmXkS.js";import{P as fe}from"./context-LY6_5Er-.js";import{R as K}from"./YsCarouselPagination-B7_-MkGn.js";var V=(e=>(e.POPULAR="popular",e.ASC="asc",e.DESC="desc",e))(V||{});const xe="_commentInput_c4211_1",Se="_textInput_c4211_5",Le="_input_c4211_25",Ie="_send_c4211_57",Te="_avatar_c4211_93",Ne="_noAvatar_c4211_98",Ae="_commentInfo_c4211_107",M={commentInput:xe,textInput:Se,input:Le,send:Ie,avatar:Te,noAvatar:Ne,commentInfo:Ae},ue=p.forwardRef((e,a)=>{const{className:t,data:f,user:l,onSend:y}=e,[i,u]=p.useState(""),{t:_}=Z(),d=c=>{y?.({comment:c,data:f}),u("")};return s.jsxs(q,{className:L(t,M.commentInput),children:[s.jsx(q,{className:L(t,M.textInput,"YsTextInput"),children:s.jsx(be,{ref:a,placeholder:_("commentsList.addComment"),variant:"unstyled",className:M.input,value:i,onChange:c=>u(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),d(i))},rightSection:s.jsx(X,{variant:"transparent",className:M.send,style:{pointerEvents:"auto"},disabled:i.trim().length===0,onClick:()=>d(i),children:_("form.send")}),leftSection:s.jsx(ve,{className:L(M.avatar,!l?.avatar&&M.noAvatar),src:l?.avatar||"https://assets.yenisafak.com/yenisafak/wwwroot/images/comment-input-default.svg",alt:l?.fullname||"Avatar",size:20,imageProps:{width:20,height:20,loading:"lazy"},px:0})})}),s.jsx(F,{className:M.commentInfo,children:_("commentsList.pleaseRespect")})]})}),je="_commentHead_cf5en_1",Me="_title_cf5en_11",we="_titleIcon_cf5en_23",De="_titleText_cf5en_29",Re="_filter_cf5en_41",Ee="_filterTitle_cf5en_47",He="_filterSelect_cf5en_59",Be="_filterText_cf5en_63",Pe="_filterIcon_cf5en_75",Oe="_count_cf5en_82",b={commentHead:je,title:Me,titleIcon:we,titleText:De,filter:Re,filterTitle:Ee,filterSelect:He,filterText:Be,filterIcon:Pe,count:Oe};function Ue(e){const{className:a,totalCommentCount:t=0,onHandleSortingType:f}=e,{t:l}=Z(),y=[{label:l("commentsList.mostPopular"),value:V.POPULAR},{label:l("commentsList.theLatest"),value:V.DESC},{label:l("commentsList.theOldestOnes"),value:V.ASC}],[i,u]=p.useState({label:l("commentsList.byDate"),value:V.DESC}),_=d=>{u(d),f?.(d.value)};return s.jsxs(P,{className:L(a,b.commentHead),children:[s.jsxs(q,{children:[s.jsxs(P,{className:b.title,align:"center",children:[s.jsx(me,{className:b.titleIcon,name:"feed-card-comment"}),s.jsx(F,{className:b.titleText,component:"strong",children:l("commentsList.comments")})]}),t>0&&s.jsxs(P,{className:b.filter,children:[s.jsx(F,{className:b.filterTitle,component:"span",children:l("commentsList.sort")}),s.jsxs(z,{width:200,position:"bottom-start",zIndex:994,children:[s.jsx(z.Target,{children:s.jsxs(P,{className:b.filterSelect,align:"center",children:[s.jsx(F,{className:b.filterText,component:"span",children:i.label}),s.jsx(me,{name:"more-comments-chevron-down",className:b.filterIcon})]})}),s.jsx(z.Dropdown,{children:y.map(d=>s.jsx(z.Item,{onClick:()=>_(d),children:d.label},d.value))})]})]})]}),t>0&&s.jsxs(F,{className:b.count,component:"span",children:[t," ",l("commentsList.comment")]})]})}const Ye="_commentList_bla5k_1",$e="_content_bla5k_20",Ke="_contentModal_bla5k_25",Fe="_allComment_bla5k_29",Ve="_allCommentReply_bla5k_61",B={commentList:Ye,content:$e,contentModal:Ke,allComment:Fe,allCommentReply:Ve};function Ze(e){const{ref:a,commentInputRef:t,user:f,className:l,isDetailComment:y,comments:i,totalCommentCount:u,isVisibleInModal:_,hasMoreComments:d,isLoadingMore:c,isCommentOwner:w,onHandleSendComment:I,onHandleReactionType:T,onHandleDeleteComment:O,onHandleReportComment:D,onHandleFetchAllComments:S,onHandleSortingType:N,onHandleSendEditComment:U,onHandleOpenModal:A,onLoadMoreComments:m}=e,{t:g}=Z(),[v,x]=p.useState(null),[R,h]=p.useState(null),E=_||y||!1,ee=p.useMemo(()=>E?i:i.slice(0,1),[E,i]),[te,ne]=p.useState(!1),oe=r=>{x(r)},se=r=>{h({cid:r})},ae=r=>{S?.(r),ne(!0)},G=(r,k)=>({isCommentOwner:w,onEditComment:se,onHandleReactionType:n=>T?.(n,r.id.toString()),onHandleReportComment:({reportId:n,description:o})=>D?.({reportId:n,commentId:r.id.toString(),description:o}),onHandleDeleteComment:()=>
1O?.(r.id.toString(),!!k,k?.id??null),onHandleSendComment:(n,o)=>o==="edit"?U?.(n,R?.cid||""):I?.({comment:n,data:v}),onReply:()=>oe({cid:r.id.toString(),repliedName:r.user.username,...k&&{mainCommentId:k.id}})});return s.jsxs(q,{className:L(l,B.commentList,"YsCommentList"),ref:a,children:[s.jsxs(P,{className:L(l,B.content,_&&B.contentModal,"YsCommentListContent"),children:[y&&s.jsx(Ue,{totalCommentCount:u,onHandleSortingType:N}),y&&s.jsx(ue,{ref:t,user:f||null,onSend:({comment:r,data:k})=>I?.({comment:r,data:k})}),ee.map(r=>s.jsx(ie,{isDetailComment:y,comment:r,...G(r),replies:s.jsxs(s.Fragment,{children:[E&&r.replies.map(k=>s.jsx(ie,{comment:k,variant:"reply",...G(k,{id:r.id.toString()})},k.id)),S&&r.subCommentCount>r.replies.length&&!te&&s.jsxs(X,{className:L(l,B.allComment,B.allCommentReply),onClick:()=>{ae(r.id.toString())},children:[g("commentsList.viewAllAnswers"),"(",r.subCommentCount-r.replies.length,")"]})]})},r.id)),u>1&&!E&&s.jsxs(X,{className:B.allComment,onClick:()=>{A?.()},children:[g("commentsList.viewAllComments")," (",u-1,")"]}),d&&!c&&E&&s.jsx(P,{justify:"center",align:"center",py:"md",onClick:()=>m?.(),children:g("general.loadMore")})]}),!y&&s.jsx(ue,{ref:t,className:L("bottomInput"),data:v,user:f||null,onSend:({comment:r,data:k})=>I?.({comment:r,data:k})})]})}const et=({item:e})=>{const{entity:a,entityApi:t,entityStore:f}=de(),{isPiriNetDisabled:l}=p.useContext(fe),{setSubComments:y,setComments:i,setEditComment:u,setDeleteComment:_,setDeleteSubComment:d,setLikeComment:c,getSubCommentsByWithId:w}=f,{createTempDisableUserProcessesToast:I}=Ce(),{openAuthModal:T}=pe(),{commentsMeta:{quantity:O},comments:D}=a,S=O||0,[N,U]=p.useState("desc"),A=p.useMemo(()=>{const n=[...D];return N==="popular"?n.sort((o,C)=>C.likeCount-o.likeCount||C.createdAtDate.getTime()-o.createdAtDate.getTime()):n.sort((o,C)=>N==="asc"?o.createdAtDate.getTime()-C.createdAtDate.getTime():C.createdAtDate.getTime()-o.createdAtDate.getTime())},[D,N]),m=p.useMemo(()=>A.reduce((n,o)=>n+1+o.subCommentCount,0),[A]),g=p.useMemo(()=>S>m,[S,m]),[v,x]=p.useState(!1),R=p.useRef(null),{user:h}=ye();return{comments:A,totalCommentCount:S,hasMoreComments:g,isLoadingMore:v,user:h,isCommentOwner:n=>!!(h&&h.uid===n),sendComment:async({msg:n,data:o=null})=>{if(l){I();return}if(!h){T();return}if(n.trim().length<=0)return;const{fullname:Y,uid:J,avatar:he}=h,Q={body:n,exactReplyId:null,entity:{},eid:a.id,repliedUserName:o?.repliedName||null,rid:o?.cid||null,user:{name:Y,avatar:he,uid:J}},ke=!!o?.cid,$=a.type==="reel"?"reel":e.contentType||e.type||"",{id:W,title:re,url:ce,category:_e,mainCategory:ge,mediumId:le}=e;[j.columns,j.cartoons,j.economy,j.sport,j.economyWidget,j.fixtureWidget,j.standingWidget].includes($)||a.type==="reel"?Q.entity={id:Number(W),key:`${$}-${W}`,title:re,url:ce,type:$,mediumId:le}:Q.entity={id:W,category:_e?.title,categoryName:ge?.title,key:`${$}-${W}`,title:re,url:ce,type:$,mediumId:le};try{try{const{result:H}=await t.sendComment(Q);ke?o?.cid&&y(a.id,o.cid,H,J,!0):i(a.id,H,J,!0)}catch(H){console.error("Send comment error:",H)}}catch(H){console.error("Send comment error:",H)}},reportComment:async n=>{if(!h){T();return}await t.reportComment(n.commentId,n.reportId,n.description)},likeComment:async({cid:n})=>{if(!h){T();return}const o=a.type==="reel"?"reel":e.contentType||e.type,C={cid:n,entity:{key:e.firebaseId,type:o,title:e.title,url:e.url,signatureIds:null,mediumId:e.mediumId},user:{name:h.fullname??"",avatar:h.avatar??""}};c(a.id,n,"like");try{await t.likeComment(C)}catch(Y){console.error("Like comment error:",Y),c(a.id,n,"unlike")}},unLikeComment:async({cid:n})=>{c(a.id,n,"unlike");try{await t.unLikeComment(n)}catch(o){console.error("UnLike comment error:",o),c(a.id,n,"like")}},deleteComment:async({cId:n,isSubComment:o=!1,mainCommentId:C=null})=>{o&&C?(await t.removeSubComment(n),d(a.id,C,n)):(await t.removeSubComment(n),await t.removeComment(n),_(a.id,n))},sortCommentsByDate:async({sortingType:n="desc"})=>{U(n)},fetchSubComments:async n=>{const o=w(a.id,n),C=o[o.length-1]?.id||null,{result:Y}=await t.getSubCommentsByWithId(n,C);y(a.id,n,Y,h?.uid||null,!0)}
1,loadMoreComments:async()=>{if(!(v||!g)){x(!0);try{const{result:n}=await t.getCommentsWithLimit(a.id,50,R.current),o=n||[];o.length&&(R.current=o[o.length-1].id),i(a.id,o,h?.uid||null),x(!1)}catch(n){console.error("Load more comments error:",n),x(!1)}}},editComment:async({cid:n,content:o})=>{try{await t.editComment(n,o),u(a.id,n,o)}catch(C){console.error("Edit comment error:",C)}}}},tt=({item:e,commentInputRef:a})=>{const{entity:t,entityApi:f,entityStore:l}=de(),{isPiriNetDisabled:y}=p.useContext(fe),{updateLike:i,updateBookmark:u}=l,{like:_,bookmark:d}=t,{user:c}=ye(),w=c??null,{openAuthModal:I}=pe(),{createTempDisableUserProcessesToast:T}=Ce(),O=m=>{if(y){T();return}if(m.type===K.COMMENT){D();return}if(!c){I();return}switch(m.type){case K.LIKE:S();break;case K.DISLIKE:N();break;case K.BOOKMARK:U();break;case K.REMOVE_BOOKMARK:A();break}},D=()=>{a?.current&&(a.current.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{a.current?.focus()},500))},S=async()=>{i(t.id,{isActive:!0,count:t.like.count+1,usersLiked:[...t.like.usersLiked,{name:c?.fullname??"",avatar:c?.avatar??""}]});const m=e.contentType?e.contentType:e.type,g=t.type==="reel"?"reel":m,v={eid:t.id,entity:{id:Number(e.id),key:`${g}-${e.id}`,mainCategoryName:e.category?.title||"",type:g,title:e.title,url:e.url,publishDate:e.publishDate,image:e.coverImage?.path||e.content?.[0].src||e.items?.[0].media||"",mediumId:e.mediumId},user:{name:c?.fullname??"",avatar:c?.avatar??""}};try{await f.likeEntity(v)}catch(x){console.error(x),i(t.id,{isActive:!1,count:t.like.count-1,usersLiked:t.like.usersLiked.filter(R=>R.name!==w?.fullname)})}},N=async()=>{i(t.id,{isActive:!1,count:t.like.count-1,usersLiked:t.like.usersLiked.filter(m=>m.name!==w?.fullname)});try{await f.unLikeEntity(t.id)}catch(m){console.error(m),i(t.id,{isActive:!0,count:t.like.count+1,usersLiked:[...t.like.usersLiked,{name:c?.fullname??"",avatar:c?.avatar??""}]})}},U=async()=>{u(t.id,{isActive:!0,count:t.bookmark.count+1});const m=e.contentType?e.contentType:e.type,g=t.type==="reel"?"reel":m,v={eid:t.id,entity:{id:Number(e.id),key:`${e.contentType}-${e.id}`,mainCategoryName:e.category?.title||"",type:g,title:e.title,url:e.url,publishDate:e.publishDate,image:e.coverImage?.path||e.content?.[0].src||e.items?.[0].media||"",duration:e.duration||"",chef:e.chef??null,mediumId:e.mediumId},user:{name:c?.fullname??"",avatar:c?.avatar??""}};try{await f.bookmarkEntity(v)}catch(x){console.error(x),u(t.id,{isActive:!1,count:t.bookmark.count-1})}},A=async()=>{u(t.id,{isActive:!1,count:t.bookmark.count-1});try{await f.unBookmarkEntity(t.id)}catch(m){console.error(m),u(t.id,{isActive:!0,count:t.bookmark.count+1})}};return{handleReaction:O,like:_,bookmark:d}};export{Ze as Y,tt as a,et as u};

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.