/* ---------- Routing & DDoS: one modal for the network-wide settings ---------- The backbone, Auto-TE and DDoS automation used to sit at the bottom of the NOC tab, below every incident and the log, where nobody found them. A button at the top of the NOC tab opens them here, with the traceroute. */ // Auto-TE: paused, installed or for sale. function tePanel(){ return S.te&&!coreTE()?`
Auto-TE${tr('core.paused')}

${tr('core.auto_te_is_paused_it_needs')}

`:S.te?`
Auto-TE${S.te.on?tr('hud_and_panels.on_moving_g_onto_alternate_paths',{g:fmtG(R.teMoved||0)}):tr('common.off')}
${btn(S.te.on?tr('hud_and_panels.turn_auto_te_off'):tr('hud_and_panels.turn_auto_te_on'),'teToggle',{},'ghost sm')}${btn(S.te.script?tr('common.edit_routescript'):tr('hud_and_panels.write_a_routescript'),'teEdit',{},'pink sm')}
${S.te.script?`

RouteScript: ${teRules()?tr('hud_and_panels.n_rules_live',{n:teRules().n}):S.te.on?tr('hud_and_panels.has_errors_not_running'):tr('common.controller_off')}${R.teBlack?` ยท ${tr('hud_and_panels.blackholing_g',{g:fmtG(R.teBlack)})}`:''}

`:''}` :`
Auto-TE${lvl()<3?tr('hud_and_panels.unlocks_at_customer_level_3'):tr('common.not_installed')}

${tr('hud_and_panels.traffic_takes_the_shortest_path_even')}

${coreTE()?'':`

${tr('core.auto_te_needs_an_rsvp_te_or')}

`}
${btn(tr('hud_and_panels.install_auto_te_cost_mo_mo',{cost:fmt$(TE_COST),mo:fmt$(TE_MO)}),'buyTE',{},'pink sm',lvl()<3||S.cash`;} // What the modal holds, without its title (scripts/lib/fuzz-page.js reads its buttons too). // Traceroute opens its own modal from here: it explains the routing these settings shape. function routingBody(){return `
๐Ÿ”Ž ${tr('common.traceroute')}
${tr('routing.trace_note')}
${btn(tr('routing.trace_run'),'trace',{},'sm')}
`+corePanel()+`

${tr('common.traffic_engineering')}

${tePanel()}` +`

${tr('routing.ddos_defence')}

${ddosSettings()}`;} function routingModal(){if(!S)return;const card=$('modalCard'),open=!$('modal').hidden&&card.querySelector('[data-routing]'),st=open?card.scrollTop:0; let h=`
NOC

${tr('routing.routing_and_ddos')}

${tr('routing.how_traffic_crosses_your_backbone')}

`; openModal(h+routingBody());if(open)card.scrollTop=st;} // Actions taken in the modal re-render the game through after(); this keeps the open modal in step. function routingRefresh(){if(S&&!$('modal').hidden&&$('modalCard').querySelector('[data-routing]'))routingModal();}