1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8045],{5118:(e,n,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/reports/[id]",function(){return i(89946)}])},9272:(e,n,i)=>{"use strict";i.d(n,{A:()=>N});var l=i(18153),t=i(99407),s=i(63973),r=i(2665),a=i(55791),o=i(83734),d=i(43043),c=i(64435),u=i(76032),h=i(91921),m=i(2791),p=i(50485),A=i(52276),y=i(4173),Y=i(14232),g=i(19515),b=i(97390),f=i(1664),T=i(38009),_=i(55720),D=i(6662),w=i(60852),S=i(46304),v=i(46860),k=i(82899),F=i(15099),x=i(47808),$=i(48944),C=i(8818),I=i(93523),R=i(86802);function N({feedbacks:e}){let[n,i]=(0,Y.useState)(null);return(0,l.FD)(l.FK,{children:[null==n?null:(0,l.Y)(I.A,{isOpen:null!=n,onClose:()=>i(null),...n}),(0,l.FD)(t.X,{variant:"simple",children:[(0,l.Y)(s.d,{children:(0,l.FD)(r.Tr,{children:[(0,l.Y)(a.Th,{width:"120px",children:"Report"}),(0,l.Y)(a.Th,{children:"Offending Users"}),(0,l.Y)(a.Th,{children:"Policy Violation Type"}),(0,l.Y)(a.Th,{width:"300px",children:"Description"}),(0,l.Y)(a.Th,{width:"300px",children:"Recent Violation Content"}),(0,l.Y)(a.Th,{children:"Status"}),(0,l.Y)(a.Th,{children:"Urgency"})]})}),0===e.length?(0,l.Y)(o.r,{children:"No reports to display."}):null,(0,l.Y)(d.N,{children:e.map(e=>{let n=e(f.A.id),t=e(f.A.policy_violation_type)??"other",s=e(f.A.getStatus())??w.n2.None,a=e(f.A.created_at),o=e(f.A.action_needed_at),d=e.many(f.A.getSubjectUsers()),Y=e(f.A.description)??"",I=Y.length>=140,N=D.i2[t],M=e.many(f.A.getAllRelatedPolicyViolations()),U=e.one(f.A.getMostRecentRelatedPolicyViolation())(T.A.content)??"",E=e(f.A.internal_note)??"",B=d.map(e=>e(_.Ay.id)).filter(g.Pe),V=M.map(e=>e(T.A.id)).filter(g.Pe);return(0,l.FD)(r.Tr,{children:[(0,l.Y)(c.Td,{children:(0,l.FD)(u.B,{direction:"column",spacing:1,children:[null==n?(0,l.Y)(h.E,{children:"-"}):(0,l.FD)(v.A,{href:(0,S.qmi)(n),isExternal:!0,children:["Report#",n]}),(0,l.Y)(F.A,{time:o??a})]})}),(0,l.Y)(c.Td,{children:(0,l.Y)(u.B,{direction:"column",spacing:"8px",children:0===d.length?"N/A":d.map(e=>{let n=e(_.Ay.id)??0,i={id:n,displayName:e(_.Ay.display_name)??b.JQO,trustSubmetrics:(0,$.o)(e,_.Ay.id)};return(0,l.Y)(C.A,{userReference:i,hideUserId:!0},n)})})}),(0,l.Y)(c.Td,{children:(0,l.FD)(u.B,{direction:"row",spacing:"4px",alignItems:"center",children:[(0,l.Y)(m.vw,{children:D.vr[t]}),(0,l.Y)(p.K,{"aria-label":"Edit safety report",variant:"ghost",color:"fg.subtle",icon:(0,l.Y)(k.A,{faIcon:A.MT7}),onClick:()=>i({safetyReportId:n??0,policyViolationType:t,policyViolationIds:V,subjectUserIds:B,internalNote:E})})]})}),(0,l.Y)(c.Td,{children:(0,l.Y)(x.A,{disabled:!I,content:Y,children:(0,l.FD)(h.E,{children:[Y.slice(0,140),I?"...":""]})})}),(0,l.Y)(c.Td,{children:(0,l.Y)(x.A,{disabled:U.length<140,content:U,children:(0,l.FD)(h.E,{children:[U.slice(0,140),U.length>=140?"...":""]})})}),(0,l.Y)(c.Td,{children:(0,l.Y)(R.A,{status:s})}),(0,l.Y)(c.Td,{children:(0,l.Y)(m.vw,{colorScheme:"high"===N?"red":"medium"===N?"yellow":"green",whiteSpace:"nowrap",children:(0,y.A)(N)})})]},n??0)})})]})]})}},16542:(e,n,i)=>{"use strict";function l({type:e,body:n}){return null==e||null==n?null:{type:e,body:n}}i.d(n,{A:()=>l})},18144:(e,n,i)=>{"use strict";i.d(n,{A:()=>p});var l=i(18153),t=i(2791),s=i(76032),r=i(10929),a=i(14232),o=i(48369),d=i(52038),c=i(46862),u=i(65956);let h="hide-author";function m({label:e,onSelect:n}){return(0,l.Y)(t.vw,{colorScheme:"blue",cursor:"pointer",onClick:n,children:e})}function p({userDisplayName:e,initialValues:n=null,onSubmit:i,showModal:t,onClose:A,templates:y}){let Y=null!=n,[g,b]=(0,a.useState)(0),[f,T]=(0,a.useState)(null),_=(0,a.useCallback)(e=>{var n;T((n=e.content,(0,o.A)(n)?n:{serialization_method:"plain_text",content:n})),b(e=>e+1)},[]),D=f??n?.content??void 0,w=a.useMemo(()=>[{label:"What message would you like to send this user?",sublabel:"This message will be displayed to users the next time they log onto Schoolhouse, as a blocking modal.",type:"rich-text",initialValue:D,name:"content",required:!0,size:6},{label:"What acknowledgment text would you like this user to submit?",sublabel:"If provided, users will have to type this in before acknowledging the message. If you don't want users to acknowledge, you can leave this blank.",type:"text",initialValue:null==n?"I understand":n.acknowledgmentText,name:"acknowledgment_text",required:!1,size:6},...Y?[]:[{label:"Would you like to hide your name?",type:"multi-checkbox",name:"hide_author",options:[{value:h,label:`Hide my name from this message. It will appear as coming from ${d.CP}, and the recipient will be offered support chat instead of a DM with me.`}],required:!1,size:6}]],[D,n,Y]),S=(0,a.useCallback)(()=>{T(null),b(0),A()},[A]),v=(0,a.useCallback)(async e=>{let n=`${e.acknowledgment_text}`.trim();await i({content:e.content,acknowledgmentText:0===n.length?null:n,hideAuthor:Array.isArray(e.hide_author)&&e.hide_author.some(e=>e===h)}),S()},[i,S]);return(0,l.Y)(u.A,{size:"2xl",open:t,onClose:S,title:Y?`Edit User Admin Message for ${e}`:`Send User Admin Message to ${e}`,body:()=>(0,l.FD)(s.B,{direction:"column",spacing:"24px",children:[y.length>0?(0,l.Y)(r.B,{spacing:"8px",children:y.map(e=>(0,l.Y)(r.Q,{children:(0,l.Y)(m,{label:e.label,onSelect:()=>_(e)})},e.label))}):null,(0,l.Y)(c.A,{name:`Admin${Y?"Edit":"Send"}UserMessage`,blocks:w,onSubmit:v},g)]})})}},31613:(e,n,i)=>{"use strict";i.d(n,{A:()=>w});var l=i(18153),t=i(50485),s=i(38890),r=i(44517),a=i(97460),o=i(14232),d=i(47808),c=i(76032),u=i(60851),h=i(91921),m=i(59803),p=i(87365),A=i(82285),y=i(19515),Y=i(74175),g=i(9496),b=i(48369),f=i(41130),T=i(46862),_=i(65956);function D({userId:e,userDisplayName:n,policyViolationIds:i,safetyReportId:t=null,showModal:r,onClose:a}){let d=(0,f._)(),[w,S]=(0,o.useState)(null),[v,k]=(0,o.useState)(""),[F,x]=(0,Y.A)(async()=>{S(null),S(await g.Ay.admin_generateSafetyOutreachMessage({userId:e,additionalInstructions:v}))},[e,v],"Generate safety outreach draft"),$=(0,o.useCallback)(()=>{S(null)},[]),C=(0,o.useCallback)(()=>{S(null),k(""),a()},[a]),I=null!=i&&i.length>0,R=(0,o.useCallback)(async n=>{let l=`${n.acknowledgment_text}`.trim();if(!(0,b.A)(n.content))throw Error("The drafted message content is not val
1id rich text.");I?(await g.Ay.admin_createUserAdminMessage({safetyReportId:t,recipientUserId:e,acknowledgmentText:0===l.length?null:l,hideAuthor:!0,content:n.content}),d({title:`Successfully sent message to User#${e}`,status:"success"}),await g.Vf.admin_resolvePolicyViolations({policyViolationIds:i}),d({title:`Resolved ${(0,y.td)(i.length,"policy violation")}`,status:"success"})):(await g.Vf.admin_createUserAdminMessage({safetyReportId:t,recipientUserId:e,acknowledgmentText:0===l.length?null:l,hideAuthor:!0,content:n.content}),d({title:`Successfully sent message to User#${e}`,status:"success"})),C()},[t,e,d,C]),N=o.useMemo(()=>[{label:"Review and edit the draft before sending.",sublabel:"The AI may include a one-line note to you above the message â remove it before sending. This message will be displayed to the user the next time they log onto Schoolhouse, as a blocking modal.",type:"rich-text",initialValue:w??void 0,name:"content",required:!0,size:6},{label:"What acknowledgment text would you like this user to submit?",sublabel:"If provided, users will have to type this in before acknowledging the message. If you don't want users to acknowledge, you can leave this blank.",type:"text",initialValue:"I understand",name:"acknowledgment_text",required:!1,size:6}],[w]);return(0,l.Y)(_.A,{size:"2xl",open:r,onClose:C,title:`Draft Safety Outreach to ${n}`,body:()=>x?(0,l.FD)(c.B,{direction:"column",spacing:"16px",align:"center",padding:"32px",children:[(0,l.Y)(u.y,{size:"lg"}),(0,l.Y)(h.E,{color:"fg.muted",children:"Drafting a message addressing this user's unresolved policy violations â this can take up to a minute."})]}):null!=w?(0,l.Y)(T.A,{name:"AdminSendSafetyOutreach",blocks:N,onSubmit:R,FooterComponent:({submitting:e})=>(0,l.FD)(m.s,{mt:"16px",children:[(0,l.Y)(p.h,{}),(0,l.Y)(s.$,{variant:"outline",isDisabled:e,onClick:$,mr:"8px",children:"Regenerate"}),(0,l.Y)(s.$,{isLoading:e,type:"submit",children:I?"Send Message & Resolve":"Send Message"})]})}):(0,l.FD)(c.B,{direction:"column",spacing:"16px",children:[(0,l.Y)(h.E,{children:"The AI will draft an educational safety outreach message addressing all of this user's unresolved policy violations, using their safety history for context."}),(0,l.Y)(A.T,{value:v,onChange:e=>k(e.target.value),placeholder:"Optional: additional instructions for the AI (e.g. clarifications not captured by the user's safety history)"})]}),rightFooterContent:null!=w||x?null:()=>(0,l.Y)(s.$,{onClick:F,children:"Generate Draft"})})}function w({userId:e,userDisplayName:n,policyViolationIds:i,safetyReportId:c=null,showIconButton:u=!1}){let[h,m]=o.useState(!1);return(0,l.FD)(l.FK,{children:[(0,l.Y)(D,{showModal:h,onClose:()=>m(!1),userId:e,userDisplayName:n,policyViolationIds:i,safetyReportId:c}),u?(0,l.Y)(d.A,{content:"Draft safety outreach with AI",children:(0,l.Y)(t.K,{variant:"icon-outline","aria-label":"Draft safety outreach with AI",onClick:()=>m(!0),icon:(0,l.Y)(a.g,{icon:r.p7g})})}):(0,l.Y)(s.$,{onClick:()=>m(!0),children:"Draft Safety Outreach"})]})}},37012:(e,n,i)=>{"use strict";i.d(n,{A:()=>m});var l=i(18153),t=i(50485),s=i(38890),r=i(44517),a=i(97460),o=i(14232),d=i(9496),c=i(41130),u=i(47808),h=i(18144);function m({userId:e,userDisplayName:n,safetyReportId:i=null,showIconButton:p=!1,associateSession:A,templates:y,variant:Y}){let g=(0,c._)(),[b,f]=o.useState(!1),T=(0,o.useCallback)(async({content:n,acknowledgmentText:l,hideAuthor:t})=>{await d.Vf.admin_createUserAdminMessage({safetyReportId:i,recipientUserId:e,acknowledgmentText:l,hideAuthor:t,content:n,associateSession:A}),g({title:`Successfully sent message to User#${e}`,status:"success"}),f(!1)},[e,g,i,A]);return(0,l.FD)(l.FK,{children:[(0,l.Y)(h.A,{showModal:b,onClose:()=>f(!1),onSubmit:T,userDisplayName:n,templates:y}),p?(0,l.Y)(u.A,{content:"Send admin message",children:(0,l.Y)(t.K,{variant:"icon-outline","aria-label":"Send admin message",onClick:()=>f(!0),icon:(0,l.Y)(a.g,{icon:r._6d})})}):(0,l.Y)(s.$,{variant:Y,onClick:()=>f(!0),children:"Send Admin Message"})]})}},45514:(e,n,i)=>{"use strict";i.d(n,{A:()=>u});
1var l=i(18153),t=i(39955),s=i(82736),r=i(76032),a=i(86623),o=i(44517),d=i(97460),c=i(14232);function u({title:e,body:n,collapsible:i=!1,closeCollapsible:h=!1,asSubsection:m=!1,...p}){let[A,y]=c.useState(!h);return i?(0,l.FD)(t.a,{...p,children:[(0,l.FD)(r.B,{direction:"row",cursor:"pointer",align:"center",onClick:()=>y(e=>!e),spacing:"8px",mt:m?void 0:"48px",children:[(0,l.Y)(s.D,{size:m?"md":"xl",children:e}),(0,l.Y)(d.g,{icon:A?o.Jt$:o.XkK})]}),(0,l.Y)(a.S,{in:A,children:(0,l.Y)(t.a,{mt:"16px",children:n()})})]}):(0,l.FD)(t.a,{...p,children:[(0,l.Y)(s.D,{size:m?"md":"xl",mt:m?void 0:"48px",mb:"16px",children:e}),(0,l.Y)(t.a,{children:n()})]})}},61110:(e,n,i)=>{"use strict";i.d(n,{A:()=>t});var l=i(16425);function t(e,n){return null!=n.userRoles&&n.userRoles.forEach(e=>{if(!e.startsWith("admin:"))throw Error("Cannot expose admin page to non-admins!")}),(0,l.A)(e,{authScopes:n.authScopes,userRoles:n.userRoles,onboardingUsers:"disallowed"})}},73378:(e,n,i)=>{"use strict";i.d(n,{A:()=>R});var l=i(18153),t=i(59803),s=i(99407),r=i(63973),a=i(2665),o=i(55791),d=i(83734),c=i(43043),u=i(64435),h=i(91921),m=i(76032),p=i(50485),A=i(44517),y=i(97460),Y=i(14232),g=i(98571),b=i(55720),f=i(9496),T=i(7574),_=i(46304),D=i(46860),w=i(41130),S=i(83532),v=i(15099),k=i(47808),F=i(18144),x=i(38890),$=i(74175),C=i(65956);function I({id:e,showModal:n,onClose:i}){let[t,s]=(0,$.A)(async()=>{await f.Vf.admin_deleteUserAdminMessage({id:e}),i()},[e,i],"Delete User Admin Message");return(0,l.Y)(C.A,{size:"lg",open:n,onClose:i,title:"Delete User Admin Message",rightFooterContent:()=>(0,l.FD)(m.B,{direction:"row",spacing:"12px",children:[(0,l.Y)(x.$,{variant:"outline",onClick:i,children:"Cancel"}),(0,l.Y)(x.$,{variant:"danger",isLoading:s,onClick:t,children:"Delete"})]}),body:()=>(0,l.Y)(h.E,{children:"Are you sure you'd like to delete this admin message?"})})}function R({userAdminMessages:e,templates:n}){let i=(0,w._)(),[x,$]=(0,Y.useState)(null),[C,N]=(0,Y.useState)(null),M=(0,Y.useCallback)(async({content:e,acknowledgmentText:n})=>{null!=C&&(await f.Vf.admin_editUserAdminMessage({id:C.id,acknowledgmentText:n,content:e}),i({title:"Successfully edited message",status:"success"}),N(null))},[i,C]);return(0,l.FD)(t.s,{flexDir:"column",children:[(0,l.Y)(F.A,{initialValues:C??null,showModal:null!=C,onSubmit:M,onClose:()=>N(null),userDisplayName:C?.userDisplayName??"",templates:n}),(0,l.Y)(I,{id:x??0,showModal:null!=x,onClose:()=>$(null)}),(0,l.FD)(s.X,{variant:"simple",children:[(0,l.Y)(r.d,{children:(0,l.FD)(a.Tr,{children:[(0,l.Y)(o.Th,{children:"Sent At"}),(0,l.Y)(o.Th,{children:"From"}),(0,l.Y)(o.Th,{children:"To"}),(0,l.Y)(o.Th,{width:"450px",children:"Message"}),(0,l.Y)(o.Th,{children:"Ack Text"}),(0,l.Y)(o.Th,{children:"Acked?"}),(0,l.Y)(o.Th,{children:"Actions"})]})}),0===e.length?(0,l.Y)(d.r,{children:"No user notes to display."}):null,(0,l.Y)(c.N,{children:e.map(e=>{let n=e(g.A.id)??0,i=e(g.A.created_at)??"",t=e(g.A.acknowledged_at),s=e(g.A.acknowledgment_text),r=e(g.A.content)??T.Z,o=e.one(g.A.getUser()),d=o(b.Ay.id),c=o(b.Ay.display_name),f=e.one(g.A.getRecipientUser()),w=f(b.Ay.id)??0,F=f(b.Ay.display_name)??"";return(0,l.Y)(Y.Fragment,{children:(0,l.FD)(a.Tr,{children:[(0,l.Y)(u.Td,{children:(0,l.Y)(v.A,{time:i})}),(0,l.Y)(u.Td,{children:null==d?"-":(0,l.Y)(D.A,{href:(0,_.hTK)(`user/${d}`),children:c})}),(0,l.Y)(u.Td,{children:(0,l.Y)(D.A,{href:(0,_.hTK)(`user/${w}`),children:F})}),(0,l.Y)(u.Td,{children:(0,l.Y)(S.A,{content:r})}),(0,l.Y)(u.Td,{children:s??"-"}),(0,l.Y)(u.Td,{children:null==t?"-":(0,l.Y)(h.E,{color:"success.fg",fontWeight:"bold",children:(0,l.Y)(v.A,{time:t})})}),(0,l.Y)(u.Td,{children:(0,l.Y)(k.A,{content:"This message has been acknowledged.",disabled:null==t,children:(0,l.FD)(m.B,{direction:"row",spacing:"8px",children:[(0,l.Y)(p.K,{variant:"icon","aria-label":"Edit message",icon:(0,l.Y)(y.g,{icon:A.zLW}),onClick:()=>N({id:n,content:r,acknowledgmentText:s,userDisplayName:F}),isDisabled:null!=t}),(0,l.Y)(p.K,{variant:"icon","aria-label":"Delete message",icon:(0,l.Y)(y.g,{icon:A.yLS}),onClick:()=>$(n),isDisabled:null!=t})]})})})]})},n??0)})})]})]})}},85637:(e,n,i)=>{"use strict";i.d(n,{$:()=>r});var l=i(30786),t=i(7574),s=i(16542);function r({type:e,body:n}){let i=(0,s.A)({type:e,body:n});return null==i?t.Z:"embed-v1"===i.type?"assessment"===i.body.embed?(0,l.A)(e=>e.text("[EMBEDDED ASSESSMENT]",{italic:!0})):(0,l.A)(e=>e.text("[EMBEDDED RESOURCE]",{italic:!0})):i.body}},86313:(e,n,i)=>{"use strict";i.d(n,{A:()=>$});var l=i(18153),t=i(99407),s=i(63973),r=i(2665),a=i(55791),o=i(83734),d=i(43043),c=i(64435),u=i(76032),h=i(50485),m=i(39955
1),p=i(91921),A=i(2791),y=i(44517),Y=i(97460),g=i(14232),b=i(6662),f=i(46304),T=i(46860),_=i(65956),D=i(15099),w=i(51012),S=i(7645),v=i(24292),k=i(38085),F=i(8818),x=i(6433);function $({policyViolations:e,includeUserColumn:n=!1,includeViolationTypeColumn:i=!1,includeReporterColumn:C=!1,templates:I}){let R=g.useMemo(()=>e.map(k.s),[e]),[N,M]=(0,g.useState)(null),U=null==N?null:R.find(e=>e.id===N)??null;return(0,l.FD)(l.FK,{children:[(0,l.Y)(_.A,{title:null!=N?`Policy Violation #${N}`:null,size:"4xl",open:null!=U,onClose:()=>M(null),body:()=>null!=U?(0,l.Y)(x.A,{details:U,templates:I}):null}),(0,l.FD)(t.X,{variant:"simple",children:[(0,l.Y)(s.d,{children:(0,l.FD)(r.Tr,{children:[(0,l.Y)(a.Th,{children:"Policy Violation"}),C?(0,l.Y)(a.Th,{children:"Reported By"}):null,n?(0,l.Y)(a.Th,{children:"User"}):null,i?(0,l.Y)(a.Th,{children:"Violation Type"}):null,(0,l.Y)(a.Th,{children:"Content"}),(0,l.Y)(a.Th,{children:"Strike?"}),(0,l.Y)(a.Th,{children:"Dispute"}),(0,l.Y)(a.Th,{children:"Escalation"})]})}),0===e.length?(0,l.Y)(o.r,{children:"No policy violations to display."}):null,(0,l.Y)(d.N,{children:R.map(e=>{let{id:t,createdAt:s,type:a,content:o,strikeVoidedReason:d,entityDisplayInfo:g,reporter:_,disputeStatus:k,user:x,escalatedAt:$,resolvedAt:I}=e;return(0,l.FD)(r.Tr,{children:[(0,l.Y)(c.Td,{children:(0,l.FD)(u.B,{direction:"row",align:"center",spacing:"16px",children:[(0,l.Y)(h.K,{"aria-label":"Expand policy violation details",variant:"icon-outline",size:"sm",icon:(0,l.Y)(Y.g,{icon:y.skf}),onClick:()=>M(t)}),(0,l.FD)(m.a,{children:[(0,l.Y)(p.E,{children:(0,l.FD)(T.A,{href:(0,f.Fmn)(t),children:["#",t]})}),(0,l.Y)(D.A,{time:s})]})]})}),C?(0,l.Y)(c.Td,{children:null==_?"-":(0,l.FD)(T.A,{href:(0,f.hTK)(`user/${_.id}`),children:[_.displayName," (#",_.id,")"]})}):null,n?(0,l.Y)(c.Td,{children:null!=x?(0,l.Y)(F.A,{userReference:x}):"-"}):null,i?(0,l.Y)(c.Td,{children:(0,l.Y)(A.vw,{children:b.vr[a]})}):null,(0,l.Y)(c.Td,{children:(0,l.FD)(u.B,{direction:"column",children:[null!=g?(0,l.Y)(T.A,{href:g.url,children:g.label}):null,(0,l.Y)(p.E,{noOfLines:4,whiteSpace:"pre-wrap",wordBreak:"break-word",children:o})]})}),(0,l.Y)(c.Td,{children:(0,l.Y)(v.A,{strikeVoidedReason:d})}),(0,l.Y)(c.Td,{children:null===k?"-":(0,l.Y)(w.A,{status:k})}),(0,l.Y)(c.Td,{children:null==$?"-":(0,l.Y)(S.A,{status:null!=I?"resolved":"escalated"})})]},t)})})]})]})}},89946:(e,n,i)=>{"use strict";i.r(n),i.d(n,{__N_SSP:()=>eb,default:()=>ef});var l=i(18153),t=i(76032),s=i(91921),r=i(99407),a=i(43043),o=i(2665),d=i(64435),c=i(2791),u=i(39955),h=i(59803),m=i(42720),p=i(38890),A=i(82736),y=i(87365),Y=i(38993),g=i(44517),b=i(97460),f=i(2259),T=i(45540),_=i(44824),D=i(89099),w=i(14232),S=i(41954),v=i(18447),k=i(1664),F=i(38009),x=i(10686),$=i(99485),C=i(81345),I=i(98571),R=i(55720),N=i(75737),M=i(54443),U=i(74175),E=i(78919),B=i(9496),V=i(20646),z=i(90380),O=i(6662),P=i(61110),K=i(60852),L=i(46304),W=i(77489),q=i(45514),X=i(48944),j=i(16583),H=i(8818),Z=i(86313),G=i(93523),J=i(9272),Q=i(39706),ee=i(44674),en=i(15099),ei=i(86802);function el({feedback:e}){let n=e(k.A.safety_actions)??[];return 0===n.length?(0,l.Y)(u.a,{mt:2,children:"No safety actions."}):(0,l.Y)(t.B,{direction:"column",spacing:4,children:(0,Q.A)(n,"timestamp").reverse().map(({timestamp:e,status:n,userName:i,comment:t})=>(0,l.FD)(u.a,{bg:"primary.subtle",padding:5,children:[(0,l.Y)(s.E,{color:"primary.fg",fontWeight:"bold",mb:2,children:(0,l.Y)(en.A,{time:e})}),(0,l.FD)(s.E,{mb:2,children:[(0,l.Y)("b",{children:i})," marked as ",(0,l.Y)(ei.A,{status:n})," with comment:"]}),(0,l.Y)(ee.$,{children:t})]},`${i}-${e}`))})}var et=i(8113),es=i(60266),er=i(74086),ea=i(31613),eo=i(73378),ed=i(37012),ec=i(49783),eu=i(46860),eh=i(23538),em=i(41130),ep=i(46862),eA=i(65956),ey=i(47808);let eY=({userReference:e,userRoles:n,safetyReportId:i,templates:r,showDraftSafetyOutreachButton:a=!1})=>(0,l.FD)(t.B,{direction:"row",spacing:"16px",align:"center",children:[(0,l.Y)(H.A,{userReference:e}),(0,W.B7)({roles:n})?(0,l.Y)(s.E,{as:"span",fontWeight:"bold",color:"error.fg",children:"(suspended)"}):null,(0,l.Y)(ed.A,{userId:e.id,userDisplayName:e.displayName,safetyReportId:i,showIconButton:!0,templates:r}),a?(0,l.Y)(ea.A,{userId:e.id,userDisplayName:e.displayName,safetyReportId:i,showIconButton:!0}):null]},e.id),eg=(0,P.A)(function(){let e=(0,D.useRouter)(),n=(0,M.I)(),i=(0,em._)(),[s,P]=w.useState(!1),[W,Q]=w.useState(!1),[ee,ea]=(0,w.useState)(!1),eg=Number.parseInt(`${e.query.id}`,10)??0,eb=n.one(k.A.where({id:eg})),ef=eb(k.A.user_id),eT={id:ef??0,displayName:eb.one(k.A.getUser())(R.Ay.display_name)??""},e_=eb(k.A.type)??K.xQ.Other,eD=eb(k.A.policy_violation_type)??"other",ew=eb(k.A.getStatus())??K.n2.None,eS=eb(k.A.description),ev=eb(k.A.created_at),ek=eb(k.A.action_needed_at),eF=eb(k.A.subject_user_ids)??[],ex=eb(k.A.session_id),e$=eb(k.A.link),eC=eb(k.A.internal_types),eI=eb(k.A.safety_actions)??[],eR=eb(k.A.internal_note)??"",eN=eb.one(k.A.getActionUser()),eM=eN(R.Ay.id),eU=eN(R.Ay.display_name),eE=eI[eI.length-1],eB=eE?.status===K.n2.Resolved,eV=eb.many(k.A.getSubjectUsers()).map(e=>{let n=e(R.Ay.onboarding_details)??{},i=null!=e(R.Ay.date_of_birth)?_.c9.fromISO(`${e(R.Ay.date_of_birth)}`):null,l=e.many(x.A.where({tutor:R.Ay.id,order:[[x.A.start_date,"desc"]],limit:15,paranoid:!1},(0,E.Xs)`${x.A.start_date} < NOW()`)),t=e.many($.A.where({userId:R.Ay.id,include:[{association:"Session",required:!0,where:(0,E.Xs)`${x.A.start_date} < NOW()`}],order:[[x.A.start_date,"desc"]],limit:15})),s=e.many(I.A.where({recipientUserId:R.Ay.id,order:[[I.A.created_at,"desc"]]})),[r,a]=(0,f.A)(s,e=>e(I.A.isManual()));return{id:e(R.Ay.id)??0,displayName:e(R.Ay.display_name)??"",roles:e(R.Ay.roles)??[],country:e(R.Ay.country)??"",createdAt:_.c9.fromISO(`${e(R.Ay.created_at)}`),trustSubmetrics:(0,X.o)(e,R.Ay.id),lastOnlineAt:null!=e(R.Ay.last_online_at)?_.c9.fromISO(`${e(R.Ay.last_online_at)}`):null,education:z.J5[n.education]??"Unknown",howDidYouHear:n.how_did_you_hear??"Unknown",bio:e(R.Ay.bio)??"",age:null!=i?_.c9.now().diff(i):null,isOver18:e(R.Ay.isOver18()),isTutor:e(R.Ay.hasTutorRole())??!1,messageCount:e(R.Ay.countMessages())??0,numUpcomingSessionsAsLearner:e(R.Ay.countUpcomingAttendingSessions())??0,numUpcomingSessionsAsTutor:e(R.Ay.countUpcomingSessionsHostedByUser())??0,automatedAdminMessages:a,manualAdminMessages:r,pastSessionsAsTutor:l,pastSessionsAsLearner:t}}),ez=eV[0]??null,eO=eb.many(k.A.getAllRelatedPolicyViolations()),eP=eO.map(e=>e.one(R.Ay.where({id:F.A.reporter_user_id},(0,E.Xs)`${F.A.reporter_user_id} IS NOT NULL`))),eK=(0,T.A)(eP.map(e=>({id:e(R.Ay.id)??0,name:e(R.Ay.display_name)??"",roles:e(R.Ay.roles)??[]})).filter(e=>0!==e.id),e=>e.id),eL=eb.many(v.A.where({id:k.A.content_flag_id,include:[{association:"User",required:!1}]})),eW=eL.map(e=>e(v.A.id)),eq=eO.map(e=>e.one(v.A.where({id:F.A.content_flag_id,include:[{association:"User",required:!1}]}))).filter(e=>{let n=e(v.A.id)??0;return!eW.includes(n)}),eX=eL.concat(eq),ej=eX.filter(e=>null!=e(v.A.id)).length,eH=eb.many(C.A.where({sessionId:k.A.session_id,order:[[C.A.created_at,"desc"]],includeAuditor:!0})),eZ=eb.many(I.A.where({order:[[I.A.created_at,"desc"]]},(0,E.Xs)`${I.A.safety_report_id} = ${eg}`)),eG=n.many(k.A.where({order:[[k.A.created_at,"desc"]]},(0,E.Xs)` 2 ${k.A.subject_user_ids} @> ( 3 SELECT jsonb_build_array(primary_report.subject_user_ids->0) 4 FROM ${k.A} primary_report 5 WHERE primary_report.id = ${eg} 6 ) AND ${k.A.id} != ${eg}`)),eJ=(0,w.useCallback)(async e=>{await B.Vf.admin_addSafetyReportAction({id:eg,status:e.status,comment:`${e.comment}`}),i({title:"Successfully changed safety status!",status:"success"}),P(!1)},[eg,i,P]),[eQ]=(0,U.A)(async()=>{await B.Vf.admin_createSafetyReportAiInvestigation({safetyReportId:eg})},[eg],"Automated investigation"),e0=w.useMemo(()=>(0,V.GT)(),[]),e1=n(N.A.getUserAdminMessageTemplates())??[];return(0,l.FD)(ec.A,{title:`Escalation #${eg}`,children:[(0,l.Y)(eA.A,{size:"6xl",open:ee,onClose:()=>ea(!1),title:"Additional Details",body:()=>(0,l.FD)(l.FK,{children:[(0,l.Y)(r.X,{children:(0,l.FD)(a.N,{children:[null==ek?null:(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Action Last Needed At"}),(0,l.Y)(d.Td,{children:(0,l.Y)(en.A,{time:ek})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Date Reported"}),(0,l.Y)(d.Td,{children:(0,l.Y)(en.A,{time:ev})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Reported By"}),(0,l.Y)(d.Td,{children:null==ef?"N/A":(0,l.FD)(t.B,{direction:"row",spacing:4,align:"center",children:[(0,l.Y)(H.A,{userReference:eT}),(0,l.Y)(ed.A,{userId:eT.id,userDisplayName:eT.displayName,safetyReportId:eg,showIconButton:!0,templates:e1})]})})]}),0===eK.length?null:(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Policy Violation Reporters"}),(0,l.Y)(d.Td,{children:(0,l.Y)(t.B,{spacing:"16px",children:eK.map(e=>
6{let n={id:e.id,displayName:e.name};return(0,l.Y)(eY,{userReference:n,userRoles:e.roles,safetyReportId:eg,templates:e1},e.id)})})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Type (deprecated)"}),(0,l.Y)(d.Td,{children:(0,l.Y)(c.vw,{colorScheme:"gray",children:K.Sk[e_]})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Internal Types (deprecated)"}),(0,l.Y)(d.Td,{children:(0,l.Y)(t.B,{direction:"column",spacing:"4px",children:(eC??[]).map(e=>(0,l.Y)(u.a,{children:(0,l.Y)(c.vw,{colorScheme:"blue",children:K.At[e]})},e))})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Description"}),(0,l.Y)(d.Td,{whiteSpace:"pre-line",children:eS})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Link"}),(0,l.Y)(d.Td,{children:null==e$?"N/A":(0,l.Y)(eu.A,{href:e$,isExternal:!0,children:e$})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:"Session"}),(0,l.Y)(d.Td,{children:null==ex?"N/A":(0,l.FD)(eu.A,{href:(0,L.hTK)(`session/${ex}`),children:["Session #",ex]})})]})]})}),(0,l.Y)(q.A,{title:"Session Peer Reviews",body:()=>(0,l.Y)(et.A,{audits:eH}),collapsible:!0})]})}),(0,l.Y)(eA.A,{size:"xl",open:s,onClose:()=>P(!1),title:"Change Status",body:()=>(0,l.Y)(h.s,{direction:"column",children:(0,l.Y)(ep.A,{name:"AdminSafetyReportStatus",blocks:e0,onSubmit:eJ})})}),(0,l.Y)(G.A,{isOpen:W,onClose:()=>Q(!1),safetyReportId:eg,policyViolationType:eD,policyViolationIds:eO.map(e=>e(F.A.id)??0),subjectUserIds:eF,internalNote:eR}),(0,l.FD)(m.m,{children:[(0,l.Y)(eu.A,{href:(0,L.hTK)("reports"),children:(0,l.Y)(p.$,{variant:"ghost",leftIcon:(0,l.Y)(b.g,{icon:g.Wzs}),children:"Back to Reports Page"})}),(0,l.FD)(t.B,{direction:{base:"column",md:"row"},align:{base:"flex-start",md:"center"},borderBottom:`1px solid ${(0,S.A)("border.emphasized")}`,py:"16px",mb:"32px",spacing:"16px",children:[(0,l.FD)(A.D,{size:"2xl",children:["Escalation #",eg," "]}),(0,l.Y)(c.vw,{colorScheme:"gray",children:null!=eD?O.vr[eD]:"-"}),(0,l.Y)(ei.A,{status:ew}),(0,l.Y)(y.h,{}),(0,l.Y)(p.$,{onClick:()=>Q(!0),leftIcon:(0,l.Y)(b.g,{icon:g.MT7}),children:"Edit Details"}),(0,l.Y)(p.$,{onClick:()=>P(!0),children:"Change Status"})]}),(0,l.Y)(q.A,{title:"Escalation Details",collapsible:!0,body:()=>(0,l.FD)(t.B,{direction:"column",spacing:"32px",children:[(0,l.Y)(r.X,{css:(0,Y.AH)("td:nth-child(1){width:150px;}"),children:(0,l.FD)(a.N,{children:[(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Offending Users"})}),(0,l.Y)(d.Td,{children:0===eV.length?"N/A":(0,l.Y)(t.B,{direction:"column",spacing:"16px",children:eV.map(e=>(0,l.Y)(eY,{userReference:e,userRoles:e.roles,safetyReportId:eg,templates:e1,showDraftSafetyOutreachButton:!0},e.id))})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Addressed By"})}),(0,l.Y)(d.Td,{children:null==eM?"N/A":(0,l.FD)(eu.A,{href:(0,L.hTK)(`user/${eM}`),children:[eU," (#",eM,")"]})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Resolved At"})}),(0,l.Y)(d.Td,{children:eB?(0,l.Y)(en.A,{time:eE.timestamp}):"N/A"})]}),(0,l.Y)(o.Tr,{children:(0,l.Y)(d.Td,{colSpan:2,children:(0,l.Y)(p.$,{variant:"outline",onClick:()=>ea(!0),children:"Show More Details"})})})]})}),(0,l.Y)(q.A,{title:`Policy Violations (${eO.length})`,asSubsection:!0,body:()=>(0,l.Y)(Z.A,{policyViolations:eO,includeReporterColumn:!0,templates:e1}),collapsible:!0}),(0,l.Y)(q.A,{title:"Internal Note",asSubsection:!0,body:()=>(0,l.Y)(u.a,{p:"16px",bgColor:"bg.subtle",borderRadius:"8px",children:(0,l.Y)(eh.A,{text:eR})}),collapsible:!0}),(0,l.Y)(q.A,{title:`User Admin Messages (${eZ.length})`,asSubsection:!0,body:()=>(0,l.Y)(eo.A,{userAdminMessages:eZ,templates:e1}),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Safety Actions (${eI.length})`,asSubsection:!0,body:()=>(0,l.FD)(u.a,{children:[(0,l.Y)(u.a,{mb:"24px",children:(0,l.Y)(p.$,{onClick:eQ,children:"AI Investigation"})}),(0,l.Y)(el,{feedback:eb})]}),collapsible:!0,closeCollapsible:!0})]})}),null==ez?null:(0,l.Y)(q.A,{title:`About ${ez.displayName} (${function({isOver18:e,isTutor:n}){return null==e?n?"tutor":"learner":`${e?"adult":"minor"} | ${n?"tutor":"learner"}`}(ez)})`,body:()=>(0,l.FD)(t.B,{direction:"column",spacing:"32px",children:[(0,l.Y)(r.X,{css:(0,Y.AH)("td:nth-child(1){width:150px;}"),children:(0,l.FD)(a.N,{children:[(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Profile"})}),(0,l.Y)(d.Td,{children:(0,l.Y)(eY,{userReference:ez,userRoles:ez.roles,safetyReportId:eg,templates:e1,showDraftSafetyOutreachButton:!0})})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Approximate Age"})}),(0,l.Y)(d.Td,{children:null!=ez.age?(0,l.Y)(ey.A,{content:ez.age.toFormat("y' years and 'M' months'"),placement:"top",children:ez.age.toFormat("y' years old'")}):"Unknown"})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Last Online"})}),(0,l.FD)(d.Td,{children:[null!=ez.lastOnlineAt?ez.lastOnlineAt.toRelative():"Unknown",", ",ez.numUpcomingSessionsAsLearner," upcoming sessions as learner, ",ez.numUpcomingSessionsAsTutor," upcoming sessions as tutor"]})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Onboarding Info"})}),(0,l.Y)(d.Td,{children:`${ez.education} as of ${_.c9.fromISO(`${ez.createdAt}`).toFormat("MMMM d, yyyy")}, in ${ez.country}`})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Bio"})}),(0,l.Y)(d.Td,{children:ez.bio})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Referral Source"})}),(0,l.Y)(d.Td,{children:`${ez.howDidYouHear??"Unknown"}`})]}),(0,l.FD)(o.Tr,{children:[(0,l.Y)(d.Td,{children:(0,l.Y)(A.D,{size:"md",children:"Messages sent"})}),(0,l.Y)(d.Td,{children:(0,l.Y)(eu.A,{href:(0,L.dTP)({userId:ez.id}),children:ez.messageCount})})]})]})}),(0,l.Y)(q.A,{title:`Past Escalations (${eG.length})`,asSubsection:!0,body:()=>(0,l.Y)(J.A,{feedbacks:eG}),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Automated admin messages (${ez.automatedAdminMessages.length})`,asSubsection:!0,body:()=>(0,l.Y)(eo.A,{userAdminMessages:ez.automatedAdminMessages,templates:e1}),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Manual admin messages (${ez.manualAdminMessages.length})`,asSubsection:!0,body:()=>(0,l.Y)(eo.A,{userAdminMessages:ez.manualAdminMessages,templates:e1}),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Content Flags (${ej})`,asSubsection:!0,body:()=>(0,l.Y)(j.A,{contentFlags:eX,allowChangeSeverity:!0,templates:e1}),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Past Sessions as Tutor (${ez.pastSessionsAsTutor.length})`,asSubsection:!0,body:()=>(0,l.Y)(er.A,{showZoomCols:!0,showVolunteerHourCols:!0,showAuditorCols:!0,sessions:ez.pastSessionsAsTutor,hostUserId:ez.id}
6),collapsible:!0,closeCollapsible:!0}),(0,l.Y)(q.A,{title:`Past Sessions as Learner (${ez.pastSessionsAsLearner.length})`,asSubsection:!0,body:()=>(0,l.Y)(es.A,{includeSessionInfo:!0,registrations:ez.pastSessionsAsLearner}),collapsible:!0,closeCollapsible:!0})]}),collapsible:!0})]})]})},{userRoles:["admin:safety"]});var eb=!0;let ef=eg},93523:(e,n,i)=>{"use strict";i.d(n,{A:()=>h});var l=i(18153),t=i(59803),s=i(14232),r=i(9496),a=i(6662),o=i(41130),d=i(46862),c=i(65956);let u=/^([\d]+)?(,[\d]+)*$/;function h({isOpen:e,onClose:n,safetyReportId:i,policyViolationType:m,policyViolationIds:p,subjectUserIds:A,internalNote:y}){let Y=(0,o._)(),g=s.useMemo(()=>[{label:"What type would you use to describe this violation?",type:"select",name:"policy_violation_type",options:a.Z6.map(e=>({value:e,label:a.vr[e]})),initialValue:m??null,required:!1,size:6},{label:"What policy violations should change to this type?",type:"multi-checkbox",name:"policy_violations_to_update_type",options:p.map(e=>({value:`${e}`,label:`PolicyViolation#${e}`})),required:!1,size:6,dependencies:{keys:["policy_violation_type"],callback:e=>e.policy_violation_type!==m}},{label:"Who were the offending user IDs?",sublabel:'Please separate each ID with a comma, e.g. "3, 15, 21." The first ID will be considered the primary offending user.',type:"text",initialValue:(A??[]).join(", "),name:"subject_user_ids",required:!1,size:6},{label:"Internal Note",sublabel:"This note is shared between all adminsâremember not to overwrite!",type:"textarea",name:"internal_note",initialValue:y,required:!1,size:6}],[m,p,A,y]),b=s.useCallback((e,n)=>{if(null!=n)return null;let i=`${e.subject_user_ids}`.replaceAll(" ","");return u.test(i)?null:{errors:{subject_user_ids:"The user IDs list should be formatted properly."},message:"Please format the list of user IDs properly."}},[]),f=s.useCallback(async e=>{let l=`${e.subject_user_ids}`.split(",").map(e=>e.trim()).filter(e=>e.length>0).map(e=>Number.parseInt(e,10)),t=(e.policy_violations_to_update_type??[]).map(e=>Number.parseInt(e,10));await r.Vf.admin_editSafetyReport({id:i,policyViolationType:e.policy_violation_type,policyViolationIdsToUpdateType:t,subjectUserIds:l,internalNote:`${e.internal_note}`}),Y({title:"Successfully changed safety report!",status:"success"}),n()},[i,Y,n]);return(0,l.Y)(c.A,{size:"2xl",open:e,onClose:n,title:"Edit Safety Report Details",body:()=>(0,l.Y)(t.s,{direction:"column",children:(0,l.Y)(d.A,{name:"AdminSafetyReportEdit",onValidate:b,blocks:g,onSubmit:f})})})}}},e=>{e.O(0,[8828,4674,2743,6425,3916,8113,4596,4086,1349,266,6583,636,6593,8792],()=>e(e.s=5118)),_N_E=e.O()}]); 7//# sourceMappingURL=[id]-a168a4200824f160.js.map
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.