1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="428bc343-312c-4a4b-81e0-cee1c5875a30",e._sentryDebugIdIdentifier="sentry-dbid-428bc343-312c-4a4b-81e0-cee1c5875a30")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5683],{16139:function(e,t,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/institutions/[institutionId]/focus",function(){return l(48119)}])},37177:function(e,t,l){"use strict";l.d(t,{Z:function(){return d}});var a=l(52322),s=l(2784),r=l(44620),n=l(12383);let i=r.default.generatePicker(n.Z),{MonthPicker:o,RangePicker:c}=i;var d=e=>{let{format:t="DD/MM/YYYY",...l}=e,[r,n]=(0,s.useState)(!1);if("year"===l.selectionType){let{selectionType:e,defaultValue:s,disabled:o,size:c,style:d,value:u}=l;return(0,a.jsx)(i,{open:r,onOpenChange:e=>n(e),onPanelChange:(e,t)=>{n(!1),l.onChange&&l.onChange(e,t)},mode:e,size:c,style:d,value:u,disabled:o,defaultValue:s,format:t})}if("month"===l.selectionType){let{selectionType:e,...s}=l;return(0,a.jsx)(o,{format:t,...s})}if("range"===l.selectionType){let{selectionType:e,...s}=l;return(0,a.jsx)(c,{format:t,...s})}if("full"===l.selectionType||void 0===l.selectionType){let{selectionType:e,...s}=l;return(0,a.jsx)(i,{format:t,...s})}return null}},38646:function(e,t,l){"use strict";l.d(t,{Z:function(){return d}});var a=l(52322),s=l(2784),r=l(80865),n=l.n(r),i=l(93967),o=l.n(i);let c=s.createContext(!1);var d=e=>{let{children:t,position:l="default",textAlign:s}=e;return(0,a.jsx)(c.Consumer,{children:e=>e?(0,a.jsx)("div",{children:t}):(0,a.jsx)(c.Provider,{value:!0,children:(0,a.jsx)("div",{className:o()(n().section,{[n()["section--".concat(l)]]:"default"!==l,[n()["section--text-".concat(s)]]:!!s}),children:t})})})}},88299:function(e,t,l){"use strict";l.d(t,{Z:function(){return m}});var a=l(52322),s=l(93897),r=l(93967),n=l.n(r),i=l(2784),o=l(64349),c=l.n(o);let{Option:d}=s.default,u=i.forwardRef((e,t)=>{let{children:l,ordinalLabels:r,className:i,options:o,loading:d,...u}=e,m=d?{...u,value:void 0}:u;return(0,a.jsx)(s.default,{ref:t,optionFilterProp:o?"label":"children",className:n()(c().select,i,{[c()["select--ordinalLabels"]]:r}),options:o,fieldNames:o?{label:"label",value:"value"}:void 0,loading:d,placeholder:d?"Loading...":u.placeholder,optionRender:e=>(0,a.jsx)("div",{style:{whiteSpace:"break-spaces",wordWrap:"break-word",padding:"4px 0"},children:e.label}),...m})});u.Option=d,u.displayName="Select";var m=u},90285:function(e,t,l){"use strict";var a=l(39970);t.Z=a.default},50822:function(e,t,l){"use strict";l.d(t,{Z:function(){return d}});var a=l(52322);l(2784);var s=l(99523),r=l(64992),n=l(61162),i=l(52454),o=l.n(i);let c=e=>(0,a.jsx)(n.default,{image:n.default.PRESENTED_IMAGE_SIMPLE,description:e});var d=e=>{let{rowKey:t,dataSource:l,columns:n,paginationSettings:i,onPaginationChange:d,renderExpandableContent:u,loading:m,onSortersChange:x,onFiltersChange:h,emptyText:p,renderExpandIcon:f,onRowClick:v,hasBorders:g,onChange:y}=e,j=e=>{let{columnClass:t,...l}=e;return{...t?{className:o()[t]}:{},...l}},b=e=>{let{dataIndex:t,hasFilter:a,...s}=e;if(!a||h)return{dataIndex:t,...s};let r=Array.from(new Set(l.map(e=>e[t]))).map(e=>({value:e,text:e}));return{...s,filters:r,dataIndex:t,onFilter:(e,l)=>l[t]===e}},N=e=>{let{hasSorter:t,...l}=e;return{...l,...t?{sorter:!!x||((e,t)=>e[l.dataIndex]>t[l.dataIndex]?1:-1)}:{}}},C=n.map(e=>j(b(N(e)))),w=!!i&&{...void 0!==i.current?{current:i.current}:{},pageSize:i.pageSize||20,showQuickJumper:!0,hideOnSinglePage:!0,showSizeChanger:!1,...void 0!==i.total?{total:i.total}:{},showTotal:e=>e?"Total: ".concat(e):null},k=v&&o()["clickable-row"];return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(r.default,{renderEmpty:()=>c(p),children:(0,a.jsx)(s.default,{rowKey:t,scroll:{x:!0},dataSource:l,columns:C,onChange:(e,t,l)=>{y&&y(e,t,l),d&&d(e),h&&h(t),x&&x(l)},expandable:{expandedRowRender:u},pagination:w,loading:m||!1,bordered:g,...f?{expandIcon:f}:{},onRow:v?(e,t)=>({onClick:()=>v(e,t)}):void 0,rowClassName:k})})})}},66904:function(e,t,l){"use strict";var a=l(10722);t.Z=a.default},59512:function(e,t,l){"use strict";l.d(t,{T:function(){return c}});var a=l(52322),s=l(90285),r=l(17978),n=l.n(r),i=l(93967),o=l.n(i);let c=e=>{let{height:t,className:l}=e;return(0,a.jsx)("div",{className:o()(n().container,l),style:t?{height:t}:void 0,children:(0,a.jsx)(s.Z,{})})}},58166:function(e,t,l){"use strict";l.d(t,{i:function(){return i}});var a=l(23943),s=l(5632),r=l.n(s),n=l(2784);function i(e){let{children:t}=e,{user:l}=(0,a.aC)();return(0,n.useEffect)(()=>{l||r().push("/login")},[l]),l?t:null}},50151:function(e,t,l){"use strict";l.r(t);var a=l(52322),s=l(38646),r=l(57818),n=l(24615),i=l(15612);l(2784);let o={404:"Sorry, couldn't find this page.",500:"Internal server error."},c=e=>{let{statusCode:t=404,title:l}=e;return(0,a.jsx)(n.Z,{children:(0,a.jsx)(r.Z,{children:(0,a.jsxs)(s.Z,{children:[(0,a.jsx)("h1",{children:t}),(0,a.jsx)("h2",{children:l||o[t]})]})})})};c.getInitialProps=async e=>(await (0,i.u)(e),{statusCode:e.res?e.res.statusCode:404}),t.default=c},48119:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return tr}});var a,s,r,n,i,o,c=l(52322),d=l(61812),u=l(15118),m=l(6812),x=l(5632),h=l(59512),p=l(66904),f=l(57411),v=l(2784),g=l(23746),y=l.n(g),j=l(27392),b=l(50603),N=l(58842),C=l(3131),w=l(44013),k=l(30840);let S="#0072b5",A="#ffcc00",M="#d95319",L={colour:S},T=(0,v.createContext)(L);function D(e){var t;let{children:l,value:a=L}=e,s={colour:null!==(t=a.colour)&&void 0!==t?t:L.colour};return(0,c.jsx)(T.Provider,{value:s,children:l})}let E=()=>(0,v.useContext)(T);function Y(e){let{cx:t,cy:l}=e,{colour:a}=E();return void 0===t||void 0===l?null:(0,c.jsx)("circle",{cx:t,cy:l,r:3,fill:a,stroke:"white"})}function _(e){let{cx:t,cy:l,payload:a,hoveredIndex:s,setHoveredIndex:r}
1=e,{colour:n}=E();if(!a||void 0===t||void 0===l)return null;let i="number"==typeof a.index?a.index:-1;return -1!==i&&s!==i&&setTimeout(()=>r(i),0),(0,c.jsx)("circle",{cx:t,cy:l,r:4,fill:n,stroke:n,strokeWidth:2})}var I=l(35610),R=l.n(I),P=l(91739),K=l.n(P),O=l(8368),q=l.n(O),z=l(93967),Q=l.n(z);function B(e){let{difference:t}=e;if(!t)return null;let{percentChange:l,isPositive:a}=t,s=.01>Math.abs(l);return(0,c.jsxs)("div",{className:Q()("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium transition-all",{"bg-green-50 text-green-700 border border-green-200":a&&!s,"bg-red-50 text-red-700 border border-red-200":!a&&!s,"bg-gray-50 text-gray-700 border border-gray-200":s}),children:[s?(0,c.jsx)(q(),{className:"text-sm"}):a?(0,c.jsx)(R(),{className:"text-sm"}):(0,c.jsx)(K(),{className:"text-sm"}),(0,c.jsx)("span",{children:s?"0.0%":a?"+".concat(l.toFixed(1),"%"):"".concat(l.toFixed(1),"%")})]})}function Z(e){var t;let{title:l,description:a,data:s,currentValue:r,formatValue:n=e=>"".concat(e.toFixed(1),"%")}=e,{colour:i}=E(),[o,d]=(0,v.useState)(null),u=null!==o?s[o].value:r,m=null!==o?s[o].label:null===(t=s[s.length-1])||void 0===t?void 0:t.label,x=(0,v.useMemo)(()=>{let e=null!==o?o:s.length-1;if(0===e||e<0)return null;let t=s[e].value,l=s[e-1].value,a=t-l;return{percentChange:0===l?a:a/l*100,isPositive:a>=0}},[o,s]),h=(0,v.useMemo)(()=>{if(null===o)return null;let e=s[o].value,t=s[o].marketAvg,l=e-t;return{diff:l,isAbove:l>=0,marketAvg:t}},[o,s]),f=(0,v.useMemo)(()=>s.map((e,t)=>({...e,index:t})),[s]),g=(0,v.useMemo)(()=>{let e=s.flatMap(e=>[e.value,e.marketAvg]),t=Math.min(...e),l=Math.max(...e),a=(l-t)*.1;return[Math.max(0,t-a),l+a]},[s]);return(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg px-5 pt-5 pb-3 flex flex-col gap-3 relative h-full",children:[(0,c.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,c.jsx)("h3",{className:"text-sm font-light text-gray-text m-0",children:l}),(0,c.jsx)(p.Z,{title:a,placement:"topRight",color:"#1f2937",className:"absolute top-1.5 right-1.5",children:(0,c.jsx)(y(),{className:"text-gray-400 hover:text-gray-600 transition-colors !cursor-help",onClick:e=>e.stopPropagation()})})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-2 flex-grow",children:[(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)("p",{className:"text-4xl font-bold text-gray-800",children:n(u)}),(0,c.jsx)(B,{difference:x})]}),(0,c.jsx)("p",{className:"text-sm text-gray-text font-light",children:m}),(0,c.jsxs)("div",{className:"mt-2 flex-grow flex flex-col gap-1.5",children:[(0,c.jsx)("div",{className:"flex-grow h-[60px] min-h-[60px] outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",tabIndex:-1,children:(0,c.jsx)(j.h,{width:"100%",height:60,children:(0,c.jsxs)(b.T,{data:f,onMouseMove:e=>{let t="number"==typeof e.activeTooltipIndex?e.activeTooltipIndex:null;!t||t<0||t>=f.length||d(t)},onMouseLeave:()=>d(null),margin:{top:5,right:5,left:5,bottom:5},children:[(0,c.jsx)("defs",{children:(0,c.jsxs)("linearGradient",{id:"colorValue",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,c.jsx)("stop",{offset:"0%",stopColor:i,stopOpacity:.3}),(0,c.jsx)("stop",{offset:"100%",stopColor:i,stopOpacity:0})]})}),(0,c.jsx)(N.uN,{type:"monotone",dataKey:"value",stroke:"none",fill:"url(#colorValue)",isAnimationActive:!1}),(0,c.jsx)(C.B,{domain:g,hide:!0}),(0,c.jsx)(w.x1,{type:"monotone",dataKey:"value",stroke:i,strokeWidth:2,dot:Y,activeDot:e=>(0,c.jsx)(_,{...e,hoveredIndex:o,setHoveredIndex:d}),isAnimationActive:!1}),null!==o&&(0,c.jsx)(k.db,{y:s[o].marketAvg,stroke:"#9ca3af",strokeDasharray:"4 4",strokeWidth:1})]})})}),(0,c.jsx)("p",{className:"text-xs text-gray-500 font-light m-0",children:null!==o&&h?0===h.diff?"Your institution matched market avg. (".concat(h.marketAvg.toFixed(1),"%)"):"Your institution was ".concat(Math.abs(h.diff).toFixed(1),"% ").concat(h.isAbove?"above":"below"," market (").concat(h.marketAvg.toFixed(1),"%)"):"Hover over the data points to see values by year"})]})]})]})}function G(e){let{colour:t,...l}=e;return(0,c.jsx)(D,{children:(0,c.jsx)(Z,{...l})})}var F=l(81909),$=l(62688),H=l(28879),U=l.n(H);class V{static getCurrentLabel(){let e=U()(),t=e.month()>=8?e.year():e.year()-1,l=(t+1).toString().slice(-2);return"".concat(t,"/").concat(l)}static getDates(e){return[U()("".concat(e,"-10-01")),U()("".concat(e+1,"-09-30"))]}static getCurrentCycle(){return this.getLastCycles(1)[0]}static getPreviousCycles(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=U()(),l=t.month()>=8?t.year():t.year()-1;return Array.from({length:e},(t,a)=>{let s=l-(e-a),r=s+1,n=r.toString().slice(-2),i="".concat(s,"/").concat(n),[o,c]=this.getDates(s),d=s+1;return{label:i,startDate:o,endDate:c,startYear:s,courseStartYear
11:d,courseStartYear2:r+1}})}static getLastCycles(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=U()(),l=t.month()>=8?t.year():t.year()-1;return Array.from({length:e},(t,a)=>{let s=l-(e-1-a),r=s+1,n=r.toString().slice(-2),i="".concat(s,"/").concat(n),[o,c]=this.getDates(s),d=s+1;return{label:i,startDate:o,endDate:c,startYear:s,courseStartYear1:d,courseStartYear2:r+1}})}static getCourseStartYearOptions(e,t,l){if(0===e.length)return[{label:"All",value:null}];let a=e;if(t&&l){let s=U()(t),r=U()(l);if(0===(a=e.filter(e=>!s.isAfter(e.endDate,"day")&&!r.isBefore(e.startDate,"day"))).length)return[{label:"All",value:null}]}return[{label:"All",value:null},...Array.from(new Set(a.flatMap(e=>[e.courseStartYear1,e.courseStartYear2]))).sort((e,t)=>e-t).map(e=>({label:String(e),value:e}))]}}var W=l(80979);function X(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,{data:a,loading:s,error:r}=(0,m.a)(F.f,{variables:{metricKey:$.N.OVERVIEW_METRICS,institutionId:l},skip:!l}),n=(0,v.useMemo)(()=>{var e;if(!(null==a?void 0:null===(e=a.institutionMetric)||void 0===e?void 0:e.payload))return null;let t=a.institutionMetric.payload,l=t.enrollmentRateHistory||[],s=t.totalSubmitted||0,r=t.totalReleased||0;return{conversionRate:s>0?Math.round(r/s*100):0,currentEnrollmentRate:l.length>0?l[l.length-1].value:0,totalSubmitted:s,totalReleased:r,enrollmentRateHistory:l.map(e=>({year:e.year,value:e.value,label:e.label,marketAvg:e.marketAvg}))}},[null==a?void 0:null===(e=a.institutionMetric)||void 0===e?void 0:e.payload]);return s?(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,c.jsx)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:(0,c.jsx)("div",{className:"h-32",children:(0,c.jsx)(h.T,{height:"100%"})})}),(0,c.jsx)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:(0,c.jsx)("div",{className:"h-32",children:(0,c.jsx)(h.T,{height:"100%"})})})]}):r?(0,c.jsx)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:(0,c.jsxs)("p",{className:"text-red-600",children:["Error loading metrics: ",r.message]})}):n?(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 items-stretch",children:[(0,c.jsxs)(f.R,{children:[(0,c.jsx)(f.R.Heading,{children:"Application Completion Rate"}),(0,c.jsxs)(f.R.Value,{subtitle:{label:(0,c.jsxs)(v.Fragment,{children:["applications released out of ".concat(n.totalSubmitted.toLocaleString()," "),(0,c.jsx)(p.Z,{title:"Submitted application stage indicates forms held in the system pending submission of a reference.",className:"border-b border-dotted border-current cursor-help",children:"submitted"})]}),value:n.totalReleased.toLocaleString()},children:[n.conversionRate,"%"]}),(0,c.jsx)(f.R.Description,{children:"Percentage of submitted applications that reached the released stage for the current application year (applications released since ".concat(V.getCurrentCycle().startDate.format("D MMMM YYYY"),").")})]}),(0,c.jsx)(G,{title:"Previous 2 Years Enrolment Rate",description:"Percentage of released applications that resulted in enrolments. The difference indicator shows the change compared to the previous application cycle (".concat(V.getLastCycles(1)[0].startDate.format("D MMMM YYYY")," to ").concat(V.getLastCycles(1)[0].endDate.format("D MMMM YYYY"),")."),data:n.enrollmentRateHistory,currentValue:n.currentEnrollmentRate})]}),!s&&!r&&(0,c.jsx)(W.O,{lastUpdatedAt:null==a?void 0:null===(t=a.institutionMetric)||void 0===t?void 0:t.calculatedAt})]}):(0,c.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 items-stretch",children:[(0,c.jsxs)(f.R,{children:[(0,c.jsx)(f.R.Heading,{children:"Application Completion Rate"}),(0,c.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:"No metrics data available."})})]}),(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg px-5 pt-5 pb-3 flex flex-col gap-3 relative h-full",children:[(0,c.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,c.jsx)("h3",{className:"text-sm font-light text-gray-text m-0",children:"Enrolment Rate"})}),(0,c.jsx)("div",{className:"flex items-center justify-center flex-grow h-[60px] min-h-[60
1px]",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:"No metrics data available."})})]})]})}var J=l(74776),ee=l(37177),et=l(88299);function el(e){let{items:t,activeKey:l,onChange:a,className:s}=e;return(0,c.jsx)("div",{className:Q()("flex gap-8",s),children:t.map(e=>{let t=l===e.key;return(0,c.jsx)("button",{onClick:()=>a(e.key),className:Q()("border-b-2 font-medium text-sm transition-colors",{"border-primary text-primary":t,"border-transparent text-gray-text hover:text-gray-heading hover:border-gray-border":!t}),children:e.label},e.key)})})}var ea=l(50822),es=l(80739),er=l(55484),en=l(25556),ei=l(55032),eo=l(60258),ec=l(66628);function ed(e){let{active:t,payload:l,label:a}=e;return t&&l&&0!==l.length?(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg shadow-lg p-3",children:[a&&(0,c.jsx)("p",{className:"text-sm font-medium mb-2 text-black",children:a}),l.map((e,t)=>{if(!e||e.hide)return null;let l="number"==typeof e.value?e.value:0,a=e.name||"";return(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[e.color&&(0,c.jsx)("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:e.color}}),(0,c.jsx)("span",{className:"text-sm",children:"".concat(a,": ").concat(l.toLocaleString())})]},t)})]}):null}function eu(e){let{payload:t}=e;return t&&0!==t.length?(0,c.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 mt-2 sm:mt-5 justify-start sm:justify-between",role:"list","aria-label":"Chart legend",children:[(0,c.jsx)("p",{className:"text-xs text-gray-500 font-light",children:"Hover over data points to see values"}),(0,c.jsx)("div",{className:"flex gap-4",children:t.map((e,t)=>"none"===e.type?null:(0,c.jsxs)("div",{className:"flex items-center gap-2",role:"listitem",children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:e.color},"aria-hidden":"true"}),(0,c.jsx)("span",{className:"text-xs text-gray-text whitespace-nowrap",children:e.value})]},t))})]}):null}function em(e){let{data:t}=e;return(0,c.jsx)("div",{className:"h-80 outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:t,margin:{top:0,right:0,left:0,bottom:0},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{dataKey:"courseType"}),(0,c.jsx)(C.B,{width:45}),(0,c.jsx)(ei.u,{content:ed,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"1st Choice",fill:S,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(eo.$Q,{dataKey:"2nd Choice",fill:A,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(eo.$Q,{dataKey:"3rd Choice",fill:M,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})})}function ex(e){let{data:t,viewType:l}=e,a=t.map(e=>({courseType:e.courseType,"1st Choice":e.firstChoice,"2nd Choice":e.secondChoice,"3rd Choice":e.thirdChoice}));return(0,c.jsx)("div",{className:"mt-6",children:l===i.Table?(0,c.jsx)(ea.Z,{columns:[{title:"Course Type",dataIndex:"courseType",key:"courseType"},{title:"1st Choice",dataIndex:"firstChoice",key:"firstChoice",render:e=>e.toLocaleString()},{title:"2nd Choice",dataIndex:"secondChoice",key:"secondChoice",render:e=>e.toLocaleString()},{title:"3rd Choice",dataIndex:"thirdChoice",key:"thirdChoice",render:e=>e.toLocaleString()},{title:"Total",dataIndex:"total",key:"total",render:(e,t)=>{let l=t.firstChoice||0;return(l+(t.secondChoice||0)+(t.thirdChoice||0)).toLocaleString()}}],dataSource:t,rowKey:"courseType"}):(0,c.jsx)(em,{data:a})})}function eh(e){let{data:t,viewType:l}=e,a=t.map(e=>({courseType:e.courseType,"1st Choice":e.firstChoice,"2nd Choice":e.secondChoice,"3rd Choice":e.thirdChoice}));return(0,c.jsx)("div",{className:"mt-6",children:l===i.Table?(0,c.jsx)(ea.Z,{columns:[{title:"Course Type",dataIndex:"courseType",key:"courseType"},{title:"1st Choice",dataIndex:"firstChoice",key:"firstChoice",render:e=>e.toLocaleString()},{title:"2nd Choice",dataIndex:"secondChoice",key:"secondChoice",render:e=>e.toLocaleString()},{title:"3rd Choice",dataIndex:"thirdChoice",key:"thirdChoice",render:e=>
1e.toLocaleString()},{title:"Total",dataIndex:"total",key:"total",render:(e,t)=>{let l=t.firstChoice||0;return(l+(t.secondChoice||0)+(t.thirdChoice||0)).toLocaleString()}}],dataSource:t,rowKey:"courseType"}):(0,c.jsx)(em,{data:a})})}(a=n||(n={})).Released="released",a.Submitted="submitted",(s=i||(i={})).Table="table",s.Graph="graph";var ep=l(19034),ef=l.n(ep);function ev(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{scope:t="all"}=e,[l,a]=(0,v.useState)(null),s=(0,v.useMemo)(()=>"currentCycleOnly"===t?[V.getCurrentCycle()]:"previousThreeCyclesOnly"===t?V.getPreviousCycles(3):V.getLastCycles(3),[t]),{minDate:r,maxDate:n}=(0,v.useMemo)(()=>{if(0===s.length)return{minDate:null,maxDate:null};let e=[...s].sort((e,t)=>e.startDate.valueOf()-t.startDate.valueOf());return{minDate:e[0].startDate,maxDate:e[e.length-1].endDate}},[s]),i=(0,v.useMemo)(()=>{if(!(null==l?void 0:l[0])||!(null==l?void 0:l[1]))return null;let e=s.find(e=>{var t,a;return(null===(t=l[0])||void 0===t?void 0:t.isSame(e.startDate,"day"))&&(null===(a=l[1])||void 0===a?void 0:a.isSame(e.endDate,"day"))});return(null==e?void 0:e.label)||null},[l,s]),o=(0,v.useMemo)(()=>{var e;return null==l?void 0:null===(e=l[0])||void 0===e?void 0:e.format("YYYY-MM-DD")},[l]),c=(0,v.useMemo)(()=>{var e;return null==l?void 0:null===(e=l[1])||void 0===e?void 0:e.format("YYYY-MM-DD")},[l]),d=(0,v.useMemo)(()=>l?[l[0]?ef()(l[0].toDate()):null,l[1]?ef()(l[1].toDate()):null]:null,[l]);return{dateRange:l,setDateRange:a,cycles:s,minDate:r,maxDate:n,activeCycleLabel:i,handleCycleClick:e=>i===e.label?a(null):a([e.startDate,e.endDate]),disabledDate:e=>{if(!e||!r||!n)return!1;let t=U()(e.toDate());return t.isBefore(r,"day")||t.isAfter(n,"day")},releasedAfter:o,releasedBefore:c,momentDateRange:d,handleDateRangeChange:e=>e?a([e[0]?U()(e[0].toDate()):null,e[1]?U()(e[1].toDate()):null]):a(null)}}function eg(e){let{cycles:t,activeCycleLabel:l,onCycleClick:a}=e;return(0,c.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap",children:t.map(e=>{let t=l===e.label;return(0,c.jsx)("button",{type:"button",onClick:()=>a(e),className:Q()("px-2.5 py-1 text-xs font-medium rounded transition-all duration-200",{"bg-primary text-white hover:text-white":t,"bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-300":!t}),children:e.label},e.label)})})}let ey=[{key:n.Released,label:"Released"},{key:n.Submitted,label:"Submitted"}],ej=[{label:"Table",value:i.Table},{label:"Graph",value:i.Graph}];function eb(e){return(null!=e?e:[]).filter(e=>"CPQ"!==e.courseType)}function eN(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,[a,s]=(0,v.useState)(i.Table),[r,o]=(0,v.useState)(n.Released),[d,u]=(0,v.useState)(void 0),f=r===n.Submitted,{releasedAfter:g,releasedBefore:j,cycles:b,activeCycleLabel:N,handleCycleClick:C,disabledDate:w,momentDateRange:k,handleDateRangeChange:S,setDateRange:A,minDate:M,maxDate:L}=ev({scope:f?"currentCycleOnly":"all"});(0,v.useEffect)(()=>{let[e,t]=[g,j].map(e=>e?new Date(e):null);if(!e||!t||!M||!L)return;let l=e.toISOString().slice(0,10),a=t.toISOString().slice(0,10),s=M.format("YYYY-MM-DD"),r=L.format("YYYY-MM-DD");(l<s||a>r)&&A(null)},[r,g,j,M,L,A]);let T=(0,v.useMemo)(()=>V.getCourseStartYearOptions(b,g,j),[b,g,j]);(0,v.useEffect)(()=>{let e=T.filter(e=>null!=e.value).map(e=>e.value);void 0==d||e.includes(d)||u(void 0)},[T,d]);let{data:D,loading:E,error:Y}=(0,m.a)(F.f,{variables:{metricKey:$.N.APPLICATION_DISTRIBUTION,institutionId:l,releasedAfter:g,releasedBefore:j,courseStartYear:d},skip:!l}),_=(0,v.useMemo)(()=>{var e;let t=null==D?void 0:null===(e=D.institutionMetric)||void 0===e?void 0:e.payload;return t?{released:t.released||[],submitted:t.submitted||[]}:null},[null==D?void 0:null===(e=D.institutionMetric)||void 0===e?void 0:e.payload]),{releasedDataFiltered:I,submittedDataFiltered:R}=(0,v.useMemo)(()=>({releasedDataFiltered:eb(null==_?void 0:_.released),submittedDataFiltered:eb(null==_?void 0:_.submitted)}),[_]),P=!!(g||j||null!=d);return(0,c.jsxs)("div",{children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Application Distribution"}),(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsxs)("div",{className:"border-b border-gray-border pb-4 flex items-center justify-between flex-wrap gap-3",children:[(0,c.jsx)(el,{items:ey,activeKey:r,onChange:e=>o(e)}),(0,c.jsx)(J.default,{options:ej,value:a,onChange:e=>s(e),size:"small"})]}),(0,c.jsxs)("div",{className:"flex flex-col gap-4 pt-6",children:[(0,c.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:f?"
1Submitted:":"Released:"}),(0,c.jsx)(ee.Z,{selectionType:"range",value:k,onChange:S,disabledDate:w,format:"DD/MM/YYYY",size:"small",style:{width:240}})]}),!f&&(0,c.jsx)(eg,{cycles:b,activeCycleLabel:N,onCycleClick:C}),f&&(0,c.jsx)("div",{className:"ml-auto",children:(0,c.jsx)(p.Z,{title:"Submitted application metrics are only available for the current application cycle.",placement:"topRight",color:"#1f2937",children:(0,c.jsx)(y(),{className:"text-sm text-gray-400 hover:text-gray-600 transition-colors cursor-help",onClick:e=>e.stopPropagation()})})})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Course start year:"}),(0,c.jsx)(et.Z,{placeholder:"All",options:T,value:d,onChange:e=>u(null!=e?e:void 0),allowClear:!0,size:"small",style:{width:160}})]})]}),E?(0,c.jsx)("div",{className:"mt-6 flex items-center justify-center h-[275px]",children:(0,c.jsx)(h.T,{height:"100%"})}):Y?(0,c.jsx)("div",{className:"mt-6 flex items-center justify-center h-[275px]",children:(0,c.jsxs)("p",{className:"text-red-600",children:["Error loading application distribution: ",Y.message]})}):_?f?0===R.length?(0,c.jsx)("div",{className:"mt-6 flex items-center justify-center h-80",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:P?"No submitted application data found for the selected filters.":"No submitted application distribution data available for the current cycle."})}):(0,c.jsx)(eh,{data:R,viewType:a}):0===I.length?(0,c.jsx)("div",{className:"mt-6 flex items-center justify-center h-80",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:P?"No application data found for the selected filters.":"No application distribution data available."})}):(0,c.jsx)(ex,{data:I,viewType:a}):(0,c.jsx)("div",{className:"mt-6 flex items-center justify-center h-[275px]",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:!f&&P?"No application data found for the selected filters.":"No application distribution data available."})})]}),!E&&!Y&&(0,c.jsx)(W.O,{lastUpdatedAt:null==D?void 0:null===(t=D.institutionMetric)||void 0===t?void 0:t.calculatedAt})]})}let eC=["LPC","GDL","SQE"];function ew(e){let{data:t}=e,l=eC.map(e=>{var l,a,s;let r=t.find(t=>t.courseType===e);return{courseType:e,yes:null!==(l=null==r?void 0:r.requiresVisa)&&void 0!==l?l:0,dontKnow:null!==(a=null==r?void 0:r.dontKnow)&&void 0!==a?a:0,no:null!==(s=null==r?void 0:r.noVisa)&&void 0!==s?s:0}});return(0,c.jsx)(ea.Z,{columns:[{title:"Is a student visa required?",dataIndex:"courseType",key:"courseType"},{title:"Yes",dataIndex:"yes",key:"yes",render:e=>e.toLocaleString()},{title:"Don't know",dataIndex:"dontKnow",key:"dontKnow",render:e=>e.toLocaleString()},{title:"No",dataIndex:"no",key:"no",render:e=>e.toLocaleString()}],dataSource:l,rowKey:"courseType"})}function ek(e){let{x:t,y:l,payload:a,width:s=80,fontSize:r=11}=e;if(!a||void 0===t||void 0===l)return null;let n=a.value||"",i=.55*r,o=Math.floor((s-.55*r*3-2)/i),d=n.length>o?"".concat(n.substring(0,o),"..."):n;return(0,c.jsx)("text",{x:t,y:l,textAnchor:"end",dominantBaseline:"middle",fontSize:r,fill:"#666",children:d})}let eS=["LPC","GDL","SQE"];function eA(e){let{data:t}=e,l=eS.map(e=>{var l,a,s;let r=t.find(t=>t.courseType===e);return{courseType:e,Yes:null!==(l=null==r?void 0:r.requiresVisa)&&void 0!==l?l:0,"Don't know":null!==(a=null==r?void 0:r.dontKnow)&&void 0!==a?a:0,No:null!==(s=null==r?void 0:r.noVisa)&&void 0!==s?s:0}});return l.some(e=>e.Yes+e["Don't know"]+e.No>0)?(0,c.jsx)("div",{className:"h-80 w-full outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:l,layout:"vertical",margin:{top:8,right:20,left:0,bottom:8},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{type:"number"}),(0,c.jsx)(C.B,{type:"category",dataKey:"courseType",width:40,tick:(0,c.jsx)(ek,{width:36})}),(0,c.jsx)(ei.u,{content:ed,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"Yes",fill:S,maxBarSize:40,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(eo.$Q,{dataKey:"Don't know",fill:A,maxBarSize:40,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(eo.$Q,{dataKey:"No",fill:M,maxBarSize:40,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})}):(0,c.jsx)("div",{className:"flex items-center justify-center h-80 text-gray-text",children:(0,c.jsx)("p",{className:"text-sm",children:"No data available."})})}function eM(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,[a,s]=(0,v.useState)("table"),[r,n]=(0,v.useState)(null),{releasedAfter:i,releasedBefore:o,cycles:d,minDate:u,maxDate:p,activeCycleLabel:f,handleCycleClick:g,disabledDate:y,momentDateRange:j,handleDateRangeChange:b}=ev(),N=(0,v.useMemo)(()=>i||(null!=r&&u?u.format("YYYY-MM-DD"):void 0),[i,r,u]),C=(0,v.useMemo)(()=>o||(null!=r&&p?p.format("YYYY-MM-DD"):void 0),[o,r,p]),{data:w,loading:k,error:S}=(0,m.a)(F.f,{variables:{metricKey:$.N.VISA_BREAKDOWN,institutionId:l,releasedAfter:N,releasedBefore:C,courseStartYear:r},skip:!l}),A=(0,v.useMemo)(()=>{var e,t;if(!(null==w?void 0:null===(e=w.institutionMetric)||void 0===e?void 0:e.payload))return null;let l=w.institutionMetric.payload;return N||C?Array.isArray(l)?l:[]:null!==(t=l.currentCycle)&&void 0!==t?t:[]},[null==w?void 0:null===(e=w.institutionMetric)||void 0===e?void 0:e.payload,N,C]),M=(0,v.useMemo)(()=>A?A.filter(e=>"CPQ"!==e.courseType):null,[A]),L=M&&M.length>0,T=(0,v.useMemo)(()=>V.getCourseStartYearOptions(d,i,o),[d,i,o]);return(0,v.useEffect)(()=>{let e=T.filter(e=>null!=e.value).map(e=>e.value);null==r||e.includes(r)||n(null)},[T,r]),(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsxs)("div",{className:"border-b border-gray-border pb-4 flex items-center justify-between flex-wrap gap-3",children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-gray-heading",children:"Applicant Visa Requirements"}),(0,c.jsx)(J.default,{options:[{label:"Table",value:"table"},{label:"Graph",value:"graph"}],value:a,onChange:e=>s(null!=e?e:"table"),size:"small"})]}),(0,c.jsx)("p",{className:"text-sm text-gray-text mt-4 mb-4",children:"Released applications based on student visa requirements (LPC, GDL, SQE)"}),(0,c.jsxs)("div",{className:"flex flex-col gap-4 mb-6",children:[(0,c.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Released:"}),(0,c.jsx)(ee.Z,{selectionType:"range",value:j,onChange:b,disabledDate:y,format:"DD/MM/YYYY",size:"small",style:{width:240}})]}),(0,c.jsx)(eg,{cycles:d,activeCycleLabel:f,onCycleClick:g})]}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Course start year:"}),(0,c.jsx)(et.Z,{placeholder:"All",options:T,value:r,onChange:e=>n(null!=e?e:null),allowClear:!0,size:"small",style:{width:160}})]})]}),(k||!A)&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsx)(h.T,{height:"100%"})}),!k&&A&&S&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsxs)("p",{className:"text-red-600 text-sm",children:["Error loading metrics: ",S.message]})}),!k&&M&&!S&&L&&(0,c.jsxs)("div",{className:"mt-6",children:["table"===a&&(0,c.jsx)(ew,{data:M}),"graph"===a&&(0,c.jsx)(eA,{data:M})]}),!k&&A&&!S&&!L&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80 text-gray-text",children:(0,c.jsx)("p",{className:"text-sm",children:N||C?"No data found for the selected filters.":"No visa data found for the current application cycle."})})]}),!k&&!S&&(0,c.jsx)(W.O,{lastUpdatedAt:null==w?void 0:null===(t=w.institutionMetric)||void 0===t?void 0:t.calculatedAt})]})}function eL(e){let{data:t}=e,l=t.map(e=>({country:e.country,LPC:e.lpc,GDL:e.gdl,SQE:e.sqe})),a=Math.min(Math.max(356,30*l.length+20),640);return(0,c.jsx)("div",{className:"w-full outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",style:{height:"".concat(a,"px")},children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:l,layout:"vertical",margin:{top:5,right:20,left
1:0,bottom:5},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{type:"number",allowDecimals:!1}),(0,c.jsx)(C.B,{type:"category",dataKey:"country",width:80,tick:(0,c.jsx)(ek,{})}),(0,c.jsx)(ei.u,{content:ed,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"LPC",fill:S,maxBarSize:60,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(eo.$Q,{dataKey:"GDL",fill:A,maxBarSize:60,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(eo.$Q,{dataKey:"SQE",fill:M,maxBarSize:60,isAnimationActive:!1,stackId:"a"}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})})}var eT=l(11011);let eD=["LPC","GDL","SQE"],eE={LPC:S,GDL:A,SQE:M};function eY(e){let{data:t}=e,l=eD.map(e=>({course:e,count:t[e.toLowerCase()],color:eE[e]}));return(0,c.jsx)("div",{className:"w-full outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",style:{height:"320px"},children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:l,margin:{top:8,right:0,left:0,bottom:8},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{dataKey:"course",tick:{fontSize:12}}),(0,c.jsx)(C.B,{tick:{fontSize:12}}),(0,c.jsx)(ei.u,{content:ed,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"count",maxBarSize:80,isAnimationActive:!1,name:"Applications",children:l.map((e,t)=>(0,c.jsx)(eT.b,{fill:e.color},t))}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})})}function e_(e){let{data:t}=e;return t&&0!==t.length?(0,c.jsx)("div",{className:"w-full outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",style:{height:"320px"},children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:t,margin:{top:8,right:0,left:0,bottom:8},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{dataKey:"label",tick:{fontSize:12}}),(0,c.jsx)(C.B,{tick:{fontSize:12}}),(0,c.jsx)(ei.u,{content:ed,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"LPC",name:"LPC",fill:S,stackId:"a",maxBarSize:48,isAnimationActive:!1}),(0,c.jsx)(eo.$Q,{dataKey:"GDL",name:"GDL",fill:A,stackId:"a",maxBarSize:48,isAnimationActive:!1}),(0,c.jsx)(eo.$Q,{dataKey:"SQE",name:"SQE",fill:M,stackId:"a",maxBarSize:48,isAnimationActive:!1}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})}):(0,c.jsx)("div",{className:"flex items-center justify-center w-full text-gray-text outline-none [&_*]:outline-none",style:{height:"320px"},children:(0,c.jsx)("p",{className:"text-sm",children:"No year-on-year data available for this country."})})}let eI={PER_COURSE:"per_course",PER_YEAR:"per_year"};function eR(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,[a,s]=(0,v.useState)(null),[r,n]=(0,v.useState)(eI.PER_COURSE),{releasedAfter:i,releasedBefore:o,cycles:d,minDate:u,maxDate:f,activeCycleLabel:g,handleCycleClick:j,disabledDate:b,momentDateRange:N,handleDateRangeChange:C}=ev(),w=null!=i?i:null==u?void 0:u.format("YYYY-MM-DD"),k=null!=o?o:null==f?void 0:f.format("YYYY-MM-DD"),{data:S,loading:A,error:M}=(0,m.a)(F.f,{variables:{metricKey:$.N.COUNTRY_BY_COURSE_TYPE,institutionId:l,releasedAfter:w,releasedBefore:k},skip:!l}),L=null==S?void 0:null===(e=S.institutionMetric)||void 0===e?void 0:e.payload,T=(0,v.useMemo)(()=>{var e;return null!==(e=null==L?void 0:L.year)&&void 0!==e?e:[]},[null==L?void 0:L.year]),D=(0,v.useMemo)(()=>{if(!T.length)return null;let e=new Map;for(let t of T)for(let l of t.countries){let t=e.get(l.country);t?(t.lpc+=l.lpc,t.gdl+=l.gdl,t.sqe+=l.sqe,t.cpq+=l.cpq):e.set(l.country,{country:l.country,lpc:l.lpc,gdl:l.gdl,sqe:l.sqe,cpq:l.cpq})}return Array.from(e.values()).sort((e,t)=>t.lpc+t.gdl+t.sqe+t.cpq-(e.lpc+e.gdl+e.sqe+e.cpq)).slice(0,10)},[T]),E=(0,v.useMemo)(()=>D?[{label:"All",value:null},...D.map(e=>({label:e.country,value:e.country})).sort((e,t)=>e.label.localeCompare(t.label))]:[],[D]),Y=a?null==D?void 0:D.find(e=>e.country===a):null,_=(0,v.useMemo)(()=>a&&T.length?T.map(e=>{var t,l,s;let r=e.countries.find(e=>e.country===a);return{year:e.year,label:e.label,LPC:null!==(t=null==r?void 0:r.lpc)&&void 0!==t?t:0,GDL:null!==(l=null==r?void 0:r.gdl)&&void 0!==l?l:0,SQE:null!==(s=null==r?void 0:r.sqe)&&void 0!==s?s:0}}):[],[a,T]);return(0,c.jsxs)("div",{children:[(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-gray-heading mb-1",children:"Applicant Country of Domicile"}),(0,c.jsx)("p",{className:"text-sm text-gray-text mb-4",children:"Applications released to your institution, based on applicant country of domicile and course type (top 10 countries by application count)."}),(0,c.jsxs)("div",{className:"flex flex-col gap-4 mb-6",children:[(0,c.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Released:"}),(0,c.jsx)(ee.Z,{selectionType:"range",value:N,onChange:C,disabledDate:b,format:"DD/MM/YYYY",size:"small",style:{width:240}})]}),(0,c.jsx)(eg,{cycles:d,activeCycleLabel:g,onCycleClick:j})]}),(0,c.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Country:"}),(0,c.jsx)(et.Z,{placeholder:"Select country",options:E,value:a,onChange:e=>s(e),allowClear:!0,size:"small",className:"w-[160px] sm:w-[240px]"}),(0,c.jsx)(p.Z,{title:"Lists only countries that have released applications in the selected period.",children:(0,c.jsx)(y(),{className:"text-gray-400 hover:text-gray-600 transition-colors cursor-help"})})]}),a&&(0,c.jsx)(J.default,{value:r,onChange:e=>n(e),options:[{label:"Per course",value:eI.PER_COURSE},{label:"Per year",value:eI.PER_YEAR}],size:"small"})]})]}),A&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsx)(h.T,{height:"100%"})}),!A&&D&&M&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsxs)("p",{className:"text-red-600 text-sm",children:["Error loading country data: ",M.message]})}),!A&&D&&!M&&!a&&D.length>0&&(0,c.jsx)(eL,{data:D}),!A&&D&&!M&&a&&Y&&(0,c.jsxs)(v.Fragment,{children:[r===eI.PER_COURSE&&(0,c.jsx)(eY,{data:Y}),r===eI.PER_YEAR&&(0,c.jsx)(e_,{data:_})]}),!A&&!M&&(!D||0===D.length||a&&!Y)&&(0,c.jsx)("div",{className:"flex items-center justify-center h-80 text-gray-text",children:(0,c.jsx)("p",{className:"text-sm",children:a?"No applications foun
1d for the selected country.":i||o?"No released applications found for the selected date range.":"No country data available."})})]}),!A&&!M&&(0,c.jsx)(W.O,{lastUpdatedAt:null==S?void 0:null===(t=S.institutionMetric)||void 0===t?void 0:t.calculatedAt})]})}function eP(){return(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Demographics"}),(0,c.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,c.jsx)(eM,{}),(0,c.jsx)(eR,{})]})]})}let eK="all course types";(r=o||(o={})).Table="table",r.Graph="graph";var eO=l(35838),eq=l.n(eO),ez=l(3440),eQ=l.n(ez),eB=l(829),eZ=l.n(eB);function eG(e){let{choice:t}=e,l=t.applications>0?t.enrolments/t.applications*100:0;return(0,c.jsx)(p.Z,{title:(0,c.jsxs)("span",{children:[t.enrolments.toLocaleString()," of ",t.applications.toLocaleString()," applications enrolled."]}),children:(0,c.jsxs)("span",{className:"cursor-help",children:[t.applications.toLocaleString(),"\xa0",(0,c.jsxs)("span",{className:"text-neutral-400",children:["(",(0,c.jsxs)("span",{className:"border-b border-dotted border-current cursor-help",children:[l.toFixed(1),"%"]}),")"]})]})})}function eF(e){let{data:t,courseType:l}=e,a=[{title:"Course Start Year",dataIndex:"year",key:"year",className:"whitespace-nowrap"},{title:"1st Choice",dataIndex:"firstChoice",key:"firstChoice",className:"whitespace-nowrap",render:(e,t)=>(0,c.jsx)(eG,{choice:t.firstChoice})},{title:"2nd Choice",dataIndex:"secondChoice",key:"secondChoice",className:"whitespace-nowrap",render:(e,t)=>(0,c.jsx)(eG,{choice:t.secondChoice})},{title:"3rd Choice",dataIndex:"thirdChoice",key:"thirdChoice",className:"whitespace-nowrap",render:(e,t)=>(0,c.jsx)(eG,{choice:t.thirdChoice})},{title:"Total Applications",dataIndex:"totalApplications",key:"totalApplications",className:"whitespace-nowrap",render:(e,t)=>{let l=t.firstChoice,a=t.secondChoice,s=t.thirdChoice;return(l.applications+a.applications+s.applications).toLocaleString()}},{title:"Total Enrolled",dataIndex:"totalEnrolled",key:"totalEnrolled",className:"whitespace-nowrap",render:(e,t)=>{let l=t.firstChoice,a=t.secondChoice,s=t.thirdChoice,r=l.enrolments+a.enrolments+s.enrolments,n=l.applications+a.applications+s.applications;return(0,c.jsxs)(v.Fragment,{children:[(0,c.jsx)("span",{children:r.toLocaleString()}),(0,c.jsxs)("span",{className:"text-neutral-400",children:[" (",(n>0?r/n*100:0).toFixed(1),"%)"]})]})}},{title:(0,c.jsx)(p.Z,{title:"Your institution's share of all enrolments in the market for ".concat("ALL"===l?"all":l," courses."),children:(0,c.jsx)("span",{className:"border-b border-dotted border-current cursor-help",children:"Enrolment Market Share"})}),dataIndex:"marketTotalEnrollmentsPct",key:"marketTotalEnrollmentsPct",className:"whitespace-nowrap",render:e=>"".concat(e.toFixed(1),"%")}];return(0,c.jsx)(ea.Z,{columns:a,dataSource:t,rowKey:"year"})}function e$(e){let{data:t,courseType:l,loading:a}=e;return a?(0,c.jsx)("div",{className:"h-[12.5rem] flex items-center justify-center",children:(0,c.jsx)(h.T,{height:"100%"})}):(0,c.jsx)(eF,{data:t,courseType:l})}let eH=(e,t)=>t>0?e/t*100:0;function eU(e){var t;let{active:l,label:a,payload:s,courseTypeLabel:r}=e;if(!l||!(null==s?void 0:s.length))return null;let n=null===(t=s[0])||void 0===t?void 0:t.payload;if(!(null==n?void 0:n.firstChoice))return null;let{year:i,firstChoice:o,secondChoice:d,thirdChoice:u,marketTotalEnrollments:m,marketTotalEnrollmentsPct:x}=n,h=o.applications+d.applications+u.applications,p=o.enrolments+d.enrolments+u.enrolments,f=[{key:"1",choiceLabel:"1st",...o},{key:"2",choiceLabel:"2nd",...d},{key:"3",choiceLabel:"3rd",...u}],v=r===eK;return(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-md shadow-md px-2.5 py-2 text-xs text-gray-text min-w-[13rem] max-w-[17rem]",children:[(0,c.jsx)("p",{className:"text-sm font-medium text-black leading-tight mb-1.5",children:null!=i?i:a}),(0,c.jsxs)("div",{className:"leading-snug text-gray-600 mb-2 space-y-1",children:[(0,c.jsxs)("p",{children:[(0,c.jsxs)("span",{className:"text-black/80 tabular-nums",children:[(h>0?p/h*100:0).toFixed(1),"%"]})," of your applications enrolled"]}),m>0&&(0,c.jsxs)("p",{children:[(0,c.jsxs)("span",{className:"text-black/80 tabular-nums",children:[x,"%"]}),v?" of enrolments across all course types":" of all ".concat(r," enrolments"),(0,c.jsxs)("span",{className:"text-gray-500",children:[" ","(",(0,c.jsx)("span",{className:"tabular-nums",children:m.toLocaleStr
1ing()})," market-wide",")"]})]})]}),(0,c.jsxs)("div",{className:"grid gap-x-2 gap-y-0.5 text-gray-800 border-t border-gray-border pt-1.5 grid-cols-[auto_1fr_1fr]",children:[(0,c.jsx)("span",{className:"text-gray-500 font-medium text-[11px]",children:"Choice"}),(0,c.jsx)("span",{className:"text-gray-500 font-medium text-[11px] text-right",children:"Applications"}),(0,c.jsx)("span",{className:"text-gray-500 font-medium text-[11px] text-right",children:"Enrolments"}),f.map(e=>{let t=eH(e.enrolments,e.applications);return(0,c.jsxs)("div",{className:"contents",children:[(0,c.jsx)("span",{className:"text-gray-600 pr-1",children:e.choiceLabel}),(0,c.jsx)("span",{className:"text-right tabular-nums",children:e.applications.toLocaleString()}),(0,c.jsxs)("span",{className:"text-right tabular-nums",children:[e.enrolments.toLocaleString(),(0,c.jsx)("span",{className:"text-gray-400 font-normal",children:" (".concat(t.toFixed(1),"%)")})]})]},e.key)})]}),(0,c.jsxs)("div",{className:"pt-2 flex items-center gap-x-4 gap-y-0.5",children:[(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:S}}),(0,c.jsx)("span",{className:"text-[11px] text-gray-600",children:"Applications"})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,c.jsx)("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:A}}),(0,c.jsx)("span",{className:"text-[11px] text-gray-600",children:"Enrolments"})]})]})]})}function eV(e){let{onHoverYear:t,courseTypeLabel:l,...a}=e;return(0,v.useEffect)(()=>{var e;if(t){if(a.active&&(null===(e=a.payload)||void 0===e?void 0:e[0])){let e=a.payload[0].payload;return t({year:e.year,applied:e.Applied,enrolled:e.Enrolled,percentEnrolled:e.Applied>0?e.Enrolled/e.Applied*100:0,marketTotalEnrollments:e.marketTotalEnrollments,marketTotalEnrollmentsPct:e.marketTotalEnrollmentsPct})}return t(null)}},[t,a.active,a.payload]),(0,c.jsx)(eU,{courseTypeLabel:l,...a})}function eW(e){let{data:t,courseTypeLabel:l,onHoverYear:a}=e;if(!t||0===t.length)return(0,c.jsx)("div",{className:"flex items-center justify-center h-80 text-gray-text",children:(0,c.jsx)("p",{className:"text-sm",children:"No historical trends data available for this course type."})});let s=t.map(e=>{let t=e.firstChoice.applications+e.secondChoice.applications+e.thirdChoice.applications,l=e.firstChoice.enrolments+e.secondChoice.enrolments+e.thirdChoice.enrolments;return{year:e.year,Applied:t,Enrolled:l,firstChoice:e.firstChoice,secondChoice:e.secondChoice,thirdChoice:e.thirdChoice,marketTotalEnrollments:e.marketTotalEnrollments,marketTotalEnrollmentsPct:e.marketTotalEnrollmentsPct}});return s.some(e=>e.Applied>0||e.Enrolled>0)?(0,c.jsx)("div",{className:"h-80 w-full min-w-0 outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:s,margin:{top:0,right:0,left:0,bottom:0},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{dataKey:"year"}),(0,c.jsx)(C.B,{width:45}),(0,c.jsx)(ei.u,{content:e=>(0,c.jsx)(eV,{...e,courseTypeLabel:l,onHoverYear:a}),cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"Applied",fill:S,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(eo.$Q,{dataKey:"Enrolled",fill:A,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})}):(0,c.jsx)("div",{className:"flex items-center justify-center h-80 text-gray-text",children:(0,c.jsx)("p",{className:"text-sm",children:"No historical trends data available for this course type."})})}let eX={ALL:"ALL"};function eJ(e){var t,l,a,s,r,n,i,o;let{data:d,courseLabel:u,courseStartYear:m,cycles:x,onCourseStartYearChange:f,loading:g}=e,[y,j]=(0,v.useState)(null),b=(0,v.useMemo)(()=>[{label:"All",value:null},...x.map(e=>({label:e.courseStartYear1.toString(),value:e.courseStartYear1}))],[x]),N=(0,v.useMemo)(()=>null!=m?d.filter(e=>e.year===m):d,[d,m]),{totalApplied:C,totalEnrolled:w,percentEnrolled:k,totalMarketEnrollments:S,marketTotalEnrollmentsPct:A}=(0,v.useMemo)(()=>
1{if(!N.length)return{totalApplied:0,totalEnrolled:0,percentEnrolled:0,totalMarketEnrollments:0,marketTotalEnrollmentsPct:0};let e=N.reduce((e,t)=>e+t.firstChoice.applications+t.secondChoice.applications+t.thirdChoice.applications,0),t=N.reduce((e,t)=>e+t.firstChoice.enrolments+t.secondChoice.enrolments+t.thirdChoice.enrolments,0),l=N.reduce((e,t)=>e+t.marketTotalEnrollments,0);return{totalApplied:e,totalEnrolled:t,percentEnrolled:e>0?Math.round(t/e*100):0,totalMarketEnrollments:l,marketTotalEnrollmentsPct:l>0?Math.round(t/l*1e3)/10:0}},[N]),M=null!==(a=null==y?void 0:null===(t=y.year)||void 0===t?void 0:t.toString())&&void 0!==a?a:d.map(e=>e.year).join(", "),L=(0,v.useMemo)(()=>{var e;let t=null!==(e=null==y?void 0:y.marketTotalEnrollments)&&void 0!==e?e:S;if(t<=0)return"";let l=M.includes(",")?"application cycles ".concat(M):"application cycle ".concat(M),a=t.toLocaleString(),s=u===eK?eX.ALL:u;return"".concat(a," total enrolments across all institutions for ").concat(s===eX.ALL?"all course types":"course ".concat(s)," in ").concat(l,".")},[u,null==y?void 0:y.marketTotalEnrollments,M,S]);return(0,c.jsxs)(v.Fragment,{children:[(0,c.jsx)("div",{className:"flex flex-col gap-4 mb-6",children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("label",{className:"text-sm text-gray-700 whitespace-nowrap",children:"Course start year:"}),(0,c.jsx)(et.Z,{placeholder:"All",options:b,value:m,onChange:e=>f(null!=e?e:null),allowClear:!0,size:"small",style:{width:160}})]})}),g?(0,c.jsx)("div",{className:"h-80 flex items-center justify-center",children:(0,c.jsx)(h.T,{height:"100%"})}):(0,c.jsxs)(v.Fragment,{children:[(0,c.jsx)(eW,{data:N,courseTypeLabel:u,onHoverYear:j}),(0,c.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-3 text-sm text-gray-text sm:flex sm:flex-wrap sm:items-baseline sm:justify-start sm:gap-x-6 sm:gap-y-2",children:[(0,c.jsxs)("span",{className:"min-w-0",children:[(0,c.jsx)("span",{className:"font-medium text-gray-heading",children:"Applied:"})," ",(0,c.jsx)("span",{className:"tabular-nums",children:(null!==(s=null==y?void 0:y.applied)&&void 0!==s?s:C).toLocaleString()})]}),(0,c.jsxs)("span",{className:"min-w-0",children:[(0,c.jsx)("span",{className:"font-medium text-gray-heading",children:"Enrolled:"})," ",(0,c.jsx)("span",{className:"tabular-nums",children:(null!==(r=null==y?void 0:y.enrolled)&&void 0!==r?r:w).toLocaleString()})]}),(0,c.jsxs)("span",{className:"min-w-0 leading-snug",children:[(0,c.jsx)("span",{className:"font-medium text-gray-heading",children:"% Enrolled:"})," ",(0,c.jsxs)("span",{className:"tabular-nums",children:[null!==(n=null==y?void 0:null===(l=y.percentEnrolled)||void 0===l?void 0:l.toFixed(1))&&void 0!==n?n:k.toFixed(1),"%"]})]}),(null!==(i=null==y?void 0:y.marketTotalEnrollments)&&void 0!==i?i:S)>0&&(0,c.jsx)("span",{className:"col-span-2 min-w-0 leading-snug sm:col-auto",children:(0,c.jsx)(p.Z,{title:L,children:(0,c.jsxs)("span",{className:"border-b border-dotted border-gray-400 cursor-help",children:[(0,c.jsx)("span",{className:"font-medium text-gray-heading",children:"% of all enrolments:"})," ",(0,c.jsxs)("span",{className:"tabular-nums",children:[null!==(o=null==y?void 0:y.marketTotalEnrollmentsPct)&&void 0!==o?o:A,"%"]})]})})})]})]})]})}let e0=[{label:"Table",value:o.Table},{label:"Graph",value:o.Graph}],e1={ALL:"ALL",GDL:"GDL",LPC:"LPC",SQE:"SQE"},e2=[e1.GDL,e1.LPC,e1.SQE];function e3(e,t){return e.reduce((e,l)=>({applications:e.applications+l[t].applications,enrolments:e.enrolments+l[t].enrolments}),{applications:0,enrolments:0})}function e6(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,[a,s]=(0,v.useState)(o.Table),[r,n]=(0,v.useState)(e1.ALL),[i,d]=(0,v.useState)(null),u=V.getPreviousCycles(2),{data:h,loading:p,error:f}=(0,m.a)(F.f,{variables:{metricKey:$.N.HISTORICAL_TRENDS,institutionId:l},skip:!l}),g=null==h?void 0:null===(e=h.institutionMetric)||void 0===e?void 0:e.payload,y=r===e1.ALL||e2.some(e=>e===r)?r:e1.ALL,j=(0,v.useMemo)(()=>{var e;return g?"ALL"===y?function(e){let t=eQ()(eq()(e2,t=>{var l;return null!==(l=e[t])&&void 0!==l?l:[]}),"year");return eZ()(Object.values(t).map(e=>{var t,l;let a=e3(e,"firstChoice"),s=e3(e,"secondChoice"),r=e3(e,"thirdChoice"),n=a.enrolments+s.enrolments+r.enrolments,i=e.reduce((e,t)=>
1e+t.marketTotalEnrollments,0);return{year:null!==(l=null===(t=e[0])||void 0===t?void 0:t.year)&&void 0!==l?l:0,firstChoice:a,secondChoice:s,thirdChoice:r,marketTotalEnrollments:i,marketTotalEnrollmentsPct:i>0?Math.round(n/i*1e3)/10:0}}),"year")}(g):null!==(e=g[y])&&void 0!==e?e:[]:[]},[g,y]),b=y===e1.ALL?eK:y;return(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Historical Trends"}),(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between gap-4 mb-6 sm:mb-0",children:[(0,c.jsxs)("div",{className:"flex flex-col",children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-gray-heading mb-1",children:"Application and Enrolment Totals by Course Type"}),(0,c.jsx)("p",{className:"text-sm text-gray-text sm:mb-6",children:"Your application and enrolment totals for previous 2 years based on course start year, course type and order of choices."})]}),(0,c.jsx)(J.default,{options:e0,value:a,onChange:e=>{s(e),d(null)},size:"small",className:"h-fit w-fit"})]}),(0,c.jsx)("div",{className:"border-b border-gray-border pb-4 mb-6",children:(0,c.jsx)(el,{items:Object.values(e1).map(e=>({key:e,label:e})),activeKey:r,onChange:e=>n(e)})}),(0,c.jsxs)("div",{className:"h-fit min-h-40 w-full min-w-0",children:[f&&(0,c.jsxs)("p",{className:"text-red-600 py-8",children:["Error loading historical trends: ",f.message]}),!f&&(a===o.Table?(0,c.jsx)(e$,{data:j,courseType:y,loading:p}):(0,c.jsx)(eJ,{data:j,courseLabel:b,courseStartYear:i,cycles:u,onCourseStartYearChange:d,loading:p}))]})]}),!p&&!f&&(0,c.jsx)(W.O,{lastUpdatedAt:null==h?void 0:null===(t=h.institutionMetric)||void 0===t?void 0:t.calculatedAt})]})}function e4(e){var t;let{active:l,payload:a,label:s}=e;if(!l||!a||0===a.length)return null;let r=null===(t=a[0])||void 0===t?void 0:t.payload,n=(null==r?void 0:r.fullName)||s;return(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg shadow-lg p-3",children:[n&&(0,c.jsx)("p",{className:"text-sm font-medium mb-2 text-black",children:n}),a.map((e,t)=>{if(!e||e.hide)return null;let l="number"==typeof e.value?e.value:0,a=e.name||"";return(0,c.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[e.color&&(0,c.jsx)("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:e.color}}),(0,c.jsx)("span",{className:"text-sm",children:"".concat(a,": ").concat(l.toLocaleString())})]},t)})]})}function e5(e){let{data:t}=e,l=t.map(e=>({institution:e.shortName||e.institutionName,fullName:e.institutionName,"Co-occurrences":e.coOccurrenceCount}));return(0,c.jsx)("div",{className:"h-[356px] w-full outline-none focus:outline-none [&_*]:outline-none [&_*]:focus:outline-none",children:(0,c.jsx)(j.h,{width:"100%",height:"100%",children:(0,c.jsxs)(es.v,{data:l,layout:"vertical",margin:{top:5,right:25,left:0,bottom:5},children:[(0,c.jsx)(er.q,{strokeDasharray:"3 3"}),(0,c.jsx)(en.K,{type:"number"}),(0,c.jsx)(C.B,{type:"category",dataKey:"institution",width:80,tick:(0,c.jsx)(ek,{width:80,fontSize:11})}),(0,c.jsx)(ei.u,{content:e4,cursor:{fill:"#fafafa"}}),(0,c.jsx)(eo.$Q,{dataKey:"Co-occurrences",fill:S,maxBarSize:60,isAnimationActive:!1}),(0,c.jsx)(ec.D,{content:(0,c.jsx)(eu,{})})]})})})}let e8={ALL:"All",GDL:"GDL",LPC:"LPC",SQE:"SQE"};function e9(){var e,t;let{institutionId:l}=(0,x.useRouter)().query,[a,s]=(0,v.useState)(e8.ALL),{data:r,loading:n,error:i}=(0,m.a)(F.f,{variables:{metricKey:$.N.COMPETITOR_ANALYSIS,institutionId:l},skip:!l}),o=null==r?void 0:null===(e=r.institutionMetric)||void 0===e?void 0:e.payload,d=(0,v.useMemo)(()=>{var e;let t=null!==(e=null==o?void 0:o.courseType)&&void 0!==e?e:{},l=new Map;for(let e of Object.values(t))for(let t of e){let e=l.get(t.institutionId);if(e){e.coOccurrenceCount+=t.coOccurrenceCount;continue}l.set(t.institutionId,{...t})}return Array.from(l.values()).sort((e,t)=>t.coOccurrenceCount-e.coOccurrenceCount).slice(0,10)},[null==o?void 0:o.courseType]),u=(0,v.useMemo)(()=>{var e,t;return(null==o?void 0:o.courseType)?a===e8.ALL?d:null!==(t=null===(e=o.courseType)||void 0===e?void 0:e[a])&&void 0!==t?t:[]:[]},[o,a,d]),f=(0,v.useMemo)(()=>(null==o?void 0:o.courseType)?Object.values(e8).map(e=>({key:e,label:e})):[],[null==o?void 0:o.courseType]),g=(0,v.useMemo)(()=>{let e=V.getLastCycles(3),t=e[0].startDate.format("D MMMM YYYY"),l=e[e.length-1].endDate.format("D MMMM YYYY");return"".concat(t," â ").concat(l)},[]);return n||!o?(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Market & Competitor Insights"}),(0,c.jsx)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:(0,c.jsx)("div",{className:"h-80",children:(0,c.jsx)(h.T,{height:"100%"})})})]}):i?(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Market & Competitor Insights"}),(0,c.jsx)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:(0,c.jsxs)("p",{className:"text-red-600",children:["Error loading competitor analysis: ",i.message]})})]}):(null==o?void 0:o.courseType)?(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Market & Competitor Insights"}),(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-gray-heading mb-1",children:"Most Common Competitors"}),(0,c.jsxs)("p",{className:"text-sm text-gray-text mb-4",children:["Institutions most frequently selected alongside your institution on applications based on released and submitted applications from the"," ",(0,c.jsx)(p.Z,{title:g,color:"#1f2937",className:"border-b border-dotted border-current cursor-help",children:"last 3 application cycles."})]}),f.length>0&&(0,c.jsx)("div",{className:"border-b border-gray-border pb-4 mb-6",children:(0,c.jsx)(el,{items:f,activeKey:a,onChange:e=>s(e)})}),0===u.length?(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:"All"===a?"No competitor data available.":"No competitor data for ".concat(a,".")})}):(0,c.jsx)(e5,{data:u})]}),!n&&!i&&(0,c.jsx)(W.O,{lastUpdatedAt:null==r?void 0:null===(t=r.institutionMetric)||void 0===t?void 0:t.calculatedAt})]}):(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)("h2",{className:"text-xl font-semibold text-gray-heading mb-4",children:"Market & Competitor Insights"}),(0,c.jsxs)("div",{className:"bg-white border border-gray-border rounded-lg p-6",children:[(0,c.jsx)("h3",{className:"text-base font-semibold text-gray-heading mb-1",children:"Most Common Competitors"}),(0,c.jsxs)("p",{className:"text-sm text-gray-text mb-4",children:["Institutions most frequently selected alongside your institution on applications based on released and submitted applications from the"," ",(0,c.jsx)(p.Z,{title:g,color:"#1f2937",className:"border-b border-dotted border-current cursor-help",children:"last 3 application cycles."})]}),(0,c.jsx)("div",{className:"flex items-center justify-center h-80",children:(0,c.jsx)("p",{className:"text-sm text-gray-text",children:"No competitor data available."})})]})]})}function e7(){return(0,c.jsxs)(d.H,{children:[(0,c.jsx)(u.p.Heading,{className:"mb-6",children:"Your Institution in Focus"}),(0,c.jsxs)("div",{className:"w-full flex flex-col gap-8",children:[(0,c.jsx)(X,{}),(0,c.jsx)(eN,{}),(0,c.jsx)(eP,{}),(0,c.jsx)(e6,{}),(0,c.jsx)(e9,{})]})]})}var te=l(23943),tt=l(58166),tl=l(50151),ta=l(90429);let ts=()=>{let{institutionId:e}=(0,x.useRouter)().query,{user:t}=(0,te.aC)();if(!t||![ta.dC.Admin,ta.dC.Institution].includes(t.role.name))return(0,c.jsx)(tl.default,{statusCode:404});let l=t.institution&&t.institution.id;return t.role.name!==ta.dC.Institution||l&&l===e?(0,c.jsx)(e7,{}):(0,c.jsx)(tl.default,{statusCode:404})};
1function tr(){return(0,c.jsx)(tt.i,{children:(0,c.jsx)(ts,{})})}},80865:function(e){e.exports={section:"section_section__qToxo","section--leading":"section_section--leading__kNc5q","section--trailing":"section_section--trailing__j90da","section--text-left":"section_section--text-left__3DWUo","section--text-right":"section_section--text-right__W7GmA","section--text-centre":"section_section--text-centre__JtLn0"}},64349:function(e){e.exports={"select--ordinalLabels":"select_select--ordinalLabels__W9s2c",select:"select_select__9q6GD"}},52454:function(e){e.exports={actions:"table_actions__4dyAX","row-shaded":"table_row-shaded__NTBEY","clickable-row":"table_clickable-row__4WOAN"}},17978:function(e){e.exports={container:"loading-spinner_container__vi98G"}}},function(e){e.O(0,[3661,1499,5267,6257,4615,6450,2888,9774,179],function(){return e(e.s=16139)}),_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.