PageSourceSearch

https://vc.ru/assets/Comments-qpONnG02.js

js vc.ru collected 2026-09-24 07:39:48 UTC 46,609 bytes, 2 lines download raw bytes

1import{c9 as Le,cH as Nt,cI as nn,aq as de,cB as Ye,r as M,e as h,ac as re,a7 as Ie,G as le,cJ as on,ap as et,au as ve,a4 as Re,cK as je,d as he,o as $t,a as E,b as ne,p as ie,P as ye,S as Se,cL as Lt,ba as ge,X as ot,y as Ge,u as an,cM as sn,cN as Ze,bB as rn,cc as ln,aQ as Ft,f as i,z as Z,c as X,N as cn,cO as un,cP as dn,s as W,F as Ee,L as Mt,cQ as mn,aC as _e,D as at,w as we,m as Ve,t as Oe,l as bt,bX as vn,v as I,av as Ae,cR as fn,cS as yn,cT as pn,cU as hn,bb as pe,cV as me,cW as gn,bk as bn,cX as st,cn as it,bc as Cn,cY as kn,ab as Ct,cZ as Tn,af as Ne,c_ as In,c$ as wn,d0 as Rn,d1 as Sn,cd as En,Z as Xe,bf as qe,b5 as An,W as rt,aj as be,aG as Pn,j as lt,aE as Bn,d2 as xn,ax as _n,d3 as ce,d4 as Nn,d5 as $n,b2 as kt,d6 as tt,d7 as Ln,bP as De,d8 as Fn,d9 as He,a2 as ct,da as Mn,bV as Dn,db as Hn,bD as Un,dc as ze,dd as Dt,de as Ht,df as Ut,cx as Vn,dg as On,cb as zn,ad as se,cu as jn,ct as Gn,cp as Tt,$ as Xn,aT as qn,aY as nt,dh as Wn,di as Kn,dj as Yn,c4 as Zn,dk as Jn,dl as Qn,ah as eo,dm as to,dn as no,dp as oo,dq as ao,bH as Te,dr as so,ds as Vt,dt as io,aw as It,du as ro,dv as Ot,dw as lo,dx as co,dy as uo,dz as mo,bs as Me,dA as vo,dB as fo,aO as yo,dC as po,dD as ho,ao as go,dE as bo,cG as Co,b6 as Je,dF as ko,dG as To,dH as Io,dI as wo,dJ as Ro}from"./index-DcSVvNrM.js";const fe=0,$e="data-branch-id",Ue="data-branch-highlightable",So="data-branch-expandable",zt="data-branch-semi-expandable";function Eo(e){const{scrollToElement:c}=Nt(),s=M(fe),{css:o}=nn("",{id:"comments-branches"});function a(v,m){if(m!==void 0&&(v.getAttribute(m)??"")==="")return fe;const d=v.getAttribute($e)??"",r=parseInt(d);return Number.isNaN(r)?fe:r}function n(v,m,d){var r;return((r=e.tree.value)==null?void 0:r.toggleCollapse(v,m,d))??!1}function y(v){s.value=v,o.value=`@media (hover: hover) { [${Ue}][${$e}="${v}"] { --branch-stroke: 2px; --color-branch: var(--theme-color-signal-active-default); } }`}function u(){s.value=fe,o.value=""}return de(e.entryId,()=>{u()}),Ye(e.container,"mouseover",v=>{const m=a(v.target,Ue);m!==fe&&y(m)}),Ye(e.container,"mouseout",v=>{a(v.target,Ue)!==fe&&u()}),Ye(e.container,"click",v=>{var d;const m=a(v.target);if(m!==fe){const r=v.target.getAttribute(zt)!==null,p=n(m,void 0,{semi:r}),b=(d=e.tree.value)==null?void 0:d.getNodeById(m);if(b===void 0)return;p&&b.rootElement!==null&&!b.state.isOnScreen&&!r&&c(b.rootElement),u()}}),{toggleBranch:n}}const Ao=Le(Eo,()=>({toggleBranch:()=>!1})),ut=({data:e})=>h("div",{class:"comment-branches"},[e.map(c=>{const s=!c.isParentOrSelfLastInBranch,o=c.isDirectReplyInBranch&&c.isParentOrSelfLastInBranch,a=c.isDirectReplyInBranch||!c.isParentOrSelfLastInBranch;return re(h("div",le({class:["comment-branch",s&&"comment-branch--visible",a&&"comment-branch--interactable",o&&"comment-branch--short"],key:`branch:${c.branchId}`},{[$e]:c.branchId,[Ue]:!0}),[c.isDirectReplyInBranch&&h("div",{class:"comment-branch__arc"},null)]),[[Ie("gtm"),"Comment — Close Thread — Click"]])})]);function wt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!je(e)}const Po=({stubText:e,stubType:c,isReply:s,i18n:o},{emit:a})=>{let n,y;return h("div",{class:"comments-form-stub"},[h("div",{class:"comments-form-stub__text",innerHTML:on(e??"")},null),h("div",{class:"comments-form-stub__buttons"},[c===et.OnlySubscribers&&h(ve,{size:"small",onClick:()=>a("subscribe")},wt(n=o.t("shared.subscribeButton.subscribe"))?n:{default:()=>[n]}),c===et.OnlyPlus&&h(ve,{size:"small",to:{name:"Plus",params:{source:Re.RestrictedComments}}},{default:()=>[h("span",{class:"comments-form-stub__plus-button"},[o.t("entry.comments.form.plus")])]}),s&&h(ve,{size:"small",onClick:()=>a("cancel")},wt(y=o.t("entry.comments.form.cancel"))?y:{default:()=>[y]})])])},Bo={class:"contenteditable"},xo=["contenteditable","data-placeholder"],_o=he({__name:"Contenteditable",props:{modelValue:{},placeholder:{},disabled:{type:Boolean},maxlength:{}},emits:["focus","blur","input","exceeded","update:modelValue"],setup(e,{expose:c,emit:s}){const o=e,a=s,n=M();function y(m){var p;m.preventDefault();const d=(p=m.clipboardData)==null?void 0:p.getData("text/plain");if(typeof d!="string")return;const r=Lt(d.trim());r!==""&&document.execCommand("insertText",!1,r)}function u(){var r,p;const m=((r=n.value)==null?void 0:r.textContent)??"";if(o.maxlength!==void 0&&m.length>
1o.maxlength){a("exceeded");return}const d=m===""||((p=n.value)==null?void 0:p.innerHTML)===void 0?"":n.value.innerHTML;a("update:modelValue",d)}function v(m=""){n.value!==void 0&&(n.value.innerHTML=m)}return de(()=>o.modelValue,()=>{var m;o.modelValue!==((m=n.value)==null?void 0:m.innerHTML)&&v(o.modelValue)}),$t(()=>{v(o.modelValue)}),c({input:n}),(m,d)=>(E(),ne("div",Bo,[ie("span",{ref_key:"input",ref:n,class:Se(["contenteditable__input",e.disabled&&"contenteditable__input--disabled"]),contenteditable:!e.disabled,"data-placeholder":e.placeholder,onInput:u,onPaste:y,onFocus:d[0]||(d[0]=r=>a("focus",r)),onBlur:d[1]||(d[1]=r=>a("blur",r)),onDragover:d[2]||(d[2]=ye(()=>{},["prevent"]))},null,42,xo)]))}}),No={class:"comment__branches"},$o={class:"comment__content"},Lo={key:0,class:"comments-form__donation"},Fo={class:"comments-form__attachments"},Mo={class:"comments-form__footer"},Do={class:"comments-form__actions"},Ho={class:"comments-form__buttons"},Rt=5e3,Uo=250,St=he({__name:"CommentsForm",props:{modelValue:{},contextNode:{default:void 0},attachmentsLimit:{default:1},stubText:{},stubType:{},isDisabled:{type:Boolean},isLoading:{type:Boolean},isMain:{type:Boolean},isEmpty:{type:Boolean},isExtractingLinks:{type:Boolean},branchesRelations:{default:()=>[]},suggestPlugins:{},isDonationsEnabled:{type:Boolean,default:!1}},emits:["submit","cancel","update:modelValue","attachmentRemove","subscribe"],setup(e,{expose:c,emit:s}){const o=e,a=s,{t:n,p:y}=ge(),{open:u,close:v}=ot(),{alert:m,AlertType:d}=Ge(),{open:r,close:p}=an(),b=M(),k=M();sn(Ze(o).suggestPlugins,k);const A=Ze(o).modelValue,B=M(!1),D=M(!1),{nodes:U,uploaded:L,openFileDialog:oe,isFileOverDropZone:V,attach:ee,remove:N}=rn({model:Ze(A).attachments,container:b,accept:".png,.jpg,.jpeg,.heic,.webp,.gif,.mp4,.mov,.webm",limit:o.attachmentsLimit,onChange:()=>{O()},onRemove:l=>{a("attachmentRemove",l)}});ln(b,([{contentRect:l}])=>{B.value=l.width<Uo});const q=M(!1),x=I(()=>!o.isDisabled&&!o.isLoading),j=I(()=>{var l;return((l=o.contextNode)==null?void 0:l.comment.id)??0}),f=I(()=>o.contextNode!==void 0),P=I(()=>Z('{"withdrawalLink":"https://lk.cloudtips.ru"}')&&o.isDonationsEnabled&&!f.value),S=I(()=>!q.value&&(o.isEmpty??!0)&&!Z(o.modelValue.donation)&&!f.value&&((U==null?void 0:U.value.length)??0)===0);function J(){q.value=!0}function H(l){var te;const g=l.relatedTarget;g instanceof Node&&((te=b.value)==null?void 0:te.contains(g))===!0||requestAnimationFrame(()=>{var K;((K=b.value)==null?void 0:K.contains(document.activeElement))!==!0&&(q.value=!1)})}function O(l){a("update:modelValue",{html:(l==null?void 0:l.html)??o.modelValue.html,attachments:(l==null?void 0:l.attachments)??(L==null?void 0:L.value)??[],replyTo:(l==null?void 0:l.replyTo)??j.value,donation:(l==null?void 0:l.donation)===void 0?o.modelValue.donation:l.donation})}function C(){D.value=!0,m({type:d.Error,text:n("entry.comments.alerts.formTextLimitExceeded",{limit:Rt})})}async function R(l){D.value=!1,O({html:l})}function $(){o.isEmpty||a("submit")}function _(){Ae().then(()=>{requestAnimationFrame(()=>{k.value!==void 0&&fn(k.value)})})}function T(l){r(hn,{min:100,max:1e4,suggestions:[250,500,1e3],buttonLabel:n("entry.comments.attach"),location:"Comments",style:{padding:"16px"},onSubmit:g=>{O({donation:g}),p()}},{width:220,target:l.target})}function F(){u(yn,{onSelect(l){ee==null||ee([l]),v()}},{title:n("shared.gifs.attach"),fit:"cover"})}async function z(){k.value!==void 0&&pn("@",k.value,{skipInsertIfPresent:!0})}async function t(){a("subscribe"),await Ae(),_()}return c({input:k,focus:_}),(l,g)=>{const te=Ie("gtm");return E(),ne("div",{class:Se(["comment","comment--writing",e.isMain&&"comment--writing-main",!e.isMain&&"comment--writing-secondary",e.contextNode!==void 0&&"comment--writing-reply"]),style:Ft({"--comment-display-level":e.branchesRelations.length>0?1:0})},[ie("div",No,[h(i(ut),{data:e.branchesRelations},null,8,["data"])]),ie("div",$o,[e.isDisabled&&i(Z)(e.stubText)?(E(),X(i(Po),{key:0,stubText:e.stubText,stubType:e.stubType,isReply:f.value,i18n:{t:i(n),p:i(y)},onCancel:g[0]||(g[0]=K=>a("cancel")),onSubscribe:t},null,8,["stubText","stubType","isReply","i18n"])):(E(),ne("div",{key:1,ref_key:"formContainer",ref:b,class:Se(["comments-form",!x.value&&"comments-form--disabled",q.value&&"comments-form--focused",S.value&&"comments-form--collapsed",i(V)&&"comments-form--dropover"]),onClick:ye(_,["self"]),onFocusin:J,onFocusout:H},[h(_o,{ref:K=>{k.value=K==null?void 0:K.input},disabled:!x.value,"model-value":e.modelValue.html,placeholder:i(Z)(e.stubText)?e.
1stubText:i(n)("entry.comments.form.placeholder"),maxlength:Rt,onExceeded:C,"onUpdate:modelValue":R,onKeyup:cn(ye($,["ctrl"]),["enter"])},null,8,["disabled","model-value","placeholder","onKeyup"]),e.modelValue.donation?(E(),ne("div",Lo,[h(i(un),{value:e.modelValue.donation},null,8,["value"]),f.value?W("",!0):(E(),X(i(dn),{key:0,onClick:g[1]||(g[1]=()=>{O({donation:null})})}))])):W("",!0),ie("div",Fo,[(E(!0),ne(Ee,null,Mt(i(U),K=>(E(),X(i(mn),le({ref_for:!0},K,{key:`attachment:${K.key}`,onRemove:Ce=>{var Pe;return(Pe=i(N))==null?void 0:Pe(K.key)}}),null,16,["onRemove"]))),128))]),ie("div",Mo,[ie("div",Do,[re(h(i(_e),{icon:"image","icon-size":20,onMousedown:g[2]||(g[2]=ye(()=>{},["prevent"])),onClick:g[3]||(g[3]=K=>{var Ce;return(Ce=i(oe))==null?void 0:Ce()})},null,512),[[te,"New Comment — Attach Media — Click"]]),re(h(i(_e),{icon:"gif","icon-size":20,onMousedown:g[4]||(g[4]=ye(()=>{},["prevent"])),onClick:g[5]||(g[5]=K=>F())},null,512),[[te,"New Comment — Attach GIF — Click"]]),re(h(i(_e),{icon:"mention_clear","icon-size":20,onMousedown:g[6]||(g[6]=ye(()=>{},["prevent"])),onClick:g[7]||(g[7]=K=>z())},null,512),[[te,"New Comment — Mention — Click"]]),P.value?(E(),X(i(_e),{key:0,icon:"rouble","icon-size":20,onMousedown:g[8]||(g[8]=ye(()=>{},["prevent"])),onClick:T})):W("",!0),e.isExtractingLinks?(E(),X(i(at),{key:1})):W("",!0)]),ie("div",Ho,[f.value?(E(),X(i(bt),{key:0,type:"minimal",icon:B.value?"cross":void 0,"is-circle":B.value,rounded:!0,disabled:!x.value,onClick:g[9]||(g[9]=K=>a("cancel"))},{default:we(()=>[B.value?W("",!0):(E(),ne(Ee,{key:0},[Ve(Oe(i(n)("entry.comments.form.cancel")),1)],64))]),_:1},8,["icon","is-circle","disabled"])):W("",!0),re(h(i(bt),{icon:"arrow_up",disabled:e.isEmpty||!x.value||D.value,"is-circle":!0,onClick:$},null,8,["disabled"]),[[vn,!e.isEmpty],[te,"New Comment — Send Button — Click"]])])])],34))])],6)}}}),Vo={class:"comments-header"},Oo=5,zo=he({__name:"CommentsHeader",props:{count:{},sorting:{},isSubscribedToNotifications:{type:Boolean}},emits:["update:sorting","update:isSubscribedToNotifications"],setup(e,{emit:c}){const s=e,o=c,{t:a}=ge(pe.Entry),n=[{label:a("comments.sorting.best"),value:me.Hotness,action:()=>{o("update:sorting",me.Hotness)}},{label:a("comments.sorting.popular"),value:me.Popular,action:()=>{o("update:sorting",me.Popular)}},{label:a("comments.sorting.latest"),value:me.Date,action:()=>{o("update:sorting",me.Date)}}];return(y,u)=>(E(),ne("div",Vo,[e.count!==void 0?(E(),ne(Ee,{key:0},[e.count>Oo?(E(),X(i(gn),{key:0,selected:s.sorting,options:n},null,8,["selected"])):W("",!0),h(i(_e),{class:"comments-header__bell",icon:"bell","is-active":e.isSubscribedToNotifications,onClick:u[0]||(u[0]=v=>o("update:isSubscribedToNotifications",!e.isSubscribedToNotifications)),"icon-size":20},null,8,["is-active"])],64)):(E(),X(i(bn),{key:1,width:"100px"}))]))}});function jo(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!je(e)}const Go=({entryAuthorId:e,entryUrl:c,i18n:s,...o},{emit:a})=>{const n=o.replyTo>0,y=o.isPinned,u=o.isEdited,v=e!==void 0&&e===o.author.id,m=st(c,o.id),d=it(o.author),r={main:()=>[y&&h("div",{class:"comment__icon"},[h(Ne,{name:"pin",width:14,height:14},null)]),n&&re(h("div",{class:"comment__icon comment__icon--interactable",onMouseenter:()=>a("arrowHover"),onMouseleave:()=>a("arrowUnhover"),onClick:()=>a("arrowClick")},[h(Ne,{name:"reply_to",width:14,height:14},null)]),[[Ie("gtm"),"Comment — Go To — Click"]])].filter(p=>p!==!1),secondary:()=>[o.author.nickname&&re(h(Ct,{class:"comment__detail",to:d,"preview-type":kn.Subsite,previewSource:"Comment"},{default:()=>[Ve("@"),o.author.nickname]}),[[Ie("gtm"),"Comment — Nickname — Click"]]),re(h(Ct,{class:"comment__detail comment__detail--noshrink",to:m,preventDefault:!0,onClick:p=>{p.preventDefault(),a("dateClick")}},{default:()=>[h(Tn,{date:o.date},null)]}),[[Ie("gtm"),"Comment — Date — Click"]]),u&&h(Ne,{name:"pen_solid",width:12,height:12},null),o.source&&h(In,{source:o.source},null),v&&h("div",{class:"comment__detail--accent"},[s.t("entry.comments.author")])].filter(p=>p!==!1)};return h(Cn,{id:o.author.id,url:d,name:o.author.name,avatar:o.author.avatar,badgeId:o.author.badgeId,favoriteCollectible:o.author.favoriteCollectible,isAllowVideoAvatar:o.author.isPlus,location:"Comment",avatarSize:36,isOnline:o.author.isOnline},jo(r)?r:{default:()=>[r]}
1)};function Et(e,c,{isForceRealText:s=!1}={}){return s?e.hiddenContent??e.text:e.isIgnored?c.t("shared.comments.hidden"):e.text}function Xo(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!je(e)}const qo=({level:e,parentId:c,branchesRelations:s,maxVisibleRelationsLevel:o,label:a})=>h("div",{class:"comment comment--expander",style:{"--comment-display-level":Math.min(e,o)}},[h("div",{class:"comment__branches"},[h(ut,{data:s.slice(0,o).map((n,y)=>({...n,isParentOrSelfLastInBranch:y===s.length-1?!0:n.isParentOrSelfLastInBranch}))},null)]),h("div",{class:"comment__content"},[h(ve,le({class:"comment__expand",size:"small"},{[$e]:c,[zt]:!0}),Xo(a)?a:{default:()=>[a]})])]);function Wo(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!je(e)}const Ko=({i18n:e,actions:c,entryUrl:s,repliesCount:o,entryAuthorId:a,branchesRelations:n,maxVisibleRelationsLevel:y,state:u,isUnread:v,isMePlusSubscriber:m,getRepliesCount:d,...r},{emit:p})=>{let b,k=null;if(!u.isRendered)return p("refUpdate",r.id,null,k),k=null,W(`comment:${r.id}`);if(u.isRenderedAsParentBranchExpander){const L=(d==null?void 0:d(r.replyTo,r.id))??0,oe=`${e.t("shared.more")} ${e.p("shared.comments.repliesCounter",L)}`;return h(qo,{parentId:r.replyTo,level:r.level,branchesRelations:n,maxVisibleRelationsLevel:y,label:oe},null)}const A=(r.isIgnored||r.isHiddenByBan)&&!u.isRevealedHidden,D=r.isRemoved&&!r.isHiddenByBan||A,U=o>0;return h("div",{class:["comment",r.level===0&&"comment--root",u.isHighlighted&&"comment--highlighted",u.isAttention&&"comment--attention",v&&"comment--unread",D&&"comment--hidden"],"data-id":r.id,ref:L=>{p("refUpdate",r.id,L,k),k=L},style:{"--comment-display-level":Math.min(r.level,y)}},[h("div",{class:"comment__branches"},[h(ut,{data:n.slice(0,y)},null)]),h("div",{class:"comment__content","data-content":!0},[D?[h("div",{class:"comment__avatar comment__avatar--icon"},[h(Ne,{name:A?"spoiler":"ban",width:22,height:22},null)]),h("div",{class:"comment-hidden"},[h("div",{class:"comment-hidden__text"},[Et(r,e,{isForceRealText:u.isRevealedHidden})]),A&&h("div",{class:"comment-hidden__restore"},[h(ve,{size:"tiny",isPromotesPlus:!m,onClick:()=>p("revealHidden",r.id)},Wo(b=e.t("entry.comments.show"))?b:{default:()=>[b]})])])]:[h(Go,le(r,{entryUrl:s,entryAuthorId:a,i18n:e,onArrowHover:()=>p("highlightParent",r.replyTo),onArrowUnhover:()=>p("unhighlightParent"),onArrowClick:()=>p("navigateToParent",r.replyTo),onDateClick:()=>p("navigateToSelf",r.id)}),null),h(wn,le(r,{actions:c,mediaSize:[400,300],mediaZoom:!0,text:Et(r,e,{isForceRealText:u.isRevealedHidden})}),null)],h(Rn,le(r,{i18n:e,actions:c,context:{entryId:r.entry.id,entryUrl:s,entryAuthorId:a},isReplyDisabled:D,isEtcDisabled:D,onReplyClick:()=>{p("reply",r.id)}}),{default:()=>U&&[re(h(ve,le({class:"comment__expand",size:"small",disabled:u.isLoadingReplies,onClick:u.isRepliesLoaded?void 0:()=>p("expand",r.id)},u.isRepliesLoaded?{[$e]:r.id,[So]:!0}:void 0),{default:()=>[u.isRepliesLoaded&&!u.isRepliesCollapsed?e.t("shared.collapse"):e.p("shared.comments.repliesCounter",o)]}),[[Sn,"Comment — Open Thread — Click"]]),u.isLoadingReplies&&h(at,null,null)]})])])},Yo={class:"comments-updates"},Qe=99,At=140,Zo=he({__name:"CommentsUpdates",props:{unreadCount:{}},emits:["click","close"],setup(e,{emit:c}){const s=e,o=c,{p:a}=ge(pe.Entry),n=M(),y=M(!1),u=M(!1);let v;const m=I(()=>s.unreadCount>Qe?`${Qe}+ ${a("comments.newUnread",Qe,!1)}`:`${s.unreadCount} ${a("comments.newUnread",s.unreadCount,!1)}`);En(n,([{boundingClientRect:r,intersectionRect:p}])=>{u.value=r.bottom>p.bottom&&p.bottom!==0},{threshold:[0,1]});function d(){y.value=!0,v=setTimeout(()=>{y.value=!1},At)}return Xe(()=>{clearTimeout(v),v=void 0}),(r,p)=>{const b=Ie("gtm");return e.unreadCount>0?(E(),ne(Ee,{key:0},[p[2]||(p[2]=ie("div",{class:"comments-updates-shifter"},null,-1)),ie("div",Yo,[re((E(),ne("div",{class:Se(["comments-updates-button",u.value&&"comments-updates-button--stuck",y.value&&"comments-updates-button--pressed"]),style:Ft({"--press-duration":At+"ms"}),onMousedown:d}
1,[ie("div",{class:"comments-updates-button__label",onClick:p[0]||(p[0]=k=>o("click"))},Oe(m.value),1),ie("div",{class:"comments-updates-button__close",onClick:p[1]||(p[1]=k=>o("close"))},[h(i(Ne),{name:"cross",width:16,height:16})])],38)),[[b,"Comments — New — Click"]]),ie("div",{ref_key:"horizon",ref:n,class:"comments-updates__horizon"},null,512)])],64)):W("",!0)}}}),Jo=120;function Qo({processCommentsFn:e}={}){const{[pe.Comments]:c}=qe(),{copy:s}=An(),{alert:o,AlertType:a}=Ge(),{t:n,tf:y}=ge(),{open:u,close:v}=ot(),{recallAfterAuth:m}=rt(),{user:d,isPlusSubscriber:r,isMe:p}=be(),{confirm:b}=Pn(),k=lt(),A=Bn(),{proceedToGiftsList:B}=xn(),{block:D,unblock:U,isBlocked:L}=_n(),{isAppModuleEnabled:oe}=ct(),V=Mn(),ee=[{icon:"like",label:n("shared.reactions.title"),handler:async t=>{if(A!==void 0&&!r.value){await k.push({name:"Plus",params:{source:Re.ReactionVoters}});return}u(Nn,{getter:async l=>await R(t.comment.id,l),onItemSelect:v},{title:n("shared.reactions.title")})}},{icon:"rouble",label:n("donations.title"),handler:async t=>{u($n,{getter:async l=>await $(t.comment.id,l),onItemSelect:v},{title:n("donations.title")})},filter:t=>oe("donations")&&(t==null?void 0:t.comment.author.isDonationsEnabled)===!0},{value:"gift",icon:"gift",label:n("shared.etc.gift"),handler:async t=>{await(B==null?void 0:B(t.comment.author,{source:Re.GiftComment,context:{commentId:t.comment.id}}))},filter:t=>Z(B)&&Z(t)&&!p(t.comment.author.id)&&t.comment.author.isPlusGiftEnabled},{icon:"link",label:n("entry.comments.etc.copyLink"),handler:async({comment:t,entryUrl:l})=>{l!==void 0&&await q(t.id,l)},filter:t=>(t==null?void 0:t.entryUrl)!==void 0,gtm:"Comment — More — Copy Link — Click"},{icon:"bookmark",label:n("entry.comments.etc.addToBookmarks"),handler:async({comment:t})=>{await x(t)},filter:t=>{var l;return((l=t==null?void 0:t.comment)==null?void 0:l.isFavorited)===!1},gtm:"Comment — More — Add To Favorites — Click"},{icon:"bookmark_active",label:n("entry.comments.etc.removeFromBookmarks"),handler:async({comment:t})=>{await j(t)},filter:t=>{var l;return((l=t==null?void 0:t.comment)==null?void 0:l.isFavorited)===!0},gtm:"Comment — More — Remove From Favorites — Click"}
1,{icon:"flag",label:n("shared.etc.complain"),handler:async({comment:t})=>{await f(t.id)},filter:t=>{var l;return(t==null?void 0:t.comment.author.id)!==((l=d.value)==null?void 0:l.id)},gtm:"Comment — More — Complain — Click"},{icon:"spoiler",label:n("shared.etc.block"),handler:async({comment:t})=>{await D(t.author,{onCancel:()=>{z(t.author.id,!1)}}),z(t.author.id,!0)},filter:t=>{var l;return t!==void 0&&!F(t.comment)&&(t==null?void 0:t.comment.author.id)!==((l=d.value)==null?void 0:l.id)},gtm:"Comment — More — Ignore — Click"},{icon:"eye",label:n("shared.etc.unblock"),handler:async({comment:t})=>{await U(t.author,{onCancel:()=>{z(t.author.id,!0)}}),z(t.author.id,!1)},filter:t=>{var l;return t!==void 0&&F(t.comment)&&(t==null?void 0:t.comment.author.id)!==((l=d.value)==null?void 0:l.id)}},{permission:ce.Edit,icon:"pen",label:n("shared.etc.edit"),handler:async({comment:t})=>{await P(t)},gtm:"Comment — More — Edit — Click"},{permission:ce.Pin,icon:"pin",label:n("entry.comments.etc.pin"),handler:async({comment:t})=>{await S(t)},filter:t=>{var l;return((l=t==null?void 0:t.comment)==null?void 0:l.isPinned)===!1}},{permission:ce.Pin,icon:"pin",label:n("entry.comments.etc.unpin"),handler:async({comment:t})=>{await J(t)},filter:t=>{var l;return((l=t==null?void 0:t.comment)==null?void 0:l.isPinned)===!0}},{permission:ce.Remove,icon:"delete",label:n("entry.comments.etc.remove"),handler:async({comment:t,entryId:l,entryAuthorId:g})=>{var te;await b({title:n("shared.etc.remove")}),await H(t,l,g!==((te=d.value)==null?void 0:te.id)),o({type:a.Success,text:n("shared.done")})},filter:t=>(t==null?void 0:t.comment.isRemoved)===!1},{permission:ce.RemoveThread,icon:"delete_thread",label:n("entry.comments.etc.removeThread"),handler:async({comment:t,entryId:l})=>{await b({title:n("shared.etc.remove")}),await O(t,l),o({type:a.Success,text:n("shared.done")})},filter:t=>(t==null?void 0:t.comment.isRemoved)===!1},{permission:ce.Moderate,icon:"comment",label:n("shared.etc.moderateComment"),handler:async t=>{kt(tt(`/admin/comments/${t.comment.id}`),"_blank")}},{permission:ce.Moderate,icon:"subs",label:n("shared.etc.moderateUser"),handler:async t=>{kt(tt(`/admin/users/${t.comment.author.id}`),"_blank")}}],{getContextActions:N}=Ln(ee,{requestPermissions:async({comment:t})=>await c.getPermissionsForCommentId(t.id)});async function q(t,l){const g=window.location.origin+st(l,t);await s(g),o({type:a.Success,text:n("entry.comments.alerts.copied")})}async function x(t){await m(async()=>{const l=await De().getPayload();await c.toggleBookmark(t.id,!0,l),o({type:a.Success,text:n("entry.comments.alerts.addedToBookmarks")})})}async function j(t){await m(async()=>{const l=await De().getPayload();await c.toggleBookmark(t.id,!1,l),o({type:a.Success,text:n("entry.comments.alerts.removedFromBookmarks")})})}async function f(t,l=!0){return await new Promise(g=>{u(Fn,{isShowSuccessAlert:l,submitHandler:async te=>
1{await m(async()=>await c.complain(t,te)),g(),v()}},{title:n("shared.etc.complain")})})}async function P(t){await V.trigger({action:ce.Edit,contextCommentId:t.id,isNeedPlus:!r.value&&He().unix()-t.date>Jo})}async function S(t){await c.pinComment(t.id,!0),o({type:a.Success,text:n("entry.comments.alerts.pinned")})}async function J(t){await c.pinComment(t.id,!1),o({type:a.Success,text:n("entry.comments.alerts.unpinned")})}async function H(t,l,g){await c.removeComment({id:t.id,entryId:l,isRemoveReplies:!1,isRemovedByModerator:g})}async function O(t,l){await c.removeComment({id:t.id,entryId:l,isRemoveReplies:!0})}async function C(t,l){try{const g=await De().getPayload();await m(async()=>await c.toggleReaction(t,l,g))}catch(g){g instanceof Error&&o({type:a.Error,text:y(`shared.reactions.errors.${g.message}`,"shared.unknownError")})}}async function R(t,l,g){return await c.getReactorsList(t,l,g)}async function $(t,l){return await c.getDonatorsList(t,l)}function _(){c.clearReactorsList()}function T(){c.clearDonatorsList()}function F(t){return t.isIgnored||L(t.author.id)}function z(t,l){e==null||e(g=>g.comment.author.id===t,g=>{g.comment.isIgnored=l,g.state.isRevealedHidden=!1},{chunkSize:100})}return{actions:{getContextActions:N,toggleReaction:C,getReactors:R,clearReactors:_,getDonators:$,clearDonators:T},onAction:V.on}}const ea=Le(Qo,()=>({actions:{getContextActions:async()=>[],toggleReaction:async()=>{},getReactors:async()=>[],clearReactors:()=>{},getDonators:async()=>[],clearDonators:()=>{}},onAction:()=>({off:()=>{}})}));function ta(e){const{[pe.Comments]:c}=qe(),{isAnon:s}=be(),o=M(!1),a=Un(new Map),n=I(()=>Array.from(a.entries()).sort(([,k],[,A])=>k-A).map(([k])=>k)),y=I(()=>a.size);async function u(){s.value||o.value||e.count.value===void 0||(await c.saveCommentsVisitForEntryId(e.entryId.value,e.count.value),o.value=!0)}function v(){o.value=!1}function m(k,A){a.set(k,A)}function d(k){a.delete(k)}function r(){a.clear()}async function p(k,A){const B=await Hn(e.lastVisit).not.toBe(void 0);typeof(B==null?void 0:B.date)=="number"&&A>B.date&&m(k,A)}function b(k){return n.value.includes(k)}return de(e.entryId,()=>{v()}),Dn(e.isShouldUpdateVisit,u),{unreadCommentsIdsByDate:n,unreadCommentsCount:y,removeUnread:d,readAll:r,compareCommentDate:p,isUnread:b}}const na=Le(ta,()=>({unreadCommentsIdsByDate:I(()=>[]),unreadCommentsCount:I(()=>0),removeUnread:()=>{},readAll:()=>{},compareCommentDate:async()=>{},isUnread:()=>!1}));function Pt(e){return e.props!==null&&e.el!==null&&e.el instanceof HTMLElement&&e.el.nodeType===e.el.ELEMENT_NODE}const oa=he({__name:"CommentsTree",props:{entryId:{},nodes:{},count:{},lastVisit:{},isSingleThread:{type:Boolean},maxVisibleRelationsLevel:{},getRepliesCount:{type:Function},processComments:{type:Function},getRootIndex:{type:Function}},emits:["reply","edit","expand","highlight","unhighlight","navigate","read","refUpdate","visibilityChange","donationRender","revealHidden"],setup(e,{emit:c}){const s=e,o=c,a=ze(Dt,I(()=>0)),n=ze(Ht,I(()=>"")),y=Ut("container"),u=new Map,v=I(()=>!s.isSingleThread&&s.nodes!==void 0&&k.value&&s.lastVisit!==void 0),m=lt(),{t:d,p:r}=ge(),{actions:p,onAction:b}=ea({processCommentsFn:s.processComments}),{isVisible:k}=Vn(y),{observe:A,unobserve:B,visibleElements:D}=On(),{isPlusSubscriber:U}=be(),{isDisabled:L,isBannerEnabled:oe}=zn(),{unreadCommentsIdsByDate:V,unreadCommentsCount:ee,removeUnread:N,readAll:q,isUnread:x,compareCommentDate:j}=na({entryId:se(s,"entryId"),count:se(s,"count"),lastVisit:se(s,"lastVisit"),isShouldUpdateVisit:v}),f=I(()=>!L.value&&oe(Tt.InComments));function P(){const C=V.value[0];C!==void 0&&o("navigate",C)}function S(C,R,$){o("refUpdate",C,R),R!==$&&$!==null&&B($),R!==null&&A(R,{threshold:.5},({isIntersecting:_})=>{o("visibilityChange",C,_),O(C,R,_)})}function J(C){C.props!==null&&(C.props.level===0&&j(C.props.id,C.props.date),Pt(C)&&C.props.donation!==null&&o("donationRender",C.props.id,C.props.nonce))}function H(C){Pt(C)&&B(C.el)}function O(C,R,$){if(!$||!x(C))return;const _=setTimeout(()=>{D.has(R)&&x(C)&&(N(C),o("read",C)),u.delete(C)},100);u.set(C,_)}return b(({action:C,contextCommentId:R,isNeedPlus:$})=>{if(C===ce.Edit&&R!==void 0){if($){m.push({name:"Plus",params:{source:Re.EditComment}});return}o("edit",R)}}),Xe(()=>{u.forEach(C=>{clearTimeout(C)}),u.clear()}),(C,R)=>(E(),ne("div",{ref_key:"container",ref:y,class:"comments-tree"},[(E(!0),ne(Ee,null,Mt(e.nodes,$=>(E(),ne(Ee,{key:`comment:${$.comment.id}`},[f.value&&s.getRootIndex&&s.getRootIndex($.comment.id)%5===2?(E(),X(jn,{key:0,"banner-id":i(Tt).InComments,"advert-place":i(Gn).PostBefore,"is-dynamic-height":!0,class:"comments-rotator"},null,8,["banner-id","advert-place"])):W("",!0),h(i(Ko),le({ref_for:!0},$.comment,{branchesRelations:$.branchesRelations,state:$.state,isUnread:i(x)($.comment.id),actions:i(p),i18n:{t:i(d),p:i(r)},entryUrl:i(n),entryAuthorId:i(a),repliesCount:$.repliesCount,maxVisibleRelationsLevel:e.maxVisibleRelationsLevel,getRepliesCount:e.getRepliesCount,isMePlusSubscriber:i(U),onRefUpdate:S,onReply:R[0]||(R[0]=_=>o("reply",_)),onExpand:R[1]||(R[1]=_=>o("expand",_)),onHighlightParent:R[2]||(R[2]=_=>o("highlight",_)),onUnhighlightParent:R[3]||(R[3]=()=>o("unhighlight")),onNavigateToParent:R[4]||(R[4]=_=>o("navigate",_)),onNavigateToSelf:R[5]||(R[5]=_=>o("navigate",_)),onRevealHidden:R[6]||(R[6]=_=>o("revealHidden",_)),onVnodeMounted:J,onVnodeUnmounted:H}),null,16,["branchesRelations","state","isUnread","actions","i18n","entryUrl","entryAuthorId","repliesCount","maxVisibleRelationsLevel","getRepliesCount","
1isMePlusSubscriber"])],64))),128)),h(Zo,{"unread-count":i(ee),onClick:P,onClose:i(q)},null,8,["unread-count","onClose"]),Xn(C.$slots,"default")],512))}}),Bt=he({__name:"CommentsExpandBar",props:{count:{},isLoading:{type:Boolean},position:{},isSingleThread:{type:Boolean}},emits:["expand"],setup(e,{emit:c}){const s=e,o=c,{t:a,p:n}=qn(),{isPlusSubscriber:y}=be(),u=I(()=>s.count===void 0||s.count===0?a("entry.comments.showAll"):s.isSingleThread?`${a("common.showAll")} ${n("entry.comments.counter",s.count)}`:n("entry.comments.counter",s.count)),v=I(()=>!s.isSingleThread&&!y.value);return(m,d)=>(E(),ne("div",{class:Se(["comments-limit",e.position&&`comments-limit--${e.position}`])},[h(i(ve),{class:"comments-limit__expand",disabled:e.isLoading,onClick:d[0]||(d[0]=r=>o("expand"))},{default:we(()=>[Ve(Oe(u.value)+" ",1),e.isLoading?(E(),X(i(at),{key:0})):W("",!0)]),_:1},8,["disabled"]),h(i(nt),null,{default:we(()=>[v.value?(E(),X(i(ve),{key:0,class:"comments-limit__expand-always",to:{name:"Plus",params:{source:i(Re).ExpandComments}}},{default:we(()=>[Ve(Oe(i(a)("entry.comments.expandAlways")),1)]),_:1},8,["to"])):W("",!0)]),_:1})],2))}});function aa(e,c){const{t:s}=ge(),o=Lt(e.text),a=Wn({entityType:"post",entityId:e.entry.id,version:He().unix()}),n=e.author.name,y=tt(st(Z(c)?c:e.entry,e.id)),u=o===""?`${s("shared.comment")} ${n} ${s("core.meta.on")} vc.ru`:`${Kn(o,100)} — ${n} ${s("core.meta.on")} vc.ru`,v=(()=>{let r=s("entry.comments.commentInPost");return e.entry.title!==""?r+=` "${e.entry.title}"`:r+=` ${s("core.meta.on")} vc.ru`,r})(),m={description:v,ogType:"article",ogImage:a.fb,ogUrl:y,twitterImage:a.tw,author:n},d=[Yn({itemListElement:[{name:e.entry.title!==""?e.entry.title:`${s("shared.post")} ${s("core.meta.on")} vc.ru`,item:Zn(e.entry)}]}),Jn({headline:u,description:v,datePublished:He(e.date*1e3).toISOString(),dateModified:He(e.lastModificationDate*1e3).toISOString(),author:{name:e.author.name,image:Qn({uuid:e.author.avatar.data.uuid,width:128}),url:it(e.author)},image:a.fb,url:y,text:o})];return{title:u,meta:m,schema:d,canonicalUrl:y,vkImage:a.vk}}async function sa(e){const{[pe.Comments]:c,[pe.Subsite]:s}=qe(),{isAnon:o,user:a}=be(),{setPageProperties:n}=eo(),{alert:y,AlertType:u}=Ge(),{recallAfterAuth:v}=rt(),{catchError:m}=to(),{isAppModuleEnabled:d}=ct(),r={Anon:3,Authorized:3,Plus:0,Pagination:10},p=I(()=>Te(e.entryId)),b=I(()=>Te(e.commentId)),k=M(o.value?me.Popular:c.getPreferredSorting()),A=I(()=>Te(e.count)),B=I(()=>Te(e.isHandleSeo)??!1),D=I(()=>b.value!==void 0&&b.value>0),U=M(!1),L=I(()=>{var T;return(T=ee.value)==null?void 0:T.reduce((F,z)=>(z.comment.isRemoved||(F+=1),z.state.isRepliesLoaded||(F+=z.comment.replyCount??0),F),0)}),oe=I(()=>({total:A.value,processed:L.value,nonProcessed:D.value||A.value===void 0||L.value===void 0?0:A.value-L.value})),V=oo(),ee=I(()=>{var T;return(T=V.value)==null?void 0:T.nodes}),N=M(!1),q=M(!1);async function x(T){await m(async()=>{var F;try{N.value=!0;const z=await c.getCommentsByEntryId(p.value,b.value,T);z!==void 0&&(V.value=z,P()),U.value=(b.value===void 0||b.value===0)&&(T==null?void 0:T.limit)!==void 0&&T.limit>0&&(((F=V.value)==null?void 0:F.getNonProcessedCount())??0)>0}catch(z){if(b.value!==void 0&&z instanceof ao)throw z;console.error(z),q.value=!0}finally{N.value=!1}})}function j(){var T;N.value=!1,q.value=!1,U.value=!1,(T=V.value)==null||T.clear(),V.value=void 0}function f(){k.value=o.value?me.Popular:c.getPreferredSorting()}function P(){var F;if(!B.value||b.value===void 0||b.value===0)return;const T=(F=V.value)==null?void 0:F.getNodeById(b.value);T!==void 0&&n(aa(T.comment,Te(e==null?void 0:e.entryUrl)))}async function S(T,F){return s.clearMentionsCache(""),await c.addComment(T,F)}async function J(T){s.clearMentionsCache(""),await c.editComment(T)}async function H(){}async function O(){let T=r.Anon;Z(a.value)&&(T=d("plus")&&!a.value.isPlus?r.Authorized:r.Plus),await x({includeUserData:Z(a.value),limit:T,s
1orting:k.value})}async function C(T){await c.fillCommentRepliesById(p.value,T)}async function R(){await x({includeUserData:Z(a.value),limit:r.Pagination,isPagination:!0,sorting:k.value})}async function $(T){try{await v(async()=>await c.toggleNotificationsSubscription(p.value,T))}catch(F){F instanceof Error&&y({type:u.Error,text:F.message})}}async function _(T){return await c.getHiddenCommentById(T)}return de(p,async(T,F)=>{c.disableRealtimeUpdates(F),j(),f(),await O(),c.enableRealtimeUpdates(T)}),de(b,async()=>{N.value||(j(),f(),await O())}),de(k,async T=>{N.value||(c.setPreferredSorting(T),j(),await O())}),Xe(()=>{c.disableRealtimeUpdates(p.value),j()}),await no({onServer:H,onHydration:H,onAfterClientRender:async()=>{(ee.value===void 0||!o.value)&&await O(),c.enableRealtimeUpdates(p.value)}}),{tree:V,nodes:ee,counters:oe,sorting:k,isLoading:N,isError:q,isSingleThread:D,isLimitApplied:U,add:S,edit:J,loadReplies:C,loadMore:R,toggleNotificationsSubscription:$,getHiddenCommentById:_}}const xt=0;function ia(e){const{scrollToElement:c}=Nt(),s=M(null);function o(v){s.value=v,n(!0)}function a(){n(!1),s.value=null}function n(v){var d;if(s.value===null)return;const m=(d=e.tree.value)==null?void 0:d.getNodeById(s.value);m!==void 0&&(m.state.isHighlighted=v)}async function y(v,m=!0){var r;if(v===void 0)return;if(v===xt){c(e.container.value);return}const d=(r=e.tree.value)==null?void 0:r.getNodeById(v);if(d===void 0){c(e.container.value);return}d.parents.length>0&&d.parents.forEach(p=>{var b;(b=e.tree.value)==null||b.toggleCollapse(p,!1,{complete:!0})}),await Ae(),requestAnimationFrame(()=>{c(d.rootElement),typeof e.onAfterItemNavigation=="function"&&m&&e.onAfterItemNavigation(d)})}function u(v=xt){Ae().then(async()=>{await y(v,!0)})}return{highlight:o,unhighlight:a,navigate:u}}const ra=Le(ia,()=>({highlight:()=>{},unhighlight:()=>{},navigate:()=>{}}));var ue=(e=>(e.Add="add",e.Edit="edit",e))(ue||{});function _t({id:e,name:c,nickname:s}){return Ot(`<mention id="${e}" nickname="${s??""}">${c}</mention>`)}function la({limit:e=5,items:c}={}){const{[pe.Subsite]:s}=qe(),{getBadgeById:o}=so(),{isNicknamePromoted:a}=ct();return{getQuery:n=>{const y=/(?:^|\s)(@[^@\s]*)$/i,u=n.match(y);return(u==null?void 0:u[1])??null},getSuggestions:async n=>{n=n.replace(/^@/g,"").trim();const y=n===""?Te(c)??[]:[],u=await s.searchMentions(n);return ro([...y,...u],"id").sort((m,d)=>{const r=Z(m.nickname)&&a(m.nickname),p=Z(d.nickname)&&a(d.nickname);return r===p?0:r?-1:1}).slice(0,e).map(m=>{var d;return{value:m.id,label:m.name,labelImageUuid:(d=o(m.badgeId))==null?void 0:d.staticUuid,media:m.avatar,details:It(m),promoted:Z(m.nickname)&&a(m.nickname)}})},getReplacementNode:({value:n,label:y,details:u})=>{const v=document.createElement("a"),m=n,d=y,r=u==null?void 0:u.replace(/^@/,"");return v.textContent=`@${r??d}`,v.dataset.mention=_t({id:m,name:d,nickname:r}),v.dataset.suggested="true",v.href=it({id:m,nickname:r}),v.spellcheck=!1,Z(r)&&a(r)&&v.classList.add("plus-promoted-text"),v},textToHtml:n=>n.replace(io,(y,u,v,m,d,r,p)=>{const{id:b,name:k,nickname:A}
1=p,B=It({id:b,nickname:A});return`<a data-mention="${_t({id:b,name:k,nickname:A})}" data-suggested="true" spellcheck="false" href="/${b}">${B}</a>`}),htmlToText:n=>n.replace(/<a.*?(?:data-mention="(.+?)".*?)>.*?<\/a>/g,(y,u)=>Vt(u))}}function ca(e){const{user:c}=be(),s=M(),o=M(!1),a=I(()=>y.value===ue.Edit),n=I(()=>{var f;return typeof((f=s.value)==null?void 0:f.contentElement)=="object"}),y=M(ue.Add),u=M({html:"",attachments:[],replyTo:0,donation:null}),v=co(s,()=>{if(s.value===void 0)return;const f=new Set;return[s.value.comment.id,...s.value.parents].reduce((S,J)=>{var O,C,R;const H=(C=(O=e.tree.value)==null?void 0:O.getNodeById(J))==null?void 0:C.comment.author;return H!==void 0&&!f.has(H.id)&&H.id!==((R=c.value)==null?void 0:R.id)&&(S.push({id:H.id,name:H.name,avatar:H.avatar,nickname:H.nickname,badgeId:H.badgeId}),f.add(H.id)),S},[])}),d=[la({items:v})],r=I(()=>{const f=u.value.html.trim().length===0,P=u.value.attachments.length===0;return f&&P}),p=I(()=>{var J;if(s.value===void 0)return[];if(s.value.comment.level>=e.maxVisibleRelationsLevel.value)return[];const f=s.value!==void 0?s.value.replies.total.length>0:!1,P=((J=s.value)==null?void 0:J.state.isRepliesCollapsed)??!1,S=f&&!P;return[{branchId:s.value.comment.id,isDirectReplyInBranch:!0,isParentOrSelfLastInBranch:!S}]}),b=I(()=>({attachmentsLimit:e.attachmentsLimit,isEmpty:r.value,isLoading:o.value,isDisabled:e.isEnabled.value!==!0,isExtractingLinks:(j==null?void 0:j.value)??!1,stubText:e.stubText.value,stubType:e.stubType.value,branchesRelations:p.value,suggestPlugins:d})),k=new Set;async function A(f){return await new Promise(P=>{requestAnimationFrame(()=>{s.value=f,P()})})}function B(){u.value.html="",u.value.attachments=[],u.value.replyTo=0,u.value.donation=null}async function D(f){y.value=ue.Add,u.value.replyTo=f.comment.id,B(),await A(f),await Ae()}async function U(f){y.value=ue.Edit,u.value={html:oe(f.comment.text),attachments:[...f.comment.media],replyTo:f.comment.id,donation:f.comment.donation},await A(f)}async function L(){y.value=ue.Add,k.clear(),B(),await A(void 0)}function oe(f){return f=Ot(f).replace(/\n/g,"<br>"),Object.values(d).forEach(P=>{f=P.textToHtml(f)}),f.replace(/\r|\n|\r\n/g,"")}function V(f){return Object.values(d).forEach(S=>{f=S.htmlToText(f)}),f=f.replace(/<br>/g,`
2`),mo(Vt(f),{allow:["mention"]})}function ee(f){o.value=f}async function N(f){const P=V(u.value.html),S=JSON.stringify(u.value.attachments);if(f===ue.Edit)return{comment_id:u.value.replyTo,text:P,attachments:S};const{location:J,previousPage:H,fromFeed:O,hitId:C}=await De().getPayload();return{id:e.entryId.value,text:P,attachments:S,reply_to:u.value.replyTo,nonce:vo(),location:J,previousPage:H,fromFeed:O,hitId:C}}function q(f){var S;if(f.type===Me.Audio||f.type===Me.OsnovaEmbed||f.type===Me.Embed||f.type===Me.File)return;const P=(S=x==null?void 0:x.value)==null?void 0:S.get(f);P!==void 0&&k.add(P)}const{extracted:x,isExtracting:j}=uo(()=>V(u.value.html),{limit:1,exclude:k,disabled:()=>u.value.attachments.filter(f=>{var P;return((P=x.value)==null?void 0:P.has(f))!==!0}).length>0});return x!==void 0&&de(x,f=>{fo(u.value.attachments,f!==void 0?Array.from(f.keys()):[])}),de(e.entryId,()=>{L()}),{model:u,contextNode:s,sharedProps:b,isEditMode:a,isContextNodeElementPresent:n,setFormForReply:D,setFormForEdit:U,setLoadingState:ee,resetForm:L,getFormPayload:N,excludeAttachmentLinkFromParsing:q}}const ua=lo(ca,()=>({model:M({html:"",attachments:[],replyTo:0,authorId:void 0,donation:null}),attachmentsNodes:I(()=>[]),contextNode:M(),sharedProps:I(()=>({isEmpty:!0,isLoading:!1,isDisabled:!1,isExtractingLinks:!1,stubText:void 0,stubType:void 0,branchesRelations:[],suggestPlugins:[],attachmentsLimit:0})),isEditMode:I(()=>!1),isContextNodeElementPresent:I(()=>!1),setFormForReply:async()=>{},setFormForEdit:async()=>{},setLoadingState:()=>{},resetForm:async()=>{},getFormPayload:async()=>({comment_id:0,id:0,text:"",attachments:"",reply_to:0,creator_id:void 0,nonce:0}),excludeAttachmentLinkFromParsing:()=>{}}));function da(e=1200){const c=new Map;function s(a){const n=c.get(a.comment.id);n!==void 0&&(clearTimeout(n),c.delete(a.comment.id)),a.state.isAttention=!1}function o(a){s(a),requestAnimationFrame(()=>{a.state.isAttention=!0;const n=setTimeout(()=>{s(a)},e);c.set(a.comment.id,n)})}return{makeAttention:o}}
2const ma=Le(da,()=>({makeAttention:()=>{}}));function va(e){const{makeAttention:c}=ma();function s(n,y){if(e.value===void 0||!e.value.hasNode(n))return;const u=e.value.getNodeById(n);u.rootElement=y,u.contentElement=(y==null?void 0:y.querySelector("[data-content]"))??null}function o(n,y){e.value===void 0||!e.value.hasNode(n)||(e.value.getNodeById(n).state.isOnScreen=y)}function a(n){e.value===void 0||!e.value.hasNode(n)||c(e.value.getNodeById(n))}return{setElementsById:s,setVisibilityById:o,makeAttentionById:a}}const ya=he({__name:"Comments",props:{entryId:{},commentId:{},isFormEnabled:{type:Boolean},formStubText:{},formStubType:{},singleFormCommentsLimit:{default:3},lastVisit:{},count:{},navigationState:{},isSubscribedToNotifications:{type:Boolean},isDonationsEnabled:{type:Boolean}},emits:["subscribeToAuthor"],async setup(e,{emit:c}){var gt;let s,o;const a=e,n=lt(),{recallAfterAuth:y}=rt(),{open:u,close:v,onModalClose:m}=ot(),{isWiderThanContent:d}=yo(),{isPlusSubscriber:r,isMe:p}=be(),{alert:b,AlertType:k}=Ge(),A=ze(Ht,I(()=>"")),B=ze(Dt,I(()=>0)),D=Ut("container"),U=M(null),L=I(()=>J.value&&x.value.nonProcessed!==void 0&&x.value.nonProcessed>0),oe=I(()=>S.value?l.value!==void 0:!0),V=I(()=>d.value?8:5),ee=I(()=>!f.value&&!S.value&&!L.value&&!Ce.value&&a.count!==void 0&&a.count>a.singleFormCommentsLimit),{tree:N,nodes:q,counters:x,sorting:j,isLoading:f,isError:P,isSingleThread:S,isLimitApplied:J,add:H,edit:O,loadReplies:C,loadMore:R,toggleNotificationsSubscription:$,getHiddenCommentById:_}=([s,o]=po(()=>sa({entryId:se(a,"entryId"),entryUrl:A,commentId:se(a,"commentId"),count:se(a,"count"),isHandleSeo:()=>a.commentId!==void 0})),s=await s,o(),s),{setElementsById:T,setVisibilityById:F,makeAttentionById:z}=va(N),{model:t,contextNode:l,sharedProps:g,setLoadingState:te,isEditMode:K,isContextNodeElementPresent:Ce,setFormForReply:Pe,setFormForEdit:jt,resetForm:We,getFormPayload:dt,excludeAttachmentLinkFromParsing:mt}=ua({entryId:se(a,"entryId"),isEnabled:se(a,"isFormEnabled"),stubText:se(a,"formStubText"),stubType:se(a,"formStubType"),attachmentsLimit:1,maxVisibleRelationsLevel:V,tree:N}),{highlight:Gt,unhighlight:Xt,navigate:Fe}=ra({tree:N,container:D,onAfterItemNavigation:Y=>{var w;z(Y.comment.id),((w=a.navigationState)==null?void 0:w.isRequestReplyForm)===!0&&Y.comment.id===a.commentId&&requestAnimationFrame(()=>{Pe(Y).then(()=>{var G;(G=U.value)==null||G.focus()})})}}),{toggleBranch:qt}=Ao({tree:N,entryId:se(a,"entryId"),container:D}),{t:vt,tf:Wt}=ge(),ft=c,Kt=I(()=>q.value===void 0||L.value?"short":"full");ho({commentsRoot:D,entryId:se(a,"entryId"),displayType:Kt,sorting:j});async function yt(Y="top"){await y(async()=>{te(!0);try{await Yt(Y)}finally{te(!1)}})}const pt=(gt=go)==null?void 0:gt();let Be;async function Yt(Y){if(K.value){await O(await dt(ue.Edit)),await We();return}if(a.formStubType===et.OnlyDonators&&!Z(t.value.donation)&&!p(B.value)){u(To,{text:vt("entry.comments.onlyDonatorsRestrict"),cancelText:vt("common.gotIt"),cancelHandler:()=>{v()}});return}const w=t.value.replyTo,G=l.value,ae=await dt(ue.Add);let ke;if(Z(pt)&&t.value.donation!==null)await pt.donate({type:Io.Comment,data:ae,donation:t.value.donation}),Be=ae.nonce;else try{ke=await H(ae,{position:Y,collapserRule:()=>!1})}catch(Q){throw Q instanceof Error&&Q.message in wo.comments.errors&&b({type:k.Error,text:Wt(`entry.comments.errors.${Q.message}`,"shared.unknownError")}),Q}await We(),(G==null?void 0:G.state.isRepliesLoaded)===!1&&await C(G.comment.id),w!==0&&qt(w,!1),ke!==void 0&&(await Ae(),Fe(ke))}const{off:Zt}=m(()=>{Be=void 0});function Jt(Y,w){Z(Be)&&Be===w&&(Fe(Y),Be=void 0)}async function ht(){if(S.value){await n.push(Ro(A.value));return}await R()}function Ke(){a.navigationState!==void 0&&Fe(a.commentId)}function Qt(Y){var G;const w=(G=N.value)==null?void 0:G.getNodeById(Y);w!==void 0&&Pe(w).then(()=>{var ae;(ae=U.value)==null||ae.focus()})}function en(Y){var G;const w=(G=N.value)==null?void 0:G.getNodeById(Y);w!==void 0&&jt(w).then(()=>{var ae;(ae=U.value)==null||ae.focus()})}async function tn(Y){var G;if(!r.value){n.push({name:"Plus",params:{source:Re.ShowIgnoredComments}});return}const w=(G=N.value)==null?void 0:G.getNodeById(Y);w!==void 0&&(w.comment.isHiddenByBan&&w.comment.hiddenContent===null&&await _(Y),w.state.isRevealedHidden=!0)}return de(()=>a.navigationState,()=>{Ke()}),$t(()=>{Ke()}),Xe(()=>{Zt()}),(Y,w)=>{var G,ae,ke;return i(P)?W("",!0):re((E(),ne("div",{key:0,ref_key:"container",ref:D,class:Se(["comments",L.value&&"comments--limited",i(S)&&"comments--single-thread"])},[i(S)?(E(),X(Bt,{key:0,count:i(S)?e.count:i(x).nonProcessed,"is-loading":i(f),"is-single-thread":i(S),position:"top",onExpand:ht},null,8,["count","is-loading","is-single-thread"])):W("",!0),h(i(nt),null,{default:we(()=>{var Q;return[(E(),X(Co,{to:(Q=i(l))==null?void 0:Q.contentElement,disabled:!i(Ce)},[oe.value?(E(),X(St,le({key:0,ref_key:"mainForm",ref:U,modelValue:i(t),"onUpdate:modelValue":w[0]||(w[0]=xe=>Je(t)?t.value=xe:null)},i(g),{"is-main":!0,"context-node":i(l),"is-donations-enabled":e.isDonationsEnabled,onCancel:i(We),onSubmit:w[1]||(w[1]=xe=>yt("top")),onAttachmentRemove:w[2]||(w[2]=xe=>i(mt)(xe)),onSubscribe:w[3]||(w[3]=xe=>ft("subscribeToAuthor"))}),null,16,["modelValue","context-node","is-donations-enabled","onCancel"])):W("",!0)],8,["to","disabled"]))]}),_:1}),i(S)?W("",!0):(E(),X(zo,{key:1,sorting:i(j),"onUpdate:sorting":w[4]||(w[4]=Q=>Je(j)?j.value=Q:null),count:i(x).total,"is-subscribed-to-notifications":e.isSubscribedToNotifications,"onUpdate:isSubscribedToNotifications":i($)},null,8,["sorting","count","is-subscribed-to-notifications","onUpdate:isSubscribedToNotifications"])),i(q)!==void 0?(E(),X(oa,{key:2,"entry-id":e.entryId,nodes:i(q),count:i(x).total,"last-visit":e.lastVisit,"is-single-thread":i(S),"max-visible-relations-level":V.value,"get-replies-count":(G=i(N))==null?void 0:G.getRepliesCount,"process-comments":(ae=i(N))==null?void 0:ae.processComments,"get-root-index":(ke=i(N))==null?void 0:ke.getRootIndex,onVnodeMounted:w[5]||(w[5]=Q=>Ke()),onReply:Qt,onEdit:en,onExpand:i(C),onHighlight:i(Gt),onUnhighlight:i(Xt),onNavigate:i(Fe),onRead:i(z),onRefUpdate:i(T),onVisibilityChange:i(F),onDonationRender:Jt,onRevealHidden:tn},null,8,["entry-id","nodes","count","last-visit","is-single-thread","max-visible-relations-level","get-replies-count","process-comments","get-root-index","onExpand","onHighlight","onUnhighlight","onNavigate","onRead","onRefUpdate","onVisibilityChange"])):(E(),X(i(ko),{key:3,"with-background":!1,size:i(S)?2:5},null,8,["size"])),i(S)||L.value?(E(),X(Bt,{key:4,count:i(S)?e.count:i(x).nonProcessed,"is-loading":i(f),"is-single-thread":i(S),position:"bottom",onExpand:ht},null,8,["count","is-loading","is-single-thread"])):W("",!0),h(i(nt),null,{default:we(()=>[ee.value?(E(),X(St,le({key:0,modelValue:i(t),"onUpdate:modelValue":w[6]||(w[6]=Q=>Je(t)?t.value=Q:null)},i(g),{"is-donations-enabled":e.isDonationsEnabled,onSubmit:w[7]||(w[7]=Q=>yt("bottom")),onAttachmentRemove:w[8]||(w[8]=Q=>i(mt)(Q)),onSubscribe:w[9]||(w[9]=Q=>ft("subscribeToAuthor"))}),null,16,["modelValue","is-donations-enabled"])):W("",!0)]),_:1})],2)),[[i(bo),i(n)]])}}});
2export{ya 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.