1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91102],{91102:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var l=n(65724),r=n(61699),a=n(2512),o=n(42459);function s(e){if("string"!=typeof e)return null;let t=e.trim();return t.length>0?t:null}function i(e){var t,n,l,r,a;if(null==e)return{status:"unreadable",reason:"no_post_supplied"};if("object"!=typeof e||Array.isArray(e))return{status:"unreadable",reason:"malformed"};let o=null!==(t=s(e.post_id))&&void 0!==t?t:s(e.id);if(!o)return{status:"unreadable",reason:"missing_identifier"};let i=null!==(r=null!==(l=null!==(n=s(e.description))&&void 0!==n?n:s(e.body))&&void 0!==l?l:s(e.content))&&void 0!==r?r:s(e.text),u=i?i.replace(/<br\s*\/?>/gi,"\n").replace(/<\/li>/gi,"\n").replace(/<\/(p|div|h[1-6]|blockquote|section|article)>/gi,"\n\n").replace(/<[^>]*>/g,"").replace(/ /gi," ").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/[ \t]+/g," ").replace(/\n{3,}/g,"\n\n").trim():null,d=!!u&&u.length>4e3,c=u?u.slice(0,4e3):null,p=function(e){var t,n,l;let r=e.posted_by;if(!r||"object"!=typeof r)return{name:null,handle:null};let a=null!==(t=s(r.first_name))&&void 0!==t?t:"",o=null!==(n=s(r.last_name))&&void 0!==n?n:"",i="".concat(a," ").concat(o).trim();return{name:i.length>0?i:null,handle:null!==(l=s(r.user_name))&&void 0!==l?l:s(r.username)}}(e);return{status:"read",subject:{postId:o,title:s(e.title),body:c&&c.length>0?c:null,bodyTruncated:d,authorName:p.name,authorHandle:p.handle,createdAt:s(e.created_at),communityName:s(e.community_name),categoryName:"string"==typeof(a=e.category)?s(a):a&&"object"==typeof a?s(a.name):null,media:function(e){let t=[];s(e.live_stream_id)&&t.push({kind:"live",caption:null}),(s(e.video_playback_id)||s(e.playback_id)||s(e.video_url))&&t.push({kind:"video",caption:null}),s(e.youtube_url)&&t.push({kind:"youtube",caption:null});let n=e.image_urls;if(Array.isArray(n))for(let e of n)s(e)&&t.push({kind:"image",caption:null});else s(e.image_url)&&t.push({kind:"image",caption:null});return t}(e),commentCount:"number"==typeof e.comment_count&&Number.isFinite(e.comment_count)?e.comment_count:null,hasQuotedPost:!!e.quoted_post&&"object"==typeof e.quoted_post}}}var u=n(63019),d=n(76205),c=n(54923),p=n(24026),f=n(10317),m=n(68352),g=e=>{let{open:t,onOpenChange:n,post:s,postAuthorName:g}=e,{messages:x,isStreaming:b,error:h,send:v,stop:j,reset:y,regenerate:N}=(0,m.X)(s),[w,_]=(0,a.useState)(""),k=(0,a.useRef)(null),C=(0,a.useRef)(null),D=(0,a.useMemo)(()=>{let e=i(s);return"read"===e.status?(0,u.qz)(e.subject):u.fy},[s]),R=(0,a.useMemo)(()=>{for(let e=x.length-1;e>=0;e--)if("assistant"===x[e].role)return x[e];return null},[x]),M=null==R?void 0:R.id,A=(0,a.useMemo)(()=>R&&!b?(0,o.G)(R.content,{hasPost:!!s,interrupted:R.interrupted}):[],[R,b,s]),O=(0,a.useMemo)(()=>{let e=i(s);if("read"!==e.status)return null;let t=null!=g?g:e.subject.authorName;return t?"About ".concat(t,"'s post"):"About this post"},[s,g]);(0,a.useEffect)(()=>{let e=k.current;e&&(e.scrollTop=e.scrollHeight)},[x]);let F=(0,a.useCallback)(e=>{let t=e.trim();t&&!b&&(_(""),v(t))},[b,v]),I=x.length>0;return(0,l.jsx)(r.fC,{open:t,onOpenChange:e=>{e||j(),n(e)},children:(0,l.jsxs)(r.h_,{children:[(0,l.jsx)(r.aV,{className:"fixed inset-0 z-[1000] bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),(0,l.jsxs)(r.VY,{onOpenAutoFocus:e=>{var t;e.preventDefault(),null===(t=C.current)||void 0===t||t.focus()},className:(0,d.cn)("fixed z-[1001] flex flex-col bg-white shadow-2xl","focus:outline-none","inset-x-0 bottom-0 max-h-[86dvh] rounded-t-2xl","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom","sm:inset-y-0 sm:left-auto sm:right-0 sm:max-h-none sm:w-[420px] sm:rounded-none sm:border-l sm:border-[rgb(239,243,244)]","sm:data-[state=closed]:slide-out-to-right sm:data-[state=open]:slide-in-from-right"),children:[(0,l.jsx)("div",{"aria-hidden":"true",className:"mx-auto mt-2 h-1 w-9 shrink-0 rounded-full bg-[rgb(207,217,222)] sm:hidden"}),(0,l.jsxs)("header",{className:"flex shrink-0 items-center gap-3 px-4 py-3",children:[(0,l.jsx)("span",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-[#db1802]/10 text-[#db1802]",children:(0,l.jsx)(p.Z,{className:"h-5 w-5"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)(r.Dx,{className:"text-[15px] font-bold leading-tight text-[rgb(15,20,25)]",children:"Clarua"}),(0,l.jsx)(r.dk,{className:"truncate text-[13px] leading-tight text-[rgb(83,100,113)]",children:null!=O?O:"Ask me anything"})]}),I&&(0,l.jsx)("button",{type:"button",onClick:()=>{var e;y(),null===(e=C.current)||void 0===e||e.focus()},className:"rounded-full px-3 py-1.5 text-[13px] font-medium text-[rgb(83,100,113)] transition-colors hover:bg-[rgb(247,249,249)] focu
1s-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]",children:"New"}),(0,l.jsx)(r.x8,{"aria-label":"Close Clarua",className:"flex h-9 w-9 items-center justify-center rounded-full text-[rgb(83,100,113)] transition-colors hover:bg-[rgb(247,249,249)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]",children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",className:"h-5 w-5",fill:"currentColor",children:(0,l.jsx)("path",{d:"M10.59 12L4.54 5.96l1.42-1.42L12 10.59l6.04-6.05 1.42 1.42L13.41 12l6.05 6.04-1.42 1.42L12 13.41l-6.04 6.05-1.42-1.42L10.59 12z"})})})]}),(0,l.jsxs)("div",{ref:k,className:"min-h-0 flex-1 overflow-y-auto px-4 pb-2",children:[!I&&(0,l.jsxs)("div",{className:"pb-2 pt-1",children:[(0,l.jsx)("p",{className:"text-[15px] leading-snug text-[rgb(83,100,113)]",children:O?"I can only read this post's text â I can't watch video or see images.":"I can help you write, think something through, or explain an idea."}),(0,l.jsx)("div",{className:"mt-3 flex flex-col gap-2",children:D.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>F(e.prompt),className:"rounded-xl border border-[rgb(239,243,244)] px-3.5 py-2.5 text-left text-[14px] font-medium text-[rgb(15,20,25)] transition-colors hover:border-[#db1802]/30 hover:bg-[#db1802]/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]",children:e.label},e.id))})]}),(0,l.jsx)("div",{className:"flex flex-col gap-3 py-2","aria-live":"polite","aria-busy":b,children:x.map(e=>"user"===e.role?(0,l.jsx)("div",{className:"flex justify-end",children:(0,l.jsx)("p",{className:"max-w-[85%] whitespace-pre-wrap break-words rounded-2xl rounded-br-sm bg-[rgb(247,249,249)] px-3.5 py-2 text-[15px] leading-normal text-[rgb(15,20,25)]",children:e.content})},e.id):(0,l.jsxs)("div",{className:"flex gap-2.5",children:[(0,l.jsx)("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#db1802]/10 text-[#db1802]",children:(0,l.jsx)(p.Z,{className:"h-3.5 w-3.5"})}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"text-[15px] leading-normal text-[rgb(15,20,25)]",children:[e.content.length>0&&(0,l.jsx)(f.Z,{children:e.content}),b&&0===e.content.length&&(0,l.jsxs)("span",{className:"inline-flex gap-1 align-middle",children:[(0,l.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-[rgb(207,217,222)] [animation-delay:-0.3s]"}),(0,l.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-[rgb(207,217,222)] [animation-delay:-0.15s]"}),(0,l.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-[rgb(207,217,222)]"})]})]}),e.interrupted&&(0,l.jsx)("p",{className:"mt-1 text-[13px] text-[rgb(83,100,113)]",children:"Clarua stopped early â this answer is incomplete."}),!b&&e.id===M&&e.content.length>0&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.Z,{text:e.content,onRegenerate:N}),A.length>0&&(0,l.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:A.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>F(e.prompt),className:"rounded-full border border-[rgb(239,243,244)] px-3 py-1.5 text-[13px] font-medium text-[rgb(15,20,25)] transition-colors hover:border-[#db1802]/30 hover:bg-[#db1802]/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]",children:e.label},e.id))})]})]})]},e.id))}),h&&(0,l.jsx)("div",{role:"alert",className:"my-2 rounded-xl bg-[rgb(247,249,249)] px-3.5 py-3 text-[14px] leading-normal text-[rgb(83,100,113)]",children:h.message})]}),(0,l.jsx)("div",{className:"shrink-0 border-t border-[rgb(239,243,244)] p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),F(w)},className:"flex items-end gap-2",children:[(0,l.jsx)("label",{htmlFor:"clarua-question",className:"sr-only",children:"Ask Clarua a question"}),(0,l.jsx)("textarea",{id:"clarua-question",ref:C,rows:1,value:w,onChange:e=>{_(e.target.value),e.target.style.height="auto",e.target.style.height="".concat(Math.min(e.target.scrollHeight,120),"px")},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),F(w))},placeholder:O?"Ask about this post":"Ask Clarua",className:"max-h-[120px] min-h-[40px] flex-1 resize-none rounded-2xl bg-[rgb(247,249,249)] px-3.5 py-2.5 text-[15px] leading-normal text-[rgb(15,20,25)] placeholder:text-[rgb(83,100,113)] focus:outline-none focus:ring-2 focus:ring-[#db1802]/40"}),b?(0,l.jsx)("button",{type:"button",onClick:j,"aria-label":"Stop generating",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[rgb(15,20,25)] text-white transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802]",children:(0,l.jsx)("span",{className:"h-3 w-3 rounded-[2px] bg-white"})}):(0,l.jsx)("button",{type:"submit",disabled:0===w.trim().length,"aria-label":"Send to Clarua",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#db1802] text-white transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#db1802] focus-visible:ring-offset-2 disabled:opacity-40",children:(0,l.jsx)("svg",{viewBox:"0 0 24 24",className:"h-5 w-5",fill:"currentColor",children:(0,l.jsx)("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})})})]})})]})]})})}},61699:function(e,t,n){n.d(t,{Dx:function(){return Z},VY:function(){return z},aV:function(){return F},dk:function(){return S},fC:function(){return _},h_:function(){return A},x8:function(){return H},xz:function(){return C}});var l=n(2512),r=n(15440),a=n(22909),o=n(55443),s=n(9521),i=n(38982),u=n(400),d=n(50245),c=n(71447),p=n(18022),f=n(2276),m=n(42188),g=n(61316),x=n(9750),b=n(16427),h=n(65724),v="Dialog",[j,y]=(0,o.b)(v),[N,w]=j(v),_=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:u=!0}=e,d=l.useRef(null),c=l.useRef(null),[p,f]=(0,i.T)({prop:r,defaultProp:null!=a&&a,onChange:o,caller:v});return(0,h.jsx)(N,{scope:t,triggerRef:d,contentRef:c,contentId:(0,s.M)(),titleId:(0,s.M)(),descriptionId:(0,s.M)(),open:p,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(e=>!e),[f]),modal:u,children:n})};_.displayName=v;var k="DialogTrigger",C=l.forwardRef((e,t)=>
1{let{__scopeDialog:n,...l}=e,o=w(k,n),s=(0,a.e)(t,o.triggerRef);return(0,h.jsx)(f.WV.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":K(o.open),...l,ref:s,onClick:(0,r.Mj)(e.onClick,o.onOpenToggle)})});C.displayName=k;var D="DialogPortal",[R,M]=j(D,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=w(D,t);return(0,h.jsx)(R,{scope:t,forceMount:n,children:l.Children.map(r,e=>(0,h.jsx)(p.z,{present:n||o.open,children:(0,h.jsx)(c.h,{asChild:!0,container:a,children:e})}))})};A.displayName=D;var O="DialogOverlay",F=l.forwardRef((e,t)=>{let n=M(O,e.__scopeDialog),{forceMount:l=n.forceMount,...r}=e,a=w(O,e.__scopeDialog);return a.modal?(0,h.jsx)(p.z,{present:l||a.open,children:(0,h.jsx)(E,{...r,ref:t})}):null});F.displayName=O;var I=(0,b.Z8)("DialogOverlay.RemoveScroll"),E=l.forwardRef((e,t)=>{let{__scopeDialog:n,...l}=e,r=w(O,n),o=(0,u.WL)(),s=(0,a.e)(t,o);return(0,h.jsx)(g.Z,{as:I,allowPinchZoom:!0,shards:[r.contentRef],children:(0,h.jsx)(f.WV.div,{"data-state":K(r.open),...l,ref:s,style:{pointerEvents:"auto",...l.style}})})}),P="DialogContent",z=l.forwardRef((e,t)=>{let n=M(P,e.__scopeDialog),{forceMount:l=n.forceMount,...r}=e,a=w(P,e.__scopeDialog);return(0,h.jsx)(p.z,{present:l||a.open,children:a.modal?(0,h.jsx)(V,{...r,ref:t}):(0,h.jsx)(q,{...r,ref:t})})});z.displayName=P;var V=l.forwardRef((e,t)=>{let n=w(P,e.__scopeDialog),o=l.useRef(null),s=(0,a.e)(t,n.contentRef,o);return l.useEffect(()=>{let e=o.current;if(e)return(0,x.Ry)(e)},[]),(0,h.jsx)(L,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:(0,r.Mj)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:(0,r.Mj)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:(0,r.Mj)(e.onFocusOutside,e=>e.preventDefault())})}),q=l.forwardRef((e,t)=>{let n=w(P,e.__scopeDialog),r=l.useRef(!1),a=l.useRef(!1);return(0,h.jsx)(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var l,o;null===(l=e.onCloseAutoFocus)||void 0===l||l.call(e,t),t.defaultPrevented||(r.current||null===(o=n.triggerRef.current)||void 0===o||o.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{var l,o;null===(l=e.onInteractOutside)||void 0===l||l.call(e,t),t.defaultPrevented||(r.current=!0,"pointerdown"!==t.detail.originalEvent.type||(a.current=!0));let s=t.target;(null===(o=n.triggerRef.current)||void 0===o?void 0:o.contains(s))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})}),L=l.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:l,onOpenAutoFocus:r,onCloseAutoFocus:a,...o}=e,s=w(P,n);return(0,m.EW)(),(0,h.jsx)(h.Fragment,{children:(0,h.jsx)(d.M,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:r,onUnmountAutoFocus:a,children:(0,h.jsx)(u.XB,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":K(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),W="DialogTitle",Z=l.forwardRef((e,t)=>{let{__scopeDialog:n,...l}=e,r=w(W,n);return(0,h.jsx)(f.WV.h2,{id:r.titleId,...l,ref:t})});Z.displayName=W;var T="DialogDescription",S=l.forwardRef((e,t)=>{let{__scopeDialog:n,...l}=e,r=w(T,n);return(0,h.jsx)(f.WV.p,{id:r.descriptionId,...l,ref:t})});S.displayName=T;var B="DialogClose",H=l.forwardRef((e,t)=>{let{__scopeDialog:n,...l}=e,a=w(B,n);return(0,h.jsx)(f.WV.button,{type:"button",...l,ref:t,onClick:(0,r.Mj)(e.onClick,()=>a.onOpenChange(!1))})});function K(e){return e?"open":"closed"}H.displayName=B}}]);
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.