1import{e7 as ge,j as e,r as h,h7 as Z,H as ye,fO as q,fs as me,gp as ue,gq as fe}from"./index-D9ib8j_u.js";import{bs as j,s as t,b_ as je,cB as G,cC as be,K as f}from"./DataProviderContext-CMiYnCJH.js";import{S as g}from"./Skeleton-DBy-_whN.js";import{C as B}from"./CardErrorState-DOq1zv-E.js";import{S as ve,a as Se}from"./shared-DxYK1Zze.js";import{u as we,E as ke,D as Ne,C as Te}from"./edit_dashboard_button-kZvEiCNg.js";import{L as P}from"./Link-LWynSUKr.js";import{P as We,S as Re,a as ze,b as He,c as Le,d as Ce,L as Be,M as De}from"./index-CXfVTx4G.js";import{g as X,T as Me}from"./TimeFilter-BlQzQ35D.js";import{c as Ie}from"./school-hooks-CLtoQUF3.js";import{A as Ee}from"./arrow-left-BR6Ss_OD.js";import{X as ee}from"./x-Bl1ZJG9u.js";import{R as te,L as $e,C as se,X as ie,Y as re,T as ne,b as Ae,B as Pe,c as J}from"./recharts-Bt9rXYD7.js";import{C as D}from"./chevron-up-DDdQAgHM.js";import{C as M}from"./loader-circle-DDd2C8DT.js";import{C as oe}from"./chevron-right-BRiylkSq.js";import{T as Oe}from"./triangle-alert-OeijB30v.js";import{C as Ve}from"./clock-BS9V1IvW.js";import{A as Ke}from"./arrow-right-DKjd0lOa.js";import"./AssignmentAdder-CN4tCSWg.js";import"./ai-DvseSiLQ.js";import"./assignment-B4FxrTDo.js";import"./bluebonnet-Cv4uQ1yl.js";import"./communications-CC0Kyd-T.js";import"./ContactForm-B_RZiH29.js";import"./curriculum-_NDZww4O.js";import"./district-C0LGX8rZ.js";import"./it_onboarding-DQMDk536.js";import"./problems-Ms_HJndC.js";import"./standards-D97JtNAe.js";import"./apiHooks-DiwywtOq.js";import"./index-Dl9uMAbC.js";import"./search-B3ckJGGq.js";import"./SearchBar-Dy-v_5YP.js";import"./circle-alert-BDGpQBy6.js";import"./file-download-Cj7L2l2N.js";import"./csv-HrEr3YiY.js";import"./query_table-DrRuyyS2.js";import"./x_axis-CUmioXox.js";import"./ColumnFilter-CKFfu9DP.js";import"./Avatar-ROOz-uCU.js";import"./chevron-left-BL6Lv6fl.js";import"./Tooltip-DL4IyBcL.js";import"./info-Bu7qlLzy.js";import"./trash-2-sgS-waWc.js";import"./copy-C3fUur9E.js";import"./pencil-BEioFwND.js";import"./download-BNRZQyAy.js";import"./sparkles-DUoHvWK4.js";import"./send-C1PWct8j.js";import"./grip-vertical-Du4AKwbU.js";import"./index-qoe7yWvp.js";import"./plus-D6muH9cN.js";import"./rotate-ccw-Ck3IhOOR.js";import"./student_profile_path-CqaR3fjO.js";import"./district-hooks-CV1giW64.js";import"./common-BrsB4Z19.js";import"./tslib.es6-CMwweBXX.js";import"./hoist-non-react-statics.cjs-hhFT2_1f.js";import"./array--rEjq1cQ.js";import"./objectSpread2-B5i5h7FH.js";import"./tiny-invariant-BaFNuDhB.js";/** 2 * @license lucide-react v0.562.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Fe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ye=ge("user",Fe);function O({heading:s,body:i,onAdjustDateRange:o,minHeight:l}){return e.jsxs("div",{className:"flex flex-col items-center justify-center",style:{textAlign:"center",minHeight:l},children:[e.jsx("h3",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:500,color:j.text.muted,marginBottom:"4px"},children:s}),e.jsx("p",{style:{fontSize:"13px",lineHeight:"18px",fontWeight:400,color:j.text.disabled,maxWidth:"280px",marginBottom:o?"12px":void 0},children:i}),o&&e.jsx("button",{onClick:o,style:{fontSize:"14px",lineHeight:"20px",fontWeight:500,color:j.action.link,background:"none",border:"none",cursor:"pointer",padding:0},onMouseEnter:c=>c.currentTarget.style.textDecoration="underline",onMouseLeave:c=>c.currentTarget.style.textDecoration="none",children:"Adjust date range"})]})}const T={background:t.white,border:`1px solid ${t.gray200}`,borderRadius:"12px",boxShadow:"0 1px 2px rgba(31, 30, 26, 0.05)"};function E({showDivider:s}){return e.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",position:"relative",gap:"8px"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{whiteSpace:"nowrap"},children:[e.jsx(g,{style:{width:"80px",height:"12px",borderRadius:"4px"}}),e.jsx(g,{style:{width:"60px",height:"16px",borderRadius:"4px"}})]}),e.jsx(g,{style:{width:"48px",height:"28px",borderRadius:"4px"}}),e.jsx(g,{style:{width:"120px",height:"12px",borderRadius:"4px"}}),s&&e.jsx("div",{style:{position:"absolute",right:0,top:"20px",bottom:"20px",width:"1px",background:t.gray200}})]})}function Ue(){return e.jsxs("div",{style:{...T,display:"grid",gridTemplateColumns:"repeat(3, 1fr)",overflow:"hidden",height:"100%"},children:[e.jsx(E,{showDivider:!0}),e.jsx(E,{showDivider:!0}),e.jsx(E,{showDivider:!1})]})}function $({label:s,showDivider:i}){return e.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",position:"relative"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",color:t.gray500},children:s}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center"},children:e.jsx("p",{style:{fontSize:"28px",fontWeight:600,letterSpacing:"-0.5px",color:j.text.disabled,fontVariantNumeric:"tabular-nums"},children:"â"})}),i&&e.jsx("div",{style:{position:"absolute",right:0,top:"20px",bottom:"20px",width:"1px",background:t.gray200}})]})}function _e(){return e.jsxs("div",{style:{...T,display:"grid",gridTemplateColumns:"repeat(3, 1fr)",overflow:"hidden",height:"100%"},children:[e.jsx($,{label:"Total Incidents",showDivider:!0}),e.jsx($,{label:"Students with Incidents",showDivider:!0}),e.jsx($,{label:"Total Suspensions",showDivider:!1})]})}function qe(){return e.jsxs("div",{className:"flex flex-col",style:{...T,padding:"24px",height:"100%"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:"16
6px"},children:[e.jsx(g,{style:{width:"140px",height:"16px",borderRadius:"4px"}}),e.jsx("div",{className:"flex items-center",style:{gap:"10px"},children:Array.from({length:4}).map((s,i)=>e.jsx(g,{style:{width:"48px",height:"12px",borderRadius:"4px"}},i))})]}),e.jsxs("div",{style:{minHeight:"192px",position:"relative"},children:[Array.from({length:5}).map((s,i)=>e.jsx("div",{style:{position:"absolute",left:"40px",right:0,top:`${i*25}%`,height:"1px",background:t.gray200}},i)),Array.from({length:5}).map((s,i)=>e.jsx(g,{style:{position:"absolute",left:0,top:`${i*25-1}%`,width:"28px",height:"10px",borderRadius:"4px"}},`y-${i}`)),e.jsx("div",{className:"flex justify-between",style:{position:"absolute",bottom:0,left:"40px",right:0},children:Array.from({length:7}).map((s,i)=>e.jsx(g,{style:{width:"28px",height:"10px",borderRadius:"4px"}},`x-${i}`))})]})]})}function Ge({isNoDataAtAll:s,onAdjustDateRange:i}){return e.jsxs("div",{className:"flex flex-col",style:{...T,padding:"24px",height:"100%"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:"16px"},children:[e.jsx("h3",{style:{fontSize:"15px",lineHeight:"20px",fontWeight:500,color:t.gray900},children:"Incidents Over Time"}),e.jsx("div",{className:"flex items-center",style:{gap:"10px",fontSize:"12px",lineHeight:"16px"},children:["major","minor","susp","last yr"].map(o=>e.jsxs("div",{className:"flex items-center",style:{gap:"4px"},children:[e.jsx("span",{style:{width:"12px",height:"2px",background:j.text.disabled,borderRadius:"1px"}}),e.jsx("span",{style:{color:j.text.disabled},children:o})]},o))})]}),e.jsx(O,{heading:s?"No incident history":"No data for this time period",body:s?"Trend data will appear here once incidents are recorded.":"Try selecting a wider date range to see trends.",onAdjustDateRange:s?void 0:i,minHeight:"192px"})]})}const H={padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},Xe=[140,120,160,130,150];function Je(){return e.jsxs("div",{style:{...T,padding:"24px",height:"100%",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(g,{style:{width:"130px",height:"16px",borderRadius:"4px"}})}),e.jsx("div",{style:{flex:1,minHeight:0},children:e.jsxs("table",{style:{width:"100%",fontSize:"14px",tableLayout:"fixed"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}})]}),e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.gray300}`},children:[e.jsx("th",{style:H,children:"School"}),e.jsx("th",{style:H,children:"Total"}),e.jsx("th",{style:H,children:"Major"}),e.jsx("th",{style:H,children:"Minor"}),e.jsx("th",{style:H,children:"Susp"})]})}),e.jsx("tbody",{children:Array.from({length:5}).map((s,i)=>e.jsxs("tr",{style:{borderBottom:i<4?`1px solid ${t.gray200}`:void 0},children:[e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(g,{style:{width:`${Xe[i]}px`,height:"14px",borderRadius:"4px"}})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(g,{style:{width:"36px",height:"14px",borderRadius:"4px"}})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(g,{style:{width:"28px",height:"14px",borderRadius:"4px"}})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(g,{style:{width:"28px",height:"14px",borderRadius:"4px"}})}),e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(g,{style:{width:"24px",height:"14px",borderRadius:"4px"}})})]},i))})]})})]})}function le({isNoDataAtAll:s,onAdjustDateRange:i,isSchoolView:o}){const l=o?"staff":"school";return e.jsxs("div",{style:{...T,padding:"24px",height:"100%"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("h3",{style:{fontSize:"15px",lineHeight:"20px",fontWeight:500,color:t.gray900},children:o?"Incidents Reported by Staff":"Incidents by School"})}),e.jsx(O,{heading:s?`No ${l} data`:`No ${l} data for this time period`,body:s?`Incident data by ${l} will appear here once incidents are recorded.`:"Try selecting a wider date range.",onAdjustDateRange:s?void 0:i,minHeight:"200px"})]})}function Qe(){return e.jsxs("div",{className:"flex flex-col",style:{...T,padding:"24px",height:"100%"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:"16
6px"},children:[e.jsx(g,{style:{width:"200px",height:"16px",borderRadius:"4px"}}),e.jsx("div",{className:"flex items-center",style:{gap:"10px"},children:Array.from({length:2}).map((s,i)=>e.jsx(g,{style:{width:"80px",height:"12px",borderRadius:"4px"}},i))})]}),e.jsx("div",{style:{flex:1,minHeight:"192px",position:"relative"},children:e.jsx("div",{className:"flex items-end justify-around",style:{height:"100%",paddingTop:"16px"},children:Array.from({length:13}).map((s,i)=>e.jsx(g,{style:{width:"20px",height:`${30+i*17%60}%`,borderRadius:"3px 3px 0 0"}},i))})})]})}function Ze(){return e.jsxs("div",{style:{...T,padding:"24px",height:"100%"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("h3",{style:{fontSize:"15px",lineHeight:"20px",fontWeight:500,color:t.gray900},children:"Suspension Rate by Demographic"})}),e.jsx(O,{heading:"No suspension data",body:"Demographic suspension rates will appear here once data is available.",minHeight:"192px"})]})}const V={background:t.white,border:`1px solid ${t.gray200}`,borderRadius:"12px",boxShadow:"0 1px 2px rgba(31, 30, 26, 0.05)"},et=["65%","45%","75%","55%","80%","50%","60%"],tt=[280,240,300],st=[200,180,220];function it(){return e.jsx("div",{style:{...V,padding:"24px",height:"100%",display:"flex",flexDirection:"column"},children:e.jsxs("div",{className:"flex flex-col lg:flex-row",style:{gap:"24px",flex:1,minHeight:0},children:[e.jsxs("div",{className:"lg:w-72 flex-shrink-0 flex flex-col",style:{minHeight:0},children:[e.jsxs("div",{className:"flex items-start",style:{padding:"0 12px 8px",marginBottom:"8px",borderBottom:`1px solid ${t.gray200}`,gap:"8px"},children:[e.jsx("div",{style:{width:"20px"}}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{style:{width:"56px",textAlign:"center"},children:[e.jsx("span",{style:{fontSize:"10px",lineHeight:"14px",fontWeight:600,letterSpacing:"0.5px",color:t.gray500,display:"block"},children:"Trend"}),e.jsx("span",{style:{fontSize:"9px",lineHeight:"12px",fontWeight:400,color:t.gray400,display:"block"},children:"vs. last yr"})]}),e.jsx("div",{style:{width:"48px",textAlign:"right"},children:e.jsx("span",{style:{fontSize:"10px",lineHeight:"14px",fontWeight:600,letterSpacing:"0.5px",color:t.gray500,display:"block"},children:"Count"})})]}),e.jsx("div",{style:{flex:1,minHeight:0},children:Array.from({length:7}).map((s,i)=>e.jsxs("div",{className:"flex items-center",style:{padding:"8px 12px",gap:"8px",borderBottom:`1px solid ${t.gray200}`},children:[e.jsx("div",{style:{width:"20px"},children:e.jsx(g,{style:{width:"20px",height:"14px",borderRadius:"4px"}})}),e.jsx("div",{style:{flex:1},children:e.jsx(g,{style:{width:et[i],height:"14px",borderRadius:"4px"}})}),e.jsx("div",{style:{width:"56px",display:"flex",justifyContent:"center"},children:e.jsx(g,{style:{width:"40px",height:"14px",borderRadius:"4px"}})}),e.jsx("div",{style:{width:"48px",display:"flex",justifyContent:"flex-end"},children:e.jsx(g,{style:{width:"32px",height:"14px",borderRadius:"4px"}})})]},i))})]}),e.jsxs("div",{className:"flex-1",style:{borderLeft:`1px solid ${t.gray200}`,paddingLeft:"24px",minHeight:0},children:[e.jsx(g,{style:{width:"100%",height:"44px",borderRadius:"8px",marginBottom:"16px"}}),Array.from({length:3}).map((s,i)=>e.jsxs("div",{style:{padding:"16px 0",borderBottom:i<2?`1px solid ${t.gray200}`:"none"},children:[e.jsx(g,{style:{width:"120px",height:"14px",borderRadius:"4px",marginBottom:"8px"}}),e.jsx(g,{style:{width:`${tt[i]}px`,height:"14px",borderRadius:"4px",marginBottom:"8px"}}),e.jsx(g,{style:{width:`${st[i]}px`,height:"12px",borderRadius:"4px"}})]},i))]})]})})}function rt({isNoDataAtAll:s,onAdjustDateRange:i}){return e.jsx("div",{style:{...V,padding:"24px",height:"100%",display:"flex",flexDirection:"column"},children:e.jsxs("div",{className:"flex flex-col lg:flex-row",style:{gap:"24px",flex:1,minHeight:0},children:[e.jsxs("div",{className:"lg:w-72 flex-shrink-0 flex flex-col items-center justify-center",style:{minHeight:0},children:[e.jsx("h3",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:500,color:j.text.muted,marginBottom:"4px"},children:s?"No incidents recorded":"No incidents in this time period"}),e.jsx("p",{style:{fontSize:"13px",lineHeight:"18px",fontWeight:400,color:j.text.disabled,maxWidth:"280px",textAlign:"center",marginBottom:"12px"},children:s?"There aren't enough incident themes for this time period.":"Try selecting a wider date range to see incident themes."}),!s&&i&&e.jsx("button",{onClick:i,style:{fontSize:"14px",lineHeight:"20px",fontWeight:500,color:j.action.link,background:"none",border:"none",cursor:"pointer",padding:0},onMouseEnter:o=>o.currentTarget.style.textDecoration="underline",onMouseLeave:o=>o.currentTarget.style.textDecoration="none",children:"Adjust date range"})]}),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{borderLeft:`1px solid ${t.gray200}`,paddingLeft:"24px",minHeight:0},children:[e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:t.gray400,marginBottom:"12px"},children:[e.jsx("rect",{x:"8",y:"10",width:"32",height:"28",rx:"3"}),e.jsx("line",{x1:"8",y1:"22",x2:"40",y2:"22"})]}),e.jsx("h3",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:600,color:j.text.heading,marginBottom:"4px"},children:"Nothing to show"}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:400,color:j.text.secondary,maxWidth:"280px",textAlign:"center"},children:"Incident details will appear here once data is available."})]})]})})}function nt({onRetry:s}){const[i,o]=h.useState(!1);return e.jsx("div",{style:{...V,height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{className:"flex flex-col items-center",style:{textAlign:"center"},children:[e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:t.red700,marginBottom:"12px"},children:[e.jsx("circle",{cx:"24",cy:"24",r:"20"}),e.jsx("line",{x1:"18",y1:"18",x2:"30",y2:"30"}),e.jsx("line",{x1:"30",y1:"18",x2:"18",y2:"30"})]}),e.jsx("h3",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:600,color:j.text.heading,marginBottom:"4px"},children:"Unable to load incident data"}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:400,color:j.text.secondary,maxWidth:"280px",marginBottom:"16
6px"},children:"Something went wrong while fetching incident themes. Please try again."}),e.jsxs("button",{onClick:s,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:"4px",background:i?j.action.primaryHover:j.action.primary,color:j.action.primaryText,borderRadius:"12px",padding:"8px 16px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",transition:"background 150ms"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 7A5 5 0 1 1 10.5 3.5"}),e.jsx("path",{d:"M12 2V5H9"})]}),"Retry"]})]})})}function ot(s){return s.replace(/\bHigh School\b/g,"HS").replace(/\bMiddle School\b/g,"MS").replace(/\bElementary School\b/g,"ES").replace(/\bElementary\b/g,"ES").replace(/\bHigh\b/g,"HS").replace(/\bMiddle\b/g,"MS")}const z={background:t.white,border:`1px solid ${t.gray200}`,borderRadius:"12px",boxShadow:"0 1px 2px rgba(31, 30, 26, 0.05)"},Q=[{dataKey:"major",label:"Major",tooltipLabel:"Major",color:t.orange500},{dataKey:"minor",label:"Minor",tooltipLabel:"Minor",color:t.yellow400},{dataKey:"suspensions",label:"Susp.",tooltipLabel:"Suspensions",color:t.violet400}];function lt({incident:s,onClose:i}){return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto scrollbar-thin",children:e.jsxs("div",{className:"flex min-h-full items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0",style:{background:"rgba(31, 30, 26, 0.5)"},onClick:i}),e.jsxs("div",{className:"relative w-full max-w-2xl",style:{background:t.white,borderRadius:"12px",boxShadow:"0 20px 25px -5px rgba(31, 30, 26, 0.1)"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4",style:{borderBottom:`1px solid ${t.gray200}`},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex items-center justify-center",style:{width:"40px",height:"40px",borderRadius:"50%",background:s.severity==="Major"?t.red50:t.yellow50},children:s.severity==="Major"?e.jsx(Oe,{style:{width:"20px",height:"20px",color:t.red500}}):e.jsx(Ve,{style:{width:"20px",height:"20px",color:t.yellow600}})}),e.jsxs("div",{children:[e.jsxs("h2",{style:{fontSize:"18px",lineHeight:"24px",fontWeight:600,color:t.gray900},children:["Incident #",s.id]}),e.jsx("p",{style:{fontSize:"14px",color:t.gray500},children:s.category})]})]}),e.jsx("button",{onClick:i,className:"p-2 rounded-lg cursor-pointer","aria-label":"Close incident detail",style:{transition:"background 150ms"},onMouseEnter:o=>o.currentTarget.style.background=t.gray100,onMouseLeave:o=>o.currentTarget.style.background="transparent",children:e.jsx(ee,{style:{width:"20px",height:"20px",color:t.gray500}})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ve,{severity:s.severity}),e.jsx(Se,{status:s.status}),s.parentNotified&&e.jsx(q,{variant:"success",children:"Parent Notified"})]}),e.jsx("div",{style:{background:t.gray50,borderRadius:"8px",padding:"16px"},children:e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"flex items-center justify-center",style:{width:"40px",height:"40px",borderRadius:"50%",background:"#EFF6FF"},children:e.jsx(Ye,{style:{width:"20px",height:"20px",color:"#2563EB"}})}),e.jsxs("div",{children:[e.jsx(P,{href:`/students/${s.studentId}`,style:{fontSize:"14px",fontWeight:500,color:t.gray900},children:s.studentName}),e.jsxs("p",{style:{fontSize:"12px",color:t.gray500},children:[s.grade?`Grade ${s.grade}`:"Grade N/A"," ","⢠",s.school]})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:"14px"},children:[e.jsx(me,{style:{width:"16px",height:"16px",color:t.gray400}}),e.jsxs("span",{style:{color:t.gray600},children:[s.date,s.time&&` at ${s.time}`]})]}),e.jsxs("div",{className:"flex items-center gap-2",style:{fontSize:"14px"},children:[e.jsx(ue,{style:{width:"16px",height:"16px",color:t.gray400}}),e.jsx("span",{style:{color:t.gray600},children:s.location})]})]}),e.jsxs("div",{children:[e.jsx("h4",{style:{fontSize:"14px",fontWeight:500,color:t.gray700,marginBottom:"4px"},children:"Description"}),e.jsx("p",{style:{fontSize:"14px",color:t.gray600,background:t.gray50,borderRadius:"8px",padding:"12px"},children:s.description})]}),s.actionTaken&&e.jsxs("div",{children:[e.jsx("h4",{style:{fontSize:"14px",fontWeight:500,color:t.gray700,marginBottom:"4px"},children:"Action Taken"}),e.jsx("p",{style:{fontSize:"14px",color:t.gray600,background:t.gray50,borderRadius:"8px",padding:"12px"},children:s.actionTaken})]}),s.consequences&&s.consequences.length>0&&e.jsxs("div",{children:[e.jsx("h4",{style:{fontSize:"14px",fontWeight:500,color:t.gray700,marginBottom:"8px"},children:"Consequences"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.consequences.map((o,l)=>e.jsx(q,{variant:"error",children:o},l))})]}),e.jsx("div",{style:{paddingTop:"8px",borderTop:`1px solid ${t.gray200}`},children:e.jsxs("p",{style:{fontSize:"12px",color:t.gray500},children:["Reported by:"," ",e.jsx("span",{style:{fontWeight:500,color:t.gray700},children:s.reportedBy})]})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4",style:{borderTop:`1px solid ${t.gray200}`,background:t.gray50,borderRadius:"0 0 12px 12px"},children:[e.jsx("div",{className:"flex items-center gap-2",children:!s.parentNotified&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm btn-secondary",children:[e.jsx(fe,{className:"w-4 h-4"}),"Call Parent"]}),e.jsxs("button",{className:"btn btn-sm btn-secondary",children:[e.jsx(De,{className:"w-4 h-4"}),"Email Parent"]})]})}),e.jsxs(P,{href:`/students/${s.studentId}`,className:"btn btn-sm",style:{background:t.yellow400,color:t.gray900},children:["View Student Profile",e.jsx(Ke,{className:"w-4 h-4"})]})]})]})]})})}function at({text:s,style:i}){const o=h.useRef(null),l=h.useRef(null),c=()=>{const a=o.current,v=l.current;if(!a||!v)return;const m=v.scrollWidth-a.clientWidth+32;m>0&&(a.classList.add("is-overflowing"),a.style.setProperty("--scroll-distance",`-${m}px`))},y=()=>{const a=o.current;a&&a.classList.remove("is-overflowing")};return e.jsx("td",{ref:o,style:i,title:s,className:"school-name-cell",onMouseEnter:c,onMouseLeave:y,children:e.jsx("span",{ref:l,className:"school-name-text",children:s})})}function A(s){return s==="schoolYear"?"year":s==="week"?"week":"period"}function dt({metrics:s,extendedMetrics:i,timePreset:o,suspensionRate:l}
6){return e.jsxs("div",{style:{...z,display:"grid",gridTemplateColumns:"repeat(3, 1fr)",overflow:"hidden",height:"100%"},children:[e.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",position:"relative"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",color:t.gray500},children:"Total Incidents"}),(()=>{const c=i.incidentsChange,y=c>0;return e.jsxs("span",{style:{fontSize:"11px",fontWeight:500,padding:"1px 6px",borderRadius:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0,background:y?t.red50:t.green50,color:y?t.red700:t.green700},children:[c>0?"+":"",c," vs last ",A(o)]})})()]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center"},children:e.jsx("p",{style:{fontSize:"28px",fontWeight:600,letterSpacing:"-0.5px",color:t.gray900,fontVariantNumeric:"tabular-nums"},children:s.totalIncidents.toLocaleString()})}),e.jsxs("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:"12px",lineHeight:"16px"},children:[e.jsxs("span",{style:{fontWeight:600,color:t.gray600},children:[i.officeReferrals.toLocaleString()," referrals"]}),e.jsxs("span",{style:{color:t.gray500},children:[" / ",e.jsx("span",{style:{fontWeight:500},children:s.majorIncidents.toLocaleString()})," ","major"]})]}),e.jsx("div",{style:{position:"absolute",right:0,top:"20px",bottom:"20px",width:"1px",background:t.gray200}})]}),e.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",position:"relative"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",color:t.gray500},children:"Students with Incidents"}),(()=>{const c=i.studentsChange,y=c>0;return e.jsxs("span",{style:{fontSize:"11px",fontWeight:500,padding:"1px 6px",borderRadius:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0,background:y?t.red50:t.green50,color:y?t.red700:t.green700},children:[c>0?"+":"",c," vs last ",A(o)]})})()]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center"},children:e.jsx("p",{style:{fontSize:"28px",fontWeight:600,letterSpacing:"-0.5px",color:t.gray900,fontVariantNumeric:"tabular-nums"},children:i.uniqueStudents.toLocaleString()})}),e.jsxs("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:"12px",lineHeight:"16px"},children:[e.jsxs("span",{style:{fontWeight:600,color:t.gray600},children:[i.repeatStudents.toLocaleString()," repeat"]}),e.jsxs("span",{style:{color:t.gray500},children:[" / ",e.jsxs("span",{style:{fontWeight:500},children:[i.totalEnrollment?Math.round(i.uniqueStudents/i.totalEnrollment*100):0,"%"]})," ","of enrolled"]})]}),e.jsx("div",{style:{position:"absolute",right:0,top:"20px",bottom:"20px",width:"1px",background:t.gray200}})]}),e.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",color:t.gray500},children:"Total Suspensions"}),(()=>{const c=i.suspensionsChange,y=c<0;return e.jsxs("span",{style:{fontSize:"11px",fontWeight:500,padding:"1px 6px",borderRadius:"4px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexShrink:1,minWidth:0,background:y?t.green50:t.red50,color:y?t.green700:t.red700},children:[c>0?"+":"",c," vs last ",A(o)]})})()]}),e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center"},children:e.jsx("p",{style:{fontSize:"28px",fontWeight:600,letterSpacing:"-0.5px",color:t.gray900,fontVariantNumeric:"tabular-nums"},children:s.suspensions.toLocaleString()})}),e.jsxs("div",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:"12px",lineHeight:"16px"},children:[e.jsxs("span",{style:{fontWeight:600,color:t.gray600}
6,children:[s.outOfSchoolSuspensions.toLocaleString()," out-of-school"]}),e.jsxs("span",{style:{color:t.gray500},children:[" / ",e.jsx("span",{style:{fontWeight:500},children:s.inSchoolSuspensions.toLocaleString()})," ","in-school"]}),s.unspecifiedSuspensions>0&&e.jsxs("span",{style:{color:t.gray500},children:[" / ",e.jsx("span",{style:{fontWeight:500},children:s.unspecifiedSuspensions.toLocaleString()})," ","unspecified"]}),l!==null&&e.jsxs("span",{style:{color:t.gray500},children:[" · ",e.jsxs("span",{style:{fontWeight:500},children:[l,"%"]})," of enrolled"]})]})]})]})}function ct({incidentsTrend:s,isNoDataAtAll:i,onAdjustDateRange:o}){return s.length===0?e.jsx(Ge,{isNoDataAtAll:i,onAdjustDateRange:o}):e.jsxs("div",{className:"flex flex-col",style:{...z,padding:"24px",height:"100%"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:"16px"},children:[e.jsx("h3",{style:f.title,children:"Incidents Over Time"}),e.jsx("div",{className:"flex items-center",style:{gap:"10px",fontSize:"12px",lineHeight:"16px"},children:Q.map(l=>e.jsxs("div",{className:"flex items-center",style:{gap:"4px"},children:[e.jsx("span",{style:{width:"12px",height:"2px",background:l.color,borderRadius:"1px"}}),e.jsx("span",{style:{color:t.gray600},children:l.label})]},l.dataKey))})]}),e.jsx("div",{className:"flex-1",style:{minHeight:0},children:e.jsx(te,{width:"100%",height:"100%",children:e.jsxs($e,{data:s,margin:{top:5,right:20,left:0,bottom:5},children:[e.jsx(se,{strokeDasharray:"0",stroke:t.gray200,vertical:!1}),e.jsx(ie,{dataKey:"label",tick:{fontSize:11,fill:t.gray500},tickLine:!1,axisLine:!1,interval:s.length<=10?0:Math.ceil(s.length/8)-1,tickFormatter:l=>/^\d{4}-\d{2}-\d{2}$/.test(l)?new Date(l+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"}):l,tickMargin:4}),e.jsx(re,{tick:{fontSize:11,fill:t.gray500},tickLine:!1,axisLine:!1,width:40}),e.jsx(ne,{contentStyle:f.tooltip,labelStyle:f.tooltipLabel,itemStyle:f.tooltipItem,labelFormatter:l=>/^\d{4}-\d{2}-\d{2}$/.test(l)?new Date(l+"T00:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):l,formatter:(l,c)=>[l??0,c??""]}),Q.map(l=>e.jsx(Ae,{type:"monotone",dataKey:l.dataKey,stroke:l.color,strokeWidth:2,dot:!1,name:l.tooltipLabel},l.dataKey))]})})})]})}function xt({incidentsBySchool:s,schoolNameById:i,schoolIdByName:o,onSchoolClick:l,isNoDataAtAll:c,onAdjustDateRange:y}){const[a,v]=h.useState("total"),[m,u]=h.useState("desc"),S=n=>{a===n?u(p=>p==="asc"?"desc":"asc"):(v(n),u(n==="school"?"asc":"desc"))},k=h.useMemo(()=>[...s].sort((n,p)=>{let r=0;if(a==="school"){const b=i[n.school]??n.school,N=i[p.school]??p.school;r=b.localeCompare(N)}else r=(n[a]??0)-(p[a]??0);return m==="asc"?r:-r}),[a,m,s,i]);return s.length===0?e.jsx(le,{isNoDataAtAll:c,onAdjustDateRange:y,isSchoolView:!1}):e.jsxs("div",{style:{...z,padding:"24px",height:"100%",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("h3",{style:f.title,children:"Incidents by School"})}),e.jsx("div",{className:"overflow-y-auto scrollbar-thin",style:{flex:1,minHeight:0},children:e.jsxs("table",{style:{width:"100%",fontSize:"14px",tableLayout:"fixed"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"32px"}})]}),e.jsx("thead",{style:{background:t.gray50,position:"sticky",top:0,zIndex:1},children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.gray300}`},children:[e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:e.jsxs("button",{onClick:()=>S("school"),className:"flex items-center cursor-pointer",style:{gap:"4px",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500,transition:"color 150ms"},onMouseEnter:n=>n.currentTarget.style.color=t.gray700,onMouseLeave:n=>n.currentTarget.style.color=t.gray500,children:["School"," ",m==="asc"?e.jsx(D,{style:{width:"12px",height:"12px",visibility:a==="school"?"visible":"hidden"}}):e.jsx(M,{style:{width:"12px",height:"12px",visibility:a==="school"?"visible":"hidden"}})]})}),e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:e.jsxs("button",{onClick:()=>S("total"),className:"flex items-center cursor-pointer",style:{gap:"4px",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500,transition:"color 150ms"},onMouseEnter:n=>n.currentTarget.style.color=t.gray700,onMouseLeave:n=>n.currentTarget.style.color=t.gray500,children:["Total"," ",m==="asc"?e.jsx(D,{style:{width:"12px",height:"12px",visibility:a==="total"?"visible":"hidden"}}):e.jsx(M,{style:{width:"12px",height:"12px",visibility:a==="total"?"visible":"hidden"}})]})}),["major","minor","suspensions"].map(n=>e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:e.jsxs("button",{onClick:()=>S(n),className:"flex items-center cursor-pointer",style:{gap:"4px",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500,transition:"color 150ms"},onMouseEnter:p=>p.currentTarget.style.color=t.gray700,onMouseLeave:p=>p.currentTarget.style.color=t.gray500,children:[n==="suspensions"?"Susp":n.charAt(0).toUpperCase()+n.slice(1)," ",m==="asc"?e.jsx(D,{style:{width:"12px",height:"12px",visibility:a===n?"visible":"hidden"}}):e.jsx(M,{style:{width:"12px",height:"12px",visibility:a===n?"visible":"hidden"}})]})}
6,n)),e.jsx("th",{})]})}),e.jsx("tbody",{children:k.map(n=>e.jsxs("tr",{onClick:()=>{const p=i[n.school]?n.school:o[n.school]??n.school,r=i[n.school]??n.school;l(p,r)},className:"cursor-pointer",style:{borderBottom:`1px solid ${t.gray200}`,transition:"background 150ms"},onMouseEnter:p=>{p.currentTarget.style.background=t.gray50;const r=p.currentTarget.querySelector(".chevron-nav");r&&(r.style.color=t.gray500)},onMouseLeave:p=>{p.currentTarget.style.background="transparent";const r=p.currentTarget.querySelector(".chevron-nav");r&&(r.style.color=t.gray300)},children:[e.jsx(at,{text:ot(i[n.school]??n.school),style:{padding:"10px 16px",fontWeight:400,color:t.gray800}}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:600,color:t.gray900,fontVariantNumeric:"tabular-nums"},children:n.total.toLocaleString()}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray500,fontVariantNumeric:"tabular-nums"},children:n.major.toLocaleString()}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray500,fontVariantNumeric:"tabular-nums"},children:n.minor.toLocaleString()}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray500,fontVariantNumeric:"tabular-nums"},children:(n.suspensions??0).toLocaleString()}),e.jsx("td",{style:{padding:"10px 4px 10px 0",textAlign:"center"},children:e.jsx(oe,{className:"chevron-nav",style:{width:"14px",height:"14px",color:t.gray300,transition:"color 150ms"}})})]},n.school))})]})})]})}function pt({staffData:s,isNoDataAtAll:i,onAdjustDateRange:o}){return s.length===0?e.jsx(le,{isNoDataAtAll:i,onAdjustDateRange:o,isSchoolView:!0}):e.jsxs("div",{style:{...z,padding:"24px",height:"100%",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx("h3",{style:f.title,children:"Incidents Reported by Staff"})}),e.jsx("div",{className:"overflow-auto scrollbar-thin",style:{flex:1,minHeight:0},children:e.jsxs("table",{style:{width:"100%",fontSize:"14px",tableLayout:"fixed"},children:[e.jsxs("colgroup",{children:[e.jsx("col",{}),e.jsx("col",{style:{width:"88px"}}),e.jsx("col",{style:{width:"72px"}}),e.jsx("col",{style:{width:"72px"}})]}),e.jsx("thead",{style:{position:"sticky",top:0,background:t.gray50,zIndex:1},children:e.jsxs("tr",{style:{borderBottom:`1px solid ${t.gray300}`},children:[e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:"Name"}),e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:"Role"}),e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:"Reported"}),e.jsx("th",{style:{padding:"8px 16px",textAlign:"left",fontSize:"11px",lineHeight:"16px",fontWeight:600,color:t.gray500},children:"Involved"})]})}),e.jsx("tbody",{children:s.map(l=>e.jsxs("tr",{style:{borderBottom:`1px solid ${t.gray200}`,transition:"background 150ms"},onMouseEnter:c=>c.currentTarget.style.background=t.gray50,onMouseLeave:c=>c.currentTarget.style.background="transparent",children:[e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray800,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:l.name,children:l.name}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.role}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:600,color:t.gray900,fontVariantNumeric:"tabular-nums"},children:l.incidentsReported.toLocaleString()}),e.jsx("td",{style:{padding:"10px 16px",fontWeight:400,color:t.gray500,fontVariantNumeric:"tabular-nums"},children:l.incidentsInvolved.toLocaleString()})]},l.name))})]})})]})}function ht({incidentKeywords:s,keywordIncidents:i,keywordInsights:o,viewMode:l,timePreset:c,timeFilter:y,isNoDataAtAll:a,onAdjustDateRange:v}){var k;const[m,u]=h.useState(""),S=((k=s[0])==null?void 0:k.keyword)??"";return h.useEffect(()=>{S&&!m&&u(S)},[S,m]),s.length===0?e.jsx(rt,{isNoDataAtAll:a,onAdjustDateRange:v}):e.jsxs("div",{style:{...z,padding:"24px",height:"100%",display:"flex",flexDirection:"column"}
6,children:[e.jsx("h3",{style:{...f.title,marginBottom:"16px"},children:"Top Incident Themes"}),e.jsxs("div",{className:"flex flex-col lg:flex-row",style:{gap:"24px",flex:1,minHeight:0},children:[e.jsxs("div",{className:"lg:w-[345px] flex-shrink-0 flex flex-col",style:{minHeight:0},children:[e.jsxs("div",{className:"flex items-start",style:{padding:"0 12px 8px",marginBottom:"8px",borderBottom:`1px solid ${t.gray200}`,gap:"8px"},children:[e.jsx("div",{style:{width:"20px"}}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{style:{width:"56px",textAlign:"center"},children:[e.jsx("span",{style:{fontSize:"10px",lineHeight:"14px",fontWeight:600,letterSpacing:"0.5px",color:t.gray500,display:"block"},children:"Trend"}),e.jsxs("span",{style:{fontSize:"9px",lineHeight:"12px",fontWeight:400,color:t.gray400,display:"block"},children:["vs. last"," ",c==="schoolYear"?"yr":c==="week"?"wk":"period"]})]}),e.jsx("div",{style:{width:"48px",textAlign:"right"},children:e.jsx("span",{style:{fontSize:"10px",lineHeight:"14px",fontWeight:600,letterSpacing:"0.5px",color:t.gray500,display:"block"},children:"Count"})})]}),e.jsx("div",{className:"scrollbar-thin flex-1",style:{overflowY:"auto",minHeight:0},children:s.map((n,p)=>{const r=n.keyword===m;return e.jsxs("button",{onClick:()=>u(n.keyword),className:"w-full text-left flex items-center cursor-pointer",style:{padding:"8px 12px",gap:"8px",transition:"all 150ms",background:r?t.gray100:"transparent",borderLeft:r?`3px solid ${t.yellow400}`:"3px solid transparent",borderBottom:`1px solid ${t.gray200}`},onMouseEnter:b=>{r||(b.currentTarget.style.background=t.gray50)},onMouseLeave:b=>{r||(b.currentTarget.style.background="transparent")},children:[e.jsx("span",{style:{width:"20px",fontSize:"14px",lineHeight:"20px",fontWeight:400,color:t.gray500,fontVariantNumeric:"tabular-nums"},children:p+1}),e.jsx("span",{className:"truncate",style:{flex:1,fontSize:"14px",lineHeight:"20px",fontWeight:r?600:400,color:r?t.gray900:t.gray800,textTransform:"capitalize",minWidth:0},title:n.keyword,children:n.keyword}),e.jsxs("span",{className:"flex items-center justify-center",style:{width:"56px",gap:"2px",fontSize:"12px",lineHeight:"16px",fontWeight:500,fontVariantNumeric:"tabular-nums",color:n.trend==="up"?t.red500:n.trend==="down"?t.green500:t.gray800},children:[n.trend==="up"&&e.jsxs(e.Fragment,{children:[e.jsx(D,{style:{width:"12px",height:"12px"}}),n.changePercent,"%"]}),n.trend==="down"&&e.jsxs(e.Fragment,{children:[e.jsx(M,{style:{width:"12px",height:"12px"}}),n.changePercent,"%"]}),n.trend==="neutral"&&e.jsx("span",{style:{color:t.gray400},children:"â"})]}),e.jsx("span",{style:{width:"48px",textAlign:"right",fontSize:"14px",lineHeight:"20px",fontWeight:400,color:t.gray900,fontVariantNumeric:"tabular-nums"},children:n.count.toLocaleString()})]},n.keyword)})})]}),e.jsxs("div",{className:"flex-1 flex flex-col",style:{borderLeft:`1px solid ${t.gray200}`,paddingLeft:"24px",minHeight:0},children:[(o==null?void 0:o[m])&&e.jsxs("div",{className:"flex items-start flex-shrink-0",style:{gap:"8px",padding:"12px",background:t.yellow50,borderRadius:"8px",marginBottom:"16px"},children:[e.jsx(Be,{style:{width:"16px",height:"16px",color:t.yellow600,flexShrink:0,marginTop:"2px"}}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:400,color:t.gray800},children:o==null?void 0:o[m]})]}),e.jsx("div",{className:"scrollbar-thin",style:{flex:1,overflowY:"auto",minHeight:0},children:(()=>{const p=i.filter(r=>r.keyword===m).slice(0,10);return p.length>0?p.map((r,b)=>e.jsxs("div",{style:{padding:"16px 0",borderBottom:b<p.length-1?`1px solid ${t.gray200}`:"none"},children:[e.jsxs("div",{className:"flex items-start justify-between",style:{gap:"8px",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:600,color:t.gray900},children:l==="school"?r.studentName:r.school}),e.jsx("span",{style:{fontSize:"11px",lineHeight:"14px",fontWeight:500,padding:"2px 8px",borderRadius:"4px",flexShrink:0,background:r.severity==="Major"?t.red50:t.yellow50,color:r.severity==="Major"?t.red700:t.yellow600},children:r.severity})]}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"20px",fontWeight:400,color:t.gray800,marginBottom:"8px"},className:"line-clamp-2",children:r.description}),e.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"12px",fontSize:"12px",lineHeight:"16px",color:t.gray500},children:[l==="school"&&e.jsx("span",{children:r.school}),r.grade?e.jsxs("span",{children:["Grade ",r.grade]}):null,e.jsx("span",{children:r.location}),e.jsx("span",{children:r.date}),e.jsxs("span",{children:["Reported by ",r.reportedBy]})]})]},`${r.id}-${b}`)):e.jsx("p",{style:{fontSize:"14px",color:t.gray400,padding:"24px 0",textAlign:"center"},children:"No incidents recorded for this keyword"})})()}),e.jsx("div",{className:"flex-shrink-0",style:{paddingTop:"12px",borderTop:`1px solid ${t.gray200}`},children:e.jsxs(P,{href:"/behavior/incidents",state:{from:"behavior-overview",themeKeyword:m,timeFilter:y},className:"btn btn-ghost btn-sm",children:["View all"," ",e.jsx("span",{style:{textTransform:"capitalize"},children:m}
6)," ","incidents",e.jsx(oe,{style:{width:"14px",height:"14px"}})]})})]})]})]})}function gt({data:s}){if(s.length===0)return e.jsx(Ze,{});const i=s.filter(a=>a.rate>0||a.prevRate>0).map(a=>a.category==="race"?{...a,group:Z(a.group)??a.group}:a),o=Math.max(...i.flatMap(a=>[a.rate,a.prevRate])),l=5,y=Math.ceil((o+1)/(l-1))*(l-1);return e.jsxs("div",{className:"flex flex-col",style:{...z,padding:"24px",height:"100%"},children:[e.jsxs("div",{className:"flex items-center justify-between",style:{marginBottom:"16px"},children:[e.jsx("h3",{style:f.title,children:"Suspension Rate by Demographic"}),e.jsxs("div",{className:"flex items-center",style:{gap:"12px",fontSize:"12px",lineHeight:"16px"},children:[e.jsxs("div",{className:"flex items-center",style:{gap:"4px"},children:[e.jsx("span",{style:{width:"12px",height:"8px",borderRadius:"2px",background:t.blue200}}),e.jsx("span",{style:{color:t.gray600},children:"Previous Period"})]}),e.jsxs("div",{className:"flex items-center",style:{gap:"4px"},children:[e.jsx("span",{style:{width:"12px",height:"8px",borderRadius:"2px",background:t.blue400}}),e.jsx("span",{style:{color:t.gray600},children:"This Period"})]})]})]}),e.jsx("div",{style:{flex:1,minHeight:0},children:e.jsx(te,{width:"100%",height:"100%",children:e.jsxs(Pe,{data:i,margin:{top:4,right:8,left:0,bottom:0},barGap:2,barCategoryGap:"20%",children:[e.jsx(se,{stroke:f.grid.stroke,strokeDasharray:f.grid.strokeDasharray,vertical:f.grid.vertical}),e.jsx(ie,{dataKey:"group",tick:f.axis.tick,tickLine:f.axis.tickLine,axisLine:f.xAxisLine,interval:0,angle:-30,textAnchor:"end",height:50}),e.jsx(re,{tick:f.axis.tick,tickLine:f.axis.tickLine,axisLine:f.axis.axisLine,domain:[0,y],tickCount:l,tickFormatter:a=>`${a}%`,width:40}),e.jsx(ne,{cursor:{fill:"rgba(0, 0, 0, 0.04)"},content:({active:a,payload:v,label:m})=>{var S;if(!a||!(v!=null&&v.length))return null;const u=(S=v[0])==null?void 0:S.payload;return e.jsxs("div",{style:{...f.tooltip,padding:"8px 12px"},children:[e.jsx("p",{style:{...f.tooltipLabel,fontWeight:600,margin:"0 0 4px"},children:m}),e.jsxs("p",{style:{...f.tooltipItem,margin:0},children:["This Period: ",u.rate,"% (",u.suspended,"/",u.enrolled,")"]}),e.jsxs("p",{style:{...f.tooltipItem,margin:0},children:["Previous Period: ",u.prevRate,"%"]})]})}}),e.jsx(J,{dataKey:"prevRate",name:"Previous Period",fill:t.blue200,radius:[4,4,0,0],maxBarSize:32}),e.jsx(J,{dataKey:"rate",name:"This Period",fill:t.blue400,radius:[4,4,0,0],maxBarSize:32})]})})})]})}function ks(){const{data:s}=je(),i=(s==null?void 0:s.schools)??[],{selectedSchoolId:o,setSelectedSchoolId:l,schoolOptions:c}=Ie("dip"),y=o!=="all"?"school":"district",a=h.useMemo(()=>Object.fromEntries(i.map(d=>[d.id,d.name])),[i]),v=h.useMemo(()=>Object.fromEntries(i.map(d=>[d.name,d.id])),[i]),m=o!=="all"?o:void 0,[u,S]=h.useState({preset:"schoolYear"}),k=s==null?void 0:s.schoolYearStartDate,n=h.useMemo(()=>{const d=X(u,k);if(d.start&&d.end)return{startDate:G(d.start.toDate()),endDate:G(d.end.toDate())}},[u,k]),p=be(m,n),r=p.data,b=p.error,N=h.useCallback(()=>{var d;(d=p.mutate)==null||d.call(p)},[p]),[K,ae]=h.useState(null),[F,I]=h.useState(null),W=h.useRef(null),Y=h.useCallback(d=>{W.current&&clearTimeout(W.current),I(d),W.current=setTimeout(()=>I(null),5e3)},[]),L=h.useCallback(()=>{W.current&&clearTimeout(W.current),I(null)},[]);h.useEffect(()=>{y==="district"&&L()},[y,L]),h.useEffect(()=>()=>{W.current&&clearTimeout(W.current)},[]);const C=h.useRef(null),[yt,de]=h.useState(!1);h.useEffect(()=>{const d=new IntersectionObserver(([w])=>{de(!w.isIntersecting)},{threshold:0,rootMargin:"-1px 0px 0px 0px"});return C.current&&d.observe(C.current),()=>d.disconnect()},[]);const ce=()=>{var d;return(d=C.current)==null?void 0:d.scrollIntoView({behavior:"smooth"})},U=h.useCallback((d,w)=>{l(d),Y(w)},[l,Y]),xe=h.useMemo(()=>{const w=r&&r.metrics.totalIncidents===0&&r.incidentsTrend.length===0&&r.incidentsBySchool.length===0&&u.preset==="schoolYear",R=w?void 0:ce;return[{id:"kpi-bar",type:"fixed",x:0,y:0,w:12,h:2,render:()=>r?r.metrics.totalIncidents===0?e.jsx(_e,{}):e.jsx(dt,{metrics:r.metrics,extendedMetrics:r.extendedMetrics,timePreset:u.preset,suspensionRate:r.suspensionDemographicData.length>0?r.suspensionDemographicData[0].rate:null}):b?e.jsx(B,{heading:"Unable to load summary",onRetry:N}):e.jsx(Ue,{})},{id:"incidents-over-time",type:"fixed",x:0,y:2,w:6,h:4,render:()=>r?e.jsx(ct,{incidentsTrend:r.incidentsTrend,isNoDataAtAll:!!w,onAdjustDateRange:R}):b?e.jsx(B,{heading:"Unable to load trend data",onRetry:N}):e.jsx(qe,{}),getCSVData:()=>({title:"Incidents Over Time",columns:["Date","Minor","Major","Suspensions"],rows:((r==null?void 0:r.incidentsTrend)??[]).map(x=>[x.label,x.minor,x.major,x.suspensions])})},{id:"incidents-by-school",type:"fixed",x:6,y:2,w:6,h:4,render:()=>r?y==="district"?e.jsx(xt,{incidentsBySchool:r.incidentsBySchool,schoolNameById:a,schoolIdByName:v,onSch
6oolClick:U,isNoDataAtAll:!!w,onAdjustDateRange:R}):e.jsx(pt,{staffData:r.staffData,isNoDataAtAll:!!w,onAdjustDateRange:R}):b?e.jsx(B,{heading:"Unable to load school data",onRetry:N}):e.jsx(Je,{}),getCSVData:()=>r?y==="district"?{title:"Incidents by School",columns:["School","Total","Major","Minor","Suspensions"],rows:r.incidentsBySchool.map(x=>[x.school,x.total,x.major,x.minor,x.suspensions??0])}:{title:"Incidents by Staff",columns:["Name","Role","Incidents Reported","Incidents Involved"],rows:r.staffData.map(x=>[x.name,x.role,x.incidentsReported,x.incidentsInvolved])}:{title:"Incidents by School",columns:[],rows:[]}},{id:"suspension-demographic",type:"fixed",x:0,y:6,w:12,h:4,render:()=>r?e.jsx(gt,{data:r.suspensionDemographicData}):b?e.jsx(B,{heading:"Unable to load demographic data",onRetry:N}):e.jsx(Qe,{}),getCSVData:()=>({title:"Suspension Rate by Demographic",columns:["Group","Category","Enrolled","Suspended","Rate","Previous Rate"],rows:((r==null?void 0:r.suspensionDemographicData)??[]).map(x=>[x.category==="race"?Z(x.group)??x.group:x.group,x.category,x.enrolled,x.suspended,x.rate,x.prevRate])})},{id:"incident-themes",type:"fixed",x:0,y:10,w:12,h:7,render:()=>r?e.jsx(ht,{incidentKeywords:r.incidentKeywords,keywordIncidents:r.keywordIncidents,keywordInsights:r.keywordInsights,viewMode:y,timePreset:u.preset,timeFilter:u,isNoDataAtAll:!!w,onAdjustDateRange:R}):b?e.jsx(nt,{onRetry:N}):e.jsx(it,{}),getCSVData:()=>({title:"Incident Themes",columns:["Keyword","Count","Trend","Change %"],rows:((r==null?void 0:r.incidentKeywords)??[]).map(x=>[x.keyword,x.count,x.trend,x.changePercent])})}]},[r,u,b,N,y,a,v,U]),_=we("behavior",xe),pe=h.useMemo(()=>{var R,x;const d=o!=="all"?o:void 0,w=X(u,k);return{schoolId:d,startDate:(R=w.start)==null?void 0:R.format("YYYY-MM-DD"),endDate:(x=w.end)==null?void 0:x.format("YYYY-MM-DD")}},[o,u,k]),he=e.jsx("div",{ref:C,children:e.jsx(We,{title:"Behavior Overview",subtitle:"Track incidents, suspensions, and behavioral trends across schools",className:"mb-8",actions:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(Re,{value:o,onValueChange:l,children:[e.jsx(ze,{children:e.jsx(He,{})}),e.jsx(Le,{children:c.map(d=>e.jsx(Ce,{value:d.value,children:d.label},d.value))})]}),e.jsx(Me,{value:u,onChange:S}),e.jsx(ke,{dashboard:_})]})})});return e.jsxs(e.Fragment,{children:[e.jsx(ye,{children:e.jsx("title",{children:"Edia | Behavior"})}),e.jsxs("div",{className:"pt-8 px-8 pb-12",style:{background:t.gray50,minHeight:"100%"},children:[he,e.jsx(Ne,{filters:pe,children:e.jsx(Te,{dashboard:_})}),F&&e.jsx("div",{style:{position:"sticky",bottom:"24px",zIndex:50,display:"flex",justifyContent:"center",pointerEvents:"none",marginTop:"-48px",animation:"slideUp 200ms ease-out"},children:e.jsxs("div",{className:"flex items-center gap-3",style:{background:t.gray900,borderRadius:"10px",padding:"10px 12px 10px 12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1)",whiteSpace:"nowrap",pointerEvents:"auto"},children:[e.jsxs("button",{onClick:()=>{l("all"),L()},className:"flex items-center gap-1.5 cursor-pointer",style:{fontSize:"13px",fontWeight:500,color:t.gray300,background:"rgba(255, 255, 255, 0.1)",border:"none",padding:"4px 10px",borderRadius:"6px",transition:"background 150ms"},onMouseEnter:d=>d.currentTarget.style.background="rgba(255, 255, 255, 0.2)",onMouseLeave:d=>d.currentTarget.style.background="rgba(255, 255, 255, 0.1)",children:[e.jsx(Ee,{style:{width:"14px",height:"14px"}}),"Back to all schools"]}),e.jsx("div",{style:{width:"1px",height:"16px",background:"rgba(255, 255, 255, 0.15)"}}),e.jsxs("span",{style:{fontSize:"13px",color:t.gray300,fontWeight:400,padding:"0 2px"},children:["Viewing"," ",e.jsx("span",{style:{color:"#fff",fontWeight:500},children:F})]}),e.jsx("button",{onClick:L,className:"cursor-pointer",style:{background:"none",border:"none",padding:"2px",borderRadius:"4px",color:t.gray500,transition:"color 150ms"},onMouseEnter:d=>d.currentTarget.style.color=t.gray300,onMouseLeave:d=>d.currentTarget.style.color=t.gray500,children:e.jsx(ee,{style:{width:"14px",height:"14px"}})})]})}),K&&e.jsx(lt,{incident:K,onClose:()=>ae(null)})]})]})}export{ks as default}; 7//# sourceMappingURL=page-D3rVXmH0.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.