1/*! For license information please see 8372.df099cff.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkedumark_frontend=globalThis.webpackChunkedumark_frontend||[]).push([[8372],{13322(){},84052(e,t,n){n.d(t,["A",0,{group:"urzj2IGI"}])},71480(e,t,n){n.d(t,["A",0,{card:"NZCYpa5X",content:"yV5IV7eK",header:"nst1FVvn",icon:"G310zRyG",eyebrow:"B7chWxyD",close:"_m0dJ47a",intro:"toVcucYX",action:"yJlHQMFS",details:"SUEsJ5I8",choices:"ndCREDHa",choice:"bPcpaEI3",acknowledge:"e3wSbxPC",warning:"cXsdve9X",scopeNote:"LYT6FAVf",footer:"Rbdi1YFM",primary:"Vi7wE6KU",secondary:"AMVdUDwf",notice:"lqWCBp0N",error:"QtujIvJx",floating:"hbmwjDz6",accessBar:"P0zExz_r",accessButton:"c1v4END3"}])},21676(e,t,n){n.d(t,["A",0,{launcherSlot:"nz3oVP8z",launcher:"wSzGLqvp",accessPage:"GGTnxRPL",accessNotice:"Fvo4QUam",accessNoticeIcon:"PboWf2wj",accessNoticeEyebrow:"AkO6L2c6",accessNoticeDetail:"jxpqPVQO",accessNoticeActions:"ajikpRXz",launcherActive:"N7GvEoNX",launcherMark:"mEdGS0YA",legacyConfirmation:"aSVMsn5M",legacyConfirmationIdentity:"F3n7tWnN",legacyConfirmationDetails:"cWbgaxdV",legacyConfirmationSafety:"yO18XiYT",legacyConfirmationActions:"ysVUvRXK",panel:"OplRQTJC",panelMinimized:"HKhkC5AN",panelComplete:"EkhA_nbD","aurora-complete-flash":"E4hXMkXF",minimizedContent:"xrcN9Uj2",minimizedStatus:"oAlU7omq",minimizedBadge:"SPKnxR8B",minimizedBadgeComplete:"pWE4vcx1",minimizedBadgeError:"k4DcscYX",minimizedCopy:"Krwrb9JK",minimizedActions:"SxMWRAC5",panelHeader:"ISaY_Ces",identity:"aWLNdsSq",identityBadge:"KQz7n_P9",identityText:"KOU4EHS_",identityEyebrow:"WYAqSTu0",identityName:"nnAy1sPS",identityNameLabel:"eIf9PVpb",contextChip:"QiOs6n3o",headerActions:"szqu2axj",headerTool:"lx3ktkXR",chat:"LU01ITDz",chatBody:"SkfRge9u",transcript:"UGqwcU3T",userRow:"ZwXEojBp",userBubble:"_KCR92Pf",assistantRow:"kEXsYJrE",assistantBubble:"imwVJnYC",messageParagraph:"M00Ia7w9",messageList:"lFoZjRuZ",activityStatus:"FlPLUAiQ",activityStatusCompact:"L_t9KLVo",activitySpark:"ONkNLYQN","aurora-spark-pulse":"G53WdRRl",activityCopy:"Gk6qpby6",activityEyebrow:"MXj5Jr6I",activityCurrent:"HcmUNLMd","aurora-status-arrive":"kLtbu8GD",metaNote:"__YMP8vE",errorNote:"ZO2CKbYu",inlineRetry:"pNqJYiP4",actionsRow:"Hm3HSjj9",receipts:"nqk0ms9O",receipt:"jJNapn1A",receiptIcon:"ppP39CMa",receiptCopy:"Blr8I0Vc",receiptUndo:"PNPs55o8",receiptUndone:"sBHYmXGd",actionButton:"uuQcI8QN",messageArtifact:"UW2862n9",sources:"unjZJryU",sourcesToggle:"IFlCOxiv",sourcesList:"QMH9op4j",sourceLink:"QNVrLlXn",sourceLabel:"qdlMIrp_",sourceCategory:"d8xnKc3y",messageFooter:"mXnpjXjf",timestamp:"Fspy8ZHZ",messageTool:"BfZMJQQV",emptyState:"zek_f5mk",emptyBadge:"ta8cCwkH",emptyTitle:"V8a2_p7A",emptyCopy:"KnS9cknT",suggestions:"Z6l3Larq",suggestionButton:"LczRVqB0",lockedNotice:"jXUKpfOM",errorStrip:"X2PH_dPn",composer:"wF0zjDrP",composerBusy:"C43KNVMx",composerInput:"YaLlQBHh",composerControls:"siSUmcNM",composerCount:"Uh1yTuMc",sendButton:"gMFEzYCA",composerDragging:"cCRpqBoR",composerAttachments:"QpyNM3LX",attachmentChip:"oJK5Gy1u",attachmentName:"VZ3RUK1r",attachmentSize:"HYnDYcZI",attachmentRemove:"EF8TTgAQ",attachmentProblem:"Un5VL1D7",attachInput:"JS1k6T_r",attachButton:"xQFgrURi",userAttachments:"s1LwFxMs",stopButton:"A8MV1BwH",liveVoiceButton:"UBXwLUJs",history:"UqruUqxR",historyToolbar:"AbqCQ6Xd",historySearch:"N1AepNA3",newChatButton:"IB3rq6Jw",historyState:"ePdqmVDb",historyGroup:"OCEYQGbC",historyGroupTitle:"D3eeymov",historyList:"z7poMN_3",historyItem:"cVWzJyCH",historyItemActive:"urXCS9kC",historyOpen:"ZNLQ1AZX",historyTitle:"edDuWNEh",historyWhen:"QpFoLPch",historyTool:"Vd6kQ6ke",historyRename:"kWt4Uckq",historyConfirm:"cl87hBhE",dangerAction:"yboODM0c",fullScreen:"kfNkTniy",fullScreenHistory:"V6BTkQ2w",fullScreenBrand:"anthLp1H",fullScreenMain:"aK0bJ2ln",fullScreenHeader:"n1nLqGh0",fullScreenTitle:"QtxDAciV","aurora-orbit":"nGEJE91J","aurora-enter":"wub2zKaN",contextBar:"AjJQQucT",panelBackdrop:"UCNxB5g1",srOnly:"yigjPa8y",launcherLabel:"HyCXVYr0",semanticControls:"GFJTpOvv"}])},81273(e,t,n){n.d(t,["A",0,{root:"PtYnkc4k",halo:"NGB8knMK",cursor:"K1QYAWI9",ripple:"D6tcMSxM","aurora-ripple":"Ee71FXRd",anchoredPreview:"H7eprORD",previewCaret:"YBmbco6d","aurora-caret":"Rr6eMBik",pointer:"clFOcknl",pointerArrow:"dDDhqAzX",pointerLabel:"q2q06q_t",pointerName:"pM2WrvzP",pointerStatus:"dccdcu5V",pointerDots:"aTpDo907","aurora-
2pointer-drift":"P6YreFAz","aurora-pointer-breathe":"VDfAxuuO","aurora-pointer-press":"swU5gBJ8","aurora-pointer-dot":"ODoj4zbP",aura:"ypemWC4v","aurora-aura-spin":"uGkwJgMn","aurora-aura-pulse":"PmyJ4W6A",panelLit:"CrInAY9B",controls:"OeLLLRbl",confirmation:"l_vD8ohs",inspector:"vkBmnybp",identity:"JS7XTrSk",statusRow:"SoFngnzb",actions:"qocbCXjJ",confirmationActions:"VlFEpdDM",inspectorHeader:"V6VcdWG5",title:"to54yvw_",target:"AEahE2d5",reason:"nKpg1Qh0",progressLabel:"rxIP42xo",step:"KaAgKeNL",preview:"yJ9c6ez5",progress:"yQcZ44lh",steps:"F5CQkAAy",button:"ixnz1T_H",primaryButton:"lcvgvpvW",dangerButton:"J4ozhp51",inspectorButton:"EoXXJ7Iq",confirmationDetails:"zZcCTFZK",liveRegion:"j1Y0C9Rr",inspectorToggle:"ZWMAkdZI",simulationLabel:"MTIG9FYf",debugHalo:"leEror0K",forceReduced:"oNH3mB3J",dismiss:"wJlsYKOy"}])},19245(e,t,n){n.d(t,["A",0,{page:"rx5IHIBr",brandPanel:"p_uzFbMq",identity:"sQBfAIxU",brandSymbol:"M5hEJgVe",brandStory:"He7MhMHJ",eyebrow:"wNPlTRBt",learningArt:"jxncigKU",orbit:"vXvSEEWC",artCard:"N1_IXwN8",artLines:"kE1FyXZ6",brandFooter:"LjSk1A1X",dot:"FgBAH6YC",formPanel:"Forn_u8V",topLine:"EEpIQFJn",secure:"XBVDoEAA",powered:"Tqh2DbEn",environment:"DInUWmh0",formContent:"hgs_sAbT",heading:"gXOiUpyL",googleButton:"FEgjVAEe",googleMark:"FNmSCiZ3",divider:"MW9PnJeQ",field:"knhwAUDW",passwordField:"htPggIdN",passwordHeading:"XcFVxUd5",submitButton:"Tbk9kjP7",accessHelp:"qgKylk2q",error:"jc3Ew55s",notice:"KLnhA1Il",formFooter:"xSbgqBKy",mobileIdentity:"nkZkRpLZ"}])},70884(e,t,n){n.d(t,["A",0,{page:"O5BkYzg5",header:"_6iaganU",eyebrow:"Z9FarGM8",context:"PxfMzwTn",actions:"oIM4ousB",tabs:"cd9x4uah",inline:"ISuR4MX0",shelf:"UPHbZMbR",button:"Vj5wwNiq",primary:"LHw03PFJ",quiet:"cE2QnmhC",chip:"RxRMPxz_",editor:"CJFZbJh2",grid:"RA_0Bi_C",gridItem:"Qj69s1PM",card:"L0H4olqb",cardHead:"AE6leqJ4",cardTitle:"g3GSVtb2",scope:"F8KOdiO6",icon:"fM5BCOAi",body:"tUw05uum",empty:"eW4UYVXP",rowMain:"lZ0Hu7RR",row:"ErnafRXS",continueAction:"gADpWHh2",rows:"xVnO8t3S",rowAction:"FJlN9RSm",status:"SvbCpkkR",fact:"K8BL_yL8",progress:"ILiEMsbS",footer:"DhacxvPC",notice:"BXm9x_90",error:"OQVv2dSU",skeleton:"sQ1QPLLf",metrics:"af3Zqs_V",metric:"px0n_1aq",sectionTitle:"INe4TS5_",required:"oJBFlbh9",editorList:"ZLyH_obv",editorRow:"YT9SmNJ6",gallery:"WGORnj9N",editorFooter:"jG0FfVar",optionList:"sYGkUdCe",preview:"JJ409j2i",pinButton:"oaUveCmv",homeEnter:"tndced8r"}])},63438(e,t,n){n.d(t,{bL:()=>c});var i=n(12229),a=n(39197),r=n(51706);const s="edumark_landing_auth_flow_v1",o=(e,t)=>{const n=new URL((0,i.F5)("lms-next",e,"/auth/callback"));if(t)try{const e=new URL(t);e.origin===n.origin&&e.pathname===n.pathname||console.warn("AUTH_LMS_CALLBACK_HOST_DRIFT",`backend=${e.origin}${e.pathname}`,`frontend=${n.origin}${n.pathname}`)}catch{console.warn("AUTH_LMS_CALLBACK_URL_UNPARSEABLE")}return n},l=(e,t,n)=>{const a=new URL((0,i.F5)("landing-next",e,"/sol/login"));a.searchParams.set("next",(0,i.jA)(`${t.pathname}${t.search}${t.hash}`)||"/dashboard"),n&&(a.searchParams.set("resume","lms-context"),a.searchParams.set("context",n)),window.location.replace(a.toString())};async function c(e,t,n,c){var d;let u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const m=window.location.hostname,p=(0,i.jA)(t),h=new URL((0,i.yy)(e,m,p)),v=(0,a.aK)(),g=null!==(d=u.centreTarget)&&void 0!==d?d:(0,r.MA)();if(v.token)try{const e=await(0,a.SS)("auth","/auth/lms/handoff",{method:"POST",requiresAuth:!0,body:{return_url:(0,i.jA)(`${h.pathname}${h.search}${h.hash}`),...n?{context_id:n}:{},...g?{destination_host:g.hostname,code_challenge:g.challenge}:{}}});if(!e.code)throw console.error("AUTH_LMS_HANDOFF_RESPONSE_INVALID",`fields=${Object.keys(null!==e&&void 0!==e?e:{}).join(",")||"none"}`),new Error("We could not open your workspace. Please try again.");let t;if(g){const n=`https://${g.hostname}/auth/callback`;if(e.destinationHost!==g.hostname||e.lmsCallbackUrl!==n)throw new Error("We could not verify this centre\u2019s sign-in destination. Please start again from its web address.");t=new URL(n),(0,r.t3)()}else t=o(m,e.lmsCallbackUrl);
2t.searchParams.set("code",e.code);const l=null!==c&&void 0!==c?c:(()=>{try{const e=window.sessionStorage.getItem(s);if(!e)return null;const t=JSON.parse(e);return"number"!==typeof(null===t||void 0===t?void 0:t.startedAt)||"string"!==typeof(null===t||void 0===t?void 0:t.method)||Date.now()-t.startedAt>18e5?null:t}catch{return null}})();l&&Number.isFinite(l.startedAt)&&l.startedAt>0&&(t.searchParams.set("auth_flow_started_at",String(Math.floor(l.startedAt))),t.searchParams.set("auth_method",l.method)),window.location.replace(t.toString())}catch(f){if(f instanceof a.j$&&401===f.status&&!1!==u.redirectOnUnauthorized)return void l(m,h,n);throw f}else{if(!1===u.redirectOnUnauthorized)throw new a.j$("Please sign in to continue.",401,null,"auth");l(m,h,n)}}n.d(t,["hl",0,o,"tH",0,e=>{const t={method:e,startedAt:Date.now()};try{window.sessionStorage.setItem(s,JSON.stringify(t))}catch{}return t}])},17187(e,t,n){var i=n(18537),a=n(5487);const r=new Map,s=(e,t)=>a.default.get(e,t),o=e=>Array.isArray(e)?e.map(o):e&&"object"===typeof e?Object.fromEntries(Object.entries(e).sort((e,t)=>{let[n]=e,[i]=t;return n.localeCompare(i)}).map(e=>{let[t,n]=e;return[t,o(n)]})):e;n.d(t,["G",0,(e,t)=>{if(!(e=>{if(!e)return!0;const t=new Set(["headers","params","responseType"]);return Object.keys(e).every(e=>t.has(e))})(t))return s(e,t);const n=((e,t)=>{var n;return JSON.stringify([e,o(null===t||void 0===t?void 0:t.params),o(null===t||void 0===t?void 0:t.headers),null!==(n=null===t||void 0===t?void 0:t.responseType)&&void 0!==n?n:null,"undefined"===typeof window?null:window.localStorage.getItem("edumrk_dv_ath"),(0,i.yk)()])})(e,t),a=r.get(n);if(a)return a;const l=s(e,t);r.set(n,l);const c=()=>{r.get(n)===l&&r.delete(n)};return l.then(c,c),l}])}
2,7755(e,t,n){var i=n(34539),a=n(18537);const r=i.AE,s="https://systems.aries.edumark.ai".trim().replace(/\/+$/,"");n.d(t,["N_",0,r,"Pw",0,()=>{const e=(()=>{try{return(0,i.Xq)()}catch{return null}})(),t=(0,a.yk)();return{...e?{Authorization:`Bearer ${e}`}:{},...t?{"X-Edumark-Centre":t}:{}}},"tR",0,async e=>{try{const t=await e.json();if(t&&"string"===typeof t.detail)return t.detail;if(null!==t&&void 0!==t&&t.detail&&"string"===typeof t.detail.message)return t.detail.message;if(t&&"string"===typeof t.error)return t.error}catch{}return`Request failed (${e.status})`},"tj",0,s])},94044(e,t,n){var i=n(7755);const a=()=>({"Content-Type":"application/json",...(0,i.Pw)()}),r=async(e,t)=>{const n=await(0,i.N_)(`${i.tj}${e}`,t);if(!n.ok)throw new Error(await(0,i.tR)(n));return n},s=async(e,t)=>{const n=await(0,i.N_)(`${i.tj}${e}`,t);if(404===n.status)return null;if(!n.ok)throw new Error(await(0,i.tR)(n));return n},o=e=>encodeURIComponent(e),l={kind:"live",async getAssignment(e){const t=await s(`/api/assessments/${o(e)}`,{headers:(0,i.Pw)()});return t?await t.json():null},async putAssignment(e){await r("/api/assessments",{method:"POST",headers:a(),body:JSON.stringify(e)})},async provisionLearnerAccess(e,t){const n=await r(`/api/assessments/${o(e)}/access`,{method:"POST",headers:a(),body:JSON.stringify(t)});return await n.json()},async getAttempt(e,t){const n=await s(`/api/assessments/${o(e)}/attempt?learner_id=${encodeURIComponent(t)}`,{headers:(0,i.Pw)()});return n?await n.json():null},async putAttemptDraft(e,t,n){await r(`/api/assessments/${o(e)}/attempt/draft`,{method:"PUT",headers:a(),body:JSON.stringify({learner_id:t,attempt:n})})},async startRestBreak(e,t){const n=await r(`/api/assessments/${o(e)}/attempt/rest-break/start`,{method:"POST",headers:a(),body:JSON.stringify({learner_id:t})});return await n.json()},async endRestBreak(e,t){const n=await r(`/api/assessments/${o(e)}/attempt/rest-break/end`,{method:"POST",headers:a(),body:JSON.stringify({learner_id:t})});return await n.json()},async submitAttempt(e,t,n){const i=await r(`/api/assessments/${o(e)}/attempt/submit`,{method:"POST",headers:a(),body:JSON.stringify({learner_id:t,attempt:n})});return await i.json()},async uploadAttemptFile(e,t,n){const a=new FormData;a.append("file",n,n.name),a.append("learner_id",t);const s=await r(`/api/assessments/${o(e)}/attempt/files`,{method:"POST",headers:(0,i.Pw)(),body:a});return await s.json()},async postAttemptEvents(e,t,n){await r(`/api/assessments/${o(e)}/attempt/events`,{method:"POST",headers:a(),body:JSON.stringify({learner_id:t,events:n})})},async getAttemptEvents(e,t){const n=await r(`/api/assessments/${o(e)}/attempt/events?learner_id=${encodeURIComponent(t)}`,{headers:(0,i.Pw)()});return await n.json()},async getServerTime(){const e=await r("/api/time");return await e.json()},async requestAnswerDoc(e,t){const n=await r(`/api/assessments/${o(e)}/answer-doc`,{method:"POST",headers:a(),body:JSON.stringify({learner_id:t})}),i=(n.headers.get("content-disposition")||"").match(/filename="?([^";]+)"?/i);return{filename:(null===i||void 0===i?void 0:i[1])||`${e}-answers.docx`,blob:await n.blob()}},async parseAnswerDoc(e,t,n){const a=new FormData;a.append("file",n,n.name),a.append("learner_id",t);const s=await r(`/api/assessments/${o(e)}/answer-doc/parse`,{method:"POST",headers:(0,i.Pw)(),body:a});return await s.json()},async getResponses(e){const t=await r(`/api/assessments/${o(e)}/responses`,{headers:(0,i.Pw)()});return await t.json()},async getAccessArrangements(e){const t=await r(`/api/learners/${encodeURIComponent(e)}/access-arrangements`,{headers:(0,i.Pw)()});return await t.json()},async putAccessArrangements(e,t){const{revision:n,...i}=t;await r(`/api/learners/${encodeURIComponent(e)}/access-arrangements`,{method:"PUT",headers:a(),body:JSON.stringify({...i,expected_revision:null!==n&&void 0!==n?n:0})})}};n.d(t,["Y",0,l])},1816(e,t,n){n.d(t,{Ul:()=>f});var i=n(80257),a=n(2413),r=n(8340);const s="em_mock_assessments_v1",o="em_mock_attempts_v1",l="em_mock_events_v1",c="em_mock_files_v1",d="em_mock_access_v1",u=e=>{try{const t=window.localStorage.getItem(e),n=t?JSON.parse(t):{};return n&&"object"===typeof n?n:{}}catch{return{}}},m=(e,t)=>
2{try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},p=(e,t)=>`${e}::${t}`,h=e=>JSON.parse(JSON.stringify(e)),v=e=>"section"!==e.type&&"instruction"!==e.type&&"unsupported_import"!==e.type,g=(e,t)=>{var n;const i=null===(n=e.answer_schema)||void 0===n?void 0:n.kind,a=t.trim();if("rich_text"===i)return{kind:"rich_text",html:a};if("long_text"===i)return{kind:"long_text",text:a};if("short_text"===i)return{kind:"short_text",text:a};if("case_study"===i)return{kind:"case_study",response:a};if("numeric"===i){const e=parseFloat(a.replace(/[^\d.eE+-]/g,""));return Number.isFinite(e)?{kind:"numeric",value:e}:null}return null},f={kind:"mock",async getAssignment(e){const t=u(s)[e];return t?h(t):null},async putAssignment(e){const t=u(s);t[e.assignment_ref]=h(e),m(s,t)},async provisionLearnerAccess(e,t){if(0===t.learner_ids.length)throw new Error("Choose at least one learner for this structured assessment.");const n=Date.parse(t.available_from),i=Date.parse(t.available_until);if(Number.isNaN(n)||Number.isNaN(i)||i<=n)throw new Error("The structured assessment availability window is invalid.");const a={assignment_ref:e,assignment_hash:`mock-${e}`,learner_ids:Array.from(new Set(t.learner_ids)),available_from:t.available_from,available_until:t.available_until,status:"active"};return h(a)},async getAttempt(e,t){const n=u(o)[p(e,t)];return n?h(n):null},async putAttemptDraft(e,t,n){var i;const a=u(o),r=p(e,t);if("submitted"===(null===(i=a[r])||void 0===i?void 0:i.status))throw new Error("An attempt has already been submitted for this assignment.");a[r]=h({...n,status:"draft"}),m(o,a)},async submitAttempt(e,t,n){const i=u(o),a=p(e,t),r=i[a];if("submitted"===(null===r||void 0===r?void 0:r.status))return h(r);const s=h({...n,status:"submitted",timings:{...n.timings,submitted_at:(new Date).toISOString()}});return i[a]=s,m(o,i),h(s)},async uploadAttemptFile(e,t,n){const i=u(c),r=`mock-file-${(0,a.Bb)()}`;return i[r]={filename:n.name},m(c,i),{file_id:r,filename:n.name}},async postAttemptEvents(e,t,n){var i;if(!(e=>{var t,n;return!0===(null===e||void 0===e||null===(t=e.settings)||void 0===t||null===(n=t.integrity)||void 0===n?void 0:n.enabled)})(u(s)[e]))throw new Error("Integrity capture is not enabled for this assignment.");const a=u(l),r=p(e,t),o=[...null!==(i=a[r])&&void 0!==i?i:[],...n];a[r]=o.slice(-2e4),m(l,a)},async getAttemptEvents(e,t){var n;const i=u(l);return h(null!==(n=i[p(e,t)])&&void 0!==n?n:[])},async getServerTime(){const e=new Date;return{now:e.toISOString(),epoch_ms:e.getTime()}},async requestAnswerDoc(e,t){const n=u(s)[e];if(!n)throw new Error("No structured assignment to generate a document for.");const a=[`EduMark answer document \u2014 ${n.metadata.unitTitle||e}`,`Learner: ${t}`,"Write each answer directly below its marker line. Do not edit marker lines.",""];let r=0;return n.blocks.forEach(e=>{v(e)&&(r+=1,a.push(`[[EM:${e.id}]]`),a.push(`Question ${r}: ${(0,i.nH)(e.prompt)}`),a.push(""),a.push(""))}),{filename:`${e}-answers.txt`,blob:new Blob([a.join("\n")],{type:"text/plain"})}},async parseAnswerDoc(e,t,n){var i;const a=u(s)[e];if(!a)throw new Error("No structured assignment to parse against.");const r=new Map(a.blocks.map(e=>[e.id,e])),o=await(e=>"function"===typeof e.text?e.text():new Promise((t,n)=>{const i=new FileReader;i.onload=()=>{var e;return t(String(null!==(e=i.result)&&void 0!==e?e:""))},i.onerror=()=>n(i.error),i.readAsText(e)}))(n),l=[],c=[],d=o.split(/\[\[EM:([^\]]+)\]\]/),m=null===(i=d[0])||void 0===i?void 0:i.trim();m&&c.push(m);const p=new Set;for(let s=1;s<d.length;s+=2){var h;const e=d[s].trim(),t=(null!==(h=d[s+1])&&void 0!==h?h:"").replace(/^\s*Question \d+:[^\n]*\n?/,""),n=r.get(e);if(!n){t.trim()&&c.push(t.trim());continue}p.add(e);const i=t.trim(),a=i?g(n,i):null;l.push({block_id:e,extracted_text:i,mapped:a,confidence:i?.9:.4})}return a.blocks.forEach(e=>{v(e)&&!p.has(e.id)&&l.push({block_id:e.id,extracted_text:"",mapped:null,confidence:.4})}),{entries:l,unmatched_content:c}},async getResponses(e){const t=u(o),n=[];return Object.entries(t).forEach(t=>{let[i,a]=t;i.startsWith(`${e}::`)&&n.push({learner_id:i.slice(e.length+2),status:a.status,submitted_at:a.timings.submitted_at,mode:a.mode,attempt:h(a)})}),n},async getAccessArrangements(e){const t=u(d)[e];return t?h(t):{...r.FP}},async putAccessArrangements(e,t){const n=u(d);n[e]=h(t),m(d,n)}}}
2,8340(e,t,n){n.d(t,{FP:()=>i,Jb:()=>a});const i={extra_time_multiplier:1,rest_breaks:!1},a=()=>!1},38238(e,t,n){var i=n(33006),a=n(84034),r=n(87140),s=n(18537),o=n(79103),l=n(3374);const c="edumark:active-assessment-policy",d="edumark:assessment-policy-changed",u=()=>{const e=(0,r.Du)();return null!==e&&void 0!==e&&e.user.id&&e.activeOrganisationId?`${e.user.id}:${e.activeOrganisationId}`:(0,s.N7)()},m={active:!1,assignmentId:null,attemptId:null,assistancePolicy:null,workRecordEnabled:!1,message:null},p=e=>{try{const t=e?JSON.parse(e):null;if(null===t||void 0===t||!t.scope||t.scope!==u())return m;const n=t.policy;return null!==n&&void 0!==n&&n.active&&n.attemptId&&n.assignmentId?{active:!0,assignmentId:n.assignmentId,attemptId:n.attemptId,assistancePolicy:n.assistancePolicy||"protected",workRecordEnabled:Boolean(n.workRecordEnabled),message:n.message||null}:m}catch{return m}},h=()=>{try{return p(localStorage.getItem(c))}catch{return m}},v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=u();try{e.active&&n?localStorage.setItem(c,JSON.stringify({scope:n,policy:e})):localStorage.removeItem(c)}catch{}window.dispatchEvent(new CustomEvent(d,{detail:{...e,scope:n,verified:t}}))};(0,o._)(()=>{try{localStorage.removeItem(c)}catch{}window.dispatchEvent(new CustomEvent(d,{detail:{...m,scope:u(),verified:!0}}))});const g=e=>{const t=h();e&&t.attemptId&&t.attemptId!==e||v(m)},f=(0,i.createContext)({...m,refresh:async()=>{}}),_=d;n.d(t,["Ef",0,g,"oS",0,e=>{let{children:t}=e;const[n,s]=(0,i.useState)(h),o=(0,r.Um)(),g=`${(null===o||void 0===o?void 0:o.user.id)||""}:${(null===o||void 0===o?void 0:o.activeOrganisationId)||""}`,_=i.useRef(0),y=(0,i.useCallback)(async()=>{const e=u(),t=++_.current;try{const n=await(0,a.KK)();if(e!==u()||t!==_.current)return;const i=n.active?{active:!0,assignmentId:n.assignment_id,attemptId:n.attempt_id,assistancePolicy:n.assistance_policy,workRecordEnabled:n.work_record_enabled,message:n.message}:m;s(i),v(i,!0)}catch{if(e!==u()||t!==_.current)return;s(h())}},[]);(0,i.useEffect)(()=>{s(h()),y();const e=e=>{const t=e.detail;(null===t||void 0===t?void 0:t.scope)===u()&&(s(t||h()),null!==t&&void 0!==t&&t.verified||y())},t=e=>{e.key===c&&(s(p(e.newValue)),y())},n=()=>{y()},i=()=>{document.hidden||y()};return window.addEventListener(d,e),window.addEventListener("storage",t),window.addEventListener("focus",n),window.addEventListener("online",n),document.addEventListener("visibilitychange",i),()=>{_.current+=1,window.removeEventListener(d,e),window.removeEventListener("storage",t),window.removeEventListener("focus",n),window.removeEventListener("online",n),document.removeEventListener("visibilitychange",i)}},[g,y]),(0,i.useEffect)(()=>{if(!n.active)return;const e=window.setInterval(()=>{document.hidden||y()},3e4);return()=>window.clearInterval(e)},[n.active,y]);const b=(0,i.useMemo)(()=>({...n,refresh:y}),[y,n]);return(0,l.jsx)(f.Provider,{value:b,children:t})},"qt",0,(e,t)=>{"in_progress"===t.status?v({active:!0,assignmentId:e,attemptId:t.id,assistancePolicy:t.assistance_policy||"protected",workRecordEnabled:Boolean(t.work_record_enabled),message:"aurora_allowed"===t.assistance_policy?null:"Aurora learning assistance is temporarily unavailable while your protected assessment is in progress."}):g(t.id)},"rj",0,_,"uC",0,()=>(0,i.useContext)(f)])},8346(e,t,n){const i=e=>{var t,n,i,a,r,s,o,l,c,d,u,m,p,h,v,g,f,_,y,b,w;return{schema_version:"invigilation-policy.v1",activity_enabled:null===(t=null!==(n=null===(i=e.invigilation)||void 0===i?void 0:i.activity_enabled)&&void 0!==n?n:null===(a=e.integrity)||void 0===a?void 0:a.enabled)||void 0===t||t,retention_days:null!==(r=null===(s=e.invigilation)||void 0===s?void 0:s.retention_days)&&void 0!==r?r:365,permitted_sources:null!==(o=null===(l=e.invigilation)||void 0===l?void 0:l.permitted_sources)&&void 0!==o?o:[],allowed_tools:null!==(c=null===(d=e.invigilation)||void 0===d?void 0:d.allowed_tools)&&void 0!==c?c:[],allowed_resources:null!==(u=null===(m=e.invigilation)||void 0===m?void 0:m.allowed_resources)&&void 0!==u?u:[],notice_version:"invigilation-notice.v1",acknowledgement_required:!0,screen:(null===(p=e.invigilation)||void 0===p?void 0:p.screen)||"off",camera:(null===(h=e.invigilation)||void 0===h?void 0:h.camera)||"off",microphone:"off",system_audio:"off",source_metadata_fallback:"allow_unverified",interruption:"pause_required_capture",media_retention_days:null!==(v=null===(g=e.invigilation)||void 0===g?void 0:g.media_retention_days)&&void 0!==v?v:30,reviewer_permissions:null!==(f=null===(_=e.invigilation)||void 0===_?void 0:_.reviewer_permissions)&&void 0!==f?f:["summary","replay","decisions","holds"],alternative_arrangements:(null===(y=e.invigilation)||void 0===y?void 0:y.alternative_arrangements)||"Contact your educator before starting to discu
2ss an alternative arrangement.",release_review_required:null!==(b=null===(w=e.invigilation)||void 0===w?void 0:w.release_review_required)&&void 0!==b&&b}},a=e=>{const t=i(e);return{invigilation:t,work_record:{enabled:t.activity_enabled,retention_days:t.retention_days}}};n.d(t,["$f",0,i,"WR",0,e=>{var t;return{...a(e),plagiarism:null!==(t=e.plagiarism)&&void 0!==t?t:{enabled:!1,provider:null}}},"uU",0,a])},2413(e,t,n){const i=["section","instruction","rich_text","long_text","short_text","date","numeric","multiple_choice_single","multiple_choice_multi","true_false","matching","ordering","fill_blank","table","file_upload","categorisation","matrix","multiple_file_upload","case_study","multipart_question","portfolio_evidence","competency_decision","declaration","unsupported_import"],a=["section","instruction"],r=e=>a.includes(e);n.d(t,["Bb",0,()=>{const e=globalThis.crypto;return e&&"randomUUID"in e?e.randomUUID():`blk-${Math.random().toString(36).slice(2,10)}-${Date.now().toString(36)}`},"Wn",0,r,"Zb",0,e=>!r(e)&&"unsupported_import"!==e,"ph",0,e=>{const t=e.filter(e=>{return"string"===typeof(t=e.type)&&i.includes(t);var t});return t.length!==e.length&&"undefined"!==typeof console&&console.warn(`[assessment] Ignoring ${e.length-t.length} block(s) with unknown type \u2014 schema ahead of this client.`),t}])},68607(e,t,n){const i=new Set(["question_marks","criteria_achieved","rubric_bands","weighted_sections","competency_outcomes","holistic_judgement","mixed_custom"]),a={points_by_question:"question_marks",criteria_based:"criteria_achieved",rubric:"rubric_bands",learning_outcomes:"competency_outcomes",threshold:"mixed_custom"},r=new Set(["points_by_question","criteria_based","rubric","learning_outcomes","threshold"]),s=e=>"string"===typeof e&&r.has(e)?e:void 0;n.d(t,["CT",0,e=>{if("string"!==typeof e)return;if(i.has(e))return e;const t=s(e);return t?a[t]:void 0},"P",0,e=>"ARIES_RECOMMENDATION"===e||"AUTHOR_OVERRIDE"===e||"DEFAULT"===e?e:void 0,"Qf",0,e=>{switch(e){case"question_marks":default:return"Marks by question";case"criteria_achieved":return"Criteria achieved";case"rubric_bands":return"Rubric & performance bands";case"weighted_sections":return"Weighted sections";case"competency_outcomes":return"Competency / outcomes";case"holistic_judgement":return"Holistic judgement";case"mixed_custom":return"Mixed / custom"}},"ir",0,s])},38440(e,t,n){n.d(t,["Fe",0,e=>"AI_ASSISTED"===e?"AI-assisted marking":"Human marking","H3",0,function(e){return"AI_ASSISTED"===e||"ai_assisted"===e||"hybrid"===e?"AI_ASSISTED":"HUMAN_ONLY"===e||"human"===e?"HUMAN_ONLY":arguments.length>1&&void 0!==arguments[1]?arguments[1]:"HUMAN_ONLY"},"_u",0,function(e){return"ORGANISATION_DEFAULT"===e||"ASSIGNMENT_OVERRIDE"===e?e:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ASSIGNMENT_OVERRIDE"}])},87140(e,t,n){var i=n(33006),a=n(34463),r=n(79103);let s=null,o=0,l=null;const c=()=>{o+=1,s=null,l=null};(0,r._)(c);const d=(0,i.createContext)(null),u=d.Provider,m=()=>(0,i.useContext)(d);n.d(t,["D2",0,function(e){var t,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!i.refresh&&(null===(t=s)||void 0===t?void 0:t.token)===e)return Promise.resolve({status:"ready",context:s.context});const r=Boolean(i.refresh);if((null===(n=l)||void 0===n?void 0:n.token)===e&&(!r||l.refresh))return l.request;const c=(async(e,t)=>{try{const n=(await a.A.get(`${"https://systems.aries.edumark.ai".replace(/\/+$/,"")}/api/me/context`,{headers:{Authorization:`Bearer ${e}`},timeout:2e4})).data;return n&&Array.isArray(n.organisations)?0===n.organisations.length?{status:"no_membership"}:(t===o&&(s={token:e,context:n}),{status:"ready",context:n}):{status:"unavailable"}}catch(l){var n,i,r;const e=a.A.isAxiosError(l),t=e&&null!==(n=null===(i=l.response)||void 0===i?void 0:i.status)&&void 0!==n?n:null,s=e?(e=>{var t,n;const i=e,a=null!==(t=null===i||void 0===i||null===(n=i.detail)||void 0===n?void 0:n.code)&&void 0!==t?t:null===i||void 0===i?void 0:i.code;return"string"===typeof a?a:null})(null===(r=l.response)||void 0===r?void 0:r.data):null;return 403===t&&"ORG_MEMBERSHIP_REQUIRED"===s?{status:"no_membership"}:401===t?{status:"unauthenticated"}:404===t||null!==t&&t>=500||e&&!l.response?{status:"unavailable"}:{status:"error"}}})(e,++o);l={token:e,refresh:r,request:c};const d=()=>{var e;(null===(e=l)||void 0===e?void 0:e.request)===c&&(l=null)};return c.then(d,d),c},"Du",0,()=>{var e,t;return null!==(e=null===(t=s)||void 0===t?void 0:t.context)&&void 0!==e?e:null},"Lu",0,"em-account-context-invalidated","Ok",0,()=>{var e,t;const n=m();return n&&null!==(e=null!==(t=n.organisations.find(e=>e.id===n.activeOrganisationId))&&void 0!==t?t:n.organisations[0])&&void 0!==e?e:null},"Um",0,m,"eW",0,"em-account-access-refreshed","sG",0,c,"uz",0,u])},53294(e,t,n){n.r(t),n.d(t,{sanitizeReturnPath:()=>r.d});var i=n(61348),a=n(18492),r=n(84322),s=n(2210),o=n(79103),l=n(13709),c=n(73141),d=n(16378),u=n(39197);const m="edumark_lms_onboarding",p="edumark_lms_session_mode",h="edumrk_dv_ath",v="edumark_lms_session_recovery",g=e=>"native"===e||"legacy_compatibility"===e,f=()=>{try{const e=localStorage.getItem(p);return g(e)?e:null}catch{return null}},_=()=>{try{return localStorage.getItem(h)}catch{return null}},y=(e,t)=>{if(void 0===t||_()===t){try{localStorage.removeItem(p)}catch{}(0,o.t)(),e((0,i.ri)())}},b=(e,t,n)=>{if(_()===t){try{sessionStorage.setItem(v,n)}catch{}y(e,t)}},w=(e,t)=>{if(!g(t.sessionMode))throw y(e),new a.b$("Your LMS session could not be verified. Please sign in again.","LMS_SESSION_MODE_INVALID",null);(0,o.t)(),x();try{sessionStorage.removeItem(v)}catch{}var n;localStorage.removeItem("invitationStatus"),n=t.sessionMode,localStorage.setItem(p,n),e((0,i.Ne)({data:{token:t.token,user:t.user,userId:t.userId,userType:(0,l.y)(t.user,t.userType)}}))},x=()=>{try{sessionStorage.removeItem(m)}catch{}};n.d(t,["LMS_SESSION_MODE_KEY",0,p,"LMS_SESSION_TOKEN_KEY",0,h,"applyLmsSession",0,w,"buildLoginPath",0,e=>{const t=(0,r.d)(e);return t?`/login?returnUrl=${encodeURIComponent(t)}`:"/login"},"clearLocalLmsSession",0,y,"clearOnboardingStash",0,x,"endLmsSession",0,async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=_(),i=f();if(!t.everywhere){const t=[];n&&"native"===i&&t.push((0,a.Zj)(n)),(0,s.Bj)(window.location.hostname)&&t.push((0,u.qi)());try{sessionStorage.setItem(v,"signed_out")}catch{}return y(e),void await(0,d.j)(Promise.all(t))}try{n&&"native"===i&&(t.everywhere?await(0,a.ri)(n):await(0,a.Zj)(n))}finally{if(_()===n&&(0,s.Bj)(window.location.hostname))try{await(0,u.qi)()}catch{}if(_()===n){try{sessionStorage.setItem(v,"signed_out")}catch{}y(e)}}},"hydrateStoredLmsSession",0,async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_();if(_()!==t)return{status:"superseded"};
2if(!t){try{localStorage.removeItem(p)}catch{}return{status:"anonymous"}}const n=f();if("legacy_compatibility"===n)return{status:"legacy_compatibility"};if("native"!==n)return b(e,t,"session_invalid"),{status:"cleared",reason:"LMS_SESSION_MODE_INVALID"};try{const n=await(0,a.UH)(t);return _()!==t?{status:"superseded"}:"native"!==n.session.sessionMode?(b(e,t,"session_invalid"),{status:"cleared",reason:"LMS_SESSION_MODE_INVALID"}):(w(e,{...n.session,token:t}),{status:"hydrated"})}catch(i){if(_()!==t)return{status:"superseded"};if((0,a.vF)(i))return b(e,t,"LMS_SESSION_EXPIRED"===i.code?"session_expired":"session_invalid"),{status:"cleared",reason:i.code};throw i}},"readLmsSessionMode",0,f,"readLmsSessionRecoveryReason",0,()=>{try{return(0,c.A)(sessionStorage.getItem(v))}catch{return null}},"readOnboardingStash",0,()=>{try{const e=sessionStorage.getItem(m);if(!e)return null;const t=JSON.parse(e);return t&&"object"===typeof t&&t.token&&t.prefill?t:null}catch{return null}},"readReturnPathFromSearch",0,e=>{var t;const n=new URLSearchParams(e);return(0,r.d)(null!==(t=n.get("returnUrl"))&&void 0!==t?t:n.get("next"))},"rejectLmsSession",0,b,"stashOnboarding",0,e=>{try{sessionStorage.setItem(m,JSON.stringify(e))}catch{}},"switchLmsMembership",0,async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_();if(!n||"native"!==f())throw new a.b$("Switching organisations requires a current LMS session.","LMS_SESSION_COMPATIBILITY_MODE",null);try{const i=await(0,a.JI)(n,t);if(_()!==n)throw new a.b$("A newer LMS session is already active.","LMS_SESSION_SUPERSEDED",null);if("native"!==i.session.sessionMode)throw y(e),new a.b$("Your new LMS session could not be verified. Please sign in again.","LMS_SESSION_MODE_INVALID",null);return w(e,i.session),i.session}catch(i){throw(0,a.vF)(i)&&_()===n&&y(e),i}}])},5158(e,t,n){var i=n(84322),a=n(12229);const r=e=>{const t=(e.membershipId||e.id||e.orgId||"").trim();return t&&t.length<=200&&!/[\r\n]/.test(t)?t:null};n.d(t,["C",0,(e,t,n)=>{const s=new URL((0,a.F5)("landing-next",e,"/sol/login")),o=r(t);s.searchParams.set("resume","lms-context"),o&&s.searchParams.set("context",o);const l=(0,i.d)(n);return l&&s.searchParams.set("next",l),s.toString()},"f",0,r])},46874(e,t,n){var i=n(33006),a=n(85188),r=n(87140),s=n(13946),o=n(3374);const l=(0,i.createContext)(null);n.d(t,["M",0,()=>{const e=(0,i.useContext)(l),t=(0,r.Ok)(),{userType:n,user:o}=(0,a.d4)(e=>e.auth),c=(0,i.useMemo)(()=>{var e,i;return new Set(null!==(e=null!==(i=null===t||void 0===t?void 0:t.permissions)&&void 0!==i?i:s.oT[(0,s.t2)(o,n)])&&void 0!==e?e:[])},[t,n,o]),d=(0,i.useMemo)(()=>{var e;return new Set(null!==(e=null===t||void 0===t?void 0:t.deniedPermissions)&&void 0!==e?e:[])},[t]),u=(0,i.useCallback)(e=>(0,s.n6)(c,e,d),[c,d]);return null!==e&&void 0!==e?e:{permissions:c,serverResolved:Boolean(t),can:u}},"X",0,e=>{let{children:t}=e;const n=(0,r.Ok)(),{userType:c,user:d}=(0,a.d4)(e=>e.auth),u=Boolean(n),m=(0,i.useMemo)(()=>{var e,t;return new Set(null!==(e=null!==(t=null===n||void 0===n?void 0:n.permissions)&&void 0!==t?t:s.oT[(0,s.t2)(d,c)])&&void 0!==e?e:[])},[n,c,d]),p=(0,i.useMemo)(()=>{var e;return new Set(null!==(e=null===n||void 0===n?void 0:n.deniedPermissions)&&void 0!==e?e:[])},[n]),h=(0,i.useCallback)((e,t)=>(0,s.n6)(m,e,p),[m,p]),v=(0,i.useMemo)(()=>({permissions:m,serverResolved:u,can:h}),[h,m,u]);return(0,o.jsx)(l.Provider,{value:v,children:t})}])},13946(e,t,n){var i=n(13709);const a=["calendar.view","practice.use","study.use","aurora.use","learning.submit_work","learning.view_feedback","learning.record_progress","communications.read","live_session.view","live_session.create","live_session.join","live_session.edit","live_session.cancel","live_session.delete","live_session.attendance.view","live_session.attendance.manage","integration.connect_self","integration.connect_organization","integration.manage","people.view","people.create","people.edit","people.deactivate","people.archive","people.manage_roles","people.bulk_import","support.view","support.manage","support.approve","support.confidential","support.evidence","accessibility.policy.manage","cohorts.view","cohorts.create","cohorts.edit","cohorts.archive","cohorts.manage_members","cohorts.assign_staff","courses.view","courses.create","courses.edit","courses.edit_assigned","courses.publish","courses.archive","courses.delete","deliveries.view","deliveries.create","deliveries.edit","deliveries.manage_cohorts","deliveries.manage_team","assignments.view","assignments.create","assignments.edit","assignments.publish","assignments.schedule","assessment.view_submissions","ai_marking.use","plagiarism.view","assessment.claim","asse
2ssment.mark","assessment.edit_mark","assessment.release_feedback","qa.view","qa.sample","qa.moderate","qa.return_to_assessor","qa.approve","qa.signoff","qa.share_evidence","qa.export_evidence","qa.view_audit","integrity.override","communications.send_individual","communications.send_cohort","communications.send_staff","analytics.view","reports.export","settings.view","settings.manage","tenant.manage","permissions.manage"],r={"tenant.manage":["settings.manage","permissions.manage"],"people.view":["people.read","users.read","staff.read"],"people.create":["people.manage","users.manage","staff.manage"],"people.edit":["people.manage","users.manage","staff.manage"],"people.deactivate":["people.manage","users.manage"],"people.archive":["people.manage","users.manage"],"people.manage_roles":["staff.manage","manage_administrators"],"people.bulk_import":["imports.manage"],"cohorts.view":["people.read","users.read"],"cohorts.create":["people.manage","users.manage"],"cohorts.edit":["people.manage","users.manage"],"cohorts.archive":["people.manage","users.manage"],"cohorts.manage_members":["people.manage","users.manage"],"cohorts.assign_staff":["people.manage","users.manage"],"courses.view":["courses.read"],"courses.create":["courses.manage"],"courses.edit":["courses.manage"],"courses.edit_assigned":["courses.manage"],"courses.publish":["courses.manage"],"courses.archive":["courses.manage"],"deliveries.view":["courses.read"],"deliveries.create":["courses.manage"],"deliveries.edit":["courses.manage"],"deliveries.manage_cohorts":["courses.manage"],"deliveries.manage_team":["courses.manage"],"assignments.view":["assignments.read"],"assignments.create":["assignments.create","assignments.manage"],"assignments.edit":["assignments.manage"],"assignments.publish":["assignments.manage"],"assignments.schedule":["assignments.manage"],"assessment.view_submissions":["marking.read"],"assessment.claim":["marking.manage"],"assessment.mark":["marking.manage"],"assessment.edit_mark":["marking.manage"],"assessment.release_feedback":["feedback.release"],"qa.view":["moderation.manage"],"qa.sample":["moderation.manage"],"qa.moderate":["moderation.manage"],"qa.return_to_assessor":["moderation.manage"],"qa.approve":["moderation.manage"],"qa.signoff":["moderation.manage"],"qa.share_evidence":["moderation.manage"],"qa.export_evidence":["moderation.manage"],"qa.view_audit":["audit.read","moderation.manage"],"communications.send_individual":["message_assigned_learners","message_course_members","message_any_org_member"],"communications.send_cohort":["message_cohort_members","message_any_org_member"],"communications.send_staff":["message_staff","message_any_org_member"],"analytics.view":["audit.read"],"reports.export":["audit.read"],"settings.view":["tenant.manage"],"settings.manage":["tenant.manage"],"permissions.manage":["tenant.manage","manage_administrators"]},s=["calendar.view","aurora.use","people.view","communications.read","assessment.view_submissions","assessment.claim","assessment.mark","assessment.release_feedback","communications.send_individual"],o={learner:["calendar.view","practice.use","study.use","learning.submit_work","learning.view_feedback","learning.record_progress","courses.view","deliveries.view","assignments.view","settings.view"],marker:s,assessor:s,educator:["calendar.view","support.view","people.view","cohorts.view","courses.view","deliveries.view","assignments.view","assignments.create","assignments.edit","ai_marking.use","plagiarism.view","assessment.view_submissions","assessment.claim","assessment.mark","assessment.edit_mark","assessment.release_feedback","settings.view"],supervisor:a.filter(e=>"permissions.manage"!==e),admin:a};n.d(t,["Jj",0,a,"VT",0,r,"n6",0,function(e,t){var n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;return!i.has(t)&&(e.has(t)||(null!==(n=r[t])&&void 0!==n?n:[]).some(t=>e.has(t)&&!i.has(t)))},"oT",0,o,"t2",0,(e,t)=>{var n,a,r,s,o,l;const c=e&&"object"===typeof e?e:{},d=null!==(n=null!==(a=null!==(r=null!==(s=null!==(o=null!==(l=c.activeContext)&&void 0!==l?l:c.active_context)&&void 0!==o?o:c.currentMembership)&&void 0!==s?s:c.current_membership)&&void 0!==r?r:c.membership)&&void 0!==a?a:c.tenantContext)&&void 0!==n?n:c.tenant_context,u=d&&"object"===typeof d?d:{},m=[u.role,u.lmsRole,u.lms_role,c.lmsRole,c.lms_role,c.userType,c.user_t
2ype,c.role,t];for(const p of m){if("string"!==typeof p)continue;const e=p.trim().toLowerCase().replace(/[\s.-]+/g,"_");if(["marker","assessor","personal_marker","organisation_marker","organization_marker","centre_marker","center_marker"].includes(e))return"marker";if((0,i.Y)(e))return String(null!==t&&void 0!==t?t:"").toLowerCase()}return String(null!==t&&void 0!==t?t:"").toLowerCase()}])},13650(e,t,n){var i=n(33006),a=n(5487),r=n(87140),s=n(46874),o=n(13946);const l=(e,t)=>(0,o.n6)(e.permissions,t,e.deniedPermissions);let c=0;const d=new Map,u=new Map,m=()=>{c+=1,d.clear(),u.clear()};n.d(t,["JT",0,(e,t)=>{var n;const o=(0,s.M)(),p=(0,r.Um)(),h=(0,r.Ok)(),v=null===t||void 0===t?void 0:t.cohortId,g=null===t||void 0===t?void 0:t.courseId,f=null===t||void 0===t?void 0:t.deliveryId,_=(0,i.useMemo)(()=>(e=>null!==e&&void 0!==e&&e.deliveryId?{type:"delivery",id:e.deliveryId}:null!==e&&void 0!==e&&e.courseId?{type:"course",id:e.courseId}:null!==e&&void 0!==e&&e.cohortId?{type:"cohort",id:e.cohortId}:null)({cohortId:v,courseId:g,deliveryId:f}),[v,g,f]),y=o.can(e),b=String(null!==(n=null===p||void 0===p?void 0:p.user.id)&&void 0!==n?n:""),w=_&&b&&null!==h&&void 0!==h&&h.id?`${h.id}:${b}:${_.type}:${_.id}`:"",[x,k]=(0,i.useState)(0),A=`${w}:${e}:${x}`,[j,S]=(0,i.useState)(null);return(0,i.useEffect)(()=>{const e=()=>{m(),k(e=>e+1)};return window.addEventListener(r.Lu,e),window.addEventListener(r.eW,e),()=>{window.removeEventListener(r.Lu,e),window.removeEventListener(r.eW,e)}},[]),(0,i.useEffect)(()=>{if(!_||!o.serverResolved||!b||!w)return void S(null);let t=!1;const n=d.get(w);if(!n)return S({key:A,allowed:!1}),((e,t,n,i)=>{const r=d.get(e);if(r)return Promise.resolve(r);const s=u.get(e);if(s)return s;const o=c,l=a.default.get((m=`/api/users/${encodeURIComponent(t)}/effective-permissions`,`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${m}`),{params:{scopeType:n,scopeId:i}}).then(t=>{var n;const i=null!==(n=null===t||void 0===t?void 0:t.data)&&void 0!==n?n:t,a={permissions:new Set(Array.isArray(null===i||void 0===i?void 0:i.permissions)?i.permissions.map(String):[]),deniedPermissions:new Set(Array.isArray(null===i||void 0===i?void 0:i.deniedPermissions)?i.deniedPermissions.map(String):[])};return o===c&&d.set(e,a),a}).finally(()=>{u.get(e)===l&&u.delete(e)});var m;return u.set(e,l),l})(w,b,_.type,_.id).then(n=>{t||S({key:A,allowed:l(n,e)})}).catch(()=>{t||S({key:A,allowed:!1})}),()=>{t=!0};S({key:A,allowed:l(n,e)})},[w,e,o.serverResolved,A,_,b]),_&&o.serverResolved?(null===j||void 0===j?void 0:j.key)===A&&j.allowed:y},"Sk",0,()=>(0,s.M)()])},68989(e,t,n){var i=n(55507),a=n(28591);const r=e=>{const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():"unknown"},s="em_studio_extractions_v1";const o=new class{constructor(){this.jobs=new Map,this.pollFailures=new Map,this.startPromises=new Map,this.retryPromises=new Map,this.listeners=new Set,this.timer=null,this.snapshot=[],this.uiSnapshot={minimized:!1},this.syncSnapshot={status:"idle",lastUpdatedAt:null,error:!1},this.scopeRevision=0,this.pendingResume=null,this.lastServerSyncAt=0,this.scope=null,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getSnapshot=()=>this.snapshot,this.getUiSnapshot=()=>this.uiSnapshot,this.getSyncSnapshot=()=>this.syncSnapshot}setScope(e){this.scope!==e&&(null!==this.timer&&window.clearInterval(this.timer),this.timer=null,this.scope=e,this.scopeRevision+=1,this.jobs.clear(),this.pollFailures.clear(),this.retryPromises.clear(),this.startPromises.clear(),this.pendingResume=null,this.lastServerSyncAt=0,this.uiSnapshot={minimized:!1},this.syncSnapshot={status:"idle",lastUpdatedAt:null,error:!1},e&&this.rehydrate(),this.notify())}matchesScope(e){return Boolean(e)&&this.scope===e}notify(){this.snapshot=Array.from(this.jobs.values()).sort((e,t)=>t.createdAt-e.createdAt),this.listeners.forEach(e=>e())}get(e){return e&&this.jobs.get(e)||null}resumable(){return this.snapshot}async start(e,t){var n;const i=null!==(n=null===t||void 0===t?void 0:t.idempotencyKey)&&void 0!==n?n:(0,a.Vx)(e,null===t||void 0===t?void 0:t.assignmentDraftId),r=this.startPromises.get(i);if(r)return r;const s=this.startOnce(e,{...t,idempotencyKey:i});this.startPromises.set(i,s);try{return await s}finally{this.startPromises.get(i)===s&&this.startPromises.delete(i)}}async startOnce(e,t){var n,s,o,l,c;const d=this.scope;(0,i.Lp)("assignment_ai_extraction_started",{file_type:r(e.filename)});const u=await(0,a.Yk)(e,{assignmentDraftId:null!==(n=null===t||void 0===t?void 0:t.assignmentDraftId)&&void 0!==n?n:null,idempotencyKey:null!==(s=null===t||void 0===t?void 0:t.idempotencyKey)&&void 0!==s?s:(0,a.Vx)(e,null!==(o=null===t||void 0===t?void 0:t.assignmentDraftId)&&void 0!==o?o:null)}),m=u.jobId;if((0,i.Lp)("assignment_upload_acknowledged",{draft_id:u.assignmentDraftId,job_id:m,file_type:r(e.filename)}),d!==this.scope)return m;if(this.jobs.has(m))return this.ensurePolling(),m;if(this.jobs.size>=8){const e=this.snapshot[this.snapshot.length-1];e&&"processing"!==e.status&&this.jobs.delete(e.jobId)}return this.jobs.set(m,{jobId:m,filename:e.filename,createdAt:Date.now(),status:"processing",job:null,summary:null,error:null,failure:null,briefFile:e,assignmentDraftId:null!==(l=null!==(c=u.assignmentDraftId)&&void 0!==c?c:null===t||void 0===t?void 0:t.assignmentDraftId)&&void 0!==l?l:null,notifyRequested:!1,hidden:!1}),this.pollFailures.set(m,0),this.ensurePolling(),this.persist(),this.notify(),m}cancelAndDismiss(e){this.jobs.get(e)&&((0,a.BX)(e),this.jobs.delete(e),this.pollFailures.delete(e),this.persist(),this.notify())}dismiss(e){this.jobs.delete(e)&&(this.pollFailures.delete(e),this.persist(),this.notify())}async notifyMe(e,t){const n=this.jobs.get(e);await(0,a.XN)(e,{email:null===t||void 0===t?void 0:t.email}),n&&this.jobs.get(e)===n&&(n.notifyRequested=!0,this.persist(),this.notify()),(0,i.Lp)("assignment_import_notify_me",{email:Boolean(null===t||void 0===t?void 0:t.email)})}async stopPreparationKeepDraft(e){var t;const n=null!==(t=this.jobs.get(e))&&void 0!==t?t:await this.adoptJob(e);if(n&&"processing"===n.status&&!n.stopping){n.stopping=!0,this.persist(),this.notify();try{if(await(0,a.gM)(e),this.jobs.get(e)!==n)return;this.ensurePolling(),await this.pollOne(e)}catch(i){throw this.jobs.get(e)===n&&(n.stopping=!1,this.persist(),this.notify()),i}}}async stopPreparing(e){var t;const n=this.jobs.get(e),r=null!==(t=null===n||void 0===n?void 0:n.assignmentDraftId)&&void 0!==t?t:null;r?await(0,a.bf)(r):await(0,a.BX)(e),n&&this.jobs.get(e)!==n||(this.jobs.delete(e),this.pollFailures.delete(e),this.persist(),this.notify(),(0,i.Lp)("assignment_import_stopped",{}))}hideCompleted(e){const t=this.jobs.get(e);t&&(t.hidden=!0,this.persist(),this.notify())}setMinimized(e){this.uiSnapshot.minimized!==e&&(this.uiSnapshot={minimized:e},this.persist(),this.notify())}
2retryFromFile(e){const t=this.retryPromises.get(e);if(t)return t;const n=this.retryFromFileOnce(e);return this.retryPromises.set(e,n),n.then(()=>{this.retryPromises.get(e)===n&&this.retryPromises.delete(e)},()=>{this.retryPromises.get(e)===n&&this.retryPromises.delete(e)}),n}async retryFromFileOnce(e){const t=this.jobs.get(e);if(!t)return null;try{var n;const r=await(0,a.S8)(e);return this.jobs.get(e)!==t?null:(this.jobs.delete(e),this.pollFailures.delete(e),this.jobs.set(r.jobId,{...t,jobId:r.jobId,createdAt:Date.now(),status:"processing",stopping:!1,job:null,summary:null,error:null,failure:null,assignmentDraftId:null!==(n=r.assignmentDraftId)&&void 0!==n?n:t.assignmentDraftId,hidden:!1}),this.pollFailures.set(r.jobId,0),this.ensurePolling(),this.persist(),this.notify(),(0,i.Lp)("assignment_import_retried",{source:"server"}),r.jobId)}catch(u){if(this.jobs.get(e)!==t)return null;if(!(Boolean(t.briefFile)&&(404===(null===u||void 0===u?void 0:u.status)||405===(null===u||void 0===u?void 0:u.status)||"DRAFT_RETRY_UNAVAILABLE"===(null===u||void 0===u?void 0:u.code)||"SOURCE_DOCUMENT_UNAVAILABLE"===(null===u||void 0===u?void 0:u.code))))throw u}if(!t.briefFile)return null;const r=t.briefFile,s=t.assignmentDraftId,o=(0,a.Vx)(r,s),l=`:retry:${e.replace(/[^a-zA-Z0-9._:/-]/g,"_")}`,c=`${o.slice(0,200-l.length)}${l}`,d=await this.start(r,{assignmentDraftId:s,idempotencyKey:c});return this.jobs.get(e)===t&&d!==e&&(this.jobs.delete(e),this.pollFailures.delete(e),this.persist(),this.notify()),d}async adoptJob(e){var t,n,i,r,s,o,l,c;const d=this.scope,u=this.jobs.get(e);if(u&&(u.job||"processing"===u.status))return u;let m;try{m=await(0,a.y9)(e)}catch{return null}if(d!==this.scope)return null;if("succeeded"===m.status||"partial"===m.status)try{const t=await(0,a.t9)(e);m={...m,normalized:t.normalized,warnings:t.warnings}}catch{}if(d!==this.scope)return null;const p={jobId:e,filename:m.filename||(null===u||void 0===u?void 0:u.filename)||"Uploaded brief",createdAt:null!==(t=null===u||void 0===u?void 0:u.createdAt)&&void 0!==t?t:Date.parse(m.created_at)||Date.now(),status:"processing"===m.status?"processing":"cancelled"===m.status?"cancelled":"failed"===m.status?"failed":"ready",job:m,summary:null!==(n=null===u||void 0===u?void 0:u.summary)&&void 0!==n?n:null,error:m.error_detail||m.error||null,failure:null!==(i=null===u||void 0===u?void 0:u.failure)&&void 0!==i?i:null,briefFile:null!==(r=null===u||void 0===u?void 0:u.briefFile)&&void 0!==r?r:null,assignmentDraftId:null!==(s=null!==(o=m.assignment_draft_id)&&void 0!==o?o:null===u||void 0===u?void 0:u.assignmentDraftId)&&void 0!==s?s:null,notifyRequested:null!==(l=null===u||void 0===u?void 0:u.notifyRequested)&&void 0!==l&&l,hidden:null!==(c=null===u||void 0===u?void 0:u.hidden)&&void 0!==c&&c};return this.jobs.set(e,p),this.pollFailures.set(e,0),"processing"===p.status&&this.ensurePolling(),this.persist(),this.notify(),p}async syncFromServer(e){const t=this.scope,n=this.scopeRevision;if(!t||"loading"===this.syncSnapshot.status)return;const i=Date.now();if((null===e||void 0===e||!e.force)&&i-this.lastServerSyncAt<3e4)return;let r;this.lastServerSyncAt=i,this.syncSnapshot={...this.syncSnapshot,status:"loading"},this.notify();try{r=await(0,a.DB)()}catch{if(n!==this.scopeRevision)return;return this.syncSnapshot={...this.syncSnapshot,status:"error",error:!0},void this.notify()}if(n!==this.scopeRevision)return;let s=!1;if(r.forEach(e=>{var t;const n=this.jobs.get(e.job_id);if(n)return n.summary=e,(n.error||n.failure)&&(s=!0),n.error=null,n.failure=null,null==n.assignmentDraftId&&e.assignment_draft_id&&(n.assignmentDraftId=e.assignment_draft_id),void("processing"===n.status&&"processing"!==e.status&&(n.status="cancelled"===e.status?"cancelled":"failed"===e.status?"failed":"ready",n.stopping=!1,s=!0));this.jobs.size>=8||(this.jobs.set(e.job_id,{jobId:e.job_id,filename:e.filename||"Uploaded brief",createdAt:Date.parse(e.created_at)||Date.now(),status:"processing"===e.status?"processing":"cancelled"===e.status?"cancelled":"failed"===e.status?"failed":"ready",job:null,summary:e,error:null,failure:null,briefFile:null,assignmentDraftId:null!==(t=e.assignment_draft_id)&&void 0!==t?t:null,notifyRequested:!1,hidden:!1}),this.pollFailures.set(e.job_id,0),s=!0)}),s){Array.from(this.jobs.values()).some(e=>"processing"===e.status)&&this.ensurePolling(),this.persist()}this.syncSnapshot={status:"ready",lastUpdatedAt:Date.now(),error:!1},this.notify()}requestResume(e){this.pendingResume=e,this.notify()}peekPendingResume(){return this.pendingResume}consumePendingResume(){const e=this.pendingResume;return this.pendingResume=null,e}async refreshJob(e){return this.jobs.has(e)?(await this.pollOne(e),this.stopPollingIfIdle(),this.get(e)):this.adoptJob(e)}ensurePolling(){null===this.timer&&(this.timer=window.setInterval(()=>{this.pollAll()},1200))}stopPollingIfIdle(){Array.from(this.jobs.values()).some(e=>"processing"===e.status)||null===this.timer||(window.clearInterval(this.timer),this.timer=null)}async pollAll(){const e=Array.from(this.jobs.values()).filter(e=>"processing"===e.status);await Promise.all(e.map(e=>this.pollOne(e.jobId))),this.stopPollingIfIdle()}async pollOne(e){const t=this.jobs.get(e);if(t)try{const u=await(0,a.y9)(e);if(this.jobs.get(e)!==t)return;if(this.pollFailures.set(e,0),t.job=u,t.error=null,t.failure=null,"processing"!==u.status?t.stopping=!1:u.cancel_requested&&(t.stopping=!0),null==t.assignmentDraftId&&u.assignment_draft_id&&(t.assignmentDraftId=u.assignment_draft_id),"succeeded"===u.status||"partial"===u.status){var n,s,o,l,c;try{const n=await(0,a.t9)(e);if(this.jobs.get(e)!==t)return;t.job={...u,normalized:n.normalized,warnings:n.warnings}}catch{}if(this.jobs.get(e)!==t)return;t.status="ready",(0,i.Lp)("partial"===u.status?"assignment_ai_extraction_partial":"assignment_ai_extraction_completed",{file_type:r(t.filename),extraction_duration_ms:u.duration_ms,question_count:null!==(n=null===(s=u.stats)||void 0===s?void 0:s.questions)&&void 0!==n?n:0,warning_count:null!==(o=null===(l=t.job)||void 0===l||null===(c=l.warnings)||void 0===c?void 0:c.length)&&void 0!==o?o:0}),this.persist()}else if("failed"===u.status){var d;t.status="failed",t.error=u.error_detail||u.error||"Extraction failed.",t.failure={message:t.error,status:200,code:Array.isArray(u.validation_errors)&&u.validation_errors.length?"DRAFT_SCHEMA_VALIDATION_FAILED":void 0,retryable:!1},(0,i.Lp)("assignment_ai_extraction_failed",{file_type:r(t.filename),failure_category:null!==(d=u.failure_category)&&void 0!==d?d:"unknown"}),this.persist()}else"cancelled"===u.status&&(t.status="cancelled",t.stopping=!1,t.error=null,this.persist());this.notify()}catch(m){if(this.jobs.get(e)!==t)return;const n=(this.pollFailures.get(e)||0)+1;if(this.pollFailures.set(e,n),n>=4){var u;const e=404===(null===m||void 0===m?void 0:m.status);e&&(t.status="failed"),t.error=e?"Preparation needs to be restarted from the saved document.":"We\u2019re reconnecting to your assignment preparation.",t.failure={message:t.error,status:null!==(u=null===m||void 0===m?void 0:m.status)&&void 0!==u?u:0,code:e?"EXTRACTION_STATUS_NO_LONGER_AVAILABLE":"EXTRACTION_STATUS_TEMPORARILY_UNAVAILABLE",retryable:!0},this.persist(),this.notify()}}}persist(){try{const e=Array.from(this.jobs.values()).map(e=>({jobId:e.jobId,filename:e.filename,createdAt:e.createdAt,status:e.status,stopping:e.stopping,job:"processing"===e.status?null:e.job,summary:e.summary,error:e.error,failure:e.failure,briefFile:e.briefFile,assignmentDraftId:e.assignmentDraftId,notifyRequested:e.notifyRequested,hidden:e.hidden}));let t=JSON.stringify({version:1,jobs:e,ui:this.uiSnapshot});t.length>
23e6&&(t=JSON.stringify({version:1,jobs:e.map(e=>({...e,briefFile:null})),ui:this.uiSnapshot})),this.scope&&window.localStorage.setItem(`${s}:${encodeURIComponent(this.scope)}`,t)}catch{}}rehydrate(){try{const e=this.scope?window.localStorage.getItem(`${s}:${encodeURIComponent(this.scope)}`):null;if(!e)return;const t=JSON.parse(e);if(!t||!Array.isArray(t.jobs))return;if(t.ui&&"boolean"===typeof t.ui.minimized&&(this.uiSnapshot={minimized:t.ui.minimized}),t.jobs.forEach(e=>{null!==e&&void 0!==e&&e.jobId&&null!==e&&void 0!==e&&e.filename&&(this.jobs.set(e.jobId,{jobId:e.jobId,filename:e.filename,createdAt:Number(e.createdAt)||Date.now(),status:["ready","failed","cancelled"].includes(e.status)?e.status:"processing",stopping:Boolean(e.stopping),job:e.job||null,summary:e.summary||null,error:e.error||null,failure:e.failure||null,briefFile:e.briefFile||null,assignmentDraftId:e.assignmentDraftId||null,notifyRequested:Boolean(e.notifyRequested),hidden:Boolean(e.hidden)}),this.pollFailures.set(e.jobId,0))}),this.jobs.size>0){this.snapshot=Array.from(this.jobs.values()).sort((e,t)=>t.createdAt-e.createdAt);this.snapshot.some(e=>"processing"===e.status)&&this.ensurePolling()}}catch{}}};n.d(t,["R",0,o])},98967(e,t,n){const i={reading:"Reading your brief",requirements:"Finding the key requirements",drafting:"Building your assignment draft",checking:"Checking everything",ready:"Ready to review"},a=["reading","requirements","drafting","checking","ready"],r={UPLOADED:"reading",QUEUED:"reading",READING_DOCUMENT:"reading",EXTRACTING_DETAILS:"requirements",EXTRACTING_QUESTIONS:"drafting",VALIDATING:"checking",PREPARING_DRAFT:"checking",READY:"ready",PARTIAL:"ready",FAILED:"reading",CANCELLED:"reading"},s={processing:"Preparing your assignment",succeeded:"Your assignment draft is ready",partial:"Your assignment draft is ready",failed:"We couldn't prepare this assignment",cancelled:"Preparation stopped"},o=e=>{const t=e.stats;if(!t)return[];const n=[],i=(e,t,i,a)=>{t>0&&n.push({key:e,count:t,label:1===t?i:a})};return i("questions",t.questions,"assessment task found","assessment tasks found"),i("criteria",t.criteria,"marking criterion identified","marking criteria identified"),i("resources",t.resources,"supporting resource detected","supporting resources detected"),n};n.d(t,["$_",0,e=>{if(!e||!e.p50||!e.p95)return null;if(e.p95<=90)return"Usually ready in about a minute";const t=Math.max(1,Math.floor(e.p50/60)),n=Math.max(t+1,Math.ceil(e.p95/60));return n>30?null:`Usually ready in ${t} to ${n} minutes`},"ex",0,e=>{var t,n;return null!==(t=null===e||void 0===e?void 0:e.display)&&void 0!==t?t:(e=>{var t,n,l,c,d;const u=e.status,m="failed"===u||"cancelled"===u?null:"succeeded"===u||"partial"===u?"ready":null!==(t=r[null!==(n=e.state)&&void 0!==n?n:"READING_DOCUMENT"])&&void 0!==t?t:"reading",p=m?a.indexOf(m):-1,h=null!==(l=null===(c=e.stats)||void 0===c?void 0:c.questions)&&void 0!==l?l:0,v=a.map((e,t)=>{let n="pending";return p>=0&&(t<p?n="complete":t===p&&(n="ready"===m?"complete":"active")),{key:e,label:"drafting"===e&&h>0?"Preparing the questions":i[e],progress:n}});return{status:u,headline:null!==(d=s[u])&&void 0!==d?d:s.processing,stage_key:m,stage_label:m?v[a.indexOf(m)].label:null,stage_index:p>=0?p+1:null,total_stages:a.length,stages:v,findings:o(e)}})(null!==(n=e)&&void 0!==n?n:{status:"processing"})},"hk",0,e=>{var t,n,i;const a=null!==(t=null!==(n=null===e||void 0===e||null===(i=e.stats)||void 0===i?void 0:i.questions)&&void 0!==n?n:null===e||void 0===e?void 0:e.question_count)&&void 0!==t?t:0;return a>0?`${a} assessment task${1===a?"":"s"} prepared`:null},"v7",0,e=>!e||e<=0?null:e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`])},28591(e,t,n){n.d(t,{BH:()=>q,BX:()=>T,DB:()=>I,Do:()=>$,EK:()=>H,HK:()=>W,Is:()=>D,O:()=>U,OW:()=>B,On:()=>P,S8:()=>N,XN:()=>E,Y1:()=>G,YJ:()=>J,Yk:()=>S,ZP:()=>Y,ZT:()=>z,bf:()=>F,cQ:()=>A,gM:()=>R,rg:()=>O,rh:()=>V,t9:()=>L,y9:()=>C});var i=n(18103),a=n(18537),r=n(38440),s=n(68607);const o="https://systems.aries.edumark.ai".trim().replace(/\/+$/,""),l=e=>e&&"object"===typeof e&&!Array.isArray(e)?e:void 0,c=e=>"string"===typeof e&&e.trim()?e.trim():void 0,d=e=>"number"===typeof e&&Number.isFinite(e)?e:void 0,u=e=>{var t;return Math.min(1,Math.max(0,null!==(t=d(e))&&void 0!==t?t:0))},m=e=>Array.isArray(e)?e.map(c).filter(e=>Boolean(e)):[],p=e=>{var t,n,i,a,r,s,o,u,m,p,h,v,g,f,_,y,b,w,x,k;const A=l(e);if(!A)return null;const j=null!==(t=c(A.documentId))&&void 0!==t?t:c(A.document_id);if(!j)return null;const S=null!==(n=A.boundingBox)&&void 0!==n?n:A.bounding_box,C=Array.isArray(S)&&4===S.length&&S.every(e=>
2void 0!==d(e))?S:void 0;return{documentId:j,...c(A.filename)?{filename:c(A.filename)}:{},...void 0!==d(A.page)?{page:d(A.page)}:{},...C?{boundingBox:C}:{},...c(A.excerpt)?{excerpt:c(A.excerpt)}:{},...c(null!==(i=A.sectionHeading)&&void 0!==i?i:A.section_heading)?{sectionHeading:c(null!==(a=A.sectionHeading)&&void 0!==a?a:A.section_heading)}:{},...void 0!==d(null!==(r=A.pageEnd)&&void 0!==r?r:A.page_end)?{pageEnd:d(null!==(s=A.pageEnd)&&void 0!==s?s:A.page_end)}:{},...void 0!==d(null!==(o=A.paragraphStart)&&void 0!==o?o:A.paragraph_start)?{paragraphStart:d(null!==(u=A.paragraphStart)&&void 0!==u?u:A.paragraph_start)}:{},...void 0!==d(null!==(m=A.paragraphEnd)&&void 0!==m?m:A.paragraph_end)?{paragraphEnd:d(null!==(p=A.paragraphEnd)&&void 0!==p?p:A.paragraph_end)}:{},...void 0!==d(null!==(h=A.tableIndex)&&void 0!==h?h:A.table_index)?{tableIndex:d(null!==(v=A.tableIndex)&&void 0!==v?v:A.table_index)}:{},...void 0!==d(null!==(g=A.rowIndex)&&void 0!==g?g:A.row_index)?{rowIndex:d(null!==(f=A.rowIndex)&&void 0!==f?f:A.row_index)}:{},...void 0!==d(null!==(_=A.columnIndex)&&void 0!==_?_:A.column_index)?{columnIndex:d(null!==(y=A.columnIndex)&&void 0!==y?y:A.column_index)}:{},...c(null!==(b=A.extractionMethod)&&void 0!==b?b:A.extraction_method)?{extractionMethod:c(null!==(w=A.extractionMethod)&&void 0!==w?w:A.extraction_method)}:{},...c(null!==(x=A.parserVersion)&&void 0!==x?x:A.parser_version)?{parserVersion:c(null!==(k=A.parserVersion)&&void 0!==k?k:A.parser_version)}:{},verified:!0===A.verified}},h=(e,t)=>Array.isArray(e)?e.map(l).filter(e=>Boolean(e)).map(t).filter(e=>Boolean(e)):[],v=e=>{const t=l(e);return t?{...t}:null},g=e=>{var t,n,i;const a=e&&"object"===typeof e?e:{},{marking_method:o,marking_model:v,marking_pattern:g,marking_pattern_source:f,marking_recommendation:_,marking_review_required:y,marking_review_reason:b,marking_policy:w,marking_workflow:x,marking_workflow_source:k,...A}=a,j=(e=>{const t=l(e);if(!t)return;const n=(0,s.CT)(t.pattern);if(!n)return;const i=Array.isArray(t.source_references)?t.source_references.map(p).filter(e=>Boolean(e)):[];return{pattern:n,confidence:u(t.confidence),reasons:m(t.reasons),source_references:i,...c(t.detected_scheme_type)?{detected_scheme_type:c(t.detected_scheme_type)}:{}}})(_),S=(e=>{const t=l(e);if(!t)return;const n=e=>"string"===typeof e?e:"",i=h(t.grade_bands,e=>{const t=d(e.min_score),i=d(e.max_score);return{...e,id:n(e.id),label:n(e.label),min_score:null!==t&&void 0!==t?t:null,...void 0!==i?{max_score:i}:null===e.max_score?{max_score:null}:{},outcome:n(e.outcome)}}),a=h(t.criteria_rules,e=>({...e,criterion_id:n(e.criterion_id),rule:n(e.rule)})),r=h(t.question_marks,e=>{const t=c(e.question_id),n=d(e.marks);return t&&void 0!==n?{...e,question_id:t,marks:n}:null}),o=h(t.section_weights,e=>{const t=d(e.weight);return{...e,section_id:n(e.section_id),label:n(e.label),weight:null!==t&&void 0!==t?t:0}}),p=h(t.outcome_rules,e=>{var t,i;const a=l(e.threshold)||{};return{...e,id:n(e.id),label:n(e.label),requirement:"at_least_n"===e.requirement?"at_least_n":"all_minimum",targets:h(e.targets,e=>"question"!==e.kind&&"criterion"!==e.kind&&"section"!==e.kind?null:{kind:e.kind,id:n(e.id)}),threshold:{unit:"marks"===a.unit?"marks":"percent",value:null!==(t=d(a.value))&&void 0!==t?t:null},minimum_count:null!==(i=d(e.minimum_count))&&void 0!==i?i:null,on_unmet:"cap_grade"===e.on_unmet?"cap_grade":"fail",cap_band_id:c(e.cap_band_id)||null,origin:"source"===e.origin?"source":"author"}}),v=l(t.source_mapping),g=v?{...v,...void 0!==d(v.page_start)?{page_start:d(v.page_start)}:{},...void 0!==d(v.page_end)?{page_end:d(v.page_end)}:{},...c(v.section_heading)?{section_heading:c(v.section_heading)}:{},...void 0!==d(v.paragraph_start)?{paragraph_start:d(v.paragraph_start)}:{},...void 0!==d(v.paragraph_end)?{paragraph_end:d(v.paragraph_end)}:{},...void 0!==d(v.table_index)?{table_index:d(v.table_index)}:{},...void 0!==d(v.row_index)?{row_index:d(v.row_index)}:{},...void 0!==d(v.column_index)?{column_index:d(v.column_index)}:{},...void 0!==d(v.confidence)?{confidence:u(v.confidence)}:{}}:void 0,f=c(t.detected_scheme_type),_=(0,s.CT)(t.recommended_pattern),y=d(t.confidence),b=d(t.total_marks),w=d(t.pass_mark),x="string"===typeof t.final_outcome_rule?t.final_outcome_rule:void 0,k="string"===typeof t.notes?t.notes:void 0;return{...t,...f?{detected_scheme_type:f}:null===t.detected_scheme_type?{detected_scheme_type:null}:{},..._?{recommended_pattern:_}:null===t.recommended_pattern?{recommended_pattern:null}:{},...void 0!==y?{confidence:u(y)}:null===t.confidence?{confidence:null}:{},...void 0!==b?{total_marks:b}:null===t.total_marks?{total_marks:null}:{},...void 0!==w?{pass_mark:w}:null===t.pass_mark?{pass_mark:null}:{},...void 0!==x?{final_outcome_rule:x}:null===t.final_outcome_rule?{final_outcome_rule:null}:{},grade_bands:i,criteria_rules:a,outcome_rules:p,question_marks:r,section_weights:o,...g?{source_mapping:g}:null===t.source_mapping?{source_mapping:null}:{},recommendation_reasons:m(t.recommendation_reasons),...void 0!==k?{notes:k}:null===t.notes?{notes:null}:{}}})(w),C=(0,s.ir)(v),I=null!==(t=(0,s.CT)(g))&&void 0!==t?t:(0,s.CT)(C),E=null!==(n=null===j||void 0===j?void 0:j.pattern)&&void 0!==n?n:(0,s.CT)(null===S||void 0===S?void 0:S.recommended_pattern),R=null!==I&&void 0!==I?I:E,$=I?null!==(i=(0,s.P)(f))&&void 0!==i?i:E===R?"ARIES_RECOMMENDATION":"DEFAULT":E?"ARIES_RECOMMENDATION":void 0,N=(e=>null===e?null:"BRIEF_CHANGED"===e||"LOW_CONFIDENCE"===e||"CONFLICTING_EVIDENCE"===e?e:void 0)(b);return{...A,...C?{marking_model:C}:{},...null===g?{marking_pattern:null}:R?{marking_pattern:R}:{},...null===f?{marking_pattern_source:null}:null===g&&(0,s.P)(f)?{marking_pattern_source:(0,s.P)(f)}:$?{marking_pattern_source:$}:{},...j?{marking_recommendation:j}:{},..."boolean"===typeof y?{marking_review_required:y}:{},...void 0!==N?{marking_review_reason:N}:{},...S?{marking_policy:S}:{},overall_feedback_required:!0===a.overall_feedback_required,marking_workflow:(0,r.H3)(null!==x&&void 0!==x?x:o),marking_workflow_source:(0,r._u)(k),second_marking:"required_for_all"===a.second_marking_policy||"rules"===a.second_marking_policy||"not_required"!==a.second_marking_policy&&"available_on_request"!==a.second_marking_policy&&"organisation_policy"!==a.second_marking_policy&&Boolean(a.second_marking),moderation_enabled:"required"===a.moderation_policy||"custom_rules"===a.moderation_policy||"organisation_policy"===a.moderation_policy||"no_moderation"!==a.moderation_policy&&Boolean(a.moderation_enabled),second_marking_policy:"not_required"===a.second_marking_policy||"available_on_request"===a.second_marking_policy||"required_for_all"===a.second_marking_policy||"organisation_policy"===a.second_marking_policy?a.second_marking_policy:"rules"===a.second_marking_policy||a.second_marking?"required_for_all":"available_on_request",moderation_policy:"organisation_policy"===a.moderation_policy||"no_moderation"===a.moderation_policy||"required"===a.moderation_policy?a.moderation_policy:a.moderation_enabled||"custom_rules"===a.moderation_policy?"required":"no_moderation",result_status:"final_after_marking"===a.result_status||"provisional_until_qa"===a.result_status?a.result_status:a.moderation_enabled||a.second_marking?"provisional_until_qa":"final_after_marking"}},f=()=>{const e=(()=>{try{return localStorage.getItem("edumrk_dv_ath")||(0,i.aK)().token||null}catch{return null}})();return e?{Authorization:`Bearer ${e}`}:{}};
2class _ extends Error{constructor(e){var t;super(e.message),this.status=void 0,this.code=void 0,this.detail=void 0,this.retryable=void 0,this.name="StudioApiError",this.status=e.status,this.code=e.code,this.detail=e.detail,this.retryable=null!==(t=e.retryable)&&void 0!==t&&t}}const y=(e,t)=>0===e||408===e||429===e||e>=500,b=e=>"string"===typeof e?e:void 0,w=(e,t)=>{const n=e>0?`Request failed (${e})`:"Could not reach the extraction service.";if(!t||"object"!==typeof t)return new _({status:e,message:n,code:0===e?"NETWORK_ERROR":void 0,retryable:y(e)});const i=t;if("string"===typeof i.detail)return new _({status:e,message:i.detail,detail:i.detail,retryable:y(e)});if(i.detail&&"object"===typeof i.detail){const t=i.detail,a=b(t.code),r=b(t.message)||n,s={code:a,message:r,retryable:"boolean"===typeof t.retryable?t.retryable:void 0,context:t.context&&"object"===typeof t.context&&!Array.isArray(t.context)?t.context:void 0};return new _({status:e,code:a,message:r,detail:s,retryable:"boolean"===typeof t.retryable?t.retryable:y(e)})}return"string"===typeof i.error?new _({status:e,message:i.error,detail:i.error,retryable:y(e)}):new _({status:e,message:n,retryable:y(e)})},x=async e=>{try{return w(e.status,await e.json())}catch{return w(e.status,void 0)}},k=()=>w(0,void 0);async function A(e,t){const n=(0,a.yk)(),i=await fetch(`${o}/api/studio/aurora/inline-suggestions`,{method:"POST",headers:{...f(),"Content-Type":"application/json",...n?{"X-Edumark-Centre":n}:{}},body:JSON.stringify(e),signal:t});if(!i.ok)throw await x(i);const r=await i.json();if(r.target_type!==e.target_type||r.target_id!==e.target_id||null==r.value)throw new Error("Aurora returned an incomplete suggestion. Please try again.");return r}const j=e=>{if(null===e||void 0===e||!e.job_id||null===e||void 0===e||!e.assignment_draft_id||null===e||void 0===e||!e.source_document_id||!0!==(null===e||void 0===e?void 0:e.durable))throw new _({status:503,code:"EXTRACTION_DURABILITY_UNCONFIRMED",retryable:!0,message:"Your upload could not be confirmed as saved. Retry before leaving this page."})};async function S(e,t){var n;const i=new FormData;i.append("file",((e,t)=>{const n=atob(e),i=new Uint8Array(n.length);for(let a=0;a<n.length;a+=1)i[a]=n.charCodeAt(a);return new Blob([i],{type:t||"application/octet-stream"})})(e.content,e.mimeType),e.filename),null!==t&&void 0!==t&&t.assignmentDraftId&&i.append("assignment_draft_id",t.assignmentDraftId);const a={...f()};let r;null!==t&&void 0!==t&&t.idempotencyKey&&(a["Idempotency-Key"]=t.idempotencyKey);try{r=await fetch(`${o}/api/studio/extractions`,{method:"POST",headers:a,body:i})}catch{throw k()}if(!r.ok)throw await x(r);const s=await r.json();return j(s),{jobId:s.job_id,assignmentDraftId:null!==(n=s.assignment_draft_id)&&void 0!==n?n:null,reused:Boolean(s.reused),durable:!0,sourceDocumentId:s.source_document_id,execution:s.execution}}async function C(e){let t;try{t=await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}`,{headers:f()})}catch{throw k()}if(!t.ok)throw await x(t);return await t.json()}async function I(e){const t=new AbortController,n=setTimeout(()=>t.abort(),15e3);try{const n=null!==e&&void 0!==e&&e.activeOnly?"?active=1":"",i=await fetch(`${o}/api/studio/extractions${n}`,{headers:f(),signal:t.signal});if(!i.ok)throw await x(i);const a=await i.json();if(!Array.isArray(null===a||void 0===a?void 0:a.jobs)||!a.jobs.every(e=>{if(!e||"object"!==typeof e)return!1;const t=e;return"string"===typeof t.job_id&&Boolean(t.job_id.trim())&&["processing","succeeded","partial","failed","cancelled"].includes(t.status||"")}))throw new _({status:502,code:"STUDIO_EXTRACTIONS_INVALID_RESPONSE",message:"Assignment activity could not be refreshed. Try again.",retryable:!0});return a.jobs}catch(i){if(i instanceof _)throw i;throw k()}finally{clearTimeout(n)}}async function E(e,t){let n;try{n=await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}/notify`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify({email:Boolean(null===t||void 0===t?void 0:t.email)})})}catch{throw k()}if(!n.ok)throw await x(n)}async function R(e){let t;try{t=await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:f()})}catch{throw k()}if(!t.ok)throw await x(t)}async function $(e,t){let n;try{n=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/telemetry`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{throw k()}if(!n.ok)throw await x(n)}async function N(e){var t;let n;try{n=await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}/retry`,{method:"POST",headers:f()})}catch{throw k()}if(!n.ok)throw await x(n);const i=await n.json();return j(i),{jobId:i.job_id,assignmentDraftId:null!==(t=i.assignment_draft_id)&&void 0!==t?t:null,reused:Boolean(i.reused),durable:!0,sourceDocumentId:i.source_document_id,execution:i.execution}}async function T(e){try{await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}`,{method:"DELETE",headers:f()})}catch{}}async function L(e){var t,n;let i;try{i=await fetch(`${o}/api/studio/extractions/${encodeURIComponent(e)}/result`,{headers:f()})}catch{throw k()}if(!i.ok)throw await x(i);const a=await i.json();return{status:"partial"===a.status?"partial":"succeeded",normalized:null!==(t=a.normalized)&&void 0!==t?t:null,warnings:Array.isArray(a.warnings)?a.warnings:[],assignmentDraftId:null!==(n=a.assignment_draft_id)&&void 0!==n?n:null}}async function O(){let e;try{e=await fetch(`${o}/api/studio/health`,{headers:f()})}catch{throw k()}if(!e.ok)throw await x(e);const t=await e.json();return{ok:Boolean(null===t||void 0===t?void 0:t.ok),aiConfigured:Boolean(null===t||void 0===t?void 0:t.openai_configured),maxUploadMb:Number(null===t||void 0===t?void 0:t.max_upload_mb)||30,acceptedFileTypes:Array.isArray(null===t||void 0===t?void 0:t.accepted_file_types)?t.accepted_file_types:[".docx",".pdf"]}}const M=e=>{var t,n,i,a,r,s,o,l,c,d,u,m,p,h,f,_,y,b,w,x,k,A,j,S;return{draft_id:String(null!==(t=null===e||void 0===e?void 0:e.draft_id)&&void 0!==t?t:""),content_state:["preparing","ready","partial","failed","cancelled"].includes(null===e||void 0===e?void 0:e.content_state)?e.content_state:void 0,capabilities:null!==e&&void 0!==e&&e.capabilities&&"object"===typeof e.capabilities?{can_edit_setup:!0===e.capabilities.can_edit_setup,can_edit_delivery:!0===e.capabilities.can_edit_delivery,can_review_content:!0===e.capabilities.can_review_content}:void 0,applied_extraction:null!==(n=null===e||void 0===e?void 0:e.applied_extraction)&&void 0!==n?n:null,
2source_fingerprint:null!==(i=null===e||void 0===e?void 0:e.source_fingerprint)&&void 0!==i?i:null,readiness:null===e||void 0===e?void 0:e.readiness,job:null!==(a=null===e||void 0===e?void 0:e.job)&&void 0!==a?a:null,creation_mode:["manual","scratch","import","aurora","document","reuse"].includes(null===e||void 0===e?void 0:e.creation_mode)?e.creation_mode:"ai",status:"completed"===(null===e||void 0===e?void 0:e.status)||"discarded"===(null===e||void 0===e?void 0:e.status)?e.status:"active",wizard_step:Number(null===e||void 0===e?void 0:e.wizard_step)||1,setup_completed:!0===(null===e||void 0===e?void 0:e.setup_completed),extraction_job_id:null!==(r=null===e||void 0===e?void 0:e.extraction_job_id)&&void 0!==r?r:null,source_document_id:null!==(s=null===e||void 0===e?void 0:e.source_document_id)&&void 0!==s?s:null,source_filename:null!==(o=null===e||void 0===e?void 0:e.source_filename)&&void 0!==o?o:null,source_definition_version_id:null!==(l=null===e||void 0===e?void 0:e.source_definition_version_id)&&void 0!==l?l:null,source_delivery_id:null!==(c=null===e||void 0===e?void 0:e.source_delivery_id)&&void 0!==c?c:null,source_delivery_revision_id:null!==(d=null===e||void 0===e?void 0:e.source_delivery_revision_id)&&void 0!==d?d:null,source_delivery_assignment_revision:"number"===typeof(null===e||void 0===e?void 0:e.source_delivery_assignment_revision)?e.source_delivery_assignment_revision:null,assignment_ref:null!==(u=null===e||void 0===e?void 0:e.assignment_ref)&&void 0!==u?u:null,preparation_status:["preparing","processing","ready","partial","failed","cancelled"].includes(null===e||void 0===e?void 0:e.preparation_status)?e.preparation_status:"ready",lifecycle_status:["draft","published","archived"].includes(null===e||void 0===e?void 0:e.lifecycle_status)?e.lifecycle_status:"completed"===(null===e||void 0===e?void 0:e.status)?"published":"draft",course_links:Array.isArray(null===e||void 0===e?void 0:e.course_links)?e.course_links:[],content_mode:"document"===(null===e||void 0===e?void 0:e.content_mode)?"document":"structured",submission_mode:"file_upload"===(null===e||void 0===e?void 0:e.submission_mode)||"external"===(null===e||void 0===e?void 0:e.submission_mode)||"none"===(null===e||void 0===e?void 0:e.submission_mode)?e.submission_mode:"file"===(null===e||void 0===e||null===(m=e.delivery)||void 0===m?void 0:m.submission_mode)||"document_allowed"===(null===e||void 0===e||null===(p=e.delivery)||void 0===p?void 0:p.submission_mode)?"file_upload":"external"===(null===e||void 0===e||null===(h=e.delivery)||void 0===h?void 0:h.submission_mode)?"external":"online_response",title:"string"===typeof(null===e||void 0===e?void 0:e.title)?e.title:"",instructions:"str
2ing"===typeof(null===e||void 0===e?void 0:e.instructions)?e.instructions:"",brief_asset:null!==e&&void 0!==e&&e.brief_asset&&"object"===typeof e.brief_asset?e.brief_asset:null,brief_revisions:Array.isArray(null===e||void 0===e?void 0:e.brief_revisions)?e.brief_revisions:[],resources:Array.isArray(null===e||void 0===e?void 0:e.resources)?e.resources:[],revision:Number(null===e||void 0===e?void 0:e.revision)||1,assessment_v2:null!==(f=null===e||void 0===e?void 0:e.assessment_v2)&&void 0!==f?f:null,grading_policy:v(null===e||void 0===e?void 0:e.grading_policy),marking_readiness_issues:Array.isArray(null===e||void 0===e?void 0:e.marking_readiness_issues)?e.marking_readiness_issues.filter(e=>"string"===typeof(null===e||void 0===e?void 0:e.field)&&"string"===typeof(null===e||void 0===e?void 0:e.message)):void 0,mapping_review:null!==e&&void 0!==e&&e.mapping_review&&"string"===typeof e.mapping_review.summary&&Array.isArray(e.mapping_review.issues)?e.mapping_review:null,mapping_check:null!==e&&void 0!==e&&e.mapping_check&&Array.isArray(e.mapping_check.issues)?e.mapping_check:null,delivery:{...null!==(_=null===e||void 0===e?void 0:e.delivery)&&void 0!==_?_:{},submission_mode:"file"===(null===e||void 0===e||null===(y=e.delivery)||void 0===y?void 0:y.submission_mode)||"document_allowed"===(null===e||void 0===e||null===(b=e.delivery)||void 0===b?void 0:b.submission_mode)?"file_upload":"platform"===(null===e||void 0===e||null===(w=e.delivery)||void 0===w?void 0:w.submission_mode)||"platform_only"===(null===e||void 0===e||null===(x=e.delivery)||void 0===x?void 0:x.submission_mode)||"either"===(null===e||void 0===e||null===(k=e.delivery)||void 0===k?void 0:k.submission_mode)?"online_response":null===e||void 0===e||null===(A=e.delivery)||void 0===A?void 0:A.submission_mode},marking_quality:g(null===e||void 0===e?void 0:e.marking_quality),created_at:null!==(j=null===e||void 0===e?void 0:e.created_at)&&void 0!==j?j:null,updated_at:null!==(S=null===e||void 0===e?void 0:e.updated_at)&&void 0!==S?S:null}};async function U(e,t){let n;try{n=await fetch(`${o}/api/studio/assignment-drafts`,{method:"POST",headers:{...f(),"Content-Type":"application/json",...null!==t&&void 0!==t&&t.idempotencyKey?{"Idempotency-Key":t.idempotencyKey}:{}},body:JSON.stringify({creation_mode:e,content_mode:null===t||void 0===t?void 0:t.contentMode,submission_mode:null===t||void 0===t?void 0:t.submissionMode,title:null===t||void 0===t?void 0:t.title,instructions:null===t||void 0===t?void 0:t.instructions,marking_quality:null===t||void 0===t?void 0:t.markingQuality,source_definition_version_id:null===t||void 0===t?void 0:t.sourceDefinitionVersionId})})}catch{throw k()}if(!n.ok)throw await x(n);return M(await n.json())}async function P(e){let{assignmentRef:t,sourceDefinitionVersionId:n,idempotencyKey:i,courseLink:a}=e;const r=new URLSearchParams({assignment_ref:t});if(n&&r.set("source_definition_version_id",n),a)for(const o of["course_id","course_version_id","module_id","course_item_id"]){const e=a[o];e&&r.set(o,e)}let s;try{s=await fetch(`${o}/api/studio/assignment-drafts/published-preview?${r}`,{headers:{...f(),...i?{"Idempotency-Key":i}:{}},cache:"no-store"})}catch{throw k()}if(!s.ok)throw await x(s);const l=await s.json();return{draft:M(l.draft),persisted:!0===l.persisted}}async function q(e){let t,{assignmentRef:n,sourceDefinitionVersionId:i,idempotencyKey:a,courseLink:r}=e;try{t=await fetch(`${o}/api/studio/assignment-drafts/clone-published`,{method:"POST",headers:{...f(),"Content-Type":"application/json",...a?{"Idempotency-Key":a}:{}},body:JSON.stringify({assignment_ref:n,...i?{source_definition_version_id:i}:{},...r?{course_link:r}:{}})})}catch{throw k()}if(!t.ok)throw await x(t);return M(await t.json())}async function D(e){var t;let n;try{n=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}`,{headers:f(),cache:"no-store"})}catch{throw k()}if(!n.ok)throw await x(n);const i=await n.json(),a=M(i);return a.readiness=null===i||void 0===i?void 0:i.readiness,a.job=null!==(t=null===i||void 0===i?void 0:i.job)&&void 0!==t?t:null,a}async function z(e,t,n){var i,a,r;let s;try{s=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/mapping-review`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify({expected_revision:t}),signal:n})}catch(m){if(null!==n&&void 0!==n&&n.aborted)throw m;throw k()}if(!s.ok)throw await x(s);let l=await s.json();if(["queued","processing"].includes(null===(i=l)||void 0===i?void 0:i.status)){const t=l.review_id;if("string"!==typeof t||!t)throw new Error("Aurora returned an incomplete source review. Please check again.");const i=Date.now();let a=0;for(;["queued","processing"].includes(null===(c=l)||void 0===c?void 0:c.status);){var c,d;if(Date.now()-i>=3e5)throw new Error("The source check is taking longer than expected. Check again to retrieve its result. Your draft is unchanged.");const r=a++<5?1500:3e3;await new Promise((e,t)=>
2{if(null!==n&&void 0!==n&&n.aborted)return void t(new DOMException("Source check cancelled.","AbortError"));const i=()=>{clearTimeout(a),t(new DOMException("Source check cancelled.","AbortError"))},a=setTimeout(()=>{null===n||void 0===n||n.removeEventListener("abort",i),e()},r);null===n||void 0===n||n.addEventListener("abort",i,{once:!0})});try{s=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/mapping-review/${encodeURIComponent(t)}`,{headers:f(),signal:n})}catch(m){if(null!==n&&void 0!==n&&n.aborted)throw m;throw k()}if(!s.ok)throw await x(s);if(l=await s.json(),(null===(d=l)||void 0===d?void 0:d.review_id)!==t)throw new Error("Aurora returned an incomplete source review. Please check again.")}}var u;if("failed"===(null===(a=l)||void 0===a?void 0:a.status))throw new Error("string"===typeof(null===(u=l.error)||void 0===u?void 0:u.message)?l.error.message:"Aurora could not complete the source check. Your draft is unchanged; please try again.");if("string"!==typeof(null===(r=l)||void 0===r?void 0:r.proposal_id)||l.draft_id!==e||l.expected_revision!==t||"string"!==typeof l.source_fingerprint||!["changes_proposed","review_required","consistent"].includes(l.status)||!Array.isArray(l.changes)||!Array.isArray(l.issues)||"string"!==typeof l.summary||!Number.isFinite(Date.parse(l.expires_at)))throw new Error("Aurora returned an incomplete source review. Please check again.");if(l.changes.some(e=>!e||"string"!==typeof e.path||"string"!==typeof e.label||"string"!==typeof e.reason||"string"!==typeof e.evidence)||l.issues.some(e=>!e||"string"!==typeof e.message||"string"!==typeof e.code))throw new Error("Aurora returned an incomplete source review. Please check again.");return l}async function B(e){let t;try{t=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e.draft_id)}/mapping-review/${encodeURIComponent(e.proposal_id)}/apply`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify({expected_revision:e.expected_revision,source_fingerprint:e.source_fingerprint})})}catch{throw k()}if(!t.ok)throw await x(t);const n=M(await t.json());if(n.draft_id!==e.draft_id||n.revision<=e.expected_revision)throw new Error("The saved changes could not be confirmed. Reload this draft before trying again.");return n}async function F(e){let t;try{t=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}`,{method:"DELETE",headers:f()})}catch{throw k()}if(!t.ok&&404!==t.status)throw await x(t)}async function W(e,t){let n;try{n=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}`,{method:"PATCH",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{throw k()}if(!n.ok)throw await x(n);return M(await n.json())}async function H(e,t){let n;try{n=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/undo`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify({expected_revision:t})})}catch{throw k()}if(!n.ok)throw await x(n);return M(await n.json())}async function V(e,t){let n;try{n=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/migrate-v2`,{method:"POST",headers:{...f(),"Content-Type":"application/json"},body:JSON.stringify({expected_revision:t})})}catch{throw k()}if(!n.ok)throw await x(n);return M(await n.json())}async function Y(e){let t;try{t=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/support-audit`,{headers:f()})}catch{throw k()}if(!t.ok)throw await x(t);return await t.json()}async function G(e,t){const n=new FormData;let i;n.append("file",t,t.name);try{i=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/resources`,{method:"POST",headers:f(),body:n})}catch{throw k()}if(!i.ok)throw await x(i);const a=await i.json();return{...a,url:a.url&&a.url.startsWith("/")?`${o}${a.url}`:a.url}}async function J(e,t,n){const i=new FormData;let a;i.append("file",t,t.name),i.append("expected_revision",String(n));try{a=await fetch(`${o}/api/studio/assignment-drafts/${encodeURIComponent(e)}/brief`,{method:"POST",headers:f(),body:i})}catch{throw k()}if(!a.ok)throw await x(a);return M(await a.json())}n.d(t,["Vx",0,(e,t)=>{let n=5381;const i=e.content.length>65536?e.content.slice(0,32768)+e.content.slice(-32768):e.content;for(let s=0;s<i.length;s+=1)n=(n<<5)+n+i.charCodeAt(s)|0;const a=(n>>>0).toString(16),r=t?`-${t.replace(/[^a-zA-Z0-9_-]/g,"_").slice(-48)}`:"";return`em-brief-${a}-${e.content.length}${r}`},"_4",0,e=>`${o}/api/studio/source-documents/${encodeURIComponent(e)}`,"m0",0,e=>`${o}/api/studio/brief-assets/${encodeURIComponent(e)}`])},12159(e,t,n){n.d(t,{oV:()=>v,uv:()=>c,k:()=>m});var i=n(77903),a=n(33006),r=n(24053),s=n(93949);var o=n(3374);const l="edumark:page-tour-state-change",c=(e,t,n)=>`${e}:${null!==t&&void 0!==t?t:"anon"}:${n}`,d=()=>window,u=()=>{"undefined"!==typeof window&&window.dispatchEvent(new CustomEvent(l))},m=e=>{if("undefined"===typeof window)return!1;try{return"1"!==window.localStorage.getItem(e)&&(window.localStorage.setItem(e,"1"),u(),!0)}catch{return!1}},p=e=>{let{step:t,tooltipProps:n,closeProps:i,backProps:a,primaryProps:r,skipProps:s,total:l,current:c}=e;const d=l?Math.round((c+1)/l*100):0,u=0===c,m=c===l-1;return(0,o.jsxs)("div",{...n,className:"pt-card",role:"dialog","aria-live":"polite",children:[(0,o.jsxs)("div",{className:"pt-head",children:[(0,o.jsxs)("div",{className:"pt-title",children:[(0,o.jsx)("span",{className:"pt-title-text",children:t.title||"Guide"}),(0,o.jsxs)("span",{className:"pt-pill","aria-label":`Step ${c+1} of ${l}`,children:[c+1," / ",l]})]}),t.content?(0,o.jsx)("div",{className:"pt-sub",children:t.content}):null]}),(0,o.jsxs)("div",{className:"pt-footer",children:[(0,o.jsxs)("div",{className:"pt-left",children:[(0,o.jsx)("div",{className:"pt-ring",style:{"--pt-ring":`${d}%`},"aria-hidden":!0}),(0,o.jsxs)("span",{className:"pt-tiny",children:[d,"% complete"]})]}),(0,o.jsxs)("div",{className:"pt-actions",children:[(0,o.jsx)("button",{...s,className:"pt-btn pt-btn-ghost",children:"Skip"}),!u&&(0,o.jsx)("button",{...a,className:"pt-btn pt-btn-ghost",children:"Back"}),(0,o.jsx)("button",{...r,className:"pt-btn pt-btn-primary",children:m?"Finish":"Next"}),(0,o.jsx)("button",{...i,style:{display:"none"}})]})]}),(0,o.jsxs)("div",{className:"pt-hint",children:[(0,o.jsx)("span",{className:"pt-dot","aria-hidden":!0}),"Tip: Use ",(0,o.jsx)("kbd",{children:"\u2190"}),"/",(0,o.jsx)("kbd",{children:"\u2192"})," or ",(0,o.jsx)("kbd",{children:"Enter"})," to navigate"]})]})},h=e=>{let{title:t,body:n,confirmLabel:i,dismissLabel:a,onConfirm:r,onDismiss:s}=e;return(0,o.jsx)("div",{className:"pt-promptBackdrop",role:"presentation",children:(0,o.jsxs)("div",{className:"pt-promptCard",role:"dialog","aria-modal":"true","aria-labelledby":"pt-prompt-title",children:[(0,o.jsxs)("div",{className:"pt-promptHead",children:[(0,o.jsx)("span",{className:"pt-promptEyebrow",children:"Guided tour"}),(0,o.jsx)("h2",{id:"pt-prompt-title",className:"pt-promptTitle",children:t})]}),(0,o.jsx)("p",{className:"pt-promptBody",children:n}),(0,o.jsxs)("div",{className:"pt-promptActions",children:[(0,o.jsx)("button",{className:"pt-btn pt-btn-primary",type:"button",onClick:r,children:i}),(0,o.jsx)("button",{className:"pt-btn pt-btn-ghost",type:"button",onClick:s,children:a})]})]})})},v=e=>{let{userId:t,storagePrefix:n="tour:v1",steps:v,delayMs:g=450,runIf:f=!0,persist:_=!0,forceRunKey:y=null,storageId:b,lockKey:w,dependsOnKey:x,promptBeforeRun:k=!1,promptTitle:A,promptBody:j,promptConfirmLabel:S="Start tour",promptDismissLabel:C="Not now",onTourEvent:I}=e;const E=(0,i.o)(),R=f&&!E,{pathname:$}=(0,s.zy)(),[N,T]=(0,a.useState)(!1),[L,O]=(0,a.useState)(!1),[M,U]=(0,a.useState)(0),[P,q]=(0,a.useState)(!1),[D,z]=(0,a.useState)(0),B=(0,a.useRef)(y),F=(0,a.useRef)(!1),W=(0,a.useRef)(null),H=(0,a.useRef)(null),V=(0,a.useMemo)(()=>c(n,t,b||$),[n,t,$,b]),Y=null!==A&&void 0!==A?A:"Take a quick tour of this page?",G=null!==j&&void 0!==j?j:`We can walk you through ${v.length} key area${1===v.length?"":"s"} before you get started.`,J=w?`__joyride_lock__:${w}`:null,K=(0,a.useCallback)(()=>
2{if(!J)return!0;return d()[J]===V},[J,V]),X=(0,a.useCallback)(()=>{if(!J)return!0;const e=d();return(!e[J]||e[J]===V)&&(e[J]=V,u(),!0)},[J,V]),Z=(0,a.useCallback)(()=>{if(!J)return;const e=d();e[J]===V&&(e[J]=null,u())},[J,V]),Q=(0,a.useCallback)(()=>v.some(e=>{try{return!!document.querySelector(String(e.target))}catch{return!1}}),[v]),ee=(0,a.useCallback)(()=>{null!==H.current&&(window.clearTimeout(H.current),H.current=null)},[]),te=(0,a.useCallback)(()=>{ee(),T(!1),O(!1),Z()},[ee,Z]),ne=(0,a.useCallback)(e=>(ee(),T(!1),O(!1),U(0),F.current=!1,W.current=null,H.current=window.setTimeout(()=>{H.current=null,T(!0)},e),ee),[ee]),ie=(0,a.useCallback)((e,t)=>{const n="number"===typeof t?t:M,i=v[n];_&&m(V),null===I||void 0===I||I({type:e,index:n,total:v.length,step:i}),T(!1),O(!1),Z()},[I,_,Z,M,v,V]),ae=(0,a.useCallback)(()=>{O(!1),_&&m(V),Z()},[_,Z,V]),re=(0,a.useCallback)(()=>{(K()||X())&&ne(Math.min(g,100))},[X,g,ne,K]),se=(0,a.useCallback)(e=>{var t;const n=Math.max(0,(null!==(t=null===v||void 0===v?void 0:v.length)&&void 0!==t?t:1)-1);U(Math.min(n,Math.max(0,e)))},[v]);(0,a.useEffect)(()=>{if(R)if(null!==v&&void 0!==v&&v.length){if(_&&"1"===window.localStorage.getItem(V))te();else if(x&&"1"!==window.localStorage.getItem(x))te();else if(!J||!K())if(X()){if(!Q())return O(!1),void Z();if(!k)return ne(g);O(!0)}else O(!1)}else te();else te()},[X,te,g,x,Q,ne,J,K,_,k,Z,R,D,v,V]),(0,a.useEffect)(()=>{if(null!==y&&void 0!==y){if(B.current!==y&&(B.current=y,null!==v&&void 0!==v&&v.length&&(!x||"1"===window.localStorage.getItem(x))&&X())){if(Q())return O(!1),ne(0);Z()}}else B.current=y},[X,x,y,Q,ne,Z,v,V]),(0,a.useEffect)(()=>{const e=()=>{z(e=>e+1)};return window.addEventListener(l,e),()=>{window.removeEventListener(l,e)}},[]),(0,a.useEffect)(()=>()=>{ee(),Z()},[ee,Z]),(0,a.useEffect)(()=>{const e=()=>{const e=document.documentElement.getAttribute("data-theme");q("dark"===e)};e();const t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>t.disconnect()},[]),(0,a.useEffect)(()=>{if(!L)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),ae())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[ae,L]);return(0,a.useEffect)(()=>{var e,t;if(!N)return;F.current||(F.current=!0,null===I||void 0===I||I({type:"start",index:M,total:v.length,step:v[M]}));const n=`${M}:${null!==(e=null===(t=v[M])||void 0===t?void 0:t.target)&&void 0!==e?e:"unknown"}`;W.current!==n&&(W.current=n,null===I||void 0===I||I({type:"step_viewed",index:M,total:v.length,step:v[M]}));const i=e=>{if(!(()=>{const e=document.activeElement;if(!e)return!1;const t=(e.tagName||"").toLowerCase();return"input"===t||"textarea"===t||"select"===t||e.isContentEditable})()){if("Escape"===e.key)return e.preventDefault(),void ie("skipped");if("ArrowRight"===e.key||"Enter"===e.key){if(e.preventDefault(),M>=v.length-1)return void ie("completed");se(M+1)}else"ArrowLeft"===e.key&&(e.preventDefault(),se(M-1))}};return window.addEventListener("keydown",i,{passive:!1}),()=>window.removeEventListener("keydown",i)},[ie,I,N,se,M,v]),null!==v&&void 0!==v&&v.length?(0,o.jsxs)(o.Fragment,{children:[L?(0,o.jsx)(h,{title:Y,body:G,confirmLabel:S,dismissLabel:C,onConfirm:re,onDismiss:ae}):null,(0,o.jsx)(r.Ay,{run:N,steps:v,stepIndex:M,continuous:!0,showProgress:!0,showSkipButton:!0,scrollToFirstStep:!0,scrollOffset:80,disableOverlayClose:!0,disableCloseOnEsc:!0,disableScrolling:!1,spotlightClicks:!0,floaterProps:{options:{flip:{padding:16},preventOverflow:{boundariesElement:"window",padding:16}}},tooltipComponent:e=>(0,o.jsx)(p,{...e,total:v.length,current:M}),styles:{options:{primaryColor:P?"#58a1ff":"#0b6bff",textColor:P?"#e5edf8":"#111827",overlayColor:P?"rgba(2, 6, 23, 0.56)":"rgba(15, 23, 42, 0.42)",backgroundColor:P?"#162233":"#ffffff",zIndex:99999},spotlight:{borderRadius:14},beacon:{display:"none"}},callback:e=>{const{action:t,index:n,status:i,type:a}=e,s="number"===typeof n?n:M;i!==r.XQ.FINISHED&&i!==r.XQ.SKIPPED?t!==r.kl.CLOSE?(a===r.qY.STEP_AFTER&&(t===r.kl.NEXT&&U((null!==n&&void 0!==n?n:0)+1),t===r.kl.PREV&&se((null!==n&&void 0!==n?n:0)-1)),a===r.qY.TARGET_NOT_FOUND&&se((null!==n&&void 0!==n?n:0)+(t===r.kl.PREV?-1:1))):ie("skipped",s):ie(i===r.XQ.SKIPPED?"skipped":"completed",s)}})]}):null}},8278(e,t,n){n.d(t,{U:()=>b,A:()=>w});var i=n(33006),a=n(91386),r=n(92355),s=n(49873),o=n(86661),l=n(3235),c=n(3099),d=n(65345);const u=(0,d.A)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),m=(0,d.A)("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);var p=n(54577),h=n(44151),v=n(97738),g=n(78165);const f={trigger:"S1E1RSvb",iconStack:"GupHSNyM",icon:"GeDJujjm",sun:"hfXLsw45",moon:"YwwiawVG",dark:"khjXKwzD",systemBadge:"ER8m1ZnZ",menuItemActive:"HmDPhOn3",menuItemInactive:"KlPy0hPv",segmented:"Ph4PT0zs",segmentedButton:"LI4aNXOO",segmentedButtonActive:"srZnUQSR",segmentedIcon:"rgNxXE0U",segmentedLabel:"fu8PEVgx",cardLabel:"IePEhwfG",cards:"qggtK8DJ",cardButton:"tX0e4Tb6",cardCheck:"DZGmfxgU",cardPreview:"LsHHI1qj"};var _=n(3374);const y=[{mode:"light",label:"Light",Icon:u},{mode:"dark",label:"Dark",Icon:m},{mode:"system",label:"System",Icon:p.A}],b=e=>{let{variant:t="menu",className:n}=e;const{themeMode:d,resolvedTheme:b,setThemeMode:w}=(0,v.eP)(),{effective:x}=(0,g.Rl)(),[k,A]=(0,i.useState)(null),j=Boolean(k),S=(0,i.useMemo)(()=>"system"===d?`Theme: System (${"dark"===b?"Dark":"Light"})`:"Theme: "+("dark"===d?"Dark":"Light"),[d,b]);return"segmented"===t||"cards"===t?(0,_.jsx)("div",{className:["cards"===t?f.cards:f.segmented,n].filter(
2Boolean).join(" "),role:"group","aria-label":"Theme mode",children:y.map(e=>{let{mode:n,label:i,Icon:a}=e;const r=d===n;return(0,_.jsxs)("button",{type:"button",className:`${"cards"===t?f.cardButton:f.segmentedButton} ${r?f.segmentedButtonActive:""}`.trim(),"aria-pressed":r,title:"system"===n?`System (${b})`:i,onClick:()=>w(n),children:["cards"===t&&(0,_.jsxs)("span",{className:f.cardPreview,"data-mode":n,"aria-hidden":"true",children:[(0,_.jsx)("span",{}),(0,_.jsxs)("span",{children:[(0,_.jsx)("i",{}),(0,_.jsx)("i",{}),(0,_.jsx)("i",{})]})]}),(0,_.jsxs)("span",{className:"cards"===t?f.cardLabel:f.segmentedLabel,children:[(0,_.jsx)(a,{className:f.segmentedIcon,"aria-hidden":"true"}),(0,_.jsx)("span",{children:i}),"cards"===t&&(0,_.jsx)(h.A,{className:f.cardCheck,"aria-hidden":"true",style:{opacity:r?1:0}})]})]},n)})}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(a.A,{title:S,arrow:!0,children:(0,_.jsxs)(r.A,{"aria-label":"Change theme","aria-controls":j?"theme-mode-menu":void 0,"aria-haspopup":"menu","aria-expanded":j?"true":void 0,onClick:e=>A(e.currentTarget),className:[f.trigger,n].filter(Boolean).join(" "),children:[(0,_.jsxs)("span",{className:`${f.iconStack} ${"dark"===b?f.dark:""}`,children:[(0,_.jsx)(u,{className:`${f.icon} ${f.sun}`,strokeWidth:1.8}),(0,_.jsx)(m,{className:`${f.icon} ${f.moon}`,strokeWidth:1.8})]}),"system"===d&&(0,_.jsx)("span",{className:f.systemBadge,"aria-hidden":"true",children:(0,_.jsx)(p.A,{strokeWidth:1.8})})]})}),(0,_.jsx)(s.A,{transitionDuration:"standard"===x?150:0,id:"theme-mode-menu",anchorEl:k,open:j,onClose:()=>A(null),transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,PaperProps:{sx:{mt:1,borderRadius:"12px",minWidth:180,background:"var(--surface-2)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",boxShadow:"var(--shadow-md)"}},children:y.map(e=>{let{mode:t,label:n,Icon:i}=e;const a=t===d;return(0,_.jsxs)(o.A,{onClick:()=>{w(t),A(null)},className:a?f.menuItemActive:f.menuItemInactive,children:[(0,_.jsx)(l.A,{sx:{color:"inherit",minWidth:32},children:(0,_.jsx)(i,{size:18,strokeWidth:1.8})}),(0,_.jsx)(c.A,{primary:n,secondary:a?"Selected":void 0,secondaryTypographyProps:{sx:{color:"var(--text-tertiary)",fontSize:11}}})]},t)})})]})},w=b},44285(e,t,n){n.d(t,{FQ:()=>x,rp:()=>h});var i=n(72019);const a=/^ {0,3}(`{3,}|~{3,})\s*(\S*)[^`]*$/,r=/^ {0,3}(#{1,6})\s+(.*)$/,s=/^ {0,3}(-{3,}|\*{3,}|_{3,})\s*$/,o=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,l=/^\s*\|?(\s*:?-+:?\s*\|)*\s*:?-+:?\s*\|?\s*$/,c=/^ {0,3}>\s?(.*)$/,d=/^!\[([^\]]*)\]\(\s*(\S+?)(?:\s+"([^"]*)")?\s*\)\s*$/,u=new Set(["\\","`","*","_","{","}","[","]","(",")","#","+","-",".","!","|","$","<",">"]);function m(e,t){if(!t)return;const n=e[e.length-1];n&&"text"===n.type?n.value+=t:e.push({type:"text",value:t})}function p(e,t,n){let i=e.indexOf(n,t);for(;i>0&&"\\"===e[i-1]&&n.startsWith("\\");)i=e.indexOf(n,i+1);return i}function h(e){const t=[];let n=0;const i=e.length;for(;n<i;){const a=e[n];if("\n"!==a){if("`"===a){let a=n;for(;a<i&&"`"===e[a];)a+=1;const r=e.slice(n,a);let s=e.indexOf(r,a);for(;-1!==s&&"`"===e[s+r.length];){let t=s;for(;t<i&&"`"===e[t];)t+=1;s=e.indexOf(r,t)}if(-1!==s){let i=e.slice(a,s);i.startsWith(" ")&&i.endsWith(" ")&&""!==i.trim()&&(i=i.slice(1,-1)),t.push({type:"code",value:i.replace(/\n/g," ")}),n=s+r.length;continue}m(t,r),n=a;continue}if("\\"===a){const i=e[n+1];if("("===i||"["===i){const a=p(e,n+2,"("===i?"\\)":"\\]");if(-1!==a){const r=e.slice(n+2,a).trim();t.push("("===i?{type:"inlineMath",tex:r}:{type:"displayMath",tex:r}),n=a+2;continue}m(t,e.slice(n,n+2)),n+=2;continue}if(void 0!==i&&u.has(i)){m(t,i),n+=2;continue}m(t,a),n+=1;continue}if("!"===a&&"["===e[n+1]){const i=v(e,n);if(i){t.push({type:"image",src:i.src,alt:i.alt}),n=i.end;continue}}if("["===a){const i=g(e,n);if(i){t.push({type:"link",href:i.href,children:h(i.label)}),n=i.end;continue}}if("*"===a){const i=e.startsWith("**",n),a=i?"**":"*",r=n+a.length;if(e[r]&&" "!==e[r]&&"*"!==e[r]){let s=e.indexOf(a,r);for(;-1!==s&&" "===e[s-1];)s=e.indexOf(a,s+a.length);if(-1!==s&&s>r){const o=h(e.slice(r,s));t.push(i?{type:"strong",children:o}:{type:"em",children:o}),n=s+a.length;continue}}m(t,a),n+=a.length;continue}m(t,a),n+=1}else t.push({type:"break"}),n+=1}return t}function v(e,t){var n;const i=e.indexOf("]",t+2);if(-1===i||"("!==e[i+1])return null;const a=e.indexOf(")",i+2);if(-1===a)return null;const r=null!==(n=e.slice(i+2,a).trim().split(/\s+/)[0])&&void 0!==n?n:"";return{alt:e.slice(t+2,i),src:r,end:a+1}}function g(e,t){var n;const i=e.indexOf("]",t+1);if(-1===i||"("!==e[i+1])return null;const a=e.indexOf(")",i+2);if(-1===a)return null;const r=null!==(n=e.slice(i+2,a).trim().split(/\s+/)[0])&&void 0!==n?n:"";return{label:e.slice(t+1,i),href:r,end:a+1}}function f(e){const t=[];let n="",i=0;
2const a=e.trim(),r=a.startsWith("|")?a.slice(1):a,s=r.endsWith("|")&&!r.endsWith("\\|")?r.slice(0,-1):r;for(;i<s.length;)"\\"!==s[i]||"|"!==s[i+1]?"|"!==s[i]?(n+=s[i],i+=1):(t.push(n.trim()),n="",i+=1):(n+="\\|",i+=2);return t.push(n.trim()),t}function _(e){const t=e.trim(),n=t.startsWith(":"),i=t.endsWith(":");return n&&i?"center":i?"right":n?"left":null}function y(e){return a.test(e)||r.test(e)||s.test(e)||o.test(e)||c.test(e)||e.trim().startsWith("\\[")}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=[];let u=0;if(t>i.Mq.maxNestingDepth){const t=e.join("\n").trim();return t?[{type:"paragraph",children:h(t)}]:[]}for(;u<e.length;){const i=e[u];if(""===i.trim()){u+=1;continue}const p=i.match(a);if(p){const t=p[1],i=p[2]?p[2]:null,a=new RegExp(`^ {0,3}${t[0]}{${t.length},}\\s*$`),r=[];for(u+=1;u<e.length&&!a.test(e[u]);)r.push(e[u]),u+=1;u<e.length&&(u+=1),n.push({type:"codeBlock",lang:i,value:r.join("\n")});continue}if(i.trim().startsWith("\\[")){const t=[];let a=null,r=!1,s=u,o=i.trim().slice(2);for(;s<e.length;){const n=o.indexOf("\\]");if(-1!==n){t.push(o.slice(0,n));a=o.slice(n+2).trim()||null,r=!0,s+=1;break}t.push(o),s+=1,o=s<e.length?e[s]:""}if(r){n.push({type:"mathBlock",tex:t.join("\n").trim()}),u=s,a&&e.splice(u,0,a);continue}}const v=i.match(r);if(v){const e=v[1].length,t=v[2].replace(/\s+#+\s*$/,"");n.push({type:"heading",level:e,children:h(t)}),u+=1;continue}if(s.test(i)&&!o.test(i)){n.push({type:"hr"}),u+=1;continue}if(i.match(c)){const i=[];for(;u<e.length;){const t=e[u].match(c);if(!t)break;i.push(t[1]),u+=1}n.push({type:"blockquote",children:b(i,t+1)});continue}const g=i.match(o);if(g){const i=g[1].length,a=/\d/.test(g[2][0]),r=a&&parseInt(g[2],10)||1,s=[];let l=[];const c=()=>{l.length&&s.push(b(l,t+1)),l=[]};for(;u<e.length;){const t=e[u],n=t.match(o);if(n&&n[1].length===i&&/\d/.test(n[2][0])===a)c(),l.push(n[3]),u+=1;else if(n&&n[1].length>
2i)l.push(t.slice(Math.min(i+2,n[1].length))),u+=1;else{if(""===t.trim()){var m;const t=e[u+1];if(t&&((null===(m=t.match(o))||void 0===m?void 0:m[1].length)===i||/^\s{2,}\S/.test(t))){l.push(""),u+=1;continue}break}if(!/^\s{2,}\S/.test(t)||n)break;l.push(t.trim()),u+=1}}c(),n.push({type:"list",ordered:a,start:r,items:s});continue}if(i.includes("|")&&u+1<e.length&&e[u+1].includes("-")&&l.test(e[u+1])&&e[u+1].includes("|")){const t=f(i),a=f(e[u+1]).map(_);for(;a.length<t.length;)a.push(null);const r=[];for(u+=2;u<e.length&&e[u].includes("|")&&""!==e[u].trim();)r.push(f(e[u])),u+=1;n.push({type:"table",align:a.slice(0,t.length),header:t.map(e=>h(e)),rows:r.map(e=>{const n=e.slice(0,t.length);for(;n.length<t.length;)n.push("");return n.map(e=>h(e))})});continue}const w=i.match(d);if(w){n.push({type:"figure",alt:w[1],src:w[2],caption:w[3]?w[3]:null}),u+=1;continue}const x=[i];for(u+=1;u<e.length&&""!==e[u].trim()&&!y(e[u])&&!(e[u].includes("|")&&u+1<e.length&&l.test(e[u+1])&&e[u+1].includes("|"));)x.push(e[u]),u+=1;n.push({type:"paragraph",children:h(x.join("\n"))})}return n}const w=new Map;function x(e){const t=w.get(e);if(t)return t;const n={blocks:b(e.replace(/\r\n?/g,"\n").split("\n"))};if(w.size>=200){const e=w.keys().next().value;void 0!==e&&w.delete(e)}return w.set(e,n),n}},80257(e,t,n){n.d(t,{G9:()=>l,nH:()=>c,zU:()=>d});var i=n(44285),a=n(41255),r=n(72019);function s(e){let t="";for(const n of e)switch(n.type){case"text":case"code":t+=n.value;break;case"strong":case"em":case"link":t+=s(n.children);break;case"image":t+=n.alt;break;case"inlineMath":case"displayMath":t+=(0,a.L$)(n.tex);break;case"break":t+="\n"}return t}function o(e){switch(e.type){case"paragraph":case"heading":return s(e.children);case"list":return e.items.map((t,n)=>`${e.ordered?`${e.start+n}.`:"-"} ${t.map(o).join("\n")}`).join("\n");case"blockquote":return e.children.map(o).join("\n");case"codeBlock":return e.value;case"mathBlock":return(0,a.L$)(e.tex);case"table":return[e.header.map(s).join(" | "),...e.rows.map(e=>e.map(s).join(" | "))].join("\n");case"figure":return e.caption?`${e.alt} \u2014 ${e.caption}`:e.alt;default:return""}}function l(e){if(!/[<>]/.test(e))return e;return e.replace(/<\s*br\s*\/?\s*>/gi,"\n").replace(/<\s*\/\s*(p|div|li|ul|ol|h[1-6])\s*>/gi,"\n").replace(/<[^>]*>/g,"").replace(/ /gi," ").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/'|'/gi,"'").replace(/"/gi,'"').replace(/\n{3,}/g,"\n\n").trim()}function c(e){const t=(0,r.fj)(e);return"rich_text_v1"===t.schema?(n=t.source,(0,i.FQ)(n).blocks.map(o).filter(e=>""!==e).join("\n\n").trim()):l(t.source);var n}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:80;const n=c(e).replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(1,t-1)).trimEnd()}\u2026`}},41255(e,t,n){n.d(t,{$6:()=>r,L$:()=>c,UB:()=>a});const i=["\\href","\\url","\\includegraphics","\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData","\\raw","\\def","\\gdef","\\edef","\\xdef","\\global","\\futurelet","\\let","\\newcommand","\\renewcommand","\\catcode","\\input","\\write","\\special"];function a(e){for(const t of i){let n=e.indexOf(t);for(;-1!==n;){const i=e[n+t.length];if(void 0===i||!/[a-zA-Z]/.test(i))return t;n=e.indexOf(t,n+1)}}return null}function r(e){let t=0;for(let n=0;n<e.length;n+=1){const i=e[n];if("\\"!==i){if("{"===i&&(t+=1),"}"===i&&(t-=1,t<0))return!1}else n+=1}return 0===t}const s={times:"\xd7",div:"\xf7",pm:"\xb1",mp:"\u2213",cdot:"\xb7",le:"\u2264",leq:"\u2264",ge:"\u2265",geq:"\u2265",ne:"\u2260",neq:"\u2260",approx:"\u2248",infty:"\u221e",degree:"\xb0",circ:"\xb0",rightarrow:"\u2192",to:"\u2192",leftarrow:"\u2190",Rightarrow:"\u21d2",int:"\u222b",sum:"\u03a3",prod:"\u03a0",sqrt:"\u221a",propto:"\u221d",in:"\u2208",subset:"\u2282",cup:"\u222a",cap:"\u2229",forall:"\u2200",exists:"\u2203",partial:"\u2202",nabla:"\u2207",alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03b5",varepsilon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u
203bd",xi:"\u03be",pi:"\u03c0",rho:"\u03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",varphi:"\u03c6",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039b",Xi:"\u039e",Pi:"\u03a0",Sigma:"\u03a3",Phi:"\u03a6",Psi:"\u03a8",Omega:"\u03a9"};function o(e,t){if("{"!==e[t])return null;let n=0;for(let i=t;i<e.length;i+=1)if("\\"!==e[i]){if("{"===e[i]&&(n+=1),"}"===e[i]&&(n-=1,0===n))return{body:e.slice(t+1,i),end:i+1}}else i+=1;return null}function l(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n+=1;if("{"===e[n])return o(e,n);if(n>=e.length||"}"===e[n])return null;if("\\"===e[n]){const t=/^\\(?:[a-zA-Z]+|.)/.exec(e.slice(n));return t?{body:t[0],end:n+t[0].length}:null}const i=String.fromCodePoint(e.codePointAt(n));return{body:i,end:n+i.length}}function c(e){let t="",n=0;const i=e.length;for(;n<i;){const i=e[n];if("\\"!==i){t+=i,n+=1;continue}const a=/^\\([a-zA-Z]+)/.exec(e.slice(n));if(!a){const i=e[n+1];t+=","===i||";"===i||":"===i||"!"===i?" ":null!==i&&void 0!==i?i:"",n+=2;continue}const r=a[1],d=n+a[0].length;let u=d;for(;" "===e[u];)u+=1;if("frac"===r||"dfrac"===r||"tfrac"===r){const i=l(e,u),a=i?l(e,i.end):null;if(i&&a){const e=c(i.body),r=c(a.body),s=e=>/^[\w.]+$/.test(e)?e:`(${e})`;t+=`${s(e)}/${s(r)}`,n=a.end;continue}}if("sqrt"===r){const i=o(e,u);if(i){t+=`\u221a(${c(i.body)})`,n=i.end;continue}t+="\u221a",n=u;continue}if("text"===r||"mathrm"===r||"mathbf"===r||"mathit"===r||"operatorname"===r||"ce"===r||"pu"===r){const i=o(e,u);if(i){t+="ce"===r||"pu"===r?i.body:c(i.body),n=i.end;continue}}if("vec"===r||"hat"===r||"bar"===r||"overline"===r){const i=o(e,u);if(i){t+=c(i.body),n=i.end;continue}}if("begin"===r||"end"===r){const i=o(e,u);if(i){"end"===r&&(t+="] "),"begin"===r&&(t+=" ["),n=i.end;continue}}if("left"===r||"right"===r||"displaystyle"===r||"limits"===r){n=d;continue}if("quad"===r||"qquad"===r){t+=" ",n=d;continue}const m=s[r];void 0===m?(t+=r,n=d):(t+=m,n=d)}return t.replace(/\^\{([^{}]*)\}/g,"^$1").replace(/_\{([^{}]*)\}/g,"_$1").replace(/[{}]/g,"").replace(/&/g," ").replace(/\\\\/g,"; ").replace(/\s+/g," ").trim()}},72019(e,t,n){n.d(t,{$6:()=>i,YD:()=>r,aA:()=>o,fj:()=>a,vz:()=>s});function i(e){if("object"!==typeof e||null===e)return!1;const t=e;return("rich_text_v1"===t.schema||"plain_text_v0"===t.schema)&&"string"===typeof t.source}function a(e){return i(e)?e:"string"===typeof e?{schema:"plain_text_v0",format:"plain_text",source:e}:{schema:"plain_text_v0",format:"plain_text",source:""}}function r(e){return{schema:"rich_text_v1",format:"markdown_latex",source:e}}function s(e){return a(e).source}function o(e,t){return i(e)&&"rich_text_v1"===e.schema?r(t):t}n.d(t,["Mq",0,{maxSourceLength:5e4,maxMathLength:2e3,maxNestingDepth:8},"iB",0,["https:","http:","mailto:"]])},9151(e,t,n){n.d(t,{RY:()=>M,pp:()=>L,bt:()=>N,DS:()=>D,I$:()=>O,C8:()=>z,Zn:()=>q,AD:()=>P,Ay:()=>B,NK:()=>T});var i=n(33006),a=n(71119),r=n(63878),s=n(44151),o=n(54304);const l="yS5CUb2c",c="pHj8MmsE",d="JwOToWj7",u="l7d18ba_",m="XjRFGJDa",p="BxGxZeje",h="C0XU5_pf",v="jk_McPpF",g="LunlPnib",f="zqjnmDCk",_="NgE0ajx_",y="pYtommPU",b="cyQzLzVG",w="ciTQIKxj",x="tvUg1JXU",k="bnWW3bmv",A="SG8BsUcs",j="VsOLbVKu",S="ynVRBBTW",C="ZwH4Iale",I="tg9YmpNe";var E=n(84052),R=n(3374);const $=(0,i.createContext)(null),N=e=>{let{target:t,children:n,onAuroraAvailabilityChange:a}=e;const r=(0,i.useRef)(new Set),s=(0,i.useCallback)(()=>{const e=Symbol("workspace-aurora");return r.current.add(e),null===a||void 0===a||a(!0),()=>{r.current.delete(e),null===a||void 0===a||a(r.current.size>0)}},[a]),o=(0,i.useMemo)(()=>({target:t,registerAurora:s}),[t,s]);return(0,R.jsx)($.Provider,{value:o,children:n})},T=e=>/^\/assignments\/new\/?$/.test(e)||/^\/assignments\/(?:drafts\/)?[^/]+\/(?:edit|builder|review|preview)\/?$/.test(e)||/^\/courses\/new(?:\/[^/]+(?:\/modules\/[^/]+)?(?:\/steps\/[^/]+)?)?\/?$/.test(e)||/^\/courses\/[^/]+(?:\/studio(?:\/.*)?)?\/?$/.test(e)||/^\/marking(?:\/cases\/[^/]+)?\/?$/.test(e),L=e=>{let{label:t,onClick:n,href:i}=e;const a=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(r.A,{size:15,"aria-hidden":"true"}),(0,R.jsx)("span",{children:t})]});return i?(0,R.jsx)("a",{className:m,href:i,"aria-label":t,children:a}):(0,R.jsx)("button",{className:m,type:"button",onClick:n,"aria-label":t,children:a})},O=e=>{let{title:t,status:n,subtitle:i,titleText:a,headingLevel:r="h1"}=e;return(0,R.jsxs)("div",{className:`${p} ${i?v:""}`,children:[(0,R.jsx)(r,{className:h,title:null!==a&&void 0!==a?a:"str
2ing"===typeof t?t:void 0,children:t}),i&&(0,R.jsx)("span",{className:g,children:i}),n&&(0,R.jsx)("span",{className:f,children:n})]})},M=e=>{let{children:t}=e;return(0,R.jsx)("div",{className:b,children:t})},U={idle:"",unsaved:"Unsaved changes",saving:"Saving\u2026",saved:"Saved",error:"Error saving",offline:"Offline",conflict:"Newer version available"},P=e=>{let{state:t,label:n}=e;const i=null!==n&&void 0!==n?n:U[t];return i?(0,R.jsxs)("span",{className:w,"data-state":t,role:"status","aria-live":"polite",children:["saved"===t&&(0,R.jsx)(s.A,{size:13,"aria-hidden":"true"}),i]}):null},q=e=>{let{label:t="More workspace actions",children:n}=e;const a=(0,i.useRef)(null);return(0,R.jsxs)("details",{className:x,ref:a,children:[(0,R.jsx)("summary",{"aria-label":t,children:(0,R.jsx)(o.A,{size:18,"aria-hidden":"true"})}),(0,R.jsx)("div",{role:"menu",onClickCapture:e=>{var t,n;e.target.closest('[role="menuitem"]')&&(null===(t=a.current)||void 0===t||null===(n=t.querySelector("summary"))||void 0===n||n.focus({preventScroll:!0}))},onClick:e=>{var t;e.target.closest('[role="menuitem"]')&&(null===(t=a.current)||void 0===t||t.removeAttribute("open"))},children:n})]})},D=e=>{var t;let{breadcrumb:n,identity:a,aurora:r,actions:s}=e;const o=null===(t=(0,i.useContext)($))||void 0===t?void 0:t.registerAurora,l=Boolean(r);return(0,i.useEffect)(()=>l?null===o||void 0===o?void 0:o():void 0,[l,o]),(0,R.jsxs)("div",{className:d,"data-has-aurora":l||void 0,"data-has-actions":Boolean(s)||void 0,children:[(0,R.jsxs)("div",{className:u,children:[n,a]}),r&&(0,R.jsx)("div",{className:_,children:r}),s&&(0,R.jsx)("div",{className:y,children:s})]})},z=e=>{var t,n;
2let{items:a,status:r,trailing:s,label:o="Workspace views",variant:l="underline"}=e;const c=(0,i.useRef)(null),d=null===(t=a.find(e=>e.active))||void 0===t?void 0:t.id;return(0,i.useEffect)(()=>{const e=c.current;if(!e||"underline"!==l)return;const t=()=>{const t=e.querySelector('[data-active="true"]');if(!t||e.scrollWidth<=e.clientWidth)return;const n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.left<n.left?e.scrollLeft+=i.left-n.left:i.right>n.right&&(e.scrollLeft+=i.right-n.right)};t();const n="undefined"!==typeof ResizeObserver?new ResizeObserver(t):null;return null===n||void 0===n||n.observe(e),e.querySelectorAll('[role="tab"]').forEach(e=>null===n||void 0===n?void 0:n.observe(e)),()=>null===n||void 0===n?void 0:n.disconnect()},[d,l]),(0,R.jsxs)("div",{className:`${k} ${"pills"===l?S:""}`,"data-workspace-navigation":"true",children:["pills"===l&&(0,R.jsxs)("label",{className:C,children:[(0,R.jsx)("span",{children:o}),(0,R.jsx)("select",{value:(null===(n=a.find(e=>e.active))||void 0===n?void 0:n.id)||"",onChange:e=>{var t;return null===(t=a.find(t=>t.id===e.target.value))||void 0===t?void 0:t.onSelect()},children:a.map(e=>(0,R.jsxs)("option",{value:e.id,children:[e.label,"number"===typeof e.badge||"string"===typeof e.badge?` (${e.badge})`:""]},e.id))})]}),(0,R.jsx)("nav",{ref:c,className:`${A} ${E.A.group}`,"aria-label":o,role:"tablist",children:a.map(e=>(0,R.jsxs)("button",{type:"button",role:"tab","aria-selected":Boolean(e.active),"data-active":e.active||void 0,onClick:e.onSelect,children:[e.label,null!=e.badge&&(0,R.jsx)("span",{children:e.badge})]},e.id))}),(r||s)&&(0,R.jsxs)("div",{className:j,children:[r,s]})]})},B=e=>{let{workspace:t,header:n,introduction:r,navigation:s,children:o,className:d,auroraScope:u,auroraPersistenceState:m}=e;const p=(0,i.useContext)($),h=null!==p&&void 0!==p&&p.target?(0,a.createPortal)(n,p.target):(0,R.jsx)("div",{className:c,children:n});return(0,R.jsxs)("section",{className:`${l} ${d||""}`.trim(),"data-workspace":t,"data-aurora-scope":u,"data-aurora-persistence-state":m,children:[h,r,s,(0,R.jsx)("div",{className:I,children:o})]})}},40555(e,t,n){n.d(t,{w:()=>u,i:()=>m});var i=n(33006),a=n(85188),r=n(87140),s=n(18537),o=n(44226);const l={reading_size:"standard",text_spacing:"standard",speech_rate:1,captions:!0};var c=n(3374);const d=(0,i.createContext)({preferences:l,record:null,loading:!1,saving:!1,conflict:!1,error:"",reload:()=>{},save:async()=>!1});function u(e){let{children:t}=e;const n=(0,a.d4)(e=>e.auth.token),u=(0,a.d4)(e=>{var t;return null===(t=e.auth.user)||void 0===t?void 0:t.id}),[m,p]=(0,i.useState)(null),[h,v]=(0,i.useState)(!1),[g,f]=(0,i.useState)(!1),[_,y]=(0,i.useState)(""),[b,w]=(0,i.useState)(!1),[x,k]=(0,i.useState)(0),[A,j]=(0,i.useState)(s.N7),S=(0,i.useRef)(0),C=(0,i.useRef)(!1);(0,i.useEffect)(()=>{const e=()=>j((0,s.N7)());return window.addEventListener(r.Lu,e),window.addEventListener(r.eW,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r.Lu,e),window.removeEventListener(r.eW,e),window.removeEventListener("storage",e)}},[]),(0,i.useEffect)(()=>{const e=++S.current;if(p(null),y(""),w(!1),f(!1),C.current=!1,n)return v(!0),(0,o.Ve)().then(t=>{e===S.current&&p(t)}).catch(t=>{e===S.current&&y((0,o.dV)(t,"Your saved accessibility preferences could not be loaded. Retry to restore them."))}).finally(()=>{e===S.current&&v(!1)}),()=>{++S.current};v(!1)},[n,u,A,x]);const I=(null===m||void 0===m?void 0:m.preferences)||l;(0,i.useEffect)(()=>{const e=document.documentElement;return e.dataset.readingSize=I.reading_size,e.dataset.textSpacing=I.text_spacing,()=>{delete e.dataset.readingSize,delete e.dataset.textSpacing}},[I.reading_size,I.text_spacing]),(0,i.useEffect)(()=>{const e=new Map,t=t=>{[...Array.from(t.querySelectorAll("video, audio")),...t instanceof HTMLMediaElement?[t]:[]].forEach(t=>{var n,i;if(e.has(t))return;const a=()=>{const e=Array.from(t.textTracks||[]).filter(e=>"captions"===e.kind||"subtitles"===e.kind),n=e.find(e=>navigator.language.toLowerCase().startsWith(e.language.toLowerCase())&&Boolean(e.language))||e[0];
2e.forEach(e=>{e.mode=I.captions&&e===n?"showing":"hidden"})};a(),t.addEventListener("loadedmetadata",a),null===(n=t.textTracks)||void 0===n||null===(i=n.addEventListener)||void 0===i||i.call(n,"addtrack",a),e.set(t,()=>{var e,n;t.removeEventListener("loadedmetadata",a),null===(e=t.textTracks)||void 0===e||null===(n=e.removeEventListener)||void 0===n||n.call(e,"addtrack",a)})})};t(document);const n=new MutationObserver(n=>{n.forEach(e=>e.addedNodes.forEach(e=>{e instanceof Element&&t(e)})),e.forEach((t,n)=>{n.isConnected||(t(),e.delete(n))})});return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),e.forEach(e=>e())}},[I.captions]);const E=(0,i.useCallback)(async e=>{if(!m||C.current||b)return!1;const t=S.current;C.current=!0,f(!0),y("");try{const n=await(0,o.OD)(m.revision,e);return t===S.current&&(p(n),!0)}catch(n){return t===S.current&&(y((0,o.dV)(n)),w((0,o.n$)(n))),!1}finally{t===S.current&&(C.current=!1,f(!1))}},[m,b]);return(0,c.jsx)(d.Provider,{value:{preferences:I,record:m,loading:h,saving:g,conflict:b,error:_,reload:()=>k(e=>e+1),save:E},children:t})}const m=()=>(0,i.useContext)(d)},44226(e,t,n){var i=n(5487);const a=e=>`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}/api/accessibility${e}`,r=e=>`/learners/${encodeURIComponent(e)}`,s=e=>{var t,n;const i=null===e||void 0===e?void 0:e.response;return 409===(null===i||void 0===i?void 0:i.status)&&(!(null!==(t=i.data)&&void 0!==t&&null!==(n=t.detail)&&void 0!==n&&n.code)||"VERSION_CONFLICT"===i.data.detail.code)};n.d(t,["AQ",0,async(e,t)=>i.default.put(a("/policy"),{expected_revision:e,policy:t}),"Gx",0,async(e,t)=>{const n=new FormData;return n.append("file",t),i.default.post(a(`${r(e)}/evidence`),n)},"J9",0,async e=>i.default.get(a(`${r(e)}/support`)),"OD",0,async(e,t)=>i.default.put(a("/preferences"),{expected_revision:e,preferences:t}),"Ve",0,async()=>i.default.get(a("/preferences")),"dV",0,function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"This change could not be saved. Your edits are still here.";const i=null===e||void 0===e?void 0:e.response;if(s(e))return"This record changed elsewhere. Your edits are still here. Reload the saved version before trying again.";if(403===(null===i||void 0===i?void 0:i.status))return"You do not have permission to access or change this support information.";const a=null===i||void 0===i||null===(t=i.data)||void 0===t?void 0:t.detail;return"string"===typeof a?a:(null===a||void 0===a?void 0:a.message)||n},"hm",0,async(e,t)=>{await i.default.delete(a(`${r(e)}/evidence/${encodeURIComponent(t)}`))},"n$",0,s,"oX",0,async(e,t,n)=>i.default.put(a(`${r(e)}/support`),{expected_revision:t,plan:n}),"qX",0,(e,t)=>a(`${r(e)}/evidence/${encodeURIComponent(t)}/download`),"rR",0,async(e,t)=>i.default.post(a(`${r(e)}/evidence/${encodeURIComponent(t)}/retry`)),"zo",0,async()=>i.default.get(a("/policy"))])},84034(e,t,n){n.d(t,{zH:()=>N,NQ:()=>z,Z6:()=>D,rO:()=>k,k0:()=>$,xN:()=>O,c:()=>I,KK:()=>S,y_:()=>C,uJ:()=>j,X8:()=>q,Lw:()=>A,H7:()=>E,eV:()=>B,GR:()=>P,uS:()=>M,oy:()=>T,y$:()=>L,HW:()=>R,nK:()=>U});var i=n(8346),a=n(5487);const r=new Set(["aac","avi","flac","m4a","m4v","mkv","mov","mp3","mp4","mpeg","mpga","oga","ogg","wav","webm"]),s=e=>(e=>{const t=e.name.includes(".")?e.name.split(".").pop().toLowerCase():"",n=(e.type||"").split(";")[0].trim().toLowerCase();return r.has(t)&&(!n||n.startsWith("audio/")||n.startsWith("video/")||"application/octet-stream"===n)})(e),o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return i=`/api/assignment-lifecycle/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/recording-uploads${n}`,`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${i}`;var i},l=(e,t)=>{try{t?sessionStorage.setItem(e,t):sessionStorage.removeItem(e)}catch{}},c=(e,t)=>new Promise((n,i)=>{if(null!==t&&void 0!==t&&t.aborted)return void i(new DOMException("Upload cancelled","AbortError"));const a=window.setTimeout(()=>{null===t||void 0===t||t.removeEventListener("abort",r),n()},e),r=()=>{window.clearTimeout(a),i(new DOMException("Upload cancelled","AbortError"))};null===t||void 0===t||t.addEventListener("abort",r,{once:!0})}),d=e=>new Promise((t,n)=>{if("undefined"===typeof navigator||!1!==navigator.onLine)return void t();const i=()=>{null===e||void 0===e||e.removeEventListener("abort",a),t()},a=()=>{window.removeEventListener("online",i),n(new DOMException("Upload cancelled","AbortError"))};window.addEventListener("online",i,{once:!0}),null===e||void 0===e||e.addEventListener("abort",a,{once:!0})}),u=(e,t,n,i,a)=>new Promise((r,s)=>{const o=new XMLHttpRequest;
2o.open("PUT",e),Object.entries(t).forEach(e=>{let[t,n]=e;return o.setRequestHeader(t,n)}),o.upload.onprogress=e=>i(e.loaded),o.onload=()=>o.status>=200&&o.status<300?r():s(Object.assign(new Error("Storage refused the part"),{storage:!0})),o.onerror=()=>s(Object.assign(new Error("Network error"),{storage:!0})),o.ontimeout=()=>s(Object.assign(new Error("Network timeout"),{storage:!0})),o.onabort=()=>s(new DOMException("Upload cancelled","AbortError")),o.timeout=6e5,null===a||void 0===a||a.addEventListener("abort",()=>o.abort(),{once:!0}),o.send(n)}),m=e=>{var t;return null===e||void 0===e||null===(t=e.response)||void 0===t?void 0:t.status},p=(e,t)=>Boolean(null===t||void 0===t?void 0:t.aborted)||"AbortError"===(null===e||void 0===e?void 0:e.name)||"ERR_CANCELED"===(null===e||void 0===e?void 0:e.code);async function h(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const{fieldId:s,signal:h,onProgress:v,onPhase:g}=r,f=((e,t,n,i)=>`edumark.recording-upload:${e}:${t}:${n||""}:${i.name}:${i.size}:${i.lastModified}`)(t,n,s,i);let _=null;const y=(e=>{try{return sessionStorage.getItem(e)}catch{return null}})(f);if(y)try{const n=await a.default.get(o(e,t,`/${encodeURIComponent(y)}`),{signal:h});n.size===i.size&&["uploading","finalising","ready"].includes(n.state)&&(_=n)}catch{}_||(_=await a.default.post(o(e,t),{block_id:n,field_id:null!==s&&void 0!==s?s:null,filename:i.name,media_type:i.type||"application/octet-stream",size:i.size},{signal:h}),l(f,_.upload_id));const b=_;try{if("uploading"===b.state){null===g||void 0===g||g("uploading");const n=new Set(b.received_parts),r=new Map;let s=Array.from(n).reduce((e,t)=>e+Math.min(b.part_bytes,i.size-t*b.part_bytes),0);const l=()=>{const e=Array.from(r.values()).reduce((e,t)=>e+t,0);null===v||void 0===v||v(Math.max(0,Math.min(96,Math.round((s+e)/i.size*96))))};l();const f=Array.from({length:b.part_count},(e,t)=>t).filter(e=>!n.has(e)),_=async n=>{const v=i.slice(n*b.part_bytes,Math.min(i.size,(n+1)*b.part_bytes)),g=await v.arrayBuffer(),f=await(async e=>{var t;if(null===(t=globalThis.crypto)||void 0===t||!t.subtle)return;const n=new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",e));let i="";return n.forEach(e=>{i+=String.fromCharCode(e)}),{hex:Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join(""),base64:btoa(i)}})(g),_=o(e,t,`/${encodeURIComponent(b.upload_id)}/parts/${n}`);for(let e=1;;e+=1){await d(h);try{if("s3"===b.mode){if(!f)throw new Error("This browser cannot verify uploads. Use an up-to-date browser over a secure connection.");const e=await a.default.post(`${_}/url`,{sha256_base64:f.base64},{signal:h});await u(e.url,e.headers,g,e=>{r.set(n,Math.min(v.size,e)),l()},h)}else await a.default.put(_,g,{signal:h,timeout:3e5,headers:{"Content-Type":"application/octet-stream",...f?{"X-Part-SHA256":f.hex}:{}},onUploadProgress:e=>{r.set(n,Math.min(v.size,e.loaded)),l()}});return r.delete(n),s+=v.size,void l()}catch(y){r.delete(n);const t=m(y);if(p(y,h)||!y.storage&&void 0!==t&&t>=400&&t<500&&408!==t&&422!==t&&429!==t||e>=6)throw y;await c(Math.min(15e3,600*2**e),h)}}},y=Array.from({length:Math.min(3,f.length)},async()=>{for(let e=f.shift();void 0!==e;e=f.shift())await _(e)});await Promise.all(y)}null===g||void 0===g||g("checking");let n="ready"===b.state?b:await a.default.post(o(e,t,`/${encodeURIComponent(b.upload_id)}/complete`),{},{signal:h});const r=Date.now()+12e5;let s=1200;for(;"finalising"===n.state;){if(Date.now()>r)throw new Error("Your recording arrived, but its checks are taking longer than expected. Keep this page open and try again shortly \u2014 nothing needs uploading twice.");await c(s,h),s=Math.min(5e3,Math.round(1.3*s)),n=await a.default.get(o(e,t,`/${encodeURIComponent(b.upload_id)}`),{signal:h})}if("ready"!==n.state||!n.file)throw l(f,null),new Error(n.error_message||"This recording could not be accepted. Choose a valid audio or video file.");return l(f,null),null===v||void 0===v||v(100),n.file}catch(w){if(p(w,h))throw l(f,null),a.default.delete(o(e,t,`/${encodeURIComponent(b.upload_id)}`)).catch(()=>{}),new DOMException("Upload cancelled","AbortError");const n=(e=>{var t,n;const i=null===e||void 0===e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.detail;return"string"===typeof i?i:i&&"object"===typeof i&&"string"===typeof i.message?i.message:null})(w);throw n?new Error(n):w instanceof Error&&!m(w)&&!w.isAxiosError&&!w.storage?w:new Error("The connection dropped while uploading. Choose the same file again to continue where it stopped.")}}const v="Moderation sample percentage must be a whole number from 1 to 100.";function g(e){const t=function(e){const t="string"===typeof e?e.trim():e;if(""===t||"string"===typeof t&&!/^\d+$/.test(t))return v;const n=Number(t);return Number.isInteger(n)&&n>=1&&n<=100?null:v}(e);if(t)throw new Error(t);return Number(e)}const f=e=>`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${e}`,_="/api/assignment-lifecycle",y=(e,t,n)=>{const i=e.trim(),a=/^\d{4}-\d{2}-\d{2}$/.test(i)?new Date(`${i}T${String(t).padStart(2,"0")}
2:${String(n).padStart(2,"0")}:00`):new Date(i);if(Number.isNaN(a.getTime()))throw new Error("Assignment dates are invalid.");return a.toISOString()};const b=e=>a.default.post(f(`${_}/assignments`),function(e){var t,n,a,r,s,o,l,c,d,u,m,p,h,v,f,_,b;const w=null===(t=e.settings.window)||void 0===t?void 0:t.open_at,x=null===(n=e.settings.window)||void 0===n?void 0:n.close_at,k=y(w||e.releasedDate,0,0),A=null!==(a=e.dueDate)&&void 0!==a&&a.trim()?y(e.dueDate,17,0):null,j=x?y(x,23,59):null!==(r=e.dueDate)&&void 0!==r&&r.trim()?y(e.dueDate,23,59):null;if(null!==A&&Date.parse(k)>=Date.parse(A)||null!==j&&Date.parse(k)>=Date.parse(j)||null!==A&&null!==j&&Date.parse(A)>Date.parse(j))throw new Error("The assignment window must open before the due date and close no earlier than it.");const S=e.settings.resubmission,C=Math.max(0,null!==(s=null!==(o=null===S||void 0===S?void 0:S.max_cycles)&&void 0!==o?o:e.maxResubmissions)&&void 0!==s?s:0),I=Math.max(0,null!==(l=null!==(c=null===S||void 0===S?void 0:S.window_days)&&void 0!==c?c:e.resubmissionWindowDays)&&void 0!==l?l:0),E=void 0!==S?S.enabled&&C>0&&I>0:C>0&&I>0,R=e.settings.timed;return{assessment_ref:e.assessmentRef,course_version_id:e.courseVersionId,module_id:e.moduleId,cohort_ids:Array.from(new Set(e.cohortIds)),title:e.title,description:e.description,window:{opens_at:k,due_at:A,closes_at:j,timezone:e.timezone},policies:{accessibility:e.settings.accessibility||{read_aloud_enabled:!0,voice_typing_enabled:!0},attempts:{max_attempts:e.settings.attempts_allowed||1,time_limit_minutes:(null===R||void 0===R?void 0:R.duration_minutes)||null,submission_grace_minutes:null!==R&&void 0!==R&&R.grace_seconds?Math.min(120,Math.ceil(R.grace_seconds/60)):0},late:{mode:e.lateMode||"reject",grace_minutes:0,penalty_percent_per_day:0},extensions:{allowed:!0,max_extension_days:30},anonymised_marking:!1,plagiarism:null!==(d=e.settings.plagiarism)&&void 0!==d?d:{enabled:!1,provider:null},overall_feedback_required:!0===e.settings.overall_feedback_required,ai_marking:{enabled:"AI_ASSISTED"===e.settings.marking_workflow||!e.settings.marking_workflow&&!0===(null===(u=e.settings.ai_marking)||void 0===u?void 0:u.enabled),human_approval_required:!0},marker_ids:Array.from(new Set(e.markers)),moderation:e.moderationRequired?{required:!0,sample_percent:g(null!==(m=e.moderationSamplePercent)&&void 0!==m?m:10)}:{required:!1,sample_percent:0},resubmission:{allowed:E,max_cycles:E?C:0,window_days:E?I:0,close_grace_days:E?Math.max(0,null!==(p=null!==(h=null===S||void 0===S?void 0:S.close_grace_days)&&void 0!==h?h:e.resubmissionCloseGraceDays)&&void 0!==p?p:0):0,max_extension_days:E?Math.max(0,null!==(v=null!==(f=null===S||void 0===S?void 0:S.max_extension_days)&&void 0!==f?f:e.resubmissionMaxExtensionDays)&&void 0!==v?v:0):0,attempts_per_cycle:Math.max(1,null!==(_=null!==(b=null===S||void 0===S?void 0:S.attempts_per_cycle)&&void 0!==b?b:e.resubmissionAttemptsPerCycle)&&void 0!==_?_:1),grade_cap:E&&((null===S||void 0===S?void 0:S.grade_cap)||e.resubmissionGradeCap)||null},assistance_policy:"protected",invigilation:(0,i.$f)(e.settings),work_record:{enabled:(0,i.$f)(e.settings).activity_enabled,retention_days:(0,i.$f)(e.settings).retention_days},grading_scheme_id:e.gradingSchemeId||null,grading_scheme_snapshot:e.gradingSchemeSnapshot||null}}}(e)),w=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return a.default.post(f(`${_}/assignments/${encodeURIComponent(e.id)}/transitions`),{expected_revision:e.revision,target_state:t,reason:n})};async function x(e){const t=await w(e,"under_review","Author completed the structured assignment review");return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return a.default.post(f(`${_}/assignments/${encodeURIComponent(e.id)}/publish`),{expected_revision:e.revision,reason:t})}(await w(t,"approved","Author confirmed questions, criteria, policy and placement"),"Approved assignment released to eligible enrolments")}async function k(e,t){const n=await b(e);return"draft"===t?n:x(n)}const A=e=>a.default.get(f(`${_}/assignments`),...e?[{signal:e}]:[]),j=e=>a.default.get(f(`${_}/assignments/${encodeURIComponent(e)}/eligibility`)),S=()=>a.default.get(f(`${_}/active-attempt-policy`)),C=e=>a.default.get(f(`${_}/assignments/${encodeURIComponent(e)}`));async function I(e,t){let n=await C(e);if(("open"===n.lifecycle_state||"scheduled"===n.lifecycle_state)&&"closed"!==n.effective_state)throw new Error("The assignment window is still open. Results can be prepared now and released after it closes.");if("open"!==n.lifecycle_state&&"scheduled"!==n.lifecycle_state||(n=await w(n,"closed","Server window closed before official result release")),"closed"===n.lifecycle_state&&(n=await w(n,"marking","All submitted work entered official human marking")),"marking"===n.lifecycle_state&&t&&(n=await w(n,"moderation","Required independent moderation decisions completed")),"marking"!==n.lifecycle_state&&"moderation"!==n.lifecycle_state||(n=await w(n,"ready_for_release","Human approval and release clearance gates completed")),!["ready_for_release","released"].includes(n.lifecycle_state))throw new Error(`Assignment is ${n.lifecycle_state.replaceAll("_"," ")} and cannot release results.`);return n}const E=(e,t)=>a.default.get(f(`${_}/assignments/${encodeURIComponent(e)}/attempts`),...t?[{signal:t}]:[]),R=(e,t,n)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/recording/monitor`),n,{timeout:1e4}),$=(e,t)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/preflight`),t?{resubmission_cycle_id:t}:void 0),N=(e,t,n)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/preflight/${encodeURIComponent(t)}/admit`),n),T=(e,t)=>
2a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts`),void 0,{headers:{"Idempotency-Key":t}}),L=(e,t)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/rest-break/start`)),O=(e,t)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/rest-break/end`)),M=(e,t,n,i,r,s,o)=>a.default.put(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/draft`),{expected_revision:n,...o,answers:i,...r?{flagged_question_ids:Array.from(new Set(r))}:{},...void 0!==s?{current_question_id:s}:{}}),U=async function(e,t,n,i,r,o){let l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(s(i))return h(e,t,n,i,{fieldId:o,onProgress:r});const c=new FormData;return c.append("block_id",n),o&&c.append("field_id",o),c.append("file",i),a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/files${l?"?scan_async=true":""}`),c,{onUploadProgress:e=>{r&&e.total&&r(Math.max(0,Math.min(100,Math.round(e.loaded/e.total*100))))}})},P=(e,t,n)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/files/${encodeURIComponent(n)}/retry`),{}),q=(e,t,n)=>f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/files/${encodeURIComponent(n)}`),D=(e,t,n,i,r)=>a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t)}/submission-intent`),{expected_revision:n,answers:i,...r?{work_record_capture_gap_reason:r}:{}}),z=(e,t)=>{var n;return a.default.post(f(`${_}/assignments/${encodeURIComponent(e)}/attempts/${encodeURIComponent(t.id)}/submission-intent/cancel`),{expected_revision:t.revision,intent_id:null===(n=t.submission_intent)||void 0===n?void 0:n.intent_id})},B=(e,t)=>a.default.get(f(`${_}/assignments/${encodeURIComponent(e)}/receipts`),...t?[{signal:t}]:[])},56965(e,t,n){n.d(t,{y:()=>o});var i=n(33006),a=n(40939),r=n(3374);const s=(0,i.createContext)(null);function o(e){let{children:t,enabled:n}=e;const[o,l]=(0,i.useState)(null),[c,d]=(0,i.useState)(!0),[u,m]=(0,i.useState)(!1),[p,h]=(0,i.useState)(null),v=(0,i.useRef)(!1),g=(0,i.useRef)(!1),f=(0,i.useRef)(0);(0,i.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);const _=(0,i.useCallback)(async()=>{if(!n||g.current)return;const e=++f.current;d(!0);try{const t=await(0,a.PD)();v.current&&f.current===e&&(l(t),h(null))}catch{v.current&&f.current===e&&(l(null),h("Your saved access could not be loaded. You can still allow this action once."))}finally{v.current&&f.current===e&&d(!1)}},[n]);(0,i.useEffect)(()=>{if(!n)return f.current++,l(null),void d(!1);_();const e=()=>{_()};return window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e),f.current++}},[n,_]);return(0,r.jsx)(s.Provider,{value:{preference:o,loading:c,saving:u,error:p,refresh:_,save:async(e,t)=>{if(!n||!o||c||g.current)return!1;g.current=!0,f.current++,m(!0),h(null);let i=!1;try{const n=await(0,a.yH)(e,o.revision,t);v.current&&(l(n),i=!0)}catch(r){try{const e=await(0,a.PD)();v.current&&l(e)}catch{v.current&&l(null)}v.current&&h(r.message||"Access could not be saved. Review the saved choice and try again.")}finally{g.current=!1,v.current&&m(!1)}return i}},children:t})}n.d(t,["M",0,()=>(0,i.useContext)(s)])},6386(e,t,n){n.d(t,{A:()=>u});var i=n(33006),a=n(77425),r=n(22056),s=n(64963),o=n(93949),l=n(38238),c=n(21676),d=n(3374);function u(e){let{access:t,onClose:n}=e;const u=(0,o.Zp)(),{refresh:m}=(0,l.uC)();return(0,i.useEffect)(()=>{m()},[m]),(0,d.jsxs)("section",{className:c.A.accessNotice,"aria-label":"Aurora availability",children:[(0,d.jsx)("span",{className:c.A.accessNoticeIcon,"aria-hidden":"true",children:t.resumePath?(0,d.jsx)(s.A,{size:25}):(0,d.jsx)(r.A,{size:25})}),(0,d.jsx)("span",{className:c.A.accessNoticeEyebrow,children:"Aurora access"}),(0,d.jsx)("h2",{children:t.title}),(0,d.jsx)("p",{children:t.reason}),t.detail&&(0,d.jsx)("p",{className:c.A.accessNoticeDetail,children:t.detail}),(0,d.jsxs)("div",{className:c.A.accessNoticeActions,children:[n&&(0,d.jsx)("button",{type:"button",onClick:n,children:"Close"}
2),t.resumePath&&(0,d.jsxs)("button",{type:"button","data-primary":"true",onClick:()=>{null===n||void 0===n||n(),u(t.resumePath)},children:["Return to assessment ",(0,d.jsx)(a.A,{size:16,"aria-hidden":"true"})]})]})]})}},98158(e,t,n){n.d(t,{A:()=>v});var i=n(33006),a=n(99640),r=n(70276),s=n(50097),o=n(44151),l=n(92525),c=n(64963),d=n(80687),u=n(56965),m=n(71480),p=n(3374);function h(e){let{mode:t,onChange:n,acknowledged:a,onAcknowledge:o,disabled:l}=e;const d=(0,i.useId)();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("fieldset",{className:m.A.choices,disabled:l,children:[(0,p.jsx)("legend",{children:"How should Aurora act?"}),(0,p.jsxs)("label",{className:m.A.choice,"data-selected":"ask"===t,children:[(0,p.jsx)("input",{type:"radio",name:d,checked:"ask"===t,onChange:()=>n("ask")}),(0,p.jsxs)("span",{children:[(0,p.jsxs)("strong",{children:["Ask before actions ",(0,p.jsx)("small",{children:"Default"})]}),(0,p.jsx)("span",{children:"Review consequential actions before they run."})]})]}),(0,p.jsxs)("label",{className:m.A.choice,"data-selected":"full_access"===t,children:[(0,p.jsx)("input",{type:"radio",name:d,checked:"full_access"===t,onChange:()=>n("full_access")}),(0,p.jsxs)("span",{children:[(0,p.jsxs)("strong",{children:["Full access ",(0,p.jsx)(s.A,{size:14,"aria-hidden":"true"})]}),(0,p.jsx)("span",{children:"Let Aurora act without repeated confirmations."})]})]})]}),"full_access"===t&&(0,p.jsxs)("div",{className:m.A.warning,children:[(0,p.jsxs)("div",{children:[(0,p.jsx)(r.A,{size:18,"aria-hidden":"true"}),(0,p.jsx)("strong",{children:"More freedom. More responsibility."})]}),(0,p.jsx)("p",{children:"Aurora can change or delete content, publish work and send messages wherever your permissions allow. It can make mistakes or be misled by content it reads. Some actions cannot be undone."}),(0,p.jsxs)("label",{className:m.A.acknowledge,children:[(0,p.jsx)("input",{type:"checkbox",checked:a,disabled:l,onChange:e=>o(e.target.checked)}),(0,p.jsx)("span",{children:"I understand and accept these risks."})]})]}),(0,p.jsxs)("p",{className:m.A.scopeNote,children:[(0,p.jsx)(c.A,{size:15,"aria-hidden":"true"}),(0,p.jsx)("span",{children:"Applies only to you in this workspace, across chats and devices. Your account permissions and protected assessment rules still apply. Change this anytime in Aurora access."})]})]})}function v(e){var t,n,r,s;let{summary:c,pending:v=!1,onDecision:g,onClose:f,settings:_=!1}=e;const y=(0,u.M)(),b=(0,i.useId)(),w=(0,i.useRef)(null),[x,k]=(0,i.useState)(_&&(null===y||void 0===y||null===(t=y.preference)||void 0===t?void 0:t.mode)||"ask"),[A,j]=(0,i.useState)(!1),[S,C]=(0,i.useState)(!1),[I,E]=(0,i.useState)(null),R=(0,i.useRef)(!1),$=(0,i.useRef)(!1),N=v||S||Boolean(null===y||void 0===y?void 0:y.saving);(0,i.useEffect)(()=>{var e;_&&(k((null===y||void 0===y||null===(e=y.preference)||void 0===e?void 0:e.mode)||"ask"),j(!1))},[_,null===y||void 0===y||null===(n=y.preference)||void 0===n?void 0:n.mode,null===y||void 0===y||null===(r=y.preference)||void 0===r?void 0:r.revision]),(0,i.useEffect)(()=>{var e;$.current=!0;const t=document.activeElement;return null===(e=w.current)||void 0===e||e.focus({preventScroll:!0}),()=>{$.current=!1,null!==t&&void 0!==t&&t.isConnected&&t.focus({preventScroll:!0})}},[]);const T=()=>{N||(_?null===f||void 0===f||f():null===g||void 0===g||g(!1))},L="full_access"===x,O=Boolean((_||L)&&(!(null!==y&&void 0!==y&&y.preference)||y.loading));return(0,p.jsxs)("section",{className:m.A.card,role:_?"dialog":"alertdialog","aria-modal":"false","aria-labelledby":`${b}-title`,"aria-describedby":`${b}-copy`,"aria-busy":N,"data-aurora-overlay":"true",onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),T())},children:[(0,p.jsxs)("div",{className:m.A.content,children:[(0,p.jsxs)("header",{className:m.A.header,children:[(0,p.jsx)("span",{className:m.A.icon,children:(0,p.jsx)(a.A,{size:21,"aria-hidden":"true"})}),(0,p.jsxs)("div",{children:[(0,p.jsx)("span",{className:m.A.eyebrow,children:"AURORA \xb7 YOU\u2019RE IN CONTROL"}),(0,p.jsx)("h2",{id:`${b}-title`,children:_?"Aurora access":"Review this action"})]}),(0,p.jsx)("button",{type:"button",className:m.A.close,"aria-label":"Close review",onClick:T,disabled:N,children:(0,p.jsx)(d.A,{size:18})})]}),(0,p.jsx)("p",{id:`${b}-copy`,className:m.A.intro,children:_?"Choose how much Aurora can do on your behalf.":"Aurora is ready to take the next step on your behalf."}),c&&(0,p.jsxs)("div",{className:m.A.action,children:[(0,p.jsx)("strong",{children:c.target}),(0,p.jsx)("p",{children:c.consequence}),(c.scope||c.undoability||void 0!==c.affected_count)&&(0,p.jsxs)("details",{className:m.A.details,children:[(0,p.jsxs)("summary",{children:["Action details ",(0,p.jsx)(l.A,{size:14,"aria-hidden":"true"})]}),(0,p.jsxs)("dl",{children:[c.scope&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("dt",{children:"Where"}),(0,p.jsx)("dd",{children:c.scope})]}),c.undoability&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("dt",{children:"Undo"}),(0,p.jsx)("dd",{children:{limited:"May not be undoable",none:"Cannot be undone",not_available:"Cannot be undone",reversible:"Can be undone"}[c.undoability]||c.undoability.replace(/_/g," ")})]}),void 0!==c.affected_count&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("dt",{children:"Affected"}
2),(0,p.jsx)("dd",{children:c.affected_count.toLocaleString()})]})]})]})]}),y&&(0,p.jsx)(h,{mode:x,onChange:e=>{k(e),j(!1)},acknowledged:A,onAcknowledge:j,disabled:N||y.loading||!y.preference}),(null===y||void 0===y||null===(s=y.preference)||void 0===s?void 0:s.permissions_changed)&&(0,p.jsx)("p",{className:m.A.error,children:"Your permissions changed. Review and enable full access again if you want to keep using it."}),(null===y||void 0===y?void 0:y.loading)&&(0,p.jsx)("p",{className:m.A.notice,role:"status",children:"Loading your saved access\u2026"}),(I||(null===y||void 0===y?void 0:y.error))&&(0,p.jsxs)("div",{className:m.A.error,role:"alert",children:[I||(null===y||void 0===y?void 0:y.error),y&&!N&&(0,p.jsx)("button",{type:"button",onClick:()=>{y.refresh()},children:"Reload saved access"})]})]}),(0,p.jsxs)("footer",{className:m.A.footer,children:[(0,p.jsx)("span",{children:_?"Saved for this workspace":L?"Remember this choice":"Permission for this action only"}),(0,p.jsxs)("div",{children:[(0,p.jsx)("button",{ref:w,type:"button",className:m.A.secondary,onClick:T,disabled:N,children:"Cancel"}),(0,p.jsxs)("button",{type:"button",className:m.A.primary,disabled:N||O||L&&!A,onClick:()=>{(async()=>{if(!N&&!R.current){R.current=!0,C(!0),E(null);try{var e;if((_||"full_access"===x&&"full_access"!==(null===y||void 0===y||null===(e=y.preference)||void 0===e?void 0:e.mode))&&(!y||!await y.save(x,A)))return;if(!$.current)return;_?null===f||void 0===f||f():await(null===g||void 0===g?void 0:g(!0))}catch(t){$.current&&E(t.message||"This action could not be confirmed. Try again.")}finally{R.current=!1,$.current&&C(!1)}}})()},children:[(0,p.jsx)(o.A,{size:16,"aria-hidden":"true"}),N?"Saving\u2026":_?L?"Enable full access":"Use ask before actions":L?"Enable & allow":"Allow once"]})]})]})]})}},66217(e,t,n){n.d(t,{A:()=>r});n(33006);var i=n(32769),a=n(3374);function r(e){let{context:t="workspace",label:n,compact:r=!1}=e;const s=null===n||void 0===n?void 0:n.trim(),o=s&&"thinking"!==s.toLowerCase()?s:"course"===t?"Working with this course":"Working in this page";return(0,a.jsx)(i.A,{label:`Aurora is working: ${o}`,compact:r})}},87780(e,t,n){var i=n(33006),a=n(27532),r=n(71119),s=n(99640),o=n(70276),l=n(44151),c=n(83718),d=n(18663),u=n(80687),m=n(66217),p=n(1401),h=n(81273),v=n(44330),g=n(77104),f=n(62470),_=n(21676),y=n(3374);const b=e=>{let{open:t,onClose:n,ariaLabel:b,contextChip:w,contextDetail:x,onClearSelection:k,headerTools:A,minimized:j=!1,onMinimize:S,activityState:C="idle",activityLabel:I,activityContext:E="workspace",children:R,testId:$="aurora-panel"}=e;const N=(0,i.useRef)(null),T=(0,i.useCallback)(()=>{(0,a.nq)(),n()},[n]),L=(0,v.yI)(),O=(0,p.Z0)("working"===C,(null===L||void 0===L?void 0:L.activity)||null),[M,U]=(0,i.useState)(()=>{var e,t,n;return null!==(e=null===(t=(n=window).matchMedia)||void 0===t?void 0:t.call(n,"(max-width: 1099px)").matches)&&void 0!==e&&e});return(0,i.useEffect)(()=>{var e,t,n;const i=null===(e=(t=window).matchMedia)||void 0===e?void 0:e.call(t,"(max-width: 1099px)");if(!i)return;const a=()=>U(i.matches);return null===(n=i.addEventListener)||void 0===n||n.call(i,"change",a),()=>{var e;return null===(e=i.removeEventListener)||void 0===e?void 0:e.call(i,"change",a)}},[]),(0,i.useLayoutEffect)(()=>{if(!t)return;const e=document.activeElement;return()=>{null!==e&&void 0!==e&&e.isConnected&&e.focus({preventScroll:!0})}},[t]),(0,i.useEffect)(()=>{if(!t||j)return;const e=document.getElementById("root"),n=null===e||void 0===e?void 0:e.getAttribute("inert");return M&&e?(null===n&&e.setAttribute("data-aurora-inert-owner","true"),e.setAttribute("inert","")):(document.documentElement.setAttribute("data-aurora-docked","true"),(0,f.d_)(!0)),()=>{document.documentElement.removeAttribute("data-aurora-docked"),(0,f.d_)(!1),M&&e&&(e.removeAttribute("data-aurora-inert-owner"),null===n?e.removeAttribute("inert"):null!=n&&e.setAttribute("inert",n))}},[t,j,M]),(0,i.useEffect)(()=>{const e=()=>{t&&M&&!j&&(null===S||void 0===S||S())};return window.addEventListener(g.OM,e),()=>window.removeEventListener(g.OM,e)},[M,j,S,t]),(0,i.useEffect)(()=>
2{if(!t)return;const e=e=>{const t=N.current;if(!t)return;const n=e.target instanceof Element?e.target:null,i=null===n||void 0===n?void 0:n.closest('[data-aurora-overlay="true"]');if(i&&i!==t)return;if(!M&&!t.contains(document.activeElement))return;if("Escape"===e.key&&!e.defaultPrevented)return e.preventDefault(),void T();if("Tab"!==e.key||!M||j)return;const a=Array.from(t.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])')).filter(e=>!e.closest("[hidden]")&&e.getClientRects().length>0),r=a[0],s=a[a.length-1];if(!r||!s)return e.preventDefault(),void t.focus();e.shiftKey&&document.activeElement===r?(e.preventDefault(),s.focus()):e.shiftKey||document.activeElement!==s||(e.preventDefault(),r.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[T,t,M,j]),t?(0,r.createPortal)((0,y.jsxs)(y.Fragment,{children:[M&&!j&&(0,y.jsx)("div",{className:_.A.panelBackdrop,"aria-hidden":"true",onClick:T}),(0,y.jsxs)("div",{ref:N,tabIndex:-1,className:`${_.A.panel}${j?` ${_.A.panelMinimized}`:""}${"complete"===C?` ${_.A.panelComplete}`:""}${O?` ${h.A.panelLit}`:""}`,role:"dialog","aria-modal":M&&!j,"data-modal":M||void 0,"aria-label":b,"data-testid":$,"data-aurora-overlay":"true","data-minimized":j?"true":"false","data-activity-state":C,"data-aura":O||void 0,children:[(0,y.jsx)(p.wG,{mode:O}),j?(0,y.jsxs)("div",{className:_.A.minimizedContent,children:[(0,y.jsx)("div",{className:_.A.minimizedStatus,children:"working"===C?(0,y.jsx)(m.A,{compact:!0,context:E,label:I}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:`${_.A.minimizedBadge}${"complete"===C?` ${_.A.minimizedBadgeComplete}`:""}${"error"===C?` ${_.A.minimizedBadgeError}`:""}`,"aria-hidden":"true",children:"complete"===C?(0,y.jsx)(l.A,{size:16,strokeWidth:2.2}):"error"===C?(0,y.jsx)(o.A,{size:16,strokeWidth:1.9}):(0,y.jsx)(s.A,{size:16,strokeWidth:1.8})}),(0,y.jsxs)("span",{className:_.A.minimizedCopy,role:"status","aria-live":"polite",children:[(0,y.jsx)("strong",{children:"complete"===C?"Your response is ready":"error"===C?"Aurora needs your attention":"Aurora is minimised"}),(0,y.jsx)("span",{children:"complete"===C?"Your response is ready.":"error"===C?"Open the conversation to try again.":"Open the conversation when you\u2019re ready."})]})]})}),(0,y.jsxs)("div",{className:_.A.minimizedActions,children:[(0,y.jsx)("button",{type:"button",className:_.A.headerTool,"aria-label":"Restore Aurora",title:"Restore conversation",onClick:S,children:(0,y.jsx)(c.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})}),(0,y.jsx)("button",{type:"button",className:_.A.headerTool,"aria-label":"Close Aurora",title:"Close",onClick:T,children:(0,y.jsx)(u.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)("header",{className:_.A.panelHeader,children:[(0,y.jsxs)("div",{className:_.A.identity,children:[(0,y.jsx)("span",{className:_.A.identityBadge,"aria-hidden":"true",children:(0,y.jsx)(s.A,{size:16,strokeWidth:1.8})}),(0,y.jsxs)("div",{className:_.A.identityText,children:[(0,y.jsx)("span",{className:_.A.identityEyebrow,children:x||"Your workspace assistant"}),(0,y.jsx)("span",{className:_.A.identityName,children:(0,y.jsx)("span",{className:_.A.identityNameLabel,children:"Aurora"})})]})]}),(0,y.jsxs)("div",{className:_.A.headerActions,children:[A,S?(0,y.jsx)("button",{type:"button",className:_.A.headerTool,"aria-label":"Minimise Aurora",title:"Minimise conversation",onClick:S,children:(0,y.jsx)(d.A,{size:17,strokeWidth:1.9,"aria-hidden":"true"})}):null,(0,y.jsx)("button",{type:"button",className:_.A.headerTool,"aria-label":"Close Aurora",title:"Close",onClick:T,children:(0,y.jsx)(u.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})})]})]}),(0,y.jsxs)("div",{className:_.A.contextBar,children:[(0,y.jsx)("span",{"aria-live":"polite",title:w,children:w}),k&&(0,y.jsxs)("button",{type:"button",onClick:k,"aria-label":"Clear selection and return to this assignment",children:[(0,y.jsx)(u.A,{size:13})," Clear selection"]})]}),R]})]})]}),document.body):null};n.d(t,["A",0,b])},32769(e,t,n){n.d(t,{o:()=>f,A:()=>_});n(33006);var i=n(44151),a=n(99640),r=n(77356);const s="WCcyFF2U",o="QPb6YWuW",l="pxOEHDPv",c="L0bWQaf7",d="Q_xwD_qh",u="tJE6sPez",m="ydNSpHFE",p="uPiqJ4fA",h="ikd54UHM",v="NPUVSUGQ";var g=n(3374);function f(e){let{active:t=!1,complete:n=!1}=e;return(0,g.jsxs)("span",{className:d,"data-active":t,"data-complete":n,"aria-hidden":"true",children:[(0,g.jsx)("span",{className:u}),n?(0,g.jsx)(i.A,{size:18,strokeWidth:2}):(0,g.jsx)(a.A,{size:18,strokeWidth:1.7}),(0,g.jsx)("i",{className:m}),(0,g.jsx)("i",{className:m})]})}function _(e){let{phase:t="thinking",label:n,detail:i,compact:a=!1,lines:d=0,announce:u=!0}=e;const m="thinking"===t||"applying"===t;return(0,g.jsxs)("span",{className:s,"data-phase":t,"data-compact":a,children:[(0,g.jsxs)("span",{className:o,children:["error"===t?(0,g.jsx)("span",{className:v,"aria-hidden":"true",children:(0,g.jsx)(r.A,{size:19})}):(0,g.jsx)(f,{active:m,complete:"success"===t}),(0,g.jsxs)("span",{className:l,role:u?"error"===t?"alert":"status":void 0,"aria-label":u?n:void 0,"aria-atomic":!!u||void 0,children:[(0,g.jsx)("strong",{children:n}),i&&(0,g.jsx)("span",{className:c,children:i})]}),m&&(0,g.jsxs)("span",{className:p,"aria-hidden":"true",children:[(0,g.jsx)("i",{}),(0,g.jsx)("i",{}),(0,g.jsx)("i",{})]})]}),m&&d>0&&(0,g.jsx)("span",{className:h,"aria-hidden":"true",children:Array.from({length:Math.min(d,4)},(e,t)=>(0,g.jsx)("i",{},t))})]})}},63228(e,t,n){var i=n(33006),a=n(93949),r=n(1792),s=n(60419),o=n(3374);const l="edumark:aurora-client-action",c=(0,i.createContext)(null),d=new Set(["status","stage","tab","view","role","cohort","cohort_id","course","course_id","sort","q","search","type","page","create","mode","learner","conversation","new"]),u=new Set(["dashboard","courses","course","course_creation","course_import","assignments","assignment","marking_queue","people","cohorts","migrations","imports","integrations","administration","analytics","quality","settings","supp
2ort","aurora","results","tutorials","security","audit","file_security","plagiarism","billing","usage","notification_broadcast","communications","communication_inbox","live_sessions","live_session"]),m=new Set(["course","assignment","person","cohort","migration"]),p=new Set(["aurora","url","document","manual","import"]),h=new Set(["profile","notifications","course_creation","person_creation","cohort_creation","assignment_creation","integration_setup"]),v=new Set(["course_document","course_resource","people_import","assignment_brief","migration_file"]),g=new Set(s.XC),f=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),_=e=>void 0===e||null===e||null!==k(e),y=e=>{if("string"!==typeof e)return null;const t=e.trim(),n=Array.from(t).some(e=>0===e.charCodeAt(0));return t&&t.length<=8e3&&!n?t:null},b=e=>{if("string"!==typeof e)return null;const t=e.trim();if(!t||t.length>500)return null;try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol?t:null}catch{return null}},w=(e,t)=>!!f(e)&&Object.entries(e).every(e=>{let[n,i]=e;if(!d.has(n))return!1;if(t&&null===i)return!0;const a=Array.isArray(i)?i:[i];return a.length<=25&&a.every(e=>null!==k(e))}),x=e=>{if(!f(e)||!_(e.action_id)||"string"!==typeof e.action)return!1;switch(e.action){case"navigate":return u.has(String(e.destination))&&_(e.entity_id)&&_(e.view)&&(void 0===e.filters||w(e.filters,!1));case"open_creation_flow":return m.has(String(e.flow))&&(void 0===e.mode||null===e.mode||p.has(String(e.mode)))&&_(e.build_session_id)&&(e=>void 0===e||null===e||null!==y(e))(e.brief)&&(e=>void 0===e||null===e||null!==b(e))(e.source_url);case"set_filter":return w(e.filters,!0)&&(void 0===e.replace||"boolean"===typeof e.replace);case"open_modal":return h.has(String(e.modal));case"close_modal":return _(e.modal);case"select_entity":case"focus_entity":case"highlight_change":return(e=>!!f(e)&&g.has(String(e.entity_type))&&null!==k(e.entity_id))(e.entity);case"open_upload_picker":return v.has(String(e.purpose));case"invalidate_view":return Array.isArray(e.targets)&&e.targets.length<=25&&e.targets.every(e=>null!==k(e));case"logout":return!0;default:return!1}},k=e=>{if("string"!==typeof e)return null;const t=e.trim(),n=Array.from(t).some(e=>[0,10,13].includes(e.charCodeAt(0)));return!t||t.length>200||n?null:t},A=(e,t)=>
2{if(!t)return!0;for(const[n,i]of Object.entries(t)){if(!d.has(n))return!1;if(e.delete(n),null===i)continue;const t=Array.isArray(i)?i:[i];for(const i of t){const t=k(i);if(!t)return!1;e.append(n,t)}}return!0};n.d(t,["HL",0,e=>{let{children:t,actorRole:n="admin"}=e;const s=(0,a.Zp)(),d=(0,a.zy)(),u=(0,i.useRef)(s);u.current=s;const m=(0,i.useRef)(d);m.current=d;const p=(0,i.useRef)(new Set),h=(0,i.useRef)(new Map),v=(0,i.useRef)(!0);(0,i.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);const g=(0,i.useCallback)(e=>{if("navigate"===e.action){const t=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"admin";const a=t?k(t):null,r=n?k(n):null;switch(e){case"dashboard":return"/dashboard";case"courses":return"/courses";case"course":return a?`/courses/${encodeURIComponent(a)}`:null;case"course_creation":return"/courses/new";case"course_import":return"/courses/new?start=sources";case"assignments":return"/assignments";case"assignment":return a?"learner"===i?`/assignments/${encodeURIComponent(a)}`:`/assignments/${encodeURIComponent(a)}/manage`:null;case"marking_queue":return"/marking";case"people":return r?`/people/${encodeURIComponent(r)}`:"/people";case"cohorts":return"/people/cohorts";case"migrations":return"/migration";case"imports":return"/data-imports";case"integrations":return"/integrations";case"administration":return"/organisation";case"analytics":return"/analytics";case"quality":return"/quality";case"settings":return"/settings";case"support":return"/support";case"aurora":return"/aurora";case"results":return"/results";case"tutorials":return"/tutorials";case"security":return"/security";case"audit":return"/audit";case"file_security":return"/file-security";case"plagiarism":return"/plagiarism/upload";case"billing":case"usage":return"/settings/workspace/billing";case"notification_broadcast":return"/community/announcements";case"communications":return"/communications";case"communication_inbox":return a?`/communications/conversations/${encodeURIComponent(a)}`:"/communications/inbox";case"live_sessions":return"/communications/live";case"live_session":return a?`/communications/live/${encodeURIComponent(a)}`:null;default:return null}}(e.destination,e.entity_id,e.view,n),i=t?((e,t)=>{const[n,i=""]=e.split("?"),a=new URLSearchParams(i);if(!A(a,t))return null;const r=a.toString();return`${n}${r?`?${r}`:""}`})(t,e.filters):null;return i?(0,r.s)(i):null}if("open_creation_flow"===e.action)return(e=>{const t=new URLSearchParams,n=e.brief?y(e.brief):null,i=e.build_session_id?k(e.build_session_id):null,a=e.source_url?b(e.source_url):null;if(e.brief&&!n)return null;if(e.build_session_id&&!i)return null;if(e.source_url&&!a)return null;switch(n&&t.set("brief",n),a&&t.set("source_url",a),e.flow){case"course":{if("url"===e.mode||"document"===e.mode||"import"===e.mode)return t.set("start","sources"),e.mode&&t.set("mode",e.mode),`/courses/new?${t.toString()}`;if(i)return`/courses/create/aurora/${encodeURIComponent(i)}`;if("manual"===e.mode)return t.set("start","blank"),`/courses/new?${t.toString()}`;("aurora"===e.mode||n)&&t.set("start","aurora");const a=t.toString();return"/courses/new"+(a?`?${a}`:"")}case"assignment":{"document"!==e.mode&&"import"!==e.mode||t.set("start","import"),"aurora"===e.mode&&t.set("start","aurora"),"manual"===e.mode&&t.set("start","manual");const n=t.toString();return"/assignments/new"+(n?`?${n}`:"")}case"person":return t.set("create","person"),`/people?${t.toString()}`;case"cohort":return t.set("create","cohort"),`/people/cohorts?${t.toString()}`;case"migration":return"/migration";default:return null}})(e);if("open_modal"===e.action)return(e=>{switch(e.modal){case"profile":case"notifications":default:return null;case"course_creation":return"/courses/new";case"person_creation":return"/people?create=person";case"cohort_creation":return"/people/cohorts?create=cohort";case"assignment_creation":return"/assignments/new";case"integration_setup":return"/integrations?setup=true"}})(e);if("open_upload_picker"===e.action)return(e=>{switch(e.purpose){case"course_document":return"/courses/new?start=sources&upload=course_document";case"course_resource":return"/courses/new?start=sources&upload=course_resource";case"people_import":return"/data-imports?type=user&upload=true";case"assignment_brief":return"/assignments/new?start=import";case"migration_file":return"/data-imports?upload=true";default:return null}})(e);if("set_filter"===e.action){const t=new URLSearchParams(m.current.search);return A(t,e.filters)?`${m.current.pathname}${t.toString()?`?${t.toString()}`:""}`:null}return"logout"===e.action?"/logout":null},[n]),f=(0,i.useCallback)(e=>{if(!x(e))return{executed:!1,reason:"Unsupported client action."};const t=e;if(t.action_id&&p.current.has(t.action_id))return{executed:!0};const n=g(t);
2if(!n){if("navigate"===t.action)return{executed:!1,reason:"Invalid navigation target."};if("open_creation_flow"===t.action)return{executed:!1,reason:"Invalid creation flow."};if("open_upload_picker"===t.action)return{executed:!1,reason:"Invalid upload target."};if("set_filter"===t.action)return{executed:!1,reason:"Unsupported filter."}}return t.action_id&&(p.current.add(t.action_id),p.current.size>500&&(p.current=new Set(Array.from(p.current).slice(-250)))),n&&u.current(n,{replace:"set_filter"===t.action&&!0===t.replace}),(e=>{window.dispatchEvent(new CustomEvent(l,{detail:e}))})(t),{executed:!0}},[g]),_=(0,i.useCallback)((e,t)=>{if(!x(e))return Promise.resolve({executed:!1,reason:"Unsupported client action."});if(e.action_id){const t=h.current.get(e.action_id);if(t)return t}const n=g(e),i=(async(i,a,r)=>{const s=()=>`${m.current.pathname}${m.current.search}${m.current.hash}`;if(null!==t&&void 0!==t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)return{executed:!1,reason:"The action was cancelled.",actual_route:s()};const o=f(e);if(!o.executed)return o;if(!n)return{executed:!1,reason:"The page action was requested, but its result requires semantic verification.",actual_route:s()};const l=new URL(n,window.location.origin),c=Date.now();let d=null;const u=null!==(a=null===t||void 0===t?void 0:t.timeout_ms)&&void 0!==a?a:8e3;for(;v.current&&(null===t||void 0===t||null===(p=t.signal)||void 0===p||!p.aborted);){var p;const t=new URL(s(),window.location.origin),i="navigate"===e.action&&["settings","people","communications","administration","support"].includes(e.destination)&&!e.entity_id&&!e.view,a=t.pathname===l.pathname||Boolean(i&&t.pathname.startsWith(`${l.pathname}/`)),r=Array.from(l.searchParams.keys()).every(e=>JSON.stringify(t.searchParams.getAll(e))===JSON.stringify(l.searchParams.getAll(e)));if(!a||!r||l.hash&&t.hash!==l.hash)d=null;else if(null===d&&(d=Date.now()),Date.now()-d>=120)return{executed:!0,actual_route:s(),expected_route:n};if(Date.now()-c>=u)break;await new Promise(e=>window.setTimeout(e,40))}return{executed:!1,reason:null!==t&&void 0!==t&&null!==(r=t.signal)&&void 0!==r&&r.aborted||!v.current?"The action was cancelled before its result could be verified.":`The requested page did n
2ot open. The current page is ${s()}. Check for an unsaved-change prompt, a redirect, or unavailable access before trying again.`,actual_route:s(),expected_route:n}})();return e.action_id&&(h.current.set(e.action_id,i),h.current.size>500&&(h.current=new Map(Array.from(h.current.entries()).slice(-250)))),i},[f,g]),w=(0,i.useMemo)(()=>({execute:f,executeVerified:_}),[f,_]);return(0,o.jsx)(c.Provider,{value:w,children:t})},"fy",0,l,"ii",0,x,"wS",0,()=>{const e=(0,i.useContext)(c);if(!e)throw new Error("useAuroraClientActions must be used inside AuroraClientActionProvider");return e}])},40939(e,t,n){n.d(t,{$H:()=>F,$h:()=>O,F9:()=>M,G9:()=>T,NJ:()=>c,PD:()=>h,QL:()=>x,SF:()=>g,Sb:()=>j,Wz:()=>S,Zn:()=>w,cK:()=>b,fx:()=>L,gV:()=>R,ly:()=>A,pO:()=>I,rO:()=>E,tL:()=>C,u8:()=>B,vX:()=>z,vl:()=>U,wN:()=>N,wT:()=>k,xC:()=>$,yH:()=>v});var i=n(5487),a=n(17187),r=n(18537),s=n(60419),o=n(66390),l=n(77538);class c extends Error{constructor(e,t,n,i){super(n),this.kind=void 0,this.code=void 0,this.retryAfterSeconds=void 0,this.name="AuroraApiError",this.kind=e,this.code=t,this.retryAfterSeconds=i}}const d=()=>"https://systems.aries.edumark.ai".replace(/\/$/,""),u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return`${d()}/api/aurora/conversations${e}`},m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return`${d()}/api/aurora/semantic${e}`},p=e=>{const t=f(e);if(!t||!["ask","full_access"].includes(t.mode)||!Number.isSafeInteger(t.revision)||t.revision<0||"2026-09-17"!==t.consent_version||"boolean"!==typeof t.permissions_changed)throw new Error("Aurora access could not be verified. Please try again.");return t};async function h(){try{return p(await i.default.get(m("/access")))}catch(e){throw y(e)}}async function v(e,t,n){try{return p(await i.default.put(m("/access"),{mode:e,expected_revision:t,acknowledged_risks:n,consent_version:"2026-09-17"}))}catch(a){throw y(a)}}async function g(e){const t=e.undo;if(!e.success||null===t||void 0===t||!t.available||!t.assessment_draft_id||!t.expected_revision)throw new c("denied","AURORA_UNDO_UNAVAILABLE","This change cannot be undone.");
2try{const n=f(await i.default.post(`${d()}/api/aurora/tools/assessment_undo_last_change`,{draft_id:t.assessment_draft_id,expected_revision:t.expected_revision},{headers:{"X-Request-ID":`undo:${e.command_id}`}}));if(!n.success||n.revision!==t.expected_revision+1||n.request_id!==`undo:${e.command_id}`)throw new c("unavailable","AURORA_COMMAND_OUTCOME_UNKNOWN","Undo could not be verified. Reload the assignment to check its saved state.");return n}catch(n){throw y(n)}}function f(e){return e&&"object"===typeof e&&"data"in e?e.data:e}const _=(e,t)=>null===e?"offline":401===e||403===e?"denied":404===e?"not_found":409===e?"AURORA_CONTEXT_CHANGED"===t?"locked":"denied":429===e?"rate_limited":"unavailable",y=e=>{var t,n,i,a,r;if(e instanceof c)return e;const s=e,o="number"===typeof(null===s||void 0===s||null===(t=s.response)||void 0===t?void 0:t.status)?s.response.status:null,l=(null===s||void 0===s||null===(n=s.response)||void 0===n||null===(i=n.data)||void 0===i?void 0:i.error)||(null===s||void 0===s||null===(a=s.response)||void 0===a||null===(r=a.data)||void 0===r?void 0:r.detail),d=String((null===l||void 0===l?void 0:l.code)||"AURORA_UNAVAILABLE"),u=String((null===l||void 0===l?void 0:l.message)||"Aurora is unavailable right now.");return new c(_(o,d),d,u)};async function b(e){try{return f(await i.default.post(u(),e?{title:e}:{}))}catch(t){throw y(t)}}async function w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{const t=new URLSearchParams;e.q&&t.set("q",e.q),e.cursor&&t.set("cursor",e.cursor);const n=t.toString()?`?${t.toString()}`:"";return f(await i.default.get(u(n)))}catch(t){throw y(t)}}async function x(e,t){try{const n=t?`?cursor=${encodeURIComponent(t)}`:"";return f(await i.default.get(u(`/${encodeURIComponent(e)}${n}`)))}catch(n){throw y(n)}}async function k(e,t){try{return f(await i.default.patch(u(`/${encodeURIComponent(e)}`),{title:t}))}catch(n){throw y(n)}}async function A(e){try{await i.default.delete(u(`/${encodeURIComponent(e)}`))}catch(t){throw y(t)}}async function j(){try{var e,t;const n=await i.default.delete(u());return Number(null!==(e=null===(t=f(n))||void 0===t?void 0:t.cleared)&&void 0!==e?e:0)}catch(n){throw y(n)}}async function S(e){try{await i.default.post(u(`/messages/${encodeURIComponent(e)}/cancel`))}catch(t){throw y(t)}}async function C(e,t){if(!(0,s.pi)(e))throw new c("denied","AURORA_LEGACY_CONFIRMATION_INVALID","This confirmation is no longer valid.");
2try{const n=f(await i.default.post(`${d()}/api/aurora/tools/${encodeURIComponent(e.tool)}/confirmation-proposals/${encodeURIComponent(e.confirmation_id)}/decision`,{protocol_version:"1.0",confirmation_token:e.confirmation_token,request_id:e.request_id,confirmed:t}));if(!n||"1.0"!==n.protocol_version||n.confirmation_id!==e.confirmation_id||n.request_id!==e.request_id||!["cancelled","completed"].includes(n.status)||"boolean"!==typeof n.replayed||t&&"completed"!==n.status||!t&&"cancelled"!==n.status)throw new c("unavailable","AURORA_LEGACY_CONFIRMATION_INVALID","Aurora returned an invalid confirmation result.");return n}catch(n){throw y(n)}}async function I(e,t,n){try{await i.default.post(u(`/messages/${encodeURIComponent(e)}/feedback`),{rating:t,...n?{reason:n}:{}})}catch(a){throw y(a)}}async function E(e){try{return f(await i.default.post(m("/sessions"),{protocol_version:"1.0",...e,mode:e.mode||"active"}))}catch(t){throw y(t)}}async function R(e,t){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e)}/observations`),t))}catch(n){throw y(n)}}async function $(e,t,n,a){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e)}/actions/${encodeURIComponent(t)}/start`),{protocol_version:"1.0",client_instance_id:n,envelope:a}))}catch(r){throw y(r)}}async function N(e,t){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e)}/actions`),t))}catch(n){throw y(n)}}async function T(e,t,n,a,r){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e)}/actions/${encodeURIComponent(t)}/result`),{protocol_version:"1.0",client_instance_id:n,envelope:a,result:r}))}catch(s){throw y(s)}}async function L(e){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e.session_id)}/actions/${encodeURIComponent(e.action_id)}/confirmation`),{protocol_version:"1.0",decision_id:e.decision_id,client_instance_id:e.client_instance_id,snapshot_version:e.snapshot_version,target_fingerprint:e.target_fingerprint||void 0,confirmed:e.confirmed}))}catch(t){throw y(t)}}async function O(e){try{return f(await i.default.post(m(`/sessions/${encodeURIComponent(e.session_id)}/cancel`),{protocol_version:"1.0",client_instance_id:e.client_instance_id,cancellation_token:e.cancellation_token,...e.reason?{reason:e.reason}:{}}))}catch(t){throw y(t)}}async function M(e){try{return f(await i.default.post(m("/resources/resolve"),{protocol_version:"1.0",...e}))}catch(t){throw y(t)}}async function U(){try{const e=f(await(0,a.G)(m("/capabilities")));if(!(0,l.dt)(e))throw new Error("Aurora semantic capabilities did not match protocol 1.0.");return e}catch(e){throw y(e)}}const P=()=>{const e={"Content-Type":"application/json",Accept:"text/event-stream"};try{const t=window.localStorage.getItem("edumrk_dv_ath");t&&(e.Authorization=`Bearer ${t}`)}catch{}const t=(0,r.yk)();return t&&(e["X-Edumark-Centre"]=t),e["X-Request-ID"]=`aurora-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,e},q=e=>{let t="",n="";for(const i of e.split("\n"))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(!t||!n)return null;try{return{...JSON.parse(n),kind:t}}catch{return null}};async function D(e,t,n){var i;let a;try{a=await fetch(e,t)}catch(l){if("AbortError"===(null===l||void 0===l?void 0:l.name))return;throw new c("offline","AURORA_NETWORK","You appear to be offline.")}if(!a.ok){let e="AURORA_UNAVAILABLE",t="Aurora is unavailable right now.";try{const n=await a.json(),i=(null===n||void 0===n?void 0:n.error)||(null===n||void 0===n?void 0:n.detail);null!==i&&void 0!==i&&i.code&&(e=String(i.code)),null!==i&&void 0!==i&&i.message&&(t=String(i.message))}catch{}const n=Number(a.headers.get("Retry-After")||"")||void 0;throw new c(_(a.status,e),e,t,n)}const r=null===(i=a.body)||void 0===i?void 0:i.getReader();if(!r)throw new c("unavailable","AURORA_STREAM_UNSUPPORTED","Streaming is unavailable.");const s=new TextDecoder;let o="";try{for(;;){const{done:e,value:t}=await r.read();if(e)break;o+=s.decode(t,{stream:!0});let i=o.indexOf("\n\n");for(;-1!==i;){const e=o.slice(0,i);o=o.slice(i+2);const t=q(e);t&&n.onEvent(t),i=o.indexOf("\n\n")}}}catch(l){if("AbortError"===(null===l||void 0===l?void 0:l.name))return;throw new c("offline","AURORA_STREAM_INTERRUPTED","The connection was interrupted
2while Aurora was responding.")}}async function z(e,t,n){const a=new FormData;a.append("file",t,t.name);try{return f(await i.default.post(u(`/${encodeURIComponent(e)}/attachments`),a,{signal:n,timeout:12e4}))}catch(r){throw y(r)}}async function B(e){var t;await D(u(`/${encodeURIComponent(e.conversationId)}/messages`),{method:"POST",headers:P(),signal:e.signal,body:JSON.stringify({content:e.content,client_message_id:e.clientMessageId,...e.pageContext?{page_context:(0,o.a)(e.pageContext)}:{},...e.semanticSessionId?{semantic_session_id:e.semanticSessionId}:{},...e.semanticSnapshotId?{semantic_snapshot_id:e.semanticSnapshotId}:{},...null!==(t=e.attachmentIds)&&void 0!==t&&t.length?{attachment_ids:e.attachmentIds}:{}})},{onEvent:e.onEvent})}async function F(e){await D(u(`/messages/${encodeURIComponent(e.messageId)}/retry`),{method:"POST",headers:P(),signal:e.signal,body:JSON.stringify({...e.pageContext?{page_context:(0,o.a)(e.pageContext)}:{},...e.semanticSessionId?{semantic_session_id:e.semanticSessionId}:{},...e.semanticSnapshotId?{semantic_snapshot_id:e.semanticSnapshotId}:{}})},{onEvent:e.onEvent})}},62470(e,t,n){var i=n(33006);let a=!1;const r=new Set,s=()=>a,o=e=>(r.add(e),()=>{r.delete(e)});n.d(t,["PF",0,"(max-width: 1679px)","d_",0,e=>{a!==e&&(a=e,r.forEach(e=>e()))},"kC",0,()=>(0,i.useSyncExternalStore)(o,s,()=>!1)])},43597(e,t,n){var i=n(77538);const a=()=>!0,r=()=>!0,s=(e,t)=>{var n,i;return!0===(null===(n=e[t])||void 0===n?void 0:n.enabled)&&!0===(null===(i=e[t])||void 0===i?void 0:i.valid)};n.d(t,["E0",0,(e,t,n)=>{const a=Boolean((null===t||void 0===t?void 0:t.configured)&&t.eligible&&n&&(0,i.NU)(t,n))&&s(e,"aurora_semantic_runtime"),r=a&&s(e,"aurora_presence_layer");return{runtime:a,presence:r,generic_actions:r&&s(e,"aurora_generic_actions"),resource_resolver:a&&s(e,"aurora_resource_resolver"),typed_commands:a&&s(e,"aurora_typed_commands"),legacy_bridge:s(e,"aurora_legacy_bridge"),shadow_mode:a&&s(e,"aurora_shadow_mode")}},"Gx",0,()=>!1,"K4",0,()=>!0,"Zr",0,()=>!1,"be",0,r,"cp",0,()=>!1,"g3",0,()=>!1,"p7",0,()=>!0,"wZ",0,a])},40636(e,t,n){n.d(t,{y:()=>L,M:()=>O});var i=n(33006),a=n(55507);let r=0;class s{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"connection-"+ ++r;this.sessionId=e,this.rows=[],this.seen=new Set,this.sequence=0}append(e){if(!["session.input_transcript.delta","session.output_transcript.delta"].includes(e.type))return null;const t="session.input_transcript.delta"===e.type?"user":"assistant",{delta:n,start_ms:i,end_ms:a,event_id:r}=e;if("string"!==typeof n||!n||!Number.isFinite(i)||!Number.isFinite(a)||a<i||r&&this.seen.has(r))return null;r&&this.seen.add(r);let s=[...this.rows].reverse().find(e=>e.role===t&&i<=e.endMs+1500&&a>=e.startMs-1500&&e.text.length+n.length<=12e3);return s||(s={id:`live:${this.sessionId}:${++this.sequence}:${t}`,role:t,text:"",startMs:i,endMs:a,fragments:[]},this.rows.push(s)),s.fragments.push({delta:n,startMs:i,endMs:a}),s.fragments.sort((e,t)=>e.startMs-t.startMs),s.text=s.fragments.map(e=>e.delta).join(""),s.startMs=Math.min(s.startMs,i),s.endMs=Math.max(s.endMs,a),{...s}}}class o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.handlers=e,this.peer=null,this.channel=null,this.micStream=null,this.remoteStream=null,this.audioElement=null,this.stopped=!1,this.ready=!1,this.closing=!1,this.micEnabled=!0,this.started=null,this.startupFailed=null,this.finalize=null}get localStream(){return this.micStream}get outputStream(){return this.remoteStream}get connectionState(){var e;return(null===(e=this.peer)||void 0===e?void 0:e.connectionState)||"closed"}async start(e){var t;if("undefined"===typeof RTCPeerConnection||null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia)throw new Error("This browser cannot run live voice.");this.stop(),this.stopped=!1,this.closing=!1;try{var n,i,a;if(this.micStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),this.stopped)throw this.micStream.getTracks().forEach(e=>e.stop()),this.micStream=null,new Error("Voice connection was cancelled.");null===(n=(i=this.handlers).onLocalStream)||void 0===n||n.call(i,this.micStream),this.micStream.getAudioTracks().forEac
2h(e=>{e.enabled=!1,e.onmute=()=>{var e,t;this.stopped||null===(e=(t=this.handlers).onMicrophoneMuted)||void 0===e||e.call(t)},e.onunmute=()=>{var e,t;this.stopped||null===(e=(t=this.handlers).onMicrophoneUnmuted)||void 0===e||e.call(t)},e.onended=()=>{var e,t;this.stopped||null===(e=(t=this.handlers).onMicrophoneEnded)||void 0===e||e.call(t)}});const t=new RTCPeerConnection;this.peer=t,this.micStream.getTracks().forEach(e=>t.addTrack(e,this.micStream));const r=document.createElement("audio");r.autoplay=!0,r.setAttribute("playsinline","true"),this.audioElement=r,t.ontrack=e=>{var t,n;const[i]=e.streams;i&&!this.stopped&&(this.remoteStream=i,r.srcObject=i,null===(t=(n=this.handlers).onRemoteStream)||void 0===t||t.call(n,i),r.play().catch(()=>{}))},t.onconnectionstatechange=()=>{var e,n;this.stopped||null===(e=(n=this.handlers).onConnectionState)||void 0===e||e.call(n,t.connectionState)};const s=t.createDataChannel("oai-events");this.channel=s,s.onmessage=e=>{if(!this.stopped)try{var t,n;const l=JSON.parse(String(e.data));var i,a,r,s,o;if("session.started"===l.type)this.ready=!0,this.setMicEnabled(this.micEnabled),null===(i=this.started)||void 0===i||i.call(this);if("error"!==l.type||this.ready||!0!==(null===(t=l.error)||void 0===t?void 0:t.fatal)||null===(n=this.startupFailed)||void 0===n||n.call(this),"session.closed"===l.type)this.ready=!1,null===(a=this.startupFailed)||void 0===a||a.call(this),null===(r=this.finalize)||void 0===r||r.call(this);if(l&&"object"===typeof l)Promise.resolve(null===(s=(o=this.handlers).onEvent)||void 0===s?void 0:s.call(o,l)).catch(()=>{})}catch{}},s.onopen=()=>{var e,t;return null===(e=(t=this.handlers).onChannelOpen)||void 0===e?void 0:e.call(t)};const o=await t.createOffer(),l=o.sdp;if(!l)throw new Error("The browser did not create a live voice offer.");if(await t.setLocalDescription(o),"complete"!==t.iceGatheringState&&await new Promise((e,n)=>{const i=window.setTimeout(()=>{t.removeEventListener("icegatheringstatechange",a),n(new Error("Timed out connecting voice. Please try again."))},1e4),a=()=>{"complete"===t.iceGatheringState&&(window.clearTimeout(i),t.removeEventListener("icegatheringstatechange",a),e())};t.addEventListener("icegatheringstatechange",a),a()}),this.stopped)throw new Error("Voice connection was cancelled.");const c=await e((null===(a=t.localDescription)||void 0===a?void 0:a.sdp)||l);if(!c||this.stopped)throw new Error("The live voice handshake was incomplete.");const d=new Promise((e,t)=>{const n=window.setTimeout(()=>{var e;return null===(e=this.startupFailed)||void 0===e?void 0:e.call(this)},15e3),i=()=>{window.clearTimeout(n),this.started=null,this.startupFailed=null};this.started=()=>{i(),e()},this.startupFailed=()=>{i(),t(new Error("The voice session could not start. Please try again."))}});d.catch(()=>{}),await t.setRemoteDescription({type:"answer",sdp:c}),await d}catch(r){throw this.stop(),r}}setMicEnabled(e){var t;this.micEnabled=e,null===(t=this.micStream)||void 0===t||t.getAudioTracks().forEach(t=>{t.enabled=e&&this.ready&&!this.closing})}send(e){try{var t;this.ready&&!this.closing&&"open"===(null===(t=this.channel)||void 0===t?void 0:t.readyState)&&this.channel.send(JSON.stringify(e))}catch{}}cancelResponse(){this.send({type:"session.instructions.append",delegation_id:null,content:"Stop speaking and listen to the user. Do not cancel any backend work."})}async close(){this.ready?(this.setMicEnabled(!1),this.audioElement&&(this.audioElement.muted=!0),await new Promise(e=>{const t=window.setTimeout(()=>{this.finalize=null,e()},5e3);this.finalize=()=>{window.clearTimeout(t),this.finalize=null,e()},this.send({type:"session.close"}),this.closing=!0}),this.stop()):this.stop()}stop(){var e,t,n,i;this.send({type:"session.close"}),null===(e=this.startupFailed)||void 0===e||e.call(this),this.ready=!1,this.stopped=!0,null===(t=this.finalize)||void 0===t||t.call(this);const a=e=>{try{e()}catch{}};a(()=>{var e;return null===(e=this.channel)||void 0===e?void 0:e.close()}),a(()=>{var e;return null===(e=this.peer)||void 0===e?void 0:e.close()}
2),null===(n=this.micStream)||void 0===n||n.getTracks().forEach(e=>a(()=>e.stop())),null===(i=this.remoteStream)||void 0===i||i.getTracks().forEach(e=>a(()=>e.stop())),this.audioElement&&(a(()=>{var e;return null===(e=this.audioElement)||void 0===e?void 0:e.pause()}),this.audioElement.srcObject=null),this.channel=null,this.peer=null,this.micStream=null,this.remoteStream=null,this.audioElement=null}}var l=n(63228),c=n(4912),d=n(44330),u=n(5487),m=n(66390);const p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}/api/aurora/realtime${e}`};function h(e){return e&&"object"===typeof e&&"data"in e?e.data:e}async function v(e){return h(await u.default.post(p("/session"),{conversation_id:e.conversationId,sdp:e.sdp,...e.observation?{observation:e.observation}:{},...e.pageContext?{page_context:(0,m.a)(e.pageContext)}:{}}))}async function g(e,t,n){await u.default.patch(p(`/sessions/${encodeURIComponent(e)}/context`),{page_context:(0,m.a)(t),...n?{observation:n}:{}})}async function f(e){await u.default.post(p(`/sessions/${encodeURIComponent(e)}/end`))}async function _(e,t,n){await u.default.post(p(`/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}/context`),n)}async function y(e,t,n){await u.default.post(p(`/sessions/${encodeURIComponent(e)}/client-actions/${encodeURIComponent(t)}/result`),n)}var b=n(38238);class w{constructor(e){this.settings=e,this.active=!1,this.aboveSince=null,this.belowSince=null}update(e,t){return arguments.length>2&&void 0!==arguments[2]&&!arguments[2]||!Number.isFinite(e)?this.reset():(this.active?(this.aboveSince=null,e>this.settings.off?this.belowSince=null:(null===this.belowSince&&(this.belowSince=t),t-this.belowSince>=this.settings.releaseMs&&(this.active=!1))):(this.belowSince=null,e<this.settings.on?this.aboveSince=null:(null===this.aboveSince&&(this.aboveSince=t),t-this.aboveSince>=this.settings.attackMs&&(this.active=!0))),this.active)}reset(){return this.active=!1,this.aboveSince=null,this.belowSince=null,!1}}class x{constructor(){this.context=null,this.analyser=null,this.source=null,this.samples=null,this.stream=null,this.resumePending=null,this.lastResumeAt=-1/0}attach(e){this.dispose();const t="undefined"!==typeof AudioContext?AudioContext:window.webkitAudioContext;if(t)try{const n=new t;this.context=n,this.stream=e;const i=n.createAnalyser();i.fftSize=256,i.smoothingTimeConstant=.72;const a=n.createMediaStreamSource(e);a.connect(i),this.analyser=i,this.source=a,this.samples=new Uint8Array(new ArrayBuffer(i.fftSize)),n.onstatechange=()=>{this.context===n&&"running"!==n.state&&this.resume()},this.resume()}catch{this.dispose()}}resume(){const e=this.context;if(!e||"running"===e.state||"closed"===e.state)return Promise.resolve();if(this.resumePending)return this.resumePending;this.lastResumeAt=Date.now();const t=Promise.resolve().then(()=>{if(this.context===e&&"closed"!==e.state)return e.resume()}).catch(()=>{}).finally(()=>{this.resumePending===t&&(this.resumePending=null)});return this.resumePending=t,t}readSamples(){var e;if(!this.analyser||!this.samples||!this.context)return null;if("running"!==this.context.state)return Date.now()-this.lastResumeAt>=1e3&&this.resume(),null;if(null===(e=this.stream)||void 0===e||!e.getAudioTracks().some(e=>"live"===e.readyState&&e.enabled&&!e.muted))return null;try{return this.analyser.getByteTimeDomainData(this.samples),this.samples}catch{return null}}level(){const e=this.readSamples();if(!e)return 0;let t=0;for(const n of e){const e=(n-128)/128;t+=e*e}return Math.min(1,4.5*Math.sqrt(t/e.length))}waveform(e){const t=this.readSamples();if(t)for(let n=0;n<e.length;n+=1)e[n]=(t[Math.floor(n*t.length/e.length)]-128)/128;else e.fill(0)}dispose(){try{var e;null===(e=this.source)||void 0===e||e.disconnect(),this.context&&(this.context.onstatechange=null,this.context.close().catch(()=>{}))}catch{}this.context=null,this.analyser=null,this.source=null,this.samples=null,this.stream=null,this.resumePending=null,this.lastResumeAt=-1/0}}var k=n(27507),A=n(27532),j=n(3374);const S={connecting:"Connecting to Aurora",listening:"Listening",user_speaking:"I\u2019m listening",thinking:"Thinking",tool_running:"Working in EduMark",assistant_speaking:"Aurora is speaking",interrupted:"Interrupted \u2014 listening",reconnecting:"Reconnecting",error:"Couldn\u2019t connect to Aurora",ended:"Voice conversation ended"},C=(0,i.createContext)(null),I=e=>JSON.stringify(e),E=e=>{var t,n;return`${(null===(t=e.workspace)||void 0===t?void 0:t.organisation_id)||""}:${(null===(n=e.workspace)||void 0===n?void 0:n.centre_id)||""}`},R=e=>JSON.stringify(e,(e,t)=>["snapshot_id","snapshot_version","captured_at","geometry"].includes(e)?void 0:t),$=(e,t)=>e.route.split(/[?#]/)[0]===t.route.split(/[?#]/)[0],N=e=>{var t,n,i;return null===e||void 0===e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n||null===(i=n.detail)||void 0===i?void 0:i.code},T=e=>["AURORA_VOICE_REQUEST_STALE","AURORA_REFUSED"].includes(N(e)||""),L=e=>{let{children:t}=e;const n=(0,k.M)(),r=(0,l.wS)(),m=(0,i.useRef)(r);m.current=r;const L=(0,d.yI)(),{context:O}=(0,c.KF)(),[M,U]=(0,i.useState)(null),P=(0,i.useRef)(null),q=(0,i.useRef)(null),D=(0,i.useRef)(null),[z,B]=(0,i.useState)(null),[F,W]=(0,i.useState)("ended"),[H,V]=(0,i.useState)(S.ended),[Y,G]=(0,i.useState)(!1),J=(0,i.useRef)(!1),[
2K,X]=(0,i.useState)([]),[Z,Q]=(0,i.useState)(null),[ee,te]=(0,i.useState)(0),ne=(0,i.useRef)(null),ie=(0,i.useRef)(null),ae=(0,i.useRef)("ended"),re=(0,i.useRef)(!1),se=(0,i.useRef)(0),oe=(0,i.useRef)(null),le=(0,i.useRef)(0),ce=(0,i.useRef)(!1),de=(0,i.useRef)({micActive:!1,outputActive:!1,micLevel:0,outputLevel:0}),ue=(0,i.useRef)({state:"ended",label:S.ended}),me=(0,i.useRef)({state:"listening",label:S.listening}),pe=(0,i.useRef)(S.ended),he=(0,i.useRef)(null),ve=(0,i.useRef)(null),ge=(0,i.useRef)(null),fe=(0,i.useRef)(new Set),_e=(0,i.useRef)(0),ye=(0,i.useRef)(new Set),be=(0,i.useRef)({user:"",assistant:""}),we=(0,i.useRef)({user:"",assistant:""}),xe=(0,i.useRef)(O),ke=(0,i.useRef)(""),Ae=(0,i.useRef)(""),je=(0,i.useRef)(new Set),Se=(0,i.useRef)(null),Ce=(0,i.useRef)(null),Ie=(0,i.useRef)(new Set),Ee=(0,i.useRef)("read_only"),Re=(0,i.useRef)(new Set),$e=(0,i.useRef)(new Map),Ne=(0,i.useRef)(L);Ne.current=L,xe.current=O;const Te=(0,i.useCallback)(()=>{const e=ue.current,t=ce.current&&!re.current&&!["connecting","reconnecting","error","ended"].includes(e.state),n=t&&de.current.micActive?"user_speaking":t&&de.current.outputActive?"assistant_speaking":e.state,i=n===e.state?e.label:S[n];ae.current!==n&&(ae.current=n,W(n)),pe.current!==i&&(pe.current=i,V(i))},[]),Le=(0,i.useCallback)((e,t)=>{const n={state:e,label:t||S[e]};ue.current=n,["listening","thinking","tool_running","interrupted"].includes(e)&&(me.current=n),Te()},[Te]),Oe=(0,i.useCallback)(function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1800;const i=null===(t=Ne.current)||void 0===t?void 0:t.observe_page;if(!i)return Promise.resolve(null);const a=new AbortController;return je.current.add(a),new Promise(t=>{let r=!1;const s=e=>{r||(r=!0,window.clearTimeout(o),je.current.delete(a),t(e))},o=window.setTimeout(()=>a.abort(),n);a.signal.addEventListener("abort",()=>s(null),{once:!0}),Promise.resolve().then(()=>i(e,a.signal)).then(s).catch(()=>s(null))})},[]),Me=(0,i.useCallback)(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=t.trim();if(!i)return;const a=n.id||`${e}:${Date.now()}:${Math.random()}`;ye.current.has(a)?n.replace&&X(e=>e.map(e=>e.id===a?{...e,text:i}:e)):(ye.current.add(a),X(t=>[...t,{id:a,who:e,text:i}]))},[]),Ue=(0,i.useCallback)(e=>{Me("action","semantic"===Ee.current?"This change needs the current on-screen review. Voice can continue.":"This change needs review in text chat. Voice can still help with reading and navigation.",{id:e})},[Me]),Pe=(0,i.useCallback)(e=>{Me("action","Voice can help with reading and navigation, but changes are not available in this session.",{id:e})},[Me]),qe=(0,i.useCallback)(async function(e,t){var n;let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0,l.ii)(e))return;const s="logout"===e.action||"open_creation_flow"===e.action&&Boolean(e.build_session_id);if("legacy"!==Ee.current&&!r&&s){["semantic","semantic_text_required"].includes(Ee.current)?Ue(`client-action:${e.action_id||e.action}`):Pe(`client-action:${e.action_id||e.action}`),(0,a.Lp)("voice_legacy_mutation_blocked",{conversation_id:M,action:e.action});const n=t||ie.current;if(i&&n&&e.action_id)try{await y(n,e.action_id,{executed:!1,reason:"This action requires the current semantic action flow."})}catch(d){if(!T(d))throw d}return}null===(n=Ne.current)||void 0===n||n.record_legacy_action(e);const o=i||"invalidate_view"!==e.action?await m.current.executeVerified(e):m.current.execute(e);o.executed||Me("action",o.reason,{id:`client-action:${e.action_id||e.action}:failed`});const c=t||ie.current;if(i&&c&&e.action_id)try{await y(c,e.action_id,o)}catch(d){if(!T(d))throw d}},[Me,M,Pe,Ue]),De=(0,i.useCallback)(async function(e,t,n){var i;let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(["semantic","semantic_text_required"].includes(Ee.current)&&!r)return Ue(`${t}:semantic-required`),void(0,a.Lp)("voice_legacy_mutation_blocked",{conversation_id:M,command_id:e.command_id});if("read_only"!==Ee.current){for(const t of e.client_actions||[])await qe(t,n,!1,r);
2null!==(i=e.refresh)&&void 0!==i&&i.length&&m.current.execute({action_id:`refresh:${e.command_id}`,action:"invalidate_view",targets:e.refresh}),Me("action",(e=>{if(!e.success)return"The requested change could not be completed.";if(e.summary)return e.summary;const t=Array.from(new Set((e.affected_entities||[]).map(e=>e.type)));return t.length?`Updated ${t.join(", ").replaceAll("_"," ")}.`:"Change completed."})(e),{id:`${t}:mutation`})}else Pe(`${t}:read-only`)},[Me,M,qe,Pe,Ue]),ze=(0,i.useCallback)(async(e,t)=>{for(const o of[...e].sort((e,t)=>e.sequence-t.sequence)){if(ie.current!==t||re.current)return;const e=`${t}:${o.turn_id}:${o.sequence}`;if(fe.current.has(e))continue;if("interaction.prepare"===o.type&&o.interaction_id){const e=`${t}:${o.interaction_id}`;let r=$e.current.get(e);if(!r){var n,i;if("observe"!==o.purpose&&null!==(n=(i=window).matchMedia)&&void 0!==n&&n.call(i,"(max-width: 1099px)").matches&&(window.dispatchEvent(new Event("aurora:reveal-page")),await new Promise(e=>{const t=window.setTimeout(e,250);window.requestAnimationFrame(()=>window.requestAnimationFrame(()=>{window.clearTimeout(t),e()}))}),ie.current!==t||re.current))return;if("observe"===o.purpose){const e=await Oe(o.goal||"Inspect the current page",5e3);r=e?{observation:e}:{failure_code:"AURORA_PAGE_OBSERVATION_UNAVAILABLE"}}else{let e=null;try{var a;e=await(null===(a=Ne.current)||void 0===a?void 0:a.prepare_turn(o.goal||"Help with the current page"))}catch{}r=e||{failure_code:"AURORA_SEMANTIC_UNAVAILABLE"}}$e.current.set(e,r)}if(ie.current!==t||re.current)return;try{await _(t,o.interaction_id,r),"semantic_session_id"in r&&Re.current.add(`${t}:${r.semantic_session_id}`)}catch(s){if("AURORA_SEMANTIC_CONTEXT_STALE"===N(s))r={failure_code:"AURORA_SEMANTIC_CONTEXT_REJECTED"},$e.current.set(e,r),await _(t,o.interaction_id,r);else if(!T(s))throw s}}var r;if("semantic_event"===o.type&&o.semantic_event)null===(r=Ne.current)||void 0===r||r.handle_stream_event(o.semantic_event);"task.started"===o.type?Me("action",o.goal?`Working on it: ${o.goal}`:"Working on it.",{id:`${e}:task`}):"task.progress"===o.type&&o.summary?Me("action",o.summary,{id:`task-progress:${t}:${o.interaction_id||o.turn_id}`,replace:!0}):"task.completed"===o.type?Me("action",o.summary?`Done: ${o.summary}`:"Task finished.",{id:`${e}:task`}):"task.failed"===o.type?Me("action",o.summary?`Stopped: ${o.summary}`:"The task stopped before finishing. Ask Aurora to continue when you are ready.",{id:`${e}:task`}):"response.failed"===o.type&&Me("action","Aurora\u2019s last reply didn\u2019t complete. You can keep speaking.",{id:`${e}:response`});const l="semantic"===Ee.current&&Boolean(o.semantic_session_id&&Re.current.has(`${t}:${o.semantic_session_id}`));o.client_action&&await qe(o.client_action,t,!0,l),"AURORA_VOICE_SEMANTIC_REQUIRED"===o.failure_code?Ue(`${e}:semantic-required`):"AURORA_VOICE_MUTATION_UNAVAILABLE"===o.failure_code&&Pe(`${e}:read-only`),o.mutation_receipt&&await De(o.mutation_receipt,e,t,l),fe.current.add(e),_e.current=Math.max(_e.current,o.sequence)}},[Me,qe,De,Oe,Pe,Ue]),Be=(0,i.useCallback)(async()=>{await Promise.all(Array.from(Ie.current).map(e=>Promise.resolve(e()).catch(()=>{})))},[]),Fe=(0,i.useCallback)(e=>(Ie.current.add(e),()=>Ie.current.delete(e)),[]),We=(0,i.useCallback)(e=>{n.blocked?Q(n.reason):(P.current!==e||re.current)&&(P.current=e,re.current=!1,se.current=0,Q(null),D.current!==e&&(D.current=e,X([]),ye.current.clear()),be.current={user:"",assistant:""},we.current={user:"",assistant:""},fe.current.clear(),_e.current=0,Ee.current="read_only",Ce.current=E(xe.current),Le("connecting"),U(e))},[n.blocked,n.reason,Le]);(0,i.useEffect)(()=>{var e;if(!M||n.blocked||P.current!==M)return;re.current=!1;let t=null,i=null,r=!0,l=0,c=null,d=null,m=!1,g=new s,_=!0;const y=new w({on:.055,off:.032,attackMs:80,releaseMs:320}),b=new w({on:.025,off:.014,attackMs:40,releaseMs:240}),k=()=>{var e,t;if(!r)return;const n=ce.current&&!re.current,i=n&&!J.current&&_,s=i&&(null===(e=ve.current)||void 0===e?void 0:e.level())||0,o=n&&(null===(t=ge.current)||void 0===t?void 0:t.level())||0,l=Date.now(),c=y.update(s,l,i),d=b.update(o,l,n),u=de.current;de.current={micActive:c,outputActive:d,micLevel:s,outputLevel:o},u.micActive!==c&&(0,a.Lp)(c?"user_audio_started":"user_audio_ended",{conversation_id:M}),u.outputActive!==d&&(0,a.Lp)(d?"assistant_audio_started":"assistant_audio_ended",{conversation_id:M}),u.micActive===c&&u.outputActive===d||Te()};he.current=k;const A=window.setInterval(k,40),j=()=>
2{ce.current=!1,je.current.forEach(e=>e.abort()),y.reset(),b.reset(),k()},C=async e=>{var n,i,a;l+=1,m=!1,j(),t&&window.clearInterval(t),t=null,null===(n=c)||void 0===n||n.stop(),ne.current===c&&(ne.current=null),c=null,null===(i=ve.current)||void 0===i||i.dispose(),null===(a=ge.current)||void 0===a||a.dispose(),ve.current=null,ge.current=null;const s=d;ie.current===s&&(ie.current=null),d=null,r&&B(null),e&&s&&await f(s).catch(()=>{})};q.current=C;const E=()=>{if(r&&!re.current&&null===i){if(j(),se.current>=2)return Q("The voice connection could not recover. Your completed turns are saved."),void Le("error");se.current+=1,Le("reconnecting"),i=window.setTimeout(()=>{i=null,C(!0).then(T)},900)}},T=async()=>{if(re.current||!r)return;const e=++l,n=()=>r&&e===l&&!re.current;g=new s,m=!1,_=!0,j(),me.current={state:"listening",label:S.listening},we.current={user:"",assistant:""},be.current={user:"",assistant:""},_e.current=0,Re.current.clear(),$e.current.clear(),Q(null),Le(se.current?"reconnecting":"connecting"),le.current=performance.now();const y=Oe("Inspect the current page for this voice conversation",800),b=new o({onEvent:e=>n()?(async e=>{if(!r||re.current&&"session.closed"!==e.type)return;const t=String(e.type||"");var n;if("session.started"===t)m=!0,ce.current=!0,Q(null),se.current=0,Le("listening"),null===(n=ne.current)||void 0===n||n.setMicEnabled(!J.current),(0,a.Lp)("voice_session_connected",{conversation_id:M,connection_time_ms:Math.round(performance.now()-le.current)});else if("session.input_transcript.delta"===t||"session.output_transcript.delta"===t){const t=g.append(e);if(!t)return;we.current[t.role]=t.text,X(e=>{const n={id:t.id,who:"user"===t.role?"you":"aurora",text:t.text};if(e.some(e=>e.id===t.id))return e.map(e=>e.id===t.id?n:e);const i=`status:${d}:${t.role}:${be.current[t.role]}`,a=e.find(e=>e.id===i&&(e.text.startsWith(t.text)||t.text.startsWith(e.text)));return a?e.map(e=>e===a?n:e):[...e,n]})}else if("session.delegation.created"===t)Q(null),Le("thinking");else if("response.event"===t){const t=e.event||{};var i;["response.failed","response.incomplete"].includes(t.type)?(Me("action","Aurora\u2019s last reply didn\u2019t complete. You can keep speaking.",{id:`response:${d}:${(null===(i=t.response)||void 0===i?void 0:i.id)||e.event_id||Date.now()}:failed`}),Le("listening")):"response.cancelled"===t.type&&Le("listening")}else if("session.closed"===t)re.current=!0,Le("ended"),await C(!1),U(null),Be();else if("client_action"===t||"aurora.client_action"===t)await qe(e.client_action,d||void 0);else if("mutation_receipt"===t||"aurora.mutation_receipt"===t){const t=e.mutation_receipt;t&&await De(t,`receipt:${t.command_id}`,d||void 0)}else if("error"===t){var s;!0===(null===(s=e.error)||void 0===s?void 0:s.fatal)?(Q("The voice connection was interrupted. Reconnecting\u2026"),E()):ce.current&&Le("listening")}})(e):void 0,onLocalStream:e=>{var t;if(!n())return;null===(t=ve.current)||void 0===t||t.dispose();const i=new x;i.attach(e),ve.current=i},onRemoteStream:e=>{var t;if(!n())return;null===(t=ge.current)||void 0===t||t.dispose();const i=new x;i.attach(e),ge.current=i},onMicrophoneMuted:()=>{n()&&(_=!1,k())},onMicrophoneUnmuted:()=>{var e;n()&&(_=!0,null===(e=ve.current)||void 0===e||e.resume())},onMicrophoneEnded:()=>{n()&&(Q("Your microphone disconnected. Reconnecting\u2026"),E())},onConnectionState:e=>{var t,a;n()&&("failed"===e&&E(),"disconnected"===e&&(j(),Le("reconnecting"),oe.current&&window.clearTimeout(oe.current),oe.current=window.setTimeout(E,1600)),"connected"===e&&(oe.current&&(window.clearTimeout(oe.current),oe.current=null),m&&null===i&&(ce.current=!0,null===(t=ve.current)||void 0===t||t.resume(),null===(a=ge.current)||void 0===a||a.resume(),Le(me.current.state,me.current.label))))}});c=b,ne.current=b,b.setMicEnabled(!J.current);try{await b.start(async e=>{const i=await y;if(!n())return"";let a,r=xe.current,s=i&&$(i,r)?i:null;try{a=await v({conversationId:M,sdp:e,pageContext:r,...s?{observation:s}:{}})}catch(l){if(!s||!["AURORA_OBSERVATION_STALE","AURORA_OBSERVATION_INVA
2LID"].includes(N(l)||""))throw l;if(!n())throw l;r=xe.current,s=null,a=await v({conversationId:M,sdp:e,pageContext:r})}if(!n())return await f(a.session_id).catch(()=>{}),a.sdp;ie.current=a.session_id,d=a.session_id,Ee.current=a.mutation_mode||"read_only",B(a.session_id),ke.current=I(r),Ae.current=s?R(s):"";let o=!1;return t=window.setInterval(()=>{const e=a.session_id;n()&&!o&&(o=!0,async function(e,t){return h(await u.default.get(p(`/sessions/${encodeURIComponent(e)}`),Number.isFinite(t)?{params:{after_sequence:t}}:void 0))}(e,_e.current).then(async t=>{var i;if(n()){if(Ee.current=t.mutation_mode||Ee.current,ce.current&&["tool_running","listening","thinking"].includes(t.state)&&Le(t.state,t.status_label),t.user_transcript){const n=t.user_transcript.trim(),i=t.user_turn_id||n;n&&!we.current.user&&(be.current.user=i,Me("you",n,{id:`status:${e}:user:${i}`,replace:!0}))}if(t.assistant_transcript){const n=t.assistant_transcript.trim(),i=t.assistant_turn_id||n;!n||de.current.outputActive||we.current.assistant||(be.current.assistant=i,Me("aurora",n,{id:`status:${e}:assistant:${i}`,replace:!0}))}null!==(i=t.events)&&void 0!==i&&i.length&&await ze(t.events,e),n()&&("number"===typeof t.canonical_sequence&&(_e.current=Math.max(_e.current,t.canonical_sequence)),"AURORA_ACCESS_CHANGED"===t.error_code?(Q("Your access to Aurora changed. Return to text chat to continue."),Le("error"),re.current=!0,await C(!0)):"AURORA_VOICE_CONNECTION_FAILED"===t.error_code?(Q("Aurora\u2019s connection was interrupted. Reconnecting\u2026"),E()):"AURORA_VOICE_TOOL_FAILED"===t.error_code?(Me("action","Aurora could not finish that task. You can keep speaking and try again.",{id:`status-error:${e}:${t.error_code}`}),ce.current&&Le("listening")):t.error_code?ce.current&&Le("listening"):"error"!==t.state&&m&&Q(null))}}).catch(()=>{}).finally(()=>{o=!1}))},900),a.sdp})}catch(w){if(!n())return;C(!0);const e=w,t="NotAllowedError"===(null===e||void 0===e?void 0:e.name)||/permission|denied/i.test((null===e||void 0===e?void 0:e.message)||""),i=["NotFoundError","DevicesNotFoundError"].includes((null===e||void 0===e?void 0:e.name)||""),r=["NotReadableError","TrackStartError"].includes((null===e||void 0===e?void 0:e.name)||"");Q(t?"Microphone access is blocked. Allow it in your browser, or return to text chat.":i?"No microphone is available. Connect one, or continue in text chat.":r?"Your microphone is in use by another app. Close it there, then try again.":"Voice isn\u2019t available right now. You can continue by typing."),Le("error"),(0,a.Lp)("voice_session_failed",{conversation_id:M,error_class:(null===e||void 0===e?void 0:e.name)||"Error"})}},L=()=>{var e,t,n;"visible"===document.visibilityState&&(null===(t=ve.current)||void 0===t||t.resume(),null===(n=ge.current)||void 0===n||n.resume());"visible"===document.visibilityState&&["failed","disconnected","closed"].includes((null===(e=ne.current)||void 0===e?void 0:e.connectionState)||"")&&E()},O=navigator.mediaDevices,D=()=>{var e,t;null===(e=ve.current)||void 0===e||e.resume(),null===(t=ge.current)||void 0===t||t.resume()};return document.addEventListener("visibilitychange",L),document.addEventListener("pointerdown",D,{passive:!0}),null===O||void 0===O||null===(e=O.addEventListener)||void 0===e||e.call(O,"devicechange",L),(0,a.Lp)("voice_mode_started",{conversation_id:M}),T(),()=>{var e;r=!1,re.current=!0,ce.current=!1,de.current={micActive:!1,outputActive:!1,micLevel:0,outputLevel:0},he.current===k&&(he.current=null),window.clearInterval(A),t&&window.clearInterval(t),i&&window.clearTimeout(i),oe.current&&window.clearTimeout(oe.current),document.removeEventListener("visibilitychange",L),document.removeEventListener("pointerdown",D),null===O||void 0===O||null===(e=O.removeEventListener)||void 0===e||e.call(O,"devicechange",L),q.current===C&&(q.current=null),C(!0),Be()}},[n.blocked,Me,M,qe,ze,De,Be,Oe,Te,ee,Le]);const He=null===L||void 0===L?void 0:L.subscribe_page_changes;(0,i.useEffect)(()=>{if(!z||!M)return;let e=!0,t=null,n=!1,i=!1;const a=()=>{i=!0,null===t&&!n&&e&&(t=window.setTimeout(()=>{t=null,r()},250))},r=async()=>
2{if(e&&!re.current&&ie.current===z){i=!1,n=!0;try{const t=await Oe("Refresh the current visible page for the voice conversation");if(!e||re.current||ie.current!==z)return;const n=xe.current,i=t&&$(t,n)?t:null,a=I(n),r=i?R(i):"";if(a===ke.current&&(!r||r===Ae.current))return;if(i?await g(z,n,i):await g(z,n),!e)return;ke.current=a,Ae.current=r}catch{}finally{n=!1,i&&e&&a()}}};Se.current=a;const s=null===He||void 0===He?void 0:He(a);return a(),()=>{e=!1,null!==t&&window.clearTimeout(t),Se.current===a&&(Se.current=null),null===s||void 0===s||s()}},[M,Oe,z,He]);const Ve=I(O);(0,i.useEffect)(()=>{var e;null===(e=Se.current)||void 0===e||e.call(Se)},[Ve]);const Ye=(0,i.useCallback)(async()=>{var e;const t=P.current;var n;(P.current=null,re.current=!0,je.current.forEach(e=>e.abort()),ce.current=!1,null===(e=he.current)||void 0===e||e.call(he),Le("ended"),U(null),B(null),q.current)?await q.current(!0):(null===(n=ne.current)||void 0===n||n.stop(),ne.current=null);t&&((0,a.Lp)("voice_session_ended",{conversation_id:t}),await Be())},[Be,Le]);(0,i.useEffect)(()=>{const e=()=>{Ye()};return window.addEventListener(A.Yn,e),()=>window.removeEventListener(A.Yn,e)},[Ye]),(0,i.useEffect)(()=>{n.blocked&&M&&Ye()},[n.blocked,M,Ye]),(0,i.useEffect)(()=>{const e=e=>{const t=e.detail;null!==t&&void 0!==t&&t.active&&"protected"===t.assistancePolicy&&Ye()};return window.addEventListener(b.rj,e),()=>window.removeEventListener(b.rj,e)},[Ye]),(0,i.useEffect)(()=>{M&&null!==Ce.current&&Ce.current!==E(O)&&Ye()},[M,Ye,O]);const Ge=(0,i.useCallback)(()=>{se.current=0,re.current=!1,Q(null),te(e=>e+1)},[]),Je=(0,i.useCallback)(e=>{var t,n;J.current=e,G(e),null===(t=ne.current)||void 0===t||t.setMicEnabled(!e),null===(n=he.current)||void 0===n||n.call(he)},[]),Ke=(0,i.useCallback)(()=>{var e;null===(e=ne.current)||void 0===e||e.cancelResponse(),Le("interrupted")},[Le]),Xe=(0,i.useMemo)(()=>({conversationId:M,realtimeSessionId:z,pageContext:O,voiceState:F,statusLabel:H,muted:Y,captions:K,error:Z,micAnalyser:ve,outputAnalyser:ge,audioActivityRef:de,start:We,finish:Ye,retry:Ge,setMuted:Je,cancelResponse:Ke,registerConversationChanged:Fe}),[Ke,K,M,Z,Ye,Y,O,z,Fe,Ge,Je,We,H,F]);return(0,j.jsx)(C.Provider,{value:Xe,children:t})},O=()=>{const e=(0,i.useContext)(C);if(!e)throw new Error("useAuroraVoiceSession must be used inside AuroraVoiceSessionProvider");return e}},27532(e,t,n){const i="edumark:aurora-media-stop";let a=0;n.d(t,["Pr",0,()=>a,"Yn",0,i,"nq",0,()=>{a+=1,"undefined"!==typeof window&&window.dispatchEvent(new Event(i))}])},1792(e,t,n){const i={profile:"/settings/profile",appearance:"/settings/appearance",accessibility:"/settings/accessibility",notifications:"/settings/notifications",account:"/settings/security",security:"/settings/security",workspace:"/settings/workspace/general",general:"/settings/workspace/general",feedback:"/settings/workspace/assessment",assessment:"/settings/workspace/assessment",communications:"/settings/workspace/communications",policy:"/settings/workspace/communications/policy",integrations:"/settings/workspace/communications/integrations",delivery:"/settings/workspace/communications/delivery",operations:"/settings/workspace/communications/delivery",billing:"/settings/workspace/billing",data:"/settings/workspace/data",danger:"/settings/workspace/data",tours:"/settings/tours"},a={"/settings/personal/appearance":"/settings/appearance","/settings/personal/accessibility":"/settings/accessibility","/settings/account":"/settings/security","/settings/billing":"/settings/workspace/billing","/settings/usage":"/settings/workspace/billing"};n.d(t,["s",0,e=>{const[t]=e.split(/[?#]/);if("/settings"===t){var n;const t=(null===(n=e.split("?")[1])||void 0===n?void 0:n.split("#")[0])||"",a=new URLSearchParams(t);return i[a.get("section")||a.get("tab")||""]||"/settings/profile"}return a[t]||e}])},4912(e,t,n){n.d(t,{KF:()=>v});var i=n(33006),a=n(93949),r=n(87140),s=n(18537),o=n(3374);const l=(0,i.createContext)(null);function c(e){if(!e)return null;try{const t=decodeURIComponent(e).trim(),n=Array.from(t).some(e=>[0,10,13].includes(e.charCodeAt(0)));return t&&t.length<=200&&!n?t:null}catch{return null}}const d=new Set(["status","stage","tab","view","role","cohort","cohort_id","course","course_id","sort","q","search","type","page","start","setup","upload","new","learner","conversation"]);const u=function(e,t){return{context_version:2,route:e,page_kind:t,surface:arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,entity:null,selection:null,focused_element:null,...arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}}},m={profile:"Profile settings",appearance:"Appearance settings",notifications:"Notification settings",security:"Account security settings","workspace/general":"Workspace settings","workspace/assessment":"Workspace assessment defaults","workspace/communications":"Workspace communication settings","workspace/billing":"Workspace billing settings","workspace/data":"Workspace data settings"};function p(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0;
2const a=e.split("/").filter(Boolean),r=(null===(t=a[0])||void 0===t?void 0:t.toLowerCase())||"",s=c(a[1]),o=function(e){return(e.startsWith("/")&&!e.startsWith("//")?e:"/").slice(0,500)}(e),l=function(e){var t,n,i;const a=new URLSearchParams(e),r={};a.forEach((e,t)=>{if(!d.has(t))return;const n=(e=>{const t=e.trim();return t&&t.length<=200?t:null})(e);if(!n)return;const i=r[t];r[t]=i?Array.isArray(i)?[...i,n]:[i,n]:n});const s=null!==(t=null!==(n=r.tab)&&void 0!==n?n:r.status)&&void 0!==t?t:r.view,o=null!==(i=r.q)&&void 0!==i?i:r.search,l=r.sort;return Object.keys(r).length>0?{..."string"===typeof s?{tab:s}:{},..."string"===typeof o?{search:o}:{},..."string"===typeof l?{sort:l}:{},filters:r}:void 0}(n),p={...i?{workspace:i}:{},...l?{view:l}:{}};if(!r||"dashboard"===r)return u(o,"dashboard","dashboard",p);if("practice"===r)return u(o,"practice","practice",{...p,...s&&!["new","shared"].includes(s)?{entity:{entity_type:"practice_session",entity_id:s}}:{}});if("courses"===r){if("live"===a[2]&&s){const e=c(a[3]);return u(o,e?"live_session":"live_sessions",e?"live_session":"live_sessions",{...p,entity:e?{entity_type:"live_session",entity_id:e}:{entity_type:"course",entity_id:s},view:{...l,filters:{...null===l||void 0===l?void 0:l.filters,course_id:s}}})}if("new"===a[1]){const e=c(a[2]);return u(o,"course_intake","course_authoring",{...p,...e?{intake_session_id:e}:{}})}if("create"===a[1]&&"aurora"===a[2])return u(o,"course_creation","course_creation",p);if("imports"===a[1]){const e=c(a[2]);return u(o,"course_import","course_import",{...p,...e?{entity:{entity_type:"import_job",entity_id:e}}:{}})}return s?u(o,"course","course",{...p,entity:{entity_type:"course",entity_id:s}}):u(o,"courses","courses",p)}if("assignmentdetails"===r&&s)return u(o,"assignment","assignment",{...p,entity:{entity_type:"assignment",entity_id:s}});if("assignments"===r){const e="drafts"===a[1]?c(a[2]):null,t="builder"===a[2]?s:null,n=["edit","preview","responses"].includes(a[2]||"")?s:null,i=s&&"new"!==a[1]?s:null,r=e||t||n||i;return r?u(o,"assignment","assignment",{...p,...e||n?{label:"marking-quality"===(null===l||void 0===l?void 0:l.tab)?"Assignment authoring \u2014 Marking & quality":"Assignment authoring"}:{},entity:{entity_type:r.startsWith("acd_")?"assessment_draft":"assignment",entity_id:r}}):u(o,"assignments","assignments",p)}if("learner-assignments"===r)return u(o,"assignments","assignments",p);if("learners"===r&&"communication"===a[2]&&s)return u(o,"communication_inbox","communication_inbox",{...p,entity:{entity_type:"learner",entity_id:s}});if("communications"===r){var h;const e=(null===(h=a[1])||void 0===h?void 0:h.toLowerCase())||"inbox",t=c(a[2]);return"live"===e?u(o,t?"live_session":"live_sessions",t?"live_session":"live_sessions",{...p,...t?{entity:{entity_type:"live_session",entity_id:t}}:{}}):"conversations"===e?u(o,"communication_inbox","communication_inbox",{...p,...t?{entity:{entity_type:"conversation",entity_id:t}}:{}}):"announcements"===e?u(o,"communications","communications",{...p,label:"Announcements",...t?{entity:{entity_type:"announcement",entity_id:t}}:{}}):"settings"===e?u(o,"communications","communications",{...p,label:"Communication settings"}):u(o,"inbox"===e?"communication_inbox":"communications","inbox"===e?"communication_inbox":"communications",p)}if("marking"===r){const e="cases"===a[1]?c(a[2]):null;return u(o,"marking","marking",{...p,...e?{entity:{entity_type:"marking_case",entity_id:e}}:{}})}if("results"===r)return u(o,"submission","submission",{...p,label:"Results"});if("people"===r||"users"===r||"cohorts"===r){const e="cohorts"===r?"cohorts":s||"all";return u(o,"cohorts"===e?"cohorts":"people","cohorts"===e?"cohorts":"people",{...p,view:{...l,tab:e}})}if("analytics"===r)return u(o,"analytics","analytics",p);if("quality"===r)return u(o,"quality","quality",p);if("settings"===r){const e=a.slice(1).join("/");return u(o,"settings","settings",{...p,label:m[e]||"Settings",view:{...l,filters:{...null===l||void 0===l?void 0:l.filters,settings_section:e.slice(0,200)||"profile"}}})}if("organisation"===r||"tenant-administration"===r)return u(o,"administration","administration",p);if("migration"===r)return u(o,"migrations","migrations",p);if("data-imports"===r)return u(o,"imports","imports",p);if("integrations"===r)return u(o,"integrations","integrations",p);if("file-security"===r||"security"===r)return u(o,"security","security",p);if("audit"===r)return u(o,"audit","audit",p);if("support"===r)return u(o,"support","support",p);if("tutorials"===r)return u(o,"support","support",{...p,label:"Help and tutorials"});if("aurora"===r)return u(o,"aurora","aurora",p);if("plagiarism"===r&&"scans"===a[1]&&a[2]){const e=c(a[2]);return u(o,"submission","submission",{...p,...e?{entity:{entity_type:"plagiarism_report",entity_id:e}}:{}})}return"plagiarism"===r?u(o,"security","security",{...p,label:"Plagiarism checks"}):"bulk"===r?u(o,"marking","marking",p):u(o,"other","other",p)}const h={dashboard:"Home",courses:"Courses",course:"Course",course_studio:"Course Studio",course_authoring:"Course authoring",course_intake:"Course authoring",course_creation:"Course creation",course_import:"Course import",assignments:"Assignments",practice:"Practice",assignment:"Assignment",submission:"Submission",marking:"Marking",people:"People",cohorts:"Cohorts",migrations:"Migrations",integrations:"Integrations",administration:"Administration",notifications:"Notifications",imports:"Imports",security:"Security",audit:"Audit",support:"Support",aurora:"Aurora",analytics:"Analytics",quality:"Quality",settings:"Settings",communications:"Communications",communication_inbox:"Inbox",live_sessions:"Live sessions",live_session:"Live session",other:"Workspace"};function v(){const e=(0,i.useContext)(l);if(!e)throw new Error("useAuroraPageContext must be used inside AuroraPageContextProvider");return e}n.d(t,["u9",0,e=>e.label||h[e.surface||e.page_kind]||"Workspace","um",0,e=>{let{children:t}=e;const{pathname:n,search:c}=(0,a.zy)(),d=(0,r.Ok)(),u=`${n}${c}`,m=(0,i.useMemo)(()=>({organisation_id:(null===d||void 0===d?void 0:d.id)||null,centre_id:(0,s.yk)()}),[null===d||void 0===d?void 0:d.id]),h=(0,i.useMemo)(()=>p(n,c,m),[n,c,m]),v=`${m.organisation_id||""}:${m.centre_id||""}`,g=`${v}:${u}`,f=(0,i.useRef)(v);f.current=v;const _=(0,i.useRef)(null),y=(0,i.useCallback)(e=>{const t={key:g,clear:e};return _.current=t,()=>{_.current===t&&(_.current=null)}},[g]),b=(0,i.useCallback)(()=>{var e;(null===(e=_.current)||void 0===e?void 0:e.key)===g&&_.current.clear()},[g]),[w,x]=(0,i.useState)(null),k=(0,i.useRef)(null),A=(0,i.useCallback)(e=>{x(e?{routeKey:g,value:e}:null)},[g]),j=(0,i.useMemo)(()=>(null===w||void 0===w?void 0:w.routeKey)===g?{...h,...w.value,workspace:{...h.workspace,...w.value.workspace},view:{...h.view,...w.value.view}}:h,[h,w,g]),S=(0,i.useCallback)(e=>{if(!e)return k.current=null,()=>{};const t={routeKey:g,value:e};return k.current=t,()=>{k.current===t&&(k.current=null)}},[g]),C=(0,i.useCallback)(async function(){var e,t,n,i;let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;if(!a)return null;const r=JSON.parse(JSON.stringify(a));if((null===(e=r.workspace)||void 0===e?void 0:e.organisation_id)!==(null===(t=j.workspace)||void 0===t?void 0:t.organisation_id)||(null===(n=r.workspace)||void 0===n?void 0:n.centre_id)!==(null===(i=j.workspace)||void 0===i?void 0:i.centre_id))return null;const s=f.current,o=k.current,l=o&&o.routeKey===g&&r.route===j.route?await o.value(r):r;return f.current===s?l:null},[j,g]),I=(0,i.useMemo)(()=>({context:j,setContextOverride:A,setContextPreparer:S,prepareContext:C,clearSelection:b,setSelectionClearer:y}),[j,C,A,S,b,y]);return(0,o.jsx)(l.Provider,{value:I,children:t})}])},66390(e,t,n){const i=e=>{const t=null===e||void 0===e?void 0:e.trim();return t||null},a=e=>{const t=i(null===e||void 0===e?void 0:e.entity_id);return e&&t?{entity_type:e.entity_type,entity_id:t}:null},r=e=>Number.isInteger(e)&&Number(e)>=1?Number(e):null;n.d(t,["a",0,e=>{var t;const n=(null===(t=e.label)||void 0===t?void 0:t.trim().slice(0,160))||null,s=a(e.entity),o=(e=>{if(!e)return null;const t=(e.entities||[]).map(a).filter(e=>null!==e).slice(0,50);return{...t.length?{entities:t}:{},module_id:i(e.module_id),activity_id:i(e.activity_id),block_id:i(e.block_id)}})(e.selection),l=a(e.focused_element),c=i(e.course_version_id),d=i(e.intake_session_id),u=r(e.graph_revision),m=r(e.assessment_revision),p=r(e.blueprint_revision);return{context_version:2,route:e.route.slice(0,500),page_kind:e.page_kind,...e.surface?{surface:e.surface}:{},...n?{label:n}:{},...e.workspace?{workspace:(v=e.workspace,{organisation_id:i(v.organisation_id),centre_id:i(v.centre_id)})}:{},...e.view?{view:(h=e.view,{...null===h.tab?{tab:null}:i(h.tab)?{tab:i(h.tab)}:{},...null===h.search?{search:null}:void 0!==h.search?{search:h.search.trim().slice(0,200)}:{},...null===h.sort?{sort:null}:i(h.sort)?{sort:i(h.sort)}:{},...h.filters?{filters:h.filters}:{}})}:{},...s?{entity:s}:{},...o?{selection:o}:{},...l?{focused_element:l}:{},...c?{course_version_id:c}:{},...u?{graph_revision:u}:{},...m?{assessment_revision:m}:{},...d?{intake_session_id:d}:{},...p?{blueprint_revision:p}:{}};var h,v}])},77104(e,t,n){const i="edumark:aurora-prompt",a="edumark:aurora-open",r=e=>window.dispatchEvent(new CustomEvent(i,{cancelable:!0,detail:e}))&&e.accepted||Promise.resolve(!1),s=function(e,t,n){return r({prompt:e,pageContext:t,onComplete:n,...arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}})};n.d(t,["Dm",0,s,"OM",0,"aurora:reveal-page","VW",0,a,"v0",0,i,"ws",0,()=>{window.dispatchEvent(new Event(a))},"xN",0,(e,t,n)=>s(e,t,n,{semanticRequired:!0})])},1401(e,t,n){var i=n(33006),a=n(71119),r=n(80687),s=n(77538),o=n(19976),l=n(81273),c=n(98158),d=n(71480
2),u=n(3374);const m=e=>{let{snapshot:t,exclusions:n,events:a,on_refresh_snapshot:o,reduced_motion:c,on_force_reduced_motion:d,on_simulate:m}=e;const[p,h]=(0,i.useState)(!1),[v,g]=(0,i.useState)(!1),[f,_]=(0,i.useState)("focus"),y=(0,i.useMemo)(()=>t?{...t,elements:t.elements.map(e=>({...e,...void 0!==e.value?{value:"[redacted in inspector]"}:{},...e.state.value_hash?{state:{...e.state,value_hash:e.state.value_hash}}:{}}))}:null,[t]);return(0,u.jsxs)("div",{"data-aurora-overlay":"true",children:[v&&(null===t||void 0===t?void 0:t.elements.map(e=>e.geometry&&(0,u.jsx)("span",{className:l.A.debugHalo,style:{left:e.geometry.x,top:e.geometry.y,width:e.geometry.width,height:e.geometry.height},"aria-hidden":"true"},e.element_id))),p&&(0,u.jsxs)("section",{className:l.A.inspector,"aria-label":"Aurora semantic inspector",children:[(0,u.jsxs)("div",{className:l.A.inspectorHeader,children:[(0,u.jsx)("strong",{children:"Aurora semantic inspector"}),(0,u.jsx)("button",{className:l.A.inspectorButton,type:"button",onClick:()=>h(!1),"aria-label":"Close semantic inspector",children:(0,u.jsx)(r.A,{size:14})})]}),(0,u.jsxs)("div",{className:l.A.actions,children:[(0,u.jsx)("button",{className:l.A.inspectorButton,type:"button",onClick:o,children:"Refresh snapshot"}),(0,u.jsx)("button",{className:l.A.inspectorButton,type:"button","aria-pressed":v,onClick:()=>g(e=>!e),children:"Element overlays"}),(0,u.jsx)("button",{className:l.A.inspectorButton,type:"button","aria-pressed":c,onClick:()=>d(!c),children:"Force reduced motion"}),(0,u.jsxs)("label",{className:l.A.simulationLabel,children:["Dry-run action",(0,u.jsx)("select",{value:f,onChange:e=>_(e.target.value),children:s.UZ.map(e=>(0,u.jsx)("option",{value:e,children:e},e))})]}),(0,u.jsx)("button",{className:l.A.inspectorButton,type:"button",onClick:()=>m(f),children:"Simulate visuals"})]}),(0,u.jsxs)("details",{open:!0,children:[(0,u.jsx)("summary",{children:"Scoped snapshot"}),(0,u.jsx)("pre",{children:JSON.stringify(y,null,2)})]}),(0,u.jsxs)("details",{children:[(0,u.jsxs)("summary",{children:["Excluded elements (",n.length,")"]}),(0,u.jsx)("pre",{children:JSON.stringify(n,null,2)})]}),(0,u.jsxs)("details",{children:[(0,u.jsxs)("summary",{children:["Lifecycle events (",a.length,")"]}),(0,u.jsx)("pre",{children:JSON.stringify(a,null,2)})]}
2),(0,u.jsx)("p",{children:"Dry runs update only local visuals; they never forge an envelope, dispatch an event, or mutate page state."})]}),!p&&(0,u.jsx)("button",{className:`${l.A.inspectorButton} ${l.A.inspectorToggle}`,type:"button",onClick:()=>h(!0),children:"Aurora inspector"})]})},p=e=>h(e),h=e=>{var t;const n=e.confirmation,i=null===(t=n.decision.constraints)||void 0===t?void 0:t.confirmation_summary,a=i&&"object"===typeof i&&!Array.isArray(i)?i:{},r=n.action,s="string"===typeof a.target?a.target:n.target_name,o=s&&!["menuitem","button","link"].includes(s)?s:"Selected control";return{target:"domain_command"===r.action_type?`${(r.parameters.command_name||"Update").replace(/^(communications|course)_/,"").replace(/_/g," ").replace(/^./,e=>e.toUpperCase())} \xb7 ${o}`:o,consequence:"string"===typeof a.consequence?a.consequence:n.decision.user_message,scope:"string"===typeof a.scope?a.scope:void 0,undoability:"string"===typeof a.undoability?a.undoability:void 0,affected_count:"number"===typeof a.affected_count?a.affected_count:void 0}},v=e=>{if("undefined"===typeof document)return null;const{activity:t}=e,n=t.target_geometry,i=e.visible,r=(0,o.bn)(t),s=r?f(t,r):null,h=g(t.status_label,56);return(0,u.jsxs)(u.Fragment,{children:[(0,a.createPortal)((0,u.jsxs)("div",{className:`${l.A.root}${e.reduced_motion?` ${l.A.forceReduced}`:""}`,"data-aurora-overlay":"true","data-lifecycle":t.lifecycle,children:[i&&!1!==e.highlights_visible&&n&&(0,o.Sk)(t)&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:l.A.halo,"data-presence":"halo","data-state":t.lifecycle,style:{left:n.x-4,top:n.y-4,width:n.width+8,height:n.height+8},"aria-hidden":"true"}),"executing"===t.lifecycle&&"click"===t.action_type&&(0,u.jsx)("span",{className:l.A.ripple,style:{left:n.x+n.width/2,top:n.y+n.height/2},"aria-hidden":"true"}),t.preview_text&&(0,u.jsxs)("span",{className:l.A.anchoredPreview,style:{left:Math.max(8,n.x+8),top:Math.max(8,n.y+Math.min(n.height-8,28)),maxWidth:Math.max(120,Math.min(520,n.width-16))},"aria-hidden":"true",children:[(0,u.jsx)("span",{children:t.preview_text}),(0,u.jsx)("i",{className:l.A.previewCaret})]})]}),i&&!1!==e.highlights_visible&&r&&s&&(0,u.jsxs)("span",{className:`${l.A.cursor} ${l.A.pointer}`,"data-presence":"pointer","data-mode":r,style:{left:s.left,top:s.top},"aria-hidden":"true",children:[(0,u.jsx)("svg",{className:l.A.pointerArrow,viewBox:"0 0 24 24",width:"22",height:"22",focusable:"false",children:(0,u.jsx)("path",{d:"M5 3l14 8.6-6.3 1.5L9.4 21 5 3z"})}),(0,u.jsxs)("span",{className:l.A.pointerLabel,children:[(0,u.jsx)("span",{className:l.A.pointerName,children:"Aurora"}),h&&(0,u.jsx)("span",{className:l.A.pointerStatus,children:h}),"acting"!==r&&(0,u.jsxs)("span",{className:l.A.pointerDots,children:[(0,u.jsx)("i",{}),(0,u.jsx)("i",{}),(0,u.jsx)("i",{})]})]})]}),(0,u.jsx)("div",{className:l.A.liveRegion,role:"status","aria-live":"polite","aria-atomic":"true",children:t.announcement}),e.inspector_enabled&&(0,u.jsx)(m,{snapshot:e.snapshot,exclusions:e.exclusions,events:e.events,on_refresh_snapshot:e.on_refresh_snapshot,reduced_motion:e.reduced_motion,on_force_reduced_motion:e.on_force_reduced_motion,on_simulate:e.on_simulate})]}),document.body),e.visible&&t.confirmation&&(0,a.createPortal)((0,u.jsx)("div",{className:d.A.floating,"data-aurora-overlay":"true",children:(0,u.jsx)(c.A,{summary:p(t),onDecision:e.on_confirm},t.confirmation.decision.decision_id)}),document.body)]})},g=(e,t)=>{const n=String(e||"").replace(/\s+/g," ").trim();return n?n.length>t?`${n.slice(0,t-1)}\u2026`:n:""},f=(e,t)=>{var n;const i="acting"===t||"waiting"===t?e.target_geometry||e.last_target_geometry:e.last_target_geometry||e.target_geometry;if(i)return{left:Math.max(8,i.x),top:Math.max(28,i.y-8)};const a=null===(n=document.querySelector('[data-motion-surface="route"]'))||void 0===n?void 0:n.getBoundingClientRect(),r=document.documentElement.hasAttribute("data-aurora-docked"),s=window.innerWidth||1024,o=Math.max(24,s-(r?460:96)),l=a&&a.width>0?a.left+.5*a.width:.45*s,c=a&&a.height>0?a.top+96:128;return{left:Math.min(Math.max(24,l),o),top:Math.max(48,c)}};n.d(t,["Ay",0,v,"Z0",0,(e,t)=>{const n=t?(0,o.bn)(t):null;return"waiting"===n?"waiting":"acting"===n?"acting":e||"thinking"===n?"thinking":null},"wG",0,e=>{let{mode:t}=e;return t?(0,u.jsx)("span",{className:l.A.aura,"data-aurora-aura":t,"aria-hidden":"true"}):null}])},44330(e,t,n){n.d(t,{Wz:()=>He,sv:()=>Ue,yI:()=>Me});var i=n(50244),a=n(33006),r=n(93949),s=n(40939),o=n(43597),l=n(77538),c=n(55433);const d=1e3,u=new Set(["button","checkbox","combobox","gridcell","link","listbox","menuitem","option","radio","searchbox","slider","spinbutton","switch","tab","textbox","treeitem"]),m=new Set(["banner","complementary","contentinfo","dialog","document","form","main","navigation","region","search"]),p=new Set([...Array.from(u),...Array.from(m),"alert","cell","columnheader","grid","heading","list","listitem","log","progressbar","row","rowgroup","status","table","tabpanel"]),h=/\b(delete|publish|submit|send|f
2inali[sz]e|release|remove|archive|permission|grade|mark all|bulk)\b/i,v=/(?:password|passwd|secret|token|api[-_ ]?key|authorization|one[-_ ]?time[-_ ]?code|otp|webauthn|credit[-_ ]?card|card[-_ ]?(?:number|expiry|expiration|security)|cvv|cvc|card[-_ ]?pin|payment[-_ ]?pin)/i,g=new Set(["current-password","new-password","one-time-code","webauthn","cc-number","cc-csc","cc-exp","cc-exp-month","cc-exp-year"]),f=(e,t)=>Boolean(t.read_behind_aurora&&"true"===e.getAttribute("data-aurora-inert-owner")&&document.querySelector('[data-testid="aurora-panel"][aria-modal="true"], [data-aurora-overlay][aria-modal="true"]')),_=new Set(["assessed_activity","assessment_protected"]),y=(e,t)=>{const n=String(null!==e&&void 0!==e?e:"").replace(/\s+/g," ").trim();if(n)return n.length>t?`${n.slice(0,t-1)}\u2026`:n},b=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36).padStart(7,"0")},w=e=>{const t=(e=>{var t,n;const i=null!==(t=null===(n=y(e.getAttribute("role"),80))||void 0===n?void 0:n.toLowerCase())&&void 0!==t?t:null;return"alertdialog"===i?"dialog":i&&p.has(i)?i:null})(e);if(t)return t;const n=e.tagName.toLowerCase();if("body"===n)return"document";if("button"===n||"summary"===n)return"button";if("a"===n&&e.hasAttribute("href"))return"link";if("textarea"===n)return"textbox";if("select"===n)return e.multiple?"listbox":"combobox";if("option"===n)return"option";if("table"===n)return"table";if("tr"===n)return"row";if("th"===n)return"columnheader";if("td"===n)return"cell";if("dialog"===n)return"dialog";if(/^h[1-6]$/.test(n))return"heading";if("main"===n)return"main";if("nav"===n)return"navigation";if("form"===n)return"form";if("input"===n){const t=e.type.toLowerCase();return"checkbox"===t?"checkbox":"radio"===t?"radio":"button"===t||"submit"===t||"reset"===t?"button":"range"===t?"slider":"number"===t?"spinbutton":"search"===t?"searchbox":"textbox"}return e.isContentEditable?"textbox":"section"===n||e.hasAttribute("data-aurora-snapshot-root")||e.hasAttribute("data-workspace")?"region":"generic"},x=e=>{if("true"===e.getAttribute("data-aurora-sensitive"))return!0;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return!1;if(e instanceof HTMLInputElement&&["hidden","password"].includes(e.type.toLowerCase()))return!0;if((e.getAttribute("autocomplete")||"").toLowerCase().split(/\s+/).some(e=>g.has(e)))return!0;const t=[e.getAttribute("name"),e.id,e.getAttribute("aria-label"),e.getAttribute("data-aurora-name")].filter(Boolean).join(" ");return v.test(t)},k=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(["script","style","noscript","template","iframe"].includes(e.tagName.toLowerCase())||"prohibited"===e.getAttribute("data-aurora-risk"))return!0;if(e.hasAttribute("hidden")||"true"===e.getAttribute("aria-hidden")||(e.hasAttribute("inert")||e.inert)&&!f(e,t)||"true"===e.getAttribute("data-aurora-ignore")||e.hasAttribute("data-aurora-overlay")||x(e))return!0;const n="undefined"===typeof window?null:window.getComputedStyle(e);return"none"===(null===n||void 0===n?void 0:n.display)||"hidden"===(null===n||void 0===n?void 0:n.visibility)||"collapse"===(null===n||void 0===n?void 0:n.visibility)||"0"===(null===n||void 0===n?void 0:n.opacity)||"rect(0px, 0px, 0px, 0px)"===(null===n||void 0===n?void 0:n.clip)||"inset(100%)"===(null===n||void 0===n?void 0:n.clipPath)},A=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(k(e,n))return;const i="undefined"===typeof NodeFilter?{SHOW_TEXT:4,FILTER_ACCEPT:1,FILTER_REJECT:2}:NodeFilter,a=document.createTreeWalker(e,i.SHOW_TEXT,{acceptNode:t=>{let a=t.parentElement;for(;a&&a!==e;){if(k(a,n))return i.FILTER_REJECT;a=a.parentElement}return i.FILTER_ACCEPT}}),r=[];let s=0;for(;s<2*t;){const e=a.nextNode();if(!e)break;const t=e.textContent||"";r.push(t),s+=t.length}return y(r.join(" "),t)},j=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e5;if(k(e))return;const n="undefined"===typeof NodeFilter?{SHOW_TEXT:4,FILTER_ACCEPT:1,FILTER_REJECT:2}:NodeFilter,i=document.createTreeWalker(e,n.SHOW_TEXT,{acceptNode:t=>{let i=t.parentElement;for(;i&&i!==e;){if(k(i))return n.FILTER_REJECT;i=i.parentElement}return n.FILTER_ACCEPT}});let a="";for(;a.length<t;){const e=i.nextNode();if(!e)break;a+=e.textContent||""}return a.slice(0,t)},S=(e,t)=>
2{const n=(e.getAttribute(t)||"").split(/\s+/).filter(Boolean).slice(0,10);return y(n.map(e=>{const t=document.getElementById(e);return t&&A(t,d)||""}).join(" "),d)},C=e=>{const t=y(e.getAttribute("data-aurora-name"),500);if(t)return t;const n=y(e.getAttribute("aria-label"),500);if(n)return n;const i=S(e,"aria-labelledby");if(i)return i;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){const t=Array.from(e.labels||[]).map(e=>A(e,500)||"").join(" "),n=y(t,500);if(n)return n}const a=y(e.getAttribute("alt"),500);if(a)return a;const r=w(e);if("document"===r)return y(document.title,500)||"Current page";if(["button","link","option","heading","menuitem","tab","treeitem","checkbox","radio","switch"].includes(r)||m.has(r)){const t=A(e,500);if(t)return t}const s=y(e.getAttribute("title"),500);return s||(y(e.getAttribute("placeholder"),500)||"")},I=e=>S(e,"aria-describedby")||y(e.getAttribute("data-aurora-description"),d),E=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.closest('[data-aurora-overlay], [data-aurora-ignore="true"], [data-testid="aurora-panel"]'))return"runtime_overlay_or_explicitly_ignored";if(e.closest('[data-aurora-sensitive="true"]'))return"sensitive_subtree";if("iframe"===e.tagName.toLowerCase())return"cross_origin_or_embedded_frame";if(x(e))return"sensitive_control";if(e.isContentEditable&&Array.from(e.querySelectorAll("*")).some(e=>k(e)))return"mixed_sensitive_editor";if(e instanceof HTMLInputElement&&"hidden"===e.type.toLowerCase())return"hidden_input";if(e.closest('[hidden], [aria-hidden="true"]'))return"hidden";let n=e;for(;n;){if((n.hasAttribute("inert")||n.inert)&&!f(n,t))return"inert";n=n.parentElement}let i=e;for(;i;){const e="undefined"!==typeof window?window.getComputedStyle(i):null;if("none"===(null===e||void 0===e?void 0:e.display)||"hidden"===(null===e||void 0===e?void 0:e.visibility)||"collapse"===(null===e||void 0===e?void 0:e.visibility)||"0"===(null===e||void 0===e?void 0:e.opacity))return"css_hidden";if("rect(0px, 0px, 0px, 0px)"===(null===e||void 0===e?void 0:e.clip)||"inset(100%)"===(null===e||void 0===e?void 0:e.clipPath))return"visually_clipped";i=i.parentElement}return null},R=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.isConnected||E(e,t))return!1;if("undefined"!==typeof navigator&&/jsdom/i.test(navigator.userAgent))return!0;const n=e.getBoundingClientRect();return n.width>=2&&n.height>=2},$=R,N=(e,t)=>{if(!function(e){if(!R(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))return!1;const t=e.getBoundingClientRect();return t.bottom>=0&&t.right>=0&&t.top<=window.innerHeight&&t.left<=window.innerWidth}(e,t))return;const n=e.getBoundingClientRect();return{x:Math.round(100*n.x)/100,y:Math.round(100*n.y)/100,width:Math.round(100*n.width)/100,height:Math.round(100*n.height)/100}},T=e=>{if(!x(e)){if(e instanceof HTMLInputElement){if(["checkbox","radio","file","button","submit","reset"].includes(e.type.toLowerCase()))return;return e.value}return e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?e.value:e.isContentEditable?j(e)||"":void 0}},L=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=1e5;let i="",a=!1;if(!E(e,t)&&!k(e,t)){const r=T(e);if(void 0!==r)i=r;else{const r=[e],s=[];let o=0;for(;r.length&&o<=n;){const e=r.pop();if(e instanceof Element&&k(e,t))continue;const n=e instanceof Element?T(e):e.nodeType===Node.TEXT_NODE?e.textContent:void 0;if(void 0!==n&&null!==n){const e=n.replace(/\s+/g," ").trim();e&&(s.push(e),o+=e.length+1)}else r.push(...Array.from(e.childNodes).reverse())}i=s.join(" "),a=r.length>0}}let r=i.slice(0,n);return r.length<i.length&&/[\uD800-\uDBFF]$/.test(r)&&(r=r.slice(0,-1)),{text:r,content_hash:(0,c.f)(r),truncated:a||i.length>n}},O=(e,t)=>{const n=e.isContentEditable&&"true"!==e.getAttribute("data-aurora-plain-text"),i=(e.getAttribute("data-aurora-actions")||"").split(",").map(e=>e.trim()).filter(e=>l.ck.includes(e)).filter(e=>"press"!==e||["combobox","listbox","option","tab","treeitem"].includes(t)).filter(e=>!n||"fill"!==e&&"replace"!==e);if(i.length)return"true"===e.getAttribute("data-aurora-undo-available")&&i.push("undo"),Array.from(new Set(i));const a=["read"];return u.has(t)&&a.push("focus"),["combobox","listbox","option","tab","treeitem"].includes(t)&&a.push("press"),["button","checkbox","link","menuitem","option","radio","switch","tab","treeitem"].includes(t)&&a.push("click"),!(["textbox","searchbox","spinbutton","slider"].includes(t)||"combobox"===t&&e instanceof HTMLInputElement)||n||e instanceof HTMLInputElement&&"file"===e.type||a.push("fill","replace"),["combobox","listbox"].includes(t)&&a.push("select"),"link"===t&&a.push("navigate"),(m.has(t)||"list"===t||"grid"===t||"table"===t)&&a.push("scroll"),e instanceof HTMLInputElement&&"file"===e.type&&a.push("open"),e.hasAttribute("data-aurora-resource-id")&&a.push("open"),"true"===e.getAttribute("data-aurora-undo-available")&&a.push("undo"),Array.from(new Set(a
2))},M=e=>{const t={};let n=e;for(;n;){for(const e of Array.from(n.attributes)){if(!e.name.startsWith("data-aurora-"))continue;const n=e.name.slice(12).replace(/-/g,"_");if(!_.has(n)||n in t)continue;const i=e.value;"true"!==i&&"false"!==i||(t[n]="true"===i)}n=n.parentElement}return t},U=(e,t,n)=>{if("prohibited"===e)return 5;if("consequential"===e)return 4;if(n||t.hasAttribute("data-aurora-resource-id"))return 3;if("reversible"===e){const e=w(t);return["textbox","searchbox","spinbutton","slider","combobox","listbox","checkbox","radio","switch"].includes(e)?2:1}return 0},P=e=>{if(e.hasAttribute("data-aurora-id")||e.hasAttribute("data-aurora-name")||e.hasAttribute("data-aurora-resource-id"))return!0;const t=w(e);return"generic"!==t&&(p.has(t)||u.has(t))},q=e=>{let t=e.parentElement;for(;t;){const e=w(t);if(m.has(e)){return`${e}:${t.getAttribute("data-aurora-name")||t.getAttribute("aria-label")||S(t,"aria-labelledby")||t.id||""}`}t=t.parentElement}return"document"};class D{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.observationOptions=e,this.identities=new WeakMap,this.registrations=new WeakMap,this.entries=new Map,this.usedIds=new Map,this.generatedCounter=0,this.revision=1,this.excluded=[],this.observationCandidateCount=0,this.observationTruncated=!1}get version(){return this.revision}invalidate(){this.revision+=1}register(e,t){return this.registrations.set(e,t),this.invalidate(),()=>{this.registrations.delete(e);const t=this.identities.get(e);t&&this.entries.delete(t),this.invalidate()}}identityFor(e,t){var n;const i=this.identities.get(e);if(i)return i;let a=(null===(n=y(t,200))||void 0===n?void 0:n.replace(/[^a-zA-Z0-9:_\-.]/g,"-"))||""||`aurora-${b(`${w(e)}|${C(e)}|${q(e)}`)}`;
2const r=this.usedIds.get(a);return r&&r!==e&&r.isConnected&&(a=`${a}--${(++this.generatedCounter).toString(36)}`),this.identities.set(e,a),this.usedIds.set(a,e),a}observeElement(e){var t,n,i,a;if(E(e,this.observationOptions))return null;const r=this.registrations.get(e);if(!r&&!P(e))return null;const s=(null===r||void 0===r?void 0:r.role)||w(e),o=y(null===r||void 0===r?void 0:r.name,500)||C(e),l=(null===r||void 0===r?void 0:r.scope)||(e=>{var t;return y(e.getAttribute("data-aurora-scope")||(null===(t=e.closest("[data-aurora-scope]"))||void 0===t?void 0:t.getAttribute("data-aurora-scope")),300)})(e),c=this.identityFor(e,(null===r||void 0===r?void 0:r.id)||e.getAttribute("data-aurora-id")||void 0),u=[s,o,l||"",q(e),e.getAttribute("data-aurora-id")||""].join("|").toLowerCase(),m=`fp_${b(u)}${b(`scope:${u}`)}${b(`role:${u}`)}`,p=(null===r||void 0===r?void 0:r.resource_id)||y(e.getAttribute("data-aurora-resource-id"),500),v=((e,t,n)=>{var i;const a=null===(i=e.closest("[data-aurora-risk]"))||void 0===i?void 0:i.getAttribute("data-aurora-risk");return"read"===a||"reversible"===a||"consequential"===a||"prohibited"===a?a:h.test(n)||("button"===t||e instanceof HTMLInputElement&&"submit"===e.type)&&e.closest('[role="dialog"], [role="alertdialog"], dialog')&&/\b(confirm|approve|apply|continue|yes|proceed)\b/i.test(n)?"consequential":["button","link","menuitem","option","tab","treeitem"].includes(t)||["textbox","searchbox","spinbutton","slider","combobox","listbox","checkbox","radio","switch"].includes(t)?"reversible":"read"})(e,s,o),g="prohibited"===v?"prohibited":(null===r||void 0===r?void 0:r.risk)||v,f=N(e,this.observationOptions),_=((e,t)=>{const n=e,i=t=>{const n=e.getAttribute(t);return null===n?void 0:"true"===n},a={visible:$(e,t),disabled:!1,read_only:!1,required:!1,invalid:!1,sensitive:!1};return e instanceof HTMLInputElement&&(a.input_type=e.type.toLowerCase()),("disabled"in n||e.hasAttribute("aria-disabled"))&&(a.disabled=Boolean(n.disabled)||e.matches(":disabled")||!0===i("aria-disabled")),("checked"in n||e.hasAttribute("aria-checked"))&&(a.checked=Boolean(n.checked)||!0===i("aria-checked")),e.hasAttribute("aria-expanded")&&(a.expanded=i("aria-expanded")),"summary"===e.tagName.toLowerCase()&&e.parentElement instanceof HTMLDetailsElement&&(a.expanded=e.parentElement.open),("selected"in e||e.hasAttribute("aria-selected"))&&(a.selected=Boolean(e.selected)||!0===i("aria-selected")),("readOnly"in n||e.hasAttribute("aria-readonly"))&&(a.read_only=Boolean(n.readOnly)||!0===i("aria-readonly")),("required"in n||e.hasAttribute("aria-required"))&&(a.required=Boolean(n.required)||!0===i("aria-required")),e.hasAttribute("aria-invalid")&&(a.invalid="false"!==e.getAttribute("aria-invalid")),e.hasAttribute("aria-busy")&&(a.busy=i("aria-busy")),a})(e,this.observationOptions),x={element_id:c,fingerprint:m,role:s,accessible_name:o||s,...null!==r&&void 0!==r&&r.description||I(e)?{description:y((null===r||void 0===r?void 0:r.description)||I(e),d)}:{},..."prohibited"===g||T(e)||["textbox","searchbox","document"].includes(s)?{}:{text:A(e,2e3)},..."prohibited"!==g&&void 0!==T(e)?{value:null===(t=T(e))||void 0===t?void 0:t.slice(0,4e3)}:{},state:_,supported_actions:"prohibited"===g?[]:(null===r||void 0===r?void 0:r.actions)||O(e,s),risk_tier:U(g,e,Boolean(p)),risk:g,...l?{scope_id:l}:{},...p?{resource_id:p}:{},...f?{geometry:f}:{},child_ids:[],metadata:{...M(e),...this.observationOptions.read_behind_aurora&&e.closest('[data-aurora-inert-owner="true"]')?{covered_by_aurora:!0,requires_page_reveal:!0}:{},in_viewport:void 0!==f,...e instanceof HTMLAnchorElement&&null!==(n=e.getAttribute("href"))&&void 0!==n&&n.startsWith("/")&&(null===(i=e.getAttribute("href"))||void 0===i||!i.startsWith("//"))?{route:e.getAttribute("href").slice(0,500)}:{},...e instanceof HTMLInputElement&&["number","range","date","time","datetime-local"].includes(e.type)?{minimum:e.min||null,maximum:e.max||null,step:e.step||null}:{},...e instanceof HTMLInputElement&&e.hasAttribute("data-schedule-type")?{minimum:e.dataset.scheduleMin||null,maximum:e.dataset.scheduleMax||null,display_format:"dd/mm/yyyy"}:{},...(null===r||void 0===r?void 0:r.metadata)||{},..."view_navigation"===e.getAttribute("data-aurora-effect")?{effect:"view_navigation"}:{},...e.hasAttribute("data-aurora-question-number")?{question_number:Number(e.getAttribute("data-aurora-question-number")),question_count:Number(e.getAttribute("data-aurora-question-count")),block_id:(null===(a=e.getAttribute("data-aurora-block-id"))||void 0===a?void 0:a.slice(0,300))||null}:{},...null!==r&&void 0!==r&&r.adapter_id?{adapter:r.adapter_id}:{}}},k={element:e,semantic:x,registration:r,adapter_id:null===r||void 0===r?void 0:r.adapter_id};
2return this.entries.set(c,k),k}observe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.entries.clear(),this.excluded=[];const n=[],i="undefined"===typeof NodeFilter?{SHOW_ELEMENT:1,FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3}:NodeFilter,a=new Set;for(const u of[...t,e]){const e=document.createTreeWalker(u,i.SHOW_ELEMENT,{acceptNode:e=>{const t=e,n=E(t,this.observationOptions);return n?(this.excluded.length<100&&(P(t)||"sensitive_control"===n||"iframe"===t.tagName.toLowerCase())&&this.excluded.push({tag:t.tagName.toLowerCase(),reason:n,name:"sensitive_control"===n?void 0:C(t)||void 0}),i.FILTER_REJECT):P(t)||this.registrations.has(t)?R(t,this.observationOptions)?i.FILTER_ACCEPT:(this.excluded.length<100&&this.excluded.push({tag:t.tagName.toLowerCase(),reason:"zero_or_tiny_geometry",name:C(t)||void 0}),i.FILTER_REJECT):i.FILTER_SKIP}});for(a.has(u)||!P(u)&&!this.registrations.has(u)||E(u,this.observationOptions)||(n.push(u),a.add(u));n.length<1500;){const t=e.nextNode();if(!t)break;a.has(t)||(n.push(t),a.add(t))}}const r=new Set([e,...t]),s="undefined"!==typeof navigator&&/jsdom/i.test(navigator.userAgent),o=e=>{var t;if(r.has(e)||e===document.activeElement)return 0;const n=(null===(t=this.registrations.get(e))||void 0===t?void 0:t.role)||w(e);return 2*(u.has(n)?1:"heading"===n||"alert"===n||"status"===n?2:m.has(n)?3:4)+((e=>{if(s)return!0;const t=e.getBoundingClientRect();return t.bottom>=0&&t.right>=0&&t.top<=window.innerHeight&&t.left<=window.innerWidth})(e)?0:1)};this.observationCandidateCount=n.length,this.observationTruncated=n.length>400;const l=n.map((e,t)=>({element:e,rank:o(e),index:t})).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.element).slice(0,400).map(e=>this.observeElement(e)).filter(e=>Boolean(e)),c=new Map(l.map(e=>[e.element,e]));for(const u of l){let e=u.element.parentElement;for(;e&&!c.has(e);)e=e.parentElement;if(e){var d,p;u.semantic.parent_id=null===(d=c.get(e))||void 0===d?void 0:d.semantic.element_id;const t=null===(p=c.get(e))||void 0===p?void 0:p.semantic;t&&(t.child_ids=[...t.child_ids,u.semantic.element_id])}}return l}get(e){const t=this.entries.get(e);return null!==t&&void 0!==t&&t.element.isConnected?t:(t&&this.entries.delete(e),null)}peek(e){return this.entries.get(e)||null}findByFingerprint(e){return Array.from(this.entries.values()).filter(t=>t.element.isConnected&&t.semantic.fingerprint===e)}all(){return Array.from(this.entries.values()).filter(e=>e.element.isConnected)}observationCoverage(){return{observation_scope:"whole_page",observation_truncated:this.observationTruncated,observed_candidate_count:this.observationCandidateCount}}exclusions(){return[...this.excluded]}}const z=e=>{try{if("undefined"!==typeof crypto&&"function"===typeof crypto.randomUUID)return`${e}-${crypto.randomUUID()}`}catch{}return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`},B=e=>{let t=0;for(let n=0;n<e.length;n+=1){const i=e.charCodeAt(n);i<128?t+=1:i<2048?t+=2:i>=55296&&i<=56319&&n+1<e.length&&e.charCodeAt(n+1)>=56320&&e.charCodeAt(n+1)<=57343?(t+=4,n+=1):t+=3}return t},F=e=>{const t=String(e||"").trim();return/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(t)?t:void 0},W=(e,t)=>{const n=new Set,i=[e];for(let a=0;a<i.length&&a<20;a+=1){const r=[i[a],...Array.from(i[a].querySelectorAll("[aria-controls], [aria-owns]"))];for(const a of r){if(!$(a,t))continue;const r=`${a.getAttribute("aria-controls")||""} ${a.getAttribute("aria-owns")||""}`.split(/\s+/).filter(Boolean);for(const a of r){const r=document.getElementById(a);if(r&&!e.contains(r)&&!n.has(r)&&$(r,t)&&(n.add(r),i.push(r),n.size>=20))return Array.from(n)}}}return Array.from(n)},H=(e,t)=>Array.from(new Set([...W(e,t),...Array.from(document.querySelectorAll('[data-aurora-app-chrome="true"]')).filter(n=>!e.contains(n)&&!n.contains(e)&&$(n,t))])),V=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Array.from(document.querySelectorAll('[role="dialog"], [role="alertdialog"], dialog[open], [aria-modal="true"]')).filter(t=>$(t,e)),n=t[t.length-1];if(n)return{root:n,additional_roots:W(n,e),scope:{scope_id:F(n.getAttribute("data-aurora-scope"))||"active-dialog",kind:"dialog",frame_origin:window.location.origin}};const i=Array.from(document.querySelectorAll('[data-aurora-snapshot-root="true"]')).filter(t=>$(t,e)).pop();if(i)return{root:i,additional_roots:H(i,e),scope:{scope_id:F(i.getAttribute("data-aurora-scope"))||"active-component",kind:"component",frame_origin:window.location.origin}};const a=Array.from(document.querySelectorAll("[data-workspace][data-aurora-scope]")).filter(t=>$(t,e)),r=a.filter(e=>!a.some(t=>e!==t&&e.contains(t))).pop();return r?{root:r,additional_roots:H(r,e),scope:{scope_id:F(r.getAttribute("data-aurora-scope"))||"active-workspace",kind:"editor",frame_origin:window.location.origin}}:{root:document.body,scope:{scope_id:"page-viewport",kind:"viewport",frame_origin:window.location.origin}}},Y=e=>{const t=e.element.getAttribute("data-aurora-notification-kind");if("success"===t||"warning"===t||"error"===t)return t;const n=`${e.element.getAttribute("class")||""} ${e.semantic.accessible_name}`;return/error|danger|failed/i.test(n)?"error":/warn/i.test(n)?"warning":/success|complete/i.test(n)?"success":"info"};class G{constructor(e,t){this.registry=e,this.adapter_observer=t}create(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V(this.registry.observationOptions);this.registry.invalidate();const n=this.registry.observe(t.root,t.additional_roots),i=n.find(e=>e.element===t.root);i&&(i.semantic.metadata={...i.semantic.metadata,...this.registry.observationCoverage()});let a=2e5-n.reduce((e,t)=>
2e+t.semantic.accessible_name.length,0),r=131072;for(const m of n){var s;const e="prohibited"===m.semantic.risk||5===m.semantic.risk_tier||m.semantic.state.sensitive,t=m.semantic.accessible_name.length,n="document"!==m.semantic.role||m.registration?null===(s=this.adapter_observer)||void 0===s?void 0:s.observe(m):void 0;n&&(m.semantic={...m.semantic,...n,state:{...m.semantic.state,...n.state||{}},metadata:{...m.semantic.metadata,...n.metadata||{}}}),m.semantic.accessible_name=String(m.semantic.accessible_name||m.semantic.role).replace(/\s+/g," ").trim().slice(0,500)||m.semantic.role,a-=m.semantic.accessible_name.length-t;const i=e||"prohibited"===m.semantic.risk||5===m.semantic.risk_tier||m.semantic.state.sensitive||["hidden","password"].includes((m.semantic.state.input_type||"").toLowerCase());i&&(m.semantic.risk="prohibited",m.semantic.risk_tier=5,m.semantic.supported_actions=[],delete m.semantic.value,delete m.semantic.text);const o=T(m.element);if(m.semantic.state.sensitive||"prohibited"===m.semantic.risk||void 0===o||(m.semantic.state.value_hash=(0,c.f)(o)),m.semantic.text&&(m.semantic.state.text_hash=(0,c.f)(m.semantic.text)),!i&&m.semantic.supported_actions.includes("read")&&!m.semantic.resource_id){const e=L(m.element,this.registry.observationOptions);m.semantic.metadata={...m.semantic.metadata,readable_text_hash:e.content_hash,readable_characters:e.text.length,readable_truncated:e.truncated,content_truncated:e.truncated||e.text.length>(m.semantic.value||m.semantic.text||"").length}}if(m.semantic.description){const e=Math.max(0,Math.min(m.semantic.description.length,a));m.semantic.description=m.semantic.description.slice(0,e)||void 0,a-=e}for(const r of["value","text"]){const e=m.semantic[r];e&&(a<=0?(delete m.semantic[r],m.semantic.metadata.content_truncated=!0):(e.length>a&&(m.semantic[r]=e.slice(0,a),m.semantic.metadata.content_truncated=!0),a-=Math.min(e.length,a)))}const l=Object.fromEntries(Object.entries(m.semantic.metadata).map(e=>{let[t,n]=e;return[t.slice(0,120),"string"===typeof n?n.slice(0,500):n]})),d=B(JSON.stringify(l));d<=r?(m.semantic.metadata=l,r-=d):m.semantic.metadata={}}const o=n.find(e=>e.element===document.activeElement),l=n.filter(e=>"dialog"===e.semantic.role),d=n.filter(e=>"alert"===e.semantic.role||"status"===e.semantic.role).slice(0,50),u=[];for(const c of d){if(a<=0)break;const e=(c.semantic.text||c.semantic.accessible_name).slice(0,Math.min(500,a));e&&(u.push({notification_id:`notice-${c.semantic.element_id}`,kind:Y(c),text:e}),a-=e.length)}return{protocol_version:"1.0",snapshot_id:z("snapshot"),snapshot_version:this.registry.version,captured_at:(new Date).toISOString(),route:e.route||"/",client_instance_id:e.client_instance_id,actor_hint:{...F(e.org_id)?{org_id:F(e.org_id)}:{},...F(e.centre_id)?{centre_id:F(e.centre_id)}:{},...F(e.actor_id)?{actor_id:F(e.actor_id)}:{},roles:e.actor_role?[e.actor_role]:[]},scope:t.scope,elements:n.map(e=>e.semantic),...o?{focused_element_id:o.semantic.element_id}:{},dialog_element_ids:l.map(e=>e.semantic.element_id),notifications:u}}observeInvalidation(e){let t=null;const n=()=>{null!==t&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,this.registry.invalidate(),e()},100)},i=e=>{const t=e instanceof Element?e:null===e||void 0===e?void 0:e.parentElement;return Boolean(null===t||void 0===t?void 0:t.closest('[data-aurora-overlay], [data-aurora-ignore="true"], [data-testid="aurora-panel"]'))},a=new MutationObserver(e=>{e.some(e=>{if(i(e.target))return!1;if("childList"===e.type){const t=[...Array.from(e.addedNodes),...Array.from(e.removedNodes)];if(t.length>0&&t.every(i))return!1}return!0})&&n()});a.observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["aria-label","aria-labelledby","aria-describedby","aria-disabled","aria-expanded","aria-selected","aria-checked","aria-busy","aria-hidden","aria-controls","aria-owns","aria-valuenow","aria-valuetext","class","style","inert","role","value","type","tabindex","disabled","readonly","required","hidden","open","data-aurora-id","data-aurora-name","data-aurora-actions","data-aurora-risk","data-aurora-resource-id","data-aurora-scope"]});const r=t=>{i(t.target)||(this.registry.invalidate(),e())};document.addEventListener("input",r,!0),document.addEventListener("change",r,!0);const s=e=>{i(e.target)||n()};return window.addEventListener("resize",s,{passive:!0}),window.addEventListener("scroll",s,{passive:!0,capture:!0}),()=>{a.disconnect(),document.removeEventListener("input",r,!0),document.removeEventListener("change",r,!0),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),null!==t&&window.clearTimeout(t)}}}const J=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1500,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Date.now();let a=i;const r=new G(new D).observeInvalidation(()=>{a=Date.now()});try{for(;Date.now()-i<t;){if(null!==e&&void 0!==e&&e.aborted)throw new DOMException("Page observation cancelled","AbortError");const t=V(n),i=[t.root,...t.additional_roots||[]];if(!i.some(e=>[e,...Array.from(e.querySelectorAll('[aria-busy="true"], [role="progressbar"]'))].some(e=>("true"===e.getAttribute("aria-busy")||"progressbar"===e.getAttribute("role"))&&$(e,n)))&&Date.now()-a>=180)return;await new Promise(e=>window.setTimeout(e,40))}if(null!==e&&void 0!==e&&e.aborted)throw new DOMException("Page observation cancelled","AbortError")}finally{r()}},K=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,X=e=>K(e)?e.value:e.textContent||"",Z=(e,t)=>{if(K(e)){var n;const i=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,a=null===(n=Object.getOwnPropertyDescriptor(i,"value"))||void 0===n?void 0:n.set;a?a.call(e,t):e.value=t}else e.textContent=t;
2const i="function"===typeof InputEvent?new InputEvent("input",{bubbles:!0,inputType:"insertReplacementText",data:null}):new Event("input",{bubbles:!0});e.setAttribute("data-aurora-committing","true");try{e.dispatchEvent(i)}finally{e.removeAttribute("data-aurora-committing")}},Q=()=>new DOMException("Aurora edit cancelled","AbortError");class ee{get can_undo(){return Boolean(this.snapshot&&this.committed&&this.element.isConnected&&X(this.element)===this.committedValue)}get undo_postcondition(){return this.snapshot?{kind:"value_hash",expected_hash:(0,c.f)(this.snapshot.value)}:void 0}constructor(e,t,n){this.target_id=e,this.element=t,this.context=n,this.transaction_id=z("edit"),this.snapshot=null,this.committed=!1,this.committedValue=null,this.undo=async()=>{await this.rollback()}}async begin(){if(this.context.signal.aborted)throw Q();this.snapshot={value:X(this.element),selection_start:K(this.element)?this.element.selectionStart:null,selection_end:K(this.element)?this.element.selectionEnd:null,scroll_top:this.element.scrollTop,scroll_left:this.element.scrollLeft},this.element.setAttribute("data-aurora-editing","true"),this.element.focus({preventScroll:!0})}async preview(e){const t=(e=>{if(!e)return[""];const t=e.match(/[^.!?\n]+[.!?\n]+|[^.!?\n]+$/g)||[e];if(t.length<=16)return t;const n=Math.ceil(t.length/12),i=[];for(let a=0;a<t.length;a+=n)i.push(t.slice(a,a+n).join(""));return i})(e);let n="";for(let i=0;i<t.length;i+=1){if(this.context.signal.aborted)throw Q();n+=t[i];const e=Math.round((i+1)/t.length*100);this.context.set_preview(n,e),this.context.report_progress(e,"Previewing edit"),!this.context.reduced_motion&&i<t.length-1&&await new Promise((e,t)=>{const n=window.setTimeout(e,24);this.context.signal.addEventListener("abort",()=>{window.clearTimeout(n),t(Q())},{once:!0})})}}async commit(e){if(!this.snapshot)throw new Error("Edit transaction has not started.");if(this.context.signal.aborted)throw Q();if(Z(this.element,e),this.committed=!0,this.committedValue=e,this.element.setAttribute("data-aurora-undo-available","true"),K(this.element)){const t=e.length;try{this.element.setSelectionRange(t,t)}catch{}}this.element.removeAttribute("data-aurora-editing"),this.context.set_preview(null,100)}async rollback(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.snapshot;if(this.element.removeAttribute("data-aurora-editing"),this.context.set_preview(null),t&&!e.preserve_human_input){if(this.committed){if(!this.element.isConnected)throw new te;if(X(this.element)!==this.committedValue)throw new te;this.committedValue!==t.value&&Z(this.element,t.value),this.element.removeAttribute("data-aurora-undo-available")}if(K(this.element)&&null!==t.selection_start&&null!==t.selection_end)try{this.element.setSelectionRange(t.selection_start,t.selection_end)}catch{}this.element.scrollTop=t.scroll_top,this.element.scrollLeft=t.scroll_left}}}class te extends Error{constructor(){super("Undo is unavailable because the field was edited after Aurora finished."),this.code="AURORA_UNDO_STALE",this.name="AuroraUndoStaleError"}}const ne=function(e){return{handled:!0,changed:arguments.length>1&&void 0!==arguments[1]&&arguments[1],message:e}},ie=async(e,t)=>{var n,i;const a=null!==(n=null!==(i=T(e))&&void 0!==i?i:j(e))&&void 0!==n?n:"";switch(t.kind){case"value_hash":return t.expected_hash===(0,c.f)(a);case"text_present":return a.includes(t.text||"");case"state":{const n=t.state_key||"";return"disabled"===n?Boolean(e.disabled||"true"===e.getAttribute("aria-disabled"))===t.state_value:"checked"===n?Boolean(e.checked||"true"===e.getAttribute("aria-checked"))===t.state_value:"selected"===n?Boolean(e.selected||"true"===e.getAttribute("aria-selected"))===t.state_value:"expanded"===n?"true"===e.getAttribute("aria-expanded")===t.state_value:"read_only"===n&&Boolean(e.readOnly||"true"===e.getAttribute("aria-readonly"))===t.state_value}case"element_present":return e.isConnected;default:return!1}},ae=async(e,t,n)=>{if(!(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&!["button","checkbox","file","hidden","radio","reset","submit"].includes(e.type)||e instanceof HTMLElement&&e.isContentEditable)(e)||"fill"!==t.action_type&&"replace"!==t.action_type)return{handled:!1};const i=t.parameters.value;if("string"!==typeof i)return{handled:!0,message:"The edit did n
2ot include a value."};if(X(e)===i)return{handled:!0,changed:!1,message:"The field already matched the requested value."};const a=new ee(t.target_id||"target",e,n);await a.begin();try{await a.preview(i),await a.commit(i)}catch(r){throw await a.rollback({preserve_human_input:n.signal.aborted}),r}return{handled:!0,changed:!0,message:"Updated the field in one edit.",transaction_id:a.transaction_id,undo:a.undo,can_undo:()=>a.can_undo,undo_postcondition:a.undo_postcondition}},re={id:"native-control",matches:e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,observe:e=>({role:w(e)}),execute:async(e,t,n)=>{const i=await ae(e,t,n);if(i.handled)return i;if("select"===t.action_type&&e instanceof HTMLSelectElement){var a;const i=t.parameters.option,r=Array.from(e.options).find(e=>e.value===i||e.text.trim()===i);if(!r||r.disabled||null!==(a=r.closest("optgroup"))&&void 0!==a&&a.disabled)throw new Error("The requested option is not available.");const s=e.value;r.setAttribute("data-aurora-option-preview","true");try{if(n.set_preview(r.text,50),n.reduced_motion||await new Promise(e=>window.setTimeout(e,120)),n.signal.aborted)throw new DOMException("Selection cancelled","AbortError");e.value=r.value,e.dispatchEvent(new Event("change",{bubbles:!0})),n.set_preview(null,100)}finally{r.removeAttribute("data-aurora-option-preview")}return{handled:!0,changed:s!==r.value,message:`Selected ${r.text.trim()}.`,undo:async()=>{if(!e.isConnected||e.value!==r.value)throw new te;e.value=s,e.dispatchEvent(new Event("change",{bubbles:!0}))},can_undo:()=>e.isConnected&&e.value===r.value,undo_postcondition:{kind:"value_hash",expected_hash:(0,c.f)(s)}}}return"open"===t.action_type&&e instanceof HTMLInputElement&&"file"===e.type?(e.click(),ne("Opened the file picker.")):"read"===t.action_type?ne("Read the control."):{handled:!1}},verify:ie},se={id:"combobox",matches:e=>!(e instanceof HTMLSelectElement)&&"combobox"===w(e),observe:()=>({metadata:{adapter:"combobox"}}),execute:async(e,t,n)=>{const i=await ae(e,t,n);if(i.handled)return i;if("select"!==t.action_type)return{handled:!1};const a=t.parameters.option;if(!a)return ne("The selection did not name an option.");e.focus(),e.click(),await Promise.resolve();let r=[],s=[];const o=Date.now();for(;Date.now()-o<2e3;){if(n.signal.aborted)throw new DOMException("Selection cancelled","AbortError");if(!e.isConnected)throw new Error("The combobox changed before its options opened.");if(r=Array.from(new Set(`${e.getAttribute("aria-controls")||""} ${e.getAttribute("aria-owns")||""}`.split(/\s+/).filter(Boolean))).slice(0,10).map(e=>document.getElementById(e)).filter(e=>Boolean(e)),s=r.flatMap(e=>Array.from(e.querySelectorAll('[role="option"]'))).filter(e=>C(e)===a&&$(e)&&"true"!==e.getAttribute("aria-disabled")),s.length)break;await new Promise(e=>window.setTimeout(e,40))}if(!r.length)throw new Error("This combobox must identify its owned option list before Aurora can select safely.");if(1!==s.length)throw new Error(s.length>1?"The requested option is ambiguous for this combobox.":"The requested option is not available.");const l=s[0],d=T(e),u=void 0===d?void 0:r.flatMap(e=>Array.from(e.querySelectorAll('[role="option"]'))).find(e=>C(e)===d||e.getAttribute("data-value")===d);let m;l.setAttribute("data-aurora-option-preview","true");try{if(n.set_preview(a,50),n.reduced_motion||await new Promise(e=>window.setTimeout(e,120)),n.signal.aborted)throw new DOMException("Selection cancelled","AbortError");l.click(),m=T(e),n.set_preview(null,100)}finally{l.removeAttribute("data-aurora-option-preview")}return{handled:!0,changed:!0,message:`Selected ${a}.`,...void 0!==d&&u?{undo:async()=>{if(!e.isConnected||T(e)!==m)throw new te;u.click()},can_undo:()=>e.isConnected&&T(e)===m,undo_postcondition:{kind:"value_hash",expected_hash:(0,c.f)(d)}}:{}}},verify:ie},oe={id:"data-grid",matches:e=>["grid","table","row","gridcell"].includes(w(e)),observe:()=>({metadata:{adapter:"data-grid"}}),execute:async(e,t)=>"read"===t.action_type?ne("Read the rendered grid content."):"focus"===t.action_type?(e.focus(),ne("Focused the grid target.")):"click"===t.action_type||"select"===t.action_type?(e.click(),ne("Selected the grid target.",!0)):{handled:!1},verify:ie},le=(e,t)=>
2({id:e,matches:t,observe:()=>({metadata:{adapter:e,explicit_registration_required:!0}}),execute:async(t,n)=>"read"===n.action_type?ne(`Read the ${e.replace(/-/g," ")} surface.`):{handled:!1,message:`The ${e.replace(/-/g," ")} requires an explicit component controller.`},verify:ie}),ce=[{id:"plain-contenteditable",matches:e=>e.isContentEditable&&"true"===e.getAttribute("data-aurora-plain-text"),observe:()=>({role:"textbox",metadata:{adapter:"plain-contenteditable"}}),execute:ae,verify:ie},{...re,id:"date-time",matches:e=>e instanceof HTMLInputElement&&(e.hasAttribute("data-schedule-type")||["date","datetime-local","month","time","week"].includes(e.type)),observe:e=>({metadata:{adapter:"date-time",...e.hasAttribute("data-schedule-type")?{display_format:"dd/mm/yyyy",date_type:e.getAttribute("data-schedule-type")}:{}}})},{id:"file-attachment",matches:e=>e instanceof HTMLInputElement&&"file"===e.type||e.hasAttribute("data-aurora-resource-id"),observe:e=>({metadata:{adapter:"file-attachment",has_resource:e.hasAttribute("data-aurora-resource-id")}}),execute:async(e,t)=>"open"===t.action_type||"click"===t.action_type?e instanceof HTMLAnchorElement?{handled:!1}:(e.click(),ne("Opened the attachment control.")):"read"===t.action_type?ne("Located the attachment resource."):{handled:!1},verify:ie},se,{id:"modal-drawer",matches:e=>"dialog"===w(e)||e.hasAttribute("data-drawer")||"drawer"===e.getAttribute("data-aurora-adapter"),observe:()=>({metadata:{adapter:"modal-drawer"}}),execute:async(e,t)=>"read"===t.action_type?ne("Read the open dialog."):"focus"===t.action_type||"open"===t.action_type?(e.focus(),ne("Focused the open dialog.")):"press"===t.action_type&&"Escape"===t.parameters.key?(e.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0})),ne("Requested that the dialog close.",!0)):{handled:!1},verify:ie},le("drag-and-drop",e=>"true"===e.getAttribute("draggable")||e.hasAttribute("data-aurora-drop-zone")),le("canvas-editor",e=>e instanceof HTMLCanvasElement||"canvas"===e.getAttribute("data-aurora-adapter")),oe,re];class de{constructor(){this.adapters=[...ce]}register(e){return this.adapters=[e,...this.adapters.filter(t=>t.id!==e.id)],()=>{this.adapters=this.adapters.filter(t=>t!==e)}}find(e){const t=e.registration;return t&&(t.execute||t.read||t.verify)?{id:t.adapter_id||"registered-component",matches:()=>!0,observe:()=>({metadata:{adapter:t.adapter_id||"registered-component"}}),execute:async(e,n,i)=>"read"===n.action_type&&t.read?(await t.read(),ne("Read the registered component.")):t.execute?t.execute(n,i):{handled:!1},verify:async(n,i)=>t.verify?Boolean(await t.verify(i)):ie(e.element,i),rollback:t.rollback?async e=>{var n;await(null===(n=t.rollback)||void 0===n?void 0:n.call(t,e))}:void 0}:this.adapters.find(t=>t.matches(e.element))||null}observe(e){const t=this.find(e);return t?t.observe(e.element):{}}ids(){return this.adapters.map(e=>e.id)}}const ue=(e,t,n)=>{if(!t.target_id||!t.target_fingerprint)return{status:"stale",error_code:"AURORA_TARGET_REQUIRED",message:"This action requires a semantic target."};const i=e.peek(t.target_id);if(!i||!i.element.isConnected)return{status:"stale",error_code:"AURORA_TARGET_STALE",message:"The authorized target was replaced. Aurora needs a fresh observation."};n();const a=e.get(t.target_id);return a&&a.element===i.element&&a.semantic.fingerprint===t.target_fingerprint?{status:"resolved",entry:a,recovered:!1}:{status:"stale",error_code:"AURORA_TARGET_STALE",message:"The authorized target changed. Aurora needs a fresh observation."}},me=["pointerdown","keydown","beforeinput","input","touchstart","wheel","scroll"],pe=e=>{let t=0;const n=n=>{var i;if(!n.isTrusted)return;const a=n.target;if(null!==a&&void 0!==a&&null!==(i=a.closest)&&void 0!==i&&i.call(a,"[data-aurora-overlay]"))return;const r=Boolean(e.target&&a&&(e.target===a||e.target.contains(a))),s=Boolean(a&&(e.scope===a||e.scope.contains(a)));s&&["wheel","touchstart","pointerdown","keydown"].includes(n.type)&&(t=performance.now()),(e=>{const t="wheel"===e.event_type||"touchstart"===e.event_type,n="scroll"===e.event_type&&e.recent_manual_scroll_intent,i=["pointerdown","keydown","beforeinput","input"].includes(e.event_type);return e.in_target||e.in_scope&&(i||t||n)})({event_type:n.type,in_target:r,in_scope:s,recent_manual_scroll_intent:performance.now()-t<600}
2)&&e.on_takeover(n)};return me.forEach(e=>document.addEventListener(e,n,!0)),()=>me.forEach(e=>document.removeEventListener(e,n,!0))};var he=n(1792);const ve=(e,t)=>{const[n,i]=(0,he.s)(e).split("#"),[a,r]=(0,he.s)(t).split("#"),[s,o]=n.split("?"),[l,c]=a.split("?");if(r&&i!==r)return!1;if(c){const e=new URLSearchParams(o||""),t=new URLSearchParams(c);if(!Array.from(t.keys()).every(n=>JSON.stringify(e.getAll(n))===JSON.stringify(t.getAll(n))))return!1}if(s===l)return!0;const d=s.split("/").filter(Boolean),u=l.split("/").filter(Boolean);return"*"===u[u.length-1]?(u.pop(),u.every((e,t)=>e.startsWith(":")||e===d[t])):d.length===u.length&&u.every((e,t)=>e.startsWith(":")||e===d[t])},ge=(e,t)=>JSON.stringify({route:t,scope:V().scope.kind,elements:e.all().map(e=>e.semantic).filter(e=>e.state.visible&&!e.state.sensitive&&"prohibited"!==e.risk&&5!==e.risk_tier).map(e=>{var t;return{role:e.role,accessible_name:e.accessible_name,description:e.description||null,text:e.text||null,value:null!==(t=e.value)&&void 0!==t?t:null,state:Object.fromEntries(Object.entries(e.state).filter(e=>{let[t]=e;return!["focused","busy","value_hash","text_hash"].includes(t)})),supported_actions:e.supported_actions}})}),fe=async e=>{e.refresh();const t=e.postcondition,n=e.target?e.registry.get(e.target.semantic.element_id):null,i=!e.target||(null===n||void 0===n?void 0:n.element)===e.target.element&&n.semantic.fingerprint===e.target.semantic.fingerprint;let a,r=!1;switch(t.kind){case"value_hash":{var s,o;const e=i?n:null;a=(0,c.f)(e&&null!==(s=null!==(o=T(e.element))&&void 0!==o?o:j(e.element))&&void 0!==s?s:""),r=a===t.expected_hash;break}case"text_present":{var l,d;const e=i?n:null;r=Boolean(e&&(null!==(l=null!==(d=T(e.element))&&void 0!==d?d:j(e.element))&&void 0!==l?l:"").includes(t.text||""));break}case"state":{const e=i?n:null;r=Boolean(e&&((e,t)=>"focused"===t?document.activeElement===e.element:t in e.semantic.state?e.semantic.state[t]:e.element.getAttribute(`aria-${t.replace(/_/g,"-")}`))(e,t.state_key||"")===t.state_value);break}case"route":r=ve(e.route,t.route||"");break;case"page_changed":r=Boolean(e.page_before&&!e.registry.all().some(e=>e.semantic.state.visible&&e.semantic.state.busy)&&ge(e.registry,e.route)!==e.page_before);break;case"element_present":r=Boolean(t.element_id&&e.registry.get(t.element_id));break;case"adapter":{const a=i?n:null,s=a?e.adapters.find(a):null;r=Boolean(a&&s&&s.id===t.adapter_verification&&await s.verify(a.element,t));break}default:r=!1}return{passed:r,postcondition:t,...a?{observed_hash:a}:{},message:r?"page_changed"===t.kind?"The page changed. Inspect the current page to confirm the outcome.":"The expected result is visible.":"The expected result could not be verified."}},_e=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Backspace","Delete"]);class ye extends Error{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"retry",i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(t),this.code=e,this.recoverability=n,this.changed=i,this.name="ExecutionFailure"}}const be=new Set(["saving","pending","dirty"]),we=new Set(["offline","error","conflict"]),xe=e=>{const t="string"===typeof e&&Array.from(e).some(e=>e.charCodeAt(0)<32);if("string"!==typeof e||!e.startsWith("/")||e.startsWith("//")||e.includes("\\")||t)return null;try{const t=new URL(e,window.location.origin);return t.origin===window.location.origin?(0,he.s)(`${t.pathname}${t.search}${t.hash}`):null}catch{return null}},ke=e=>({protocol_version:"1.0",action_id:e.request.action_id,session_id:e.request.session_id,status:e.status,started_at:e.started_at,completed_at:(new Date).toISOString(),message:e.message,policy_decision_id:e.policy_decision_id,...e.new_snapshot_version?{new_snapshot_version:e.new_snapshot_version}:{},...e.verification?{verification:e.verification}:{},...e.observation?{observation:e.observation}:{},...e.error?{error:e.error}:{},recoverability:e.recoverability||"none"});class Ae{constructor(e){this.options=e,this.active=null,this.undoHistory=new Map,this.refresh=()=>{const e=V(),t=this.options.registry.observe(e.root,e.additional_roots);for(const n of t){const e=this.options.adapters.observe(n);n.semantic={...n.semantic,...e,state:{...n.semantic.state,...e.state||{}},metadata:{...n.semantic.metadata,...e.metadata||{}}}}}}cancel(){var e;null===(e=this.active)||void 0===e||e.controller.abort()}get running(){return Boolean(this.active)}latestUndo(){const e=Array.from(this.undoHistory.entries());for(let n=e.length-1;n>=0;n-=1){var t;const[i,a]=e[n];if(!1!==(null===(t=a.can_undo)||void 0===t?void 0:t.call(a)))return{target_id:i,target_fingerprint:a.target_fingerprint,target_name:a.target_name,expected_postcondition:a.expected_postcondition};this.undoHistory.delete(i)}return null}lifecycle(e,t){var n,i;null===(n=this.options.hooks)||void 0===n||null===(i=n.on_lifecycle)||void 0===i||i.call(n,e,t)}async execute(e,t){const n=(new Date).toISOString();if(this.active)return ke({request:e,status:"failed",started_at:n,message:"Another Aurora action is already active.",policy_decision_id:t,error:{code:"AURORA_ACTION_ALREADY_RUNNING",message:"Another action is active.",changed:!1},recoverability:"retry"});const i=new AbortController;this.active={controller:i,interrupted_by_user:!1};let a,r=null,s=null,o=()=>{};try{var c,d,u,m;if(!l.UZ.includes(e.action_type)&&"undo"!==e.action_type)throw new ye("AURORA_ACTION_NOT_GENER
2IC","This action must use a typed server command.","none");if(this.lifecycle("locating","Locating the target"),"navigate"!==e.action_type){var p,h;const i=ue(this.options.registry,e,this.refresh);if("stale"===i.status)return this.lifecycle("stale",i.message),ke({request:e,status:"stale",started_at:n,message:i.message,policy_decision_id:t,new_snapshot_version:this.options.registry.version,error:{code:i.error_code,message:i.message,changed:!1},recoverability:"reobserve"});if(r=i.entry,"prohibited"===r.semantic.risk||!r.semantic.supported_actions.includes(e.action_type))return this.lifecycle("denied","The target does not permit this action"),ke({request:e,status:"denied",started_at:n,message:"This target does not permit the requested action.",policy_decision_id:t,error:{code:"AURORA_TARGET_ACTION_DENIED",message:"The target is protected.",changed:!1}});if(r.semantic.state.disabled||r.semantic.state.read_only&&["fill","replace","select"].includes(e.action_type))return ke({request:e,status:"denied",started_at:n,message:"The target is disabled or read-only.",policy_decision_id:t,error:{code:"AURORA_TARGET_DISABLED",message:"The target is unavailable.",changed:!1}});null===(p=this.options.hooks)||void 0===p||null===(h=p.on_target)||void 0===h||h.call(p,r)}const _=V();o=(this.options.listen_for_takeover||pe)({target:(null===(c=r)||void 0===c?void 0:c.element)||null,scope:_.root,on_takeover:()=>{this.active&&(this.active.interrupted_by_user=!0,this.active.controller.abort())}});const y={signal:i.signal,reduced_motion:this.options.reduced_motion(),report_progress:(e,t)=>{var n,i;return null===(n=this.options.hooks)||void 0===n||null===(i=n.on_progress)||void 0===i?void 0:i.call(n,e,t)},set_preview:(e,t)=>{var n,i;return null===(n=this.options.hooks)||void 0===n||null===(i=n.on_preview)||void 0===i?void 0:i.call(n,e,t)},navigate:this.options.navigate,resolve_resource:this.options.resolve_resource};var v;if(["fill","replace","select"].includes(e.action_type))this.lifecycle("previewing",`Previewing ${(null===(v=r)||void 0===v?void 0:v.semantic.accessible_name)||"the change"}`);this.lifecycle("executing",`Aurora is ${e.action_type.replace("_"," ")}`);const b="page_changed"===e.expected_postcondition.kind?ge(this.options.registry,this.options.route()):void 0;if("read"===e.action_type&&r&&!r.semantic.resource_id){const e=L(r.element,this.options.registry.observationOptions),t=r.semantic.metadata.readable_text_hash;if(t&&t!==e.content_hash)throw new ye("AURORA_READ_CHANGED","The page text changed. Read a fresh observation before continuing.","reobserve");a={target_id:r.semantic.element_id,route:this.options.route(),...e}}const w=(null===(d=r)||void 0===d?void 0:d.element.closest("[data-aurora-persistence-state]"))||null,x={host:w,revision:null===w||void 0===w?void 0:w.dataset.auroraPersistenceRevision},k=r?this.options.adapters.find(r):null;if(k&&r&&(s=await k.execute(r.element,e,y)),null!==(u=s)&&void 0!==u&&u.handled||(s=await this.executeNative(e,r,y)),null!==(m=s)&&void 0!==m&&m.undo&&s.undo_postcondition&&r&&this.undoHistory.set(r.semantic.element_id,{target_fingerprint:r.semantic.fingerprint,target_name:r.semantic.accessible_name,expected_postcondition:s.undo_postcondition,undo:s.undo,can_undo:s.can_undo}),i.signal.aborted)throw new DOMException("Aurora action cancelled","AbortError");if(!s.handled)throw new ye("AURORA_ADAPTER_REQUIRED",s.message||"This component requires a registered adapter.","retry");if(s.changed&&r&&(this.lifecycle("verifying","Waiting for the page change to save"),await async function(e,t){var n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:15e3,a=arguments.length>3?arguments[3]:void 0;const r=(null===a||void 0===a?void 0:a.host)||e.closest("[data-aurora-persistence-state]");if(!r)return;const s="explicit"===r.dataset.auroraPersistenceMode,o=s&&"save"===e.getAttribute("data-aurora-persistence-action"),l=null!==(n=null===a||void 0===a?void 0:a.revision)&&void 0!==n?n:r.dataset.auroraPersistenceRevision;let c=be.has(r.dataset.auroraPersistenceState||"");await new Promise((e,n)=>{let a=!1;const d=i=>{a||(a=!0,m.disconnect(),window.clearTimeout(h),t.removeEventListener("abort",p),i?n(i):e())},u=()=>{if(t.aborted)return void d(new DOMException("Aurora action cancelled","AbortError"));const e=r.dataset.auroraPersistenceState||"";if(be.has(e)&&(c=!0),we.has(e))d(new ye(`AURORA_PERSISTENCE_${e.toUpperCase()}`,`The page change is applied locally, but saving reported ${e}. Undo remains available.`,"undo",!0));else{if(o){const t=r.dataset.auroraPersistenceRevision;return void("saved"===e&&void 0!==l&&void 0!==t&&/^\d+$/.test(l)&&/^\d+$/.test(t)&&Number(t)>Number(l)&&d())}!s||"draft"!==e&&"saved"!==e?"saved"===e&&c&&d():d()}},m=new MutationObserver(u);m.observe(r,{attributes:!0,attributeFilter:["data-aurora-persistence-state","data-aurora-persistence-revision"]});const p=()=>u();t.addEventListener("abort",p,{once:!0});const h=window.setTimeout(()=>d(new ye("AURORA_PERSISTENCE_TIMEOUT","The page change is applied locally, but Aurora could not verify that it was saved. Undo remains available.","undo",!0)),i);window.setTimeout(u,0)})}(r.element,i.signal,15e3,x),i.signal.aborted))throw new DOMException("Aurora action cancelled","AbortError");
2if(this.lifecycle("verifying","Verifying the result"),i.signal.aborted)throw new DOMException("Aurora action cancelled","AbortError");const A=await(async e=>{var t;const n=null!==(t=e.timeout_ms)&&void 0!==t?t:0,i=Date.now();let a=null;for(;;){var r,s;if(null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new DOMException("Aurora action cancelled","AbortError");const t=await fe({...e,route:"function"===typeof e.route?e.route():e.route});if(null!==(s=e.signal)&&void 0!==s&&s.aborted)throw new DOMException("Aurora action cancelled","AbortError");if(t.passed){if(null===a&&(a=Date.now()),"route"!==e.postcondition.kind||0===n||Date.now()-a>=120)return t}else a=null;if(Date.now()-i>=n)return t;await new Promise(e=>window.setTimeout(e,40))}})({postcondition:e.expected_postcondition,page_before:b,registry:this.options.registry,adapters:this.options.adapters,refresh:this.refresh,route:this.options.route,target:r,signal:i.signal,timeout_ms:"route"===e.expected_postcondition.kind?8e3:["click","open","press","select"].includes(e.action_type)?1600:0});if(i.signal.aborted)throw new DOMException("Aurora action cancelled","AbortError");if(!A.passed){if(s.undo)try{await s.undo(),r&&this.undoHistory.delete(r.semantic.element_id),s.changed=!1}catch{throw new ye("AURORA_ROLLBACK_FAILED","The result could not be verified and Aurora could not roll the change back.","undo",!0)}throw new ye("AURORA_POSTCONDITION_FAILED",A.message,"reobserve",Boolean(s.changed))}var g,f;if(s.undo&&r)null===(g=this.options.hooks)||void 0===g||null===(f=g.on_undo)||void 0===f||f.call(g,{action_id:e.action_id,target_name:r.semantic.accessible_name,undo:s.undo});const j="page_changed"===e.expected_postcondition.kind?A.message:s.message||"The action completed and was verified.";return this.lifecycle("succeeded",j),ke({request:e,status:"succeeded",started_at:n,message:j,policy_decision_id:t,new_snapshot_version:this.options.registry.version,verification:A,observation:a,recoverability:s.undo?"undo":"none"})}catch(R){var _,y;const i=Boolean(null===(_=this.active)||void 0===_?void 0:_.interrupted_by_user);if("AbortError"===(null===R||void 0===R?void 0:R.name)){var b,w,x,k,A,j;const a=i?"interrupted_by_user":"cancelled",o=i?"Aurora stopped because you took over. Your input was preserved.":"Aurora stopped the action.";this.lifecycle(a,o);const l=Boolean((null===(b=s)||void 0===b?void 0:b.undo)&&(null===(w=null===(x=(k=s).can_undo)||void 0===x?void 0:x.call(k))||void 0===w||w));var S,C;if(!l&&r&&this.undoHistory.delete(r.semantic.element_id),l&&null!==(A=s)&&void 0!==A&&A.undo&&r)null===(S=this.options.hooks)||void 0===S||null===(C=S.on_undo)||void 0===C||C.call(S,{action_id:e.action_id,target_name:r.semantic.accessible_name,undo:s.undo});return ke({request:e,status:a,started_at:n,message:o,policy_decision_id:t,new_snapshot_version:this.options.registry.version,error:{code:i?"AURORA_INT
2ERRUPTED_BY_USER":"AURORA_ACTION_CANCELLED",message:o,changed:Boolean(null===(j=s)||void 0===j?void 0:j.changed)},recoverability:l?"undo":"retry"})}const a=R instanceof ye?R:new ye(/^[A-Z0-9_]+$/.test(String((null===R||void 0===R?void 0:R.code)||""))?String(R.code):"AURORA_EXECUTION_FAILED",(null===R||void 0===R?void 0:R.message)||"The action failed.");return this.lifecycle("failed",a.message),ke({request:e,status:"failed",started_at:n,message:a.message,policy_decision_id:t,new_snapshot_version:this.options.registry.version,error:{code:a.code,message:a.message,changed:a.changed||Boolean(null===(y=s)||void 0===y?void 0:y.changed)},recoverability:a.recoverability})}finally{var I,E;o(),null===(I=this.options.hooks)||void 0===I||null===(E=I.on_preview)||void 0===E||E.call(I,null),this.active=null}}async executeNative(e,t,n){if("navigate"===e.action_type){const t=xe(e.parameters.route);if(!t)throw new ye("AURORA_ROUTE_INVALID","Aurora can only navigate to a safe EduMark route.","none");return n.navigate(t),await Promise.resolve(),await new Promise(e=>window.setTimeout(e,0)),{handled:!0,message:`Opened ${t}.`}}if(!t)return{handled:!1};const i=t.element;var a;if("read"!==e.action_type&&"scroll"!==e.action_type&&(null===(a=i.scrollIntoView)||void 0===a||a.call(i,{block:"nearest",inline:"nearest",behavior:n.reduced_motion?"auto":"smooth"}),await Promise.resolve(),!$(i)))throw new ye("AURORA_TARGET_NOT_VISIBLE","The target is not visible.","reobserve");switch(e.action_type){case"undo":{const e=this.undoHistory.get(t.semantic.element_id);if(!e||e.target_fingerprint!==t.semantic.fingerprint)throw new ye("AURORA_UNDO_STALE","Undo is no longer available for this target.","none");return await e.undo(),this.undoHistory.delete(t.semantic.element_id),{handled:!0,changed:!0,message:`Undid Aurora's change to ${t.semantic.accessible_name}.`}}case"focus":return i.focus({preventScroll:!0}),{handled:!0,message:`Focused ${t.semantic.accessible_name}.`};case"click":if(i instanceof HTMLAnchorElement){const e=xe(i.getAttribute("href"));if(!e)throw new ye("AURORA_ROUTE_INVALID","Aurora cannot open an external or unsafe link.","none");return n.navigate(e),{handled:!0,message:`Opened ${t.semantic.accessible_name}.`}}return i.click(),{handled:!0,changed:!0,message:`Activated ${t.semantic.accessible_name}.`};case"open":if(i instanceof HTMLAnchorElement){const e=xe(i.getAttribute("href"));if(!e)throw new ye("AURORA_ROUTE_INVALID","Aurora cannot open an external or unsafe link.","none");return n.navigate(e),await Promise.resolve(),{handled:!0,message:`Opened ${t.semantic.accessible_name}.`}}throw new ye("AURORA_ADAPTER_REQUIRED","Opening this target requires an explicit component adapter.","none");case"press":{const n=e.parameters.key;if(!n||!_e.has(n))throw new ye("AURORA_KEY_DENIED","That key is not permitted.","none");if("Backspace"===n||"Delete"===n)throw new ye("AURORA_ADAPTER_REQUIRED","Editing keys require a controlled component adapter.","none");if("Tab"===n){const e=Array.from(V().root.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>$(e)),t=e.indexOf(i),n=e[t<0||t===e.length-1?0:t+1];if(!n)throw new ye("AURORA_KEY_DENIED","There is no safe next focus target.","none");return n.focus({preventScroll:!0}),{handled:!0,message:"Moved focus to the next control."}}if("Enter"===n||"Escape"===n)throw new ye("AURORA_ADAPTER_REQUIRED","Activating or dismissing keys require a role-specific component adapter.","none");if(!["combobox","listbox","option","tab","treeitem"].includes(t.semantic.role))throw new ye("AURORA_KEY_DENIED","This target does not support safe directional key navigation.","none");return i.dispatchEvent(new KeyboardEvent("keydown",{key:n,bubbles:!0,cancelable:!0})),i.dispatchEvent(new KeyboardEvent("keyup",{key:n,bubbles:!0,cancelable:!0})),{handled:!0,changed:!0,message:`Pressed ${n}.`}}case"scroll":{const t=e.parameters.direction||"into_view";if("into_view"===t){var r;null===(r=i.scrollIntoView)||void 0===r||r.call(i,{block:"center",inline:"nearest",behavior:n.reduced_motion?"auto":"smooth"})}else{const a=e.parameters.amount||Math.max(160,Math.round(.6*window.innerHeight)),r=(e=>{let t=e;for(;t;){const e=window.getComputedStyle(t);
2if(/(auto|scroll)/.test(`${e.overflow} ${e.overflowY} ${e.overflowX}`)&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth))return t;t=t.parentElement}return window})(i),s="left"===t?-a:"right"===t?a:0,o="up"===t?-a:"down"===t?a:0;r.scrollBy({left:s,top:o,behavior:n.reduced_motion?"auto":"smooth"})}return{handled:!0,message:`Scrolled ${t.replace("_"," ")}.`}}case"read":return e.parameters.resource_id||t.semantic.resource_id?{handled:!0,message:`Located ${t.semantic.accessible_name} for the server-side resource read.`}:{handled:!0,message:`Read ${t.semantic.accessible_name}.`};default:return{handled:!1}}}}var je=n(55507);const Se=new Set(["","dashboard","courses","course","new","create","aurora","assignments","manage","edit","submissions","marking","people","cohorts","migration","data-imports","integrations","organisation","analytics","settings","workspace","billing","support","results","tutorials","security","audit","file-security","plagiarism","upload","communications","conversations","inbox","announcements","live","sessions","profile"]),Ce=e=>{let t="/";try{t=new URL(e,"https://edumark.invalid").pathname}catch{t=String(e||"/").split(/[?#]/,1)[0]||"/"}return t.split("/").map(e=>Se.has(e.toLowerCase())?e.toLowerCase():":id").join("/")},Ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,je.Lp)(`aurora_semantic_${e}`,{...t.action_type?{action_type:t.action_type}:{},...t.risk?{risk:t.risk}:{},..."number"===typeof t.risk_tier?{risk_tier:t.risk_tier}:{},...t.route?{route:Ce(t.route)}:{},...t.adapter?{component_adapter:t.adapter}:{},...t.path?{execution_path:t.path}:{},..."number"===typeof t.duration_ms?{duration_ms:Math.max(0,Math.round(t.duration_ms))}:{},..."number"===typeof t.verification_duration_ms?{verification_duration_ms:Math.max(0,Math.round(t.verification_duration_ms))}:{},..."number"===typeof t.retry_count?{retry_count:t.retry_count}:{},...t.policy_denial_code?{policy_denial_code:t.policy_denial_code}:{}})},Ee=e=>{switch(e.action){case"navigate":case"open_creation_flow":return"navigate";case"open_modal":case"open_upload_picker":return"open";case"focus_entity":case"highlight_change":return"focus";case"select_entity":case"set_filter":return"select";case"close_modal":return"press";case"invalidate_view":return"read";case"logout":return"domain_command";default:return"legacy_unknown"}};var Re=n(1401),$e=n(56965),Ne=n(19976),Te=n(3374);const Le={runtime:!1,presence:!1,generic_actions:!1,resource_resolver:!1,typed_commands:!1,legacy_bridge:!1,shadow_mode:!1},Oe=(0,a.createContext)(null),Me=()=>(0,a.useContext)(Oe),Ue=()=>{const e=(0,a.useContext)(Oe);if(!e)throw new Error("useAuroraSemanticRuntime must be used inside AuroraSemanticRuntimeProvider.");return e},Pe=15e5,qe=()=>{try{return"undefined"===typeof window?null:window.sessionStorage}catch{return null}},De=e=>{if(!e||"object"!==typeof e||Array.isArray(e))return!1;const t=e,n=e=>"string"===typeof e&&/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(e);return n(t.action_id)&&n(t.session_id)&&n(t.client_instance_id)&&n(t.cancellation_token)&&"string"===typeof t.action_type&&l.ck.includes(t.action_type)},ze=(e,t)=>{if(!e||"object"!==typeof e||Array.isArray(e))return!1;const n=e;return"1.0"===n.protocol_version&&n.action_id===t.action_id&&n.session_id===t.session_id&&["succeeded","denied","stale","failed","cancelled","interrupted_by_user"].includes(String(n.status))&&"string"===typeof n.completed_at&&Number.isFinite(Date.parse(n.completed_at))&&"string"===typeof n.message&&n.message.length<=2e3&&["none","retry","reobserve","undo"].includes(String(n.recoverability))},Be=(e,t,n)=>{var i,a;if(!e||"object"!==typeof e||Array.isArray(e))return!1;const r=e,s=e=>"string"===typeof e&&/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(e),o=r.constraints;if(!o||"object"!==typeof o||Array.isArray(o))return!1;const l=o.route,c=o.scope_id,d=o.frame_origin,u=o.action_fingerprint,m=Date.parse(String(r.issued_at||"")),p=Date.parse(String(r.expires_at||""));return"1.0"===r.protocol_version&&s(r.envelope_id)&&r.action_id===t.action_id&&r.session_id===t.session_id&&r.actor_id===n.actor_id&&r.org_id===n.org_id&&(null!==(i=r.centre_id)&&void 0!==i?i:"")===(null!==(a=n.centre_id)&&void 0!==a?a:"")&&r.client_instance_id===t.client_instance_id&&r.client_instance_id===n.client_instance_id&&r.action_type===t.action_type&&Number.isInteger(r.snapshot_version)&&Number(r.snapshot_version)>=1&&s(r.policy_decision_id)&&s(r.nonce)&&"string"===typeof r.signature&&/^[a-f0-9]{64,128}$/.test(r.signature)&&"string"===typeof l&&l.startsWith("/")&&!l.startsWith("//")&&s(c)&&d===n.frame_origin&&"string"===typeof u&&/^[a-f0-9]{64}$/.test(u)&&Number.isFinite(m)&&Number.isFinite(p)&&p>m},Fe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;return String(e||"").replace(/\s+/g," ").trim().slice(0,t)},We=e=>{if(null===e||void 0===e||!e.element.isConnected)return null;const t=e.element.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}},He=e=>{let{children:t,actor_id:n,actor_role:d,org_id:u,centre_id:m,scope_key:p}=e;const h=(0,r.zy)(),v=(0,r.Zp)(),g=(0,a.useRef)(v);g.current=v;const f=`${h.pathname}${h.search}${h.hash}`||"/",_=(0,a.useRef)(f);_.current=f;const y=(0,a.useMemo)(()=>{return e=n,t=u,i=m,(0,c.f)(JSON.stringify([String(e||""),String(t||""),String(i||"")])).slice(0,32);var e,t,i},[n,m,u]),b=(0,a.useMemo)(()=>(e=>{const t=`edumark.aurora.semantic.client.${e}`,n=qe();try{const e=null===n||void 0===n?void 0:n.getItem(t);if(e&&/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(e))return e;const i=z("client");return null===n||void 0===n||n.setItem(t,i),i}catch{return z("client")}})(y),[y]),w=(0,a.useMemo)(()=>`edumark.aurora.semantic.settlements.${y}`,[y]),[x]=(0,a.useState)(()=>new D),[k]=(0,a.useState)(()=>new de),[A]=(0,a.useState)(()=>new G(x,k)),[j]=(0,a.useState)(()=>new D({read_behind_aurora:!0}
2)),[S]=(0,a.useState)(()=>new G(j,k)),C=(0,a.useRef)(new Set),[I,E]=(0,a.useState)(null),[R,$]=(0,a.useState)(null),[N,T]=(0,a.useState)(Ne.JG),[L,O]=(0,a.useState)(!1),[M,U]=(0,a.useState)([]),[P,q]=(0,a.useState)(!1),B=(0,a.useCallback)(()=>{O(!0),T(e=>({...e,target_geometry:null,preview_text:null}))},[]),F=(0,Ne.Sk)(N)&&!L;(0,a.useEffect)(()=>{F||T(e=>e.target_geometry||e.preview_text?{...e,last_target_geometry:"active"===e.plan_status?e.target_geometry||e.last_target_geometry:null,target_geometry:null,preview_text:null}:e)},[F]);const W=(0,i.b)(),H=(0,a.useRef)(null),Y=(0,a.useRef)(p),K=(0,a.useRef)(null),X=(0,a.useRef)(null),Z=(0,a.useRef)(null),Q=(0,a.useRef)(null),ee=(0,a.useRef)(new Set),te=(0,a.useRef)(new Set),ne=(0,a.useRef)(new Set),ie=(0,a.useRef)(new Map),ae=(0,a.useRef)(async()=>{}),re=(0,a.useRef)(Promise.resolve()),se=(0,a.useRef)(!1),oe=(0,a.useRef)(P),le=(0,a.useRef)(null),ce=(0,a.useRef)(Promise.resolve()),me=(0,a.useRef)(`${p}|${f}`),pe=(0,a.useRef)(w),he=(0,a.useRef)(null);oe.current=P;const ve=(0,a.useCallback)(()=>{const e=qe();if(e)try{const t=Array.from(ie.current.values()).slice(-4).map(e=>{let{action:t,envelope:n,result:i,risk:a,risk_tier:r,attempts:s}=e;return{action_identity:{action_id:t.action_id,session_id:t.session_id,client_instance_id:t.client_instance_id,action_type:t.action_type,cancellation_token:t.cancellation_token},envelope:n,result:i,...a?{risk:a}:{},..."number"===typeof r?{risk_tier:r}:{},attempts:s}});if(0===t.length)return void e.removeItem(w);const n={version:1,client_instance_id:b,entries:t},i=JSON.stringify(n);i.length<=Pe&&e.setItem(w,i)}catch{}},[b,w]),ge=(0,a.useMemo)(()=>I?(0,o.E0)(I.features,I.rollout_constraints,f):Le,[I,f]),fe=(0,a.useRef)(I);fe.current=I;const _e=(0,a.useRef)(ge);_e.current=ge;const ye=(0,a.useCallback)(async()=>{if(!H.current){const e=p;H.current=(0,s.vl)().then(t=>{if("1.0"!==t.protocol_version)throw new Error("Aurora semantic protocol negotiation failed.");return Y.current===e&&E(t),t}).catch(t=>{throw Y.current===e&&(H.current=null),t})}return H.current},[p]),be=(0,a.useCallback)(async()=>{const e=Y.current;fe.current&&!_e.current.runtime&&(H.current=null);const t=await ye();return Y.current===e&&(0,o.E0)(t.features,t.rollout_constraints,_.current).runtime},[ye]);se.current=W;const we=(0,a.useCallback)(()=>({route:_.current,client_instance_id:b,actor_id:n,actor_role:d,org_id:u,centre_id:m}),[n,d,m,b,u]),xe=(0,a.useCallback)(e=>(C.current.add(e),()=>{C.current.delete(e)}),[]);(0,a.useEffect)(()=>S.observeInvalidation(()=>{C.current.forEach(e=>e())}),[S]),(0,a.useEffect)(()=>{C.current.forEach(e=>e())},[f]);const ke=(0,a.useCallback)(async(e,t)=>{if(!e.trim()||!n||!u||null!==t&&void 0!==t&&t.aborted)return null;const i=y,a=re.current;return t?await new Promise((e,n)=>{const i=()=>{t.removeEventListener("abort",i),n(new DOMException("Page observation cancelled","AbortError"))};t.aborted?i():(t.addEventListener("abort",i,{once:!0}),a.then(()=>{t.removeEventListener("abort",i),e()},e=>{t.removeEventListener("abort",i),n(e)}))}):await a,await J(t,1500,j.observationOptions),null!==t&&void 0!==t&&t.aborted||pe.current!==`edumark.aurora.semantic.settlements.${i}`?null:S.create(we())},[n,S,j,u,we,y]),je=(0,a.useCallback)(()=>{const e=V(),t=x.observe(e.root,e.additional_roots);for(const n of t){const e=k.observe(n);n.semantic={...n.semantic,...e,state:{...n.semantic.state,...e.state||{}},metadata:{...n.semantic.metadata,...e.metadata||{}}}}},[k,x]),Se=(0,a.useCallback)(()=>{if("undefined"===typeof document||!document.body)return null;const e=A.create(we());return X.current=e,$(e),e},[A,we]),Ce=(0,a.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=Y.current;if(t&&await J(),K.current!==e||Y.current!==n)throw new Error("The authenticated task context changed before observing the page.");const i=Se();if(!i)throw new Error("The page is not available for semantic observation.");const a=await(0,s.gV)(e,i);if(K.current!==e||Y.current!==n||_.current!==i.route)throw new Error("The page changed while registering its observation.");return X.current=a,$(a),a},[Se]);(0,a.useLayoutEffect)(()=>{var e,t;const i=`${p}|${f}`,a=K.current,r=Z.current||(null===(e=Q.current)||void 0===e?void 0:e.action)||null,l=(null===r||void 0===r?void 0:r.cancellation_token)||z("cancel"),c=Y.current===p&&pe.current===w,h=me.current!==i;if(c&&h){var v;const e=Q.current;if(me.current=i,X.current=null,$(null),Q.current=null,T(e=>({...e,confirmation:null,...a?{status_label:"Reading the next page",announcement:"Aurora is reading the next page."}:{}})),null===(v=le.current)||void 0===v||!v.running){const t=async()=>{await J(),me.current===i&&(a&&K.current===a?(await Ce(a),e&&await(0,s.fx)({session_id:a,action_id:e.action.action_id,decision_id:e.decision.decision_id,client_instance_id:b,
2snapshot_version:e.action.snapshot_version,target_fingerprint:e.action.target_fingerprint,confirmed:!1})):Se())};ce.current=t().catch(()=>{})}return}Y.current=p,me.current=i,H.current=null,E(null),null===(t=le.current)||void 0===t||t.cancel(),K.current=null,Z.current=null,Q.current=null,X.current=null,$(null),ee.current.clear(),te.current.clear(),ne.current.clear(),T(Ne.JG);ce.current=(async()=>{if(a&&await(0,s.$h)({session_id:a,client_instance_id:b,cancellation_token:l,reason:"Aurora authenticated scope changed"}).catch(()=>{}),me.current!==i)return;const e=await ye().catch(()=>null);if(me.current===i)if(e){if((0,o.E0)(e.features,e.rollout_constraints,f).runtime&&document.body){const e=A.create({route:f,client_instance_id:b,actor_id:n,actor_role:d,org_id:u,centre_id:m});X.current=e,$(e)}}else E(null)})()},[n,d,m,b,ye,u,A,f,p,w,Ce,Se]);const Me=(0,a.useCallback)((e,t)=>{T(n=>({...n,lifecycle:e,status_label:t,announcement:t,steps:n.action_id?[...n.steps.filter(e=>e.id!==n.action_id),{id:n.action_id,label:t,status:"succeeded"===e?"complete":["failed","denied","stale","cancelled","interrupted_by_user"].includes(e)?"failed":"active"}]:n.steps}))},[]),Ue=(0,a.useMemo)(()=>new Ae({registry:x,adapters:k,navigate:(e,t)=>g.current(e,t),route:()=>_.current,reduced_motion:()=>se.current||oe.current,resolve_resource:async()=>{throw new Error("Resource reads are executed once by the server-side semantic broker.")},hooks:{on_lifecycle:Me,on_target:e=>T(t=>({...t,target_id:(null===e||void 0===e?void 0:e.semantic.element_id)||null,target_name:(null===e||void 0===e?void 0:e.semantic.accessible_name)||null,target_geometry:We(e)})),on_preview:(e,t)=>T(n=>({...n,preview_text:e,..."number"===typeof t?{progress:t}:{}})),on_progress:(e,t)=>T(n=>({...n,progress:e,...t?{status_label:t,announcement:t}:{}})),on_undo:e=>{let{target_name:t}=e;return T(e=>({...e,undo_available:!0,undo_label:`Undo change to ${t}`}))}}}),[k,x,Me]);le.current=Ue,(0,a.useEffect)(()=>{if(ge.runtime)return A.observeInvalidation(()=>{var e,t;const n=(null===(e=le.current)||void 0===e?void 0:e.latestUndo())||null;T(e=>({...e,undo_available:Boolean(n),undo_label:n?`Undo change to ${n.target_name}`:null}));const i=null===(t=Z.current)||void 0===t?void 0:t.target_id;if(!i||!F)return;const a=x.peek(i);null!==a&&void 0!==a&&a.element.isConnected&&T(e=>({...e,target_geometry:We(a)}))})},[ge.runtime,F,A,x]),(0,a.useEffect)(()=>{const e=N.target_id;if(!e||!F)return;const t=x.peek(e);if(null===t||void 0===t||!t.element.isConnected)return;const n=()=>T(e=>({...e,target_geometry:We(t)})),i="function"===typeof ResizeObserver?new ResizeObserver(n):null;return null===i||void 0===i||i.observe(t.element),window.addEventListener("resize",n,{passive:!0}),window.addEventListener("scroll",n,{passive:!0,capture:!0}),()=>{null===i||void 0===i||i.disconnect(),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[N.target_id,F,x]);const He=(0,a.useCallback)(e=>{U(t=>{var n,i;return[...t,{id:e.semantic_event_id||`${e.kind}:${e.semantic_sequence||e.sequence||Date.now()}:${(null===(n=e.action_request)||void 0===n?void 0:n.action_id)||""}`,kind:e.kind,timestamp:e.semantic_timestamp||e.timestamp||(new Date).toISOString(),...null!==(i=e.action_request)&&void 0!==i&&i.action_id?{action_id:e.action_request.action_id}:{},message:Fe(e.semantic_message||e.message||e.status_label||e.kind,500)}].slice(-80)})},[]),Ve=(0,a.useCallback)(e=>{var t;if(e.target_id)return x.peek(e.target_id);const n=e.parameters.resource_id;if(!n)return null;const i=((null===(t=X.current)||void 0===t?void 0:t.elements)||[]).filter(e=>e.resource_id===n);return 1!==i.length?null:x.peek(i[0].element_id)},[x]),Ye=(0,a.useCallback)(async e=>{const t=ie.current.get(e);if(!(!t||t.in_flight||t.attempts>=6)){t.in_flight=!0,null!==t.timer&&(window.clearTimeout(t.timer),t.timer=null);try{var n,i;const r=await(0,s.G9)(t.action.session_id,t.action.action_id,b,t.envelope,t.result);ie.current.delete(e),ve();const o=r.result||t.result,l=(null===(n=le.current)||void 0===n?void 0:n.latestUndo())||null;var a;if(T(e=>({...e,lifecycle:o.status,plan_status:"interrupted_by_user"===o.status?"cancelled":e.plan_status,last_result:o,status_label:o.message,announcement:`${o.message} The action audit is recorded.`,progress:"succeeded"===o.status?100:e.progress,undo_available:Boolean(l),undo_label:l?`Undo change to ${l.target_name}`:null})),(null===(i=Z.current)||void 0===i?void 0:i.action_id)===e&&(Z.current=null),!ne.current.has(e))ne.current.add(e),Ie("succeeded"===o.status&&"undo"===t.action.action_type?"undone":"AURORA_ROLLBACK_FAILED"===(null===(a=o.error)||void 0===a?void 0:a.code)?"rollback_failed":"succeeded"===o.status?"succeeded":"stale"===o.status?"stale_target":"interrupted_by_user"===o.status?"interrupted_by_user":"cancelled"===o.status?"cancelled":"failed",{action_type:t.action.action_type,risk:t.risk,risk_tier:t.risk_tier,route:_.current,path:"generic"});"interrupted_by_user"===o.status&&await(0,s.$h)({session_id:t.action.session_id,client_instance_id:b,cancellation_token:t.action.cancellation_token,reason:"The user took over the active semantic scope"}).catch(()=>{})}catch{if(t.in_flight=!1,t.attempts+=1,t.attempts<6){const n=Math.min(16e3,1e3*2**Math.max(0,t.attempts-2));t.timer=window.setTimeout(()=>{ae.current(e)},n)}else T(e=>({...e,lifecycle:"failed",plan_status:"failed",status_label:"The page change is applied, but its action audit could not reconnect. Undo remains available.",announcement:"Aurora could not reconnect to record the applied change. Undo remains available."}));ve()}}},[b,ve]);ae.current=Ye,(0,a.useEffect)(()=>{const e=ie.current,t=()=>{H.current=null,ye().catch(()=>{});for(const[e,t]of ie.current.entries())t.attempts=Math.min(t.attempts,5),ae.current(e);ve()};return window.addEventListener("online",t),()=>{window.removeEventListener("online",t),ve();for(const t of e.values())null!==t.timer&&window.clearTimeout(t.timer)}},[ye,ve]),(0,a.useEffect)(()=>
2{if(pe.current!==w){for(const e of ie.current.values())null!==e.timer&&window.clearTimeout(e.timer);ie.current.clear(),pe.current=w,he.current=null}if(!n||!u||he.current===w)return;he.current=w;const e=qe();let t=null;try{const n=null===e||void 0===e?void 0:e.getItem(w);n&&n.length<=Pe&&(t=JSON.parse(n))}catch{t=null}if(!t||"object"!==typeof t||Array.isArray(t))return;const i=t;if(1!==i.version||i.client_instance_id!==b||!Array.isArray(i.entries)||i.entries.length>4)try{null===e||void 0===e||e.removeItem(w)}catch{}else{for(const e of i.entries)e&&"object"===typeof e&&De(e.action_identity)&&ze(e.result,e.action_identity)&&Be(e.envelope,e.action_identity,{actor_id:n,org_id:u,centre_id:m,client_instance_id:b,frame_origin:window.location.origin})&&ie.current.set(e.action_identity.action_id,{action:e.action_identity,envelope:e.envelope,result:e.result,risk:["read","reversible","consequential","prohibited"].includes(String(e.risk))?e.risk:void 0,risk_tier:Number.isInteger(e.risk_tier)&&Number(e.risk_tier)>=0&&Number(e.risk_tier)<=5?e.risk_tier:void 0,attempts:Math.min(Number.isInteger(e.attempts)?Number(e.attempts):0,5),in_flight:!1,timer:null});if(ve(),!1!==navigator.onLine)for(const e of ie.current.keys())window.setTimeout(()=>{ae.current(e)},0)}},[n,m,b,u,ve,w]);const Ge=(0,a.useCallback)(async(e,t,i)=>{var a,r,o;if(ee.current.has(e.action_id))return;if("resource_read"===e.action_type||"domain_command"===e.action_type||"observe"===e.action_type)return;ee.current.add(e.action_id);const c=X.current,d=K.current,p=_.current,h=V().scope.scope_id,v=Ve(e),g=null===(a=fe.current)||void 0===a?void 0:a.rollout_constraints,f=null!==(r=null!==(o=null===i||void 0===i?void 0:i.risk_tier)&&void 0!==o?o:null===v||void 0===v?void 0:v.semantic.risk_tier)&&void 0!==r?r:5,y=Boolean(g&&(0,l.eR)(g,e.action_type,f)),w=!c||c.route!==p||c.scope.scope_id!==h,k=(0,l.S9)(t,e,{actor_id:n||"",org_id:u||"",centre_id:m,client_instance_id:b,session_id:d||"",snapshot_version:(null===c||void 0===c?void 0:c.snapshot_version)||0,current_route:p,current_scope_id:h,current_frame_origin:window.location.origin});if((0,l.WE)(e)&&d===e.session_id&&_e.current.generic_actions&&y&&(w||(null===c||void 0===c?void 0:c.snapshot_version)!==e.snapshot_version))try{await Ce(d);const n=await(0,s.xC)(d,e.action_id,b,t);var A;if("executing"===n.status)await(0,s.G9)(d,e.action_id,b,n.envelope||t,{protocol_version:"1.0",session_id:d,action_id:e.action_id,status:"stale",started_at:(new Date).toISOString(),completed_at:(new Date).toISOString(),message:"The page changed before the action could start. Aurora will observe the current page.",policy_decision_id:(null===(A=n.policy_decision)||void 0===A?void 0:A.decision_id)||t.policy_decision_id,error:{code:"AURORA_TARGET_STALE",message:"The previous page observation is stale.",changed:!1},recoverability:"reobserve"});return void T(e=>({...e,lifecycle:"stale",plan_status:"active",status_label:"Reading the current page",announcement:"The page changed. Aurora is reading it again."}))}catch{}if(!(0,l.WE)(e)||!d||w||e.session_id!==d||!_e.current.generic_actions||!y||!k.valid){const t=_e.current.generic_actions&&y?w?"The page changed after Aurora observed it. Aurora must re-observe before acting.":k.valid?"The action request did not match this semantic session.":k.message:"Semantic browser actions are disabled for this workspace.";if(T(e=>({...e,lifecycle:"denied",status_label:t,announcement:t,plan_status:"failed"})),d&&(0,l.WE)(e)){var j;await(0,s.$h)({session_id:d,client_instance_id:b,cancellation_token:e.cancellation_token,reason:"Client rejected an invalid or mismatched authorization"}).then(()=>!0).catch(()=>!1)&&(null===(j=Z.current)||void 0===j?void 0:j.action_id)===e.action_id&&(Z.current=null)}return Ie("denied",{action_type:e.action_type,route:_.current}),void ne.current.add(e.action_id)}Z.current=e,T(t=>({...t,session_id:d,plan_status:"active",lifecycle:"authorized",action_id:e.action_id,action_type:e.action_type,target_id:e.target_id||null,target_name:(null===v||void 0===v?void 0:v.semantic.accessible_name)||e.target_id||null,target_geometry:We(v),risk:(null===i||void 0===i?void 0:i.risk)||(null===v||void 0===v?void 0:v.semantic.risk)||null,status_label:`Authorized ${e.action_type.replace("_"," ")}`,announcement:`Aurora is ready to ${e.action_type.replace("_"," ")}.`,confirmation:null,progress:null})),Ie("authorized",{action_type:e.action_type,risk:null===i||void 0===i?void 0:i.risk,risk_tier:null===i||void 0===i?void 0:i.risk_tier,route:_.current,adapter:(null===v||void 0===v?void 0:v.adapter_id)||null,path:"generic"});let S=!1,C=null,I=e,E=t,R=i;try{var $,N,L,O,M,U;const a=await(0,s.xC)(d,e.action_id,b,t);if(K.current!==d)return;if("executing"!==a.status){var P;
2S=!0,"stale"===a.status&&await Ce(d).catch(()=>{});const t=(null===(P=a.result)||void 0===P?void 0:P.message)||`Aurora did not start the ${e.action_type.replace("_"," ")} action.`;return T(e=>({...e,lifecycle:a.status,last_result:a.result||e.last_result,status_label:t,announcement:t})),Ie("stale"===a.status?"stale_target":"denied",{action_type:e.action_type,route:_.current,path:"generic"}),void ne.current.add(e.action_id)}const r=a.action,o=a.envelope,p=a.policy_decision||i,h=null!==r&&void 0!==r&&r.target_id?x.peek(r.target_id):null,v=null!==($=null!==(N=null!==(L=null===p||void 0===p?void 0:p.risk_tier)&&void 0!==L?L:a.risk_tier)&&void 0!==N?N:null===h||void 0===h?void 0:h.semantic.risk_tier)&&void 0!==$?$:5,f=Boolean(g&&r&&(0,l.eR)(g,r.action_type,v)),y=r&&o?(0,l.S9)(o,r,{actor_id:n||"",org_id:u||"",centre_id:m,client_instance_id:b,session_id:d,snapshot_version:c.snapshot_version,current_route:_.current,current_scope_id:V().scope.scope_id,current_frame_origin:window.location.origin}):{valid:!1,error_code:"AURORA_START_RESPONSE_INVALID",message:"The action start response was invalid."},w=null===o||void 0===o?void 0:o.constraints,k=r&&o&&w?(0,l.S9)(o,r,{actor_id:n||"",org_id:u||"",centre_id:m,client_instance_id:b,session_id:d,snapshot_version:r.snapshot_version,current_route:"string"===typeof w.route?w.route:"",current_scope_id:"string"===typeof w.scope_id?w.scope_id:"",current_frame_origin:window.location.origin}):{valid:!1,error_code:"AURORA_START_RESPONSE_INVALID",message:"The action start response was invalid."};if(!r||!(0,l.WE)(r)||!o||!y.valid||r.action_id!==e.action_id||r.session_id!==d||r.client_instance_id!==b||!f){if(Boolean(r&&(0,l.WE)(r)&&o&&k.valid&&r.action_id===e.action_id&&r.session_id===d&&r.client_instance_id===b)&&r&&o){var q,D;I=r,E=o,R=p,Z.current=I;const e={protocol_version:"1.0",action_id:I.action_id,session_id:I.session_id,status:"failed",completed_at:(new Date).toISOString(),message:"Aurora blocked a canonical action that no longer matched this page or rollout.",policy_decision_id:E.policy_decision_id,error:{code:"AURORA_CANONICAL_ACTION_MISMATCH",message:"The server-bound action was not safe to execute in the current browser context.",changed:!1},recoverability:"reobserve"};C=e;try{await(0,s.G9)(d,I.action_id,b,E,e),S=!0}catch{var z,B;const t={action:I,envelope:E,result:e,risk:null===(z=R)||void 0===z?void 0:z.risk,risk_tier:null===(B=R)||void 0===B?void 0:B.risk_tier,attempts:1,in_flight:!1,timer:null};ie.current.set(I.action_id,t),t.timer=window.setTimeout(()=>{ae.current(I.action_id)},1e3),ve()}return T(t=>({...t,lifecycle:"failed",plan_status:S?"failed":"active",last_result:e,status_label:S?e.message:"No page change was made. Aurora is reconnecting to record the blocked action.",announcement:e.message})),Ie("failed",{action_type:I.action_type,risk:null===(q=R)||void 0===q?void 0:q.risk,risk_tier:null===(D=R)||void 0===D?void 0:D.risk_tier,route:_.current,path:"generic"}),void ne.current.add(I.action_id)}I=e,E=t,R=i,Z.current=I;const n={protocol_version:"1.0",action_id:I.action_id,session_id:I.session_id,status:"failed",completed_at:(new Date).toISOString(),message:"Aurora blocked an invalid action start response. No page change was made.",policy_decision_id:E.policy_decision_id,error:{code:"AURORA_START_RESPONSE_INVALID",message:"The server returned an invalid canonical action after accepting the signed start envelope.",changed:!1},recoverability:"reobserve"};C=n;try{await(0,s.G9)(d,I.action_id,b,E,n),S=!0}catch{var F,W;const e={action:I,envelope:E,result:n,risk:null===(F=R)||void 0===F?void 0:F.risk,risk_tier:null===(W=R)||void 0===W?void 0:W.risk_tier,attempts:1,in_flight:!1,timer:null};ie.current.set(I.action_id,e),e.timer=window.setTimeout(()=>{ae.current(I.action_id)},1e3),ve()}return T(e=>({...e,lifecycle:"failed",plan_status:S?"failed":"active",last_result:n,status_label:S?n.message:"No page change was made. Aurora is reconnecting to record the invalid start response.",announcement:"Aurora blocked an invalid action before it could affect this page."})),Ie("failed",{action_type:e.action_type,route:_.current,path:"generic"}),void ne.current.add(e.action_id)}I=r,E=o,R=p,Z.current=I,T(e=>{var t;return{...e,action_id:I.action_id,action_type:I.action_type,target_id:I.target_id||null,target_name:(null===h||void 0===h?void 0:h.semantic.accessible_name)||I.target_id||null,target_geometry:We(h),risk:(null===(t=R)||void 0===t?void 0:t.risk)||(null===h||void 0===h?void 0:h.semantic.risk)||null}}),Ie("started",{action_type:I.action_type,route:_.current,path:"generic"});let A=await Ue.execute(I,E.policy_decision_id);try{if(K.current!==d&&"succeeded"!==A.status)return;const e=await Ce(d,["navigate","click"].includes(I.action_type)||_.current!==E.constraints.route);A={...A,session_id:d,new_snapshot_version:e.snapshot_version}}catch(Q){A=((e,t,n)=>{var i;return{protocol_version:"1.0",action_id:e.action_id,session_id:e.session_id,status:"failed",started_at:t.started_at,completed_at:(new Date).toISOString(),message:"The page changed, but Aurora could not register the required verification snapshot.",policy_decision_id:t.policy_decision_id,error:{code:"AURORA_POST_ACTION_OBSERVATION_FAILED",message:Fe((null===n||void 0===n?void 0:n.message)||"Post-action observation failed."),changed:"succeeded"===t.status||Boolean(null===(i=t.error)||void 0===i?void 0:i.changed)}
2,recoverability:"undo"===t.recoverability?"undo":"reobserve"}})(I,A,Q)}C=A;let j=null,J=null;for(let e=0;e<2&&!j;e+=1)try{j=await(0,s.G9)(d,I.action_id,b,E,A)}catch(Q){J=Q}if(!j){var H,Y,G;const e={action:I,envelope:E,result:A,risk:null===(H=R)||void 0===H?void 0:H.risk,risk_tier:null===(Y=R)||void 0===Y?void 0:Y.risk_tier,attempts:2,in_flight:!1,timer:null};ie.current.set(I.action_id,e),e.timer=window.setTimeout(()=>{ae.current(I.action_id)},1e3),ve();const t=Ue.latestUndo(),n=Fe((null===(G=J)||void 0===G?void 0:G.message)||"The action result could not be recorded.");return void T(e=>({...e,lifecycle:"executing",plan_status:"active",last_result:A,undo_available:Boolean(t),undo_label:t?`Undo change to ${t.target_name}`:null,status_label:"The page change is applied. Aurora is reconnecting to record its action audit.",announcement:`The page change is applied and preserved. Aurora is reconnecting. ${n}`}))}S=!0;const X=j.result||A,ee=Ue.latestUndo();T(e=>({...e,lifecycle:X.status,last_result:X,status_label:X.message,announcement:X.message,progress:"succeeded"===X.status?100:e.progress,undo_available:Boolean(ee),undo_label:ee?`Undo change to ${ee.target_name}`:null})),"interrupted_by_user"===X.status&&(await(0,s.$h)({session_id:d,client_instance_id:b,cancellation_token:I.cancellation_token,reason:"The user took over the active semantic scope"}).catch(()=>{}),T(e=>({...e,plan_status:"cancelled"}))),Ie("succeeded"===X.status&&"undo"===I.action_type?"undone":"AURORA_ROLLBACK_FAILED"===(null===(O=X.error)||void 0===O?void 0:O.code)?"rollback_failed":"succeeded"===X.status?"succeeded":"stale"===X.status?"stale_target":"interrupted_by_user"===X.status?"interrupted_by_user":"cancelled"===X.status?"cancelled":"failed",{action_type:I.action_type,risk:null===(M=R)||void 0===M?void 0:M.risk,risk_tier:null===(U=R)||void 0===U?void 0:U.risk_tier,route:_.current,path:"generic"}),ne.current.add(I.action_id)}catch(Q){const e=Fe((null===Q||void 0===Q?void 0:Q.message)||"Aurora could not execute the authorized action.");try{await(0,s.$h)({session_id:d,client_instance_id:b,cancellation_token:I.cancellation_token,reason:"Browser action lifecycle could not be settled"}),S=!0}catch{}const t=Ue.latestUndo();T(n=>({...n,lifecycle:"failed",plan_status:S?"cancelled":"failed",last_result:C||n.last_result,undo_available:Boolean(t),undo_label:t?`Undo change to ${t.target_name}`:null,status_label:e,announcement:e})),Ie("failed",{action_type:I.action_type,route:_.current,path:"generic"}),ne.current.add(I.action_id)}finally{var J;S&&(null===(J=Z.current)||void 0===J?void 0:J.action_id)===I.action_id&&(Z.current=null)}},[n,m,b,Ue,u,ve,Ce,x,Ve]),Je=(0,a.useCallback)((e,t,n)=>{re.current=re.current.then(()=>Ge(e,t,n)).catch(()=>{})},[Ge]),Ke=(0,a.useCallback)(e=>{Q.current=e,T(t=>({...t,lifecycle:e?"awaiting_confirmation":t.lifecycle,confirmation:e,...e?{action_id:e.action.action_id,action_type:e.action.action_type,risk:e.decision.risk,target_id:e.action.target_id||null,target_name:e.target_name,status_label:"Confirmation required",announcement:`Confirmation required to ${e.action.action_type.replace("_"," ")} ${e.target_name}.`}:{}}))},[]),Xe=(0,a.useCallback)(e=>{var t,n,i;if("status"===e.kind){const t=Fe(e.status_label||"",120);return void(t&&"thinking"!==t.toLowerCase()&&T(e=>"active"===e.plan_status&&e.status_label!==t?{...e,status_label:t}:e))}if("complete"===e.kind||"error"===e.kind||"cancelled"===e.kind)return Q.current=null,Z.current=null,void T(t=>"active"===t.plan_status||t.confirmation?{...t,plan_status:"complete"===e.kind?"completed":"cancelled"===e.kind?"cancelled":"failed",lifecycle:"active"!==t.plan_status||["succeeded","denied","stale","failed","cancelled","interrupted_by_user"].includes(t.lifecycle)?t.lifecycle:"cancelled"===e.kind?"cancelled":"error"===e.kind?"failed":t.lifecycle,confirmation:null,target_geometry:null,last_target_geometry:null,preview_text:null}:t);if(!(0,l.Rc)(e.kind))return;const a=K.current;if(!a||e.semantic_session_id&&e.semantic_session_id!==a||null!==(t=e.action_request)&&void 0!==t&&t.session_id&&e.action_request.session_id!==a||null!==(n=e.action_result)&&void 0!==n&&n.session_id&&e.action_result.session_id!==a)return;He(e);const r=e.semantic_message||e.message||"",o="number"===typeof e.semantic_progress?e.
2semantic_progress:e.progress,c=e.action_request,d=e.semantic_event_id||`${e.kind}:${e.semantic_sequence||e.sequence||0}:${(null===c||void 0===c?void 0:c.action_id)||(null===(i=e.action_result)||void 0===i?void 0:i.action_id)||""}`,u=!te.current.has(d);if(u&&te.current.add(d),c&&!(0,l.WE)(c)){T(e=>({...e,lifecycle:"denied",status_label:"Invalid semantic action request.",announcement:"Aurora blocked an invalid action request."}));const e=c.cancellation_token,t=K.current;return void(t&&"string"===typeof e&&/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(e)&&(0,s.$h)({session_id:t,client_instance_id:b,cancellation_token:e,reason:"Client rejected a malformed semantic action"}).catch(()=>{}))}if(c&&["aurora.action.planned","aurora.action.authorized","aurora.action.confirmation_required","aurora.action.started","aurora.action.progress"].includes(e.kind)){var m,p,h,v;const t=Ve(c),n=null===(m=fe.current)||void 0===m?void 0:m.rollout_constraints,i=null!==(p=null!==(h=null===(v=e.policy_decision)||void 0===v?void 0:v.risk_tier)&&void 0!==h?h:null===t||void 0===t?void 0:t.semantic.risk_tier)&&void 0!==p?p:5;if(!n||!(0,l.eR)(n,c.action_type,i))return}switch(c&&(Z.current=c),e.kind){case"aurora.plan.started":case"aurora.plan.updated":T(e=>({...e,plan_status:"active",status_label:Fe(r||"Aurora is planning."),announcement:Fe(r||"Aurora is planning.")}));break;case"aurora.action.planned":if(c){var g,f;const t=Ve(c);u&&Ie("requested",{action_type:c.action_type,risk:(null===(g=e.policy_decision)||void 0===g?void 0:g.risk)||(null===t||void 0===t?void 0:t.semantic.risk),risk_tier:(null===(f=e.policy_decision)||void 0===f?void 0:f.risk_tier)||(null===t||void 0===t?void 0:t.semantic.risk_tier),route:_.current,adapter:(null===t||void 0===t?void 0:t.adapter_id)||null}),T(n=>{var i;return{...n,plan_status:"active",lifecycle:"planned",action_id:c.action_id,action_type:c.action_type,target_id:(null===t||void 0===t?void 0:t.semantic.element_id)||c.target_id||null,target_name:(null===t||void 0===t?void 0:t.semantic.accessible_name)||c.target_id||null,target_geometry:We(t),risk:(null===(i=e.policy_decision)||void 0===i?void 0:i.risk)||(null===t||void 0===t?void 0:t.semantic.risk)||null,status_label:Fe(r||`Planning ${c.action_type.replace("_"," ")}`),announcement:Fe(r||`Aurora plans to ${c.action_type.replace("_"," ")}.`)}})}break;case"aurora.action.authorized":if(c&&e.envelope){var y,w;if(u&&["resource_read","domain_command"].includes(c.action_type))Ie("authorized",{action_type:c.action_type,risk:null===(y=e.policy_decision)||void 0===y?void 0:y.risk,risk_tier:null===(w=e.policy_decision)||void 0===w?void 0:w.risk_tier,route:_.current});Je(c,e.envelope,e.policy_decision)}break;case"aurora.action.confirmation_required":if(c&&e.policy_decision){const t=Ve(c);u&&Ie("confirmation_requested",{action_type:c.action_type,risk:e.policy_decision.risk,risk_tier:e.policy_decision.risk_tier,route:_.current,adapter:(null===t||void 0===t?void 0:t.adapter_id)||null}),Ke({action:c,decision:e.policy_decision,target_name:(null===t||void 0===t?void 0:t.semantic.accessible_name)||c.target_id||"this action"})}break;case"aurora.action.denied":var x,k,A;if(u&&c)ne.current.add(c.action_id),Ie("denied",{action_type:c.action_type,risk:null===(x=e.policy_decision)||void 0===x?void 0:x.risk,risk_tier:null===(k=e.policy_decision)||void 0===k?void 0:k.risk_tier,route:_.current,policy_denial_code:null===(A=e.policy_decision)||void 0===A?void 0:A.reason_code});Q.current=null,T(e=>({...e,lifecycle:"denied",confirmation:null,status_label:Fe(r),announcement:Fe(r)})),Z.current=null;break;case"aurora.action.started":case"aurora.action.progress":if("aurora.action.started"===e.kind&&u){const t=c||Z.current;var j,S;if(t&&!ee.current.has(t.action_id))Ie("started",{action_type:t.action_type,risk:null===(j=e.policy_decision)||void 0===j?void 0:j.risk,risk_tier:null===(S=e.policy_decision)||void 0===S?void 0:S.risk_tier,route:_.current})}T(e=>({...e,lifecycle:"executing",status_label:Fe(r),announcement:Fe(r),progress:"number"===typeof o?o:e.progress}));break;case"aurora.action.completed":case"aurora.action.failed":case"aurora.action.cancelled":case"aurora.action.interrupted_by_user":{const t=c||Z.current;if(u&&t&&!ne.current.has(t.action_id)){var C,I,E;ne.current.add(t.action_id);const n=(null===(C=e.action_result)||void 0===C?void 0:C.status)||("aurora.action.completed"===e.kind?"succeeded":"aurora.action.cancelled"===e.kind?"cancelled":"aurora.action.interrupted_by_user"===e.kind?"interrupted_by_user":"failed");Ie("succeeded"===n?"succeeded":"stale"===n?"stale_target":"cancelled"===n?"cancelled":"interrupted_by_user"===n?"interrupted_by_user":"failed",{action_type:t.action_type,risk:null===(I=e.policy_decision)||void 0===I?void 0:I.risk,risk_tier:null===(E=e.policy_decision)||void 0===E?void 0:E.risk_tier,route:_.current})}}Q.current=null,T(t=>{var n;return{...t,lifecycle:(null===(n=e.action_result)||void 0===n?void 0:n.status)||("aurora.action.completed"===e.kind?"succeeded":"aurora.action.cancelled"===e.kind?"cancelled":"aurora.action.interrupted_by_user"===e.kind?"interrupted_by_user":"failed"),last_result:e.action_result||t.last_result,confirmation:null,status_label:Fe(r),announcement:Fe(r)}}),Z.current=null;break;case"aurora.plan.completed":case"aurora.plan.failed":Q.current=null,T(t=>({...t,plan_status:"aurora.plan.completed"===e.kind?"completed":"failed",target_geometry:null,last_target_geometry:null,preview_text:null,confirmation:null,status_label:Fe(r),announcement:Fe(r)})),Z.current=null}},[He,b,Je,Ke,Ve]),Ze=(0,a.useCallback)(async(e,t)=>{const i=Fe(e,1e3);if(!i||!n||!u)return null;if(await ce.current,null!==t&&void 0!==t&&t.aborted)return null;try{await J(t)}catch(h){if(null!==t&&void 0!==t&&t.aborted)return null;throw h}if(null!==t&&void 0!==t&&t.aborted)return null;const a=Y.current;if(ie.current.size>0)return null;let r;try{r=await ye()}catch{return null}if(null!==t&&void 0!==t&&t.aborted)return null;const l=(0,o.E0)(r.features,r.rollout_constraints,_.current);if(!l.runtime)return null;Ue.cancel();const c=K.current;var d;(K.current=null,c)&&await(0,s.$h)({session_id:c,client_instance_id:b,cancellation_token:(null===(d=Z.current)||void 0===d?void 0:d.cancellation_token)||z("cancel"),reason:"A new user request replaced the previous task"}).catch(()=>{});if(null!==t&&void 0!==t&&t.aborted||Y.current!==a)return null;ee.current.clear(),te.current.clear(),ne.current.clear();const m=await(0,s.rO)({goal_summary:i,client_instance_id:b,route:_.current,mode:l.shadow_mode?"shadow":"active",idempotency_key:z("session-request")});if(null!==t&&void 0!==t&&t.aborted||Y.current!==a)return await(0,s.$h)({session_id:m.session_id,client_instance_id:b,cancellation_token:z("cancel"),reason:null!==t&&void 0!==t&&t.aborted?"Stopped before the semantic turn started":"The authenticated scope changed before the semantic turn started"}).catch(()=>{}),null;K.current=m.session_id;const p=await Ce(m.session_id);return null!==t&&void 0!==t&&t.aborted||Y.current!==a?(await(0,s.$h)({session_id:m.session_id,client_instance_id:b,cancellation_token:z("cancel"),reason:null!==t&&void 0!==t&&t.aborted?"Stopped while observing the page":"The authenticated scope changed while observing the page"}).catch(()=>{}),null):(O(!1),T({...Ne.JG,session_id:m.session_id,goal_summary:i,plan_status:"active",lifecycle:"planned",status_label:"Reading this page",announcement:"Aurora is reading the current page."}),{semantic_session_id:m.session_id,semantic_snapshot_id:p.snapshot_id})},[n,b,ye,Ue,u,Ce]),Qe=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Stopped by the user";Ue.cancel();const t=K.current,n=Z.current;K.current=null;const i=(null===n||void 0===n?void 0:n.cancellation_token)||z("cancel"),a=`stop:${(null===n||void 0===n?void 0:n.action_id)||t||"local"}`;if(te.current.has(a)||(te.current.add(a),n&&ne.current.add(n.action_id),Ie("cancelled",{action_type:null===n||void 0===n?void 0:n.action_type,risk:N.risk||void 0,route:_.current})),T(e=>({...e,lifecycle:"cancelled",plan_status:"cancelled",status_label:"Aurora stopped",announcement:"Aurora stopped. Your input was preserved.",confirmation:null})),Q.current=null,t)try{var r;if(await(0,s.$h)({session_id:t,client_instance_id:b,cancellation_token:i,reason:Fe(e,500)}),n&&!ie.current.has(n.action_id))(null===(r=Z.current)||void 0===r?void 0:r.action_id)===n.action_id&&(Z.current=null)}catch{}},[N.risk,b,Ue]),et=(0,a.useCallback)(async(e,t)=>{var n;const i=Q.current,a=X.current;if(!i||i.decision.decision_id!==t)return;const r=K.current;if(!r||i.action.session_id!==r||(null===(n=Z.current)||void 0===n?void 0:n.action_id)!==i.action.action_id)return Q.current=null,void T(e=>({...e,confirmation:null}));const o=V().scope.scope_id,l=!a||a.route!==_.current||a.scope.scope_id!==o,c=!l&&Boolean(i.action.target_id)&&"stale"===ue(x,i.action,je).status;if(e&&(l||c)){Q.current=null,T(e=>({...e,lifecycle:"stale",confirmation:null,status_label:"The page changed while you were reviewing. Aurora is reading it again.",announcement:"The page changed while you were reviewing. Aurora is reading it again and will continue."}));try{await(0,s.fx)({session_id:i.action.session_id,action_id:i.action.action_id,decision_id:i.decision.decision_id,client_instance_id:b,
2snapshot_version:i.action.snapshot_version,target_fingerprint:i.action.target_fingerprint,confirmed:!1})}catch{}return void await Ce(r,!0).catch(()=>{})}const d=`confirmation:${i.action.action_id}:${i.decision.decision_id}:${e}`;te.current.has(d)||(te.current.add(d),Ie(e?"confirmation_accepted":"confirmation_cancelled",{action_type:i.action.action_type,risk:i.decision.risk,risk_tier:i.decision.risk_tier,route:_.current})),e||Ke(null);try{const t=await(0,s.fx)({session_id:i.action.session_id,action_id:i.action.action_id,decision_id:i.decision.decision_id,client_instance_id:b,snapshot_version:i.action.snapshot_version,target_fingerprint:i.action.target_fingerprint,confirmed:e});if(Ke(null),!e)return void T(e=>({...e,lifecycle:"cancelled",status_label:"Action cancelled",announcement:"Aurora did not make that change."}));if("stale"===t.status||!t.envelope)return T(e=>({...e,lifecycle:"stale",status_label:"Aurora is reading the page again, then continuing with your approval.",announcement:"Aurora is reading the page again, then continuing with your approval."})),void await Ce(r,!0).catch(()=>{});Je(t.action,t.envelope,t.policy_decision)}catch(m){var u;const t=Fe((null===m||void 0===m?void 0:m.message)||"Confirmation could not be completed.");if(e&&(null===(u=Q.current)||void 0===u?void 0:u.action.action_id)===i.action.action_id&&!ee.current.has(i.action.action_id))throw T(e=>({...e,announcement:t})),new Error(t);T(e=>({...e,lifecycle:"failed",status_label:t,announcement:t}))}},[b,Je,je,Ce,x,Ke]),tt=(0,a.useCallback)(async()=>{const e=Ue.latestUndo();if(!e||!_e.current.generic_actions||!n||!u)return!1;O(!1);try{var t,i;const n=(await(0,s.rO)({goal_summary:`Undo Aurora's previous change to ${e.target_name}.`,client_instance_id:b,route:_.current,mode:"active",idempotency_key:z("undo-session")})).session_id;K.current=n;const a=await Ce(n),r={protocol_version:"1.0",action_id:z("action"),session_id:n,client_instance_id:b,snapshot_version:a.snapshot_version,target_id:e.target_id,target_fingerprint:e.target_fingerprint,action_type:"undo",parameters:{},reason:`Undo Aurora's previous change to ${e.target_name}.`,expected_postcondition:e.expected_postcondition,idempotency_key:z("undo-request"),cancellation_token:z("undo-cancel")},o=await(0,s.wN)(n,r);return Z.current=o.action,o.envelope?Je(o.action,o.envelope,o.policy_decision):"confirmation_required"===(null===(t=o.policy_decision)||void 0===t?void 0:t.outcome)&&Ke({action:o.action,decision:o.policy_decision,target_name:e.target_name}),Boolean(o.envelope||"confirmation_required"===(null===(i=o.policy_decision)||void 0===i?void 0:i.outcome))}catch(a){const e=Fe((null===a||void 0===a?void 0:a.message)||"Undo is no longer available.");return T(t=>({...t,undo_available:!1,undo_label:null,status_label:e,announcement:e})),!1}},[n,b,Ue,u,Je,Ce,Ke]),nt=(0,a.useCallback)(async(e,t)=>{const n=K.current;if(!n||!_e.current.resource_resolver)throw new Error("Aurora resource reading is unavailable.");return(await(0,s.F9)({session_id:n,client_instance_id:b,resource_id:e,action_id:z("resource-action"),idempotency_key:z("resource-request"),cancellation_token:z("resource-cancel"),reason:Fe(t||"Read the attached resource",500)})).resource},[b]),it=(0,a.useCallback)(e=>{var t;const n=null===(t=X.current)||void 0===t?void 0:t.elements.find(t=>t.supported_actions.includes(e));O(!1),T(t=>({...t,plan_status:"active",lifecycle:"fill"===e||"replace"===e||"select"===e?"previewing":"locating",action_type:e,target_id:(null===n||void 0===n?void 0:n.element_id)||null,target_name:(null===n||void 0===n?void 0:n.accessible_name)||"No eligible target",target_geometry:(null===n||void 0===n?void 0:n.geometry)||null,preview_text:"fill"===e||"replace"===e?"Dry-run preview text":null,status_label:`Dry run: ${e.replace("_"," ")}`,announcement:`Developer dry run for ${e.replace("_"," ")}. No action was executed.`}))},[]);(0,a.useEffect)(()=>()=>{K.current=null,Ue.cancel()},[Ue]);const at=(0,a.useMemo)(()=>({available:ge.runtime,ensure_available:be,capabilities:I,flags:ge,activity:N,events:M,snapshot:R,observe_page:ke,subscribe_page_changes:xe,prepare_turn:Ze,handle_stream_event:Xe,dismiss_presence:B,stop:Qe,undo:tt,resolve_resource:nt,register_element:(e,t)=>
2{const n=x.register(e,t),i=j.register(e,t);return()=>{n(),i()}},register_adapter:k.register.bind(k),record_legacy_action:e=>((e,t,n)=>{(n?n.legacy_bridge:(0,o.wZ)())&&(Ie("legacy_fallback_used",{action_type:Ee(e),route:t,path:"legacy"}),(n?n.shadow_mode:(0,o.be)())&&window.dispatchEvent(new CustomEvent("edumark:aurora-semantic-shadow",{detail:{legacy_action:e.action,semantic_category:Ee(e),deprecation_owner:"aurora-platform",target_release:"post-parity-two-release-window"}})))})(e,_.current,ge),refresh_snapshot:Se}),[N,k,I,B,be,M,ge,Xe,j,ke,Ze,Se,x,nt,R,Qe,xe,tt]);return(0,Te.jsx)(Oe.Provider,{value:at,children:(0,Te.jsxs)($e.y,{enabled:Boolean(n&&u),children:[t,(0,Te.jsx)(Re.Ay,{activity:N,snapshot:R,exclusions:x.exclusions(),events:M,visible:ge.presence,highlights_visible:!L,inspector_enabled:(0,o.Zr)(),reduced_motion:W||P,on_force_reduced_motion:q,on_simulate:it,on_stop:()=>{Qe()},on_undo:()=>{tt()},on_confirm:e=>{var t;return et(e,null===(t=N.confirmation)||void 0===t?void 0:t.decision.decision_id)},on_refresh_snapshot:()=>{Se()}})]},y)})}},77538(e,t,n){var i=n(55433);const a="1.0",r=["focus","click","fill","replace","select","press","scroll","navigate","open","read"],s=["observe","focus","click","fill","replace","undo","select","press","scroll","navigate","open","read","resource_read","domain_command"],o=["aurora.plan.started","aurora.plan.updated","aurora.action.planned","aurora.action.authorized","aurora.action.denied","aurora.action.started","aurora.action.progress","aurora.action.confirmation_required","aurora.action.completed","aurora.action.failed","aurora.action.cancelled","aurora.action.interrupted_by_user","aurora.plan.completed","aurora.plan.failed"],l=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;return"string"===typeof e&&e.trim().length>0&&e.length<=t},d=e=>"string"===typeof e&&s.includes(e),u=e=>c(e,300)&&/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,299}$/.test(e),m=e=>"string"===typeof e&&/^[A-Za-z0-9_-]{16,128}$/.test(e),p=e=>"string"===typeof e&&e.length<=1e3&&e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\")&&!(e=>Array.from(e).some(e=>e.charCodeAt(0)<32))(e),h=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(t>8)&&(null===e||"string"===typeof e||"boolean"===typeof e||("number"===typeof e?Number.isFinite(e):Array.isArray(e)?e.length<=1e3&&e.every(e=>h(e,t+1)):l(e)&&Object.keys(e).length<=1e3&&Object.entries(e).every(e=>{let[n,i]=e;return n.length<=200&&h(i,t+1)})))}
2,v=new Set(["value","option","key","direction","amount","route","resource_id","command_name","command_arguments"]),g=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Tab","Backspace","Delete"]),f=new Set(["up","down","left","right","into_view"]),_=new Set(["unconstrained","actor_id","cohort_id","role"]),y=["aurora_semantic_runtime","aurora_presence_layer","aurora_generic_actions","aurora_resource_resolver","aurora_typed_commands","aurora_legacy_bridge","aurora_shadow_mode"],b=e=>{if("*"===e)return!0;if("string"!==typeof e||!e.startsWith("/")||e.startsWith("//"))return!1;const t=e.split("/").filter(Boolean);return t.every((e,n)=>"*"===e&&n===t.length-1||/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(e)||/^[A-Za-z0-9._~:-]+$/.test(e))},w=e=>{var t;return null===e||"object"!==typeof e?null!==(t=JSON.stringify(e))&&void 0!==t?t:"null":Array.isArray(e)?`[${e.map(w).join(",")}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${w(e[t])}`).join(",")}}`},x=e=>(0,i.f)((e=>{var t,n,i,a,r,s,o,l,c,d,u,m,p,h,v,g,f,_;return w({protocol_version:e.protocol_version,action_id:e.action_id,session_id:e.session_id,client_instance_id:e.client_instance_id,snapshot_version:e.snapshot_version,target_id:null!==(t=e.target_id)&&void 0!==t?t:null,target_fingerprint:null!==(n=e.target_fingerprint)&&void 0!==n?n:null,action_type:e.action_type,parameters:{value:null!==(i=e.parameters.value)&&void 0!==i?i:null,option:null!==(a=e.parameters.option)&&void 0!==a?a:null,key:null!==(r=e.parameters.key)&&void 0!==r?r:null,direction:null!==(s=e.parameters.direction)&&void 0!==s?s:null,amount:null!==(o=e.parameters.amount)&&void 0!==o?o:null,route:null!==(l=e.parameters.route)&&void 0!==l?l:null,resource_id:null!==(c=e.parameters.resource_id)&&void 0!==c?c:null,command_name:null!==(d=e.parameters.command_name)&&void 0!==d?d:null,command_arguments:null!==(u=e.parameters.command_arguments)&&void 0!==u?u:null},reason:e.reason,expected_postcondition:{kind:e.expected_postcondition.kind,expected_hash:null!==(m=e.expected_postcondition.expected_hash)&&void 0!==m?m:null,text:null!==(p=e.expected_postcondition.text)&&void 0!==p?p:null,state_key:null!==(h=e.expected_postcondition.state_key)&&void 0!==h?h:null,state_value:null!==(v=e.expected_postcondition.state_value)&&void 0!==v?v:null,route:null!==(g=e.expected_postcondition.route)&&void 0!==g?g:null,element_id:null!==(f=e.expected_postcondition.element_id)&&void 0!==f?f:null,adapter_verification:null!==(_=e.expected_postcondition.adapter_verification)&&void 0!==_?_:null},idempotency_key:e.idempotency_key,cancellation_token:e.cancellation_token})})(e));n.d(t,["NU",0,(e,t)=>e.route_templates.some(e=>{if("*"===e)return!0;let n=t;try{n=new URL(t,"https://edumark.invalid").pathname}catch{}const i=n.split("/").filter(Boolean),a=e.split("/").filter(Boolean);for(let t=0;t<a.length;t+=1){const e=a[t];if("*"===e)return!0;if(t>=i.length)return!1;if((!e.startsWith("{")||!e.endsWith("}"))&&i[t]!==e)return!1}return i.length===a.length}),"Rc",0,e=>"string"===typeof e&&o.includes(e),"S9",0,(e,t,n)=>{var i,r,s,o,c,h,v,g,f;if(!l(e)||e.protocol_version!==a||!u(e.envelope_id)||!u(e.action_id)||!u(e.session_id)||!u(e.actor_id)||!u(e.org_id)||!u(e.client_instance_id)||!Number.isInteger(e.snapshot_version)||!d(e.action_type)||!l(e.constraints)||!u(e.policy_decision_id)||!u(e.nonce)||"string"!==typeof e.signature||!/^[a-f0-9]{64,128}$/.test(e.signature))return{valid:!1,error_code:"AURORA_ENVELOPE_INVALID",message:"The action authorization is invalid."};const _=e,y=_.constraints.route,b=_.constraints.scope_id,w=_.constraints.snapshot_version,k=_.constraints.action_fingerprint,A=_.constraints.frame_origin,j=e=>{if("string"!==typeof e||e.length>500)return null;try{const t=new URL(e);return["http:","https:"].includes(t.protocol)&&t.origin===e?t.origin:null}catch{return null}};if(!p(y)||!u(b)||!Number.isInteger(w)||!m(k)||!j(A)||!j(n.current_frame_origin))return{valid:!1,error_code:"AURORA_ENVELOPE_INVALID",message:"The action authorization constraints are invalid."};const S=null!==(i=n.now)&&void 0!==i?i:Date.now(),C=Date.parse(_.issued_at),I=Date.parse(_.expires_at);return!Number.isFinite(C)||!Number.isFinite(I)||I<=S||C>S+6e4?{valid:!1,error_code:"AURORA_ENVELOPE_EXPIRED",message:"The action authorization has expired."}:_.action_id!==t.action_id||_.session_id!==t.session_id||_.session_id!==n.session_id||_.actor_id!==n.actor_id||_.org_id!==n.org_id||_.client_instance_id!==t.client_instance_id||_.client_instance_id!==n.client_instance_id||_.snapshot_version!==t.snapshot_version||_.snapshot_version!==n.snapshot_version||_.action_type!==t.action_type||w!==t.snapshot_version||y!==n.current_route||b!==n.current_scope_id||A!==n.current_frame_origin||k!==x(t)||(null!==(r=_.target_id)&&void 0!==r?r:"")!==(null!==(s=t.target_id)&&void 0!==s?s:"")||(null!==(o=_.target_fingerprint)&&void 0!==o?o:"")!==(null!==(c=t.target_fingerprint)&&void 0!==c?c:"")||(null!==(h=_.resource_id)&&void 0!==h?h:"")!==(null!==(v=t.parameters.resource_id)&&void 0!==v?v:"")||(null!==(g=_.centre_id)&&void 0!==g?g:"")!==(null!==(f=n.centre_id)&&void 0!==f?f:"")?{valid:!1,error_code:"AURORA_ENVELOPE_SCOPE_MISMATCH",message:"The action authorization does not match this page."}:{valid:!0,envelope:_}},"UZ",0,r,"WE",0,e=>{if(!l(e)||e.protocol_version!==a)return!1;if(!u(e.action_id)||!u(e.session_id)||!u(e.client_instance_id)||!Number.isInteger(e.snapshot_version)||Number(e.snapshot_version)<1||!d(e.action_type)||!l(e.parameters)||Object.keys(e.parameters).some(e=>!v.has(e))||!c(e.reason,500)||!u(e.idempotency_key)||!u(e.cancellation_token)||!(e=>{if(!l(e))return!1;switch(e.kind){case"value_hash":return"string"===typeof e.expected_hash&&/^[a-f0-9]{64}$/.test(e.expected_hash);case"text_present":return c(e.text,500);case"state":return c(e.state_key,80)&&void 0!==e.state_value&&null!==e.state_value;case"route":return p(e.route);case"element_present":return u(e.element_id);case"page_changed":return!0;case"adapter":return c(e.adapter_verification,200);default:return!1}})(e.expected_postcondition))return!1;if([...r.filter(e=>"navigate"!==e),"undo"].includes(e.action_type)&&(!u(e.target_id)||!m(e.target_fingerprint)))return!1;if(void 0!==e.target_id&&null!==e.target_id&&!u(e.target_id))return!1;if(void 0!==e.target_fingerprint&&null!==e.target_fingerprint&&!m(e.target_fingerprint))return!1;if(void 0!==e.parameters.value&&null!==e.parameters.value&&("string"!==typeof e.parameters.value||e.parameters.value.length>1e5))return!1;if(void 0!==e.parameters.option&&null!==e.parameters.option&&("string"!==typeof e.parameters.option||e.parameters.option.length>2e3))return!1;if(void 0!==e.parameters.key&&null!==e.parameters.key&&!g.has(String(e.parameters.key)))return!1;if(void 0!==e.parameters.direction&&null!==e.parameters.direction&&!f.has(String(e.parameters.direction)))return!1;if(void 0!==e.parameters.amount&&null!==e.parameters.amount&&(!Number.isInteger(e.parameters.amount)||Number(e.parameters.amount)<1||Number(e.parameters.amount)>1e4))return!1;if(("fill"===e.action_type||"replace"===e.action_type)&&"string"!==typeof e.parameters.value)return!1;if("select"===e.action_type&&"string"!==typeof e.parameters.option)return!1;if("press"===e.action_type&&!g.has(String(e.parameters.key)))return!1;if("navigate"===e.action_type&&!p(e.parameters.route))return!1;if("resource_read"===e.action_type&&!c(e.parameters.resource_id,500))return!1;if("domain_command"===e.action_type&&(!c(e.parameters.command_name,120)||!l(e.parameters.command_arguments)||!h(e.parameters.command_arguments)))return!1;const t=e.expected_postcondition;if("page_changed"===t.kind&&!["click","open","press"].includes(String(e.action_type)))return!1;return(!new Set(["click","fill","replace","undo","select","press","open","navigate"]).has(String(e.action_type))||"element_present"!==t.kind||t.element_id!==e.target_id)&&(("navigate"!==e.action_type||"route"===t.kind&&t.route===e.parameters.route)&&(!!("fill"!==e.action_type&&"replace"!==e.action_type||["value_hash","text_present","adapter"].includes(t.kind))&&(!("und
2o"===e.action_type&&!["value_hash","text_present","state","adapter"].includes(t.kind))&&!("select"===e.action_type&&!["value_hash","state","adapter"].includes(t.kind)))))},"ck",0,s,"dt",0,e=>{if(!l(e)||e.protocol_version!==a||!l(e.features)||!l(e.rollout_constraints)||!Array.isArray(e.available_domain_commands)||!e.available_domain_commands.every(e=>c(e,120)))return!1;const t=e.features;if(!y.every(e=>{const n=t[e];return l(n)&&c(n.feature,120)&&"boolean"===typeof n.enabled&&"boolean"===typeof n.valid&&Array.isArray(n.missing_dependencies)&&n.missing_dependencies.every(e=>c(e,120))}))return!1;const n=e.rollout_constraints;return"boolean"===typeof n.configured&&"boolean"===typeof n.eligible&&"boolean"===typeof n.unconstrained&&Array.isArray(n.matched_by)&&n.matched_by.every(e=>_.has(String(e)))&&Array.isArray(n.route_templates)&&n.route_templates.length<=100&&n.route_templates.every(b)&&Array.isArray(n.action_types)&&n.action_types.length<=32&&n.action_types.every(d)&&Number.isInteger(n.max_risk_tier)&&Number(n.max_risk_t
2ier)>=0&&Number(n.max_risk_tier)<=4},"eR",0,(e,t,n)=>e.configured&&e.eligible&&n<=e.max_risk_tier&&e.action_types.includes(t)])},55433(e,t,n){n.d(t,["f",0,e=>{const t=(e,t)=>e>>>t|e<<32-t,n=2**32,i=[],a=unescape(encodeURIComponent(e)),r=8*a.length,s=[],o=[],l={};let c=0;for(let u=2;c<64;u+=1)if(!l[u]){for(let e=u*u;e<313;e+=u)l[e]=!0;c<8&&(s[c]=Math.sqrt(u)*n|0),o[c]=Math.cbrt(u)*n|0,c+=1}let d=`${a}\x80`;for(;d.length%64!==56;)d+="\0";for(let u=0;u<d.length;u+=1)i[u>>2]=(i[u>>2]||0)|d.charCodeAt(u)<<(3-u)%4*8;i.push(Math.floor(r/n)),i.push(r);for(let u=0;u<i.length;u+=16){const e=i.slice(u,u+16),n=s.slice(0,8);for(let i=0;i<64;i+=1){const a=e[i-15],r=e[i-2],s=i<16?e[i]:e[i-16]+(t(a,7)^t(a,18)^a>>>3)+e[i-7]+(t(r,17)^t(r,19)^r>>>10)|0;e[i]=s;const l=t(n[4],6)^t(n[4],11)^t(n[4],25),c=n[4]&n[5]^~n[4]&n[6],d=n[7]+l+c+o[i]+s|0,u=(t(n[0],2)^t(n[0],13)^t(n[0],22))+(n[0]&n[1]^n[0]&n[2]^n[1]&n[2])|0;n.pop(),n.unshift(d+u|0),n[4]=n[4]+d|0}for(let t=0;t<8;t+=1)s[t]=s[t]+n[t]|0}return s.map(e=>(e>>>0).toString(16).padStart(8,"0")).join("")}])},19976(e,t,n){n.d(t,["JG",0,{session_id:null,goal_summary:null,plan_status:"idle",lifecycle:"idle",action_id:null,action_type:null,target_id:null,target_name:null,target_geometry:null,last_target_geometry:null,risk:null,status_label:null,progress:null,preview_text:null,announcement:"",steps:[],confirmation:null,last_result:null,undo_available:!1,undo_label:null},"Sk",0,e=>"active"===e.plan_status&&["planned","authorized","locating","previewing","awaiting_confirmation","executing","verifying"].includes(e.lifecycle),"bn",0,e=>"active"!==e.plan_status?null:"awaiting_confirmation"===e.lifecycle?"waiting":["authorized","locating","previewing","executing","verifying"].includes(e.lifecycle)?"acting":"thinking"])},60419(e,t,n){const i=["communications_schedule_live_session","course_live_session_update","course_live_session_reschedule","course_live_session_cancel","course_live_session_change_provider","communications_send_message"],a=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),r=(e,t)=>"string"===typeof e&&e.trim()===e&&e.length>0&&e.length<=t&&!Array.from(e).some(e=>[0,10,13].includes(e.charCodeAt(0)));n.d(t,["Gy",0,".xlsx,.xlsm,.csv,.tsv,.docx,.pdf,.txt,.md,.html,.htm","Kc",0,20971520,"XC",0,["page","course","course_version","course_module","course_activity","course_block","assignment","practice_session","assessment_draft","question_group","question_part","response_block","assessment_resource","cohort","learner","person","submission","marking_case","plagiarism_report","analytics_report","migration","integration","import_job","product_guidance","conversation","live_session","announcement"],"pi",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();if(!a(e))return!1;const n=new Set(["protocol_version","confirmation_id","confirmation_token","tool","request_id","expires_at","payload_fingerprint","summary"]);if(Object.keys(e).some(e=>!n.has(e))||"1.0"!==e.protocol_version||!r(e.confirmation_id,200)||"string"!==typeof e.confirmation_token||!/^[a-f0-9]{64}$/.test(e.confirmation_token)||"string"!==typeof e.tool||!i.includes(e.tool)||!r(e.request_id,200)||"string"!==typeof e.payload_fingerprint||!/^[a-f0-9]{64}$/.test(e.payload_fingerprint)||!a(e.summary))return!1;const s=Date.parse(String(e.expires_at||""));if(!Number.isFinite(s)||s<=t||s>t+6e5)return!1;const o=e.summary,l=new Set(["target","scope","consequence","undoability","affected_count"]);return!Object.keys(o).some(e=>!l.has(e))&&r(o.target,240)&&r(o.scope,240)&&r(o.consequence,500)&&["undoable","limited","not_undoable"].includes(String(o.undoability))&&Number.isInteger(o.affected_count)&&Number(o.affected_count)>=1&&Number(o.affected_count)<=1e5}])},27507(e,t,n){n.d(t,{M:()=>r});var i=n(87140),a=n(38238);function r(){return e=(0,i.Ok)(),t=(0,a.uC)(),e&&Array.isArray(e.permissions)&&!e.permissions.includes("aurora.use")?{blocked:!0,title:"Aurora is turned off for your account",reason:"Your current access settings do not include Aurora.",detail:"Ask an organisation administrator to review Aurora in People \u2192 Access.",resumePath:null}:e&&!["learner","student"].includes(e.role)||!t.active||"protected"!==t.assistancePolicy?{blocked:!1,title:"Aurora",reason:null,detail
2:null,resumePath:null}:{blocked:!0,title:"Aurora is paused during your assessment",reason:t.message||"A protected assessment is still in progress.",detail:"This applies across EduMark, including Home. Aurora becomes available when the protected attempt ends.",resumePath:t.assignmentId&&t.attemptId?`/assignments/${encodeURIComponent(t.assignmentId)}/attempt/${encodeURIComponent(t.attemptId)}`:null};var e,t}},6487(e,t,n){n.d(t,{mh:()=>h,q3:()=>g});var i=n(33006),a=n(55507),r=n(40939),s=n(60419),o=n(44330);const l=(e,t)=>{var n,i;return{kind:e.kind,message_id:e.message_id||t,error_code:e.error_code,can_continue:Boolean(null===(n=e.task_progress)||void 0===n?void 0:n.can_continue),pause_reason:null===(i=e.task_progress)||void 0===i?void 0:i.pause_reason}},c=()=>{try{if("undefined"!==typeof crypto&&"function"===typeof crypto.randomUUID)return`msg-${crypto.randomUUID()}`}catch{}return`msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`},d=e=>`em_aurora_draft:${e}`,u=e=>{const t="assistant"===e.role&&e.completed_at||e.created_at,n=Date.parse(t);return Number.isFinite(n)?n:Number.POSITIVE_INFINITY},m=e=>e.map((e,t)=>({message:e,index:t})).sort((e,t)=>{const n=u(e.message),i=u(t.message);return n<i?-1:n>i?1:e.index-t.index}).reduce((e,t,n,i)=>{if(n>0&&u(i[n-1].message)===u(t.message))return e;const a=u(t.message),r=i.slice(n).filter(e=>u(e.message)===a).map(e=>e.message),s=r.filter(e=>"user"===e.role),o=r.filter(e=>"assistant"===e.role);let l=e.length>0?"user"===e[e.length-1].role?"assistant":"user":s.length>0?"user":"assistant";for(;s.length>0||o.length>0;){const t="user"===l?o:s,n=("user"===l?s:o).shift()||t.shift();if(!n)break;e.push(n),l="user"===n.role?"assistant":"user"}return e},[]),p=e=>e instanceof r.NJ?{code:e.code,message:e.message,retryable:"offline"===e.kind||"rate_limited"===e.kind||"unavailable"===e.kind,retryAfterSeconds:e.retryAfterSeconds}:{code:"AURORA_UNAVAILABLE",message:"Aurora is unavailable right now.",retryable:!0};function h(e){var t,n,d,u;let h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},v=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const g=(0,o.yI)(),[f,_]=(0,i.useState)({conversations:[],historyLoading:!1,historyError:null,activeConversation:null,messages:[],threadLoading:!1,locked:!1,streaming:!1,streamingMessageId:null,streamingSince:null,statusLabel:null,error:null,legacyConfirmation:null,legacyConfirmationPending:!1}),y=(0,i.useRef)(null),b=(0,i.useRef)(!1),w=(0,i.useRef)(0),x=(0,i.useRef)(null),k=(0,i.useRef)(e),A=(0,i.useRef)(h),j=(0,i.useRef)(g),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),I=(0,i.useRef)({started_at:0,segments:0,transient:0}),E=(0,i.useRef)(!1),R=(0,i.useRef)(async()=>{}),$=e=>{if(!e||"error"!==e.kind||"AURORA_TASK_PAUSED"!==e.error_code||!e.can_continue)return null;if(E.current)return null;const t=I.current;return t.segments>=60||Date.now()-t.started_at>108e5?null:"budget"===e.pause_reason?"now":"transient"===e.pause_reason&&t.transient<4?"delayed":null};j.current=g,A.current={...h,prepareSemanticTurn:h.prepareSemanticTurn||(null===g||void 0===g?void 0:g.prepare_turn),onSemanticEvent:h.onSemanticEvent||(null===g||void 0===g?void 0:g.handle_stream_event),onStopSemantic:h.onStopSemantic||(null===g||void 0===g?void 0:g.stop)},(0,i.useLayoutEffect)(()=>{var t;if(v||k.current===e)return;const n=x.current;n&&!n.startsWith("local-")&&(0,r.Wz)(n).catch(()=>{}),x.current=null,k.current=e,w.current+=1,null===(t=y.current)||void 0===t||t.abort(),b.current=!1,_({conversations:[],historyLoading:!1,historyError:null,activeConversation:null,messages:[],threadLoading:!1,locked:!1,streaming:!1,streamingMessageId:null,streamingSince:null,statusLabel:null,error:null,legacyConfirmation:null,legacyConfirmationPending:!1}),S.current=null,C.current=!1},[v,e]),(0,i.useEffect)(()=>()=>{var e,t,n;if(v)return;null===(e=y.current)||void 0===e||e.abort();const i=x.current;i&&!i.startsWith("local-")&&(0,r.Wz)(i).catch(()=>{}),null===(t=(n=A.current).onStopSemantic)||void 0===t||t.call(n)},[v]);const N=(0,i.useCallback)(async e=>{const t=k.current;_(e=>({...e,historyLoading:!0,historyError:null}));try{const n=await(0,r.Zn)({q:e});if(t!==k.current)return;_(e=>({...e,historyLoading:!1,conversations:n.conversations}))}catch(n){if(t!==k.current)return;_(e=>({...e,historyLoading:!1,historyError:p(n)}))}},[]),T=(0,i.useCallback)(async()=>{const e=k.current;if(f.activeConversation)return f.activeConversation;try{const t=await(0,r.cK)();return e!==k.current?null:(_(e=>({...e,activeConversation:t,conversations:[t,...e.conversations],messages:[],locked:!1,error:null})),t)}catch(t){return e!==k.current||_(e=>({...e,error:p(t)})),null}},[f.activeConversation]),L=(0,i.useCallback)(async()=>{var e;const t=k.current,n=null===(e=f.activeConversation)||void 0===e?void 0:e.id;if(n)try{const e=await(0,r.QL)(n);if(t!==k.current)return;_(t=>({...t,activeConversation:e.conversation,messages:m(e.messages),locked:"locked"===e.conversation.status}))}catch(i){if(t!==k.current)return;_(e=>({...e,error:p(i)}))}},[null===(t=f.activeConversation)||void 0===t?void 0:t.id]),O=(0,i.useCallback)(async e=>{var t,n,i,a;if(e&&e===(null===(t=f.activeConversation)||void 0===t?void 0:t.id)&&b.current)return;const s=++w.current,o=x.current;if(x.current=null,b.current=!1,null===(n=y.current)||void 0===n||n.abort(),null===(i=(a=A.current).onStopSemantic)||void 0===i||i.call(a),o&&!o.startsWith("local-")&&(0,r.Wz)(o).catch(()=>{}),S.current=null,C.current=!1,null!==e){_(e=>({...e,threadLoading:!0,streaming:!1,streamingMessageId:null,statusLabel:null,error:null,legacyConfirmation:null,legacyConfirmationPending:!1}));try{const t=await(0,r.QL)(e);if(w.current!==s)return;_(e=>({...e,threadLoading:!1,activeConversation:t.conversation,locked:"locked"===t.conversation.status,messages:m(t.messages)}))}catch(l){if(w.current!==s)return;_(e=>({...e,threadLoading:!1,error:p(l)}))}}else _(e=>({...e,activeConversation:null,messages:[],locked:!1,threadLoading:!1,streaming:!1,streamingMessageId:null,statusLabel:null,error:null,legacyConfirmation:null,legacyConfirmationPending:!1}))},[null===(n=f.activeConversation)||void 0===n?void 0:n.id]),M=(0,i.useCallback)(e=>{var t,n,i,a;if(null===(t=(n=A.current).onMutationReceipt)||void 0===t||t.call(n,e),null===(i=e.client_actions)||void 0===i||i.forEac
2h(e=>{var t,n,i;null===(t=j.current)||void 0===t||t.record_legacy_action(e),null===(n=(i=A.current).onClientAction)||void 0===n||n.call(i,e)}),null!==(a=e.refresh)&&void 0!==a&&a.length){var r,s,o;const t={action_id:`refresh:${e.command_id}`,action:"invalidate_view",targets:e.refresh};null===(r=j.current)||void 0===r||r.record_legacy_action(t),null===(s=(o=A.current).onClientAction)||void 0===s||s.call(o,t)}},[]),U=(0,i.useCallback)((e,t)=>{var n,i,a,r,o;(e.message_id&&"title"!==e.kind&&(x.current=e.message_id),["complete","error","cancelled"].includes(e.kind)&&(x.current=null),e.kind.startsWith("aurora.")||["complete","error","cancelled","status"].includes(e.kind))&&(null===(n=(i=A.current).onSemanticEvent)||void 0===n||n.call(i,e));if("client_action"===e.kind&&e.client_action)return null===(a=j.current)||void 0===a||a.record_legacy_action(e.client_action),void(null===(r=(o=A.current).onClientAction)||void 0===r||r.call(o,e.client_action));if("mutation_receipt"===e.kind&&e.mutation_receipt&&M(e.mutation_receipt),"aurora.legacy_confirmation.required"===e.kind){var c,d;const n=e.legacy_confirmation_proposal;if(!(null!==(c=A.current.legacyConfirmationAllowed)&&void 0!==c?c:!1!==(null===(d=j.current)||void 0===d?void 0:d.flags.legacy_bridge))||!(0,s.pi)(n))return S.current=null,void _(e=>({...e,legacyConfirmation:null,legacyConfirmationPending:!1,statusLabel:null,error:{code:"AURORA_LEGACY_CONFIRMATION_INVALID",message:"Aurora blocked an invalid or unavailable confirmation request. Nothing was changed.",retryable:!1}}));S.current={proposal:n,message_id:e.message_id||t}}_(n=>{const i=n.messages.map(e=>({...e})),a=i.findIndex(i=>i.id===t||i.id===n.streamingMessageId||e.message_id&&i.id===e.message_id),r=a>=0?i[a]:null;r&&e.message_id&&(r.id=e.message_id);let s={};switch(r&&e.task_progress&&(r.task_progress=e.task_progress),e.kind){case"accepted":r&&e.message_id&&(r.id=e.message_id),s={streamingMessageId:e.message_id||t};break;case"status":s={statusLabel:e.status_label||null};break;case"delta":r&&(r.status="streaming",r.content+=e.text||""),s={statusLabel:null};break;case"citations":r&&(r.citations=e.citations||[]);break;case"actions":r&&(r.actions=e.actions||[]);break;case"mutation_receipt":r&&e.mutation_receipt&&(r.mutation_receipts=[...(r.mutation_receipts||[]).filter(t=>{var n;return t.command_id!==(null===(n=e.mutation_receipt)||void 0===n?void 0:n.command_id)}),e.mutation_receipt]);break;case"command_started":s={statusLabel:e.status_label||"Making that change"};break;case"command_completed":s={statusLabel:e.status_label||"Change completed"};break;case"command_failed":s={statusLabel:null};break;case"aurora.legacy_confirmation.required":s={legacyConfirmation:e.legacy_confirmation_proposal||null,legacyConfirmationPending:!1,statusLabel:"Review and confirm"};break;case"aurora.plan.started":case"aurora.plan.updated":case"aurora.action.planned":case"aurora.action.authorized":case"aurora.action.started":case"aurora.action.progress":case"aurora.action.confirmation_required":s={statusLabel:e.semantic_message||e.message||e.status_label||"Aurora is working in this page"};break;case"aurora.action.denied":case"aurora.action.completed":case"aurora.action.failed":case"aurora.action.cancelled":case"aurora.action.interrupted_by_user":case"aurora.plan.completed":case"aurora.plan.failed":s={statusLabel:e.semantic_message||e.message||null};break;case"title":s={activeConversation:n.activeConversation?{...n.activeConversation,title:e.title||n.activeConversation.title}:n.activeConversation,conversations:n.conversations.map(t=>{var i;return t.id===(null===(i=n.activeConversation)||void 0===i?void 0:i.id)?{...t,title:e.title||t.title}:t})};break;case"complete":r&&(r.status="complete",r.content=e.text||r.content,r.citations=e.citations||r.citations,r.actions=e.actions||r.actions),s={streaming:!1,streamingMessageId:null,statusLabel:null};break;case"cancelled":r&&(r.status="cancelled"),s={streaming:!1,streamingMessageId:null,statusLabel:null};break;case"error":if($(l(e,e.message_id||n.streamingMessageId))){r&&(r.status="streaming"),s={statusLabel:"Progress saved. Continuing the task",error:null};break}r&&(r.status="failed",r.error_code=e.error_code||"AURORA_CONVERSATION_FAILED",r.error_message=e.error_message||"I could not finish that response. Completed changes are preserved.",r.retryable=!1!==e.retryable),s={streaming:!1,streamingMessageId:null,statusLabel:null,error:{code:e.error_code||"AURORA_CONVERSATION_FAILED",message:e.error_message||"I could not finish that response. Completed changes are preserved.",retryable:!1!==e.retryable}}}return{...n,...n.streaming&&e.message_id?{streamingMessageId:e.message_id}:{},messages:i,...s}})},[M]),P=(0,i.useCallback)(async e=>{const t=S.current;if(!t||C.current||!(0,s.pi)(t.proposal))return!1;C.current=!0,_(t=>({...t,legacyConfirmationPending:!0,statusLabel:e?"Applying confirmed change":"Cancelling change",error:null}));try{var n;const i=await(0,r.tL)(t.proposal,e);return(null===(n=S.current)||void 0===n?void 0:n.proposal.confirmation_id)===t.proposal.confirmation_id&&("completed"===i.status&&i.result&&M(i.result),S.current=null,_
2(e=>({...e,legacyConfirmation:null,legacyConfirmationPending:!1,statusLabel:"completed"===i.status?"Change completed":null,messages:i.result&&t.message_id?e.messages.map(e=>e.id===t.message_id?{...e,mutation_receipts:[...(e.mutation_receipts||[]).filter(e=>{var t;return e.command_id!==(null===(t=i.result)||void 0===t?void 0:t.command_id)}),i.result]}:e):e.messages})),(0,a.Lp)("completed"===i.status?"aurora_legacy_confirmation_completed":"aurora_legacy_confirmation_cancelled",{tool:t.proposal.tool,replayed:i.replayed}),"completed"===i.status)}catch(i){const e=p(i),n=(0,s.pi)(t.proposal);return n||(S.current=null),_(i=>({...i,legacyConfirmation:n?t.proposal:null,legacyConfirmationPending:!1,statusLabel:null,error:e})),!1}finally{C.current=!1}},[M]);(0,i.useEffect)(()=>{const e=f.legacyConfirmation;if(!e)return;const t=Math.max(0,Date.parse(e.expires_at)-Date.now()),n=window.setTimeout(()=>{var t;(null===(t=S.current)||void 0===t?void 0:t.proposal.confirmation_id)===e.confirmation_id&&(S.current=null,C.current=!1,_(e=>({...e,legacyConfirmation:null,legacyConfirmationPending:!1,statusLabel:null,error:{code:"AURORA_LEGACY_CONFIRMATION_EXPIRED",message:"That confirmation expired. Ask Aurora to prepare the change again.",retryable:!0}})))},Math.min(t+1,6e5));return()=>window.clearTimeout(n)},[f.legacyConfirmation]);const q=(0,i.useCallback)(async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(n.attachments||[]).slice(0,5),s=e.trim()||(i.length?"Please read the attached file and help me with it.":"");if(!s||b.current||f.streaming||f.locked||f.legacyConfirmation)return null;b.current=!0,_(e=>({...e,streaming:!0,streamingSince:Date.now(),statusLabel:"Thinking",error:null}));const o=new AbortController;y.current=o;const d=k.current,u=()=>!o.signal.aborted&&y.current===o&&k.current===d;let m=f.activeConversation;if(!m)try{if(m=await(0,r.cK)(),!u())return null;_(e=>({...e,activeConversation:m,conversations:[m,...e.conversations],messages:[],locked:!1}))}catch(z){return u()?(b.current=!1,_(e=>({...e,streaming:!1,statusLabel:null,error:p(z)})),null):null}if(!u())return null;const h=[];for(const a of i){_(e=>({...e,statusLabel:`Uploading ${a.name}`}));try{h.push(await(0,r.vX)(m.id,a,o.signal))}catch(z){if(!u())return null;b.current=!1;const e=p(z);return _(t=>({...t,streaming:!1,statusLabel:null,error:{...e,message:`${a.name}: ${e.message}`,retryable:!0}})),null}if(!u())return null}let v=null;if(A.current.prepareSemanticTurn)try{_(e=>({...e,statusLabel:"Reading this page"})),v=await A.current.prepareSemanticTurn(s,o.signal)}catch{v=null}if(!u())return null;if(n.semantic_required&&!v)return b.current=!1,_(e=>({...e,streaming:!1,streamingMessageId:null,statusLabel:null,error:{code:"AURORA_SEMANTIC_RUNTIME_UNAVAILABLE",message:"Aurora cannot safely make this in-page change right now. Nothing was changed.",retryable:!0}})),null;const g=(new Date).toISOString(),w=`local-user-${Date.now()}`,j=`local-assistant-${Date.now()}`;x.current=j;const S={id:w,conversation_id:m.id,role:"user",content:s,status:"complete",created_at:g,citations:[],actions:[],...h.length?{attachments:h}:{}},C={id:j,conversation_id:m.id,role:"assistant",content:"",status:"queued",created_at:g,citations:[],actions:[]};_(e=>({...e,messages:[...e.messages,S,C],streaming:!0,streamingMessageId:j,statusLabel:"Thinking",error:null})),(0,a.Lp)("aurora_message_sent",{conversation_id:m.id,content_length:s.length});let N="",T=!1,L=!1,O=null,M=null;I.current={started_at:Date.now(),segments:0,transient:0},E.current=!1;try{var P,q,D;if(await(0,r.u8)({conversationId:m.id,content:s,clientMessageId:c(),pageContext:t,semanticSessionId:null===(P=v)||void 0===P?void 0:P.semantic_session_id,semanticSnapshotId:null===(q=v)||void 0===q?void 0:q.semantic_snapshot_id,attachmentIds:h.map(e=>e.attachment_id),signal:o.signal,onEvent:e=>{u()&&(e.message_id&&(O=e.message_id),["complete","error","cancelled"].includes(e.kind)&&(L=!0,M=l(e,O)),"delta"===e.kind&&(N+=e.text||""),"complete"===e.kind&&(N=e.text||N,T=!0),"error"!==e.kind&&"cancelled"!==e.kind||(T=!1),U(e,j))}}),!u())return null;if(!L)throw new r.NJ("offline","AURORA_STREAM_INTERRUPTED","The connection ended before Aurora finished. Your partial response is available; try again.");const e=$(M),n=null===(D=M)||void 0===D?void 0:D.message_id;return e&&n&&!n.startsWith("local-")?(R.current(n,t,s,e),null):(b.current=!1,_(e=>({...e,streaming:!1,statusLabel:null})),T&&!o.signal.aborted&&N.trim()?N:null)}catch(z){if(!u())return null;b.current=!1,x.current=null;const e=p(z);return(0,a.Lp)("aurora_message_failed",{error_code:e.code}),_(t=>({...t,streaming:!1,streamingMessageId:null,statusLabel:null,locked:"AURORA_CONTEXT_CHANGED"===e.code||t.locked,messages:t.messages.map(n=>n.id===j||n.id===t.streamingMessageId?{...n,status:"failed",error_code:e.code,error_message:e.message,retryable:e.retryable}:n),error:e})),null}},[U,f.activeConversation,f.legacyConfirmation,f.locked,f.streaming]),D=(0,i.useCallback)(async()=>{var e,t,n,i;E.current=!0;const s=k.current,o=y.current,l=null===(e=f.activeConversation)||void 0===e?void 0:e.id,c=x.current||f.streamingMessageId;if(x.current=null,null===(t=y.current)||void 0===t||t.abort(),null===(n=(i=A.current).onStopSemantic)||void 0===n||n.call(i),b.current=!1,_(e=>({...e,streaming:!1,statusLabel:null,streamingMessageId:null,messages:e.messages.map(e=>e.id===c&&"assistant"===e.role&&"complete"!==e.status?{...e,status:"cancelled"}:e)})),c&&!c.startsWith("local-"))try{if(await(0,r.Wz)(c),l){const e=(await(0,r.QL)(l)).messages.find(e=>e.id===c);k.current===s&&y.current===o&&!b.current&&e&&["cancelled","failed","complete"].includes(e.status)&&_(t=>{var n;return(null===(n=t.activeConversation)||void 0===n?void 0:n.id)===l?{...t,messages:t.messages.map(t=>
2t.id===c?e:t)}:t})}}catch{}(0,a.Lp)("aurora_generation_cancelled",{})},[null===(d=f.activeConversation)||void 0===d?void 0:d.id,f.streamingMessageId]),z=(0,i.useCallback)(async(e,t,n,i,a)=>{b.current=!0;const s=I.current.segments;_(t=>({...t,streaming:!0,streamingMessageId:e,streamingSince:a&&t.streamingSince?t.streamingSince:Date.now(),statusLabel:a?`Continuing the task (part ${s+1})`:"Thinking",error:null,messages:t.messages.map(t=>t.id===e?{...t,status:"queued",content:"",error_code:null,error_message:null,retryable:null}:t)}));const o=new AbortController;y.current=o,x.current=e;const c=k.current,d=()=>!o.signal.aborted&&y.current===o&&k.current===c;try{var u,m;let a=null;if(A.current.prepareSemanticTurn)try{a=await A.current.prepareSemanticTurn(n,o.signal)}catch{a=null}if(!d())return;if(i&&A.current.prepareSemanticTurn&&!a)throw new r.NJ("unavailable","AURORA_SEMANTIC_RUNTIME_UNAVAILABLE","Aurora needs a fresh page observation to continue this task. Completed steps are preserved.");let s=!1,c=null;if(await(0,r.$H)({messageId:e,pageContext:t,semanticSessionId:null===(u=a)||void 0===u?void 0:u.semantic_session_id,semanticSnapshotId:null===(m=a)||void 0===m?void 0:m.semantic_snapshot_id,signal:o.signal,onEvent:t=>{d()&&(["complete","error","cancelled"].includes(t.kind)&&(s=!0,c=l(t,e)),U(t,e))}}),!d())return;if(!s)throw new r.NJ("offline","AURORA_STREAM_INTERRUPTED","The connection ended before Aurora finished. Completed steps are preserved; continue the task.");const p=$(c);if(p)return void R.current(e,t,n,p);b.current=!1,_(e=>({...e,streaming:!1,statusLabel:null}))}catch(h){if(!d())return;x.current=null,b.current=!1;const t=p(h);_(n=>({...n,streaming:!1,streamingMessageId:null,statusLabel:null,messages:n.messages.map(n=>n.id===e?{...n,status:"failed",error_code:t.code,error_message:t.message,retryable:t.retryable}:n),error:t}))}},[U]),B=(0,i.useCallback)(async(e,t,n,i)=>{const r=I.current;r.segments+=1,"delayed"===i?(r.transient+=1,_(e=>({...e,statusLabel:"Waiting for the page, then continuing"})),await new Promise(e=>window.setTimeout(e,1500))):r.transient=0,E.current||((0,a.Lp)("aurora_task_auto_continued",{segment:r.segments,reason:i}),await z(e,t,n,!0,!0))},[z]);R.current=B;const F=(0,i.useCallback)(async(e,t)=>{var n;if(b.current||f.streaming||f.legacyConfirmation)return;if(e.startsWith("local-")){const n=f.messages.findIndex(t=>t.id===e),i=n>0?[...f.messages.slice(0,n)].reverse().find(e=>"user"===e.role):null;if(!i)return;return _(t=>({...t,messages:t.messages.filter(t=>t.id!==e&&t.id!==i.id),error:null})),void await q(i.content,t)}const i=f.messages.findIndex(t=>t.id===e),a=i>0?[...f.messages.slice(0,i)].reverse().find(e=>"user"===e.role):null,r=f.messages.find(t=>t.id===e);I.current={started_at:Date.now(),segments:0,transient:0},E.current=!1,await z(e,t,(null===a||void 0===a?void 0:a.content)||"Retry the previous Aurora request.",Boolean(null===r||void 0===r||null===(n=r.task_progress)||void 0===n?void 0:n.can_continue),!1)},[z,q,f.legacyConfirmation,f.messages,f.streaming]),W=(0,i.useCallback)(async(e,t)=>{const n=k.current,i=await(0,r.wT)(e,t);n===k.current&&_(t=>{var n;return{...t,activeConversation:(null===(n=t.activeConversation)||void 0===n?void 0:n.id)===e?i:t.activeConversation,conversations:t.conversations.map(t=>t.id===e?i:t)}})},[]),H=(0,i.useCallback)(async e=>{var t;const n=k.current;await(0,r.ly)(e),n===k.current&&((null===(t=f.activeConversation)||void 0===t?void 0:t.id)===e&&(await D(),w.current+=1),S.current&&(S.current=null,C.current=!1),_(t=>{var n;return{...t,conversations:t.conversations.filter(t=>t.id!==e),...(null===(n=t.activeConversation)||void 0===n?void 0:n.id)===e?{activeConversation:null,messages:[],locked:!1,legacyConfirmation:null,legacyConfirmationPending:!1}:{}}}))},[null===(u=f.activeConversation)||void 0===u?void 0:u.id,D]),V=(0,i.useCallback)(async()=>{const e=k.current;await(0,r.Sb)(),e===k.current&&(await D(),w.current+=1,S.current=null,C.current=!1,_(e=>({...e,conversations:[],activeConversation:null,messages:[],locked:!1,legacyConfirmation:null,legacyConfirmationPending:!1})))},[D]),Y=(0,i.useCallback)(async(e,t)=>{_(n=>({...n,messages:n.messages.map(n=>n.id===e?{...n,feedback:t}:n)}));try{await(0,r.pO)(e,t),(0,a.Lp)("aurora_feedback_submitted",{rating:t})}catch{}},[]),G=(0,i.useCallback)(()=>{_(e=>({...e,error:null}))},[]);return(0,i.useMemo)(()=>({state:f,ensureConversation:T,refreshActiveConversation:L,refreshHistory:N,openConversation:O,send:q,stopGeneration:D,retry:F,rename:W,remove:H,clearAll:V,decideLegacyConfirmation:P,feedback:Y,dismissError:G}),[f,T,L,N,O,q,D,F,W,H,V,P,Y,G])}const v=(0,i.createContext)(null);function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,i.useContext)(v),a=h(e,t,Boolean(n));return(null===n||void 0===n?void 0:n.controller)||a}n.d(t,["S7",0,e=>{var t;return(null===(t=(0,i.useContext)(v))||void 0===t?void 0:t.scopeKey)||e},"aG",0,v,"q0",0,e=>{try{return window.sessionStorage.getItem(d(e))||""}catch{return""}},"tz",0,(e,t)=>{try{t?window.sessionStorage.setItem(d(e),t):window.sessionStorage.removeItem(d(e))}catch{}}])},51571(e,t,n){n.d(t,{SN:()=>u});var i=n(33006),a=n(34463),r=n(79103),s=n(51384),o=n(66772),l=n(3374);let c=null;(0,r._)(()=>{c=null});const d=(0,i.createContext)(null);function u(e){let{children:t}=e;const[n,r]=(0,i.useState)(()=>(0,o.o)()?c?{status:"ready",workspace:c}:{status:"loading"}:{status:"unavailable"}),u=(0,i.useCallback)(async()=>
2{if((0,o.o)())try{const e=await(0,s.C9)();if(!e||!e.commercial)return void r({status:"unavailable"});c=e,r({status:"ready",workspace:e})}catch(n){var e,t;const i=a.A.isAxiosError(n)&&null!==(e=null===(t=n.response)||void 0===t?void 0:t.status)&&void 0!==e?e:null;if(401===i||403===i||404===i)return void r({status:"unavailable"});r({status:"error"})}else r({status:"unavailable"})},[]);(0,i.useEffect)(()=>{"loading"===n.status&&u()},[u]);const m=(0,i.useMemo)(()=>({outcome:n,can:e=>"ready"===n.status&&!0===n.workspace.allowed_actions[e],refresh:u}),[n,u]);return(0,l.jsx)(d.Provider,{value:m,children:t})}n.d(t,["wU",0,()=>{const e=(0,i.useContext)(d);if(!e)throw new Error("useCommercial must be used inside CommercialProvider");return e}])},51384(e,t,n){var i=n(5487);const a=e=>`${"https://billing.edumark.ai".replace(/\/+$/,"")}${e}`;n.d(t,["C9",0,e=>i.default.get(a("/commercial/workspace"+(e?`?org_id=${encodeURIComponent(e)}`:""))),"Jx",0,e=>i.default.post(a("/commercial/quotes/preview"),{...e,offer:"standard"}),"Sn",0,e=>i.default.post(a(`/commercial/checkout/${encodeURIComponent(e)}/cancel`),{}),"fw",0,e=>i.default.post(a("/commercial/checkout/session"),e),"nd",0,e=>i.default.get(a(`/commercial/checkout/status?org_id=${encodeURIComponent(e)}`)),"t_",0,e=>i.default.post(a("/commercial/quotes"),{...e,offer:"standard"})])},66772(e,t,n){var i=n(63821);n.d(t,["o",0,()=>!(0,i.T4)()&&!1])},75607(e,t,n){var i=n(5487),a=n(17187),r=n(38970),s=n(50424),o=n(12517);const l=e=>`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${e}`,c=e=>e&&"object"===typeof e&&!Array.isArray(e)?e:{},d=e=>Array.isArray(e)?e:[],u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"string"!==typeof e&&"number"!==typeof e?t:String(e).trim()||t},m=e=>!0===e,p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=Number(e);return Number.isFinite(n)?n:t},h=(e,t,n)=>{var i;return null!==(i=e[t])&&void 0!==i?i:e[n]},v=e=>{var t;return null!==(t=c(e).data)&&void 0!==t?t:e},g=e=>{var t;const n=c(v(e));return c(null!==(t=n.data)&&void 0!==t?t:n)},f=e=>{var t,n,i;const a=c(e);return{id:u(null!==(t=a.id)&&void 0!==t?t:a._id),name:u(null!==(n=null!==(i=a.name)&&void 0!==i?i:a.display_name)&&void 0!==n?n:a.displayName,"EduMark member"),avatarUrl:u(h(a,"avatar_url","avatarUrl"))||null,role:u(a.role)||null}},_=e=>{const t=c(e),n=u(t.type,"none");return{type:["course","cohort","organisation","group","learner"].includes(n)?n:"none",id:u(t.id)||null,label:u(t.label)||null}},y=e=>{var t;const n=c(e),i=c(h(n,"reply_to","replyTo")),a=c(i.sender),r=u(n.status,"sent"),o=(0,s.W)(u(n.body),u(n.type,"text"),n.resource),l=d(n.attachments).map(e=>{var t;const n=c(e);return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),filename:u(n.filename,"Attachment"),contentType:u(h(n,"content_type","contentType"),"application/octet-stream"),sizeBytes:p(h(n,"size_bytes","sizeBytes")),downloadUrl:u(h(n,"download_url","downloadUrl"))}}).filter(e=>e.id);return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),clientId:u(h(n,"client_id","clientId"))||null,conversationId:u(h(n,"conversation_id","conversationId")),sender:f(n.sender),body:"deleted"===r?"":o.body,resource:"deleted"===r?null:o.resource,type:u(n.type,"text"),status:["pending","sent","delivered","read","failed","deleted"].includes(r)?r:"sent",replyTo:u(i.id)?{id:u(i.id),body:(0,s.W)(u(i.body),"resource",null).body,sender:f(a)}:null,createdAt:u(h(n,"created_at","createdAt"),(new Date).toISOString()),editedAt:u(h(n,"edited_at","editedAt"))||null,deletedAt:u(h(n,"deleted_at","deletedAt"))||null,attachments:l}},b=e=>{var t;const n=c(e),i=h(n,"latest_message","latestMessage"),a=u(n.type,"direct");return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),type:["direct","group","course","staff","system"].includes(a)?a:"direct",title:u(n.title,"Conversation"),participants:d(n.participants).map(f).filter(e=>e.id),context:_(n.context),latestMessage:Object.keys(c(i)).length?y(i):null,unreadCount:p(h(n,"unread_count","unreadCount")),isPinned:m(h(n,"is_pinned","isPinned")),isMuted:m(h(n,"is_muted","isMuted")),isArchived:m(h(n,"is_archived","isArchived")),updatedAt:u(h(n,"updated_at","updatedAt"),(new Date).toISOString())}},w=e=>{var t;const n=c(e),i=u(n.provider,"external"),a=u(n.status,"scheduled"),r=c(h(n,"provider_capabilities","providerCapabilities")),s={canCreate:m(h(r,"can_create","canCreate")),canU
2pdate:m(h(r,"can_update","canUpdate")),canCancel:m(h(r,"can_cancel","canCancel")),canEmbed:m(h(r,"can_embed","canEmbed")),canOpenExternal:!1!==r.can_open_external&&!1!==r.canOpenExternal,supportsHostControls:m(h(r,"supports_host_controls","supportsHostControls")),supportsCalendarInvites:m(h(r,"supports_calendar_invites","supportsCalendarInvites")),supportsAttendanceSync:m(h(r,"supports_attendance_sync","supportsAttendanceSync")),supportsRecordings:m(h(r,"supports_recordings","supportsRecordings"))},l=c(h(n,"provider_sync_error","providerSyncError")),v=["external","in_person","google_meet","microsoft_teams","zoom","edumark_live"].includes(i)?i:"external",g=d(n.resources).map(e=>{var t;const n=c(e);return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),title:u(n.title,"Session resource"),url:u(n.url),kind:u(n.kind,"resource")}}),y=d(n.participants).map(e=>{const t=c(e);return{...f(t),attendanceStatus:k(h(t,"attendance_status","attendanceStatus")),checkedInAt:u(h(t,"checked_in_at","checkedInAt"))||null,checkInMethod:A(h(t,"check_in_method","checkInMethod"))}});return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),organizationId:u(h(n,"organization_id","organizationId"))||null,courseId:u(h(n,"course_id","courseId"))||null,moduleId:u(h(n,"module_id","moduleId"))||null,courseStepId:u(h(n,"course_step_id","courseStepId"))||null,markingCaseId:u(h(n,"marking_case_id","markingCaseId"))||null,organizerId:u(h(n,"organizer_id","organizerId"))||null,title:u(n.title,"Live session"),description:u(n.description)||null,status:["draft","scheduled","starting_soon","live","completed","ended","cancelled"].includes(a)?a:"scheduled",startAt:u(h(n,"start_at","startAt")),endAt:u(h(n,"end_at","endAt")),timezone:u(n.timezone,"Europe/London"),provider:v,providerConnectionId:u(h(n,"provider_connection_id","providerConnectionId"))||null,providerMeetingId:u(h(n,"provider_meeting_id","providerMeetingId"))||null,providerMetadata:c(h(n,"provider_metadata","providerMetadata")),provisioningStatus:u(h(n,"provisioning_status","provisioningStatus"),"not_created"),providerSyncError:u(l.code)?{code:u(l.code),message:u(l.message,"The provider operation failed."),retryable:!1!==l.retryable}:null,providerCapabilities:s,joinUrl:u(h(n,"join_url","joinUrl"))||null,hostUrl:u(h(n,"host_url","hostUrl"))||null,joinMode:u(h(n,"join_mode","joinMode"),"external_only"),learnerVisibility:u(h(n,"learner_visibility","learnerVisibility"),"scheduled"),attendanceEnabled:!1!==h(n,"attendance_enabled","attendanceEnabled"),location:u(n.location)||null,checkIn:S(h(n,"check_in","checkIn")),myAttendance:C(h(n,"my_attendance","myAttendance")),providerLabel:u(h(n,"provider_label","providerLabel"),(0,o.sQ)(v)),host:f(n.host),additionalHosts:d(h(n,"additional_hosts","additionalHosts")).map(f),participants:y,participantCount:p(h(n,"participant_count","participantCount"),y.length),context:_(n.context),agenda:u(n.agenda)||null,cancellationMessage:u(h(n,"cancellation_message","cancellationMessage"))||null,recurrenceLabel:u(h(n,"recurrence_label","recurrenceLabel"))||null,reminders:d(n.reminders).map(e=>p(e)).filter(e=>e>=0),resources:g,canEdit:m(h(n,"can_edit","canEdit")),canCancel:m(h(n,"can_cancel","canCancel")),canManageAttendance:m(h(n,"can_manage_attendance","canManageAttendance")),canRunCheckIn:m(h(n,"can_run_check_in","canRunCheckIn")),canCheckIn:m(h(n,"can_check_in","canCheckIn")),revision:p(n.revision,1),createdAt:u(h(n,"created_at","createdAt")),updatedAt:u(h(n,"updated_at","updatedAt"))}},x=["invited","accepted","declined","joined","attended","partially_attended","late","absent","excused","unknown"],k=e=>{const t=u(e,"unknown");return x.includes(t)?t:"unknown"},A=e=>{const t=u(e);return"qr"===t||"code"===t?t:null},j=e=>{const t=u(e,"unavailable");return["unavailable","not_yet_open","open","paused","closed"].includes(t)?t:"unavailable"},S=e=>{if(!e||"object"!==typeof e)return null;const t=c(e),n=u(t.handle);return n?{state:j(t.state),handle:n,attendPath:u(h(t,"attend_path","attendPath"),`/attend/${n}`),rotationSeconds:p(h(t,"rotation_seconds","rotationSeconds"),30),opensMinutesBefore:p(h(t,"opens_minutes_before","opensMinutesBefore"),15),closesMinutesAfter:p(h(t,"closes_minutes_after","closesMinutesAfter"),15),lateAfterMinutes:p(h(t,"late_after_minutes","lateAfterMinutes"),10),manualCodeEnabled:!1!==h(t,"manual_code_enabled","manualCodeEnabled"),opensAt:u(h(t,"opens_at","opensAt"))||null,closesAt:u(h(t,"closes_at","closesAt"))||null,lateAfter:u(h(t,"late_after","lateAfter"))||null,openedAt:u(h(t,"opened_at","openedAt"))||null,pausedAt:u(h(t,"paused_at","pausedAt"))||null,closedAt:u(h(t,"closed_at","closedAt"))||null,checkedInCount:p(h(t,"checked_in_count","checkedInCount"),0)}:null},C=e=>{if(!e||"object"!==typeof e)return null;const t=c(e);return{status:k(t.status),checkedInAt:u(h(t,"checked_in_at","checkedInAt"))||null,method:A(t.method)}},I=e=>e?{rotation_seconds:e.rotationSeconds,opens_minutes_before:e.opensMinutesBefore,closes_minutes_after:e.closesMinutesAfter,late_after_minutes:e.lateAfterMinutes,manual_code_enabled:e.manualCodeEnabled}:void 0,E=e=>{const t=c(e);
2return{canCreate:m(h(t,"can_create","canCreate")),canUpdate:m(h(t,"can_update","canUpdate")),canCancel:m(h(t,"can_cancel","canCancel")),canEmbed:m(h(t,"can_embed","canEmbed")),canOpenExternal:!1!==t.can_open_external&&!1!==t.canOpenExternal,supportsHostControls:m(h(t,"supports_host_controls","supportsHostControls")),supportsCalendarInvites:m(h(t,"supports_calendar_invites","supportsCalendarInvites")),supportsAttendanceSync:m(h(t,"supports_attendance_sync","supportsAttendanceSync")),supportsRecordings:m(h(t,"supports_recordings","supportsRecordings"))}},R=(e,t)=>{var n;const i=g(e);return{items:d(null!==(n=i.items)&&void 0!==n?n:i.results).map(t),nextCursor:u(h(i,"next_cursor","nextCursor"))||null,total:null==i.total?null:p(i.total)}},$=e=>{const t=c(e),n=c(h(t,"manual_override","manualOverride"));return{participant:f(t.participant),status:k(t.status),source:u(t.source,"unknown"),checkedInAt:u(h(t,"checked_in_at","checkedInAt"))||null,checkInMethod:A(h(t,"check_in_method","checkInMethod")),manualOverride:Object.keys(n).length?{actorId:u(h(n,"actor_id","actorId"))||null,at:u(n.at)||null,note:u(n.note)||null}:null,updatedAt:u(h(t,"updated_at","updatedAt"))||null}},N=async(e,t)=>{const n=g(await i.default.patch(l(`/live-sessions/${encodeURIComponent(e)}/attendance`),{updates:Object.fromEntries(Object.entries(t).map(e=>{let[t,n]=e;return[t,{status:n.status,note:n.note||void 0}]}))}));return d(n.items).map($)},T=e=>{const t=c(e);return{id:u(t.id),title:u(t.title,"Session"),startAt:u(h(t,"start_at","startAt")),endAt:u(h(t,"end_at","endAt")),timezone:u(t.timezone,"Europe/London"),location:u(t.location)||null,host:f(t.host),contextLabel:u(h(t,"context_label","contextLabel"))||null}},L=e=>{const t=c(v(e)),n=c(t.summary);return{session:T(t.session),state:j(t.state),checkIn:S(h(t,"check_in","checkIn")),serverTime:u(h(t,"server_time","serverTime")),codes:d(t.codes).map(e=>{const t=c(e);return{epoch:p(t.epoch),token:u(t.token),manualCode:u(h(t,"manual_code","manualCode"))||null,validFrom:u(h(t,"valid_from","validFrom")),validUntil:u(h(t,"valid_until","validUntil"))}}),summary:{expected:p(n.expected),checkedIn:p(h(n,"checked_in","checkedIn")),present:p(n.present),late:p(n.late),absent:p(n.absent),excused:p(n.excused),remaining:p(n.remaining)},recent:d(t.recent).map(e=>{const t=c(e);return{participant:f(t.participant),status:k(t.status),at:u(t.at),method:A(t.method)}}),roster:d(t.roster).map(e=>{const t=c(e);return{participant:f(t.participant),status:k(t.status),checkedInAt:u(h(t,"checked_in_at","checkedInAt"))||null,checkInMethod:A(h(t,"check_in_method","checkInMethod")),manualOverride:m(h(t,"manual_override","manualOverride"))}})}},O=e=>e.recurrence||{frequency:"none"},M=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{quietHoursStart:null,quietHoursEnd:null,timezone:"Europe/London",readReceipts:!0,emailWhenOffline:!1,eventChannels:{}};const i=c(v(e)),a=h(i,"event_channels","eventChannels");return{notificationPreset:void 0!==i.notification_preset||void 0!==i.notificationPreset?D(h(i,"notification_preset","notificationPreset")):null!==(t=n.notificationPreset)&&void 0!==t?t:null,quietHoursStart:void 0!==i.quiet_hours_start||void 0!==i.quietHoursStart?u(h(i,"quiet_hours_start","quietHoursStart"))||null:n.quietHoursStart,quietHoursEnd:void 0!==i.quiet_hours_end||void 0!==i.quietHoursEnd?u(h(i,"quiet_hours_end","quietHoursEnd"))||null:n.quietHoursEnd,timezone:void 0!==i.timezone?u(i.timezone,n.timezone):n.timezone,readReceipts:void 0!==i.read_receipts||void 0!==i.readReceipts?m(h(i,"read_receipts","readReceipts")):n.readReceipts,emailWhenOffline:void 0!==i.email_when_offline||void 0!==i.emailWhenOffline?m(h(i,"email_when_offline","emailWhenOffline")):n.emailWhenOffline,eventChannels:void 0===a?n.eventChannels:{...n.eventChannels,...Object.fromEntries(Object.entries(c(a)).map(e=>{let[t,n]=e;return[t,d(n).filter(e=>"in_app"===e||"email"===e||"browser"===e)]}))}}},U=e=>{var t;const n=c(v(e));return{id:u(null!==(t=n.id)&&void 0!==t?t:n._id),title:u(n.title,"Announcement"),body:u(n.body),targetType:u(h(n,"target_type","targetType"),"organisation"),targetId:u(h(n,"target_id","targetId"))||null,recipientCount:p(h(n,"recipient_count","recipientCount")),acknowledgementRequired:m(h(n,"acknowledgement_required","acknowledgementRequired")),acknowledgedAt:u(h(n,"acknowledged_at","acknowledgedAt"))||null,canAcknowledge:m(h(n,"can_acknowledge","canAcknowledge")),publishedAt:u(h(n,"published_at","publishedAt")),audience:n.audience||null,isPinned:m(h(n,"is_pinned","isPinned")),expiresAt:u(h(n,"expires_at","expiresAt"))||null,isExpired:m(h(n,"is_expired","isExpired")),status:"archived"===n.status?"archived":"published",canManage:m(h(n,"can_manage","canManage")),revision:p(n.revision,1)}},P=e=>{const t=c(v(e));return{revision:p(t.revision),learnerMessaging:u(h(t,"learner_messaging","learnerMessaging"),"staff_only"),learnersCanCreateGroups:m(h(t,"learners_can_create_groups","learnersCanCreateGroups")),allowBlocking:!1!==t.allow_blocking&&!1!==t.allowBlocking,allowReadReceipts:!1!==t.allow_read_receipts&&!1!==t.allowReadReceipts,allowAttachments:!1!==t.allow_attachments&&!1!==t.allowAttachments,allowExternalLinks:!1!==t.allow_external_links&&!1!==t.allowExternalLinks,messageRetentionDays:p(h(t,"message_retention_days","messageRetentionDays"),2555),recordingPolicy:u(h(t,"recording_policy","recordingPolicy"),"optional"),transcriptPolicy:u(h(t,"transcript_policy","transcriptPolicy"),"optional"),mandatoryNotificationChannels:Object.fromEntries(Object.entries(c(h(t,"mandatory_notification_channels","mandatoryNotificationChannels"))).map(e=>{let[t,n]=e;return[t,d(n).filter(e=>"in_app"===e||"email"===e||"browser"===e)]}))}},q=e=>{var t,n,i,a;const s=c(e);return{id:u(null!==(t=s.id)&&void 0!==t?t:s._id),eventType:u(h(s,"event_type","eventType"),"notification.created"),title:u(s.title,"EduMark update"),body:u(null!==(n=s.body)&&void 0!==n?n:s.message),actionUrl:(0,r.M)(u(null!==(i=h(s,"action_url","actionUrl"))&&void 0!==i?i:s.link),c(s.payload).assignment_draft_id),payload:c(s.payload),isRead:m(null!==(a=h(s,"is_read","isRead"))&&void 0!==a?a:s.read),createdAt:u(h(s,"created_at","createdAt"),(new Date).toISOString())}},D=e=>"recommended"===e||"email_off"===e?e:null,z=async()=>{const e=c(v(await i.default.get(l("/communications/notification-catalogue"))));return{groups:d(e.groups).map(e=>{const t=c(e);return{name:u(t.name,"Notifications"),items:d(t.items).map(e=>{var n,i,a;const r=c(e);return{eventType:u(h(r,"event_type","eventType")),label:u(r.label,"Notification"),description:u(r.description),group:u(r.group,u(t.name,"Notifications")),scope:u(r.scope,"user"),availableChannels:d(h(r,"available_channels","availableChannels")).filter(e=>"in_app"===e||"email"===e||"browser"===e),defaultChannels:d(h(r,"default_channels","defaultChannels")).filter(e=>"in_app"===e||"email"===e||"browser"===e),mandatoryChannels:d(h(r,"mandatory_channels","mandatoryChannels")).filter(e=>"in_app"===e||"email"===e||"browser"===e),selectedChannels:d(null!==(n=h(r,"selected_channels","selectedChannels"))&&void 0!==n?n:h(r,"default_channels","defaultChannels")).filter(e=>"in_app"===e||"email"===e||"browser"===e),effectiveChannels:d(null!==(i=null!==(a=h(r,"effective_channels","effectiveChannels"))&&void 0!==a?a:h(r,"selected_channels","selectedChannels"))&&void 0!==i?i:h(r,"default_channels","defaultChannels")).filter(e=>"in_app"===e||"email"===e||"browser"===e),editable:!1!==h(r,"editable","editable"),urgency:u(r.urgency,"normal")}}).filter(e=>e.eventType)}}),presets:d(e.presets).flatMap(e=>{const t=c(e),n=D(t.id);return n?[{id:n,label:u(t.label),description:u(t.description)}]:[]}),accessSummary:d(h(e,"access_summary","accessSummary")).map(e=>
2u(e)).filter(Boolean),recommendedPresetId:D(h(e,"recommended_preset_id","recommendedPresetId")),activePreset:D(h(e,"active_preset","activePreset"))}};n.d(t,["Ah",0,async e=>{const t=c(v(await i.default.post(l("/live-sessions/check-in"),{handle:e.handle,token:"token"in e?e.token:void 0,code:"code"in e?e.code:void 0})));return{status:k(t.status),alreadyCheckedIn:m(h(t,"already_checked_in","alreadyCheckedIn")),checkedInAt:u(h(t,"checked_in_at","checkedInAt"))||null,late:m(t.late),method:A(t.method),session:T(t.session)}},"EC",0,async e=>U(await i.default.post(l("/communications/announcements"),{title:e.title,body:e.body,target_type:e.targetType,target_id:e.targetId||void 0,recipient_ids:e.recipientIds||[],role:e.role||void 0,acknowledgement_required:Boolean(e.acknowledgementRequired),audience:e.audience||void 0,is_pinned:Boolean(e.isPinned),expires_at:e.expiresAt||null,idempotency_key:e.idempotencyKey})),"EL",0,(e,t)=>i.default.patch(l(`/communications/conversations/${encodeURIComponent(e)}`),t).then(b),"FI",0,N,"Fx",0,async()=>{const e=g(await i.default.get(l("/integrations/live-session-providers")));return d(e.items).map(e=>{const t=c(e),n=u(t.provider,"external"),i=u(t.status,"not_connected"),a=h(t,"configured","configured"),r="boolean"===typeof a?a:"unavailable"!==i,s=h(t,"connectable","connectable"),l=u(h(t,"configuration_message","configurationMessage")),v=`${u(t.label,(0,o.sQ)(n))} isn't currently available in this EduMark environment.`,g=u(h(t,"configuration_status","configurationStatus"));return{provider:n,label:u(t.label,(0,o.sQ)(n)),status:i,configured:r,connectable:"boolean"===typeof s?s:r&&"external"!==n,configurationStatus:r?"ready":"configuration_required"===g?"configuration_required":"unavailable",configurationMessage:l||(r?"Ready to connect an account.":v),configurationIssues:d(h(t,"configuration_issues","configurationIssues")).map(e=>{const t=c(e);return{code:u(t.code||e),configKey:u(h(t,"config_key","configKey"))||null}}).filter(e=>Boolean(e.code)),automaticCreation:m(h(t,"automatic_creation","automaticCreation")),capabilities:E(t.capabilities),connections:d(t.connections).map(e=>{const t=c(e);return{id:u(t.id),ownerType:u(h(t,"owner_type","ownerType"),"user"),ownerId:u(h(t,"owner_id","ownerId")),accountEmail:u(h(t,"account_email","accountEmail"))||null,accountDisplayName:u(h(t,"account_display_name","accountDisplayName"))||null,status:u(t.status,"not_connected"),statusReasonCode:u(h(t,"status_reason_code","statusReasonCode"))||null,statusReason:u(h(t,"status_reason","statusReason"))||null,connectedAt:u(h(t,"connected_at","connectedAt"))||null,updatedAt:u(h(t,"updated_at","updatedAt"))||null,expiresAt:u(h(t,"expires_at","expiresAt"))||null,revision:p(t.revision,1)}})}})},"IA",0,z,"Ig",0,(e,t,n)=>i.default.post(l(`/communications/messages/${encodeURIComponent(e)}/report`),{reason:t,details:n||void 0}),"Jj",0,e=>i.default.post(l(`/communications/notifications/${encodeURIComponent(e)}/read`)),"M",0,(e,t)=>{var n,i,a,r;const s=c(c(e).response),o=c(s.data),l=c(o.detail),d=c(o.error),m=u(null!==(n=null!==(i=d.code)&&void 0!==i?i:l.code)&&void 0!==n?n:o.code);return u(null!==(a=null!==(r=d.message)&&void 0!==r?r:l.message)&&void 0!==a?a:o.message,{PROVIDER_CONNECTION_UNAVAILABLE:"This provider connection is not available. Check the integration readiness and try again.",PROVIDER_CREDENTIALS_UNAVAILABLE:"The connected account credentials could not be used. Reconnect the provider and try again.",PROVIDER_REDIRECT_UNAVAILABLE:"Provider sign-in redirects are not configured for this deployment.",PROVIDER_AUTH_EXPIRED:"The provider authorization has expired. Reconnect the account and try again.",PROVIDER_CONNECTION_REQUIRED:"Connect an account for this provider before creating the meeting.",PROVIDER_CAPABILITY_UNAVAILABLE:"This provider does not support the requested meeting action."}[m]||t)},"O3",0,async(e,t)=>{const n={};"quietHoursStart"in e&&(n.quiet_hours_start=e.quietHoursStart),"quietHoursEnd"in e&&(n.quiet_hours_end=e.quietHoursEnd),"timezone"in e&&(n.timezone=e.timezone),"readReceipts"in e&&(n.read_receipts=e.readReceipts),"emailWhenOffline"in e&&(n.email_when_offline=e.emailWhenOffline),"eventChannels"in e&&(n.event_channels=e.eventChannels),"notificationPreset"in e&&(n.notification_preset=e.notificationPreset);const a=await i.default.patch(l("/communications/preferences"),n),r=t?{...t,...e,eventChannels:e.notificationPreset?{}:{...t.eventChannels,...e.eventChannels}}:void 0;return M(a,r)},"PS",0,async(e,t)=>U(await i.default.patch(l(`/communications/announcements/${encodeURIComponent(e.id)}`),{revision:e.revision,...void 0!==t.isPinned?{is_pinned:t.isPinned}:{},...void 0!==t.status?{status:t.status}:{},...void 0!==t.expiresAt?{expires_at:t.expiresAt}:{}})),"Pd",0,async e=>w(await i.default.post(l(`/live-sessions/${encodeURIComponent(e)}
2/provider/sync`))),"Q",0,e=>i.default.delete(l(`/communications/users/${encodeURIComponent(e)}/block`)),"RC",0,e=>i.default.delete(l(`/communications/messages/${encodeURIComponent(e)}`)),"S2",0,async e=>{const t=c(v(await i.default.post(l(`/communications/announcements/${encodeURIComponent(e)}/acknowledge`))));return u(h(t,"acknowledged_at","acknowledgedAt"),(new Date).toISOString())},"TA",0,async e=>w(await i.default.get(l(`/live-sessions/${encodeURIComponent(e)}`))),"TI",0,async e=>b(await i.default.post(l("/communications/conversations"),{type:"direct",participant_ids:[e],context:{type:"learner",id:e,label:null}})),"Tc",0,async(e,t)=>b(await i.default.post(l("/communications/conversations"),{type:"group",title:e,participant_ids:t,context:{type:"group",id:null,label:e}})),"Wj",0,async(e,t)=>w(await i.default.patch(l(`/live-sessions/${encodeURIComponent(e)}`),{title:t.title,description:t.description,agenda:t.agenda,start_at:t.startAt,end_at:t.endAt,timezone:t.timezone,provider:t.provider,meeting_url:t.meetingUrl,provider_connection_id:t.providerConnectionId,join_mode:t.joinMode,learner_visibility:t.learnerVisibility,attendance_enabled:t.attendanceEnabled,location:t.location,check_in:I(t.checkIn),host_id:t.hostId,additional_host_ids:t.additionalHostIds,reminders:t.reminders,expected_revision:t.expectedRevision,edit_scope:t.editScope||"this"})),"Wr",0,e=>{const t=c(e),n=c(t.response),i=c(n.data),a=c(i.detail),r=c(i.error);return u(a.code)||u(r.code)||u(i.code)||null},"Xh",0,async function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return R(await i.default.get(l("/communications/announcements"),{params:{limit:null!==(e=t.limit)&&void 0!==e?e:30,cursor:t.cursor,view:t.view,status:t.status,announcement_id:t.announcementId},signal:t.signal}),U)},"ZI",0,async()=>M(await i.default.get(l("/communications/preferences"))),"_z",0,async function(e,t,n,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return y(await i.default.post(l(`/communications/conversations/${encodeURIComponent(e)}/messages`),{body:t,client_id:n,reply_to_id:a||void 0,attachment_ids:r,type:"text"}))},"b3",0,async(e,t)=>w(await i.default.delete(l(`/live-sessions/${encodeURIComponent(e)}/provider/meeting`),{data:{expected_revision:t}})),"b9",0,async e=>{const t=c(v(await i.default.post(l(`/live-sessions/${encodeURIComponent(e)}/join`))));return{joinUrl:u(h(t,"join_url","joinUrl")),hostUrl:u(h(t,"host_url","hostUrl"))||null,provider:u(t.provider,"external"),joinMode:u(h(t,"join_mode","joinMode"),"external_only"),embeddedAvailable:m(h(t,"embedded_available","embeddedAvailable")),renderer:u(t.renderer,"external"),capabilities:E(t.capabilities),embedUnavailableReason:u(h(t,"embed_unavailable_reason","embedUnavailableReason"))||void 0,zoomSdk:t.zoom_sdk&&"object"===typeof t.zoom_sdk?{signature:u(c(t.zoom_sdk).signature),meetingNumber:u(c(t.zoom_sdk).meeting_number),password:u(c(t.zoom_sdk).password),userName:u(c(t.zoom_sdk).user_name),expiresAt:u(c(t.zoom_sdk).expires_at),zak:u(c(t.zoom_sdk).zak)||void 0}:void 0}},"bX",0,async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await i.default.get(l("/communications/conversations"),{params:{search:e.search||void 0,filter:e.filter||"inbox",cursor:e.cursor||void 0,limit:50}});return R(t,b)},"bb",0,async e=>{const t=g(await(0,a.G)(l("/communications/notifications"),{params:{cursor:e||void 0,limit:50}}));return{items:d(t.items).map(q).filter(e=>e.id),unreadCount:p(h(t,"unread_count","unreadCount")),nextCursor:u(h(t,"next_cursor","nextCursor"))||null}},"fY",0,async(e,t,n)=>w(await i.default.post(l(`/live-sessions/${encodeURIComponent(e)}/cancel`),{expected_revision:t,edit_scope:"this",message:n||void 0})),"gX",0,async(e,t)=>L(await i.default.patch(l(`/live-sessions/${encodeURIComponent(e)}/check-in`),{action:t})),"gs",0,async(e,t)=>{var n;const a=new FormData;a.append("file",t);const r=c(v(await i.default.post(l(`/communications/conversations/${encodeURIComponent(e)}/attachments`),a,{headers:{"Content-Type":"multipart/form-data"}})));return{id:u(null!==(n=r.id)&&void 0!==n?n:r._id),filename:u(r.filename,t.name),contentType:u(h(r,"content_type","contentType"),t.type||"application/octet-stream"),sizeBytes:p(h(r,"size_bytes","sizeBytes"),t.size),downloadUrl:u(h(r,"download_url","downloadUrl"))}},"h3",0,async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"user",a=arguments.length>3?arguments[3]:void 0;const r=c(v(await i.default.post(l(`/integrations/${e}/connect`),{owner_type:n,return_path:t,...a?{replace_connection_id:a}:{}}
2)));return{authorizationUrl:u(h(r,"authorization_url","authorizationUrl")),expiresAt:u(h(r,"expires_at","expiresAt"))}},"hY",0,async(e,t,n,i)=>N(e,{[t]:{status:n,note:i}}),"ik",0,async e=>b(await i.default.get(l(`/communications/conversations/${encodeURIComponent(e)}`))),"ix",0,async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:`frontend-provision-${crypto.randomUUID()}`;return w(await i.default.post(l(`/live-sessions/${encodeURIComponent(e)}/provider/provision`),{expected_revision:t,idempotency_key:n}))},"kH",0,async()=>{await i.default.post(l("/communications/operations/wake-delivery-worker"))},"l3",0,async()=>P(await i.default.get(l("/communications/policy"))),"lj",0,async(e,t)=>{const n=await i.default.get(l(`/communications/conversations/${encodeURIComponent(e)}/messages`),{params:{cursor:t||void 0,limit:75}}),a=R(n,y);return{...a,items:[...a.items].sort((e,t)=>e.createdAt.localeCompare(t.createdAt))}},"m5",0,async e=>{const t=c(v(await i.default.get(l(`/live-sessions/check-in/${encodeURIComponent(e)}`))));return{session:T(t.session),state:j(t.state),checkIn:S(h(t,"check_in","checkIn")),serverTime:u(h(t,"server_time","serverTime")),isParticipant:m(h(t,"is_participant","isParticipant")),isHost:m(h(t,"is_host","isHost")),myAttendance:C(h(t,"my_attendance","myAttendance")),canCheckIn:m(h(t,"can_check_in","canCheckIn"))}},"n3",0,async e=>{const t=await i.default.get(l(`/communications/attachments/${encodeURIComponent(e.id)}`),{responseType:"blob"}),n=c(t),a=n.data instanceof Blob?n.data:new Blob([n.data]),r=URL.createObjectURL(a),s=document.createElement("a");s.href=r,s.download=e.filename,s.click(),window.setTimeout(()=>URL.revokeObjectURL(r),0)},"oP",0,async e=>L(await i.default.get(l(`/live-sessions/${encodeURIComponent(e)}/check-in`))),"rX",0,async()=>{const e=c(v(await i.default.get(l("/communications/operations/delivery-health")))),t=c(e.counts);return{overdueCount:p(e.overdue_count),oldestWaitSeconds:p(e.oldest_wait_seconds),counts:{queued:p(t.queued),sent:p(t.sent),failed:p(t.failed),skipped:p(t.skipped),suppressed:p(t.suppressed)},failures:d(e.failures).map(e=>{const t=c(e);return{id:u(t.id),eventType:u(h(t,"event_type","eventType")),channel:u(t.channel),recipientUserId:u(h(t,"recipient_user_id","recipientUserId")),recipientName:u(h(t,"recipient_name","recipientName")),status:u(t.status),title:u(t.title),error:u(t.error)||null,reasonCode:u(h(t,"reason_code","reasonCode"))||null,reasonLabel:u(h(t,"reason_label","reasonLabel"))||null,createdAt:u(h(t,"created_at","createdAt"))||null,attempts:p(t.attempts),nextAttemptAt:u(h(t,"next_attempt_at","nextAttemptAt"))||null,correlationId:u(h(t,"correlation_id","correlationId"))||null}})}},"s0",0,async(e,t)=>{await i.default.delete(l(`/integrations/connections/${encodeURIComponent(e)}`),{data:{expected_revision:t}})},"tA",0,async()=>(await z()).groups,"tL",0,async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=g(await i.default.get(l("/communications/operations/deliveries"),{params:{event:e.event||void 0,channel:e.channel||void 0,recipient:e.recipient||void 0,status:e.status||void 0,date_from:e.dateFrom?new Date(e.dateFrom).toISOString():void 0,date_to:e.dateTo?new Date(e.dateTo).toISOString():void 0,limit:200}}));return d(t.items).map(e=>{const t=c(e);return{ageSeconds:p(t.age_seconds),overdue:!0===t.overdue,id:u(t.id),eventType:u(h(t,"event_type","eventType")),channel:u(t.channel),recipientUserId:u(h(t,"recipient_user_id","recipientUserId")),recipientName:u(h(t,"recipient_name","recipientName")),status:u(t.status),title:u(t.title),error:u(t.error)||null,reasonCode:u(h(t,"reason_code","reasonCode"))||null,reasonLabel:u(h(t,"reason_label","reasonLabel"))||null,createdAt:u(h(t,"created_at","createdAt"))||null,attempts:p(t.attempts),nextAttemptAt:u(h(t,"next_attempt_at","nextAttemptAt"))||null,correlationId:u(h(t,"correlation_id","correlationId"))||null}})},"t_",0,()=>i.default.post(l("/communications/notifications/read-all")),"u_",0,async(e,t)=>y(await i.default.patch(l(`/communications/messages/${encodeURIComponent(e)}`),{body:t})),"ub",0,async()=>{var e;const t=c(v(await i.default.get(l("/communications/operations/scheduler-health")))),n=d(null!==(e=t.items)&&void 0!==e?e:t.checks),a=n.length?n.map((e,t)=>{const n=c(e);return[u(n.id,`scheduler_check_${t+1}`),e]}):Object.entries(t);return Object.fromEntries(a.map(e=>{let[t,n]=e;const i=c(n);return[t,{id:u(i.id,t),label:u(i.label,t.replaceAll("_"," ").replace(/^./,e=>e.toUpperCase())),healthy:m(i.healthy),status:u(i.status,"never_run"),lastSuccess:u(h(i,"last_success","lastSuccess"))||null,lastRunAt:u(h(i,"last_run_at","lastRunAt"))||null,nextRunAt:u(h(i,"next_run_at","nextRunAt"))||null,ageSeconds:null==i.age_seconds?null:p(i.age_seconds),lastDurationMs:null==i.last_duration_ms?null:p(h(i,"last_duration_ms","lastDurationMs")),eventsEmitted:p(h(i,"events_emitted","eventsEmitted")),deliveries:p(i.deliveries),failures:p(i.failures),error:u(i.error)||null}]}))},"vB",0,e=>i.default.post(l(`/communications/users/${encodeURIComponent(e)}/block`)),"vs",0,e=>i.default.post(l(`/communications/conversations/${encodeURIComponent(e)}/read`)),"wE",0,async e=>P(await i.default.patch(l("/communications/policy"),{expected_revision:e.revision,learner_messaging:e.learnerMessaging,learners_can_create_groups:e.learnersCanCreateGroups,allow_blocking:e.allowBlocking,allow_read_receipts:e.allowReadReceipts,allow_attachments:e.allowAttachments,allow_external_links:e.allowExternalLinks,message_retention_days:e.messageRetentionDays,recording_policy:e.recordingPolicy,transcript_policy:e.transcriptPolicy,mandatory_notification_channels:e.mandatoryNotificationChannels})),"wV",0,async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return R(await i.default.get(l("/live-sessions"),{params:{view:e.view||"upcoming",course_id:e.courseId||void 0,learner_id:e.learnerId||void 0,limit:100}}),w)},"xQ",0,async e=>{var t,n;const a=w(await i.default.post(l("/live-sessions"),{title:e.title,de
2scription:e.description||void 0,start_at:e.startAt,end_at:e.endAt,timezone:e.timezone,provider:e.provider,meeting_url:e.meetingUrl||void 0,location:e.location||void 0,check_in:I(e.checkIn),provider_connection_id:e.providerConnectionId||void 0,module_id:e.moduleId||void 0,course_step_id:e.courseStepId||void 0,marking_case_id:e.markingCaseId||void 0,status:e.status||"scheduled",join_mode:e.joinMode||"external_only",learner_visibility:e.learnerVisibility||"scheduled",attendance_enabled:null===(t=e.attendanceEnabled)||void 0===t||t,provision:null!==(n=e.provision)&&void 0!==n&&n,host_id:e.hostId||void 0,additional_host_ids:e.additionalHostIds||[],target_type:e.targetType,target_id:e.targetId||void 0,participant_ids:e.participantIds||[],reminders:e.reminders,recurrence:O(e),idempotency_key:e.idempotencyKey||`frontend-${crypto.randomUUID()}`}));if(e.markingCaseId&&(!a.id||a.markingCaseId!==e.markingCaseId||Date.parse(a.startAt)!==Date.parse(e.startAt)||Date.parse(a.endAt)!==Date.parse(e.endAt)))throw new Error("The response did not confirm the call linked to this submission. Your details are kept; retry to confirm the saved session.");return a}])},59432(e,t,n){n.d(t,{SN:()=>i});function i(e){for(const[t,n]of[["/communications/pages","/community/resources"],["/communications/announcements","/community/announcements"]])if(e===t||e.startsWith(`${t}/`))return n+e.slice(t.length);return null}},821(e,t,n){n.d(t,["N",0,()=>!0])},12517(e,t,n){const i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(["draft","cancelled","completed","ended"].includes(e.status))return e.status;if("live"===e.status)return"live";const n=t.getTime(),i=new Date(e.startAt).getTime(),a=new Date(e.endAt).getTime();return Number.isFinite(i)&&Number.isFinite(a)?n>=i&&n<a?"live":n>=a?"completed":n<i&&i-n<=36e5?"starting_soon":e.status:e.status},a={invited:"Not yet",accepted:"Accepted",declined:"Declined",joined:"Joined",attended:"Present",partially_attended:"Partly attended",late:"Late",absent:"Absent",excused:"Excused",unknown:"Unknown"};n.d(t,["Gn",0,e=>"attended"===e||"joined"===e||"partially_attended"===e?"present":"late"===e?"late":"absent"===e||"declined"===e?"absent":"neutral","ID",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;const n=Math.ceil((new Date(e).getTime()-t.getTime())/1e3);return Number.isFinite(n)?Math.max(0,n):0},"Pt",0,e=>({unavailable:"Check-in unavailable",not_yet_open:"Check-in opens before the session",open:"Check-in open",paused:"Check-in paused",closed:"Check-in closed"}[e]),"Qu",0,["attended","late","partially_attended","absent","excused","invited"],"Wx",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;const n=new Date(e).getTime()-t.getTime();if(!Number.isFinite(n)||n<=0)return null;const i=Math.max(1,Math.ceil(n/6e4));if(i<60)return`Starts in ${i} minute${1===i?"":"s"}`;const a=Math.round(i/60);return a<24?`Starts in ${a} hour${1===a?"":"s"}`:null},"aD",0,e=>a[e]||e,"lP",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;const n=i(e,t);var a;return"in_person"===e.provider?"cancelled"===n?{label:"Session cancelled",enabled:!1,kind:"view"}:"draft"===n?{label:"Not available yet",enabled:!1,kind:"view"}:null!==(a=e.myAttendance)&&void 0!==a&&a.checkedInAt?{label:"Checked in",enabled:!1,kind:"checked_in"}:e.canCheckIn?{label:"Check in",enabled:!0,kind:"check_in"}:"ended"===n||"completed"===n?{label:"View session",enabled:!1,kind:"view"}:{label:"Check in",enabled:!1,kind:"check_in"}:"cancelled"===n?{label:"Session cancelled",enabled:!1,kind:"view"}:"draft"===n?{label:"Not available yet",enabled:!1,kind:"view"}:"ended"===n||"completed"===n?{label:"View session",enabled:!1,kind:"view"}:"live"===n?{label:"Join now",enabled:Boolean(e.joinUrl),kind:"join"}:{label:"Join session",enabled:Boolean(e.joinUrl),kind:"join"}},"mF",0,i,"sQ",0,e=>({external:"External meeting",in_person:"In person",google_meet:"Google Meet",microsoft_teams:"Microsoft Teams",zoom:"Zoom",edumark_live:"EduMark Live"}[e])])},50424(e,t,n){n.d(t,{W:()=>a});const i=/\n\nShared a practice (?:question|session) \xb7 AI practice, not an official grade(\n\/practice\/shared\/([a-f0-9]{64}))\s*$/;function a(e,t,n){if("resource"!==t)return{body:e,resource:null};const a=n&&"object"===typeof n?n:{};let r="practice_share"===a.kind&&"string"===typeof a.id&&/^[a-f0-9]{64}$/.test(a.id)?{kind:"practice_share",id:a.id}:null;const s=r?`\n/practice/shared/${r.id}`:null;if(s&&e.trimEnd().endsWith(s))return{body:e.trimEnd().slice(0,-s.length),resource:r};const o=e.match(i);return!o||r&&r.id!==o[2]||(r={kind:"practice_share",id:o[2]},e=e.slice(0,e.lastIndexOf(o[1]))),{body:e,resource:r}}n.d(t,["I",0,e=>{var t;return(null===(t=e.match(/^\/practice\/shared\/[a-f0-9]{64}$/m))||void 0===t?void 0:t[0])||null}])},38970(e,t,n){var i=n(59432),a=n(12229);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=new URLSearchParams(e),i=n.get("courseId");if(!i||!/^[a-zA-Z0-9_-]{1,200}$/.test(i))return null;n.delete("courseId");const a=n.toString();return`/courses/${encodeURIComponent(i)}${a?`?${a}`:""}${t}`},s=e=>{var t;const n=new URL(e,"https://app.edumark.ai"),a=(0,i.SN)(n.pathname);return a?`${a}${n.search}${n.hash}`:"/courses"===n.pathname&&null!==(t=r(n.search,n.hash))&&void 0!==t?t:e};n.d(t,["M",0,(e,t)=>{if("string"===typeof t&&/^acd_[a-zA-Z0-9_-]+$/.test(t))return`/assignments/drafts/${encodeURIComponent(t)}/review`;const n=e.trim().replace(/^\/?https?:\/(?!\/)/i,e=>`${e.replace(/^\//,"")}/`),i=(0,a.Sv)(n);if(!i)return null;if(/^\/(?!\/)/.test(i))return s(i);try{const e=new URL(i);return["http:","https:"].includes(e.protocol)?/(^|\.)edumark\.ai$/i.test(e.hostname)&&/^\/(assignments|courses|marking|results|communications|community)(\/|\?|$)/.test(e.pathname)?s(`${e.pathname}${e.search}${e.hash}`):e.toString():null}catch{return null}},"N",0,r])},42860(e,t,n){var i=n(33006),a=n(75607),r=n(43535);n.d(t,["G",0,function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const[t,n]=(0,i.useState)([]),[s,o]=(0,i.useState)(e),[l,c]=(0,i.useState)(null),d=(0,i.useCallback)(async()=>
2{if(e)try{const e=await(0,a.bb)();n(e.items),c(null)}catch(t){c((0,a.M)(t,"Notifications could not be loaded."))}finally{o(!1)}},[e]);(0,r.L)(e=>{"notification.created"!==e.type&&"notification.updated"!==e.type&&"notification.read"!==e.type||d()},()=>{d()},e),(0,i.useEffect)(()=>{if(!e)return n([]),o(!1),void c(null);o(!0),d();const t=window.setInterval(()=>{d()},3e5),i=()=>{d()};return window.addEventListener("focus",i),()=>{window.clearInterval(t),window.removeEventListener("focus",i)}},[e,d]);const u=(0,i.useCallback)(async e=>{const i=t;n(t=>t.map(t=>t.id===e?{...t,isRead:!0}:t));try{await(0,a.Jj)(e)}catch(r){throw n(i),c((0,a.M)(r,"The notification could not be marked as read.")),r}},[t]),m=(0,i.useCallback)(async()=>{const e=t;n(e=>e.map(e=>({...e,isRead:!0})));try{await(0,a.t_)()}catch(i){throw n(e),c((0,a.M)(i,"Notifications could not be marked as read.")),i}},[t]),p=(0,i.useMemo)(()=>t.reduce((e,t)=>e+(t.isRead?0:1),0),[t]);return{items:t,unreadCount:p,loading:s,error:l,refresh:d,markRead:u,markAllRead:m}}])},43535(e,t,n){var i=n(33006),a=n(18537);const r=()=>{var e,t;const n=null===(e=void 0)||void 0===e?void 0:e.trim();if(n)return n;const i=null===(t="https://systems.aries.edumark.ai")?void 0:t.trim();return i?`${i.replace(/^http/i,"ws").replace(/\/$/,"")}/communications/realtime`:null},s=()=>`edumark:communications:realtime:${(0,a.N7)()||"session"}`;n.d(t,["L",0,function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const o=(0,i.useRef)(e),l=(0,i.useRef)(t);o.current=e,l.current=t;const[c,d]=(0,i.useState)(()=>n&&r()?"connecting":"unavailable");return(0,i.useEffect)(()=>{const e=r();if(!n||!e)return void d("unavailable");const t=e;let i=null,c=!1,u=null,m=null,p=null,h=0,v=!1;const g=()=>{null!=m&&window.clearTimeout(m),null!=p&&window.clearTimeout(p),m=null,p=null},f=e=>{null!=p&&window.clearTimeout(p),p=window.setTimeout(()=>{i===e&&e.readyState===WebSocket.OPEN&&e.close(4e3,"Realtime heartbeat timed out")},2e4)},_=()=>{if(c||null!=u)return;const e=Math.min(3e4,1e3*2**Math.min(h,5));u=window.setTimeout(()=>{u=null,y()},e)};function y(){if(c)return;if(i&&(i.readyState===WebSocket.CONNECTING||i.readyState===WebSocket.OPEN))return;let e;v=!1,d(h?"polling":"connecting");try{e=new WebSocket(t)}catch{return h+=1,d("polling"),l.current(),void _()}i=e,e.onopen=()=>{const t=localStorage.getItem("edumrk_dv_ath");if(!t)return d("unavailable"),void e.close(4401,"No active session");e.send(JSON.stringify({type:"authenticate",access_token:t,centre_id:(0,a.yk)(),last_event_id:localStorage.getItem(s())})),m=window.setTimeout(()=>{i!==e||v||e.readyState!==WebSocket.OPEN||e.close(4e3,"Realtime authentication timed out")},1e4)},e.onmessage=t=>{try{const n=JSON.parse(t.data);if("authenticated"===n.type)return v=!0,h=0,null!=m&&window.clearTimeout(m),m=null,d("connected"),void f(e);if("heartbeat"===n.type)return void(v&&f(e));const i=(e=>{const t=e&&"object"===typeof e?e:{},n=String(t.type||"");if(!["message.created","message.updated","message.deleted","message.received","conversation.updated","conversation.read","notification.created","notification.updated","notification.read","live_session.updated","live_session.created","live_session.rescheduled","live_session.cancelled","live_session.starting_soon","announcement.published"].includes(n))return null;const i=t.payload&&"object"===typeof t.payload?t.payload:{};return{id:"string"===typeof t.id?t.id:null,type:"message.received"===n?"message.created":n.startsWith("live_session.")?"live_session.updated":"announcement.published"===n?"notification.created":n,conversationId:"string"===typeof i.conversation_id?i.conversation_id:null,sessionId:"string"===typeof i.session_id?i.session_id:n.startsWith("live_session.")&&"string"===typeof t.entity_id?t.entity_id:null,payload:i}})(n);if(!i)return;v&&f(e),i.id&&localStorage.setItem(s(),i.id),o.current(i)}catch{}},e.onclose=()=>{g(),i===e&&(i=null),v=!1,c||(h+=1,d(localStorage.getItem("edumrk_dv_ath")?"polling":"unavailable"),l.current(),localStorage.getItem("edumrk_dv_ath")&&_())},e.onerror=()=>e.close()}y();const b=window.setInterval(()=>{v||l.current()},5e3);return()=>{var e;c=!0,null!=u&&window.clearTimeout(u),window.clearInterval(b),g(),null===(e=i)||void 0===e||e.close(1e3,"Route changed")}},[n]),c}])},42567(e,t,n){n.d(t,{AR:()=>f,Eb:()=>l,H1:()=>p,R8:()=>w,RG:()=>b,Ss:()=>u,XZ:()=>g,ZA:()=>c,oX:()=>v,pq:()=>_,qP:()=>y,sT:()=>o,v6:()=>h,vl:()=>d,wg:()=>m});var i=n(5487),a=n(17187);function r(e){return`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${e}`}function s(e){return e&&"object"===typeof e&&"data"in e?e.data:e}async function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=new URLSearchParams;e.owner&&t.set("owner",e.owner),e.query&&t.set("q",e.query),e.attention&&t.set("attention",e.attention);const n=s(await(0,a.G)(r("/api/courses/status-counts"+(t.toString()?`?${t}`:""))));if(!n||"object"!==typeof n||Array.isArray(n))throw new Error("The course status totals were invalid.");const i=n;
2if(![i.draft,i.published,i.archived,i.all].every(e=>"number"===typeof e&&Number.isSafeInteger(e)&&e>=0)||i.all!==i.draft+i.published+i.archived||null!=i.archived_blueprints&&(!Number.isSafeInteger(i.archived_blueprints)||i.archived_blueprints<0)||null!=i.saved_blueprints&&(!Number.isSafeInteger(i.saved_blueprints)||i.saved_blueprints<0))throw new Error("The course status totals were invalid.");return i}async function l(){const e=s(await(0,a.G)(r("/api/courses/capabilities")));return{...e.capabilities,featureIssues:e.feature_issues||[]}}async function c(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URLSearchParams;t.status&&n.set("status",t.status),null!==(e=t.query)&&void 0!==e&&e.trim()&&n.set("q",t.query.trim()),t.sort&&n.set("sort",t.sort),t.owner&&n.set("owner",t.owner),t.attention&&"all"!==t.attention&&n.set("attention",t.attention),n.set("page",String(t.page||1)),n.set("page_size",String(t.pageSize||12));return s(await(0,a.G)(r(`/api/courses/library?${n.toString()}`)))}async function d(e){return s(await i.default.get(r(`/api/courses/${encodeURIComponent(e)}/deletion-eligibility`)))}async function u(e,t){return s(await i.default.post(r(`/api/courses/${encodeURIComponent(e)}/delete-permanently`),{confirmation_title:t}))}async function m(e){return s(await i.default.get(r(`/api/courses/${encodeURIComponent(e)}/sources`))).sources}async function p(e,t,n){return s(await i.default.post(r(`/api/courses/${encodeURIComponent(e)}/sources/${encodeURIComponent(t)}/remove`),{origin:n})).sources}async function h(e,t){return s(await i.default.post(r(`/api/courses/${encodeURIComponent(e)}/change-sets`),t))}async function v(e){return s(await i.default.get(r(`/api/courses/${encodeURIComponent(e)}/change-sets`)))}async function g(e){return s(await i.default.get(r(`/api/course-change-sets/${encodeURIComponent(e)}`)))}async function f(e,t,n){return s(await i.default.patch(r(`/api/course-change-sets/${encodeURIComponent(e)}/operations/${encodeURIComponent(t)}`),n))}async function _(e,t){return s(await i.default.post(r(`/api/course-change-sets/${encodeURIComponent(e)}/apply`),t))}async function y(e,t){return s(await i.default.post(r(`/api/course-change-sets/${encodeURIComponent(e)}/reject`),t))}async function b(e,t){return s(await i.default.post(r(`/api/course-change-sets/${encodeURIComponent(e)}/undo`),t))}function w(e){var t;switch(e.op){case"update_course_metadata":return"title"===e.field?"Update course title":"Update course summary";case"update_overview":return"Update course overview";case"rename_node":return`Rename "${String(null!==(t=e.existing_value)&&void 0!==t?t:"")}"`;case"update_node_description":return"Update item description";case"create_node":return`Add "${(e.proposed_value||{}).title||"New item"}"`;case"delete_node":return`Remove "${(e.existing_value||{}).title||"item"}"`;case"move_node":return"Move item";case"reorder_nodes":return"Reorder items";case"add_outcomes":{const t=e.proposed_value||[];return`Add ${t.length} learning outcome${1===t.length?"":"s"}`}case"add_content":{const t=e.proposed_value||{};return`Add ${t.type||"content"} block "${t.title||"Untitled"}"`}case"update_content":return`Update content "${(e.existing_value||{}).title||"block"}"`;case"remove_content":return`Remove content "${(e.existing_value||{}).title||"block"}"`;case"move_content":return"Move content block";case"create_quiz":{const t=e.proposed_value||{},n=Array.isArray(t.questions)?t.questions.length:0;return`Create quiz "${t.title||"Quiz"}" (${n} question${1===n?"":"s"})`}default:return"Change"}}n.d(t,["Mn",0,(e,t)=>i.default.post(r(`/api/courses/bulk/${e}`),{items:t.map(e=>({id:e.id,expected_revision:e.revision}))})])},72374(e,t,n){n.d(t,["f",0,e=>["courses.create","courses.edit","courses.archive","courses.delete"].some(e)])},7712(e,t,n){var i=n(31243),a=n(5487);const r=e=>`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${e}`,s="/api/marker-studio",o=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;const o=await a.default.get(r(`${s}/cases/page`),{params:{limit:50,...t,...e?{cursor:e}:{}},...t?{paramsSerializer:i.uh}:{},timeout:t?6e4:2e4,...n?{signal:n}:{}});if(!o||!Array.isArray(o.items)||o.items.length>50||!o.items.every(e=>e&&"string"===typeof e.id&&e.id&&"string"===typeof e.assignment_title&&"string"===typeof e.candidate_ref&&"string"===typeof e.workflow_state&&"string"===typeof e.next_action)||new Set(o.items.map(e=>e.id)).size!==o.items.length||!(null===o.next_cursor||"string"===typeof o.next_cursor&&o.next_cursor.length>0&&o.next_cursor.length<=2048&&o.next_cursor!==e))throw new Error("The marking inbox response was invali
2d. Refresh the inbox and try again.");return o},l=e=>({case_ids:e.map(e=>e.id),expected_revisions:Object.fromEntries(e.map(e=>[e.id,e.queue_revision]))}),c=(e,t,n)=>{if(!e||"string"!==typeof e.id||!e.id.trim()||e.case_id!==t||"string"!==typeof e.created_at||!Number.isFinite(Date.parse(e.created_at))||!n)throw new Error("The response did not confirm this case update. Your details are kept. Refresh the case before retrying.");return e};n.d(t,["$j",0,async(e,t)=>{const n=await a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/corrections`),t);return c(n,e,(null===n||void 0===n?void 0:n.reason)===t.reason.trim()&&Date.parse(null===n||void 0===n?void 0:n.due_at)===Date.parse(t.due_at)&&JSON.stringify(null===n||void 0===n?void 0:n.allowed_block_ids)===JSON.stringify(t.allowed_block_ids))},"A2",0,(e,t)=>a.default.put(r(`${s}/cases/${encodeURIComponent(e)}/decision`),t),"B$",0,e=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/route-moderation`),{}),"Bz",0,e=>a.default.get(r(`${s}/cases/${encodeURIComponent(e)}/plagiarism/ai`)),"Cy",0,(e,t,n)=>a.default.post(`${r(s)}/cases/${encodeURIComponent(e)}/generate-proposal`,{expected_revision:t,document_evidence_revision:n}),"HZ",0,async e=>{var t;const n=await a.default.get(r(`${s}/cases/${encodeURIComponent(e)}`));return{...n,supporting_sources:null===(t=n.supporting_sources)||void 0===t?void 0:t.map(e=>({...e,download_url:e.download_url.startsWith("/")?r(e.download_url):e.download_url}))}},"NV",0,(e,t,n)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/feedback-assistance`),t,{signal:n}),"OS",0,async(e,t)=>{const n=await a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/escalations`),t);return c(n,e,(null===n||void 0===n?void 0:n.reason)===t.reason&&(null===n||void 0===n?void 0:n.message)===t.message.trim()&&((null===n||void 0===n?void 0:n.block_id)||void 0)===t.block_id&&((null===n||void 0===n?void 0:n.criterion_id)||void 0)===t.criterion_id)},"Oq",0,e=>r(`${s}/cases/${encodeURIComponent(e)}/preserved-review`),"RE",0,(e,t)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/understand`),{}),"SM",0,async e=>{const t=await a.default.post(r(`${s}/cases/${encodeURIComponent(e.id)}/unclaim`),{expected_revision:e.queue_revision});if(!t||t.id!==e.id||null!=t.owner_id||"available"!==t.ownership_state||"ANY_ELIGIBLE_ORGANISATION_MARKER"!==t.allocation_mode||t.queue_revision!==e.queue_revision+1)throw new Error("The return to the open pool could not be confirmed. Refresh the inbox before retrying.");return t},"TU",0,(e,t)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/preview/prepare`),{}),"To",0,(e,t,n)=>a.default.put(r(`${s}/corrections/${encodeURIComponent(e)}`),{expected_revision:t,answers:n}),"U2",0,(e,t,n)=>a.default.post(`${r(s)}/cases/${encodeURIComponent(e)}/ai-assistance`,{expected_revision:t,reason:n}),"UH",0,e=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/plagiarism/viewer`),{}),"Uk",0,async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const i=await a.default.post(r(`${s}/cases/assignment-options`),{...l(e),...t?{override_allocation:!0}:{}},{signal:n,timeout:15e3}).catch(e=>{if("ECONNABORTED"===(null===e||void 0===e?void 0:e.code)||"ETIMEDOUT"===(null===e||void 0===e?void 0:e.code))throw new Error("Loading eligible markers took too long. Please try again.");throw e}),o=new Set(e.map(e=>e.id));if(!i||!Array.isArray(i.candidates)||i.candidates.some(e=>"string"!==typeof(null===e||void 0===e?void 0:e.id)||!e.id.trim()||"string"!==typeof e.name||!e.name.trim())||new Set(i.candidates.map(e=>e.id)).size!==i.candidates.length||"boolean"!==typeof i.truncated||!i.blocked||"object"!==typeof i.blocked||Array.isArray(i.blocked)||Object.entries(i.blocked).some(e=>{let[t,n]=e;return!o.has(t)||"string"!==typeof n||!n})||!i.history||"object"!==typeof i.history||Array.isArray(i.history)||Object.entries(i.history).some(e=>{let[t,n]=e;return!o.has(t)||!Array.isArray(n)||n.some(e=>!e||"string"!==typeof e.from_owner||"string"!==typeof e.owner||"string"!==typeof e.actor||!Number.isFinite(Date.parse(e.at))||!Number.isInteger(e.revision)||e.revision<1)}))throw new Error("The marker selection could not be confirmed. Refresh and try again.");return i},"Xh",0,(e,t,n)=>a.default.post(r(`/api/integrity/cases/${encodeURIComponent(e)}/override`),{reason:t,expected_state:n}),"Y0",0,(e,t)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/plagiarism/ai`),{expected_generation:t}),"YV",0,(e,t)=>r(`${s}/cases/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/preview`),"_X",0,(e,t,n)=>a.default.post(r(`${s}/communications/${encodeURIComponent(e)}/reply`),{body:t,block_id:n}),"a2",0,async e=>{const t=new Date,n=new Date(t.getTime()-2592e6),i=await a.default.get(r(`${s}/turnaround`),{params:{start_date:(null===e||void 0===e?void 0:e.start)||n.toISOString(),end_date:(null===e||void 0===e?void 0:e.end)||t.toISOString()}});if(!i||"object"!==typeof i||Array.isArray(i))throw new Error("The personal marking summary was invali
2d.");const o=i,l=o.count,c=o.median_working_days,d=e=>"string"===typeof e&&Number.isFinite(Date.parse(e));if("number"!==typeof l||!Number.isSafeInteger(l)||l<0||(0===l?null!==c:"number"!==typeof c||!Number.isFinite(c)||c<0)||!d(o.start_at)||!d(o.end_at)||!d(o.as_of)||Date.parse(o.start_at)>Date.parse(o.end_at))throw new Error("The personal marking summary was invalid.");return{count:l,median_working_days:c,start_at:o.start_at,end_at:o.end_at,as_of:o.as_of}},"cM",0,e=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/preparation/retry`),{}),"d5",0,async(e,t,n)=>{const i=await a.default.post(r(`${s}/cases/bulk-assign`),{...l(e),assignee_id:t,...n?{override_allocation:!0,reason:n.reason}:{}}),o=new Set(e.map(e=>e.id));if(!i||!Array.isArray(i.assigned)||!Array.isArray(i.skipped)||!Array.isArray(i.unchanged)||!i.reasons||"object"!==typeof i.reasons||Array.isArray(i.reasons)||Object.entries(i.reasons).some(e=>{let[t,n]=e;return!i.skipped.includes(t)||"string"!==typeof n||!n})||i.skipped.some(e=>!i.reasons[e])||i.assigned.length+i.skipped.length!==o.size||new Set([...i.assigned,...i.skipped]).size!==o.size||[...i.assigned,...i.skipped].some(e=>!o.has(e))||i.unchanged.some(e=>!i.assigned.includes(e)))throw new Error("The assignment result could not be confirmed. Refresh the selected cases before retrying.");return i},"ep",0,async(e,t,n)=>{const i=await a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/escalations/${encodeURIComponent(t)}/resolve`),n);return c(i,e,(null===i||void 0===i?void 0:i.id)===t&&"resolved"===(null===i||void 0===i?void 0:i.state)&&(null===i||void 0===i?void 0:i.resolution)===n.resolution.trim()&&Boolean(null===i||void 0===i?void 0:i.resolved_by)&&Boolean((null===i||void 0===i?void 0:i.resolved_at)&&Number.isFinite(Date.parse(i.resolved_at)))&&(null===i||void 0===i?void 0:i.resolution_revision)===n.expected_revision+1)},"ey",0,(e,t)=>{if(!["document","pdf","spreadsheet","text","code"].includes(t.viewer_kind)||!/^[a-f0-9]{64}$/.test(t.checksum||"")||!/^[A-Za-z0-9][A-Za-z0-9:._-]{0,199}$/.test(e)||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/.test(t.id))return;const n=`marking_artifact:${e}:artifact:${t.id}:sha256:${t.checksum}`;return n.length<=500?n:void 0},"gF",0,async(e,t)=>{const n=await a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/messages`),t);return c(n,e,(null===n||void 0===n?void 0:n.body)===t.body.trim()&&(null===n||void 0===n?void 0:n.kind)===t.kind&&(null===n||void 0===n?void 0:n.visibility)===t.visibility&&((null===n||void 0===n?void 0:n.block_id)||void 0)===t.block_id&&((null===n||void 0===n?void 0:n.criterion_id)||void 0)===t.criterion_id)},"hU",0,e=>r(`${s}/cases/${encodeURIComponent(e)}/assignment-brief`),"hc",0,(e,t,n)=>a.default.post(r(`${s}/corrections/${encodeURIComponent(e)}/submit`),{expected_revision:t,answers:n}),"i8",0,async e=>{const t=await a.default.post(r(`${s}/cases/${encodeURIComponent(e.id)}/reject`),{expected_revision:e.queue_revision,review_stage:e.review_stage||"primary",expected_moderation_revision:"second_marking"===e.review_stage?e.moderation_revision:void 0});if(!t||t.id!==e.id||!0!==t.rejected_by_me)throw new Error("The server did not confirm this rejection. Refresh the inbox before retrying.");return t},"kg",0,(e,t)=>r(`${s}/cases/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/original`),"lZ",0,async e=>{const t=await a.default.get(r(`${s}/cases/${encodeURIComponent(e)}/history`)),n=e=>e.startsWith("/")?r(e):e;return{...t,items:t.items.map(e=>{var t;return{...e,files:e.files.map(e=>({...e,download_url:n(e.download_url)})),blocks:null===(t=e.blocks)||void 0===t?void 0:t.map(e=>({...e,files:e.files.map(e=>({...e,download_url:e.download_url?n(e.download_url):void 0}))})),plagiarism:{...e.plagiarism,report_url:e.plagiarism.report_url?n(e.plagiarism.report_url):e.plagiarism.report_url}}})}},"mA",0,()=>a.default.get(r(`${s}/corrections/active`)),"oi",0,()=>a.default.get(r(`${s}/communications/active`)),"rN",0,(e,t)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/claim`),{expected_revision:t}),"s$",0,async()=>(await o()).items,"sS",0,e=>r(`${s}/cases/${encodeURIComponent(e)}/submission-download`),"so",0,e=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/plagiarism/retry`),{}),"sp",0,o,"vd",0,(e,t,n)=>a.default.post(r(`/api/results-moderation/cases/${encodeURIComponent(e.id)}/schedule`),{expected_revision:e.revision,release_at:t,reason:n}),"xL",0,(e,t)=>a.default.post(r(`${s}/cases/${encodeURIComponent(e)}/regenerate-proposal`),{job_id:t})])},50573(e,t,n){n.d(t,{A:()=>J});var i=n(33006),a=n(99640),r=n(68359),s=n(29015),o=n(17459),l=n(44151),c=n(80687),d=n(39653),u=n(77425),m=n(63878),p=n(8650),h=n(22458),v=n(37413),g=n(13650),f=n(15666);const _="yh0gkO3B",y="_8sqVZYz",b="V8GZQsWd",w="gAevdgI1",x="Q19A_vvh",k="b2steip9",A="VVArpit0",j="ZQHu2pUA",S="aRqBcwkY",C="OPN_lfof",I="wjXhE0ZR",E="ioUBsC4P",R="cWo00Dng",$="ppFz3GUh",N="veHp_qs9",T="pT6Q1gv_",L="O70qN75K",O="mY46CWEO",M="VkLzABS2",U="QzGBhLxn",P="b5B4vvyv",q="NWOvSIer",D="E2hZtz3w",z="zWkjBDjZ",B="mAnEqLVO",F="qk5UjyMS",W="_aTuKVA2",H="O6DvVg8O",V="fogemcQ4",Y="yMeFGl8_";var G=n(3374);function J(e){let{role:t,organisationName:n,preview:J=!1,onAcknowledge:K,onClose:X}=e;const{can:Z}=(0,g.Sk)(),Q=(0,f.o)(t,Z),ee=(0,i.useId)(),te=(0,i.useId)(),[ne,ie]=(0,i.useState)(0),[ae,re]=(0,i.useState)(!1),[se,oe]=(0,i.useState)(null);if(!Q)return null;const le=async e=>{if(K)if(ae)X();else{re(!0),oe(null);try{await K(e),X()}catch{oe(e)}finally{re(!1)}}else X()},ce=[a.A,r.A,s.A,o.A][ne],de="learner"===t,ue=de?"Your learning continues.":"supervisor"===t?"Your oversight continues.":"Your teaching continues.";return(0,G.jsxs)(v.A,{labelledBy:ee,describedBy:te,onDismiss:()=>{le("dismissed")},dismissOnBackdrop:!1,panelClassName:_,children:[(0,G.jsxs)("div",{className:y,children:[(0,G.jsxs)("span",{className:b,children:[(0,G.jsx)("span",{className:w,"aria-hidden":"true",children:(0,G.jsx)(l.A,{size:19,strokeWidth:3})}),"EduMark",(0,G.jsx)("span",{className:x,children:"A new chapter"})]}),(0,G.jsx)("button",{type:"button",className:k,"aria-label":"Close welcome guide",onClick:()=>{le("dismissed")},children:(0,G.jsx)(c.A,{size:19})})]}),(0,G.jsx)("div",{className:A,role:"progressbar","aria-label":"Welcome tour","aria-valuemin":1,"aria-valuemax":4,"aria-valuenow":ne+1,"aria-valuetext":`Step ${ne+1} of 4`,children:[0,1,2,3].map(e=>(0,G.jsx)("span",{className:e<=ne?j:""},e))}),(0,G.jsxs)(h.PY1.div,{initial:{opacity:0,y:10}
2,animate:{opacity:1,y:0},transition:{duration:.24},className:S,children:[(0,G.jsxs)("div",{className:C,"aria-hidden":"true",children:[(0,G.jsx)("span",{className:I}),(0,G.jsx)("span",{className:E}),(0,G.jsxs)("span",{className:$,children:[(0,G.jsx)(d.A,{size:21}),(0,G.jsx)("span",{}),(0,G.jsx)("span",{})]}),(0,G.jsx)("span",{className:R,children:(0,G.jsx)(ce,{size:36,strokeWidth:1.6})}),(0,G.jsx)("span",{className:N,children:(0,G.jsx)(l.A,{size:19,strokeWidth:2.5})})]}),(0,G.jsxs)("p",{className:T,children:[Q.label,n?` \xb7 ${n}`:""]}),(0,G.jsx)("h2",{id:ee,"aria-live":"polite",children:["Welcome to the new EduMark","A place for everything","Pick up where you left off","Make yourself at home"][ne]}),(0,G.jsx)("p",{className:L,id:te,children:["A fresh look. A clearer way to find your work. The same learning journey.","Your main pages are together in the navigation. Here is where to find the work available to you.","Your move to the new EduMark does not mean starting again.","You can explore at your own pace. This guide is always here when you need it."][ne]}),0===ne&&(0,G.jsxs)("div",{className:O,children:[(0,G.jsxs)("div",{children:[(0,G.jsx)(r.A,{size:20}),(0,G.jsx)("strong",{children:"Easier to find"}),(0,G.jsx)("span",{children:"Your main pages, together in one workspace."})]}),(0,G.jsxs)("div",{children:[(0,G.jsx)(d.A,{size:20}),(0,G.jsx)("strong",{children:"Clearer to follow"}),(0,G.jsx)("span",{children:"Open your work to see its details and next steps."})]}),(0,G.jsxs)("div",{children:[(0,G.jsx)(o.A,{size:20}),(0,G.jsx)("strong",{children:"Help close by"}),(0,G.jsx)("span",{children:"Guidance you can return to whenever you need."})]})]}),1===ne&&(0,G.jsxs)("div",{className:q,children:[Q.destinations.map((e,t)=>(0,G.jsxs)("div",{className:M,children:[(0,G.jsx)("span",{className:D,children:String(t+1).padStart(2,"0")}),(0,G.jsxs)("div",{children:[(0,G.jsx)("strong",{children:e.title}),(0,G.jsx)("p",{children:e.description})]})]},e.route)),!Q.destinations.length&&(0,G.jsx)("p",{className:z,children:"Your available pages depend on your workspace access. Your centre can help you find the right place."})]}),2===ne&&(0,G.jsxs)("div",{className:U,children:[(0,G.jsxs)("p",{children:[(0,G.jsx)(l.A,{size:18}),(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:ue})," ",de?"Open an assignment to find its earlier submissions and feedback under Your previous EduMark work.":"Open the assignment to find the earlier submissions and feedback available to you."]})]}),(0,G.jsxs)("p",{children:[(0,G.jsx)(l.A,{size:18}),(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:de?"No need to submit work again.":"Check existing work first."})," ",de?"Check the assignment and its existing submissions first.":"Review the preserved record before creating a replacement or asking a learner to resubmit."]})]}),(0,G.jsxs)("p",{children:[(0,G.jsx)(l.A,{size:18}),(0,G.jsxs)("span",{children:[(0,G.jsx)("strong",{children:de?"Your centre is still here.":"Your responsibilities stay familiar."})," ",de?"If something looks missing, contact them before recreating it.":"Continue with the marking, feedback and review actions available for your role."]})]}),(0,G.jsx)("span",{className:z,children:de?"Results and returned work appear when your centre releases them.":"Learners see feedback and returned work only when your centre releases them."})]}),3===ne&&(0,G.jsxs)("div",{className:P,children:[(0,G.jsx)(r.A,{size:23}),(0,G.jsxs)("div",{children:[(0,G.jsx)("strong",{children:"Find this tour in Help and tutorials"}),(0,G.jsx)("p",{children:"You can also reopen it from Settings \u2192 Product tours."})]}),(0,G.jsxs)(p.N_,{to:"/support",onClick:()=>{le("dismissed"),X()},children:["Get help",(0,G.jsx)(u.A,{size:15})]})]})]},ne),se&&(0,G.jsxs)("div",{className:Y,role:"alert",children:[(0,G.jsx)("p",{children:"We couldn\u2019t save your tour progress. You can still use EduMark; the welcome may appear again next time."}),(0,G.jsx)("button",{type:"button",onClick:()=>{le(se)},children:"Retry saving"}),(0,G.jsx)("button",{type:"button",onClick:X,children:"Continue without saving"})]}),(0,G.jsxs)("footer",{className:B,children:[(0,G.jsx)("div",{children:ne>0?(0,G.jsxs)("button",{type:"button",className:H,onClick:()=>ie(ne-1),disabled:ae,children:[(0,G.jsx)(m.A,{size:16}),"Back"]}):(0,G.jsx)("button",{type:"button",className:H,onClick:()=>{le("dismissed")},children:ae?"Continue to EduMark":"Explore later"})}),(0,G.jsxs)("span",{className:F,children:[ne+1," of 4"]}),(0,G.jsxs)("button",{type:"button",className:W,disabled:ae,onClick:()=>ne<3?ie(ne+1):void le("completed"),children:[ae?"Saving\u2026":0===ne?"Show me around":3===ne?"Let\u2019s get started":"Next",!ae&&(0,G.jsx)(u.A,{size:17})]})]}),J&&(0,G.jsx)("p",{className:V,role:"note",children:"Tour preview \xb7 Exploring this guide does not change your account or learning records."})]})}}
2,77903(e,t,n){var i=n(33006);const a=(0,i.createContext)(!1);n.d(t,["I",0,a,"o",0,()=>(0,i.useContext)(a)])},15666(e,t,n){var i=n(13709);const a={title:"Assignments",description:"Open assignment briefs and manage the work available to you. Open an assignment to find its submissions and delivery details.",route:"/assignments",permission:"assignments.view"},r={title:"Marking",description:"Find submissions available to you, open the learner\u2019s work, and continue marking and feedback where your access allows.",route:"/marking",permission:"assessment.view_submissions"},s={title:"People",description:"Find the learners, staff and cohorts you have access to. Open a person or cohort to see their details.",route:"/people",permission:"people.view"},o={title:"Courses",description:"Find course content and structure, with delivery details where available to you.",route:"/courses",permission:"courses.view"},l={title:"Quality",description:"Open the quality assurance work available to you, including sampling and moderation.",route:"/quality",permission:"qa.view"},c={learner:{label:"Learner",introduction:"Start with your assignments, then check Results for feedback your centre has released.",destinations:[{...a,description:"Find your available assignments and due dates. Open an assignment to read the brief, continue your work or check its submission status."},{title:"Results",description:"Read released feedback, grades and returned work. Work awaiting marking or release may not have a result yet.",route:"/results",permission:"learning.view_feedback"},{...o,title:"Your learning",description:"Find the courses and learning materials available to you."}]},educator:{label:"Educator",introduction:"Start in Marking for learner submissions. Assignments and People bring together the work and learners you support.",destinations:[r,a,s]},supervisor:{label:"Supervisor",introduction:"Use Assignments and People to oversee delivery, Marking for assessment work, and Quality for your quality assurance responsibilities.",destinations:[a,s,r,l,o]},admin:{label:"Administrator",introduction:"Use People and Courses to find your organisation\u2019s learning activity. Your available assessment and quality tools appear alongside them.",destinations:[s,o,a,r,l]}};n.d(t,["o",0,(e,t)=>{const n=(0,i.Y)(e);if(!n)return null;const a=c[n];return{...a,destinations:a.destinations.filter(e=>t(e.permission))}}])},62229(e,t,n){n.d(t,{A:()=>d});var i=n(33006),a=n(77425),r=n(29015),s=n(22056),o=n(74227),l=n(19245),c=n(3374);function d(e){let{brand:t,hostname:n,development:d,title:u,subtitle:m,children:p,navigation:h,className:v}=e;const g=(0,i.useId)();
2return(0,c.jsxs)("main",{className:[l.A.page,v].filter(Boolean).join(" "),style:{"--centre-primary":t.primary_colour,"--centre-secondary":t.secondary_colour,"--centre-panel-ink":(0,o.qy)(t.primary_colour)},children:[(0,c.jsxs)("section",{className:l.A.brandPanel,"aria-label":`${t.display_name} learning space`,children:[(0,c.jsxs)("div",{className:l.A.identity,children:[t.logo_url?(0,c.jsx)("img",{src:t.logo_url,alt:t.display_name}):(0,c.jsx)("span",{className:l.A.brandSymbol,children:(0,c.jsx)(r.A,{size:24,"aria-hidden":"true"})}),(0,c.jsx)("strong",{children:t.display_name})]}),(0,c.jsxs)("div",{className:l.A.brandStory,children:[(0,c.jsx)("span",{className:l.A.eyebrow,children:"Your learning space"}),(0,c.jsxs)("h2",{children:["Your next",(0,c.jsx)("br",{}),"chapter",(0,c.jsx)("br",{}),(0,c.jsx)("em",{children:"starts here."})]}),(0,c.jsxs)("p",{children:["A place for fresh ideas,",(0,c.jsx)("br",{}),"steady progress and what comes next."]}),(0,c.jsxs)("div",{className:l.A.learningArt,"aria-hidden":"true",children:[(0,c.jsx)("span",{className:l.A.orbit}),(0,c.jsxs)("span",{className:l.A.artCard,children:[(0,c.jsx)(r.A,{size:26}),(0,c.jsx)("span",{children:"Discover."})]}),(0,c.jsxs)("span",{className:l.A.artCard,children:[(0,c.jsxs)("span",{className:l.A.artLines,children:[(0,c.jsx)("i",{}),(0,c.jsx)("i",{}),(0,c.jsx)("i",{})]}),(0,c.jsx)("span",{children:"Practice."})]}),(0,c.jsxs)("span",{className:l.A.artCard,children:[(0,c.jsx)(a.A,{size:30}),(0,c.jsx)("span",{children:"Grow."})]})]})]}),(0,c.jsxs)("div",{className:l.A.brandFooter,children:[(0,c.jsx)("span",{className:l.A.dot}),n]})]}),(0,c.jsxs)("section",{className:l.A.formPanel,"aria-labelledby":g,children:[(0,c.jsxs)("div",{className:l.A.topLine,children:[d?(0,c.jsx)("span",{className:l.A.environment,children:"Test workspace"}):(0,c.jsxs)("span",{className:l.A.secure,children:[(0,c.jsx)(s.A,{size:13,"aria-hidden":"true"}),"Your centre. Your learning."]}),(0,c.jsxs)("span",{className:l.A.powered,children:["Powered by ",(0,c.jsx)("strong",{children:"EduMark"})]})]}),(0,c.jsxs)("div",{className:l.A.formContent,children:[(0,c.jsxs)("div",{className:l.A.mobileIdentity,children:[t.logo_url?(0,c.jsx)("img",{src:t.logo_url,alt:""}):(0,c.jsx)(r.A,{size:23,"aria-hidden":"true"}),(0,c.jsx)("span",{children:t.display_name})]}),h,(0,c.jsxs)("header",{className:l.A.heading,children:[(0,c.jsx)("h1",{id:g,children:u}),(0,c.jsx)("p",{children:m})]}),p]}),(0,c.jsxs)("footer",{className:l.A.formFooter,children:[(0,c.jsx)("span",{children:"Learn a little. Go a little further."}),(0,c.jsxs)("span",{children:[(new Date).getFullYear()," \xb7 ",t.display_name]})]})]})]})}},53814(e,t,n){n.d(t,{Hg:()=>y,n8:()=>b});var i=n(33006),a=n(85188),r=n(93949),s=n(97738),o=n(74227),l=n(64471),c=n(18537),d=n(39879);const u=e=>e&&"object"===typeof e&&!Array.isArray(e)?e:null,m=e=>{if("string"!==typeof e&&"number"!==typeof e)return null;return String(e).trim()||null},p=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const i of t){const e=m(i);if(e)return e}return null};const h={identity:"platform",name:"EduMark",logoUrl:d.A.BRAND_FULL_LOGO,faviconUrl:"/edumarkfavicon.png",primaryColour:"#0343fa",secondaryColour:"#2563eb",supportName:"EduMark Support",supportEmail:"[email protected]",orgId:null,centreId:null,version:0},v=[[/^\/dashboard(?:\/|$)/,"Dashboard"],[/^\/community(?:\/|$)/,"Community Hub"],[/^\/courses(?:\/|$)/,"Courses"],[/^\/assignments(?:\/|$)/,"Assignments"],[/^\/(?:bulk|plagiarism)(?:\/|$)/,"Marking Workspace"],[/^\/integrations\/moodle(?:\/|$)/,"Moodle migration"],[/^\/integrations(?:\/|$)/,"External integrations"],[/^\/file-security(?:\/|$)/,"File security"],[/^\/tenant-administration(?:\/|$)/,"Tenant administration"],[/^\/settings(?:\/|$)/,"Settings"]];function g(e,t){const n=(e=>{var t,n;return null!==(t=null===(n=v.find(t=>{let[n]=t;return n.test(e)}))||void 0===n?void 0:n[1])&&void 0!==t?t:"EduMark LMS"})(e);return"tenant"===t.identity?`${n} | ${t.pageTitle||t.name} | EduMark`:`${n} | EduMark`}var f=n(3374);const _=(0,i.createContext)(h),y=e=>{let{children:t}=e;const{policy:n,loading:d,error:v}=(0,l.UQ)(),{token:y,user:b}=(0,a.d4)(e=>e.auth),{pathname:w}=(0,r.zy)(),{resolvedTheme:x}=(0,s.eP)(),k=(0,i.useMemo)(()=>function(e,t){var n,i;if(!m(e))return null;const a=u(t),r=u(null!==(n=null===a||void 0===a?void 0:a.activeContext)&&void 0!==n?n:null===a||void 0===a?void 0:a.active_context);if(!r)return null;const s=p(r.orgId,r.org_id),o=p(r.organisation,r.organization,r.organisationName,r.organizationName);return s&&o?{orgId:s,name:o,centreId:null!==(i=(0,c.Od)({activeContext:r}))&&void 0!==i?i:m(r.center)}:null}(y,b),[y,b]),A=(0,i.useMemo)(()=>function(e,t,n,i){return t||n||null===e||void 0===e||!e.orgId||!i||e.orgId!==i.orgId||e.centreId&&i.centreId&&e.centreId!==i.centreId?h:e.configured?{identity:"tenant",name:e.brandName,logoUrl:e.logoUrl||h.logoUrl,faviconUrl:e.faviconUrl||h.faviconUrl,primaryColour:e.primaryColour,secondaryColour:e.secondaryColour,supportName:e.supportName||h.supportName,supportEmail:e.supportEmail||h.supportEmail,orgId:e.orgId,centreId:e.centreId,version:e.brandVersion,pageTitle:e.pageTitle}:{...h,identity:"tenant",name:i.name,orgId:i.orgId,centreId:null!==(a=e.centreId)&&void 0!==a?a:i.centreId};var a}(n,d,v,k),[k,v,d,n]);return(0,i.useEffect)(()=>{document.title=g(w,A);const e=document.querySelector('link[rel="icon"]');if(e&&(e.href=A.faviconUrl),"tenant"===A.identity)return(0,o.nT)(A.primaryColour,A.secondaryColour,"dark"===x)}
2,[A,w,x]),(0,f.jsx)(_.Provider,{value:A,children:t})},b=()=>(0,i.useContext)(_)},74227(e,t,n){n.d(t,{nT:()=>u,qy:()=>d});const i=e=>/^#[\da-f]{6}$/i.test(e)?e.toLowerCase():"#315f9f",a="#ffffff",r="#101821",s=e=>[1,3,5].map(t=>parseInt(i(e).slice(t,t+2),16)),o=e=>s(e).reduce((e,t,n)=>{const i=t/255;return e+(i<=.04045?i/12.92:((i+.055)/1.055)**2.4)*[.2126,.7152,.0722][n]},0),l=(e,t)=>{const n=[o(e),o(t)].sort((e,t)=>t-e);return(n[0]+.05)/(n[1]+.05)},c=(e,t,n)=>{const i=s(t);return`#${s(e).map((e,t)=>Math.round(e*(1-n)+i[t]*n).toString(16).padStart(2,"0")).join("")}`};function d(e){return l(e,a)>=4.5?a:l(e,r)>=4.5?r:"#000000"}function u(e,t,n){const s=document.documentElement.style,o=function(e,t,n){const s=i(e),o=n?"#213044":"#edf3fb",d=n?a:"#000000";let u=s;for(let i=1;l(u,o)<4.5&&i<=20;i+=1)u=c(s,d,i/20);const m=l(u,a)>=l(u,r)?a:r;return{"--tenant-brand-primary":s,"--tenant-brand-secondary":i(t),"--brand":u,"--brand-hover":c(u,d,.14),"--brand-pressed":c(u,d,.24),"--brand-subtle":`color-mix(in srgb, ${u} 12%, transparent)`,"--brand-contrast":m,"--brand-secondary":i(t)}}(e,t,n),d=Object.fromEntries(Object.keys(o).map(e=>[e,s.getPropertyValue(e)]));return Object.entries(o).forEach(e=>{let[t,n]=e;return s.setProperty(t,n)}),()=>Object.entries(d).forEach(e=>{let[t,n]=e;return n?s.setProperty(t,n):s.removeProperty(t)})}},64471(e,t,n){n.d(t,{UQ:()=>p});var i=n(33006),a=n(5487),r=n(38440),s=n(3374);const o={policy:null,loading:!1,error:"Tenant policy provider is unavailable.",reload:()=>{}},l=(0,i.createContext)(o),c=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),d=e=>"string"===typeof e&&e.trim()?e.trim():null,u=e=>{const t=d(e);if(!t)return null;try{const e=new URL(t);return"https:"===e.protocol?e.toString():null}catch{return null}};function m(e){var t;const n=(e=>{if(!c(e))throw new Error("Tenant policy response was invalid.");return c(e.data)&&!c(e.policy)?e.data:e})(e);if(!c(n.policy))throw new Error("Tenant policy was unavailable.");const i=n.policy;if(!c(i.brand)||!c(i.assignment_defaults))throw new Error("Tenant policy was incomplete.");const a=d(i.brand.display_name);if(!a)throw new Error("Tenant brand name was unavailable.");const s=null!==(t=(Array.isArray(i.notification_contacts)?i.notification_contacts.filter(c):[]).find(e=>d(e.email)))&&void 0!==t?t:null,o=d(i.assignment_defaults.default_checklist_id),l=d(i.assignment_defaults.default_grading_scheme_id),m=i.assignment_defaults.default_marking_workflow,p="HUMAN_ONLY"===m||"AI_ASSISTED"===m||"human"===m||"ai_assisted"===m||"hybrid"===m?(0,r.H3)(m):null,h=(Array.isArray(i.grading_schemes)?i.grading_schemes.filter(c):[]).find(e=>d(e.id)===l),v=h&&Array.isArray(h.bands)?h.bands.filter(c):[],g=(()=>{if(!h)return null;const e=d(h.id),t=d(h.name),n=h.score_unit,i=h.maximum_score,a=h.boundary_rounding,r=v.flatMap(e=>{const t=d(e.id),n=d(e.label),i=e.minimum_score;return t&&n&&"number"===typeof i&&Number.isFinite(i)&&"boolean"===typeof e.passing?[{id:t,label:n,minimumScore:i,passing:e.passing}]:[]});return!e||!t||"points"!==n&&"percentage"!==n||"number"!==typeof i||!Number.isFinite(i)||i<=0||"none"!==a&&"half_up"!==a||0===r.length?null:{id:e,name:t,scoreUnit:n,maximumScore:i,boundaryRounding:a,bands:r}})(),f=(Array.isArray(i.assignment_checklists)?i.assignment_checklists.filter(c):[]).find(e=>d(e.id)===o),_=(f&&Array.isArray(f.items)?f.items.filter(c):[]).flatMap(e=>{const t=d(e.id),n=d(e.text),i=Array.isArray(e.applies_to)?e.applies_to.filter(e=>"initial"===e||"resubmission"===e):[];return t&&n&&0!==i.length?[{id:t,text:n,required:!1!==e.required,appliesTo:i}]:[]}),y=Array.isArray(i.assignment_defaults.submission_file_extensions)?i.assignment_defaults.submission_file_extensions.map(d).filter(e=>Boolean(e)):[],b=i.assignment_defaults.max_submission_file_bytes,w=d(i.assignment_defaults.default_resubmission_policy_id),x=(Array.isArray(i.resubmission_policies)?i.resubmission_policies.filter(c):[]).find(e=>d(e.id)===w),k=i.assignment_defaults.late_submission_behaviour,A=Array.isArray(i.learner_identifiers)&&c(i.learner_identifiers[0])?i.learner_identifiers[0]:null,j=A&&d(A.id)&&d(A.label)&&d(A.pattern)&&d(A.example)&&("preserve"===A.normalisation||"uppercase"===A.normalisation||"lowercase"===A.normalisation)?{id:d(A.id),label:d(A.label),pattern:d(A.pattern),example:d(A.example),prefix:d(A.prefix),required:!0===A.required,
2caseSensitive:!0===A.case_sensitive,normalisation:A.normalisation}:null;return{brandName:a,productName:d(i.brand.product_name)||"EduMark",pageTitle:d(i.brand.page_title)||"EduMark LMS",logoUrl:u(i.brand.logo_url),faviconUrl:u(i.brand.favicon_url),primaryColour:d(i.brand.primary_colour)||"#0343fa",secondaryColour:d(i.brand.secondary_colour)||"#2563eb",configured:!0===n.configured,orgId:c(n.scope)&&d(n.scope.org_id)||"",centreId:c(n.scope)?d(n.scope.centre_id):null,brandVersion:"number"===typeof n.version&&Number.isFinite(n.version)?n.version:0,centreName:d(i.brand.centre_name),centreNumber:d(i.brand.centre_number),supportName:s?d(s.display_name):null,supportEmail:s?d(s.email):null,checklist:_,submissionFileExtensions:y,maxSubmissionFileBytes:"number"===typeof b&&Number.isFinite(b)&&b>0?b:31457280,learnerIdentifier:j,defaultTimezone:d(i.default_timezone)||"UTC",defaultGradingSchemeId:l,defaultMarkingWorkflow:p,defaultGradingScheme:g,maxResubmissions:"number"===typeof(null===x||void 0===x?void 0:x.max_resubmissions)?Math.max(0,x.max_resubmissions):0,resubmissionWindowDays:"number"===typeof(null===x||void 0===x?void 0:x.resubmission_window_days)?Math.max(0,x.resubmission_window_days):0,resubmissionCloseGraceDays:"number"===typeof(null===x||void 0===x?void 0:x.close_grace_days)?Math.max(0,x.close_grace_days):0,resubmissionMaxExtensionDays:"number"===typeof(null===x||void 0===x?void 0:x.max_extension_days)?Math.max(0,x.max_extension_days):0,resubmissionAttemptsPerCycle:"number"===typeof(null===x||void 0===x?void 0:x.attempts_per_cycle)?Math.max(1,x.attempts_per_cycle):1,resubmissionGradeCap:d(null===x||void 0===x?void 0:x.grade_cap),lateSubmissionBehaviour:"reject"===k||"allow"===k?k:"allow_and_flag"}}function p(){return(0,i.useContext)(l)}n.d(t,["G3",0,e=>{let{children:t}=e;const[n,r]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0),[d,u]=(0,i.useState)(null),[p,h]=(0,i.useState)(0);(0,i.useEffect)(()=>{let e=!0;return r(null),c(!0),u(null),a.default.get(`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}/api/tenant-policy/effective`).then(t=>{e&&r(m(t))}).catch(()=>{e&&(r(null),u("Tenant policy could not be loaded."))}).finally(()=>{e&&c(!1)}),()=>{e=!1}},[p]);const v=(0,i.useMemo)(()=>({policy:n,loading:o,error:d,reload:()=>h(e=>e+1)}),[n,o,d]);return(0,s.jsx)(l.Provider,{value:v,children:t})}])},31243(e,t,n){const i=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Array.from(new Set(n.flatMap(t=>e.getAll(t).flatMap(e=>e.split(",").map(e=>e.trim()).filter(Boolean)))))},a=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return n.map(t=>e.get(t)).find(e=>Boolean(e))},r={assignmentIds:["assignmentIds","assignment_id"],unitCodes:["unitCodes","unit","unit_code"],q:["q","query","search"],courseIds:["courseIds","course","course_id"],cohortIds:["cohortIds","cohort","cohort_id"],learnerIds:["learnerIds","learner","learnerId"],levelId:["levelId","level"],statuses:["statuses","status","state"],state:["statuses","status","state"],reasons:["reasons","reason"],attention:["attention","needsAttention","activation"],reviewerId:["reviewerId","reviewer"],samplingMethod:["samplingMethod","sampling"],releaseReadiness:["releaseReadiness","release"]};n.d(t,["As",0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";return{view:e.get("view")||t,query:a(e,"q","query")||"",course_id:i(e,"courseIds","course","course_id"),cohort_id:i(e,"cohortIds","cohort","cohort_id"),state:i(e,"statuses","state"),reviewer_id:a(e,"reviewerId","reviewer"),sampling_method:a(e,"samplingMethod","sampling"),release_readiness:a(e,"releaseReadiness","release")||"all",period:e.get("period")||"all",start_at:e.get("from")||void 0,end_at:e.get("to")||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}},"Cd",0,e=>({courseIds:i(e,"courseIds","course","course_id"),cohortIds:i(e,"cohortIds","cohort","cohort_id"),learnerIds:i(e,"learnerIds","learner","learnerId"),levelId:a(e,"levelId","level"),statuses:i(e,"statuses","status").map(e=>e.toLowerCase()),reasons:i(e,"reasons","reason"),attention:"overdue"!==e.get("activation")&&(["true","required"].includes(e.get("attention")||"")||"true"===e.get("needsAttention"))}),"GC",0,e=>({view:e.get("view")||"my_work",query:a(e,"q","query")||"",sort:e.get("sort")||"priority",course_id:i(e,"courseIds","course","course_id"),cohort_id:i(e,"cohortIds","cohort","cohort_id"),assignment_id:i(e,"assignmentIds","assignment_id"),unit_code:i(e,"unitCodes","unit","unit_code"),integrity:e.get("integrity")||"all",readiness:e.get("readiness")||"all"}),"N7",0,(e,t,n)=>
2{(r[t]||[t]).forEach(t=>e.delete(t)),n&&e.set(t,n)},"Zm",0,i,"Zw",0,e=>{const[t,n]=e.split(":"),i=n?Number(n):0;return{overdue:`${i} overdue ${1===i?"assignment":"assignments"}`,due_within_48h:`${i} due within 48 hours`,not_started:`${i} not started`,blocked_progression:"Progression is blocked",learner_action_required:"Learner action required",pace_gap:`${i} steps behind expected pace`,nothing_outstanding:"No required work outstanding",active:"Active learning"}[t]||e.replaceAll("_"," ")},"uh",0,e=>{const t=new URLSearchParams;return Object.entries(e).forEach(e=>{let[n,i]=e;(Array.isArray(i)?i:[i]).forEach(e=>{null!==e&&void 0!==e&&t.append(n,String(e))})}),t.toString()}])},48151(e,t,n){n(4746);const i={learner:[],educator:["assessment.mark","marking.read","assignments.read","assignments.create","learners.view_progress","people.read"],supervisor:["assessment.mark","marking.read","assignments.read","assignments.create","learners.view_progress","people.read","qa.moderate","analytics.view","cohorts.manage","courses.create","people.create","cohorts.create"],admin:["marking.read","assignments.read","assignments.create","learners.view_progress","people.read","qa.moderate","analytics.view","analytics.view_org","courses.create","cohorts.manage","tenant.manage","people.create","cohorts.create"]},a=e=>"string"===typeof e?e.trim().toLowerCase().replace(/[\s.-]+/g,"_").replace(/_+/g,"_"):"",r=e=>e&&"object"===typeof e&&!Array.isArray(e)?e:null,s=e=>Array.isArray(e)?e.map(e=>{var t,n,i;if("string"===typeof e)return a(e);const s=r(e);return a(null!==(t=null!==(n=null!==(i=null===s||void 0===s?void 0:s.role)&&void 0!==i?i:null===s||void 0===s?void 0:s.role_key)&&void 0!==n?n:null===s||void 0===s?void 0:s.key)&&void 0!==t?t:null===s||void 0===s?void 0:s.name)}).filter(Boolean):[],o={admin:"Administrator",super_admin:"Organisation Owner",educator:"Educator",teacher:"Teacher",tutor:"Tutor",assessor:"Assessor",marker:"Assessor",iqa:"IQA",moderator:"Moderator",quality_assurer:"Quality Assurer",programme_manager:"Programme Manager",program_manager:"Programme Manager",course_author:"Course Author",course_creator:"Course Author",course_manager:"Course Manager",supervisor:"Supervisor",learner:"Learner"},l=e=>{var t;return null!==(t=o[e])&&void 0!==t?t:e.split("_").map(e=>e?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:e).join(" ")},c=e=>{var t;return new Set(null!==(t=e.permissions)&&void 0!==t?t:i[e.primaryRole])};n.d(t,["jI",0,e=>{var t,n,i,o,c,d,u,m,p,h,v,g,f,_;let{primaryRole:y,user:b,organisation:w}=e;const x=r(b),k=r(null!==(t=null!==(n=null!==(i=null!==(o=null===x||void 0===x?void 0:x.currentMembership)&&void 0!==o?o:null===x||void 0===x?void 0:x.current_membership)&&void 0!==i?i:null===x||void 0===x?void 0:x.membership)&&void 0!==n?n:null===x||void 0===x?void 0:x.activeContext)&&void 0!==t?t:null===x||void 0===x?void 0:x.active_context),A=r(w),j=Array.from(new Set([a(null===w||void 0===w?void 0:w.role),...s(null!==(c=null===A||void 0===A?void 0:A.roleAssignments)&&void 0!==c?c:null===A||void 0===A?void 0:A.role_assignments),...s(null!==(d=null!==(u=null===x||void 0===x?void 0:x.roles)&&void 0!==u?u:null===x||void 0===x?void 0:x.roleAssignments)&&void 0!==d?d:null===x||void 0===x?void 0:x.role_assignments),...s(null!==(m=null!==(p=null===k||void 0===k?void 0:k.roles)&&void 0!==p?p:null===k||void 0===k?void 0:k.roleAssignments)&&void 0!==m?m:null===k||void 0===k?void 0:k.role_assignments),a(null!==(h=null===k||void 0===k?void 0:k.lmsRole)&&void 0!==h?h:null===k||void 0===k?void 0:k.lms_role),a(null!==(v=null===x||void 0===x?void 0:x.lmsRole)&&void 0!==v?v:null===x||void 0===x?void 0:x.lms_role),y].filter(Boolean))),S=(null===w||void 0===w||null===(g=w.displayRole)||void 0===g?void 0:g.trim())||"",C=Array.from(new Set([S,...j.filter(e=>!S||e!==y).map(l)].filter(Boolean)));return{primaryRole:y,roles:j,roleLabels:C,permissions:w?Array.from(new Set(w.permissions)):null,deniedPermissions:null!==(f=null===w||void 0===w?void 0:w.deniedPermissions)&&void 0!==f?f:[],organisationId:null!==(_=null===w||void 0===w?void 0:w.id)&&void 0!==_?_:null}},"xF",0,c])},855(e,t,n){n(18537);new Map},80487(e,t,n){n.d(t,{PF:()=>l,Pp:()=>o,hA:()=>c,wM:()=>s});var i=n(4746);const a=e=>`${e}-${"undefined"!==typeof crypto&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}`,r=e=>e.map((e,t)=>({...e,pos:t}));function s(e,t){var n;const a=null!==(n=e.recommended)&&void 0!==n?n:e.widgets.map(e=>({typeId:e.id,config:e.defaultConfig})),r=new Set,s=[];return a.forEach(t=>{var n,a,o;const l=e.widgets.find(e=>e.id===t.typeId),c=i.Fs.get(t.typeId);if(!l||!c)return;const d=null!==(n=null!==(a=t.config)&&void 0!==a?a:l.defaultConfig)&&void 0!==n?n:{},u=`${t.typeId}:${JSON.stringify(d)}`;r.has(u)||(r.add(u),s.push({instanceId:`recommended-${s.length}-${c.id}`,typeId:c.id,...t.title?{title:t.title}:{},config:d,pos:s.length,size:null!==(o=t.size)&&void 0!==o?o:c.defaultSize}))}),{version:2,scope:t,views:[{id:"all-work",name:"All work",instances:s,shortcuts:[]}],defaultViewId:"all-work",hidden_pages:[],collapsed:{activity:!1},ai_summary:!1,density:"comfortable"}}function o(e,t,n){const i=s(t,n),a=new Set(t.widgets.map(e=>e.id)),o={"educator.marking_queue":"assessment.my_queue","educator.turnaround":"assessment.turnaround","educator.active_learners":"teaching.assignment_scope","supervisor.org_health":"management.delivery_health","supervisor.review_time":"assessment.turnaround","supervisor.sla":"qual
2ity.marking_sla","supervisor.ai_assurance":"quality.ai_assurance","admin.users":"operations.workflow","admin.org_grade":"assessment.first_pass","learner.due_next":"learning.commitments","learner.recent_feedback":"learning.feedback","learner.course_progress":"learning.courses","learner.submission_tracker":"learning.commitments"};return i.views[0].instances=r([...e.tiles].sort((e,t)=>e.pos-t.pos).flatMap((e,n)=>{var i,r,s;const l=null!==(i=o[e.id])&&void 0!==i?i:e.id;return a.has(l)?[{instanceId:`import-v1-${n}-${l}`,typeId:l,pos:n,size:"full"===e.size?"wide":"half"===e.size?"medium":e.size,config:null!==(r=null===(s=t.widgets.find(e=>e.id===l))||void 0===s?void 0:s.defaultConfig)&&void 0!==r?r:{}}]:[]})),{...i,hidden_pages:[...e.hidden_pages],collapsed:e.collapsed,ai_summary:e.ai_summary,density:e.density}}function l(e){var t;return{...e,instanceId:a("card"),title:`${(e.title||(null===(t=i.Fs.get(e.typeId))||void 0===t?void 0:t.title)||"Information").slice(0,93)} \u2014 copy`,config:JSON.parse(JSON.stringify(e.config))}}function c(e){var t,n,i,a,r;const s=[null===(t=e.view)||void 0===t?void 0:t.replaceAll("_"," "),e.from&&e.to?`${new Date(e.from).toLocaleDateString()} \u2013 ${new Date(e.to).toLocaleDateString()}`:e.period&&{today:"Today","7d":"7 days","30d":"30 days",all:"All dates"}[e.period],e.query&&`Search: ${e.query}`,"me"===e.owner&&"Created by me","all"===e.owner&&"All permitted authors",e.needsAttention&&"Needs attention"];return null!==(n=e.courseIds)&&void 0!==n&&n.length&&s.push(`${e.courseIds.length} selected course${1===e.courseIds.length?"":"s"}`),null!==(i=e.cohortIds)&&void 0!==i&&i.length&&s.push(`${e.cohortIds.length} selected cohort${1===e.cohortIds.length?"":"s"}`),null!==(a=e.statuses)&&void 0!==a&&a.length&&s.push(e.statuses.map(e=>e.replaceAll("_"," ")).join(", ")),null!==(r=e.reasons)&&void 0!==r&&r.length&&s.push(e.reasons.map(e=>e.replaceAll("_"," ")).join(", ")),s.filter(Boolean).join(" \xb7 ")||"Current centre"}n.d(t,["Ls",0,r,"hb",0,a])},2822(e,t,n){n.d(t,{Px:()=>v,zd:()=>m,iO:()=>h,aX:()=>g});var i=n(5487),a=n(39215);n(7712),n(42567),n(40884),n(48151),n(855);const r={mandatedTiles:{},forbiddenTiles:[],mandatedPages:{}};const s=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),o=e=>{if(!s(e))throw new Error("The Home response was invalid.");return s(e.data)?e.data:e},l=e=>"string"===typeof e&&e.trim()?e.trim():null,c=e=>"small"===e||"medium"===e||"large"===e||"wide"===e||"half"===e||"full"===e?e:null,d=e=>{var t,n,i;if(!s(e))return r;const a=null!==(t=e.mandatedTiles)&&void 0!==t?t:e.mandated_tiles,o=null!==(n=e.mandatedPages)&&void 0!==n?n:e.mandated_pages,c=null!==(i=e.forbiddenTiles)&&void 0!==i?i:e.forbidden_tiles,d=s(a)?a:{},u=s(o)?o:{},m=e=>Object.fromEntries(Object.entries(e).flatMap(e=>{let[t,n]=e;const i=l(n);return i?[[t,i]]:[]}));return{mandatedTiles:m(d),forbiddenTiles:Array.isArray(c)?c.map(String):[],mandatedPages:m(u)}},u=e=>{const t=o(e);return{widgets:(Array.isArray(t.widgets)?t.widgets:[]).flatMap(e=>{if(!s(e)||!l(e.id))return[];const t=(Array.isArray(e.sizes)?e.sizes:[]).map(c).filter(e=>Boolean(e));return[{id:l(e.id),sizes:t,essential:Boolean(e.essential),customisable:!1!==e.customisable&&!1!==e.customizable}]}),actions:Array.isArray(t.actions)?t.actions.map(String):[],policy:d(t.policy),source:"server"}},m=async e=>{const t=await i.default.get((0,a.vz)("/manifest"),{signal:e,timeout:15e3}),n=u(t);return{...n,scope:t.scope,permissionsKey:t.permissionsKey,roles:t.roles,recommended:t.recommended,shortcuts:t.shortcuts,requiredNotices:t.requiredNotices,widgets:n.widgets.map(e=>({...e,...t.widgets.find(t=>t.id===e.id)}))}},p=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),h=async(e,t)=>{const n=await i.default.post((0,a.vz)("/snapshot"),{instances:e,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"},{signal:t,timeout:25e3});if(!p(n)||!p(n.widgets)||!e.every(e=>Object.prototype.hasOwnProperty.call(n.widgets,e.instanceId))||!Array.isArray(n.needsYou)||!n.needsYou.every(e=>p(e)&&"string"===typeof e.id&&"string"===typeof e.title)||!Object.values(n.widgets).every(e=>p(e)&&("not_available"===e.status?"string"===typeof e.reason:"error"===e.status||"ok"===e.status&&p(e.data)&&Array.isArray(e.data.rows)&&e.data.rows.every(e=>p(e)&&"string"===typeof e.id&&"string"===typeof e.title))))throw new Error("The Home data response could not be read. Please retry.");return n},v=async e=>{const t=await i.default.get((0,a.vz)("/activity"),{signal:e,timeout:15e3});if(!t||!Array.isArray(t.items)||!t.items.every(e=>e&&"string"===typeof e.id&&"string"===typeof e.label&&"string"===typeof e.ts))throw new Error("Recent activity could not be read.");return t}
2,g=async(e,t,n)=>{const r=await i.default.get((0,a.vz)("/options"),{params:{kind:e,query:t},signal:n});return Array.isArray(r)?r:r.items}},70092(e,t,n){n.d(t,{DV:()=>u,Uf:()=>d,et:()=>c});const i={calendar:"/calendar",marking:"/marking",quality:"/quality/moderation",courses:"/courses",people:"/people/learners",cohorts:"/people/cohorts",deliveries:"/deliveries",assignments:"/assignments",sessions:"/communications/live",analytics:"/analytics",feedback:"/results",organisation:"/organisation",authoring:"/courses",help:"/support",support:"/support/review",settings:"/settings/profile",billing:"/settings/workspace/billing"},a={course:"/courses/",assignment:"/assignments/",marking_case:"/marking/cases/",quality_case:"/quality/moderation/",learner:"/people/learners",cohort:"/people/cohorts",delivery:"/deliveries/",session:"/communications/live/",ticket:"/support/review",course_intake:"/courses/new/",course_import:"/courses/imports/",course_studio:"/courses/",assessment_draft:"/assignments/",assessment_management:"/assignments/"},r=new Set(["view","query","sort","courseIds","cohortIds","deliveryIds","learnerIds","period","from","to","statuses","reasons","fields","rowLimit","display","integrity","readiness","owner","preferredCourseId","needsAttention","samplingMethod","reviewerId","levelId","releaseReadiness","offering","activity"]),s=new Set(["courseIds","cohortIds","deliveryIds","learnerIds","statuses","reasons","fields"]),o={marking:{query:"q",courseIds:"course",cohortIds:"cohort"},quality:{query:"q",courseIds:"course",cohortIds:"cohort",statuses:"state",reviewerId:"reviewer",samplingMethod:"sampling",releaseReadiness:"release"},courses:{view:"status",query:"q",needsAttention:"attention"},authoring:{view:"status",query:"q",needsAttention:"attention"},people:{query:"q",courseIds:"course",cohortIds:"cohort",learnerIds:"learner",levelId:"level",statuses:"status",reasons:"reason",needsAttention:"attention"},sessions:{courseIds:"course",learnerIds:"learner",cohortIds:"cohort"},deliveries:{query:"q",courseIds:"course",cohortIds:"cohort",statuses:"status"},assignments:{query:"q"},cohorts:{query:"q"},support:{query:"q",statuses:"status"},analytics:{cohortIds:"cohort",from:"start_date",to:"end_date"},organisation:{view:"homeView",query:"q",statuses:"status"}};function l(e){if(!e||!i[e.kind]&&!a[e.kind])return null;if(e.kind in a&&(!e.recordId||e.recordId.length>200||/[\\/]/.test(e.recordId)||Array.from(e.recordId).some(e=>e.charCodeAt(0)<32)))return null;const t={};for(const[i,a]of Object.entries(null!==(n=e.params)&&void 0!==n?n:{})){var n;if(!r.has(i))return null;if("string"===typeof a&&a.length<=500&&!Array.from(a).some(e=>e.charCodeAt(0)<32)||"boolean"===typeof a||"number"===typeof a&&Number.isFinite(a))t[i]=a;else{if(!(Array.isArray(a)&&a.length<=20&&a.every(e=>"string"===typeof e&&e.length<=200)))return null;t[i]=[...a]}}return{kind:e.kind,...e.recordId?{recordId:e.recordId}:{},params:t}}function c(e){const t=l(e);if(!t)return null;let n=t.recordId?a[t.kind]:i[t.kind];if("quality"===t.kind&&["overview","moderation","second-marking","issues","exports"].includes(String(t.params.view))&&(n="overview"===t.params.view?"/quality":`/quality/${t.params.view}`),!n)return null;if("settings"===t.kind){const e=String(t.params.view||"profile");return["profile","appearance","security","notifications"].includes(e)?`/settings/${e}`:null}const r=new URLSearchParams;for(const[i,a]of Object.entries(t.params)){var s;if(["rowLimit","display","fields"].includes(i)||"quality"===t.kind&&"view"===i&&["overview","moderation","second-marking","issues","exports"].includes(String(a)))continue;const e="organisation"===t.kind&&"view"===i&&["organisation","marking","centres","staff","policy","history"].includes(String(a))?"tab":(null===(s=o[t.kind])||void 0===s?void 0:s[i])||i;let n=Array.isArray(a)?a.join(","):String(a);["courses","authoring"].includes(t.kind)&&"needsAttention"===i&&(n=a?"needs_attention":"all"),r.set(e,n)}let c=t.recordId?encodeURIComponent(t.recordId):"";return"learner"!==t.kind&&"cohort"!==t.kind&&"ticket"!==t.kind||(r.set(t.kind,t.recordId),c=""),"course_studio"===t.kind&&(c+="/studio"),"assessment_draft"===t.kind&&(c+="/edit","deliver"===r.get("view")&&(r.delete("view"),r.set("tab","deliver"))),"assessment_management"===t.kind&&(c+="/manage"),`${n}${c}${r.toString()?`?${r}`:""}`}function d(e,t){var n,c;let d=null===(n=Object.entries(i).find(t=>{let[,n]=t;return n===e}))||void 0===n?void 0:n[0];const u=/^\/quality(?:\/(overview|moderation|second-marking|issues|exp
2orts))?$/.exec(e);u&&(d="quality");const m=/^\/settings\/(profile|appearance|security|notifications)$/.exec(e);let p;m&&(d="settings");const h=/^\/(courses|assignments)\/([^/]+)\/(studio|edit|manage)$/.exec(e);if(h){d="studio"===h[3]?"course_studio":"edit"===h[3]?"assessment_draft":"assessment_management";try{p=decodeURIComponent(h[2])}catch{return null}}if(!d)for(const[i,r]of Object.entries(a).sort((e,t)=>t[1].length-e[1].length)){if(!e.startsWith(r))continue;const t=e.slice(r.length);if(t&&!t.includes("/")&&!["new","create","import","generation"].includes(t)){try{p=decodeURIComponent(t)}catch{return null}d=i;break}}if(!d)return null;const v=new URLSearchParams(t);"cohorts"===d&&v.get("cohort")&&(d="cohort",p=v.get("cohort"));const g=u?{view:u[1]||"overview"}:m?{view:m[1]}:{},f=Object.fromEntries(Object.entries(null!==(c=o[d])&&void 0!==c?c:{}).map(e=>{let[t,n]=e;return[n,t]})),_=new Set(["page","intakePage","page_size","pageSize","cursor","selected","selectedIds","create","new","modal","returnTo","return_to","token","code","state","auth","source_url"]);for(const[i,a]of v){const e="organisation"===d&&"tab"===i?"view":f[i]||i;if("assessment_draft"!==d||"tab"!==i||"deliver"!==a){if((!_.has(i)||"quality"===d&&"state"===i)&&("cohort"!==d||"cohort"!==i)){if(!r.has(e))return null;a&&(g[e]=s.has(e)?Array.from(new Set([...Array.isArray(g[e])?g[e]:[],...a.split(",").filter(Boolean)])):"needsAttention"===e?"true"===a||"needs_attention"===a:a)}}else g.view="deliver"}return l({kind:d,...p?{recordId:p}:{},params:g})}function u(e,t){return Object.fromEntries(Object.entries(e.params).filter(e=>{let[n]=e;return t.includes(n)}))}n.d(t,["Bj",0,{calendar:"calendar.agenda",marking:"assessment.my_queue",quality:"quality.marking_sla",courses:"authoring.courses",people:"teaching.assignment_scope",sessions:"communications.sessions",feedback:"learning.feedback",assignments:"learning.commitments"}])},40884(e,t,n){n.d(t,{xm:()=>s});n(5487),n(855);const i=e=>"object"===typeof e&&null!==e&&!Array.isArray(e);const a="em_home_needsyou:",r="em-needsyou-changed";function s(e){try{const t=window.localStorage.getItem(`${a}${e}`),n=t?JSON.parse(t):{};return i(n)?Object.fromEntries(Object.entries(n).filter(e=>"number"===typeof e[1]&&Number.isFinite(e[1])&&e[1]>=0)):{}}catch{return{}}}n.d(t,["k2",0,r])},39215(e,t,n){n.d(t,{JD:()=>h,Lg:()=>p,eg:()=>m,jb:()=>d,qz:()=>s});var i=n(18537);async function a(){return(await Promise.resolve().then(n.bind(n,5487))).default}function r(e){return{version:1,scope:e,tiles:[],hidden_pages:[],collapsed:{activity:!1},ai_summary:!1,density:"comfortable"}}function s(e,t){try{const n=t.startsWith("staff:")?t.slice(6):null;if(n){const a=window.localStorage.getItem(c(e,`${n}:${(0,i.yk)()||"organisation"}`));if(a){const e=JSON.parse(a).document;if(2===(null===e||void 0===e?void 0:e.version))return{...r(t),hidden_pages:e.hidden_pages,collapsed:e.collapsed,density:e.density}}}const a=window.localStorage.getItem(((e,t)=>`em_home_prefs:${e}:${t}`)(e,t));return a?function(e,t){var n;if(!e||"object"!==typeof e)return null;const i=e;return{version:1,scope:t,tiles:Array.isArray(i.tiles)?i.tiles.filter(e=>Boolean(e)&&"object"===typeof e).slice(0,50).map((e,t)=>{var n,i;return{id:String(null!==(n=e.id)&&void 0!==n?n:""),pos:"number"===typeof e.pos?e.pos:t,size:(i=e.size,"small"===i||"medium"===i||"large"===i||"wide"===i||"half"===i||"full"===i?i:"half")}}).filter(e=>e.id.length>0&&e.id.length<100):[],hidden_pages:Array.isArray(i.hidden_pages)?i.hidden_pages.filter(e=>"string"===typeof e).slice(0,50):[],collapsed:{activity:Boolean(null===(n=i.collapsed)||void 0===n?void 0:n.activity)},ai_summary:Boolean(i.ai_summary),density:"compact"===i.density?"compact":"comfortable"}}(JSON.parse(a),t):null}catch{return null}}const o="em-home-prefs-changed";const l=e=>`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}/api/home${e}`,c=(e,t)=>`em_home_v2:${e}:${t}`;function d(e,t){try{const n=c(e,t.scope.key),i=JSON.stringify(t);if(window.localStorage.getItem(n)===i)return;window.localStorage.setItem(n,i)}catch{}window.dispatchEvent(new CustomEvent(o,{detail:{userId:e,scope:t.scope.key,revision:t.revision}}))}function u(e){var t,n;const i=e,a=e=>Boolean(e)&&"object"===typeof e&&!Array.isArray(e),r=e=>"string"===typeof e&&e.trim().length>0,s=null===i||void 0===i?void 0:i.document,o=null===s||a(s)&&2===s.version&&s.scope===(null===(t=i.scope)||void 0===t?void 0:t.key)&&Array.isArray(s.views)&&s.views.length>0&&s.views.length<=8&&s.views.every(e=>a(e)&&r(e.id)&&r(e.name)&&Array.isArray(e.instances)&&e.instances.length<=24&&e.instances.every(e=>a(e)&&r(e.instanceId)&&r(e.typeId)&&a(e.config)&&Number.isInteger(e.pos)&&["small","medium","large","wide"].includes(e.size))&&Array.isArray(e.shortcuts)&&e.shortcuts.length<=24&&e.shortcuts.every(e=>a(e)&&r(e.id)&&r(e.title)&&a(e.destination)&&r(e.destination.kind)&&a(e.destination.params)))&&s.views.some(e=>e.id===s.defaultViewId)&&Array.isArray(s.hidden_pages)&&s.hidden_pages.every(e=>
2"string"===typeof e)&&a(s.collapsed)&&"boolean"===typeof s.collapsed.activity&&"boolean"===typeof s.ai_summary&&["comfortable","compact"].includes(s.density);if(!a(i)||!Number.isSafeInteger(i.revision)||i.revision<0||!r(null===(n=i.scope)||void 0===n?void 0:n.key)||!o)throw new Error("The saved Home response could not be read. Your layout has not been replaced.");return i}async function m(e){return u(await(await a()).get(l("/preferences"),{signal:e,timeout:15e3}))}async function p(e,t,n,i){const r=u(await(await a()).patch(l("/preferences"),{expectedRevision:n,document:t},{signal:i}));if(null!==i&&void 0!==i&&i.aborted)throw new Error("The Home request belongs to an earlier context.");if(r.scope.key!==t.scope||!r.document||r.revision!==n+1)throw new Error("The Home acknowledgement did not match this save. Reload the current context before retrying.");return d(e,r),r}function h(e){var t,n;const i=null===e||void 0===e?void 0:e.code,a=null===e||void 0===e?void 0:e.response;if(409===(null===a||void 0===a?void 0:a.status)){let e=null;try{var r,s;e=u(null===(r=a.data)||void 0===r||null===(s=r.detail)||void 0===s?void 0:s.details)}catch{}return{message:"Home changed in another session. Your edits are still here. Review the latest saved layout before choosing what to keep.",conflict:e}}return null!==a&&void 0!==a&&a.status&&a.status>=500?{message:"Home is temporarily unavailable. Please try again shortly.",conflict:null}:!a&&("ERR_NETWORK"===i||e instanceof Error&&"Network Error"===e.message)?{message:"We couldn\u2019t reach EduMark. Please try again shortly.",conflict:null}:a||"ECONNABORTED"!==i&&"ETIMEDOUT"!==i?{message:(null===a||void 0===a||null===(t=a.data)||void 0===t||null===(n=t.detail)||void 0===n?void 0:n.message)||(e instanceof Error?e.message:"Home could not complete this request. Please try again."),conflict:null}:{message:"Home took too long to respond. Please try again.",conflict:null}}n.d(t,["mD",0,o,"vz",0,l])},4746(e,t,n){var i=n(13946);const a=[{id:"learner.due_next",title:"Due next",roles:["learner"],defaultSize:"full",lockable:!0,emptyTeach:"Nothing due right now. When an assignment is set, it appears here with an honest countdown and what happens if it\u2019s late.",drillRoute:"/assignments"},{id:"learner.recent_feedback",title:"Recent feedback",roles:["learner"],defaultSize:"half",lockable:!1,emptyTeach:"No feedback yet. When a marker releases feedback on your work, the latest appears here the moment it\u2019s ready.",drillRoute:"/assignments"},{id:"learner.submission_tracker",title:"Submission status",roles:["learner"],defaultSize:"half",lockable:!1,emptyTeach:"Nothing in flight. After you press submit, this shows exactly where your work is: received \u2192 being marked \u2192 feedback ready.",drillRoute:"/assignments"},{id:"learner.course_progress",title:"Official result activity",roles:["learner"],defaultSize:"half",lockable:!1,emptyTeach:"No official result activity yet. Submitted work and released results appear here without estimating course completion.",drillRoute:"/assignments"},{id:"learner.announcements",title:"Announcements",roles:["learner"],defaultSize:"half",lockable:!1,emptyTeach:"No announcements from your centre right now."},{id:"educator.marking_queue",title:"Marking queue",roles:["educator"],defaultSize:"full",lockable:!0,emptyTeach:"Nothing waiting on you. New allocations appear here the moment they arrive, with the queue one click away.",drillRoute:"/assignments",legacy:!0},{id:"educator.turnaround",title:"Median marking turnaround",roles:["educator"],defaultSize:"half",lockable:!0,emptyTeach:"Once an approved marking decision exists, its reconciled working-day turnaround appears here.",drillRoute:"/assignments",legacy:!0},{id:"educator.active_learners",title:"Assignments in scope",roles:["educator"],defaultSize:"half",lockable:!1,emptyTeach:"Official assignments allocated within your selected centre scope appear here.",legacy:!0},{id:"supervisor.org_health",title:"Centre workflow",roles:["supervisor"],defaultSize:"full",lockable:!0,emptyTeach:"As official assignments, submissions and result records are created, the reconciled centre workflow appears here.",drillRoute:"/analytics",legacy:!0},{id:"supervisor.review_time",title:"Median marking turnaround",roles:["supervisor"],defaultSize:"half",lockable:!0,emptyTeach:"Once approved decisions exist, the median
2working-day turnaround appears here.",drillRoute:"/analytics",legacy:!0},{id:"supervisor.ai_assurance",title:"AI comparison evidence",roles:["supervisor"],defaultSize:"half",lockable:!0,ai:!0,emptyTeach:"When an AI proposal has an approved named-human comparison, its recorded evaluation evidence appears here.",drillRoute:"/analytics",legacy:!0},{id:"supervisor.sla",title:"Marking SLA",roles:["supervisor"],defaultSize:"half",lockable:!0,emptyTeach:"On-time marking performance appears here once submissions flow.",drillRoute:"/analytics",legacy:!0},{id:"admin.users",title:"Official workflow",roles:["admin"],defaultSize:"full",lockable:!0,emptyTeach:"Official assignments, submissions and result records in the selected centre appear here.",drillRoute:"/analytics",legacy:!0},{id:"admin.org_grade",title:"First-pass yield",roles:["admin"],defaultSize:"half",lockable:!1,emptyTeach:"Once official results are released, their reconciled first-attempt share appears here.",drillRoute:"/analytics",legacy:!0},{id:"assessment.my_queue",title:"Your marking",requiresAny:["assessment.mark","assessment.view_submissions","marking.read","marking.manage"],area:"assessment",dataKey:"assessment.my_queue",defaultSize:"large",sizes:["medium","large","wide"],priority:100,essential:!0,customisable:!1,lockable:!0,recommendedFor:["assessor","marker","educator","teacher","tutor"],emptyTeach:"Nothing is waiting for you. New marking allocations appear here when they arrive.",drillRoute:"/marking?view=assigned_to_me"},{id:"teaching.assignment_scope",title:"Learners and assignments",requiresAny:["learners.view_progress","learning.progress.read","people.read","people.view"],area:"teaching",dataKey:"teaching.assignment_scope",defaultSize:"medium",sizes:["small","medium","large"],priority:84,essential:!0,customisable:!1,lockable:!0,recommendedFor:["teacher","tutor","educator","programme_manager","supervisor"],emptyTeach:"Learner progress will appear when a course delivery is active in your authorised scope.",drillRoute:"/people/learners?attention=true"},{id:"assessment.turnaround",title:"Marking turnaround",requiresAny:["assessment.mark","marking.read","analytics.assessment","analytics.view"],area:"assessment",dataKey:"assessment.marking_turnaround.median",defaultSize:"medium",sizes:["small","medium","large"],priority:78,essential:!1,customisable:!0,lockable:!0,recommendedFor:["assessor","marker","educator","programme_manager","supervisor"],emptyTeach:"No approved decisions with valid submission and approval times exist in this period.",drillRoute:"/analytics?section=assessment&metric=assessment.marking_turnaround.median"},{id:"quality.marking_sla",title:"Quality and SLA",requiresAny:["qa.moderate","quality.moderate","analytics.quality","analytics.view"],area:"quality",dataKey:"quality.marking_sla",defaultSize:"medium",sizes:["medium","large"],priority:88,essential:!0,customisable:!1,lockable:!0,recommendedFor:["iqa","moderator","quality_assurer","programme_manager","supervisor"],emptyTeach:"No approved decisions with a configured SLA target can be measured in this period.",drillRoute:"/analytics?section=quality"},{id:"quality.ai_assurance",title:"AI comparison evidence",requiresAny:["qa.moderate","quality.moderate","analytics.ai","analytics.view"],area:"quality",dataKey:"quality.ai_assurance",defaultSize:"medium",sizes:["medium","large"],priority:45,essential:!1,customisable:!0,lockable:!0,recommendedFor:["iqa","moderator","quality_assurer","supervisor"],ai:!0,emptyTeach:"Comparison evidence appears after a named human approves a decision with an AI proposal.",drillRoute:"/analytics?section=ai"},{id:"management.delivery_health",title:"Delivery health",requiresAny:["programmes.manage","deliveries.manage","cohorts.manage","deliveries.manage_cohorts","deliveries.manage_team","analytics.view_org","analytics.view"],area:"management",dataKey:"management.delivery_health",defaultSize:"wide",sizes:["large","wide"],priority:92,essential:!0,customisable:!1,lockable:!0,recommendedFor:["programme_manager","course_manager","supervisor","admin","super_admin"],emptyTeach:"Delivery health appears when assignments and submissions exist in y
2our authorised scope.",drillRoute:"/analytics?section=overview"},{id:"assessment.first_pass",title:"First-pass outcomes",requiresAny:["analytics.assessment","analytics.view_org","analytics.view"],area:"assessment",dataKey:"assessment.first_pass",defaultSize:"medium",sizes:["small","medium","large"],priority:62,essential:!1,customisable:!0,lockable:!0,recommendedFor:["programme_manager","supervisor","admin","super_admin"],emptyTeach:"First-pass outcomes appear when official results have been released.",drillRoute:"/analytics?section=assessment&metric=assessment.first_pass"},{id:"authoring.courses",title:"Course authoring",requiresAny:["courses.create","courses.edit","courses.write","courses.manage"],area:"authoring",dataKey:"authoring.courses",defaultSize:"medium",sizes:["medium","large"],priority:58,essential:!0,customisable:!1,lockable:!0,recommendedFor:["course_author","course_creator","course_manager","supervisor","admin"],emptyTeach:"Course totals will appear here as courses are created in your authorised catalogue.",drillRoute:"/courses"},{id:"operations.workflow",title:"Organisation workflow",requiresAny:["tenant.manage","settings.manage","people.manage","staff.manage","analytics.view_org"],area:"operations",dataKey:"operations.workflow",defaultSize:"wide",sizes:["large","wide"],priority:90,essential:!0,customisable:!1,lockable:!0,recommendedFor:["admin","super_admin","organisation_admin"],emptyTeach:"Operational counts appear as people, deliveries and official records are created.",drillRoute:"/analytics?section=operations"}],r=[["calendar.agenda","Your calendar","learning","large","Your events, live sessions and upcoming deadlines appear here. Open Calendar to organise your time or connect Google and Outlook."],["learning.continue","Continue learning","learning","large","Your next available assignment or course activity appears here."],["learning.commitments","My commitments","learning","medium","Assignments appear here with your individual deadlines and availability."],["learning.courses","My courses","learning","large","Your enrolled courses and real progress appear here."],["learning.feedback","Feedback and corrections","learning","medium","Released feedback and corrections appear here when they are available to you."],["communications.sessions","Live sessions","teaching","medium","Your authorised teaching and learning commitments appear here."],["authoring.assignments","Assessment library","authoring","large","Return to a draft, review readiness or open a published assessment."],["operations.invitations","Invitations","operations","large","Review invitations and their actual delivery status."],["operations.governance","Governance and access","operations","medium","Authorised membership and access information appears here."],["operations.history","Policy history","operations","medium","Published policy versions and their recorded reasons appear here."],["assigned.resources","Assigned work","teaching","large","Resources allocated to you appear here. Contact your organisation if you need an allocation."],["quality.evidence","Quality evidence","quality","large","Readable quality evidence in your authorised scope appears here."]].map(e=>{let[t,n,i,a,r]=e;return{id:t,title:n,area:i,defaultSize:a,emptyTeach:r,sizes:["medium","large","wide"],lockable:!1,customisable:!0}}),s={"calendar.agenda":{requiresAny:["calendar.view"]},"assessment.my_queue":{title:"My marking",requiresAny:["assessment.mark","marking.manage"]},"quality.marking_sla":{title:"Quality reviews",drillRoute:"/quality"},"quality.ai_assurance":{requiresAny:["analytics.view"]},"assessment.turnaround":{drillRoute:"/marking?view=completed"},"teaching.assignment_scope":{title:"Learners needing attention",drillRoute:"/people/learners?attention=true"},"management.delivery_health":{title:"Course deliveries",drillRoute:"/courses"},"operations.workflow":{title:"Organisation operations",drillRoute:"/settings/organisation"},"authoring.courses":{title:"Continue authoring",emptyTeach:"Saved blueprints, drafts and published courses appear here with their next action."}},o=[...a,...r].map(e=>({...e,...s[e.id],essential:!1,customisable:!0})),l=new Map(o.map(e=>[e.id,e]));o.filter(e=>!e.legacy&&e.requiresAny);n.d(t,["Fs",0,l,"ku",0,function(e,t){var n,a;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;const s=new Set([...r].flatMap(e=>{var t;return null!==(t=i.VT[e])&&void 0!==t?t:[]})),o=e=>!r.has(e)&&!s.has(e)&&t.has(e),l=null!==(n=e.requiresAny)&&void 0!==n?n:[],c=null!==(a=e.requiresAll)&&void 0!==a?a:[];return(0===l.length||l.some(o))&&c.every(o)}])}
2,82967(e,t,n){var i=n(5487);n.d(t,["f",0,e=>{var t;i.default.post((t="/api/observability/product-events",`${"https://systems.aries.edumark.ai".replace(/\/$/,"")}${t}`),{contract_version:"1.0",reason_code:"none",compatibility:!1,...e}).catch(()=>{})}])},17374(e,t,n){var i=n(12229);const a="/support/review",r=new Set(["support","supervisor","admin","ops","operations","manager"]),s=new Set(["centre_admin","centre-admin","center_admin","center-admin"]),o=e=>(null!==e&&void 0!==e?e:"").trim().toLowerCase(),l="".split(",").map(e=>o(e)).filter(Boolean),c=l.length>0?l:["[email protected]"];n.d(t,["Ec",0,(e,t)=>{const n=o(e),i=(null!==(a=t)&&void 0!==a?a:"").trim().toLowerCase();var a;const l=Boolean(i)&&!s.has(i)&&(i.includes("support")||r.has(i));return Boolean(n&&(c.includes(n)||n.endsWith("@edumark.ai"))||l)},"HV",0,a,"vg",0,e=>(0,i.F5)("landing",e,a)])},98216(e,t,n){n.r(t),n.d(t,{default:()=>al});var i=n(33006),a=n(78165),r=n(73326),s=n(97353),o=n(20110);const l='[aria-modal="true"]',c=`:scope > ${l}, :scope > * > ${l}`,d='[class*="MuiModal"], [class*="MuiPopover"], [class*="MuiDialog"], [class*="MuiDrawer"]';function u(e){return!e.hasAttribute(s.gC)&&!e.hasAttribute(s.nc)&&(!(!e.matches(l)&&!e.querySelector(c))&&(!e.querySelector(`[${s.nc}]`)&&(!e.matches(d)&&!e.querySelector(d))))}function m(e,t,n){e.setAttribute(s.gC,""),e.setAttribute("inert",""),e.setAttribute("aria-hidden","true"),e.style.pointerEvents="none",e.querySelectorAll("iframe, object, embed").forEach(e=>{e.removeAttribute("src"),e.removeAttribute("srcdoc"),e.removeAttribute("data")}),t.insertBefore(e,n&&n.parentNode===t?n:null);const i=e.animate([{opacity:0}],{duration:170,easing:s.rM,fill:"forwards"});let a=!1;const r=()=>{a||(a=!0,window.clearTimeout(o),e.remove())},o=window.setTimeout(r,420);i.finished.then(r,r)}var p=n(57646),h=n(71119),v=n(85188),g=n(39787),f=n(43330),_=n(52733),y=n(97738),b=n(40555),w=n(3374);const x=e=>{let{children:t}=e;const n=(0,v.d4)(e=>e.auth.token);return(0,i.useEffect)(()=>function(){if("undefined"===typeof MutationObserver||"undefined"===typeof document)return()=>{};const e=new MutationObserver(e=>{if("standard"===(0,o.uX)()&&"hidden"!==document.visibilityState)for(const t of e){if(0===t.removedNodes.length)continue;const e=t.target;e.isConnected&&(e instanceof Element&&e.closest(`[${s.gC}], ${d}`)||t.removedNodes.forEach(n=>{n instanceof HTMLElement&&!n.isConnected&&"function"===typeof n.animate&&u(n)&&m(n,e,t.nextSibling)}))}});return e.observe(document.body,{childList:!0,subtree:!0}),()=>e.disconnect()}(),[]),(0,w.jsx)(a.gc,{token:n,children:(0,w.jsx)(b.w,{children:t})})},k=()=>{const{resolvedTheme:e}=(0,y.eP)();return(0,h.createPortal)((0,w.jsx)(g.N9,{position:"top-center",autoClose:5e3,hideProgressBar:!1,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:e,transition:r.x}),document.body)},A=e=>{let{children:t}=e;return(0,w.jsx)(y.NP,{children:(0,w.jsx)(_.O,{children:(0,w.jsx)(v.Kq,{store:f.default,children:(0,w.jsxs)(x,{children:[t,(0,w.jsx)(p.G,{}),(0,w.jsx)(k,{})]})})})})};var j=n(72374),S=n(93949),C=n(8650),I=n(89089),E=n(64471),R=n(53814),$=n(55507),N=n(18955);const T=e=>{let{isAuth:t=!1}=e;const n=(0,S.Zp)(),{pathname:a,search:r}=(0,S.zy)(),s=`mailto:[email protected]?subject=${encodeURIComponent("Broken link")}&body=${encodeURIComponent(`Path: ${a}${r}`)}`;return(0,i.useEffect)(()=>{try{$.bC.capture("404_viewed",{path:a+r})}catch{}},[a,r]),(0,w.jsxs)("div",{className:N.A.page,role:"main","aria-labelledby":"nf-title",children:[(0,w.jsx)("div",{className:N.A.wrapper,children:(0,w.jsxs)("section",{className:N.A.card,"aria-live":"polite",children:[(0,w.jsx)("div",{className:N.A.code,"aria-hidden":"true",children:"404"}),(0,w.jsx)("h1",{id:"nf-title",className:N.A.title,children:"This page wandered off"}),(0,w.jsxs)("p",{className:N.A.subtitle,children:["We couldn\u2019t find ",(0,w.jsx)("span",{className:N.A.path,children:a}),"."]}),(0,w.jsxs)("div",{className:N.A.actions,children:[(0,w.jsx)("button",{className:`${N.A.btn} ${N.A.btnPrimary}`,onClick:()=>n(-1),children:"Go back"}),(0,w.jsx)("button",{className:`${N.A.btn} ${N.A.btnGhost}`,onClick:()=>
2n(t?"/dashboard":"/login"),children:t?"Go to dashboard":"Go to login"}),(0,w.jsx)("a",{className:`${N.A.btn} ${N.A.btnLink}`,href:s,children:"Report this"})]}),(0,w.jsx)("p",{className:N.A.tip,children:"Tip: check the URL or use the sidebar to find what you need."})]})}),(0,w.jsxs)("div",{className:N.A.bgDecor,children:[(0,w.jsx)("div",{className:`${N.A.blob} ${N.A.blobA}`}),(0,w.jsx)("div",{className:`${N.A.blob} ${N.A.blobB}`})]})]})};var L=n(18492),O=n(53294),M=n(39879),U=n(47443),P=n(83420);const q=(e,t)=>{const n=Number.parseInt((null!==e&&void 0!==e?e:"").trim(),10);return Number.isFinite(n)&&n>0?n:t},D={slowHintMs:q(void 0,8e3),hardTimeoutMs:q(void 0,45e3)},z={initiating_authentication:{title:"Connecting securely\u2026",detail:"Opening a protected connection to EduMark."},redirecting_to_provider:{title:"Connecting securely\u2026",detail:"Taking you to your sign-in provider."},processing_provider_callback:{title:"Signing you in\u2026",detail:"Confirming your identity with EduMark."},exchanging_credentials:{title:"Signing you in\u2026",detail:"Verifying your secure sign-in code."},creating_or_restoring_session:{title:"Signing you in\u2026",detail:"Starting your secure EduMark session."},loading_user_profile:{title:"Preparing your EduMark workspace\u2026",detail:"Loading your profile."},loading_tenant_context:{title:"Preparing your EduMark workspace\u2026",detail:"Finding your organisation and centres."},loading_permissions:{title:"Loading your courses and permissions\u2026",detail:"Applying what you can see and do."},determining_destination:{title:"Almost ready\u2026",detail:"Working out the best place to take you."},redirecting_to_application:{title:"Almost ready\u2026",detail:"Opening your EduMark workspace."}},B=e=>"recoverable_error"===e||"fatal_error"===e,F="sWK4mf1m",W="AQUetHcw",H="FewatmQz",V="Z_5IEfaW",Y="jTkPFAuY",G="xQE1QMuZ",J="XdXFB5pj",K="qp5S1_hi",X="irFZO8Zg",Z="tBUAvkhi",Q="gq4pG0ct",ee="m5Ygq3oO",te=e=>{let{state:t,failure:n=null,errorReference:a=null,flowStartedAt:r,onRetry:s,onReturnToSignIn:o,onSignOutAndRestart:l,retrying:c=!1}=e;const[d,u]=(0,i.useState)(!1),m=B(t)||null!==n;if((0,i.useEffect)(()=>{if(m)return void u(!1);const e=null!==r&&void 0!==r?r:Date.now(),t=Date.now()-e,n=Math.max(0,D.slowHintMs-t),i=window.setTimeout(()=>u(!0),n);return()=>window.clearTimeout(i)},[m,r]),m&&n)return(0,w.jsx)("main",{className:`${F} ${P.A.fullscreen}`,"data-testid":"auth-transition","data-state":t,children:(0,w.jsxs)("section",{className:G,role:"alert",children:[(0,w.jsx)("img",{src:M.A.BRAND_FAVICON,alt:"","aria-hidden":"true",width:48,height:48,style:{borderRadius:"var(--radius-lg)"}}),(0,w.jsx)("h1",{className:J,children:"fatal"===n.kind?"Sign-in is unavailable right now":"Sign-in didn\u2019t complete"}),(0,w.jsx)("p",{className:K,children:n.message}),(0,w.jsxs)("div",{className:X,children:[n.canRetry&&s?(0,w.jsx)("button",{type:"button",className:Z,disabled:c,onClick:s,"data-testid":"auth-retry",children:c?"Trying again\u2026":"Try again"}):null,o?(0,w.jsx)("button",{type:"button",className:n.canRetry?Q:Z,onClick:o,"data-testid":"auth-return-to-sign-in",children:"Return to sign-in"}):null,l?(0,w.jsx)("button",{type:"button",className:Q,onClick:l,"data-testid":"auth-sign-out-restart",children:"Sign out and restart"}):null]}),a?(0,w.jsxs)("p",{className:ee,"data-testid":"auth-error-reference",children:["Reference: ",a
2]}):null]})});const p=t in z?z[t]:z.processing_provider_callback;return(0,w.jsx)("main",{className:`${F} ${P.A.fullscreen}`,role:"status","aria-live":"polite","data-testid":"auth-transition","data-state":t,children:(0,w.jsxs)("div",{className:W,children:[(0,w.jsx)(U.A,{}),(0,w.jsx)("h1",{className:H,children:p.title}),(0,w.jsx)("p",{className:V,children:p.detail}),(0,w.jsx)("div",{className:P.A.track,"aria-hidden":"true",children:(0,w.jsx)("span",{className:P.A.sweep})}),d?(0,w.jsx)("p",{className:Y,"data-testid":"auth-slow-hint",children:"This is taking a little longer than usual. Your sign-in is still being processed."}):null]})})};const ne="edumark_auth_flow_v1",ie="edumark_auth_callback_visits_v1",ae=()=>{try{const e=window.sessionStorage.getItem(ne);if(!e)return null;const t=JSON.parse(e);return"number"===typeof(null===t||void 0===t?void 0:t.startedAt)&&Array.isArray(null===t||void 0===t?void 0:t.stages)?t:null}catch{return null}},re=e=>{try{null===e?window.sessionStorage.removeItem(ne):window.sessionStorage.setItem(ne,JSON.stringify(e))}catch{}},se=e=>{try{"undefined"!==typeof performance&&"function"===typeof performance.mark&&performance.mark(e)}catch{}},oe=(e,t)=>{ae()||!Number.isFinite(t)||t<=0||t>Date.now()+6e4||re({method:e,startedAt:t,stages:[]})},le=e=>{var t;const n=ae(),i=Date.now(),a=null===n||void 0===n?void 0:n.stages[n.stages.length-1];n&&(n.stages.push({stage:e,at:i}),re(n)),se(`auth:${e}`),a&&((e,t,n)=>{try{"undefined"!==typeof performance&&"function"===typeof performance.measure&&performance.measure(e,t,n)}catch{}})(`auth:${a.stage}\u2192${e}`,`auth:${a.stage}`,`auth:${e}`),(0,$.Lp)("auth_stage_reached",{auth_stage:e,auth_method:null!==(t=null===n||void 0===n?void 0:n.method)&&void 0!==t?t:"unknown",stage_elapsed_ms:a?i-a.at:void 0,total_elapsed_ms:n?i-n.startedAt:void 0})},ce=function(e){var t,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=ae(),r=Date.now();if(se(`auth:flow_${e}`),(0,$.Lp)("auth_flow_completed",{auth_method:null!==(t=null===a||void 0===a?void 0:a.method)&&void 0!==t?t:"unknown",auth_outcome:e,total_duration_ms:a?r-a.startedAt:void 0,stage_count:null!==(n=null===a||void 0===a?void 0:a.stages.length)&&void 0!==n?n:0,failure_code:i.failureCode,failure_kind:i.failureKind}),re(null),"success"===e)try{window.sessionStorage.removeItem(ie)}catch{}};var de=n(12229),ue=n(2210),me=n(84322);const pe=(e,t)=>"success"===e.status?(0,de.gW)(e.session,t):null,he=(e,t,n)=>(0,me.d)(e.safe_destination)||(0,me.d)(t)||pe(e,n),ve=e=>{let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t+e.charCodeAt(n)|0;return Math.abs(t).toString(36)},ge="edumark_lms_exchange_done_v1",fe=()=>{try{const e=window.sessionStorage.getItem(ge);return e?JSON.parse(e):null}catch{return null}},_e=["google_login","google_signup","email_password","invitation","handoff"],ye=()=>{const e=(0,v.wA)(),t=(0,S.Zp)(),{search:n}=(0,S.zy)(),a=(0,v.d4)(e=>e.auth.token),[r,s]=(0,i.useState)("processing_provider_callback"),[o,l]=(0,i.useState)(null),[c,d]=(0,i.useState)(null),[u,m]=(0,i.useState)(!1),p=(0,i.useRef)(!1),h=(0,i.useRef)(""),g=(0,i.useRef)(null),f=(0,i.useRef)(Date.now()),_=(0,i.useCallback)(e=>{l(e),d(`AUTH-${e.code.replace(/[^A-Z0-9]/gi,"").slice(0,12).toUpperCase()||"UNKNOWN"}-${Date.now().toString(36).slice(-6).toUpperCase()}`),s("fatal"===e.kind?"fatal_error":"recoverable_error"),m(!1),((e,t)=>{t?(0,$.LO)("auth_flow_error",t,{failure_code:e}):(0,$.Lp)("auth_flow_error",{failure_code:e})})(e.code),ce("failure",{failureCode:e.code,failureKind:e.kind})},[]),y=(0,i.useCallback)(()=>{const n=h.current,i=g.current;l(null),d(null),s("exchanging_credentials"),le("exchanging_credentials"),console.info("exchange_request_started"),(0,L.X)(n).then(a=>{console.info(`exchange_response_status=${a.status}`),s("creating_or_restoring_session"),le("creating_or_restoring_session");const r=((e,t,n)=>(0,me.d)(e.returnUrl)||(0,me.d)(t)||pe(e,n))(a,i,window.location.hostname);if(s("determining_destination"),le("determining_destination"),"success"===a.status)return(0,O.applyLmsSession)(e,a.session),(e=>{try{window.sessionStorage.setItem(ge,JSON.stringify(e))}catch{}})({codeFingerprint:ve(n),destination:r||"/dashboard"}),console.info(`exchange_completed final_destination=${r||"/dashboard"}`),s("redirecting_to_application"),le("redirecting_to_application"),ce("success"),void t(r||"/dashboard",{replace:!0});(0,O.stashOnboarding)({token:a.onboardingToken||"",accountState:a.account_state,prefill:a.prefill,resume:a.resume,memberships:a.memberships,pendingInvitations:a.pending_invitations,missingPersonalFields:a.missing_personal_fields,requiredLegalA
2cceptances:a.required_legal_acceptances,nextAction:a.next_action,returnUrl:r,capabilities:a.capabilities?{acceptInvitation:a.capabilities.accept_invitation,createOrganisation:a.capabilities.create_organisation}:void 0,onboardingTransaction:a.onboarding_transaction?{id:a.onboarding_transaction.id,intent:a.onboarding_transaction.intent,organisationName:a.onboarding_transaction.organisation_name,status:a.onboarding_transaction.status}:null}),console.info("exchange_completed final_destination=/account"),s("redirecting_to_application"),le("redirecting_to_application"),ce("success"),t("/account",{replace:!0})}).catch(e=>{const r=(e=>e instanceof L.b$?null===e.status?(console.error("exchange_error_code=AUTH_LMS_EXCHANGE_UNREACHABLE"),{kind:"recoverable",code:"AUTH_LMS_EXCHANGE_UNREACHABLE",canRetry:!0,message:"We could not finish opening your EduMark account. Check your connection and try again."}):401===e.status?(console.error("exchange_error_code=AUTH_LMS_CODE_INVALID_OR_CONSUMED"),{kind:"recoverable",code:"AUTH_LMS_CODE_INVALID_OR_CONSUMED",canRetry:!1,message:"Your sign-in link has expired or was already used. Sign in again to continue \u2014 your account and organisation are unaffected."}):(console.error(`exchange_error_code=${e.code} status=${e.status}`),{kind:"recoverable",code:e.code,canRetry:!1,message:e.message}):(console.error("exchange_error_code=AUTH_LMS_EXCHANGE_UNEXPECTED"),{kind:"recoverable",code:"AUTH_LMS_EXCHANGE_UNEXPECTED",canRetry:!1,message:"We could not complete your sign-in. Please try again."}))(e);if("AUTH_LMS_CODE_INVALID_OR_CONSUMED"===r.code&&a){const e=fe(),a=e&&e.codeFingerprint===ve(n)?e.destination:i||"/dashboard";return console.info(`exchange_reused_existing_session destination=${a}`),ce("success"),void t(a,{replace:!0})}_(r)})},[e,_,t,a]);(0,i.useEffect)(()=>{var e,i,r,s,o;if(p.current)return;p.current=!0,console.info("callback_loaded");const l=new URLSearchParams(n);h.current=null!==(e=null===(i=l.get("code"))||void 0===i?void 0:i.trim())&&void 0!==e?e:"",g.current=(0,O.sanitizeReturnPath)(l.get("returnUrl")),console.info(`handoff_code_present=${Boolean(h.current)}`);const c=Number.parseInt(null!==(r=l.get("auth_flow_started_at"))&&void 0!==r?r:"",10),d=l.get("auth_method"),u=d&&_e.includes(d)?d:"handoff";if(Number.isFinite(c)?oe(u,c):oe(u,Date.now()),f.current=null!==(s=null===(o=ae())||void 0===o?void 0:o.startedAt)&&void 0!==s?s:Date.now(),le("processing_provider_callback"),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now(),t=[];try{const n=window.sessionStorage.getItem(ie);n&&(t=JSON.parse(n).filter(t=>e-t<12e4))}catch{t=[]}t.push(e);try{window.sessionStorage.setItem(ie,JSON.stringify(t))}catch{}const n=t.length>3;return n&&(0,$.Lp)("auth_redirect_loop_detected",{visit_count:t.length}),n}())return void _({kind:"recoverable",code:"AUTH_REDIRECT_LOOP",canRetry:!1,message:"Sign-in keeps returning to this page without completing. Return to sign-in and try again; if this continues, contact support with the reference below."});if(!h.current){const e=new URL((0,ue.Bj)(window.location.hostname)?`${window.location.origin}/login`:(0,de.F5)("landing-next",window.location.hostname,"/sol/login"));return g.current&&e.searchParams.set("next",g.current),void window.location.replace(e.toString())}const m=fe();if(m&&m.codeFingerprint===ve(h.current)&&a)return console.info(`exchange_marker_hit destination=${m.destination}`),ce("success"),void t(m.destination,{replace:!0});y()},[_,t,y,n,a]),(0,i.useEffect)(()=>{if(null!==o)return;const e=window.setTimeout(()=>{_({kind:"recoverable",code:"AUTH_TIMEOUT",canRetry:!0,message:"Your sign-in is taking too long to complete. Try again, or return to sign-in and start fresh."})},D.hardTimeoutMs);return()=>window.clearTimeout(e)},[_,o]);return(0,w.jsx)(te,{state:r,failure:o,errorReference:c,flowStartedAt:f.current,retrying:u,onRetry:null!==o&&void 0!==o&&o.canRetry?()=>{m(!0),y()}:void 0,onReturnToSignIn:()=>window.location.replace((0,ue.Bj)(window.location.hostname)?`${window.location.origin}/login`:(0,de.F5)("landing-next",window.location.hostname,"/sol/login"))})};var be=n(5158);const we="VLHYo6XT",xe="rqTVjgtA",ke="wxrSxYK_",Ae="r9uO4Y9d",je="t8BlVrpg",Se="i3kHHsMf",Ce="ohkw_gFp",Ie="LoP8X9gM",Ee="ZelaWCbk",Re="wE7IZL6g",$e="KmQWV08j",Ne="BJupX0nn",Te="SnEpOlpp",Le="d6kJDyY2",Oe="prsI3Npo",Me="fzkB6DSY",Ue="Jeyvb4So",Pe="XTWGUPm2",qe="qbdy0t1t",De="drCtGTXx",ze={PENDING_INVITATION:["Your EduMark invitation","Your institution has already chosen your organisation and access. Review the invitation below to continue."],NEW_ORGANISATION_CREATOR:["Create your organisation","Set up an institutional EduMark workspace. You will become its initial administrator."],NEW_INDIVIDUAL_EDUCATOR:["Invitation required","Indiv
2idual staff access is created by an institution, not through public signup."],UNINVITED_LEARNER:["An invitation is required","Learner accounts are created by your institution. Ask your course team for an invitation or sign in using the email address they enrolled."],NO_VALID_MEMBERSHIP:["No LMS access found","You signed in successfully, but this account does not currently have an EduMark LMS membership."],MULTIPLE_AVAILABLE_CONTEXTS:["Choose where to continue","Select one of your authorised EduMark contexts."],EXISTING_PROFILE_INCOMPLETE:["Finish your profile","We only need the genuinely required personal details before you enter EduMark."],EXISTING_COMPLETE_ACCOUNT:["Opening EduMark","Your account is ready."]},Be=()=>{var e,t,n,a,r,s,o,l;const c=(0,v.wA)(),d=(0,S.Zp)(),u=(0,i.useMemo)(()=>(0,O.readOnboardingStash)(),[]),[m,p]=(0,i.useState)(u),[h,g]=(0,i.useState)(null!==(e=null===u||void 0===u?void 0:u.prefill.firstName)&&void 0!==e?e:""),[f,_]=(0,i.useState)(null!==(t=null===u||void 0===u?void 0:u.prefill.lastName)&&void 0!==t?t:""),[y,b]=(0,i.useState)(null!==(n=null!==(a=null===u||void 0===u||null===(r=u.onboardingTransaction)||void 0===r?void 0:r.organisationName)&&void 0!==a?a:null===u||void 0===u?void 0:u.prefill.organisation)&&void 0!==n?n:""),[x,k]=(0,i.useState)(""),[A,j]=(0,i.useState)(!1),[I,E]=(0,i.useState)(null),[R,$]=(0,i.useState)(!1),N=(0,i.useRef)(!0);(0,i.useEffect)(()=>{if(N.current=!0,u)return(0,L._U)(u.token).then(e=>{if(!N.current)return;if("success"===e.status)return(0,O.clearOnboardingStash)(),(0,O.applyLmsSession)(c,e.session),void d(he(e,u.returnUrl,window.location.hostname)||"/dashboard",{replace:!0});const t={token:e.onboardingToken||u.token,accountState:e.account_state,prefill:e.prefill,resume:e.resume,memberships:e.memberships,pendingInvitations:e.pending_invitations,missingPersonalFields:e.missing_personal_fields,requiredLegalAcceptances:e.required_legal_acceptances,nextAction:e.next_action,returnUrl:u.returnUrl,capabilities:e.capabilities?{acceptInvitation:e.capabilities.accept_invitation,createOrganisation:e.capabilities.create_organisation}:u.capabilities,onboardingTransaction:e.onboarding_transaction?{id:e.onboarding_transaction.id,intent:e.onboarding_transaction.intent,organisationName:e.onboarding_transaction.organisation_name,status:e.onboarding_transaction.status}:u.onboardingTransaction};(0,O.stashOnboarding)(t),p(t)}).catch(e=>{N.current&&E(e instanceof Error?e.message:"We could not refresh your account state.")}),()=>{N.current=!1};d("/login",{replace:!0})},[c,u,d]);const T=(0,i.useCallback)(async e=>{if(e.preventDefault(),m){$(!0),E(null);try{const e=await(0,L.N5)(m.token,{firstName:h,lastName:f,termsAccepted:A});if("success"!==e.status)throw new Error("Your account still needs attention.");if(!N.current)return;(0,O.clearOnboardingStash)(),(0,O.applyLmsSession)(c,e.session),d(he(e,m.returnUrl,window.location.hostname)||"/dashboard",{replace:!0})}catch(t){N.current&&E(t instanceof L.b$||t instanceof Error?t.message:"We could not update your profile.")}finally{N.current&&$(!1)}}},[c,h,f,d,m,A]),U=(0,i.useCallback)(async e=>{if(e.preventDefault(),m){$(!0),E(null);try{const e=await(0,L.aK)(m.token,{organisationName:y,country:x||void 0,firstName:h||void 0,lastName:f||void 0,termsAccepted:A});if("success"!==e.status)throw new Error("Your organisation could not be created.");if(!N.current)return;(0,O.clearOnboardingStash)(),(0,O.applyLmsSession)(c,e.session),d(he(e,m.returnUrl,window.location.hostname)||"/dashboard",{replace:!0})}catch(t){N.current&&(t instanceof L.b$&&"PENDING_INVITATION_EXISTS"===t.code?E("An invitation is waiting for this email address. Open the link in your invitation email instead of creating a new organisation."):t instanceof L.b$&&"EXISTING_MEMBERSHIP"===t.code?E("This account already belongs to an organisation. Sign in again to enter your existing workspace."):E(t instanceof L.b$||t instanceof Error?t.message:"We could not create your organisation."))}finally{N.current&&$(!1)}}},[x,c,h,f,d,y,m,A]);if(!m)return null;const[P,q]=ze[m.accountState],D=Boolean(null===(s=m.capabilities)||void 0===s?void 0:s.createOrganisation)&&["NO_VALID_MEMBERSHIP","NEW_ORGANISATION_CREATOR","NEW_INDIVIDUAL_EDUCATOR"].includes(m.accountState)&&0===m.pendingInvitations.length,z=!m.prefill.firstName||!m.prefill.lastName,B=(0,de.F5)("landing-next",window.location.hostname,"/sol/login"),F=(0,de.F5)("landing-next",window.location.hostname,"/sol/signup"),W=(0,de.F5)("landing-next",window.location.hostname,"/sol/onboarding/organisation"),H=(0,de.F5)("landing-next",window.location.hostname,"/contact"),V=new URL((0,de.F5)("landing-next",window.location.hostname,"/logout"));return V.searchParams.set("next","/sol/login"),(0,w.jsx)("main",{className:we,children:(0,w.jsxs)("section",{className:`${xe} ${ke}`,"aria-labelledby":"account-title",children:[(0,w.jsx)("header",{className:Ae,children:(0,w.jsx)("img",{src:M.A.BRAND_FULL_LOGO,alt:"EduMark",className:je})}),(0,w.jsx)("h1",{id:"account-title",className:Ne,children:P}),(0,w.jsx)("p",{className:Te,children:q}),(0,w.jsxs)("p",{className:Se,children:["Signed in as ",(0,w.jsx)("strong",{children:m.prefill.email})]}),I&&(0,w.jsx)("p",{className:Oe,role:"alert",children:I}),"EXISTING_PROFILE_INCOMPLETE"===m.accountState&&(0,w.jsxs)("form",{"data-validation-scope":!0,onSubmit:T,noValidate:!0,children:[m.missingPersonalFields.includes("first_name")&&(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"first-name",children:"First name"}),(0,w.jsx)("input",{id:"first-name",className:qe,autoComplete:"given-name",value:h,onChange:e=>g(e.target.value),required:!0})]}),m.missingPersonalFields.includes("last_name")&&(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"last-name",children:"Last name"}),(0,w.jsx)("input",{id:"last-name",className:qe,autoComplete:"family-name",value:f,onChange:e=>_(e.target.value),required:!0})]}
2),m.requiredLegalAcceptances.length>0&&(0,w.jsxs)("label",{className:De,children:[(0,w.jsx)("input",{type:"checkbox",checked:A,onChange:e=>j(e.target.checked),required:!0}),(0,w.jsxs)("span",{children:["I agree to the EduMark ",(0,w.jsx)(C.N_,{className:Le,to:"/terms",target:"_blank",children:"Terms"})," and ",(0,w.jsx)(C.N_,{className:Le,to:"/privacy",target:"_blank",children:"Privacy Policy"}),"."]})]}),(0,w.jsx)("button",{className:Ie,"data-validation-submit":!0,disabled:R,children:R?"Saving\u2026":"Save and enter EduMark"})]}),"PENDING_INVITATION"===m.accountState&&(0,w.jsxs)(w.Fragment,{children:[m.pendingInvitations.map(e=>(0,w.jsxs)("div",{className:Ce,children:[(0,w.jsx)("strong",{children:e.organisation}),(0,w.jsx)("span",{children:e.role?`Access: ${e.role}`:"Institutional access"}),(0,w.jsx)("span",{children:"Open the unique link in your invitation email to approve this access."})]},e.id||e.orgId)),(0,w.jsxs)("div",{className:Ee,children:[(0,w.jsx)("p",{className:Me,children:"For security, open the unique link in your invitation email to approve this access."}),(0,w.jsx)("a",{className:$e,href:B,children:"Try another account"}),(0,w.jsx)("a",{className:$e,href:H,children:"Contact support"})]})]}),"MULTIPLE_AVAILABLE_CONTEXTS"===m.accountState&&m.memberships.map(e=>{const t=(0,be.f)(e);return(0,w.jsxs)("div",{className:Ce,children:[(0,w.jsx)("strong",{children:e.organisation}),(0,w.jsxs)("span",{children:[e.centre||"Organisation-wide"," \xb7 ",e.role||e.lmsRole||"Member"]}),t?(0,w.jsx)("a",{className:Re,href:(0,be.C)(window.location.hostname,e,m.returnUrl),children:"Continue in this context"}):(0,w.jsx)("a",{className:$e,href:B,children:"Choose from secure sign in"})]},t||e.organisation)}),D&&(0,w.jsxs)("form",{"data-validation-scope":!0,onSubmit:U,noValidate:!0,children:[(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"organisation-name",children:"Organisation name"}),(0,w.jsx)("input",{id:"organisation-name",className:qe,autoComplete:"organization",value:y,onChange:e=>b(e.target.value),required:!0,minLength:2,maxLength:150})]}),z&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"owner-first-name",children:"First name"}),(0,w.jsx)("input",{id:"owner-first-name",className:qe,autoComplete:"given-name",value:h,onChange:e=>g(e.target.value),required:!0})]}),(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"owner-last-name",children:"Last name"}),(0,w.jsx)("input",{id:"owner-last-name",className:qe,autoComplete:"family-name",value:f,onChange:e=>_(e.target.value),required:!0})]})]}),(0,w.jsxs)("div",{className:Ue,children:[(0,w.jsx)("label",{className:Pe,htmlFor:"organisation-country",children:"Country or region (optional)"}),(0,w.jsx)("input",{id:"organisation-country",className:qe,autoComplete:"country-name",value:x,onChange:e=>k(e.target.value),maxLength:100})]}),(0,w.jsxs)("label",{className:De,children:[(0,w.jsx)("input",{type:"checkbox",checked:A,onChange:e=>j(e.target.checked),required:!0}),(0,w.jsxs)("span",{children:["I agree to the EduMark ",(0,w.jsx)(C.N_,{className:Le,to:"/terms",target:"_blank",children:"Terms"})," and ",(0,w.jsx)(C.N_,{className:Le,to:"/privacy",target:"_blank",children:"Privacy Policy"}),"."]})]}),(0,w.jsx)("button",{className:Ie,"data-validation-submit":!0,disabled:R,children:R?"Creating your organisation\u2026":"Create organisation and continue"}),(0,w.jsx)("p",{className:Me,children:"You will become this organisation\u2019s owner and can invite staff and learners next."})]}),["NO_VALID_MEMBERSHIP","UNINVITED_LEARNER","NEW_INDIVIDUAL_EDUCATOR"].includes(m.accountState)&&(0,w.jsxs)("div",{className:Ee,children:[(0,w.jsx)("p",{className:Me,children:"Invitation links contain a secure one-time token, so they can only be opened from the invitation email. If the link has expired, ask your institution administrator to resend it."}),!D&&(null===(o=m.capabilities)||void 0===o?void 0:o.createOrganisation)&&(0,w.jsx)("a",{className:Re,href:F,children:"Create your centre"}),(0,w.jsx)("a",{className:$e,href:B,children:"Try another account"}),(0,w.jsx)("a",{className:$e,href:V.toString(),children:"Sign out"}),(0,w.jsx)("a",{className:$e,href:H,children:"Contact support"})]}),"NEW_ORGANISATION_CREATOR"===m.accountState&&!D&&(0,w.jsxs)("div",{className:Ee,children:[(0,w.jsxs)("p",{className:Me,children:["Continue setting up ",(0,w.jsx)("strong",{children:(null===(l=m.onboardingTransaction)||void 0===l?void 0:l.organisationName)||m.prefill.organisation}),". No organisation has been created yet."]}),(0,w.jsx)("a",{className:Re,href:W,children:"Continue centre setup"})]})]})})};var Fe=n(81020),We=n(73141);const He=e=>{var t,n;let{path:a="/sol/login",returnToCurrentPath:r=!0}=e;const s=(0,S.zy)(),{token:o,passwordProfileUpdateState:l}=(0,v.d4)(e=>e.auth),c=new URLSearchParams(s.search),d=null!==(t=(0,We.A)(c.get("reason")))&&void 0!==t?t:(0,O.readLmsSessionRecoveryReason)(),u=(0,me.d)(null!==(n=c.get("returnUrl"))&&void 0!==n?n:c.get("next")),m=u&&!/^\/(?:login|signup|logout|sol|auth)(?:\/|$)/.test(u.split("?")[0])?u:null,p=(0,i.useMemo)(()=>
2{if("/sol/login"===a&&"signed_out"===d){const e=new URL((0,de.F5)("landing-next",window.location.hostname,"/logout"));return e.searchParams.set("next",We.s),e.toString()}const e=new URL((0,de.F5)("landing-next",window.location.hostname,a));if("/sol/login"===a&&(e.searchParams.set("app_session","checked"),d&&e.searchParams.set("reason",d),m&&e.searchParams.set("next",m)),"/sol/reset-password"===a){const t=new URLSearchParams(s.search);for(const n of["token","type"]){const i=t.get(n);i&&e.searchParams.set(n,i)}}const t=(0,me.d)(`${s.pathname}${s.search}`);return r&&t&&!t.startsWith("/login")&&!e.searchParams.has("next")&&e.searchParams.set("next",t),e.toString()},[s.pathname,s.search,a,d,m,r]);return"/sol/login"===a&&"signed_out"!==d&&o&&"done"===l?(0,w.jsx)(S.C5,{to:null!==m&&void 0!==m?m:"/dashboard",replace:!0}):(0,w.jsx)(Fe.A,{targetUrl:p})};var Ve=n(83314);const Ye=e=>{let{label:t,sublabel:n}=e;return(0,w.jsx)(Ve.A,{variant:"fullscreen",label:t,sublabel:n})};var Ge=n(18088),Je=n(87140);const Ke={minHeight:"100vh",display:"grid",placeItems:"center",padding:"2rem"},Xe=async(e,t,n)=>{if((0,Je.sG)(),"no_membership"!==n)try{await(0,O.hydrateStoredLmsSession)(e,t)}catch{}else(0,O.rejectLmsSession)(e,t,"workspace_access_changed")},Ze=e=>{let{children:t}=e;const n=(0,v.d4)(e=>e.auth.token),a=(0,v.wA)(),[r,s]=(0,i.useState)("loading"),[o,l]=(0,i.useState)(0),[c,d]=(0,i.useState)(Je.Du),u=(0,i.useRef)(0),m=(0,i.useRef)(null),p=(0,Ge.cW)("ready"===r);return(0,i.useEffect)(()=>{const e=()=>{(0,Je.sG)(),l(e=>e+1)};return window.addEventListener(Je.Lu,e),()=>window.removeEventListener(Je.Lu,e)},[]),(0,i.useEffect)(()=>{if(!n)return;let e=!1;return s("loading"),(0,Je.D2)(n).then(async t=>{if(!e)return"ready"===t.status||"unavailable"===t.status&&m.current!==n?("ready"===t.status&&(m.current=null),d("ready"===t.status?t.context:null),void s("ready")):"no_membership"===t.status||"unauthenticated"===t.status?(m.current=n,await Xe(a,n,t.status),void(e||s("error"))):void s("error")}),()=>{e=!0}},[a,n,o]),(0,i.useEffect)(()=>{if(!n||"ready"!==r)return;const e=++u.current;let t=!1,i=0;const o=()=>{"hidden"===document.visibilityState||t||Date.now()-i<1e3||(t=!0,i=Date.now(),(0,Je.D2)(n,{refresh:!0}).then(t=>{e===u.current&&("ready"===t.status?(d(t.context),window.dispatchEvent(new Event(Je.eW))):"no_membership"!==t.status&&"unauthenticated"!==t.status||(m.current=n,s("error"),Xe(a,n,t.status)))}).finally(()=>{t=!1}))};return window.addEventListener("focus",o),document.addEventListener("visibilitychange",o),()=>{u.current+=1,window.removeEventListener("focus",o),document.removeEventListener("visibilitychange",o)}},[a,r,n,o]),n?"error"===r?(0,w.jsx)("main",{style:Ke,children:(0,w.jsxs)("section",{role:"alert",style:{width:"100%",maxWidth:480,borderRadius:"var(--radius-lg)",border:"1px solid var(--border-default)",background:"var(--surface-primary)",color:"var(--text-primary)",boxShadow:"var(--shadow-md)",padding:"2rem"},children:[(0,w.jsx)("h1",{style:{marginTop:0,marginBottom:"0.75rem",fontSize:"1.25rem"},children:"We couldn\u2019t load your account"}),(0,w.jsx)("p",{style:{marginTop:0,marginBottom:"1.5rem",lineHeight:1.5,color:"var(--text-secondary)"},children:"Your sign-in is still saved, but the organisation details didn\u2019t load. Check your connection and try again."}),(0,w.jsx)("button",{type:"button",onClick:()=>l(e=>e+1),style:{borderRadius:"var(--radius-md)",border:"1px solid var(--border-default)",background:"var(--action-primary-background)",color:"var(--action-primary-text)",padding:"0.6rem 1.2rem",cursor:"pointer"},children:"Retry"})]})}):"ready"===r&&p?(0,w.jsx)(Je.uz,{value:c,children:t}):(0,w.jsx)(Ye,{label:"Loading your workspace",sublabel:"Fetching your organisation, courses and permissions."}):t},Qe=e=>{let{children:t}=e;const{token:n,passwordProfileUpdateState:a}=(0,v.d4)(e=>e.auth),r=(0,v.wA)(),{pathname:s,search:o}=(0,S.zy)(),[l,c]=(0,i.useState)(null),[d,u]=(0,i.useState)(null),[m,p]=(0,i.useState)(0),h=Boolean(n&&"done"===a),g=(0,Ge.cW)(l===n);return(0,i.useEffect)(()=>{if(u(null),c(null),!n)return;let e=!1;return(0,O.hydrateStoredLmsSession)(r,n).then(t=>{e||("hydrated"===t.status||"legacy_compatibility"===t.status?c(n):"superseded"===t.status&&u("superseded"))}).catch(()=>{e||u(localStorage.getItem(O.LMS_SESSION_TOKEN_KEY)===n?"temporary":"superseded")}),()=>{e=!0}},[r,n,m]),h?d?(0,w.jsx)("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:"2rem"},children:(0,w.jsxs)("section",{role:"alert",style:{width:"100%",maxWidth:480,borderRadius:"var(--radius-lg)",border:"1px solid var(--border-default)",background:"var(--surface-primary)",color:"var(--text-primary)",padding:"2rem"},children:[(0,w.jsx)("h1",{style:{marginTop:0},children:"superseded"===d?"Your sign-in changed":"We couldn\u2019t verify your sign-in"}),(0,w.jsx)("p",{children:"superseded"===d?"Another tab changed your session. Reload to continue with your current sign-in.":"Your session is still saved. Check your connection and try again."}),(0,w.jsx)("button",{type:"button",onClick:()=>{localStorage.getItem(O.LMS_SESSION_TOKEN_KEY)!==n?window.location.reload():p(e=>e+1)},style:{border:0,borderRadius:"var(--radius-md)",background:"var(--action-primary-background)",color:"var(--action-primary-text)",padding:"0.75rem 1.25rem",cursor:"pointer"},children:"superseded"===d?"Reload session":"Retry"})]})}):l===n&&g?t:(0,w.jsx)(Ye,{label:"Restoring your session",sublabel:"Confirming your sign-in with EduMark."}):(0,w.jsx)(S.C5,{to:(0,O.buildLoginPath)(`${s}${o}`),replace:!0})};var et=n(51571),tt=n(66772),nt=n(821);const it=()=>{const e=(0,v.wA)(),t=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let n=!0;return t.current||(t.current=(0,O.endLmsSession)(e).catch(()=>{})),t.current.then(()=>
2{if(!n)return;if((0,ue.Bj)(window.location.hostname))return void window.location.replace("/login?reason=signed_out");const e=new URL((0,de.F5)("landing-next",window.location.hostname,"/logout"));e.searchParams.set("next",We.s),window.location.replace(e.toString())}),()=>{n=!1}},[e]),(0,w.jsx)(Ve.A,{variant:"fullscreen",label:"Signing you out",sublabel:"Closing your secure EduMark session.",showInsights:!1,immediate:!0})};n(7718);var at=n(97900),rt=n(18537),st=n(37413),ot=n(91386),lt=n(2822),ct=n(70092),dt=n(39215),ut=n(80487),mt=n(4746),pt=n(70884);function ht(){var e,t,n;const a=(0,S.zy)(),{user:r}=(0,v.d4)(e=>e.auth),s=(0,Je.Ok)(),o=String(null!==(e=null===r||void 0===r?void 0:r.id)&&void 0!==e?e:""),l=`${o}:${(null===s||void 0===s?void 0:s.id)||""}:${(0,rt.yk)()||""}:${(null===s||void 0===s?void 0:s.permissions.join(","))||""}`,c=(0,i.useMemo)(()=>(0,ct.Uf)(a.pathname,a.search),[a.pathname,a.search]),d=null===c||void 0===c?void 0:c.kind,[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(!1),[f,_]=(0,i.useState)(null),[y,b]=(0,i.useState)(""),[x,k]=(0,i.useState)(""),[A,j]=(0,i.useState)("shortcut"),[C,I]=(0,i.useState)(null),[E,R]=(0,i.useState)(!1),[$,N]=(0,i.useState)(!1),T=(0,i.useRef)(null);(0,i.useEffect)(()=>{var e;if(h(!1),_(null),N(!1),I(null),R(!1),k(""),null===(e=T.current)||void 0===e||e.abort(),!d)return;const t=new AbortController;return(0,lt.zd)(t.signal).then(e=>{t.signal.aborted||m({key:l,value:e})}).catch(()=>{t.signal.aborted||m(null)}),()=>t.abort()},[l,d,a.pathname]),(0,i.useEffect)(()=>()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.abort()},[]);const L=(null===u||void 0===u?void 0:u.key)===l?u.value:null;if(!(c&&(null===L||void 0===L||null===(t=L.shortcuts)||void 0===t?void 0:t.includes(c.kind)))||!c||!L)return null;let O=ct.Bj[c.kind];"courses"!==c.kind||L.widgets.some(e=>e.id===O)||(O="learning.courses"),"assignments"===c.kind&&L.widgets.some(e=>"authoring.assignments"===e.id)&&(O="authoring.assignments");const M=L.widgets.find(e=>e.id===O),U=Boolean(M&&Object.keys(c.params).every(e=>{var t;return(null===(t=M.configFields)||void 0===t?void 0:t.includes(e))||"view"===e&&["feedback","commitments"].includes(String(c.params[e]))})),P=null!==(n=null===f||void 0===f?void 0:f.document)&&void 0!==n?n:f?(0,ut.wM)(L,f.scope.key):null,q=async()=>{var e;null===(e=T.current)||void 0===e||e.abort();const t=new AbortController;T.current=t,I(null);try{const e=await(0,dt.eg)(t.signal);t.signal.aborted||(_(e),k(t=>{var n,i;return null!==(n=e.document)&&void 0!==n&&n.views.some(e=>e.id===t)?t:(null===(i=e.document)||void 0===i?void 0:i.defaultViewId)||"all-work"}),R(!1))}catch(n){t.signal.aborted||I((0,dt.JD)(n).message)}};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ot.A,{title:"Pin to home",placement:"bottom",arrow:!0,enterDelay:250,children:(0,w.jsx)("button",{type:"button",className:pt.A.pinButton,"aria-label":"Pin to home","aria-haspopup":"dialog",onClick:()=>{b(vt()),j("shortcut"),h(!0),q()},children:(0,w.jsx)(at.A,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})}),p&&(0,w.jsx)(st.A,{label:"Pin to home",onDismiss:()=>{$||h(!1)},size:"compact",children:(0,w.jsxs)("div",{className:pt.A.editor,children:[(0,w.jsx)("h2",{children:"Pin to home"}),(0,w.jsx)("p",{children:"This shortcut opens the saved page and filters. It never repeats an action."}),C&&(0,w.jsx)("p",{role:"alert",children:C}),P?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("label",{children:["Name",(0,w.jsx)("input",{value:y,maxLength:100,onChange:e=>b(e.target.value)})]}),(0,w.jsxs)("label",{children:["Personal view",(0,w.jsx)("select",{"aria-label":"Personal view",value:x,onChange:e=>k(e.target.value),children:P.views.map(e=>(0,w.jsx)("option",{value:e.id,children:e.name},e.id))})]}),U&&(0,w.jsxs)("label",{children:["Add as",(0,w.jsxs)("select",{"aria-label":"Add as",value:A,onChange:e=>j(e.target.value),children:[(0,w.jsx)("option",{value:"shortcut",children:"Shortcut"}),(0,w.jsx)("option",{value:"information",children:"Live information card"})]})]}),(0,w.jsx)("p",{children:(0,ut.hA)(c.params)})]}):(0,w.jsx)("button",{className:pt.A.button,onClick:()=>{q()},children:"Load Home views"}),E&&(0,w.jsx)("button",{className:pt.A.button,onClick:()=>{q()},children:"Review latest Home before pinning"}),(0,w.jsxs)("div",{className:pt.A.inline,children:[(0,w.jsx)("button",{className:pt.A.button,disabled:$,onClick:()=>h(!1),children:"Cancel"}),(0,w.jsx)("button",{className:pt.A.primary,disabled:!P||!y.trim()||$||E,onClick:()=>{(async()=>{var e,t;if(!P||!f||$||E)return;const n=P.views.find(e=>e.id===x);if(!n)return;if("shortcut"===A&&n.shortcuts.length>=24||"information"===A&&n.instances.length>=24)return void I("This view is full. Choose another view or remove an item in Customise home.");const i="information"===A&&M?{...n,instances:[...n.instances,{instanceId:(0,ut.hb)("card"),typeId:M.id,title:y.trim(),config:{...M.defaultConfig,...(0,ct.DV)(c,M.configFields||[])},pos:n.instances.length,size:(null===(e=mt.Fs.get(M.id))||void 0===e?void 0:e.defaultSize)||"medium"}]}:{...n,shortcuts:[...n.shortcuts,{id:(0,ut.hb)("pin"),title:y.trim(),destination:c}]};null===(t=T.current)||void 0===t||t.abort();const a=new AbortController;T.current=a,N(!0),I(null);try{await(0,dt.Lg)(o,{...P,views:P.views.map(e=>e.id===n.id?i:e)},f.revision,a.signal),a.signal.aborted||(h(!1),g.oR.success(`Pinned to ${n.name}.`))}catch(r){if(!a.signal.aborted){const e=(0,dt.JD)(r);I(e.message),R(Boolean(e.conflict))}}finally{a.signal.aborted||N(!1)}})()},children:$?"Saving\u2026":"Pin to home"})]})]})})]})}function vt(){var e,t;return(null===(e=document.querySelector("h1"))||void 0===e||null===(t=e.textContent)||void 0===t?void 0:t.trim().slice(0,100))||"Saved page"}
2var gt=n(86954),ft=n(79654),_t=n(81655),yt=n(23961),bt=n(48875),wt=n(83210),xt=n(92355),kt=n(39055),At=n(66033),jt=n(92021),St=n(70889),Ct=n(78769),It=n(86661),Et=n(3099),Rt=n(22458),$t=n(15087),Nt=n(83243);function Tt(e){return/^\/(dashboard|analytics)(\/|$)/.test(e)?"dashboard":/^\/calendar(\/|$)/.test(e)?"calendar":/^\/assignments\/(new|[^/]+\/(edit|builder|preview|attempt))(\/|$)/.test(e)||/^\/courses\/(new|[^/]+\/studio)(\/|$)/.test(e)||/^\/marking\/cases\//.test(e)?"editor":/^\/(courses|practice|study|community)(\/|$)/.test(e)?"cards":/^\/(settings|organisation|integrations|support|aurora|attend)(\/|$)/.test(e)||/^\/communications\/(inbox|conversations|live\/[^/]+)(\/|$)/.test(e)||/^\/assignments\/[^/]+/.test(e)?"detail":"table"}function Lt(){const{pathname:e}=(0,S.zy)();return(0,w.jsx)(Nt.A,{layout:Tt(e)})}var Ot=n(46011),Mt=n(80687);const Ut="xUR8IOLh",Pt="YWlbf5x0",qt=e=>"string"===typeof e&&/^[a-f0-9]{7,64}$/i.test(e);function Dt(e){let{revision:t="9e1db5af8910c544610941b7e039980bae8a77c5",onRefresh:n=()=>window.location.reload()}=e;const a=(0,I.Jq)(),[r,s]=(0,i.useState)(null),[o,l]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!qt(t))return;let e=!0,n=!1,i=null;const a=async()=>{if(!n&&"hidden"!==document.visibilityState){n=!0,i=new AbortController;try{var a;const n=await fetch("/healthz",{cache:"no-store",credentials:"omit",signal:i.signal});if(!n.ok)return;const r=await n.json(),o=null!==(a=r.client_revision)&&void 0!==a?a:r.revision;if(e&&"ok"===r.status&&qt(o)){const e=t.toLowerCase(),n=o.toLowerCase();s(n.startsWith(e)||e.startsWith(n)?null:n)}}catch{}finally{n=!1}}};a();const r=window.setInterval(()=>{a()},3e5),o=()=>{"visible"===document.visibilityState&&a()};return document.addEventListener("visibilitychange",o),()=>{var t;e=!1,null===(t=i)||void 0===t||t.abort(),window.clearInterval(r),document.removeEventListener("visibilitychange",o)}},[t]),r&&r!==o?(0,w.jsxs)("aside",{className:Ut,"aria-label":"Application update",children:[(0,w.jsx)(Ot.A,{size:17,"aria-hidden":"true"}),(0,w.jsxs)("p",{role:"status",children:[(0,w.jsx)("strong",{children:"An EduMark update is ready."})," ",a?"Save your changes before refreshing.":"Refresh when you are ready to use the latest version."]}),(0,w.jsx)("button",{type:"button",disabled:a,onClick:()=>{a||n()},children:"Refresh"}),(0,w.jsx)("button",{type:"button",className:Pt,"aria-label":"Dismiss update notice",onClick:()=>l(r),children:(0,w.jsx)(Mt.A,{size:16,"aria-hidden":"true"})})]}):null}var zt=n(57130);const Bt=[];function Ft(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=null,a=null;const r=()=>(a||(a=e().then(e=>(n=e.default,e),e=>{throw a=null,e})),a);t.length&&Bt.push({paths:t,load:r});const s=i.lazy(r),o=e=>{const[t]=(0,i.useState)(()=>n);return t?(0,w.jsx)(t,{...e}):(0,w.jsx)(s,{...e})};return o.displayName="LazyRoute",o}function Wt(e){(()=>{var e;const t=navigator.connection;return Boolean(null===t||void 0===t?void 0:t.saveData)||/(^|-)2g$/.test(String(null!==(e=null===t||void 0===t?void 0:t.effectiveType)&&void 0!==e?e:""))})()||document.hidden||Bt.forEach(t=>{let{paths:n,load:i}=t;n.some(t=>(0,zt.B6)({path:t,end:!0},e))&&i().catch(()=>{})})}const Ht=e=>/^\/assignments\/[^/]+\/attempt\/[^/]+(?:\/|$)/.test(e),Vt=[/^\/settings(?=\/|$)/,/^\/community(?=\/|$)/,/^\/communications(?=\/|$)/,/^\/people(?=\/|$)/,/^\/quality(?=\/|$)/,/^\/migration(?=\/|$)/,/^\/courses\/new(?=\/|$)/,/^\/courses\/(?!new(?:\/|$)|imports(?:\/|$))[^/]+(?=\/studio(?:\/|$)|\/?$)/];function Yt(e){for(const t of Vt){const n=t.exec(e);if(n)return n[0]}return e.replace(/\/+$/,"")||"/"}const Gt=/^\/(?:login|signup|logout|account|onboarding|auth|terms|privacy|cookies|moderation-review)(?:\/|$)/,Jt=e=>Ht(e)?"focused":Gt.test(e)||"/"===e?"public":"app";var Kt=n(40260),Xt=n(65345);const Zt=(0,Xt.A)("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),Qt=(0,Xt.A)("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);var en=n(7242),tn=n(83572),nn=n(5487);const an=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return`${"https://systems.aries.edumark.ai".replace(/\/+$/,"")}/api/migration/welcome${e}`},rn=e=>{var t;const n=null!==(t=null===e||void 0===e?void 0:e.data)&&void 0!==t?t:e;if(!n||"boolean"!==typeof n.eligible||"boolean"!==typeof n.acknowledged||n.eligible&&("string"!==typeof n.receipt_id||!n.receipt_id||!["learner","educator","supervisor"].includes(n.role)))throw new Error("Welcome guide unavailable");return n},sn=(e,t)=>({headers:{Authorization:`Bearer ${e}`},timeout:1e4,signal:t});var on=n(50573),ln=n(77903);function cn(e){let{token:t,organisationName:n,onPriorityChange:a}=e;const[r,s]=(0,i.useState)(null),[o,l]=(0,i.useState)(!0),[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(!1),p=(0,S.zy)(),h=(0,S.Zp)(),v=(0,i.useRef)(!0);(0,i.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]),(0,i.useEffect)(()=>{const e=new AbortController;let n=!1,i=!1;const a=async()=>
2{if(!n&&!i){i=!0;try{const i=await async function(e,t){return rn(await nn.default.get(an(),sn(e,t)))}(t,e.signal);e.signal.aborted||(n=!0,s(i))}catch{}finally{i=!1,e.signal.aborted||l(!1)}}};return a(),window.addEventListener("online",a),window.addEventListener("focus",a),()=>{e.abort(),window.removeEventListener("online",a),window.removeEventListener("focus",a)}},[t]),(0,i.useEffect)(()=>{const e=new URLSearchParams(p.search);"1"===e.get("migrationTour")&&(m(!0),d(!1),e.delete("migrationTour"),h({pathname:p.pathname,search:e.toString(),hash:p.hash},{replace:!0}))},[p.hash,p.pathname,p.search,h]);const g=(0,i.useCallback)(async e=>{if(null===r||void 0===r||!r.receipt_id)throw new Error("Welcome unavailable");const n=await async function(e,t,n){return rn(await nn.default.post(an("/acknowledge"),{receipt_id:t,action:n},sn(e)))}(t,r.receipt_id,e);if(!n.eligible||n.receipt_id!==r.receipt_id||!n.acknowledged)throw new Error("Welcome not saved");v.current&&s(n)},[t,null===r||void 0===r?void 0:r.receipt_id]),f="1"===new URLSearchParams(p.search).get("navigationTour"),_=Boolean((null===r||void 0===r?void 0:r.eligible)&&!c&&(!r.acknowledged||u)&&!Ht(p.pathname));return(0,i.useEffect)(()=>{a(o||_||Boolean(null===r||void 0===r?void 0:r.eligible)&&!f)},[o,f,a,_,null===r||void 0===r?void 0:r.eligible]),(0,w.jsx)(w.Fragment,{children:_&&(null===r||void 0===r?void 0:r.role)&&(0,w.jsx)(on.A,{role:r.role,organisationName:n,onAcknowledge:g,onClose:()=>{d(!0),m(!1)}})})}function dn(e){let{children:t}=e;const{token:n,user:a}=(0,v.d4)(e=>e.auth),r=(0,Je.Ok)(),s=n&&null!==a&&void 0!==a&&a.id&&null!==r&&void 0!==r&&r.id?`${n}:${a.id}:${r.id}`:null,[o,l]=(0,i.useState)(null),c=(0,i.useCallback)(e=>l({scope:s,value:e}),[s]);return(0,w.jsxs)(ln.I.Provider,{value:Boolean(s)&&((null===o||void 0===o?void 0:o.scope)!==s||o.value),children:[t,s&&n&&(0,w.jsx)(cn,{token:n,organisationName:null===r||void 0===r?void 0:r.name,onPriorityChange:c},s)]})}var un=n(49873),mn=n(71321),pn=n(37486),hn=n(39653),vn=n(72436),gn=n(92525),fn=n(28887),_n=n(73559),yn=n(76884);const bn=(0,Xt.A)("bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);var wn=n(35074),xn=n(32892);const kn=wn.Ay.div` 3 width: 30px; 4 height: 30px; 5 flex-shrink: 0; 6 display: grid; 7 place-items: center; 8 color: inherit; 9 position: relative; 10 11 svg { 12 opacity: 0.85; /* allow-opacity: icon weight tuning, label text stays full-contrast */ 13 } 14`,An=wn.Ay.span` 15 white-space: nowrap; 16 overflow: hidden; 17 min-width: 0; 18 flex: 1 1 auto; 19 transition: opacity var(--motion-fast) var(--ease-standard); 20 opacity: ${e=>{let{$collapsed:t}=e;return t?0:1}}; 21 ${e=>{let{$collapsed:t}=e;return t?wn.AH` 22 width: 0; 23 flex: 0 0 0; 24 `:""}} 25`,jn=wn.Ay.aside` 26 --sidebar-collapsed-width: 4.5rem; 27 28 display: flex; 29 flex-direction: column; 30 width: ${e=>{let{$collapsed:t}=e;return t?"var(--sidebar-collapsed-width)":"var(--layout-sidebar-width)"}}; 31 height: 100vh; 32 height: 100dvh; 33 min-height: 0; 34 overflow: hidden; 35 background: var(--surface-sidebar); 36 border-right: 1px solid var(--sidebar-divider); 37 backdrop-filter: var(--shell-glass-blur, blur(18px)); 38 -webkit-backdrop-filter: var(--shell-glass-blur, blur(18px)); 39 padding: var(--space-6) 0; 40 gap: ${16}px; 41 transition: width var(--motion-base) var(--ease-standard); 42 43 /* The JS media query already swaps to the mobile drawer below 769px; 44 this rule is the no-JS/first-paint guard. */ 45 @media (max-width: 768px) { 46 display: none; 47 } 48 49 @media (min-width: 769px) and (max-width: 1024px) { 50 width: ${e=>{let{$collapsed:t}=e;return t?"var(--sidebar-collapsed-width)":"220px"}}; 51 } 52 53 @media (prefers-reduced-motion: reduce) { 54 html:not([data-motion]) & { transition: none; } 55 } 56`,Sn=wn.Ay.div` 57 padding: 0 ${e=>{let{$collapsed:t}=e;return t?8:24}}px; 58 display: flex; 59 align-items: center; 60 justify-content: ${e=>{let{$collapsed:t}=e;return t?"center":"space-between"}}; 61 gap: ${8}px; 62 63 @media (max-width: 768px) { 64 padding-top: var(--space-4); 65 } 66`,Cn=wn.Ay.button` 67 border: none; 68 background: transparent; 69 padding: 0; 70 cursor: pointer; 71 display: grid; 72 isolation: isolate; 73 width: ${e=>{let{$collapsed:t}=e;return t?"40px":"clamp(100px, 12vw, 140px)"}}; 74 border-radius: var(--radius-sm); 75 76 img { 77 grid-area: 1 / 1; 78 width: 100%; 79 height: auto; 80 background: transparent; 81 } 82 83 @media (max-width: 768px) { 84 width: 120px; 85 } 86`,In=wn.Ay.button` 87 flex-shrink: 0; 88 width: 32px; 89 height: 32px; 90 display: grid; 91 place-items: center; 92 border: none; 93 background: transparent; 94 color: var(--text-tertiary); 95 border-radius: var(--radius-sm); 96 cursor: pointer; 97 transition: var(--transition-interactive); 98 99 &:hover { 100 color: var(--text-primary); 101 background: var(--surface-sidebar-hover); 102 } 103 ${xn.qw}; 104`,En=wn.Ay.span` 105 font-size: 0.72rem; 106 font-weight: 650; 107 letter-spacing: 0.01em; 108 color: var(--text-tertiary); 109 padding: 0 ${24}px; 110 margin-bottom: ${8}px; 111 white-space: nowrap; 112 ${e=>{let{$collapsed:t}=e;return t?wn.AH` 113 visibility: hidden; 114 height: 0; 115 margin-bottom: 0; 116 `:""}} 117`,Rn=wn.Ay.nav` 118 flex: 1 1 auto; 119 min-height: 0; 120 display: flex; 121 flex-direction: column; 122 gap: 2px; 123 overflow-x: hidden; 124 overflow-y: auto; 125 overscroll-behavior: contain; 126 scrollbar-color: var(--border-strong) transparent; 127 scrollbar-width: thin; 128 129 &::-webkit-scrollbar {
130 width: 4px; 131 } 132 133 &::-webkit-scrollbar-thumb { 134 border-radius: var(--radius-pill); 135 background: var(--border-strong); 136 } 137`,$n=(0,wn.Ay)(C.k2)` 138 --height: 48px; 139 140 display: flex; 141 align-items: center; 142 gap: ${e=>{let{$collapsed:t}=e;return t?0:12}}px; 143 padding: 0 ${e=>{let{$collapsed:t}=e;return t?0:24}}px; 144 justify-content: ${e=>{let{$collapsed:t}=e;return t?"center":"flex-start"}}; 145 height: var(--height); 146 min-height: var(--height); 147 font-size: 0.95rem; 148 font-weight: ${e=>{let{$active:t}=e;return t?650:500}}; 149 border-radius: var(--radius-md); 150 color: var(--text-primary); 151 text-decoration: none; 152 position: relative; 153 transition: var(--transition-interactive); 154 155 &::before { 156 content: ""; 157 position: absolute; 158 left: ${e=>{let{$collapsed:t}=e;return t?2:9}}px; 159 top: 8px; 160 bottom: 8px; 161 width: 4px; 162 border-radius: 4px; 163 background: ${e=>{let{$active:t}=e;return t?"var(--tenant-accent)":"transparent"}}; 164 box-shadow: ${e=>{let{$active:t}=e;return t?"0 0 0 1px var(--border-strong)":"none"}}; 165 transition: var(--transition-interactive); 166 } 167 168 background: ${e=>{let{$active:t}=e;return t?"var(--surface-sidebar-active)":"transparent"}}; 169 170 &:hover { 171 background: ${e=>{let{$active:t}=e;return t?"var(--surface-sidebar-active)":"var(--surface-sidebar-hover)"}}; 172 } 173 174 @media (max-width: 768px) { 175 --height: 52px; 176 font-size: 1rem; 177 } 178 ${xn.pw}; 179 html[data-motion='standard'] &::before { 180 transform: ${e=>{let{$active:t}=e;return t?"scaleY(1)":"scaleY(0.45)"}}; 181 transform-origin: center; 182 transition: transform var(--motion-base, 200ms) var(--ease-standard, ease), 183 background-color var(--motion-base, 200ms) var(--ease-standard, ease); 184 } 185 186`,Nn=wn.Ay.span` 187 margin-left: auto; 188 font-size: 11px; 189 font-weight: 700; 190 border-radius: var(--radius-pill); 191 min-width: 18px; 192 text-align: center; 193 padding: 1px 6px; 194 background: var(--brand-subtle); 195 color: var(--brand); 196 font-variant-numeric: tabular-nums; 197`,Tn=wn.Ay.span` 198 position: absolute; 199 top: -4px; 200 right: -6px; 201 min-width: 16px; 202 height: 16px; 203 padding: 0 4px; 204 display: grid; 205 place-items: center; 206 font-size: 10px; 207 font-weight: 700; 208 border-radius: var(--radius-pill); 209 background: var(--brand); 210 color: var(--brand-contrast); 211 font-variant-numeric: tabular-nums; 212`,Ln=wn.Ay.button` 213 display: flex; 214 align-items: center; 215 gap: ${e=>{let{$collapsed:t}=e;return t?0:12}}px; 216 padding: 0 ${e=>{let{$collapsed:t}=e;return t?0:24}}px; 217 justify-content: ${e=>{let{$collapsed:t}=e;return t?"center":"flex-start"}}; 218 height: 44px; 219 min-height: 44px; 220 width: 100%; 221 margin-top: ${8}px; 222 border: none; 223 background: transparent; 224 cursor: pointer; 225 text-align: left; 226 font-family: inherit; 227 font-size: 0.9rem; 228 font-weight: 600; 229 color: var(--text-secondary); 230 border-radius: var(--radius-md); 231 transition: var(--transition-interactive); 232 233 &:hover { 234 color: var(--text-primary); 235 background: var(--surface-sidebar-hover); 236 } 237 ${xn.pw}; 238`,On=wn.Ay.div` 239 display: flex; 240 flex-direction: column; 241 gap: 2px; 242 243 ${$n} { 244 --height: 44px; 245 padding-left: ${36}px; 246 font-size: 0.9rem; 247 } 248`,Mn=wn.Ay.div` 249 flex: 0 0 auto; 250 padding: 0 ${e=>{let{$collapsed:t}=e;return t?8:24}}px ${24}px; 251 display: flex; 252 flex-direction: column; 253 gap: 4px; 254 margin-top: auto; 255`,Un=wn.Ay.a` 256 display: flex; 257 align-items: center; 258 gap: ${e=>{let{$collapsed:t}=e;return t?0:12}}px; 259 justify-content: ${e=>{let{$collapsed:t}=e;return t?"center":"flex-start"}}; 260 padding: ${e=>{let{$collapsed:t}=e;return t?"10px 0":"10px 12px"}}; 261 min-height: 44px; 262 border-radius: var(--radius-md); 263 font-size: 0.88rem; 264 font-weight: 500; 265 color: var(--text-secondary); 266 text-decoration: none; 267 transition: var(--transition-interactive); 268 269 &:hover { 270 color: var(--text-primary); 271 background: var(--surface-sidebar-hover); 272 } 273 274 @media (max-width: 768px) { 275 min-height: 48px; 276 padding: 12px 14px; 277 font-size: 0.92rem; 278 } 279 ${xn.pw}; 280`,Pn=wn.Ay.div` 281 display: flex; 282 flex-wrap: wrap; 283 justify-content: center; 284 gap: 4px 8px; 285 font-size: 0.75rem; 286 color: var(--text-tertiary); 287 margin-top: ${16}px; 288 289 a { 290 color: inherit; 291 text-decoration: none; 292 293 &:hover { 294 text-decoration: underline; 295 } 296 } 297 298 span { 299 user-select: none; 300 color: var(--text-disabled); 301 } 302`,qn=wn.Ay.button` 303 display: flex; 304 align-items: center; 305 gap: ${e=>{let{$collapsed:t}=e;return t?0:12}}px; 306 justify-content: ${e=>{let{$collapsed:t}=e;return t?"center":"flex-start"}}; 307 width: 100%; 308 padding: ${e=>{let{$collapsed:t}=e;return t?"8px 0":"8px 10px"}}; 309 min-height: 56px; 310 border: 1px solid var(--sidebar-divider); 311 border-radius: var(--radius-md); 312 background: transparent; 313 cursor: pointer; 314 text-align: left; 315 font-family: inherit; 316 transition: var(--transition-interactive); 317 margin-bottom: ${8}px; 318 319 &:hover { 320 background: var(--surface-sidebar-hover); 321 } 322 ${xn.qw}; 323`,Dn=wn.Ay.span` 324 flex-shrink: 0; 325 width: 34px; 326 height: 34px; 327 display: grid; 328 place-items: center; 329 border-radius: var(--radius-pill); 330 background: var(--brand-subtle); 331 color: var(--brand); 332 font-size: 0.82rem; 333 font-weight: 700; 334 letter-spacing: 0.02em; 335 user-select: none; 336`,zn=wn.Ay.span` 337 display: flex; 338 flex-direction: column; 339 min-width: 0; 340 flex: 1 1 auto; 341 gap: 1px; 342`,Bn=wn.Ay.span` 343 font-size: 0.88rem; 344 font-weight: 600; 345 color: var(--text-primary); 346 white-space: nowrap; 347 overflow: hidden; 348 text-overflow: ellipsis; 349`,Fn=wn.Ay.span` 350 font-size: 0.74rem; 351 font-weight: 500; 352 color: var(--text-tertiary); 353 white-space: nowrap; 354 overflow: hidden; 355 text-overflow: ellipsis; 356`,Wn=wn.Ay.span` 357 position: absolute; 358 width: 1px; 359 height: 1px; 360 padding: 0; 361 margin: -1px; 362 overflow: hidden; 363 clip: rect(0 0 0 0); 364 white-space: nowrap; 365 border: 0; 366`;var Hn=n(12159),Vn=n(62470);function Yn(e){const[t,n]=(0,i.useState)(()=>(e=>"undefined"!==typeof window&&"function"===typeof window.matchMedia&&window.matchMedia(e).matches)(e));return(0,i.useEffect)(()=>{var t;if("undefined"===typeof window||"function"!==typeof window.matchMedia)return;const i=window.matchMedia(e),a=()=>n(i.matches);return a(),null===(t=i.addEventListener)||void 0===t||t.call(i,"change",a),()=>{var e;return null===(e=i.removeEventListener)||void 0===e?void 0:e.call(i,"change",a)}},[e]),t}const Gn={learner:{role:"learner",defaultTiles:[{id:"learner.due_next",size:"full"},{id:"learner.recent_feedback"},{id:"learner.submission_tracker"}],optionalTiles:["learner.course_progress","learner.announcements"],corePages:["/dashboard","/tutorials"],optionalPages:["/assignments","/settings"]},educator:{role:"educator",defaultTiles:[{id:"educator.marking_queue",size:"full"},{id:"educator.turnaround"}],optionalTiles:["educator.active_learners"],corePages:["/dashboard","/tutorials"],optionalPages:["/assignments","/cohorts","/settings"]},supervisor:{role:"supervisor",defaultTiles:[{id:"supervisor.org_health",size:"full"},{id:"supervisor.review_time"},{id:"supervisor.ai_assurance"},{id:"supervisor.sla"}],optionalTiles:[],corePages:["/dashboard","/tutorials"],optionalPages:["/assignments","/users","/analytics","/settings","/bulk","/plagiarism/upload"]},admin:{role:"admin",defaultTiles:[{id:"admin.users",size:"full"},{id:"admin.org_grade"}],optionalTiles:[],corePages:["/dashboard","/tutorials"],optionalPages:["/assignments","/users","/analytics","/settings"]}};
366var Jn=n(40884),Kn=n(646),Xn=n(44151),Zn=n(22677),Qn=n(44662);const ei=(0,Xt.A)("accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);const ti=e=>String(e.membershipId||e.id||"").trim(),ni=e=>{if(!Array.isArray(e))return[];const t=new Set;return e.flatMap(e=>{var n;if(!e||"object"!==typeof e)return[];const i=e,a=ti(i);if(!a||t.has(a))return[];t.add(a);const r=String(i.centre||(null!==(n=i.centreIds)&&void 0!==n&&n.length?i.centreIds.join(", "):"")).trim(),s=String(i.organisation||i.orgId||"EduMark organisation");return[{membershipId:a,label:r?`${s} \xb7 ${r}`:s,role:i.lmsRole||i.role||null}]})},ii=e=>{const t=e.split(/\s+/).map(e=>e.trim()).filter(Boolean);return 0===t.length?"?":1===t.length?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[t.length-1][0]}`.toUpperCase()},ai=e=>{const t=String(null!==e&&void 0!==e?e:"").trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()):null},ri=e=>{var t,n,r;let{collapsed:s,onOpenProfile:o,onAfterNavigate:l}=e;const c=(0,v.wA)(),d=(0,S.Zp)(),{user:u,userType:m}=(0,v.d4)(e=>e.auth),p=(0,Je.Um)(),{effective:h}=(0,a.Rl)(),g=(0,Je.Ok)(),[f,_]=(0,i.useState)(null),[y,b]=(0,i.useState)(!1),[x,k]=(0,i.useState)(null),A=null!==u&&void 0!==u?u:{},j=String(null!==(t=A.name)&&void 0!==t?t:"").trim()||(null===p||void 0===p?void 0:p.user.displayName)||(null===p||void 0===p?void 0:p.user.email)||"Your account",C=(null===g||void 0===g?void 0:g.displayRole)||ai(m),I=(null===g||void 0===g||null===(n=g.name)||void 0===n?void 0:n.trim())||null,E=(0,i.useMemo)(()=>{var e;return ni(null!==(e=A.availableContexts)&&void 0!==e?e:A.available_contexts)},[u]),R=null!==(r=A.activeContext)&&void 0!==r?r:A.active_context,$=String((null===R||void 0===R?void 0:R.membershipId)||(null===R||void 0===R?void 0:R.id)||"").trim(),N="native"===(0,O.readLmsSessionMode)()&&E.length>=2&&Boolean($),T=()=>_(null),L=e=>{T(),d(e),null===l||void 0===l||l()},M=I?`Account: ${j}, ${null!==C&&void 0!==C?C:"member"} at ${I}`:`Account: ${j}`;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(qn,{type:"button",$collapsed:s,"aria-label":M,"aria-haspopup":"menu","aria-expanded":Boolean(f),"data-testid":"sidebar-account-control",title:s?j:void 0,onClick:e=>{e.stopPropagation(),_(e.currentTarget)},children:[(0,w.jsx)(Dn,{"aria-hidden":"true",children:ii(j)}),s?null:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(zn,{children:[(0,w.jsx)(Bn,{children:j}),C||I?(0,w.jsx)(Fn,{children:[C,I].filter(Boolean).join(" \xb7 ")}):null]}),(0,w.jsx)(Kn.A,{size:14,strokeWidth:1.8,"aria-hidden":"true"})]})]}),(0,w.jsxs)(un.A,{transitionDuration:"standard"===h?150:0,anchorEl:f,open:Boolean(f),onClose:T,anchorOrigin:{vertical:"top",horizontal:s?"right":"center"},transformOrigin:{vertical:"bottom",horizontal:s?"left":"center"},children:[N?[(0,w.jsx)(It.A,{disabled:!0,dense:!0,children:(0,w.jsx)(Et.A,{primary:"Switch workspace"})},"workspace-heading"),...E.map(e=>{var t;return(0,w.jsxs)(It.A,{dense:!0,disabled:y,selected:e.membershipId===$,onClick:()=>{var t;(t=e.membershipId)&&t!==$&&!y&&(b(!0),k(null),(0,O.switchLmsMembership)(c,t).then(()=>{T(),d("/dashboard",{replace:!0}),null===l||void 0===l||l()}).catch(e=>{k(e instanceof Error?e.message:"We could not switch workspaces. Please try again.")}).finally(()=>b(!1)))},children:[(0,w.jsx)(Et.A,{primary:e.label,secondary:null!==(t=ai(e.role))&&void 0!==t?t:void 0}),e.membershipId===$?(0,w.jsx)(Xn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}):null]},e.membershipId)}),x?(0,w.jsx)(It.A,{disabled:!0,dense:!0,children:(0,w.jsx)(Et.A,{secondary:x})},"workspace-error"):null,(0,w.jsx)(St.A,{},"workspace-divider")]:null,o?(0,w.jsx)(It.A,{dense:!0,onClick:()=>{T(),o()},children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(Zn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),"Profile"]})}):null,(0,w.jsx)(It.A,{dense:!0,onClick:()=>L("/settings"),children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(Qn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),"Account settings"]})}),(0,w.jsx)(St.A,{}),(0,w.jsx)(It.A,{dense:!0,onClick:()=>L("/settings/appearance"),children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(ei,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),"Appearance & accessibility"]})}),(0,w.jsx)(It.A,{dense:!0,onClick:()=>L("/logout"),children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,w.jsx)(tn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),"Sign out"]})})]})]})};var si=n(90827),oi=n(39329),li=n(60263),ci=n(68998),di=n(7589),ui=n(99640),mi=n(64963),pi=n(90203),hi=n(98771),vi=n(80449),gi=n(29015),fi=n(94147);const _i=(0,Xt.A)("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);var yi=n(68042);const bi=[{name:"Home",route:"/dashboard"},{name:"Calendar",route:"/calendar",capability:"calendar.view"},{name:"Community Hub",route:"/community",childRoutes:["/community/"],anyCapability:["communications.read","people.create"],anyPermission:["create_announcements","communications.create_announcements"]},{name:"Communications",route:"/communications",childRoutes:["/communications/"],capability:"communications.read"},{name:"Courses",route:"/courses",childRoutes:["/courses/"],capability:"courses.view"},{name:"Deliveries",route:"/deliveries",childRoutes:["/deliveries/"],staffOnly:!0,capability:"deliveries.view"},{name:"Assignments",route:"/assignments",capability:"assignments.view"},{name:"Results",route:"/results",learnerOnly:!0,capability:"learning.view_feedback"},{name:"Practice",route:"/practice",childRoutes:["/practice/"],learnerOnly:!0,capability:"practice.use"},{name:"Study",route:"/study",childRoutes:["/study/"],learnerOnly:!0,capability:"study.use"},{name:"People",route:"/people",childRoutes:["/people/"],capability:"people.view"},{name:"Analytics",route:"/analytics",capability:"analytics.view"},{name:"Marking",route:"/marking",childRoutes:["/marking/"],capability:"assessment.view_submissions"},{name:"AI Marking",route:"/ai-marking",childRoutes:["/ai-marking/"],staffOnly:!0,capability:"ai_marking.use",anyCapability:["assessment.view_submissions"]},{name:"Plagiarism",route:"/plagiarism",childRoutes:["/plagiarism/"],staffOnly:!0,capability:"plagiarism.view"},{name:"Quality",route:"/quality",childRoutes:["/quality/"],capability:"qa.view"},{name:"Settings",route:"/settings"}],wi=bi.filter(e=>
366["/dashboard","/calendar","/community","/communications","/people","/marking","/settings"].includes(e.route)),xi={marker:wi,assessor:wi,learner:[{name:"Home",route:"/dashboard"},{name:"Calendar",route:"/calendar"},{name:"Community Hub",route:"/community",childRoutes:["/community/"],anyCapability:["communications.read","people.create"],anyPermission:["create_announcements","communications.create_announcements"]},{name:"Communications",route:"/communications",childRoutes:["/communications/"],permission:"communications.read"},{name:"My learning",route:"/courses",childRoutes:["/courses/"],permission:"courses.read"},{name:"Assignments",route:"/assignments",permission:"assignments.read"},{name:"Results",route:"/results"},{name:"Practice",route:"/practice",childRoutes:["/practice/"]},{name:"Study",route:"/study",childRoutes:["/study/"]},{name:"Settings",route:"/settings"}],educator:[{name:"AI Marking",route:"/ai-marking",childRoutes:["/ai-marking/"],permission:"ai_marking.use"},{name:"Plagiarism",route:"/plagiarism",childRoutes:["/plagiarism/"],capability:"plagiarism.view"},{name:"Deliveries",route:"/deliveries",childRoutes:["/deliveries/"]},{name:"Home",route:"/dashboard"},{name:"Calendar",route:"/calendar"},{name:"Community Hub",route:"/community",childRoutes:["/community/"],anyCapability:["communications.read","people.create"],anyPermission:["create_announcements","communications.create_announcements"]},{name:"Communications",route:"/communications",childRoutes:["/communications/"],permission:"communications.read"},{name:"Marking",route:"/marking",childRoutes:["/marking/"],permission:"marking.read"},{name:"Assignments",route:"/assignments",permission:"assignments.read"},{name:"People",route:"/people",childRoutes:["/people/"],permission:"people.read"},{name:"Settings",route:"/settings"}],supervisor:[{name:"AI Marking",route:"/ai-marking",childRoutes:["/ai-marking/"],permission:"ai_marking.use"},{name:"Deliveries",route:"/deliveries",childRoutes:["/deliveries/"]},{name:"Home",route:"/dashboard"},{name:"Calendar",route:"/calendar"},{name:"Community Hub",route:"/community",childRoutes:["/community/"],anyCapability:["communications.read","people.create"],anyPermission:["create_announcements","communications.create_announcements"]},{name:"Communications",route:"/communications",childRoutes:["/communications/"],permission:"communications.read"},{name:"Courses",route:"/courses",childRoutes:["/courses/"],permission:"courses.read"},{name:"Assignments",route:"/assignments",permission:"assignments.read"},{name:"People",route:"/people",childRoutes:["/people/"],permission:"people.read"},{name:"Analytics",route:"/analytics"},{name:"Marking",route:"/marking",childRoutes:["/marking/"],permission:"marking.read"},{name:"Quality",route:"/quality",childRoutes:["/quality/"],permission:"moderation.manage"},{name:"Plagiarism",route:"/plagiarism",childRoutes:["/plagiarism/"],capability:"plagiarism.view"},{name:"Settings",route:"/settings"}],admin:[{name:"AI Marking",route:"/ai-marking",childRoutes:["/ai-marking/"],permission:"ai_marking.use"},{name:"Plagiarism",route:"/plagiarism",childRoutes:["/plagiarism/"],capability:"plagiarism.view"},{name:"Deliveries",route:"/deliveries",childRoutes:["/deliveries/"]},{name:"Home",route:"/dashboard"},{name:"Calendar",route:"/calendar"},{name:"Community Hub",route:"/community",childRoutes:["/community/"],anyCapability:["communications.read","people.create"],anyPermission:["create_announcements","communications.create_announcements"]},{name:"Communications",route:"/communications",childRoutes:["/communications/"],permission:"communications.read"},{name:"Marking",route:"/marking",childRoutes:["/marking/"],permission:"marking.read"},{name:"Courses",route:"/courses",childRoutes:["/courses/"],permission:"courses.read"},{name:"Assignments",route:"/assignments",permission:"assignments.read"},{name:"People",route:"/people",childRoutes:["/people/"],permission:"people.read"},{name:"Analytics",route:"/analytics"},{name:"Quality",route:"/quality",childRoutes:["/quality/"],permission:"moderation.manage"},{name:"Settings",route:"/settings"}]},ki=[{name:"Organisation",route:"/organisation",childRoutes:["/tenant-administration"],capability:"settings.view"},{name:"Apps & integrations",route:"/integrations",permission:"integration.manage",capability:"integration.manage"},{name:"Migration assistant",route:"/migration",childRoutes:["/migration/","/integrations/moodle","/data-imports"],permission:"imports.manage",capability:"people.bulk_import"},{name:"Security & audit",route:"/security",childRoutes:["/audit","/file-security"],permission:"audit.read",capability:"qa.view_audit"},{name:"Billing",route:"/settings/workspace/billing",childRoutes:["/settings/billing","/settings/usage","/pilot"],permission:"tenant.manage",capability:"settings.manage"}],Ai={Home:si.A,Calendar:oi.A,Assignments:hn.A,Settings:Qn.A,Users:li.A,People:li.A,Analytics:ci.A,Marking:di.A,"AI Marking":ui.A,Quality:mi.A,Plagiarism:mi.A,Organisation:vn.A,"Apps & integrations":pi.A,"Migration assistant":hi.A,"Security & audit":mi.A,Billing:vi.A,Courses:gi.A,Deliveries:vn.A,"My courses":gi.A,"My learning":gi.A,Results:ci.A,Communications:fi.A,"Community Hub":_i,Practice:ui.A,Study:yi.A},ji=(e,t)=>{if(!t)return e;const n=new Set(t);return e.filter(e=>!e.permission||n.has(e.permission))},Si=e=>`em_sidebar_collapsed:${String(null!==e&&void 0!==e?e:"").trim()||"anon"}`,Ci=e=>{const[t,n]=(0,i.useState)(()=>(e=>{try{return"1"===window.localStorage.getItem(Si(e))}catch{return!1}})(e)),a=(0,i.useCallback)(()=>{n(t=>{const n=!t;return((e,t)=>{try{window.localStorage.setItem(Si(e),t?"1":"0")}catch{}})(e,n),n})},[e]);return{collapsed:t,toggleCollapsed:a}};var Ii=n(13650),Ei=n(13946);const Ri=e=>{var t;let{isOpen:n,onToggleSidebar:a,onOpenProfile:r}=e;const s=(0,S.Zp)(),{resolvedTheme:o}=(0,y.eP)(),l=(0,yt.A)(),c=(0,bt.A)(l.breakpoints.down("md")),d=(0,Rt.IbK)(),u=(0,S.zy)(),{userType:m,user:p}=(0,v.d4)(e=>e.auth),h=(0,R.n8)(),g=(0,Je.Ok)(),f=(0,Ii.Sk)(),_=i.useRef(null),{collapsed:b,toggleCollapsed:x}=Ci(null!==(t=null===p||void 0===p?void 0:p.id)&&void 0!==t?t:null),k=(0,Vn.kC)(),A=Yn(Vn.PF),j=!c&&k&&A&&!b,[I,E]=i.useState(!1);(0,i.useEffect)(()=>{j||E(!1)},[j]);const $=j&&!I,N=!c&&(b||$),T=()=>{$?E(!0):x()},[L,O]=i.useState(null),U="tenant"===h.identity&&Boolean(h.logoUrl)&&h.logoUrl!==M.A.BRAND_FULL_LOGO,P=U?h.logoUrl:"dark"===o?M.A.BRAND_FULL_LOGO_DARK:M.A.BRAND_FULL_LOGO,q=N?U?"/edumarkfavicon.png"!==h.faviconUrl?h.faviconUrl:h.logoUrl:M.A.BRAND_FAVICON:P,D=(0,i.useMemo)(()=>(0,Hn.uv)("tour:sidebar",null===p||void 0===p?void 0:p.id,"v1"),[null===p||void 0===p?void 0:p.id]),[z,B]=i.useState(0);(0,i.useEffect)(()=>{const e=()=>B(e=>e+1);return window.addEventListener(dt.mD,e),window.addEventListener(Jn.k2,e),window.addEventListener("storage",e),()=>{window.removeEventListener(dt.mD,e),window.removeEventListener(Jn.k2,e),window.removeEventListener("storage",e)}},[]);const F=g?g.permissions:null,{items:W,adminItems:H,badges:V,resurfaced:Y}=(0,i.useMemo)(()=>{var e,t;const n=g?bi.filter(e=>(!e.staffOnly||Boolean(m)&&"learner"!==m)&&(!e.learnerOnly||"learner"===m)&&(!e.capability||f.can(e.capability))&&function(e,t,n){var i,a;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return!e.anyCapability&&!e.anyPermission||Boolean((null===(i=e.anyCapability)||void 0===i?void 0:i.some(e=>!r.includes(e)&&t(e)))||(null===(a=e.anyPermission)||void 0===a?void 0:a.some(e=>n.includes(e)&&!r.includes(e))))}(e,f.can,g.permissions,g.deniedPermissions)):m&&xi[(0,Ei.t2)(p,m)]||[],i=ji(n,F).filter(e=>!["/communications","/community"].includes(e.route)||(0,nt.N)()),a=g||"admin"===m?ki.filter(e=>!(g&&e.capability&&!f.can(e.capability))&&("/settings/workspace/billing"!==e.route||(0,tt.o)())):[],r=ji(a,F),s=function(e){var t;return e&&null!==(t=Gn[e])&&void 0!==t?t:null}(m),o=null!==(e=null===p||void 0===p?void 0:p.id)&&void 0!==e?e:"";if(!s||!o)return{items:i,adminItems:r,badges:{},resurfaced:new Set};const l=g?`staff:${g.id}`:String(m),c=(0,dt.qz)(o,l),d=new Set(null!==(t=null===c||void 0===c?void 0:c.hidden_pages)&&void 0!==t?t:[]),u=(0,Jn.xm)(o),h=new Set(s.corePages),v=new Set;return{items:i.filter(e=>{var t;const n=(null!==(t=u[e.route])&&void 0!==t?t:0)>0;return!(d.has(e.route)&&!h.has(e.route))||!!n&&(v.add(e.route),!0)}),adminItems:r,badges:u,resurfaced:v}},[g,f,m,null===p||void 0===p?void 0:p.id,F,z]),G=e=>{var t;return u.pathname===e.route||(null===(t=e.childRoutes)||void 0===t?void 0:t.some(e=>u.pathname.startsWith(e)))},J=H.some(G),[K,X]=i.useState(!1);(0,i.useEffect)(()=>{J&&X(!0)},[J]);const Z=c?"center":"right-start",Q=c?"center":"right",ee=c?"center":"right-end",te=(0,i.useMemo)(()=>[{target:'[data-tour="sidebar"]',title:"Navigation",content:"This sidebar is your command center. Jump between pages without losing your place.",disableBeacon:!0,placement:Z},{target:'[data-tour="nav-assignments"]',title:"Assignments",content:"Your queue of work. See what\u2019s due, what\u2019s pending, and what\u2019s already submitted.",placement:Q},{target:'[data-tour="nav-settings"]',title:"Settings",content:"Update profile, preferences, and notifications whenever you like.",placement:Q},{target:'[data-tour="nav-analytics"]',title:"Analytics",content:"For supervisors/admins: deep dive into performance and trends.",placement:Q},{target:'[data-tour="nav-users"]',title:"People",content:"Manage learners and staff. Filter by cohort to move fast.",placement:Q},{target:'[data-tour="nav-administration"]',title:"Administration",content:"Organisation settings, apps, migration and security live here, tucked away until you need them.",placement:Q},{target:'[data-tour="nav-tutorials"]',title:"Help and tutorials",content:"Guides and walkthroughs whenever you need a refresher. Your account, workspace and sign out live just above.",placement:ee}],[ee,Q,Z]);(0,i.useEffect)(()=>
366{if(c)return;const e=_.current;if(!e)return;const t=window.requestAnimationFrame(()=>{var t;null===(t=e.scrollIntoView)||void 0===t||t.call(e,{block:"nearest",inline:"nearest"})});return()=>window.cancelAnimationFrame(t)},[K,c,W,u.pathname]);const ne=(e,t,n)=>N?(0,w.jsx)(ot.A,{title:e,placement:"right",arrow:!0,children:t},null!==n&&void 0!==n?n:e):t,ie=e=>{var t;const n=Ai[e.name]||hn.A,i=(e=>{switch(e){case"Home":return"nav-home";case"Calendar":return"nav-calendar";case"Assignments":return"nav-assignments";case"Practice":return"nav-practice";case"Study":return"nav-study";case"Community Hub":return"nav-community";case"Communications":return"nav-communications";case"Courses":case"My courses":case"My learning":return"nav-courses";case"Settings":return"nav-settings";case"Tutorials":case"Help":return"nav-tutorials";case"Analytics":return"nav-analytics";case"People":case"Users":return"nav-users";case"Marking":return"nav-marking";case"Quality":return"nav-quality";case"Plagiarism":return"nav-plagiarism";case"Organisation":return"nav-organisation";case"Apps & integrations":return"nav-integrations";case"Migration assistant":return"nav-migration";case"Security & audit":return"nav-security";case"Billing":return"nav-billing";default:return}})(e.name),a=G(e),r=null!==(t=V[e.route])&&void 0!==t?t:0;return ne(e.name,(0,w.jsxs)($n,{to:e.route,$active:a,$collapsed:N,"aria-current":a?"page":void 0,"aria-label":N?e.name:void 0,ref:a?_:void 0,...i?{"data-tour":i}:{},...Y.has(e.route)?{title:"Shown because something here needs you \u2014 it stays until that clears."}:{},children:[(0,w.jsxs)(kn,{children:[(0,w.jsx)(n,{size:18,strokeWidth:1.8,"aria-hidden":"true"}),N&&r>0&&(0,w.jsx)(Tn,{"aria-label":`${r} items need you`,children:r>99?"99+":r})]}),(0,w.jsx)(An,{$collapsed:N,children:e.name}),!N&&r>0&&(0,w.jsx)(Nn,{"aria-label":`${r} items need you`,children:r})]},e.name))},ae=()=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Sn,{"data-tour":"sidebar-header",$collapsed:N,children:[(0,w.jsx)(Cn,{type:"button","data-tour":"sidebar-logo","aria-label":"EduMark \u2014 go to Home",$collapsed:N,onClick:()=>s("/dashboard"),children:(0,w.jsx)("img",{src:q,alt:h.name,onError:e=>{e.target.style.display="none"}})}),!c&&(0,w.jsx)(ot.A,{title:N?"Expand sidebar":"Collapse sidebar",placement:"right",arrow:!0,children:(0,w.jsx)(In,{type:"button","aria-label":N?"Expand sidebar":"Collapse sidebar","aria-expanded":!N,"data-testid":"sidebar-collapse-toggle",onClick:T,children:N?(0,w.jsx)(Zt,{size:18,strokeWidth:1.8,"aria-hidden":"true"}):(0,w.jsx)(Qt,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})})]}),(0,w.jsxs)(Rn,{"data-tour":"sidebar","aria-label":"Primary",children:[(0,w.jsx)(En,{$collapsed:N,children:"Your Pages"}),W.map(ie),0===H.length?null:N?(0,w.jsxs)(w.Fragment,{children:[ne("Administration",(0,w.jsx)(Ln,{type:"button",$collapsed:!0,"aria-haspopup":"menu","aria-expanded":Boolean(L),"aria-label":"Administration","data-tour":"nav-administration",onClick:e=>{e.stopPropagation(),O(e.currentTarget)},children:(0,w.jsx)(kn,{children:(0,w.jsx)(vn.A,{size:18,strokeWidth:1.8,"aria-hidden":"true"})})})),(0,w.jsx)(un.A,{anchorEl:L,open:Boolean(L),onClose:()=>O(null),anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"left"},children:H.map(e=>(0,w.jsx)(It.A,{dense:!0,selected:Boolean(G(e)),onClick:()=>{O(null),s(e.route)},children:e.name},e.name))})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Ln,{type:"button","aria-expanded":K,"data-tour":"nav-administration",onClick:e=>{e.stopPropagation(),X(e=>!e)},children:[(0,w.jsx)(kn,{children:(0,w.jsx)(vn.A,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)(An,{children:"Administration"}),K?(0,w.jsx)(gn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}):(0,w.jsx)(fn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})]}),K&&(0,w.jsx)(On,{children:H.map(ie)})]})]}),(0,w.jsxs)(Mn,{"data-tour":"sidebar-bottom",$collapsed:N,children:[(0,w.jsx)(ri,{collapsed:N,onOpenProfile:r,onAfterNavigate:c?a:void 0}),(0,w.jsx)(St.A,{sx:{mb:1,borderColor:"var(--sidebar-divider)"}}),ne("Help and tutorials",(0,w.jsxs)(Un,{as:C.k2,to:"/tutorials",$collapsed:N,"aria-label":N?"Help and tutorials":void 0,onClick:a,"data-tour":"nav
366-tutorials",children:[(0,w.jsx)(kn,{children:(0,w.jsx)(_n.A,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)(An,{$collapsed:N,children:"Help and tutorials"})]})),ne("Contact support",(0,w.jsxs)(Un,{href:`mailto:${h.supportEmail}`,$collapsed:N,"aria-label":N?"Contact support":void 0,onClick:a,title:N?void 0:h.supportName,children:[(0,w.jsx)(kn,{children:(0,w.jsx)(yn.A,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)(An,{$collapsed:N,children:"Contact support"})]})),ne("Report a problem",(0,w.jsxs)(Un,{href:"https://bugspot.dev/form/29dfada0-f308-49bc-b443-c6b4da772ac1",target:"_blank",rel:"noopener noreferrer",$collapsed:N,"aria-label":N?"Report a problem":void 0,onClick:a,children:[(0,w.jsx)(kn,{children:(0,w.jsx)(bn,{size:18,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)(An,{$collapsed:N,children:"Report a problem"})]})),!N&&(0,w.jsxs)(Pn,{children:[(0,w.jsx)("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"}),(0,w.jsx)("span",{children:"\u2022"}),(0,w.jsx)("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"})]})]}),(0,w.jsx)(Wn,{role:"status","aria-live":"polite",children:N?"Sidebar collapsed":"Sidebar expanded"})]}),re=c?(0,w.jsx)(mn.Ay,{open:n,onClose:a,transitionDuration:d?0:void 0,PaperProps:{sx:{width:{xs:"85vw",sm:280},maxWidth:320,background:"var(--surface-sidebar)",borderRight:"1px solid var(--sidebar-divider)",backdropFilter:"var(--shell-glass-blur, blur(18px))",WebkitBackdropFilter:"var(--shell-glass-blur, blur(18px))",boxShadow:"var(--shadow-sm)"}},children:(0,w.jsx)(pn.A,{"data-aurora-app-chrome":"true",onClick:a,sx:{height:"100%",display:"flex",flexDirection:"column"},children:ae()})}):(0,w.jsx)(jn,{"data-aurora-app-chrome":"true","data-tour":"sidebar-shell","data-resting-for-aurora":$?"true":void 0,$collapsed:N,children:ae()});return(0,i.useEffect)(()=>{c&&(0,Hn.k)(D)},[c,D]),(0,w.jsxs)(w.Fragment,{children:[re,(0,w.jsx)(Hn.oV,{userId:null===p||void 0===p?void 0:p.id,steps:te,storagePrefix:"tour:sidebar",storageId:"v1",runIf:!c,lockKey:"tour:lock",promptBeforeRun:!0,promptTitle:"Take a quick navigation tour?",promptBody:"We\u2019ll point out the main LMS areas so it\u2019s easier to find your way around.",promptConfirmLabel:"Show navigation"})]})},$i="uKCFYPzh";class Ni extends i.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidUpdate(e){this.state.hasError&&e.resetKey!==this.props.resetKey&&this.setState({hasError:!1})}render(){var e,t;return this.state.hasError?null!==(e=this.props.fallback)&&void 0!==e?e:(0,w.jsxs)("section",{className:$i,role:"alert","aria-label":"Page loading problem",children:[(0,w.jsx)("h1",{children:"We couldn\u2019t load this page"}),(0,w.jsx)("p",{children:"This can happen after an update or when the connection is interrupted. Refresh to try again."}),(0,w.jsx)("p",{children:"Refreshing may discard changes that haven\u2019t been saved."}),(0,w.jsx)("button",{type:"button",onClick:null!==(t=this.props.onReload)&&void 0!==t?t:()=>window.location.reload(),children:"Refresh page"})]}):this.props.children}}var Ti=n(17187),Li=n(61348);const Oi=e=>{var t,n;return String(null!==(t=null!==(n=null===e||void 0===e?void 0:e.id)&&void 0!==n?n:null===e||void 0===e?void 0:e._id)&&void 0!==t?t:"").trim()};var Mi=n(94031),Ui=n.n(Mi),Pi=n(89369),qi=n.n(Pi);const Di="i7bi0mDk",zi="gyu5CpAc",Bi="uwHlytlW",Fi="rUeYNkGH",Wi="dw9O3NyH",Hi="wQ4Yt_8J",Vi="_DPxaNmB",Yi="Kf2zgomn",Gi="G_CcwgxV",Ji="gBsb9jPk",Ki="n3d4DiRK",Xi="XjECm8lH",Zi="YYQD8G5C",Qi="MULzUjFe",ea="ukJ7nQtp",ta="V0ZbHhgm",na="WfREfMhY",ia="nSYIXjWQ",aa="zWZstcdG",ra="adBIiPlh",sa="yU1LIpUg",oa="ZJVIOihO",la="REnn1LxF",ca="r_QQi4cV",da="Wfz2Bnlu",ua="IgLNL6pG";var ma=n(8278),pa=n(32430),ha=(n(13322),n(68989)),va=n(98967);const ga=wn.Ay.div` 367 --assignment-activity-clearance: 16px; 368 position: fixed; 369 /* Never beneath a docked Aurora panel: clearance is 0 unless it is docked. */ 370 right: max(calc(16px + var(--aurora-dock-clearance, 0px)), env(safe-area-inset-right)); 371 transition: right 200ms ease-out; 372 bottom: max(var(--assignment-activity-clearance), env(safe-area-inset-bottom)); 373 z-index: var(--z-dock); 374 display: flex; 375 flex-direction: column; 376 align-items: flex-end; 377 gap: var(--space-2); 378 pointer-events: none; 379 max-width: min(25rem, calc(100vw - 32px)); 380`,fa=wn.Ay.section` 381 pointer-events: auto; 382 min-width: 0; 383 width: 100%; 384 box-sizing: border-box; 385 border-radius: var(--radius-lg); 386 border: 1px solid 387 ${e=>
387{let{$tone:t}=e;return"ok"===t?"var(--success-border)":"error"===t?"var(--danger-border)":"var(--ai-border)"}}; 388 background: var(--surface-1); 389 box-shadow: none; 390 padding: var(--space-3); 391 display: flex; 392 flex-direction: column; 393 gap: var(--space-2); 394`,_a=wn.Ay.div` 395 display: flex; 396 align-items: center; 397 gap: var(--space-2); 398`,ya=wn.i7` 399 to { transform: rotate(360deg); } 400`,ba=wn.Ay.span` 401 display: inline-grid; 402 place-items: center; 403 width: 2rem; 404 height: 2rem; 405 border-radius: var(--radius-pill); 406 flex: 0 0 auto; 407 background: ${e=>{let{$tone:t}=e;return"ok"===t?"var(--success-subtle)":"error"===t?"var(--danger-subtle)":"var(--ai-subtle)"}}; 408 color: ${e=>{let{$tone:t}=e;return"ok"===t?"var(--status-success)":"error"===t?"var(--danger)":"var(--ai)"}}; 409 410 & > .spinning { 411 display: inline-flex; 412 animation: ${ya} 1.1s linear infinite; 413 } 414 415 @media (prefers-reduced-motion: reduce) { 416 html:not([data-motion]) & > .spinning { 417 animation: none; 418 } 419 } 420`,wa=wn.Ay.span` 421 font-weight: 650; 422 color: var(--text-primary); 423 font-size: 0.92rem; 424`,xa=wn.Ay.button` 425 display: inline-grid; 426 place-items: center; 427 width: 1.75rem; 428 height: 1.75rem; 429 border: none; 430 border-radius: var(--radius-sm); 431 background: none; 432 color: var(--text-muted); 433 cursor: pointer; 434 435 &:hover:not(:disabled) { 436 background: var(--hover-overlay); 437 color: var(--text-primary); 438 } 439 440 &:disabled { color: var(--text-disabled); cursor: default; } 441 442 &:focus-visible { 443 outline: none; 444 box-shadow: var(--focus-ring); 445 } 446`,ka=wn.Ay.span` 447 font-size: var(--type-caption); 448 color: var(--text-primary); 449 font-weight: 600; 450 white-space: nowrap; 451 overflow: hidden; 452 text-overflow: ellipsis; 453`,Aa=wn.Ay.span` 454 font-size: var(--type-caption); 455 color: var(--text-muted); 456`,ja=wn.Ay.div` 457 display: flex; 458 align-items: center; 459 flex-wrap: wrap; 460 gap: var(--space-2); 461 margin-top: 2px; 462`,Sa=wn.Ay.button` 463 display: inline-flex; 464 align-items: center; 465 justify-content: center; 466 gap: 6px; 467 height: 2.1rem; 468 padding: 0 var(--space-3); 469 border: none; 470 border-radius: var(--radius-md); 471 background: var(--action-primary-background); 472 color: var(--action-primary-text); 473 font-size: var(--type-caption); 474 font-weight: 650; 475 cursor: pointer; 476 477 &:hover:not(:disabled) { 478 background: var(--action-primary-hover); 479 } 480 481 &:disabled { 482 cursor: default; 483 background: var(--surface-2); 484 color: var(--text-muted); 485 } 486 487 &:focus-visible { 488 outline: none; 489 box-shadow: var(--focus-ring); 490 } 491`,Ca=wn.Ay.button` 492 display: inline-flex; 493 align-items: center; 494 gap: 6px; 495 height: 2.1rem; 496 padding: 0 var(--space-3); 497 border: 1px solid var(--border-default); 498 border-radius: var(--radius-md); 499 background: none; 500 color: var(--text-primary); 501 font-size: var(--type-caption); 502 font-weight: 600; 503 cursor: pointer; 504 505 &:hover:not(:disabled):not([aria-disabled='true']) { 506 background: var(--hover-overlay); 507 } 508 509 &:disabled, &[aria-disabled='true'] { 510 cursor: default; 511 color: var(--text-muted); 512 } 513 514 &:focus-visible { 515 outline: none; 516 box-shadow: var(--focus-ring); 517 } 518`,Ia=(0,wn.Ay)(Rt.PY1.div)` 519 pointer-events: auto; 520 width: min(25rem, calc(100vw - 32px)); 521 max-height: min(35rem, calc(100dvh - var(--assignment-activity-clearance) - 108px)); 522 display: flex; 523 flex-direction: column; 524 overflow: hidden; 525 border: 1px solid var(--border-subtle); 526 border-radius: var(--radius-xl); 527 background: var(--surface-1); 528 box-shadow: var(--shadow-lg); 529 transform-origin: bottom right; 530`,Ea=wn.Ay.div` 531 display: flex; 532 align-items: center; 533 justify-content: space-between; 534 gap: var(--space-2); 535 padding: var(--space-3) var(--space-4); 536 border-bottom: 1px solid var(--border-subtle); 537 background: linear-gradient(115deg, var(--ai-subtle), var(--surface-1)); 538 strong { display: block; font-size: 0.95rem; color: var(--text-primary); } 539 small { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); } 540`,Ra=wn.Ay.div` 541 display: grid; 542 gap: var(--space-2); 543 padding: var(--space-2); 544 overflow-y: auto; 545 overscroll-behavior: contain; 546 min-height: 0; 547`,$a=wn.Ay.div` 548 display: flex; 549 flex-wrap: wrap; 550 align-items: center; 551 justify-content: space-between; 552 gap: var(--space-2); 553 padding: var(--space-2) var(--space-3); 554 border-top: 1px solid var(--border-subtle); 555 color: var(--text-muted); 556 font-size: 0.75rem; 557`,Na=(0,wn.Ay)(Rt.PY1.button)` 558 pointer-events: auto; 559 position: relative; 560 display: inline-flex; 561 align-items: center; 562 gap: 10px; 563 min-height: 52px; 564 padding: 10px 16px; 565 border: 1px solid var(--ai-border); 566 border-radius: var(--radius-pill); 567 background: linear-gradient(120deg, var(--action-primary-background), var(--ai-text)); 568 color: var(--action-primary-text); 569 box-shadow: var(--shadow-lg); 570 cursor: pointer; 571 font-size: 0.85rem; 572 font-weight: 650; 573 &:focus-visible { outline: 3px solid var(--ai); outline-offset: 3px; } 574`,Ta=wn.Ay.span` 575 display: inline-grid; 576 place-items: center; 577 min-width: 24px; 578 height: 24px; 579 padding: 0 5px; 580 box-sizing: border-box; 581 border-radius: var(--radius-pill); 582 background: var(--surface-1); 583 color: var(--text-primary); 584 font-size: 0.75rem; 585 font-variant-numeric: tabular-nums; 586`,La=(0,wn.Ay)(Na)` 587 width: 44px; 588 min-height: 44px; 589 padding: 10px; 590 justify-content: center; 591 gap: 0; 592 flex: 0 0 auto; 593 border-color: transparent; 594 background: var(--surface-1); 595 color: var(--text-secondary); 596 box-shadow: none; 597 &:hover { background: var(--brand-subtle); color: var(--brand); } 598 .activityLabel { display: none; } 599 [data-assignment-count] { 600 position: absolute; 601 top: -3px; 602 right: -3px; 603 min-width: 18px; 604 height: 18px; 605 padding: 0 4px; 606 font-size: 11px; 607 background: var(--ai); 608 color: var(--action-primary-text); 609 } 610`,Oa=wn.Ay.span` 611 position: absolute; 612 width: 1px; 613 height: 1px; 614 overflow: hidden; 615 clip: rect(0 0 0 0); 616 white-space: nowrap; 617`;function Ma(e){var t,n;let{tracked:a,onLater:r}=e;const s=(0,S.Zp)(),[o,l]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),p=(e=>"ready"===e.status?"ok":"busy")(a),h=(0,va.ex)(null!==(t=a.job)&&void 0!==t?t:a.summary),v=(0,va.hk)(null!==(n=a.job)&&void 0!==n?n:a.summary),g=()=>{if(o)return;l(!0);const e=a.assignmentDraftId;e?s(`/assignments/drafts/${encodeURIComponent(e)}/review`):(ha.R.requestResume(a.jobId),s("/assignments")),l(!1)};var f,_;return"processing"===a.status?(0,w.jsxs)(fa,{$tone:p,"aria-label":"Preparing assignment",children:[(0,w.jsxs)(_a,{children:[(0,w.jsx)(ba,{$tone:p,"aria-hidden":"true",children:(0,w.jsx)("span",{className:"spinning",children:(0,w.jsx)(pa.I,{lib:"fi",name:"FiLoader",size:15})})}),(0,w.jsx)(wa,{children:a.stopping?"Stopping preparation\u2026":"Preparing assignment"})]}),(0,w.jsx)(ka,{title:a.filename,children:a.filename}),(0,w.jsx)(Aa,{role:"status",children:null!==(f=a.failure)&&void 0!==f&&f.retryable?"Reconnecting to the latest progress \u2014 your draft is safe.":null!==(_=h.stage_label)&&void 0!==_?_:"Preparing\u2026"}),(0,w.jsx)(ja,{children:(0,w.jsxs)(Ca,{type:"button",onClick:g,children:[(0,w.jsx)(pa.I,{lib:"fi",name:"FiEye",size:13})," Set up assignment"]})})]}):"ready"===a.status?(0,w.jsxs)(fa,{$tone:p,"aria-label":"Assignment draft ready",children:[(0,w.jsxs)(_a,{children:[(0,w.jsx)(ba,{$tone:p,"aria-hidden":"true",children:(0,w.jsx)(pa.I,{lib:"fi",name:"FiCheckCircle",size:16})}),(0,w.jsx)(wa,{children:"Your assignment draft is ready"})]}),(0,w.jsx)(ka,{title:a.filename,children:a.filename}),v&&(0,w.jsx)(Aa,{children:v}),(0,w.jsxs)(ja,{children:[(0,w.jsx)(Sa,{type:"button",onClick:g,disabled:o,children:o?"Opening\u2026":(0,w.jsxs)(w.Fragment,{children:["Review draft ",(0,w.jsx)(pa.I,{lib:"fi",name:"FiArrowRight",size:13})]})}),a.hidden?(0,w.jsx)(Aa,{children:"Saved for later"}
617):(0,w.jsx)(Ca,{type:"button",onClick:r,children:"Later"})]})]}):(0,w.jsxs)(fa,{$tone:p,"aria-label":"Assignment preparation needs attention",children:[(0,w.jsxs)(_a,{children:[(0,w.jsx)(ba,{$tone:p,"aria-hidden":"true",children:(0,w.jsx)(pa.I,{lib:"fi",name:"FiRefreshCw",size:15})}),(0,w.jsx)(wa,{children:"cancelled"===a.status?"Preparation stopped":"Preparation needs your attention"})]}),(0,w.jsx)(ka,{title:a.filename,children:a.filename}),(0,w.jsx)(Aa,{children:"Your draft and original file are safe. You can prepare it again or choose another file."}),u&&(0,w.jsx)(Aa,{role:"status",children:u}),(0,w.jsxs)(ja,{children:[(0,w.jsx)(Sa,{type:"button",onClick:()=>{(async()=>{if(!c){d(!0),m(null);try{await ha.R.retryFromFile(a.jobId)||g()}catch(e){"DRAFT_SOURCE_CHANGED"===(null===e||void 0===e?void 0:e.code)||"EXTRACTION_STILL_RUNNING"===(null===e||void 0===e?void 0:e.code)?g():m("We couldn\u2019t restart it just yet. Open the draft for the next safe option.")}finally{d(!1)}}})()},disabled:c,children:c?"Restarting\u2026":"Prepare again"}),(0,w.jsx)(Ca,{type:"button",onClick:g,children:"View details"}),a.hidden?(0,w.jsx)(Aa,{children:"Saved for later"}):(0,w.jsx)(Ca,{type:"button",onClick:r,children:"Later"})]})]})}function Ua(){var e,t;let{launcherHost:n=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=(0,Ii.JT)("assignments.edit"),r=(0,Je.Um)(),s=a&&null!==r&&void 0!==r&&r.user.id&&r.activeOrganisationId?`${r.user.id}:${r.activeOrganisationId}:${(0,rt.yk)()||""}`:null,o=(0,S.zy)(),l=function(e,t){const[n,a]=(0,i.useState)(16);return(0,i.useEffect)(()=>{if(!t)return;let e=null;const n="undefined"===typeof ResizeObserver?null:new ResizeObserver(()=>s()),i=new Set,r=()=>{var t;e=null;let r=16;const s=(null===(t=document.querySelector("[data-assignment-activity-launcher]"))||void 0===t?void 0:t.getBoundingClientRect().height)||48,o=window.innerHeight-s-32;document.querySelectorAll("[data-workspace-action-footer]").forEach(e=>{i.has(e)||(i.add(e),null===n||void 0===n||n.observe(e));const t=e.getBoundingClientRect();t.height>0&&t.bottom>o&&t.top<window.innerHeight&&!e.closest('[hidden], [inert], [aria-hidden="true"]')&&(r=Math.max(r,Math.ceil(window.innerHeight-t.top+16)))}),a(r)},s=()=>{null===e&&(e=window.requestAnimationFrame(r))},o=new MutationObserver(s);return o.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),r(),()=>{null!==e&&window.cancelAnimationFrame(e),o.disconnect(),null===n||void 0===n||n.disconnect(),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[t,e]),n}(o.pathname,Boolean(s)),c=(0,Rt.IbK)(),d=(0,i.useRef)(null),u=(0,i.useRef)(null),[m,p]=(0,i.useState)(!1),[v,g]=(0,i.useState)(0),f=(0,i.useSyncExternalStore)(ha.R.subscribe,ha.R.getSnapshot),_=(0,i.useSyncExternalStore)(ha.R.subscribe,ha.R.getUiSnapshot),y=(0,i.useSyncExternalStore)(ha.R.subscribe,ha.R.getSyncSnapshot);(0,i.useLayoutEffect)(()=>{var e,t;_.minimized||document.activeElement!==d.current||(null===(e=u.current)||void 0===e||null===(t=e.querySelector("button"))||void 0===t||t.focus())},[_.minimized,m]),(0,i.useEffect)(()=>{ha.R.setScope(s),s&&ha.R.syncFromServer()},[s]);const b=()=>{var e;ha.R.setMinimized(!0),null===(e=d.current)||void 0===e||e.focus()};if(!a||!ha.R.matchesScope(s))return null;const x=(null===(e=o.pathname.match(/^\/assignments\/drafts\/([^/]+)\/review\/?$/))||void 0===e?void 0:e[1])||(null===(t=o.pathname.match(/^\/assignments\/(acd_[^/]+)\/(?:edit|preview)\/?$/))||void 0===t?void 0:t[1]),k=f.filter(e=>!x||e.assignmentDraftId!==decodeURIComponent(x));if(0===k.length&&!y.error)return null;const A=k.filter(e=>m||!e.hidden),j=Math.ceil(A.length/2),C=Math.min(v,Math.max(0,j-1)),I=A.slice(2*C,2*C+2),E=!_.minimized&&(A.length>0||y.error),R=k.filter(e=>"processing"===e.status).length,$=k.filter(e=>"ready"===e.status).length,N=k.filter(e=>"failed"===e.status||"cancelled"===e.status).length,T=[R?`${R} preparing`:"",$?`${$} ready`:"",N?`${N} ${1===N?"needs":"need"} attention`:"","loading"===y.status?"Refreshing activity\u2026":y.error?"Refresh needed":""].filter(
617Boolean).join(" \xb7 "),L=e=>{"Escape"===e.key&&E&&(e.stopPropagation(),b())},O=n?La:Na,M=(0,w.jsxs)(O,{ref:d,"data-assignment-activity-launcher":!0,type:"button","aria-label":E?"Collapse assignment activity":"Show assignment activity","aria-expanded":E,"aria-controls":E?"assignment-activity-panel":void 0,"aria-describedby":"assignment-activity-status",title:`Assignment activity: ${T}`,whileHover:c||n?void 0:{y:-2},whileTap:c?void 0:{scale:.97},onKeyDown:L,onClick:()=>{E?b():(p(!0),g(0),ha.R.setMinimized(!1))},children:[(0,w.jsx)(Rt.PY1.span,{"aria-hidden":"true",animate:c?void 0:{rotate:[0,-12,10,-5,0]},transition:{duration:.55},children:(0,w.jsx)(pa.I,{lib:"fi",name:y.error?"FiAlertCircle":n?"FiLayers":"FiBell",size:20})},T),(0,w.jsx)("span",{className:"activityLabel",children:"Activity"}),k.length>0&&(0,w.jsx)(Ta,{"data-assignment-count":!0,"aria-label":`${k.length} assignments`,children:k.length})]});return(0,w.jsxs)(w.Fragment,{children:[n&&(0,h.createPortal)(M,n),(0,h.createPortal)((0,w.jsxs)(ga,{"data-modal-background":"",style:{"--assignment-activity-clearance":`${l}px`},"aria-label":"Assignment activity",role:"region",onKeyDown:L,children:[(0,w.jsx)(Rt.Nyo,{initial:!1,children:E&&(0,w.jsxs)(Ia,{ref:u,id:"assignment-activity-panel",initial:{opacity:0,y:c?0:12,scale:c?1:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:c?0:8,scale:c?1:.97},transition:{duration:c?0:.2},children:[(0,w.jsxs)(Ea,{children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("strong",{children:"Assignment activity"}),(0,w.jsx)("small",{children:T})]}),(0,w.jsxs)(Ca,{type:"button",onClick:b,children:[(0,w.jsx)(pa.I,{lib:"fi",name:"FiChevronsDown",size:14})," Collapse all"]})]}),(0,w.jsxs)(Ra,{children:[y.error&&(0,w.jsxs)(fa,{$tone:"error","aria-label":"Assignment activity refresh",children:[(0,w.jsx)(wa,{children:"Activity could not be refreshed"}),(0,w.jsx)(Aa,{role:"alert",children:k.length>0?"Saved activity remains available, but it may be out of date.":"Try again to load your assignment activity."}),null!==y.lastUpdatedAt&&(0,w.jsxs)(Aa,{children:["Last refreshed ",new Date(y.lastUpdatedAt).toLocaleString()]})]}),I.map(e=>(0,w.jsx)(Ma,{tracked:e,onLater:()=>{ha.R.hideCompleted(e.jobId),(m||1===A.length)&&b()}},e.jobId))]}),(0,w.jsxs)($a,{children:[A.length>0&&(0,w.jsxs)("span",{"aria-live":"polite",children:[2*C+1,"\u2013",Math.min(2*C+2,A.length)," of ",A.length]}),(0,w.jsx)(Ca,{type:"button","aria-disabled":"loading"===y.status,"aria-busy":"loading"===y.status,onClick:()=>{"loading"!==y.status&&ha.R.syncFromServer({force:!0})},children:"loading"===y.status?"Refreshing\u2026":y.error?"Try again":"Refresh activity"}),!m&&k.some(e=>e.hidden)&&(0,w.jsx)(Ca,{type:"button",onClick:()=>{p(!0),g(0)},children:"View saved"}),j>1&&(0,w.jsxs)("div",{children:[(0,w.jsx)(xa,{type:"button","aria-label":"Previous activities",disabled:0===C,onClick:()=>g(C-1),children:(0,w.jsx)(pa.I,{lib:"fi",name:"FiArrowLeft",size:16})}),(0,w.jsx)(xa,{type:"button","aria-label":"Next activities",disabled:C===j-1,onClick:()=>g(C+1),children:(0,w.jsx)(pa.I,{lib:"fi",name:"FiArrowRight",size:16})})]})]})]},"activity-panel")}),!n&&M,(0,w.jsx)(Oa,{id:"assignment-activity-status",role:"status","aria-live":"polite",children:R>0?`Preparing ${R} assignment${1===R?"":"s"}`:T})]}),document.body)]})}var Pa=n(8340);const qa="HyqpQBGw",Da=()=>(0,Pa.Jb)()?(0,w.jsxs)("div",{className:qa,role:"status","aria-live":"polite",children:[(0,w.jsx)("strong",{children:"Local assessment mock mode"}),(0,w.jsx)("span",{children:"Structured assignments and attempts stay in this browser. Nothing is being saved to Aries."})]}):null;var za=n(22056),Ba=n(22199),Fa=n(47759),Wa=n(83718),Ha=n(13709),Va=n(63228),Ya=n(4912),Ga=n(6487),Ja=n(87780),Ka=n(77104),Xa=n(44330),Za=n(21676),Qa=n(27507),er=n(6386),tr=n(27532);const nr=(0,i.lazy)(()=>Promise.all([n.e(6390),n.e(800),n.e(8657),n.e(5187),n.e(9417)]).then(n.bind(n,22939))),ir=(0,i.lazy)(()=>n.e(8981).then(n.bind(n,39574))),ar=e=>{var t,n,a,r,s,o,l,c,d;let{actorId:u,actorRole:m,disabledReason:p,hideLauncher:v=!1,launcherHost:g}=e;const f=(0,S.Zp)(),_=(0,Qa.M)(),y=p||_.reason,b=(0,i.useRef)(y);b.current=y;const[x,k]=(0,i.useState)(!1),A=(0,Je.Ok)(),{context:j,prepareContext:C,clearSelection:I}=(0,Ya.KF)(),{execute:E}
617=(0,Va.wS)(),R=(0,Xa.sv)(),$=R.dismiss_presence,N=null!==(t=(0,Ha.Y)(null!==m&&void 0!==m?m:null))&&void 0!==t?t:"learner",T=(0,Ga.S7)(`${u||"anon"}:${N}:${(null===A||void 0===A?void 0:A.id)||"org"}:${(null===j||void 0===j||null===(n=j.workspace)||void 0===n?void 0:n.centre_id)||"centre"}`),[L,O]=(0,i.useState)(!1),[M,U]=(0,i.useState)(!1),[P,q]=(0,i.useState)(!1),[D,z]=(0,i.useState)("chat"),B=(0,i.useRef)(null),F=(0,i.useRef)(!1),W=(0,i.useRef)(!1),H=(0,i.useRef)(T);H.current=T;const V=(0,i.useRef)(!0);(0,i.useEffect)(()=>(V.current=!0,()=>{V.current=!1}),[]);const Y=(0,i.useRef)(null),G=(0,i.useCallback)(()=>{var e;(0,tr.nq)(),$(),O(!1),U(!1),q(!1),null===(e=B.current)||void 0===e||e.focus()},[$]),J=(0,i.useCallback)(e=>{E(e).executed&&"logout"===e.action&&G()},[G,E]),K=(0,i.useCallback)(e=>{var t,n;if(null!==(t=e.refresh)&&void 0!==t&&t.length)return;if(!(Boolean(null===(n=e.undo)||void 0===n?void 0:n.assessment_draft_id)||(e.affected_entities||[]).some(e=>["assessment_draft","question_group","question_part","response_block","assessment_resource"].includes(e.type))))return;const i={action_id:`assessment-refresh:${e.command_id}`,action:"invalidate_view",targets:["assessment-studio","assignment-outline","question-canvas"]};window.dispatchEvent(new CustomEvent(Va.fy,{detail:i}))},[]),X=(0,Ga.q3)(T,{onClientAction:J,onMutationReceipt:K,prepareSemanticTurn:R.prepare_turn,onSemanticEvent:R.handle_stream_event,onStopSemantic:R.stop,legacyConfirmationAllowed:R.flags.legacy_bridge});(0,i.useEffect)(()=>{const e=()=>{y||(z("chat"),U(!1),O(!0))};return window.addEventListener(Ka.VW,e),()=>window.removeEventListener(Ka.VW,e)},[y]),(0,i.useEffect)(()=>{const e=e=>{var t,n,i;const a=e;if(!a.detail)return void a.preventDefault();const r=null===(t=a.detail)||void 0===t||null===(n=t.prompt)||void 0===n?void 0:n.trim();if(!r||r.length>4e3||y||X.state.streaming||X.state.locked||X.state.legacyConfirmation||W.current||null!==(i=a.detail.signal)&&void 0!==i&&i.aborted)return a.detail.rejectionReason=y||(r&&r.length>4e3?"This text is too long for a single request. Ask Aurora about a shorter selection.":X.state.locked?"Your workspace context changed. Start a new Aurora conversation.":"Finish or stop the active Aurora request, then try again."),void a.preventDefault();W.current=!0,a.detail.accepted=(async()=>{try{var e,t,n,i;if(a.detail.semanticRequired&&!R.available){let e=!1;try{e=await R.ensure_available()}catch{return a.detail.rejectionReason="Aurora could not check its availability. Check your connection and try again.",W.current=!1,!1}if(!e)return a.detail.rejectionReason="In-page Aurora could not start. Try again, or reload the page to reconnect.",W.current=!1,!1}if(b.current||null!==(e=a.detail.signal)&&void 0!==e&&e.aborted||!V.current||H.current!==T)return W.current=!1,!1;const s=await C(null!==(t=a.detail.pageContext)&&void 0!==t?t:j);if(!s||b.current||null!==(n=a.detail.signal)&&void 0!==n&&n.aborted||!V.current||H.current!==T)return a.detail.rejectionReason="Check that your changes are saved and this workspace is still open, then try again.",W.current=!1,!1;z("chat"),U(!1),O(!0);const o=()=>{X.stopGeneration()};return null===(i=a.detail.signal)||void 0===i||i.addEventListener("abort",o,{once:!0}),X.send(r,s,{semantic_required:a.detail.semanticRequired}).then(e=>{var t,n;return null===(t=(n=a.detail).onComplete)||void 0===t?void 0:t.call(n,V.current&&H.current===T?e:null)},()=>{var e,t;return null===(e=(t=a.detail).onComplete)||void 0===e?void 0:e.call(t,null)}).finally(()=>{var e;null===(e=a.detail.signal)||void 0===e||e.removeEventListener("abort",o),W.current=!1}),!0}catch{return a.detail.rejectionReason="Your changes could not be prepared. Check the save status, then try again.",W.current=!1,!1}})()};return window.addEventListener(Ka.v0,e),()=>window.removeEventListener(Ka.v0,e)},[j,X,y,C,T,R]),(0,i.useEffect)(()=>(O(!1),k(!1),U(!1),q(!1),z("chat"),()=>{(0,tr.nq)()}),[T]),(0,i.useEffect)(()=>{k(!1),y&&((0,tr.nq)(),O(!1),U(!1),q(!1),X.stopGeneration())},[y]),(0,i.useEffect)(()=>{const e=F.current,t=[...X.state.messages].reverse().find(e=>"assistant"===e.role);X.state.streaming?q(!1):e&&M&&"complete"===(null===t||void 0===t?void 0:t.status)&&(q(!0),Y.current&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>q(!1),8e3)),F.current=X.state.streaming},[X.state.messages,X.state.streaming,M]),(0,i.useEffect)(()=>()=>{Y.current&&window.clearTimeout(Y.current)},[]),(0,i.useEffect)(()=>{L&&X.refreshHistory()},[L]);const Z=(0,i.useMemo)(()=>
617j?(0,Ya.u9)(j):"Workspace",[j]),Q=null===(a=X.state.activeConversation)||void 0===a?void 0:a.id,ee=(0,w.jsxs)("button",{ref:B,type:"button",className:`${Za.A.launcher}${L?` ${Za.A.launcherActive}`:""}`,"aria-haspopup":"dialog","aria-expanded":L||x,"aria-label":y?"Why is Aurora unavailable?":"Open Aurora",title:y||"Open Aurora","data-unavailable":Boolean(y)||void 0,"data-testid":"aurora-launcher","data-working":X.state.streaming||void 0,onClick:()=>{y?k(!0):L?G():(U(!1),O(!0))},children:[(0,w.jsx)("span",{className:Za.A.launcherMark,"aria-hidden":"true",children:(0,w.jsx)(ui.A,{size:14,strokeWidth:1.8})}),(0,w.jsx)("span",{className:Za.A.launcherLabel,children:"Aurora"}),y&&(0,w.jsx)(za.A,{size:12,"aria-hidden":"true"}),X.state.streaming&&(0,w.jsx)("span",{className:Za.A.srOnly,children:"Working"})]});return(0,w.jsxs)("div",{className:Za.A.launcherSlot,children:[!v&&(void 0===g?ee:g?(0,h.createPortal)(ee,g):null),x&&y&&(0,w.jsx)(st.A,{label:"Aurora availability",size:"compact",onDismiss:()=>k(!1),children:(0,w.jsx)(er.A,{access:p?{..._,reason:p}:_,onClose:()=>k(!1)})}),!y&&(0,w.jsx)(Ja.A,{open:L,onClose:G,minimized:M,onMinimize:()=>{U(e=>!e),q(!1)},activityState:X.state.streaming?"working":P?"complete":X.state.error?"error":"idle",activityLabel:X.state.statusLabel,activityContext:"workspace",ariaLabel:"Aurora assistant",contextChip:"assessment_draft"===(null===j||void 0===j||null===(r=j.entity)||void 0===r?void 0:r.entity_type)&&"assessment_draft"===(null===(s=j.focused_element)||void 0===s?void 0:s.entity_type)?"This assignment":"response_block"===(null===j||void 0===j||null===(o=j.focused_element)||void 0===o?void 0:o.entity_type)?"Selected response":Z,contextDetail:"string"===typeof(null===j||void 0===j||null===(l=j.view)||void 0===l||null===(c=l.filters)||void 0===c?void 0:c.document_title)?j.view.filters.document_title:void 0,onClearSelection:"assessment_draft"===(null===j||void 0===j||null===(d=j.entity)||void 0===d?void 0:d.entity_type)&&j.focused_element&&"assessment_draft"!==j.focused_element.entity_type?I:void 0,headerTools:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("button",{type:"button",className:Za.A.headerTool,"aria-label":"New chat",title:"New chat",onClick:()=>{z("chat"),X.openConversation(null)},children:(0,w.jsx)(Ba.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)("button",{type:"button",className:Za.A.headerTool,"aria-label":"history"===D?"Back to conversation":"Conversation history",title:"history"===D?"Back to conversation":"Conversation history","aria-pressed":"history"===D,onClick:()=>z(e=>"history"===e?"chat":"history"),children:(0,w.jsx)(Fa.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})}),(0,w.jsx)("button",{type:"button",className:Za.A.headerTool,"aria-label":"Open full screen",title:"Open full screen",onClick:()=>{O(!1),f(Q?`/aurora?c=${encodeURIComponent(Q)}`:"/aurora")},children:(0,w.jsx)(Wa.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"})})]}),children:(0,w.jsx)(i.Suspense,{fallback:(0,w.jsx)("p",{role:"status",children:"Loading Aurora\u2026"}),children:"history"===D?(0,w.jsx)(ir,{controller:X,onOpenConversation:e=>{z("chat"),X.openConversation(e)},onNewConversation:()=>{z("chat"),X.openConversation(null)}}):(0,w.jsx)(nr,{controller:X,scopeKey:T,role:N,pageContext:j,preparePageContext:C,autoFocusComposer:!0,onNavigate:G})})})]})};function rr(e){let{sx:t,disableEnforceFocus:n,...i}=e;const a=(0,Xa.yI)();return(0,w.jsx)(un.A,{...i,disableEnforceFocus:n||Boolean(null===a||void 0===a?void 0:a.activity.confirmation),sx:[{zIndex:"var(--z-modal-popover)"},...Array.isArray(t)?t:t?[t]:[]]})}const sr=e=>{let{scopeKey:t,children:n}=e;const{execute:a}=(0,Va.wS)(),r=(0,i.useCallback)(e=>{var t,n;if(null!==(t=e.refresh)&&void 0!==t&&t.length)return;(Boolean(null===(n=e.undo)||void 0===n?void 0:n.assessment_draft_id)||(e.affected_entities||[]).some(e=>["assessment_draft","question_group","question_part","response_block","assessment_resource"].includes(e.type)))&&window.dispatchEvent(new CustomEvent(Va.fy,{detail:{action_id:`assessment-refresh:${e.command_id}`,action:"invalidate_view",targets:["assessment-studio","assignment-outline","question-canvas"]}}))},[]),s=(0,Ga.mh)(t,{onClientAction:a,onMutationReceipt:r}),o=(0,i.useMemo)(()=>({scopeKey:t,controller:s}),[s,t]);return(0,w.jsx)(Ga.aG.Provider,{value:o,children:n})};var or=n(40636),lr=n(38238);const cr=e=>{let{surfaceRef:t,children:n}=e;return(0,w.jsx)("div",{ref:t,className:zi,"data-motion-surface":"route","data-assessment-mode":"protected",children:n})},dr=e=>{let{results:t=!1,assignmentScoped:n=!1}
617=e;return(0,w.jsx)("nav",{className:Ji,"aria-label":t?"Results navigation":"Assessment navigation",children:(0,w.jsxs)("ol",{children:[(!t||n)&&(0,w.jsx)("li",{children:(0,w.jsx)(C.N_,{to:t?"/results":"/assignments",children:t?"Results":"Assignments"})}),(0,w.jsxs)("li",{children:[(!t||n)&&(0,w.jsx)(fn.A,{size:14,"aria-hidden":"true"}),(0,w.jsx)("span",{"aria-current":"page",children:t?n?"Assessment results":"Results":"Assessment"})]})]})})};var ur=n(9151),mr=n(42860);const pr=e=>{var t,n;if("message.received"!==e.eventType)return null;const i="string"===typeof(a=null!==(t=e.payload.conversation_id)&&void 0!==t?t:e.payload.conversationId)||"number"===typeof a?String(a).trim():"";var a;if(i)return i;const r=null===(n=e.actionUrl)||void 0===n?void 0:n.match(/^\/communications\/conversations\/([^/?#]+)/);if(!r)return null;try{return decodeURIComponent(r[1])}catch{return r[1]}},hr=(e,t)=>{const n=pr(e);return!!n&&t===`/communications/conversations/${encodeURIComponent(n)}`};Ui().extend(qi());const vr=(0,i.lazy)(()=>Promise.all([n.e(3418),n.e(3138),n.e(8596),n.e(3708),n.e(5473),n.e(7098)]).then(n.bind(n,94343))),gr=(0,Rt.PY1)(gt.A),fr=(0,ft.A)(_t.A)` 618 transition: transform 0.18s ease; 619 &:hover { 620 transform: scale(1.05); 621 } 622`;const _r=()=>{const e=(0,yt.A)(),t=(0,bt.A)(e.breakpoints.down("md")),n=(0,v.wA)(),a=(0,S.zy)(),r=(0,i.useRef)(null),s=Yt(a.pathname),o=(0,ur.NK)(a.pathname)||Ht(a.pathname),l=(0,S.wQ)();(0,i.useLayoutEffect)(()=>{"POP"!==l&&r.current&&(r.current.scrollTop=0)},[a.pathname]);const[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(null),[f,_]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null),[x,k]=(0,i.useState)(null),[A,j]=(0,i.useState)(null),[C,I]=(0,i.useState)(!1),E=(0,i.useRef)(null),R=(0,S.Zp)(),$=(0,v.d4)(e=>e.auth.user),N=(0,mr.G)(Boolean(null===$||void 0===$?void 0:$.id)),T=(0,i.useRef)(null),L=(0,i.useRef)($);L.current=$,(0,i.useEffect)(()=>function(){let e;const t=e=>{const t=e.target instanceof Element?e.target.closest("a[href]"):null;if(!(t instanceof HTMLAnchorElement)||t.hasAttribute("download")||"_blank"===t.target)return null;try{const e=new URL(t.href,window.location.href);return e.origin!==window.location.origin||e.pathname===window.location.pathname?null:e.pathname}catch{return null}},n=e=>{const n=t(e);n&&Wt(n)},i=n=>{clearTimeout(e);const i=t(n);i&&(e=setTimeout(()=>Wt(i),80))},a=()=>clearTimeout(e);return document.addEventListener("pointerover",i),document.addEventListener("pointerout",a),document.addEventListener("focusin",n),document.addEventListener("pointerdown",n,{passive:!0}),()=>{clearTimeout(e),document.removeEventListener("pointerover",i),document.removeEventListener("pointerout",a),document.removeEventListener("focusin",n),document.removeEventListener("pointerdown",n)}}(),[]),(0,i.useEffect)(()=>{const e=e=>{const t=e.detail;"open_modal"===t.action&&"profile"===t.modal?_(!0):"open_modal"===t.action&&"notifications"===t.modal?m(E.current):"close_modal"===t.action&&(t.modal&&"profile"!==t.modal||_(!1),t.modal&&"notifications"!==t.modal||m(null))};return window.addEventListener(Va.fy,e),()=>window.removeEventListener(Va.fy,e)},[]);const O=(0,i.useRef)(0),M=(0,i.useCallback)(async()=>{const e=L.current,t=Oi(e);if(!t)return;const i=++O.current,a={userId:t,token:localStorage.getItem("edumrk_dv_ath"),featureScope:(0,rt.N7)(),generation:i};try{const e=await(0,Ti.G)(`https://systems.aries.edumark.ai/user/${t}`);if(null===e||void 0===e||!e.data)return;if(!((e,t)=>e.generation===t.generation&&e.userId===t.userId&&e.token===t.token&&e.featureScope===t.featureScope)(a,{userId:Oi(L.current),token:localStorage.getItem("edumrk_dv_ath"),featureScope:(0,rt.N7)(),generation:O.current}))return;n((0,Li.lt)(((e,t)=>{var n,i,a,r,s,o,l,c,d;const u=Oi(t)||Oi(e),m=null!==(n=null!==(i=null!==(a=null!==(r=null===t||void 0===t?void 0:t.role)&&void 0!==r?r:null===t||void 0===t?void 0:t.userType)&&void 0!==a?a:null===e||void 0===e?void 0:e.role)&&void 0!==i?i:null===e||void 0===e?void 0:e.userType)&&void 0!==n?n:"learner",p={...t,...e,id:u,_id:null!==(s=null!==(o=null===t||void 0===t?void 0:t._id)&&void 0!==o?o:null===t||void 0===t?void 0:t.id)&&void 0!==s?s:u,role:m,userType:null!==(l=null!==(c=null!==(d=null===t||void 0===t?void 0:t.userType)&&void 0!==d?d:null===t||void 0===t?void 0:t.role)&&void 0!==c?c:null===e||void 0===e?void 0:e.userType)&&void 0!==l?l:null===e||void 0===e?void 0:e.role},h=["roles","permissions","activeContext","active_context","availableContexts","available_contexts","tenant_context","tenantContext","current_membership","currentMembership","membership","membershipId","org_id","orgId","organisation_id","organisationId","organization_id","organizationId","centre_id","centreId","center_id","centerId","centre_ids","centreIds","center_ids","centerIds","solUserId"];for(const v of h)t&&Object.prototype.hasOwnProperty.call(t,v)?p[v]=t[v]:delete p[v];return p})(e.data,L.current)))}catch(r){console.error("Failed to refresh current user:",r)}},[n]);(0,i.useEffect)(()=>{null!==$&&void 0!==$&&$.id&&M()},[M,null===$||void 0===$?void 0:$.id]),(0,i.useEffect)(()=>()=>{O.current+=1},[]),(0,i.useEffect)(()=>{T.current=null},[null===$||void 0===$?void 0:$.id]),(0,i.useEffect)(()=>
622{if(N.loading)return;if(!T.current)return void(T.current=new Set(N.items.map(e=>e.id)));const e=((e,t,n)=>{const i=[];for(const a of e){const e=!t.has(a.id);t.add(a.id),!e||a.isRead||"message.received"!==a.eventType||hr(a,n)||i.push(a)}return i})(N.items,T.current,a.pathname);for(const t of e)g.oR.info(t.body?`${t.title}: ${t.body}`:t.title,{toastId:`incoming-message:${t.id}`,onClick:()=>{N.markRead(t.id).catch(()=>{}),t.actionUrl&&R(t.actionUrl)}})},[a.pathname,R,N]);const U=(0,i.useMemo)(()=>{return null!==$&&void 0!==$&&$.id?`https://systems.aries.edumark.ai/user/avatar/${$.id}`:null!==$&&void 0!==$&&$.avatarChunkData?`data:image/webp;base64,${$.avatarChunkData}`:null!==$&&void 0!==$&&$.avatarFile?`https://systems.aries.edumark.ai${$.avatarFile}`:(e=null===$||void 0===$?void 0:$.email,t=null===$||void 0===$?void 0:$.id,`https://api.dicebear.com/7.x/identicon/svg?seed=${encodeURIComponent(e||t||"user")}`);var e,t},[null===$||void 0===$?void 0:$.id,null===$||void 0===$?void 0:$.avatarChunkData,null===$||void 0===$?void 0:$.avatarFile,null===$||void 0===$?void 0:$.email]),P=(0,i.useMemo)(()=>{const e=new Map;for(const t of N.items){const n=String(t.id),i=e.get(n);i?(i.count+=1,i.unread=i.unread||!t.isRead,i.ids.push(t.id),String(t.createdAt)>String(i.latest.createdAt)&&(i.latest=t)):e.set(n,{latest:t,count:1,unread:!t.isRead,ids:[t.id]})}return Array.from(e.values()).sort((e,t)=>String(e.latest.createdAt)<String(t.latest.createdAt)?1:-1)},[N.items]),q=P.filter(e=>e.unread).length,D=Ht(a.pathname),z=(B=a.pathname,/^\/marking\/cases\/[^/]+(?:\/|$)/.test(B));var B;const[F,W]=(0,i.useState)(!1),H=(0,ur.NK)(a.pathname),V=(e=>/^\/assignments\/(?!new\/?$|drafts\/?$|corrections\/?$|communications\/?$)[^/]+\/?$/.test(e)||/^\/results\/?$/.test(e))(a.pathname),Y=()=>m(null),G=(0,w.jsx)(Ni,{resetKey:a.pathname,children:(0,w.jsxs)(i.Suspense,{fallback:(0,w.jsx)(Lt,{}),children:[(0,w.jsx)(S.sv,{}),(0,w.jsx)($t.V3,{surfaceRef:r,routeKey:s,workspace:o})]})});return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ar,{launcherHost:y,hideLauncher:D||C,actorId:(null===$||void 0===$?void 0:$.id)||(null===$||void 0===$?void 0:$._id),actorRole:(null===$||void 0===$?void 0:$.role)||(null===$||void 0===$?void 0:$.userType)}),D?(0,w.jsx)(cr,{surfaceRef:r,children:G}):(0,w.jsx)(ur.bt,{target:x,onAuroraAvailabilityChange:I,children:(0,w.jsxs)("div",{className:Di,"data-frontend-commit":"9e1db5af8910c544610941b7e039980bae8a77c5","data-frontend-build":"unknown",children:[!(z&&F)&&(0,w.jsx)(Ri,{isOpen:c,onToggleSidebar:()=>d(e=>!e),onOpenProfile:()=>_(!0)}),(0,w.jsxs)("div",{className:`${Bi} ${H?la:""} ${z?ua:""}`,"data-modal-scroll-region":H?"":void 0,children:[(0,w.jsx)(gr,{"data-aurora-app-chrome":"true",position:"sticky",className:Fi,elevation:0,initial:!1,children:(0,w.jsxs)(wt.A,{className:`${Wi} ${H?Hi:""} ${V?sa:""}`,children:[t&&!(z&&F)&&(0,w.jsx)(xt.A,{edge:"start","aria-label":"Open navigation",onClick:()=>d(e=>!e),className:Yi,children:(0,w.jsx)(Kt.A,{size:20,strokeWidth:1.8,"aria-hidden":"true"})}),H?(0,w.jsx)("div",{className:Vi,ref:k}):V?(0,w.jsx)(dr,{results:/^\/results\/?$/.test(a.pathname),assignmentScoped:Boolean(new URLSearchParams(a.search).get("assignment"))}):(0,w.jsx)("div",{className:Gi}),void 0,z&&(0,w.jsx)(ot.A,{title:F?"Show navigation":"Focus on marking",children:(0,w.jsx)(xt.A,{"aria-label":F?"Show navigation":"Focus on marking","aria-pressed":F,onClick:()=>{W(e=>!e),d(!1)},children:F?(0,w.jsx)(Zt,{size:19,"aria-hidden":"true"}):(0,w.jsx)(Qt,{size:19,"aria-hidden":"true"})})}),(0,w.jsx)(ht,{}),(0,w.jsx)("div",{className:ca,ref:b}),(0,w.jsx)("div",{className:Ki,ref:j}),(0,w.jsx)(ma.A,{}),(0,w.jsx)(ot.A,{title:"Notifications",children:(0,w.jsx)(xt.A,{ref:E,onClick:e=>{m(e.currentTarget),N.refresh()},"aria-label":q>0?`Open notifications, ${q} unread`:"Open notifications",children:(0,w.jsx)(kt.A,{badgeContent:q,color:"error",children:(0,w.jsx)("span",{className:Xi,"aria-hidden":"true",children:(0,w.jsx)(en.A,{size:20,strokeWidth:1.8})})})})}),(0,w.jsxs)(rr,{anchorEl:u,open:Boolean(u),onClose:Y,classes:{paper:Zi}
622,children:[(0,w.jsxs)("div",{className:Qi,children:[(0,w.jsx)(At.A,{variant:"subtitle1",children:"Notifications"}),q>0&&(0,w.jsx)(jt.A,{size:"small",onClick:async()=>{await N.markAllRead().catch(()=>{})},children:"Mark all read"})]}),(0,w.jsx)(St.A,{}),(0,w.jsxs)(Ct.A,{disablePadding:!0,className:ea,children:[N.loading&&0===P.length&&(0,w.jsx)(It.A,{disabled:!0,children:"Loading notifications\u2026"}),N.error&&0===P.length&&(0,w.jsx)(It.A,{disabled:!0,children:N.error}),!N.loading&&!N.error&&0===P.length&&(0,w.jsx)(It.A,{disabled:!0,children:"No notifications"}),P.map(e=>(0,w.jsx)(It.A,{onClick:()=>(async(e,t)=>{await Promise.all(e.map(e=>N.markRead(e))).catch(()=>{}),Y(),t&&R(t)})(e.ids,e.latest.actionUrl||""),className:e.unread?ta:na,children:(0,w.jsx)(Et.A,{primary:e.count>1?`${e.latest.title} (\xd7${e.count})`:e.latest.title,secondary:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(At.A,{component:"span",variant:"body2",color:"textSecondary",children:e.latest.body}),(0,w.jsx)(At.A,{component:"div",variant:"caption",color:"textDisabled",children:Ui()(e.latest.createdAt).fromNow()})]})})},e.latest.id))]})]}),(0,w.jsx)(ot.A,{title:"Account",children:(0,w.jsx)(xt.A,{"aria-label":"Open profile menu","data-tour":"profile-menu",onClick:e=>{e.stopPropagation(),h(e.currentTarget)},children:(0,w.jsx)(fr,{src:U,alt:(null===$||void 0===$?void 0:$.name)||"User"})})}),(0,w.jsxs)(rr,{anchorEl:p,open:Boolean(p),onClose:()=>h(null),children:[(0,w.jsx)(It.A,{onClick:()=>{h(null),_(!0)},children:(0,w.jsx)(Et.A,{primary:"View profile",secondary:(null===$||void 0===$?void 0:$.name)||void 0})}),(0,w.jsx)(St.A,{}),(0,w.jsx)(It.A,{onClick:()=>{h(null),R("/logout")},children:(0,w.jsxs)("span",{className:oa,children:[(0,w.jsx)(tn.A,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),"Log out"]})})]})]})}),(0,w.jsx)(Da,{}),(0,w.jsx)(Dt,{}),(0,w.jsx)("div",{ref:r,className:`${ia} ${H?aa:""} ${V?ra:""} ${z?da:""}`,"data-modal-scroll-region":"","data-motion-surface":"route",children:G})]}),f&&(0,w.jsx)(i.Suspense,{fallback:(0,w.jsx)(st.A,{label:"Loading profile",size:"compact",onDismiss:()=>_(!1),children:(0,w.jsx)("p",{role:"status",children:"Loading profile\u2026"})}),children:(0,w.jsx)(vr,{visible:!0,handleClose:()=>_(!1),selectedUser:{id:(null===$||void 0===$?void 0:$.id)||""},onUpdated:()=>{M()}})}),(0,w.jsx)(Ua,{launcherHost:A})]})})]})},yr=()=>{var e;const t=(0,v.d4)(e=>e.auth.userType),n=(0,v.d4)(e=>e.auth.user),i=(0,Je.Ok)(),a=null!==(e=(0,Ha.Y)(t))&&void 0!==e?e:"learner",r=(null===n||void 0===n?void 0:n.id)||(null===n||void 0===n?void 0:n._id)||null,s=(null===i||void 0===i?void 0:i.id)||null,o=(0,rt.yk)(),l=`${r||"anon"}:${s||"org"}:${o||"centre"}:${a}`;return(0,w.jsx)(lr.oS,{children:(0,w.jsx)(Ya.um,{children:(0,w.jsx)(Xa.Wz,{actor_id:r,actor_role:a,org_id:s,centre_id:o,scope_key:l,children:(0,w.jsx)(Va.HL,{actorRole:a,children:(0,w.jsx)(sr,{scopeKey:l,children:(0,w.jsx)(or.y,{children:(0,w.jsx)(dn,{children:(0,w.jsx)(_r,{})})})})})})})})};var br=n(17374),wr=n(36825),xr=n(46874);const kr=e=>"calendar"===e?"calendar.view":e.startsWith("practice/shared/")?"communications.read":"practice"===e||e.startsWith("practice/")?"practice.use":"study"===e||e.startsWith("study/")?"study.use":"results"!==e?e.startsWith("people")?"people.view":"cohorts"===e?"cohorts.view":"ai-marking"===e||e.startsWith("ai-marking/")?"ai_marking.use":e.startsWith("marking")?"assessment.view_submissions":"quality"===e||e.startsWith("quality/")?"qa.view":"plagiarism"===e||e.startsWith("plagiarism/")?"plagiarism.view":"analytics"===e?"analytics.view":e.startsWith("audit")?"qa.view_audit":e.startsWith("courses/new")||e.startsWith("courses/imports")?"courses.create":e.includes("/studio")?"courses.edit":e.startsWith("courses")?"courses.view":e.startsWith("deliveries")?"deliveries.view":e.includes("/responses")||e.includes("/submissions")?"assessment.view_submissions":"assignments/new"===e?"assignments.create":e.includes("/edit")||e.includes("/builder")||e.includes("/drafts/")?"assignments.edit":e.startsWith("assignments")?"assignments.view":"data-imports"===e||e.startsWith("bulk")?"people.bulk_import":e.startsWith("organisation")||e.startsWith("tenant-administration")?"settings.view":e.startsWith("migration")||e.startsWith("integrations/moodle")?"people.bulk_import":e.startsWith("integrations")?"integration.manage":"security"===e?"qa.view_audit":"file-security"===e?"assignments.edit":void 0:void 0;var Ar=n(82967);const jr=e=>{let{from:t,to:n,preserveLocation:a=!1}=e;const{search:r,hash:s}=(0,S.zy)();return(0,i.useEffect)(()=>{(0,Ar.f)({event:"route_alias_hit",outcome:"fallback",source:"compatibility",route_alias:t,compatibility:!0,route:t,call_site:"routing.RouteAliasRedirect"})},[t]),(0,w.jsx)(S.C5,{to:a?{pathname:n,search:r,hash:s}:n,replace:!0})};function Sr(){const{learnerId:e}=(0,S.g)(),{search:t}=(0,S.zy)(),n=new URLSearchParams(t);return e&&n.set("person",e),(0,w.jsx)(S.C5,{replace:!0,to:{pathname:"/people/learners",search:n.toString()}})}const Cr="data-route-change",Ir="data-route-transitions";var Er=n(63821),Rr=n(54419);const $r=Ft(()=>Promise.all([n.e(7658),n.e(3284),n.e(3138),n.e(2158),n.e(7883)]).then(n.bind(n,62172))),Nr=Ft(()=>
622Promise.all([n.e(7658),n.e(5213)]).then(n.bind(n,32401))),Tr=Ft(()=>n.e(7857).then(n.bind(n,73631)),["/bulk/history"]),Lr=Ft(()=>Promise.all([n.e(7658),n.e(9356),n.e(2640),n.e(5376)]).then(n.bind(n,72933)),["/bulk"]),Or=Ft(()=>Promise.all([n.e(4253),n.e(499)]).then(n.bind(n,103)),["/plagiarism"]),Mr=Ft(()=>n.e(7442).then(n.bind(n,43113)),["/ai-marking"]),Ur=Ft(()=>Promise.all([n.e(2741),n.e(6918),n.e(3138),n.e(7398)]).then(n.bind(n,57370)),["/analytics"]),Pr=Ft(()=>Promise.all([n.e(8596),n.e(3708),n.e(1307),n.e(5285)]).then(n.bind(n,61217)),["/quality/*"]),qr=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(2709),n.e(449),n.e(359),n.e(1307),n.e(3965),n.e(403),n.e(3115)]).then(n.bind(n,34019))),Dr=Ft(()=>n.e(2350).then(n.bind(n,59862)),["/assignments"]),zr=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(8596),n.e(2709),n.e(449),n.e(1307),n.e(5539),n.e(1975),n.e(243),n.e(705),n.e(2429),n.e(1162),n.e(2830)]).then(n.bind(n,83896))),Br=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(1641),n.e(3138),n.e(8596),n.e(2709),n.e(449),n.e(1307),n.e(5539),n.e(1975),n.e(243),n.e(705),n.e(4253),n.e(2429),n.e(5544),n.e(4268),n.e(1162),n.e(516)]).then(n.bind(n,6620))),Fr=Ft(()=>n.e(7058).then(n.bind(n,68616))),Wr=Ft(()=>Promise.all([n.e(705),n.e(5858)]).then(n.bind(n,3065))),Hr=Ft(()=>n.e(6895).then(n.bind(n,66895))),Vr=Ft(()=>Promise.all([n.e(8596),n.e(3708),n.e(359),n.e(3415)]).then(n.bind(n,74448)),["/marking","/marking/cases/:caseId"]),Yr=Ft(()=>n.e(910).then(n.bind(n,80275))),Gr=Ft(()=>Promise.all([n.e(3138),n.e(705),n.e(199),n.e(3011)]).then(n.bind(n,31054))),Jr=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(8342),n.e(3138),n.e(2709),n.e(4875),n.e(359),n.e(6512),n.e(5489),n.e(7502),n.e(9874),n.e(4560),n.e(3328),n.e(199),n.e(7649),n.e(914),n.e(575)]).then(n.bind(n,33378))),Kr=Ft(()=>n.e(7820).then(n.bind(n,29335)),["/assignments"]),Xr=Ft(()=>Promise.all([n.e(3138),n.e(1970)]).then(n.bind(n,44040))),Zr=Ft(()=>n.e(1786).then(n.bind(n,63912))),Qr=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(2709),n.e(449),n.e(359),n.e(5539),n.e(7502),n.e(9874),n.e(3965),n.e(8580),n.e(7649),n.e(4268),n.e(3972),n.e(6349)]).then(n.bind(n,89701)).then(e=>({default:e.AssessmentLaunchPage}))),es=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(2709),n.e(449),n.e(359),n.e(5539),n.e(7502),n.e(9874),n.e(3965),n.e(8580),n.e(7649),n.e(4268),n.e(3972),n.e(6349)]).then(n.bind(n,89701)).then(e=>({default:e.AssessmentAttemptPage}))),ts=Ft(()=>n.e(4359).then(n.bind(n,1728))),ns=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(2709),n.e(449),n.e(359),n.e(5539),n.e(9874),n.e(3965),n.e(8580),n.e(3972),n.e(5840)]).then(n.bind(n,87294)),["/results"]),is=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(3138),n.e(2709),n.e(7502),n.e(4560),n.e(2473)]).then(n.bind(n,67527)).then(e=>({default:e.WorkRecordOverviewPage}))),as=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(3138),n.e(2709),n.e(7502),n.e(4560),n.e(2473)]).then(n.bind(n,67527)).then(e=>({default:e.WorkRecordReplayPage}))),rs=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(3138),n.e(2709),n.e(7502),n.e(4560),n.e(2473)]).then(n.bind(n,67527)).then(e=>({default:e.LearnerWorkRecordSummaryPage}))),ss=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(8342),n.e(3138),n.e(8596),n.e(2709),n.e(4875),n.e(3708),n.e(359),n.e(6512),n.e(5489),n.e(7502),n.e(4560),n.e(3328),n.e(199),n.e(914),n.e(7341)]).then(n.bind(n,44444))),os=Ft(()=>Promise.all([n.e(3138),n.e(4674),n.e(5625),n.e(2287)]).then(n.bind(n,50086)),["/dashboard"]),ls=Ft(()=>Promise.all([n.e(8596),n.e(3708),n.e(4670)]).then(n.bind(n,54052))),cs=Ft(()=>Promise.all([n.e(3138),n.e(9679)]).then(n.bind(n,55695)),["/audit","/audit/:entityType/:entityId"]),ds=Ft(()=>Promise.all([n.e(3138),n.e(8596),n.e(3708),n.e(6390),n.e(800),n.e(4170),n.e(714),n.e(4674),n.e(7962)]).then(n.bind(n,38504)),["/deliveries","/deliveries/:deliveryId"]),us=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(6889),n.e(3138),n.e(8596),n.e(2709),n.e(4875),n.e(3708),n.e(449),n.e(6390),n.e(1307),n.e(5539),n.e(1975),n.e(243),n.e(800),n.e(6512),n.e(3897),n.e(2429),n.e(4170),n.e(714),n.e(5544),n.e(8657),n.e(3055),n.e(4931)]).then(n.bind(n,36723)),["/courses"]),ms=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(6889),n.e(3138),n.e(8596),n.e(2709),n.e(4875
622),n.e(3708),n.e(449),n.e(6390),n.e(1307),n.e(5539),n.e(1975),n.e(243),n.e(800),n.e(6512),n.e(3897),n.e(2429),n.e(4170),n.e(714),n.e(5544),n.e(3055),n.e(1509)]).then(n.bind(n,17914))),ps=Ft(()=>Promise.all([n.e(6390),n.e(9225)]).then(n.bind(n,92512))),hs=Ft(()=>n.e(6078).then(n.bind(n,40778))),vs=Ft(()=>Promise.all([n.e(6390),n.e(3897),n.e(3099),n.e(2128),n.e(9094)]).then(n.bind(n,10964))),gs=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(8596),n.e(2709),n.e(3708),n.e(449),n.e(7013)]).then(n.bind(n,77022)),["/practice"]),fs=Ft(()=>Promise.all([n.e(2741),n.e(1830),n.e(7097),n.e(3138),n.e(8596),n.e(2709),n.e(3708),n.e(449),n.e(7013)]).then(n.bind(n,97856))),_s=Ft(()=>Promise.all([n.e(3099),n.e(1557)]).then(n.bind(n,90236)),["/study"]),ys=Ft(()=>Promise.all([n.e(6390),n.e(3897),n.e(3099),n.e(2128),n.e(5228)]).then(n.bind(n,14780)),["/courses"]),bs=Ft(()=>Promise.all([n.e(3138),n.e(1307),n.e(1975),n.e(243),n.e(7104)]).then(n.bind(n,73137)),["/organisation"]),ws=Ft(()=>n.e(2580).then(n.bind(n,32919)),["/data-imports"]),xs=Ft(()=>n.e(4223).then(n.bind(n,92254)),["/file-security"]),ks=Ft(()=>n.e(7e3).then(n.bind(n,27511))),As=Ft(()=>Promise.all([n.e(8596),n.e(3708),n.e(4253),n.e(8890),n.e(8151)]).then(n.bind(n,9093)),["/integrations"]),js=Ft(()=>n.e(4497).then(n.bind(n,8025))),Ss=Ft(()=>n.e(7678).then(n.bind(n,68460)),["/migration/*"]),Cs=Ft(()=>n.e(9612).then(n.bind(n,83423)),["/security"]),Is=Ft(()=>n.e(2721).then(n.bind(n,63761))),Es=Ft(()=>n.e(2721).then(n.bind(n,49624))),Rs=Ft(()=>Promise.all([n.e(3418),n.e(857),n.e(3138),n.e(8596),n.e(3708),n.e(4253),n.e(5473),n.e(8890),n.e(5246),n.e(5005)]).then(n.bind(n,68489)),["/settings/*"]),$s=Ft(()=>n.e(8123).then(n.bind(n,65860)),["/support"]),Ns=Ft(()=>n.e(2721).then(n.bind(n,97e3))),Ts=Ft(()=>n.e(7127).then(n.bind(n,43546)),["/tutorials"]),Ls=Ft(()=>Promise.all([n.e(7658),n.e(3418),n.e(3284),n.e(5982),n.e(3138),n.e(8596),n.e(3708),n.e(6390),n.e(4170),n.e(5473),n.e(5246),n.e(2158),n.e(8139)]).then(n.bind(n,7812)),["/people","/people/:view"]),Os=Ft(()=>Promise.all([n.e(6390),n.e(800),n.e(8657),n.e(5187),n.e(8186)]).then(n.bind(n,93090))),Ms=Ft(()=>Promise.all([n.e(8671),n.e(3138),n.e(8596),n.e(1316)]).then(n.bind(n,57321)),["/calendar"]),Us=Ft(()=>Promise.all([n.e(4875),n.e(3156)]).then(n.bind(n,73635)),["/communications","/communications/*"]),Ps=Ft(()=>Promise.all([n.e(4875),n.e(3156)]).then(n.bind(n,73635)).then(e=>({default:e.LearnerCommunicationPage}))),qs=Ft(()=>Promise.all([n.e(4875),n.e(3558)]).then(n.bind(n,47395)),["/communications/inbox","/communications/conversations/:conversationId"]),Ds=Ft(()=>Promise.all([n.e(4875),n.e(2746)]).then(n.bind(n,13712)),["/communications","/communications/activity"]),zs=Ft(()=>Promise.all([n.e(3138),n.e(4875),n.e(6512),n.e(6594)]).then(n.bind(n,48189)),["/communications/live"]),Bs=Ft(()=>Promise.all([n.e(3138),n.e(4875),n.e(6512),n.e(6594)]).then(n.bind(n,48189)).then(e=>({default:e.CourseLiveSessionsPage}))),Fs=Ft(()=>Promise.all([n.e(3138),n.e(4875),n.e(4303)]).then(n.bind(n,21559))),Ws=Ft(()=>Promise.all([n.e(7083),n.e(6473)]).then(n.bind(n,25599))),Hs=Ft(()=>n.e(2011).then(n.bind(n,33551))),Vs=Ft(()=>Promise.all([n.e(4875),n.e(765)]).then(n.bind(n,57041))),Ys=Ft(()=>Promise.all([n.e(4875),n.e(5625),n.e(4765)]).then(n.bind(n,2369)),["/community","/community/*"]),Gs=Ft(()=>Promise.all([n.e(4875),n.e(5625),n.e(4765)]).then(n.bind(n,2369)).then(e=>({default:e.CommunityHubOverview}))),Js=Ft(()=>Promise.all([n.e(4875),n.e(5625),n.e(4765)]).then(n.bind(n,2369)).then(e=>({default:e.LegacyCommunityRedirect}))),Ks=Ft(()=>Promise.all([n.e(4875),n.e(8457)]).then(n.bind(n,37100)),["/community/resources","/community/resources/:pageId"]),Xs=Ft(()=>Promise.all([n.e(3138),n.e(4875),n.e(2930)]).then(n.bind(n,81285)),["/community/announcements","/community/announcements/:announcementId"]),Zs=Ft(()=>n.e(4736).then(n.bind(n,37167))),Qs=["organisation","organization","org","tenant","company","institution","centre","center","organisationName","organizationName","organisationSlug","organizationSlug","orgName","orgSlug","orgKey","tenantName","tenantSlug","companyName","companySlug","institutionName","institutionSlug","centreName","centerName"],eo=["name","slug","key","code"],to={display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:"2.75rem",padding:"0 1rem",borderRadius:10,textDecoration:"none",background:"#0f172a",color:"#fff",fontWeight:600}
622,no={display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:"2.75rem",padding:"0 1rem",borderRadius:10,textDecoration:"none",border:"1px solid #cbd5e1",color:"#0f172a",fontWeight:600},io={minHeight:"2.75rem",padding:"0 1rem",borderRadius:10,border:"1px solid #cbd5e1",background:"#fff",color:"#0f172a",fontWeight:600,cursor:"pointer"},ao=e=>{let{role:t,isAuth:n}=e;const{pathname:a,search:r}=(0,S.zy)(),{analyticsConsent:s}=(0,_.u)();return(0,i.useLayoutEffect)(()=>{(0,$.h1)()},[a]),(0,i.useEffect)(()=>{if(!s||null===$.bC||void 0===$.bC||!$.bC.capture)return;const e=a+r;$.bC.capture("$pageview",{$current_url:e}),t&&$.bC.register_once({role:t}),$.bC.register({isAuth:Boolean(n)})},[s,a,r,t,n]),null},ro=()=>{const{search:e}=(0,S.zy)();return(0,w.jsx)(Fe.A,{product:"landing-next",path:`/invite/accept${e}`,message:"Opening EduMark invite acceptance..."})},so={learner:[{path:"dashboard",element:(0,w.jsx)(ts,{})},{path:"courses",element:(0,w.jsx)(ys,{})},{path:"practice",element:(0,w.jsx)(gs,{})},{path:"practice/:sessionId",element:(0,w.jsx)(gs,{})},{path:"study",element:(0,w.jsx)(_s,{})},{path:"study/:materialId",element:(0,w.jsx)(_s,{})},{path:"courses/:courseId",element:(0,w.jsx)(ys,{})},{path:"assignments",element:(0,w.jsx)(Kr,{})},{path:"assignments/corrections/:correctionId",element:(0,w.jsx)(Xr,{})},{path:"assignments/communications/:caseId",element:(0,w.jsx)(Zr,{})},{path:"assignments/:assignmentId",element:(0,w.jsx)(Qr,{})},{path:"assignments/:assignmentId/attempt/:attemptId",element:(0,w.jsx)(es,{})},{path:"results",element:(0,w.jsx)(ns,{})},{path:"assignments/:assignmentId/attempts/:attemptId/work-record",element:(0,w.jsx)(rs,{})},{path:"settings/*",element:(0,w.jsx)(Rs,{})},{path:"tutorials",element:(0,w.jsx)(Ts,{})},{path:"support",element:(0,w.jsx)($s,{})}],educator:[{path:"dashboard",element:(0,w.jsx)(os,{})},{path:"marking",element:(0,w.jsx)(Vr,{})},{path:"marking/cases/:caseId",element:(0,w.jsx)(Vr,{})},{path:"people",element:(0,w.jsx)(Ls,{})},{path:"people/:view",element:(0,w.jsx)(Ls,{})},{path:"cohorts",element:(0,w.jsx)(jr,{from:"/cohorts",to:"/people/cohorts"})},{path:"courses/:courseId/preview",element:(0,w.jsx)(vs,{})},{path:"assignments",element:(0,w.jsx)(Dr,{})},{path:"assignments/new",element:(0,w.jsx)(zr,{})},{path:"assignments/:assignmentId/edit",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/preview",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/responses",element:(0,w.jsx)(Wr,{})},{path:"assignments/drafts/:assignmentId/review",element:(0,w.jsx)(Fr,{})},{path:"assignments/:assignmentId/builder",element:(0,w.jsx)(Br,{})},{path:"file-security",element:(0,w.jsx)(xs,{})},{path:"tutorials",element:(0,w.jsx)(Ts,{})},{path:"settings/*",element:(0,w.jsx)(Rs,{})},{path:"support",element:(0,w.jsx)($s,{})}],supervisor:[{path:"dashboard",element:(0,w.jsx)(os,{})},{path:"marking",element:(0,w.jsx)(Vr,{})},{path:"marking/cases/:caseId",element:(0,w.jsx)(Vr,{})},{path:"people",element:(0,w.jsx)(Ls,{})},{path:"people/:view",element:(0,w.jsx)(Ls,{})},{path:"users",element:(0,w.jsx)(jr,{from:"/users",to:"/people"})},{path:"courses",element:(0,w.jsx)(us,{})},{path:"courses/new",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/modules/:moduleId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/modules/:moduleId/steps/:stepId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/steps/:stepId",element:(0,w.jsx)(ms,{})},{path:"courses/:courseId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/modules/:moduleId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/modules/:moduleId/steps/:stepId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/steps/:stepId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/preview",element:(0,w.jsx)(vs,{})},{path:"assignments",element:(0,w.jsx)(Dr,{})},{path:"assignments/new",element:(0,w.jsx)(zr,{})},{path:"assignments/:assignmentId/edit",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/preview",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/responses",element:(0,w.jsx)(Wr,{})},{path:"assignments/drafts/:assignmentId/review",element:(0,w.jsx)(Fr,{})},{path:"assignments/:assignmentId/builder",element:(0,w.jsx)(Br,{})},{path:"file-security",element:(0,w.jsx)(xs,{})},{path:"analytics",element:(0,w.jsx)(Ur,{})},{path:"audit",element:(0,w.jsx)(cs,{})},{path:"tutorials",element:(0,w.jsx)(Ts,{})},{path:"settings/*",element:(0,w.jsx)(Rs,{})},{path:"support",element:(0,w.jsx)($s,{})},{path:"data-imports",element:(0,w.jsx)(ws,{})},{path:"bulk",element:(0,w.jsx)(Lr,{})},{path:"bulk/history",element:(0,w.jsx)(Tr,{})}],admin:[{path:"dashboard",element:(0,w.jsx)(os,{})},{path:"marking",element:(0,w.jsx)(Vr,{})},{path:"marking/cases/:caseId",element:(0,w.jsx)(Vr,{})},{path:"people",element:(0,w.jsx)(Ls,{})},{path:"people/:view",element:(0,w.jsx)(Ls,{})},{path:"users",element:(0,w.jsx)(jr,{from:"/users",to:"/people"})},{path:"courses",element:(0,w.jsx)(us,{})},{path:"courses/new",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/modules/:moduleId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/modules/:moduleId/steps/:stepId",element:(0,w.jsx)(ms,{})},{path:"courses/new/:sessionId/steps/:stepId",element:(0,w.jsx)(ms,{})},{path:"courses/:courseId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/modules/:moduleId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/modules/:moduleId/steps/:stepId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/studio/steps/:stepId",element:(0,w.jsx)(us,{})},{path:"courses/:courseId/preview",element:(0,w.jsx)(vs,{})},{path:"analytics",element:(0,w.jsx)(Ur,{})},{path:"audit",element:(0,w.jsx)(cs,{})},{path:"assignments",element:(0,w.jsx)(Dr,{})},{path:"assignments/new",element:(0,w.jsx)(zr,{})},{path:"assignments/:assignmentId/edit",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/preview",element:(0,w.jsx)(Br,{})},{path:"assignments/:assignmentId/responses",element:(0,w.jsx)(Wr,{})},{path:"assignments/drafts/:assignmentId/review",element:(0,w.jsx)(Fr,{})},{path:"assignments/:assignmentId/builder",element:(0,w.jsx)(Br,{})},{path:"file-security",element:(0,w.jsx)(xs,{})},{path:"tutorials",element:(0,w.jsx)(Ts,{})},{path:"settings/*",element:(0,w.jsx)(Rs,{})},{path:"support",element:(0,w.jsx)($s,{})},{path:"organisation",element:(0,w.jsx)(bs,{})},{path:"tenant-administration",element:(0,w.jsx)(jr,{from:"/tenant-administration",to:"/organisation"})},{path:"migration/*",element:(0,w.jsx)(Ss,{})},{path:"security",element:(0,w.jsx)(Cs,{})},{path:"design-system",element:(0,w.jsx)(ls,{})},{path:"data-imports",element:(0,w.jsx)(ws,{})},{path:"integrations",element:(0,w.jsx)(As,{})},{path:"integrations/moodle",element:(0,w.jsx)(js,{})},{path:"support/agent",element:(0,w.jsx)(Fe.A,{product:"landing",path:br.HV,message:"Opening support review..."})}]},oo=e=>{let{permission:t,legacyRoles:n,children:i}=e;const a=(0,Je.Ok)(),r=(0,v.d4)(e=>e.auth.userType),s=(0,Ii.JT)(null!==t&&void 0!==t?t:"settings.view"),o=(0,v.d4)(e=>e.auth.user),l="marker"===(0,Ei.t2)(o,r),c=!t||s;return(a?c:n.includes(String(r))&&(!l||c))?i:(0,w.jsx)(S.C5,{to:"/dashboard",replace:!0})},lo=()=>(0,w.jsx)(os,{}),co=()=>{const e=(0,Ii.Sk)(),t=(0,v.d4)(e=>e.auth.userType);return t&&"learner"!==t&&e.can("plagiarism.view")?(0,w.jsx)(Or,{}):(0,w.jsx)(S.C5,{to:"/dashboard",replace:!0})},uo=()=>{const e=(0,Ii.Sk)(),t=(0,v.d4)(e=>e.auth.userType);return t&&"learner"!==t&&e.can("ai_marking.use")&&e.can("assessment.view_submissions")?(0,w.jsx)(Mr,{}):(0,w.jsx)(S.C5,{to:"/dashboard",replace:!0})},mo=()=>{const e=(0,Ii.Sk)();return(0,j.f)(e.can)?(0,w.jsx)(us,{}):(0,w.jsx)(ys,{})},po=()=>{const e=(0,Ii.JT)("assignments.create"),t=(0,Ii.JT)("assessment.view_submissions");return e||t?(0,w.jsx)(Dr,{}):(0,w.jsx)(Kr,{})},ho=(()=>{const e=new Map;
622return Object.entries(so).forEach(t=>{let[n,i]=t;i.forEach(t=>{let{path:i,element:a}=t;const r=e.get(i);r?r.roles.push(n):e.set(i,{element:a,roles:[n]})})}),e.set("dashboard",{element:(0,w.jsx)(lo,{}),roles:["learner","educator","supervisor","admin"]}),e.set("courses",{element:(0,w.jsx)(mo,{}),roles:["learner","supervisor","admin"]}),e.set("courses/:courseId",{element:(0,w.jsx)(mo,{}),roles:["learner","supervisor","admin"]}),e.set("invigilation/export/:exportId/:linkId",{element:(0,w.jsx)(Hr,{}),roles:["educator","supervisor","admin"]}),e.set("assignments",{element:(0,w.jsx)(po,{}),roles:["learner","educator","supervisor","admin"]}),Array.from(e,e=>{let[t,n]=e;return{path:t,...n}})})();function vo(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const go="".split(",").map(vo).filter(Boolean);function fo(e,t){if("string"===typeof e)return void t.push(e);if(!e||"object"!==typeof e)return;const n=e;eo.forEach(e=>{const i=n[e];"string"===typeof i&&t.push(i)}),Qs.forEach(e=>{const i=n[e];"string"===typeof i&&t.push(i)})}function _o(e){if(0===go.length)return!0;const t=function(e){if(!e||"object"!==typeof e)return[];const t=e,n=[];return Qs.forEach(e=>fo(t[e],n)),fo(t.profile,n),fo(t.meta,n),Array.from(new Set(n.map(e=>vo(e)).filter(Boolean)))}(e);return go.some(e=>t.includes(e))}const yo=()=>{const e=(0,S.Zp)(),t=(0,i.useMemo)(()=>(0,de.F5)("landing",window.location.hostname,"/"),[]);return(0,w.jsx)("main",{style:{minHeight:"100vh",display:"grid",placeItems:"center",padding:"2rem"},children:(0,w.jsxs)("section",{style:{width:"100%",maxWidth:560,borderRadius:16,border:"1px solid #e5e7eb",background:"#fff",padding:"2rem",boxShadow:"0 16px 32px rgba(15, 23, 42, 0.08)"},children:[(0,w.jsx)("h1",{style:{marginTop:0,marginBottom:"0.75rem"},children:"Access restricted"}),(0,w.jsx)("p",{style:{marginTop:0,marginBottom:"1.5rem",lineHeight:1.5},children:"Your account is signed in, but this LMS workspace is limited to approved organisations."}),(0,w.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.75rem"},children:[(0,w.jsx)("a",{href:t,style:to,children:"Go to landing"}),(0,w.jsx)("a",{href:"/assignments",style:no,children:"Open assignments"}),(0,w.jsx)("button",{type:"button",onClick:()=>{e("/logout")},style:io,children:"Sign out"})]})]})})},bo=e=>{let{children:t}=e;return _o((0,v.d4)(e=>e.auth.user))?t:(0,w.jsx)(yo,{})},wo=()=>{var e;const{userType:t,token:n,passwordProfileUpdateState:a}=(0,v.d4)(e=>e.auth),r=null!==(e=(0,Ha.Y)(t))&&void 0!==e?e:"learner",s=Boolean(n&&"done"===a),o=(0,Er.T4)();return(0,w.jsxs)(I.nN,{enabled:s,children:[(0,w.jsx)(wr.A,{}),(0,w.jsx)(ao,{role:r,isAuth:s}),(0,w.jsx)(i.Suspense,{fallback:(0,w.jsx)(Ye,{label:"Loading EduMark"}),children:(0,w.jsxs)(S.BV,{children:[(0,w.jsx)(S.qh,{index:!0,element:s?(0,w.jsx)(S.C5,{to:"/dashboard",replace:!0}):(0,w.jsx)(He,{})}),(0,w.jsx)(S.qh,{path:"/login",element:(0,w.jsx)(He,{returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:de.dB,element:(0,w.jsx)(He,{returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/:userType/login",element:(0,w.jsx)(S.C5,{to:"/login",replace:!0})}),(0,w.jsx)(S.qh,{path:"/signup",element:o?(0,w.jsx)(Rr.s,{restriction:"signup"}):(0,w.jsx)(He,{path:"/sol/signup",returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/auth/callback",element:(0,w.jsx)(ye,{})}),(0,w.jsx)(S.qh,{path:"/moderation-review",element:(0,w.jsx)(qr,{})}),(0,w.jsx)(S.qh,{path:"/logout",element:(0,w.jsx)(it,{})}),(0,w.jsx)(S.qh,{path:"/account",element:(0,w.jsx)(Be,{})}),(0,w.jsx)(S.qh,{path:"/onboarding",element:(0,w.jsx)(S.C5,{to:"/account",replace:!0})}),(0,w.jsx)(S.qh,{path:"/auto-login",element:(0,w.jsx)(He,{returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/auto-login-success",element:(0,w.jsx)(He,{returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/forgot-password",element:(0,w.jsx)(He,{path:"/sol/forgot-password",returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/reset-password",element:(0,w.jsx)(He,{path:"/sol/reset-password",returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/verify-email",element:(0,w.jsx)(He,{path:"/sol/verify-email",returnToCurrentPath:!1})}),(0,w.jsx)(S.qh,{path:"/verifyotp",element:(0,w.jsx)(S.C5,{to:"/forgot-password",replace:!0})}),(0,w.jsx)(S.qh,{path:"/forgot-enter-password",element:(0,w.jsx)(S.C5,{to:"/forgot-password",replace:!0})}),(0,w.jsx)(S.qh,{path:"/terms",element:(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Ns,{})})}),(0,w.jsx)(S.qh,{path:"/privacy",element:(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Es,{})})}),(0,w.jsx)(S.qh,{path:"/cookies",element:(0,w.jsx)(i.Suspense,{fallback:null,children:(0,w.jsx)(Is,{})})}),(0,w.jsx)(S.qh,{path:"/mark",element:(0,w.jsx)(jr,{from:"/mark",to:"/marking"})}),(0,w.jsx)(S.qh,{path:"/landing",element:(0,w.jsx)(Fe.A,{product:"landing",path:"/",message:"Opening EduMark landing..."})}),(0,w.jsx)(S.qh,{path:"/invite/accept",element:(0,w.jsx)(ro,{})}),(0,w.jsx)(S.qh,{path:"/app/invite/accept",element:(0,w.jsx)(ro,{})}),(0,w.jsxs)(S.qh,{element:(0,w.jsx)(Qe,{children:(0,w.jsx)(bo,{children:(0,w.jsx)(Ze,{children:(0,w.jsx)(et.SN,{children:(0,w.jsx)(E.G3,{children:(0,w.jsx)(R.Hg,{children:(0,w.jsx)(xr.X,{children:(0,w.jsx)(yr,{})})})})})})})}),children:[(0,w.jsx)(S.qh,{index:!0,element:(0,w.jsx)(S.C5,{to:"dashboard",replace:!0})}),(0,w.jsx)(S.qh,{path:"calendar",element:(0,w.jsx)(oo,{permission:"calendar.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Ms,{})})}),(0,w.jsx)(S.qh,{path:"practice/shared/:shareId",element:(0,w.jsx)(oo,{permission:"communications.read",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(fs,{})})}),ho.map(e=>{let{path:t,element:n,roles:i}=e;return(0,w.jsx)(S.qh,{path:t,element:(0,w.jsx)(oo,{permission:kr(t),legacyRoles:i,children:(0,w.jsx)(w.Fragment,{children:n})})},t)}),(0,w.jsx)(S.qh,{path:"assignments/:assignmentId/attempts/:attemptId/work-record",element:(0,w.jsx)(oo,{permission:"assessment.view_submissions",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(is,{})})}),(0,w.jsx)(S.qh,{path:"assignments/:assignmentId/attempts/:attemptId/work-record/replay",element:(0,w.jsx)(oo,{permission:"assessment.view_submissions",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(as,{})})}),(0,w.jsx)(S.qh,{path:"assignments/:assignmentId/submissions",element:(0,w.jsx)(oo,{permission:"assessment.view_submissions",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(ss,{})})}),(0,w.jsx)(S.qh,{path:"assignments/groups/:groupId",element:(0,w.jsx)(oo,{permission:"assignments.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Gr,{})})}),(0,w.jsx)(S.qh,{path:"assignments/:assignmentId/manage",element:(0,w.jsx)(oo,{permission:"assignments.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Jr,{})})}),(0,w.jsx)(S.qh,{path:"assignments/legacy-reference/:assignmentId",element:(0,w.jsx)(oo,{permission:"assignments.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Yr,{})})}),(0,w.jsx)(S.qh,{path:"deliveries",element:(0,w.jsx)(oo,{permission:"deliveries.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(ds,{})})}),(0,w.jsx)(S.qh,{path:"deliveries/:deliveryId",element:(0,w.jsx)(oo,{permission:"deliveries.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(ds,{})})}),(0,w.jsx)(S.qh,{path:"quality/*",element:(0,w.jsx)(oo,{permission:"qa.view",legacyRoles:["supervisor","admin"],children:(0,w.jsx)(Pr,{})})}),(0,w.jsx)(S.qh,{path:"bulk/batch/:id",element:(0,w.jsx)(oo,{permission:"people.bulk_import",legacyRoles:["supervisor"],children:(0,w.jsx)(Nr,{})})}),(0,w.jsx)(S.qh,{path:"plagiarism",element:(0,w.jsx)(co,{})}),(0,w.jsx)(S.qh,{path:"ai-marking",element:(0,w.jsx)(uo,{})}),(0,w.jsx)(S.qh,{path:"ai-marking/:id",element:(0,w.jsx)(uo,{})}),(0,w.jsx)(S.qh,{path:"plagiarism/upload",element:(0,w.jsx)(S.C5,{to:"/plagiarism",replace:!0})}),(0,w.jsx)(S.qh,{path:"plagiarism/scans",element:(0,w.jsx)(S.C5,{to:"/plagiarism",replace:!0})}),(0,w.jsx)(S.qh,{path:"plagiarism/scans/:scanId",element:(0,w.jsx)(co,{})}),(0,w.jsx)(S.qh,{path:"createuser",element:(0,w.jsx)(oo,{permission:"people.create",legacyRoles:["admin"],children:(0,w.jsx)($r,{})})}),(0,tt.o)()&&(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(S.qh,{path:"pilot",element:(0,w.jsx)(oo,{permission:"settings.manage",legacyRoles:["admin"],children:(0,w.jsx)(ks,{})})})}),(0,w.jsx)(S.qh,{path:"audit/:entityType/:entityId",element:(0,w.jsx)(oo,{permission:"qa.view_audit",legacyRoles:["admin","supervisor"],children:(0,w.jsx)(cs,{})})}),(0,w.jsx)(S.qh,{path:"courses/imports/:jobId",element:(0,w.jsx)(oo,{permission:"courses.create",legacyRoles:["admin","supervisor"],children:(0,w.jsx)(ps,{})})}),(0,w.jsx)(S.qh,{path:"courses/create/aurora",element:(0,w.jsx)(oo,{permission:"courses.create",legacyRoles:["admin","supervisor"],children:(0,w.jsx)(jr,{from:"/courses/create/aurora",to:"/courses/new?start=aurora"})})}),(0,w.jsx)(S.qh,{path:"courses/create/aurora/:sessionId",element:(0,w.jsx)(oo,{permission:"courses.create",legacyRoles:["admin","supervisor"],children:(0,w.jsx)(hs,{})})}),(0,nt.N)()&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(S.qh,{path:"community",element:(0,w.jsx)(Ys,{}),children:[(0,w.jsx)(S.qh,{index:!0,element:(0,w.jsx)(Gs,{})}),(0,w.jsx)(S.qh,{path:"resources",element:(0,w.jsx)(Ks,{})}),(0,w.jsx)(S.qh,{path:"resources/new",element:(0,w.jsx)(Ks,{})}),(0,w.jsx)(S.qh,{path:"resources/:pageId",element:(0,w.jsx)(Ks,{})}),(0,w.jsx)(S.qh,{path:"resources/:pageId/edit",element:(0,w.jsx)(Ks,{})}),(0,w.jsx)(S.qh,{path:"announcements",element:(0,w.jsx)(Xs,{})}),(0,w.jsx)(S.qh,{path:"announcements/:announcementId",element:(0,w.jsx)(Xs,{})})]}),(0,w.jsx)(S.qh,{path:"communications/pages/*",element:(0,w.jsx)(Js,{})}),(0,w.jsx)(S.qh,{path:"communications/announcements/*",element:(0,w.jsx)(Js,{})}),(0,w.jsxs)(S.qh,{path:"communications",element:(0,w.jsx)(Us,{}),children:[(0,w.jsx)(S.qh,{index:!0,element:(0,w.jsx)(S.C5,{to:"activity",replace:!0})}),(0,w.jsx)(S.qh,{path:"activity",element:(0,w.jsx)(Ds,{})}),(0,w.jsx)(S.qh,{path:"notifications",element:(0,w.jsx)(jr,{from:"/communications/notifications",to:"/communications/activity"})}),(0,w.jsx)(S.qh,{path:"inbox",element:(0,w.jsx)(qs,{})}),(0,w.jsx)(S.qh,{path:"conversations/:conversationId",element:(0,w.jsx)(qs,{})}),(0,w.jsx)(S.qh,{path:"live",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(zs,{})})}),(0,w.jsx)(S.qh,{path:"live/:sessionId/room",element:(0,w.jsx)(oo,{permission:"live_session.join",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Vs,{})})}),(0,w.jsx)(S.qh,{path:"live/:sessionId/check-in",element:(0,w.jsx)(oo,{permission:"live_session.attendance.manage",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Ws,{})})}),(0,w.jsx)(S.qh,{path:"live/:sessionId",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Fs,{})})}),(0,w.jsx)(S.qh,{path:"settings",element:(0,w.jsx)(Zs,{})})]}),(0,w.jsx)(S.qh,{path:"courses/:courseId/live",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Bs,{})})}),(0,w.jsx)(S.qh,{path:"courses/:courseId/live/:sessionId",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Fs,{})})}),(0,w.jsx)(S.qh,{path:"courses/:courseId/live/:sessionId/room",element:(0,w.jsx)(oo,{permission:"live_session.join",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Vs,{})})}),(0,w.jsx)(S.qh,{path:"courses/:courseId/live/:sessionId/check-in",element:(0,w.jsx)(oo,{permission:"live_session.attendance.manage",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Ws,{})})}),(0,w.jsx)(S.qh,{path:"attend/:handle",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Hs,{})})}),(0,w.jsx)(S.qh,{path:"attend/:handle/:token",element:(0,w.jsx)(oo,{permission:"live_session.view",legacyRoles:["learner","educator","supervisor","admin"],children:(0,w.jsx)(Hs,{})})}),(0,w.jsx)(S.qh,{path:"learners/:learnerId/communication",element:(0,w.jsx)(Ps,{})})]}),(0,w.jsx)(S.qh,{path:"aurora",element:(0,w.jsx)(Os,{})}),(0,w.jsx)(S.qh,{path:"assignmentdetails/:assignmentId",element:(0,w.jsx)(Yr,{})}),(0,w.jsx)(S.qh,{path:"learner-assignments",element:(0,w.jsx)(jr,{from:"/learner-assignments",to:"/assignments",preserveLocation:!0}
622)}),(0,w.jsx)(S.qh,{path:"learners/:learnerId",element:(0,w.jsx)(oo,{permission:"people.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(Sr,{})})}),(0,w.jsx)(S.qh,{path:"learners",element:(0,w.jsx)(oo,{permission:"people.view",legacyRoles:["educator","supervisor","admin"],children:(0,w.jsx)(jr,{from:"/learners",to:"/people/learners",preserveLocation:!0})})}),(0,w.jsx)(S.qh,{path:"broadcast-notification",element:(0,w.jsx)(oo,{permission:"communications.send_staff",legacyRoles:["admin"],children:(0,w.jsx)(jr,{from:"/broadcast-notification",to:"/community/announcements"})})})]}),(0,w.jsx)(S.qh,{path:"*",element:s?(0,w.jsx)(T,{isAuth:!0}):(0,w.jsx)(He,{})})]})})]})},xo=(0,C.Ys)([{path:"*",element:(0,w.jsx)(wo,{})}]);!function(e,t){if("undefined"===typeof document)return()=>{};const n=document.documentElement;n.setAttribute(Ir,"");let i=e.state.location.pathname;const a=e.subscribe(e=>{const a=e.location.pathname;a!==i&&(n.setAttribute(Cr,t(i,a)),i=a)}),r=e.navigate.bind(e);e.navigate=(t,n)=>{const i="undefined"!==typeof document&&"function"===typeof document.startViewTransition&&"standard"===(0,o.uX)()&&"visible"===document.visibilityState&&function(e,t){if("number"===typeof e||null==e)return!1;if("string"===typeof e)return""!==e&&!e.startsWith("?")&&!e.startsWith("#")&&(e.startsWith("/")?e.split(/[?#]/,1)[0].replace(/\/+$/,"")!==t.replace(/\/+$/,""):"."!==e);const n=e.pathname;return"string"===typeof n&&""!==n&&(n.startsWith("/")?n.replace(/\/+$/,"")!==t.replace(/\/+$/,""):"."!==n)}(t,e.state.location.pathname);return r(t,i?{viewTransition:!0,...n}:n)}}(xo,function(e,t){return Jt(e)!==Jt(t)?"shell":Yt(e)===Yt(t)?"section":"page"});const ko=()=>(0,w.jsx)(C.pg,{router:xo}),Ao=()=>((0,i.useEffect)(()=>(document.documentElement.setAttribute("data-product","lms-next"),()=>{document.documentElement.removeAttribute("data-product")}),[]),(0,w.jsx)(Ni,{children:(0,w.jsx)(ko,{})}));var jo=n(51706),So=n(39197),Co=n(63438),Io=n(74227),Eo=n(21878),Ro=n(32590),$o=n(77425),No=n(62229),To=n(19245);function Lo(e){let{brand:t,hostname:n,development:a,onPasswordSignIn:r,onGoogleSignIn:s,onForgotPassword:o,wrongContext:l=!1}=e;const[c,d]=(0,i.useState)(""),[u,m]=(0,i.useState)(""),[p,h]=(0,i.useState)(!1),[v,g]=(0,i.useState)(null),[f,_]=(0,i.useState)(""),y=(0,i.useRef)(!1),b=async(e,t)=>{if(!y.current){y.current=!0,g(e),_("");try{await t()}catch(n){_(n instanceof Error&&n.message&&n.message.length<=300?n.message:"We couldn\u2019t sign you in. Please try again.")}finally{y.current=!1,g(null)}}};return(0,w.jsxs)(No.A,{brand:t,hostname:n,development:a,title:"Welcome back.",subtitle:`Sign in to ${t.display_name}.`,children:[l&&(0,w.jsx)("p",{className:To.A.notice,children:"You\u2019re signed in to another workspace. Use an account with access to this centre to continue."}),(0,w.jsxs)("button",{type:"button",className:To.A.googleButton,disabled:Boolean(v),onClick:()=>{b("google",s)},children:[(0,w.jsx)("span",{className:To.A.googleMark,"aria-hidden":"true",children:"G"}),"google"===v?"Continuing\u2026":"Continue with Google"]}),(0,w.jsxs)("div",{className:To.A.divider,children:[(0,w.jsx)("span",{}),"or use your email",(0,w.jsx)("span",{})]}),(0,w.jsxs)("form",{onSubmit:e=>{e.preventDefault(),b("password",()=>r(c.trim(),u))},"aria-busy":"password"===v,children:[(0,w.jsxs)("label",{className:To.A.field,htmlFor:"centre-signin-email",children:["Email address",(0,w.jsx)("input",{id:"centre-signin-email",type:"email",autoComplete:"username",value:c,onChange:e=>d(e.target.value),placeholder:"[email protected]",required:!0,disabled:Boolean(v),maxLength:254})]}),(0,w.jsxs)("div",{className:To.A.passwordHeading,children:[(0,w.jsx)("label",{htmlFor:"centre-signin-password",children:"Password"}),(0,w.jsx)("button",{type:"button",disabled:Boolean(v),onClick:()=>{b("reset",o)},children:"reset"===v?"Opening recovery\u2026":"Forgot password?"})]}),(0,w.jsxs)("div",{className:To.A.passwordField,children:[(0,w.jsx)("input",{id:"centre-signin-password",type:p?"text":"password",autoComplete:"current-password",value:u,onChange:e=>m(e.target.value),required:!0,disabled:Boolean(v)}),(0,w.jsx)("button",{type:"button","aria-label":p?"Hide password":"Show password","aria-pressed":p,onClick:()=>h(e=>!e),children:p?(0,w.jsx)(Eo.A,{size:18,"aria-hidden":"true"}):(0,w.jsx)(Ro.A,{size:18,"aria-hidden":"true"})})]}),f&&(0,w.jsx)("p",{className:To.A.error,role:"alert",children:f}),(0,w.jsxs)("button",{type:"submit",className:To.A.submitButton,disabled:Boolean(v),children:["password"===v?"Signing you in\u2026":"Sign in",(0,w.jsx)($o.A,{size:17,"aria-hidden":"true"})]})]}),(0,w.jsx)("p",{className:To.A.accessHelp,children:"Need access? Your centre can invite you or help you find the right account."})]})}var Oo=n(68359),Mo=n(48043);const Uo="jl5RT0Tt",Po="aKTTly67",qo="PGp8MhIR",Do="WBSckxHs",zo="d8lfAo5S",Bo="K3riOR6P",Fo="EDw9QvHu",Wo="T70gEslQ",Ho="zVj236f9",Vo="YE7FETCN",Yo="EhjykfxX",Go="xbJ2dAQk",Jo="oxzoKfZC",Ko="VDRmLTSj",Xo="XQXlvcCz",Zo="sVriOhlc",Qo="OcOz_DNL";function el(e){let{hostname:t,onRetry:n,setupUrl:i,homeUrl:a}=e;const{resolvedTheme:r}=(0,y.eP)(),s="dark"===r?Mo.A.BRAND_FULL_LOGO_DARK:Mo.A.BRAND_FULL_LOGO;return(0,w.jsxs)("main",{className:Uo,children:[(0,w.jsxs)("header",{className:Po,children:[(0,w.jsx)("a",{href:a,"aria-label":"EduMark home",children:(0,w.jsx)("img",{className:qo,src:s,alt:"EduMark",width:144,height:36})}),(0,w.jsx)("span",{children:"Room for what\u2019s next."})]}),(0,w.jsxs)("section",{className:Do,"aria-labelledby":"unknown-centre-heading",children:[(0,w.jsxs)("div",{className:zo,"aria-hidden":"true",children:[(0,w.jsx)("span",{className:Bo}),(0,w.jsx)("span",{className:Bo}),(0,w.jsx)("span",{className:Fo,children:(0,w.jsx)(Oo.A,{size:48,strokeWidth:1.35})}),(0,w.jsx)("span",{className:Wo,children:"+"}),(0,w.jsx)("span",{className:Wo,children:"+"})]}),(0,w.jsx)("p",{className:Ho,children:"A small detour"}),(0,w.jsxs)("h1",{id:"unknown-centre-heading",children:["No learning here",(0,w.jsx)("br",{}),(0,w.jsx)("em",{children:"Yet."})]}),(0,w.jsxs)("p",{className:Vo,children:["The address has arrived before the classroom.",(0,w.jsx)("br",{}),"We couldn\u2019t find an active centre at:"]}),(0,w.jsx)("div",{className:Yo,children:t}),(0,w.jsxs)("p",{className:Go,children:["Here to learn? Check the link with your centre.",(0,w.jsx)("br",{}),"Building a learning space of your own? You\u2019re in the right neighbourhood."]}),(0,w.jsxs)("div",{className:Jo,children:[(0,w.jsxs)("a",{className:Ko,href:i,children:["Set up your centre",(0,w.jsx)($o.A,{size:17,"aria-hidden":"true"})]}),(0,w.jsx)("a",{className:Xo,href:a,children:"Explore EduMark"})]}),n&&(0,w.jsx)("button",{className:Zo,type:"button",onClick:n,children:"Already set up? Check again"})]}),(0,w.jsx)("footer",{className:Qo,children:"A little curiosity can lead somewhere good."})]})}const tl="bIAPqkLs",nl="jtCkrKZ9";const il=e=>{var t;let{children:n}=e;const a=window.location.hostname,r=(0,ue.Bj)(a),{token:s,user:o}=(0,v.d4)(e=>e.auth),{resolvedTheme:l}=(0,y.eP)(),[c,d]=(0,i.useState)(null),[u,m]=(0,i.useState)(null),[p,h]=(0,i.useState)(0),g=function(e){if(/^\/(?:sol\/)?(?:reset-password|verify-email)\/?$/.test(e))return`/sol/${e.split("/").filter(
622Boolean).pop()}`;return/^\/(?:app\/)?invite\/accept\/?$/.test(e)?"/invite/accept":null}(window.location.pathname),[f]=(0,i.useState)(()=>new URLSearchParams(window.location.search).get("resume")),_="lms"===f||"signup"===f,[b,x]=(0,i.useState)("opening"),[k,A]=(0,i.useState)(0),j=(0,i.useRef)(null),S=/^\/(?:auth\/callback|account|onboarding|logout)(?:\/|$)/.test(window.location.pathname),C=function(e){const t=new URLSearchParams(e.search);t.delete("resume");const n="/login"===e.pathname?t.get("next"):`${e.pathname}${t.size?`?${t}`:""}${e.hash||""}`,i=(0,de.jA)(n);return i&&!/^\/(?:sol|auth|login|logout|signup)(?:[/?#]|$)/.test(i)?i:null}(window.location);(0,i.useEffect)(()=>{if(!r)return;const e=new AbortController;let t=!1;const n=window.setTimeout(()=>e.abort(),15e3);return d(null),m(null),(0,ue.G1)(null),(0,ue.MG)(a,e.signal).then(t=>{e.signal.aborted||((0,ue.G1)(t),d(t))}).catch(e=>{t||m(e instanceof Error?e.message:"CENTRE_HOST_UNAVAILABLE")}).finally(()=>window.clearTimeout(n)),()=>{t=!0,e.abort(),window.clearTimeout(n),(0,ue.G1)(null)}},[a,p]);const I=null===o||void 0===o?void 0:o.activeContext,E=Boolean(s&&c&&I&&(String(I.orgId||I.org_id||"")!==c.org_id||(null===(t=I.centreIds)||void 0===t?void 0:t.length)&&!I.centreIds.includes(c.centre_id))),R=!s||E,$=_&&!s&&!g&&!S;if((0,i.useEffect)(()=>{var e;if(!c||!$)return;let t=!0;return x("opening"),(null===(e=j.current)||void 0===e?void 0:e.attempt)!==k&&(j.current={attempt:k,promise:"signup"===f?(0,jo.C5)(a,C):(0,L.U6)(a,C)}),j.current.promise.then(e=>{t&&window.location.replace(e)}).catch(e=>{var n;t&&x(e instanceof L.b$&&[401,403,409].includes(null!==(n=e.status)&&void 0!==n?n:0)?"unavailable":"failed")}),()=>{t=!1}},[c,a,C,k,f,$]),(0,i.useEffect)(()=>{if(!c||!R)return;const e=document.title,t=document.querySelector('link[rel="icon"]'),n=null===t||void 0===t?void 0:t.getAttribute("href");document.title=c.brand.page_title||c.brand.display_name,t&&c.brand.favicon_url&&(t.href=c.brand.favicon_url);const i=(0,Io.nT)(c.brand.primary_colour,c.brand.secondary_colour,"dark"===l);return()=>{i(),document.title=e,t&&n&&(t.href=n)}},[c,R,l]),(0,i.useEffect)(()=>{if(!c||!g)return;let e=!1;return(0,jo.C5)(a).then(t=>{if(e)return;const n=new URL(t);n.pathname=g;const i=new URLSearchParams(window.location.search);for(const e of["token","type","invite_token"]){const t=i.get(e);t&&n.searchParams.set(e,t)}window.location.replace(n.toString())}).catch(()=>{e||m("RECOVERY_UNAVAILABLE")}),()=>{e=!0}},[c,a,g]),!r)return(0,w.jsx)(w.Fragment,{children:n});if("CENTRE_HOST_NOT_FOUND"===u)return(0,w.jsx)(el,{hostname:a,onRetry:()=>h(e=>e+1),setupUrl:(0,de.F5)("landing-next",a,"/sol/signup?type=centre"),homeUrl:(0,de.F5)("landing-next",a,"/")});if(!c)return(0,w.jsx)("main",{className:tl,children:(0,w.jsxs)("section",{className:nl,"aria-live":"polite",children:[(0,w.jsx)(vn.A,{size:32,"aria-hidden":"true"}),(0,w.jsx)("h1",{children:u?"CENTRE_HOST_NOT_FOUND"===u?"Centre not found":"We couldn\u2019t open this centre":"Opening your centre\u2026"}),(0,w.jsx)("p",{children:u?"CENTRE_HOST_NOT_FOUND"===u?"This address is not assigned to an active centre. Check the link with your centre.":"Please check your connection and try again.":"Checking your learning space."}),u&&(0,w.jsx)("button",{type:"button",onClick:()=>h(e=>e+1),children:"Try again"}),u&&(0,w.jsx)("a",{href:(0,de.F5)("landing-next",a,"/"),children:"Go to EduMark"})]})});if(g)return(0,w.jsx)("main",{className:tl,children:(0,w.jsxs)("section",{className:nl,"aria-live":"polite",children:[(0,w.jsx)("h1",{children:u?"We couldn\u2019t open this link":"Opening your secure link\u2026"}),(0,w.jsx)("p",{children:u?"Allow browser storage, then reload this page to try again.":`Continuing with ${c.brand.display_name}.`})]})});if(!R||S)return(0,w.jsx)(w.Fragment,{children:n});if($&&"unavailable"!==b)return(0,w.jsx)("main",{className:tl,children:(0,w.jsxs)("section",{className:nl,"aria-live":"polite",children:[(0,w.jsx)("h1",{children:"failed"===b?"We couldn\u2019t open your workspace":"Opening your workspace\u2026"}),(0,w.jsx)("p",{children:"failed"===b?"Please check your connection and try again.":`Continuing with ${c.brand.display_name}.`}),"failed"===b&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("button",{type:"button",onClick:()=>A(e=>e+1),children:"Try again"}),(0,w.jsx)("button",{type:"button",onClick:()=>x("unavailable"),children:"Sign in instead"})]})]})});const N=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=new URL(await(0,jo.C5)(a,C));e&&(t.pathname="/sol/forgot-password"),E&&t.searchParams.set("choose_account","1"),window.location.assign(t.toString())};return(0,w.jsx)(Lo,{brand:c.brand,hostname:a,development:"development"===r.environment,wrongContext:E,onGoogleSignIn:()=>N(),onForgotPassword:()=>N(!0),onPasswordSignIn:async(e,t)=>{var n,i;const r=await(0,So.Zr)(e,t);(0,So.dp)(r);const s=await(0,jo.DI)(a);await(0,Co.bL)((0,Ha.Y)(null!==(n=r.userType)&&void 0!==n?n:null===(i=r.user)||void 0===i?void 0:i.role)||"learner",C,null,null,{centreTarget:s,redirectOnUnauthorized:!1})}})},al=()=>(0,w.jsx)(A,{children:(0,w.jsx)(il,{children:(0,w.jsx)(Ao,{})})})},73141(e,t,n){n.d(t,["A",0,e=>
622"session_expired"===e||"session_invalid"===e||"workspace_access_changed"===e||"signed_out"===e?e:null,"s",0,"/sol/login?reason=signed_out&app_session=checked"])},98771(e,t,n){const i=(0,n(65345).A)("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);n.d(t,["A",0,i])},50097(e,t,n){const i=(0,n(65345).A)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);n.d(t,["A",0,i])},72436(e,t,n){const i=(0,n(65345).A)("building-2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);n.d(t,["A",0,i])},68998(e,t,n){const i=(0,n(65345).A)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);n.d(t,["A",0,i])},646(e,t,n){const i=(0,n(65345).A)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);n.d(t,["A",0,i])},68359(e,t,n){const i=(0,n(65345).A)("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);n.d(t,["A",0,i])},80449(e,t,n){const i=(0,n(65345).A)("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);n.d(t,["A",0,i])},68042(e,t,n){const i=(0,n(65345).A)("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);n.d(t,["A",0,i])},47759(e,t,n){const i=(0,n(65345).A)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);n.d(t,["A",0,i])},90827(e,t,n){const i=(0,n(65345).A)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);n.d(t,["A",0,i])},17459(e,t,n){const i=(0,n(65345).A)("life-buoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);n.d(t,["A",0,i])},22056(e,t,n){const i=(0,n(65345).A)("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);n.d(t,["A",0,i])},22199(e,t,n){const i=(0,n(65345).A)("message-square-plus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);n.d(t,["A",0,i])},94147(e,t,n){const i=(0,n(65345).A)("messages-square",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);n.d(t,["A",0,i])},18663(e,t,n){const i=(0,n(65345).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);n.d(t,["A",0,i])},54577(e,t,n){const i=(0,n(65345).A)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);n.d(t,["A",0,i])},97900(e,t,n){const i=(0,n(65345).A)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7
622a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);n.d(t,["A",0,i])},90203(e,t,n){const i=(0,n(65345).A)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);n.d(t,["A",0,i])},44662(e,t,n){const i=(0,n(65345).A)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);n.d(t,["A",0,i])},64963(e,t,n){const i=(0,n(65345).A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);n.d(t,["A",0,i])},99640(e,t,n){const i=(0,n(65345).A)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);n.d(t,["A",0,i])},22677(e,t,n){const i=(0,n(65345).A)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);n.d(t,["A",0,i])}}]); 623//# sourceMappingURL=8372.df099cff.chunk.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.