PageSourceSearch

https://kanu.us/_next/static/chunks/pages/network-admin/classrooms/[classroomId]/grades-9918600df69a256d.js

js kanu.us collected 2026-10-07 03:01:44 UTC 44,626 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1197],{4068:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>u});var s=a(10940),r=a(38740),n=a.n(r),l=a(96669),i=a(39968),o=a(35687),c=a(94175),d=a(47392);let u=function(){let{classroomId:e,classroomTitle:t,isLoading:a}=(0,o.L)(),{gradebook:r,assignment:u,mutate:h,isLoading:m,isValidating:p}=(0,d.n)(e),f=`/network-admin/classrooms/${e}`;return(0,s.jsx)(c.x.Provider,{value:{classroomId:e,routeIdParams:["classroomId"],gradesHref:`${f}/grades`,assessHref:e=>`${f}/grades/assess/${e}`,gradebook:r,assignment:u,isLoading:m||a,isValidating:p,reloadGrades:h},children:(0,s.jsxs)(i.e,{breadcrumbSuffix:[{label:"Classrooms",href:"/network-admin/classrooms"},{label:t,href:f},{label:"Grades"}],children:[(0,s.jsx)(n(),{children:(0,s.jsxs)("title",{children:["Grades \xb7 ",t," | KANU"]})}),(0,s.jsxs)("h1",{className:"sr-only",children:["Grades \xb7 ",t]}),(0,s.jsx)(l.c,{})]})})}},4901:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/network-admin/classrooms/[classroomId]/grades",function(){return a(4068)}])},13548:()=>{},23694:(e,t,a)=>{"use strict";a.d(t,{S:()=>o});var s=a(84108),r=a(62544),n=a(6608),l=a(39772),i=a(54382);function o(e){let{tabs:t,isLoading:a,search:o,searchResults:c,refresh:d,applyLastMessage:u}=(0,s.RL)(),{subscribeLastMessage:h,subscribeUsersTyping:m}=(0,l._Q)(),p=(0,s.TA)();(0,r.useEffect)(()=>{let e=()=>void d();return window.addEventListener("focus",e),()=>window.removeEventListener("focus",e)},[d]);let{mutate:f,cache:g}=(0,n.iX)();(0,r.useEffect)(()=>{let t,a=h(a=>{let r=u(a,{openChatId:e,selfId:p}),n=a.chat?`chat/${a.chat}`:null;(n&&g.get(n)?.data&&f(n,e=>e&&{...e,messages:(0,s.xz)(e.messages??[],a)},{revalidate:!1}),clearTimeout(t),r)?t=setTimeout(()=>void d(),1500):d()});return()=>{clearTimeout(t),a()}},[u,g,e,f,d,p,h]);let[x,v]=(0,r.useState)({}),b=(0,r.useRef)({});(0,r.useEffect)(()=>{let e=b.current,t=t=>{clearTimeout(e[t]),delete e[t],v(e=>{if(!(t in e))return e;let a={...e};return delete a[t],a})},a=m(a=>{if(!a?.chat)return;let s=a.chat;a.typing?(v(e=>({...e,[s]:`${a.user||"Someone"} is typing`})),clearTimeout(e[s]),e[s]=setTimeout(()=>t(s),6e3)):t(s)});return()=>{for(let t of(a(),Object.keys(e)))clearTimeout(e[t]);b.current={}}},[m]);let y=(e,t)=>e.map(e=>({row:x[e.id]?{...e,typingLabel:x[e.id]}:e,tab:t})),j=(e,t)=>(0,s.DD)(e.row,t.row);return{sections:[{key:"marketplace",label:"Marketplace",icon:i.p.marketplace,rows:[...y(t.consumer,"consumer"),...y(t.provider,"provider")].sort(j)},{key:"team",label:"My Team",icon:i.p.team,rows:y(t.team,"team").sort(j)},{key:"classroom",label:"Classroom",icon:i.p.classroom,rows:y(t.classroom,"classroom").sort(j)},{key:"staff",label:"Staff",icon:i.p.staff,rows:y(t.staff,"staff").sort(j)}],isLoading:a,search:o,searchResults:c,refresh:d}}},26473:()=>{},29675:()=>{},35687:(e,t,a)=>{"use strict";a.d(t,{L:()=>s.Q});var s=a(68686)},39968:(e,t,a)=>{"use strict";a.d(t,{e:()=>y});var s=a(10940),r=a(62544),n=a(43652),l=a(27965),i=a(69789),o=a(76255),c=a(7684),d=a(35295),u=a(20788),h=a(58704),m=a(93176),p=a(21818),f=a(11461),g=a(99994),x=a(50316);let v=({networkName:e,collapsed:t,onToggle:a})=>{let r=(0,d.useRouter)(),{isLoading:n,classrooms:l}=(0,h.O)(),i=r.asPath.split("?")[0],o="string"==typeof r.query.classroomId?r.query.classroomId:void 0;return(0,s.jsxs)(x.n,{collapsed:t,onToggle:a,children:[(0,s.jsx)(p.m,{label:"Network",entityName:e,entityHref:"/network-admin",activeHref:r.pathname,links:[{label:"Training",href:"/network-admin/training",icon:u.z7B},{label:"People",href:"/network-admin/people",icon:u.SrR}]}),(0,s.jsxs)("div",{className:"flex flex-col gap-1 w-full",children:[(0,s.jsx)(g.H,{label:"Products",activeHref:r.pathname,items:[{label:"Marketplace",href:"/network-admin/marketplace",icon:u.$H1},{label:"Competitions",href:"/network-admin/competitions",icon:u.pyc}]}),(0,s.jsx)(f.y,{label:"Classrooms",groupHeader:{href:"/network-admin/classrooms",icon:u.Tb7},activeItemId:o,activeHref:i,items:n?[]:(0,m.c)(l,"/network-admin/classrooms")})]})]})};function b({breadcrumbSuffix:e,trailingBadge:t,actions:a,children:i}){let{networkAdmin:d}=(0,n.F)(),u=d?.networkName??"Your Network",{collapsed:h,onToggle:m}=(0,l.X)("network-admin-sidebar-collapsed"),[p,f]=(0,r.useState)(!1);return(0,s.jsxs)(c.N,{sidebar:(0,s.jsx)(v,{networkName:u,collapsed:h,onToggle:m}),breadcrumbs:[{label:u},...e],trailingBadge:t,extraActions:a,onMessagesClick:()=>f(!0),children:[i,p&&(0,s.jsx)(o._u,{onClose:()=>f(!1)})]})}let y=e=>(0,s.jsx)(i.n,{children:(0,s.jsx)(n.L,{children:(0,s.jsx)(b,{...e})})})},43652:(e,t,a)=>{"use strict";a.d(t,{F:()=>d,L:()=>c});
1var s=a(10940),r=a(62544),n=a(21072),l=a(25298),i=a(82887);let o=(0,r.createContext)({networkAdmin:null,isLoading:!1,error:void 0}),c=({children:e})=>{let{data:t,isLoading:a,error:r}=(0,n.Ay)("users/me/navigation",i.hS,{revalidateOnFocus:!1}),c=t?.role===l.tz.NETWORK_ADMIN?{networkId:t.network?._id,networkName:t.network?.title,moduleZero:t.moduleZero,moduleZeroRedirectId:t.voyageRedirect?.moduleZeroId,moduleZeroRedirectStepId:t.voyageRedirect?.stepId}:null;return(0,s.jsx)(o.Provider,{value:{networkAdmin:c,isLoading:a,error:r},children:e})},d=()=>(0,r.useContext)(o)},45269:(e,t,a)=>{"use strict";a.d(t,{Q:()=>r});var s=a(62544);function r(){let[e,t]=(0,s.useState)(0);return(0,s.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let a=()=>{let a=window.innerHeight-(e.height+e.offsetTop);t(a>80?Math.round(a):0)};return a(),e.addEventListener("resize",a),e.addEventListener("scroll",a),()=>{e.removeEventListener("resize",a),e.removeEventListener("scroll",a)}},[]),e}},53950:()=>{},54382:(e,t,a)=>{"use strict";a.d(t,{Y:()=>i,p:()=>l});var s=a(10940),r=a(61913),n=a(62544);let l={marketplace:(0,s.jsx)(function(){return(0,s.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M3 9.5 4.5 4h15L21 9.5M3 9.5h18M3 9.5v10h18v-10M3 9.5a2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 5 0 2.5 2.5 0 0 0 3 0",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})},{}),team:(0,s.jsx)(function(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,s.jsx)("circle",{cx:"9",cy:"8",r:"3.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,s.jsx)("path",{d:"M3.5 19a5.5 5.5 0 0 1 11 0M16 5.5a3 3 0 0 1 0 5.6M17.5 19a5.4 5.4 0 0 0-2-4.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})},{}),classroom:(0,s.jsx)(function(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M12 4 2 8.5 12 13l10-4.5L12 4Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M6 10.5V16c0 1.4 2.7 2.5 6 2.5s6-1.1 6-2.5v-5.5M20 8.5V15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},{}),staff:(0,s.jsx)(function(){return(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M5 20V6.5L12 3l7 3.5V20",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9 20v-5h6v5M9 11h.01M15 11h.01M12 11h.01",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})},{})};function i({sections:e,hrefFor:t,selectedId:a,onSelect:l,linkComponent:o,onSearch:c,searchResults:d,hrefForSearch:u,isLoading:h}){let[m,p]=(0,n.useState)(""),[f,g]=(0,n.useState)({}),x=m.trim().length>0;(0,n.useEffect)(()=>{let e=m.trim();if(!e)return void c("");let t=setTimeout(()=>c(e),1e3);return()=>clearTimeout(t)},[m,c]);let v=(e,t)=>e.map(({row:e,tab:n})=>(0,s.jsx)(r.gG,{item:e,href:t({row:e,tab:n}),linkComponent:o,selected:a===e.id,onSelect:l},`${n}-${e.id}`));return(0,s.jsxs)("div",{className:"flex flex-col h-full min-h-0 bg-white",children:[(0,s.jsx)("div",{className:"px-4 pt-4 pb-3",children:(0,s.jsx)("h2",{className:"text-lg font-bold text-black1 tracking-[0.4px]",children:"Message"})}),(0,s.jsx)("div",{className:"px-4 pb-3",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-softgrey1 px-3 py-2",children:[(0,s.jsx)("img",{src:"/assets/icon/search.svg",alt:"","aria-hidden":"true",className:"w-4 h-4"}),(0,s.jsx)("input",{className:"flex-1 bg-transparent text-sm outline-none placeholder:text-placeholder",type:"text",placeholder:"Search","aria-label":"Search conversations",value:m,onChange:e=>p(e.target.value),"data-e2e":"chats-search"})]})}),(0,s.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto pb-4",children:h?(0,s.jsx)("div",{role:"status",className:"px-4 py-3 text-sm text-text","data-e2e":"chats-loading",children:"Loading conversations…"}):x?d?0===d.users.length&&0===d.messages.length?(0,s.jsx)("div",{role:"status",className:"px-4 py-6 text-sm text-text","data-e2e":"chats-empty",children:"Nothing found!"}):(0,s.jsxs)(s.Fragment,{children:[d.users.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"px-4 pt-2 pb-1 text-xs font-bold text-placeholder",children:"Users"}),v(d.users.map(e=>({row:e,tab:"team"})),({row:e})=>u(e.id))]}),d.messages.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"px-4 pt-2 pb-1 text-xs font-bold text-placeholder",children:"Messages"}),v(d.messages.map(e=>({row:e,tab:"team"})),({row:e})=>u(e.id))]})]}):(0,s.jsx)("div",{role:"status",className:"px-4 py-3 text-sm text-text","data-e2e":"chats-loading",children:"Searching…"}):e.every(e=>0===e.rows.length)?(0,s.jsx)("div",{role:"status",className:"px-4 py-6 text-sm text-text","data-e2e":"chats-empty",children:"No conversation yet"}):e.filter(e=>e.rows.length>0).map(e=>{let a=f[e.key],r=e.rows.reduce((e,{row:t})=>e+(t.unread??0),0);return(0,s.jsxs)("section",{children:[(0,s.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2.5 text-left text-black1 hover:bg-softgrey2","aria-expanded":!a,"aria-label":r>0?`${e.label}, ${r} unread`:e.label,"data-e2e":`chats-section-${e.key}`,onClick:()=>g(t=>({...t,[e.key]:!t[e.key]})),children:[(0,s.jsx)("span",{className:"text-text",children:e.icon}),(0,s.jsx)("span",{className:"flex-1 text-sm font-semibold tracking-[0.4px]",children:e.label}),r>0&&(0,s.jsx)("span",{"aria-hidden":"true",className:"min-w-[20px] rounded-full bg-red px-1.5 text-center text-xs font-bold leading-5 text-white",children:r}),(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:`transition-transform ${a?"":"rotate-180"}`,children:(0,s.jsx)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),!a&&v(e.rows,t)]},e.key)})})]})}},55445:(e,t,a)=>{"use strict";a.d(t,{f:()=>l});
1var s=a(21072),r=a(82887);let n=e=>(0,r.Ay)().get(e).then(e=>e.data),l=e=>{let{data:t,isLoading:a,error:r}=(0,s.Ay)(e&&"[slug]"!==e?`admin/classroom/${e}`:null,n,{revalidateOnFocus:!1});return{isLoading:a,data:t??void 0,statistic:t?.statistic??void 0,classroom:t?.classroom??void 0,error:r}}},58704:(e,t,a)=>{"use strict";a.d(t,{O:()=>n});var s=a(21072),r=a(82887);let n=()=>{let{data:e,isLoading:t,error:a,mutate:n}=(0,s.Ay)("admin/classrooms",r.hS,{revalidateOnFocus:!0,revalidateIfStale:!0});return{isLoading:t,data:e,classrooms:e?e.classrooms:[],error:a,mutate:n}}},61913:(e,t,a)=>{"use strict";a.d(t,{u6:()=>c,RB:()=>u,gG:()=>i});var s=a(10940),r=a(62544);function n(e){if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function l({href:e,children:t,...a}){return(0,s.jsx)("a",{href:e,...a,children:t})}function i({item:e,href:t,linkComponent:a=l,selected:r,onSelect:n}){let o=n?a=>{a.defaultPrevented||0!==a.button||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),n(e.id,t))}:void 0;return(0,s.jsxs)(a,{href:t,onClick:o,className:`dialog-item${r?" dialog-item--selected":""}`,"aria-current":r?"true":void 0,"data-e2e":"chat-list-item",children:[(0,s.jsx)("div",{className:"dialog-item__photo",children:e.photoUrl?(0,s.jsx)("img",{src:e.photoUrl,alt:""}):null}),(0,s.jsxs)("div",{className:"dialog-item__body",children:[e.requestReferenceId?(0,s.jsxs)("span",{className:"dialog-item__meta","data-e2e":"chat-request-id",children:["ID: ",e.requestReferenceId]}):null,(0,s.jsxs)("div",{className:"dialog-item__row",children:[(0,s.jsx)("span",{className:"dialog-item__name",children:e.name}),(0,s.jsx)("span",{className:"dialog-item__time",children:function(e,t=new Date){if(!e)return"";let a=new Date(e);return Number.isNaN(a.getTime())?"":a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()?a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):a.getFullYear()===t.getFullYear()?a.toLocaleDateString([],{day:"numeric",month:"short"}):a.toLocaleDateString([],{day:"numeric",month:"short",year:"numeric"})}(e.timestamp)})]}),e.businessName?(0,s.jsx)("span",{className:"dialog-item__meta","data-e2e":"chat-row-business",children:e.businessName}):null,(0,s.jsxs)("div",{className:"dialog-item__row",children:[e.typingLabel?(0,s.jsx)("span",{className:"dialog-item__last dialog-item__last--typing","data-e2e":"chat-row-typing",children:e.typingLabel}):(0,s.jsx)("span",{className:"dialog-item__last",children:e.lastMessage||"Tap to start conversation"}),e.unread?(0,s.jsx)("span",{className:"dialog-item__unread",children:e.unread}):null]})]})]})}function o({images:e,index:t,onClose:a}){let[n,l]=(0,r.useState)(t),i=e.length-1;return(0,r.useEffect)(()=>{let e=e=>{"Escape"===e.key&&a(),"ArrowLeft"===e.key&&l(e=>e>0?e-1:e),"ArrowRight"===e.key&&l(e=>e<i?e+1:e)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,i]),(0,s.jsxs)("div",{className:"chat-gallery",role:"dialog","aria-modal":"true","data-e2e":"chat-gallery",onClick:a,children:[(0,s.jsx)("img",{className:"chat-gallery__img",src:e[n],alt:"",onClick:e=>e.stopPropagation()}),(0,s.jsxs)("div",{className:"chat-gallery__controls",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("span",{className:"chat-gallery__counter",children:[n+1," of ",e.length]}),(0,s.jsxs)("div",{className:"chat-gallery__nav",children:[(0,s.jsx)("button",{type:"button","aria-label":"Previous photo",disabled:0===n,onClick:()=>l(e=>e>0?e-1:e),children:"‹"}),(0,s.jsx)("button",{type:"button","aria-label":"Next photo",disabled:n===i,onClick:()=>l(e=>e<i?e+1:e),children:"›"}),(0,s.jsx)("button",{type:"button",className:"chat-gallery__close","aria-label":"Close","data-e2e":"chat-gallery-close",onClick:a,children:"\xd7"})]})]})]})}function c({message:e}){return(0,s.jsx)("div",{className:"chat-thread-placeholder","data-e2e":"chat-thread-placeholder",children:(0,s.jsx)("p",{children:e??"Select a conversation to start messaging"})})}function d({message:e,onOpenPhoto:t,onReply:a,onRetry:r}
1){let n=["message",e.isMine?"message--mine":"",e.pending?"message--pending":"",e.failed?"message--failed":""].filter(Boolean).join(" ");return(0,s.jsxs)("div",{className:n,"data-e2e":"chat-message",children:[e.isMine?null:(0,s.jsx)("div",{className:"message__avatar",children:(0,s.jsx)("img",{src:e.avatarUrl||"/assets/default/user.svg",alt:""})}),(0,s.jsxs)("div",{className:"message__content",children:[(0,s.jsx)("span",{className:"message__time",children:function(e){if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}(e.timestamp)}),e.quote?(0,s.jsxs)("div",{className:"message__quote","data-e2e":"chat-message-quote",children:[e.quote.author?(0,s.jsx)("span",{className:"message__quote-author",children:e.quote.author}):null,(0,s.jsx)("span",{className:"message__quote-text",children:e.quote.text})]}):null,e.text?(0,s.jsx)("p",{className:"message__text","data-e2e":"chat-message-text",children:e.text}):null,e.photos&&e.photos.length>0?(0,s.jsx)("div",{className:"message__photos","data-e2e":"chat-message-photos",children:e.photos.slice(0,4).map((a,r)=>(0,s.jsxs)("button",{type:"button",className:"message__photo","aria-label":"Open photo",onClick:()=>t?.(e.photos??[],r),children:[(0,s.jsx)("img",{src:a,alt:""}),3===r&&e.photos&&e.photos.length>4?(0,s.jsxs)("span",{className:"message__photo-more",children:["+",e.photos.length-4]}):null]},r))}):null,e.failed?(0,s.jsxs)("span",{className:"message__status message__status--failed",children:["Not sent",r?(0,s.jsx)("button",{type:"button",className:"message__retry","data-e2e":"chat-message-retry",onClick:()=>r(e.id),children:"Try again"}):null]}):null]}),!a||e.pending||e.failed?null:(0,s.jsx)("button",{type:"button",className:"message__reply","aria-label":"Reply","data-e2e":"chat-message-reply",onClick:()=>a(e.id),children:"↩"})]})}function u({title:e,subtitle:t,requestId:a,onRequestClick:l,typingLabel:i,messages:c,isLoading:h,isRefreshing:m,isSending:p,onSend:f,onType:g,onAttachFiles:x,attachments:v,onRemoveAttachment:b,replyTo:y,onReplyTo:j,onRetryMessage:_,onCancelReply:w,onBack:k,keyboardInset:N=0}){let[C,R]=(0,r.useState)(""),S=v??[],$=S.some(e=>void 0!==e.progress&&!e.failed),I=(C.trim().length>0||S.length>0)&&!p&&!$,[T,L]=(0,r.useState)(null),M=(0,r.useRef)(null),E=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=E.current;if(!e)return;let t=()=>{e.scrollTop=e.scrollHeight};t();let a=Array.from(e.querySelectorAll("img"));return a.forEach(e=>{e.complete||e.addEventListener("load",t,{once:!0})}),()=>a.forEach(e=>e.removeEventListener("load",t))},[c,N]);let q=()=>{I&&(f(C.trim()),R(""))};return(0,s.jsxs)("div",{className:"chat-thread",children:[(0,s.jsxs)("div",{className:"chat-thread__header",children:[k?(0,s.jsx)("button",{type:"button",className:"chat-thread__back","aria-label":"Back",onClick:k,children:(0,s.jsx)("img",{src:"/assets/icon/chevron-left.svg",alt:"","aria-hidden":"true"})}):null,(0,s.jsxs)("div",{className:"chat-thread__heading",children:[(0,s.jsx)("p",{className:"chat-thread__name","data-e2e":"chat-thread-name",children:e}),i?(0,s.jsxs)("p",{className:"chat-thread__typing","data-e2e":"chat-typing",children:[i,(0,s.jsxs)("span",{className:"chat-thread__typing-dots","aria-hidden":"true",children:[(0,s.jsx)("span",{className:"chat-thread__typing-dot"}),(0,s.jsx)("span",{className:"chat-thread__typing-dot"}),(0,s.jsx)("span",{className:"chat-thread__typing-dot"})]})]}):t?(0,s.jsx)("p",{className:"chat-thread__role",children:t}):null]})]}),a?(0,s.jsxs)("button",{type:"button",className:"chat-thread__banner","data-e2e":"chat-request-banner",onClick:l,children:[(0,s.jsx)("img",{src:"/assets/navigation-tabs/checklist-active.svg",alt:"","aria-hidden":"true"}),(0,s.jsxs)("span",{className:"chat-thread__banner-text",children:[(0,s.jsx)("span",{className:"chat-thread__banner-title",children:"Tap to check your Request"}),(0,s.jsxs)("span",{className:"chat-thread__banner-id",children:["ID: ",a]})]})]}):null,m?(0,s.jsxs)("div",{className:"chat-thread__refreshing",role:"status","data-e2e":"chat-thread-refreshing",children:[(0,s.jsx)("span",{className:"chat-thread__refreshing-bar","aria-hidden":"true"}),(0,s.jsx)("span",{className:"chat-thread__sr-only",children:"Checking for new messages"})]}):null,(0,s.jsxs)("div",{className:"chat-thread__messages",ref:E,"data-e2e":"chat-thread-messages",children:[c.map((e,t)=>{let a=n(e.timestamp)!==n(c[t-1]?.timestamp);return(0,s.jsxs)(r.Fragment,{children:[a&&e.timestamp?(0,s.jsx)("div",{className:"chat-thread__day","data-e2e":"chat-thread-day",children:(0,s.jsx)("span",{className:"chat-thread__day-label",children:function(e,t=new Date){if(!e)return"";let a=new Date(e);if(Number.isNaN(a.getTime()))return"";if(n(e)===n(t.toISOString()))return"Today";let s=new Date(t);return(s.setDate(t.getDate()-1),n(e)===n(s.toISOString()))?"Yesterday":a.getFullYear()===t.getFullYear()?a.toLocaleDateString([],{day:"numeric",month:"short"}):a.toLocaleDateString([],{day:"numeric",month:"short",year:"numeric"})}(e.timestamp)})}):null,(0,s.jsx)(d,{message:e,onOpenPhoto:(e,t)=>L({images:e,index:t}),onReply:j,onRetry:_})]},e.id)}),h||0!==c.length?null:(0,s.jsx)("div",{className:"chat-thread__empty","data-e2e":"chat-thread-empty",children:(0,s.jsx)("span",{children:"No messages yet. Say hello!"})})]}),(0,s.jsxs)("div",{className:"chat-thread__footer",style:N?{paddingBottom:N+12}:void 0,children:[y?(0,s.jsxs)("div",{className:"chat-thread__reply","data-e2e":"chat-reply-preview",children:[(0,s.jsxs)("div",{className:"chat-thread__reply-body",children:[y.author?(0,s.jsx)("span",{className:"chat-thread__reply-author",children:y.author}):null,(0,s.jsx)("span",{className:"chat-thread__reply-text",children:y.preview})]}),(0,s.jsx)("button",{type:"button",className:"chat-thread__reply-cancel","aria-label":"Cancel reply",onClick:w,children:"\xd7"})]}):null,S.length?(0,s.jsx)("div",{className:"chat-thread__attachments","data-e2e":"chat-attachments",children:S.map(e=>(0,s.jsxs)("div",{className:`chat-thread__thumb${e.failed?" chat-thread__thumb--failed":""}`,"data-e2e":"chat-attachment",children:[(0,s.jsx)("img",{src:e.previewUrl,alt:""}),void 0===e.progress||e.failed?null:(0,s.jsx)("span",{className:"chat-thread__thumb-progress",role:"progressbar","aria-valuenow":e.progress,"aria-label":"Uploading photo",children:(0,s.jsx)("span",{style:{width:`${e.progress}%`}})}),e.failed?(0,s.jsx)("span",{className:"chat-thread__thumb-failed",children:"Failed"}):null,(0,s.jsx)("button",{type:"button",className:"chat-thread__thumb-remove","aria-label":"Remove photo",onClick:()=>b?.(e.id),children:"\xd7"})]},e.id))}):null,(0,s.jsxs)("div",{className:"chat-thread__compose-row",children:[x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{ref:M,type:"file",accept:"image/png,image/jpeg",multiple:!0,hidden:!0,"data-e2e":"chat-attach-input",onChange:e=>{let t=Array.from(e.target.files??[]);t.length&&x(t),e.target.value=""}}),(0,s.jsx)("button",{type:"button",className:"chat-thread__attach","aria-label":"Attach photo",onClick:()=>M.current?.click(),children:(0,s.jsx)("img",{src:"/assets/icon/attachment.svg",alt:"","aria-hidden":"true"})})]}):null,(0,s.jsxs)("div",{className:"chat-thread__composer",children:[(0,s.jsx)("textarea",{className:"chat-thread__input","aria-label":"Message",placeholder:"Type a message",rows:1,value:C,onChange:e=>{R(e.target.value),g?.()},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),q())},"data-e2e":"chat-input"}),(0,s.jsx)("button",{type:"button",className:"chat-thread__send","aria-label":"Send",disabled:!I,onClick:q,"data-e2e":"chat-send",children:p?(0,s.jsx)("span",{className:"chat-thread__send-spinner","aria-hidden":"true"}):(0,s.jsx)("img",{src:"/assets/icon/send.svg",alt:"","aria-hidden":"true"})})]})]})]}),T?(0,s.jsx)(o,{images:T.images,index:T.index,onClose:()=>L(null)}):null]})}a(26473),a(94445),a(13548),a(90354),a(29675),a(53950)},67387:(e,t,a)=>{"use strict";a.d(t,{X8:()=>g,d3:()=>y});
1var s=a(10940),r=a(61913),n=a(84108),l=a(45269),i=a(90122),o=a.n(i),c=a(35295),d=a(62544),u=a(20788),h=a(41795),m=a(69789),p=a(54382),f=a(23694);function g(e){return"consumer"===e?"provider":"provider"===e?"consumer":"classroom"===e?"classroom":"team"}function x({chatId:e,type:t}){let a=(0,c.useRouter)(),{title:i,subtitle:o,request:u,messages:m,isLoading:p,isRefreshing:f,isSending:g,sendMessage:v,retrySend:b,typingLabel:y,notifyTyping:j,attachments:_,attachFiles:w,removeAttachment:k,replyTo:N,startReply:C,cancelReply:R,error:S}=(0,n.UU)(e,t),$=(0,l.Q)();return((0,d.useEffect)(()=>{(0,h.hE)({placements:"classroom"===t?[h.pE.CLASSROOM_CHAT]:[h.pE.CONSUMER_CHAT,h.pE.PROVIDER_CHAT,h.pE.TEAM_CHAT],modelId:e})},[e,t]),!S||m.length||p)?(0,s.jsx)(r.RB,{title:i,subtitle:o,requestId:u?.requestId,onRequestClick:u?()=>a.push(u.requestUrl):void 0,typingLabel:y,messages:m,isLoading:p,isRefreshing:f,isSending:g,onSend:v,onType:j,onAttachFiles:w,attachments:_,onRemoveAttachment:k,replyTo:N,onReplyTo:C,onRetryMessage:b,onCancelReply:R,onBack:()=>window.history.length>1?a.back():a.push("/chat"),keyboardInset:$}):(0,s.jsx)(r.u6,{message:"This conversation could not be opened."})}let v={student:"/student",admin:"/admin",networkAdmin:"/network-admin",coordinator:"/coordinator"};function b({chatId:e,type:t}){let a=(0,c.useRouter)(),l=function(e){var t;if(e.backHref&&(t=e.backHref).startsWith("/")&&!t.startsWith("//")&&!t.startsWith("/\\"))return{href:e.backHref,label:"Back to dashboard"};let a=e.from?v[e.from]:void 0;return a?{href:a,label:"Back to dashboard"}:{href:"/marketplace",label:"Explore Marketplace"}}({from:a.query.from,backHref:a.query.backHref}),{sections:i,isLoading:d,search:h,searchResults:m}=(0,f.S)(e),y=(0,n._h)(),j=a.query.from,_=e=>j?`${e}&from=${j}`:e,w=(0,s.jsx)(p.Y,{sections:i,hrefFor:({row:e,tab:t})=>_(`/chat/${e.id}?type=${g(t)}`),hrefForSearch:e=>_(`/chat/${e}?type=team`),onSearch:h,searchResults:m,isLoading:d,linkComponent:y,selectedId:e,onSelect:(e,t)=>a.push(t)});return(0,s.jsxs)("div",{className:"flex flex-col h-[100dvh] overflow-hidden bg-webapp",children:[(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-1/2 focus:-translate-x-1/2 focus:z-[100] focus:px-4 focus:py-2 focus:bg-white focus:text-green focus:rounded-lg focus:shadow-lg focus:outline-none",children:"Skip to main content"}),(0,s.jsxs)("header",{className:"flex flex-none items-center gap-4 border-b border-softgrey1 bg-white px-4 py-3",children:[(0,s.jsx)(o(),{href:"/","aria-label":"KANU home",className:"flex shrink-0 items-center",children:(0,s.jsx)(u.VTb,{className:"h-6 w-auto"})}),(0,s.jsx)("h1",{className:"min-w-0 truncate text-sm font-bold tracking-[0.4px] text-black1",children:"Inbox"}),(0,s.jsx)(o(),{href:l.href,className:"ml-auto shrink-0 whitespace-nowrap rounded-full border border-softgrey1 px-3 py-1.5 text-sm font-semibold text-black1 hover:bg-softgrey2",children:l.label})]}),(0,s.jsxs)("div",{className:"flex-1 min-h-0 desktop:grid desktop:grid-cols-[360px_1fr] desktop:gap-4 desktop:p-4",children:[(0,s.jsx)("aside",{"aria-label":"Conversations",className:`min-h-0 h-full overflow-hidden rounded-2xl bg-white ${e?"hidden desktop:block":"block"}`,children:w}),(0,s.jsx)("main",{id:"main-content",tabIndex:-1,className:`min-h-0 h-full overflow-hidden rounded-2xl bg-white outline-none ${e?"block":"hidden desktop:block"}`,children:e?(0,s.jsx)("div",{className:"kanu-chat-thread h-full",children:(0,s.jsx)(x,{chatId:e,type:t},e)}):(0,s.jsx)(r.u6,{})})]})]})}function y(e){return(0,s.jsx)(m.n,{children:(0,s.jsx)(b,{...e})})}},68686:(e,t,a)=>{"use strict";a.d(t,{Q:()=>n});var s=a(35295),r=a(55445);function n(){let e=(0,s.useRouter)(),t="string"==typeof e.query.classroomId?e.query.classroomId:"",{classroom:a,isLoading:n}=(0,r.f)(t);return{classroomId:t,classroomTitle:a?.abbreviation??a?.name??"Classroom",isLoading:n}}},69789:(e,t,a)=>{"use strict";a.d(t,{n:()=>f});var s=a(10940),r=a(88063),n=a(88073),l=a(90122),i=a.n(l),o=a(62544),c=a(82887),d=a(15755),u=a(49007);function h({href:e,children:t,...a}){return(0,s.jsx)(i(),{href:e,...a,children:t})}let m={async get(e){let t=await (0,c.Qg)(e);return t?.data??t},async post(e,t){let a=await (0,c.I9)(e,t);return a?.data??a}},p={requestUrl:(e,t)=>
1`/requests/${e}s/${t}`};function f({children:e}){let{data:t}=(0,d.J)(),a=t?._id??null,l=(0,o.useCallback)(()=>(0,n.getCookie)("accessToken")??null,[]),i=(0,o.useCallback)(()=>a,[a]),c=(0,o.useMemo)(u.N,[]);return(0,s.jsx)(r.g,{http:m,getToken:l,getUserId:i,wsBaseUrl:c,routes:p,linkComponent:h,children:e})}},76255:(e,t,a)=>{"use strict";a.d(t,{_u:()=>p});var s=a(10940),r=a(61913),n=a(84108),l=a(62544),i=a(61682),o=a(69789),c=a(96246),d=a(54382),u=a(67387),h=a(23694);function m(){let[e,t]=(0,l.useState)(),{sections:a,isLoading:i,search:o,searchResults:m}=(0,h.S)(e?.chatId),p=(0,n._h)(),f=(0,s.jsx)(d.Y,{sections:a,hrefFor:({row:e,tab:t})=>`/chat/${e.id}?type=${(0,u.X8)(t)}`,hrefForSearch:e=>`/chat/${e}?type=team`,onSearch:o,searchResults:m,isLoading:i,linkComponent:p,selectedId:e?.chatId,onSelect:(e,a)=>t({chatId:e,type:new URLSearchParams(a.split("?")[1]).get("type")??void 0})});return(0,s.jsxs)("div",{className:"flex w-[860px] max-w-[100vw] h-screen overflow-hidden bg-white",children:[(0,s.jsx)("div",{className:"w-[340px] shrink-0 h-full overflow-hidden border-r border-softgrey1",children:f}),(0,s.jsx)("div",{className:"flex-1 h-full overflow-hidden",children:e?(0,s.jsx)(c.q,{chatId:e.chatId,type:e.type,onClose:()=>t(void 0)},e.chatId):(0,s.jsx)(r.u6,{})})]})}function p({onClose:e}){return(0,s.jsx)(i.w,{onClose:e,children:(0,s.jsx)(o.n,{children:(0,s.jsx)(m,{})})})}},84108:(e,t,a)=>{"use strict";a.d(t,{DD:()=>u,xz:()=>_,_h:()=>N,UU:()=>k,RL:()=>m,TA:()=>l});var s=a(62544),r=a(21072),n=a(88063);function l(){let{getUserId:e}
1=(0,n.q)(),[t,a]=(0,s.useState)(()=>{let t=e();return"string"==typeof t?t:null});return(0,s.useEffect)(()=>{let t=!0;return Promise.resolve(e()).then(e=>{t&&a(e??null)}),()=>{t=!1}},[e]),t}function i(e){return`${e?.firstName??""} ${e?.lastName??""}`.trim()}function o(e){return"products"===e.businessType?e.businessLogoUrl||e.businessPhotoUrl||void 0:e.businessPhotoUrl??void 0}function c(e,t){let a=e.chat??{},s=a.group??[],r=s.map(i).filter(Boolean).join(", "),n={id:a._id??"",requestReferenceId:a.requestReferenceId,lastMessage:e.lastMessage?.content,timestamp:e.lastMessage?.createdAt,unread:e.unreadMessage,participantIds:s.map(e=>e._id).filter(e=>!!e),participants:s.filter(e=>!!e._id).map(e=>({id:e._id,name:i(e)})),classroomId:a.classroomId,ecosystemId:a.ecosystemId};if("provider"===t){let e=s[1],t=i(e);return{...n,name:t||(a.businessName?`${a.businessName} team`:r||"Chat"),photoUrl:e?.photoUrl??void 0,businessName:a.businessName}}return"team"===t?{...n,name:a.businessName?`${a.businessName} team`:r||"Chat",photoUrl:o(a)}:"classroom"===t||"staff"===t?{...n,name:r||"Chat"}:{...n,name:a.businessName||r||"Chat",photoUrl:o(a)}}let d={consumer:[],provider:[],team:[],classroom:[],staff:[]};function u(e,t){return new Date(t.timestamp??0).getTime()-new Date(e.timestamp??0).getTime()}function h(e,t){return t?e.map(e=>{let a=e.participants?.find(e=>e.id!==t&&e.name);return a&&a.name!==e.name?{...e,name:a.name}:e}):e}function m(){let{http:e}=(0,n.q)(),{data:t,error:a,isLoading:i,mutate:o}=(0,r.Ay)("chat",async t=>{let a=await e.get(t);return{consumer:(a?.preparedConsumer??[]).map(e=>c(e,"consumer")),provider:(a?.preparedProvider??[]).map(e=>c(e,"provider")),team:(a?.preparedTeam??[]).map(e=>c(e,"team")),classroom:(a?.preparedClassroom??[]).map(e=>c(e,"classroom")),staff:(a?.preparedStaff??[]).map(e=>c(e,"staff"))}}),u=l(),m=t??d,p=(0,s.useMemo)(()=>0===m.classroom.length&&0===m.staff.length?m:{...m,classroom:h(m.classroom,u),staff:h(m.staff,u)},[m,u]),f=(0,s.useRef)(p);f.current=p;let g=(0,s.useCallback)((e,t)=>{let a=function(e,t,a){let s=t?.chat;if(!s)return null;let r="object"==typeof t.owner&&null!==t.owner?String(t.owner._id??""):String(t.owner??""),n=(!a?.selfId||r!==a.selfId)&&s!==a?.openChatId,l=!1,i={};for(let a of["consumer","provider","team","classroom","staff"]){let r=e[a],o=r.findIndex(e=>e.id===s);if(-1===o){i[a]=r;continue}l=!0;let c={...r[o],lastMessage:t.content??r[o].lastMessage,timestamp:t.createdAt??r[o].timestamp,unread:n?(r[o].unread??0)+1:r[o].unread};i[a]=[c,...r.slice(0,o),...r.slice(o+1)]}return l?i:null}(f.current,e,t);return a&&o(a,{revalidate:!1}),null!==a},[o]),[x,v]=(0,s.useState)(null),b=(0,s.useRef)(0),y=(0,s.useRef)(""),j=(0,s.useCallback)(async t=>{let a=t.trim();y.current=a;let s=++b.current;if(v(null),a)try{let t=await e.get(`chat/find/messages?searchText=${encodeURIComponent(a)}`);if(s!==b.current)return;let r=new Map;for(let e of[...f.current.consumer,...f.current.provider,...f.current.team,...f.current.classroom,...f.current.staff])r.has(e.id)||r.set(e.id,e.name);v({users:(t?.users??[]).map(e=>c(e,"team")),messages:(t?.messages??[]).map(e=>({id:e.chat??"",name:r.get(e.chat??"")??"Chat",lastMessage:e.content,timestamp:e.createdAt}))})}catch{s===b.current&&v({users:[],messages:[]})}},[e]),_=(0,s.useCallback)(()=>y.current?j(y.current):Promise.resolve(),[j]);return{tabs:p,error:a,isLoading:i,refresh:o,applyLastMessage:g,search:j,searchResults:x,refreshSearch:_}}var p=a(6608),f=a(24767);function g(e){return e?.toLowerCase()||void 0}function x(e){return`${e?.firstName??""} ${e?.lastName??""}`.trim()}function v(e){return e._id??(null!=e.id?String(e.id):void 0)}function b(e){return"string"==typeof e.owner?e.owner:e.owner?._id}function y(e){return"string"==typeof e.owner?void 0:e.owner}function j(e){return"string"==typeof e.quote?e.quote:e.quote?._id}function _(e,t){let a=v(t);if(a&&e.some(e=>v(e)===a))return e.map(e=>v(e)===a?{...e,pending:!1}:e);let s=b(t),r=e.findIndex(e=>e.pending&&!e._id&&e.content===t.content&&b(e)===s&&void 0!==s);return -1!==r?e.map((e,a)=>a===r?{...e,_id:t._id,pending:!1}:e):[...e,t]}function w(e){return(e.photos??[]).map(e=>"string"==typeof e?e:e.webviewPath||e.s3Url).filter(e=>!!e)}function k(e,t,a){var i;let o,c,{http:d,routes:u}=(0,n.q)(),h=l(),m=a?`?guestIdentifier=${encodeURIComponent(a)}`:"",k=e?`chat/${e}${m}`:null,N=(0,s.useRef)(!1),{data:C,error:R,isLoading:S,isValidating:$,mutate:I}=(0,r.Ay)(k,async e=>{let t=await d.get(e);return{messages:t?.message??[],chat:t?.chat??{},businessName:t?.business?.businessName,request:t?.request,viewerId:t?.viewerId}},a&&!h?{refreshInterval:12e3,isPaused:()=>N.current}
1:void 0),T=h??C?.viewerId??null,[L,M]=(0,s.useState)(!1),[E,q]=(0,s.useState)(null),U=function(e,t){let{http:a}=(0,n.q)(),[r,l]=(0,s.useState)([]),i=(0,s.useRef)(new Map),o=(0,s.useRef)([]);(0,s.useEffect)(()=>()=>{for(let e of o.current)URL.revokeObjectURL(e)},[]);let c=(0,s.useCallback)(s=>{for(let r of s){let s=`${r.name}-${r.size}-${o.current.length}-${Math.random().toString(36).slice(2)}`,n=URL.createObjectURL(r);o.current.push(n),l(e=>[...e,{id:s,previewUrl:n,progress:0}]),(async()=>{try{let n=function(e){let t=e.name.includes(".")?e.name.split(".").pop():void 0,a=`${Date.now()}-${Math.random().toString(36).slice(2,14)}`;return t?`${a}.${t}`:a}(r),{presigned:o}=await a.post("upload-credential",{path:e?`chat/${e}`:"chat",...t&&e?{chatId:e,guestIdentifier:t}:{}}),c=await function(e,t,a,s){let{url:r,key:n,...l}=e,i=new FormData;for(let[e,t]of(i.append("key",n),Object.entries(l)))i.append(e,t);return i.append("file",t,a),new Promise((e,t)=>{let l=new XMLHttpRequest;l.open("POST",r),l.timeout=6e4,l.upload.onprogress=e=>{e.lengthComputable&&s(Math.round(e.loaded/e.total*100))},l.onload=()=>{let s,i,o;return l.status>=200&&l.status<300?e((i=(s=n.includes("${filename}")?n.replace("${filename}",a):n).startsWith("/")?s.slice(1):s,o=r.endsWith("/")?r:`${r}/`,`${o}${i}`)):t(Error(`S3 upload failed (${l.status})`))},l.onerror=()=>t(Error("S3 upload failed")),l.ontimeout=()=>t(Error("S3 upload timed out")),l.send(i)})}(o,r,n,e=>l(t=>t.map(t=>t.id===s?{...t,progress:e}:t)));i.current.set(s,c),l(e=>e.map(e=>e.id===s?{id:e.id,previewUrl:e.previewUrl}:e))}catch{l(e=>e.map(e=>e.id===s?{...e,progress:void 0,failed:!0}:e))}})()}},[a,e,t]),d=(0,s.useCallback)(e=>{i.current.delete(e),l(t=>{let a=t.find(t=>t.id===e);return a&&(URL.revokeObjectURL(a.previewUrl),o.current=o.current.filter(e=>e!==a.previewUrl)),t.filter(t=>t.id!==e)})},[]),u=(0,s.useCallback)(()=>{let e=r.filter(e=>i.current.has(e.id)),t=e.map(e=>i.current.get(e.id));for(let t of e)URL.revokeObjectURL(t.previewUrl),i.current.delete(t.id);let a=new Set(e.map(e=>e.previewUrl));return o.current=o.current.filter(e=>!a.has(e)),l(t=>t.filter(t=>!e.some(e=>e.id===t.id))),t},[r]),h=r.filter(e=>i.current.has(e.id)).length;return{attachments:r,add:c,remove:d,takeUrls:u,readyCount:h}}(e,a);(0,s.useEffect)(()=>{q(null)},[e]);let{mutate:A,cache:D}=(0,p.iX)();(0,s.useEffect)(()=>{if(!e||!D.get("chat")?.data)return;let t=(t=[])=>t.map(t=>t.id===e?{...t,unread:0}:t);A("chat",e=>e&&{consumer:t(e.consumer),provider:t(e.provider),team:t(e.team),classroom:t(e.classroom),staff:t(e.staff)},{revalidate:!1})},[e,A,D]);let P=(0,s.useMemo)(()=>{let e=(C?.messages??[]).slice().sort((e,t)=>new Date(e.createdAt??0).getTime()-new Date(t.createdAt??0).getTime()),t=new Map;for(let a of e)a._id&&t.set(a._id,a);return e.map((e,a)=>{let s,r;return s=e._id??(null!=e.id?String(e.id):void 0)??`idx-${a}`,r=j(e)?t.get(j(e)):void 0,{id:s,text:e.content??"",timestamp:e.createdAt,isMine:!!T&&b(e)===T,avatarUrl:y(e)?.photoUrl??void 0,author:x(y(e))||void 0,photos:w(e),pending:e.pending,failed:e.failed,quote:r?{author:x(y(r))||void 0,text:r.content||(w(r).length?"Photo":"")}:void 0}})},[C,T]),{typing:O,notifyTyping:F,stopTyping:H}=function(e,t){let{userId:a}=t,{getToken:r,wsBaseUrl:l}=(0,n.q)(),i=(0,s.useRef)(null),[o,c]=(0,s.useState)(null),d=(0,s.useRef)(!1),u=(0,s.useRef)(void 0),h=(0,s.useRef)(t.onMessage);h.current=t.onMessage;let m=(0,s.useRef)(t.onReconnect);m.current=t.onReconnect;let p=(0,s.useRef)(t.userId);p.current=t.userId;let g=(0,s.useRef)(r);g.current=r;let x=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!e)return;let t=!1;x.current=null;let a=new f.$({baseUrl:l,getToken:()=>g.current(),namespace:"message",onReconnect:s=>{if(t)return;let r=p.current??void 0;x.current=r??null,a.emit("enter-chat-room",{chatId:e,owner:r}),a.emit("read-message",{chatId:e,owner:r}),s&&m.current?.()}});return i.current=a,a.on("message",e=>h.current(e)),a.on("users-typing",e=>{c(e?.typing?e:null)}),a.connect().catch(()=>{}),()=>{t=!0,clearTimeout(u.current),d.current&&(d.current=!1,a.emit("is-typing",{chatId:e,owner:p.current??void 0,typing:!1})),a.emit("leave-chat-room",{chatId:e,owner:p.current??void 0}),a.disconnect(),i.current=null}},[e,l]),(0,s.useEffect)(()=>{e&&a&&x.current!==a&&(x.current=a,i.current?.emit("enter-chat-room",{chatId:e,owner:a}),i.current?.emit("read-message",{chatId:e,owner:a}))},[e,a]);let v=(0,s.useCallback)(t=>{i.current?.emit("is-typing",{chatId:e,owner:p.current??void 0,typing:t})},[e]);return{typing:o,notifyTyping:(0,s.useCallback)(()=>{d.current||(d.current=!0,v(!0)),clearTimeout(u.current),u.current=setTimeout(()=>{d.current=!1,v(!1)},600)},[v]),stopTyping:(0,s.useCallback)(()=>{clearTimeout(u.current),d.current&&(d.current=!1,v(!1))},[v])}}(e,{userId:T,onMessage:(0,s.useCallback)(e=>{e&&I(t=>{let a=t??{messages:[],chat:{}};return{...a,messages:_(a.messages,e)}},{revalidate:!1})},[I]),onReconnect:()=>void I()}),B=(0,s.useCallback)(async(t,a)=>{M(!0),N.current=!0;try{let s=await d.post(`chat/${e}${m}`,{type:a.type,content:a.content??"",...a.photos?.length?{photos:a.photos}:{},...a.quote?{quote:a.quote}:{}}),r=s?.created?.message;await I(e=>{var a;let s;return{...e??{chat:{}},messages:(a=(e?.messages??[]).map(e=>e.id===t?{...e,_id:r?._id,pending:!1}:e),s=new Set,a.filter(e=>
1!e._id||!s.has(e._id)&&(s.add(e._id),!0)))}},{revalidate:!1})}catch{await I(e=>({...e??{chat:{}},messages:(e?.messages??[]).map(e=>e.id===t?{...e,pending:!1,failed:!0}:e)}),{revalidate:!1})}finally{N.current=!1,M(!1)}},[e,m,d,I]),W=(0,s.useCallback)(async t=>{let a=t.trim();if(!e||!a&&!U.readyCount)return;let s=U.takeUrls();H();let r=E?.id;q(null);let n=`tmp-${Date.now()}`,l={id:n,content:a,owner:{_id:T??void 0},createdAt:new Date().toISOString(),type:s.length?"picture":"text",photos:s,quote:r,pending:!0};await I(e=>({...e??{chat:{}},messages:[...e?.messages??[],l]}),{revalidate:!1}),await B(n,{type:s.length?"picture":"text",content:a,photos:s,quote:r})},[e,T,I,H,E,U,B]),Y=(0,s.useCallback)(async e=>{let t=(C?.messages??[]).find(t=>v(t)===e&&t.failed&&!t.pending);t&&(await I(t=>({...t??{chat:{}},messages:(t?.messages??[]).map(t=>v(t)===e?{...t,pending:!0,failed:!1}:t)}),{revalidate:!1}),await B(e,{type:t.type??(w(t).length?"picture":"text"),content:t.content,photos:w(t),quote:j(t)}))},[C,I,B]),z=(0,s.useCallback)(e=>{let t=P.find(t=>t.id===e);t&&q({id:e,author:t.isMine?"You":t.author,preview:t.text||(t.photos?.length?"Photo":"")})},[P]),K=O?.typing?`${O.user||"Someone"} is typing`:void 0;return{title:C?(c=(o=C.chat.group??[]).filter(e=>e._id!==T).map(x).filter(Boolean).join(", "),"consumer"===g(t)?x(o[1])||c||C.businessName||"Chat":C.businessName||c||"Chat"):"",subtitle:(i=g(t))?i.charAt(0).toUpperCase()+i.slice(1):void 0,request:C?function(e,t,a){if("provider"!==g(t)||!e?._id)return;let s="service"===e.type||"product"===e.type?e.type:void 0;if(!s)return;let r=a.requestUrl(s,e._id);if(r)return{requestId:e.referenceId||e._id,requestUrl:r}}(C.request,t,u):void 0,messages:P,isLoading:S,isRefreshing:$&&!S&&!!C,isSending:L,error:R,sendMessage:W,retrySend:Y,typingLabel:K,notifyTyping:F,attachments:U.attachments,attachFiles:U.add,removeAttachment:U.remove,replyTo:E,startReply:z,cancelReply:(0,s.useCallback)(()=>q(null),[])}}function N(){return(0,n.q)().linkComponent}},88063:(e,t,a)=>{"use strict";a.d(t,{g:()=>n,q:()=>l});var s=a(62544);let r=(0,s.createContext)(null);function n({children:e,http:t,getToken:a,getUserId:l,wsBaseUrl:i,routes:o,linkComponent:c}){let d=(0,s.useMemo)(()=>({http:t,getToken:a,getUserId:l,wsBaseUrl:i,routes:o,linkComponent:c}),[t,a,l,i,o,c]);return(0,s.createElement)(r.Provider,{value:d},e)}function l(){let e=(0,s.useContext)(r);if(!e)throw Error("Messaging runtime used outside a <MessagingUiProvider>. Wrap the chat screens in one and pass the app's http, token, user-id, ws and route adapters.");return e}},90354:()=>{},93176:(e,t,a)=>{"use strict";a.d(t,{c:()=>n});var s=a(10940),r=a(20788);function n(e,t){return e.map(e=>({id:e._id,label:e.abbreviation??e.name,href:`${t}/${e._id}`,subLinks:[{label:"Activity",href:`${t}/${e._id}/activity`,icon:(0,s.jsx)(r.p3o,{className:"fill-black1"})},{label:"Students",href:`${t}/${e._id}/students`,icon:(0,s.jsx)(r.hjP,{className:"fill-black1"})},{label:"Grades",href:`${t}/${e._id}/grades`,icon:(0,s.jsx)(r.WfV,{className:"fill-black1"})},{label:"Insights",href:`${t}/${e._id}/insights`,icon:(0,s.jsx)(r.YCQ,{className:"fill-black1"})}]}))}},94445:()=>{},96246:(e,t,a)=>{"use strict";a.d(t,{I:()=>h,q:()=>u});var s=a(10940),r=a(61913),n=a(84108),l=a(45269),i=a(62544),o=a(61682),c=a(41795),d=a(69789);function u({chatId:e,type:t,guestIdentifier:a,onClose:o}){let{title:d,subtitle:h,request:m,messages:p,isLoading:f,isRefreshing:g,isSending:x,sendMessage:v,retrySend:b,typingLabel:y,notifyTyping:j,attachments:_,attachFiles:w,removeAttachment:k,replyTo:N,startReply:C,cancelReply:R,error:S}=(0,n.UU)(e,t,a),$=(0,l.Q)();return((0,i.useEffect)(()=>{(0,c.hE)({placements:"classroom"===t?[c.pE.CLASSROOM_CHAT]:"staff"===t?[c.pE.STAFF_CHAT]:[c.pE.CONSUMER_CHAT,c.pE.PROVIDER_CHAT,c.pE.TEAM_CHAT],modelId:e})},[e,t]),!S||p.length||f)?(0,s.jsx)(r.RB,{title:d,subtitle:h,requestId:m?.requestId,onRequestClick:void 0,typingLabel:y,messages:p,isLoading:f,isRefreshing:g,isSending:x,onSend:v,onType:j,onAttachFiles:w,attachments:_,onRemoveAttachment:k,replyTo:N,onReplyTo:C,onRetryMessage:b,onCancelReply:R,onBack:o,keyboardInset:$}):(0,s.jsx)(r.u6,{message:"This conversation could not be opened."})}let h=({chatId:e,type:t,guestIdentifier:a,onClose:r})=>(0,s.jsx)(o.w,{onClose:r,children:(0,s.jsx)("div",{className:"w-screen max-w-[480px] h-screen flex flex-col bg-white overflow-hidden",children:(0,s.jsx)(d.n,{children:(0,s.jsx)(u,{chatId:e,type:t,guestIdentifier:a,onClose:r},e)})})})},99994:(e,t,a)=>{"use strict";a.d(t,{H:()=>d});
1var s=a(10940),r=a(90122),n=a.n(r),l=a(64052),i=a(56152),o=a(81448);function c(e,t){return e===t||e?.startsWith(`${t}/`)}let d=({label:e,items:t,activeHref:a})=>(0,o.h)()?(0,s.jsx)("div",{className:"flex flex-col gap-1 items-center w-full",children:t.map(e=>{let t=c(a,e.href);return(0,s.jsx)(i.rK,{content:e.label,side:"right",sideOffset:8,delayDuration:0,children:(0,s.jsx)(n(),{href:e.href,"aria-label":e.label,className:(0,l.cn)("flex items-center justify-center p-2 rounded-lg",t?"bg-softgrey2":"hover:bg-softgrey2"),children:(0,s.jsx)(e.icon,{className:"size-5 shrink-0 fill-black1"})})},e.href)})}):(0,s.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,s.jsx)("div",{className:"flex items-center p-2 rounded-lg w-full",children:(0,s.jsx)("p",{className:"flex-1 text-sm font-semibold text-gray-700",children:e})}),(0,s.jsx)("div",{className:"flex flex-col gap-1 items-start w-full",children:t.map(e=>{let t=c(a,e.href);return(0,s.jsxs)(n(),{href:e.href,className:(0,l.cn)("flex gap-2 items-center p-2 rounded-lg w-full",t?"bg-softgrey2":"hover:bg-softgrey2"),children:[(0,s.jsx)(e.icon,{className:"size-5 shrink-0 fill-black1"}),(0,s.jsx)("span",{className:"text-sm font-semibold text-black1",children:e.label})]},e.href)})})]})}},e=>{e.O(0,[4906,4095,122,5302,7267,7536,4465,1359,1250,8357,9229,1772,3460,3234,5754,438,4308,2224,2543,5529,7595,8997,2395,1152,5076,7752,9200,5450,8137,5544,9362,6506,4319,3253,5890,8684,636,6593,8792],()=>e(e.s=4901)),_N_E=e.O()}]);

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.