1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46629],{46629:function(e,t,l){l.r(t),l.d(t,{REPLY_WARN_REMAINING:function(){return u},default:function(){return x}});var r=l(65724),a=l(80710),n=l(34102),s=l(2512),i=l(28266),o=l(92483),c=l(54126),d=l(35570),m=l(76205);let u=200,p=e=>{let{src:t,size:l=40}=e;return t?(0,r.jsx)(n.default,{src:t,alt:"",width:l,height:l,className:"flex-shrink-0 rounded-full object-cover",style:{width:l,height:l}}):(0,r.jsx)("div",{"aria-hidden":"true",className:"flex-shrink-0 rounded-full bg-gray-200",style:{width:l,height:l}})};function x(e){let{target:t,open:l,onClose:n,onReplied:x,onViewPost:h,viewer:f}=e,[b,g]=(0,s.useState)(""),[y,v]=(0,s.useState)(!1),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{var e;return null===(e=j.current)||void 0===e?void 0:e.focus()},60);return()=>clearTimeout(e)},[l]),(0,s.useEffect)(()=>{let e=j.current;e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},[b]);let N=(0,o.a)({onClose:()=>{y||n()},autoFocus:!1});if(!l)return null;let w=b.trim(),_=d.qr-b.length,k=w.length>0&&_>=0&&!y,C=t.author.username?"@".concat(t.author.username):null,R=()=>{y||(g(""),n())},A=async()=>{if(k){v(!0);try{let e=await fetch("/api/v2/community/posts/".concat(t.postId,"/comments"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})});if(401===e.status){i.Am.error("Please sign in to reply");return}if(!e.ok){let t=await e.json().catch(()=>null);i.Am.error((0,c.N9)(t));return}g(""),null==x||x(),n(),i.Am.success("Your reply was sent",h?{action:{label:"View",onClick:h}}:{})}catch(e){i.Am.error("Couldn't send your reply. Check your connection.")}finally{v(!1)}}};return(0,r.jsxs)("div",{ref:N,role:"dialog","aria-modal":"true","aria-labelledby":"reply-composer-title",tabIndex:-1,className:"fixed inset-0 z-[200] flex items-stretch justify-center sm:items-start sm:p-4 sm:pt-[10vh]",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:R}),(0,r.jsxs)("div",{className:"relative flex h-[100dvh] w-full flex-col overflow-hidden bg-white shadow-xl sm:h-auto sm:max-h-[80vh] sm:max-w-lg sm:rounded-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 sm:px-5",children:[(0,r.jsx)("button",{type:"button",onClick:R,disabled:y,"aria-label":"Close",className:"-ml-1.5 flex h-11 w-11 items-center justify-center rounded-full text-[#536471] transition-colors hover:bg-gray-100 hover:text-[#0f1419] disabled:opacity-50 sm:h-9 sm:w-9",children:(0,r.jsx)("svg",{viewBox:"0 0 24 24",className:"h-5 w-5","aria-hidden":"true",children:(0,r.jsx)("path",{stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",d:"M18 6 6 18M6 6l12 12"})})}),(0,r.jsx)("h2",{id:"reply-composer-title",className:"flex-1 text-[16px] font-bold text-[#0f1419]",children:"Reply"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 pb-2 sm:px-5",children:[(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center",children:[(0,r.jsx)(p,{src:t.author.profileImage}),(0,r.jsx)("div",{"aria-hidden":"true",className:"mt-1 w-0.5 flex-1 rounded-full bg-[rgb(207,217,222)]"})]}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 pb-3",children:[(0,r.jsxs)("p",{className:"flex flex-wrap items-baseline gap-x-1 text-[15px] leading-5",children:[(0,r.jsx)("span",{className:"truncate font-bold text-[#0f1419]",children:t.author.name}),C&&(0,r.jsx)("span",{className:"truncate text-[#536471]",children:C}),t.timeLabel&&(0,r.jsxs)("span",{className:"text-[#536471]",children:["\xb7 ",t.timeLabel]})]}),t.text&&(0,r.jsx)("p",{className:"mt-0.5 line-clamp-6 whitespace-pre-wrap break-words text-[15px] leading-5 text-[#0f1419]",children:t.text}),C&&(0,r.jsxs)("p",{className:"mt-3 text-[15px] text-[#536471]",children:["Replying to ",(0,r.jsx)("span",{className:"text-brand",children:C})]})]})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-1",children:[(0,r.jsx)(p,{src:null==f?void 0:f.profileImage}),(0,r.jsx)("textarea",{ref:j,value:b,onChange:e=>g(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),A())},rows:2,placeholder:"Post your reply","aria-label":C?"Reply to ".concat(C):"Your reply",className:"max-h-[40vh] min-h-[56px] w-full resize-none border-0 p-0 pt-2 text-[20px] leading-6 text-[#0f1419] placeholder:text-[#536471] focu
1s:outline-none focus:ring-0"})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-3 border-t border-gray-100 px-4 py-2.5 pb-safe-bottom sm:px-5",children:[_<=u&&(0,r.jsx)("span",{"aria-live":"polite",className:(0,m.cn)("text-[13px] tabular-nums",_<0?"font-semibold text-[#f4212e]":"text-amber-600"),children:_}),(0,r.jsxs)("button",{type:"button",onClick:()=>void A(),disabled:!k,className:"flex min-h-[36px] items-center gap-1.5 rounded-full bg-[#0f1419] px-4 py-2 text-[15px] font-bold text-white transition-colors hover:bg-[#272c30] disabled:cursor-not-allowed disabled:opacity-50",children:[y&&(0,r.jsx)(a.Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),y?"Replyingâ¦":"Reply"]})]})]})]})}},54126:function(e,t,l){l.d(t,{HC:function(){return n},Kr:function(){return r},N9:function(){return s},gi:function(){return a}});let r="Failed to post comment",a="Failed to delete comment",n="Couldn't update your reaction",s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,l=null==e?void 0:e.error;if("string"==typeof l&&l.trim())return l.trim();let a=null==e?void 0:e.message;return"string"==typeof a&&a.trim()?a.trim():t}},35570:function(e,t,l){l.d(t,{qr:function(){return a}});var r=l(7233);let a=2e3,n=e=>r.Z_().trim().min(1,"Comment ".concat(e," is required")).max(a,"A comment can be at most ".concat(a," characters")),s={text:n("text").optional(),content:n("content").optional(),parent_comment:r.Z_().trim().uuid().optional(),parent_comment_id:r.Z_().trim().uuid().optional().nullable(),media_url:r.Z_().trim().url("Attachment must be a valid URL").refine(e=>e.startsWith("https://")||e.startsWith("http://"),"Attachment must be an http(s) URL").optional().nullable(),media_type:r.Km(["image","gif"]).optional().nullable()},i=e=>{var t,l;return!!((null===(t=e.text)||void 0===t?void 0:t.length)||(null===(l=e.content)||void 0===l?void 0:l.length))||!!e.media_url},o=e=>!!e.media_url==!!e.media_type,c="media_url and media_type must be provided together";r.Ry({...s}).refine(i,{message:"Comment text or an attachment is required"}).refine(o,{message:c}),r.Ry({...s,post_id:r.Z_().trim().min(1,"Post id is required")}).refine(i,{message:"Comment text or an attachment is required"}).refine(o,{message:c});let d={text:n("text"),parent_comment:r.Z_().trim().uuid().optional()};r.Ry({...d}),r.Ry({...d,post_id:r.Z_().trim().min(1,"Post id is required")})}}]);
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.