${esc(m[1])}
${esc(m[2])}
import { lessons } from './lessons.js';
import { sources } from './sources.js';
import { courseRegister, advancedArffPlan, radiotelephonyPlan } from './course-catalog.js';
import { readState, saveState, summary, storageAvailable, freshSession } from './state.js';
const $=id=>document.getElementById(id), esc=s=>String(s).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const shapes={home:'
':''}${i===1?'${lessonDescriptions[i]}
${s.ended?'Review exercise':s.started?'Continue exercise':'Enter scenario'} ${icon('arrow')}${eyebrow}
${body}
Official Opspec name · approved ${esc(c.approvalDate)}
Try another course name or sequence number.
Register status: human ATO review required. ${esc(courseRegister.reconciliation)}. The three scenario-lab exercises remain demonstrations and are not listed here as released courses.
`;} function bindCatalog(){if(!$('catalog-search'))return;$('catalog-search').addEventListener('input',e=>{$('catalog-results').innerHTML=catalogRows(e.target.value);fillIcons();});} function advancedArff(){const p=advancedArffPlan;return heading('COURSE BUILD / '+p.courseId,'Advanced Aircraft Firefighting.','The first controlled digital course build. Its training journey is designed; formal release remains locked until authorised humans approve every source, assessment and practical definition.')+`${esc(m[2])}
${esc(s.calls[0].text)}
The check looks for key phrases only. It does not grade competence.
Start at the RFFS station. Follow the marked route and stop when instructed.
Academy · records · controlled content
CHECKING THIS HOST…Videos, manuals and site overlays
Optional Ollama model
Five read-only training tools
Approved devices use the node IP
HOW THE CLIENT SITE WORKS
The server and training drive stay at the client site. Learners open the academy in a browser. Videos stream from the local SSD, Prof uses the local model and approved retrieval library, and records remain on the controlled runtime volume.
On the public Hugging Face preview this page shows the architecture. When served by the local Training Node, it reads live storage, model and course-pack status from the same machine.
`;} async function bindNode(){if(!$('node-live'))return;try{const r=await fetch('/api/node/status',{cache:'no-store'});if(!r.ok)throw new Error('preview');const s=await r.json();$('node-live').textContent='● LOCAL NODE ONLINE';$('node-live').classList.add('online');$('node-content').textContent=`${s.content.videos} videos · ${s.content.documents} documents · ${s.content.images} images`;$('node-ai').textContent=s.local_ai.available?`${s.local_ai.model} ready`:`${s.local_ai.model} configured · model offline`;$('node-note').textContent=`Live node: ${s.node_name}. Content root ${s.content_root_available?'available':'missing'}. Course release: ${s.course_pack.release_status}.`; }catch{$('node-live').textContent='PUBLIC CLOUD PREVIEW';}} function bindRadioTrainer(){if(!$('radio-play'))return;const p=radiotelephonyPlan,s=p.scenario,points=s.points;let callIndex=0,routeIndex=0;const speak=text=>{if(!speechOK){toast('Device voice is unavailable. Read the call on screen.');return;}stopSpeech();const u=new SpeechSynthesisUtterance(text);u.lang='en-GB';u.rate=.9;window.speechSynthesis.speak(u);};const updateCall=()=>{$('radio-instruction').textContent=s.calls[callIndex].text;$('radio-feedback').textContent='The check looks for key phrases only. It does not grade competence.';$('radio-readback').value='';};$('radio-play').onclick=()=>speak(s.calls[callIndex].text);$('radio-next').onclick=()=>{callIndex=(callIndex+1)%s.calls.length;updateCall();};$('radio-check').onclick=()=>{const answer=$('radio-readback').value.toLowerCase();const missing=s.calls[callIndex].expected.filter(term=>!answer.includes(term));$('radio-feedback').textContent=missing.length?`Keep practising. Key words not found: ${missing.join(', ')}. Ask your instructor to review the complete call.`:'Key phrases found for this practice attempt. An instructor must review the full transmission and context.';$('radio-feedback').classList.toggle('good',!missing.length);};const updateRoute=()=>{$('route-progress').textContent=`${routeIndex} / ${points.length-1} points`;const marker=$('vehicle-marker'),current=points[routeIndex];marker.setAttribute('cx',current.x);marker.setAttribute('cy',current.y);document.querySelectorAll('.route-point').forEach((el,i)=>el.classList.toggle('active',i<=routeIndex));$('route-note').textContent=routeIndex===points.length-1?'Route complete for this practice run. Record it for instructor review; it is not a driving authorisation.':`Vehicle marker at ${current.label}. Follow the next instruction before moving.`;};$('route-move').onclick=()=>{if(routeIndexA place to learn, practise and build clearer decisions.

Step into the scenario. Read the scene.
Build your reasoning with Prof.

ARFF / PRACTICE PATHWAY
Explore an illustrative aircraft scene, choose a response and see why it matters. Each exercise ends with your own debrief.
The supplied Advanced ARFF artwork shows the academy’s intended direction. This version contains the three practice exercises above; it is not the complete Advanced ARFF course.
`;} function progress(){const s=summary(state);return heading('YOUR PRACTICE RECORD','See how far you’ve come.','Your actual exercise activity, saved in this browser. These are practice records, not competence certificates.')+`| EXERCISE | STATUS | FIRST CHOICES | |
|---|---|---|---|
| 0${i+1} · ${l.title} | ${status(a)} | ${a.answers.length?a.answers.filter(x=>x.correct).length+' / '+a.answers.length:'—'} | ${a.ended?'Review':a.started?'Continue':'Start'} ↗ |
Progress stays in this browser and is not synced to other devices. Clearing browser data removes it. Restarting an exercise replaces that attempt; completed attempts also appear below.
| EXERCISE | COMPLETED | FIRST CHOICES |
|---|---|---|
| ${lessons[x.lesson].title} | ${esc(formatDate(x.date))} | ${x.score} / 3 |
Complete all three decisions and open the debrief in an exercise.
Start practising →${s.scope}
${s.status}No AM Risk manuals, aerodrome emergency plans or local SOPs have been added to this demonstration. The instructor desk includes a space to record the documents and editions you want to use.
Open instructor desk →These links are source directories and publication pages. The academy does not claim approval, accreditation or full alignment with ICAO, NFPA, EASA, SACAA or UK CAA.
`;} function instructor(){return heading('INSTRUCTOR DESK','Put your expertise into the academy.','Review the authored exercises, record local context and export your review notes. This desk is a demonstration workspace on this device.')+`3 exercises · 9 decisions · authored feedback
${l.intro}
${l.steps.map((q,j)=>`${q.prompt}
Feedback for the strongest response: ${q.options.find(o=>o.correct).feedback}
`).join('')}Review the applicable authority, adopted editions, learning outcomes and assessment arrangements before using content in formal training.
YOUR LOCAL CONTEXT
${state.reviewNotes?'Saved notes loaded from this device.':'Your notes will appear here when saved.'}
${p.body}
${p.note} This outline is for curriculum planning, not a completed course.
`);$('outline-instructor').onclick=()=>$('academy-dialog').close();}));document.querySelectorAll('[data-guide]').forEach(b=>b.onclick=openGuide);if($('prof-welcome'))$('prof-welcome').onclick=()=>speaking?stopSpeech():narrate('Hi, I’m Prof, your AM Risk learning guide. Start with Smoke at stand four. Explore the three observation points, then make your decisions. We will reflect on what you knew, what was missing, and what you should discuss with your instructor. Your progress is saved on this device.');if($('export-progress'))$('export-progress').onclick=()=>showReport('YOUR PRACTICE RECORD',practiceReport(),'AM-Risk-practice-record.txt');if($('reset-practice'))$('reset-practice').onclick=()=>{openModal('RESET PRACTICE PROGRESS','This clears the three exercise attempts and their completion history on this device. Your display name and instructor notes stay saved. Export a practice record first if you want to keep your results.
');$('cancel-reset').onclick=()=>$('academy-dialog').close();$('confirm-reset').onclick=()=>{const s=readState();s.sessions=lessons.map(freshSession);s.history=[];if(saveState(s)){$('academy-dialog').close();render();toast('Practice progress reset on this device.');}else toast('Browser storage unavailable. Progress was not reset.');};};if($('review-notes')){const input=$('review-notes');input.value=pendingNotes??state.reviewNotes;input.oninput=()=>{pendingNotes=input.value;$('notes-status').textContent='Unsaved changes — use Save notes.';};$('save-notes').onclick=saveNotes;$('export-review').onclick=()=>{saveNotes();showReport('INSTRUCTOR REVIEW',reviewReport(),'AM-Risk-curriculum-review.txt');};}} function saveNotes(){const s=readState();s.reviewNotes=$('review-notes').value;const ok=saveState(s);pendingNotes=ok?null:s.reviewNotes;$('notes-status').textContent=ok?'Notes saved on this device.':'Notes could not be saved. Export or copy them before leaving.';toast(ok?'Instructor notes saved.':'Browser storage unavailable. Copy your notes.');} const guideTopics=[{label:'Where do I start?',keys:/start|begin|first|course|learn/i,text:'Start with “Smoke at stand 04”. Explore the three observation points, choose Start briefing, and work through three decisions. You can return later: this browser keeps your current attempt.',href:route(0),link:'Start the first exercise'}, {label:'What is ARFF?',keys:/arff|rescue|fire|purpose|life/i,text:'ARFF means aircraft rescue and firefighting. The high-level purpose centres on saving lives, supporting survivable conditions and escape. This demo practises observation, communication and reflection; operational methods belong to your approved training and local procedures.',href:'#resources',link:'Explore the official references'}, {label:'What can I ask you?',keys:/prof|avatar|ai|talk|voice|question/i,text:'I’m a guided learning character in this version. These answers are written learning notes, and the audio uses a voice on your device. My photograph is a still portrait. For now I can explain the exercises, progress and reference library; I am not an open-ended AI instructor.',href:'#learning',link:'Explore your learning pathway'}, {label:'Where are the standards?',keys:/icao|nfpa|easa|sacaa|caa|standard|regulation|certif|qualif/i,text:'The resource library links to ICAO, NFPA, EASA, SACAA and UK CAA. Full standards and licensed publications have not been loaded. A qualified instructor must confirm the applicable editions and map the curriculum before this becomes formal standards-based training.',href:'#resources',link:'Open the reference library'}, {label:'How is progress saved?',keys:/progress|score|save|record|result/i,text:'Completing an exercise adds one of three completions. The score counts your first choices against the authored responses. Both your current attempts and up to 40 completed attempts stay in this browser. Clearing its data removes them; records do not sync to another device.',href:'#progress',link:'View your actual progress'}]; function openGuide(){openModal('MEET YOUR LEARNING GUIDE',`
Choose a topic, or search these learning notes.
These are authored answers, not a live AI conversation. No model token or login is required.
`);let answer='';const choose=t=>{stopSpeech();answer=t.text;$('guide-answer').replaceChildren();const p=document.createElement('p');p.textContent=t.text;const a=document.createElement('a');a.href=t.href;a.textContent=t.link+' →';a.onclick=()=>$('academy-dialog').close();$('guide-answer').append(p,a);};document.querySelectorAll('[data-topic]').forEach(b=>b.onclick=()=>choose(guideTopics[Number(b.dataset.topic)]));$('guide-form').onsubmit=e=>{e.preventDefault();const q=$('guide-query').value.trim();choose(guideTopics.find(t=>t.keys.test(q))||{text:'That topic is not in these guided notes yet. For a technical or operational question, record it for your instructor and check the applicable approved source. I can help you find the current practice exercises and reference library.',href:'#instructor',link:'Record a question for your instructor'});};$('guide-read').onclick=()=>speaking?stopSpeech():narrate(answer);choose(guideTopics[0]);} function practiceReport(){const s=readState(),p=summary(s);return ['AM RISK & TRAINING — PRACTICE RECORD','Not a certificate or assessment of operational competence.',`Learner label: ${s.learner}`,`Exported: ${new Date().toISOString()}`,`Completed: ${p.complete}/3 | Decisions answered: ${p.decisions}/9 | Strongest first choices: ${p.correct}/${p.decisions}`,'',...lessons.flatMap((l,i)=>{const a=s.sessions[i];return [`${i+1}. ${l.title} — ${status(a)}`,...a.answers.flatMap((v,j)=>[`${j+1}. ${l.steps[j].title}`,`Your first choice: ${l.steps[j].options[v.choice].text}`,`Feedback: ${l.steps[j].options[v.choice].feedback}`]),''];}),'COMPLETED ATTEMPT HISTORY',...s.history.map(x=>`${x.date} | ${lessons[x.lesson].title} | ${x.score}/3`),'','Records are editable browser data, not verified learner evidence.','Instructor discussion: Which information was missing? Which local procedures apply? What practical assessment should follow?'].join('\n');} function reviewReport(){return ['AM RISK & TRAINING — CURRICULUM REVIEW','Draft demonstration content — instructor validation pending',`Exported: ${new Date().toISOString()}`,'','INSTRUCTOR NOTES',readState().reviewNotes||'(No saved notes.)','',...lessons.flatMap((l,i)=>[`${i+1}. ${l.title} — ${l.aim}`,l.intro,...l.steps.flatMap((q,j)=>[`${j+1}. ${q.title}`,q.prompt,...q.options.map((o,k)=>`${String.fromCharCode(65+k)}. ${o.text}${o.correct?' [Strongest authored response]':''}\nFeedback: ${o.feedback}`)]),'']),'OFFICIAL REFERENCES',...sources.map(s=>`${s.name}: ${s.url}\n${s.status}`)].join('\n');} function showReport(label,text,filename){openModal(label,'Copy the text below, or save a text file. Some embedded browsers may not support downloads.
');$('record-text').value=text;$('copy-record').onclick=async()=>{try{await navigator.clipboard.writeText(text);$('copy-record').textContent='Copied ✓';}catch{$('record-text').focus();$('record-text').select();$('copy-record').textContent='Text selected — copy now';}};$('download-record').onclick=()=>{const url=URL.createObjectURL(new Blob([text],{type:'text/plain;charset=utf-8'})),a=document.createElement('a');a.href=url;a.download=filename;document.body.append(a);a.click();a.remove();setTimeout(()=>URL.revokeObjectURL(url),30000);};} $('profile-button').onclick=()=>{openModal('YOUR DEVICE PROFILE','This is a display name on this device, not a login or verified learner record.
');$('profile-name').value=readState().learner;$('profile-form').onsubmit=e=>{e.preventDefault();const s=readState();s.learner=$('profile-name').value.trim()||'Learner';if(saveState(s)){updateHeader();$('academy-dialog').close();toast('Display name saved on this device.');}else toast('Browser storage is unavailable. The name could not be saved.');};}; $('about-academy').onclick=()=>openModal('ABOUT THIS ACADEMY','This working demonstration combines your supplied AM Risk artwork with a 3D aircraft scene, three authored practice exercises, device narration, saved browser progress and an instructor review desk.
The academy uses your supplied still portrait. Narration uses the device’s voice. The scenario lab also offers a stylised animated 3D guide. A realistic video avatar and open-ended AI conversation are not connected.
These practice scenarios are illustrative. Full standards, approved local manuals and formal assessment have not been added. The source library explains the role of each authority.
Progress, display name and notes are saved in this browser, not sent to a learner database. There is no account sync. The hosting service and font provider receive normal page requests; your browser or operating system determines how device narration is processed.
'); document.querySelector('.skip').onclick=e=>{e.preventDefault();$('page-content').focus();}; $('close-modal').onclick=()=>$('academy-dialog').close();$('academy-dialog').addEventListener('close',stopSpeech);$('academy-dialog').addEventListener('click',e=>{if(e.target!==$('academy-dialog'))return;const r=e.target.getBoundingClientRect();if(e.clientX