@fnndsc/argus 0.39.1 → 0.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Settings-BVrOcytq.js → Settings-BoMHOSp6.js} +1 -1
- package/dist/assets/{Texture-4jPm_xeP.js → Texture-D960GMMA.js} +1 -1
- package/dist/assets/{addVolumesToViewports-DQP3LeFX.js → addVolumesToViewports-BpHHdOxc.js} +1 -1
- package/dist/assets/{cornerstoneEngine-Blp1IbPT.js → cornerstoneEngine-BUPxTjGN.js} +2 -2
- package/dist/assets/{field-C2Ib0VHd.js → field-jqfvruDC.js} +3 -3
- package/dist/assets/{index-Cwo9Lq4H.js → index-BKyk2vIR.js} +1 -1
- package/dist/assets/{index-BVXGH8U5.js → index-C9RWVPhr.js} +6 -6
- package/dist/assets/{index-DkUDUSIY.js → index-CU-JQxpu.js} +1 -1
- package/dist/assets/{index-B9oMBK73.js → index-CmKwQ1nF.js} +1 -1
- package/dist/assets/{index-CVvENnLM.js → index-DQhDp_5U.js} +1 -1
- package/dist/assets/{index-CIg7rwi_.js → index-DTOkxzz6.js} +1 -1
- package/dist/assets/{index-BgBN96Ym.js → index-DWaiH0NG.js} +1 -1
- package/dist/assets/{index-Dy633dNk.js → index-Dad2ItcR.js} +1 -1
- package/dist/assets/{index-F1eIZnRS.js → index-OB5dTpAp.js} +1 -1
- package/dist/assets/{index-Cwro-LQj.js → index-SjhRgchg.js} +1 -1
- package/dist/assets/{index-uQuRymSK.js → index-gjhljxIT.js} +1 -1
- package/dist/assets/{index-CzQ3BblT.js → index-ix2Bt1gn.js} +1 -1
- package/dist/assets/{index-DwvoD6G1.js → index-pxFc125y.js} +1 -1
- package/dist/assets/{index-DE_44cBq.js → index-q-9-3MNr.js} +1 -1
- package/dist/assets/{niivueEngine-BouI2q7Z.js → niivueEngine-Dv8fpk3P.js} +2 -2
- package/dist/assets/{slabScene-C_vNjmE5.js → slabScene-9NYXy_sk.js} +1 -1
- package/dist/build.json +1 -1
- package/dist/index.html +1 -1
- package/dist/notes.json +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cornerstoneEngine-BUPxTjGN.js","./refusal-DOpm8I8L.js","./_commonjsHelpers-CE1G-McA.js","./niivueEngine-Dv8fpk3P.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function s(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=s(n);fetch(n.href,r)}})();const Zx=450,k_=12;function xo(t,e,s=Date.now()){const i=Number(t.dataset.edgeAt??0);return t.dataset.edge===e&&s-i<Zx?!1:(delete t.dataset.edge,t.offsetWidth,t.dataset.edge=e,t.dataset.edgeAt=String(s),!0)}function Jx(t,e){return e?"▲ TOP":`▼ ${t} MORE`}function Qx(t,e){const s=t.getBoundingClientRect().bottom;let i=0;for(const n of t.querySelectorAll(e)){const r=n.getBoundingClientRect();r.height>0&&r.top>=s-2&&(i+=1)}return i}function eO(t){const e=parseFloat(getComputedStyle(t).lineHeight)||16;return Math.max(0,Math.ceil((t.scrollHeight-t.scrollTop-t.clientHeight)/e))}function Mi(t,e={}){t.dataset.more="wired",t.classList.add("holds-more");const s=document.createElement("button");s.type="button",s.className=`more-chip${e.className!==void 0?` ${e.className}`:""}`,s.hidden=!0;const i=e.label??Jx,n=()=>t.scrollTop+t.clientHeight>=t.scrollHeight-2;s.addEventListener("click",l=>{if(l.stopPropagation(),e.press!==void 0){e.press();return}t.scrollBy({top:n()?-t.scrollHeight:Math.max(1,t.clientHeight-s.offsetHeight),behavior:"smooth"})});const r=e.mount??t;r.appendChild(s);let o=!1;const a=()=>{if(!o){o=!0;try{r===t&&t.lastElementChild!==s&&t.appendChild(s);const l=(e.scrolls?.()??!0)&&t.scrollHeight>t.clientHeight+2;if(s.hidden!==!l&&(s.hidden=!l),!l)return;const c=e.rows!==void 0?Qx(t,e.rows):eO(t),h=i(c,n());s.textContent!==h&&(s.textContent=h)}finally{o=!1}}};return t.addEventListener("scroll",a,{passive:!0}),tO(t,n),typeof ResizeObserver<"u"&&new ResizeObserver(a).observe(t),new MutationObserver(a).observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","style"]}),a(),s}function tO(t,e){const s=()=>t.scrollHeight>t.clientHeight+2,i=()=>t.scrollTop<=0;let n=t.scrollTop;t.addEventListener("scrollend",()=>{const o=t.scrollTop!==n;n=t.scrollTop,!(!o||!s())&&(i()?xo(t,"top"):e()&&xo(t,"bottom"))}),t.addEventListener("wheel",o=>{!s()||o.deltaY===0||(o.deltaY<0&&i()?xo(t,"top"):o.deltaY>0&&e()&&xo(t,"bottom"))},{passive:!0});let r=null;t.addEventListener("touchstart",o=>{r=o.touches[0]?.clientY??null},{passive:!0}),t.addEventListener("touchmove",o=>{const a=o.touches[0]?.clientY;r===null||a===void 0||!s()||(a-r>k_&&i()?(xo(t,"top"),r=null):r-a>k_&&e()&&(xo(t,"bottom"),r=null))},{passive:!0}),t.addEventListener("animationend",o=>{o.target===t&&o.animationName.startsWith("edge-flare")&&delete t.dataset.edge})}function Qe(t){const e=document.getElementById(t);if(e===null)throw new Error(`required element #${t} is missing`);return e}function qi(t){const e=Qe(t);if(!(e instanceof HTMLTemplateElement))throw new Error(`#${t} is not a template`);const s=e.content.firstElementChild;if(!(s instanceof HTMLElement))throw new Error(`template #${t} is empty`);return s.cloneNode(!0)}function Ks(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`pane template is missing ${e}`);return s}const Xw=24,kf="argus.dormant";class sO{constructor(e=Xw,s){this.cap=e,this.store=s,this.rehydrate()}cap;store;groups=new Map;add(e){for(this.groups.delete(e.id),this.groups.set(e.id,e);this.groups.size>this.cap;){const s=this.oldest_id();if(s===void 0)break;this.groups.delete(s)}this.persist()}list(){return[...this.groups.values()].sort((e,s)=>s.lastTouched-e.lastTouched)}get(e){return this.groups.get(e)}has(e){return this.groups.has(e)}dismiss(e){const s=this.groups.delete(e);return s&&this.persist(),s}oldest_id(){let e;for(const s of this.groups.values())(e===void 0||s.lastTouched<e.lastTouched)&&(e=s);return e?.id}persist(){if(this.store!==void 0)try{this.store.setItem(kf,JSON.stringify([...this.groups.values()]))}catch{}}rehydrate(){if(this.store!==void 0)try{const e=this.store.getItem(kf);if(e===null)return;const s=JSON.parse(e);if(!Array.isArray(s))return;for(const i of s)i!==null&&typeof i=="object"&&typeof i.id=="string"&&this.groups.set(i.id,i)}catch{}}}function Zw(){try{const t=globalThis.localStorage;return t===void 0?void 0:(t.getItem(kf),t)}catch{return}}function iO(t){if(!t.startsWith("#/"))return null;let e;try{e=decodeURI(t.slice(1))}catch{return null}e=e.replace(/\/+$/,"")||"/";const s=e.split("/").filter(o=>o!==""),i=s[s.length-1]??"";return!s.includes("data")&&(/^feed_\d+$/.test(i)||/^[\w.-]+_\d+$/.test(i)&&s.some(o=>/^feed_\d+$/.test(o)))?{kind:"runs",target:i}:{kind:"folder",path:/\.[A-Za-z0-9]{1,8}$/.test(i)&&!/_\d+$/.test(i)?`/${s.slice(0,-1).join("/")}`:e}}function Jw(t,e){return`${t.replace(/\/+$/,"")}/#${encodeURI(e)}`}const nO=2500;function Qw(t){const e=document.createElement("div");e.className="link-line";const s=document.createElement("button");s.type="button",s.className="link-pill",s.textContent="LINK";const i=document.createElement("span");i.className="link-address",e.append(s,i),tg(e,t);const n=r=>{r.stopPropagation(),ey(e)};return s.addEventListener("click",n),i.addEventListener("click",n),e}function tg(t,e){const s=Jw(window.location.origin,e),i=t.querySelector(".link-address");i!==null&&i.textContent!==s&&(i.textContent=s),t.dataset.link=s,t.title=`a link that opens ARGUS at ${e} — press to copy`}async function ey(t,e=navigator.clipboard){const s=t.dataset.link??"",i=t.querySelector(".link-pill");let n=!1;try{if(e===void 0)throw new Error("no clipboard");await e.writeText(s),n=!0}catch{const o=t.querySelector(".link-address"),a=window.getSelection();if(o!==null&&a!==null){const l=document.createRange();l.selectNodeContents(o),a.removeAllRanges(),a.addRange(l)}}t.dataset.copied=n?"yes":"no",i!==null&&(i.textContent=n?"COPIED":"SELECT + COPY");const r=Date.now();return t.dataset.shown=String(r),setTimeout(()=>{t.dataset.shown===String(r)&&(delete t.dataset.copied,i!==null&&(i.textContent="LINK"))},nO),n}const rO="desktop clear";function ty(t){const e=t.split(`
|
|
3
3
|
`).map(s=>s.trim()).filter(s=>s!==""&&!s.startsWith("#"));return["# ARGUS view: run these lines in the ARGUS console to see what I see",rO,...e].join(`
|
|
4
4
|
`)}const N_=2500;function oO(t,e=navigator.clipboard){document.querySelector(".share-sheet")?.remove();const s=document.createElement("div");s.className="share-sheet",s.setAttribute("role","dialog"),s.setAttribute("aria-label","share this view");const i=document.createElement("div");i.className="share-head",i.textContent="SHARE VIEW · THESE LINES, OR THE LINK, PUT ANYONE WHERE YOU ARE";const n=document.createElement("pre");n.className="share-script",n.textContent=t;const r=document.createElement("button");r.type="button",r.className="share-copy share-lines",r.textContent="COPY";const o=document.createElement("button");o.type="button",o.className="share-copy share-link",o.textContent="COPY LINK";const a=document.createElement("button");a.type="button",a.className="share-close",a.textContent="CLOSE";const l=document.createElement("div");l.className="share-pills",l.append(o,r,a),s.append(i,n,l),document.body.appendChild(s),Mi(n,{mount:s});let c=0;const h=async()=>{let d=!1;try{if(e===void 0)throw new Error("no clipboard");await e.writeText(t),d=!0}catch{const p=window.getSelection();if(p!==null){const f=document.createRange();f.selectNodeContents(n),p.removeAllRanges(),p.addRange(f)}}s.dataset.copied=d?"yes":"no",r.textContent=d?"COPIED":"SELECT + COPY";const u=++c;window.setTimeout(()=>{u===c&&(delete s.dataset.copied,r.textContent="COPY")},N_)};return r.addEventListener("click",()=>{h()}),o.addEventListener("click",()=>{const d=aO(window.location.origin,t);(e===void 0?Promise.reject(new Error("no clipboard")):e.writeText(d)).then(()=>{o.textContent="LINK COPIED"},()=>{n.textContent=d,o.textContent="LINK SHOWN: SELECT + COPY"}).finally(()=>{window.setTimeout(()=>{o.textContent="COPY LINK"},N_)})}),a.addEventListener("click",()=>s.remove()),s.addEventListener("keydown",d=>{d.key==="Escape"&&s.remove()}),h(),a.focus(),s}const Nf="view=";function aO(t,e){return`${t.replace(/\/+$/,"")}/#${Nf}${encodeURIComponent(e)}`}function lO(t){if(!t.startsWith(`#${Nf}`))return null;try{const e=decodeURIComponent(t.slice(Nf.length+1));return e.trim()===""?null:e}catch{return null}}function cO(t,e,s){document.querySelector(".share-sheet")?.remove();const i=document.createElement("div");i.className="share-sheet view-ask",i.setAttribute("role","dialog");const n=document.createElement("div");n.className="share-head",n.textContent=e.size>0?`A VIEW FROM ${s.toUpperCase()} · IT ASKS FOR MORE THAN A VIEW, SO IT WILL NOT RUN`:`A VIEW FROM ${s.toUpperCase()} · RUN THESE LINES?`;const r=document.createElement("pre");r.className="share-script",t.forEach((c,h)=>{const d=document.createElement("div");d.textContent=c;const u=e.get(h);u!==void 0&&(d.className="view-refused",d.textContent=`${c} ← ${u}`),r.appendChild(d)});const o=document.createElement("button");o.type="button",o.className="share-copy view-run",o.textContent="RUN",o.disabled=e.size>0;const a=document.createElement("button");a.type="button",a.className="share-close",a.textContent="NOT NOW";const l=document.createElement("div");return l.className="share-pills",l.append(o,a),i.append(n,r,l),document.body.appendChild(i),Mi(r,{mount:i}),(e.size>0?a:o).focus(),new Promise(c=>{const h=d=>{i.remove(),c(d)};o.addEventListener("click",()=>h(!0)),a.addEventListener("click",()=>h(!1)),i.addEventListener("keydown",d=>{d.key==="Escape"&&h(!1)})})}class hO{constructor(e,s){this.host=s,this.grid=e.querySelector(".panes-grid"),this.empty=e.querySelector(".panes-empty"),this.grid.addEventListener("click",this.click_handle)}host;grid;empty;render(){const e=this.host.list();this.empty.hidden=e.length>0,this.grid.replaceChildren(...e.map(s=>this.card_build(s)))}card_build(e){const s=document.createElement("button");s.className="panes-card",s.dataset.restore=e.id,s.title=`restore ${e.label}`;const i=document.createElement("span");if(i.className="panes-card-figure",e.thumbnail!==void 0){const a=document.createElement("img");a.src=e.thumbnail,a.alt="",i.appendChild(a)}else i.classList.add("panes-card-glyph"),i.textContent=e.members.includes("files")&&!e.members.includes("viewer")?"▤":"▣";s.appendChild(i);const n=document.createElement("span");n.className="panes-card-label",n.textContent=e.label,s.appendChild(n);const r=document.createElement("span");r.className="panes-card-badges";for(const a of dO(e.members)){const l=document.createElement("span");l.className="panes-card-badge",l.textContent=a.toUpperCase(),r.appendChild(l)}s.appendChild(r);const o=document.createElement("button");return o.className="panes-card-dismiss",o.dataset.dismiss=e.id,o.title=`forget ${e.label}`,o.textContent="DISMISS",s.appendChild(o),s}click_handle=e=>{const s=e.target,i=s.closest("[data-dismiss]");if(i!==null){e.stopPropagation();const r=i.dataset.dismiss??"";this.host.dismiss(r),this.render();return}const n=s.closest("[data-restore]");n!==null&&this.host.restore(n.dataset.restore??"")}}function dO(t){return[...new Set(t)]}const uO="G1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA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A7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsybSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzk7MTc7MjRtIBtbMG0bWzM4OzI7MjM7NDU7NjJtLhtbMG0bWzM4OzI7NDE7Nzk7MTA5bTobWzBtG1szODsyOzU5OzExMzsxNTVtPRtbMG0bWzM4OzI7NzU7MTQ0OzE5NW0rG1swbRtbMzg7Mjs3NjsxNDQ7MTkzbSsbWzBtG1szODsyOzE0OzI3OzM3bSAbWzBtG1szODsyOzc1OzE0MjsxODltKxtbMG0bWzM4OzI7Nzc7MTQ1OzE5Mm0rG1swbRtbMzg7Mjs2NzsxMjY7MTY1bT0bWzBtG1szODsyOzU1OzEwMjsxMzRtLRtbMG0bWzM4OzI7NDE7Nzc7MTAwbTobWzBtG1szODsyOzI3O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sxODM7MjI0bSobWzBtG1szODsyOzkzOzE2ODsyMDVtKxtbMG0bWzM4OzI7ODE7MTQ4OzE3OW0rG1swbRtbMzg7Mjs2ODsxMjM7MTQ4bT0bWzBtG1szODsyOzUxOzkzOzExMm0tG1swbRtbMzg7MjszNDs2MTs3M206G1swbRtbMzg7MjsyMjs0MDs0N20uG1swbRtbMzg7Mjs5OzE2OzE5bSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG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bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MTsxbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjszbSAbWzBtG1szODsyOzE7MjsybSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtChtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg7MjswOzA7MG0gG1swbRtbMzg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IBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0bWzM4OzI7MDswOzBtIBtbMG0KG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtG1szODsyOzA7MDswbSAbWzBtCg==",fO=/\x1b\[[0-9;]*m/g,B_="\x1B[0m",G_="\x1B[7m",sy=atob(uO).trimEnd().split(`
|
|
@@ -4340,17 +4340,17 @@ void main() {
|
|
|
4340
4340
|
}`;function ZS(t,e){const s=performance.now();return new is({uniforms:{time:{value:s},opacity:{value:e.opacity},born:{value:s},cycle:{value:t}},vertexShader:xF,fragmentShader:OF,transparent:!0,depthWrite:!e.additive,...e.additive?{blending:Rr}:{}})}function JS(t,e,s){const i=e.length,n=new Float32Array(i*2),r=new Float32Array(i*2),o=new Float32Array(i*2);for(let a=0;a<i;a++)n[a*2]=e[a]??0,n[a*2+1]=e[a]??0,r[a*2]=s[a]??0,r[a*2+1]=s[a]??0,o[a*2+1]=1;t.setAttribute("aMode",new Tt(n,1)),t.setAttribute("aStart",new Tt(r,1)),t.setAttribute("aAlong",new Tt(o,1))}let Xu=null;function nm(){return Xu===null&&(Xu=new Jg(1,1,1,10,1,!0)),Xu}function EF(t,e){const s=performance.now(),i=new is({uniforms:{time:{value:s},opacity:{value:1},born:{value:s},cycle:{value:e}},vertexShader:KS,fragmentShader:XS,transparent:!0}),n=nm().clone(),r=new Float32Array(t.length*3),o=new Float32Array(t.length),a=new Float32Array(t.length),l=new Yg(n,i,t.length),c=new W(0,1,0),h=new Zt;return t.forEach((d,u)=>{const p=d.to.clone().sub(d.from),f=p.length();h.position.copy(d.from).addScaledVector(p,.5),h.quaternion.setFromUnitVectors(c,f>0?p.divideScalar(f):c),h.scale.set(d.width,f,d.width),h.updateMatrix(),l.setMatrixAt(u,h.matrix),r.set([d.color.r,d.color.g,d.color.b],u*3),o[u]=d.mode,a[u]=d.start}),n.setAttribute("aColor",new Sr(r,3)),n.setAttribute("aMode",new Sr(o,1)),n.setAttribute("aStart",new Sr(a,1)),l.instanceMatrix.needsUpdate=!0,l.frustumCulled=!1,l}function AF(t,e,s){const i=new Float32Array(t.length*6),n=new Float32Array(t.length*6);t.forEach((a,l)=>{i.set([a.from.x,a.from.y,a.from.z,a.to.x,a.to.y,a.to.z],l*6);const c=a.color.r*s.tint,h=a.color.g*s.tint,d=a.color.b*s.tint;n.set([c,h,d,c,h,d],l*6)});const r=new cs;r.setAttribute("position",new Tt(i,3)),r.setAttribute("aColor",new Tt(n,3)),JS(r,t.map(a=>a.mode),t.map(a=>a.start));const o=new Zp(r,ZS(e,s));return o.frustumCulled=!1,o}class TF{parent;stars=[];index=new Map;nebulaList=[];materials=[];layers=[];threads=null;threadMaterial=null;nebulaSprites=new Map;starsById=null;starsTouched=!1;threadsTouched=!1;constructor(e){this.parent=e}count(){return this.stars.length}list(){return this.stars}entry(e){const s=this.index.get(e);return s===void 0?void 0:this.stars[s]}ids(){return this.index.keys()}nebulae(){return this.nebulaList}draw(e,s,i,n){for(const r of e)this.index.has(r.id)||this.index.set(r.id,this.stars.length),this.stars.push(r);this.starsById=null;for(const[r,o]of[[!1,!1],[!0,!1],[!1,!0]]){const a=e.filter(c=>c.ring===!0===o&&(o||c.ember===r));if(a.length===0)continue;const l=yF(a,r,this.layers.length,s,o);this.layers.push({alpha:l.alpha,base:l.base,flash:l.flash}),this.parent.add(l.points),this.materials.push(l.material)}this.scale_update(i,n)}scale_update(e,s){if(this.materials.length===0)return;const i=zF(e,s);for(const n of this.materials){const r=n.uniforms.scale;r!==void 0&&(r.value=i)}}threads_draw(e,s,i=[],n){if(e.length===0)return;const r=new cs;r.setAttribute("position",new Tt(e,3));const o=new Tt(s,3);if(this.threads={attribute:o,base:Float32Array.from(s),ends:i},n===void 0){r.setAttribute("color",o),this.parent.add(new Zp(r,new Cd({vertexColors:!0,transparent:!0,opacity:sm,blending:Rr,depthWrite:!1})));return}r.setAttribute("aColor",o),JS(r,n.modes,n.starts),this.threadMaterial=ZS(n.cycle,{opacity:sm,additive:!0});const a=new Zp(r,this.threadMaterial);a.frustumCulled=!1,this.parent.add(a)}frame(e){const s=this.threadMaterial?.uniforms.time;s!==void 0&&(s.value=e)}threadsCarryWave(){return this.threadMaterial!==null}nebula_add(e,s,i,n,r){const o=new Id(new Kl({map:s_(),color:n,transparent:!0,opacity:r?BM/3:BM,blending:Rr,depthWrite:!1}));o.position.copy(s),o.scale.setScalar(i*2),o.renderOrder=0,this.parent.add(o),this.nebulaList.push({id:e,position:s.clone(),radius:i}),this.nebulaSprites.set(e,{material:o.material,base:o.material.opacity})}stars_fade(e,s){for(const i of e){const n=i.layer===void 0?void 0:this.layers[i.layer];n===void 0||i.slot===void 0||(n.alpha.setX(i.slot,(n.base[i.slot]??1)*s),this.starsTouched=!0)}}threads_fade(e,s){if(this.threads===null||e.length===0)return;const i=this.threads.attribute.array,n=this.threads.base;for(const r of e)for(let o=r*6;o<r*6+6;o++)i[o]=(n[o]??0)*s;this.threadsTouched=!0}flush(){if(this.starsTouched)for(const e of this.layers)e.alpha.needsUpdate=!0;this.threadsTouched&&this.threads!==null&&(this.threads.attribute.needsUpdate=!0),this.starsTouched=!1,this.threadsTouched=!1}clear(){this.stars=[],this.index=new Map,this.nebulaList=[],this.materials=[],this.layers=[],this.threads=null,this.threadMaterial=null,this.nebulaSprites=new Map,this.starsById=null,this.starsTouched=!1,this.threadsTouched=!1}presence_set(e,s){for(const i of e){for(const r of this.stars_list(i)){const o=r.layer===void 0?void 0:this.layers[r.layer];o===void 0||r.slot===void 0||(o.alpha.setX(r.slot,(o.base[r.slot]??1)*s),this.starsTouched=!0)}const n=this.nebulaSprites.get(i);n!==void 0&&(n.material.opacity=n.base*s)}}flash_set(e,s){for(const i of this.stars_list(e)){const n=i.layer===void 0?void 0:this.layers[i.layer];n===void 0||i.slot===void 0||(n.flash.setX(i.slot,s),n.flash.needsUpdate=!0)}}threads_present(e){const s=this.threads;if(s===null||s.ends.length===0)return;const i=s.attribute.array,n=s.ends.length/2;for(let r=0;r<n;r++){const o=e(s.ends[r*2]??"")&&e(s.ends[r*2+1]??"")?1:0;for(let a=r*6;a<r*6+6;a++)i[a]=(s.base[a]??0)*o}this.threadsTouched=!0}stars_list(e){if(this.starsById===null){this.starsById=new Map;for(const s of this.stars)this.starsById.set(s.id,[...this.starsById.get(s.id)??[],s])}return this.starsById.get(e)??[]}}class IF{parent;geometries=new mF;byId=new Map;edges=[];constructor(e){this.parent=e}get map(){return this.byId}sphere_add(e,s,i,n){const r=n.flat===!0?new Zg(i,36):this.geometries.of(i),o=new lo({color:n.color,roughness:.35,metalness:.15,emissive:n.selected===!0?new Ke("#ffffff"):new Ke("#000000"),emissiveIntensity:n.selected===!0?.35:0,...n.dim===!0?{transparent:!0,opacity:wh}:{},...n.fade!==void 0?{transparent:!0,opacity:n.fade}:{}}),a=new ii(r,o);return n.flat===!0&&(o.transparent=!0,o.depthTest=!1,a.renderOrder=2),a.position.copy(s),a.userData.nodeId=e,a.userData.dim=n.dim===!0,this.parent.add(a),this.byId.set(e,a),a}halo_add(e,s,i,n,r){const o=new ii(new kd(i,24,18),new Kg({color:n,transparent:!0,opacity:r?NM*.4:NM,depthWrite:!1}));o.position.copy(s),o.renderOrder=1,o.userData.nodeId=e,o.userData.halo=!0,o.userData.dim=r,this.parent.add(o),this.byId.set(e,o)}edge_add(e,s,i,n,r,o,a=!1){const l=new cs().setFromPoints([i,n]);let c;o?(c=new Xp(l,new oP({color:r,dashSize:.25,gapSize:.18,transparent:!0,opacity:a?wh:.9})),c.computeLineDistances()):c=new Xp(l,new Cd({color:r,transparent:!0,opacity:a?wh:.75})),this.parent.add(c),this.edges.push({line:c,fromId:e,toId:s,dashed:o})}edges_follow(){for(const e of this.edges){const s=this.byId.get(e.fromId),i=this.byId.get(e.toId);s===void 0||i===void 0||(e.line.geometry.setFromPoints([s.position,i.position]),e.dashed&&e.line.computeLineDistances())}}recolor(e,s){const i=this.byId.get(e);i===void 0||!(i.material instanceof lo)||(i.material.color=s,delete i.userData.lampBase)}select(e){for(const[s,i]of this.byId){if(!(i.material instanceof lo))continue;const n=s===e;i.material.emissive.set(n?"#ffffff":"#000000"),i.material.emissiveIntensity=n?.35:0}}remove(e){this.parent.remove(e),e.material instanceof qn&&e.material.dispose();const s=e.userData.nodeId;typeof s=="string"&&this.byId.get(s)===e&&this.byId.delete(s)}clear(){this.byId=new Map,this.edges=[]}dispose(){this.geometries.dispose()}}function i_(t){return t==="live"?1:t==="done"||t==="failed"?2:0}class DF{host;sets=[];materials=[];glows=new Map;stale=!1;census=0;censusLines=0;constructor(e){this.host=e}materialCount(){return this.materials.length}censusCount(){return this.census}censusLineCount(){return this.censusLines}holds(e){return this.sets.some(s=>s.members.has(e))}stale_mark(){this.stale=!0}build(e,s,i){const n=e.mix,r=this.host.palette(),o=[];for(const z of s){const x=this.host.node(z);if(x!==void 0){for(const M of x.parents){const S=this.host.node(M);S!==void 0&&i.has(M)&&o.push({fromId:M,from:S,toId:z,to:x,join:!1})}for(const M of x.joins){const S=this.host.node(M);S!==void 0&&i.has(M)&&o.push({fromId:M,from:S,toId:z,to:x,join:!0})}}}if(o.length===0)return;const a=new Map,l=(z,x=new Set)=>{const M=a.get(z);if(M!==void 0)return M;if(x.has(z))return 0;x.add(z);const S=this.host.node(z),T=S===void 0?[]:[...S.parents,...S.joins].filter(E=>i.has(E)),I=T.length===0?0:1+Math.max(...T.map(E=>l(E,x)));return a.set(z,I),I},c=performance.now(),h=new Float32Array(o.length*3),d=new Float32Array(o.length),u=new Float32Array(o.length),p=r.edge.clone().lerp(new Ke("#ffffff"),.45),f=new Yg(nm(),new is({uniforms:{time:{value:c},opacity:{value:n},born:{value:c},cycle:{value:1}},vertexShader:KS,fragmentShader:XS,transparent:!0}),o.length),_=new W(0,1,0),g=new Zt;let m=0;const w=[],y=new Map,b=new Set;o.forEach(({fromId:z,from:x,toId:M,to:S,join:T},I)=>{const E=S.position.clone().sub(x.position),O=E.length(),R=Math.max(.06,Math.min(x.radius,S.radius)*.34)*(e.thickness??1);g.position.copy(x.position).addScaledVector(E,.5),g.quaternion.setFromUnitVectors(_,O>0?E.clone().divideScalar(O):_),g.scale.set(R,O,R),g.updateMatrix(),f.setMatrixAt(I,g.matrix),w.push({from:z,to:M,width:R});const C=S.state==="failed"?r.error:T?r.join:p;h.set([C.r,C.g,C.b],I*3),d[I]=i_(S.state);const k=l(z);if(m=Math.max(m,k),u[I]=k*Gn,d[I]===1&&b.add(M),d[I]===2){const B=u[I]+Vi/2;y.set(M,Math.min(y.get(M)??1/0,B)),k===0&&y.set(z,0)}}),f.instanceMatrix.needsUpdate=!0;const v=nm().clone();if(v.setAttribute("aColor",new Sr(h,3)),v.setAttribute("aMode",new Sr(d,1)),v.setAttribute("aStart",new Sr(u,1)),f.geometry=v,f.frustumCulled=!1,this.host.parent.add(f),e.tubes=f,f.material instanceof is){this.materials.push(f.material);const z=f.material.uniforms.cycle;z!==void 0&&(z.value=(m+1)*Gn+Vi/2+yh)}this.sets.push({mesh:f,edges:w,lamps:y,blinks:b,owner:e,entries:s,members:i})}census_build(e,s){if(e.length===0)return;const i=EF(e,(s+1)*Gn+Vi/2+yh);this.host.parent.add(i),i.material instanceof is&&this.materials.push(i.material),this.census=e.length}censusLines_build(e,s,i){if(e.length===0)return;const n=AF(e,(s+1)*Gn+Vi/2+yh,i);this.host.parent.add(n),n.material instanceof is&&this.materials.push(n.material),this.censusLines=e.length}frame(e){if(this.materials.length!==0){for(const s of this.materials){const i=s.uniforms.time;i!==void 0&&(i.value=e)}this.stale&&this.restatus(),this.lamps_animate(e)}}follow(){const e=new W(0,1,0),s=new Zt;for(const{mesh:i,edges:n}of this.sets)n.forEach(({from:r,to:o,width:a},l)=>{const c=this.host.sphere(r),h=this.host.sphere(o);if(c===void 0||h===void 0)return;const d=h.position.clone().sub(c.position),u=d.length();s.position.copy(c.position).addScaledVector(d,.5),s.quaternion.setFromUnitVectors(e,u>0?d.clone().divideScalar(u):e),s.scale.set(a,u,a),s.updateMatrix(),i.setMatrixAt(l,s.matrix)}),i.instanceMatrix.needsUpdate=!0}release(e){if(this.host.parent.remove(e),this.sets=this.sets.filter(s=>s.mesh!==e),e.geometry.dispose(),e.material instanceof is){const s=e.material;this.materials=this.materials.filter(i=>i!==s),s.dispose()}}clear(){this.materials=[],this.census=0,this.censusLines=0,this.sets=[];for(const e of this.glows.values())e.material.dispose();this.glows=new Map}restatus(){this.stale=!1;const e=this.sets;this.sets=[];for(const s of e){if(this.host.parent.remove(s.mesh),s.mesh.geometry.dispose(),s.mesh.material instanceof is){const i=s.mesh.material;this.materials=this.materials.filter(n=>n!==i),i.dispose()}s.owner.tubes=null,this.build(s.owner,s.entries,s.members)}this.follow()}lamps_animate(e){const s=new Set;for(const{mesh:i,lamps:n,blinks:r}of this.sets){if(n.size===0&&r.size===0||!(i.material instanceof is))continue;const o=Number(i.material.uniforms.born?.value??e),a=Number(i.material.uniforms.cycle?.value??1),l=((e-o)%a+a)%a,c=Math.min(1,Math.max(0,(a-l)/fF));for(const[d,u]of n){const p=l-u;this.lamp_paint(d,p<0?0:c,p>=0&&p<Hc?p/Hc:-1,s)}const h=(e%Vi+Vi)%Vi;for(const d of r){if(n.has(d))continue;const u=Math.max(0,1-h/(Vi*.8));this.lamp_paint(d,u*u,h<Hc?h/Hc:-1,s)}}for(const[i,n]of this.glows)s.has(i)||(n.visible=!1,this.host.sphere(i)===void 0&&(this.host.parent.remove(n),n.material.dispose(),this.glows.delete(i)))}lamp_paint(e,s,i,n){const r=this.host.sphere(e);if(r===void 0||!(r.material instanceof lo))return;let o=r.userData.lampBase;o instanceof Ke||(o=r.material.color.clone(),r.userData.lampBase=o);const a=i<0?0:(1-i)**2;if(r.material.color.copy(o).multiplyScalar(GM+(1-GM)*Math.max(s,a)).lerp(im,Math.min(1,.22*s+.7*a)),i<0)return;let l=this.glows.get(e);l===void 0&&(l=new Id(new Kl({map:s_(),color:o.clone().lerp(im,.35),transparent:!0,blending:Rr,depthWrite:!1})),this.glows.set(e,l),this.host.parent.add(l));const c=r.geometry.parameters?.radius??.55,h=1-(1-i)**3;l.position.copy(r.position),l.scale.setScalar(c*(2+VS*h)*r.scale.x),l.material.opacity=.9*(1-i)**1.5,l.visible=!0,n.add(e)}}class CF{host;groups=new Map;lastAt=0;constructor(e){this.host=e}size(){return this.groups.size}solidCount(){let e=0;for(const s of this.groups.values())s.mix>0&&(e+=1);return e}gather(e,s){for(const i of e){if(i.dim)continue;const n=s(i.id);if(n===null)continue;let r=this.groups.get(n);r===void 0&&(r={entries:[],center:new W,maxRadius:0,mix:0,target:0,meshes:[],tubes:null,threadSegments:[]},this.groups.set(n,r)),r.entries.push(i),r.maxRadius=Math.max(r.maxRadius,i.radius)}for(const i of this.groups.values()){for(const n of i.entries)i.center.add(n.position);i.center.divideScalar(Math.max(1,i.entries.length))}}thread_note(e,s){this.groups.get(e)?.threadSegments.push(s)}step(e,s,i){if(this.groups.size===0)return;const n=this.lastAt===0?0:Math.min(100,i-this.lastAt);this.lastAt=i;const r=e.elements;for(const o of this.groups.values()){let a=1/0;for(const h of o.entries){const d=h.position,u=-(r[2]*d.x+r[6]*d.y+r[10]*d.z+r[14]);u>0&&u<a&&(a=u)}const l=a===1/0?0:2*o.maxRadius*s/a;if(o.target===0&&l>hF?o.target=1:o.target===1&&l<dF&&(o.target=0),o.mix===o.target)continue;const c=n===0?1:n/uF;o.mix=o.target>o.mix?Math.min(1,o.mix+c):Math.max(0,o.mix-c),o.mix>0&&o.meshes.length===0&&this.solid_build(o);for(const h of o.meshes)h.material instanceof lo&&(h.material.opacity=o.mix);if(o.tubes!==null&&o.tubes.material instanceof is){const h=o.tubes.material.uniforms.opacity;h!==void 0&&(h.value=o.mix)}this.host.stars.stars_fade(o.entries,1-o.mix),this.host.stars.threads_fade(o.threadSegments,1-o.mix),o.mix===0&&this.solid_release(o)}this.host.stars.flush()}clear(){this.groups=new Map}solid_build(e){const s=new Set(e.entries.map(i=>i.id));for(const i of e.entries){const n=this.host.look(i.id);n!==void 0&&e.meshes.push(this.host.spheres.sphere_add(i.id,n.position,n.radius,{color:n.color,fade:e.mix}))}this.host.tubes.build(e,e.entries.map(i=>i.id),s)}solid_release(e){for(const s of e.meshes)this.host.spheres.remove(s);e.tubes!==null&&(this.host.tubes.release(e.tubes),e.tubes=null),e.meshes=[]}}const RF=400;function kF(t){return t<=2e3?6:t<=2e4?3:1}class NF{host;mesh=null;base=null;memberIds=[];memberPositions=[];glows=[];constructor(e){this.host=e}drawn(){return this.mesh!==null}ids(){return this.memberIds}positions(){return this.memberPositions}build(e,s,i){let n=0;for(const w of e)w.ghost!==!0&&(n+=Math.max(1,w.count));const r=new e_(1,kF(n)),o=new lo({color:"#ffffff",roughness:.5,metalness:.1}),a=[],l=new Yg(r,o,s?1:n),c=new Ke,h=new Zt,d=new Map,u=new Map;let p=0,f=1;const _=new W;for(const w of e)_.add(w.position);_.divideScalar(Math.max(1,e.length));for(const w of e){if(w.ghost===!0)continue;const y=Math.max(1,w.count),b=y===1?0:w.radius*(1.6+.55*Math.cbrt(y)),v=y===1?w.radius:Math.max(.06,Math.min(w.radius*.5,2.2*b/Math.sqrt(y))),z=[];for(let x=0;x<y;x++){const M=y===1?w.position.clone():pF(x,y,b).add(w.position);z.push(M),c.set(w.color),s?a.push({id:w.id,position:M,radius:v,color:c.clone(),dim:w.dim,ember:w.ember}):(h.position.copy(M),h.scale.setScalar(v),h.updateMatrix(),l.setMatrixAt(p,h.matrix),l.setColorAt(p,c)),this.memberIds.push(w.id),this.memberPositions.push(M),p+=1,f=Math.max(f,_.distanceTo(M)+v)}d.set(w.id,z),u.set(w.id,v),!s&&e.length<=RF&&this.glow_add(w,b+v)}if(s){const w=this.host.starsView();this.host.stars.draw(a,w.pixelRatio,w.heightPx,w.fovDeg)}else l.instanceColor&&(l.instanceColor.needsUpdate=!0),this.host.parent.add(l),this.mesh=l,this.base=l.instanceColor?Float32Array.from(l.instanceColor.array):null;const{specs:g,deepest:m}=BF(e,d,u,i);return!s&&g.length>0&&g.length<=SF?this.host.tubes.census_build(g,m):g.length>0&&this.host.tubes.censusLines_build(g,m,s?{tint:1,opacity:sm,additive:!0}:{tint:1,opacity:.35,additive:!1}),{center:_,radius:f}}flare(e,s,i,n){let r=0;if(this.mesh===null||this.base===null||!this.mesh.instanceColor)return r;const o=this.mesh.instanceColor.array,a=this.base;for(let l=0;l<this.memberIds.length;l++){const c=e(this.memberIds[l]??"");if(c===void 0)continue;r=Math.max(r,c);const h=s-c,d=h>=0&&h<=n?Math.sin(h/n*Math.PI):0,u=l*3;o[u]=a[u]+(i.r-a[u])*d,o[u+1]=a[u+1]+(i.g-a[u+1])*d,o[u+2]=a[u+2]+(i.b-a[u+2])*d}this.mesh.instanceColor.needsUpdate=!0;for(const{id:l,sprite:c,reach:h}of this.glows){const d=e(l),u=d===void 0?-1:s-d,p=u>=0&&u<=n?Math.sin(u/n*Math.PI):0;c.visible=p>0,c.scale.setScalar(h*(2+VS*p)),c.material.opacity=.9*p}return r}glow_add(e,s){const i=new Id(new Kl({map:s_(),color:e.color.clone().lerp(im,.35),transparent:!0,blending:Rr,depthWrite:!1}));i.position.copy(e.position),i.visible=!1,this.host.parent.add(i),this.glows.push({id:e.id,sprite:i,reach:s})}pick(e){if(this.mesh===null)return null;const s=e.intersectObject(this.mesh)[0];return s===void 0||s.instanceId===void 0?null:(this.mesh.setColorAt(s.instanceId,new Ke("#ffffff")),this.mesh.instanceColor&&(this.mesh.instanceColor.needsUpdate=!0),this.memberIds[s.instanceId]??null)}clear(){this.mesh=null,this.base=null,this.memberIds=[],this.memberPositions=[];for(const{sprite:e}of this.glows)e.removeFromParent(),e.material.dispose();this.glows=[]}}function BF(t,e,s,i){const n=new Map(t.map(h=>[h.id,h])),r=new Map,o=(h,d=new Set)=>{const u=r.get(h);if(u!==void 0)return u;if(d.has(h))return 0;d.add(h);const p=(n.get(h)?.parents??[]).filter(_=>n.has(_)),f=p.length===0?0:1+Math.max(...p.map(_=>o(_,d)));return r.set(h,f),f},a=i.edge.clone().lerp(new Ke("#ffffff"),.45),l=[];let c=0;for(const h of t){const d=e.get(h.id)??[];for(const u of h.parents){const p=e.get(u);if(!p||p.length===0)continue;const f=Math.max(.02,Math.min(s.get(h.id)??.1,s.get(u)??.1)*.34),_=o(u)*Gn;c=Math.max(c,o(u));for(let g=0;g<d.length;g++){const m=d[g],w=p.length===d.length?p[g]:p[g%p.length];w===void 0||m===void 0||l.push({from:w,to:m,width:f,color:h.state==="failed"?i.error:a,mode:i_(h.state),start:_})}}}return{specs:l,deepest:c}}const LM=.028,GF=.25,PF="rgba(0, 0, 0, 0.7)",Za=48;class LF{parent;captions=new Map;shown=!0;constructor(e){this.parent=e}count(){return this.captions.size}caption_add(e,s,i,n,r,o,a=0){const l=document.createElement("canvas"),c=l.getContext("2d"),h=`600 ${Za}px sans-serif`;let d=s.length*Za*.6;if(c!==null&&(c.font=h,d=Math.ceil(c.measureText(s).width)),l.width=Math.max(1,d+Za),l.height=Math.round(Za*1.5),c!==null){c.font=h,c.textBaseline="middle";const _=l.height/4;c.fillStyle=PF,c.beginPath(),c.roundRect(0,0,l.width,l.height,_),c.fill(),c.fillStyle=`#${r.getHexString()}`,c.fillText(s,Za/2,l.height/2)}const u=new RS(l),p=new Kl({map:u,transparent:!0,depthWrite:!1,depthTest:!1,sizeAttenuation:!1,opacity:o?GF:.9}),f=new Id(p);f.scale.set(LM*(l.width/l.height),LM,1),f.center.set(.5,0),f.position.set(i.x,i.y+n,i.z),f.renderOrder=4,f.visible=this.shown,this.parent.add(f),this.captions.get(e)?.texture.dispose(),this.captions.set(e,{sprite:f,texture:u,rank:a})}declutter(e){if(!this.shown)return 0;const s=[...this.captions.values()].sort((a,l)=>l.rank-a.rank),i=[],n=new W,r=e.projectionMatrix.elements[0]??1,o=e.projectionMatrix.elements[5]??1;for(const a of s){if(a.sprite.getWorldPosition(n).project(e),n.z>1){a.sprite.visible=!1;continue}const l=a.sprite.scale.x*r/2,c={left:n.x-l,right:n.x+l,bottom:n.y,top:n.y+a.sprite.scale.y*o},h=i.some(d=>c.left<d.right&&d.left<c.right&&c.bottom<d.top&&d.bottom<c.top);a.sprite.visible=!h,h||i.push(c)}return i.length}shown_set(e){if(this.shown=e,!e)for(const s of this.captions.values())s.sprite.visible=!1}shown_get(){return this.shown}clear(){for(const e of this.captions.values())e.texture.dispose();this.captions=new Map}}const WF=.0022,FF=.006,UF=.0035,$F=1e4,WM=700,FM=new W(0,1,0),jF={minDistance:8,margin:1.15,stance:"axis",farFloor:200,farScale:2};function HF(t){return t*t*(3-2*t)}class VF{camera;world;clock;focus=new W;flight=null;home=null;holding=!1;touched=!1;spinIdleUntil=0;tumbleAxis=new W(0,1,0);tumblePhase;constructor(e,s,i=Date.now,n=Math.random()*Math.PI*2){this.camera=e,this.world=s,this.clock=i,this.tumblePhase=n}flying(){return this.flight!==null}holding_get(){return this.holding}touched_get(){return this.touched}touch_note(){this.touched=!0}spin_pause(){this.spinIdleUntil=this.clock()+$F}eyeDistance(){return this.camera.position.distanceTo(this.focus)}turn_about(e,s){const i=new vo().setFromAxisAngle(e,s);this.world.position.sub(this.focus).applyQuaternion(i).add(this.focus),this.world.quaternion.premultiply(i)}orbit(e,s){this.turn_about(FM,e*.005),this.turn_about(new W().setFromMatrixColumn(this.camera.matrixWorld,0).normalize(),s*.005)}dolly(e,s=!1){if(this.spin_pause(),this.touched=!0,s){const o=this.camera.getWorldDirection(new W),a=Math.max(4,this.camera.position.length())*.0012;this.camera.position.addScaledVector(o,-e*a);return}const i=this.camera.position.clone().sub(this.focus),n=i.length(),r=Math.min(Math.max(n*Math.exp(e*.001),1.5),Math.max(40,this.camera.far*.45));this.camera.position.copy(this.focus).addScaledVector(i,r/Math.max(1e-4,n))}pan(e,s){const i=this.camera.position.distanceTo(this.focus)*.0016,n=new W().setFromMatrixColumn(this.camera.matrixWorld,0).multiplyScalar(-e*i).add(new W().setFromMatrixColumn(this.camera.matrixWorld,1).multiplyScalar(s*i));this.camera.position.add(n),this.focus.add(n)}frame(e,s,i={}){const n={...jF,...i},r=Math.max(n.minDistance,this.fitDistance(s)*n.margin);this.world.position.copy(e).applyQuaternion(this.world.quaternion).negate(),this.focus.set(0,0,0),n.stance==="threeQuarter"?this.camera.position.set(r*.5,r*.4,r*.85):this.camera.position.set(0,0,r),this.camera.far=Math.max(n.farFloor,(r+s)*n.farScale),this.camera.updateProjectionMatrix(),this.camera.lookAt(0,0,0)}touch_clear(){this.touched=!1}flyToFit(e,s,i,n=1,r=1.15){if(e.length===0){i();return}let o=0;const a=new W;for(const u of e)a.add(u.position),o=Math.max(o,u.radius);a.divideScalar(e.length);const l=e.map(u=>a.distanceTo(u.position)).sort((u,p)=>u-p),c=Math.max(1,Math.min(l.length,Math.ceil(l.length*Math.min(1,Math.max(.1,n))))),h=Math.max(1,(l[c-1]??1)+o),d=Math.max(3,this.fitDistance(h)*r);this.camera.far=Math.max(this.camera.far,(d+h)*2),this.camera.updateProjectionMatrix(),this.flyAlongLine(a,d,s,i)}flyToward(e,s,i,n){this.flyAlongLine(e.position,Math.max(s,e.radius*4),i,n)}flyInto(e,s){if(this.flight!==null||this.holding)return!1;this.holding=!0,this.home={position:this.camera.position.clone(),quaternion:this.camera.quaternion.clone()};const i=e.clone().add(this.camera.position.clone().sub(e).normalize().multiplyScalar(.4));return this.flight_begin(i,this.aim_compute(this.camera.position,e),WM,s),!0}flyBack(e){const s=this.home;if(s===null){this.holding=!1,e();return}this.flight_begin(s.position.clone(),s.quaternion.clone(),WM,()=>{this.home=null,this.holding=!1,this.spin_pause(),e()})}flight_step(){const e=this.flight;if(e===null)return;const s=Math.min(1,(this.clock()-e.startedAt)/e.durationMs),i=HF(s);this.camera.position.lerpVectors(e.fromPos,e.toPos,i),this.camera.quaternion.slerpQuaternions(e.fromQuat,e.toQuat,i),s>=1&&(this.flight=null,e.onDone())}spin_step(e){!e||this.holding||this.flight!==null||this.clock()<this.spinIdleUntil||this.turn_about(FM,WF)}tumble_step(){this.tumblePhase+=UF,this.tumbleAxis.set(Math.sin(this.tumblePhase*.7),Math.cos(this.tumblePhase*.4)+.6,Math.sin(this.tumblePhase*.3)*.8).normalize(),this.world.rotateOnWorldAxis(this.tumbleAxis,FF)}fitDistance(e){const s=this.camera.fov*Math.PI/180,i=e/Math.tan(s/2),n=e/(Math.tan(s/2)*Math.max(.1,this.camera.aspect));return Math.max(i,n)}aim_compute(e,s){const i=this.camera.clone();return i.position.copy(e),i.lookAt(s),i.quaternion.clone()}flyAlongLine(e,s,i,n){const r=this.camera.position.clone().sub(e);r.lengthSq()<1e-4&&r.set(0,0,1),r.normalize();const o=e.clone().add(r.multiplyScalar(s));this.focus.copy(e),this.flight_begin(o,this.aim_compute(o,e),i,n)}flight_begin(e,s,i,n){this.flight={fromPos:this.camera.position.clone(),toPos:e,fromQuat:this.camera.quaternion.clone(),toQuat:s,startedAt:this.clock(),durationMs:i,onDone:n}}}const QS=4,qF=350,KF=30,YF=600,XF=400;class ZF{element;rig;target;mode;clock;touches=new Map;pinch=null;gestureHeld=!1;lastTap=null;kind="mouse";tapActivatedAt=0;suppressClick=!1;viewDrag=null;grabbing=!1;over=!1;detachers=[];constructor(e,s,i,n,r=Date.now){this.element=e,this.rig=s,this.target=i,this.mode=n,this.clock=r,e.style.touchAction="none",this.listen("click",o=>this.click_handle(o)),this.listen("dblclick",o=>{this.clock()-this.tapActivatedAt<YF||this.target.tap(o,"activate")}),this.listen("pointerdown",o=>this.down_handle(o)),this.listen("pointerup",o=>this.up_handle(o)),this.listen("pointercancel",o=>this.up_handle(o)),this.listen("pointermove",o=>this.move_handle(o)),this.listen("pointerleave",o=>{this.over=!1,this.target.leave(o)}),this.listen("wheel",o=>{o.preventDefault(),this.rig.dolly(o.deltaY,this.mode.untethered())},{passive:!1}),this.listen("contextmenu",o=>o.preventDefault())}pointerOver(){return this.over}pressKind(){return this.kind}fingersDown(){return this.touches.size}detach(){for(const e of this.detachers.splice(0))e()}listen(e,s,i){this.element.addEventListener(e,s,i),this.detachers.push(()=>this.element.removeEventListener(e,s,i))}click_handle(e){if(this.suppressClick){this.suppressClick=!1;return}if(this.kind==="touch"){const s=this.clock(),i=this.lastTap;if(i!==null&&s-i.at<=qF&&Math.hypot(e.clientX-i.x,e.clientY-i.y)<=KF){this.lastTap=null,this.tapActivatedAt=s,this.target.tap(e,"activate");return}this.lastTap={at:s,x:e.clientX,y:e.clientY}}this.target.tap(e,"select")}down_handle(e){if(this.kind=e.pointerType,e.pointerType==="touch"){if(e.isPrimary&&(this.touches.clear(),this.pinch=null,this.gestureHeld=!1),this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.touches.size===2){this.gesture_begin();return}if(this.touches.size>2||this.gestureHeld)return;this.press(e),this.hover(e);return}this.press(e)}up_handle(e){if(e.pointerType==="touch"&&(this.touches.delete(e.pointerId),this.touches.size<2&&(this.pinch=null),this.touches.size===0&&this.gestureHeld)){this.gestureHeld=!1,this.suppressClick=!0,setTimeout(()=>{this.suppressClick=!1},XF),this.release(),this.target.gesture_end?.();return}this.release()}move_handle(e){if(e.pointerType==="touch"&&this.touches.has(e.pointerId)){if(this.touches.set(e.pointerId,{x:e.clientX,y:e.clientY}),this.pinch!==null){this.gesture_move();return}if(this.gestureHeld)return}this.grabbing?this.target.grab_move(e):this.viewDrag!==null?this.view_move(e):this.hover(e)}hover(e){this.over=!0,this.target.hover(e)}press(e){if(!(this.rig.holding_get()||this.rig.flying())){this.rig.spin_pause(),this.target.grab_begin(e)?this.grabbing=!0:this.viewDrag={lastX:e.clientX,lastY:e.clientY,startX:e.clientX,startY:e.clientY,pan:e.shiftKey||e.button===2||e.button===1,moved:!1};try{this.element.setPointerCapture(e.pointerId)}catch{}this.target.tip_hide()}}release(){this.viewDrag!==null&&(this.viewDrag.moved&&(this.suppressClick=!0),this.viewDrag=null,this.rig.spin_pause()),this.grabbing&&(this.grabbing=!1,this.rig.spin_pause(),this.target.grab_end()&&(this.suppressClick=!0))}view_move(e){const s=this.viewDrag;if(s===null)return;this.rig.spin_pause();const i=e.clientX-s.lastX,n=e.clientY-s.lastY;s.lastX=e.clientX,s.lastY=e.clientY,!s.moved&&Math.abs(e.clientX-s.startX)+Math.abs(e.clientY-s.startY)>QS&&(s.moved=!0,this.rig.touch_note()),s.moved&&(s.pan||this.mode.flat()?this.rig.pan(i,n):this.rig.orbit(i,n))}fingers_read(){const[e,s]=[...this.touches.values()];return e===void 0||s===void 0?null:{spread:Math.hypot(e.x-s.x,e.y-s.y),midX:(e.x+s.x)/2,midY:(e.y+s.y)/2}}gesture_begin(){this.release(),this.gestureHeld=!0,this.pinch=this.fingers_read(),this.rig.spin_pause(),this.target.tip_hide()}gesture_move(){const e=this.fingers_read();e===null||this.pinch===null||(e.spread>0&&this.pinch.spread>0&&this.rig.dolly(Math.log(this.pinch.spread/e.spread)/.001,this.mode.untethered()),(this.mode.flat()||!this.mode.untethered())&&this.rig.pan(e.midX-this.pinch.midX,e.midY-this.pinch.midY),this.pinch=e)}}const JF=14,QF=4;class eU{camera;world;element;sources;starGlow;raycaster=new fP;constructor(e,s,i,n,r){this.camera=e,this.world=s,this.element=i,this.sources=n,this.starGlow=r}ray_aim(e){const s=this.element.getBoundingClientRect(),i=new tt((e.clientX-s.left)/s.width*2-1,-((e.clientY-s.top)/s.height)*2+1);return this.world.updateMatrixWorld(!0),this.raycaster.setFromCamera(i,this.camera),this.raycaster}mesh_under(e){const s=this.ray_aim(e).intersectObjects([...this.sources.meshes()]).filter(r=>r.object.userData.dim!==!0),n=(s.find(r=>r.object.userData.halo!==!0)??s[0])?.object;return n instanceof ii?n:null}meshNode_under(e){const s=this.mesh_under(e)?.userData.nodeId;return typeof s=="string"?s:null}node_under(e,s){const i=this.meshNode_under(e);if(i!==null)return i;const n=this.sources.census();return n!==null?n.pick(this.ray_aim(e)):this.star_under(e,s)}star_under(e,s){const i=this.sources.stars(),n=this.sources.nebulae(),r=this.element.getBoundingClientRect(),o=e.clientX-r.left,a=e.clientY-r.top;this.world.updateMatrixWorld(!0),this.camera.updateMatrixWorld();const l=r.height/(2*Math.tan(this.camera.fov*Math.PI/360)),c=new Ot().multiplyMatrices(this.camera.matrixWorldInverse,this.world.matrixWorld),d=new Ot().multiplyMatrices(this.camera.projectionMatrix,c).elements,u=c.elements,p=m=>{const w=-(u[2]*m.x+u[6]*m.y+u[10]*m.z+u[14]);if(w<=0)return null;const y=d[3]*m.x+d[7]*m.y+d[11]*m.z+d[15],b=(d[0]*m.x+d[4]*m.y+d[8]*m.z+d[12])/y,v=(d[1]*m.x+d[5]*m.y+d[9]*m.z+d[13])/y;return{x:(b+1)/2*r.width,y:(1-v)/2*r.height,depth:w}},f=s?JF:QF;let _=null,g=1/0;for(const m of i){if(m.dim)continue;const w=p(m.position);if(w===null)continue;const y=Math.max(f,this.starGlow*m.radius*l/w.depth),b=Math.hypot(w.x-o,w.y-a);if(b>y)continue;const v=b/y;v<g&&(g=v,_=m.id)}if(_!==null)return _;for(const m of n){const w=p(m.position);if(w!==null&&Math.hypot(w.x-o,w.y-a)<=m.radius*l/w.depth)return m.id}return null}}const tU=3e4,sU=900;class iU{clock;order;first;last;shown=0;moment;speed=1;running=!1;lastWall;flashes=new Map;constructor(e,s=Date.now){this.clock=s,this.order=[...e].map(([i,n])=>({id:i,at:n})).sort((i,n)=>i.at-n.at||(i.id<n.id?-1:1)),this.first=this.order[0]?.at??0,this.last=this.order[this.order.length-1]?.at??0,this.moment=this.first,this.lastWall=s()}span(){return[this.first,this.last]}ids(){return this.order.map(e=>e.id)}playing(){return this.running}at(){return this.moment}play(e=this.speed){this.speed=Math.max(.05,e),this.moment>=this.last&&this.shown>=this.order.length&&this.seek(this.first),this.running=!0,this.lastWall=this.clock()}pause(){this.running=!1}seek(e){this.moment=Math.max(this.first,Math.min(this.last,e));const s=[],i=[];for(;this.shown<this.order.length&&this.order[this.shown].at<=this.moment;)s.push(this.order[this.shown].id),this.shown+=1;for(;this.shown>0&&this.order[this.shown-1].at>this.moment;){this.shown-=1;const n=this.order[this.shown].id;i.push(n),this.flashes.delete(n)}return{at:this.moment,arrived:s,departed:i,done:this.moment>=this.last}}step(){const e=this.clock(),s=e-this.lastWall;if(this.lastWall=e,!this.running)return{at:this.moment,arrived:[],departed:[],done:this.moment>=this.last};const i=(this.last-this.first)/tU*this.speed,n=this.seek(i>0?this.moment+s*i:this.last);for(const r of n.arrived)this.flashes.set(r,e);return n.done&&(this.running=!1),n}flashing(){const e=this.clock(),s=new Map;for(const[i,n]of this.flashes){const r=(e-n)/sU;r>=1?(this.flashes.delete(i),s.set(i,0)):s.set(i,1-r)}return s}}function nU(t){const e=new Set(t.map(a=>a.id)),s=a=>!a.parentIds.some(l=>e.has(l)),i=t.filter(s),n=t.filter(a=>!s(a));if(i.length===0||n.length===0)return!1;const r=Math.min(...i.map(a=>a.y)),o=Math.max(...n.map(a=>a.y));return r>=o-1e-6}function rU(t,e){const s=new Set(t.filter(r=>r.ghost===!0||r.halo===!0).map(r=>r.id)),i=[];let n=null;for(const r of t){if(s.has(r.id))continue;const o=e.get(r.id);if(o!==void 0)for(const a of r.parentIds){if(s.has(a))continue;const l=e.get(a);if(l===void 0)continue;const c=Math.hypot(o.x-l.x,o.y-l.y,o.z-l.z);i.push(c),(n===null||c>n.length)&&(n={length:c,from:a,to:r.id})}}return i.length===0||n===null?{}:(i.sort((r,o)=>r-o),{edgeMedian:(i[Math.floor(i.length/2)]??0).toFixed(1),edgeLongest:`${n.length.toFixed(1)}(${n.from}->${n.to})`})}const oU=90*400,aU=12;function e1(t){const e={id:t.id,parents:[...t.parentIds,...t.joinParentIds]};return t.metric!==void 0&&(e.metric=t.metric),e}function lU(t){const e=kg(t.map(s=>{const i={id:s.id,parentIds:s.parentIds};return s.metric!==void 0&&(i.metric=s.metric),i}));return t.map((s,i)=>{const n=e[i];return{node:s,position:new W(...n?.position??[0,0,0]),radius:n?.radius??Bt}})}function t1(t){return kz(t.map(e1))}function s1(t,e=3,s=new Map,i=Dr,n=new Set){const r=new Map([...s].map(([a,l])=>[a,[l.x,l.y,l.z]])),o=Nz(t.map(e1),e,r,i,n);return{total:o.total,moving:o.moving,step:o.step,place:()=>o.place().map((a,l)=>({node:t[l],position:new W(...a.position),radius:a.radius}))}}function cU(t,e=3,s=new Map,i=Dr,n=new Set){const r=s1(t,e,s,i,n);return r.step(r.total),r.place()}function hU(t,e,s){const i=new Map(t.map(a=>[a.node.id,a])),n=new Map;for(const a of t)for(const l of a.node.parentIds)n.set(l,[...n.get(l)??[],a]);const r=a=>{const l=n.get(a)??[];if(l.length===0)return null;const c=new W;for(const h of l)c.add(h.position);return c.divideScalar(l.length)},o=[];for(const{node:a,position:l,radius:c}of t){if(a.caption!==void 0){const h=a.ghost===!0?r(a.id):null,d=h!==null?0:a.halo===!0?Yu(a.count??1):c;s.labels.caption_add(a.id,a.caption,h??l,d,e.done,a.dim===!0,a.count??1)}if(!(a.ghost===!0&&a.halo!==!0)){if(s.starring&&a.solid!==!0){if(a.halo===!0){s.stars.nebula_add(a.id,l,Yu(a.count??1),e.edge,a.dim===!0);continue}o.push({id:a.id,position:l.clone(),radius:c,color:va(a.look.paint,e).clone(),dim:a.dim===!0,ember:a.look.ember,...a.ring===!0?{ring:!0}:{}});continue}if(a.halo===!0){s.spheres.halo_add(a.id,l,Yu(a.count??1),e.edge,a.dim===!0);continue}s.spheres.sphere_add(a.id,l,c,{color:va(a.look.paint,e),dim:a.dim===!0,selected:a.id===s.selected,flat:s.flat})}}return{starred:o,byId:i}}function dU(t,e,s,i){const n=[],r=[],o=f=>!i.starring||f.node.solid===!0,a=[],l=[],c=[];let h=0;const d=new Map,u=(f,_=new Set)=>{const g=d.get(f);if(g!==void 0)return g;if(_.has(f))return 0;_.add(f);const m=e.get(f)?.node,w=m===void 0?[]:[...m.parentIds,...m.joinParentIds].filter(b=>e.get(b)?.node.ghost!==!0&&e.has(b)),y=w.length===0?0:1+Math.max(...w.map(b=>u(b,_)));return d.set(f,y),y},p=(f,_,g,m,w,y)=>{const b=m?.35:1,v=n.length/6;n.push(f.x,f.y,f.z,_.x,_.y,_.z),a.push(y,w.id),r.push(g.r*b,g.g*b,g.b*b,g.r*b,g.g*b,g.b*b);const z=m?0:i_(w.look.state),x=z===0?0:u(y);h=Math.max(h,x),l.push(z),c.push(x*Gn);const M=m||i.handoffKey===void 0?null:i.handoffKey(w);M!==null&&i.handoff.thread_note(M,v)};for(const f of t){const{node:_,position:g}=f;if(_.ghost!==!0){for(const m of _.parentIds){const w=e.get(m);if(!w||w.node.ghost===!0)continue;const y=_.dim===!0||w.node.dim===!0;o(f)&&o(w)?!i.starring&&y&&i.spheres.edge_add(m,_.id,w.position,g,s.edge,!1,y):p(w.position,g,s.edge,y,_,m)}for(const m of _.joinParentIds){const w=e.get(m);if(!w)continue;if(_.joinFaint===!0){p(w.position,g,s.join,!0,_,m);continue}const y=_.dim===!0||w.node.dim===!0;o(f)&&o(w)?!i.starring&&y&&i.spheres.edge_add(m,_.id,w.position,g,s.join,!0,y):p(w.position,g,s.join,y,_,m)}}}i.stars.threads_draw(n,r,a,{modes:l,starts:c,cycle:(h+1)*Gn+Vi/2+yh})}function uU(t,e,s,i,n){const r=t.filter(b=>e.has(b.id)),o=new Map;if(r.length===0)return o;const a=new W;for(const b of r)a.add(e.get(b.id));a.divideScalar(r.length);const l=s.clone().normalize(),c=new W().crossVectors(i,l);c.lengthSq()<1e-9&&c.set(1,0,0).cross(l),c.normalize();const h=new W().crossVectors(l,c).normalize(),d=new Map;for(const b of r){const v=e.get(b.id).clone().sub(a);d.set(b.id,new W(v.dot(c),v.dot(h),0))}const u=new Set(r.map(b=>b.id)),p=r.map(b=>({...b,parentIds:b.parentIds.filter(v=>u.has(v)),joinParentIds:b.joinParentIds.filter(v=>u.has(v))})),f=cU(p,2,d,{...n,gravity:!1}),_=new W;for(const b of f)_.add(b.position);_.divideScalar(f.length);const g=b=>Math.sqrt(b.reduce((v,z)=>v+z*z,0)/Math.max(1,b.length)),m=g(r.map(b=>e.get(b.id).distanceTo(a))),w=g(f.map(b=>Math.hypot(b.position.x-_.x,b.position.y-_.y))),y=w>1e-9&&m>1e-9?m/w:1;for(const b of f){const v=(b.position.x-_.x)*y,z=(b.position.y-_.y)*y;o.set(b.node.id,a.clone().addScaledVector(c,v).addScaledVector(h,z))}return o}class fU{restore=null;active(){return this.restore!==null}clear(){this.restore=null}set(e,s,i,n,r){if(e===null||e.length===0){if(this.restore===null)return!1;for(const[d,u]of this.restore)i.set(d,u);return this.restore=null,!0}if(this.restore!==null)return!1;const o=new Set(e),a=n.world.quaternion.clone().invert(),l=n.camera.position.clone().sub(n.focus).normalize().applyQuaternion(a),c=new W(0,1,0).applyQuaternion(n.camera.quaternion).applyQuaternion(a),h=uU(s.filter(d=>o.has(d.id)),i,l,c,r);if(h.size===0)return!1;this.restore=new Map([...h.keys()].map(d=>[d,i.get(d).clone()]));for(const[d,u]of h)i.set(d,u);return!0}}class pU{ports;constructor(e){this.ports=e}ids(){return[...this.ports.meshes().keys(),...this.ports.stars.ids()]}world_find(e){const s=this.ports.meshes().get(e);if(s!==void 0){const n=s.geometry;return n.boundingSphere===null&&n.computeBoundingSphere(),{position:s.getWorldPosition(new W),radius:n.boundingSphere?.radius??Bt}}const i=this.ports.stars.entry(e);return i!==void 0?{position:this.ports.group.localToWorld(i.position.clone()),radius:i.radius}:null}diveTarget_find(e){const s=this.ports.meshes().get(e),i=s===void 0?this.ports.census.ids().indexOf(e):-1;return s===void 0&&i<0?null:(this.ports.group.updateMatrixWorld(!0),s!==void 0?s.getWorldPosition(new W):this.ports.group.localToWorld((this.ports.census.positions()[i]??new W).clone()))}reaches_list(e){const s=new Set(e),i=[];this.ports.group.updateMatrixWorld(!0);for(const n of this.ids()){if(s.size>0&&!s.has(n))continue;const r=this.world_find(n);r!==null&&i.push(r)}return i}}function mU(t,e){return t.map(s=>{const i=s.node;return{id:i.id,position:s.position,radius:s.radius,count:Math.max(1,i.count??1),color:va(i.look.paint,e),dim:i.dim===!0,ember:i.look.ember,state:i.look.state,parents:i.parentIds,ghost:i.ghost===!0}})}function gU(t,e){return{position:t.position,radius:t.radius,color:va(t.node.look.paint,e)}}function _U(t){return{position:t.position,radius:t.radius,parents:t.node.parentIds,joins:t.node.joinFaint===!0?[]:t.node.joinParentIds,state:t.node.look.state}}function bU(t,e){return e.updateMatrixWorld(!0),t.updateMatrixWorld(),new Ot().multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)}function MU(t,e){return t/(2*Math.tan(e*Math.PI/360))}const Zu=.5;class vU{ports;busy=!1;constructor(e){this.ports=e}moving(){return this.busy}frame(e,s,i,n,r){this.busy=!0,this.ports.flyToFit(e,s,()=>{this.busy=!1,i()},n,r)}relight(e,s,i,n,r){this.busy=!0,this.ports.graph_set(e,{wave:!1,fit:!1,frozen:e.nodes.map(o=>o.id)}),r?.(),this.ports.flyToFit(s,i,()=>{this.busy=!1,n()})}unfold(e,s){this.busy=!0;const i=this.ports.positions_get(),n=wU(i,e.from),r=this.ports.random??(()=>Math.random()-.5);for(const l of e.unfolding){const c=e.placed?.[l];i[l]=c!==void 0?[n[0]+c[0],n[1]+c[1],n[2]+c[2]]:[n[0]+r()*Zu,n[1]+r()*Zu,n[2]+r()*Zu]}this.ports.positions_seed(i);const o=new Set(e.unfolding.filter(l=>e.placed?.[l]===void 0)),a=e.graph.nodes.filter(l=>!o.has(l.id)).map(l=>l.id);this.ports.graph_set(e.graph,{wave:!1,fit:!1,frozen:a,...e.physics!==void 0?{physics:e.physics}:{}}),e.drawn?.(),this.ports.flyToFit(e.frame,e.durationMs,()=>{this.busy=!1,s()},e.bulk,e.margin)}descent(e,s,i,n){this.busy=!0;const r=()=>{s().then(o=>{if(this.ports.alive()){if(o===null){this.busy=!1,n();return}this.unfold(o,i)}})};"toward"in e?this.ports.flyToward(e.toward,e.distance,e.durationMs,r):this.ports.flyToFit(e.fit,e.durationMs,r)}}function wU(t,e){for(const s of e){const i=[0,0,0];let n=0;for(const r of s){const o=t[r];o!==void 0&&(i[0]+=o[0],i[1]+=o[1],i[2]+=o[2],n+=1)}if(n>0)return[i[0]/n,i[1]/n,i[2]/n]}return[0,0,0]}const yU=1e3;class zU{workerOf;generation;worker=null;disposed=!1;constructor(e,s){this.workerOf=e,this.generation=s}dispose(){this.disposed=!0,this.worker?.terminate(),this.worker=null}run(e){const s=t1(e.nodes),i=new Map([...e.seeds].map(([h,d])=>[h,[d.x,d.y,d.z]])),n=d7(e.nodes,e.keyOf,i,e.frozen),r=yU,o=n.length;e.progress(0,r,o);const a=h=>{e.placed(e.nodes.map(d=>{const u=h[d.id]??[0,0,0];return{node:d,position:new W(u[0],u[1],u[2]),radius:s.get(d.id)??Bt}})),e.progress(r,r,o)},l=h=>e.progress(Math.min(r-1,Math.floor(h*r)),r,o);if(this.worker===null){if(this.workerOf===void 0){const h=P7(e.arrangement);if(h===void 0){console.error(`layout: no engine named ${e.arrangement}`),e.progress(r,r,o);return}a(h.run({nodes:n,physics:e.physics},l).positions);return}this.worker=this.workerOf()}const c=this.worker;c.onmessage=h=>{const d=h.data;if(!(d.generation!==this.generation()||this.disposed)){if(d.type==="progress"){l(d.fraction??0);return}if(d.type==="failed"){console.error(`layout: ${d.reason??"the engine failed"}`),e.progress(r,r,o);return}a(d.positions??{})}},c.postMessage({generation:e.generation,nodes:n,physics:e.physics,arrangement:e.arrangement})}}const Ja=700,SU=2500;function xU(t){const e=new Map,s=new Set(t.map(r=>r.id)),i=r=>r.look.waved;let n=!1;for(;!n;){n=!0;for(const r of t){if(e.has(r.id)||!i(r))continue;const o=[...r.parentIds,...r.joinParentIds].filter(l=>s.has(l));if(!o.every(l=>e.has(l)))continue;const a=o.reduce((l,c)=>Math.max(l,e.get(c)??0),-Gn);e.set(r.id,a+Gn),n=!1}}return e}class OU{ports;color=new Ke("#48d8f0");times=new Map;startAt=null;looping=!1;constructor(e){this.ports=e}start(){this.times=xU(this.ports.nodes()),this.startAt=this.times.size>0?this.now():null}loop_set(e){this.looping=e,e&&this.start()}loop_get(){return this.looping}animate(){if(this.startAt===null)return;const e=this.now()-this.startAt;let s=0;const i=this.ports.census();if(i!==null){s=i.flare(r=>this.times.get(r),e,this.color,Ja),e>s+Ja&&(this.startAt=this.renewal());return}const n=this.ports.selected();for(const[r,o]of this.times){s=Math.max(s,o);const a=this.ports.mesh(r);if(a===void 0||!(a.material instanceof lo))continue;const l=e-o,c=l>=0&&l<=Ja?Math.sin(l/Ja*Math.PI):0;a.scale.setScalar(1+c*.45),c>0?(a.material.emissive.copy(this.color),a.material.emissiveIntensity=c*1.2):(a.material.emissive.setScalar(r===n?1:0),a.material.emissiveIntensity=r===n?.35:0)}e>s+Ja&&(this.startAt=this.renewal())}now(){return(this.ports.now??Date.now)()}renewal(){return this.ports.ambient||this.looping?this.now()+SU:null}}class EU{ports;running=null;constructor(e){this.ports=e}active(){return this.running!==null}begin(e,s=1){const i=new iU(e,this.ports.now??Date.now);this.running={clock:i,arrivals:e,shown:new Set},this.ports.redraw(),this.paintAll(),i.play(s)}play(e){this.running?.clock.play(e)}pause(){this.running?.clock.pause()}seek(e){this.running!==null&&this.apply(this.running.clock.seek(e))}stop(){this.running!==null&&(this.running=null,this.ports.redraw())}state(){return this.running===null?null:{playing:this.running.clock.playing(),at:this.running.clock.at(),span:this.running.clock.span()}}step(){const e=this.running;if(e===null)return;const s=e.clock.playing(),i=e.clock.step();this.apply(i);for(const[n,r]of e.clock.flashing())this.ports.stars.flash_set(n,r);this.ports.stars.flush(),(s||i.arrived.length>0)&&this.ports.moved?.(i.at,e.clock.playing())}paintAll(){const e=this.running;if(e===null)return;const s=[...e.arrivals.keys()].filter(i=>!e.shown.has(i));this.ports.stars.presence_set(s,0),this.ports.stars.presence_set(e.shown,1),this.ports.stars.threads_present(i=>e.shown.has(i)||!e.arrivals.has(i)),this.ports.stars.flush()}apply(e){const s=this.running;if(!(s===null||e.arrived.length===0&&e.departed.length===0)){for(const i of e.arrived)s.shown.add(i);for(const i of e.departed)s.shown.delete(i),this.ports.stars.flash_set(i,0);this.ports.stars.presence_set(e.arrived,1),this.ports.stars.presence_set(e.departed,0),this.ports.stars.threads_present(i=>s.shown.has(i)||!s.arrivals.has(i)),this.ports.stars.flush()}}}class AU{ports;drag=null;pull=null;returns=[];constructor(e){this.ports=e}dragging(){return this.drag!==null}clear(){this.drag=null,this.pull=null}positions(){return this.pull?.positions()??[]}begin(e){const s=this.ports.picker.mesh_under(e),i=s?.userData.nodeId;if(s===null||typeof i!="string")return!1;const n=this.ports.camera.getWorldDirection(new W).negate();this.ports.group.updateMatrixWorld(!0);const r=new cr().setFromNormalAndCoplanarPoint(n,s.getWorldPosition(new W));return this.drag={nodeId:i,plane:r,startX:e.clientX,startY:e.clientY,moved:!1,solo:this.ports.solo(),home:s.position.clone()},!0}move(e){if(this.drag===null||(this.ports.spin_pause(),!this.drag.moved&&Math.abs(e.clientX-this.drag.startX)+Math.abs(e.clientY-this.drag.startY)>QS&&(this.drag.moved=!0,this.drag.solo||this.simulation_begin(this.drag.nodeId)),!this.drag.moved))return!1;const s=new W;if(this.ports.picker.ray_aim(e).ray.intersectPlane(this.drag.plane,s)===null)return!1;if(this.ports.group.worldToLocal(s),this.drag.solo){const i=this.ports.meshes().get(this.drag.nodeId);return i===void 0?!1:(i.position.copy(s),!0)}return this.pull?.pin([s.x,s.y,s.z]),!1}end(){if(this.drag===null)return!1;const e=this.drag.moved;if(this.drag.solo&&this.drag.moved){const s=this.ports.meshes().get(this.drag.nodeId);s!==void 0&&this.returns.push({mesh:s,from:s.position.clone(),to:this.drag.home.clone(),startedAt:this.now()})}return this.pull?.release(),this.drag=null,e}step(){const e=this.now();let s=!1;return this.pull!==null&&(this.pull.step(this.drag!==null)?s=!0:this.pull=null),this.returns.length>0&&(this.returns=this.returns.filter(i=>{const n=Math.min(1,(e-i.startedAt)/300),r=n*n*(3-2*n);return i.mesh.position.lerpVectors(i.from,i.to,r),n<1}),s=!0),s}now(){return(this.ports.now??Date.now)()}simulation_begin(e){const s=this.ports.nodes(),i=t1(s),n=[...this.ports.meshes()].map(([o,a])=>({id:o,position:[a.position.x,a.position.y,a.position.z],radius:i.get(o)??Bt,dim:a.userData.dim===!0,halo:a.userData.halo===!0})),r=[];for(const o of s)for(const a of[...o.parentIds,...o.joinParentIds])r.push({from:a,to:o.id});this.pull=new A7({grabbed:e,nodes:n,edges:r,dimensions:this.ports.dimensions(),baseRadius:Bt})}}const TU=1500;class IU{ports;tip;hovered=null;tapTimer=null;constructor(e,s){this.ports=s,this.tip=document.createElement("div"),this.tip.className="dag-node-tip",this.tip.hidden=!0,e.appendChild(this.tip)}hide(){this.tip.hidden=!0}leave(e){if(this.hovered=null,e.pointerType==="touch"&&!this.tip.hidden){this.tapTimer!==null&&window.clearTimeout(this.tapTimer),this.tapTimer=window.setTimeout(()=>{this.tapTimer=null,this.ports.fingersDown()===0&&(this.tip.hidden=!0)},TU);return}this.tip.hidden=!0}hover(e){const s=this.ports.picker.node_under(e,this.ports.pressKind()==="touch"),i=s===null?void 0:this.ports.nodes().find(r=>r.id===s);if(i===void 0){this.tip.hidden=!0,this.ports.canvas.style.cursor="",this.hovered=null;return}this.hovered={id:i.id,x:e.clientX,y:e.clientY};const n=this.ports.canvas.getBoundingClientRect();this.tip.textContent=this.ports.words(i)??i.label,this.tip.style.left=`${e.clientX-n.left+14}px`,this.tip.style.top=`${e.clientY-n.top+10}px`,this.tip.hidden=!1,this.ports.canvas.style.cursor="pointer"}pick(e,s){const i=this.hovered,n=i!==null&&Math.hypot(e.clientX-i.x,e.clientY-i.y)<=6?i.id:this.ports.picker.node_under(e,this.ports.pressKind()==="touch");if(n===null){s==="select"&&this.ports.selected_get()!==null&&(this.ports.selected_set(null),this.ports.selection_paint(),this.ports.deselect?.());return}const r=this.ports.nodes().find(o=>o.id===n);r&&(s==="select"?(this.ports.selected_set(n),this.ports.census()||this.ports.selection_paint(),this.ports.select?.(r)):this.ports.activate?.(r))}}function DU(){return{running:new Ke("#ff7700"),done:new Ke("#ffeecc"),error:new Ke("#ff2222"),template:new Ke("#ffaa44"),unknown:new Ke("#555555"),edge:new Ke("#cc5500"),join:new Ke("#ffcc99"),root:new Ke("#6fbfae"),pulse:new Ke("#48d8f0")}}class CU{container;handlers;paletteOf;ambient;renderer;scene;camera;group=new pl;picker;spheres=new IF(this.group);get meshes(){return this.spheres.map}starField=new TF(this.group);labels=new LF(this.group);tubes=new DF({parent:this.group,node:e=>this.tubeNode_find(e),sphere:e=>this.meshes.get(e),palette:()=>this.palette_read()});handoffField=new CF({spheres:this.spheres,stars:this.starField,tubes:this.tubes,look:e=>this.handoffLook_find(e)});censusField=new NF({parent:this.group,stars:this.starField,tubes:this.tubes,starsView:()=>({pixelRatio:window.devicePixelRatio,heightPx:this.renderer.domElement.height,fovDeg:this.camera.fov})});drawn=new pU({meshes:()=>this.meshes,stars:this.starField,census:this.censusField,group:this.group});flights=new vU({positions_get:()=>this.positions_get(),positions_seed:e=>this.positions_seed(e),graph_set:(e,s)=>this.graph_set(e,s),flyToFit:(e,s,i,n,r)=>this.camera_flyToFit(e,s,i,n,r),flyToward:(e,s,i,n)=>this.camera_flyToward(e,s,i,n),alive:()=>!this.disposed});hierarchy;wave;replay;grab;hover=null;rig;gestures=null;lastPositions=new Map;frozen=new Set;physicsOnce=void 0;census=!1;physics={...Dr};graph={nodes:[]};drawMode="spheres";placedById=new Map;fits=0;strategy="ranked";selectedId=null;frameHandle=null;disposed=!1;projection="3d";flat=new fU;rebuildGen=0;slicing=!1;arrangement="galaxy";arrangementMemory=new Map;constructor(e,s={},i={}){this.container=e,this.handlers=s,this.paletteOf=i.palette??DU,this.hierarchy=new zU(i.layoutWorker,()=>this.rebuildGen),this.ambient=i.ambient===!0,this.renderer=new cF({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.domElement.classList.add("dag-scene-canvas"),this.scene=new LG,this.camera=new Ti(50,1,.1,200),this.camera.position.set(0,0,14),this.rig=new VF(this.camera,this.group),this.picker=new eU(this.camera,this.group,this.renderer.domElement,{meshes:()=>this.meshes.values(),stars:()=>this.starField.list(),nebulae:()=>this.starField.nebulae(),census:()=>this.census&&this.censusField.drawn()?this.censusField:null},qS),this.wave=new OU({nodes:()=>this.graph.nodes,mesh:r=>this.meshes.get(r),census:()=>this.census&&this.censusField.drawn()?this.censusField:null,selected:()=>this.selectedId,ambient:this.ambient}),this.replay=new EU({stars:this.starField,redraw:()=>this.rebuild(!1,"hold"),...s.replay!==void 0?{moved:s.replay}:{}}),this.grab=new AU({picker:this.picker,camera:this.camera,group:this.group,meshes:()=>this.meshes,nodes:()=>this.graph.nodes,solo:()=>this.strategy==="ranked",dimensions:()=>this.projection==="2d"?2:3,spin_pause:()=>this.rig.spin_pause()}),this.scene.add(new hP(16777215,.9));const n=new cP(16777215,1.2);n.position.set(4,6,8),this.scene.add(n),this.scene.add(this.group),e.appendChild(this.renderer.domElement),this.size_fit(),this.ambient||(this.hover=this.pointer_wire(e)),new ResizeObserver(()=>this.size_fit()).observe(e),this.tick()}pointer_wire(e){const s=new IU(e,{picker:this.picker,canvas:this.renderer.domElement,nodes:()=>this.graph.nodes,pressKind:()=>this.gestures?.pressKind(),fingersDown:()=>this.gestures?.fingersDown()??0,words:i=>this.handlers.tip?.(i)??null,census:()=>this.census,selected_get:()=>this.selectedId,selected_set:i=>{this.selectedId=i},selection_paint:()=>this.selection_paint(),...this.handlers.select!==void 0?{select:this.handlers.select}:{},...this.handlers.activate!==void 0?{activate:this.handlers.activate}:{},...this.handlers.deselect!==void 0?{deselect:this.handlers.deselect}:{}});return this.gestures=new ZF(this.renderer.domElement,this.rig,{grab_begin:i=>this.grab.begin(i),grab_move:i=>{this.grab.move(i)&&this.positions_sync()},grab_end:()=>this.grab.end(),hover:i=>s.hover(i),leave:i=>s.leave(i),tap:(i,n)=>s.pick(i,n),tip_hide:()=>s.hide(),gesture_end:()=>this.handlers.gesture_end?.()},{flat:()=>this.projection==="2d",untethered:()=>this.census}),s}tick(){if(this.disposed)return;this.ambient?(this.rig.tumble_step(),this.wave.animate()):(this.rig.spin_step(!(this.gestures?.pointerOver()??!1)&&this.projection==="3d"&&!this.flat.active()),this.grab.step()&&this.positions_sync(),this.wave.animate(),this.rig.flight_step()),this.starField.scale_update(this.renderer.domElement.height,this.camera.fov),this.handoff_step(),this.replay.step();const e=performance.now();this.tubes.frame(e),this.starField.frame(e),this.labels.declutter(this.camera),this.renderer.render(this.scene,this.camera),this.frameHandle=window.requestAnimationFrame(()=>this.tick())}physics_set(e,s=!0){this.physics={...this.physics,...e},s&&this.rebuild()}physics_get(){return{...this.physics}}census_set(e){this.census!==e&&(this.census=e,this.rebuild(!0,"hold"))}census_get(){return this.census}graph_set(e,s={}){this.graph=e,this.flat.clear(),this.frozen=new Set(s.frozen??[]),this.physicsOnce=s.physics,this.rebuild(s.fit!==!1,s.settle??"full"),s.wave!==!1&&this.wave.start()}waveLoop_set(e){this.wave.loop_set(e)}waveLoop_get(){return this.wave.loop_get()}wave_start(){this.wave.start()}positions_get(){const e={};for(const[s,i]of this.lastPositions)e[s]=[Math.round(i.x*100)/100,Math.round(i.y*100)/100,Math.round(i.z*100)/100];return e}positions_seed(e){this.lastPositions=new Map(Object.entries(e).map(([s,[i,n,r]])=>[s,new W(i,n,r)]))}flight_into(e,s){if(this.rig.flying()||this.rig.holding_get())return;const i=this.drawn.diveTarget_find(e);i!==null&&this.rig.flyInto(i,s)}camera_flyToFit(e,s,i,n=1,r=1.15){this.rig.flyToFit(this.drawn.reaches_list(e),s,i,n,r)}camera_distance(){return this.rig.eyeDistance()}camera_touched(){return this.rig.touched_get()}moving(){return this.flights.moving()}frame(e,s,i=()=>{},n,r){this.flights.frame(e,s,i,n,r)}relight(e,s,i,n=()=>{},r){this.flights.relight(e,s,i,n,r)}unfold(e,s=()=>{}){this.flights.unfold(e,s)}descent(e,s,i=()=>{},n=()=>{}){this.flights.descent(e,s,i,n)}draw_set(e){e!==this.drawMode&&(this.drawMode=e,this.rebuild(!1,"hold"))}captions_set(e){this.labels.shown_set(e)}draw_get(){return this.drawMode}state_get(){const e=this.graph.nodes.filter(i=>i.solid===!0).map(i=>i.id),s=e.filter(i=>this.meshes.has(i)).length;return{draw:this.drawMode,arrangement:this.arrangement,captions:this.labels.shown_get()?this.labels.count():"off",known:this.lastPositions.size,census:this.census,nodes:this.graph.nodes.length,meshes:this.meshes.size,stars:this.starField.count(),solidMarked:e.length,solidDrawn:s,tubes:this.tubes.materialCount(),censusTubes:this.tubes.censusCount(),censusLines:this.tubes.censusLineCount(),censusMembers:this.census?this.censusField.ids().length:0,handoffGroups:this.handoffField.size(),handoffSolid:this.handoffField.solidCount(),camera:this.rig.eyeDistance().toFixed(1),settling:this.slicing,...rU(this.graph.nodes,this.lastPositions)}}camera_flyToward(e,s,i,n){const r=this.drawn.world_find(e);if(r===null){n();return}this.rig.flyToward(r,s,i,n)}holding_get(){return this.rig.holding_get()}flight_back(e){this.rig.flyBack(e)}strategy_set(e){this.strategy=e,this.rebuild()}selection_clear(){this.selectedId=null,this.selection_paint()}selection_set(e){const s=this.graph.nodes.find(i=>i.id===e);return s===void 0?!1:(this.selectedId=e,this.selection_paint(),this.handlers.select?.(s),!0)}selection_paint(){this.spheres.select(this.selectedId)}strategy_get(){return this.strategy}projection_set(e){this.projection=e,e==="2d"&&this.group.quaternion.identity(),this.rebuild()}projection_get(){return this.projection}flat_set(e){this.flat.set(e,this.graph.nodes,this.lastPositions,{camera:this.camera,focus:this.rig.focus,world:this.group},this.physics)&&this.rebuild(!1,"hold")}flat_get(){return this.flat.active()}look_update(e,s){const i=this.graph.nodes.find(n=>n.id===e);i&&(i.look=s,this.spheres.recolor(e,va(s.paint,this.palette_read())),this.tubes.holds(e)&&this.tubes.stale_mark())}palette_read(){return this.paletteOf()}palette_refresh(){this.rebuild(!0,"hold")}size_fit(){const e=Math.max(1,this.container.clientWidth),s=Math.max(1,this.container.clientHeight);this.renderer.setSize(e,s,!1),this.camera.aspect=e/s,this.camera.updateProjectionMatrix()}dispose(){this.disposed=!0,this.hierarchy.dispose(),this.frameHandle!==null&&window.cancelAnimationFrame(this.frameHandle),this.gestures?.detach(),this.renderer.dispose(),this.renderer.domElement.remove(),this.spheres.dispose()}arrangement_set(e,s,i=!0){if(e===this.arrangement)return;this.arrangementMemory.set(this.arrangement,new Map(this.lastPositions)),this.arrangement=e;let n=this.arrangementMemory.get(e);n===void 0&&s!==void 0&&Object.keys(s).length>0&&(n=new Map(Object.entries(s).map(([r,[o,a,l]])=>[r,new W(o,a,l)]))),this.lastPositions=n??new Map,i&&this.rebuild(!0,n===void 0?"full":"hold")}arrangement_get(){return this.arrangement}replay_begin(e,s=1){this.replay.begin(e,s)}replay_play(e){this.replay.play(e)}replay_pause(){this.replay.pause()}replay_seek(e){this.replay.seek(e)}replay_stop(){this.replay.stop()}replay_state(){return this.replay.state()}censusBuild(e,s,i=!0){const n=mU(e,s),r=this.censusField.build(n,this.drawMode==="stars",s);this.renderer.domElement.dataset.census=String(this.censusField.ids().length);const o=r.center,a=r.radius;!this.ambient&&i&&this.rig.frame(o,a,{stance:"threeQuarter",farScale:2.5})}camera_fit(e){if(e.length===0)return;this.rig.touch_clear(),this.fits+=1,this.renderer.domElement.dataset.fits=String(this.fits);const s=new W;for(const o of e)s.add(o.position);s.divideScalar(e.length);const i=e.map(o=>s.distanceTo(o.position)+o.radius).sort((o,a)=>o-a),n=this.handlers.handoffKey!==void 0?.95:1,r=Math.max(1,i[Math.max(0,Math.ceil(i.length*n)-1)]??1);this.rig.frame(s,r)}rebuild(e=!0,s="full"){const i=++this.rebuildGen;if(this.slicing&&(this.slicing=!1,this.handlers.progress?.(1,1,0)),this.strategy!=="molecule"){this.draw(lU(this.graph.nodes),e);return}let n=this.frozen;if(s!=="full"&&n.size===0){const l=this.graph.nodes.map(c=>c.id).filter(c=>this.lastPositions.has(c));l.length>0&&(n=new Set(l))}const r=s1(this.graph.nodes,this.projection==="2d"?2:3,this.lastPositions,this.physics_current(),n);if(r.moving===0){this.draw(r.place(),e);return}const o=this.handlers.progress,a=r.total*r.moving<oU;if((!a||this.arrangement!=="galaxy")&&o!==void 0&&this.handlers.handoffKey!==void 0&&this.frozen.size===0){this.hierarchy_run(i,e,n,o);return}if(o===void 0||a){r.step(r.total),this.draw(r.place(),e);return}this.settle_slice(r,i,e,o)}physics_current(){return this.physicsOnce!==void 0?{...this.physics,...this.physicsOnce}:this.physics}settle_slice(e,s,i,n){const r=this.graph.nodes.length;let o=0;this.slicing=!0,n(0,e.total,r);const a=()=>{if(s!==this.rebuildGen||this.disposed)return;const l=performance.now();for(;o<e.total&&performance.now()-l<aU;)e.step(1),o+=1;if(o<e.total){n(o,e.total,r),window.requestAnimationFrame(a);return}this.slicing=!1,this.draw(e.place(),i),n(e.total,e.total,r)};window.requestAnimationFrame(a)}hierarchy_run(e,s,i,n){const r=this.handlers.handoffKey;r!==void 0&&(this.slicing=!0,this.hierarchy.run({generation:e,nodes:this.graph.nodes,keyOf:r,seeds:this.lastPositions,frozen:i,physics:this.physics_current(),arrangement:this.arrangement,progress:(o,a,l)=>{o===a&&(this.slicing=!1),n(o,a,l)},placed:o=>{this.slicing=!1,this.draw(o,s)}}))}draw(e,s){const i=this.drawn_clear(e);if(this.census){const c=e.filter(h=>h.node.solid===!0&&h.node.ghost!==!0);this.censusBuild(e.filter(h=>h.node.solid!==!0),i,s),c.length>0&&this.solid_draw(c,i);return}!this.ambient&&s&&this.camera_fit(e);const n=this.drawMode==="stars",r=n&&!this.replay.active()?this.handlers.handoffKey:void 0,o={spheres:this.spheres,labels:this.labels,stars:this.starField,handoff:this.handoffField,selected:this.selectedId,flat:this.projection==="2d",starring:n,handoffKey:r},a=hU(e,i,o);a.starred.length>0&&this.starField.draw(a.starred,window.devicePixelRatio,this.renderer.domElement.height,this.camera.fov);for(const c of e)this.placedById.set(c.node.id,c);if(r!==void 0){const c=new Map(this.graph.nodes.map(h=>[h.id,h]));this.handoffField.gather(a.starred,h=>{const d=c.get(h);return d===void 0?null:r(d)})}dU(e,a.byId,i,o);const l=e.filter(c=>c.node.ghost!==!0&&c.node.halo!==!0&&(n?c.node.solid===!0||c.node.tubed===!0:c.node.dim!==!0)).map(c=>c.node.id);if(l.length>0){const h={tubes:null,mix:1,...!n||e.some(d=>d.node.solid===!0&&l.includes(d.node.id))?{}:{thickness:.25}};this.tubes.build(h,l,new Set(l))}this.renderer.domElement.dataset.rootsTop=nU(e.filter(c=>c.node.dim!==!0&&c.node.ghost!==!0&&c.node.halo!==!0).map(c=>({id:c.node.id,parentIds:c.node.parentIds,y:c.position.y})))?"yes":"no",this.replay.active()&&this.replay.paintAll()}drawn_clear(e){this.group.clear(),this.spheres.clear(),this.censusField.clear(),this.renderer.domElement.dataset.census="0",this.grab.clear(),this.starField.clear(),this.labels.clear(),this.handoffField.clear(),this.placedById=new Map,this.tubes.clear();const s=this.palette_read();if(this.wave.color=s.pulse,this.lastPositions=new Map(e.map(i=>[i.node.id,i.position.clone()])),this.projection==="2d")for(const i of e)i.position.z=0;return s}handoff_step(){if(this.handoffField.size()===0)return;const e=this.renderer.domElement.clientHeight||1;this.handoffField.step(bU(this.camera,this.group),MU(e,this.camera.fov),performance.now())}handoffLook_find(e){const s=this.placedById.get(e);return s===void 0?void 0:gU(s,this.palette_read())}tubeNode_find(e){const s=this.placedById.get(e);return s===void 0?void 0:_U(s)}positions_sync(){for(const{id:e,position:s}of this.grab.positions())this.meshes.get(e)?.position.set(...s),this.lastPositions.set(e,new W(...s));this.tubes.follow(),this.spheres.edges_follow()}solid_draw(e,s){for(const r of e)this.placedById.set(r.node.id,r),this.spheres.sphere_add(r.node.id,r.position,r.radius,{color:va(r.node.look.paint,s)});const i=e.map(r=>r.node.id),n={tubes:null,mix:1};this.tubes.build(n,i,new Set(i))}}const i1=new Set(["created","waiting","scheduled","started","registeringFiles"]);function RU(t){return t.status!==void 0&&i1.has(t.status)?"live":t.status==="finishedWithError"||t.share!==void 0&&t.share>=1?"failed":t.status==="finishedSuccessfully"||t.share!==void 0&&t.status!==void 0?"done":"rest"}function kU(t){return t.share!==void 0&&t.status!=="cancelled"?t.share>=1?{token:"error"}:{blend:["done","error"],share:Math.sqrt(Math.max(0,t.share))}:t.status==="finishedWithError"||t.status==="cancelled"?{token:"error"}:t.hue!==void 0?{hue:t.hue}:t.parentIds.length===0&&t.joinParentIds.length===0?{token:"root"}:t.status===void 0?{token:"template"}:t.status==="finishedSuccessfully"?{token:"done"}:i1.has(t.status)?{token:"running"}:{token:"unknown"}}function UM(t){return{state:RU(t),paint:kU(t),ember:t.share!==void 0&&t.share>0||t.status==="finishedWithError",waved:t.status===void 0||t.status==="finishedSuccessfully"||t.status==="finishedWithError"}}function NU(){const t=getComputedStyle(document.documentElement),e=(s,i)=>new Ke(t.getPropertyValue(s).trim()||i);return{running:e("--orange","#f70"),done:e("--butter","#fec"),error:new Ke("#f22"),template:e("--harvestgold","#fa4"),unknown:new Ke("#555"),edge:e("--pumpkin-pie","#c50"),join:e("--honey","#fc9"),root:e("--dag-root","#6fbfae"),pulse:e("--dag-pulse","#48d8f0")}}class Gd extends CU{byId=new Map;constructor(e,s={},i={}){const n={palette:NU,layoutWorker:()=>new Worker(new URL(""+new URL("layoutWorker-CfJVM55D.js",import.meta.url).href,import.meta.url),{type:"module"})};i.ambient!==void 0&&(n.ambient=i.ambient),super(e,s,n)}graph_set(e,s={}){const i=e.nodes.map(n=>Object.assign(n,{look:UM(n)}));this.byId=new Map(i.map(n=>[n.id,n])),super.graph_set({nodes:i},s)}relight(e,s,i,n,r){super.relight(e,s,i,n,r)}unfold(e,s){super.unfold(e,s)}descent(e,s,i,n){super.descent(e,s,i,n)}status_update(e,s){const i=this.byId.get(e);i===void 0||i.status===s||(i.status=s,this.look_update(e,UM(i)))}}function $M(t){if(t.jobsTotal===void 0||t.jobsDone===void 0)return null;const e=t.status==="finishedWithError"||t.status==="cancelled",s=t.jobsErrored===void 0?void 0:t.jobsDone-t.jobsErrored;return{done:t.jobsDone,total:t.jobsTotal,...e?{failed:!0}:{},...s!==void 0?{succeeded:s}:{}}}function BU(t){const e=t.title||"(untitled)",s=t.tags??[];if(s.length===0)return e;const i=document.createElement("span");i.className="feedlist-title feedlist-titled";const n=document.createElement("span");n.className="feedlist-title-text",n.textContent=e,i.append(n);for(const r of s){const o=document.createElement("span");o.className="feedlist-tag",o.dataset.tag=r,o.title=`tag:${r} — press to filter the roster by it`,o.textContent=`#${r}`;const a=document.createElement("span");a.className="feedlist-tag-x",a.title=`take ${r} off this feed (setfattr -x)`,a.textContent="×",o.append(a),i.append(o)}return i}const GU=[{key:"control",label:"",className:"feedlist-control",capped:!1,width:"5.2em",cell:()=>{const t=document.createElement("span");return t.className="feedlist-control listing-capsule",t.textContent="OPEN",t}},{key:"id",label:"ID",className:"feedlist-id",width:"4em",cell:t=>String(t.id),compare:t=>t.id},{key:"title",label:"TITLE",className:"feedlist-title",width:"minmax(12em, 24em)",cell:t=>BU(t),compare:t=>t.title},{key:"progress",shed:5,label:"PROGRESS",className:"feedlist-progress",width:"minmax(8em, 1fr)",cell:t=>Uh($M(t)),compare:t=>{const e=$M(t);return e===null||e.total===0?-1:e.done/e.total}},{key:"status",label:"STATUS",className:"feedlist-status",width:"8em",cell:t=>t.status.toUpperCase(),compare:t=>t.status},{key:"nodes",shed:1,label:"NODES",className:"feedlist-nodes",width:"4em",cell:t=>t.jobsTotal===void 0?"—":String(t.jobsTotal),compare:t=>t.jobsTotal??-1},{key:"sizeBytes",shed:3,label:"SIZE",className:"feedlist-size",width:"5.5em",cell:t=>t.sizeBytes===void 0?"—":r1(t.sizeBytes),compare:t=>t.sizeBytes??-1},{key:"wallSeconds",shed:2,label:"TIME",className:"feedlist-time",width:"6em",cell:t=>t.wallSeconds===void 0?"—":n1(t.wallSeconds),compare:t=>t.wallSeconds??-1},{key:"owner",shed:4,label:"OWNER",className:"feedlist-owner",width:"7em",cell:t=>t.owner},{key:"createdAt",label:"CREATED",className:"feedlist-created",width:"7em",cell:t=>t.createdAt.slice(0,10),compare:t=>t.createdAt}];function n1(t){const e=Math.round(t);return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${String(e%60).padStart(2,"0")}s`:`${Math.floor(e/3600)}h ${String(Math.floor(e%3600/60)).padStart(2,"0")}m`}function r1(t){if(t<1024)return`${t}B`;const e=["K","M","G","T"];let s=t,i=-1;for(;s>=1024&&i<e.length-1;)s=s/1024,i=i+1;return`${s<10?s.toFixed(1):Math.round(s)}${e[i]}`}function PU(t){const s=t.status==="finishedSuccessfully"||t.status==="finishedWithError"||t.status==="cancelled"?"awaiting warmup":"in flight",i=t.tally;return[["PLUGIN",t.pluginName],[i?"REP. INSTANCE":"INSTANCE",String(t.instanceId)],["STATUS",t.status],...i?[["COUNT",`×${i.count} — ${i.done} done, ${i.error} err, ${i.running} live, ${i.other} other`]]:[],...i?.anomalies!==void 0&&i.anomalies.length>0?[["FAULTS",i.anomalies.map(n=>n.id).join(" ")+(i.count>i.done+i.anomalies.length?" …":"")]]:[],["WALL",t.metrics?.computeSeconds!==void 0?n1(t.metrics.computeSeconds):s],["SIZE",t.metrics?.dataBytes!==void 0?r1(t.metrics.dataBytes):s],["DATA",t.vfsPath]]}function o1(t,e,s){t.replaceChildren();for(const[n,r]of PU(e)){const o=document.createElement("div");o.className="telemetry-row";const a=document.createElement("span");a.className="telemetry-label",a.textContent=n;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r,o.append(a,l),t.appendChild(o)}t.appendChild(LU(e.status));const i=document.createElement("div");if(i.className="feed-node-verbs",s.enter!==void 0){const n=document.createElement("button");n.className="pacs-capsule feed-node-enter",n.textContent="ENTER NODE",n.title="fly into the node: its data, browsable inside (Esc flies out)",n.addEventListener("click",s.enter),i.appendChild(n)}if(s.process!==void 0){const n=s.process,r=document.createElement("button");r.className="pacs-capsule dag-process",r.textContent="PROCESS",e.tally!==void 0?(r.disabled=!0,r.title=`${e.tally.count} instances stand here: open one to process it`,r.classList.add("pacs-capsule-off")):(r.title=`open /bin bound to ${e.label} — a run appends to this node`,r.addEventListener("click",()=>n({vfsPath:e.vfsPath,instanceId:e.instanceId,label:e.label}))),i.appendChild(r)}i.childElementCount>0&&t.appendChild(i)}const Ju=[{key:"created",label:"CREATED"},{key:"waiting",label:"WAITING"},{key:"scheduled",label:"SCHEDULED"},{key:"started",label:"STARTED"},{key:"registeringFiles",label:"REGISTERING"}];function LU(t){const e=document.createElement("div");e.className="dag-subway";const s=t==="finishedSuccessfully",i=t==="finishedWithError"||t==="cancelled",n=Ju.findIndex(l=>l.key===t),r=s||i?Ju.length:n;!s&&!i&&e.classList.add("dag-subway-live");const o=(l,c,h)=>{const d=document.createElement("span");d.className=`subway-step${h?" subway-step-here":""}`;const u=document.createElement("span");u.className=c;const p=document.createElement("span");return p.className="subway-label",p.textContent=l,d.append(u,p),d};Ju.forEach((l,c)=>{if(c>0){const d=document.createElement("span");d.className="subway-link"+(c<=r?" subway-passed":""),e.appendChild(d)}const h=c===n&&!s&&!i;e.appendChild(o(l.label,"subway-stop"+(c<r?" subway-passed":"")+(h?" subway-here":""),h))});const a=document.createElement("span");return a.className="subway-link"+(s||i?" subway-passed":""),e.appendChild(a),e.appendChild(o(s?"FINISHED":i?t==="cancelled"?"CANCELLED":"ERROR":"FINISHED","subway-stop subway-terminal"+(s?" subway-done":"")+(i?" subway-failed":""),!1)),e}class a1{notePill;tagPill;renamePill;marks;handlers;readFeedId=null;tags=[];constructor(e,s){this.handlers=s,this.notePill=e?.querySelector(".dag-note")??null,this.tagPill=e?.querySelector(".dag-tag")??null,this.renamePill=e?.querySelector(".dag-rename")??null,this.marks=e?.querySelector(".dag-marks")??null;const i=(n,r)=>{n?.addEventListener("click",()=>{const o=s.shown();o!==null&&r(o)})};i(this.notePill,n=>s.feed_note?.(n)),i(this.tagPill,n=>s.feed_tag?.(n,this.tags)),i(this.renamePill,n=>s.feed_rename?.(n,s.name()))}shown_set(e){for(const s of[this.notePill,this.tagPill,this.renamePill,this.marks])s!==null&&(s.hidden=!e);e||(this.readFeedId=null)}arrived(e){this.readFeedId!==e&&this.refresh()}refresh(){const e=this.handlers.shown();e!==null&&(this.readFeedId=e,this.handlers.feed_entered?.(e))}show(e,s){if(e!==this.handlers.shown()||this.marks===null)return;s.title!==void 0&&s.title!==""&&this.handlers.renamed(e,s.title),this.tags=[...s.tags];const i=(s.note??"").trim();this.notePill!==null&&(this.notePill.textContent=s.note===null?"NOTE":i===""?"ADD NOTE":"EDIT NOTE"),this.marks.replaceChildren();for(const n of s.tags){const r=document.createElement("span");r.className="feedlist-tag dag-mark",r.dataset.tag=n,r.textContent=`#${n}`;const o=document.createElement("span");o.className="feedlist-tag-x",o.title=`take ${n} off this feed (setfattr -x)`,o.textContent="×",o.addEventListener("click",()=>this.handlers.feed_untag?.(e,n)),r.append(o),this.marks.append(r)}if(i!==""){const n=document.createElement("span");n.className="dag-note-line",n.textContent=i.split(`
|
|
4341
4341
|
`)[0]??"",n.title=i,this.marks.append(n)}}}const jM="#555";function l1(t,e){return e==="time"?t.metrics?.computeSeconds:t.metrics?.dataBytes}function WU(t,e){const s=new Map;for(const i of t.nodes){const n=i.computeResource;n===void 0||n==="mixed"||s.has(n)||s.set(n,e[s.size%Math.max(1,e.length)]??"#888")}return s}function c1(t,e){const s=e.id_map??(a=>a),i=new Set(t.nodes.map(a=>a.id)),n=a=>{if(e.hue==="compute")return a.computeResource===void 0?jM:e.legend.get(a.computeResource)??jM},r=[],o=new Map;for(const a of t.nodes){const l=s(a.id),c=a.tally?.count??1,h=a.tally?.error??(a.status==="finishedWithError"?1:0),d=h>0&&c>1?Math.min(1,h/c):void 0,u=n(a);r.push({id:l,label:a.label,parentIds:a.parentIds.filter(p=>i.has(p)).map(s),joinParentIds:a.joinParentIds.filter(p=>i.has(p)).map(s),status:a.status,metric:l1(a,e.metric),tubed:!0,...c>1?{count:c}:{},...d!==void 0?{share:d}:{},...u!==void 0?{hue:u}:{}}),o.set(l,a)}return{nodes:r,payloads:o}}const xl={strategy:"ranked",projection:"3d",pulse:!0,metric:"time",hue:"status",census:!1,gravity:!1,draw:"spheres"},n_="argus.feedview",h1=2;function FU(){try{const t=globalThis.localStorage;return t===void 0?null:(t.getItem(n_),t)}catch{return null}}function HM(t){if(sd!==null)return{...sd};let e={};try{const n=t?.getItem(n_)??null,r=n===null?null:JSON.parse(n);r!==null&&typeof r=="object"&&(e=r)}catch{}const s=(n,r)=>r.includes(e[n])?e[n]:xl[n],i=n=>typeof e[n]=="boolean"?e[n]:xl[n];return{strategy:s("strategy",["ranked","molecule"]),projection:s("projection",["3d","2d"]),pulse:e.v===h1?i("pulse"):xl.pulse,metric:s("metric",["time","size"]),hue:s("hue",["status","compute"]),census:i("census"),gravity:i("gravity"),draw:s("draw",["spheres","stars"])}}let d1=!1,sd=null;function UU(t){d1=t}function VM(t,e){if(d1){sd={...e};return}sd=null;try{t?.setItem(n_,JSON.stringify({...e,v:h1}))}catch{}}function $U(t,e){switch(t){case"strategy":return e.strategy.toUpperCase();case"projection":return e.projection.toUpperCase();case"pulse":return e.pulse?"PULSE ON":"PULSE OFF";case"metric":return e.metric==="time"?"TIME":"SIZE";case"hue":return e.hue.toUpperCase();case"census":return e.census?"CENSUS":"SHAPE";case"gravity":return e.gravity?"GRAVITY ON":"GRAVITY OFF";case"draw":return e.draw.toUpperCase()}}function jU(t,e){switch(t){case"strategy":return{...e,strategy:e.strategy==="ranked"?"molecule":"ranked"};case"projection":return{...e,projection:e.projection==="3d"?"2d":"3d"};case"pulse":return{...e,pulse:!e.pulse};case"metric":return{...e,metric:e.metric==="time"?"size":"time"};case"hue":return{...e,hue:e.hue==="status"?"compute":"status"};case"census":return{...e,census:!e.census};case"gravity":return{...e,gravity:!e.gravity};case"draw":return{...e,draw:e.draw==="spheres"?"stars":"spheres"}}}const HU=new Set(["pulse","gravity"]);function u1(t){const e=getComputedStyle(document.documentElement),s=["--harvestgold","--daybreak","--orange","--honey","--butter","--october-sunset"].map(i=>e.getPropertyValue(i).trim()).filter(i=>i!=="");return WU(t,s)}function rm(t,e){return t.nodes.length===e.nodes.length&&e.nodes.every((s,i)=>{const n=t.nodes[i];return n!==void 0&&n.id===s.id&&(n.tally?.count??1)===(s.tally?.count??1)&&n.parentIds.length===s.parentIds.length&&n.joinParentIds.length===s.joinParentIds.length})}function f1(t,e,s=i=>i){for(const i of e.nodes)t.status_update(s(i.id),i.status)}class p1{constructor(e,s,i=FU()){this.hooks=s,this.store=i,this.modes=HM(i);for(const n of e?.querySelectorAll("[data-feed-verb]")??[]){const r=n.dataset.feedVerb;this.pills.set(r,n),n.addEventListener("click",()=>this.press(r))}this.paint()}hooks;store;modes;pills=new Map;recall(){return this.modes=HM(this.store),this.paint(),this.modes_get()}modes_get(){return{...this.modes}}pill_find(e){return this.pills.get(e)??null}press(e){this.modes=jU(e,this.modes),VM(this.store,this.modes),this.paint(),this.hooks.changed(e,this.modes_get())}set(e,s){this.modes={...this.modes,[e]:s},VM(this.store,this.modes),this.paint()}paint(){for(const[e,s]of this.pills)s.textContent=$U(e,this.modes),HU.has(e)&&s.classList.toggle("rail-off",e==="pulse"?!this.modes.pulse:!this.modes.gravity)}}class VU{abandoned=null;pick(e,s){this.abandoned=e!==null&&e!==s?e:null}drops(e,s){return this.abandoned!==e||s===null||s===e?!1:(this.abandoned=null,!0)}}function Qu(t){return(t.replace(/\[[0-9;]*m/g,"").split(`
|
|
4342
4342
|
`).find(i=>i.trim().length>0)?.trim()??"").replace(/\s*\((?:[\d,]+\/[\d,]+(?:,\s*\d+%)?|initializing)\)(?=\.?$)/,"")}const Ol=[];function m1(){const t=Ol[Ol.length-1];return t===void 0?!1:(t(),!0)}function qU(t){const e=t.querySelector(":scope > .pane-drawer");if(e!==null)return e.nextElementSibling;const s=t.querySelector(":scope > .lcars-terminal-header-bar");return s===null?t.firstElementChild:s.nextElementSibling}function id(t,e){if(t.querySelector(":scope > .ask-bar")!==null)return Promise.resolve(null);const s=document.createElement("div");s.className=e.kind==="choose"?"ask-bar ask-bar-choose":"ask-bar";const i=document.createElement("span");i.className="ask-bar-glyph",i.textContent="?";const n=document.createElement("span");n.className="ask-bar-caption",n.textContent=e.message.trim(),s.append(i,n);const r=document.createElement("input"),o=document.createElement("button"),a=document.createElement("button"),l=document.createElement("button"),c=document.createElement("button");if(c.className="pacs-capsule ask-bar-abandon",c.textContent=e.close??"ABANDON",c.title="abandon the question (Esc)",e.kind==="confirm")o.className="pacs-capsule ask-bar-yes",o.textContent="YES",a.className="pacs-capsule ask-bar-no",a.textContent="NO",s.append(o,a,c);else{for(const d of e.choices??[]){const u=document.createElement("button");u.className=`pacs-capsule ask-bar-choice${d.held===!0?" ask-bar-held":""}`,u.textContent=d.label??d.value,u.dataset.value=d.value,u.disabled=d.held===!0,s.append(u)}r.className="ask-bar-field",r.spellcheck=!1,e.kind==="secret"?r.type="password":e.suggest!==void 0&&(r.value=e.suggest),l.className="pacs-capsule ask-bar-commit",l.textContent=e.commit??"ANSWER",s.append(r,l,c)}const h=qU(t);return h===null?t.appendChild(s):t.insertBefore(s,h),window.requestAnimationFrame(()=>s.classList.add("ask-bar-shown")),new Promise(d=>{let u=!1;const p=g=>{if(u)return;u=!0;const m=Ol.indexOf(f);m>=0&&Ol.splice(m,1),s.remove(),d(g)},f=()=>p(null);Ol.push(f);const _=()=>{const g=r.value.trim();p(g===""?null:g)};l.addEventListener("click",_);for(const g of s.querySelectorAll(".ask-bar-choice"))g.addEventListener("click",()=>p(g.dataset.value??null));o.addEventListener("click",()=>p("y")),a.addEventListener("click",()=>p("n")),c.addEventListener("click",f),s.addEventListener("keydown",g=>{if(g.key==="Escape"){g.stopPropagation(),f();return}if(e.kind==="confirm"){g.key==="y"||g.key==="Y"?(g.stopPropagation(),p("y")):g.key==="n"||g.key==="N"||g.key==="Enter"&&g.target===a?(g.stopPropagation(),p("n")):g.key==="Enter"&&(g.stopPropagation(),p("y"));return}g.key==="Enter"&&(g.stopPropagation(),_())}),e.kind==="confirm"?o.focus():(r.focus(),r.select())})}const KU=6e4,qM=1e4,KM=5e3,YU=new Set(["running","scheduled","created","started"]),XU=[/\/proc\/jobs\/feed_(\d+)(?:\/|$)/,/\/feeds?\/feed_(\d+)(?:\/|$)/];function ZU(t){const e=[];return(t.layout==="ranked"||t.layout==="molecule")&&e.push(`dag layout ${t.layout}`),(t.projection==="2d"||t.projection==="3d")&&e.push(`dag projection ${t.projection}`),(t.draw==="spheres"||t.draw==="stars")&&e.push(`dag draw ${t.draw}`),(t.pulse==="pulse on"||t.pulse==="pulse off")&&e.push(`dag ${t.pulse}`),(t.scale==="time"||t.scale==="size")&&e.push(`dag scale ${t.scale}`),(t.census==="census"||t.census==="shape")&&e.push(`dag census ${t.census==="census"?"on":"off"}`),(t.gravity==="gravity on"||t.gravity==="gravity off")&&e.push(`dag ${t.gravity}`),(t.hue==="status"||t.hue==="compute")&&e.push(`dag hue ${t.hue}`),t.place!==void 0&&t.place!==null&&e.push(`dag select ${t.place}`),e}const JU={running:"started",done:"finishedSuccessfully",error:"finishedWithError"};function YM(t){const e=/^(?:feed_)?(\d+)$/.exec(t.trim());return e===null?null:Number(e[1])}class QU{scene;canvas;title;facts;linkLine;empty;strategyPill;backPill=null;feedFrame;feedList;handlers;rosterTimer=null;shownFeedId=null;pinnedFeedId=null;requestedFeedId=null;follow=new VU;defaultTitle;metricMode="time";feedView;modesApplied=null;lastModel=null;lastRoster=[];arrivals=new Set;feedAsks=new Map;filterMissText="";filterMissNote=null;rosterCheck=null;rosterCheckTimer=null;paneRoot=null;clearNewPill=null;jumpPending=!1;jumpNode=null;jumpEnter=!1;arrivalsKey="";listing;stateSpan;watchedFeedId=null;liveState=null;pendingFeedId=null;lastCwd=null;constructor(e,s,i,n,r,o,a){this.feedList=o,this.canvas=e,e.style.display="none",this.title=s,this.defaultTitle=s.textContent??"",this.facts=i,this.empty=n,this.strategyPill=r,this.handlers=a;const l=r.closest(".pane-dag");this.paneRoot=l,l?.querySelector(".runs-jump")?.addEventListener("click",()=>{this.jump_ask()}),this.clearNewPill=l?.querySelector(".runs-clearnew")??null,this.clearNewPill?.addEventListener("click",()=>this.unseen_clear("all")),this.linkLine=Qw("/proc/jobs"),this.linkLine.classList.add("dag-linkline"),this.linkLine.hidden=!0,i.parentElement?.appendChild(this.linkLine),new MutationObserver(()=>this.linkLine_refresh()).observe(i,{childList:!0}),this.stateSpan=l?.querySelector(".pane-state")??null,this.modeSpan=l?.querySelector(".pane-mode")??null;const c=a.feed_verbs;this.listing=new Ir({mount:this.feedList,traits:GU,key:d=>String(d.id),chrome:l===null?void 0:{root:l,prefix:"runs"},actions:c===void 0?void 0:{of:d=>c(d)},control:"control",terms:[{key:"tag",value:d=>(d.tags??[]).join(" ")}],activate:d=>this.feed_activate(d),indicated:d=>this.handlers.feed_indicated?.(d),row:{className:d=>`feedlist-row feedlist-${d.status}${this.arrivals.has(d.id)?" feedlist-arrived":""}${d.new===!0?" feedlist-new":""}`,decorate:(d,u)=>{if(d.dataset.feed=String(u.id),u.new===!0){const p=document.createElement("span");p.className="feedlist-newmark",p.textContent=`NEW · FROM ${u.owner.toUpperCase()}`,d.querySelector(".feedlist-title")?.append(p)}d.title=c===void 0?"enter the feed (Esc returns to this list)":"click to indicate, double-click to enter (Esc returns to this list)"}},state:d=>this.canvas.style.display==="block"?null:[d.filter,(d.shed??0)>0?`${d.shed} COLUMN${d.shed===1?"":"S"} HIDDEN`:"",this.rosterCheck_line()||this.newCount_line()].filter(Boolean).join(" · "),refresh:()=>this.handlers.command_run("proc feeds --fresh"),filteredEmpty:d=>this.filterMiss_note(d),defaultSort:{key:"createdAt",dir:"desc"}}),this.feedList.addEventListener("click",d=>this.tagMark_press(d),{capture:!0}),this.feedList.addEventListener("dblclick",d=>{d.target instanceof Element&&d.target.closest(".feedlist-tag")!==null&&d.stopPropagation()},{capture:!0}),this.rosterTimer=setInterval(()=>{if(!this.feedList.isConnected||!this.rosterShown||this.rosterPending||document.visibilityState!=="visible")return;const u=this.lastRoster.some(p=>YU.has(p.status))?qM:KU;Date.now()-this.rosterAskedAt<u||(this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds"))},qM),this.scene=new Gd(e,{select:d=>this.facts_show(d),activate:d=>this.node_activate(d),deselect:()=>this.facts.replaceChildren()}),this.backPill=r.parentElement?.querySelector(".dag-back")??null,this.feedFrame=new a1(r.parentElement,{...a,shown:()=>this.shownFeedId,name:()=>this.lastModel?.feedName??"",renamed:(d,u)=>{this.lastModel!==null&&(this.lastModel={...this.lastModel,feedName:u}),this.title.textContent=`DAG · FEED ${d} — ${u}`.toUpperCase()}}),this.backPill?.addEventListener("click",()=>{this.nav_pop()||this.feedsChooser_request()}),this.facts.addEventListener("click",d=>{d.target instanceof Element&&d.target.closest("button, a, input")===null&&(this.facts.classList.contains("dag-facts-immersed")||(this.scene.selection_clear(),this.factsShown=null,this.facts.replaceChildren()))}),this.feedView=new p1(r.parentElement,{changed:(d,u)=>this.feedMode_apply(d,u)}),this.metricMode=this.feedView.modes_get().metric,this.hueMode=this.feedView.modes_get().hue,this.scalePill=this.feedView.pill_find("metric"),this.huePill=this.feedView.pill_find("hue"),this.feedModes_recall(),r.closest(".pane-dag")?.addEventListener("argus:dag-physics",d=>{const u=d.detail;if(u==="reset"){this.scene.physics_set({charge:!0,link:!0,collide:!0});return}if(u.term==="gravity"){this.scene.physics_get().gravity!==u.on&&this.feedView.press("gravity");return}this.scene.physics_set({[u.term]:u.on})}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),window.addEventListener("resize",()=>this.scene.size_fit()),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),600)}).observe(document.body,{attributes:!0,attributeFilter:["data-zoom"]})}envelope_observe(e){if(!this.jump_take(e)&&!this.feedAsk_take(e)){if(e.model?.kind===Kf){const s=this.rosterPending||this.rosterShown;this.rosterPending=!1;const i=qf.safeParse(e.model.data);i.success&&(s||this.canvas.style.display==="none")&&this.chooser_show(i.data.feeds);return}if(this.pendingFeedId!==null&&e.status==="error"&&e.model===void 0){this.feedRequest_refuse(e.renderedErr??e.rendered??"");return}if(this.rosterPending&&e.status==="error"){this.rosterPending=!1,this.rosterRefusal_show(e);return}if(e.model?.kind===br.feedIndexing){this.feedIndexing_take(e.model.data);return}e.model?.kind===br.feedDag&&this.feedDag_take(e.model.data)}}feedIndexing_take(e){const s=UR.safeParse(e);!s.success||this.follow.drops(s.data.feedId,this.pinnedFeedId)||(this.requestedFeedId===s.data.feedId?this.requestedFeedId=null:this.pendingFeedId!==s.data.feedId&&(this.pinnedFeedId=s.data.feedId,this.pendingFeedId=s.data.feedId),this.feedIndexing_show(s.data))}feedDag_take(e){const s=bg.safeParse(e);if(!s.success)return;const i=s.data;if(this.follow.drops(i.feedId,this.pinnedFeedId))return;this.requestedFeedId===i.feedId?this.requestedFeedId=null:this.pinnedFeedId=i.feedId,this.shownFeedId=i.feedId,this.pendingFeedId=null,this.linkLine_refresh(),this.listing.activation_settle(),ea(this.stateSpan,"wait"),this.title.textContent=`DAG · FEED ${i.feedId} — ${i.feedName}`.toUpperCase(),this.empty.style.display="none",this.roster_show(!1),this.canvas.style.display="block",this.lastModel!==null&&this.lastModel.feedId!==i.feedId&&(this.facts.replaceChildren(),this.scene.selection_clear());const n=this.lastModel;this.lastModel=i,this.feedModes_recall(),n!==null&&n.feedId===i.feedId&&rm(n,i)?this.statuses_patch(i):this.graph_show(i),this.watch_open(i.feedId),this.lastRoster.some(r=>r.id===i.feedId&&r.new===!0)&&this.unseen_clear([i.feedId]),this.jumpNode!==null&&this.scene.selection_set(String(this.jumpNode))&&(this.jumpNode=null,this.jumpEnter&&(this.jumpEnter=!1,window.setTimeout(()=>{[...this.facts.querySelectorAll("button")].find(r=>r.textContent?.trim()==="ENTER NODE")?.click()},0))),this.feedFrame.arrived(i.feedId),this.handlers.feed_shown?.()}feedModes_recall(){const e=this.feedView.recall(),s=this.modesApplied;return this.modesApplied=e,(s===null||s.strategy!==e.strategy)&&this.scene.strategy_set(e.strategy),(s===null||s.projection!==e.projection)&&this.scene.projection_set(e.projection),(s===null||s.draw!==e.draw)&&this.scene.draw_set(e.draw),(s===null||s.pulse!==e.pulse)&&this.scene.waveLoop_set(e.pulse),(s===null||s.census!==e.census)&&this.scene.census_set(e.census),(s===null||s.gravity!==e.gravity)&&this.scene.physics_set({gravity:e.gravity}),this.metricMode=e.metric,this.hueMode=e.hue,this.modes_render(),s!==null&&(s.metric!==e.metric||s.hue!==e.hue||s.draw!==e.draw)}stage_returned(){this.feedModes_recall()&&this.lastModel!==null&&this.canvas.style.display!=="none"&&this.graph_show(this.lastModel,!1)}feedMode_apply(e,s){switch(this.modesApplied=s,e){case"strategy":this.scene.strategy_set(s.strategy);break;case"projection":this.scene.projection_set(s.projection);break;case"draw":this.scene.draw_set(s.draw),this.lastModel!==null&&this.graph_show(this.lastModel,!1);break;case"pulse":this.scene.waveLoop_set(s.pulse);break;case"census":this.scene.census_set(s.census);break;case"gravity":this.scene.physics_set({gravity:s.gravity});break;case"metric":this.metricMode=s.metric,this.lastModel!==null&&this.graph_show(this.lastModel,!1);break;case"hue":this.hueMode=s.hue,this.lastModel!==null&&this.graph_show(this.lastModel,!1),this.hueMode==="compute"&&!this.computeKnown&&this.shownFeedId!==null&&this.canvas.style.display!=="none"&&(this.computeRereading=!0,this.handlers.command_run(`proc refresh ${this.shownFeedId}`),this.refresh());break}this.modes_render()}marks_refresh(){this.feedFrame.refresh()}feedMarks_show(e,s){this.feedFrame.show(e,s)}watch_open(e){this.watchedFeedId!==e&&(this.watch_release(),this.watchedFeedId=e,this.liveState_show(null),this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watch_release(){this.watchedFeedId!==null&&(this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=null,this.liveState_show(null))}modeSpan=null;hueMode="status";huePill=null;hueLegend=new Map;computeKnown=!1;computeRereading=!1;hueLegend_build(e){return u1(e)}modes_render(){if(this.modeSpan===null)return;const e=[];if(this.scene.strategy_get()!=="ranked"&&e.push("MOLECULE"),this.scene.projection_get()!=="3d"&&e.push("2D"),this.metricMode!=="time"&&e.push("SIZE"),this.scene.census_get()&&e.push("CENSUS"),this.scene.waveLoop_get()&&e.push("PULSE"),this.scene.physics_get().gravity&&e.push("GRAVITY"),this.modeSpan.replaceChildren(document.createTextNode(e.join(" · "))),this.hueMode==="compute"){const s=document.createElement("span");s.className="pane-legend",s.append(document.createTextNode(e.length>0?" · COMPUTE":"COMPUTE"));for(const[i,n]of this.hueLegend){const r=document.createElement("span");r.className="legend-swatch",r.style.backgroundColor=n;const o=document.createElement("span");o.textContent=i,s.append(document.createTextNode(" "),r,o)}this.hueLegend.size===0&&s.append(document.createTextNode(this.computeRereading?" (re-reading the feed…)":" (none reported)")),this.modeSpan.appendChild(s)}}liveState_show(e){if(this.liveState=e,this.stateSpan!==null){if(e===null){ys(this.stateSpan,null,this.canvas.style.display!=="none"?"":void 0);return}ys(this.stateSpan,e,e.toUpperCase())}}liveState_get(){return this.liveState}feed_get(){return this.pendingFeedId??this.shownFeedId}graph_isShown(){return this.canvas.style.display==="block"}feedTitle_get(){return(this.title.textContent??"").replace(/^DAG\s*·\s*/i,"").trim()}place_name(){const s=(this.factsShown===null||this.facts.childElementCount===0?void 0:this.factsPayloads.get(this.factsShown.id))?.vfsPath.replace(/\/data$/,"").split("/").pop();return s!==void 0&&s!==""?s:this.shownFeedId===null?null:`feed_${this.shownFeedId}`}view_lines(){const e=this.strategyPill.parentElement,s=i=>e?.querySelector(i)?.textContent?.trim().toLowerCase()??"";return ZU({layout:s(".dag-strategy"),projection:s(".dag-projection"),scale:s(".dag-scale"),hue:s(".dag-hue"),census:s(".dag-census"),draw:s(".dag-draw"),pulse:s(".dag-pulse"),gravity:s(".dag-gravity"),place:this.place_name()})}watched_observe(e,s){const i=/feed_(\d+)$/.exec(e);!i||Number(i[1])!==this.watchedFeedId||this.liveState_show(s)}model_refresh(e){if(this.pendingFeedId===e.feedId&&this.canvas.style.display==="none"){this.envelope_observe({status:"ok",rendered:"",model:{kind:br.feedDag,data:e}});return}if(this.shownFeedId!==e.feedId||this.canvas.style.display==="none")return;const s=this.lastModel;if(this.lastModel=e,s!==null&&rm(s,e)){this.statuses_patch(e);return}this.graph_show(e,!1)}statuses_patch(e){f1(this.scene,e);for(const s of e.nodes)this.factsPayloads.set(s.id,s);this.factsShown!==null&&this.facts_show(this.factsShown)}refresh(){this.shownFeedId===null||this.canvas.style.display==="none"||(this.requestedFeedId=this.shownFeedId,this.handlers.command_run(`feed diagram feed_${this.shownFeedId}`))}scalePill=null;graph_show(e,s=!0){const i=e.nodes.some(r=>l1(r,this.metricMode)!==void 0);this.scalePill?.classList.toggle("rail-na",!i),this.scalePill!==null&&(this.scalePill.title=i?"molecule node size: wall time or output bytes":`no ${this.metricMode==="time"?"wall-time":"output-size"} data in this feed's cache yet`),this.hueLegend=this.hueLegend_build(e);const n=e.nodes.some(r=>r.computeResource!==void 0);this.computeKnown=n,n&&(this.computeRereading=!1),this.huePill?.classList.toggle("rail-na",!n),this.huePill!==null&&(this.huePill.title=n?"what colors a node: its status, or the compute resource it ran on":"no compute resource reported for this feed's nodes yet"),this.scene.graph_set({nodes:c1(e,{metric:this.metricMode,hue:this.hueMode,legend:this.hueLegend,draw:this.feedView.modes_get().draw}).nodes},{wave:s}),this.scene.size_fit(),this.hueMode==="compute"&&this.modes_render(),this.factsPayloads.clear();for(const r of e.nodes)this.factsPayloads.set(r.id,r);this.factsShown!==null&&(this.factsPayloads.has(this.factsShown.id)?this.facts_show(this.factsShown):this.factsShown=null)}factsPayloads=new Map;factsShown=null;promptContext_observe(e){if(this.rosterProgress!==null&&this.rosterProgress.isConnected){const o=e.procWarmup;if(o?.total!==void 0&&o.total>0&&o.sweeping!==!1){const a=Math.floor(o.loaded/o.total*100);this.rosterProgress.textContent=`INDEX WARMING — ${o.loaded}/${o.total} (${a}%). The roster opens when the index is whole.`}(o===void 0||o.sweeping===!1||o.state==="cached")&&(this.rosterProgress=null,this.feedsChooser_request())}this.arrivals_observe(e.procWarmup?.arrived??[]),this.rosterCheck_observe(e.procWarmup?.roster,e.procWarmup?.arrived??[]);const i=(e.procWarmup?.feeds??(e.procWarmup?.feed!==void 0?[e.procWarmup.feed]:[])).find(o=>o.id===this.pendingFeedId);i!==void 0&&this.feedIndexing_show({feedId:i.id,loaded:i.loaded,total:i.total,...i.failed!==void 0?{failed:i.failed}:{}});const n=this.lastCwd!==null&&e.cwd!==this.lastCwd;if(this.lastCwd=e.cwd,!this.canvas.isConnected||this.rosterShown||this.pendingFeedId!==null||!n)return;const r=e5(e.cwd);r!==null&&r!==this.shownFeedId&&(this.pinnedFeedId!==null&&r===this.pinnedFeedId||(this.pinnedFeedId=null,this.requestedFeedId=r,this.handlers.command_run(`feed diagram feed_${r}`)))}progress_observe(e){if(e.itemId===void 0)return;const s=e.status!==void 0?JU[e.status]:void 0;s!==void 0&&this.scene.status_update(String(e.itemId),s)}size_fit(){this.scene.size_fit()}dispose(){this.watch_release(),this.rosterTimer!==null&&clearInterval(this.rosterTimer),this.scene.dispose()}feed_enter(e){this.follow.pick(this.requestedFeedId,e),this.pinnedFeedId=e,this.requestedFeedId=null,this.feedRequest_show(e),this.handlers.command_run(`feed diagram feed_${e}`)}feedRequest_show(e){this.pendingFeedId=e,this.roster_show(!1),this.canvas.style.display="none",this.facts.replaceChildren(),this.title.textContent=`DAG · FEED ${e}`,this.empty.textContent=`RETRIEVING FEED ${e}…`,this.empty.style.display="block",ys(this.stateSpan,"wait","LOADING")}feedIndexing_show(e){this.pendingFeedId===null&&(this.pendingFeedId=e.feedId),this.roster_show(!1),this.canvas.style.display="none",this.title.textContent=`DAG · FEED ${e.feedId}`;const s=e.total>0?`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:`${e.loaded.toLocaleString()} / ?`;this.empty.textContent=e.failed!==void 0?`INDEXING FEED ${e.feedId} FAILED AT ${s} — ${e.failed.toUpperCase()} — REFRESH RETRIES`:`INDEXING FEED ${e.feedId} — ${s}`,this.empty.style.display="block",ys(this.stateSpan,"wait",e.failed!==void 0?"FAILED":"LOADING"),e.failed===void 0&&this.watch_open(e.feedId)}feedRequest_refuse(e){const s=this.pendingFeedId;this.pendingFeedId=null,this.listing.activation_settle(),this.empty.textContent=`FEED ${s??"?"}: ${e.trim()||"not available"}`.toUpperCase(),this.empty.style.display="block",this.roster_show(!0),this.title.textContent=this.defaultTitle,ea(this.stateSpan,"wait"),this.listing.state_refresh()}feedsChooser_request(){const e=document.createElement("div");e.className="feedlist-loading",e.textContent="RETRIEVING FEED ROSTER…",this.feedList.replaceChildren(e),this.canvas.style.display!=="none"&&this.graph_leave(),this.roster_show(!0),this.rosterPending=!0,this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}rosterPending=!1;target_jumpTo(e,s=!1){this.jumpEnter=s,this.jump_ask(e)}linkLine_refresh(){if(this.shownFeedId===null){this.linkLine.hidden=!0;return}const e=this.factsShown===null||this.facts.childElementCount===0?void 0:this.factsPayloads.get(this.factsShown.id);tg(this.linkLine,e?.vfsPath.replace(/\/data$/,"")??`/proc/jobs/feed_${this.shownFeedId}`),this.linkLine.hidden=!1}async jump_ask(e){if(this.paneRoot===null)return;const s=(e??await id(this.paneRoot,{kind:"text",message:"Jump to a feed or node (4389, feed_4389, pl-dircopy_639204): ",commit:"JUMP"})??"").trim();s===""||/\s/.test(s)||(this.jumpPending=!0,this.handlers.command_run(`proc jump --where ${s}`))}jump_take(e){if(!this.jumpPending)return!1;if(e.model?.kind===HR){this.jumpPending=!1;const s=jR.safeParse(e.model.data);if(!s.success)return!0;const i=s.data;if(i.choices.length===1){const n=i.choices[0];return this.jumpNode=n.nodeId??null,this.feed_enter(n.feedId),!0}return this.jump_choose(i),!0}return e.status==="error"&&e.model===void 0?(this.jumpPending=!1,this.jumpNote_show(Qu(e.renderedErr||e.rendered||"").replace(/^proc jump:\s*/,"")),!0):!1}async jump_choose(e){if(this.paneRoot===null)return;const s=e.choices.map(n=>({value:n.name,label:n.kind==="feed"?`FEED ${n.feedId} · ${n.title}`:`NODE ${n.nodeId??""} · ${n.name.replace(/_\d+$/,"")} IN FEED ${n.feedId}`})),i=await id(this.paneRoot,{kind:"choose",message:`${e.target} is both a feed and a node: `,choices:s,commit:"JUMP"});i!==null&&i.trim()!==""&&await this.jump_ask(i.trim())}jumpNote_show(e){this.rosterCheckTimer!==null&&clearTimeout(this.rosterCheckTimer),this.rosterCheck={landed:e.toUpperCase()},this.canvas.style.display==="block"?this.stateSpan!==null&&(this.stateSpan.textContent=e.toUpperCase()):this.listing.state_refresh(),this.rosterCheckTimer=setTimeout(()=>{this.rosterCheck=null,this.rosterCheckTimer=null,this.listing.state_refresh()},KM*2)}rosterCheck_observe(e,s){if(e==="full"){if(this.rosterCheck==="checking")return;this.rosterCheckTimer!==null&&(clearTimeout(this.rosterCheckTimer),this.rosterCheckTimer=null),this.rosterCheck="checking",this.listing.state_refresh();return}if(this.rosterCheck!=="checking")return;const i=s.filter(n=>!this.lastRoster.some(r=>r.id===n)).length;this.rosterCheck={landed:i>0?`FEED LIST CURRENT · ${i} NEW`:"FEED LIST CURRENT · NOTHING NEW"},this.listing.state_refresh(),this.rosterCheckTimer=setTimeout(()=>{this.rosterCheck=null,this.rosterCheckTimer=null,this.listing.state_refresh()},KM)}newCount_line(){const e=this.lastRoster.filter(s=>s.new===!0).length;return e===0?"":`${e} NEW SINCE YOUR LAST VISIT`}unseen_clear(e){this.handlers.command_run(e==="all"?"proc seen all":`proc seen ${e.map(i=>`feed_${i}`).join(" ")}`);const s=this.lastRoster.map(i=>{if(i.new!==!0||e!=="all"&&!e.includes(i.id))return i;const{new:n,...r}=i;return r});this.rosterShown?this.chooser_show(s):this.lastRoster=s,this.listing.state_refresh()}rosterCheck_line(){return this.rosterCheck===null?"":this.rosterCheck==="checking"?"CHECKING CUBE FOR THE FEED LIST…":this.rosterCheck.landed}filterMiss_note(e){e!==this.filterMissText&&(this.filterMissText=e,this.feedAsks.clear());const s=document.createElement("div");s.className="feedlist-refusal feedlist-miss";const i=YM(e);return i===null?s.textContent=`no feed matches "${e}"`:this.feedAsks.has(i)?s.textContent=this.feedAsks.get(i)??`feed_${i} is not in the roster; asking CUBE…`:(this.feedAsks.set(i,null),s.textContent=`feed_${i} is not in the roster; asking CUBE…`,this.handlers.command_run(`proc feeds ${i}`)),this.filterMissNote=s,s}feedAsk_take(e){if(this.feedAsks.size===0)return!1;if(e.model?.kind===Kf){const n=qf.safeParse(e.model.data),r=n.success&&n.data.feeds.length===1?n.data.feeds[0]:void 0;return r===void 0||this.feedAsks.get(r.id)!==null?!1:(this.feedAsks.set(r.id,"listed"),this.arrivals.add(r.id),this.chooser_show([...this.lastRoster.filter(o=>o.id!==r.id),r]),!0)}if(e.status!=="error"||e.model!==void 0)return!1;const s=Qu(e.renderedErr||e.rendered||""),i=YM(/feed_(\d+)/.exec(s)?.[0]??"");return i===null||this.feedAsks.get(i)!==null?!1:(this.feedAsks.set(i,s),this.filterMissNote!==null&&this.filterMissNote.isConnected&&(this.filterMissNote.textContent=s),!0)}rosterShown=!1;rosterAskedAt=0;rosterProgress=null;rosterRefusal_show(e){const s=Qu(e.renderedErr||e.rendered||""),i=s.length>0?s:"the roster request was refused",n=document.createElement("div");n.className="feedlist-refusal",n.textContent=i;const r=document.createElement("div");r.className="feedlist-warming",r.textContent="INDEX WARMING… the roster opens when the index is whole.",this.feedList.replaceChildren(n,r),this.roster_show(!0),this.rosterProgress=r}list_reset(){this.pendingFeedId=null,ea(this.stateSpan,"wait"),this.watch_release(),this.facts.replaceChildren(),this.scene.selection_clear(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.empty.style.display="none"}nav_pop(){return this.pendingFeedId!==null&&this.feedList.childElementCount>0?(this.pendingFeedId=null,this.pinnedFeedId=null,this.requestedFeedId=null,this.listing.activation_settle(),this.empty.style.display="none",this.roster_show(!0),this.title.textContent=this.defaultTitle,ea(this.stateSpan,"wait"),this.listing.state_refresh(),!0):this.canvas.style.display==="none"||this.feedList.childElementCount===0?!1:(this.graph_leave(),this.roster_show(!0),this.listing.state_refresh(),!0)}graph_leave(){this.watch_release(),this.canvas.style.display="none",this.pinnedFeedId=null,this.requestedFeedId=null,this.title.textContent=this.defaultTitle,this.facts.replaceChildren(),this.scene.selection_clear()}arrivals_observe(e){const s=e.join(",");if(s===this.arrivalsKey)return;this.arrivalsKey=s,this.arrivals=new Set(e);for(const r of this.lastRoster)this.listing.row_element(String(r.id))?.classList.toggle("feedlist-arrived",this.arrivals.has(r.id));const i=new Set(this.lastRoster.map(r=>r.id));e.some(r=>!i.has(r))&&this.rosterShown&&this.feedsChooser_request()}chooser_show(e){this.lastRoster=e,this.empty.style.display="none",this.roster_show(!0);const s=e.filter(i=>i.new===!0);if(this.clearNewPill!==null&&(this.clearNewPill.hidden=s.length===0),s.length===0)this.listing.rows_set([{key:"roster",rows:e}],{field:"roster"});else{const i=document.createElement("div");i.className="feedlist-newhead",i.textContent=`NEW SINCE YOUR LAST VISIT · ${s.length}`;const n=e.filter(r=>r.new!==!0);this.listing.rows_set([{key:"new",rows:s,header:i},{key:"roster",rows:n}],{field:"roster"})}this.rosterFrame_track()}feed_activate(e){this.follow.pick(this.requestedFeedId,e.id),this.pinnedFeedId=e.id,this.requestedFeedId=null,this.handlers.feed_regard?.(`/proc/jobs/feed_${e.id}`),this.feedRequest_show(e.id),this.handlers.command_run(`feed diagram feed_${e.id}`)}row_indicate(e){this.listing.row_indicate(e===null?null:String(e.id))}indicated_refresh(){const e=this.listing.indicated_get(),s=e===null?void 0:this.lastRoster.find(i=>String(i.id)===e);s!==void 0&&this.handlers.feed_indicated?.(s)}roster_ask(){this.rosterAskedAt=Date.now(),this.handlers.command_run("proc feeds")}tagMark_press(e){const s=e.target instanceof Element?e.target:null,i=s?.closest(".feedlist-tag")??null;if(i===null)return;e.stopPropagation(),e.preventDefault();const n=i.dataset.tag??"",r=Number(i.closest("[data-feed]")?.dataset.feed);if(s?.closest(".feedlist-tag-x")!==null&&Number.isFinite(r)){this.handlers.feed_untag?.(r,n);return}this.roster_filter(`tag:${n}`)}rowReadout_show(e,s){this.listing.readout_show(String(e),s)}filter_toggle(e){this.listing.filter_toggle(e)}roster_filter(e){this.listing.filter_toggle(e!==""),this.listing.filter_set(e)}rosterFrameObserver=null;rosterFrame_track(){const e=this.feedList.parentElement,s=this.feedList.querySelector(".roster-order");if(this.rosterFrameObserver?.disconnect(),this.rosterFrameObserver=null,e===null)return;if(s===null){e.style.removeProperty("--mode-frame-top");return}const i=()=>{e.style.setProperty("--mode-frame-top",`${Math.ceil(s.getBoundingClientRect().bottom-e.getBoundingClientRect().top)}px`)};i(),this.rosterFrameObserver=new ResizeObserver(i),this.rosterFrameObserver.observe(s)}roster_show(e){this.rosterShown=e,this.backPill!==null&&(this.backPill.hidden=e),this.feedFrame.shown_set(!e),this.feedList.style.display=e?"flex":"none",this.feedList.parentElement?.classList.toggle("roster-shown",e)}facts_show(e){this.factsShown=e;const s=this.factsPayloads.get(e.id);if(!s){this.facts.textContent=e.label;return}this.handlers.node_regard?.(s.vfsPath),o1(this.facts,s,{...this.handlers.node_dive!==void 0||this.handlers.node_enter!==void 0?{enter:()=>this.node_activate(e)}:{},...this.handlers.node_process!==void 0?{process:this.handlers.node_process}:{}})}node_activate(e){const s=this.factsPayloads.get(e.id);if(s)if(this.handlers.node_dive!==void 0){const i=this.handlers.node_dive;this.scene.flight_into(e.id,()=>i(s.vfsPath))}else this.handlers.node_enter(s.vfsPath)}detail_clear(){this.scene.selection_clear(),this.facts.replaceChildren()}wave_start(){this.scene.wave_start()}inside_isHeld(){return this.scene.holding_get()}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){for(const[s,i]of this.factsPayloads){if(i.instanceId!==e)continue;if(this.handlers.node_dive===void 0)return!1;const n=this.handlers.node_dive;return this.facts_show({id:s,label:i.label,parentIds:[],joinParentIds:[]}),this.scene.flight_into(s,()=>n(i.vfsPath)),!0}return!1}}function e5(t){for(const e of XU){const s=t.match(e);if(s?.[1]!==void 0)return parseInt(s[1],10)}return null}function ef(t,e){const s=Xf(t);if(s===null)return null;let i=0,n=0,r=0;for(const a of e.all()){const l=a.groups.filter(c=>c.plugin===s);if(l.length!==0){i+=1;for(const c of l)n+=c.count,r+=c.errored}}const o=n===0?0:Math.round(r/n*100);return`${s} · ${i.toLocaleString("en-US")} feed${i===1?"":"s"} · ${o}% errored`}class t5{byId=new Map;take(e){let s=!1;for(const i of e){const n=this.byId.get(i.id);n!==void 0&&n.status===i.status&&n.jobs===i.jobs&&JSON.stringify(n.groups)===JSON.stringify(i.groups)||(this.byId.set(i.id,{...i,chain:[...i.chain],groups:i.groups.map(r=>({...r}))}),s=!0)}return s}size(){return this.byId.size}shapes(){return new Set([...this.byId.values()].map(Ps)).size}all(){return[...this.byId.values()]}get(e){return this.byId.get(e)}clear(){this.byId.clear()}}function s5(t,e){const s=t.match(/^feed:(\d+):(\d+)$/);if(s===null)return null;const i=e.get(Number(s[1])),n=i?.groups[Number(s[2])];if(i===void 0||n===void 0)return null;const r=n.count>1?` ×${n.count.toLocaleString("en-US")}`:"",o=i.title.length>0?` · ${i.title}`:"",a=n.errored>0&&n.count>1?`${n.errored.toLocaleString("en-US")} errored`:n.status;return`${n.plugin}${r} · ${a} · feed ${i.id}${o}`}function i5(t,e){return`argus.universe.${t}@${e}`}const hr={draw:"stars",view:"feeds",scale:"jobs",density:"shape",arrangement:"galaxy",captions:!0};function n5(t,e,s,i,n=hr.arrangement,r=hr.captions){return{draw:t,view:e,scale:s,density:i,arrangement:n,captions:r}}function r5(t){let e={};try{const i=t===null?null:JSON.parse(t);i!==null&&typeof i=="object"&&!Array.isArray(i)&&(e=i)}catch{}const s=(i,n,r)=>typeof i=="string"&&n.includes(i)?i:r;return{draw:s(e.draw,["stars","spheres"],hr.draw),view:s(e.view,["feeds","shapes"],hr.view),scale:s(e.scale,["jobs","feeds"],hr.scale),density:s(e.density,["shape","census"],hr.density),arrangement:s(e.arrangement,["galaxy","spokes","clumps","constellations","data","accretion"],hr.arrangement),captions:typeof e.captions=="boolean"?e.captions:hr.captions}}function XM(t){if(t===null||t.length===0)return{};try{const e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return{};const s={};for(const[i,n]of Object.entries(e))Array.isArray(n)&&n.length===3&&n.every(r=>typeof r=="number"&&Number.isFinite(r))&&(s[i]=[n[0],n[1],n[2]]);return s}catch{return{}}}function tf(t,e){return`inst:${t}:${e}`}function o5(t,e,s,i="jobs",n=!1,r){const o=r??(n?vg(t,i):yd(t,i)),a=`feed:${e}:`;return{nodes:[...o.nodes.filter(c=>!c.id.startsWith(a)).map(c=>({...c,dim:!0})),...s.nodes]}}function g1(t,e){return e.groups.map((s,i)=>Mr(t,i))}function _1(t,e=3){const s=zd(t).split(" > ");return s.length<=e?s.join(" > "):`${s.slice(0,e).join(" > ")} … +${s.length-e}`}function a5(t,e){if(!t.startsWith("shape:"))return null;const s=t.slice(6),i=e.all().filter(n=>Ps(n)===s).length;return`${zd(s)} · ${i} feed${i===1?"":"s"}`}function l5(t,e){const s=[];for(const i of e.all())Ps(i)===t&&s.push(...g1(i.id,i));return s}function c5(t,e,s="jobs"){const i=yd(t,s),n=new Set(t.filter(o=>Ps(o)===e).map(o=>o.id));return{nodes:i.nodes.map(o=>{if(o.ghost===!0)return o.id===dz(e)?o:{...o,dim:!0};const a=o.id.match(/^feed:(\d+):/);return a!==null&&n.has(Number(a[1]))?o:{...o,dim:!0}})}}function b1(t,e="jobs"){const s=new Map;for(const n of[...t].sort((r,o)=>r.id-o.id)){if(n.groups.length===0)continue;const r=Ps(n),o=s.get(r)??[];o.push(n),s.set(r,o)}const i=[];for(const[n,r]of s)r[0].groups.forEach((a,l)=>{let c=0,h=0;for(const u of r){const p=u.groups[l];p!==void 0&&(c+=p.count,p.errored>0&&(h+=1))}const d=h>0?Math.min(1,h/r.length):void 0;i.push({id:ep(n,l),label:a.plugin,parentIds:a.parent===null?[]:[ep(n,a.parent)],joinParentIds:[],status:h===r.length?"finishedWithError":"finishedSuccessfully",metric:Nl(e==="feeds"?r.length:c),...r.length>1?{count:r.length}:{},...d!==void 0?{share:d}:{}})});return{nodes:i}}function h5(t,e){const s=t.match(/^fold:(.+):(\d+)$/);if(s===null)return null;const i=s[1],n=Number(s[2]),r=e.all().filter(h=>Ps(h)===i),o=r[0]?.groups[n]?.plugin;if(o===void 0)return null;const a=r.filter(h=>(h.groups[n]?.errored??0)>0).length,l=`${r.length.toLocaleString("en-US")} feed${r.length===1?"":"s"}`,c=a>0?` · ${a.toLocaleString("en-US")} with errors`:"";return`${o} · ${l}${c} · ${_1(i)}`}function ZM(t,e){const s=e.all().find(i=>Ps(i)===t);return s===void 0?[]:s.groups.map((i,n)=>ep(t,n))}function JM(t,e,s="jobs"){const i=t.filter(l=>Ps(l)===e),n=t.filter(l=>Ps(l)!==e),r=b1(n,s),o=yd(i,s),a=o.nodes.filter(l=>l.ghost!==!0).map(l=>l.id);return{graph:{nodes:[...r.nodes.map(l=>({...l,dim:!0})),...o.nodes]},memberIds:a}}class d5{root;label;fill;constructor(e){this.root=document.createElement("div"),this.root.className="wait-progress",this.root.hidden=!0,this.root.setAttribute("role","progressbar"),this.root.setAttribute("aria-valuemin","0"),this.root.setAttribute("aria-valuemax","100"),this.label=document.createElement("span"),this.label.className="wait-progress-label";const s=document.createElement("span");s.className="wait-progress-track",this.fill=document.createElement("span"),this.fill.className="wait-progress-fill",s.appendChild(this.fill),this.root.append(this.label,s),e.appendChild(this.root)}show(e,s){this.root.hidden=!1,this.label.textContent=s===null?e:`${e} · ${Math.floor(s*100)}%`,this.root.classList.toggle("wait-progress-indeterminate",s===null),this.fill.style.width=s===null?"":`${Math.max(0,Math.min(1,s))*100}%`,s===null?this.root.removeAttribute("aria-valuenow"):this.root.setAttribute("aria-valuenow",String(Math.floor(s*100)))}hide(){this.root.hidden=!0}shown(){return!this.root.hidden}}const u5=600;function f5(t,e){if(e===null)return t.projection_set(t.projection_get()==="3d"?"2d":"3d"),null;if(t.projection_get()==="2d")return"universe: the whole space is 2D; BACK and press 2D to stand it up";const s=[...e];return t.flat_set(t.flat_get()?null:s),t.camera_flyToFit(s,u5,()=>{},1,.95),null}function p5(t,e){return t.projection_get()==="2d"||e&&t.flat_get()?"2D":"3D"}function om(t,e,s){const i=t?.querySelector(".universe-projection");i!=null&&(i.textContent=p5(e,s))}function m5(t,e,s,i){const n=f5(e,s);n!==null&&i(n),om(t,e,s!==null)}const g5=4e3;function _5(t){const e={...Dr,gravity:!0};return t.charge===e.charge&&t.link===e.link&&t.collide===e.collide&&t.gravity===e.gravity}function QM(t){let e=0;for(const s of Object.values(t))e+=s[0]*1.3+s[1]*1.7+s[2]*1.9;return`${Object.keys(t).length}:${e.toFixed(2)}`}function sf(t){return t==="constellations"||t==="data"||t==="accretion"}const b5=18e4,M5=1500,v5=1e3,w5=5e3,y5=3e3,Ko=650,z5=650,S5=1.5;class x5{scene;wait;asking=!1;spaceKey="";landed=new t5;canvas;title;state;noteTimer=null;empty;handlers;store;whole=!1;shown=!1;warming="";repaintTimer=null;lastReask=0;rememberTimer=null;putSignatures=new Map;sessionPlaces=new Map;sessionWait=null;storeKey=null;arrivalsKey="";feedsCount=null;disposed=!1;scale="jobs";view="feeds";inside=null;cluster=null;framedAt=null;entering=null;facts;viewPill=null;gravityPill=null;densityPill=null;density="shape";drawMode="stars";drawPill=null;captionsPill=null;captions=!0;arrangement="galaxy";arrangementPill=null;scalePill=null;physics={...Dr,gravity:!0};backPill;openPill;pane;feedFrame=null;feedView=null;insideModel=null;insideEntered=null;insideModes=null;watchedFeedId=null;liveState=null;escape_listen;lit=null;dataHubs=new Map;litHub=null;replayPill=null;replayDay="";reach=null;constructor(e,s,i){this.canvas=e.canvas,this.title=e.title,this.state=e.state,this.empty=e.empty,this.handlers=s,this.store=i,this.facts=e.facts,this.backPill=e.backPill,this.openPill=e.openPill,this.pane=e.canvas.closest(".workspace-pane"),this.wait=new d5(e.canvas),this.scene=new Gd(e.canvas,{progress:(n,r,o)=>this.settle_progress(n,r,o),handoffKey:n=>kk(n.id),tip:n=>this.inside===null?Dk(n.id,this.dataHubs)??ef(n.id,this.landed)??h5(n.id,this.landed)??s5(n.id,this.landed)??a5(n.id,this.landed):null,select:n=>this.node_select(n),activate:n=>{const r=this.inside===null?Xf(n.id):null;r!==null?this.plugin_frame(r):this.node_dive(n)},deselect:()=>{this.facts_clear(),this.lit!==null&&this.plugin_light(null)},replay:()=>this.replay_paint(),gesture_end:()=>this.pinch_leave()}),this.scene.strategy_set("molecule"),this.scene.physics_set(this.physics),this.frame_wire(e),this.feedFrame=new a1(e.frame??null,{...s.feed_entered!==void 0?{feed_entered:s.feed_entered}:{},...s.feed_note!==void 0?{feed_note:s.feed_note}:{},...s.feed_tag!==void 0?{feed_tag:s.feed_tag}:{},...s.feed_rename!==void 0?{feed_rename:s.feed_rename}:{},...s.feed_untag!==void 0?{feed_untag:s.feed_untag}:{},shown:()=>this.inside?.feedId??null,name:()=>this.inside?.title??"",renamed:(n,r)=>{this.inside?.feedId===n&&(this.inside={...this.inside,title:r},this.title_paint())}}),this.feedView=new p1(e.frame??null,{changed:(n,r)=>this.feedMode_apply(n,r)}),this.escape_listen=this.escape_wire(),this.scene.draw_set(this.drawMode),this.canvas.style.display="none",this.title_paint()}frame_wire(e){e.backPill?.addEventListener("click",()=>this.ascend()),e.openPill?.addEventListener("click",()=>{this.inside!==null&&this.handlers.feed_open?.(this.inside.feedId)}),e.projectionPill?.addEventListener("click",()=>m5(this.pane,this.scene,this.inside?.ids??null,s=>this.bar_note(s))),e.refreshPill?.addEventListener("click",()=>this.request()),this.replayPill=e.replayPill??null,e.replayPill?.addEventListener("click",()=>{const s=this.scene.replay_state();s===null?this.bar_note(this.replay_start(1)):s.playing?this.scene.replay_pause():this.scene.replay_play(),this.replay_paint()}),e.scalePill?.addEventListener("click",()=>{this.scale=this.scale==="jobs"?"feeds":"jobs",e.scalePill!==null&&(e.scalePill.textContent=this.scale==="jobs"?"JOBS":"ALIKE"),this.shown&&this.paint(!0,"full"),this.settings_save()}),e.viewPill?.addEventListener("click",()=>this.view_set(this.view==="feeds"?"shapes":"feeds")),this.viewPill=e.viewPill,this.gravityPill=e.gravityPill,e.gravityPill?.addEventListener("click",()=>{this.physics_set("gravity",!this.physics.gravity)}),this.densityPill=e.densityPill,e.densityPill?.addEventListener("click",()=>{this.density_set(this.density==="shape"?"census":"shape")}),this.drawPill=e.drawPill??null,this.scalePill=e.scalePill,e.drawPill?.addEventListener("click",()=>{if(this.inside!==null){this.feedView?.press("draw");return}this.draw_set(this.drawMode==="stars"?"spheres":"stars")}),this.captionsPill=e.captionsPill??null,e.captionsPill?.addEventListener("click",()=>{this.bar_note(this.captions_set(!this.captions))}),this.arrangementPill=e.arrangementPill??null,e.arrangementPill?.addEventListener("click",()=>{const s=["galaxy","spokes","clumps","constellations","data","accretion"];this.bar_note(this.arrangement_set(s[(s.indexOf(this.arrangement)+1)%s.length]))})}escape_wire(){const e=s=>{if(s.key==="Escape"&&this.scene.replay_state()!==null&&(this.pane===null||this.pane.offsetParent!==null)){this.replay_end();return}s.key!=="Escape"||this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.pane!==null&&this.pane.offsetParent===null||this.ascend()};return window.addEventListener("keydown",e),e}request(){this.asking=!0,this.shown||this.wait.show("ASKING THE SESSION FOR THE SPACE",null),this.title_paint(),this.shown||this.handlers.command_run(`proc layout ${this.sessionLayoutName_derive(this.arrangement)}`),this.handlers.command_run("proc universe")}settle_progress(e,s,i){if(e>=s){this.wait.hide(),this.remember_later();return}this.wait.show(`SETTLING ${i.toLocaleString("en-US")} SPHERES`,s===0?1:e/s)}envelope_observe(e){if(e.model?.kind===JR){const i=ZR.safeParse(e.model.data);i.success&&this.sessionLayout_take(i.data.name,i.data.positions,i.data.laying??null);return}if(e.model?.kind!==XR)return;const s=YR.safeParse(e.model.data);s.success&&this.space_show(s.data)}promptContext_observe(e){if(this.disposed)return;this.identity_note(e.user,e.uri);const s=e.procWarmup?.landed??[];s.length>0&&this.shown&&this.landings_take(s);const i=e.procWarmup;if(i?.total!==void 0&&i.total>0&&i.sweeping!==!1&&!this.whole){const n=Math.floor(i.loaded/i.total*100),r=`INDEX WARMING ${i.loaded.toLocaleString()}/${i.total.toLocaleString()} (${n}%)`;r!==this.warming&&(this.warming=r,this.title_paint())}else this.shown&&!this.whole&&(i===void 0||i.sweeping===!1||i.state==="cached")&&(this.warming="",this.request());if(this.shown&&this.whole){const n=(i?.arrived??[]).join(","),r=e.procIndex?.feeds??null,o=n.length>0&&n!==this.arrivalsKey||r!==null&&this.feedsCount!==null&&r!==this.feedsCount;this.arrivalsKey=n,r!==null&&(this.feedsCount=r),o&&Date.now()-this.lastReask>w5&&(this.lastReask=Date.now(),this.request())}}size_fit(){this.scene.size_fit()}verbs_get(){return{enter:e=>this.verb_enter(e),node:e=>this.verb_node(e),state:()=>this.verb_state(),plugin:e=>this.verb_plugin(e),replay:e=>this.verb_replay(e),layout:e=>this.verb_layout(e),draw:e=>this.verb_draw(e),regrow:()=>this.verb_regrow(),captions:e=>this.verb_captions(e),density:e=>this.verb_density(e),physics:e=>this.verb_physics(e),view:e=>this.verb_view(e),cluster:e=>this.verb_cluster(e),back:()=>this.verb_back(),open:()=>this.verb_open()}}control(e,s){if(this.scene.moving()&&(e==="cluster"||e==="back"))return"universe: still moving; ask again";const i=this.verbs_get()[e];return i===void 0?"universe enter <feed>|node <instance>|cluster <feed>|view feeds|shapes|density shape|census|draw stars|spheres|captions on|off|layout galaxy|spokes|clumps|constellations|data|accretion|regrow|plugin <name>|off|replay [speed]|pause|stop|at <date>|state|physics <term> on|off|reset|back|open":i(s)}verb_enter(e){const s=parseInt(e[0]??"",10);return Number.isFinite(s)?this.landed.get(s)===void 0?`universe enter: feed ${s} has not landed here`:this.inside!==null?`universe enter: already inside feed ${this.inside.feedId}; universe back first`:(this.descend(s),`entering feed ${s}`):"universe enter <feed id>"}verb_node(e){const s=parseInt(e[0]??"",10);return Number.isFinite(s)?this.inside===null?"universe node: not inside a feed (universe enter <feed> first)":this.node_flyTo(s)?`flying into instance ${s}`:`universe node: no node of feed ${this.inside.feedId} hosts instance ${s}`:"universe node <instance id>: fly into the entered feed's node that hosts it"}verb_state(){const e=this.scene.state_get(),s=(()=>{const i=this.settingsKey_get();try{return i===null||this.store===void 0?null:this.store.getItem(i)}catch{return null}})();return[`universe: ${this.inside!==null?`inside feed ${this.inside.feedId}`:this.cluster!==null?"in a cluster":"the whole space"}; view ${this.view}, scale ${this.scale}, density ${this.density}`,`scene: ${Object.entries(e).map(([i,n])=>`${i}=${String(n)}`).join(" ")}`,`kept settings: ${s??"(none)"}`,`lit: ${this.lit??"none"}`,`captions: ${this.captions?"on":"off"}`,`session layout: ${(()=>{const i=this.sessionPlaces.get(this.sessionLayoutName_derive(this.arrangement));return i===void 0?"not asked":i===null?"none kept":`${i} places kept`})()}`,`replay: ${(()=>{const i=this.scene.replay_state();return i===null?"none":`${i.playing?"playing":"paused"} at ${new Date(i.at).toISOString().slice(0,10)} of ${new Date(i.span[0]).toISOString().slice(0,10)}..${new Date(i.span[1]).toISOString().slice(0,10)}`})()}`].join(`
|
|
4343
|
-
`)}verb_plugin(e){const s=e[0]??"";return s===""?"universe plugin <name> | off":this.arrangement!=="constellations"||this.inside!==null||this.cluster!==null?"universe plugin: the CONSTELLATIONS layout only (universe layout constellations)":s.toLowerCase()==="off"?(this.plugin_light(null),"no plugin lit"):this.landed.all().some(i=>i.groups.some(n=>n.plugin===s))?(this.plugin_light(s),ef(`plugin:${s}`,this.landed)??s):`universe plugin: no feed here ran ${s}`}verb_replay(e){const s=(e[0]??"").toLowerCase();if(s==="stop")return this.scene.replay_state()===null?"universe replay: none is running":(this.replay_end(),"replay stopped; the space is whole");if(s==="pause")return this.scene.replay_state()===null?"universe replay: none is running":(this.scene.replay_pause(),this.replay_paint(),"replay paused");if(s==="at"){if(this.scene.replay_state()===null)return"universe replay: none is running (universe replay first)";const n=Date.parse(e[1]??"");return Number.isFinite(n)?(this.scene.replay_pause(),this.scene.replay_seek(n),this.replay_paint(),`replay at ${new Date(this.scene.replay_state()?.at??n).toISOString().slice(0,10)}`):"universe replay at <YYYY-MM-DD>"}const i=s===""?1:Number(s);return!Number.isFinite(i)||i<=0?"universe replay [speed] | pause | stop | at <YYYY-MM-DD>":this.scene.replay_state()!==null?(this.scene.replay_play(i),this.replay_paint(),`replaying at ×${i}`):this.replay_start(i)}verb_layout(e){const s=(e[0]??"").toLowerCase();return s!=="galaxy"&&s!=="spokes"&&s!=="clumps"&&s!=="constellations"&&s!=="data"&&s!=="accretion"?"universe layout galaxy|spokes|clumps|constellations|data|accretion":this.arrangement_set(s)}verb_draw(e){const s=(e[0]??"").toLowerCase();return s!=="stars"&&s!=="spheres"?"universe draw stars|spheres":this.draw_set(s)}verb_regrow(){if(this.arrangement!=="accretion"||this.inside!==null||this.cluster!==null)return"universe regrow: the ACCRETION layout only (universe layout accretion)";this.replay_end();const e=this.positionsKey_derive("accretion");try{e!==null&&this.store?.setItem(e,"{}")}catch{}return this.paint(!0,"full"),"the space regrown from its first feed"}verb_captions(e){const s=(e[0]??"").toLowerCase();return s!=="on"&&s!=="off"?"universe captions on|off":this.captions_set(s==="on")}verb_density(e){const s=(e[0]??"").toLowerCase();return s!=="shape"&&s!=="census"?"universe density shape|census":this.density_set(s)}verb_physics(e){const s=(e[0]??"").toLowerCase();if(s==="reset")return this.physics_reset();if(!["charge","link","collide","gravity"].includes(s))return"universe physics charge|link|collide|gravity [on|off] | reset";const i=(e[1]??"on").toLowerCase()!=="off";return this.physics_set(s,i)}verb_view(e){const s=(e[0]??"").toLowerCase();return s!=="feeds"&&s!=="shapes"?"universe view feeds|shapes":this.inside!==null||this.cluster!==null?"universe view: climb out first (universe back)":(this.view_set(s),s==="feeds"?"every feed its own molecule":"the shapes folded, one molecule each")}verb_cluster(e){const s=parseInt(e[0]??"",10),i=Number.isFinite(s)?this.landed.get(s):void 0;return i===void 0?"universe cluster <feed id>: the cluster of a feed that landed here":this.inside!==null?`universe cluster: inside feed ${this.inside.feedId}; universe back first`:(this.cluster_enter(Ps(i)),`viewing the cluster of feed ${s}: ${zd(Ps(i))}`)}verb_back(){return this.inside===null&&this.cluster===null?"universe back: not inside a feed or a cluster":(this.ascend(),"climbing out")}verb_open(){return this.inside===null?"universe open: not inside a feed":(this.handlers.feed_open?.(this.inside.feedId),`opening feed ${this.inside.feedId}`)}physics_set(e,s){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":e==="reach"?"universe physics: reach is the pane's own":(this.physics={...this.physics,[e]:s},this.physics_apply(),`physics ${e} ${s?"on":"off"}`)}draw_set(e){return this.replay_end(),this.drawMode=e,this.drawPill!==null&&(this.drawPill.textContent=e.toUpperCase()),this.scene.draw_set(e),this.settings_save(),e==="stars"?"every sphere a point of light":"every sphere lit and solid"}captions_set(e){return this.captions=e,this.captionsPill!==null&&(this.captionsPill.textContent=e?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(e),this.settings_save(),e?"captions on: each hub names itself and its count":"captions off: a hub names itself on hover"}arrangement_set(e){if(sf(e)&&this.view!=="feeds")return`universe layout ${e}: the FEEDS view only (universe view feeds)`;this.replay_end();const s=n=>sf(n)?n:"hubs",i=s(e)!==s(this.arrangement);return this.litHub=null,this.remember_now(),this.arrangement=e,this.arrangementPill!==null&&(this.arrangementPill.textContent=e.toUpperCase()),this.positions_recalled(e)===void 0&&this.handlers.command_run(`proc layout ${this.sessionLayoutName_derive(e)}`),this.inside===null&&this.cluster===null&&(this.scene.arrangement_set(e==="data"?"hubs":e,this.positions_recalled(e),!i),i&&this.paint(!0,this.positions_recalled(e)===void 0?"full":"hold")),this.settings_save(),e==="galaxy"?"the space finds its own shape: every sphere pushing, every edge holding":e==="spokes"?"each molecule a spoke round its hub":e==="clumps"?"molecules packed round their hub":e==="constellations"?"every plugin a star, placed by what runs with what; every feed pulled to the stars it ran":e==="data"?"every feed hung from what it began from: its format, its modality, its series":"the space grown in the order it was made: each feed wandering until it sticks, to its kin more readily than to strangers"}settingsKey_get(){return this.storeKey===null?null:this.storeKey.replace(/^argus\.universe\./,"argus.universe.settings.")}settings_save(){const e=this.settingsKey_get();if(!(this.store===void 0||e===null))try{this.store.setItem(e,JSON.stringify(n5(this.drawMode,this.view,this.scale,this.density,this.arrangement,this.captions)))}catch{}}settings_recall(){const e=this.settingsKey_get();if(this.store===void 0||e===null)return!1;let s=null;try{s=this.store.getItem(e)}catch{return!1}const i=r5(s),n=i.view!==this.view||i.scale!==this.scale;return this.drawMode=i.draw,this.view=i.view,this.scale=i.scale,this.density=i.density,this.arrangement=i.arrangement,this.arrangementPill!==null&&(this.arrangementPill.textContent=i.arrangement.toUpperCase()),this.scene.arrangement_set(i.arrangement==="data"?"hubs":i.arrangement,this.positions_recalled(i.arrangement)),this.drawPill!==null&&(this.drawPill.textContent=i.draw.toUpperCase()),this.viewPill!==null&&(this.viewPill.textContent=i.view.toUpperCase()),this.scalePill!==null&&(this.scalePill.textContent=i.scale==="jobs"?"JOBS":"ALIKE"),this.densityPill!==null&&(this.densityPill.textContent=i.density.toUpperCase()),this.scene.draw_set(i.draw),this.scene.census_set(i.density==="census"),this.captions=i.captions,this.captionsPill!==null&&(this.captionsPill.textContent=i.captions?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(i.captions),n}density_set(e){return this.replay_end(),this.density=e,this.densityPill!==null&&(this.densityPill.textContent=e.toUpperCase()),this.scene.census_set(e==="census"),this.settings_save(),e==="census"?"every job its own point":"a stage one sphere, with its count"}physics_reset(){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":(this.physics={...Dr,gravity:!0},this.physics_apply(),"physics reset")}physics_apply(){this.gravityPill!==null&&(this.gravityPill.textContent=this.physics.gravity?"GRAVITY ON":"GRAVITY OFF"),this.scene.physics_set({...this.physics,reach:this.reach??void 0}),this.title_paint()}view_set(e){if(this.replay_end(),e==="shapes"&&sf(this.arrangement)&&(this.arrangement="galaxy",this.arrangementPill!==null&&(this.arrangementPill.textContent="GALAXY"),this.scene.arrangement_set("galaxy",this.positions_recalled("galaxy"),!1)),this.remember_now(),this.view=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.shown&&this.inside===null&&this.cluster===null){const s=this.positions_recalled(this.arrangement);s!==void 0?(this.scene.positions_seed(s),this.paint(!0,"new")):this.paint(!0,"full")}this.settings_save()}inside_get(){return this.inside?.feedId??null}shown_get(){return this.shown}dispose(){this.disposed=!0,this.watch_hold(null),window.removeEventListener("keydown",this.escape_listen),this.repaintTimer!==null&&window.clearTimeout(this.repaintTimer),this.rememberTimer!==null&&window.clearTimeout(this.rememberTimer),this.remember_now(),this.scene.dispose()}space_show(e){this.asking=!1;const s=`${e.whole?"W":"L"}|${e.feeds.map(i=>`${i.id}:${i.jobs}:${i.status}`).join(",")}`;if(this.shown&&s===this.spaceKey){this.title_paint();return}this.spaceKey=s,this.wait.hide(),this.whole=e.whole,this.shown||(this.shown=!0,this.seed_recall()),this.landed.clear(),this.landed.take(e.feeds),this.whole&&(this.warming=""),this.empty.style.display="none",this.canvas.style.display="block",this.inside===null&&this.cluster===null&&this.entering===null&&!this.scene.moving()?this.paint(!this.scene.camera_touched()):this.title_paint()}landings_take(e){!this.landed.take(e)||this.repaintTimer!==null||this.inside!==null||this.cluster!==null||this.entering!==null||(this.repaintTimer=window.setTimeout(()=>{this.repaintTimer=null,!(this.disposed||this.entering!==null||this.inside!==null||this.cluster!==null||this.scene.moving())&&this.paint(!this.scene.camera_touched())},v5))}paint(e=!0,s="new"){if(this.sessionWait_holds()){this.title_paint();return}const i=this.view==="shapes"?b1(this.landed.all(),this.scale):this.arrangement==="constellations"?vg(this.landed.all(),this.scale):this.arrangement==="data"?this.dataGraph_paint():this.arrangement==="accretion"?zb(this.landed.all(),this.scale):yd(this.landed.all(),this.scale),n=this.arrangement==="constellations"?this.lit:null,r=n===null?i:{nodes:i.nodes.map(a=>a.attrs?.kind==="star"||a.attrs?.plugin===n?a:{...a,dim:!0})},o=Rk(r.nodes.length);o!==this.reach&&(this.reach=o,this.scene.physics_set({reach:o},!1)),this.scene.graph_set(r,{wave:!1,fit:e,settle:s}),this.title_paint(),this.remember_later()}descend(e,s){this.replay_end();const i=this.landed.get(e),n=this.handlers.feed_dag;if(i===void 0||n===void 0||this.scene.moving()||this.inside!==null)return;this.facts_clear(),this.feedView?.recall();const r=g1(e,i);this.entering=e,this.title_paint();const o=Date.now(),a=s!==void 0?{toward:s,distance:14,durationMs:Ko}:{fit:r,durationMs:Ko};this.scene.descent(a,async()=>{const l=await n(e);if(this.disposed)return null;if(this.entering=null,l===null)return this.title_paint(),this.handlers.note?.(`universe: feed ${e}: the session gave no graph for it (feed diagram feed_${e} refused or answered nothing after ${Math.round((Date.now()-o)/1e3)}s)`),null;const c=this.insidePlan_build(e,i,l,[r,ZM(Ps(i),this.landed)],Ko);return{...c,drawn:()=>{const h=new Set(c.unfolding);this.inside={feedId:e,title:l.feedName,entered:this.insideEntered,ids:h},this.insideModel=l,this.pane?.classList.add("universe-inside"),om(this.pane,this.scene,this.inside!==null);const d=this.feedView?.modes_get()??{...xl};this.insideModes=d,this.scene.draw_set(d.draw),this.drawPill!==null&&(this.drawPill.textContent=d.draw.toUpperCase()),this.scene.waveLoop_set(d.pulse),this.feedFrame?.shown_set(!0),this.feedFrame?.arrived(e),this.watch_hold(e),this.title_paint()}}},()=>this.landed_note())}insidePlan_build(e,s,i,n,r){const o=this.feedView?.modes_get()??{...xl},a=c1(i,{metric:o.metric,hue:o.hue,legend:o.hue==="compute"?u1(i):new Map,draw:o.draw,id_map:u=>tf(e,u)});this.insideEntered=a;let l;if(o.strategy==="ranked"){l={};for(const u of kg(a.nodes.map(p=>({id:p.id,parentIds:p.parentIds,...p.metric!==void 0?{metric:p.metric}:{}}))))l[u.id]=[u.position[0],u.position[1],u.position[2]]}const c=`feed:${e}:`,h=this.view==="feeds"?o5(this.landed.all(),e,a,this.scale,this.arrangement==="constellations",this.arrangement==="data"?Sb(this.landed.all(),this.scale).graph:this.arrangement==="accretion"?zb(this.landed.all(),this.scale):void 0):{nodes:[...JM(this.landed.all(),Ps(s),this.scale).graph.nodes.filter(u=>!u.id.startsWith(c)).map(u=>({...u,dim:!0})),...a.nodes]},d=a.nodes.map(u=>u.id);return{graph:h,unfolding:d,from:n,physics:{reach:Qf,gravity:!1},...l!==void 0?{placed:l}:{},frame:d,durationMs:r,bulk:1,margin:.95}}feedMode_apply(e,s){if(this.inside===null)return;if(this.insideModes=s,e==="pulse"){this.scene.waveLoop_set(s.pulse);return}e==="draw"&&(this.scene.draw_set(s.draw),this.drawPill!==null&&(this.drawPill.textContent=s.draw.toUpperCase()));const i=this.landed.get(this.inside.feedId);if(i===void 0||this.insideModel===null||this.scene.moving())return;const n=this.inside,r=this.insidePlan_build(n.feedId,i,this.insideModel,[[...n.ids]],400);this.scene.unfold({...r,drawn:()=>{this.inside={...n,entered:this.insideEntered}}})}stage_returned(){if(this.inside===null||this.feedView===null)return;const e=this.insideModes,s=this.feedView.recall();e===null||JSON.stringify(e)===JSON.stringify(s)||(e.draw!==s.draw&&this.feedMode_apply("draw",s),e.pulse!==s.pulse&&this.feedMode_apply("pulse",s),(e.strategy!==s.strategy||e.metric!==s.metric||e.hue!==s.hue)&&this.feedMode_apply("strategy",s),this.insideModes=s)}watch_hold(e){this.watchedFeedId!==e&&(this.watchedFeedId!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=e,this.liveState=null,e!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watched_observe(e,s){const i=/feed_(\d+)$/.exec(e);i===null||Number(i[1])!==this.watchedFeedId||(this.liveState=s,this.title_paint())}model_refresh(e){const s=this.inside;if(s===null||s.feedId!==e.feedId||this.insideModel===null)return;const i=this.insideModel;if(this.insideModel=e,rm(i,e)){f1(this.scene,e,a=>tf(e.feedId,a));for(const a of e.nodes)this.insideEntered?.payloads.set(tf(e.feedId,a.id),a);return}const n=this.landed.get(e.feedId);if(n===void 0||this.scene.moving())return;const r=this.insidePlan_build(e.feedId,n,e,[[...s.ids]],400),o=new Set(r.unfolding);this.scene.unfold({...r,drawn:()=>{this.inside={...s,entered:this.insideEntered,ids:o},this.title_paint()}})}feedMarks_show(e,s){this.feedFrame?.show(e,s)}ascend(){if(!this.scene.moving()){if(this.framedAt=null,this.inside!==null){if(this.inside=null,this.insideModel=null,this.facts_clear(),this.pane?.classList.remove("universe-inside"),this.scene.waveLoop_set(!1),this.scene.draw_set(this.drawMode),this.drawPill!==null&&(this.drawPill.textContent=this.drawMode.toUpperCase()),this.feedFrame?.shown_set(!1),this.watch_hold(null),om(this.pane,this.scene,this.inside!==null),this.cluster!==null){this.cluster_show(this.cluster.shape);return}}else{if(this.cluster===null)return;this.cluster=null,this.pane?.classList.remove("universe-cluster")}this.paint(!1),this.scene.frame([],z5)}}cluster_enter(e){this.replay_end(),!(this.scene.moving()||this.inside!==null)&&this.cluster_show(e)}cluster_show(e){if(this.view==="feeds"){const r=l5(e,this.landed);if(r.length===0)return;this.cluster={shape:e,ids:r},this.pane?.classList.add("universe-cluster"),this.scene.relight(c5(this.landed.all(),e,this.scale),r,Ko,()=>this.landed_note(),()=>this.title_paint());return}const{graph:s,memberIds:i}=JM(this.landed.all(),e,this.scale);if(i.length===0)return;this.cluster={shape:e,ids:i},this.pane?.classList.add("universe-cluster");const n=new Set(i);this.scene.unfold({graph:s,unfolding:s.nodes.filter(r=>n.has(r.id)||r.ghost===!0).map(r=>r.id),from:[ZM(e,this.landed)],physics:{reach:Qf,gravity:!1},frame:i,durationMs:Ko,drawn:()=>this.title_paint()},()=>this.landed_note())}landed_note(){this.framedAt=this.scene.camera_distance()}pinch_leave(){this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.framedAt===null||this.scene.camera_distance()<=this.framedAt*S5||this.ascend()}node_dive(e){const s=this.inside?.entered.payloads.get(e.id),i=this.handlers.node_dive;s===void 0||i===void 0||this.scene.moving()||this.scene.flight_into(e.id,()=>i(s.vfsPath))}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){if(this.inside===null)return!1;for(const[s,i]of this.inside.entered.payloads){if(i.instanceId!==e)continue;const n=this.handlers.node_dive;return n===void 0?!1:(this.scene.flight_into(s,()=>n(i.vfsPath)),!0)}return!1}node_select(e){if(this.scene.moving())return;if(this.inside===null){const i=Xf(e.id);if(i!==null){this.plugin_light(this.lit===i?null:i);return}const n=Jf(e.id);if(n!==null){this.litHub=this.litHub===n?null:n,this.paint(!1,"hold");return}const r=e.id.match(/^feed:(\d+):\d+$/),o=pz(e.id);r!==null?this.descend(Number(r[1]),e.id):o!==null?this.cluster_enter(o):e.id.startsWith("shape:")&&this.cluster_enter(e.id.slice(6));return}const s=this.inside.entered.payloads.get(e.id);s!==void 0&&this.facts_show(e,s)}facts_show(e,s){this.facts!==null&&(o1(this.facts,s,{enter:()=>{this.handlers.node_dive!==void 0?this.node_dive(e):this.handlers.node_enter?.(s.vfsPath)},...this.handlers.node_process!==void 0?{process:this.handlers.node_process}:{}}),this.facts.hidden=!1)}facts_clear(){this.facts!==null&&(this.facts.replaceChildren(),this.facts.hidden=!0)}state_stand(e,s){this.state!==null&&this.noteTimer===null&&ys(this.state,e,s)}bar_note(e){this.state!==null&&(this.noteTimer!==null&&clearTimeout(this.noteTimer),this.noteTimer=null,ys(this.state,"note",e),this.noteTimer=setTimeout(()=>{this.noteTimer=null,ea(this.state,"note"),this.title_paint()},g5))}title_paint(){if(this.entering!==null&&this.inside===null){const s=this.landed.get(this.entering);this.title.textContent=`UNIVERSE — ENTERING FEED ${this.entering}${s!==void 0&&s.title.length>0?` · ${s.title}`:""} …`,this.state_stand("wait","ASKING");return}if(this.inside!==null){const s=this.inside.entered.nodes.reduce((i,n)=>i+(n.count??1),0);this.title.textContent=`UNIVERSE — INSIDE FEED ${this.inside.feedId} · ${this.inside.title} · ${s.toLocaleString("en-US")} JOBS`,this.state_stand(this.liveState==="stale"?"stale":"live",this.liveState===null?"INSIDE":`INSIDE · ${this.liveState.toUpperCase()}`);return}if(this.cluster!==null){const s=this.landed.all().filter(i=>Ps(i)===this.cluster?.shape).length;this.title.textContent=`UNIVERSE — SHAPE ${_1(this.cluster.shape)} · ${s} FEED${s===1?"":"S"}`,this.state_stand("live","CLUSTER");return}if(this.asking&&!this.shown){this.title.textContent="UNIVERSE — ASKING THE SESSION …",this.state_stand("wait","ASKING");return}const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.whole?`UNIVERSE — ${e}`:`UNIVERSE — ${e}${this.warming.length>0?` · ${this.warming}`:" · INDEX WARMING"}`,this.state_stand(this.whole?"settled":"wait",this.whole?"WHOLE":"LANDING"),this.scene.replay_state()!==null&&this.replay_paint()}replay_start(e){if(this.inside!==null||this.cluster!==null)return"universe replay: climb out first (universe back)";if(this.view!=="feeds")return"universe replay: the FEEDS view only (universe view feeds)";if(this.density!=="shape")return"universe replay: SHAPE density only (universe density shape)";if(this.drawMode!=="stars")return"universe replay: it draws stars (universe draw stars)";const s=new Map;for(const a of this.landed.all()){const l=Date.parse(a.createdAt??"");Number.isFinite(l)&&s.set(a.id,l)}if(s.size===0)return"universe replay: the session does not say when its feeds were made (a daemon from before the replay: restart it)";const i=new Map;for(const a of Object.keys(this.scene.positions_get())){const l=a.match(/^feed:(\d+):/),c=l===null?void 0:s.get(Number(l[1]));c!==void 0&&i.set(a,c)}this.facts_clear(),this.replayDay="",this.scene.replay_begin(i,e),this.replay_paint();const n=this.scene.replay_state(),r=new Date(n?.span[0]??0).toISOString().slice(0,10),o=new Date(n?.span[1]??0).toISOString().slice(0,10);return`replaying ${s.size} feeds, ${r} to ${o}, at ×${e} (universe replay pause | stop | at <date>; Esc stops)`}plugin_light(e){this.lit=e,e===null?this.facts_clear():this.pluginFacts_show(e),this.shown&&this.inside===null&&this.cluster===null&&this.paint(!1,"hold")}plugin_frame(e){this.lit!==e&&this.plugin_light(e);const s=[];for(const i of this.landed.all())i.groups.forEach((n,r)=>{n.plugin===e&&s.push(`feed:${i.id}:${r}`)});s.length===0||this.scene.moving()||this.scene.frame(s,Ko,void 0,.9)}pluginFacts_show(e){if(this.facts===null)return;this.facts.replaceChildren();const s=ef(`plugin:${e}`,this.landed)??e,[,i="",n=""]=s.split(" · ");for(const[a,l]of[["PLUGIN",e],["FEEDS",i.replace(/ feeds?$/,"")],["ERRORED",n.replace(/ errored$/,"")]]){const c=document.createElement("div");c.className="telemetry-row";const h=document.createElement("span");h.className="telemetry-label",h.textContent=a;const d=document.createElement("span");d.className="telemetry-value",d.textContent=l,c.append(h,d),this.facts.append(c)}const r=document.createElement("div");r.className="universe-node-verbs";const o=document.createElement("button");o.className="pacs-capsule universe-plugin-open",o.textContent="OPEN IN /BIN",o.title="the plugin in the files browser: its one-node graph, its parameters",o.addEventListener("click",()=>this.handlers.plugin_open?.(e)),r.append(o),this.facts.append(r),this.facts.hidden=!1}dataGraph_paint(){const{graph:e,hubs:s}=Sb(this.landed.all(),this.scale);this.dataHubs=s;const i=this.litHub;if(i===null)return e;const n=uz(this.landed.all().map(o=>o.data?.seriesDescription).filter(o=>o!==void 0)),r=new Set(this.landed.all().filter(o=>fz(o,n).some(a=>a.key===i)).map(o=>o.id));return{nodes:e.nodes.map(o=>{if(Jf(o.id)!==null)return o;const a=o.id.match(/^feed:(\d+):/);return a!==null&&r.has(Number(a[1]))?o:{...o,dim:!0}})}}replay_end(){this.scene.replay_state()!==null&&(this.scene.replay_stop(),this.replayDay="",this.title_paint(),this.replay_paint())}replay_paint(){const e=this.scene.replay_state();if(this.replayPill!==null){const i=e!==null&&!e.playing&&e.at>=e.span[1];this.replayPill.textContent=e===null?"REPLAY":e.playing?"PLAYING":i?"REPLAYED":"PAUSED",this.replayPill.classList.toggle("rail-off",e===null)}if(e===null||this.state===null)return;const s=`${e.playing?"REPLAY":"PAUSED"} ${new Date(e.at).toISOString().slice(0,10)}`;s!==this.replayDay&&(this.replayDay=s,this.state_stand("live",s))}identity_note(e,s){const i=i5(e,s);if(i===this.storeKey)return;this.storeKey=i;const n=this.settings_recall();if(this.shown){const r=this.seed_recall();(n||r)&&this.inside===null&&this.cluster===null&&this.paint(!1)}}positionsKey_derive(e){if(this.storeKey===null)return null;const s=e==="galaxy"?this.storeKey:`${this.storeKey}.${e}`;return this.view==="shapes"?`${s}.shapes`:s}positions_recalled(e){const s=this.positionsKey_derive(e);if(!(this.store===void 0||s===null))try{const i=XM(this.store.getItem(s));return Object.keys(i).length>0?i:void 0}catch{return}}seed_recall(){const e=this.positionsKey_derive(this.arrangement);if(this.store===void 0||e===null)return!1;const s=XM(this.store.getItem(e));return Object.keys(s).length===0?!1:(this.scene.positions_seed(s),!0)}remember_later(){this.rememberTimer===null&&(this.rememberTimer=window.setTimeout(()=>{this.rememberTimer=null,this.remember_now()},y5))}remember_now(){if(!(this.store===void 0||this.storeKey===null||!this.shown)&&this.positions_matchView(this.scene.positions_get())){try{const e=this.positionsKey_derive(this.arrangement);e!==null&&this.store.setItem(e,JSON.stringify(this.scene.positions_get()))}catch{}this.sessionLayout_put()}}positions_matchView(e){const s=Object.keys(e),i=s.some(r=>r.startsWith("fold:")),n=s.some(r=>r.startsWith("feed:"));return this.view==="shapes"?i&&!n:!i}sessionLayoutName_derive(e){return`${e}${this.view==="shapes"?"-shapes":""}${this.scale==="feeds"?"-alike":""}`}sessionLayout_take(e,s,i=null){if((s!==null||!this.sessionPlaces.has(e))&&this.sessionPlaces.set(e,s===null?null:Object.keys(s).length),s===null&&i!==null){this.sessionWait_hold(e,i);return}const n=this.sessionWait?.name===e;if(n&&this.sessionWait_end(),s===null||this.store===void 0){n&&this.shown&&this.paint(!0,"full");return}const r=["galaxy","spokes","clumps","constellations","data","accretion"].find(a=>this.sessionLayoutName_derive(a)===e);if(r===void 0||this.positions_recalled(r)!==void 0)return;const o=this.positionsKey_derive(r);if(o!==null){try{this.store.setItem(o,JSON.stringify(s))}catch{return}this.putSignatures.set(e,QM(s)),r===this.arrangement&&this.shown&&this.inside===null&&this.cluster===null&&this.entering===null&&(this.scene.positions_seed(s),this.paint(n,"new"))}}sessionWait_hold(e,s){if(e!==this.sessionLayoutName_derive(this.arrangement)||this.positions_recalled(this.arrangement)!==void 0)return;const i=this.sessionWait?.name===e?this.sessionWait.until:Date.now()+b5;if(this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),Date.now()>=i){this.sessionWait_end(),this.shown&&this.paint(!0,"full");return}this.wait.show(`LAYING OUT ${s.nodes.toLocaleString("en-US")} SPHERES · THE SESSION`,s.fraction);const n=window.setTimeout(()=>{this.handlers.command_run(`proc layout ${e}`)},M5);this.sessionWait={name:e,until:i,timer:n}}sessionWait_end(){this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),this.sessionWait=null,this.wait.hide()}sessionWait_holds(){return this.sessionWait!==null&&this.sessionWait.name===this.sessionLayoutName_derive(this.arrangement)&&Date.now()<this.sessionWait.until&&this.inside===null&&this.cluster===null}sessionLayout_put(){if(this.inside!==null||this.cluster!==null||this.scene.replay_state()!==null||!this.whole||!_5(this.physics))return;const e={};for(const[n,r]of Object.entries(this.scene.positions_get()))r.every(o=>Number.isFinite(o))&&(e[n]=[Math.round(r[0]*100)/100,Math.round(r[1]*100)/100,Math.round(r[2]*100)/100]);if(Object.keys(e).length===0)return;const s=this.sessionLayoutName_derive(this.arrangement),i=QM(e);this.putSignatures.get(s)!==i&&(this.putSignatures.set(s,i),this.sessionPlaces.set(s,Object.keys(e).length),this.handlers.command_run(`proc layout put ${s} '${JSON.stringify(e).replace(/'/g,"'\\''")}'`))}}function Ji(t){return`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function M1(t,e){return`touch --withContents=${Ji(e)} ${Ji(t)}`}function v1(t){return`edit ${Ji(t)}`}function O5(t,e,s){return e<s?null:`edit: ${t} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}async function ra(t,e){const{terminal:s,client:i}=t;s.line_echo(e);let n;try{n=await i.line_execute(e)}catch(r){return s.output_write("err",`\x1B[31m${r instanceof Error?r.message:String(r)}\x1B[0m
|
|
4343
|
+
`)}verb_plugin(e){const s=e[0]??"";return s===""?"universe plugin <name> | off":this.arrangement!=="constellations"||this.inside!==null||this.cluster!==null?"universe plugin: the CONSTELLATIONS layout only (universe layout constellations)":s.toLowerCase()==="off"?(this.plugin_light(null),"no plugin lit"):this.landed.all().some(i=>i.groups.some(n=>n.plugin===s))?(this.plugin_light(s),ef(`plugin:${s}`,this.landed)??s):`universe plugin: no feed here ran ${s}`}verb_replay(e){const s=(e[0]??"").toLowerCase();if(s==="stop")return this.scene.replay_state()===null?"universe replay: none is running":(this.replay_end(),"replay stopped; the space is whole");if(s==="pause")return this.scene.replay_state()===null?"universe replay: none is running":(this.scene.replay_pause(),this.replay_paint(),"replay paused");if(s==="at"){if(this.scene.replay_state()===null)return"universe replay: none is running (universe replay first)";const n=Date.parse(e[1]??"");return Number.isFinite(n)?(this.scene.replay_pause(),this.scene.replay_seek(n),this.replay_paint(),`replay at ${new Date(this.scene.replay_state()?.at??n).toISOString().slice(0,10)}`):"universe replay at <YYYY-MM-DD>"}const i=s===""?1:Number(s);return!Number.isFinite(i)||i<=0?"universe replay [speed] | pause | stop | at <YYYY-MM-DD>":this.scene.replay_state()!==null?(this.scene.replay_play(i),this.replay_paint(),`replaying at ×${i}`):this.replay_start(i)}verb_layout(e){const s=(e[0]??"").toLowerCase();return s!=="galaxy"&&s!=="spokes"&&s!=="clumps"&&s!=="constellations"&&s!=="data"&&s!=="accretion"?"universe layout galaxy|spokes|clumps|constellations|data|accretion":this.arrangement_set(s)}verb_draw(e){const s=(e[0]??"").toLowerCase();return s!=="stars"&&s!=="spheres"?"universe draw stars|spheres":this.draw_set(s)}verb_regrow(){if(this.arrangement!=="accretion"||this.inside!==null||this.cluster!==null)return"universe regrow: the ACCRETION layout only (universe layout accretion)";this.replay_end();const e=this.positionsKey_derive("accretion");try{e!==null&&this.store?.setItem(e,"{}")}catch{}return this.paint(!0,"full"),"the space regrown from its first feed"}verb_captions(e){const s=(e[0]??"").toLowerCase();return s!=="on"&&s!=="off"?"universe captions on|off":this.captions_set(s==="on")}verb_density(e){const s=(e[0]??"").toLowerCase();return s!=="shape"&&s!=="census"?"universe density shape|census":this.density_set(s)}verb_physics(e){const s=(e[0]??"").toLowerCase();if(s==="reset")return this.physics_reset();if(!["charge","link","collide","gravity"].includes(s))return"universe physics charge|link|collide|gravity [on|off] | reset";const i=(e[1]??"on").toLowerCase()!=="off";return this.physics_set(s,i)}verb_view(e){const s=(e[0]??"").toLowerCase();return s!=="feeds"&&s!=="shapes"?"universe view feeds|shapes":this.inside!==null||this.cluster!==null?"universe view: climb out first (universe back)":(this.view_set(s),s==="feeds"?"every feed its own molecule":"the shapes folded, one molecule each")}verb_cluster(e){const s=parseInt(e[0]??"",10),i=Number.isFinite(s)?this.landed.get(s):void 0;return i===void 0?"universe cluster <feed id>: the cluster of a feed that landed here":this.inside!==null?`universe cluster: inside feed ${this.inside.feedId}; universe back first`:(this.cluster_enter(Ps(i)),`viewing the cluster of feed ${s}: ${zd(Ps(i))}`)}verb_back(){return this.inside===null&&this.cluster===null?"universe back: not inside a feed or a cluster":(this.ascend(),"climbing out")}verb_open(){return this.inside===null?"universe open: not inside a feed":(this.handlers.feed_open?.(this.inside.feedId),`opening feed ${this.inside.feedId}`)}physics_set(e,s){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":e==="reach"?"universe physics: reach is the pane's own":(this.physics={...this.physics,[e]:s},this.physics_apply(),`physics ${e} ${s?"on":"off"}`)}draw_set(e){return this.replay_end(),this.drawMode=e,this.drawPill!==null&&(this.drawPill.textContent=e.toUpperCase()),this.scene.draw_set(e),this.settings_save(),e==="stars"?"every sphere a point of light":"every sphere lit and solid"}captions_set(e){return this.captions=e,this.captionsPill!==null&&(this.captionsPill.textContent=e?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(e),this.settings_save(),e?"captions on: each hub names itself and its count":"captions off: a hub names itself on hover"}arrangement_set(e){if(sf(e)&&this.view!=="feeds")return`universe layout ${e}: the FEEDS view only (universe view feeds)`;this.replay_end();const s=n=>sf(n)?n:"hubs",i=s(e)!==s(this.arrangement);return this.litHub=null,this.remember_now(),this.arrangement=e,this.arrangementPill!==null&&(this.arrangementPill.textContent=e.toUpperCase()),this.positions_recalled(e)===void 0&&this.handlers.command_run(`proc layout ${this.sessionLayoutName_derive(e)}`),this.inside===null&&this.cluster===null&&(this.scene.arrangement_set(e==="data"?"hubs":e,this.positions_recalled(e),!i),i&&this.paint(!0,this.positions_recalled(e)===void 0?"full":"hold")),this.settings_save(),e==="galaxy"?"the space finds its own shape: every sphere pushing, every edge holding":e==="spokes"?"each molecule a spoke round its hub":e==="clumps"?"molecules packed round their hub":e==="constellations"?"every plugin a star, placed by what runs with what; every feed pulled to the stars it ran":e==="data"?"every feed hung from what it began from: its format, its modality, its series":"the space grown in the order it was made: each feed wandering until it sticks, to its kin more readily than to strangers"}settingsKey_get(){return this.storeKey===null?null:this.storeKey.replace(/^argus\.universe\./,"argus.universe.settings.")}settings_save(){const e=this.settingsKey_get();if(!(this.store===void 0||e===null))try{this.store.setItem(e,JSON.stringify(n5(this.drawMode,this.view,this.scale,this.density,this.arrangement,this.captions)))}catch{}}settings_recall(){const e=this.settingsKey_get();if(this.store===void 0||e===null)return!1;let s=null;try{s=this.store.getItem(e)}catch{return!1}const i=r5(s),n=i.view!==this.view||i.scale!==this.scale;return this.drawMode=i.draw,this.view=i.view,this.scale=i.scale,this.density=i.density,this.arrangement=i.arrangement,this.arrangementPill!==null&&(this.arrangementPill.textContent=i.arrangement.toUpperCase()),this.scene.arrangement_set(i.arrangement==="data"?"hubs":i.arrangement,this.positions_recalled(i.arrangement)),this.drawPill!==null&&(this.drawPill.textContent=i.draw.toUpperCase()),this.viewPill!==null&&(this.viewPill.textContent=i.view.toUpperCase()),this.scalePill!==null&&(this.scalePill.textContent=i.scale==="jobs"?"JOBS":"ALIKE"),this.densityPill!==null&&(this.densityPill.textContent=i.density.toUpperCase()),this.scene.draw_set(i.draw),this.scene.census_set(i.density==="census"),this.captions=i.captions,this.captionsPill!==null&&(this.captionsPill.textContent=i.captions?"CAPTIONS ON":"CAPTIONS OFF"),this.scene.captions_set(i.captions),n}density_set(e){return this.replay_end(),this.density=e,this.densityPill!==null&&(this.densityPill.textContent=e.toUpperCase()),this.scene.census_set(e==="census"),this.settings_save(),e==="census"?"every job its own point":"a stage one sphere, with its count"}physics_reset(){return this.inside!==null||this.cluster!==null?"universe physics: climb out first (universe back)":(this.physics={...Dr,gravity:!0},this.physics_apply(),"physics reset")}physics_apply(){this.gravityPill!==null&&(this.gravityPill.textContent=this.physics.gravity?"GRAVITY ON":"GRAVITY OFF"),this.scene.physics_set({...this.physics,reach:this.reach??void 0}),this.title_paint()}view_set(e){if(this.replay_end(),e==="shapes"&&sf(this.arrangement)&&(this.arrangement="galaxy",this.arrangementPill!==null&&(this.arrangementPill.textContent="GALAXY"),this.scene.arrangement_set("galaxy",this.positions_recalled("galaxy"),!1)),this.remember_now(),this.view=e,this.viewPill!==null&&(this.viewPill.textContent=e.toUpperCase()),this.shown&&this.inside===null&&this.cluster===null){const s=this.positions_recalled(this.arrangement);s!==void 0?(this.scene.positions_seed(s),this.paint(!0,"new")):this.paint(!0,"full")}this.settings_save()}inside_get(){return this.inside?.feedId??null}shown_get(){return this.shown}dispose(){this.disposed=!0,this.watch_hold(null),window.removeEventListener("keydown",this.escape_listen),this.repaintTimer!==null&&window.clearTimeout(this.repaintTimer),this.rememberTimer!==null&&window.clearTimeout(this.rememberTimer),this.remember_now(),this.scene.dispose()}space_show(e){this.asking=!1;const s=`${e.whole?"W":"L"}|${e.feeds.map(i=>`${i.id}:${i.jobs}:${i.status}`).join(",")}`;if(this.shown&&s===this.spaceKey){this.title_paint();return}this.spaceKey=s,this.wait.hide(),this.whole=e.whole,this.shown||(this.shown=!0,this.seed_recall()),this.landed.clear(),this.landed.take(e.feeds),this.whole&&(this.warming=""),this.empty.style.display="none",this.canvas.style.display="block",this.inside===null&&this.cluster===null&&this.entering===null&&!this.scene.moving()?this.paint(!this.scene.camera_touched()):this.title_paint()}landings_take(e){!this.landed.take(e)||this.repaintTimer!==null||this.inside!==null||this.cluster!==null||this.entering!==null||(this.repaintTimer=window.setTimeout(()=>{this.repaintTimer=null,!(this.disposed||this.entering!==null||this.inside!==null||this.cluster!==null||this.scene.moving())&&this.paint(!this.scene.camera_touched())},v5))}paint(e=!0,s="new"){if(this.sessionWait_holds()){this.title_paint();return}const i=this.view==="shapes"?b1(this.landed.all(),this.scale):this.arrangement==="constellations"?vg(this.landed.all(),this.scale):this.arrangement==="data"?this.dataGraph_paint():this.arrangement==="accretion"?zb(this.landed.all(),this.scale):yd(this.landed.all(),this.scale),n=this.arrangement==="constellations"?this.lit:null,r=n===null?i:{nodes:i.nodes.map(a=>a.attrs?.kind==="star"||a.attrs?.plugin===n?a:{...a,dim:!0})},o=Rk(r.nodes.length);o!==this.reach&&(this.reach=o,this.scene.physics_set({reach:o},!1)),this.scene.graph_set(r,{wave:!1,fit:e,settle:s}),this.title_paint(),this.remember_later()}descend(e,s){this.replay_end();const i=this.landed.get(e),n=this.handlers.feed_dag;if(i===void 0||n===void 0||this.scene.moving()||this.inside!==null)return;this.facts_clear(),this.feedView?.recall();const r=g1(e,i);this.entering=e,this.title_paint();const o=Date.now(),a=s!==void 0?{toward:s,distance:14,durationMs:Ko}:{fit:r,durationMs:Ko};this.scene.descent(a,async()=>{const l=await n(e);if(this.disposed)return null;if(this.entering=null,l===null)return this.title_paint(),this.handlers.note?.(`universe: feed ${e}: the session gave no graph for it (feed diagram feed_${e} refused or answered nothing after ${Math.round((Date.now()-o)/1e3)}s)`),null;const c=this.insidePlan_build(e,i,l,[r,ZM(Ps(i),this.landed)],Ko);return{...c,drawn:()=>{const h=new Set(c.unfolding);this.inside={feedId:e,title:l.feedName,entered:this.insideEntered,ids:h},this.insideModel=l,this.pane?.classList.add("universe-inside"),om(this.pane,this.scene,this.inside!==null);const d=this.feedView?.modes_get()??{...xl};this.insideModes=d,this.scene.draw_set(d.draw),this.drawPill!==null&&(this.drawPill.textContent=d.draw.toUpperCase()),this.scene.waveLoop_set(d.pulse),this.feedFrame?.shown_set(!0),this.feedFrame?.arrived(e),this.watch_hold(e),this.title_paint()}}},()=>this.landed_note())}insidePlan_build(e,s,i,n,r){const o=this.feedView?.modes_get()??{...xl},a=c1(i,{metric:o.metric,hue:o.hue,legend:o.hue==="compute"?u1(i):new Map,draw:o.draw,id_map:u=>tf(e,u)});this.insideEntered=a;let l;if(o.strategy==="ranked"){l={};for(const u of kg(a.nodes.map(p=>({id:p.id,parentIds:p.parentIds,...p.metric!==void 0?{metric:p.metric}:{}}))))l[u.id]=[u.position[0],u.position[1],u.position[2]]}const c=`feed:${e}:`,h=this.view==="feeds"?o5(this.landed.all(),e,a,this.scale,this.arrangement==="constellations",this.arrangement==="data"?Sb(this.landed.all(),this.scale).graph:this.arrangement==="accretion"?zb(this.landed.all(),this.scale):void 0):{nodes:[...JM(this.landed.all(),Ps(s),this.scale).graph.nodes.filter(u=>!u.id.startsWith(c)).map(u=>({...u,dim:!0})),...a.nodes]},d=a.nodes.map(u=>u.id);return{graph:h,unfolding:d,from:n,physics:{reach:Qf,gravity:!1},...l!==void 0?{placed:l}:{},frame:d,durationMs:r,bulk:1,margin:.95}}feedMode_apply(e,s){if(this.inside===null)return;if(this.insideModes=s,e==="pulse"){this.scene.waveLoop_set(s.pulse);return}e==="draw"&&(this.scene.draw_set(s.draw),this.drawPill!==null&&(this.drawPill.textContent=s.draw.toUpperCase()));const i=this.landed.get(this.inside.feedId);if(i===void 0||this.insideModel===null||this.scene.moving())return;const n=this.inside,r=this.insidePlan_build(n.feedId,i,this.insideModel,[[...n.ids]],400);this.scene.unfold({...r,drawn:()=>{this.inside={...n,entered:this.insideEntered}}})}stage_returned(){if(this.inside===null||this.feedView===null)return;const e=this.insideModes,s=this.feedView.recall();e===null||JSON.stringify(e)===JSON.stringify(s)||(e.draw!==s.draw&&this.feedMode_apply("draw",s),e.pulse!==s.pulse&&this.feedMode_apply("pulse",s),(e.strategy!==s.strategy||e.metric!==s.metric||e.hue!==s.hue)&&this.feedMode_apply("strategy",s),this.insideModes=s)}watch_hold(e){this.watchedFeedId!==e&&(this.watchedFeedId!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${this.watchedFeedId}`,!1),this.watchedFeedId=e,this.liveState=null,e!==null&&this.handlers.watch_set?.(`/proc/jobs/feed_${e}`,!0))}watched_observe(e,s){const i=/feed_(\d+)$/.exec(e);i===null||Number(i[1])!==this.watchedFeedId||(this.liveState=s,this.title_paint())}model_refresh(e){const s=this.inside;if(s===null||s.feedId!==e.feedId||this.insideModel===null)return;const i=this.insideModel;if(this.insideModel=e,rm(i,e)){f1(this.scene,e,a=>tf(e.feedId,a));for(const a of e.nodes)this.insideEntered?.payloads.set(tf(e.feedId,a.id),a);return}const n=this.landed.get(e.feedId);if(n===void 0||this.scene.moving())return;const r=this.insidePlan_build(e.feedId,n,e,[[...s.ids]],400),o=new Set(r.unfolding);this.scene.unfold({...r,drawn:()=>{this.inside={...s,entered:this.insideEntered,ids:o},this.title_paint()}})}feedMarks_show(e,s){this.feedFrame?.show(e,s)}ascend(){if(!this.scene.moving()){if(this.framedAt=null,this.inside!==null){if(this.inside=null,this.insideModel=null,this.facts_clear(),this.pane?.classList.remove("universe-inside"),this.scene.waveLoop_set(!1),this.scene.draw_set(this.drawMode),this.drawPill!==null&&(this.drawPill.textContent=this.drawMode.toUpperCase()),this.feedFrame?.shown_set(!1),this.watch_hold(null),om(this.pane,this.scene,this.inside!==null),this.cluster!==null){this.cluster_show(this.cluster.shape);return}}else{if(this.cluster===null)return;this.cluster=null,this.pane?.classList.remove("universe-cluster")}this.paint(!1),this.scene.frame([],z5)}}cluster_enter(e){this.replay_end(),!(this.scene.moving()||this.inside!==null)&&this.cluster_show(e)}cluster_show(e){if(this.view==="feeds"){const r=l5(e,this.landed);if(r.length===0)return;this.cluster={shape:e,ids:r},this.pane?.classList.add("universe-cluster"),this.scene.relight(c5(this.landed.all(),e,this.scale),r,Ko,()=>this.landed_note(),()=>this.title_paint());return}const{graph:s,memberIds:i}=JM(this.landed.all(),e,this.scale);if(i.length===0)return;this.cluster={shape:e,ids:i},this.pane?.classList.add("universe-cluster");const n=new Set(i);this.scene.unfold({graph:s,unfolding:s.nodes.filter(r=>n.has(r.id)||r.ghost===!0).map(r=>r.id),from:[ZM(e,this.landed)],physics:{reach:Qf,gravity:!1},frame:i,durationMs:Ko,drawn:()=>this.title_paint()},()=>this.landed_note())}landed_note(){this.framedAt=this.scene.camera_distance()}pinch_leave(){this.inside===null&&this.cluster===null||this.scene.moving()||this.scene.holding_get()||this.framedAt===null||this.scene.camera_distance()<=this.framedAt*S5||this.ascend()}node_dive(e){const s=this.inside?.entered.payloads.get(e.id),i=this.handlers.node_dive;s===void 0||i===void 0||this.scene.moving()||this.scene.flight_into(e.id,()=>i(s.vfsPath))}flight_back(e){this.scene.flight_back(e)}node_flyTo(e){if(this.inside===null)return!1;for(const[s,i]of this.inside.entered.payloads){if(i.instanceId!==e)continue;const n=this.handlers.node_dive;return n===void 0?!1:(this.scene.flight_into(s,()=>n(i.vfsPath)),!0)}return!1}node_select(e){if(this.scene.moving())return;if(this.inside===null){const i=Xf(e.id);if(i!==null){this.plugin_light(this.lit===i?null:i);return}const n=Jf(e.id);if(n!==null){this.litHub=this.litHub===n?null:n,this.paint(!1,"hold");return}const r=e.id.match(/^feed:(\d+):\d+$/),o=pz(e.id);r!==null?this.descend(Number(r[1]),e.id):o!==null?this.cluster_enter(o):e.id.startsWith("shape:")&&this.cluster_enter(e.id.slice(6));return}const s=this.inside.entered.payloads.get(e.id);s!==void 0&&this.facts_show(e,s)}facts_show(e,s){this.facts!==null&&(o1(this.facts,s,{enter:()=>{this.handlers.node_dive!==void 0?this.node_dive(e):this.handlers.node_enter?.(s.vfsPath)},...this.handlers.node_process!==void 0?{process:this.handlers.node_process}:{}}),this.facts.hidden=!1)}facts_clear(){this.facts!==null&&(this.facts.replaceChildren(),this.facts.hidden=!0)}state_stand(e,s){this.state!==null&&this.noteTimer===null&&ys(this.state,e,s)}bar_note(e){this.state!==null&&(this.noteTimer!==null&&clearTimeout(this.noteTimer),this.noteTimer=null,ys(this.state,"note",e),this.noteTimer=setTimeout(()=>{this.noteTimer=null,ea(this.state,"note"),this.title_paint()},g5))}title_paint(){if(this.entering!==null&&this.inside===null){const s=this.landed.get(this.entering);this.title.textContent=`UNIVERSE — ENTERING FEED ${this.entering}${s!==void 0&&s.title.length>0?` · ${s.title}`:""} …`,this.state_stand("wait","ASKING");return}if(this.inside!==null){const s=this.inside.entered.nodes.reduce((i,n)=>i+(n.count??1),0);this.title.textContent=`UNIVERSE — INSIDE FEED ${this.inside.feedId} · ${this.inside.title} · ${s.toLocaleString("en-US")} JOBS`,this.state_stand(this.liveState==="stale"?"stale":"live",this.liveState===null?"INSIDE":`INSIDE · ${this.liveState.toUpperCase()}`);return}if(this.cluster!==null){const s=this.landed.all().filter(i=>Ps(i)===this.cluster?.shape).length;this.title.textContent=`UNIVERSE — SHAPE ${_1(this.cluster.shape)} · ${s} FEED${s===1?"":"S"}`,this.state_stand("live","CLUSTER");return}if(this.asking&&!this.shown){this.title.textContent="UNIVERSE — ASKING THE SESSION …",this.state_stand("wait","ASKING");return}const e=`${this.landed.size()} FEEDS · ${this.landed.shapes()} SHAPES`;this.title.textContent=this.whole?`UNIVERSE — ${e}`:`UNIVERSE — ${e}${this.warming.length>0?` · ${this.warming}`:" · INDEX WARMING"}`,this.state_stand(this.whole?"settled":"wait",this.whole?"WHOLE":"LANDING"),this.scene.replay_state()!==null&&this.replay_paint()}replay_start(e){if(this.inside!==null||this.cluster!==null)return"universe replay: climb out first (universe back)";if(this.view!=="feeds")return"universe replay: the FEEDS view only (universe view feeds)";if(this.density!=="shape")return"universe replay: SHAPE density only (universe density shape)";if(this.drawMode!=="stars")return"universe replay: it draws stars (universe draw stars)";const s=new Map;for(const a of this.landed.all()){const l=Date.parse(a.createdAt??"");Number.isFinite(l)&&s.set(a.id,l)}if(s.size===0)return"universe replay: the session does not say when its feeds were made (a daemon from before the replay: restart it)";const i=new Map;for(const a of Object.keys(this.scene.positions_get())){const l=a.match(/^feed:(\d+):/),c=l===null?void 0:s.get(Number(l[1]));c!==void 0&&i.set(a,c)}this.facts_clear(),this.replayDay="",this.scene.replay_begin(i,e),this.replay_paint();const n=this.scene.replay_state(),r=new Date(n?.span[0]??0).toISOString().slice(0,10),o=new Date(n?.span[1]??0).toISOString().slice(0,10);return`replaying ${s.size} feeds, ${r} to ${o}, at ×${e} (universe replay pause | stop | at <date>; Esc stops)`}plugin_light(e){this.lit=e,e===null?this.facts_clear():this.pluginFacts_show(e),this.shown&&this.inside===null&&this.cluster===null&&this.paint(!1,"hold")}plugin_frame(e){this.lit!==e&&this.plugin_light(e);const s=[];for(const i of this.landed.all())i.groups.forEach((n,r)=>{n.plugin===e&&s.push(`feed:${i.id}:${r}`)});s.length===0||this.scene.moving()||this.scene.frame(s,Ko,void 0,.9)}pluginFacts_show(e){if(this.facts===null)return;this.facts.replaceChildren();const s=ef(`plugin:${e}`,this.landed)??e,[,i="",n=""]=s.split(" · ");for(const[a,l]of[["PLUGIN",e],["FEEDS",i.replace(/ feeds?$/,"")],["ERRORED",n.replace(/ errored$/,"")]]){const c=document.createElement("div");c.className="telemetry-row";const h=document.createElement("span");h.className="telemetry-label",h.textContent=a;const d=document.createElement("span");d.className="telemetry-value",d.textContent=l,c.append(h,d),this.facts.append(c)}const r=document.createElement("div");r.className="universe-node-verbs";const o=document.createElement("button");o.className="pacs-capsule universe-plugin-open",o.textContent="OPEN IN /BIN",o.title="the plugin in the files browser: its one-node graph, its parameters",o.addEventListener("click",()=>this.handlers.plugin_open?.(e)),r.append(o),this.facts.append(r),this.facts.hidden=!1}dataGraph_paint(){const{graph:e,hubs:s}=Sb(this.landed.all(),this.scale);this.dataHubs=s;const i=this.litHub;if(i===null)return e;const n=uz(this.landed.all().map(o=>o.data?.seriesDescription).filter(o=>o!==void 0)),r=new Set(this.landed.all().filter(o=>fz(o,n).some(a=>a.key===i)).map(o=>o.id));return{nodes:e.nodes.map(o=>{if(Jf(o.id)!==null)return o;const a=o.id.match(/^feed:(\d+):/);return a!==null&&r.has(Number(a[1]))?o:{...o,dim:!0}})}}replay_end(){this.scene.replay_state()!==null&&(this.scene.replay_stop(),this.replayDay="",this.title_paint(),this.replay_paint())}replay_paint(){const e=this.scene.replay_state();if(this.replayPill!==null){const i=e!==null&&!e.playing&&e.at>=e.span[1];this.replayPill.textContent=e===null?"REPLAY":e.playing?"PLAYING":i?"REPLAYED":"PAUSED",this.replayPill.classList.toggle("rail-off",e===null)}if(e===null||this.state===null)return;const s=`${e.playing?"REPLAY":"PAUSED"} ${new Date(e.at).toISOString().slice(0,10)}`;s!==this.replayDay&&(this.replayDay=s,this.state_stand("live",s))}identity_note(e,s){const i=i5(e,s);if(i===this.storeKey)return;this.storeKey=i;const n=this.settings_recall();if(this.shown){const r=this.seed_recall();(n||r)&&this.inside===null&&this.cluster===null&&this.paint(!1)}}positionsKey_derive(e){if(this.storeKey===null)return null;const s=e==="galaxy"?this.storeKey:`${this.storeKey}.${e}`;return this.view==="shapes"?`${s}.shapes`:s}positions_recalled(e){const s=this.positionsKey_derive(e);if(!(this.store===void 0||s===null))try{const i=XM(this.store.getItem(s));return Object.keys(i).length>0?i:void 0}catch{return}}seed_recall(){const e=this.positionsKey_derive(this.arrangement);if(this.store===void 0||e===null)return!1;const s=XM(this.store.getItem(e));return Object.keys(s).length===0?!1:(this.scene.positions_seed(s),!0)}remember_later(){this.rememberTimer===null&&(this.rememberTimer=window.setTimeout(()=>{this.rememberTimer=null,this.remember_now()},y5))}remember_now(){if(!(this.store===void 0||this.storeKey===null||!this.shown)&&this.positions_matchView(this.scene.positions_get())){try{const e=this.positionsKey_derive(this.arrangement);e!==null&&this.store.setItem(e,JSON.stringify(this.scene.positions_get()))}catch{}this.sessionLayout_put()}}positions_matchView(e){const s=Object.keys(e),i=s.some(r=>r.startsWith("fold:")),n=s.some(r=>r.startsWith("feed:"));return this.view==="shapes"?i&&!n:!i}sessionLayoutName_derive(e){return`${e}${this.view==="shapes"?"-shapes":""}${this.scale==="feeds"?"-alike":""}`}sessionLayout_take(e,s,i=null){if((s!==null||!this.sessionPlaces.has(e))&&this.sessionPlaces.set(e,s===null?null:Object.keys(s).length),s===null&&i!==null){this.sessionWait_hold(e,i);return}const n=this.sessionWait?.name===e;if(n&&this.sessionWait_end(),s===null||this.store===void 0){n&&this.shown&&this.paint(!0,"full");return}const r=["galaxy","spokes","clumps","constellations","data","accretion"].find(a=>this.sessionLayoutName_derive(a)===e);if(r===void 0||this.positions_recalled(r)!==void 0)return;const o=this.positionsKey_derive(r);if(o!==null){try{this.store.setItem(o,JSON.stringify(s))}catch{return}this.putSignatures.set(e,QM(s)),r===this.arrangement&&this.shown&&this.inside===null&&this.cluster===null&&this.entering===null&&(this.scene.positions_seed(s),this.paint(n,"new"))}}sessionWait_hold(e,s){if(e!==this.sessionLayoutName_derive(this.arrangement)||this.positions_recalled(this.arrangement)!==void 0)return;const i=this.sessionWait?.name===e?this.sessionWait.until:Date.now()+b5;if(this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),Date.now()>=i){this.sessionWait_end(),this.shown&&this.paint(!0,"full");return}this.wait.show(`LAYING OUT ${s.nodes.toLocaleString("en-US")} SPHERES · THE SESSION`,s.fraction);const n=window.setTimeout(()=>{this.handlers.command_run(`proc layout ${e}`)},M5);this.sessionWait={name:e,until:i,timer:n}}sessionWait_end(){this.sessionWait?.timer!==void 0&&this.sessionWait?.timer!==null&&window.clearTimeout(this.sessionWait.timer),this.sessionWait=null,this.wait.hide()}sessionWait_holds(){return this.sessionWait!==null&&this.sessionWait.name===this.sessionLayoutName_derive(this.arrangement)&&Date.now()<this.sessionWait.until&&this.inside===null&&this.cluster===null}sessionLayout_put(){if(this.inside!==null||this.cluster!==null||this.scene.replay_state()!==null||!this.whole||!_5(this.physics))return;const e={};for(const[n,r]of Object.entries(this.scene.positions_get()))r.every(o=>Number.isFinite(o))&&(e[n]=[Math.round(r[0]*100)/100,Math.round(r[1]*100)/100,Math.round(r[2]*100)/100]);if(Object.keys(e).length===0)return;const s=this.sessionLayoutName_derive(this.arrangement),i=QM(e);this.putSignatures.get(s)!==i&&(this.putSignatures.set(s,i),this.sessionPlaces.set(s,Object.keys(e).length),this.handlers.command_run(`proc layout put ${s} '${JSON.stringify(e).replace(/'/g,"'\\''")}'`))}}function Ji(t){return`'${t.replace(/'/g,"'\\''")}'`}function M1(t,e){return`touch --withContents=${Ji(e)} ${Ji(t)}`}function v1(t){return`edit ${Ji(t)}`}function O5(t,e,s){return e<s?null:`edit: ${t} is ${(e/(1024*1024)).toFixed(1)} MB; open it in the editor? `}async function ra(t,e){const{terminal:s,client:i}=t;s.line_echo(e);let n;try{n=await i.line_execute(e)}catch(r){return s.output_write("err",`\x1B[31m${r instanceof Error?r.message:String(r)}\x1B[0m
|
|
4344
4344
|
`),!1}return s.outcome_write(n),n.envelopes.length>0&&n.envelopes.every(r=>r.status==="ok")}function E5(t){for(const e of t.envelopes){if(e.model?.kind!=="fs.acl")continue;const s=e.model.data[0];return s===void 0?null:{users:s.usernames??[],groups:s.groups??[],public:s.public===!0}}return null}function A5(t,e){return t.split(`
|
|
4345
4345
|
`).map(s=>s.trim().split(":")).filter(s=>s.length>=4&&(s[3]??"").split(",").includes(e)).map(s=>s[0]??"").filter(s=>s!=="")}function T5(t){return/^(u|user|g|group|o|other):/.test(t)?t:`u:${t}:r`}function I5(t,e){return e.kind==="public"?`setfacl -m o::- feed_${t}`:`setfacl -x ${e.kind==="user"?"u":"g"}:${Ji(e.name)} feed_${t}`}function qc(t){return t.kind==="public"?"PUBLIC":t.kind==="group"?`group ${t.name}`:t.name}function D5(t,e){const s={silent:!0,observe:!1},i=async c=>{try{return E5(await t.client.line_execute(`getfacl feed_${c}`,s))}catch{return null}},n=async()=>{const c=e.promptUser();if(c===null)return[];try{const h=await t.client.line_execute("cat /etc/group",s);return A5(h.envelopes.map(d=>d.rendered).join(""),c)}catch{return[]}},r=async(c,h,d)=>{await e.askOnPane_await(c,{kind:"confirm",message:`Stop sharing feed_${h} with ${qc(d)}? `})==="y"&&await ra(t,I5(h,d))&&e.changed(h)};return{holders_read:i,holders_build:(c,h,d)=>{const u=document.createElement("span");u.className="holder-marks";const p=[...d.users.map(f=>({kind:"user",name:f})),...d.groups.map(f=>({kind:"group",name:f})),...d.public?[{kind:"public"}]:[]];if(p.length===0)return u.textContent="SHARED WITH NOBODY",u;u.append("SHARED WITH ");for(const f of p){const _=document.createElement("span");_.className=`holder-mark holder-${f.kind}`,_.title=qc(f);const g=document.createElement("span");g.className="holder-mark-name",g.textContent=qc(f),_.append(g);const m=document.createElement("span");m.className="holder-mark-x",m.title=`stop sharing with ${qc(f)} (asks first)`,m.textContent="×",m.addEventListener("click",w=>{w.stopPropagation(),r(c,h,f)}),_.append(m),u.append(_)}return u},share_choose:async(c,h)=>{for(;;){const[d,u]=await Promise.all([i(h),n()]),p=d??{groups:[],public:!1},f=[{value:"o::r",label:"EVERYONE",held:p.public},...u.map(g=>({value:`g:${g}:r`,label:g,held:p.groups.includes(g)}))],_=(await e.askOnPane_await(c,{kind:"choose",message:`Share feed_${h} with a group, everyone, or a user: `,choices:f,commit:"SHARE",close:"DONE"})??"").trim();if(_===""||!await ra(t,`setfacl -m ${T5(_)} feed_${h}`))return;e.changed(h)}},rename:async(c,h,d)=>{const u=(await e.askOnPane_await(c,{kind:"text",message:`Rename feed_${h} to: `,suggest:d,commit:"RENAME"})??"").trim();u===""||u===d||await ra(t,M1(`/proc/jobs/feed_${h}/title`,u))&&e.changed(h)}}}function C5(t){for(const e of t.envelopes){if(e.model?.kind!=="fs.listing")continue;return(e.model.data[0]?.items??[]).map(i=>String(i.name??"")).filter(i=>i!=="")}return[]}function R5(t,e,s){const i=`setfattr -n tag -v ${Ji(e)} feed_${t}`;return s.includes(e)?[i]:[`mkdir ${Ji(`/proc/tags/${e}`)}`,i]}function k5(t,e){const s=async()=>{try{return C5(await t.client.line_execute("ls /proc/tags",{silent:!0,observe:!1}))}catch{return[]}};return{tag_choose:async(r,o,a)=>{const l=new Set(a);for(;;){const c=await s(),h=c.map(_=>({value:_,held:l.has(_)})),d=c.filter(_=>!l.has(_)).join(", "),p=(await e.askOnPane_await(r,{kind:"choose",message:`Tag feed_${o}${d===""?"":` (${d})`}, or a new tag: `,choices:h,commit:"TAG",close:"DONE"})??"").trim();if(p===""||p.includes("/"))return;if(l.has(p))continue;let f=!0;for(const _ of R5(o,p,c))if(f=await ra(t,_),!f)break;if(!f)return;l.add(p),e.tags_changed(o)}},tag_remove:async(r,o)=>{const a=await ra(t,`setfattr -x tag -v ${Ji(o)} feed_${r}`);return a&&e.tags_changed(r),a}}}function N5(t,e){return{tags:k5(t,{askOnPane_await:e.askOnPane_await,tags_changed:e.changed}),access:D5(t,e)}}function B5(t){for(const e of t.envelopes){if(e.model?.kind!=="fs.xattr")continue;return e.model.data[0]?.tags??[]}return[]}function w1(t,e,s){const{panels:i,subjects:n}=t,{tags:r,access:o}=s;return{feed_verbs:a=>{const l={feedId:a.id},c={note:()=>t.terminal.line_run(`edit /proc/jobs/feed_${a.id}/note`),tag:()=>{r.tag_choose(e,a.id,a.tags??[])},rename:()=>{o.rename(e,a.id,a.title)},share:()=>{o.share_choose(e,a.id)},delete:()=>t.terminal.line_run(`feed rm feed_${a.id}`)};return iS.rules.filter(h=>h.offered(l)).map(h=>({label:h.label(l),run:()=>c[h.name]?.()}))},feed_indicated:a=>{n.regard_write(e,{address:`/proc/jobs/feed_${a.id}`,modelKind:"feed"}),o.holders_read(a.id).then(l=>{i.get("dag",e)?.rowReadout_show(a.id,l===null?"ACCESS UNREAD":o.holders_build(e,a.id,l))})},feed_untag:(a,l)=>{r.tag_remove(a,l)},feed_entered:a=>{const l={silent:!0,observe:!1},c=h=>h!==null&&h.envelopes.every(d=>d.status==="ok")?h.envelopes.map(d=>d.rendered).join("").replace(/\x1b\[[0-9;]*m/g,""):null;Promise.all([t.client.line_execute(`cat /proc/jobs/feed_${a}/note`,l).catch(()=>null),t.client.line_execute(`getfattr feed_${a}`,l).catch(()=>null),t.client.line_execute(`cat /proc/jobs/feed_${a}/title`,l).catch(()=>null)]).then(([h,d,u])=>{(i.get("dag",e)??i.get("universe",e))?.feedMarks_show(a,{note:c(h),tags:d===null?[]:B5(d),title:(c(u)??"").trim()})})},feed_note:a=>t.terminal.line_run(`edit /proc/jobs/feed_${a}/note`),feed_tag:(a,l)=>{r.tag_choose(e,a,l)},feed_rename:(a,l)=>{o.rename(e,a,l)}}}const G5=256*1024*1024;function P5(t,e){const s=e.split("/").filter(o=>o.length>0).pop()??"download";if(t===null)return s;const i=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(t);if(i!==null)try{const o=decodeURIComponent((i[1]??"").trim());if(o.length>0)return o}catch{}const r=/filename\s*=\s*"([^"]*)"/i.exec(t)?.[1]??"";return r.length>0?r:s}function ev(t){return t.redirected?"the session asked to log in again — nothing was saved":t.status===410?"cancelled — nothing was saved":t.ok?t.headers.get("content-disposition")===null?"the session answered with something other than the file — nothing was saved":null:t.status===404?"the session could not read that file — nothing was saved":`the session refused the file (HTTP ${t.status}) — nothing was saved`}function tv(t,e){const s=document.createElement("a");s.href=t,s.download=e,s.rel="noopener",document.body.append(s),s.click(),s.remove()}function y1(){return`dl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}async function L5(t,e,s=fetch,i=y1()){const n=`${t}&dl=${encodeURIComponent(i)}`;let r;try{r=await s(`${n}&probe=1`,{method:"HEAD",credentials:"same-origin"})}catch(p){return{ok:!1,reason:`the session did not answer (${p instanceof Error?p.message:String(p)}) — nothing was saved`}}const o=ev(r);if(o!==null)return{ok:!1,reason:o};const a=P5(r.headers.get("content-disposition"),e),l=Number(r.headers.get("content-length")??NaN);if(!Number.isFinite(l)||l>G5)return tv(n,a),{ok:!0,name:a,bytes:Number.isFinite(l)?l:null,streamed:!0};let c;try{c=await s(n,{credentials:"same-origin"})}catch(p){return{ok:!1,reason:`the session did not answer (${p instanceof Error?p.message:String(p)}) — nothing was saved`}}const h=ev(c);if(h!==null)return{ok:!1,reason:h};const d=await c.blob(),u=URL.createObjectURL(d);return tv(u,a),setTimeout(()=>URL.revokeObjectURL(u),6e4),{ok:!0,name:a,bytes:d.size,streamed:!1}}const W5=1e3,F5=5e3,U5=3,$5=2e4;function Qa(t){const e=["B","KB","MB","GB","TB"];let s=t,i=0;for(;s>=1e3&&i<e.length-1;)s/=1e3,i+=1;return`${i===0?s.toFixed(0):s.toFixed(1)} ${e[i]}`}function Kc(t){const e=Math.max(0,Math.round(t/1e3)),s=Math.floor(e/3600),i=Math.floor(e%3600/60),n=String(e%60).padStart(2,"0");return s>0?`${s}:${String(i).padStart(2,"0")}:${n}`:`${i}:${n}`}function j5(t,e){switch(t.phase){case"opening":return`WAITING FOR CUBE · ${Kc(t.elapsedMs)}`;case"ready":return"CUBE ANSWERED · HANDING TO THE BROWSER";case"streaming":{if(t.bytes===0)return`WAITING FOR CUBE'S FIRST BYTE · ${Kc(t.elapsedMs)}`;const s=[t.size!==void 0?`${Qa(t.bytes)} OF ${Qa(t.size)}`:Qa(t.bytes)];return t.size!==void 0&&t.size>0&&s.push(`${Math.floor(100*t.bytes/t.size)}%`),e!==null&&e>0&&(s.push(`${Qa(e)}/S`),t.size!==void 0&&s.push(`${Kc(1e3*(t.size-t.bytes)/e)} LEFT`)),s.join(" · ")}case"done":return`DONE · ${Qa(t.bytes)} IN ${Kc(t.elapsedMs)}`;case"failed":return`FAILED · ${t.reason??"the session did not say why"}`;case"cancelled":return"CANCELLED"}}function sv(t){return t==="done"||t==="failed"||t==="cancelled"}function iv(t,e,s){const i=new URL(t,window.location.href),n=i.searchParams.get("token");return i.search="",i.searchParams.set(e,s),n!==null&&i.searchParams.set("token",n),i.toString()}function H5(){let t=document.querySelector(".transfer-stack");return t===null&&(t=document.createElement("div"),t.className="transfer-stack",t.setAttribute("role","status"),document.body.appendChild(t)),t}function V5(t,e,s,i=fetch){const n=document.createElement("div");n.className="transfer-row",n.dataset.download=s,n.dataset.phase="opening";const r=document.createElement("span");r.className="transfer-name",r.textContent=t,r.title=t;const o=document.createElement("span");o.className="transfer-bar";const a=document.createElement("span");a.className="transfer-fill",o.appendChild(a);const l=document.createElement("span");l.className="transfer-words",l.textContent="ASKING THE SESSION";const c=document.createElement("button");c.type="button",c.className="transfer-action",c.textContent="CANCEL",n.append(r,o,l,c),H5().appendChild(n);let h=null,d=null,u=!1,p=null;const f=[],_=()=>n.remove(),g=()=>{u=!0,h!==null&&clearTimeout(h),c.textContent="CLOSE",c.title="dismiss this row",d=setTimeout(_,$5)},m=x=>{const M=Date.now();for(f.push({at:M,bytes:x});f.length>1&&M-(f[0]?.at??M)>6e3;)f.shift();const S=f[0];return S===void 0||M-S.at<900?null:(x-S.bytes)*1e3/(M-S.at)};let w=!1,y=0;const b=x=>{n.dataset.phase=x.phase;const M=j5(x,x.phase==="streaming"?m(x.bytes):null);l.textContent=w&&!sv(x.phase)?`CANCELLING · ${M}`:M;const S=x.phase==="done"?1:x.size!==void 0&&x.size>0?x.bytes/x.size:0;a.style.width=`${(100*S).toFixed(1)}%`,sv(x.phase)&&g()},v=async x=>{const M=new AbortController,S=setTimeout(()=>M.abort(),F5);try{const T=await i(iv(e,x,s),{credentials:"same-origin",cache:"no-store",signal:M.signal});return T.ok?await T.json():"unknown"}catch{return null}finally{clearTimeout(S)}},z=async()=>{if(u)return;const x=await v("progress");if(!u){if(x===null)y+=1,y>=U5&&(l.textContent="LOST TOUCH WITH THE SESSION · STILL ASKING");else if(x==="unknown"){if(y=0,p??=Date.now(),Date.now()-p>5e3){n.dataset.phase="handed",l.textContent="HANDED TO THE BROWSER · SEE ITS DOWNLOADS",g();return}}else y=0,p=null,b(x);u||(h=setTimeout(()=>{z()},W5))}};return c.addEventListener("click",()=>{if(u){_();return}c.disabled=!0,w=!0,l.textContent="CANCELLING",v("cancel").then(x=>{c.disabled=!1,!u&&(x===null?(w=!1,l.textContent="THE CANCEL GOT NO ANSWER FROM THE SESSION · PRESS CANCEL AGAIN"):x==="unknown"?(w=!1,n.dataset.phase="handed",l.textContent="THE SESSION DOES NOT KNOW THIS DOWNLOAD · CANCEL IT IN THE BROWSER'S DOWNLOADS",g()):b(x))})}),z(),{element:n,show:b,fail:x=>{u||i(iv(e,"progress",s),{credentials:"same-origin",cache:"no-store"}).then(async M=>M.ok?await M.json():null).catch(()=>null).then(M=>{u||b(M!==null&&M.phase==="failed"?M:{phase:"failed",bytes:0,reason:x,elapsedMs:0})})},stop:()=>{u=!0,h!==null&&clearTimeout(h),d!==null&&clearTimeout(d)}}}const z1=/\.(csv|tsv)$/i;function nv(t){return t.replace(/\x1b\[[0-9;:]*[A-Za-z]/g,"")}function S1(t){return sp.test(t)||$h.test(t)}function am(t){const e=/_(\d+)\/data\/?$/.exec(t);return e===null?null:parseInt(e[1]??"",10)}function El(t){const e=t.match(/\/(?:feeds|jobs)\/feed_(\d+)(?:\/|$)/);return e===null?null:Number(e[1])}function q5(t){return/^\/(proc|net|etc|usr)(\/|$)/.test(t)}function K5(t){for(const e of t.envelopes){const s=e.model;if(typeof s!="object"||s===null)continue;const i=s.data;if(s.kind!=="fs.acl"||!Array.isArray(i))continue;const n=[];for(const r of i)Array.isArray(r.usernames)&&n.push(...r.usernames.map(String)),Array.isArray(r.groups)&&n.push(...r.groups.map(o=>`group ${String(o)}`)),r.public===!0&&n.push("PUBLIC");return n.length===0?"SHARED WITH NOBODY":`SHARED WITH ${n.join(", ")}`}return"ACCESS UNREAD"}function Y5(t,e){const{panels:s,subjects:i}=t,n=new Map,r=new Map,o=new Map,a=S=>{const T=e.downloadUrl_build(S),I=y1(),E=S.split("/").filter(R=>R.length>0).pop()??S,O=V5(E,T,I);t.terminal.line_note(`download: asking the session for ${E}`),L5(T,S,fetch,I).then(R=>{R.ok||O.fail(R.reason),t.terminal.line_note(R.ok?`download: ${R.name}${R.streamed?" — handed to the browser; its progress is on the transfer row":""}`:`download: ${S}: ${R.reason}`)})},l=S=>t.client.line_execute(`cat "${S}"`,{silent:!0,observe:!1}).then(T=>{if(!T.envelopes.some(O=>O.status==="error"))return{ok:!0,text:nv(T.envelopes.map(O=>O.rendered).join(`
|
|
4346
4346
|
`))};const E=T.envelopes.flatMap(O=>(O.errors??[]).map(R=>R.message)).concat(T.envelopes.map(O=>O.renderedErr??"")).map(O=>nv(O).trim()).filter(O=>O!=="").join(`
|
|
4347
|
-
`);return{ok:!1,text:E===""?"the session refused this read and said nothing further":E}}),c=async(S,T)=>{const I=await fetch(e.vfsUrl_build(S));if(!I.ok||I.body===null)return(await l(S)).text.slice(0,T);const E=I.body.getReader(),O=new TextDecoder;let R="";for(;R.length<T;){const{done:C,value:k}=await E.read();if(C)break;R+=O.decode(k,{stream:!0})}return E.cancel().catch(()=>{}),R.slice(0,T)},h=async S=>{const T=/_id(\d+)$/.exec(S)?.[1]??S.replace(/^.*\//,""),I=await t.client.line_execute(`pipeline diagram ${T}`,{silent:!0,observe:!1});for(const E of I.envelopes){if(E.model?.kind!==br.pipelineDiagram)continue;const O=_g.safeParse(E.model.data);if(O.success)return O.data.nodes.map(R=>({id:R.id,parentIds:[...R.parentIds,...R.joinParentIds??[]]}))}return null},d={imageUrl:e.vfsUrl_build,download:a,textHead:c,pipelineGlimpse:h},u=(S,T,I)=>{const E=I==="~"?"ls ~":`ls "${I}"`;t.client.line_execute(E,{silent:!0,observe:!1}).then(O=>{for(const R of O.envelopes)T.envelope_observe(R);if(I!=="~"&&T.path_current()!==I.replace(/\/+$/,"")){const R=O.envelopes.find(k=>k.status==="error"),C=R!==void 0?Uz(R):"the session answered no listing";T.listing_fail(C),t.terminal.line_note(`files: ${I}: ${C}`)}},O=>{const R=O instanceof Error?O.message:String(O);T.listing_fail(R),t.terminal.line_note(`files: ${I}: ${R}`)})},p=(S,T,I)=>{const E=T.path_current();E!==null&&n.get(S)?.push(E),u(S,T,I)},f=(S,T)=>{const I=n.get(S)?.pop();I!==void 0&&u(S,T,I)},_=S=>{o.get(S)?.()},g=(S,T)=>{r.set(S,T),_(S);const I=s.get("files",S);I?.follow_set(T),T&&I!==void 0&&t.client.line_execute("ls",{silent:!0,observe:!1}).then(E=>{for(const O of E.envelopes)I.envelope_observe(O)})},m=(S,T)=>{const I=s.get("files",S);I!==void 0&&(r.get(S)===!0?t.terminal.line_run("ls"):u(S,I,T))},w=(S,T)=>{e.askOnPane_await(S,{message:`New directory in ${T}: `,kind:"text",commit:"MAKE IT"}).then(I=>{const E=(I??"").trim();E!==""&&(t.terminal.line_run(`mkdir "${T}/${E}"`),m(S,T))})},y=async(S,T,I)=>{for(const E of I){const O=`${T}/${E.name}`;t.terminal.line_note(`putting ${E.name} in ${T}…`);try{const R=await fetch(e.vfsUrl_build(O),{method:"POST",body:E});if(!R.ok){t.terminal.line_note(`upload: ${E.name}: ${(await R.text()).trim()||R.statusText}`);continue}t.terminal.line_note(`✓ ${O}`)}catch(R){t.terminal.line_note(`upload: ${E.name}: ${R instanceof Error?R.message:String(R)}`)}}m(S,T)},b=(S,T,I)=>{if(I.kind==="dir"){r.get(S)===!0?t.terminal.line_run(`cd "${I.path}"`):p(S,T,I.path);return}if(I.kind==="plugin"||I.kind==="pipeline"){e.binEntry_show(S,T,I.path,I.kind);return}if(S1(I.path)){e.image_open(S,I.path).then(E=>t.terminal.line_note(E));return}if(i.regard_write(S,{address:I.path,modelKind:"fs.file"}),!i.groupHasViewer(S)){if(Od(I.path)){T.contentImage_show(I.path,e.vfsUrl_build(I.path));return}l(I.path).then(E=>{if(!E.ok){T.contentRefused_show(I.path,E.text);return}z1.test(I.path)?T.contentTable_show(I.path,E.text):T.content_show(I.path,E.text)})}},v=()=>{const S=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(S===null)throw new Error("tpl-pane-files has no files-body");return S},z=(S,T,I)=>{const E=`"${I}"`,O=T.type==="dir"||T.type==="vfs"||T.type==="job",R=El(I),C={kind:T.type==="plugin"||T.type==="pipeline"?"catalogue":O&&iu(I,T.name)?"seriesFolder":T.type==="file"?"file":"directory",feed:R,node:R===null?null:am(I),bound:e.catalogue_find(S)!==void 0,projection:q5(I),editable:T.type==="file"&&mC(I)},k={image:()=>{e.image_open(S,I).then(B=>t.terminal.line_note(B))},download:()=>a(I),link:()=>{const B=Jw(window.location.origin,I);(s.get("files",S)?.link_copy(I)??navigator.clipboard.writeText(B).then(()=>!0,()=>!1)).then(F=>t.terminal.line_note(F?`link copied: ${B}`:`link (copy it): ${B}`))},process:()=>e.process_open(S,{input:I,feed:R,node:R===null?null:am(I)}),gather:()=>e.cohort_gather([{kind:O?"dir":"file",seriesUID:I,description:T.name,imagery:iu(I,T.name),modality:iu(I,T.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:I,folderPath:I}]),run:()=>e.run_press(S,T.name,T.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const B=v1(I),L=O5(T.name,T.size,pC);if(L===null){e.verbLine_run(S,B);return}e.askOnPane_await(S,{kind:"confirm",message:L}).then(F=>{F==="y"&&e.verbLine_run(S,B)})},move:()=>e.verbLine_run(S,`mv ${E}`),copy:()=>e.verbLine_run(S,`cp ${E}`),delete:()=>e.verbLine_run(S,`rm ${O?"-ri":"-i"} ${E}`),share:()=>e.verbLine_run(S,`setfacl ${E}`)};return tS.rules.filter(B=>B.offered(C)).map(B=>({label:B.label(C),run:()=>k[B.name]?.()}))},x=(S,T)=>{const I=T.map(([k])=>k),E=I.map(k=>`"${k}"`).join(" "),O=[];for(const k of I){const B=El(k);B!==null&&!O.includes(B)&&O.push(B)}const R={count:I.length,feeds:O},C={delete:()=>e.verbLine_run(S,`rm -rI ${E}`),move:()=>t.terminal.line_run(`mv -t ${E}`),copy:()=>t.terminal.line_run(`cp -t ${E}`),share:()=>t.terminal.line_run(`setfacl ${O.map(k=>`feed_${k}`).join(" ")}`)};return sS.rules.filter(k=>k.offered(R)).map(k=>({label:k.label(R),run:()=>C[k.name]?.()}))};return{previewProvider:d,fileText_fetch:l,file_save:a,rootedListing_show:u,listing_refresh:m,directory_make:w,files_deliver:y,follows:S=>r.get(S)===!0,follow_set:g,cwdBind_sync_register:(S,T)=>{o.set(S,T)},cwdBind_sync:_,rooted_walk:p,rooted_back:f,filesBody_stamp:v,rowVerbs_build:z,instance_build:(S,T,I=!1)=>{const E=e.template_stamp("tpl-pane-files"),O=new jz(e.pane_find(E,".files-panel"),C=>b(S,O,C),d,{catalogue:I});O.selectionVerbs_declare(C=>x(S,C)),O.rowVerbs_declare((C,k)=>z(S,C,k),(C,k)=>{i.regard_write(S,{address:k,modelKind:"fs.file"}),El(k)!==null&&t.client.line_execute(`getfacl "${k}"`,{silent:!0,observe:!1}).then(B=>{O.rowReadout_show(k,K5(B))}).catch(()=>{O.rowReadout_show(k,"ACCESS UNREAD")})}),s.set("files",S,O);const R=e.promptUser();return R!==null&&R!==""&&O.home_set(`/home/${R}`),n.set(S,[]),r.set(S,T),_(S),O.follow_set(T),{id:S,kind:"files",mount:E,dispose:()=>{s.delete(S),n.delete(S),i.pane_leave(S)}}}}}function X5(t,e){const s=qi("tpl-pane-universe"),i=new x5({canvas:Ks(s,".universe-canvas"),title:Ks(s,".universe-title"),state:s.querySelector(".pane-state"),empty:Ks(s,".universe-empty"),projectionPill:s.querySelector(".universe-projection"),refreshPill:s.querySelector(".universe-refresh"),replayPill:s.querySelector(".universe-replay"),scalePill:s.querySelector(".universe-scale"),viewPill:s.querySelector(".universe-view"),gravityPill:s.querySelector(".universe-gravity"),densityPill:s.querySelector(".universe-density"),drawPill:s.querySelector(".universe-draw"),captionsPill:s.querySelector(".universe-captions"),arrangementPill:s.querySelector(".universe-arrangement"),facts:s.querySelector(".universe-facts"),backPill:s.querySelector(".universe-back"),openPill:s.querySelector(".universe-open"),frame:s.querySelector(".mode-frame")},{watch_set:(n,r)=>{r?t.client().watch_send(n):t.client().unwatch_send(n)},...(({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l})=>({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l}))(w1(t.context(),e,t.feedVerbs())),command_run:n=>{t.client().line_execute(n,{silent:!0,observe:!1}).then(r=>{for(const o of r.envelopes)i.envelope_observe(o)})},feed_dag:async n=>{const r=await t.client().line_execute(`feed diagram feed_${n}`,{silent:!0,observe:!1});for(const o of r.envelopes){if(o.model?.kind!==br.feedDag)continue;const a=bg.safeParse(o.model.data);if(a.success)return a.data}return null},node_enter:n=>{t.terminal().line_run(`cd "${n}"`)},node_dive:n=>{t.nodeOverlay_open(e,n.replace(/\/data$/,""))},node_process:n=>{const r=El(n.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)[1])),o=t.promptUser()===null?n.vfsPath:n.vfsPath.replace(/^\/proc\/jobs\//,`/home/${t.promptUser()}/feeds/`);t.process_open(e,{input:o,feed:r,node:n.instanceId})},feed_open:n=>{t.runs_show(),t.dag_primary().feed_enter(n)},plugin_open:n=>{(async()=>{const r=await t.client().line_execute("ls /bin",{silent:!0,observe:!1}),o=[];for(const l of r.envelopes){if(l.model?.kind!=="fs.listing")continue;const c=l.model.data,h=Array.isArray(c)?c:[c];for(const d of h)for(const u of d.items??[])o.push(u.name)}const a=o.filter(l=>l.startsWith(`${n}-v`)).sort((l,c)=>l.localeCompare(c,void 0,{numeric:!0})).pop();if(a===void 0){t.terminal().line_note(`universe: ${n} is not in /bin`);return}Qe("gutter-files").click(),t.binEntry_show("files",t.panels().get("files","files"),`/bin/${a}`,"plugin")})().catch(r=>{t.terminal().line_note(`universe: could not open ${n} in /bin: ${r instanceof Error?r.message:String(r)}`)})},note:n=>t.terminal().line_note(n)},Zw());return t.panels().set("universe",e,i),{id:e,kind:"universe",mount:s,dispose:()=>{t.panels().delete(e),t.subjects().pane_leave(e),i.dispose()}}}function Z5(t,e,s){const i=qi("tpl-pane-dag"),n=new QU(Ks(i,".dag-canvas"),Ks(i,".dag-title"),Ks(i,".dag-facts"),Ks(i,".dag-empty"),Ks(i,".dag-strategy"),Ks(i,".dag-feedlist"),{command_run:r=>{t.client().line_execute(r,{silent:!0,observe:!1}).then(o=>{for(const a of o.envelopes)n.envelope_observe(a)})},watch_set:(r,o)=>{o?t.client().watch_send(r):t.client().unwatch_send(r)},node_enter:r=>{t.terminal().line_run(`cd "${r}"`)},node_dive:r=>{t.nodeOverlay_open(e,r.replace(/\/data$/,""))},node_regard:r=>{t.subjects().regard_write(e,{address:r,modelKind:"feed.node"})},node_process:r=>{const o=El(r.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)[1])),a=t.promptUser()===null?r.vfsPath:r.vfsPath.replace(/^\/proc\/jobs\//,`/home/${t.promptUser()}/feeds/`);t.process_open(e,{input:a,feed:o,node:r.instanceId})},feed_regard:r=>{t.subjects().regard_write(e,{address:r,modelKind:"feed"})},...w1(t.context(),e,t.feedVerbs()),...s?{feed_shown:()=>t.dag_summon()}:{}});return t.panels().set("dag",e,n),{id:e,kind:"dag",mount:i,dispose:()=>{t.nodeOverlay().dispose(e),t.panels().delete(e),t.subjects().pane_leave(e),n.dispose()}}}function J5(t){return{universe_build:e=>X5(t,e),dag_build:(e,s)=>Z5(t,e,s)}}const x1=new Set(["files"]);function Q5(t){x1.add(t)}function rv(t){return x1.has(t)}const O1=new Map,wa=new Map;let e$=0;function En(t,e){O1.set(t,e)}function t$(t){const e=O1.get(t);if(e===void 0)throw new Error(`no pane factory registered for kind '${t}'`);const s=e(`${t}-${e$++}`);return wa.set(s.id,s),s}function Yc(t){wa.set(t.id,t)}function zh(t){return wa.get(t)}function Sh(){return[...wa.values()]}function As(t){const e=wa.get(t);e!==void 0&&(wa.delete(t),e.dispose?.(),e.mount.remove())}class s${byId=new Map;set(e,s,i){this.byId.set(s,{kind:e,panel:i})}get(e,s){const i=this.byId.get(s);return i!==void 0&&i.kind===e?i.panel:void 0}has(e,s){return this.byId.get(s)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([s])=>s)}entries(e){const s=[];for(const[i,n]of this.byId)n.kind===e&&s.push([i,n.panel]);return s}values(e){return this.entries(e).map(([,s])=>s)}idOf(e,s){for(const[i,n]of this.byId)if(n.kind===e&&n.panel===s)return i;return null}}const i$="modulepreload",n$=function(t,e){return new URL(t,e).href},ov={},lm=function(e,s,i){let n=Promise.resolve();if(s&&s.length>0){let c=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");n=c(s.map(h=>{if(h=n$(h,i),h in ov)return;ov[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(i)for(let f=o.length-1;f>=0;f--){const _=o[f];if(_.href===h&&(!d||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":i$,d||(p.as="script"),p.crossOrigin="",p.href=h,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((f,_)=>{p.addEventListener("load",f),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},r$=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function r_(t){const e=t instanceof Error?t.message:String(t??"");return r$.test(e)}const oa={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},o$=`${oa.before}${oa.refresh}${oa.after}`,nd="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function a$(t,e=document.body){let s=!1;const i=()=>{if(s)return;s=!0,t(`argus: ${o$} (what failed to load was part of the old build)`);const n=document.createElement("div");n.className="stale-page",n.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const o=document.createElement("button");o.type="button",o.className="stale-page-reload",o.textContent=oa.refresh,o.title="load the argus the server has now",o.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(oa.before),o,document.createTextNode(oa.after)),n.append(r),e.appendChild(n)};window.addEventListener("vite:preloadError",()=>{i()}),window.addEventListener("unhandledrejection",n=>{r_(n.reason)&&i()})}const l$=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],c$=256*1024*1024;function Xc(t){const e=["B","KB","MB","GB","TB"];let s=t,i=0;for(;s>=1024&&i<e.length-1;)s/=1024,i++;return i===0?`${t} B`:`${s.toFixed(1)} ${e[i]}`}function h$(t){const e=t.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class d${pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=c$;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,s){this.handlers=s,this.pane=e,this.field=di(e,".image-field"),this.title=di(e,".pane-title"),this.modeSpan=di(e,".pane-mode"),this.stateSpan=di(e,".pane-state");for(const i of e.querySelectorAll(".image-layout")){const n=i.dataset.layout??"single";this.layoutPills.set(n,i),i.addEventListener("click",()=>{this.layout_set(n)})}this.overlayPill=di(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=di(e,".image-colormap"),this.savePill=di(e,".image-save"),this.loadPill=di(e,".image-load"),this.retryPill=di(e,".image-retry"),this.presetPill=di(e,".image-preset"),this.focusMark=di(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),di(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const i of Rb){const n=di(e,`.image-tool[data-tool="${i}"]`);this.toolPills.set(i,n),n.addEventListener("click",()=>{this.tool_set(i)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.field.contains(i.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",i=>{if(i.key==="Escape"){this.field_release(),i.stopPropagation();return}i.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,s={}){if(this.engine_dispose(),this.series=e,this.forced=s.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=s.siblings??[],this.pane.dataset.modality=h$(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const o=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${o} of ${this.siblings.length} in this study; image series <n> switches`)}const i=await this.chunk_import(()=>lm(()=>import("./cornerstoneEngine-Blp1IbPT.js").then(o=>o.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(i===null)return;const{CornerstoneEngine:n}=i,r=new n(this.engineHost_get(),e,s.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Xc(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Xc(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,e))}async annotations_reload(e,s){let i=0;for(const n of s.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=n.split("/").pop()??n;try{const o=await fetch(this.handlers.source.url_resolve(n));if(!o.ok){this.handlers.note(`image: ${r}: HTTP ${o.status}`);continue}const a=await e.annotations_import(await o.arrayBuffer());i+=a,this.handlers.note(a>0?`image: ${a} measurement${a===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(o){this.handlers.note(`image: ${r}: ${o instanceof Error?o.message:String(o)}`)}}this.pane.dataset.annotations=String(i)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const s=await this.chunk_import(()=>lm(()=>import("./niivueEngine-BouI2q7Z.js"),__vite__mapDeps([3,1]),import.meta.url));if(s===null)return;const{NiivueEngine:i}=s;await this.engine_open(new i(this.engineHost_get(),e))}async chunk_import(e){try{const s=await e();if(s!==void 0)return s}catch(s){if(!r_(s))throw s}return ys(this.stateSpan,"stale",nd),this.handlers.note(`image: ${nd.toLowerCase()} — the viewer's code is of an older build than the server has`),null}opening_show(e){const s=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${s}`,done:0,total:0})}opening_fail(e,s){this.stateSpan.textContent=s,this.progress_show({label:s,done:0,total:0});const i=this.progressNote;i!==null&&(i.classList.add("image-working-failed"),i.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Xc(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Xc(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const s=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(s),this.modeSpan.textContent=s==="single"?"":s.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[s,i]of this.layoutPills)i.classList.toggle("rail-off",s!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_select(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const s=e[this.presetIndex];s!==void 0&&this.wl_set(s.lower,s.upper)&&(this.presetPill.textContent=s.name.toUpperCase())}presets_select(e){const s=e.toUpperCase();return zz.filter(i=>i.modalities.length===0||i.modalities.includes(s))}presets_paint(e){this.presetIndex=-1;const s=this.presets_select(e);this.presetPill.hidden=s.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const s=this.engine.slice_set(e);return s||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),s}wl_set(e,s){if(this.engine===null)return!1;const i=this.engine.wl_set(e,s);return i||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),i}ghost_set(e){if(this.engine===null)return!1;const s=this.engine.ghost_set(e);return s||this.handlers.note("image: ghost applies to the SLAB layout"),s}wlPreset_set(e){const s=this.series?.modality??"NIFTI",i=j2(e,s);return i===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${s}`),!1):this.wl_set(i.lower,i.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,s=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||s===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const i=await this.engine.annotations_export();if(i===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const n=`${s}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(n,i);return this.handlers.note(r===200?`✓ ${n}`:`image: save: ${n}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=dh[(dh.indexOf(this.colormap)+1)%dh.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(i){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${i instanceof Error?i.message:String(i)}`);return}const s=e.state_get().layout;this.layoutPills_paint(s),this.modeSpan.textContent=s==="single"?"":s.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,s=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!s||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const s=document.createElement("div");s.className="image-probe-note",this.field.appendChild(s),this.probeNote=s}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const s=this.engine.state_get();e.textContent=s.slices>1?`SLICE ${Math.max(1,s.slice)} OF ${s.slices}`:"",e.hidden=s.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const o=document.createElement("div");o.className="image-working",o.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(o),this.progressNote=o}const s=this.progressNote;s.classList.remove("image-working-failed");const i=e.total>0,n=i?Math.min(1,e.done/e.total):0;s.querySelector(".image-working-label").textContent=e.label,s.querySelector(".image-working-count").textContent=i?`${e.done} / ${e.total} · ${Math.round(n*100)}%`:"";const r=s.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!i),r.style.width=i?`${Math.round(n*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,s=await this.handlers.tags_read(e);if(s===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=l$.flatMap(i=>{const r=(s.constant.find(o=>o.name===i.tag)?.value??"").trim();return r===""?[]:[i.label===""?r:`${i.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const s=document.createElement("span");s.className="image-overlay-slice",e.appendChild(s);for(const i of this.overlayLines){const n=document.createElement("span");n.textContent=i,e.appendChild(n)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??Rb),s=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[i,n]of this.toolPills){const r=e.has(i);n.classList.toggle("rail-na",!r),n.classList.toggle("rail-off",r&&i!==s),n.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function di(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`image pane: missing ${e}`);return s}const E1=["patient","study","series","image","equipment","meta","private","other","varying"],u$=new Set(["meta","private"]),av="••••";class f${pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,s){this.handlers=s,this.pane=e,this.title=Zc(e,".pane-title"),this.modeSpan=Zc(e,".pane-mode"),this.redactBlock=Zc(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const i=Zc(e,".tags-panel");this.listing=new Ir({mount:i,traits:this.groupTraits_declare(),key:n=>n.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:n=>`tags-group tags-group-${n.group}`,decorate:n=>{n.title="fold this group open or shut (it keeps its place)"}},child:sa(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:n=>n.items.length>0,row:{className:n=>`tags-row${n.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(n,r)=>{n.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:sa(n=>n.items,{traits:this.itemTraits_declare(),key:n=>n.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:sa(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:()=>!1,row:{className:n=>`tags-row tags-row-deep${n.phi?" tags-phi":""}`}})})}),state:n=>this.stateLine_compose(n),empty:()=>_$("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${m$(e)}`,this.pane.dataset.modality=g$(e),this.groups=p$(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(s=>s.group).filter(s=>!u$.has(s))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const s=this.groups.reduce((n,r)=>n+r.rows.length,0),i=[];return this.model!==null&&this.model.subject==="folder"&&(i.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&i.push(`REFUSED ${this.model.refused.length}`)),i.push(e.filter!==""?e.filter:`${s} TAGS`),this.redact&&i.push("REDACTED"),i.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const s=document.createElement("span");if(s.className="tags-value",e.phi&&this.redact)return s.textContent=av,s.title="identifying value, redacted; the REDACT block on the frame reveals it",s;if(s.textContent=e.value,e.decoded!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` ${e.decoded}`,s.appendChild(i)}if(e.distinct!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` (${e.distinct} distinct)`,s.appendChild(i)}return s}groupTraits_declare(){return[nf(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>E1.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[nf(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?av:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[nf(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function nf(t){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const s=document.createElement("span");return s.className=t(e)?"tags-fold":"tags-fold tags-fold-none",s}}}function p$(t){const e=new Map;for(const s of t.constant){const i=s.group;e.has(i)||e.set(i,[]),e.get(i)?.push(A1(s,`${i}/${s.tag}`))}return t.varying.length>0&&e.set("varying",t.varying.map(s=>({tag:s.tag,name:s.name,vr:s.vr,value:s.distinct===1?s.first:`${s.first} .. ${s.last}`,phi:s.phi,items:[],distinct:s.distinct,key:`varying/${s.tag}`}))),E1.filter(s=>e.has(s)).map(s=>({group:s,rows:e.get(s)??[]}))}function A1(t,e){return{tag:t.tag,name:t.name,vr:t.vr,value:t.value,...t.decoded!==void 0?{decoded:t.decoded}:{},phi:t.phi,items:(t.items??[]).map((s,i)=>({index:i+1,key:`${e}/${i+1}`,rows:s.map(n=>A1(n,`${e}/${i+1}/${n.tag}`))})),key:e}}function m$(t){const e=t.path.replace(/\/$/,"").split("/").pop()??t.path;if(t.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const s=/^(\d+)-/.exec(e)?.[1];return s!==void 0?`INSTANCE ${Number(s)}`:e.length>24?`${e.slice(0,22)}…`:e}function g$(t){const e=(t.constant.find(s=>s.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function _$(t){const e=document.createElement("div");return e.className="tags-note",e.textContent=t,e}function Zc(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`tags pane: missing ${e}`);return s}function b$(t,e){const s=qi("tpl-pane-image"),i=new d$(s,{source:{url_resolve:n=>t.vfsUrl_build(n)},note:n=>t.terminal().line_note(n),regard:n=>t.subjects().regard_write(e,{address:n,modelKind:"dicom.instance"}),file_put:async(n,r)=>{try{return(await fetch(t.vfsUrl_build(n),{method:"POST",body:r})).status}catch{return 0}},tags_read:n=>o_(t,n),tags_open:()=>{t.terminal().line_note(T1(t,e))}});return t.panels().set("image",e,i),{id:e,kind:"image",mount:s,dispose:()=>{i.dispose(),t.panels().delete(e),t.subjects().pane_leave(e)}}}function M$(t,e){const s=qi("tpl-pane-tags"),i=new f$(s,{note:n=>t.terminal().line_note(n)});return t.panels().set("tags",e,i),{id:e,kind:"tags",mount:s,dispose:()=>{t.panels().delete(e),t.subjects().pane_leave(e)}}}async function o_(t,e){try{const s=await t.client().line_execute(`dcm tags "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!==Qo.tags)continue;const n=cz.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}function v$(t,e,s){const i=t.panels().get("tags",e);i===void 0||i.path_get()===s||o_(t,s).then(n=>{if(n===null){t.terminal().line_note(`tags: ${s}: not a readable DICOM file`);return}t.panels().get("tags",e)?.model_show(n)})}function T1(t,e){const s=new Set(t.layout().panes_shown()),i=t.subjects().group_resolve(e);for(const r of t.panels().ids("tags"))if(s.has(r)&&t.subjects().group_resolve(r)===i)return t.layout().focus_set(r),"image tags";if(!s.has(e))return"image tags: the image pane is not on stage";const n=t.instance_spawn("tags",e);return t.layout().leaf_split(e,t.desktop().replayPlace_get()?.dir??"col",n.id,t.desktop().replayPlace_get()?.before??!1)?(t.birth_record(n.id,e,t.desktop().replayPlace_get()?.dir??"col",t.desktop().replayPlace_get()?.before??!1),"image tags"):(As(n.id),t.layout().mount_remove(n.id),"image tags: could not open beside the image pane")}async function cm(t,e){try{const s=await t.client().line_execute(`dcm series "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!==Qo.series)continue;const n=hz.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}async function I1(t,e){try{const s=await t.client().line_execute(`ls "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!=="fs.listing")continue;const n=i.model.data,r=(Array.isArray(n)?n[0]:n)??{},o=(r.path??e).replace(/\/$/,"");return(r.items??[]).filter(a=>a.type==="dir").map(a=>`${o}/${a.name}`)}}catch{}return[]}function D1(t,e,s){const i=l=>{s!==void 0&&t.subjects().regard_write(l,s)};if(e!==null&&t.panels().has("image",e))return i(e),t.panels().get("image",e)??null;const n=new Set(t.layout().panes_shown());if(s!==void 0){for(const[l,c]of t.panels().entries("image"))if(n.has(l)&&t.subjects().regard_get(l)?.address===s.address)return i(l),c}const r=e!==null?t.subjects().group_resolve(e):null;for(const[l,c]of t.panels().entries("image"))if(n.has(l)&&r!==null&&t.subjects().group_resolve(l)===r)return c;const o=e!==null&&n.has(e)?e:t.errandHost_find();if(o===null)return null;const a=t.instance_spawn("image",e??void 0);return t.layout().leaf_split(o,t.desktop().replayPlace_get()?.dir??"col",a.id,t.desktop().replayPlace_get()?.before??!1)?(t.birth_record(a.id,o,t.desktop().replayPlace_get()?.dir??"col",t.desktop().replayPlace_get()?.before??!1),i(a.id),t.panels().get("image",a.id)??null):(As(a.id),t.layout().mount_remove(a.id),null)}async function w$(t,e,s,i={},n){t.launcher_yield();const r=e!==null?void 0:sp.test(s)?{address:s,modelKind:"image.volume"}:{address:$h.test(s)?s.slice(0,s.lastIndexOf("/")):s.replace(/\/$/,""),modelKind:"dicom.series"},o=D1(t,e,r);if(o===null)return"image: no pane to open beside";const a=t.panels().idOf("image",o);if(a!==null&&n?.(a),sp.test(s))return o.opening_show(s),o.volume_show(s),`image ${s}`;const l=$h.test(s),c=l?s.slice(0,s.lastIndexOf("/")):s.replace(/\/$/,"");o.opening_show(c);let h=await cm(t,c),d=[];if(h===null&&!l){const p=(await I1(t,c)).slice(0,32);for(const f of p){const _=await cm(t,f);if(_!==null){d=p.map(g=>({path:g,label:g.split("/").pop()??g})),h=_;break}}}if(h===null)return o.opening_fail(s,"NOT A READABLE SERIES"),`image: ${s}: not a readable DICOM series, study, or volume`;const u=l?Math.max(1,h.files.indexOf(s)+1):1;return o.series_show(h,{siblings:d,startAt:u,...i.force===!0?{force:!0}:{}}),`image ${h.path}${d.length>1?` (1 of ${d.length} series)`:""}`}function y$(t){return{imageInstance_build:e=>b$(t,e),tagsInstance_build:e=>M$(t,e),tags_ask:e=>o_(t,e),tagsPane_follow:(e,s)=>v$(t,e,s),tagsPane_open:e=>T1(t,e),series_ask:e=>cm(t,e),subfolders_ask:e=>I1(t,e),imagePane_resolve:(e,s)=>D1(t,e,s),image_open:(e,s,i={},n)=>w$(t,e,s,i,n)}}function z$(t){return{primaries:[t.panes.dag_build("dag",!0),t.panes.universe_build("universe"),{id:"pacs",kind:"pacs",mount:t.pacsMount}],domains:["dag","pacs"],presets:[["pacs",()=>({pane:"pacs"})],["dag",()=>({pane:"dag"})],["universe",()=>({pane:"universe"})]],factories:[["dag",e=>t.panes.dag_build(e,!1)],["universe",t.panes.universe_build],["image",t.dicom.imageInstance_build],["tags",t.dicom.tagsInstance_build],["gather",t.gather_build]]}}function S$(t){return async()=>{const e=await t.ask("proc feeds");let s=[];for(const d of e.envelopes){const u=d.model;if(u===void 0||u.kind!==Kf)continue;const p=qf.safeParse(u.data);p.success&&(s=p.data.feeds)}const n=s.length===0&&e.envelopes.some(d=>d.status==="error")?"INDEX WARMING":`${s.length} FEEDS`,r=s.filter(d=>/error/i.test(d.status)).length,o=s.filter(d=>/running|scheduled|created|started/i.test(d.status)).length,a={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:n}],rows:[],verb:"SEE THE SPACE",about:hn.universe,enter:()=>t.universe_show()},l={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:n},...o>0?[{text:`${o} RUNNING`}]:[],...r>0?[{text:`${r} ERRORED`,errored:!0,open:()=>t.runs_show("status:error")}]:[]],rows:s.slice(0,6).map(d=>({text:`${d.id} ${d.title}`,errored:/error/i.test(d.status),open:()=>t.feed_enter(d.id)})),verb:"OPEN THE ROSTER",about:hn.analyses,enter:()=>t.runs_show()},c=t.pacs_query(),h={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:c===""?"NO ANSWER":"ANSWERED"}],rows:c===""?[{text:"pacs query PatientID:…",open:()=>t.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>t.line_offer("pacs query AccessionNumber:")}]:[{text:c.slice(0,48)}],verb:"ASK A PACS",about:hn.pacs,enter:()=>t.pacs_open()};return{lead:{tile:l,weight:s.length},afterFiles:[h],afterPanes:[a],about:{files:{text:"Your ChRIS home: uploads, results and what others shared with you."}}}}}const x$=["expired","failed","error"];function lv(t,e,s){for(const i of t.envelopes){if(i.model?.kind!==e)continue;const n=s(i.model.data);if(n.success&&n.data!==void 0)return n.data}return null}function O$(t){return t===null?"REGION":t.includes(":")?t.slice(t.indexOf(":")+1):t}function E$(t){return t.limit.replace(new RegExp(`^(standard-)?${t.family.toLowerCase()}-`),"").replace(/-count$/,"")}function A$(t){const e=t.available===null?`${t.value} PERMITTED`:`${t.available} / ${t.value} FREE`;return`${t.family.toUpperCase()} ${O$(t.zone)} ${E$(t)} ${e}`}function cv(t,e){return`${e==="USD"?"$":`${e} `}${t.toFixed(2)}`}function T$(t){return async()=>{const[e,s]=await Promise.all([t.ask("domain status"),t.ask("capacity")]),i=lv(e,mz,u=>bz.safeParse(u)),n=i?.domains??[];i!==null&&t.names_seen?.(n.map(u=>u.name));const r=u=>u.steps.some(p=>x$.includes(p.state)),o=n.filter(r).length,a=n.filter(u=>u.cost!==void 0&&u.cost!==null),l=a.reduce((u,p)=>u+(p.cost?.hourly??0),0),c={key:"domains",name:"DOMAINS",hue:"--october-sunset",numeral:"",figures:[{text:n.length===0?"NONE":`${n.length} DOMAIN${n.length===1?"":"S"}`},...o>0?[{text:`${o} NEED${o===1?"S":""} A LOOK`,errored:!0}]:[],...a.length>0?[{text:`${cv(l,a[0]?.cost?.currency??"USD")}/H`}]:[]],rows:n.slice(0,6).map(u=>({text:`${u.name} ${u.lastDone??"NOTHING DONE"}${u.cost!==void 0&&u.cost!==null?` ${cv(u.cost.hourly,u.cost.currency)}/h`:""} ${u.cluster??""}`.trimEnd(),errored:r(u),open:()=>t.domain_open(u.name)})),verb:"OPEN THE CONTROLLER",about:hn.domains,enter:()=>t.domain_open("")},h=lv(s,Hk,u=>qk.safeParse(u)),d={key:"capacity",name:"CAPACITY",hue:"--honey",numeral:"",figures:h===null?[{text:"NO FAMILY"}]:[{text:h.region.toUpperCase()}],rows:h===null?[{text:"capacity E5",open:()=>t.line_run("capacity E5")}]:h.rows.slice(0,6).map(u=>({text:A$(u),errored:u.available===0,open:()=>t.line_run(`capacity ${u.family}`)})),verb:"READ CAPACITY",about:hn.capacity,enter:()=>t.line_run("capacity")};return{lead:{tile:c,weight:n.length},afterFiles:[d],afterPanes:[],about:{files:{text:"Your home: the Trusted Domains this session knows, each a folder of its spec, settings, state and steps."}}}}}const gl=new Set([""]);function I$(t){const e=new Set(["",...t]);if(e.size===gl.size&&[...e].every(s=>gl.has(s)))return!1;gl.clear();for(const s of e)gl.add(s);return!0}function D$(t){return{subjects:{domain:gl},views:{},claims:{},listings:{},chords:[],lines:[{after:"view",line:"domain [<name>] (the TD controller takes the screen; every other domain line is the session's)"}],run:(e,s)=>{if(s.subject==="domain")return t().controller_open(s.words[0]??"")}}}function C$(t){return t>=6e4?`${Math.max(1,Math.round(t/6e4))} MIN`:`${Math.max(1,Math.round(t/1e3))} S`}function wi(t){return t.toLocaleString("en-US")}class R${mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,s=()=>Date.now(),i={}){this.mount=e,this.clock=s,this.acts=i,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_compute(e,s,i){const n=this.clock(),r=this.walkSamples.get(e);let o=r?.rowsPerMs??null;r!==void 0&&s>r.loaded&&n>r.at&&(o=(s-r.loaded)/(n-r.at)),(r===void 0||s!==r.loaded)&&this.walkSamples.set(e,{loaded:s,at:n,rowsPerMs:o});const a=Math.max(0,i-s);return i<=0?null:o!==null&&o>0?a/o:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(a/100/4)*this.msPerPage:null}counts_show(e){this.counts=e,this.render()}promptContext_show(e){this.context=e,e.procIndex!==void 0&&(this.counts={jobs:e.procIndex.jobs,feeds:e.procIndex.feeds}),this.render()}rows_compose(){const e=[],s=this.context?.procWarmup,i=this.context?.warmupFailures??[],n=s!==void 0&&s.sweeping!==!1,r=this.counts!==null?`${wi(this.counts.jobs)} JOBS · ${wi(this.counts.feeds)} FEEDS`:"";if(i.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${i.map(l=>l.label.toUpperCase()).join(" ")}`,title:i.map(l=>`${l.label}: ${l.message}`).join(`
|
|
4347
|
+
`);return{ok:!1,text:E===""?"the session refused this read and said nothing further":E}}),c=async(S,T)=>{const I=await fetch(e.vfsUrl_build(S));if(!I.ok||I.body===null)return(await l(S)).text.slice(0,T);const E=I.body.getReader(),O=new TextDecoder;let R="";for(;R.length<T;){const{done:C,value:k}=await E.read();if(C)break;R+=O.decode(k,{stream:!0})}return E.cancel().catch(()=>{}),R.slice(0,T)},h=async S=>{const T=/_id(\d+)$/.exec(S)?.[1]??S.replace(/^.*\//,""),I=await t.client.line_execute(`pipeline diagram ${T}`,{silent:!0,observe:!1});for(const E of I.envelopes){if(E.model?.kind!==br.pipelineDiagram)continue;const O=_g.safeParse(E.model.data);if(O.success)return O.data.nodes.map(R=>({id:R.id,parentIds:[...R.parentIds,...R.joinParentIds??[]]}))}return null},d={imageUrl:e.vfsUrl_build,download:a,textHead:c,pipelineGlimpse:h},u=(S,T,I)=>{const E=I==="~"?"ls ~":`ls "${I}"`;t.client.line_execute(E,{silent:!0,observe:!1}).then(O=>{for(const R of O.envelopes)T.envelope_observe(R);if(I!=="~"&&T.path_current()!==I.replace(/\/+$/,"")){const R=O.envelopes.find(k=>k.status==="error"),C=R!==void 0?Uz(R):"the session answered no listing";T.listing_fail(C),t.terminal.line_note(`files: ${I}: ${C}`)}},O=>{const R=O instanceof Error?O.message:String(O);T.listing_fail(R),t.terminal.line_note(`files: ${I}: ${R}`)})},p=(S,T,I)=>{const E=T.path_current();E!==null&&n.get(S)?.push(E),u(S,T,I)},f=(S,T)=>{const I=n.get(S)?.pop();I!==void 0&&u(S,T,I)},_=S=>{o.get(S)?.()},g=(S,T)=>{r.set(S,T),_(S);const I=s.get("files",S);I?.follow_set(T),T&&I!==void 0&&t.client.line_execute("ls",{silent:!0,observe:!1}).then(E=>{for(const O of E.envelopes)I.envelope_observe(O)})},m=(S,T)=>{const I=s.get("files",S);I!==void 0&&(r.get(S)===!0?t.terminal.line_run("ls"):u(S,I,T))},w=(S,T)=>{e.askOnPane_await(S,{message:`New directory in ${T}: `,kind:"text",commit:"MAKE IT"}).then(I=>{const E=(I??"").trim();E!==""&&(t.terminal.line_run(`mkdir "${T}/${E}"`),m(S,T))})},y=async(S,T,I)=>{for(const E of I){const O=`${T}/${E.name}`;t.terminal.line_note(`putting ${E.name} in ${T}…`);try{const R=await fetch(e.vfsUrl_build(O),{method:"POST",body:E});if(!R.ok){t.terminal.line_note(`upload: ${E.name}: ${(await R.text()).trim()||R.statusText}`);continue}t.terminal.line_note(`✓ ${O}`)}catch(R){t.terminal.line_note(`upload: ${E.name}: ${R instanceof Error?R.message:String(R)}`)}}m(S,T)},b=(S,T,I)=>{if(I.kind==="dir"){r.get(S)===!0?t.terminal.line_run(`cd "${I.path}"`):p(S,T,I.path);return}if(I.kind==="plugin"||I.kind==="pipeline"){e.binEntry_show(S,T,I.path,I.kind);return}if(S1(I.path)){e.image_open(S,I.path).then(E=>t.terminal.line_note(E));return}if(i.regard_write(S,{address:I.path,modelKind:"fs.file"}),!i.groupHasViewer(S)){if(Od(I.path)){T.contentImage_show(I.path,e.vfsUrl_build(I.path));return}l(I.path).then(E=>{if(!E.ok){T.contentRefused_show(I.path,E.text);return}z1.test(I.path)?T.contentTable_show(I.path,E.text):T.content_show(I.path,E.text)})}},v=()=>{const S=e.template_stamp("tpl-pane-files").querySelector(".files-body");if(S===null)throw new Error("tpl-pane-files has no files-body");return S},z=(S,T,I)=>{const E=`"${I}"`,O=T.type==="dir"||T.type==="vfs"||T.type==="job",R=El(I),C={kind:T.type==="plugin"||T.type==="pipeline"?"catalogue":O&&iu(I,T.name)?"seriesFolder":T.type==="file"?"file":"directory",feed:R,node:R===null?null:am(I),bound:e.catalogue_find(S)!==void 0,projection:q5(I),editable:T.type==="file"&&mC(I)},k={image:()=>{e.image_open(S,I).then(B=>t.terminal.line_note(B))},download:()=>a(I),link:()=>{const B=Jw(window.location.origin,I);(s.get("files",S)?.link_copy(I)??navigator.clipboard.writeText(B).then(()=>!0,()=>!1)).then(F=>t.terminal.line_note(F?`link copied: ${B}`:`link (copy it): ${B}`))},process:()=>e.process_open(S,{input:I,feed:R,node:R===null?null:am(I)}),gather:()=>e.cohort_gather([{kind:O?"dir":"file",seriesUID:I,description:T.name,imagery:iu(I,T.name),modality:iu(I,T.name)?"MR":"—",patient:e.promptUser()??"",vfsPath:I,folderPath:I}]),run:()=>e.run_press(S,T.name,T.type==="pipeline"?"pipeline":"plugin"),edit:()=>{const B=v1(I),L=O5(T.name,T.size,pC);if(L===null){e.verbLine_run(S,B);return}e.askOnPane_await(S,{kind:"confirm",message:L}).then(F=>{F==="y"&&e.verbLine_run(S,B)})},move:()=>e.verbLine_run(S,`mv ${E}`),copy:()=>e.verbLine_run(S,`cp ${E}`),delete:()=>e.verbLine_run(S,`rm ${O?"-ri":"-i"} ${E}`),share:()=>e.verbLine_run(S,`setfacl ${E}`)};return tS.rules.filter(B=>B.offered(C)).map(B=>({label:B.label(C),run:()=>k[B.name]?.()}))},x=(S,T)=>{const I=T.map(([k])=>k),E=I.map(k=>`"${k}"`).join(" "),O=[];for(const k of I){const B=El(k);B!==null&&!O.includes(B)&&O.push(B)}const R={count:I.length,feeds:O},C={delete:()=>e.verbLine_run(S,`rm -rI ${E}`),move:()=>t.terminal.line_run(`mv -t ${E}`),copy:()=>t.terminal.line_run(`cp -t ${E}`),share:()=>t.terminal.line_run(`setfacl ${O.map(k=>`feed_${k}`).join(" ")}`)};return sS.rules.filter(k=>k.offered(R)).map(k=>({label:k.label(R),run:()=>C[k.name]?.()}))};return{previewProvider:d,fileText_fetch:l,file_save:a,rootedListing_show:u,listing_refresh:m,directory_make:w,files_deliver:y,follows:S=>r.get(S)===!0,follow_set:g,cwdBind_sync_register:(S,T)=>{o.set(S,T)},cwdBind_sync:_,rooted_walk:p,rooted_back:f,filesBody_stamp:v,rowVerbs_build:z,instance_build:(S,T,I=!1)=>{const E=e.template_stamp("tpl-pane-files"),O=new jz(e.pane_find(E,".files-panel"),C=>b(S,O,C),d,{catalogue:I});O.selectionVerbs_declare(C=>x(S,C)),O.rowVerbs_declare((C,k)=>z(S,C,k),(C,k)=>{i.regard_write(S,{address:k,modelKind:"fs.file"}),El(k)!==null&&t.client.line_execute(`getfacl "${k}"`,{silent:!0,observe:!1}).then(B=>{O.rowReadout_show(k,K5(B))}).catch(()=>{O.rowReadout_show(k,"ACCESS UNREAD")})}),s.set("files",S,O);const R=e.promptUser();return R!==null&&R!==""&&O.home_set(`/home/${R}`),n.set(S,[]),r.set(S,T),_(S),O.follow_set(T),{id:S,kind:"files",mount:E,dispose:()=>{s.delete(S),n.delete(S),i.pane_leave(S)}}}}}function X5(t,e){const s=qi("tpl-pane-universe"),i=new x5({canvas:Ks(s,".universe-canvas"),title:Ks(s,".universe-title"),state:s.querySelector(".pane-state"),empty:Ks(s,".universe-empty"),projectionPill:s.querySelector(".universe-projection"),refreshPill:s.querySelector(".universe-refresh"),replayPill:s.querySelector(".universe-replay"),scalePill:s.querySelector(".universe-scale"),viewPill:s.querySelector(".universe-view"),gravityPill:s.querySelector(".universe-gravity"),densityPill:s.querySelector(".universe-density"),drawPill:s.querySelector(".universe-draw"),captionsPill:s.querySelector(".universe-captions"),arrangementPill:s.querySelector(".universe-arrangement"),facts:s.querySelector(".universe-facts"),backPill:s.querySelector(".universe-back"),openPill:s.querySelector(".universe-open"),frame:s.querySelector(".mode-frame")},{watch_set:(n,r)=>{r?t.client().watch_send(n):t.client().unwatch_send(n)},...(({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l})=>({feed_entered:n,feed_note:r,feed_tag:o,feed_rename:a,feed_untag:l}))(w1(t.context(),e,t.feedVerbs())),command_run:n=>{t.client().line_execute(n,{silent:!0,observe:!1}).then(r=>{for(const o of r.envelopes)i.envelope_observe(o)})},feed_dag:async n=>{const r=await t.client().line_execute(`feed diagram feed_${n}`,{silent:!0,observe:!1});for(const o of r.envelopes){if(o.model?.kind!==br.feedDag)continue;const a=bg.safeParse(o.model.data);if(a.success)return a.data}return null},node_enter:n=>{t.terminal().line_run(`cd "${n}"`)},node_dive:n=>{t.nodeOverlay_open(e,n.replace(/\/data$/,""))},node_process:n=>{const r=El(n.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(n.vfsPath)[1])),o=t.promptUser()===null?n.vfsPath:n.vfsPath.replace(/^\/proc\/jobs\//,`/home/${t.promptUser()}/feeds/`);t.process_open(e,{input:o,feed:r,node:n.instanceId})},feed_open:n=>{t.runs_show(),t.dag_primary().feed_enter(n)},plugin_open:n=>{(async()=>{const r=await t.client().line_execute("ls /bin",{silent:!0,observe:!1}),o=[];for(const l of r.envelopes){if(l.model?.kind!=="fs.listing")continue;const c=l.model.data,h=Array.isArray(c)?c:[c];for(const d of h)for(const u of d.items??[])o.push(u.name)}const a=o.filter(l=>l.startsWith(`${n}-v`)).sort((l,c)=>l.localeCompare(c,void 0,{numeric:!0})).pop();if(a===void 0){t.terminal().line_note(`universe: ${n} is not in /bin`);return}Qe("gutter-files").click(),t.binEntry_show("files",t.panels().get("files","files"),`/bin/${a}`,"plugin")})().catch(r=>{t.terminal().line_note(`universe: could not open ${n} in /bin: ${r instanceof Error?r.message:String(r)}`)})},note:n=>t.terminal().line_note(n)},Zw());return t.panels().set("universe",e,i),{id:e,kind:"universe",mount:s,dispose:()=>{t.panels().delete(e),t.subjects().pane_leave(e),i.dispose()}}}function Z5(t,e,s){const i=qi("tpl-pane-dag"),n=new QU(Ks(i,".dag-canvas"),Ks(i,".dag-title"),Ks(i,".dag-facts"),Ks(i,".dag-empty"),Ks(i,".dag-strategy"),Ks(i,".dag-feedlist"),{command_run:r=>{t.client().line_execute(r,{silent:!0,observe:!1}).then(o=>{for(const a of o.envelopes)n.envelope_observe(a)})},watch_set:(r,o)=>{o?t.client().watch_send(r):t.client().unwatch_send(r)},node_enter:r=>{t.terminal().line_run(`cd "${r}"`)},node_dive:r=>{t.nodeOverlay_open(e,r.replace(/\/data$/,""))},node_regard:r=>{t.subjects().regard_write(e,{address:r,modelKind:"feed.node"})},node_process:r=>{const o=El(r.vfsPath)??(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)===null?null:Number(/\/feed_(\d+)(?:\/|$)/.exec(r.vfsPath)[1])),a=t.promptUser()===null?r.vfsPath:r.vfsPath.replace(/^\/proc\/jobs\//,`/home/${t.promptUser()}/feeds/`);t.process_open(e,{input:a,feed:o,node:r.instanceId})},feed_regard:r=>{t.subjects().regard_write(e,{address:r,modelKind:"feed"})},...w1(t.context(),e,t.feedVerbs()),...s?{feed_shown:()=>t.dag_summon()}:{}});return t.panels().set("dag",e,n),{id:e,kind:"dag",mount:i,dispose:()=>{t.nodeOverlay().dispose(e),t.panels().delete(e),t.subjects().pane_leave(e),n.dispose()}}}function J5(t){return{universe_build:e=>X5(t,e),dag_build:(e,s)=>Z5(t,e,s)}}const x1=new Set(["files"]);function Q5(t){x1.add(t)}function rv(t){return x1.has(t)}const O1=new Map,wa=new Map;let e$=0;function En(t,e){O1.set(t,e)}function t$(t){const e=O1.get(t);if(e===void 0)throw new Error(`no pane factory registered for kind '${t}'`);const s=e(`${t}-${e$++}`);return wa.set(s.id,s),s}function Yc(t){wa.set(t.id,t)}function zh(t){return wa.get(t)}function Sh(){return[...wa.values()]}function As(t){const e=wa.get(t);e!==void 0&&(wa.delete(t),e.dispose?.(),e.mount.remove())}class s${byId=new Map;set(e,s,i){this.byId.set(s,{kind:e,panel:i})}get(e,s){const i=this.byId.get(s);return i!==void 0&&i.kind===e?i.panel:void 0}has(e,s){return this.byId.get(s)?.kind===e}delete(e){return this.byId.delete(e)}ids(e){return this.entries(e).map(([s])=>s)}entries(e){const s=[];for(const[i,n]of this.byId)n.kind===e&&s.push([i,n.panel]);return s}values(e){return this.entries(e).map(([,s])=>s)}idOf(e,s){for(const[i,n]of this.byId)if(n.kind===e&&n.panel===s)return i;return null}}const i$="modulepreload",n$=function(t,e){return new URL(t,e).href},ov={},lm=function(e,s,i){let n=Promise.resolve();if(s&&s.length>0){let c=function(h){return Promise.all(h.map(d=>Promise.resolve(d).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");n=c(s.map(h=>{if(h=n$(h,i),h in ov)return;ov[h]=!0;const d=h.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(i)for(let f=o.length-1;f>=0;f--){const _=o[f];if(_.href===h&&(!d||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${h}"]${u}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":i$,d||(p.as="script"),p.crossOrigin="",p.href=h,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((f,_)=>{p.addEventListener("load",f),p.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},r$=/Failed to fetch dynamically imported module|error loading dynamically imported module|Importing a module script failed/i;function r_(t){const e=t instanceof Error?t.message:String(t??"");return r$.test(e)}const oa={before:"ARGUS has been updated in the background — ",refresh:"refresh",after:" this page"},o$=`${oa.before}${oa.refresh}${oa.after}`,nd="ARGUS UPDATED IN THE BACKGROUND · REFRESH THIS PAGE";function a$(t,e=document.body){let s=!1;const i=()=>{if(s)return;s=!0,t(`argus: ${o$} (what failed to load was part of the old build)`);const n=document.createElement("div");n.className="stale-page",n.setAttribute("role","alert");const r=document.createElement("span");r.className="stale-page-words";const o=document.createElement("button");o.type="button",o.className="stale-page-reload",o.textContent=oa.refresh,o.title="load the argus the server has now",o.addEventListener("click",()=>{window.location.reload()}),r.append(document.createTextNode(oa.before),o,document.createTextNode(oa.after)),n.append(r),e.appendChild(n)};window.addEventListener("vite:preloadError",()=>{i()}),window.addEventListener("unhandledrejection",n=>{r_(n.reason)&&i()})}const l$=[{label:"",tag:"PatientName"},{label:"MRN",tag:"PatientID"},{label:"ACC",tag:"AccessionNumber"},{label:"",tag:"StudyDescription"},{label:"",tag:"SeriesDescription"},{label:"",tag:"StudyDate"},{label:"",tag:"PatientAge"},{label:"",tag:"PatientSex"}],c$=256*1024*1024;function Xc(t){const e=["B","KB","MB","GB","TB"];let s=t,i=0;for(;s>=1024&&i<e.length-1;)s/=1024,i++;return i===0?`${t} B`:`${s.toFixed(1)} ${e[i]}`}function h$(t){const e=t.toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}class d${pane;field;title;modeSpan;stateSpan;layoutPills=new Map;overlayPill;colormapPill;savePill;loadPill;retryPill;presetPill;focusMark;guardBytes=c$;forced=!1;pendingLayout=null;progressNote=null;overlayNote=null;probeNote=null;overlay=!1;overlayLines=[];presetIndex=-1;toolPills=new Map;handlers;engine=null;series=null;siblings=[];colormap="gray";tool="wl";constructor(e,s){this.handlers=s,this.pane=e,this.field=di(e,".image-field"),this.title=di(e,".pane-title"),this.modeSpan=di(e,".pane-mode"),this.stateSpan=di(e,".pane-state");for(const i of e.querySelectorAll(".image-layout")){const n=i.dataset.layout??"single";this.layoutPills.set(n,i),i.addEventListener("click",()=>{this.layout_set(n)})}this.overlayPill=di(e,".image-overlay"),this.overlayPill.addEventListener("click",()=>{this.overlay_set(!this.overlay)}),this.colormapPill=di(e,".image-colormap"),this.savePill=di(e,".image-save"),this.loadPill=di(e,".image-load"),this.retryPill=di(e,".image-retry"),this.presetPill=di(e,".image-preset"),this.focusMark=di(e,".image-focus"),this.field.tabIndex=0,this.colormapPill.addEventListener("click",()=>{this.colormap_cycle()}),this.savePill.addEventListener("click",()=>{this.annotations_save()}),this.loadPill.addEventListener("click",()=>{this.load_press()}),this.retryPill.addEventListener("click",()=>{this.retry_press()}),this.presetPill.addEventListener("click",()=>this.preset_cycle()),di(e,".image-tags").addEventListener("click",()=>this.handlers.tags_open());for(const i of Rb){const n=di(e,`.image-tool[data-tool="${i}"]`);this.toolPills.set(i,n),n.addEventListener("click",()=>{this.tool_set(i)})}this.toolPills_paint(),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.field.contains(i.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",i=>{if(i.key==="Escape"){this.field_release(),i.stopPropagation();return}i.stopPropagation()})}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}async series_show(e,s={}){if(this.engine_dispose(),this.series=e,this.forced=s.force===!0,this.pendingLayout=null,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint(e.modality),this.siblings=s.siblings??[],this.pane.dataset.modality=h$(e.modality),this.title.textContent=`IMAGE ${e.modality.toUpperCase()} ${e.seriesDescription}`.trim(),this.title.title=this.title.textContent,this.siblings.length>1){const o=this.siblings.findIndex(a=>a.path===e.path)+1;this.handlers.note(`image: series ${o} of ${this.siblings.length} in this study; image series <n> switches`)}const i=await this.chunk_import(()=>lm(()=>import("./cornerstoneEngine-BUPxTjGN.js").then(o=>o.b2),__vite__mapDeps([0,1,2]),import.meta.url));if(i===null)return;const{CornerstoneEngine:n}=i,r=new n(this.engineHost_get(),e,s.startAt??1);await this.engine_open(r),this.engine===r&&(this.guard_trips()?(this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Xc(e.bytes)} · LOAD FOR STACK`,this.handlers.note(`image: ${Xc(e.bytes)} to fetch before the stack scrolls; press LOAD, image load, or image --force <path>`)):r.slices_fill(),await this.annotations_reload(r,e))}async annotations_reload(e,s){let i=0;for(const n of s.annotations.filter(r=>/\.dcm$/i.test(r))){if(this.engine!==e)return;const r=n.split("/").pop()??n;try{const o=await fetch(this.handlers.source.url_resolve(n));if(!o.ok){this.handlers.note(`image: ${r}: HTTP ${o.status}`);continue}const a=await e.annotations_import(await o.arrayBuffer());i+=a,this.handlers.note(a>0?`image: ${a} measurement${a===1?"":"s"} from ${r}`:`image: ${r}: no measurements this engine can place`)}catch(o){this.handlers.note(`image: ${r}: ${o instanceof Error?o.message:String(o)}`)}}this.pane.dataset.annotations=String(i)}async volume_show(e){this.engine_dispose(),this.series=null,this.siblings=[],this.pane.dataset.modality="NIFTI",this.title.textContent=`IMAGE ${e.split("/").pop()??""}`,this.title.title=e,this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0,this.presets_paint("NIFTI");const s=await this.chunk_import(()=>lm(()=>import("./niivueEngine-Dv8fpk3P.js"),__vite__mapDeps([3,1]),import.meta.url));if(s===null)return;const{NiivueEngine:i}=s;await this.engine_open(new i(this.engineHost_get(),e))}async chunk_import(e){try{const s=await e();if(s!==void 0)return s}catch(s){if(!r_(s))throw s}return ys(this.stateSpan,"stale",nd),this.handlers.note(`image: ${nd.toLowerCase()} — the viewer's code is of an older build than the server has`),null}opening_show(e){const s=e.replace(/\/$/,"").split("/").pop()??e;this.stateSpan.textContent="OPENING",this.progress_show({label:`OPENING ${s}`,done:0,total:0})}opening_fail(e,s){this.stateSpan.textContent=s,this.progress_show({label:s,done:0,total:0});const i=this.progressNote;i!==null&&(i.classList.add("image-working-failed"),i.querySelector(".image-working-count").textContent=e)}siblings_get(){return this.siblings}series_get(){return this.series}state_get(){return this.engine===null?null:{...this.engine.state_get(),colormap:this.colormap,path:this.series?.path??null,guard:this.guardBytes,waiting:this.pendingLayout}}async layout_set(e){if(this.engine===null)return!1;if(e!=="single"&&this.guard_trips())return this.pendingLayout=e,this.loadPill.hidden=!1,this.stateSpan.textContent=`SERIES ${Xc(this.series?.bytes??0)} · LOAD FOR ${e.toUpperCase()}`,this.handlers.note(`image: ${Xc(this.series?.bytes??0)} to fetch for ${e}; press LOAD, image load, or image --force <path>`),!1;const s=this.engine.state_get().layout;return this.layoutPills_paint(e),this.modeSpan.textContent=e==="single"?"":e.toUpperCase(),this.overlay_hide(),await this.engine.layout_set(e)?(this.progress_show(null),this.overlay_paint(),this.toolPills_paint(),!0):(this.progress_show(null),this.layoutPills_paint(s),this.modeSpan.textContent=s==="single"?"":s.toUpperCase(),this.handlers.note(`image: layout ${e}: not offered by ${this.engine.name}`),!1)}layoutPills_paint(e){for(const[s,i]of this.layoutPills)i.classList.toggle("rail-off",s!==e)}guard_trips(){return this.guardBytes!==null&&!this.forced&&this.engine?.name==="cornerstone"&&(this.series?.bytes??0)>this.guardBytes}async load_press(){this.forced=!0,this.loadPill.hidden=!0,this.retryPill.hidden=!0;const e=this.pendingLayout;return this.pendingLayout=null,e!==null?this.layout_set(e):this.engine===null||this.engine.state_get().filled?!1:this.engine.slices_fill()}guard_set(e){this.guardBytes=e}guard_get(){return this.guardBytes}preset_cycle(){const e=this.presets_select(this.series?.modality??"NIFTI");if(e.length===0)return;this.presetIndex=(this.presetIndex+1)%e.length;const s=e[this.presetIndex];s!==void 0&&this.wl_set(s.lower,s.upper)&&(this.presetPill.textContent=s.name.toUpperCase())}presets_select(e){const s=e.toUpperCase();return zz.filter(i=>i.modalities.length===0||i.modalities.includes(s))}presets_paint(e){this.presetIndex=-1;const s=this.presets_select(e);this.presetPill.hidden=s.length===0,this.presetPill.textContent="PRESET"}slice_set(e){if(this.engine===null)return!1;const s=this.engine.slice_set(e);return s||this.handlers.note(`image: slice ${e}: not offered in ${this.engine.state_get().layout} layout by ${this.engine.name}`),s}wl_set(e,s){if(this.engine===null)return!1;const i=this.engine.wl_set(e,s);return i||this.handlers.note(`image: wl: not offered by ${this.engine.name}`),i}ghost_set(e){if(this.engine===null)return!1;const s=this.engine.ghost_set(e);return s||this.handlers.note("image: ghost applies to the SLAB layout"),s}wlPreset_set(e){const s=this.series?.modality??"NIFTI",i=j2(e,s);return i===void 0?(this.handlers.note(`image: wl preset ${e}: none for ${s}`),!1):this.wl_set(i.lower,i.upper)}colormap_set(e){return this.engine===null?!1:this.engine.colormap_set(e)?(this.colormap=e,this.colormapPill.textContent=e.toUpperCase(),!0):(this.handlers.note(`image: colormap ${e}: not offered by ${this.engine.name}`),!1)}tool_set(e){return this.engine===null?!1:this.engine.tool_set(e)?(this.tool=e,this.toolPills_paint(),!0):(this.handlers.note(`image: ${e}: not offered by ${this.engine.name}`),!1)}async annotations_save(){if(this.engine===null)return!1;const e=this.series?.seriesInstanceUID,s=/^(\/home\/[^/]+)\//.exec(this.series?.path??"")?.[1];if(e===void 0||s===void 0)return this.handlers.note("image: save: this series has no UID to file an annotation under"),!1;const i=await this.engine.annotations_export();if(i===null)return this.handlers.note(`image: save: nothing measured, or ${this.engine.name} writes no report`),!1;const n=`${s}/annotations/${e}/measurements.dcm`,r=await this.handlers.file_put(n,i);return this.handlers.note(r===200?`✓ ${n}`:`image: save: ${n}: HTTP ${r}`),r===200}dispose(){this.engine_dispose()}async colormap_cycle(){const e=dh[(dh.indexOf(this.colormap)+1)%dh.length]??"gray";this.colormap_set(e)}async engine_open(e){this.engine=e,this.field.replaceChildren(),this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.layoutPills_paint("single"),this.modeSpan.textContent="",this.colormapPill.textContent=this.colormap.toUpperCase();try{await e.open(this.field)}catch(i){this.stateSpan.textContent="REFUSED",this.handlers.note(`image: ${i instanceof Error?i.message:String(i)}`);return}const s=e.state_get().layout;this.layoutPills_paint(s),this.modeSpan.textContent=s==="single"?"":s.toUpperCase(),e.tool_set(this.tool),this.toolPills_paint(),this.progress_show(null),this.overlay_fill()}engine_dispose(){this.engine?.dispose(),this.engine=null,this.progressNote=null,this.overlayNote=null,this.probeNote=null,this.field.replaceChildren(),this.stateSpan.textContent=""}retryPill_paint(){const e=this.engine===null?0:this.engine.state_get().refused,s=this.engine?.refused_retry!==void 0;this.retryPill.hidden=!s||e===0,this.retryPill.disabled||(this.retryPill.textContent=`RETRY ${e}`)}async retry_press(){if(!(this.engine?.refused_retry===void 0||this.retryPill.disabled)){this.retryPill.disabled=!0,this.retryPill.textContent="ASKING…";try{await this.engine.refused_retry()}finally{this.retryPill.disabled=!1,this.retryPill_paint()}}}engineHost_get(){return{source:this.handlers.source,readout_set:e=>{this.stateSpan.textContent=e,this.retryPill_paint()},progress_set:e=>this.progress_show(e),note:this.handlers.note,regard:e=>{this.handlers.regard(e),this.overlaySlice_paint()},probe_set:e=>this.probe_show(e)}}probe_show(e){if(e===null){this.probeNote?.remove(),this.probeNote=null;return}if(this.probeNote===null||this.probeNote.parentElement===null){const s=document.createElement("div");s.className="image-probe-note",this.field.appendChild(s),this.probeNote=s}this.probeNote.textContent=e}overlaySlice_paint(){const e=this.overlayNote?.querySelector(".image-overlay-slice")??null;if(e===null||this.engine===null)return;const s=this.engine.state_get();e.textContent=s.slices>1?`SLICE ${Math.max(1,s.slice)} OF ${s.slices}`:"",e.hidden=s.slices<=1}progress_show(e){if(e===null){this.progressNote?.remove(),this.progressNote=null;return}if(this.progressNote===null||this.progressNote.parentElement===null){const o=document.createElement("div");o.className="image-working",o.innerHTML='<span class="image-working-label"></span><span class="image-working-track"><span class="image-working-fill"></span></span><span class="image-working-count"></span>',this.field.appendChild(o),this.progressNote=o}const s=this.progressNote;s.classList.remove("image-working-failed");const i=e.total>0,n=i?Math.min(1,e.done/e.total):0;s.querySelector(".image-working-label").textContent=e.label,s.querySelector(".image-working-count").textContent=i?`${e.done} / ${e.total} · ${Math.round(n*100)}%`:"";const r=s.querySelector(".image-working-fill");r.classList.toggle("image-working-pacing",!i),r.style.width=i?`${Math.round(n*100)}%`:""}async overlay_set(e){if(this.overlay=e,this.overlayPill.textContent=e?"OVERLAY ON":"OVERLAY OFF",this.overlayPill.classList.toggle("rail-off",!e),!e){this.overlay_hide();return}await this.overlay_fill()}overlay_hide(){this.overlayNote?.remove(),this.overlayNote=null}async overlay_fill(){if(!this.overlay||this.series===null)return;const e=this.series.files[0]??this.series.path,s=await this.handlers.tags_read(e);if(s===null){this.handlers.note(`image: overlay: ${e}: no header to read`);return}this.overlayLines=l$.flatMap(i=>{const r=(s.constant.find(o=>o.name===i.tag)?.value??"").trim();return r===""?[]:[i.label===""?r:`${i.label} ${r}`]}),this.overlay_paint()}overlay_paint(){if(!this.overlay||this.overlayLines.length===0)return;this.overlay_hide();const e=document.createElement("div");e.className="image-overlay-note";const s=document.createElement("span");s.className="image-overlay-slice",e.appendChild(s);for(const i of this.overlayLines){const n=document.createElement("span");n.textContent=i,e.appendChild(n)}this.field.appendChild(e),this.overlayNote=e,this.overlaySlice_paint()}toolPills_paint(){const e=new Set(this.engine?.toolsOffered_get()??Rb),s=this.engine!==null?this.engine.state_get().primaryTool:this.tool;for(const[i,n]of this.toolPills){const r=e.has(i);n.classList.toggle("rail-na",!r),n.classList.toggle("rail-off",r&&i!==s),n.disabled=!r}}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("image-field-focused",e)}}function di(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`image pane: missing ${e}`);return s}const E1=["patient","study","series","image","equipment","meta","private","other","varying"],u$=new Set(["meta","private"]),av="••••";class f${pane;title;modeSpan;redactBlock;listing;handlers;redact=!0;model=null;groups=[];constructor(e,s){this.handlers=s,this.pane=e,this.title=Zc(e,".pane-title"),this.modeSpan=Zc(e,".pane-mode"),this.redactBlock=Zc(e,".tags-redact"),this.redactBlock.addEventListener("click",()=>this.redact_set(!this.redact));const i=Zc(e,".tags-panel");this.listing=new Ir({mount:i,traits:this.groupTraits_declare(),key:n=>n.group,chrome:{root:e,prefix:"tags"},caps:"root",row:{className:()=>"tags-group-row",groupClassName:n=>`tags-group tags-group-${n.group}`,decorate:n=>{n.title="fold this group open or shut (it keeps its place)"}},child:sa(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:n=>n.items.length>0,row:{className:n=>`tags-row${n.phi?" tags-phi":""}`,groupClassName:()=>"tags-sequence",decorate:(n,r)=>{n.title=r.items.length>0?`${r.name}: fold the sequence open or shut`:`${r.tag} ${r.name}`}},child:sa(n=>n.items,{traits:this.itemTraits_declare(),key:n=>n.key,row:{className:()=>"tags-item-row",groupClassName:()=>"tags-item"},child:sa(n=>n.rows,{traits:this.tagTraits_declare(),key:n=>n.key,activatable:()=>!1,row:{className:n=>`tags-row tags-row-deep${n.phi?" tags-phi":""}`}})})}),state:n=>this.stateLine_compose(n),empty:()=>_$("NO TAGS")}),this.redactBlock_paint(),this.listing.rows_set([],{field:"tags"})}model_show(e){this.model=e,this.title.textContent=`TAGS ${m$(e)}`,this.pane.dataset.modality=g$(e),this.groups=p$(e),this.listing.rows_set([{key:e.path,rows:this.groups}],{field:e.path}),this.listing.open_set(0,this.groups.map(s=>s.group).filter(s=>!u$.has(s))),this.modeSpan.textContent=e.subject==="folder"?"FOLDER":""}path_get(){return this.model?.path??null}redact_get(){return this.redact}redact_set(e){this.redact=e,this.redactBlock_paint(),this.model!==null&&this.listing.rows_set([{key:this.model.path,rows:this.groups}],{field:this.model.path})}filter_set(e){if(e===null){this.listing.filter_toggle(!1);return}this.listing.filter_toggle(!0),this.listing.filter_set(e)}stateLine_compose(e){const s=this.groups.reduce((n,r)=>n+r.rows.length,0),i=[];return this.model!==null&&this.model.subject==="folder"&&(i.push(this.model.read===this.model.of?`${this.model.read} FILES`:`${this.model.read} OF ${this.model.of} FILES`),this.model.refused.length>0&&i.push(`REFUSED ${this.model.refused.length}`)),i.push(e.filter!==""?e.filter:`${s} TAGS`),this.redact&&i.push("REDACTED"),i.join(" · ")}redactBlock_paint(){this.redactBlock.textContent=this.redact?"REDACT ON":"REDACT OFF",this.redactBlock.classList.toggle("rail-off",!this.redact),this.pane.classList.toggle("tags-redacted",this.redact)}value_cell(e){const s=document.createElement("span");if(s.className="tags-value",e.phi&&this.redact)return s.textContent=av,s.title="identifying value, redacted; the REDACT block on the frame reveals it",s;if(s.textContent=e.value,e.decoded!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` ${e.decoded}`,s.appendChild(i)}if(e.distinct!==void 0){const i=document.createElement("span");i.className="tags-decoded",i.textContent=` (${e.distinct} distinct)`,s.appendChild(i)}return s}groupTraits_declare(){return[nf(()=>!0),{key:"group",label:"GROUP",className:"tags-group-name",width:"minmax(12em, 1fr)",cell:e=>e.group.toUpperCase(),compare:e=>E1.indexOf(e.group)},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}tagTraits_declare(){return[nf(e=>e.items.length>0),{key:"tag",label:"TAG",className:"tags-tag",width:"7em",cell:e=>e.tag,compare:e=>e.tag},{key:"name",label:"NAME",className:"tags-name",width:"minmax(8em, 1.4fr)",cell:e=>e.name,compare:e=>e.name.toLowerCase()},{key:"vr",label:"VR",className:"tags-vr",width:"2.4em",cell:e=>e.vr,compare:e=>e.vr},{key:"value",label:"VALUE",className:"tags-value-cell",width:"minmax(6em, 2fr)",cell:e=>this.value_cell(e),compare:e=>(e.phi&&this.redact?av:`${e.value} ${e.decoded??""}`).toLowerCase()}]}itemTraits_declare(){return[nf(()=>!0),{key:"item",label:"ITEM",className:"tags-item-name",width:"minmax(12em, 1fr)",cell:e=>`ITEM ${e.index}`,compare:e=>e.index},{key:"count",label:"TAGS",className:"tags-group-count",width:"5em",cell:e=>String(e.rows.length),compare:e=>e.rows.length}]}}function nf(t){return{key:"fold",label:"",className:"tags-fold",capped:!1,width:"1.4em",cell:e=>{const s=document.createElement("span");return s.className=t(e)?"tags-fold":"tags-fold tags-fold-none",s}}}function p$(t){const e=new Map;for(const s of t.constant){const i=s.group;e.has(i)||e.set(i,[]),e.get(i)?.push(A1(s,`${i}/${s.tag}`))}return t.varying.length>0&&e.set("varying",t.varying.map(s=>({tag:s.tag,name:s.name,vr:s.vr,value:s.distinct===1?s.first:`${s.first} .. ${s.last}`,phi:s.phi,items:[],distinct:s.distinct,key:`varying/${s.tag}`}))),E1.filter(s=>e.has(s)).map(s=>({group:s,rows:e.get(s)??[]}))}function A1(t,e){return{tag:t.tag,name:t.name,vr:t.vr,value:t.value,...t.decoded!==void 0?{decoded:t.decoded}:{},phi:t.phi,items:(t.items??[]).map((s,i)=>({index:i+1,key:`${e}/${i+1}`,rows:s.map(n=>A1(n,`${e}/${i+1}/${n.tag}`))})),key:e}}function m$(t){const e=t.path.replace(/\/$/,"").split("/").pop()??t.path;if(t.subject==="folder")return e.length>24?`${e.slice(0,22)}…`:e;const s=/^(\d+)-/.exec(e)?.[1];return s!==void 0?`INSTANCE ${Number(s)}`:e.length>24?`${e.slice(0,22)}…`:e}function g$(t){const e=(t.constant.find(s=>s.name==="Modality")?.value??"").toUpperCase();return e==="MR"||e==="CT"||e==="PT"?e:"OT"}function _$(t){const e=document.createElement("div");return e.className="tags-note",e.textContent=t,e}function Zc(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`tags pane: missing ${e}`);return s}function b$(t,e){const s=qi("tpl-pane-image"),i=new d$(s,{source:{url_resolve:n=>t.vfsUrl_build(n)},note:n=>t.terminal().line_note(n),regard:n=>t.subjects().regard_write(e,{address:n,modelKind:"dicom.instance"}),file_put:async(n,r)=>{try{return(await fetch(t.vfsUrl_build(n),{method:"POST",body:r})).status}catch{return 0}},tags_read:n=>o_(t,n),tags_open:()=>{t.terminal().line_note(T1(t,e))}});return t.panels().set("image",e,i),{id:e,kind:"image",mount:s,dispose:()=>{i.dispose(),t.panels().delete(e),t.subjects().pane_leave(e)}}}function M$(t,e){const s=qi("tpl-pane-tags"),i=new f$(s,{note:n=>t.terminal().line_note(n)});return t.panels().set("tags",e,i),{id:e,kind:"tags",mount:s,dispose:()=>{t.panels().delete(e),t.subjects().pane_leave(e)}}}async function o_(t,e){try{const s=await t.client().line_execute(`dcm tags "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!==Qo.tags)continue;const n=cz.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}function v$(t,e,s){const i=t.panels().get("tags",e);i===void 0||i.path_get()===s||o_(t,s).then(n=>{if(n===null){t.terminal().line_note(`tags: ${s}: not a readable DICOM file`);return}t.panels().get("tags",e)?.model_show(n)})}function T1(t,e){const s=new Set(t.layout().panes_shown()),i=t.subjects().group_resolve(e);for(const r of t.panels().ids("tags"))if(s.has(r)&&t.subjects().group_resolve(r)===i)return t.layout().focus_set(r),"image tags";if(!s.has(e))return"image tags: the image pane is not on stage";const n=t.instance_spawn("tags",e);return t.layout().leaf_split(e,t.desktop().replayPlace_get()?.dir??"col",n.id,t.desktop().replayPlace_get()?.before??!1)?(t.birth_record(n.id,e,t.desktop().replayPlace_get()?.dir??"col",t.desktop().replayPlace_get()?.before??!1),"image tags"):(As(n.id),t.layout().mount_remove(n.id),"image tags: could not open beside the image pane")}async function cm(t,e){try{const s=await t.client().line_execute(`dcm series "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!==Qo.series)continue;const n=hz.safeParse(i.model.data);if(n.success)return n.data}}catch{}return null}async function I1(t,e){try{const s=await t.client().line_execute(`ls "${e}"`,{silent:!0,observe:!1});for(const i of s.envelopes){if(i.model?.kind!=="fs.listing")continue;const n=i.model.data,r=(Array.isArray(n)?n[0]:n)??{},o=(r.path??e).replace(/\/$/,"");return(r.items??[]).filter(a=>a.type==="dir").map(a=>`${o}/${a.name}`)}}catch{}return[]}function D1(t,e,s){const i=l=>{s!==void 0&&t.subjects().regard_write(l,s)};if(e!==null&&t.panels().has("image",e))return i(e),t.panels().get("image",e)??null;const n=new Set(t.layout().panes_shown());if(s!==void 0){for(const[l,c]of t.panels().entries("image"))if(n.has(l)&&t.subjects().regard_get(l)?.address===s.address)return i(l),c}const r=e!==null?t.subjects().group_resolve(e):null;for(const[l,c]of t.panels().entries("image"))if(n.has(l)&&r!==null&&t.subjects().group_resolve(l)===r)return c;const o=e!==null&&n.has(e)?e:t.errandHost_find();if(o===null)return null;const a=t.instance_spawn("image",e??void 0);return t.layout().leaf_split(o,t.desktop().replayPlace_get()?.dir??"col",a.id,t.desktop().replayPlace_get()?.before??!1)?(t.birth_record(a.id,o,t.desktop().replayPlace_get()?.dir??"col",t.desktop().replayPlace_get()?.before??!1),i(a.id),t.panels().get("image",a.id)??null):(As(a.id),t.layout().mount_remove(a.id),null)}async function w$(t,e,s,i={},n){t.launcher_yield();const r=e!==null?void 0:sp.test(s)?{address:s,modelKind:"image.volume"}:{address:$h.test(s)?s.slice(0,s.lastIndexOf("/")):s.replace(/\/$/,""),modelKind:"dicom.series"},o=D1(t,e,r);if(o===null)return"image: no pane to open beside";const a=t.panels().idOf("image",o);if(a!==null&&n?.(a),sp.test(s))return o.opening_show(s),o.volume_show(s),`image ${s}`;const l=$h.test(s),c=l?s.slice(0,s.lastIndexOf("/")):s.replace(/\/$/,"");o.opening_show(c);let h=await cm(t,c),d=[];if(h===null&&!l){const p=(await I1(t,c)).slice(0,32);for(const f of p){const _=await cm(t,f);if(_!==null){d=p.map(g=>({path:g,label:g.split("/").pop()??g})),h=_;break}}}if(h===null)return o.opening_fail(s,"NOT A READABLE SERIES"),`image: ${s}: not a readable DICOM series, study, or volume`;const u=l?Math.max(1,h.files.indexOf(s)+1):1;return o.series_show(h,{siblings:d,startAt:u,...i.force===!0?{force:!0}:{}}),`image ${h.path}${d.length>1?` (1 of ${d.length} series)`:""}`}function y$(t){return{imageInstance_build:e=>b$(t,e),tagsInstance_build:e=>M$(t,e),tags_ask:e=>o_(t,e),tagsPane_follow:(e,s)=>v$(t,e,s),tagsPane_open:e=>T1(t,e),series_ask:e=>cm(t,e),subfolders_ask:e=>I1(t,e),imagePane_resolve:(e,s)=>D1(t,e,s),image_open:(e,s,i={},n)=>w$(t,e,s,i,n)}}function z$(t){return{primaries:[t.panes.dag_build("dag",!0),t.panes.universe_build("universe"),{id:"pacs",kind:"pacs",mount:t.pacsMount}],domains:["dag","pacs"],presets:[["pacs",()=>({pane:"pacs"})],["dag",()=>({pane:"dag"})],["universe",()=>({pane:"universe"})]],factories:[["dag",e=>t.panes.dag_build(e,!1)],["universe",t.panes.universe_build],["image",t.dicom.imageInstance_build],["tags",t.dicom.tagsInstance_build],["gather",t.gather_build]]}}function S$(t){return async()=>{const e=await t.ask("proc feeds");let s=[];for(const d of e.envelopes){const u=d.model;if(u===void 0||u.kind!==Kf)continue;const p=qf.safeParse(u.data);p.success&&(s=p.data.feeds)}const n=s.length===0&&e.envelopes.some(d=>d.status==="error")?"INDEX WARMING":`${s.length} FEEDS`,r=s.filter(d=>/error/i.test(d.status)).length,o=s.filter(d=>/running|scheduled|created|started/i.test(d.status)).length,a={key:"universe",name:"UNIVERSE",hue:"--honey",numeral:"",figures:[{text:n}],rows:[],verb:"SEE THE SPACE",about:hn.universe,enter:()=>t.universe_show()},l={key:"analyses",name:"ANALYSES",hue:"--october-sunset",numeral:"3",figures:[{text:n},...o>0?[{text:`${o} RUNNING`}]:[],...r>0?[{text:`${r} ERRORED`,errored:!0,open:()=>t.runs_show("status:error")}]:[]],rows:s.slice(0,6).map(d=>({text:`${d.id} ${d.title}`,errored:/error/i.test(d.status),open:()=>t.feed_enter(d.id)})),verb:"OPEN THE ROSTER",about:hn.analyses,enter:()=>t.runs_show()},c=t.pacs_query(),h={key:"pacs",name:"PACS",hue:"--daybreak",numeral:"4",figures:[{text:c===""?"NO ANSWER":"ANSWERED"}],rows:c===""?[{text:"pacs query PatientID:…",open:()=>t.line_offer("pacs query PatientID:")},{text:"pacs query AccessionNumber:…",open:()=>t.line_offer("pacs query AccessionNumber:")}]:[{text:c.slice(0,48)}],verb:"ASK A PACS",about:hn.pacs,enter:()=>t.pacs_open()};return{lead:{tile:l,weight:s.length},afterFiles:[h],afterPanes:[a],about:{files:{text:"Your ChRIS home: uploads, results and what others shared with you."}}}}}const x$=["expired","failed","error"];function lv(t,e,s){for(const i of t.envelopes){if(i.model?.kind!==e)continue;const n=s(i.model.data);if(n.success&&n.data!==void 0)return n.data}return null}function O$(t){return t===null?"REGION":t.includes(":")?t.slice(t.indexOf(":")+1):t}function E$(t){return t.limit.replace(new RegExp(`^(standard-)?${t.family.toLowerCase()}-`),"").replace(/-count$/,"")}function A$(t){const e=t.available===null?`${t.value} PERMITTED`:`${t.available} / ${t.value} FREE`;return`${t.family.toUpperCase()} ${O$(t.zone)} ${E$(t)} ${e}`}function cv(t,e){return`${e==="USD"?"$":`${e} `}${t.toFixed(2)}`}function T$(t){return async()=>{const[e,s]=await Promise.all([t.ask("domain status"),t.ask("capacity")]),i=lv(e,mz,u=>bz.safeParse(u)),n=i?.domains??[];i!==null&&t.names_seen?.(n.map(u=>u.name));const r=u=>u.steps.some(p=>x$.includes(p.state)),o=n.filter(r).length,a=n.filter(u=>u.cost!==void 0&&u.cost!==null),l=a.reduce((u,p)=>u+(p.cost?.hourly??0),0),c={key:"domains",name:"DOMAINS",hue:"--october-sunset",numeral:"",figures:[{text:n.length===0?"NONE":`${n.length} DOMAIN${n.length===1?"":"S"}`},...o>0?[{text:`${o} NEED${o===1?"S":""} A LOOK`,errored:!0}]:[],...a.length>0?[{text:`${cv(l,a[0]?.cost?.currency??"USD")}/H`}]:[]],rows:n.slice(0,6).map(u=>({text:`${u.name} ${u.lastDone??"NOTHING DONE"}${u.cost!==void 0&&u.cost!==null?` ${cv(u.cost.hourly,u.cost.currency)}/h`:""} ${u.cluster??""}`.trimEnd(),errored:r(u),open:()=>t.domain_open(u.name)})),verb:"OPEN THE CONTROLLER",about:hn.domains,enter:()=>t.domain_open("")},h=lv(s,Hk,u=>qk.safeParse(u)),d={key:"capacity",name:"CAPACITY",hue:"--honey",numeral:"",figures:h===null?[{text:"NO FAMILY"}]:[{text:h.region.toUpperCase()}],rows:h===null?[{text:"capacity E5",open:()=>t.line_run("capacity E5")}]:h.rows.slice(0,6).map(u=>({text:A$(u),errored:u.available===0,open:()=>t.line_run(`capacity ${u.family}`)})),verb:"READ CAPACITY",about:hn.capacity,enter:()=>t.line_run("capacity")};return{lead:{tile:c,weight:n.length},afterFiles:[d],afterPanes:[],about:{files:{text:"Your home: the Trusted Domains this session knows, each a folder of its spec, settings, state and steps."}}}}}const gl=new Set([""]);function I$(t){const e=new Set(["",...t]);if(e.size===gl.size&&[...e].every(s=>gl.has(s)))return!1;gl.clear();for(const s of e)gl.add(s);return!0}function D$(t){return{subjects:{domain:gl},views:{},claims:{},listings:{},chords:[],lines:[{after:"view",line:"domain [<name>] (the TD controller takes the screen; every other domain line is the session's)"}],run:(e,s)=>{if(s.subject==="domain")return t().controller_open(s.words[0]??"")}}}function C$(t){return t>=6e4?`${Math.max(1,Math.round(t/6e4))} MIN`:`${Math.max(1,Math.round(t/1e3))} S`}function wi(t){return t.toLocaleString("en-US")}class R${mount;counts=null;context=null;msPerPage=null;walkSamples=new Map;clock;acts;state=void 0;constructor(e,s=()=>Date.now(),i={}){this.mount=e,this.clock=s,this.acts=i,this.render()}state_show(e){this.state=e,this.render()}pace_show(e){this.msPerPage=e,this.render()}eta_compute(e,s,i){const n=this.clock(),r=this.walkSamples.get(e);let o=r?.rowsPerMs??null;r!==void 0&&s>r.loaded&&n>r.at&&(o=(s-r.loaded)/(n-r.at)),(r===void 0||s!==r.loaded)&&this.walkSamples.set(e,{loaded:s,at:n,rowsPerMs:o});const a=Math.max(0,i-s);return i<=0?null:o!==null&&o>0?a/o:this.msPerPage!==null&&this.msPerPage>0?Math.ceil(a/100/4)*this.msPerPage:null}counts_show(e){this.counts=e,this.render()}promptContext_show(e){this.context=e,e.procIndex!==void 0&&(this.counts={jobs:e.procIndex.jobs,feeds:e.procIndex.feeds}),this.render()}rows_compose(){const e=[],s=this.context?.procWarmup,i=this.context?.warmupFailures??[],n=s!==void 0&&s.sweeping!==!1,r=this.counts!==null?`${wi(this.counts.jobs)} JOBS · ${wi(this.counts.feeds)} FEEDS`:"";if(i.length>0)e.push({label:"INDEX",bar:null,value:`${r}${r?" · ":""}FAILED: ${i.map(l=>l.label.toUpperCase()).join(" ")}`,title:i.map(l=>`${l.label}: ${l.message}`).join(`
|
|
4348
4348
|
`),degraded:!0});else if(n&&s!==void 0){const l=(s.state??"cold").toUpperCase();e.push({label:"INDEX",bar:{loaded:s.loaded,total:s.total??0,state:s.state==="failed"?"failed":"running"},value:`SWEEP ${wi(s.loaded)} / ${s.total!==void 0?wi(s.total):"?"} · ${l}`,title:"The global topology sweep: every plugin instance CUBE holds, walked page by page.",degraded:s.state==="failed"})}else e.push({label:"INDEX",bar:null,value:r?`${r} · CURRENT`:"CURRENT",title:"Nothing is moving: the process index is whole and current.",degraded:!1});if(this.state!==void 0){const l=this.state;e.push({label:"RUNNING",bar:null,value:`${wi(l.running)} IN ${wi(l.runningFeeds)} FEEDS · SCHEDULED ${wi(l.scheduled)}`,title:"Jobs running and waiting across every feed the index holds, from the roster's own counters.",degraded:!1,verb:this.acts.errored_open!==void 0?{label:`ERRORED ${wi(l.errored)} IN ${wi(l.erroredFeeds)} FEEDS`,title:"Open the runs roster filtered to the feeds with errored jobs.",act:this.acts.errored_open}:null})}const o=s?.feeds??(s?.feed!==void 0?[s.feed]:[]);for(const l of Array.from(this.walkSamples.keys()))o.some(c=>c.id===l)||this.walkSamples.delete(l);for(const l of o){const c=l.total>0?wi(l.total):"?";if(l.failed!==void 0)e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"failed"},value:`FAILED AT ${wi(l.loaded)} / ${c} · ${l.failed.toUpperCase()}`,title:"The walk stopped; the next visit to the feed starts it again.",degraded:!0});else{const h=this.eta_compute(l.id,l.loaded,l.total);e.push({label:`FEED ${l.id}`,bar:{loaded:l.loaded,total:l.total,state:"running"},value:`INDEXING ${wi(l.loaded)} / ${c}${h!==null?` · ETA ${C$(h)}`:""}`,title:"A feed is being indexed on its first visit; it opens when the walk lands.",degraded:!1})}}s?.roster!==void 0&&e.push({label:"ROSTER",bar:null,value:s.roster==="full"?"FULL WALK · every feed the identity can see":"DELTA · feeds newer than the roster knows",title:"The roster is being brought up to date; the listing answered from the cache and refreshes when arrivals land.",degraded:!1});const a=s?.arrived??[];return a.length>0&&e.push({label:"ARRIVED",bar:null,value:a.length<=3?a.map(l=>`FEED ${l}`).join(" · "):`${a.length} FEEDS`,title:"Feeds the roster gained: created here, or shared with this identity.",degraded:!1}),e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const s of e){const i=document.createElement("div");i.className="index-row telemetry-row",i.classList.toggle("status-degraded",s.degraded),i.title=s.title;const n=document.createElement("span");if(n.className="telemetry-label",n.textContent=s.label,i.appendChild(n),s.bar!==null){const o=document.createElement("span");o.className=`index-bar listing-progress listing-progress-${s.bar.state}`;const a=document.createElement("span");a.className="listing-progress-fill";const l=s.bar.total>0?Math.min(100,Math.round(s.bar.loaded/s.bar.total*100)):0;a.style.width=`${l}%`,o.appendChild(a),i.appendChild(o)}const r=document.createElement("span");if(r.className="telemetry-value",r.textContent=s.value,i.appendChild(r),s.verb!==void 0&&s.verb!==null){const o=document.createElement("button");o.type="button",o.className="index-verb pacs-capsule",o.textContent=s.verb.label,o.title=s.verb.title,o.addEventListener("click",s.verb.act),i.appendChild(o)}this.mount.appendChild(i)}}}function k$(t,e){const s=new R$(t,()=>Date.now(),{errored_open:()=>e.runs_show("status:error")});return{promptContext_take:i=>{s.promptContext_show(i),e.dag_primary().promptContext_observe(i);for(const n of e.universes())n.promptContext_observe(i)},telemetry_take:(i,n)=>{s.counts_show(i),n?.state!==void 0&&s.state_show(n.state),n?.cube!==void 0&&s.pace_show(n.cube.msPerPage)},progress_take:i=>{for(const n of e.dag_instances())n.progress_observe(i);e.pacs().progress_observe(i)}}}class N${container;title;handlers;currentAddress=null;constructor(e,s,i){this.container=e,this.title=s,this.handlers=i,this.awaiting_render()}regard_show(e){if(this.currentAddress=e.address,this.title.textContent=`VIEWER — ${e.address}`.toUpperCase(),this.handlers.path_isImage(e.address)){this.container.replaceChildren();const s=document.createElement("img");s.className="files-image",s.src=this.handlers.imageUrl_build(e.address),s.alt=e.address,this.container.appendChild(s);return}this.handlers.content_fetch(e.address).then(s=>{if(this.currentAddress!==e.address)return;if(this.container.replaceChildren(),s.trim().length===0){const n=document.createElement("p");n.className="files-empty",n.textContent=`NO PREVIEW — ${e.address.toUpperCase()}`,this.container.appendChild(n);return}const i=document.createElement("pre");i.className="files-content",i.textContent=s,this.container.appendChild(i)})}awaiting_render(){this.container.replaceChildren();const e=document.createElement("p");e.className="files-empty",e.textContent="NO REGARD — INDICATE A FILE OR NODE IN THIS PANE’S GROUP",this.container.appendChild(e)}}class B${groups=new Map;membership=new Map;writeObserver=null;writeObserver_set(e){this.writeObserver=e}pane_join(e,s){this.pane_leave(e),this.membership.set(e,s),this.groups.has(s)||this.groups.set(s,{value:null,subscribers:new Map,viewers:new Set})}pane_leave(e){const s=this.membership.get(e);if(s===void 0)return;this.membership.delete(e);const i=this.groups.get(s);if(i!==void 0){i.subscribers.delete(e),i.viewers.delete(e);for(const n of this.membership.values())if(n===s)return;this.groups.delete(s)}}group_resolve(e){const s=this.membership.get(e);return s!==void 0?s:(this.pane_join(e,e),e)}viewer_mark(e){this.groups.get(this.group_resolve(e))?.viewers.add(e)}groupHasViewer(e){const s=this.groups.get(this.group_resolve(e));return s!==void 0&&s.viewers.size>0}regard_write(e,s){const i=this.group_resolve(e),n=this.groups.get(i),r={...s,paneId:e};n.value=r;for(const o of n.subscribers.values())o(r);this.writeObserver?.(r,i)}regard_subscribe(e,s){const i=this.groups.get(this.group_resolve(e));i.subscribers.set(e,s),i.value!==null&&s(i.value)}regard_get(e){return this.groups.get(this.group_resolve(e))?.value??null}}const rf=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],G$=new Set(["done","error","unconfirmed","stalled","timeout"]),P$={shell:"`!` runs on its host",pipes:"pipes run on its host",files:"upload/download reach its disk",tasks:"jobs may change the cloud and bill"};function L$(t){return t.length===0?"":`Calypso was started with --host-control: ${t.map(e=>P$[e]??e).join("; ")}.`}function W$(t,e){const s=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const i=`${e.operation}:`;for(const n of[...t])(n===s||n.startsWith(i))&&t.delete(n);return}if(e.itemId!==void 0&&e.status!==void 0&&G$.has(e.status)){t.delete(s);return}t.add(s)}const F$=100;class U${fields;buildShown=!1;running=new Set;activityTimer=null;activityFrame=0;constructor(e){this.fields={identity:sr(e,"status-identity"),jobs:sr(e,"status-jobs"),activity:sr(e,"status-activity"),latency:sr(e,"status-latency"),mismatch:sr(e,"status-mismatch"),lamp:sr(e,"status-lamp"),host:sr(e,"status-host"),questions:sr(e,"status-questions")}}attach_show(e){if(e.protocolVersion!==Bf){this.fields.mismatch.textContent=`WIRE V${e.protocolVersion} ≠ V${Bf}`,this.fields.mismatch.title="This surface and the daemon speak different contract versions. Some messages may be dropped.",this.hostControl_show(e.hostControl??[]);return}this.fields.mismatch.textContent="",this.fields.mismatch.title=e.stack!==void 0?`chell ${e.stack.chell} · calypso ${e.stack.calypso} · build ${e.stack.build}`:"",this.hostControl_show(e.hostControl??[])}build_show(e,s=""){this.fields.mismatch.textContent!==""&&!this.buildShown||(this.buildShown=e!==null,this.fields.mismatch.textContent=e??"",this.fields.mismatch.title=s)}hostControl_show(e){this.fields.host.textContent=e.length>0?`HOST ${e.join(" ")}`:"",this.fields.host.title=L$(e)}questions_show(e){this.fields.questions.textContent=e.length>0?`? ${e.length} WAITING`:"",this.fields.questions.title=e.map(s=>`surface ${s.surface.slice(0,6)} asks "${s.message.trim()}" (${Math.round(s.sinceMs/1e3)} s); its command is paused until answered there`).join(`
|
|
4349
4349
|
`)}promptContext_show(e){const s=e.uri.replace(/^https?:\/\//,"");this.fields.identity.textContent=`${e.user}@${s}`.toUpperCase();const i=e.procWarmup,n=[];if(i!==void 0&&i.sweeping!==!1){const a=i.total!==void 0?`/${i.total}`:"",l=i.state!==void 0?` ${i.state.toUpperCase()}`:"";n.push(`JOBS ${i.loaded}${a}${l}`)}const r=i?.feeds??(i?.feed!==void 0?[i.feed]:[]);for(const a of r){const l=a.total>0?`/${a.total}`:"";n.push(a.failed!==void 0?`FEED ${a.id} FAILED ${a.loaded}${l}`:`FEED ${a.id} ${a.loaded}${l}`)}i?.roster!==void 0&&n.push(i.roster==="full"?"ROSTER WALK":"ROSTER DELTA"),i?.arrived!==void 0&&i.arrived.length>0&&n.push(i.arrived.length<=2?`+FEED ${i.arrived.join(" ")}`:`+${i.arrived.length} FEEDS`);const o=e.warmupFailures??[];o.length>0&&n.push(`WARM-UP FAILED: ${o.map(a=>a.label.toUpperCase()).join(" ")}`),this.fields.jobs.textContent=n.join(" · "),this.fields.jobs.classList.toggle("status-degraded",o.length>0),this.fields.jobs.title=o.length>0?o.map(a=>`${a.label}: ${a.message}`).join(`
|
|
4350
4350
|
`):r.length>0?"A feed is being indexed on its first visit; it opens when the walk completes.":"",this.fields.latency.textContent=e.lastCommandDurationMs>0?`${e.lastCommandDurationMs}MS`:""}progress_observe(e){W$(this.running,e),this.activity_paint()}activity_clear(){this.running.clear(),this.activity_paint()}connection_show(e){this.fields.lamp.textContent=e?"ONLINE":"OFFLINE",this.fields.lamp.classList.toggle("lamp-online",e),this.fields.lamp.classList.toggle("lamp-offline",!e),e||this.activity_clear()}activity_paint(){if(this.running.size===0){this.activityTimer!==null&&(clearInterval(this.activityTimer),this.activityTimer=null),this.fields.activity.textContent="";return}const e=()=>{const s=rf[this.activityFrame]??rf[0];this.fields.activity.textContent=`${s} ${this.running.size} RUNNING`};e(),this.activityTimer===null&&(this.activityTimer=window.setInterval(()=>{this.activityFrame=(this.activityFrame+1)%rf.length,e()},F$))}}function sr(t,e){const s=t.getElementById(e);if(s===null)throw new Error(`status bar: no element with id '${e}'`);return s}const $$=3e3;class j${mount;clock;lane=void 0;cube=void 0;beatAt=null;constructor(e,s=()=>Date.now()){this.mount=e,this.clock=s,this.render()}telemetry_show(e={}){this.beatAt=this.clock(),e.lane!==void 0&&(this.lane=e.lane),e.cube!==void 0&&(this.cube=e.cube),this.render()}tick(){this.render()}rows_compose(){const e=[],s=this.lane;if(s===void 0)e.push({label:"LANE",value:"—",title:"The daemon has not said what holds its lane (an older daemon).",degraded:!1});else if(s.running===null)e.push({label:"LANE",value:s.waiting>0?`IDLE · ${s.waiting} WAITING`:"IDLE",title:"The serialized command lane: nothing is executing.",degraded:!1});else{const r=(s.running.sinceMs/1e3).toFixed(1);e.push({label:"LANE",value:`${s.running.line} · ${r} S${s.waiting>0?` · ${s.waiting} WAITING`:""}`,title:`The command holding the lane${s.running.surface?`, from surface ${s.running.surface}`:""}; every other command waits behind it.`,degraded:s.running.sinceMs>=1e4})}const i=s?.questions??[];if(i.length>0){const r=i.reduce((o,a)=>o.sinceMs>=a.sinceMs?o:a);e.push({label:"ASKING",value:`${i.length} · ${r.message.trim()} · ${(r.sinceMs/1e3).toFixed(0)} S`,title:"Questions open in the session. A command waiting on one has stepped out of the lane; it resumes when answered on the surface that asked.",degraded:!1})}if(this.beatAt===null)e.push({label:"BEAT",value:"NONE YET",title:"No telemetry heartbeat has landed.",degraded:!1});else{const r=Math.max(0,this.clock()-this.beatAt);e.push({label:"BEAT",value:`${(r/1e3).toFixed(1)} S AGO`,title:"The age of the last telemetry heartbeat; the daemon beats once a second while a surface is attached.",degraded:r>=$$})}const n=this.cube;if(n===void 0)e.push({label:"CUBE",value:"NO PAGE TIMED",title:"CUBE's pace is known once a page of a list has been fetched.",degraded:!1});else{const r=n.msPerPage>0?Math.round(6e4/n.msPerPage):0;e.push({label:"CUBE",value:`${(n.msPerPage/1e3).toFixed(1)} S/PAGE · ${r} PAGES/MIN`,title:`The median of the last ${n.samples} page fetches (100 rows each).`,degraded:!1})}return e}render(){const e=this.rows_compose();this.mount.replaceChildren();for(const s of e){const i=document.createElement("div");i.className="lane-row telemetry-row",i.classList.toggle("status-degraded",s.degraded),i.title=s.title;const n=document.createElement("span");n.className="telemetry-label",n.textContent=s.label;const r=document.createElement("span");r.className="telemetry-value",r.textContent=s.value,i.append(n,r),this.mount.appendChild(i)}}}const H$=[2,3,3,2,2,11,2,2],V$=4,hv=300,q$=2600,K$=650;class Y${wrapper;cells=[];bootedAt=Date.now();telemetry={jobsLoaded:0,jobsTotal:0,feeds:0,lastLatencyMs:0,latencySumMs:0,lastExitCode:0,commandsRun:0,opsActive:0,opsDone:0,opsFailed:0,itemsCurrent:0,itemsTotal:0,connected:0};activeOperations=new Set;telemetryRows=[];constructor(e){if(this.wrapper=e,e===null){window.setInterval(()=>this.beat_paint(),hv);return}const s=this.narrowSources_list(),i=this.wideSources_list();let n=0,r=0;for(const o of H$){const a=document.createElement("div");a.className="data-column";for(let l=1;l<=V$;l++){const c=document.createElement("div");c.className=`dc-row-${l}`;let h;o>=6?(h=i[r%i.length],r++):(h=s[n%s.length],n++);const d={element:c,width:o,source:h??(()=>0)};c.textContent=dv(d.source(),o),a.appendChild(c),this.cells.push(d)}e.appendChild(a)}window.setInterval(()=>this.beat_paint(),hv),this.sweep_start()}promptContext_observe(e){const s=e.procWarmup;s!==void 0&&(this.telemetry.jobsLoaded=s.loaded,this.telemetry.jobsTotal=s.total??s.loaded);const i=e.procIndex;i!==void 0&&(s===void 0&&(this.telemetry.jobsLoaded=i.jobs,this.telemetry.jobsTotal=i.jobs),this.telemetry.feeds=i.feeds),e.lastCommandDurationMs>0&&(this.telemetry.lastLatencyMs=e.lastCommandDurationMs,this.telemetry.latencySumMs+=e.lastCommandDurationMs,this.telemetry.commandsRun++),this.telemetry.lastExitCode=e.lastExitCode}progress_observe(e){const s=`${e.operation}:${e.itemId??""}`;if(e.phase==="complete"||e.phase==="failed"){const i=`${e.operation}:`;for(const n of[...this.activeOperations])(n===s||n.startsWith(i))&&this.activeOperations.delete(n);e.status==="error"||e.phase==="failed"?this.telemetry.opsFailed++:this.telemetry.opsDone++}else e.itemId!==void 0&&e.status!==void 0&&["done","error","unconfirmed","stalled","timeout"].includes(e.status)?this.activeOperations.delete(s):this.activeOperations.add(s);this.telemetry.opsActive=this.activeOperations.size,e.current!==void 0&&(this.telemetry.itemsCurrent=e.current),e.total!==void 0&&(this.telemetry.itemsTotal=e.total)}index_observe(e){this.telemetry.jobsLoaded=e.jobs,this.telemetry.jobsTotal=e.jobs,this.telemetry.feeds=e.feeds}connection_show(e){this.telemetry.connected=e?1:0,this.wrapper?.classList.toggle("dc-stale",!e)}telemetryPanel_bind(e){const s=this.telemetry,i=[["LINK",()=>s.connected===1?"ONLINE":"OFFLINE"],["JOBS INDEXED",()=>`${s.jobsLoaded} / ${s.jobsTotal}`],["FEEDS VISIBLE",()=>String(s.feeds)],["OPS ACTIVE",()=>String(s.opsActive)],["OPS DONE",()=>String(s.opsDone)],["OPS FAILED",()=>String(s.opsFailed)],["ITEMS",()=>`${s.itemsCurrent} / ${s.itemsTotal}`],["LAST COMMAND",()=>`${s.lastLatencyMs} MS`],["LATENCY SUM",()=>`${s.latencySumMs} MS`],["COMMANDS RUN",()=>String(s.commandsRun)],["LAST EXIT",()=>String(s.lastExitCode)],["UPTIME",()=>`${this.uptimeSeconds_get()} S`]];for(const[n,r]of i){const o=document.createElement("div");o.className="telemetry-row";const a=document.createElement("span");a.className="telemetry-label",a.textContent=n;const l=document.createElement("span");l.className="telemetry-value",l.textContent=r(),o.append(a,l),e.appendChild(o),this.telemetryRows.push({element:l,source:r})}}narrowSources_list(){const e=this.telemetry;return[()=>e.jobsLoaded,()=>e.feeds,()=>e.lastLatencyMs,()=>e.opsActive,()=>e.opsDone,()=>e.jobsTotal,()=>e.itemsCurrent,()=>e.itemsTotal,()=>e.opsFailed,()=>e.commandsRun,()=>e.lastExitCode,()=>new Date().getSeconds(),()=>this.uptimeSeconds_get()]}wideSources_list(){return[()=>Math.floor(Date.now()/1e3),()=>this.uptimeSeconds_get(),()=>this.telemetry.latencySumMs,()=>X$()]}uptimeSeconds_get(){return Math.floor((Date.now()-this.bootedAt)/1e3)}beat_paint(){for(const e of this.cells){const s=dv(e.source(),e.width);e.element.textContent!==s&&(e.element.textContent=s)}for(const e of this.telemetryRows){const s=e.source();e.element.textContent!==s&&(e.element.textContent=s)}}sweep_start(){if(this.wrapper===null)return;const e=Array.from(this.wrapper.querySelectorAll(".data-column"));window.setInterval(()=>{const s=e[Math.floor(Math.random()*e.length)];s!==void 0&&(s.classList.add("dc-sweep"),window.setTimeout(()=>s.classList.remove("dc-sweep"),K$))},q$)}}function dv(t,e){const s=String(Math.max(0,Math.floor(t)));return s.length>e?s.slice(s.length-e):s.padStart(e,"0")}function X$(){const t=new Date;return t.getHours()*1e4+t.getMinutes()*100+t.getSeconds()}const Z$=2e4;class J${scene;nameplate;command_run;names=[];cursor=0;timer=null;seen=new Map;constructor(e,s,i){this.nameplate=s,this.command_run=i,this.scene=new Gd(e,{},{ambient:!0}),new MutationObserver(()=>this.scene.palette_refresh()).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),new MutationObserver(()=>{window.setTimeout(()=>this.scene.size_fit(),60)}).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.addEventListener("resize",()=>this.scene.size_fit())}names_set(e){this.names=e,this.cursor=0,this.timer!==null&&(window.clearInterval(this.timer),this.timer=null),e.length!==0&&(this.next_request(),e.length>1&&(this.timer=window.setInterval(()=>this.next_request(),Z$)))}envelope_observe(e){if(e.model?.kind!==br.pipelineDiagram)return;const s=_g.safeParse(e.model.data);if(!s.success)return;const i=s.data;this.seen.set(i.name,i),this.model_stage(i)}model_stage(e){this.nameplate.textContent=e.name,this.scene.graph_set({nodes:e.nodes.map(s=>({id:s.id,label:s.label,parentIds:s.parentIds,joinParentIds:s.joinParentIds}))}),this.scene.size_fit()}next_request(){const e=this.names[this.cursor%this.names.length];if(this.cursor++,e===void 0)return;const s=this.seen.get(e);if(s!==void 0){this.model_stage(s);return}this.command_run(`pipeline diagram ${e}`)}}function Q$(t,e){t.line_execute("ls /bin",{silent:!0,observe:!1}).then(s=>{const r=(s.envelopes.find(o=>o.model?.kind==="fs.listing")?.model?.data??[]).flatMap(o=>o.items).filter(o=>o.type==="pipeline").map(o=>o.name);e.names_set(r)})}const uv=new Set(["layout","slice","series","wl","colormap","save","tags","load","guard","ghost","state"]);function ej(t,e,s,i,n){if(s==="layout")return qr(t,e,".dag-strategy",i.toUpperCase())?`layout ${i}`:"dag layout ranked|molecule";if(s==="projection")return qr(t,e,".dag-projection",i.toUpperCase())?`projection ${i}`:"dag projection 2d|3d";if(s==="scale")return qr(t,e,".dag-scale",i.toUpperCase())?`scale ${i}`:"dag scale time|size";if(s==="hue")return qr(t,e,".dag-hue",i.toUpperCase())?`hue ${i}`:"dag hue status|compute";const r=(o,a,l,c)=>{const h=i.toLowerCase();return h==="on"||h==="off"?qr(t,e,o,h==="on"?l:c)?`${a} ${h}`:`dag ${a}: no mode frame`:h!==""?`dag ${a} on|off`:Rn(t,e,o)?`${a} toggled`:`dag ${a}: no mode frame`};if(s==="pulse")return r(".dag-pulse","pulse","PULSE ON","PULSE OFF");if(s==="census")return r(".dag-census","census","CENSUS","SHAPE");if(s==="gravity")return r(".dag-gravity","gravity","GRAVITY ON","GRAVITY OFF");if(s==="draw")return qr(t,e,".dag-draw",i.toUpperCase())?`draw ${i}`:"dag draw spheres|stars";if(s==="select")return i===""?"dag select <feed or job>":t.dag_jump(e,i)?`selecting ${i}`:"dag select: no RUNS pane (view runs)";if(s==="enter")return i===""?"dag enter <job>":t.dag_jump(e,i,!0)?`entering ${i}`:"dag enter: no RUNS pane (view runs)";if(s==="refresh")return fh(t,e,"REFRESH")?"refreshing":"dag refresh: no DAG pane";if(s==="physics"){const o=i,a=t.paneMount_get(e),l=a?.querySelector(".pane-dag")??a;if(l===null)return"dag physics: no DAG pane";if(o==="reset")return l.dispatchEvent(new CustomEvent("argus:dag-physics",{detail:"reset"})),"physics reset";const c=(n[2]??"on").toLowerCase()!=="off";return["charge","link","collide","gravity"].includes(o)?(l.dispatchEvent(new CustomEvent("argus:dag-physics",{detail:{term:o,on:c}})),`physics ${o} ${c?"on":"off"}`):`dag physics: unknown term '${o}' (charge|link|collide|gravity|reset)`}return`dag: unknown verb '${s}' (layout|projection|scale|hue|draw|pulse|census|gravity|select|enter|physics|refresh)`}function tj(t,e,s){return s==="enter"?fh(t,e,"ENTER NODE")?"entering node":"node enter: no DAG drawer":s==="back"?fh(t,e,"BACK")?"node back":"node back: no DAG drawer":s==="immerse"?t.node_immerse(e)?"immersing":"node immerse: nothing indicated":s==="clear"?fh(t,e,"CLEAR DETAIL")?"detail cleared":"node clear: no DAG drawer":`node: unknown verb '${s}' (enter|immerse|back|clear)`}function sj(t){return{subjects:{runs:null,node:null,dag:null,universe:null,pacs:new Set(["sort","filter"]),tags:new Set(["redact","filter"]),image:uv},views:{runs:{button:"gutter-runs",primary:"dag"},pacs:{button:"gutter-tools",primary:"pacs"}},claims:{runs:".empty-go-dag",pacs:".empty-go-pacs"},listings:{runs:{selector:".pane-dag",named:"DAG"},pacs:{selector:"#pacs-workspace",named:"PACS"}},chords:[{after:"1",key:"2",topic:"claim",selector:".empty-go-dag",does:"claim an empty pane as RUNS"},{after:"1",key:"3",topic:"claim",selector:".empty-go-pacs",does:"claim an empty pane as PACS"}],lines:[{after:"view",line:"runs enter <feedId> · sort <col> [asc|desc] · filter <text>|off"},{after:"view",line:"node enter · immerse · back · clear (the indicated node)"},{after:"view",line:"dag [@id] layout ranked|molecule · projection 2d|3d · scale time|size · hue status|compute · draw spheres|stars · pulse [on|off] · census [on|off] · gravity [on|off] · select <feed or job> · enter <job> · physics charge|link|collide|gravity on|off · physics reset · refresh"},{after:"file",line:"pacs sort <col> [asc|desc] · filter <text>|off (the results listing; every other pacs verb is the session's)"},{after:"file",line:"image [@id] [--force] <path> · layout single|mpr|3d|slab · slice <n> · series <n> · wl <lo> <hi> · wl preset <name> · colormap gray|hot|jet|cool · save · tags · load · guard <bytes>|off · ghost <0..1>|off · state"},{after:"file",line:"tags [@id] redact on|off · filter <text>|off (the pane that follows an image pane's slice)"}],run:(e,s,i)=>{const n=t(),{subject:r,words:o}=s,a=(o[0]??"").toLowerCase(),l=(o[1]??"").toLowerCase();if(r==="runs"){if(a==="enter"){const h=parseInt(l.replace(/^feed_/,""),10);return Number.isNaN(h)?"runs enter <feedId>":(n.feed_enter(h),`entering feed_${h}`)}return`runs: unknown verb '${a}' (enter)`}if(!["dag","image","tags","universe","node"].includes(r))return;const c=i();if(c===null)return`${r}: no target pane (nothing focused?)`;if(r==="dag")return ej(n,c,a,l,o);if(r==="image"){const h=o.filter(d=>d!=="--force");return uv.has((h[0]??"").toLowerCase())?n.image_control(c,a,o.slice(1)):null}return r==="tags"?n.tags_control(c,a,o.slice(1)):r==="universe"?n.universe_control(c,a,o.slice(1)):tj(n,c,a)}}}function Wl(t,e){if("pane"in t)return t.pane===e?[]:null;const s=Wl(t.first,e);if(s!==null)return[{node:t,side:"first"},...s];const i=Wl(t.second,e);return i!==null?[{node:t,side:"second"},...i]:null}function Fl(t,e,s){if(t===e)return s;if("pane"in t)return null;const i=Fl(t.first,e,s);if(i!==null)return{...t,first:i};const n=Fl(t.second,e,s);return n!==null?{...t,second:n}:null}function fv(t,e,s){const i=Wl(t,e);if(i===null||i.length===0)return"lone";const n=ki[s].axis,r=ki[s].place==="after"?"first":"second",o=i[i.length-1];let a=null;for(let d=i.length-1;d>=0;d-=1){const u=i[d];if(u.node.dir===n&&u.side===r){a=u.side==="first"?u.node.second:u.node.first;break}}if(a===null){if(o.node.dir===n)return"edge";a=o.side==="first"?o.node.second:o.node.first}const l=od(t,e);if(l===null)return"lone";const c={pane:e};return Fl(l,a,r==="first"?{dir:n,ratio:.5,first:a,second:c}:{dir:n,ratio:.5,first:c,second:a})??"edge"}const pv="argus-layout";class ij{root;mounts;presets=new Map;prefs={};activePreset="";tree=null;focusedPane=null;renderObserver=null;previousFocus=null;constructor(e,s){this.root=e,this.mounts=s;try{const i=window.localStorage.getItem(pv);this.prefs=i!==null?JSON.parse(i):{}}catch{this.prefs={}}}renderObserver_set(e){this.renderObserver=e}preset_register(e,s){this.presets.set(e,s)}mount_register(e,s){this.mounts.set(e,s)}mount_remove(e){this.mounts.delete(e),this.focusedPane===e&&(this.focusedPane=null)}leaf_split(e,s,i,n=!1){if(this.tree===null)return!1;const r=rd(this.tree,e,{dir:s,ratio:.5,first:n?{pane:i}:{pane:e},second:n?{pane:e}:{pane:i}});return r===null?!1:(this.tree=r,this.focus_move(i),this.render(),!0)}leaf_move(e,s){if(this.tree===null)return"lone";const i=fv(this.tree,e,s);return typeof i=="string"?i:(this.tree=i,this.focus_move(e),this.render(),!0)}focus_move(e){this.focusedPane!==null&&this.focusedPane!==e&&(this.previousFocus=this.focusedPane),this.focusedPane=e}focus_last(){const e=this.previousFocus;return e===null||!this.panes_shown().includes(e)?null:(this.focus_set(e),e)}leaf_flip(e){if(this.tree===null)return!1;const s=Wl(this.tree,e);if(s===null||s.length===0)return!1;const i=s[s.length-1],n={...i.node,dir:i.node.dir==="col"?"row":"col"},r=Fl(this.tree,i.node,n);return r===null?!1:(this.tree=r,this.render(),!0)}leaf_resize(e,s,i=.05){if(this.tree===null)return!1;const n=Wl(this.tree,e);if(n===null||n.length===0)return!1;const r=ki[s].axis;for(let o=n.length-1;o>=0;o-=1){const a=n[o];if(a.node.dir!==r)continue;const l=ki[s].place==="after",c=Math.min(.85,Math.max(.15,a.node.ratio+(l?i:-i))),h={...a.node,ratio:c},d=Fl(this.tree,a.node,h);return d===null?!1:(this.tree=d,this.ratio_remember(n.slice(0,o).map(u=>u.side==="first"?"0":"1").join(""),c),this.render(),!0)}return!1}move_possible(e,s){return this.tree!==null&&typeof fv(this.tree,e,s)!="string"}leaf_replace(e,s){if(this.tree===null)return!1;const i=rd(this.tree,e,{pane:s});return i===null?!1:(this.tree=i,this.focusedPane===e&&(this.focusedPane=s),this.render(),!0)}leaf_close(e){if(this.tree===null||"pane"in this.tree)return!1;const s=od(this.tree,e);return s===null?!1:(this.tree=s,this.focusedPane===e&&(this.focusedPane=null),this.render(),!0)}focused_get(){return this.focusedPane}savedPreset_get(){return this.prefs.preset!==void 0&&this.presets.has(this.prefs.preset)?this.prefs.preset:null}activePreset_get(){return this.activePreset}preset_has(e){return this.presets.has(e)}preset_apply(e){const s=this.presets.get(e);s!==void 0&&(this.activePreset=e,this.prefs.preset=e,this.prefs_save(),this.tree=this.ratios_restore(s(),e,""),this.render(),this.root.classList.remove("layout-arrive"),this.root.offsetWidth,this.root.classList.add("layout-arrive"))}tree_get(){return this.tree===null?null:JSON.parse(JSON.stringify(this.tree))}tree_set(e){this.tree=this.ratios_restore(e,this.activePreset,""),this.render()}panes_shown(){const e=[],s=i=>{if(i!==null){if("pane"in i){e.push(i.pane);return}s(i.first),s(i.second)}};return s(this.tree),e}render(){if(this.tree!==null){for(const e of this.mounts.values())e.remove();this.root.replaceChildren(this.node_render(this.tree,"")),this.focus_reconcile(),this.renderObserver?.()}}focus_reconcile(){const e=this.panes_shown();if(this.focusedPane!==null&&e.includes(this.focusedPane))return;const s=e[0];if(s===void 0)return;const i=this.focusedPane;this.focusedPane=null,this.focus_set(s),i!==null&&(this.previousFocus=i)}node_render(e,s){if("pane"in e){const a=document.createElement("div");a.className="layout-leaf",a.dataset.leaf=e.pane;const l=this.mounts.get(e.pane);return l!==void 0&&(a.appendChild(l),l.style.display="",a.addEventListener("mousedown",()=>this.focus_set(e.pane),{capture:!0}),e.pane===this.focusedPane&&a.classList.add("pane-focused")),a}const i=document.createElement("div");i.className=`layout-split layout-${e.dir}`;const n=this.node_render(e.first,`${s}0`),r=this.node_render(e.second,`${s}1`);n.style.flex=`${e.ratio} 1 0`,r.style.flex=`${1-e.ratio} 1 0`;const o=document.createElement("div");return o.className="layout-divider",this.divider_wire(o,i,e,n,r,s),i.append(n,o,r),i}divider_wire(e,s,i,n,r,o){let a=!1;e.addEventListener("mousedown",l=>{a=!0,l.preventDefault()}),window.addEventListener("mousemove",l=>{if(!a)return;const c=s.getBoundingClientRect(),h=i.dir==="col"?(l.clientX-c.left)/c.width:(l.clientY-c.top)/c.height;i.ratio=Math.min(.85,Math.max(.15,h)),n.style.flex=`${i.ratio} 1 0`,r.style.flex=`${1-i.ratio} 1 0`}),window.addEventListener("mouseup",()=>{a&&(a=!1,this.ratio_remember(o,i.ratio),this.renderObserver?.())})}focus_set(e){if(this.focusedPane===e)return;this.focusedPane!==null&&(this.previousFocus=this.focusedPane),this.focusedPane=e,document.body.dataset.focus=e;for(const i of this.root.querySelectorAll(".layout-leaf"))i.classList.remove("pane-focused");this.mounts.get(e)?.parentElement?.classList.add("pane-focused")}ratios_restore(e,s,i){if("pane"in e)return e;const n=this.prefs.ratios?.[`${s}:${i}`];return{...e,ratio:n??e.ratio,first:this.ratios_restore(e.first,s,`${i}0`),second:this.ratios_restore(e.second,s,`${i}1`)}}ratio_remember(e,s){this.prefs.ratios={...this.prefs.ratios??{},[`${this.activePreset}:${e}`]:s},this.prefs_save()}prefs_save(){try{window.localStorage.setItem(pv,JSON.stringify(this.prefs))}catch{}}}function rd(t,e,s){if("pane"in t)return t.pane===e?s:null;const i=rd(t.first,e,s);if(i!==null)return{...t,first:i};const n=rd(t.second,e,s);return n!==null?{...t,second:n}:null}function od(t,e){if("pane"in t)return null;if("pane"in t.first&&t.first.pane===e)return t.second;if("pane"in t.second&&t.second.pane===e)return t.first;const s=od(t.first,e);if(s!==null)return{...t,first:s};const i=od(t.second,e);return i!==null?{...t,second:i}:null}const nj=4e3;function rj(t){const e=new WeakMap,s=(a,l)=>{const c=t.paneInstance_get(a)?.mount.querySelector(".pane-state")??null;if(c===null)return;const h=e.get(c);h!==void 0&&clearTimeout(h);const d={text:c.textContent??"",className:c.className};ys(c,"note",l),e.set(c,setTimeout(()=>{e.delete(c),c.textContent===l&&(c.className=d.className,c.textContent=d.text)},nj))};return{bar_note:s,move:(a,l)=>{const c=t.layout.leaf_move(a,l);return c==="lone"?"pane move: the only pane on stage":c==="edge"?`pane move ${l}: already ${ki[l].edge}`:(s(a,`MOVED ${l.toUpperCase()}`),t.sound("audio3"),`moved ${l}`)},flip:a=>t.layout.leaf_flip(a)?(s(a,"FLIPPED"),t.sound("audio3"),"flipped"):"pane flip: the only pane on stage",resize:(a,l,c)=>t.layout.leaf_resize(a,l,c)?`resized ${ki[l].focusWord}`:`pane resize ${ki[l].focusWord}: no boundary that way`,chordKeys_format:(a,l)=>{const c=pn.filter(h=>h.selector===a&&h.move===!0===l).map(h=>h.key);return c.length===0?"":` [keys ${c.join(" ")}]`}}}const oj={image:"viewer",view:"viewer",dir:"files",fs:"files",tags:"tags",empty:"pane",domain:"dag",catalogue:"catalogue",graph:"dag",gather:"gather",edit:"editor"},of=240;function aj(t,e){const{layout:s,panels:i,paneInstance_get:n,dormant:r}=t,o=new Map;let a=!1,l=null;const c=y=>n(y)?.kind??null,h=(y,b,v,z,x)=>{o.set(y,{parent:b,dir:v,before:z,...x!==void 0?{binding:x}:{}})},d=y=>{if(y==="pacs")return"⊞";if(y==="dag")return"⋔";const b=c(y);return b==="image"?"▣":b==="tags"?"≣":b==="edit"?"✎":"▤"},u=y=>{if(y.length===0)return;const b=[];for(const I of y){const E=n(I)?.mount;if(E===void 0)continue;const O=E.getBoundingClientRect();O.width>0&&O.height>0&&b.push({id:I,left:O.left,top:O.top,width:O.width,height:O.height})}if(b.length===0)return;const v=Math.min(...b.map(I=>I.left)),z=Math.min(...b.map(I=>I.top)),x=Math.max(...b.map(I=>I.left+I.width))-v,M=Math.max(...b.map(I=>I.top+I.height))-z;if(x<=0||M<=0)return;const S=of/x,T=Math.max(40,Math.min(260,Math.round(M*S)));try{const I=document.createElement("canvas");I.width=of,I.height=T;const E=I.getContext("2d");if(E===null)return;const R=getComputedStyle(document.documentElement).getPropertyValue("--harvestgold").trim()||"#c9a15a";E.fillStyle="#05070a",E.fillRect(0,0,of,T);for(const C of b){const k=Math.round((C.left-v)*S),B=Math.round((C.top-z)*S),L=Math.max(6,Math.round(C.width*S)),F=Math.max(6,Math.round(C.height*S)),ee=n(C.id)?.mount.querySelector("canvas");if(ee!=null&&ee.width>0){const X=Math.min(L/ee.width,F/ee.height),he=Math.round(ee.width*X),Oe=Math.round(ee.height*X);E.fillStyle="#000",E.fillRect(k,B,L,F),E.drawImage(ee,k+Math.round((L-he)/2),B+Math.round((F-Oe)/2),he,Oe)}else E.fillStyle="rgba(255,255,255,0.05)",E.fillRect(k,B,L,F),E.fillStyle=R,E.font=`${Math.max(9,Math.min(28,Math.round(Math.min(L,F)*.5)))}px serif`,E.textAlign="center",E.textBaseline="middle",E.fillText(d(C.id),k+L/2,B+F/2+1);E.strokeStyle="rgba(255,255,255,0.22)",E.lineWidth=1,E.strokeRect(k+.5,B+.5,L-1,F-1)}return I.toDataURL("image/png")}catch{return}},p=(y,b,v)=>{const z=c(y),x=o.get(y),M={dir:x?.dir??"col",side:aB(x?.before??!1)};if(rv(y)){const T=b==="dag"?"runs":b,I=b==="pacs"?e.pacsQuery_get():null,E=b==="dag"?i.get("dag","dag"):void 0,O=E!==void 0&&E.graph_isShown()?E.feed_get():null,R=O!==null&&E!==void 0?E.view_lines():[],C=O!==null?E?.feedTitle_get():void 0;return{action:{op:"domain",domain:T,...I!==null?{query:I}:{},...O!==null?{feed:O}:{},...R.length>0?{view:R}:{}},...C!==void 0?{label:C}:{}}}if(x?.binding==="fs"||x?.binding==="view"||x?.binding==="empty")return{action:{op:x.binding,target:v,...M}};if(z==="image"){const T=i.get("image",y),I=T?.state_get()??null;if(T===void 0||I===null||I.path===null)return null;const E=[];I.layout!=="single"&&E.push(`image layout ${I.layout}`),I.colormap!==void 0&&I.colormap!=="gray"&&E.push(`image colormap ${I.colormap}`),I.voi!==void 0&&I.voi!==null&&E.push(`image wl ${I.voi.lower} ${I.voi.upper}`),I.slice>1&&E.push(`image slice ${I.slice}`),I.ghost!==void 0&&I.ghost!==null&&I.layout==="slab"&&E.push(`image ghost ${I.ghost}`);const O=T.series_get(),R=[O?.seriesDescription??"",O?.modality??""].filter(C=>C!=="");return{action:{op:"image",path:I.path,target:v,...M,...E.length>0?{view:E}:{}},anchor:I.path,...R.length>0?{label:R.join(" · ")}:{}}}const S=e.catalogue_find(y);if(S!==void 0){const T=i.get("files",y)?.commandLine_get()??"";return{action:{op:"catalogue",input:S.input,target:v,...M,...S.feed!==null?{feed:S.feed}:{},...S.node!==null?{node:S.node}:{},...T!==""?{line:T}:{}},label:`PROCESS ${S.input.split("/").filter(Boolean).pop()??S.input}`}}if(z==="files"){const T=i.get("files",y)?.path_current()??null;return typeof T!="string"||T.length===0?null:{action:{op:"dir",path:T,target:v,...M}}}if(z==="gather"){const T=i.get("gather",y);if(T===void 0)return null;const I=[...T.entries_get()],E=T.name_get(),O=T.feed_get();return{action:{op:"gather",series:I,target:v,...M,...E!==null?{name:E}:{},...O!==null?{feed:O.feedId,root:{instance:O.rootInstanceId,path:O.path}}:{}},label:E??`GATHER · ${I.length} series`}}if(z==="dag"){const T=i.get("dag",y)?.feed_get()??null;return T===null?null:{action:{op:"graph",feed:T,target:v,...M}}}if(z==="tags")return{action:{op:"tags",target:v,...M}};if(z==="edit"){const T=i.get("edit",y)?.path_get()??null;return T===null?null:{action:{op:"edit",path:T,target:v,...M},label:`EDIT ${T.split("/").pop()??T}`}}return null},f=()=>{if(a)return;const y=new Set(s.panes_shown()),b=s.activePreset_get();if(b==="panes"||b==="launcher")return;const v=Sh().map(F=>F.id).filter(F=>y.has(F)),z=new Map;let x,M;const S=[];for(const F of v){const ee=z.get(o.get(F)?.parent??"")??0,X=p(F,b,ee);X!==null&&(z.set(F,S.length),S.push(X.action),X.anchor!==void 0?x===void 0&&(x=X.anchor,X.label!==void 0&&(M=X.label)):X.label!==void 0&&M===void 0&&(M=X.label))}const T=S.filter(F=>F.op!=="domain"||F.feed!==void 0);if(T.length===0)return;const I=u(v),E=F=>{if("pane"in F){const he=z.get(F.pane);return he===void 0?null:{leaf:he}}const ee=E(F.first),X=E(F.second);return ee===null?X:X===null?ee:{dir:F.dir,ratio:F.ratio,first:ee,second:X}},O=s.tree_get(),R=O===null?null:E(O),C=[...new Set(T.map(F=>oj[F.op]??"pane"))];let k,B,L;if(x!==void 0)k=x,B=M??x.split("/").pop()??x,L={address:x,modelKind:"dicom.series"};else{const F=T.map(he=>he.path).find(he=>he!==void 0),ee=T.map(he=>he.path??(he.input!==void 0?`catalogue:${he.input}`:he.series!==void 0?`gather:${he.series.map(Oe=>Oe.seriesUID).join(",")}`:he.feed!==void 0?`feed:${he.feed}`:he.op)).sort().join("|"),X=b==="dag"?"RUNS":b.toUpperCase();k=`${b}:${ee}`,B=M!==void 0&&M!==""?M:F!==void 0?F.split("/").pop()??F:`${X} · ${T.length+1} panes`,L={address:k,modelKind:"argus.desktop"}}r.add({id:k,label:B,regard:L,members:C,actions:S,...R===null?{}:{shape:R},...I===void 0?{}:{thumbnail:I},lastTouched:Date.now()})},_=()=>{const y=new Set(s.panes_shown());for(const b of Sh())y.has(b.id)||rv(b.id)||b.id==="panes"||b.id==="launcher"||b.id==="universe"||(As(b.id),s.mount_remove(b.id));e.stage_relight()},g=y=>{f(),s.preset_apply(y),_()},m=(y,b)=>{const v=S=>Sh().filter(T=>s.panes_shown().includes(T.id)&&c(T.id)===S).map(T=>T.id),z={dir:y.dir??"col",before:y.side==="before"},x=S=>{l=z;try{return S()}finally{l=null}},M=(S,T)=>v(S).find(I=>!T.has(I))??null;if(y.op==="domain"){const S=y.domain==="runs"?"dag":y.domain==="pacs"?"pacs":"files";if(g(S),y.query!==void 0&&t.terminal.line_run(y.query),y.feed!==void 0){const T=y.feed,I=y.view??[],E=i.get("dag","dag");if(E?.feed_enter(T),I.length>0&&E!==void 0){const O=R=>{if(E.graph_isShown()&&E.feed_get()===T){for(const C of I)t.terminal.line_run(C);return}R>0&&window.setTimeout(()=>O(R-1),250)};O(240)}}return S}if(b!==null&&s.focus_set(b),y.op==="image"&&y.path!==void 0){let S=null;const T=y.path,I=x(()=>e.image_open(null,T,{},R=>{S=R})),E=y.view,O=S;return E!==void 0&&E.length>0&&O!==null&&I.then(()=>{for(const R of E)s.focus_set(O),t.terminal.line_run(R)}).catch(()=>{}),S}if(y.op==="dir"&&y.path!==void 0){const S=new Set(v("files")),T=y.path;return x(()=>e.dir_open(T)),M("files",S)}if(y.op==="tags"){const S=new Set(v("tags"));return x(()=>t.terminal.line_run("image tags")),M("tags",S)}if(y.op==="catalogue"&&y.input!==void 0){const S=()=>e.catalogueIds().filter(O=>s.panes_shown().includes(O)),T=new Set(S()),I=y.input;x(()=>e.process_open(b??"files",{input:I,feed:y.feed??null,node:y.node??null}));const E=S().find(O=>!T.has(O))??null;return E!==null&&y.line!==void 0&&i.get("files",E)?.commandLine_set(y.line),E}if(y.op==="gather"&&y.series!==void 0){const S=[...y.series],T=x(()=>e.gather_open(S,b??"pacs"));return T!==null&&y.name!==void 0&&i.get("gather",T)?.name_set(y.name),T}if(y.op==="graph"&&y.feed!==void 0){const S=new Set(v("dag")),T=y.feed;return x(()=>e.feed_open(b??"files",T)),M("dag",S)}if(y.op==="edit"&&y.path!==void 0){const S=y.path;return x(()=>e.edit_open(S))}return y.op==="fs"||y.op==="view"||y.op==="empty"?b===null?null:e.pillPane_spawn(b,y.op,z.dir,z.before):null};return{birth_record:h,replayPlace_get:()=>l,replaying:()=>a,strip_capture:u,capture:f,orphans_dispose:_,domain_enter:g,restore:async y=>{const b=r.get(y);if(!(b===void 0||b.actions===void 0)){r.dismiss(y),a=!0;try{const v=[];for(const z of b.actions){const x=v[z.target??0]??null;v.push(m(z,x))}if(b.shape!==void 0){const z=M=>{if("leaf"in M){const I=v[M.leaf]??null;return I===null?null:{pane:I}}const S=z(M.first),T=z(M.second);return S===null?T:T===null?S:{dir:M.dir,ratio:M.ratio,first:S,second:T}},x=z(b.shape);x!==null&&!("pane"in x)&&s.tree_set(x)}}finally{a=!1,e.stage_relight()}}}}}const lj=2200;function cj(t){return/\x1b\[/.test(t)?In(t):ti(t).replace(/("[^&]*")/g,'<span class="man-str">$1</span>').replace(/(^|\s)(--?[a-zA-Z][\w-]*)/g,'$1<span class="man-flag">$2</span>').replace(/^(\s{0,2})([A-Za-z_ ]+):(\s)/gm,'$1<span class="man-key">$2:</span>$3').replace(/^([A-Z][A-Z ]{2,})$/gm,'<span class="man-head">$1</span>')}function hj(t,e,s,i){if(t===void 0)return[];const n=t.arguments??[],r=[{label:"NODE",value:`${t.label} · @${t.id}`},{label:"PLUGIN",value:t.pluginName},...t.pluginVersion!==void 0?[{label:"VERSION",value:t.pluginVersion}]:[]];if(e){const o=OB(t.label,t.id,i);r.push(...n.length===0?[{label:"ARGUMENTS",value:"none — this node runs on the plugin's defaults"}]:n.map(a=>({label:a.name,value:String(a.value??""),...s?{edit:{flag:`--${o}.${a.name}`,type:typeof a.value=="boolean"?"boolean":"string",placeholder:String(a.value??"")}}:{}})))}else r.push({label:"ARGUMENTS",value:n.length===0?"none":`${n.length} — open the node to read them`});return r}function dj(t,e,s){const i=[{label:"PLUGIN",value:t.name},{label:"VERSION",value:t.version},{label:"TYPE",value:t.type.toUpperCase()}],n=t.parameters;if(!e)return i.push({label:"PARAMETERS",value:n.length===0?"none":`${n.length} — open the node to read them`}),i;if(n.length===0)return i.push({label:"PARAMETERS",value:"none — this plugin takes no arguments"}),i;for(const r of n){const o=[r.type];r.optional||o.push("required");const a=r.default===void 0||r.default===null?"":String(r.default);a!==""&&o.push(`default ${a}`);const l=o.join(" · ");i.push({label:r.flag,value:r.help===void 0?l:`${l} — ${r.help}`,...s?{edit:{flag:r.flag,type:r.type,placeholder:a}}:{}})}return i}function mv(t,e,s,i){t.replaceChildren(),t.classList.toggle("dag-facts-immersed",s);for(const{label:n,value:r,edit:o}of e){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");if(l.className="telemetry-label",l.textContent=n,a.appendChild(l),o===void 0||i===null){const c=document.createElement("span");c.className="telemetry-value",c.textContent=r,a.appendChild(c)}else{const c=zB(i.line_get(),o.flag),h=document.createElement("input");h.className="telemetry-input",h.spellcheck=!1,h.autocomplete="off",h.title=`${o.flag} — ${r}`,o.type==="boolean"?(h.type="checkbox",h.checked=c===!0,h.addEventListener("change",()=>{i.line_set(b0(i.line_get(),o.flag,h.checked?!0:null))})):(h.type="text",h.placeholder=o.placeholder,h.value=c===null||c===!0?"":c,h.addEventListener("input",()=>{i.line_set(b0(i.line_get(),o.flag,h.value))}));const d=document.createElement("span");d.className="telemetry-hint",d.textContent=r,a.append(h,d)}t.appendChild(a)}}function uj(t,e,s,i){const n=t.closest(".files-body"),r=n?.querySelector(".diagram-strategy")??null,o=n?.querySelector(".diagram-projection")??null,a=n?.querySelector(".diagram-pulse")??null,l=i===void 0?null:n?.querySelector(".diagram-run")??null,c=()=>i?.(),h=()=>{const f=[];e.strategy_get()!=="ranked"&&f.push("MOLECULE"),e.projection_get()!=="3d"&&f.push("2D"),s.mode_annunciate(f.join(" · "))},d=()=>{e.strategy_set(e.strategy_get()==="ranked"?"molecule":"ranked"),r!==null&&(r.textContent=e.strategy_get().toUpperCase()),h()},u=()=>{e.projection_set(e.projection_get()==="3d"?"2d":"3d"),o!==null&&(o.textContent=e.projection_get().toUpperCase()),h()},p=()=>{e.wave_start(),a?.classList.add("pulse-running"),window.setTimeout(()=>a?.classList.remove("pulse-running"),lj)};return r!==null&&(r.textContent=e.strategy_get().toUpperCase()),o!==null&&(o.textContent=e.projection_get().toUpperCase()),r?.addEventListener("click",d),o?.addEventListener("click",u),a?.addEventListener("click",p),l?.addEventListener("click",c),h(),()=>{r?.removeEventListener("click",d),o?.removeEventListener("click",u),a?.removeEventListener("click",p),l?.removeEventListener("click",c),a?.classList.remove("pulse-running")}}function fj(t,e){let s=null;const i=(c,h,d,u)=>{let p=null,f=null;const _=c.contentHtml_show(h,"",{diagram:!0,release:()=>{s=null,f?.(),f=null,c.mode_annunciate(""),p?.dispose(),p=null}});_!==null&&d().then(g=>{if(!_.isConnected)return;if(g===null||g.nodes.length===0){_.textContent="NOTHING TO DRAW FOR THIS ENTRY",_.classList.add("files-diagram-empty");return}g.text!==""&&c.contentText_set(g.text);const m=document.createElement("div");m.className="dag-facts",Mi(m),_.appendChild(m);const w=new Gd(_,{select:v=>g.facts_show(m,v.id,!1,u),activate:v=>y(v),deselect:()=>m.replaceChildren()},{}),y=v=>{w.flight_into(v.id,()=>{s={scene:w,facts:m},g.facts_show(m,v.id,!0,u)})};p=w,w.graph_set({nodes:g.nodes},{wave:!1}),w.size_fit(),f=uj(_,w,c,u===null?void 0:u.run);const b=g.nodes.length===1?g.nodes[0]:void 0;b!==void 0&&y(b)})},n=async c=>{const h=/_id(\d+)$/.exec(c)?.[1]??c.replace(/^.*\//,""),[d,u]=await Promise.all([t.client.line_execute(`cat "${c}"`,{silent:!0,observe:!1}),t.client.line_execute(`pipeline diagram ${h}`,{silent:!0,observe:!1})]),p=d.envelopes.map(f=>f.rendered).join(`
|
|
4351
4351
|
`);for(const f of u.envelopes){if(f.model?.kind!==br.pipelineDiagram)continue;const _=_g.safeParse(f.model.data);if(!_.success)continue;const g=new Map(_.data.nodes.map(m=>[m.id,m]));return{text:cj(p),nodes:_.data.nodes.map(m=>({id:m.id,label:m.label,parentIds:m.parentIds,joinParentIds:m.joinParentIds})),facts_show:(m,w,y,b)=>{const v=_.data.nodes.map(z=>z.label);mv(m,hj(g.get(w),y,b!==null,v),y,b)}}}return null},r=async c=>{const h=c.replace(/^.*\//,""),d=await t.client.line_execute(`plugin info "${h}"`,{silent:!0,observe:!1});for(const u of d.envelopes){if(u.model?.kind!==tk)continue;const p=ek.safeParse(u.model.data);if(!p.success)continue;const f=p.data;return{text:"",nodes:[{id:h,label:f.name,parentIds:[],joinParentIds:[]}],facts_show:(_,g,m,w)=>{mv(_,dj(f,m,w!==null),m,w)}}}return null},o=(c,h,d,u)=>{const p=e.catalogue_find(c);if(p===void 0)return null;const f=d.replace(/^.*\//,"");return eS(h.commandLine_get())!==f&&h.commandLine_set(Zz(p.input,f)),{line_get:()=>h.commandLine_get(),line_set:_=>h.commandLine_set(_),run:()=>e.run_press(c,f,u)}};return{entry_show:(c,h,d,u)=>{i(h,d,()=>u==="plugin"?r(d):n(d),o(c,h,d,u))},dive_leave:()=>{const c=s;return c===null?!1:(s=null,c.scene.flight_back(()=>{c.facts.classList.remove("dag-facts-immersed"),c.facts.replaceChildren()}),!0)}}}function pj(t,e){const{panels:s,paneInstance_get:i,subjects:n}=t,r=new Map,o=p=>s.get("dag",p)??s.get("universe",p),a=(p,f)=>{const _=r.get(p);if(_===void 0){f?.();return}r.delete(p),_.element.classList.remove("node-overlay-open");const g=()=>{_.element.remove(),f?.()},m=o(p);m!==void 0?m.flight_back(g):g()},l=(p,f,_,g,m)=>{if(m.kind==="dir"){const w=f.replace(/\/+$/,"");if(m.path!==w&&!m.path.startsWith(`${w}/`)){a(p),t.sound("audio3");return}const y=m.path.startsWith("/proc/jobs/")?(m.path.split("/").pop()??"").match(/_(\d+)$/):null;if(y!==null){const v=parseInt(y[1]??"",10);a(p,()=>{o(p)?.node_flyTo(v)!==!0&&c(p,m.path)});return}const b=_.path_current();b!==null&&g.push(b),e.rootedListing_show(p,_,m.path);return}if(n.regard_write(p,{address:m.path,modelKind:"fs.file"}),!n.groupHasViewer(p)){if(e.imagery_is(m.path)){e.image_open(p,m.path).then(w=>t.terminal.line_note(w));return}if(Od(m.path)){_.contentImage_show(m.path,e.vfsUrl_build(m.path));return}e.fileText_fetch(m.path).then(w=>{if(!w.ok){_.contentRefused_show(m.path,w.text);return}e.tableFile_is(m.path)?_.contentTable_show(m.path,w.text):_.content_show(m.path,w.text)})}},c=(p,f)=>{const g=i(p)?.mount?.querySelector(".dag-canvas, .universe-canvas")??null,m=r.get(p);if(m!==void 0&&!m.element.isConnected&&r.delete(p),g===null||r.has(p)){t.terminal.line_note(`dag: ${f}: ${g===null?"this pane has no scene to fly in":"a node is already open here"} — flew back out`),o(p)?.flight_back(()=>{});return}const w=document.createElement("div");w.className="node-overlay",w.setAttribute("aria-label",`inside ${f}`);const y=e.filesBody_stamp();y.classList.add("node-overlay-body");const b=document.createElement("button");b.type="button",b.className="strategy-pill node-overlay-exit",b.title="leave the node (Esc)",b.textContent="EXIT NODE",y.querySelector(".mode-frame")?.prepend(b),w.append(y);const v=y.querySelector(".files-panel");if(v===null)throw new Error("pane template is missing .files-panel");const z=[],x=new jz(v,M=>l(p,f,x,z,M),e.previewProvider);x.rowVerbs_declare((M,S)=>e.rowVerbs_build(p,M,S),(M,S)=>{n.regard_write(p,{address:S,modelKind:"fs.file"})}),r.set(p,{element:w,panel:x,history:z}),x.ceiling_set(f,"EXIT NODE"),b.addEventListener("click",()=>{a(p),t.sound("audio3")}),g.appendChild(w),window.requestAnimationFrame(()=>w.classList.add("node-overlay-open")),e.rootedListing_show(p,x,f)};return{open:c,close:a,back:p=>{const f=r.get(p),_=f?.history.pop();f!==void 0&&_!==void 0&&e.rootedListing_show(p,f.panel,_)},escape:()=>{const p=[...r.keys()].pop();if(p===void 0)return!1;const f=r.get(p);return f!==void 0&&f.panel.content_isShown()?f.panel.listing_restore():a(p),!0},dispose:p=>{r.get(p)?.element.remove(),r.delete(p)}}}async function a_(t,e,s){if(t.ask_isOpen()){const o=t.ask_note(s.message),a=await id(e,s);return o(s.kind==="secret"&&a!==null?"••••••":a),a}const i=id(e,s).then(o=>({from:"pane",answer:o})),n=t.ask_open({message:s.message,kind:s.kind==="choose"?"text":s.kind,focus:!1,...s.suggest===void 0?{}:{suggest:s.suggest}}).then(o=>({from:"console",answer:o})),r=await Promise.race([i,n]);return r.from==="console"?m1():t.ask_settle(r.answer),r.answer}function mj(t,e){const{panels:s,paneInstance_get:i}=t;let n=null,r=null;const o=()=>{const{layout:u}=t,p=u.tree_get();if(p===null)return null;const f=[],_=m=>{if("pane"in m){f.push(m.pane);return}_(m.first),_(m.second)};_(p);const g=u.focused_get();return g!==null&&f.includes(g)?g:f[0]??null};return{errandHost_find:o,errand_open:async u=>{const{layout:p,terminal:f}=t,_=o();if(_===null)return null;const g=e.instance_spawn("files"),m=e.replayPlace_get();if(!p.leaf_split(_,m?.dir??"col",g.id,m?.before??!1))return As(g.id),p.mount_remove(g.id),null;e.birth_record(g.id,_,m?.dir??"col",m?.before??!1);const w=s.get("files",g.id),y=u.path?.anchor??"~";w!==void 0&&e.rootedListing_show(g.id,w,y);const b=g.mount.querySelector(".files-body");if(b===null)return As(g.id),p.mount_remove(g.id),null;const v=document.createElement("div");v.className="errand-bar",b.insertBefore(v,b.firstChild);const z=document.createElement("span");z.className="errand-caption",z.textContent=u.message.trim();const x=document.createElement("input");x.className="errand-path",x.spellcheck=!1;const M=document.createElement("button");M.className="pacs-capsule errand-commit",M.textContent=u.commit??"USE THIS",v.append(z,x,M);const S=()=>{const E=w?.path_current()??y,O=u.path?.suggest;x.value=u.path?.wantsDirectory===!0||O===void 0?E:`${E.replace(/\/$/,"")}/${O}`};S();let T=!1;x.addEventListener("input",()=>{T=!0});const I=()=>{T||S()};return g.mount.addEventListener("click",I),f.question_set(!0),new Promise(E=>{const O=R=>{g.mount.removeEventListener("click",I),f.question_set(!1),n=null,p.leaf_close(g.id),As(g.id),p.mount_remove(g.id),E(R)};n=()=>O(null),M.addEventListener("click",()=>O(x.value.trim()===""?null:x.value.trim())),x.addEventListener("keydown",R=>{R.key==="Enter"&&O(x.value.trim()===""?null:x.value.trim())})})},errand_abandon:()=>n===null?!1:(n(),!0),verbLine_run:(u,p)=>{r=u,t.terminal.line_run(p)},askingPane_take:()=>{const u=r;return r=null,u},askOnPane_await:async(u,p)=>{const{terminal:f}=t,_=i(u)?.mount;if(_===void 0){const g=e.questionSheet_ask?.(p)??null;return g!==null?g:(e.console_expose(),f.ask_open({message:p.message,kind:p.kind==="choose"?"text":p.kind,...p.suggest===void 0?{}:{suggest:p.suggest}}))}return a_(f,_,p)}}}class gj{members=new Map;title=null;landed=null;watchers=new Set;watch(e){return this.watchers.add(e),()=>{this.watchers.delete(e)}}changed(){for(const e of[...this.watchers])e()}members_get(){return[...this.members.values()]}size(){return this.members.size}has(e){return this.members.has(e)}state_adopt(e,s,i){const n=JSON.stringify({members:e,name:s,feed:i}),r=JSON.stringify({members:[...this.members.values()],name:this.title,feed:this.landed});if(n!==r){this.members.clear();for(const o of e)this.members.set(o.seriesUID,o);this.title=s,this.landed=i,this.changed()}}name_get(){return this.title}feed_get(){return this.landed}}function gv(t){return(t.kind??"series")==="series"?void 0:t.vfsPath}const af="cohort";function _j(t){return/[",\n\r]/.test(t)?`"${t.split('"').join('""')}"`:t}function bj(t){const e=document.createElement("p");return e.className="files-empty",e.textContent=t,e}class _v{handlers;title;cohort;greeted=!1;listing;cohortActions;seriesActions;constructor(e,s,i,n){this.handlers=i,this.cohort=n,n.watch(()=>{this.unsaved=!0,this.render()}),this.title=e.querySelector(".gather-title"),this.cohortActions=this.cohortActions_declare(),this.seriesActions=this.seriesActions_declare(),this.listing=new Ir({mount:s,traits:this.cohortTraits_declare(),key:r=>r.key,chrome:{root:e,prefix:"gather"},control:"fold",actions:{of:()=>this.cohortActions},row:{className:()=>"gather-cohort-row",groupClassName:()=>"gather-cohort",decorate:r=>{r.title="the cohort: click for its verbs, the fold cell folds its series"}},child:sa(()=>[...this.cohort.members_get()].map(r=>({entry:r})),{traits:this.seriesTraits_declare(),key:r=>r.entry.seriesUID,address:r=>r.entry.vfsPath,actions:{of:()=>this.seriesActions},row:{className:()=>"gather-series",decorate:(r,o)=>{r.dataset.seriesuid=o.entry.seriesUID}}}),state:r=>this.stateLine_compose(r),empty:()=>bj("NOTHING GATHERED")}),this.pullBlock=e.querySelector(".gather-pull"),this.pullBlock?.addEventListener("click",()=>this.cohort_pull()),this.emptyBlock=e.querySelector(".gather-remove"),this.emptyBlock?.addEventListener("click",()=>{this.cohort_clear()}),this.processBlock=e.querySelector(".gather-process"),this.processBlock?.addEventListener("click",()=>{this.cohort_process()}),this.render()}pullBlock=null;emptyBlock=null;unsaved=!1;processBlock=null;async cohort_clear(){if(this.cohort.size()!==0){if(this.unsaved){const e=await this.handlers.confirm_ask(`Save the cohort first? (${this.cohort.size()} ${this.cohort.size()===1?"member":"members"}, unsaved)`);if(e===null||e==="y"&&!await this.manifest_save())return}await this.handlers.verb_send("gather clear")}}away(){return[...this.cohort.members_get()].filter(e=>e.folderPath===void 0&&e.series?.pulled!==!0)}cohort_pull(){const e=this.away();if(e.length===0)return;const s=e.map(i=>`"${i.vfsPath}"`).join(" ");this.handlers.command_show(`pull ${s}`)}render_now(){this.render()}has(e){return this.cohort.has(e)}entries_get(){return[...this.cohort.members_get()]}name_get(){return this.cohort.name_get()}feed_get(){return this.cohort.feed_get()}async name_set(e){e===null||e===this.cohort.name_get()||await this.handlers.verb_send(`gather name ${Ji(e)}`)}member_remove(e){this.handlers.verb_send(`gather remove ${Ji(e.vfsPath)}`)}render(){if(this.title!==null&&(this.title.textContent=this.cohort.name_get()===null?"GATHER":`GATHER · ${this.cohort.name_get()??""}`.toUpperCase()),this.listing.rows_set([{key:"gather",rows:[{key:af}]}],{field:"gather"}),this.cohort.size()>0&&this.listing.open_set(0,[af]),this.pullBlock!==null){const e=this.away().length;this.pullBlock.hidden=e===0,this.pullBlock.textContent=`PULL ${e}`}this.emptyBlock!==null&&(this.emptyBlock.hidden=this.cohort.size()===0,this.emptyBlock.textContent=`CLEAR ${this.cohort.size()}`),this.processBlock!==null&&(this.processBlock.hidden=this.cohort.size()===0),this.greeted||(this.greeted=!0,this.listing.row_indicate(af))}cohortTraits_declare(){return[{key:"fold",label:"",className:"pacs-fold",capped:!1,width:"5.2em",cell:()=>{const e=document.createElement("span");return e.className="pacs-fold",e}},{key:"name",label:"COHORT",className:"gather-cohort-name",width:"1fr",cell:()=>this.cohort.name_get()??"(unnamed — SAVE names it)"},{key:"series",label:"SERIES",className:"gather-cohort-count",width:"6em",cell:()=>String(this.series_count()),compare:()=>this.series_count()},{key:"patients",label:"PATIENTS",className:"gather-cohort-patients",width:"7em",cell:()=>String(this.patients_count()),compare:()=>this.patients_count()},{key:"feed",label:"FEED",className:"gather-cohort-feed",width:"7em",cell:()=>{if(this.cohort.feed_get()===null)return"—";const e=document.createElement("button");e.className="gather-feed listing-capsule listing-action-selected",e.textContent=`FEED ${this.cohort.feed_get()?.feedId??0}`,e.title="open the feed's graph beside the cohort";const s=this.cohort.feed_get()?.feedId??0;return e.addEventListener("click",i=>{i.stopPropagation(),this.handlers.feed_open(s)}),e},compare:()=>this.cohort.feed_get()?.feedId??-1}]}seriesTraits_declare(){const e=cS(n=>n.entry.series??{seriesUID:n.entry.seriesUID,description:n.entry.description??n.entry.vfsPath??"",modality:n.entry.modality,...n.entry.files===void 0?{}:{fileCount:n.entry.files},...n.entry.folderPath===void 0?{}:{pulled:!0,folderPath:n.entry.folderPath}},NB),s={key:"patient",label:"MRN",className:"gather-series-patient",width:"8em",cell:n=>n.entry.patient||"—"},i={key:"study",label:"STUDY",className:"gather-series-study",width:"14em",cell:n=>n.entry.study??"—"};return[...e.slice(0,1),i,s,...e.slice(1)]}cohortActions_declare(){const e=()=>({count:this.cohort.size(),feed:this.cohort.feed_get()?.feedId??null}),s={save:()=>{this.manifest_save()},export:()=>{this.cohort_export()},feed:()=>{this.feed_ensure()},process:()=>{this.cohort_process()},dismiss:()=>this.handlers.dismiss()};return rS.rules.map(i=>({label:i.label(e()),offered:()=>i.offered(e()),run:()=>s[i.name]?.()}))}seriesActions_declare(){const e=i=>({folderKnown:(i.entry.kind??"series")!=="series"||i.entry.folderPath!==void 0,imagery:(i.entry.kind??"series")==="series"||i.entry.imagery===!0,pullable:(i.entry.kind??"series")==="series"&&i.entry.folderPath===void 0&&i.entry.series?.pulled!==!0&&i.entry.vfsPath!==""}),s={remove:i=>this.member_remove(i.entry),pull:i=>this.handlers.command_show(`pull "${i.entry.vfsPath}"`),image:i=>{const n=i.entry.folderPath??gv(i.entry);n!==void 0&&this.handlers.image_open(n)},process:i=>{const n=i.entry.folderPath??gv(i.entry);if(n!==void 0){this.handlers.process_open(n);return}this.handlers.note(`gather: ${i.entry.description||i.entry.seriesUID} is not in CUBE yet — PULL it first, then PROCESS it.`)}};return nS.rules.map(i=>({label:i.label({folderKnown:!0,pullable:!0}),offered:n=>i.offered(e(n)),run:n=>s[i.name]?.(n)}))}patients_count(){return new Set(this.cohort.members_get().filter(e=>(e.kind??"series")==="series").map(e=>e.patient)).size}series_count(){return this.cohort.members_get().filter(e=>(e.kind??"series")==="series").length}stateLine_compose(e){const s=this.cohort.members_get(),i=s.filter(a=>(a.kind??"series")!=="series").length,n=s.length-i,r=[];(n>0||i===0)&&r.push(`${n} SERIES`),i>0&&r.push(`${i} ${i===1?"PLACE":"PLACES"}`),i===0&&r.push(`${this.patients_count()} PATIENTS`);const o=[r.join(" · ")];return e.filter!==""&&o.push(e.filter),o.join(" · ")}async name_ensure(){if(this.cohort.name_get()!==null)return this.cohort.name_get();const s=(await this.handlers.name_ask(`gather-${new Date().toISOString().slice(0,10)}`)??"").trim();return s===""?null:(await this.handlers.verb_send(`gather name ${Ji(s)}`),s)}async manifest_save(){if(this.cohort.size()===0)return!1;const e=await this.name_ensure();if(e===null)return!1;const s=JSON.stringify({name:e,gatheredAt:new Date().toISOString(),series:[...this.cohort.members_get()].map(i=>({seriesUID:i.seriesUID,description:i.description,modality:i.modality,patient:i.patient,vfsPath:i.vfsPath}))});return this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${s}' ~/gather/${e}.json`),this.unsaved=!1,!0}async cohort_export(){if(this.cohort.size()===0)return;const e=await this.name_ensure();if(e===null)return;const s=[["patient","series","modality","seriesUID","path"].join(","),...[...this.cohort.members_get()].map(i=>[i.patient,i.description,i.modality,i.seriesUID,i.vfsPath].map(_j).join(","))];this.handlers.command_run("mkdir -p ~/gather"),this.handlers.command_show(`touch --withContents '${s.join(`
|
|
4352
4352
|
`)}' ~/gather/${e}.csv`)}async feed_ensure(){const e=this.cohort.feed_get();return e!==null?e:this.cohort.size()===0||await this.name_ensure()===null?null:(await this.handlers.verb_send("gather feed",!0),this.cohort.feed_get())}async cohort_process(){const e=await this.feed_ensure();e!==null&&this.handlers.cohort_process({input:e.path,feed:e.feedId,node:e.rootInstanceId})}}const bv="gather.cohort";function Mj(t){return{kind:t.kind??"series",seriesUID:t.seriesUID??t.vfsPath,description:t.description??t.vfsPath.split("/").filter(Boolean).pop()??t.vfsPath,modality:t.modality??"—",patient:t.patient??"",vfsPath:t.vfsPath,...t.study===void 0?{}:{study:t.study},...t.imagery===void 0?{}:{imagery:t.imagery},...t.folderPath===void 0?{}:{folderPath:t.folderPath},...t.files===void 0?{}:{files:t.files}}}function vj(t,e){const{panels:s,subjects:i}=t,n=new gj;let r=null,o=!1;const a=b=>{if(b===null||typeof b!="object")return;const v=b,z=Array.isArray(v.series)?v.series.filter(M=>typeof M?.vfsPath=="string").map(Mj):[],x=v.feed;r===null&&z.length>0&&(r=f()),n.state_adopt(z,typeof v.name=="string"?v.name:null,x??null),p(),e.stage_relight()},l=b=>{for(const v of b.envelopes)v.model?.kind===bv&&a(v.model.data)},c=async(b,v=!1)=>{const{terminal:z,client:x}=t;z.line_echo(b);let M;try{M=await x.line_execute(b,{silent:!0,operator:!0})}catch(S){z.output_write("err",`\x1B[31m${S instanceof Error?S.message:String(S)}\x1B[0m
|
|
4353
|
-
`);return}(v||M.envelopes.some(S=>S.status==="error"))&&z.outcome_write(M),l(M)},h=[],d=b=>{const v=h.length===0;for(const z of b)z.vfsPath!==""&&!h.includes(z.vfsPath)&&h.push(z.vfsPath);!v||h.length===0||queueMicrotask(()=>{const z=h.splice(0);z.length>0&&c(`gather add ${z.map(Ji).join(" ")}`)})},u=(b,v,z)=>({command_run:x=>{t.client.line_execute(x,{silent:!0})},command_show:x=>t.terminal.line_run(x),note:x=>t.terminal.line_note(x),image_open:x=>{e.image_open(b(),x).then(M=>t.terminal.line_note(M))},process_open:x=>e.process_open(b(),{input:x,feed:null,node:null}),...v,...z,verb_send:c,cohort_process:x=>e.process_open(b(),x),feed_open:x=>e.feed_open(b(),x)}),p=()=>{const b=document.querySelector("#header-gather-pill");b!==null&&b.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},f=()=>{const b=e.element_require("header-gather"),v=()=>e.errandHost_find()??"pacs",z=x=>a_(t.terminal,e.element_require("header-gather"),x);return new _v(b,e.pane_find(b,".gather-rows"),u(v,{name_ask:x=>z({message:"Cohort name: ",kind:"text",suggest:x,commit:"NAME IT"}),confirm_ask:async x=>{const M=await z({message:x,kind:"confirm"});return M==="y"||M==="n"?M:null}},{dismiss:()=>{document.body.dataset.header="away",o=!0,p()}}),n)};return{cohort:n,instance_build:b=>{const v=e.template_stamp("tpl-pane-gather"),z=new _v(v,e.pane_find(v,".gather-rows"),u(()=>b,{name_ask:x=>e.askOnPane_await(b,{message:"Cohort name: ",kind:"text",suggest:x,commit:"NAME IT"}),confirm_ask:async x=>{const M=await e.askOnPane_await(b,{message:x,kind:"confirm"});return M==="y"||M==="n"?M:null}},{dismiss:()=>{t.layout.leaf_close(b)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),n);return s.set("gather",b,z),{id:b,kind:"gather",mount:v,dispose:()=>{s.delete(b),i.pane_leave(b)}}},has:b=>n.has(b),gather:b=>{r===null&&(r=f()),d(b);const v=document.body.dataset.header==="away";(!o||!v)&&(document.body.dataset.header="gather",o=!1),p()},open:(b,v="pacs")=>{const{layout:z}=t,x=new Set(z.panes_shown());let M=s.ids("gather").find(S=>x.has(S))??null;if(M===null){const S=x.has(v)?v:e.errandHost_find()??v,T=e.instance_spawn("gather","pacs"),I=e.replayPlace_get();if(!z.leaf_split(S,I?.dir??"row",T.id,I?.before??!1))return As(T.id),z.mount_remove(T.id),null;e.birth_record(T.id,S,I?.dir??"row",I?.before??!1),M=T.id}return s.get("gather",M)===void 0?null:(d(b),M)},stage:()=>{const{layout:b}=t,v=new Set(b.panes_shown()),z=s.ids("gather").find(x=>v.has(x))??null;if(z!==null)b.focus_set(z);else{const x=e.errandHost_find()??"pacs",M=e.instance_spawn("gather","pacs");if(!b.leaf_split(x,"col",M.id,!1)){As(M.id),b.mount_remove(M.id);return}e.birth_record(M.id,x,"col",!1),s.get("gather",M.id)?.render_now()}document.body.dataset.header="away",o=!0},annunciate:p,restore:async()=>{try{l(await t.client.line_execute("gather",{silent:!0,observe:!1}))}catch{}},envelope_observe:b=>{b.model?.kind===bv&&a(b.model.data)}}}class wj{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,s){this.mount=e,this.handlers=s,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",i=>{(i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()==="s"&&(i.preventDefault(),i.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.fieldSection.contains(i.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),ys(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const s=await this.fieldBuild;s!==null&&(s.text_get()!==this.original&&s.text_set(this.original),this.controls_sync(),s.focus(),this.focusMark_set(!0))}async field_build(e){let s;try{s=await lm(()=>import("./field-C2Ib0VHd.js").then(i=>i.Q),[],import.meta.url)}catch(i){if(!r_(i))throw i;return ys(this.stateSpan,"stale",nd),this.handlers.note(`edit: ${nd.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await s.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){ys(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let s=!1;try{s=await this.handlers.save(this.path,e)}finally{this.saving=!1}return s&&(this.original=e),this.controls_sync(),s||ys(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),s}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?ys(this.stateSpan,"wait","SAVING"):e?ys(this.stateSpan,"note","DIRTY"):ys(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const s=this.mount.querySelector(e);if(s===null)throw new Error(`edit pane: no ${e} in its template`);return s}}function yj(t,e){const{layout:s,panels:i,subjects:n}=t,r=async(d,u)=>{const p=await ra(t,M1(d,u));return p&&e.saved?.(d),p},o=d=>{const u=e.template_stamp("tpl-pane-edit"),p=new wj(u,{save:r,note:f=>t.terminal.line_note(f)});return i.set("edit",d,p),{id:d,kind:"edit",mount:u,dispose:()=>{p.dispose(),i.delete(d),n.pane_leave(d)}}},a=d=>{const u=new Set(s.panes_shown());for(const[p,f]of i.entries("edit"))if(u.has(p)&&f.path_get()===d)return p;return null},l=()=>{e.launcher_yield();const d=new Set(s.panes_shown()),u=s.focused_get(),p=u!==null&&d.has(u)?u:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),_=e.replayPlace_get();return s.leaf_split(p,_?.dir??"col",f.id,_?.before??!1)?(e.birth_record(f.id,p,_?.dir??"col",_?.before??!1),f.id):(As(f.id),s.mount_remove(f.id),null)};return{instance_build:o,edit_receive:d=>{const u=d.path??"";if(u==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=a(u)??l();if(p===null)return!1;const f=i.get("edit",p);return f===void 0?!1:(s.focus_set(p),f.dirty_is()?(t.terminal.line_note(`edit: ${u}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:u,content:d.content,extension:d.extension??ez(u)}),!0))},edit_open:(d,u={})=>{const p=a(d)??l();if(p===null)return null;const f=i.get("edit",p);if(f===void 0)return null;s.focus_set(p),f.dirty_is()||f.opening_show(d);const _=v1(d);return u.visible===!0?(t.terminal.line_run(_),p):(t.client.line_execute(_,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(w=>w.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}class zj{listing;constructor(e){const s=e.querySelector(".help-panel");if(s===null)throw new Error("help pane: no .help-panel in its template");this.listing=new Ir({mount:s,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:i=>`help-row help-${i.topic}`}}),this.render()}traits_declare(){return[{key:"name",label:"KEY · VERB",className:"help-key",width:"minmax(9em, 12em)",cell:e=>e.name},{key:"does",label:"DOES",className:"help-does",width:"minmax(16em, 1fr)",cell:e=>e.does}]}render(){const e=o=>{const a=document.createElement("header");return a.className="files-path help-block-head",a.textContent=o,a},s=pn.map(o=>({key:`k:${o.key}`,name:o.key,does:o.does,topic:o.topic})),i=ma.map((o,a)=>{const l=o.indexOf(" ");return{key:`v:${a}`,name:l<0?o:o.slice(0,l),does:l<0?"":o.slice(l+1).trim(),topic:"verb"}}),n=[{key:"g:games",name:"help games",does:"the /usr/games shelf — fortune, cal, weather and their kin, by category (type it in the console)",topic:"verb"}],r=[{key:"n:notes",name:"notes",does:"what the installed releases changed (notes pane opens it as a listing; the dashboard's WHAT'S NEW block too)",topic:"verb"}];this.listing.rows_set([{key:"keys",header:e("KEYS — Ctrl-B opens the focused pane's drawer; then one key presses one of its verbs"),rows:s},{key:"verbs",header:e("VERBS — the console language; the long form is docs/argus-lang.adoc"),rows:i},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:n},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function Sj(t,e){const{layout:s,panels:i,subjects:n}=t;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-help");return i.set("help",a,new zj(l)),{id:a,kind:"help",mount:l,dispose:()=>{i.delete(a),n.pane_leave(a)}}},open:()=>{const a=i.ids("help").find(d=>s.panes_shown().includes(d));if(a!==void 0)return s.focus_set(a),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=s.focused_get()??"files",h=e.instance_spawn("help");return l&&s.leaf_replace("files",h.id)?(s.focus_set(h.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):s.leaf_split(c,"col",h.id,!1)?(e.birth_record(h.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(As(h.id),s.mount_remove(h.id),"help: could not open a pane")}}}const lf=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function xj(){const t=lf[0].length;let e=Number.NaN,s=0;return{title:"SL",tick:60,step:i=>{Number.isNaN(e)&&(e=-t),e+=1,s+=1,e>i.cols+6&&(e=-t)},draw:(i,n)=>{const r=Math.max(0,Math.floor((i.rows-lf.length)/2));lf.forEach((a,l)=>i.text(Math.round(e),r+l,a,n.lit));const o=s%2===0?"-~=":"-=~";i.text(Math.round(e)-o.length,r+1,o,n.cool)}}}const Mv="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function Oj(){const t=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(s,i)=>{e+=1;for(let n=0;n<s.cols;n++){const r=t.get(n);if(r===void 0){i()<.02&&t.set(n,{row:-1,speed:1+Math.floor(i()*2),length:4+Math.floor(i()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(Mv[Math.floor(i()*Mv.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>s.rows&&t.delete(n))}},draw:(s,i)=>{for(const[n,r]of t)r.glyphs.forEach((o,a)=>{const l=a===0?"#ffffff":a<r.length/2?i.lit:i.dim;s.put(n,r.row-a,o,l)})}}}function Ej(){const t=[];return{title:"RAIN",tick:70,step:(e,s)=>{s()<.9&&t.push({col:Math.floor(s()*e.cols),row:0,splash:0});for(const i of t)i.row<e.rows-1?i.row+=1:i.splash+=1;for(let i=t.length-1;i>=0;i--)t[i].splash>3&&t.splice(i,1)},draw:(e,s)=>{for(const i of t){if(i.splash===0){e.put(i.col,i.row,"|",s.cool);continue}const n=["o","O","( )"][i.splash-1];e.text(i.col-(n.length>>1),e.rows-1,n,s.dim)}}}}function Aj(){const t=[],e=[];let s=0;return{title:"ASCIIQUARIUM",tick:90,step:(i,n)=>{if(s+=1,t.length<Math.max(3,i.cols/12)&&n()<.08){const r=n()<.5;t.push({col:r?-4:i.cols+1,row:2+Math.floor(n()*Math.max(1,i.rows-5)),right:r,speed:1+Math.floor(n()*2),hue:Math.floor(n()*3)})}for(const r of t)s%r.speed===0&&(r.col+=r.right?1:-1);for(let r=t.length-1;r>=0;r--){const o=t[r];(o.col<-5||o.col>i.cols+2)&&t.splice(r,1)}if(n()<.3){const r=t[Math.floor(n()*t.length)];r!==void 0&&e.push({col:r.col+(r.right?4:-1),row:r.row-1})}for(const r of e)r.row-=1;for(let r=e.length-1;r>=0;r--)e[r].row<1&&e.splice(r,1)},draw:(i,n)=>{const r=(s%4<2?"~^":"^~").repeat(i.cols>>1);i.text(0,0,r,n.cool);const o=[n.lit,n.cool,n.warn];for(const a of t)i.text(a.col,a.row,a.right?"><>":"<><",o[a.hue]);for(const a of e)i.put(a.col,a.row,a.row%2===0?"o":".",n.dim);for(let a=2;a<i.cols;a+=7){const l=(s>>2)%2===0?0:1;for(let c=0;c<3;c++)i.put(a+(c+l)%2,i.rows-2-c,c%2===0?"(":")",n.dim)}i.text(0,i.rows-1,"^".repeat(i.cols),n.dim)}}}const vv=[[[0,0],[1,0],[2,0],[3,0]],[[0,0],[1,0],[0,1],[1,1]],[[1,0],[0,1],[1,1],[2,1]],[[0,0],[1,0],[1,1],[2,1]],[[1,0],[2,0],[0,1],[1,1]],[[0,0],[0,1],[1,1],[2,1]],[[2,0],[0,1],[1,1],[2,1]]],so=10,co=20;function Tj(){return{well:Array.from({length:co},()=>Array(so).fill(0)),piece:null,score:0,lines:0,over:!1}}function l_(t,e){return e.cells.every(([s,i])=>{const n=e.x+s,r=e.y+i;return n>=0&&n<so&&r<co&&(r<0||t[r][n]===0)})}function cf(t){const e=Math.max(...t.cells.flat())+1;return{...t,cells:t.cells.map(([s,i])=>[e-1-i,s])}}function Ij(t,e){const s=Math.floor(e()*vv.length),i={cells:vv[s].map(n=>[n[0],n[1]]),x:3,y:0,kind:s+1};if(!l_(t.well,i)){t.over=!0;return}t.piece=i}function Dj(t){const e=t.piece;if(e===null)return;e.cells.some(([,n])=>e.y+n<0)&&(t.over=!0);for(const[n,r]of e.cells){const o=e.y+r;o>=0&&(t.well[o][e.x+n]=e.kind)}const s=t.well.filter(n=>n.some(r=>r===0)),i=co-s.length;for(;s.length<co;)s.unshift(Array(so).fill(0));t.well=s,t.lines+=i,t.score+=[0,100,300,500,800][i]??800,t.piece=null}function hm(t,e){if(t.over)return;if(t.piece===null){Ij(t,e);return}const s={...t.piece,y:t.piece.y+1};l_(t.well,s)?t.piece=s:Dj(t)}function Cj(t,e,s){if(t.over||t.piece===null)return!1;const i=t.piece,n=r=>l_(t.well,r)?(t.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return n({...i,x:i.x-1}),!0;case"ArrowRight":case"l":case"d":return n({...i,x:i.x+1}),!0;case"ArrowUp":case"k":case"w":return n(cf(i))||n({...cf(i),x:i.x-1})||n({...cf(i),x:i.x+1}),!0;case"ArrowDown":case"j":case"s":return hm(t,s),!0;case" ":{for(;t.piece!==null;)hm(t,s);return!0}default:return!1}}function Rj(){const t=Tj();let e=Math.random;return{title:"TETRIS",tick:500,step:(s,i)=>{e=i,hm(t,i)},draw:(s,i)=>{const n=Math.max(0,Math.floor((s.cols-(so*2+2))/2)),r=Math.max(0,Math.floor((s.rows-co-1)/2)),o=["",i.cool,i.lit,i.warn,i.dim,i.lit,i.cool,i.warn];for(let a=0;a<co;a++){s.put(n,r+a,"|",i.dim),s.put(n+so*2+1,r+a,"|",i.dim);for(let l=0;l<so;l++){const c=t.well[a][l];c!==0&&s.text(n+1+l*2,r+a,"[]",o[c])}}if(s.text(n,r+co,"+"+"-".repeat(so*2)+"+",i.dim),t.piece!==null)for(const[a,l]of t.piece.cells){const c=t.piece.y+l;c>=0&&s.text(n+1+(t.piece.x+a)*2,r+c,"[]",o[t.piece.kind])}t.over&&s.text(n+2,r+9," GAME OVER ",i.warn)},key:s=>Cj(t,s,e),status:()=>`${t.score} · ${t.lines} lines${t.over?" · OVER":""}`,over:()=>t.over}}function kj(t,e,s){const i=t>>1,n=e>>1,r={body:[[i,n],[i-1,n],[i-2,n]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:t,rows:e};return C1(r,s),r}function C1(t,e){for(let s=0;s<1e3;s++){const i=[Math.floor(e()*t.cols),Math.floor(e()*t.rows)];if(!t.body.some(([n,r])=>n===i[0]&&r===i[1])){t.food=i;return}}}const Nj={up:"down",down:"up",left:"right",right:"left"};function Bj(t,e){Nj[e]!==t.heading&&(t.next=e)}function Gj(t,e){if(t.over)return;t.heading=t.next;const[s,i]=t.body[0],n=t.heading==="up"?[s,i-1]:t.heading==="down"?[s,i+1]:t.heading==="left"?[s-1,i]:[s+1,i],r=n[0]<0||n[1]<0||n[0]>=t.cols||n[1]>=t.rows,o=t.body.some(([a,l])=>a===n[0]&&l===n[1]);if(r||o){t.over=!0;return}t.body.unshift(n),n[0]===t.food[0]&&n[1]===t.food[1]?(t.score+=10,C1(t,e)):t.body.pop()}const Pj={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function Lj(){let t=null;return{title:"SNAKE",tick:140,step:(e,s)=>{t===null&&(t=kj(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),s)),Gj(t,s)},draw:(e,s)=>{t!==null&&(e.text(0,t.rows,"-".repeat(t.cols*2),s.dim),e.text(t.food[0]*2,t.food[1],"**",s.warn),t.body.forEach(([i,n],r)=>e.text(i*2,n,r===0?"@@":"oo",r===0?s.lit:s.cool)),t.over&&e.text(Math.max(0,t.cols-6),t.rows>>1," GAME OVER ",s.warn))},key:e=>{const s=Pj[e];return s===void 0||t===null?!1:(Bj(t,s),!0)},status:()=>t===null?"":`${t.score}${t.over?" · OVER":""}`,over:()=>t?.over??!1}}const R1={sl:xj,cmatrix:Oj,rain:Ej,aquarium:Aj,tetris:Rj,snake:Lj};function Wj(t){return t in R1}const Fj=8,Uj=26,hf=1.8,$j=100,wv=24;function yv(t,e){let s=Math.floor(t/$j);return e/(s*hf)<wv&&(s=Math.floor(e/wv/hf)),s=Math.max(Fj,Math.min(Uj,s)),{w:s,h:Math.round(s*hf)}}class jj{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=el(e,".games-field"),this.canvas=el(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=el(e,".games-focus"),this.pausePill=el(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),el(e,".games-restart").addEventListener("click",()=>{this.name!==null&&this.program_run(this.name)}),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>this.key_handle(s)),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.draw()),this.observer?.observe(this.field)}program_run(e){this.name=e,this.program=R1[e](),this.paused=!1,this.pausePill.textContent="PAUSE",this.clock_start(),this.program.key!==void 0&&(this.field.focus(),this.focusMark_paint(!0)),this.draw()}program_name(){return this.name}paused_is(){return this.paused}pause_toggle(){this.program!==null&&(this.paused=!this.paused,this.pausePill.textContent=this.paused?"RESUME":"PAUSE",this.paused?this.clock_stop():this.clock_start(),this.state_paint())}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}dispose(){this.clock_stop(),this.observer?.disconnect()}key_handle(e){if(e.key==="Escape"){this.field_release(),e.stopPropagation();return}if(this.program!==null){if(e.key===" "&&this.program.key===void 0){this.pause_toggle(),e.preventDefault(),e.stopPropagation();return}this.program.key?.(e.key)===!0&&(e.preventDefault(),this.draw()),e.stopPropagation()}}clock_start(){this.clock_stop();const e=this.program;e!==null&&(this.timer=setInterval(()=>{this.field.offsetParent!==null&&(e.step(this.size_measure(),Math.random),this.draw(),e.over?.()===!0&&this.clock_stop())},e.tick))}clock_stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}size_measure(){const e=this.field.getBoundingClientRect(),s=yv(e.width,e.height);return{cols:Math.max(10,Math.floor(e.width/s.w)),rows:Math.max(6,Math.floor(e.height/s.h))}}palette_read(){const e=getComputedStyle(this.pane),s=(i,n)=>e.getPropertyValue(i).trim()||n;return{lit:s("--harvestgold","#ffcc66"),dim:s("--butter","#ffff99"),warn:s("--tomato","#ff7766"),cool:s("--daybreak","#55aaff")}}draw(){this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.paint()}))}paint(){const e=this.program,s=this.canvas.getContext("2d");if(e===null||s===null)return;const i=this.field.getBoundingClientRect(),n=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(i.width*n)||this.canvas.height!==Math.floor(i.height*n))&&(this.canvas.width=Math.floor(i.width*n),this.canvas.height=Math.floor(i.height*n)),s.setTransform(n,0,0,n,0,0),s.clearRect(0,0,i.width,i.height);const r=yv(i.width,i.height);s.font=`${r.h-2}px 'Share Tech Mono', monospace`,s.textBaseline="top";const o=this.size_measure(),a=(c,h,d,u)=>{c<0||h<0||c>=o.cols||h>=o.rows||(s.fillStyle=u,s.fillText(d,c*r.w,h*r.h))},l={cols:o.cols,rows:o.rows,put:a,text:(c,h,d,u)=>{[...d].forEach((p,f)=>{p!==" "&&a(c+f,h,p,u)})}};e.draw(l,this.palette_read()),this.state_paint()}state_paint(){if(this.state===null||this.program===null)return;const e=this.program.status?.()??"";this.state.textContent=[this.program.title,e,this.paused?"PAUSED":""].filter(s=>s!=="").join(" · ")}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("games-field-focused",e)}}function el(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`games pane: missing ${e}`);return s}function Hj(t,e){const{layout:s,panels:i,subjects:n}=t;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-games"),c=new jj(l);return i.set("games",a,c),{id:a,kind:"games",mount:l,dispose:()=>{c.dispose(),i.delete(a),n.pane_leave(a)}}},show:a=>{const l=typeof a=="object"&&a!==null?a.program:void 0;if(typeof l!="string"||!Wj(l))return`games: no program named ${String(l)}`;const c=i.ids("games").find(f=>s.panes_shown().includes(f));if(c!==void 0)return s.focus_set(c),i.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const h=e.launcher_active();e.launcher_yield();const d=s.focused_get()??"files",u=e.instance_spawn("games");return(h?s.leaf_replace("files",u.id):s.leaf_split(d,"col",u.id,!1))?(h?s.focus_set(u.id):e.birth_record(u.id,d,"col",!1),i.get("games",u.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(As(u.id),s.mount_remove(u.id),"games: could not open a pane")}}}function st(t,e){const s=document.createElementNS("http://www.w3.org/2000/svg",t);for(const[i,n]of Object.entries(e))s.setAttribute(i,String(n));return s}const fr=["cruiser","raptor","talon","warbird"],Vj={ship:'<g fill="currentColor"><ellipse cx="12" cy="6.5" rx="9" ry="4"/><rect x="9.5" y="9.5" width="5" height="6" rx="1"/><rect x="3" y="14" width="5" height="8" rx="2.2"/><rect x="16" y="14" width="5" height="8" rx="2.2"/><rect x="7" y="16" width="10" height="2.2" rx="1"/></g>',"klingon-cruiser":'<g fill="currentColor"><circle cx="12" cy="4" r="2.6"/><rect x="11" y="5.5" width="2" height="8.5"/><path d="M12 12.5 L22 20.5 L22.5 22.5 L17 19.2 L12 18 L7 19.2 L1.5 22.5 L2 20.5 Z"/><rect x="8.5" y="18.5" width="7" height="3.2" rx="1.2"/></g>',"klingon-raptor":'<path fill="currentColor" d="M12 1.5 L14 6.5 L22.5 10.5 L21.5 18 L19.5 12.5 L15 13.5 L14 20 L12 17 L10 20 L9 13.5 L4.5 12.5 L2.5 18 L1.5 10.5 L10 6.5 Z"/>',"klingon-talon":'<g fill="currentColor"><path d="M12 1.5 L13.6 11 L21.5 4.5 L19 15 L12 22 L5 15 L2.5 4.5 L10.4 11 Z"/><circle cx="12" cy="13.5" r="1.6" fill="#000"/></g>',"klingon-warbird":'<g fill="currentColor"><rect x="8.5" y="2" width="7" height="3.2" rx="1.6"/><rect x="11.1" y="4.5" width="1.8" height="7"/><path d="M1.5 13 Q12 6 22.5 13 L22 20 Q17 15.5 14 17 L12 22 L10 17 Q7 15.5 2 20 Z"/></g>',base:'<g fill="currentColor"><path d="M12 1.5 L17 12 L12 22.5 L7 12 Z"/><rect x="1.5" y="10.8" width="21" height="2.4" rx="1.2"/><circle cx="12" cy="12" r="3" fill="#000"/></g>',inhabited:'<circle cx="12" cy="12" r="7.5" fill="currentColor"/><path d="M4.5 12 Q12 15.5 19.5 12" fill="none" stroke="#000" stroke-width="1.6"/><path d="M5.5 8.5 Q12 11 18.5 8.5" fill="none" stroke="#000" stroke-width="1.2" opacity="0.6"/>',star:'<g stroke="currentColor" stroke-width="1.8" stroke-linecap="round" fill="none"><path d="M12 2 V22 M2 12 H22 M4.9 4.9 L19.1 19.1 M19.1 4.9 L4.9 19.1"/></g><circle cx="12" cy="12" r="2.6" fill="currentColor"/>',hole:'<g fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M12 12 m0 -2.5 a2.5 2.5 0 1 1 -2.5 2.5"/><path d="M12 12 m0 -6 a6 6 0 1 1 -6 6"/><path d="M12 12 m0 -9.5 a9.5 9.5 0 1 1 -9.5 9.5" opacity="0.5"/></g>',supernova:'<g fill="currentColor"><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(120 12 12)"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(240 12 12)"/><circle cx="12" cy="12" r="2.4"/></g>'},Al="tm-";function k1(t,e=null){return t==="klingon"?`${Al}klingon-${e!==null&&fr.includes(e)?e:fr[0]}`:`${Al}${t}`}function qj(){if(document.getElementById(`${Al}ship`)!==null)return null;const t=st("svg",{class:"tm-defs",width:0,height:0,"aria-hidden":"true"}),e=st("defs",{});for(const[i,n]of Object.entries(Vj)){const r=st("symbol",{id:`${Al}${i}`,viewBox:"0 0 24 24"});r.innerHTML=n,e.append(r)}const s=(i,n)=>{const r=st("radialGradient",{id:`${Al}${i}`});for(const[o,a,l]of n){const c=st("stop",{offset:o});c.setAttribute("style",`stop-color: ${a}; stop-opacity: ${l}`),r.append(c)}return r};return e.append(s("halo",[[0,"var(--butter)",.9],[.35,"var(--harvestgold)",.5],[1,"var(--harvestgold)",0]]),s("halo-nova",[[0,"var(--butter)",.9],[.3,"var(--pumpkin-pie)",.6],[1,"var(--pumpkin-pie)",0]]),s("halo-mars",[[0,"var(--butter)",.8],[.3,"var(--mars)",.6],[1,"var(--mars)",0]]),s("photon-core",[[0,"#fff",1],[.35,"#ffd27a",1],[1,"#ff6a1a",1]]),s("photon-halo",[[0,"#ff6a1a",.55],[1,"#ff6a1a",0]])),t.append(e),t}function c_(t,e,s=null,i=0){const n=st("g",{class:`tm-mark tm-mark-${t}`});return n.append(st("use",{href:`#${k1(t,s)}`,x:-e.size/2,y:-e.size/2,width:e.size,height:e.size,class:"tm-symbol"})),N1(n,e.cx,e.cy,i),n}function N1(t,e,s,i=0){t.setAttribute("transform",i===0?`translate(${e} ${s})`:`translate(${e} ${s}) rotate(${i})`)}function h_(t,e=null){const s=st("svg",{viewBox:"0 0 24 24",class:`tm-icon tm-icon-${t}`,"aria-hidden":"true"});return s.append(st("use",{href:`#${k1(t,e)}`})),s}const Jc={ship:"E",klingon:"K",base:"#",inhabited:"@",star:"*",hole:" ",supernova:"///"},Kj=[{kind:"ship",name:"ENTERPRISE"},{kind:"klingon",name:"KLINGON"},{kind:"base",name:"STARBASE"},{kind:"inhabited",name:"INHABITED"},{kind:"star",name:"STAR"},{kind:"hole",name:"BLACK HOLE"},{kind:"supernova",name:"SUPERNOVA"}],Yj=/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,Xj=/^Klingon at (\d+),(\d+) escapes to quadrant/,Zj=/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/;class Tl{marks=new Map;mark_find(e){return this.marks.get(Tl.key_format(e))??null}line_hear(e){const s=Yj.exec(e);if(s!==null){const n=`${s[1]},${s[2]}`,r=this.marks.get(n);return this.marks.delete(n),r!==void 0&&this.marks.set(`${s[3]},${s[4]}`,r),!0}const i=Xj.exec(e)??Zj.exec(e);return i!==null?(this.marks.delete(`${i[1]},${i[2]}`),!0):!1}reconcile(e,s={}){s.reset===!0&&this.marks.clear();const i=new Set(e.map(n=>Tl.key_format(n)));for(const n of[...this.marks.keys()])i.has(n)||this.marks.delete(n);e.forEach((n,r)=>{const o=Tl.key_format(n);if(s.byOrder===!0){this.marks.set(o,fr[r%fr.length]);return}this.marks.has(o)||this.marks.set(o,this.leastWorn_get())})}clear(){this.marks.clear()}leastWorn_get(){const e=new Map(fr.map(i=>[i,0]));for(const i of this.marks.values())e.set(i,(e.get(i)??0)+1);let s=fr[0];for(const i of fr)(e.get(i)??0)<(e.get(s)??0)&&(s=i);return s}static key_format(e){return`${e.x},${e.y}`}}function Jj(t,e,s,i){const n=Math.max(0,Math.min(100,100*t/Math.max(1,e)));return i?{className:"tb-ring tb-ring-docked",width:.09,percent:n}:s?{className:`tb-ring ${n>60?"tb-ring-full":n>30?"tb-ring-mid":"tb-ring-low"}`,width:.025+.085*n/100,percent:n}:{className:"tb-ring tb-ring-down",width:.02,percent:n}}function q(t,e,s){const i=document.createElement(t);return i.className=e,s!==void 0&&(i.textContent=s),i}function Os(t,e,s){const i=q("button",`tb-pill ${t}`,e);return i.type="button",i.addEventListener("click",s),i}const Qj=16;class B1{constructor(e,s,i){this.onCommit=i,this.size=e;const n=e/2;this.root=q("div","tb-wheel");const r=st("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,role:"img","aria-label":s});r.classList.add("tb-wheel-face"),r.append(st("circle",{cx:n,cy:n,r:n-4,class:"tb-wheel-rim"})),r.append(st("circle",{cx:n,cy:n,r:(n-4)*.66,class:"tb-wheel-ring"})),r.append(st("circle",{cx:n,cy:n,r:(n-4)*.33,class:"tb-wheel-ring"}));for(let l=0;l<36;l++){const c=l*Math.PI/18,h=l%3===0,d=n-4-(h?12:7);r.append(st("line",{x1:n+d*Math.sin(c),y1:n-d*Math.cos(c),x2:n+(n-4)*Math.sin(c),y2:n-(n-4)*Math.cos(c),class:h?"tb-wheel-tick-major":"tb-wheel-tick"}))}for(const l of[0,90,180,270]){const c=l*Math.PI/180,h=st("text",{x:n+(n-26)*Math.sin(c),y:n-(n-26)*Math.cos(c)+4,"text-anchor":"middle",class:"tb-wheel-label"});h.textContent=String(l),r.append(h)}this.wedge=st("path",{d:"",class:"tb-wheel-wedge"}),r.append(this.wedge),this.marks=st("g",{class:"tb-wheel-marks"}),r.append(this.marks),this.needle=st("line",{x1:n,y1:n,x2:n,y2:14,class:"tb-wheel-needle"}),r.append(this.needle),r.append(st("circle",{cx:n,cy:n,r:6,class:"tb-wheel-hub"})),this.root.append(r);const o=q("div","tb-wheel-row");this.readout=q("span","tb-wheel-readout","0°"),this.commit=Os("tb-commit","SET COURSE",()=>this.onCommit(Math.round(this.degrees))),o.append(this.readout,this.commit),this.root.append(o);const a=l=>{const c=r.getBoundingClientRect(),h=l.clientX-c.left-c.width/2,d=l.clientY-c.top-c.height/2;this.degrees_set((Math.atan2(h,-d)*180/Math.PI+360)%360)};r.addEventListener("pointerdown",l=>{r.setPointerCapture(l.pointerId),a(l)}),r.addEventListener("pointermove",l=>{l.buttons!==0&&a(l)})}onCommit;root;needle;marks;wedge;readout;commit;degrees=0;wedgeHalf=null;size;degrees_set(e){this.degrees=e;const s=this.size/2,i=e*Math.PI/180;this.needle.setAttribute("x2",String(s+(s-14)*Math.sin(i))),this.needle.setAttribute("y2",String(s-(s-14)*Math.cos(i))),this.readout.textContent=`${Math.round(e)}°`,this.wedge_draw()}degrees_get(){return this.degrees}wedge_set(e){this.wedgeHalf=e,this.wedge_draw()}wedge_draw(){if(this.wedgeHalf===null){this.wedge.setAttribute("d","");return}const e=this.size/2,s=e-14,i=(this.degrees-this.wedgeHalf)*Math.PI/180,n=(this.degrees+this.wedgeHalf)*Math.PI/180,r=e+s*Math.sin(i),o=e-s*Math.cos(i),a=e+s*Math.sin(n),l=e-s*Math.cos(n);this.wedge.setAttribute("d",`M ${e} ${e} L ${r} ${o} A ${s} ${s} 0 0 1 ${a} ${l} Z`)}marks_set(e){this.marks.replaceChildren();const s=this.size/2;for(const i of e){const n=i.bearing*Math.PI/180,r=(s-4)*.8,o=s+r*Math.sin(n),a=s-r*Math.cos(n),l=i.kind==="klingon"?i.bearing+180:0,c=c_(i.kind,{cx:o,cy:a,size:Qj},i.variant??null,l);c.classList.add("tb-wheel-mark",`tb-wheel-mark-${i.kind}`);const h=st("title",{});h.textContent=i.label,c.append(h),this.marks.append(c)}}lit_set(e,s="SET COURSE"){this.root.classList.toggle("tb-lit",e),this.commit.disabled=!e,this.commit.textContent=s}}class xr{constructor(e,s,i,n){this.digits=i,this.onCommit=n,this.root=q("div","tb-slider");const r=q("label","tb-slider-label",s);r.htmlFor=e,this.input=document.createElement("input"),this.input.type="range",this.input.id=e,this.input.className="tb-slider-input",this.input.addEventListener("input",()=>{this.shown_refresh(),this.onInput?.(this.value_get())});const o=q("div","tb-slider-column");this.ticks=q("div","tb-slider-ticks"),this.note=q("span","tb-slider-note"),o.append(this.input,this.ticks,this.note),this.shown=q("span","tb-slider-readout","—"),this.commit=Os("tb-commit","SET",()=>this.onCommit(this.value_get())),this.root.append(r,o,this.shown,this.commit)}digits;onCommit;root;input;shown;commit;note;ticks;onInput=null;range_set(e,s,i,n=0){const r=e.min??0,o=e.max??1;this.input.min=String(r),this.input.max=String(o),this.input.step=String(e.step??1),this.input.value=String(Math.min(o,Math.max(r,s))),this.note.textContent=i,this.ticks.replaceChildren();for(let a=0;a<n;a++){const l=r+(o-r)*a/Math.max(1,n-1);this.ticks.append(q("span","tb-slider-tick",Number.isInteger(l)?String(l):l.toFixed(1)))}this.shown_refresh()}input_listen(e){this.onInput=e}note_set(e){this.note.textContent=e}value_get(){return Number(this.input.value)}value_set(e){this.input.value=String(e),this.shown_refresh()}lit_set(e,s="SET"){this.root.classList.toggle("tb-lit",e),this.input.disabled=!e,this.commit.disabled=!e,this.commit.textContent=s}lit_is(){return this.root.classList.contains("tb-lit")}shown_refresh(){this.shown.textContent=this.value_get().toFixed(this.digits)}}class Qc{root;buttons=[];note;constructor(e,s,i){this.root=q("div","tb-pillrow"),e!==""&&this.root.append(q("span","tb-slider-label",e));const n=q("div","tb-slider-column"),r=q("div","tb-pills");for(const o of s){const a=Os("tb-choice",o.label,()=>i(o.line,o.label));a.dataset.line=o.line,this.buttons.push(a),r.append(a)}this.note=q("span","tb-slider-note",""),n.append(r,this.note),this.root.append(n)}note_set(e){this.note.textContent=e}lit_set(e){this.root.classList.toggle("tb-lit",e);for(const s of this.buttons)s.disabled=!e}}const e6=[[/Klingon attack:/,"incoming"],[/^HIT: \d+ units/,"hit"],[/CRITICAL HIT/,"hit"],[/\*\*\* Klingon at \d+,\d+ destroyed \*\*\*/,"explosion"],[/\*\*\*\*\* .* destroyed \*\*\*\*\*/,"explosion"],[/Starbase at \d+,\d+ destroyed/,"explosion"],[/Inhabited starsystem .* destroyed/,"explosion"],[/^Torpedo track/,"torpedo"],[/^Phaser bank \d+ fires:/,"phaser"],[/^Phasers locked on target/,"phaser"],[/^Starbase in \d+,\d+ responds/,"hail"],[/^Password verified; self destruct sequence continues/,"destruct"]];function t6(t){const e=[];for(const[s,i]of e6)s.test(t)&&!e.includes(i)&&e.push(i);return e}function s6(t,e){const s=[];if(t!==null&&t.condition.name!==e.condition.name)switch(e.condition.name){case"RED":s.push("redalert");break;case"YELLOW":s.push("yellowalert");break;case"DOCKED":s.push("dock");break;default:s.push("green");break}return t!==null&&(t.position.quadrant.x!==e.position.quadrant.x||t.position.quadrant.y!==e.position.quadrant.y)&&s.push("sensor"),s}function i6(t){switch(t){case"abandon":return"transporter";case"destruct":return"destruct";case"computer":return"thinking";default:return null}}function n6(t,e){return t!=="distance"?null:e==="impulse"?"impulse":e==="move"||e==="ram"?"warp":null}function gr(t,e){return e==="computer"&&t==="MOVE"?"MOVE (COMPUTER)":e==="commit"?/^SET COURSE/.test(t)?"SET COURSE":"SLIDER SET":e==="choice"&&/^\d+°$/.test(t)?"BURST ANGLE":/^CANCEL/.test(t)?"CANCEL":t}const Ss=10,Ul=8,r6="*",o6="#",G1="E",a6="Q",l6="K",c6="@",P1=" ",h6=7,d6=64,u6=63,f6=0,p6=1,m6=2,g6=3,_6=[{name:"warp drive",person:"Scotty"},{name:"S.R. scanners",person:"Scotty"},{name:"L.R. scanners",person:"Scotty"},{name:"phasers",person:"Sulu"},{name:"photon tubes",person:"Sulu"},{name:"impulse engines",person:"Scotty"},{name:"shield control",person:"Sulu"},{name:"computer",person:"Spock"},{name:"subspace radio",person:"Uhura"},{name:"life support",person:"Scotty"},{name:"navigation system",person:"Chekov"},{name:"cloaking device",person:"Scotty"},{name:"transporter",person:"Scotty"},{name:"shuttlecraft",person:"Scotty"},{name:"*ERR 14*",person:"Nobody"},{name:"*ERR 15*",person:"Nobody"}],b6=["GREEN","DOCKED","YELLOW","RED"];function xh(t,e){return(Math.atan2(e.y-t.y,-(e.x-t.x))*180/Math.PI+360)%360}function ad(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function M6(t){switch(t){case G1:case a6:return"ship";case l6:return"klingon";case o6:return"base";case r6:return"star";case c6:return"inhabited";case P1:return"hole";default:return"empty"}}function v6(t){const e=new Map;for(const s of t)(s.evcode&u6)!==h6||(s.evcode&d6)!==0||e.set(s.systemname,s.date);return _6.map((s,i)=>({index:i,name:s.name,person:s.person,repairAt:e.get(i)??null})).filter(s=>!s.name.startsWith("*"))}function w6(t){const e=t.Etc.nkling;switch(t.Ship.cond){case g6:return e===1?"1 Klingon in this quadrant":`${e} Klingons in this quadrant`;case m6:return t.Ship.energy<t.Param.energylow?"energy low":"Klingons near";case p6:return"docked at a starbase";case f6:default:return"all clear"}}function y6(t){const{Ship:e,Now:s,Game:i,Param:n,Etc:r,Sect:o,Quad:a}=t,l={x:e.quadx,y:e.quady},c={x:e.sectx,y:e.secty},h=[];for(let m=0;m<Ss;m++){const w=[];for(let y=0;y<Ss;y++){const b=o[m]?.[y]??P1;w.push({x:m,y,kind:M6(b),glyph:b})}h.push(w)}const d=r.klingon.slice(0,r.nkling).map(m=>({x:m.x,y:m.y,bearing:xh(c,m),range:ad(c,m),power:m.power,mark:null})).sort((m,w)=>m.range-w.range),u=s.base.slice(0,s.bases).map(m=>({x:m.x,y:m.y}));let p=null;for(const m of u){const w=ad(l,m);(p===null||w<p.range)&&(p={at:m,range:w,here:w===0})}const f=[];for(let m=0;m<Ul;m++){const w=[];for(let y=0;y<Ul;y++){const v=a[m]?.[y]?.scanned??-1,z=v<0?null:v>=1e3?"///":String(v).padStart(3,"0");w.push({x:m,y,here:m===l.x&&y===l.y,code:z,supernova:v>=1e3,klingons:v<0||v>=1e3?0:Math.floor(v/100),bases:v<0||v>=1e3?0:Math.floor(v%100/10)})}f.push(w)}const _=v6(t.Event),g=_.filter(m=>m.repairAt!==null).sort((m,w)=>(m.repairAt??0)-(w.repairAt??0));return{condition:{name:b6[e.cond]??"GREEN",why:w6(t)},ship:{shipName:e.shipname,energy:e.energy,energyMax:n.energy,shield:e.shield,shieldMax:n.shield,shieldsUp:e.shldup!==0,cloaked:e.cloaked!==0,torpedoes:e.torped,torpedoesMax:n.torped,reserves:e.reserves,reservesMax:n.reserves,crew:e.crew,warp:e.warp},mission:{stardate:s.date,timeLeft:s.time,klingonsLeft:s.klings,klingonsStart:n.klings,killed:i.killk,captives:i.captives,starbases:s.bases},position:{quadrant:l,sector:c},sectors:h,klingons:d,bases:u,nearestBase:p,chart:f,devices:_,damaged:g,game:{killk:i.killk,killb:i.killb,kills:i.kills,killinhab:i.killinhab,helps:i.helps,captives:i.captives,deaths:i.deaths,killed:i.killed!==0,skill:i.skill,won:t.Move.endgame>0,abandoned:e.ship!==G1},param:{warptime:n.warptime,dockfac:n.dockfac,klingpwr:n.klingpwr,date:n.date}}}const z6=["novice","fair","good","expert","commodore","impossible"];function L1(t){const{game:e,mission:s,param:i}=t,n=[];n.push({label:`${e.killk} Klingons killed`,points:Math.trunc(i.klingpwr/4)*e.killk});const r=Math.max(1,s.stardate-i.date),o=e.killk/r;return n.push({label:`kill rate ${o.toFixed(2)} Klingons/stardate`,points:Math.trunc(400*o)}),n.push({label:`penalty for ${s.klingonsLeft} Klingons remaining`,points:Math.trunc(-400*s.klingonsLeft/(e.killk+1))}),e.won&&n.push({label:`bonus for winning a ${z6[e.skill-1]??""} game`,points:100*e.skill}),e.killed&&n.push({label:"penalty for getting killed",points:-500}),n.push({label:`${e.killb} starbases killed`,points:-100*e.killb}),n.push({label:`${e.helps} calls for help`,points:-100*e.helps}),n.push({label:`${e.kills} stars destroyed`,points:-5*e.kills}),n.push({label:`${e.killinhab} inhabited starsystems destroyed`,points:-150*e.killinhab}),e.abandoned&&n.push({label:"penalty for abandoning ship",points:-200}),n.push({label:`${e.captives} Klingons captured`,points:3*e.captives}),n.push({label:`${e.deaths} casualties`,points:-e.deaths}),{items:n,total:n.reduce((a,l)=>a+l.points,0)}}function zv(t,e){const{quadrant:s,sector:i}=t.position,n=s.x+i.x/Ss-(e.quadrant.x+e.sector.x/Ss),r=e.quadrant.y+e.sector.y/Ss-(s.y+i.y/Ss);let o=Math.atan2(r,n);return o<0&&(o+=2*Math.PI),{course:Math.trunc(o*180/Math.PI+.5)%360,distance:Math.hypot(n,r)}}function S6(t,e,s){const{quadrant:i,sector:n}=t.position,r=e*Math.PI/180,o=Math.min(Ul*Ss-1,Math.max(0,Math.round(i.x*Ss+n.x-Math.cos(r)*s*Ss))),a=Math.min(Ul*Ss-1,Math.max(0,Math.round(i.y*Ss+n.y+Math.sin(r)*s*Ss)));return{quadrant:{x:Math.trunc(o/Ss),y:Math.trunc(a/Ss)},sector:{x:o%Ss,y:a%Ss}}}function W1(t,e,s){const i=Math.trunc((t+.05)*e*e*e);return{stardates:s*t/(e*e),units:i,unitsShielded:2*i}}function x6(t){return{stardates:t/.095,units:Math.trunc(20+100*t)}}function F1(t){return Math.trunc(Math.pow(.9,t*10)*98+.5)}function Sv(t,e){if(t.repairAt===null)return null;const s=t.repairAt-e.mission.stardate,i=e.condition.name==="DOCKED",n=i?1/e.param.dockfac:1,r=i?1:e.param.dockfac;return{inFlight:s*n+.005,docked:s*r+.005}}function U1(t,e){const s=[],i=(d,u)=>`${d>0?"+":d<0?"−":""}${Math.abs(d).toFixed(u)}`,n=e.mission.stardate-t.mission.stardate;Math.abs(n)>=.005&&s.push({label:"STARDATE",change:i(n,2),bad:!1});const r=e.ship.energy-t.ship.energy;r!==0&&s.push({label:"ENERGY",change:i(r,0),bad:r<0});const o=e.ship.shield-t.ship.shield;o!==0&&s.push({label:"SHIELDS",change:i(o,0),bad:o<0});const a=e.ship.torpedoes-t.ship.torpedoes;a!==0&&s.push({label:"TORPEDOES",change:i(a,0),bad:!1});const l=e.mission.klingonsLeft-t.mission.klingonsLeft;l!==0&&s.push({label:"KLINGONS",change:`${i(l,0)} · ${e.mission.klingonsLeft} LEFT`,bad:l>0});const c=e.damaged.filter(d=>!t.damaged.some(u=>u.index===d.index));c.length>0&&s.push({label:"DAMAGE",change:c.map(d=>d.name.toUpperCase()).join(" · "),bad:!0});const h=t.damaged.filter(d=>!e.damaged.some(u=>u.index===d.index));return h.length>0&&s.push({label:"REPAIRED",change:h.map(d=>d.name.toUpperCase()).join(" · "),bad:!1}),t.condition.name!==e.condition.name&&s.push({label:"CONDITION",change:e.condition.name,bad:e.condition.name==="RED"}),s}const O6=[["return to continue","return"],["What length game","length"],["What skill game","skill"],["Enter password verification","password-verify"],["Enter a password","password"],["Enter tournament code","tournament"],["Command","command"],["Torpedo course","torpedo-course"],["Course","course"],["course","bank-course"],["Distance","distance"],["distance","computer-distance"],["Warp factor","warp-factor"],["warp factor","computer-warp"],["How long","how-long"],["Manual or automatic","manual-automatic"],["Units to fire","units"],["units","bank-units"],["spread","spread"],["Do you want a burst","burst"],["burst angle","burst-angle"],["Up or down","up-down"],["Request","request"],["Quadrant","quadrant"],["q-y","quadrant-y"],["Sector","sector"],["s-y","sector-y"],["range","range"],["direction","direction"],["status report","status-report"],["Another game","another"]];function E6(t){const e=t.replace(/[:.\s]+$/,"");if(e==="")return"return";for(const[s,i]of O6)if(e.endsWith(s))return i;return/wise$|certain that is wise$|Shall we cancel our rest period$/.test(e)?"yes-no":"unknown"}const Pd=[{id:"move",label:"MOVE",station:"helm",line:"m",asks:["course","distance"]},{id:"ram",label:"RAM",station:"helm",line:"ram",asks:["course","distance"]},{id:"warp",label:"WARP",station:"helm",line:"w",asks:["warp-factor"]},{id:"impulse",label:"IMPULSE",station:"helm",line:"i",asks:["course","distance"]},{id:"dock",label:"DOCK",station:"helm",line:"do",asks:[]},{id:"undock",label:"UNDOCK",station:"helm",line:"u",asks:[]},{id:"rest",label:"REST",station:"helm",line:"r",asks:["how-long"]},{id:"phasers",label:"PHASERS",station:"tactical",line:"p",asks:["manual-automatic","units"]},{id:"torpedo",label:"TORPEDO",station:"tactical",line:"t",asks:["torpedo-course","burst","burst-angle"]},{id:"shields",label:"SHIELDS",station:"tactical",line:"sh",asks:["up-down"]},{id:"cloak",label:"CLOAK",station:"tactical",line:"cl",asks:["up-down"]},{id:"capture",label:"CAPTURE",station:"tactical",line:"ca",asks:[]},{id:"visual",label:"VISUAL",station:"tactical",line:"v",asks:["direction"]},{id:"computer",label:"COMPUTER",station:"ship",line:"c",asks:["request"]},{id:"help",label:"CALL STARBASE",station:"ship",line:"help",asks:[]},{id:"dump",label:"DUMP",station:"ship",line:"dump",asks:[]},{id:"credits",label:"CREDITS",station:"ship",line:"cr",asks:[]},{id:"abandon",label:"ABANDON",station:"ship",line:"abandon",asks:[],grave:!0},{id:"destruct",label:"DESTRUCT",station:"ship",line:"destruct",asks:["password-verify"],grave:!0},{id:"terminate",label:"TERMINATE",station:"ship",line:"terminate",asks:[],grave:!0}];function xs(t,e){switch(t){case"return":return{kind:"auto"};case"length":return{kind:"pills",choices:[{label:"SHORT",line:"s"},{label:"MEDIUM",line:"m"},{label:"LONG",line:"l"},{label:"RESTART",line:"restart"}]};case"skill":return{kind:"pills",choices:[{label:"NOVICE",line:"n"},{label:"FAIR",line:"f"},{label:"GOOD",line:"g"},{label:"EXPERT",line:"e"},{label:"COMMODORE",line:"c"},{label:"IMPOSSIBLE",line:"i"}]};case"password":case"tournament":case"password-verify":return{kind:"auto"};case"course":case"torpedo-course":case"direction":case"bank-course":return{kind:"wheel",min:0,max:360,step:1,commit:"SET COURSE",cancel:"-1"};case"distance":return{kind:"slider",min:0,max:15,step:.1,commit:"ENGAGE",cancel:"-1"};case"computer-distance":case"range":return{kind:"slider",min:0,max:15,step:.1,commit:"SET"};case"warp-factor":return{kind:"slider",min:1,max:10,step:.1,commit:"SET WARP",cancel:"-1"};case"computer-warp":return{kind:"slider",min:1,max:10,step:.1,commit:"SET"};case"how-long":return{kind:"slider",min:0,max:Math.max(.1,e?.mission.timeLeft??15),step:.1,commit:"REST",cancel:"0"};case"manual-automatic":return{kind:"pills",choices:[{label:"MANUAL",line:"m"},{label:"AUTOMATIC",line:"a"}]};case"units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"FIRE",cancel:"0"};case"bank-units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"SET",cancel:"0"};case"spread":return{kind:"slider",min:0,max:1,step:.05,commit:"SET"};case"burst":case"status-report":case"another":case"yes-no":return{kind:"yesno",choices:[{label:"YES",line:"y"},{label:"NO",line:"n"}]};case"burst-angle":return{kind:"pills",choices:[1,2,3,5,8,10,12,15].map(s=>({label:`${s}°`,line:String(s)})),cancel:"0"};case"up-down":return{kind:"pills",choices:[{label:"UP",line:"u"},{label:"DOWN",line:"d"}]};case"request":return{kind:"pills",choices:[{label:"CHART",line:"ch"},{label:"TRAJECTORY",line:"t"},{label:"COURSE",line:"c"},{label:"MOVE",line:"m"},{label:"SCORE",line:"s"},{label:"PHASER EFFECT",line:"p"},{label:"WARP COST",line:"w"},{label:"IMPULSE COST",line:"i"},{label:"DISTRESS LIST",line:"d"}]};case"quadrant":case"quadrant-y":return{kind:"slider",min:0,max:Ul-1,step:1,commit:"SET"};case"sector":case"sector-y":return{kind:"slider",min:0,max:Ss-1,step:1,commit:"SET"};default:return{kind:"text"}}}function A6(){return`argus${Math.floor(Math.random()*9e3+1e3)}`}class T6{constructor(e){this.hooks=e}hooks;open=null;lastCommand=null;password=A6();ended=!1;ask(e){const s=E6(e);return s==="return"?Promise.resolve(""):s==="password"||s==="tournament"||s==="password-verify"?Promise.resolve(this.password):(s==="command"&&(this.lastCommand=null),new Promise(i=>{this.open={question:{prompt:e,question:s,command:this.lastCommand},answer:i},this.hooks.question_changed(this.open.question)}))}question_get(){return this.open?.question??null}answer(e){if(this.open===null)return!1;const{answer:s}=this.open;return this.open=null,this.hooks.question_changed(null),s(e),!0}command_send(e){return this.open?.question.question!=="command"?!1:(this.lastCommand=e,this.answer(e.line))}abandon(){if(this.open===null)return!1;const{answer:e}=this.open;return this.open=null,this.hooks.question_changed(null),e(null),!0}text_take(e){this.hooks.text_written(e)}event_take(e,s){e==="games.trek.state"&&typeof s=="object"&&s!==null&&this.hooks.state_shown(s)}end(e){this.ended||(this.ended=!0,this.open=null,this.hooks.ended(e))}ended_is(){return this.ended}}const Un={torpedoPoint:140,sector:170,burst:800,beam:900,rescan:350,flare:900,tail:300},I6=[[/^Torpedo track(?:, torpedo number \d+)?:/,()=>({kind:"torpedo-head"})],[/^\s*(\d+\.\d)\s+(\d+\.\d)\s*$/,t=>({kind:"torpedo-point",at:{x:Number(t[1]),y:Number(t[2])}})],[/^Torpedo missed|^Torpedo disappears into a black hole/,()=>({kind:"torpedo-end"})],[/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/,t=>({kind:"kill",at:ui(t,1)})],[/^Starbase at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/^Inhabited starsystem .* at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/^Unknown object . at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/Star at (\d+),(\d+) gone nova/,t=>({kind:"nova",at:ui(t,1)})],[/^Photon tubes misfire/,()=>({kind:"misfire"})],[/^(\d+) unit hit on Klingon at (\d+),(\d+)/,t=>({kind:"phaser",at:ui(t,2)})],[/^HIT: (\d+) units(?: from (\d+),(\d+))?(?:, shields absorb (\d+)%)?/,t=>({kind:"incoming",hit:Number(t[1]),from:t[2]===void 0?null:ui(t,2),absorb:t[4]===void 0?0:Number(t[4])})],[/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,t=>({kind:"klingon-move",from:ui(t,1),to:ui(t,3)})],[/^Klingon at (\d+),(\d+) escapes to quadrant (\d+),(\d+)/,t=>({kind:"klingon-escape",from:ui(t,1),quadrant:ui(t,3)})],[/RED ALERT: supernova occurring at (\d+),(\d+)/,t=>({kind:"supernova",at:ui(t,1)})],[/^\s*in quadrant (\d+),(\d+)\.\s+Caution is advised/,t=>({kind:"supernova-report",quadrant:ui(t,1)})]];function ui(t,e){return{x:Number(t[e]),y:Number(t[e+1])}}function D6(t){for(const[e,s]of I6){const i=e.exec(t);if(i!==null)return s(i)}return null}class C6{constructor(e=R6){this.reduced=e}reduced;frames=[];running=!1;skipping=!1;waiting=new Set;played={};push(e){this.frames.push(e),this.pump()}skip(){if(!(this.frames.length===0&&!this.running)){this.skipping=!0;for(const e of this.waiting)e();this.waiting.clear()}}busy_is(){return this.running||this.frames.length>0}pending_count(){return this.frames.length}skipping_is(){return this.skipping}async settle(){for(;this.busy_is();)await new Promise(e=>{setTimeout(e,1)})}wait(e){return this.skipping||e<=0?Promise.resolve():new Promise(s=>{const i=setTimeout(()=>{this.waiting.delete(n),s()},e),n=()=>{clearTimeout(i),s()};this.waiting.add(n)})}async tween(e,s){const i=xv();for(;!this.skipping;){const n=Math.min(1,(xv()-i)/Math.max(1,e));if(s(n),n>=1)return;await k6(this)}s(1)}async pump(){if(!this.running){this.running=!0;try{for(;this.frames.length>0;){const e=this.frames.shift();this.played[e.kind]=(this.played[e.kind]??0)+1;const s=this.skipping||this.reduced();try{await e.run(s)}catch{}}}finally{this.running=!1,this.skipping=!1}}}}function R6(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function xv(){return typeof performance=="object"?performance.now():Date.now()}function k6(t){return typeof requestAnimationFrame=="function"?new Promise(e=>{requestAnimationFrame(()=>e())}):t.wait(16)}function ya(t){return[t.y+.5,t.x+.5]}function $1(t,e){return(Math.atan2(e.y-t.y,-(e.x-t.x))*180/Math.PI+360)%360}function N6(t,e,s=10){const i={x:t.quadrant.x*s+t.sector.x,y:t.quadrant.y*s+t.sector.y},n={x:e.quadrant.x*s+e.sector.x,y:e.quadrant.y*s+e.sector.y},r={x:n.x-i.x,y:n.y-i.y},o=(p,f,_)=>{let g=_?1/0:-1/0;for(const m of["x","y"]){if(r[m]===0)continue;const w=p[m]*s-.5,y=p[m]*s+s-.5,b=(w-f[m])/r[m],v=(y-f[m])/r[m];_?g=Math.min(g,Math.max(b,v)):g=Math.max(g,Math.min(b,v))}return Number.isFinite(g)?Math.max(0,Math.min(1,g)):_?1:0},a=o(t.quadrant,i,!0),l=o(e.quadrant,i,!1),c=.7,h={x:i.x+r.x*a-t.quadrant.x*s,y:i.y+r.y*a-t.quadrant.y*s},d={x:i.x+r.x*l-e.quadrant.x*s,y:i.y+r.y*l-e.quadrant.y*s},u=Math.hypot(r.x,r.y)||1;return{exit:{x:h.x+r.x/u*c,y:h.y+r.y/u*c},entry:{x:d.x-r.x/u*c,y:d.y-r.y/u*c}}}function Ld(t,e=""){const s=st("g",{class:`tb-motion ${e}`.trim()});return t.append(s),s}const B6=.7;async function tl(t,e,s,i,n,r={},o=!1){if(o)return;const a=Ld(t,"tb-motion-slide"),[l,c]=ya(i),[h,d]=ya(n),u=r.hostile===!0?" tb-hostile":"";a.append(st("line",{class:`tb-track${u}`,x1:l,y1:c,x2:h,y2:d}));const p=st("line",{class:`tb-pulse tb-pulse-wide${u}`,x1:l,y1:c,x2:l,y2:c}),f=st("line",{class:`tb-pulse tb-pulse-core${u}`,x1:l,y1:c,x2:l,y2:c}),_=r.heading??$1(i,n),g=c_(s.kind,{cx:l,cy:c,size:B6},s.variant,_);g.classList.add(`tb-sector-${s.kind}`),a.append(p,f,g);const m=Math.max(1,Math.hypot(n.x-i.x,n.y-i.y));await e.tween(m*Un.sector,w=>{const y=l+(h-l)*w,b=c+(d-c)*w,v=Math.max(0,w-.12),z=l+(h-l)*v,x=c+(d-c)*v;for(const M of[p,f])M.setAttribute("x1",String(z)),M.setAttribute("y1",String(x)),M.setAttribute("x2",String(y)),M.setAttribute("y2",String(b));N1(g,y,b,_)}),a.remove()}async function Ov(t,e,s,i,n,r=!1){if(r)return;const o=Ld(t,"tb-motion-beam"),[a,l]=ya(s),[c,h]=ya(i),d=n?" tb-hostile":"";o.append(st("line",{class:`tb-beam${d}`,x1:a,y1:l,x2:c,y2:h}),st("line",{class:`tb-beam tb-beam-core${d}`,x1:a,y1:l,x2:c,y2:h})),await e.wait(Un.beam),o.remove()}async function eh(t,e,s,i,n=!1){if(n)return;const r=Ld(t,`tb-motion-burst tb-burst tb-burst-${i}`),[o,a]=ya(s),l=i==="misfire"?Un.burst*.6:i==="supernova"?Un.burst*1.6:Un.burst;r.style.setProperty("--tb-ms",`${l}ms`),r.append(st("circle",{class:"tb-burst-halo",cx:o,cy:a,r:.1}));const c=st("g",{class:"tb-burst-spikes"}),h=i==="nova"||i==="supernova"?12:8,d=i==="misfire"?.6:i==="supernova"?1.8:i==="nova"?1.1:.95;for(let u=0;u<h;u++){const p=u/h*Math.PI*2+(h===8?Math.PI/8:0);c.append(st("line",{class:"tb-burst-spike",x1:o+Math.cos(p)*.12,y1:a+Math.sin(p)*.12,x2:o+Math.cos(p)*d,y2:a+Math.sin(p)*d}))}r.append(c,st("circle",{class:"tb-burst-core",cx:o,cy:a,r:.04})),await e.wait(l),r.remove()}async function G6(t,e,s=!1){if(s)return;const i=t.querySelector(".tb-ring");if(i===null)return;const n=st("circle",{class:"tb-motion tb-ring-flare",cx:i.getAttribute("cx")??0,cy:i.getAttribute("cy")??0,r:.46});t.append(n),await e.wait(Un.flare),n.remove()}class P6{layer;tail;photon;points=[];constructor(e,s){this.layer=Ld(e,"tb-motion-torpedo"),this.tail=st("g",{class:"tb-tail"}),this.photon=st("g",{class:"tb-photon"}),this.photon.append(st("circle",{class:"tb-photon-halo",cx:0,cy:0,r:.34}));const i=st("g",{class:"tb-photon-pulses"});for(let o=0;o<10;o++){const a=st("g",{transform:`rotate(${o*36})`});a.append(st("rect",{x:.08,y:-.016,width:.2+o%3*.05,height:.032,rx:.006})),i.append(a)}this.photon.append(i,st("circle",{class:"tb-photon-core",cx:0,cy:0,r:.12})),this.layer.append(this.tail,this.photon);const[n,r]=ya(s);this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`)}async point_reach(e,s,i=!1){const[n,r]=[s.y,s.x];this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`),this.tail.replaceChildren();const o=this.points.slice(-4);for(let a=1;a<o.length;a++){const[l,c]=o[a-1],[h,d]=o[a];this.tail.append(st("line",{class:"tb-tail-segment",x1:l,y1:c,x2:h,y2:d,"stroke-width":.03+.03*a,opacity:.25+.25*a}))}i||await e.wait(Un.torpedoPoint)}async end(e,s=!1){this.photon.remove(),s||await e.wait(Un.tail),this.layer.remove()}}function Ev(t,e){t.classList.toggle("tb-rescan",e)}function L6(t,e){t.classList.remove("tb-bloom","tb-bloom-hostile"),t.offsetWidth,t.classList.add("tb-bloom"),e&&t.classList.add("tb-bloom-hostile"),t.addEventListener("animationend",()=>t.classList.remove("tb-bloom","tb-bloom-hostile"),{once:!0})}function gi(t,e){return t!==null&&e.includes(t.question)}function Wd(t,e){const s=q("div","tb-station-head"),i=q("span","tb-station-step",""),n=Os("tb-grave tb-cancel","CANCEL",()=>{e.answer_send(n.dataset.line??"","CANCEL")});return n.hidden=!0,s.append(q("span","tb-station-name",t),i,q("span","tb-station-fill"),n),{root:s,step:i,cancel:n}}function Fd(t,e,s,i){const n=s?.command??null,r=n!==null&&n.station===e&&s!==null&&s.question!=="command";t.step.textContent=r&&n!==null&&s!==null?`${n.label} · ${s.question.replace(/-/g," ").toUpperCase()}`:s?.question==="command"?"READY":"";const o=r?i?.cancel:void 0;t.cancel.hidden=o===void 0,t.cancel.dataset.line=o??"",t.cancel.textContent=n===null?"CANCEL":`CANCEL ${n.label}`}function d_(t,e){const s=Os(`tb-command${t.grave===!0?" tb-grave":""}`,t.label,()=>{e.command_send(t)});return s.dataset.command=t.id,s}function j1(t,e){const s=q("div","tb-pills tb-command-pills"),i=new Map;for(const n of Pd.filter(r=>r.station===t)){const r=d_(n,e);i.set(n.id,r),s.append(r)}return{root:s,pills:i}}function Ud(t,e){for(const[s,i]of t)i.disabled=e?.question!=="command",i.classList.toggle("tb-pill-on",e?.command?.id===s)}function H1(t,e){const s=Os("tb-target","",e);return s.append(h_("klingon",t.mark),document.createTextNode(`${t.x},${t.y}`)),s.title=`Klingon at ${t.x},${t.y}`,s}function dm(t,e){const s=q("span",t,e.supernova?"":e.code??"");return e.supernova&&s.append(h_("supernova")),s}function um(t){return`quadrant ${t.x},${t.y}${t.supernova?" · supernova":t.code===null?" · unscanned":""}`}function V1(t){const e=t.klingons.map(s=>({bearing:s.bearing,kind:"klingon",label:`Klingon at ${s.x},${s.y} · ${s.range.toFixed(1)} · ${Math.round(s.bearing)}°`,variant:s.mark}));for(const s of t.sectors)for(const i of s){if(i.kind!=="base")continue;const n=i.x-t.position.sector.x,r=i.y-t.position.sector.y;e.push({bearing:(Math.atan2(r,-n)*180/Math.PI+360)%360,kind:"base",label:`starbase at ${i.x},${i.y}`})}return e}class Av{root;wheel;distance;warp;rest;head;pills;readout=null;constructor(e,s,i){this.root=q("div","tb-station tb-station-helm"),this.head=Wd("HELM",e);const n=j1("helm",e);this.pills=n.pills;const r=q("div","tb-controls");this.wheel=new B1(s,"course wheel",a=>e.answer_send(String(a),"SET COURSE"));const o=q("div","tb-sliders");this.distance=new xr(`${i}-distance`,"DISTANCE",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.warp=new xr(`${i}-warp`,"WARP FACTOR",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.rest=new xr(`${i}-rest`,"REST",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.distance.input_listen(()=>this.arrival_note()),o.append(this.distance.root,this.warp.root,this.rest.root),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}state_show(e){const s=this.readout===null;this.readout=e,this.wheel.marks_set(V1(e)),this.warp.range_set(xs("warp-factor",e),e.ship.warp,"THE SHIP NOW · ABOVE 6 THE ENGINES MAY BURN",10),this.distance.range_set(xs("distance",e),s?1:this.distance.value_get(),"QUADRANTS · 0.1 IS ONE SECTOR",6),this.rest.range_set(xs("how-long",e),0,`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT · REPAIRS RUN WHILE TIME PASSES`,2)}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"helm",e,s),this.wheel.lit_set(gi(e,["course","direction"]),"SET COURSE"),this.distance.lit_set(gi(e,["distance"]),"ENGAGE"),this.warp.lit_set(gi(e,["warp-factor"]),"SET WARP"),this.rest.lit_set(gi(e,["how-long"]),"REST"),e?.question==="distance"&&this.arrival_note()}arrival_note(){if(this.readout===null)return;const e=this.distance.value_get(),s=S6(this.readout,this.wheel.degrees_get(),e),i=W1(e,this.readout.ship.warp,this.readout.param.warptime);this.distance.note_set(`ARRIVES ${s.quadrant.x},${s.quadrant.y} / ${s.sector.x},${s.sector.y} · ${i.stardates.toFixed(2)} STARDATES AT WARP ${this.readout.ship.warp.toFixed(1)} · ${i.units} UNITS`)}}class Tv{constructor(e,s,i){this.host=e,this.root=q("div","tb-station tb-station-tactical"),this.head=Wd("TACTICAL",e);const n=j1("tactical",e);this.pills=n.pills;const r=q("div","tb-controls");this.wheel=new B1(s,"firing course wheel",l=>e.answer_send(String(l),"SET COURSE"));const o=q("div","tb-sliders");this.burst=new Qc("BURST",xs("burst",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice"))),this.burstAngle=new Qc("BURST ANGLE",xs("burst-angle",null).choices??[],(l,c)=>{this.wheel.wedge_set(Number(l)),e.answer_send(l,gr(c,"choice"))}),this.manual=new Qc("PHASERS",xs("manual-automatic",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice"))),this.units=new xr(`${i}-units`,"UNITS",0,l=>e.answer_send(String(Math.round(l)),"SLIDER SET")),this.spread=new xr(`${i}-spread`,"SPREAD",2,l=>e.answer_send(l.toFixed(2),"SLIDER SET")),this.upDown=new Qc("SHIELDS",xs("up-down",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice")));const a=q("div","tb-fire-row");this.fire=Os("tb-fire","FIRE",()=>e.answer_send("0",null)),this.targets=q("div","tb-targets"),a.append(this.fire,this.targets),o.append(this.burst.root,this.burstAngle.root,this.manual.root,this.units.root,this.spread.root,this.upDown.root,a),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}host;root;wheel;units;spread;head;pills;burst;burstAngle;manual;upDown;fire;targets;readout=null;state_show(e){this.readout=e,this.wheel.marks_set(V1(e)),this.wheel.wedge_set(null),e.klingons[0]!==void 0&&this.wheel.degrees_set(e.klingons[0].bearing),this.units.range_set(xs("units",e),Math.min(e.ship.energy,Math.round(e.ship.energy/100)*10),`UP TO THE ${e.ship.energy} FREE`,6),this.spread.range_set(xs("spread",e),.5,"MANUAL PHASERS ONLY",3),this.burst.note_set(`${e.ship.torpedoes} TORPEDOES · A BURST FIRES 3`),this.upDown.note_set(`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} OF ${e.ship.shieldMax} · REFILLS AT A STARBASE`);const s=this.pills.get("phasers");s!==void 0&&(s.classList.toggle("tb-barred",e.ship.shieldsUp),s.title=e.ship.shieldsUp?"Shields are up: phasers cannot fire through them. SHIELDS, then DOWN, first.":""),this.targets_draw(e)}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"tactical",e,s),this.wheel.lit_set(gi(e,["torpedo-course","bank-course"]),"SET COURSE"),this.burst.lit_set(gi(e,["burst"])),this.burstAngle.lit_set(gi(e,["burst-angle"])),this.manual.lit_set(gi(e,["manual-automatic"])),this.units.lit_set(gi(e,["units","bank-units"]),e?.question==="units"?"FIRE":"SET BANK"),this.spread.lit_set(gi(e,["spread"])),this.upDown.lit_set(gi(e,["up-down"])),this.fire.disabled=!gi(e,["bank-units"]),this.fire.textContent="FIRE THE BANKS SET"}targets_draw(e){if(this.targets.replaceChildren(),e.klingons.length===0){this.targets.append(q("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const s of["TARGET","RANGE","BEARING","PHASER HIT"])this.targets.append(q("span","tb-target-head",s));for(const s of e.klingons){const i=H1(s,()=>{this.host.voice.cue("scanner"),this.host.course_set(s.bearing,s.range/10)});this.targets.append(i,q("span","tb-target-cell",s.range.toFixed(1)),q("span","tb-target-cell",`${Math.round(s.bearing)}°`),q("span","tb-target-cell",`${F1(s.range/10)}%`))}}}class W6{root;rest;head;pills;damage;systems;since;inThatTime;readout=null;constructor(e){this.root=q("div","tb-view-body tb-view-engineering");const s=q("section","tb-panel tb-damage");s.append(q("span","tb-title","DAMAGE CONTROL"),q("span","tb-note","THE C'S REPORT · ALWAYS ON")),this.damage=q("div","tb-dc"),s.append(this.damage,q("span","tb-note","REPAIR TIMES IN STARDATES · REPAIRS RUN WHILE TIME PASSES · DOCKED, FASTER BY THE DOCK FACTOR"));const i=q("section","tb-panel tb-systems-section");i.append(q("span","tb-title","SHIP"),q("span","tb-note","ENERGY, SHIELDS, RESERVES")),this.systems=q("div","tb-systems"),i.append(this.systems,q("span","tb-title","SINCE THE LAST COMMAND")),this.since=q("div","tb-head-grid tb-since-grid"),i.append(this.since,q("span","tb-note","SHIELDS ARE UP OR DOWN IN TREK(6): THEIR ENERGY IS A READOUT, REFILLED AT A STARBASE"));const n=q("section","tb-panel tb-station tb-station-time");this.head=Wd("REST",e);const r=q("div","tb-pills tb-command-pills");this.pills=new Map;for(const o of["rest","dock","undock"]){const a=Pd.find(c=>c.id===o);if(a===void 0)continue;const l=d_(a,e);this.pills.set(o,l),r.append(l)}this.rest=new xr("tbe-rest","HOW LONG",1,o=>e.answer_send(o.toFixed(1),"SLIDER SET")),this.rest.input_listen(()=>this.inThatTime_note()),this.inThatTime=q("div","tb-in-that-time"),n.append(this.head.root,r,this.rest.root,q("span","tb-title","IN THAT TIME"),this.inThatTime),this.root.append(s,i,n)}state_show(e,s){this.readout=e,this.damage_draw(e),this.systems_draw(e),this.since.replaceChildren();const i=s===null?[]:U1(s,e);i.length===0&&this.since.append(q("span","tb-head-label","—"),q("span","tb-head-value","NOTHING MOVED"));for(const n of i)this.since.append(q("span","tb-head-label",n.label),q("span",`tb-head-value ${n.bad?"tb-bad":"tb-good"}`,n.change));this.rest.range_set(xs("how-long",e),this.rest.value_get(),`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT`,4),this.inThatTime_note()}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout),i=e!==null&&(e.command===null||["rest","dock","undock"].includes(e.command.id))?e:null;Fd(this.head,"helm",i,s),this.rest.lit_set(gi(e,["how-long"]),"REST")}damage_draw(e){this.damage.replaceChildren();for(const i of["DEVICE","","IN FLIGHT","DOCKED",""])this.damage.append(q("span","tb-dc-head",i));const s=Math.max(1,...e.damaged.map(i=>(i.repairAt??0)-e.mission.stardate));for(const i of e.devices){const n=Sv(i,e),r=q("div","tb-bar-track"),o=q("div",`tb-bar-fill${n===null?" tb-bar-ok":" tb-bar-down"}`);o.style.width=n===null?"100%":`${Math.max(4,Math.min(100,Math.round(100*((i.repairAt??0)-e.mission.stardate)/s)))}%`,r.append(o),this.damage.append(q("span",`tb-dc-name${n===null?"":" tb-bad"}`,i.name.toUpperCase()),r,q("span","tb-dc-time",n===null?"—":n.inFlight.toFixed(2)),q("span","tb-dc-time",n===null?"—":n.docked.toFixed(2)),q("span",`tb-dc-state${n===null?" tb-good":" tb-bad"}`,n===null?"OK":"DOWN"))}}systems_draw(e){const{ship:s}=e;this.systems.replaceChildren();const i=(l,c,h,d,u)=>{const p=q("div","tb-bar-track"),f=q("div",`tb-bar-fill${u?" tb-bar-down":" tb-bar-ok"}`);f.style.width=`${Math.max(0,Math.min(100,Math.round(100*c/Math.max(1,h))))}%`,p.append(f),this.systems.append(q("span","tb-dc-name",l),p,q("span","tb-dc-time tb-sys-value",d))};i("ENERGY",s.energy,s.energyMax,`${s.energy} / ${s.energyMax}`,s.energy<s.energyMax/4),i("SHIELDS",s.shield,s.shieldMax,`${s.shieldsUp?"UP":"DOWN"} · ${s.shield} / ${s.shieldMax}`,s.shield<s.shieldMax/4),i("LIFE SUPPORT",s.reserves,s.reservesMax,`RESERVES ${s.reserves.toFixed(1)} / ${s.reservesMax.toFixed(1)}`,s.reserves<s.reservesMax/4);const n=q("div","tb-pips");for(let l=0;l<s.torpedoesMax;l++)n.append(q("span",`tb-pip${l<s.torpedoes?" tb-pip-on":""}`));this.systems.append(q("span","tb-dc-name","TORPEDOES"),n,q("span","tb-dc-time tb-sys-value",`${s.torpedoes} / ${s.torpedoesMax}`));const r=(l,c)=>{this.systems.append(q("span","tb-dc-name",l),q("span","tb-sys-text",c))};r("CREW",`${s.crew}${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:" · BRIG EMPTY"}`);const o=e.damaged.some(l=>/warp/i.test(l.name));r("WARP",`${s.warp.toFixed(1)} · ENGINES ${o?"DOWN":"OK"}`);const a=e.damaged.some(l=>/cloak/i.test(l.name));r("CLOAK",`${s.cloaked?"ON":"OFF"} · DEVICE ${a?"DOWN":"OK"}`)}inThatTime_note(){if(this.readout===null)return;const e=this.rest.value_get();this.inThatTime.replaceChildren();const s=this.readout.damaged.filter(n=>(Sv(n,this.readout)?.inFlight??1/0)<=e).map(n=>n.name.toUpperCase());this.inThatTime.append(q("span","tb-head-value tb-good",s.length===0?e>0?"NO REPAIR COMPLETES":"—":`${s.join(" · ")} REPAIRED`));const i=this.readout.klingons.length;i>0&&this.inThatTime.append(q("span","tb-head-value tb-bad",`${i} KLINGON${i===1?"":"S"} IN THE QUADRANT WILL FIRE · SPOCK MAY ASK TO CANCEL`))}}const Iv=[{label:"CHART",line:"ch",asks:[]},{label:"TRAJECTORY",line:"t",asks:[]},{label:"COURSE",line:"c",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"MOVE",line:"m",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"SCORE",line:"s",asks:[]},{label:"PHASER EFFECT",line:"p",asks:["range"]},{label:"WARP COST",line:"w",asks:["computer-distance","computer-warp"]},{label:"IMPULSE COST",line:"i",asks:["computer-distance"]},{label:"DISTRESS LIST",line:"d",asks:[]}];class F6{constructor(e){this.host=e,this.root=q("div","tb-view-body tb-view-computer");const s=q("section","tb-panel tb-chart-section");s.append(q("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN"),q("span","tb-note","PRESS A QUADRANT: THE COURSE PANEL AIMS AT IT · HUNDREDS KLINGONS, TENS BASES, ONES STARS")),this.chart=q("div","tb-chart-big"),s.append(this.chart);const i=q("section","tb-station tb-station-computer");this.head=Wd("COMPUTER",e);const n=q("div","tb-pills tb-command-pills");for(const d of Iv){const u=Os("tb-command tb-request",d.label,()=>this.request_send(d));u.dataset.request=d.line,this.requestPills.push(u),n.append(u)}const r=q("div","tb-computer-panels"),o=q("div","tb-panel");o.append(q("span","tb-title","COURSE AND DISTANCE")),this.courseGrid=q("div","tb-head-grid");const a=q("div","tb-pills");a.append(Os("tb-commit tb-send-helm","SEND TO HELM",()=>this.helm_send()),Os("tb-commit tb-move-now","MOVE THERE NOW",()=>this.request_send(Iv[3]))),o.append(this.courseGrid,a);const l=q("div","tb-panel");l.append(q("span","tb-title","WARP COST")),this.wcDistance=new xr("tbc-distance","DISTANCE",2,()=>{}),this.wcWarp=new xr("tbc-warp","WARP FACTOR",1,()=>{}),this.wcDistance.root.classList.add("tb-local"),this.wcWarp.root.classList.add("tb-local"),this.wcDistance.input_listen(()=>this.costs_note()),this.wcWarp.input_listen(()=>{this.warpTouched=!0,this.costs_note()}),this.wcResult=q("div","tb-head-grid"),l.append(this.wcDistance.root,this.wcWarp.root,this.wcResult);const c=q("div","tb-panel");c.append(q("span","tb-title","TRAJECTORY · KLINGONS HERE")),this.trajectory=q("div","tb-targets"),c.append(this.trajectory,q("span","tb-title","SCORE SO FAR")),this.score=q("div","tb-score"),c.append(this.score);const h=q("div","tb-panel tb-answer-panel");h.append(q("span","tb-title","THE COMPUTER ANSWERS")),this.answer=q("pre","tb-computer-answer","—"),h.append(this.answer),r.append(o,l,c,h),i.append(this.head.root,n,r),this.root.append(s,i)}host;root;head;chart;requestPills=[];courseGrid;wcDistance;wcWarp;wcResult;trajectory;score;answer;readout=null;target=null;open=null;warpTouched=!1;state_show(e){this.readout=e,this.target===null&&(this.target={quadrant:{...e.position.quadrant},sector:{...e.position.sector}}),this.chart_draw(e),this.wcWarp.range_set(xs("computer-warp",e),this.warpTouched?this.wcWarp.value_get():e.ship.warp,"THE SHIP'S NOW",4),this.wcDistance.range_set(xs("computer-distance",e),this.wcDistance.value_get(),"QUADRANTS · FILLED FROM THE COURSE",4),this.wcDistance.lit_set(!0,""),this.wcWarp.lit_set(!0,""),this.course_note(),this.trajectory_draw(e),this.score_draw(e)}question_show(e){this.open=e;const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"ship",e,s);const i=e?.question==="command"||e?.question==="request";for(const n of this.requestPills)n.disabled=!i}answer_take(e){if(e===null){this.answer.textContent="";return}this.answer.textContent=`${this.answer.textContent??""}${e}`.replace(/^\s*\n/,"")}sector_set(e){this.readout!==null&&(this.target={quadrant:this.target?.quadrant??{...this.readout.position.quadrant},sector:{x:e.x,y:e.y}},this.course_note())}request_send(e){const s=e.asks.map(n=>[n,this.plannedAnswer_derive(n)]);if(this.open?.question==="request"){this.host.plan_set(s),this.answer_take(null),this.host.answer_send(e.line,gr(e.label,"computer")),this.host.voice.cue("thinking");return}const i=Pd.find(n=>n.id==="computer");if(i===void 0||this.open?.question!=="command"){this.host.voice.cue("deny");return}this.host.plan_set([["request",e.line],...s]),this.answer_take(null),this.host.voice.pill(gr(e.label,"computer")),this.host.command_send(i)}plannedAnswer_derive(e){const s=this.target,i=this.readout?.klingons[0];switch(e){case"quadrant":return String(s?.quadrant.x??0);case"quadrant-y":return String(s?.quadrant.y??0);case"sector":return String(s?.sector.x??0);case"sector-y":return String(s?.sector.y??0);case"range":return(i===void 0?this.wcDistance.value_get():i.range/10).toFixed(2);case"computer-distance":return this.wcDistance.value_get().toFixed(2);case"computer-warp":return this.wcWarp.value_get().toFixed(1);default:return""}}helm_send(){if(this.readout===null||this.target===null)return;const e=zv(this.readout,this.target);this.host.voice.pill("SEND TO HELM"),this.host.course_set(e.course,Math.round(e.distance*10)/10)}chart_draw(e){this.chart.replaceChildren(),this.chart.append(q("span","tb-srs-corner",""));for(let s=0;s<(e.chart[0]?.length??0);s++)this.chart.append(q("span","tb-srs-axis",String(s)));for(const s of e.chart){this.chart.append(q("span","tb-srs-axis",String(s[0]?.x??"")));for(const i of s)this.chart.append(this.quadrantButton_make(i))}}quadrantButton_make(e){const s=this.target?.quadrant.x===e.x&&this.target.quadrant.y===e.y,i=Os(`tb-cq${e.here?" tb-here":""}${e.klingons>0?" tb-hostile":""}${e.bases>0?" tb-based":""}${e.code===null?" tb-unscanned":""}${s?" tb-pressed":""}`,"",()=>{this.readout!==null&&(this.target={quadrant:{x:e.x,y:e.y},sector:this.target?.sector??{...this.readout.position.sector}},this.host.voice.cue("scanner"),this.chart_draw(this.readout),this.course_note())});return i.dataset.x=String(e.x),i.dataset.y=String(e.y),i.append(dm("tb-cq-code",e),q("span","tb-cq-at",`${e.x},${e.y}`)),i.title=um(e),i}course_note(){if(this.readout===null||this.target===null)return;const{position:e}=this.readout,s=zv(this.readout,this.target);this.courseGrid.replaceChildren(q("span","tb-head-label","FROM"),q("span","tb-head-value",`QUADRANT ${e.quadrant.x},${e.quadrant.y} · SECTOR ${e.sector.x},${e.sector.y}`),q("span","tb-head-label","TO"),q("span","tb-head-value",`QUADRANT ${this.target.quadrant.x},${this.target.quadrant.y} · SECTOR ${this.target.sector.x},${this.target.sector.y}`),q("span","tb-head-label","COURSE"),q("span","tb-head-value tb-course-value",`${s.course}°`),q("span","tb-head-label","DISTANCE"),q("span","tb-head-value tb-distance-value",s.distance.toFixed(2))),this.wcDistance.value_set(Math.round(s.distance*100)/100),this.costs_note()}costs_note(){if(this.readout===null)return;const e=this.wcDistance.value_get(),s=W1(e,this.wcWarp.value_get(),this.readout.param.warptime),i=x6(e);this.wcResult.replaceChildren(q("span","tb-head-label","TIME"),q("span","tb-head-value",`${s.stardates.toFixed(2)} STARDATES`),q("span","tb-head-label","ENERGY"),q("span","tb-head-value",`${s.units} UNITS · ${s.unitsShielded} WITH SHIELDS UP`),q("span","tb-head-label","AT IMPULSE"),q("span","tb-head-value",`${i.stardates.toFixed(2)} STARDATES · ${i.units} UNITS`))}trajectory_draw(e){if(this.trajectory.replaceChildren(),e.klingons.length===0){this.trajectory.append(q("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const s of["AT","COURSE","RANGE","PHASER HIT"])this.trajectory.append(q("span","tb-target-head",s));for(const s of e.klingons)this.trajectory.append(H1(s,()=>{this.host.voice.cue("scanner"),this.host.course_set(s.bearing,s.range/10)}),q("span","tb-target-cell",`${Math.round(s.bearing)}°`),q("span","tb-target-cell",s.range.toFixed(1)),q("span","tb-target-cell",`${F1(s.range/10)}%`))}score_draw(e){const s=L1(e);this.score.replaceChildren();for(const i of s.items.filter(n=>n.points!==0||/killed|remaining/.test(n.label)))this.score.append(q("span","tb-score-label",i.label.toUpperCase()),q("span",`tb-score-points${i.points<0?" tb-bad":" tb-good"}`,`${i.points>0?"+":""}${i.points}`));this.score.append(q("span","tb-score-label tb-score-total","TOTAL"),q("span","tb-score-points tb-score-total",String(s.total)))}}const U6=["bridge","helm","tactical","engineering","computer"],$6=400,j6="-0.6 -0.6 10.6 10.6",H6=.7,V6=/^S\.R\. scanners$/i,q6=/^L\.R\. scanners$/i,K6={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},Y6=["length","skill","request","quadrant","quadrant-y","sector","sector-y","range","computer-distance","computer-warp","status-report","another","yes-no","unknown"];class X6{constructor(e,s){this.hooks=e,this.harness=new T6({question_changed:d=>{this.partial_flush(),this.question_show(d)},text_written:d=>this.text_take(d),state_shown:d=>this.state_show(d),ended:()=>{this.leaving||this.hooks.voice.cue("gameover")}}),this.root=q("section","trek-bridge"),this.root.id="trek-bridge",this.root.dataset.view="bridge",this.root.setAttribute("aria-label","trek: the bridge");const i={},n=qj();n!==null&&this.root.append(n);const r=this.gutter_build(i,s),[o,a]=this.frame_build(),l=this.header_build(i),c=this.body_build(i);this.strip_build(i);const h=this.log_build(i);this.leaveAsk_build(i),this.root.append(r,o,l,a,c,i.ask,h,i.leaveAsk),this.parts=i,this.question_show(null)}hooks;root;harness;readout=null;previous=null;view="bridge";nextDistance=null;plan=new Map;answering=!1;computerRunning=!1;leaving=!1;tracker=new Tl;heading=0;pressedSector=null;scanDue=!1;fold=null;frames=new C6;shown=null;torpedo=null;trackPrinting=!1;partial="";lrsBloom=null;parts;stationHost_get(){return{answer_send:(e,s)=>this.answer_send(e,s),command_send:e=>this.command_send(e),plan_set:e=>{for(const[s,i]of e)this.plan.set(s,i)},course_set:(e,s)=>this.course_set(e,s),voice:this.hooks.voice}}gutter_build(e,s){const i=q("aside","tb-gutter"),n=q("div","tb-block");n.append(q("span","tb-block-name","TREK"),q("span","tb-block-sub","ARGUS · BSD TREK")),e.seed=q("div","tb-seed",s===null?"RANDOM GALAXY":`SEED ${s}`);const r=q("nav","tb-views");r.setAttribute("aria-label","views"),e.views=new Map;for(const c of U6){const h=Os(`tb-view tb-view-${c}`,c.toUpperCase(),()=>this.view_set(c));h.classList.remove("tb-pill"),h.dataset.view=c,e.views.set(c,h),r.append(h)}const o=Os("tb-leave","LEAVE BRIDGE",()=>this.leave_ask());o.classList.remove("tb-pill");const a=q("div","tb-gutter-top");a.append(n,e.seed,q("div","tb-gutter-fill"));const l=q("div","tb-gutter-body");return l.append(q("div","tb-gutter-cap"),r,q("div","tb-gutter-fill"),o),i.append(a,l),i}frame_build(){const e=q("div","tb-bar tb-bar-top");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c","tb-bar-d"])e.append(q("span",i));const s=q("div","tb-bar tb-bar-body");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c"])s.append(q("span",i));return[e,s]}header_build(e){const s=q("header","tb-header"),i=q("section","tb-head-condition"),n=q("div","tb-condition");n.append(q("span","tb-condition-label","CONDITION")),e.condition=q("span","tb-condition-name","—"),n.append(e.condition),e.conditionWhy=q("div","tb-condition-why",""),i.append(n,e.conditionWhy);const r=p=>{const f=q("section","tb-head-section");f.append(q("span","tb-head-title",p));const _=q("div","tb-head-grid");return f.append(_),[f,_]},[o,a]=r("SHIP"),[l,c]=r("MISSION"),[h,d]=r("POSITION"),u=q("div","tb-head-grid tb-head-since");return l.append(q("span","tb-head-title","SINCE LAST COMMAND"),u),e.ship=a,e.mission=c,e.position=d,e.since=u,s.append(i,o,l,h),s}body_build(e){const s=this.stationHost_get(),i=q("main","tb-body");i.dataset.view="bridge",e.body=i;const n=q("section","tb-scans");n.append(q("span","tb-title","LONG RANGE")),e.lrs=q("div","tb-lrs"),n.append(e.lrs,q("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN")),e.chart=q("div","tb-chart"),n.append(e.chart);const r=q("section","tb-srs-section");e.srsTitle=q("span","tb-title","SHORT RANGE"),r.append(e.srsTitle),e.scan=st("svg",{class:"tb-scan",viewBox:j6,role:"grid","aria-label":"short range scan"}),e.scan.addEventListener("keydown",l=>this.scan_key(l)),e.legend=this.legend_build(),r.append(e.scan,q("span","tb-note","PRESS A SECTOR: ITS COURSE AND DISTANCE FILL IN"),e.legend),e.shipPills=new Map;const o=q("div","tb-pills tb-ship-pills");o.append(q("span","tb-slider-label","SHIP"));for(const l of Pd.filter(c=>c.station==="ship")){const c=d_(l,s);e.shipPills.set(l.id,c),o.append(c)}r.append(o);const a=q("section","tb-stations");return e.helm=new Av(s,150,"tb"),e.tactical=new Tv(s,150,"tb"),a.append(e.helm.root,e.tactical.root),e.helmView=new Av(s,260,"tbh"),e.helmView.root.classList.add("tb-view-body","tb-view-helm"),e.tacticalView=new Tv(s,260,"tbt"),e.tacticalView.root.classList.add("tb-view-body","tb-view-tactical"),e.engineeringView=new W6(s),e.computerView=new F6(s),i.append(n,r,a,e.helmView.root,e.tacticalView.root,e.engineeringView.root,e.computerView.root),i}legend_build(){const e=q("div","tb-legend");for(const s of Kj){const i=q("span",`tb-legend-item tb-legend-${s.kind}`),n=s.kind==="klingon"?fr:[null];for(const r of n)i.append(h_(s.kind,r));i.append(q("span","tb-legend-glyph",Jc[s.kind].trim()===""?"␠":Jc[s.kind]),q("span","tb-legend-name",s.name)),e.append(i)}return e}strip_build(e){e.ask=q("div","tb-ask"),e.ask.hidden=!0,e.ask.setAttribute("role","dialog"),e.askText=q("span","tb-ask-text",""),e.askPills=q("div","tb-pills"),e.askInput=document.createElement("input"),e.askInput.type="text",e.askInput.className="tb-ask-input",e.askInput.setAttribute("aria-label","the answer");const s=e.askInput;e.askSend=Os("tb-commit","ANSWER",()=>this.answer_send(s.value,"ANSWER")),s.addEventListener("keydown",i=>{i.key==="Enter"&&this.answer_send(s.value,"ANSWER")}),e.ask.append(q("span","tb-ask-label","THE GAME ASKS"),e.askText,e.askPills,e.askInput,e.askSend)}log_build(e){const s=q("footer","tb-log-section"),i=q("div","tb-log-head");return i.append(q("span","tb-title","SHIP'S LOG"),q("span","tb-note","READ ONLY")),e.log=q("div","tb-log"),e.log.setAttribute("aria-live","polite"),s.append(i,e.log),s}leaveAsk_build(e){e.leaveAsk=q("div","tb-leave-ask"),e.leaveAsk.hidden=!0,e.leaveAsk.setAttribute("role","dialog");const s=e.leaveAsk,i=Os("tb-grave","LEAVE · THE GAME ENDS",()=>{this.leaving=!0,this.hooks.voice.cue("close"),this.hooks.leave()}),n=Os("","STAY",()=>{s.hidden=!0});e.leaveAsk.append(q("span","tb-ask-label","LEAVE THE BRIDGE?"),q("span","tb-ask-text","The game ends where it stands; dump first to keep it."),i,n)}harness_get(){return this.harness}leave_ask(){this.frames.skip(),this.parts.leaveAsk.hidden&&this.hooks.voice.pill("LEAVE BRIDGE"),this.parts.leaveAsk.hidden=!1}frames_get(){return{played:{...this.frames.played},pending:this.frames.pending_count(),busy:this.frames.busy_is()}}frames_settle(){return this.frames.settle()}leaveAsk_isOpen(){return!this.parts.leaveAsk.hidden}leaveAsk_close(){this.parts.leaveAsk.hidden=!0}view_get(){return this.view}view_set(e){this.frames.skip(),this.view=e,this.root.dataset.view=e,this.parts.body.dataset.view=e;for(const[s,i]of this.parts.views)i.classList.toggle("tb-view-on",s===e);this.hooks.voice.pill(gr(e.toUpperCase(),"view"))}readout_get(){return this.readout}command_send(e){if(this.frames.skip(),!this.harness.command_send(e))return this.hooks.voice.cue("deny"),!1;const s=i6(e.id);return s===null?this.hooks.voice.pill(gr(e.label,"command")):this.hooks.voice.cue(s),this.nextDistance=null,this.computerRunning=e.id==="computer",this.computerRunning&&this.parts.computerView.answer_take(null),this.log_write(`Command: ${e.line}
|
|
4353
|
+
`);return}(v||M.envelopes.some(S=>S.status==="error"))&&z.outcome_write(M),l(M)},h=[],d=b=>{const v=h.length===0;for(const z of b)z.vfsPath!==""&&!h.includes(z.vfsPath)&&h.push(z.vfsPath);!v||h.length===0||queueMicrotask(()=>{const z=h.splice(0);z.length>0&&c(`gather add ${z.map(Ji).join(" ")}`)})},u=(b,v,z)=>({command_run:x=>{t.client.line_execute(x,{silent:!0})},command_show:x=>t.terminal.line_run(x),note:x=>t.terminal.line_note(x),image_open:x=>{e.image_open(b(),x).then(M=>t.terminal.line_note(M))},process_open:x=>e.process_open(b(),{input:x,feed:null,node:null}),...v,...z,verb_send:c,cohort_process:x=>e.process_open(b(),x),feed_open:x=>e.feed_open(b(),x)}),p=()=>{const b=document.querySelector("#header-gather-pill");b!==null&&b.classList.toggle("panel-gather-empty",(r?.entries_get().length??0)===0)},f=()=>{const b=e.element_require("header-gather"),v=()=>e.errandHost_find()??"pacs",z=x=>a_(t.terminal,e.element_require("header-gather"),x);return new _v(b,e.pane_find(b,".gather-rows"),u(v,{name_ask:x=>z({message:"Cohort name: ",kind:"text",suggest:x,commit:"NAME IT"}),confirm_ask:async x=>{const M=await z({message:x,kind:"confirm"});return M==="y"||M==="n"?M:null}},{dismiss:()=>{document.body.dataset.header="away",o=!0,p()}}),n)};return{cohort:n,instance_build:b=>{const v=e.template_stamp("tpl-pane-gather"),z=new _v(v,e.pane_find(v,".gather-rows"),u(()=>b,{name_ask:x=>e.askOnPane_await(b,{message:"Cohort name: ",kind:"text",suggest:x,commit:"NAME IT"}),confirm_ask:async x=>{const M=await e.askOnPane_await(b,{message:x,kind:"confirm"});return M==="y"||M==="n"?M:null}},{dismiss:()=>{t.layout.leaf_close(b)||e.home_apply(),e.orphans_dispose(),e.stage_relight()}}),n);return s.set("gather",b,z),{id:b,kind:"gather",mount:v,dispose:()=>{s.delete(b),i.pane_leave(b)}}},has:b=>n.has(b),gather:b=>{r===null&&(r=f()),d(b);const v=document.body.dataset.header==="away";(!o||!v)&&(document.body.dataset.header="gather",o=!1),p()},open:(b,v="pacs")=>{const{layout:z}=t,x=new Set(z.panes_shown());let M=s.ids("gather").find(S=>x.has(S))??null;if(M===null){const S=x.has(v)?v:e.errandHost_find()??v,T=e.instance_spawn("gather","pacs"),I=e.replayPlace_get();if(!z.leaf_split(S,I?.dir??"row",T.id,I?.before??!1))return As(T.id),z.mount_remove(T.id),null;e.birth_record(T.id,S,I?.dir??"row",I?.before??!1),M=T.id}return s.get("gather",M)===void 0?null:(d(b),M)},stage:()=>{const{layout:b}=t,v=new Set(b.panes_shown()),z=s.ids("gather").find(x=>v.has(x))??null;if(z!==null)b.focus_set(z);else{const x=e.errandHost_find()??"pacs",M=e.instance_spawn("gather","pacs");if(!b.leaf_split(x,"col",M.id,!1)){As(M.id),b.mount_remove(M.id);return}e.birth_record(M.id,x,"col",!1),s.get("gather",M.id)?.render_now()}document.body.dataset.header="away",o=!0},annunciate:p,restore:async()=>{try{l(await t.client.line_execute("gather",{silent:!0,observe:!1}))}catch{}},envelope_observe:b=>{b.model?.kind===bv&&a(b.model.data)}}}class wj{mount;handlers;titleSpan;stateSpan;fieldSection;savePill;revertPill;focusMark;field=null;path=null;original="";saving=!1;fieldBuild=null;constructor(e,s){this.mount=e,this.handlers=s,this.titleSpan=e.querySelector(".pane-title"),this.stateSpan=e.querySelector(".pane-state"),this.fieldSection=this.element_require(".edit-field"),this.savePill=this.element_require(".edit-save"),this.revertPill=this.element_require(".edit-revert"),this.focusMark=e.querySelector(".edit-focus"),this.savePill.addEventListener("click",()=>{this.save()}),this.revertPill.addEventListener("click",()=>this.revert()),e.addEventListener("keydown",i=>{(i.ctrlKey||i.metaKey)&&!i.altKey&&i.key.toLowerCase()==="s"&&(i.preventDefault(),i.stopPropagation(),this.save())},{capture:!0}),this.fieldSection.addEventListener("mousedown",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusin",()=>this.focusMark_set(!0)),this.fieldSection.addEventListener("focusout",i=>{(!(i.relatedTarget instanceof Node)||!this.fieldSection.contains(i.relatedTarget))&&this.focusMark_set(!1)}),this.controls_sync()}opening_show(e){this.path=e,this.title_set(e),ys(this.stateSpan,"wait","OPENING")}async content_show(e){this.path=e.path,this.original=e.content,this.title_set(e.path),this.fieldBuild??=this.field_build(e);const s=await this.fieldBuild;s!==null&&(s.text_get()!==this.original&&s.text_set(this.original),this.controls_sync(),s.focus(),this.focusMark_set(!0))}async field_build(e){let s;try{s=await lm(()=>import("./field-jqfvruDC.js").then(i=>i.Q),[],import.meta.url)}catch(i){if(!r_(i))throw i;return ys(this.stateSpan,"stale",nd),this.handlers.note(`edit: ${nd.toLowerCase()} — the editor's code is of an older build than the server has`),null}return this.field=await s.editField_create(this.fieldSection,e.content,e.extension,()=>this.controls_sync()),this.field}opening_fail(e){ys(this.stateSpan,"refused",`NOT OPENED · ${e.toUpperCase()}`)}async save(){if(this.field===null||this.path===null||this.saving)return!1;const e=this.field.text_get();if(e===this.original)return!0;this.saving=!0,this.controls_sync();let s=!1;try{s=await this.handlers.save(this.path,e)}finally{this.saving=!1}return s&&(this.original=e),this.controls_sync(),s||ys(this.stateSpan,"refused","NOT SAVED · THE CONSOLE SAYS WHY"),s}revert(){this.field===null||!this.dirty_is()||(this.field.text_set(this.original),this.controls_sync())}dirty_is(){return this.field!==null&&this.field.text_get()!==this.original}path_get(){return this.path}field_release(){return this.field===null||!this.field.hasFocus()?!1:(this.field.blur(),this.focusMark_set(!1),!0)}dispose(){this.field?.destroy(),this.field=null}controls_sync(){const e=this.dirty_is();this.savePill.disabled=!e||this.saving,this.revertPill.disabled=!e||this.saving,this.mount.dataset.dirty=e?"yes":"no",this.field!==null&&(this.saving?ys(this.stateSpan,"wait","SAVING"):e?ys(this.stateSpan,"note","DIRTY"):ys(this.stateSpan,"settled","SAVED"))}title_set(e){this.titleSpan!==null&&(this.titleSpan.textContent=`EDIT ${e.split("/").pop()??e}`.toUpperCase()),this.mount.title=e}focusMark_set(e){this.focusMark!==null&&(this.focusMark.hidden=!e)}element_require(e){const s=this.mount.querySelector(e);if(s===null)throw new Error(`edit pane: no ${e} in its template`);return s}}function yj(t,e){const{layout:s,panels:i,subjects:n}=t,r=async(d,u)=>{const p=await ra(t,M1(d,u));return p&&e.saved?.(d),p},o=d=>{const u=e.template_stamp("tpl-pane-edit"),p=new wj(u,{save:r,note:f=>t.terminal.line_note(f)});return i.set("edit",d,p),{id:d,kind:"edit",mount:u,dispose:()=>{p.dispose(),i.delete(d),n.pane_leave(d)}}},a=d=>{const u=new Set(s.panes_shown());for(const[p,f]of i.entries("edit"))if(u.has(p)&&f.path_get()===d)return p;return null},l=()=>{e.launcher_yield();const d=new Set(s.panes_shown()),u=s.focused_get(),p=u!==null&&d.has(u)?u:e.errandHost_find();if(p===null)return null;const f=e.instance_spawn("edit"),_=e.replayPlace_get();return s.leaf_split(p,_?.dir??"col",f.id,_?.before??!1)?(e.birth_record(f.id,p,_?.dir??"col",_?.before??!1),f.id):(As(f.id),s.mount_remove(f.id),null)};return{instance_build:o,edit_receive:d=>{const u=d.path??"";if(u==="")throw new Error("the editor pane needs the file it edits, and the request named none");const p=a(u)??l();if(p===null)return!1;const f=i.get("edit",p);return f===void 0?!1:(s.focus_set(p),f.dirty_is()?(t.terminal.line_note(`edit: ${u}: its pane has unsaved changes; they stand (REVERT reads the file again)`),!0):(f.content_show({path:u,content:d.content,extension:d.extension??ez(u)}),!0))},edit_open:(d,u={})=>{const p=a(d)??l();if(p===null)return null;const f=i.get("edit",p);if(f===void 0)return null;s.focus_set(p),f.dirty_is()||f.opening_show(d);const _=v1(d);return u.visible===!0?(t.terminal.line_run(_),p):(t.client.line_execute(_,{silent:!0,observe:!1}).then(g=>{const m=g.envelopes.find(w=>w.status!=="ok");m!==void 0&&f.opening_fail((m.renderedErr??"").replace(/\x1b\[[0-9;]*m/g,"").trim()||"the kernel refused")}).catch(g=>f.opening_fail(g instanceof Error?g.message:String(g))),p)}}}class zj{listing;constructor(e){const s=e.querySelector(".help-panel");if(s===null)throw new Error("help pane: no .help-panel in its template");this.listing=new Ir({mount:s,traits:this.traits_declare(),key:i=>i.key,chrome:{root:e,prefix:"help"},caps:"root",activatable:()=>!1,row:{className:i=>`help-row help-${i.topic}`}}),this.render()}traits_declare(){return[{key:"name",label:"KEY · VERB",className:"help-key",width:"minmax(9em, 12em)",cell:e=>e.name},{key:"does",label:"DOES",className:"help-does",width:"minmax(16em, 1fr)",cell:e=>e.does}]}render(){const e=o=>{const a=document.createElement("header");return a.className="files-path help-block-head",a.textContent=o,a},s=pn.map(o=>({key:`k:${o.key}`,name:o.key,does:o.does,topic:o.topic})),i=ma.map((o,a)=>{const l=o.indexOf(" ");return{key:`v:${a}`,name:l<0?o:o.slice(0,l),does:l<0?"":o.slice(l+1).trim(),topic:"verb"}}),n=[{key:"g:games",name:"help games",does:"the /usr/games shelf — fortune, cal, weather and their kin, by category (type it in the console)",topic:"verb"}],r=[{key:"n:notes",name:"notes",does:"what the installed releases changed (notes pane opens it as a listing; the dashboard's WHAT'S NEW block too)",topic:"verb"}];this.listing.rows_set([{key:"keys",header:e("KEYS — Ctrl-B opens the focused pane's drawer; then one key presses one of its verbs"),rows:s},{key:"verbs",header:e("VERBS — the console language; the long form is docs/argus-lang.adoc"),rows:i},{key:"games",header:e("GAMES — the small pleasures, kept apart from the tools as BSD kept them"),rows:n},{key:"notes",header:e("NOTES — what changed, release by release"),rows:r}],{field:"help"})}}function Sj(t,e){const{layout:s,panels:i,subjects:n}=t;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-help");return i.set("help",a,new zj(l)),{id:a,kind:"help",mount:l,dispose:()=>{i.delete(a),n.pane_leave(a)}}},open:()=>{const a=i.ids("help").find(d=>s.panes_shown().includes(d));if(a!==void 0)return s.focus_set(a),"help: on stage";const l=e.launcher_active();e.launcher_yield();const c=s.focused_get()??"files",h=e.instance_spawn("help");return l&&s.leaf_replace("files",h.id)?(s.focus_set(h.id),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):s.leaf_split(c,"col",h.id,!1)?(e.birth_record(h.id,c,"col",!1),"help: the keys and the verbs, as a pane (help keys, help verbs print them here)"):(As(h.id),s.mount_remove(h.id),"help: could not open a pane")}}}const lf=["___________________ _-_ ","\\__(==========/_=_/ ____.---'---`---.____"," \\_ \\ \\----._________.----/"," \\ \\ / / `-_-' "," __,--`.`-'..'-_ "," /____ || "," `--.____,-' "];function xj(){const t=lf[0].length;let e=Number.NaN,s=0;return{title:"SL",tick:60,step:i=>{Number.isNaN(e)&&(e=-t),e+=1,s+=1,e>i.cols+6&&(e=-t)},draw:(i,n)=>{const r=Math.max(0,Math.floor((i.rows-lf.length)/2));lf.forEach((a,l)=>i.text(Math.round(e),r+l,a,n.lit));const o=s%2===0?"-~=":"-=~";i.text(Math.round(e)-o.length,r+1,o,n.cool)}}}const Mv="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ0123456789Z:・.=*+-<>¦|";function Oj(){const t=new Map;let e=0;return{title:"CMATRIX",tick:50,step:(s,i)=>{e+=1;for(let n=0;n<s.cols;n++){const r=t.get(n);if(r===void 0){i()<.02&&t.set(n,{row:-1,speed:1+Math.floor(i()*2),length:4+Math.floor(i()*12),glyphs:[]});continue}e%r.speed===0&&(r.row+=1,r.glyphs.unshift(Mv[Math.floor(i()*Mv.length)]),r.glyphs.length>r.length&&r.glyphs.pop(),r.row-r.length>s.rows&&t.delete(n))}},draw:(s,i)=>{for(const[n,r]of t)r.glyphs.forEach((o,a)=>{const l=a===0?"#ffffff":a<r.length/2?i.lit:i.dim;s.put(n,r.row-a,o,l)})}}}function Ej(){const t=[];return{title:"RAIN",tick:70,step:(e,s)=>{s()<.9&&t.push({col:Math.floor(s()*e.cols),row:0,splash:0});for(const i of t)i.row<e.rows-1?i.row+=1:i.splash+=1;for(let i=t.length-1;i>=0;i--)t[i].splash>3&&t.splice(i,1)},draw:(e,s)=>{for(const i of t){if(i.splash===0){e.put(i.col,i.row,"|",s.cool);continue}const n=["o","O","( )"][i.splash-1];e.text(i.col-(n.length>>1),e.rows-1,n,s.dim)}}}}function Aj(){const t=[],e=[];let s=0;return{title:"ASCIIQUARIUM",tick:90,step:(i,n)=>{if(s+=1,t.length<Math.max(3,i.cols/12)&&n()<.08){const r=n()<.5;t.push({col:r?-4:i.cols+1,row:2+Math.floor(n()*Math.max(1,i.rows-5)),right:r,speed:1+Math.floor(n()*2),hue:Math.floor(n()*3)})}for(const r of t)s%r.speed===0&&(r.col+=r.right?1:-1);for(let r=t.length-1;r>=0;r--){const o=t[r];(o.col<-5||o.col>i.cols+2)&&t.splice(r,1)}if(n()<.3){const r=t[Math.floor(n()*t.length)];r!==void 0&&e.push({col:r.col+(r.right?4:-1),row:r.row-1})}for(const r of e)r.row-=1;for(let r=e.length-1;r>=0;r--)e[r].row<1&&e.splice(r,1)},draw:(i,n)=>{const r=(s%4<2?"~^":"^~").repeat(i.cols>>1);i.text(0,0,r,n.cool);const o=[n.lit,n.cool,n.warn];for(const a of t)i.text(a.col,a.row,a.right?"><>":"<><",o[a.hue]);for(const a of e)i.put(a.col,a.row,a.row%2===0?"o":".",n.dim);for(let a=2;a<i.cols;a+=7){const l=(s>>2)%2===0?0:1;for(let c=0;c<3;c++)i.put(a+(c+l)%2,i.rows-2-c,c%2===0?"(":")",n.dim)}i.text(0,i.rows-1,"^".repeat(i.cols),n.dim)}}}const vv=[[[0,0],[1,0],[2,0],[3,0]],[[0,0],[1,0],[0,1],[1,1]],[[1,0],[0,1],[1,1],[2,1]],[[0,0],[1,0],[1,1],[2,1]],[[1,0],[2,0],[0,1],[1,1]],[[0,0],[0,1],[1,1],[2,1]],[[2,0],[0,1],[1,1],[2,1]]],so=10,co=20;function Tj(){return{well:Array.from({length:co},()=>Array(so).fill(0)),piece:null,score:0,lines:0,over:!1}}function l_(t,e){return e.cells.every(([s,i])=>{const n=e.x+s,r=e.y+i;return n>=0&&n<so&&r<co&&(r<0||t[r][n]===0)})}function cf(t){const e=Math.max(...t.cells.flat())+1;return{...t,cells:t.cells.map(([s,i])=>[e-1-i,s])}}function Ij(t,e){const s=Math.floor(e()*vv.length),i={cells:vv[s].map(n=>[n[0],n[1]]),x:3,y:0,kind:s+1};if(!l_(t.well,i)){t.over=!0;return}t.piece=i}function Dj(t){const e=t.piece;if(e===null)return;e.cells.some(([,n])=>e.y+n<0)&&(t.over=!0);for(const[n,r]of e.cells){const o=e.y+r;o>=0&&(t.well[o][e.x+n]=e.kind)}const s=t.well.filter(n=>n.some(r=>r===0)),i=co-s.length;for(;s.length<co;)s.unshift(Array(so).fill(0));t.well=s,t.lines+=i,t.score+=[0,100,300,500,800][i]??800,t.piece=null}function hm(t,e){if(t.over)return;if(t.piece===null){Ij(t,e);return}const s={...t.piece,y:t.piece.y+1};l_(t.well,s)?t.piece=s:Dj(t)}function Cj(t,e,s){if(t.over||t.piece===null)return!1;const i=t.piece,n=r=>l_(t.well,r)?(t.piece=r,!0):!1;switch(e){case"ArrowLeft":case"h":case"a":return n({...i,x:i.x-1}),!0;case"ArrowRight":case"l":case"d":return n({...i,x:i.x+1}),!0;case"ArrowUp":case"k":case"w":return n(cf(i))||n({...cf(i),x:i.x-1})||n({...cf(i),x:i.x+1}),!0;case"ArrowDown":case"j":case"s":return hm(t,s),!0;case" ":{for(;t.piece!==null;)hm(t,s);return!0}default:return!1}}function Rj(){const t=Tj();let e=Math.random;return{title:"TETRIS",tick:500,step:(s,i)=>{e=i,hm(t,i)},draw:(s,i)=>{const n=Math.max(0,Math.floor((s.cols-(so*2+2))/2)),r=Math.max(0,Math.floor((s.rows-co-1)/2)),o=["",i.cool,i.lit,i.warn,i.dim,i.lit,i.cool,i.warn];for(let a=0;a<co;a++){s.put(n,r+a,"|",i.dim),s.put(n+so*2+1,r+a,"|",i.dim);for(let l=0;l<so;l++){const c=t.well[a][l];c!==0&&s.text(n+1+l*2,r+a,"[]",o[c])}}if(s.text(n,r+co,"+"+"-".repeat(so*2)+"+",i.dim),t.piece!==null)for(const[a,l]of t.piece.cells){const c=t.piece.y+l;c>=0&&s.text(n+1+(t.piece.x+a)*2,r+c,"[]",o[t.piece.kind])}t.over&&s.text(n+2,r+9," GAME OVER ",i.warn)},key:s=>Cj(t,s,e),status:()=>`${t.score} · ${t.lines} lines${t.over?" · OVER":""}`,over:()=>t.over}}function kj(t,e,s){const i=t>>1,n=e>>1,r={body:[[i,n],[i-1,n],[i-2,n]],food:[0,0],heading:"right",next:"right",score:0,over:!1,cols:t,rows:e};return C1(r,s),r}function C1(t,e){for(let s=0;s<1e3;s++){const i=[Math.floor(e()*t.cols),Math.floor(e()*t.rows)];if(!t.body.some(([n,r])=>n===i[0]&&r===i[1])){t.food=i;return}}}const Nj={up:"down",down:"up",left:"right",right:"left"};function Bj(t,e){Nj[e]!==t.heading&&(t.next=e)}function Gj(t,e){if(t.over)return;t.heading=t.next;const[s,i]=t.body[0],n=t.heading==="up"?[s,i-1]:t.heading==="down"?[s,i+1]:t.heading==="left"?[s-1,i]:[s+1,i],r=n[0]<0||n[1]<0||n[0]>=t.cols||n[1]>=t.rows,o=t.body.some(([a,l])=>a===n[0]&&l===n[1]);if(r||o){t.over=!0;return}t.body.unshift(n),n[0]===t.food[0]&&n[1]===t.food[1]?(t.score+=10,C1(t,e)):t.body.pop()}const Pj={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down",k:"up",w:"up",j:"down",s:"down",h:"left",a:"left",l:"right",d:"right"};function Lj(){let t=null;return{title:"SNAKE",tick:140,step:(e,s)=>{t===null&&(t=kj(Math.max(8,e.cols>>1),Math.max(6,e.rows-1),s)),Gj(t,s)},draw:(e,s)=>{t!==null&&(e.text(0,t.rows,"-".repeat(t.cols*2),s.dim),e.text(t.food[0]*2,t.food[1],"**",s.warn),t.body.forEach(([i,n],r)=>e.text(i*2,n,r===0?"@@":"oo",r===0?s.lit:s.cool)),t.over&&e.text(Math.max(0,t.cols-6),t.rows>>1," GAME OVER ",s.warn))},key:e=>{const s=Pj[e];return s===void 0||t===null?!1:(Bj(t,s),!0)},status:()=>t===null?"":`${t.score}${t.over?" · OVER":""}`,over:()=>t?.over??!1}}const R1={sl:xj,cmatrix:Oj,rain:Ej,aquarium:Aj,tetris:Rj,snake:Lj};function Wj(t){return t in R1}const Fj=8,Uj=26,hf=1.8,$j=100,wv=24;function yv(t,e){let s=Math.floor(t/$j);return e/(s*hf)<wv&&(s=Math.floor(e/wv/hf)),s=Math.max(Fj,Math.min(Uj,s)),{w:s,h:Math.round(s*hf)}}class jj{pane;field;canvas;state;focusMark;pausePill;program=null;name=null;paused=!1;timer=null;frame=null;observer;constructor(e){this.pane=e,this.field=el(e,".games-field"),this.canvas=el(e,".games-canvas"),this.state=e.querySelector(".pane-state"),this.focusMark=el(e,".games-focus"),this.pausePill=el(e,".games-pause"),this.field.tabIndex=0,this.pausePill.addEventListener("click",()=>this.pause_toggle()),el(e,".games-restart").addEventListener("click",()=>{this.name!==null&&this.program_run(this.name)}),this.field.addEventListener("mousedown",()=>{this.field.focus(),this.focusMark_paint(!0)}),this.field.addEventListener("focusin",()=>this.focusMark_paint(!0)),this.field.addEventListener("focusout",s=>{(!(s.relatedTarget instanceof Node)||!this.field.contains(s.relatedTarget))&&this.focusMark_paint(!1)}),this.field.addEventListener("keydown",s=>this.key_handle(s)),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.draw()),this.observer?.observe(this.field)}program_run(e){this.name=e,this.program=R1[e](),this.paused=!1,this.pausePill.textContent="PAUSE",this.clock_start(),this.program.key!==void 0&&(this.field.focus(),this.focusMark_paint(!0)),this.draw()}program_name(){return this.name}paused_is(){return this.paused}pause_toggle(){this.program!==null&&(this.paused=!this.paused,this.pausePill.textContent=this.paused?"RESUME":"PAUSE",this.paused?this.clock_stop():this.clock_start(),this.state_paint())}field_hasFocus(){return document.activeElement instanceof Node&&this.field.contains(document.activeElement)}field_release(){return this.field_hasFocus()?(document.activeElement.blur(),this.focusMark_paint(!1),!0):!1}dispose(){this.clock_stop(),this.observer?.disconnect()}key_handle(e){if(e.key==="Escape"){this.field_release(),e.stopPropagation();return}if(this.program!==null){if(e.key===" "&&this.program.key===void 0){this.pause_toggle(),e.preventDefault(),e.stopPropagation();return}this.program.key?.(e.key)===!0&&(e.preventDefault(),this.draw()),e.stopPropagation()}}clock_start(){this.clock_stop();const e=this.program;e!==null&&(this.timer=setInterval(()=>{this.field.offsetParent!==null&&(e.step(this.size_measure(),Math.random),this.draw(),e.over?.()===!0&&this.clock_stop())},e.tick))}clock_stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}size_measure(){const e=this.field.getBoundingClientRect(),s=yv(e.width,e.height);return{cols:Math.max(10,Math.floor(e.width/s.w)),rows:Math.max(6,Math.floor(e.height/s.h))}}palette_read(){const e=getComputedStyle(this.pane),s=(i,n)=>e.getPropertyValue(i).trim()||n;return{lit:s("--harvestgold","#ffcc66"),dim:s("--butter","#ffff99"),warn:s("--tomato","#ff7766"),cool:s("--daybreak","#55aaff")}}draw(){this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.paint()}))}paint(){const e=this.program,s=this.canvas.getContext("2d");if(e===null||s===null)return;const i=this.field.getBoundingClientRect(),n=window.devicePixelRatio||1;(this.canvas.width!==Math.floor(i.width*n)||this.canvas.height!==Math.floor(i.height*n))&&(this.canvas.width=Math.floor(i.width*n),this.canvas.height=Math.floor(i.height*n)),s.setTransform(n,0,0,n,0,0),s.clearRect(0,0,i.width,i.height);const r=yv(i.width,i.height);s.font=`${r.h-2}px 'Share Tech Mono', monospace`,s.textBaseline="top";const o=this.size_measure(),a=(c,h,d,u)=>{c<0||h<0||c>=o.cols||h>=o.rows||(s.fillStyle=u,s.fillText(d,c*r.w,h*r.h))},l={cols:o.cols,rows:o.rows,put:a,text:(c,h,d,u)=>{[...d].forEach((p,f)=>{p!==" "&&a(c+f,h,p,u)})}};e.draw(l,this.palette_read()),this.state_paint()}state_paint(){if(this.state===null||this.program===null)return;const e=this.program.status?.()??"";this.state.textContent=[this.program.title,e,this.paused?"PAUSED":""].filter(s=>s!=="").join(" · ")}focusMark_paint(e){this.focusMark.hidden=!e,this.pane.classList.toggle("games-field-focused",e)}}function el(t,e){const s=t.querySelector(e);if(s===null)throw new Error(`games pane: missing ${e}`);return s}function Hj(t,e){const{layout:s,panels:i,subjects:n}=t;return{instance_build:a=>{const l=e.template_stamp("tpl-pane-games"),c=new jj(l);return i.set("games",a,c),{id:a,kind:"games",mount:l,dispose:()=>{c.dispose(),i.delete(a),n.pane_leave(a)}}},show:a=>{const l=typeof a=="object"&&a!==null?a.program:void 0;if(typeof l!="string"||!Wj(l))return`games: no program named ${String(l)}`;const c=i.ids("games").find(f=>s.panes_shown().includes(f));if(c!==void 0)return s.focus_set(c),i.get("games",c)?.program_run(l),`games: ${l} on the GAMES pane`;const h=e.launcher_active();e.launcher_yield();const d=s.focused_get()??"files",u=e.instance_spawn("games");return(h?s.leaf_replace("files",u.id):s.leaf_split(d,"col",u.id,!1))?(h?s.focus_set(u.id):e.birth_record(u.id,d,"col",!1),i.get("games",u.id)?.program_run(l),`games: ${l} in a GAMES pane (Esc gives the keyboard back; its PAUSE and RESTART pills on the frame)`):(As(u.id),s.mount_remove(u.id),"games: could not open a pane")}}}function st(t,e){const s=document.createElementNS("http://www.w3.org/2000/svg",t);for(const[i,n]of Object.entries(e))s.setAttribute(i,String(n));return s}const fr=["cruiser","raptor","talon","warbird"],Vj={ship:'<g fill="currentColor"><ellipse cx="12" cy="6.5" rx="9" ry="4"/><rect x="9.5" y="9.5" width="5" height="6" rx="1"/><rect x="3" y="14" width="5" height="8" rx="2.2"/><rect x="16" y="14" width="5" height="8" rx="2.2"/><rect x="7" y="16" width="10" height="2.2" rx="1"/></g>',"klingon-cruiser":'<g fill="currentColor"><circle cx="12" cy="4" r="2.6"/><rect x="11" y="5.5" width="2" height="8.5"/><path d="M12 12.5 L22 20.5 L22.5 22.5 L17 19.2 L12 18 L7 19.2 L1.5 22.5 L2 20.5 Z"/><rect x="8.5" y="18.5" width="7" height="3.2" rx="1.2"/></g>',"klingon-raptor":'<path fill="currentColor" d="M12 1.5 L14 6.5 L22.5 10.5 L21.5 18 L19.5 12.5 L15 13.5 L14 20 L12 17 L10 20 L9 13.5 L4.5 12.5 L2.5 18 L1.5 10.5 L10 6.5 Z"/>',"klingon-talon":'<g fill="currentColor"><path d="M12 1.5 L13.6 11 L21.5 4.5 L19 15 L12 22 L5 15 L2.5 4.5 L10.4 11 Z"/><circle cx="12" cy="13.5" r="1.6" fill="#000"/></g>',"klingon-warbird":'<g fill="currentColor"><rect x="8.5" y="2" width="7" height="3.2" rx="1.6"/><rect x="11.1" y="4.5" width="1.8" height="7"/><path d="M1.5 13 Q12 6 22.5 13 L22 20 Q17 15.5 14 17 L12 22 L10 17 Q7 15.5 2 20 Z"/></g>',base:'<g fill="currentColor"><path d="M12 1.5 L17 12 L12 22.5 L7 12 Z"/><rect x="1.5" y="10.8" width="21" height="2.4" rx="1.2"/><circle cx="12" cy="12" r="3" fill="#000"/></g>',inhabited:'<circle cx="12" cy="12" r="7.5" fill="currentColor"/><path d="M4.5 12 Q12 15.5 19.5 12" fill="none" stroke="#000" stroke-width="1.6"/><path d="M5.5 8.5 Q12 11 18.5 8.5" fill="none" stroke="#000" stroke-width="1.2" opacity="0.6"/>',star:'<g stroke="currentColor" stroke-width="1.8" stroke-linecap="round" fill="none"><path d="M12 2 V22 M2 12 H22 M4.9 4.9 L19.1 19.1 M19.1 4.9 L4.9 19.1"/></g><circle cx="12" cy="12" r="2.6" fill="currentColor"/>',hole:'<g fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M12 12 m0 -2.5 a2.5 2.5 0 1 1 -2.5 2.5"/><path d="M12 12 m0 -6 a6 6 0 1 1 -6 6"/><path d="M12 12 m0 -9.5 a9.5 9.5 0 1 1 -9.5 9.5" opacity="0.5"/></g>',supernova:'<g fill="currentColor"><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(120 12 12)"/><path d="M10 8.536 A4 4 0 0 1 14 8.536 L17.5 2.474 A11 11 0 0 0 6.5 2.474 Z" transform="rotate(240 12 12)"/><circle cx="12" cy="12" r="2.4"/></g>'},Al="tm-";function k1(t,e=null){return t==="klingon"?`${Al}klingon-${e!==null&&fr.includes(e)?e:fr[0]}`:`${Al}${t}`}function qj(){if(document.getElementById(`${Al}ship`)!==null)return null;const t=st("svg",{class:"tm-defs",width:0,height:0,"aria-hidden":"true"}),e=st("defs",{});for(const[i,n]of Object.entries(Vj)){const r=st("symbol",{id:`${Al}${i}`,viewBox:"0 0 24 24"});r.innerHTML=n,e.append(r)}const s=(i,n)=>{const r=st("radialGradient",{id:`${Al}${i}`});for(const[o,a,l]of n){const c=st("stop",{offset:o});c.setAttribute("style",`stop-color: ${a}; stop-opacity: ${l}`),r.append(c)}return r};return e.append(s("halo",[[0,"var(--butter)",.9],[.35,"var(--harvestgold)",.5],[1,"var(--harvestgold)",0]]),s("halo-nova",[[0,"var(--butter)",.9],[.3,"var(--pumpkin-pie)",.6],[1,"var(--pumpkin-pie)",0]]),s("halo-mars",[[0,"var(--butter)",.8],[.3,"var(--mars)",.6],[1,"var(--mars)",0]]),s("photon-core",[[0,"#fff",1],[.35,"#ffd27a",1],[1,"#ff6a1a",1]]),s("photon-halo",[[0,"#ff6a1a",.55],[1,"#ff6a1a",0]])),t.append(e),t}function c_(t,e,s=null,i=0){const n=st("g",{class:`tm-mark tm-mark-${t}`});return n.append(st("use",{href:`#${k1(t,s)}`,x:-e.size/2,y:-e.size/2,width:e.size,height:e.size,class:"tm-symbol"})),N1(n,e.cx,e.cy,i),n}function N1(t,e,s,i=0){t.setAttribute("transform",i===0?`translate(${e} ${s})`:`translate(${e} ${s}) rotate(${i})`)}function h_(t,e=null){const s=st("svg",{viewBox:"0 0 24 24",class:`tm-icon tm-icon-${t}`,"aria-hidden":"true"});return s.append(st("use",{href:`#${k1(t,e)}`})),s}const Jc={ship:"E",klingon:"K",base:"#",inhabited:"@",star:"*",hole:" ",supernova:"///"},Kj=[{kind:"ship",name:"ENTERPRISE"},{kind:"klingon",name:"KLINGON"},{kind:"base",name:"STARBASE"},{kind:"inhabited",name:"INHABITED"},{kind:"star",name:"STAR"},{kind:"hole",name:"BLACK HOLE"},{kind:"supernova",name:"SUPERNOVA"}],Yj=/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,Xj=/^Klingon at (\d+),(\d+) escapes to quadrant/,Zj=/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/;class Tl{marks=new Map;mark_find(e){return this.marks.get(Tl.key_format(e))??null}line_hear(e){const s=Yj.exec(e);if(s!==null){const n=`${s[1]},${s[2]}`,r=this.marks.get(n);return this.marks.delete(n),r!==void 0&&this.marks.set(`${s[3]},${s[4]}`,r),!0}const i=Xj.exec(e)??Zj.exec(e);return i!==null?(this.marks.delete(`${i[1]},${i[2]}`),!0):!1}reconcile(e,s={}){s.reset===!0&&this.marks.clear();const i=new Set(e.map(n=>Tl.key_format(n)));for(const n of[...this.marks.keys()])i.has(n)||this.marks.delete(n);e.forEach((n,r)=>{const o=Tl.key_format(n);if(s.byOrder===!0){this.marks.set(o,fr[r%fr.length]);return}this.marks.has(o)||this.marks.set(o,this.leastWorn_get())})}clear(){this.marks.clear()}leastWorn_get(){const e=new Map(fr.map(i=>[i,0]));for(const i of this.marks.values())e.set(i,(e.get(i)??0)+1);let s=fr[0];for(const i of fr)(e.get(i)??0)<(e.get(s)??0)&&(s=i);return s}static key_format(e){return`${e.x},${e.y}`}}function Jj(t,e,s,i){const n=Math.max(0,Math.min(100,100*t/Math.max(1,e)));return i?{className:"tb-ring tb-ring-docked",width:.09,percent:n}:s?{className:`tb-ring ${n>60?"tb-ring-full":n>30?"tb-ring-mid":"tb-ring-low"}`,width:.025+.085*n/100,percent:n}:{className:"tb-ring tb-ring-down",width:.02,percent:n}}function q(t,e,s){const i=document.createElement(t);return i.className=e,s!==void 0&&(i.textContent=s),i}function Os(t,e,s){const i=q("button",`tb-pill ${t}`,e);return i.type="button",i.addEventListener("click",s),i}const Qj=16;class B1{constructor(e,s,i){this.onCommit=i,this.size=e;const n=e/2;this.root=q("div","tb-wheel");const r=st("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,role:"img","aria-label":s});r.classList.add("tb-wheel-face"),r.append(st("circle",{cx:n,cy:n,r:n-4,class:"tb-wheel-rim"})),r.append(st("circle",{cx:n,cy:n,r:(n-4)*.66,class:"tb-wheel-ring"})),r.append(st("circle",{cx:n,cy:n,r:(n-4)*.33,class:"tb-wheel-ring"}));for(let l=0;l<36;l++){const c=l*Math.PI/18,h=l%3===0,d=n-4-(h?12:7);r.append(st("line",{x1:n+d*Math.sin(c),y1:n-d*Math.cos(c),x2:n+(n-4)*Math.sin(c),y2:n-(n-4)*Math.cos(c),class:h?"tb-wheel-tick-major":"tb-wheel-tick"}))}for(const l of[0,90,180,270]){const c=l*Math.PI/180,h=st("text",{x:n+(n-26)*Math.sin(c),y:n-(n-26)*Math.cos(c)+4,"text-anchor":"middle",class:"tb-wheel-label"});h.textContent=String(l),r.append(h)}this.wedge=st("path",{d:"",class:"tb-wheel-wedge"}),r.append(this.wedge),this.marks=st("g",{class:"tb-wheel-marks"}),r.append(this.marks),this.needle=st("line",{x1:n,y1:n,x2:n,y2:14,class:"tb-wheel-needle"}),r.append(this.needle),r.append(st("circle",{cx:n,cy:n,r:6,class:"tb-wheel-hub"})),this.root.append(r);const o=q("div","tb-wheel-row");this.readout=q("span","tb-wheel-readout","0°"),this.commit=Os("tb-commit","SET COURSE",()=>this.onCommit(Math.round(this.degrees))),o.append(this.readout,this.commit),this.root.append(o);const a=l=>{const c=r.getBoundingClientRect(),h=l.clientX-c.left-c.width/2,d=l.clientY-c.top-c.height/2;this.degrees_set((Math.atan2(h,-d)*180/Math.PI+360)%360)};r.addEventListener("pointerdown",l=>{r.setPointerCapture(l.pointerId),a(l)}),r.addEventListener("pointermove",l=>{l.buttons!==0&&a(l)})}onCommit;root;needle;marks;wedge;readout;commit;degrees=0;wedgeHalf=null;size;degrees_set(e){this.degrees=e;const s=this.size/2,i=e*Math.PI/180;this.needle.setAttribute("x2",String(s+(s-14)*Math.sin(i))),this.needle.setAttribute("y2",String(s-(s-14)*Math.cos(i))),this.readout.textContent=`${Math.round(e)}°`,this.wedge_draw()}degrees_get(){return this.degrees}wedge_set(e){this.wedgeHalf=e,this.wedge_draw()}wedge_draw(){if(this.wedgeHalf===null){this.wedge.setAttribute("d","");return}const e=this.size/2,s=e-14,i=(this.degrees-this.wedgeHalf)*Math.PI/180,n=(this.degrees+this.wedgeHalf)*Math.PI/180,r=e+s*Math.sin(i),o=e-s*Math.cos(i),a=e+s*Math.sin(n),l=e-s*Math.cos(n);this.wedge.setAttribute("d",`M ${e} ${e} L ${r} ${o} A ${s} ${s} 0 0 1 ${a} ${l} Z`)}marks_set(e){this.marks.replaceChildren();const s=this.size/2;for(const i of e){const n=i.bearing*Math.PI/180,r=(s-4)*.8,o=s+r*Math.sin(n),a=s-r*Math.cos(n),l=i.kind==="klingon"?i.bearing+180:0,c=c_(i.kind,{cx:o,cy:a,size:Qj},i.variant??null,l);c.classList.add("tb-wheel-mark",`tb-wheel-mark-${i.kind}`);const h=st("title",{});h.textContent=i.label,c.append(h),this.marks.append(c)}}lit_set(e,s="SET COURSE"){this.root.classList.toggle("tb-lit",e),this.commit.disabled=!e,this.commit.textContent=s}}class xr{constructor(e,s,i,n){this.digits=i,this.onCommit=n,this.root=q("div","tb-slider");const r=q("label","tb-slider-label",s);r.htmlFor=e,this.input=document.createElement("input"),this.input.type="range",this.input.id=e,this.input.className="tb-slider-input",this.input.addEventListener("input",()=>{this.shown_refresh(),this.onInput?.(this.value_get())});const o=q("div","tb-slider-column");this.ticks=q("div","tb-slider-ticks"),this.note=q("span","tb-slider-note"),o.append(this.input,this.ticks,this.note),this.shown=q("span","tb-slider-readout","—"),this.commit=Os("tb-commit","SET",()=>this.onCommit(this.value_get())),this.root.append(r,o,this.shown,this.commit)}digits;onCommit;root;input;shown;commit;note;ticks;onInput=null;range_set(e,s,i,n=0){const r=e.min??0,o=e.max??1;this.input.min=String(r),this.input.max=String(o),this.input.step=String(e.step??1),this.input.value=String(Math.min(o,Math.max(r,s))),this.note.textContent=i,this.ticks.replaceChildren();for(let a=0;a<n;a++){const l=r+(o-r)*a/Math.max(1,n-1);this.ticks.append(q("span","tb-slider-tick",Number.isInteger(l)?String(l):l.toFixed(1)))}this.shown_refresh()}input_listen(e){this.onInput=e}note_set(e){this.note.textContent=e}value_get(){return Number(this.input.value)}value_set(e){this.input.value=String(e),this.shown_refresh()}lit_set(e,s="SET"){this.root.classList.toggle("tb-lit",e),this.input.disabled=!e,this.commit.disabled=!e,this.commit.textContent=s}lit_is(){return this.root.classList.contains("tb-lit")}shown_refresh(){this.shown.textContent=this.value_get().toFixed(this.digits)}}class Qc{root;buttons=[];note;constructor(e,s,i){this.root=q("div","tb-pillrow"),e!==""&&this.root.append(q("span","tb-slider-label",e));const n=q("div","tb-slider-column"),r=q("div","tb-pills");for(const o of s){const a=Os("tb-choice",o.label,()=>i(o.line,o.label));a.dataset.line=o.line,this.buttons.push(a),r.append(a)}this.note=q("span","tb-slider-note",""),n.append(r,this.note),this.root.append(n)}note_set(e){this.note.textContent=e}lit_set(e){this.root.classList.toggle("tb-lit",e);for(const s of this.buttons)s.disabled=!e}}const e6=[[/Klingon attack:/,"incoming"],[/^HIT: \d+ units/,"hit"],[/CRITICAL HIT/,"hit"],[/\*\*\* Klingon at \d+,\d+ destroyed \*\*\*/,"explosion"],[/\*\*\*\*\* .* destroyed \*\*\*\*\*/,"explosion"],[/Starbase at \d+,\d+ destroyed/,"explosion"],[/Inhabited starsystem .* destroyed/,"explosion"],[/^Torpedo track/,"torpedo"],[/^Phaser bank \d+ fires:/,"phaser"],[/^Phasers locked on target/,"phaser"],[/^Starbase in \d+,\d+ responds/,"hail"],[/^Password verified; self destruct sequence continues/,"destruct"]];function t6(t){const e=[];for(const[s,i]of e6)s.test(t)&&!e.includes(i)&&e.push(i);return e}function s6(t,e){const s=[];if(t!==null&&t.condition.name!==e.condition.name)switch(e.condition.name){case"RED":s.push("redalert");break;case"YELLOW":s.push("yellowalert");break;case"DOCKED":s.push("dock");break;default:s.push("green");break}return t!==null&&(t.position.quadrant.x!==e.position.quadrant.x||t.position.quadrant.y!==e.position.quadrant.y)&&s.push("sensor"),s}function i6(t){switch(t){case"abandon":return"transporter";case"destruct":return"destruct";case"computer":return"thinking";default:return null}}function n6(t,e){return t!=="distance"?null:e==="impulse"?"impulse":e==="move"||e==="ram"?"warp":null}function gr(t,e){return e==="computer"&&t==="MOVE"?"MOVE (COMPUTER)":e==="commit"?/^SET COURSE/.test(t)?"SET COURSE":"SLIDER SET":e==="choice"&&/^\d+°$/.test(t)?"BURST ANGLE":/^CANCEL/.test(t)?"CANCEL":t}const Ss=10,Ul=8,r6="*",o6="#",G1="E",a6="Q",l6="K",c6="@",P1=" ",h6=7,d6=64,u6=63,f6=0,p6=1,m6=2,g6=3,_6=[{name:"warp drive",person:"Scotty"},{name:"S.R. scanners",person:"Scotty"},{name:"L.R. scanners",person:"Scotty"},{name:"phasers",person:"Sulu"},{name:"photon tubes",person:"Sulu"},{name:"impulse engines",person:"Scotty"},{name:"shield control",person:"Sulu"},{name:"computer",person:"Spock"},{name:"subspace radio",person:"Uhura"},{name:"life support",person:"Scotty"},{name:"navigation system",person:"Chekov"},{name:"cloaking device",person:"Scotty"},{name:"transporter",person:"Scotty"},{name:"shuttlecraft",person:"Scotty"},{name:"*ERR 14*",person:"Nobody"},{name:"*ERR 15*",person:"Nobody"}],b6=["GREEN","DOCKED","YELLOW","RED"];function xh(t,e){return(Math.atan2(e.y-t.y,-(e.x-t.x))*180/Math.PI+360)%360}function ad(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function M6(t){switch(t){case G1:case a6:return"ship";case l6:return"klingon";case o6:return"base";case r6:return"star";case c6:return"inhabited";case P1:return"hole";default:return"empty"}}function v6(t){const e=new Map;for(const s of t)(s.evcode&u6)!==h6||(s.evcode&d6)!==0||e.set(s.systemname,s.date);return _6.map((s,i)=>({index:i,name:s.name,person:s.person,repairAt:e.get(i)??null})).filter(s=>!s.name.startsWith("*"))}function w6(t){const e=t.Etc.nkling;switch(t.Ship.cond){case g6:return e===1?"1 Klingon in this quadrant":`${e} Klingons in this quadrant`;case m6:return t.Ship.energy<t.Param.energylow?"energy low":"Klingons near";case p6:return"docked at a starbase";case f6:default:return"all clear"}}function y6(t){const{Ship:e,Now:s,Game:i,Param:n,Etc:r,Sect:o,Quad:a}=t,l={x:e.quadx,y:e.quady},c={x:e.sectx,y:e.secty},h=[];for(let m=0;m<Ss;m++){const w=[];for(let y=0;y<Ss;y++){const b=o[m]?.[y]??P1;w.push({x:m,y,kind:M6(b),glyph:b})}h.push(w)}const d=r.klingon.slice(0,r.nkling).map(m=>({x:m.x,y:m.y,bearing:xh(c,m),range:ad(c,m),power:m.power,mark:null})).sort((m,w)=>m.range-w.range),u=s.base.slice(0,s.bases).map(m=>({x:m.x,y:m.y}));let p=null;for(const m of u){const w=ad(l,m);(p===null||w<p.range)&&(p={at:m,range:w,here:w===0})}const f=[];for(let m=0;m<Ul;m++){const w=[];for(let y=0;y<Ul;y++){const v=a[m]?.[y]?.scanned??-1,z=v<0?null:v>=1e3?"///":String(v).padStart(3,"0");w.push({x:m,y,here:m===l.x&&y===l.y,code:z,supernova:v>=1e3,klingons:v<0||v>=1e3?0:Math.floor(v/100),bases:v<0||v>=1e3?0:Math.floor(v%100/10)})}f.push(w)}const _=v6(t.Event),g=_.filter(m=>m.repairAt!==null).sort((m,w)=>(m.repairAt??0)-(w.repairAt??0));return{condition:{name:b6[e.cond]??"GREEN",why:w6(t)},ship:{shipName:e.shipname,energy:e.energy,energyMax:n.energy,shield:e.shield,shieldMax:n.shield,shieldsUp:e.shldup!==0,cloaked:e.cloaked!==0,torpedoes:e.torped,torpedoesMax:n.torped,reserves:e.reserves,reservesMax:n.reserves,crew:e.crew,warp:e.warp},mission:{stardate:s.date,timeLeft:s.time,klingonsLeft:s.klings,klingonsStart:n.klings,killed:i.killk,captives:i.captives,starbases:s.bases},position:{quadrant:l,sector:c},sectors:h,klingons:d,bases:u,nearestBase:p,chart:f,devices:_,damaged:g,game:{killk:i.killk,killb:i.killb,kills:i.kills,killinhab:i.killinhab,helps:i.helps,captives:i.captives,deaths:i.deaths,killed:i.killed!==0,skill:i.skill,won:t.Move.endgame>0,abandoned:e.ship!==G1},param:{warptime:n.warptime,dockfac:n.dockfac,klingpwr:n.klingpwr,date:n.date}}}const z6=["novice","fair","good","expert","commodore","impossible"];function L1(t){const{game:e,mission:s,param:i}=t,n=[];n.push({label:`${e.killk} Klingons killed`,points:Math.trunc(i.klingpwr/4)*e.killk});const r=Math.max(1,s.stardate-i.date),o=e.killk/r;return n.push({label:`kill rate ${o.toFixed(2)} Klingons/stardate`,points:Math.trunc(400*o)}),n.push({label:`penalty for ${s.klingonsLeft} Klingons remaining`,points:Math.trunc(-400*s.klingonsLeft/(e.killk+1))}),e.won&&n.push({label:`bonus for winning a ${z6[e.skill-1]??""} game`,points:100*e.skill}),e.killed&&n.push({label:"penalty for getting killed",points:-500}),n.push({label:`${e.killb} starbases killed`,points:-100*e.killb}),n.push({label:`${e.helps} calls for help`,points:-100*e.helps}),n.push({label:`${e.kills} stars destroyed`,points:-5*e.kills}),n.push({label:`${e.killinhab} inhabited starsystems destroyed`,points:-150*e.killinhab}),e.abandoned&&n.push({label:"penalty for abandoning ship",points:-200}),n.push({label:`${e.captives} Klingons captured`,points:3*e.captives}),n.push({label:`${e.deaths} casualties`,points:-e.deaths}),{items:n,total:n.reduce((a,l)=>a+l.points,0)}}function zv(t,e){const{quadrant:s,sector:i}=t.position,n=s.x+i.x/Ss-(e.quadrant.x+e.sector.x/Ss),r=e.quadrant.y+e.sector.y/Ss-(s.y+i.y/Ss);let o=Math.atan2(r,n);return o<0&&(o+=2*Math.PI),{course:Math.trunc(o*180/Math.PI+.5)%360,distance:Math.hypot(n,r)}}function S6(t,e,s){const{quadrant:i,sector:n}=t.position,r=e*Math.PI/180,o=Math.min(Ul*Ss-1,Math.max(0,Math.round(i.x*Ss+n.x-Math.cos(r)*s*Ss))),a=Math.min(Ul*Ss-1,Math.max(0,Math.round(i.y*Ss+n.y+Math.sin(r)*s*Ss)));return{quadrant:{x:Math.trunc(o/Ss),y:Math.trunc(a/Ss)},sector:{x:o%Ss,y:a%Ss}}}function W1(t,e,s){const i=Math.trunc((t+.05)*e*e*e);return{stardates:s*t/(e*e),units:i,unitsShielded:2*i}}function x6(t){return{stardates:t/.095,units:Math.trunc(20+100*t)}}function F1(t){return Math.trunc(Math.pow(.9,t*10)*98+.5)}function Sv(t,e){if(t.repairAt===null)return null;const s=t.repairAt-e.mission.stardate,i=e.condition.name==="DOCKED",n=i?1/e.param.dockfac:1,r=i?1:e.param.dockfac;return{inFlight:s*n+.005,docked:s*r+.005}}function U1(t,e){const s=[],i=(d,u)=>`${d>0?"+":d<0?"−":""}${Math.abs(d).toFixed(u)}`,n=e.mission.stardate-t.mission.stardate;Math.abs(n)>=.005&&s.push({label:"STARDATE",change:i(n,2),bad:!1});const r=e.ship.energy-t.ship.energy;r!==0&&s.push({label:"ENERGY",change:i(r,0),bad:r<0});const o=e.ship.shield-t.ship.shield;o!==0&&s.push({label:"SHIELDS",change:i(o,0),bad:o<0});const a=e.ship.torpedoes-t.ship.torpedoes;a!==0&&s.push({label:"TORPEDOES",change:i(a,0),bad:!1});const l=e.mission.klingonsLeft-t.mission.klingonsLeft;l!==0&&s.push({label:"KLINGONS",change:`${i(l,0)} · ${e.mission.klingonsLeft} LEFT`,bad:l>0});const c=e.damaged.filter(d=>!t.damaged.some(u=>u.index===d.index));c.length>0&&s.push({label:"DAMAGE",change:c.map(d=>d.name.toUpperCase()).join(" · "),bad:!0});const h=t.damaged.filter(d=>!e.damaged.some(u=>u.index===d.index));return h.length>0&&s.push({label:"REPAIRED",change:h.map(d=>d.name.toUpperCase()).join(" · "),bad:!1}),t.condition.name!==e.condition.name&&s.push({label:"CONDITION",change:e.condition.name,bad:e.condition.name==="RED"}),s}const O6=[["return to continue","return"],["What length game","length"],["What skill game","skill"],["Enter password verification","password-verify"],["Enter a password","password"],["Enter tournament code","tournament"],["Command","command"],["Torpedo course","torpedo-course"],["Course","course"],["course","bank-course"],["Distance","distance"],["distance","computer-distance"],["Warp factor","warp-factor"],["warp factor","computer-warp"],["How long","how-long"],["Manual or automatic","manual-automatic"],["Units to fire","units"],["units","bank-units"],["spread","spread"],["Do you want a burst","burst"],["burst angle","burst-angle"],["Up or down","up-down"],["Request","request"],["Quadrant","quadrant"],["q-y","quadrant-y"],["Sector","sector"],["s-y","sector-y"],["range","range"],["direction","direction"],["status report","status-report"],["Another game","another"]];function E6(t){const e=t.replace(/[:.\s]+$/,"");if(e==="")return"return";for(const[s,i]of O6)if(e.endsWith(s))return i;return/wise$|certain that is wise$|Shall we cancel our rest period$/.test(e)?"yes-no":"unknown"}const Pd=[{id:"move",label:"MOVE",station:"helm",line:"m",asks:["course","distance"]},{id:"ram",label:"RAM",station:"helm",line:"ram",asks:["course","distance"]},{id:"warp",label:"WARP",station:"helm",line:"w",asks:["warp-factor"]},{id:"impulse",label:"IMPULSE",station:"helm",line:"i",asks:["course","distance"]},{id:"dock",label:"DOCK",station:"helm",line:"do",asks:[]},{id:"undock",label:"UNDOCK",station:"helm",line:"u",asks:[]},{id:"rest",label:"REST",station:"helm",line:"r",asks:["how-long"]},{id:"phasers",label:"PHASERS",station:"tactical",line:"p",asks:["manual-automatic","units"]},{id:"torpedo",label:"TORPEDO",station:"tactical",line:"t",asks:["torpedo-course","burst","burst-angle"]},{id:"shields",label:"SHIELDS",station:"tactical",line:"sh",asks:["up-down"]},{id:"cloak",label:"CLOAK",station:"tactical",line:"cl",asks:["up-down"]},{id:"capture",label:"CAPTURE",station:"tactical",line:"ca",asks:[]},{id:"visual",label:"VISUAL",station:"tactical",line:"v",asks:["direction"]},{id:"computer",label:"COMPUTER",station:"ship",line:"c",asks:["request"]},{id:"help",label:"CALL STARBASE",station:"ship",line:"help",asks:[]},{id:"dump",label:"DUMP",station:"ship",line:"dump",asks:[]},{id:"credits",label:"CREDITS",station:"ship",line:"cr",asks:[]},{id:"abandon",label:"ABANDON",station:"ship",line:"abandon",asks:[],grave:!0},{id:"destruct",label:"DESTRUCT",station:"ship",line:"destruct",asks:["password-verify"],grave:!0},{id:"terminate",label:"TERMINATE",station:"ship",line:"terminate",asks:[],grave:!0}];function xs(t,e){switch(t){case"return":return{kind:"auto"};case"length":return{kind:"pills",choices:[{label:"SHORT",line:"s"},{label:"MEDIUM",line:"m"},{label:"LONG",line:"l"},{label:"RESTART",line:"restart"}]};case"skill":return{kind:"pills",choices:[{label:"NOVICE",line:"n"},{label:"FAIR",line:"f"},{label:"GOOD",line:"g"},{label:"EXPERT",line:"e"},{label:"COMMODORE",line:"c"},{label:"IMPOSSIBLE",line:"i"}]};case"password":case"tournament":case"password-verify":return{kind:"auto"};case"course":case"torpedo-course":case"direction":case"bank-course":return{kind:"wheel",min:0,max:360,step:1,commit:"SET COURSE",cancel:"-1"};case"distance":return{kind:"slider",min:0,max:15,step:.1,commit:"ENGAGE",cancel:"-1"};case"computer-distance":case"range":return{kind:"slider",min:0,max:15,step:.1,commit:"SET"};case"warp-factor":return{kind:"slider",min:1,max:10,step:.1,commit:"SET WARP",cancel:"-1"};case"computer-warp":return{kind:"slider",min:1,max:10,step:.1,commit:"SET"};case"how-long":return{kind:"slider",min:0,max:Math.max(.1,e?.mission.timeLeft??15),step:.1,commit:"REST",cancel:"0"};case"manual-automatic":return{kind:"pills",choices:[{label:"MANUAL",line:"m"},{label:"AUTOMATIC",line:"a"}]};case"units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"FIRE",cancel:"0"};case"bank-units":return{kind:"slider",min:0,max:Math.max(10,e?.ship.energy??5e3),step:10,commit:"SET",cancel:"0"};case"spread":return{kind:"slider",min:0,max:1,step:.05,commit:"SET"};case"burst":case"status-report":case"another":case"yes-no":return{kind:"yesno",choices:[{label:"YES",line:"y"},{label:"NO",line:"n"}]};case"burst-angle":return{kind:"pills",choices:[1,2,3,5,8,10,12,15].map(s=>({label:`${s}°`,line:String(s)})),cancel:"0"};case"up-down":return{kind:"pills",choices:[{label:"UP",line:"u"},{label:"DOWN",line:"d"}]};case"request":return{kind:"pills",choices:[{label:"CHART",line:"ch"},{label:"TRAJECTORY",line:"t"},{label:"COURSE",line:"c"},{label:"MOVE",line:"m"},{label:"SCORE",line:"s"},{label:"PHASER EFFECT",line:"p"},{label:"WARP COST",line:"w"},{label:"IMPULSE COST",line:"i"},{label:"DISTRESS LIST",line:"d"}]};case"quadrant":case"quadrant-y":return{kind:"slider",min:0,max:Ul-1,step:1,commit:"SET"};case"sector":case"sector-y":return{kind:"slider",min:0,max:Ss-1,step:1,commit:"SET"};default:return{kind:"text"}}}function A6(){return`argus${Math.floor(Math.random()*9e3+1e3)}`}class T6{constructor(e){this.hooks=e}hooks;open=null;lastCommand=null;password=A6();ended=!1;ask(e){const s=E6(e);return s==="return"?Promise.resolve(""):s==="password"||s==="tournament"||s==="password-verify"?Promise.resolve(this.password):(s==="command"&&(this.lastCommand=null),new Promise(i=>{this.open={question:{prompt:e,question:s,command:this.lastCommand},answer:i},this.hooks.question_changed(this.open.question)}))}question_get(){return this.open?.question??null}answer(e){if(this.open===null)return!1;const{answer:s}=this.open;return this.open=null,this.hooks.question_changed(null),s(e),!0}command_send(e){return this.open?.question.question!=="command"?!1:(this.lastCommand=e,this.answer(e.line))}abandon(){if(this.open===null)return!1;const{answer:e}=this.open;return this.open=null,this.hooks.question_changed(null),e(null),!0}text_take(e){this.hooks.text_written(e)}event_take(e,s){e==="games.trek.state"&&typeof s=="object"&&s!==null&&this.hooks.state_shown(s)}end(e){this.ended||(this.ended=!0,this.open=null,this.hooks.ended(e))}ended_is(){return this.ended}}const Un={torpedoPoint:140,sector:170,burst:800,beam:900,rescan:350,flare:900,tail:300},I6=[[/^Torpedo track(?:, torpedo number \d+)?:/,()=>({kind:"torpedo-head"})],[/^\s*(\d+\.\d)\s+(\d+\.\d)\s*$/,t=>({kind:"torpedo-point",at:{x:Number(t[1]),y:Number(t[2])}})],[/^Torpedo missed|^Torpedo disappears into a black hole/,()=>({kind:"torpedo-end"})],[/\*\*\* Klingon at (\d+),(\d+) destroyed \*\*\*/,t=>({kind:"kill",at:ui(t,1)})],[/^Starbase at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/^Inhabited starsystem .* at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/^Unknown object . at (\d+),(\d+) destroyed/,t=>({kind:"kill",at:ui(t,1)})],[/Star at (\d+),(\d+) gone nova/,t=>({kind:"nova",at:ui(t,1)})],[/^Photon tubes misfire/,()=>({kind:"misfire"})],[/^(\d+) unit hit on Klingon at (\d+),(\d+)/,t=>({kind:"phaser",at:ui(t,2)})],[/^HIT: (\d+) units(?: from (\d+),(\d+))?(?:, shields absorb (\d+)%)?/,t=>({kind:"incoming",hit:Number(t[1]),from:t[2]===void 0?null:ui(t,2),absorb:t[4]===void 0?0:Number(t[4])})],[/^Klingon at (\d+),(\d+) moves to (\d+),(\d+)/,t=>({kind:"klingon-move",from:ui(t,1),to:ui(t,3)})],[/^Klingon at (\d+),(\d+) escapes to quadrant (\d+),(\d+)/,t=>({kind:"klingon-escape",from:ui(t,1),quadrant:ui(t,3)})],[/RED ALERT: supernova occurring at (\d+),(\d+)/,t=>({kind:"supernova",at:ui(t,1)})],[/^\s*in quadrant (\d+),(\d+)\.\s+Caution is advised/,t=>({kind:"supernova-report",quadrant:ui(t,1)})]];function ui(t,e){return{x:Number(t[e]),y:Number(t[e+1])}}function D6(t){for(const[e,s]of I6){const i=e.exec(t);if(i!==null)return s(i)}return null}class C6{constructor(e=R6){this.reduced=e}reduced;frames=[];running=!1;skipping=!1;waiting=new Set;played={};push(e){this.frames.push(e),this.pump()}skip(){if(!(this.frames.length===0&&!this.running)){this.skipping=!0;for(const e of this.waiting)e();this.waiting.clear()}}busy_is(){return this.running||this.frames.length>0}pending_count(){return this.frames.length}skipping_is(){return this.skipping}async settle(){for(;this.busy_is();)await new Promise(e=>{setTimeout(e,1)})}wait(e){return this.skipping||e<=0?Promise.resolve():new Promise(s=>{const i=setTimeout(()=>{this.waiting.delete(n),s()},e),n=()=>{clearTimeout(i),s()};this.waiting.add(n)})}async tween(e,s){const i=xv();for(;!this.skipping;){const n=Math.min(1,(xv()-i)/Math.max(1,e));if(s(n),n>=1)return;await k6(this)}s(1)}async pump(){if(!this.running){this.running=!0;try{for(;this.frames.length>0;){const e=this.frames.shift();this.played[e.kind]=(this.played[e.kind]??0)+1;const s=this.skipping||this.reduced();try{await e.run(s)}catch{}}}finally{this.running=!1,this.skipping=!1}}}}function R6(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function xv(){return typeof performance=="object"?performance.now():Date.now()}function k6(t){return typeof requestAnimationFrame=="function"?new Promise(e=>{requestAnimationFrame(()=>e())}):t.wait(16)}function ya(t){return[t.y+.5,t.x+.5]}function $1(t,e){return(Math.atan2(e.y-t.y,-(e.x-t.x))*180/Math.PI+360)%360}function N6(t,e,s=10){const i={x:t.quadrant.x*s+t.sector.x,y:t.quadrant.y*s+t.sector.y},n={x:e.quadrant.x*s+e.sector.x,y:e.quadrant.y*s+e.sector.y},r={x:n.x-i.x,y:n.y-i.y},o=(p,f,_)=>{let g=_?1/0:-1/0;for(const m of["x","y"]){if(r[m]===0)continue;const w=p[m]*s-.5,y=p[m]*s+s-.5,b=(w-f[m])/r[m],v=(y-f[m])/r[m];_?g=Math.min(g,Math.max(b,v)):g=Math.max(g,Math.min(b,v))}return Number.isFinite(g)?Math.max(0,Math.min(1,g)):_?1:0},a=o(t.quadrant,i,!0),l=o(e.quadrant,i,!1),c=.7,h={x:i.x+r.x*a-t.quadrant.x*s,y:i.y+r.y*a-t.quadrant.y*s},d={x:i.x+r.x*l-e.quadrant.x*s,y:i.y+r.y*l-e.quadrant.y*s},u=Math.hypot(r.x,r.y)||1;return{exit:{x:h.x+r.x/u*c,y:h.y+r.y/u*c},entry:{x:d.x-r.x/u*c,y:d.y-r.y/u*c}}}function Ld(t,e=""){const s=st("g",{class:`tb-motion ${e}`.trim()});return t.append(s),s}const B6=.7;async function tl(t,e,s,i,n,r={},o=!1){if(o)return;const a=Ld(t,"tb-motion-slide"),[l,c]=ya(i),[h,d]=ya(n),u=r.hostile===!0?" tb-hostile":"";a.append(st("line",{class:`tb-track${u}`,x1:l,y1:c,x2:h,y2:d}));const p=st("line",{class:`tb-pulse tb-pulse-wide${u}`,x1:l,y1:c,x2:l,y2:c}),f=st("line",{class:`tb-pulse tb-pulse-core${u}`,x1:l,y1:c,x2:l,y2:c}),_=r.heading??$1(i,n),g=c_(s.kind,{cx:l,cy:c,size:B6},s.variant,_);g.classList.add(`tb-sector-${s.kind}`),a.append(p,f,g);const m=Math.max(1,Math.hypot(n.x-i.x,n.y-i.y));await e.tween(m*Un.sector,w=>{const y=l+(h-l)*w,b=c+(d-c)*w,v=Math.max(0,w-.12),z=l+(h-l)*v,x=c+(d-c)*v;for(const M of[p,f])M.setAttribute("x1",String(z)),M.setAttribute("y1",String(x)),M.setAttribute("x2",String(y)),M.setAttribute("y2",String(b));N1(g,y,b,_)}),a.remove()}async function Ov(t,e,s,i,n,r=!1){if(r)return;const o=Ld(t,"tb-motion-beam"),[a,l]=ya(s),[c,h]=ya(i),d=n?" tb-hostile":"";o.append(st("line",{class:`tb-beam${d}`,x1:a,y1:l,x2:c,y2:h}),st("line",{class:`tb-beam tb-beam-core${d}`,x1:a,y1:l,x2:c,y2:h})),await e.wait(Un.beam),o.remove()}async function eh(t,e,s,i,n=!1){if(n)return;const r=Ld(t,`tb-motion-burst tb-burst tb-burst-${i}`),[o,a]=ya(s),l=i==="misfire"?Un.burst*.6:i==="supernova"?Un.burst*1.6:Un.burst;r.style.setProperty("--tb-ms",`${l}ms`),r.append(st("circle",{class:"tb-burst-halo",cx:o,cy:a,r:.1}));const c=st("g",{class:"tb-burst-spikes"}),h=i==="nova"||i==="supernova"?12:8,d=i==="misfire"?.6:i==="supernova"?1.8:i==="nova"?1.1:.95;for(let u=0;u<h;u++){const p=u/h*Math.PI*2+(h===8?Math.PI/8:0);c.append(st("line",{class:"tb-burst-spike",x1:o+Math.cos(p)*.12,y1:a+Math.sin(p)*.12,x2:o+Math.cos(p)*d,y2:a+Math.sin(p)*d}))}r.append(c,st("circle",{class:"tb-burst-core",cx:o,cy:a,r:.04})),await e.wait(l),r.remove()}async function G6(t,e,s=!1){if(s)return;const i=t.querySelector(".tb-ring");if(i===null)return;const n=st("circle",{class:"tb-motion tb-ring-flare",cx:i.getAttribute("cx")??0,cy:i.getAttribute("cy")??0,r:.46});t.append(n),await e.wait(Un.flare),n.remove()}class P6{layer;tail;photon;points=[];constructor(e,s){this.layer=Ld(e,"tb-motion-torpedo"),this.tail=st("g",{class:"tb-tail"}),this.photon=st("g",{class:"tb-photon"}),this.photon.append(st("circle",{class:"tb-photon-halo",cx:0,cy:0,r:.34}));const i=st("g",{class:"tb-photon-pulses"});for(let o=0;o<10;o++){const a=st("g",{transform:`rotate(${o*36})`});a.append(st("rect",{x:.08,y:-.016,width:.2+o%3*.05,height:.032,rx:.006})),i.append(a)}this.photon.append(i,st("circle",{class:"tb-photon-core",cx:0,cy:0,r:.12})),this.layer.append(this.tail,this.photon);const[n,r]=ya(s);this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`)}async point_reach(e,s,i=!1){const[n,r]=[s.y,s.x];this.points.push([n,r]),this.photon.setAttribute("transform",`translate(${n} ${r})`),this.tail.replaceChildren();const o=this.points.slice(-4);for(let a=1;a<o.length;a++){const[l,c]=o[a-1],[h,d]=o[a];this.tail.append(st("line",{class:"tb-tail-segment",x1:l,y1:c,x2:h,y2:d,"stroke-width":.03+.03*a,opacity:.25+.25*a}))}i||await e.wait(Un.torpedoPoint)}async end(e,s=!1){this.photon.remove(),s||await e.wait(Un.tail),this.layer.remove()}}function Ev(t,e){t.classList.toggle("tb-rescan",e)}function L6(t,e){t.classList.remove("tb-bloom","tb-bloom-hostile"),t.offsetWidth,t.classList.add("tb-bloom"),e&&t.classList.add("tb-bloom-hostile"),t.addEventListener("animationend",()=>t.classList.remove("tb-bloom","tb-bloom-hostile"),{once:!0})}function gi(t,e){return t!==null&&e.includes(t.question)}function Wd(t,e){const s=q("div","tb-station-head"),i=q("span","tb-station-step",""),n=Os("tb-grave tb-cancel","CANCEL",()=>{e.answer_send(n.dataset.line??"","CANCEL")});return n.hidden=!0,s.append(q("span","tb-station-name",t),i,q("span","tb-station-fill"),n),{root:s,step:i,cancel:n}}function Fd(t,e,s,i){const n=s?.command??null,r=n!==null&&n.station===e&&s!==null&&s.question!=="command";t.step.textContent=r&&n!==null&&s!==null?`${n.label} · ${s.question.replace(/-/g," ").toUpperCase()}`:s?.question==="command"?"READY":"";const o=r?i?.cancel:void 0;t.cancel.hidden=o===void 0,t.cancel.dataset.line=o??"",t.cancel.textContent=n===null?"CANCEL":`CANCEL ${n.label}`}function d_(t,e){const s=Os(`tb-command${t.grave===!0?" tb-grave":""}`,t.label,()=>{e.command_send(t)});return s.dataset.command=t.id,s}function j1(t,e){const s=q("div","tb-pills tb-command-pills"),i=new Map;for(const n of Pd.filter(r=>r.station===t)){const r=d_(n,e);i.set(n.id,r),s.append(r)}return{root:s,pills:i}}function Ud(t,e){for(const[s,i]of t)i.disabled=e?.question!=="command",i.classList.toggle("tb-pill-on",e?.command?.id===s)}function H1(t,e){const s=Os("tb-target","",e);return s.append(h_("klingon",t.mark),document.createTextNode(`${t.x},${t.y}`)),s.title=`Klingon at ${t.x},${t.y}`,s}function dm(t,e){const s=q("span",t,e.supernova?"":e.code??"");return e.supernova&&s.append(h_("supernova")),s}function um(t){return`quadrant ${t.x},${t.y}${t.supernova?" · supernova":t.code===null?" · unscanned":""}`}function V1(t){const e=t.klingons.map(s=>({bearing:s.bearing,kind:"klingon",label:`Klingon at ${s.x},${s.y} · ${s.range.toFixed(1)} · ${Math.round(s.bearing)}°`,variant:s.mark}));for(const s of t.sectors)for(const i of s){if(i.kind!=="base")continue;const n=i.x-t.position.sector.x,r=i.y-t.position.sector.y;e.push({bearing:(Math.atan2(r,-n)*180/Math.PI+360)%360,kind:"base",label:`starbase at ${i.x},${i.y}`})}return e}class Av{root;wheel;distance;warp;rest;head;pills;readout=null;constructor(e,s,i){this.root=q("div","tb-station tb-station-helm"),this.head=Wd("HELM",e);const n=j1("helm",e);this.pills=n.pills;const r=q("div","tb-controls");this.wheel=new B1(s,"course wheel",a=>e.answer_send(String(a),"SET COURSE"));const o=q("div","tb-sliders");this.distance=new xr(`${i}-distance`,"DISTANCE",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.warp=new xr(`${i}-warp`,"WARP FACTOR",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.rest=new xr(`${i}-rest`,"REST",1,a=>e.answer_send(a.toFixed(1),"SLIDER SET")),this.distance.input_listen(()=>this.arrival_note()),o.append(this.distance.root,this.warp.root,this.rest.root),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}state_show(e){const s=this.readout===null;this.readout=e,this.wheel.marks_set(V1(e)),this.warp.range_set(xs("warp-factor",e),e.ship.warp,"THE SHIP NOW · ABOVE 6 THE ENGINES MAY BURN",10),this.distance.range_set(xs("distance",e),s?1:this.distance.value_get(),"QUADRANTS · 0.1 IS ONE SECTOR",6),this.rest.range_set(xs("how-long",e),0,`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT · REPAIRS RUN WHILE TIME PASSES`,2)}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"helm",e,s),this.wheel.lit_set(gi(e,["course","direction"]),"SET COURSE"),this.distance.lit_set(gi(e,["distance"]),"ENGAGE"),this.warp.lit_set(gi(e,["warp-factor"]),"SET WARP"),this.rest.lit_set(gi(e,["how-long"]),"REST"),e?.question==="distance"&&this.arrival_note()}arrival_note(){if(this.readout===null)return;const e=this.distance.value_get(),s=S6(this.readout,this.wheel.degrees_get(),e),i=W1(e,this.readout.ship.warp,this.readout.param.warptime);this.distance.note_set(`ARRIVES ${s.quadrant.x},${s.quadrant.y} / ${s.sector.x},${s.sector.y} · ${i.stardates.toFixed(2)} STARDATES AT WARP ${this.readout.ship.warp.toFixed(1)} · ${i.units} UNITS`)}}class Tv{constructor(e,s,i){this.host=e,this.root=q("div","tb-station tb-station-tactical"),this.head=Wd("TACTICAL",e);const n=j1("tactical",e);this.pills=n.pills;const r=q("div","tb-controls");this.wheel=new B1(s,"firing course wheel",l=>e.answer_send(String(l),"SET COURSE"));const o=q("div","tb-sliders");this.burst=new Qc("BURST",xs("burst",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice"))),this.burstAngle=new Qc("BURST ANGLE",xs("burst-angle",null).choices??[],(l,c)=>{this.wheel.wedge_set(Number(l)),e.answer_send(l,gr(c,"choice"))}),this.manual=new Qc("PHASERS",xs("manual-automatic",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice"))),this.units=new xr(`${i}-units`,"UNITS",0,l=>e.answer_send(String(Math.round(l)),"SLIDER SET")),this.spread=new xr(`${i}-spread`,"SPREAD",2,l=>e.answer_send(l.toFixed(2),"SLIDER SET")),this.upDown=new Qc("SHIELDS",xs("up-down",null).choices??[],(l,c)=>e.answer_send(l,gr(c,"choice")));const a=q("div","tb-fire-row");this.fire=Os("tb-fire","FIRE",()=>e.answer_send("0",null)),this.targets=q("div","tb-targets"),a.append(this.fire,this.targets),o.append(this.burst.root,this.burstAngle.root,this.manual.root,this.units.root,this.spread.root,this.upDown.root,a),r.append(this.wheel.root,o),this.root.append(this.head.root,n.root,r)}host;root;wheel;units;spread;head;pills;burst;burstAngle;manual;upDown;fire;targets;readout=null;state_show(e){this.readout=e,this.wheel.marks_set(V1(e)),this.wheel.wedge_set(null),e.klingons[0]!==void 0&&this.wheel.degrees_set(e.klingons[0].bearing),this.units.range_set(xs("units",e),Math.min(e.ship.energy,Math.round(e.ship.energy/100)*10),`UP TO THE ${e.ship.energy} FREE`,6),this.spread.range_set(xs("spread",e),.5,"MANUAL PHASERS ONLY",3),this.burst.note_set(`${e.ship.torpedoes} TORPEDOES · A BURST FIRES 3`),this.upDown.note_set(`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} OF ${e.ship.shieldMax} · REFILLS AT A STARBASE`);const s=this.pills.get("phasers");s!==void 0&&(s.classList.toggle("tb-barred",e.ship.shieldsUp),s.title=e.ship.shieldsUp?"Shields are up: phasers cannot fire through them. SHIELDS, then DOWN, first.":""),this.targets_draw(e)}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"tactical",e,s),this.wheel.lit_set(gi(e,["torpedo-course","bank-course"]),"SET COURSE"),this.burst.lit_set(gi(e,["burst"])),this.burstAngle.lit_set(gi(e,["burst-angle"])),this.manual.lit_set(gi(e,["manual-automatic"])),this.units.lit_set(gi(e,["units","bank-units"]),e?.question==="units"?"FIRE":"SET BANK"),this.spread.lit_set(gi(e,["spread"])),this.upDown.lit_set(gi(e,["up-down"])),this.fire.disabled=!gi(e,["bank-units"]),this.fire.textContent="FIRE THE BANKS SET"}targets_draw(e){if(this.targets.replaceChildren(),e.klingons.length===0){this.targets.append(q("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const s of["TARGET","RANGE","BEARING","PHASER HIT"])this.targets.append(q("span","tb-target-head",s));for(const s of e.klingons){const i=H1(s,()=>{this.host.voice.cue("scanner"),this.host.course_set(s.bearing,s.range/10)});this.targets.append(i,q("span","tb-target-cell",s.range.toFixed(1)),q("span","tb-target-cell",`${Math.round(s.bearing)}°`),q("span","tb-target-cell",`${F1(s.range/10)}%`))}}}class W6{root;rest;head;pills;damage;systems;since;inThatTime;readout=null;constructor(e){this.root=q("div","tb-view-body tb-view-engineering");const s=q("section","tb-panel tb-damage");s.append(q("span","tb-title","DAMAGE CONTROL"),q("span","tb-note","THE C'S REPORT · ALWAYS ON")),this.damage=q("div","tb-dc"),s.append(this.damage,q("span","tb-note","REPAIR TIMES IN STARDATES · REPAIRS RUN WHILE TIME PASSES · DOCKED, FASTER BY THE DOCK FACTOR"));const i=q("section","tb-panel tb-systems-section");i.append(q("span","tb-title","SHIP"),q("span","tb-note","ENERGY, SHIELDS, RESERVES")),this.systems=q("div","tb-systems"),i.append(this.systems,q("span","tb-title","SINCE THE LAST COMMAND")),this.since=q("div","tb-head-grid tb-since-grid"),i.append(this.since,q("span","tb-note","SHIELDS ARE UP OR DOWN IN TREK(6): THEIR ENERGY IS A READOUT, REFILLED AT A STARBASE"));const n=q("section","tb-panel tb-station tb-station-time");this.head=Wd("REST",e);const r=q("div","tb-pills tb-command-pills");this.pills=new Map;for(const o of["rest","dock","undock"]){const a=Pd.find(c=>c.id===o);if(a===void 0)continue;const l=d_(a,e);this.pills.set(o,l),r.append(l)}this.rest=new xr("tbe-rest","HOW LONG",1,o=>e.answer_send(o.toFixed(1),"SLIDER SET")),this.rest.input_listen(()=>this.inThatTime_note()),this.inThatTime=q("div","tb-in-that-time"),n.append(this.head.root,r,this.rest.root,q("span","tb-title","IN THAT TIME"),this.inThatTime),this.root.append(s,i,n)}state_show(e,s){this.readout=e,this.damage_draw(e),this.systems_draw(e),this.since.replaceChildren();const i=s===null?[]:U1(s,e);i.length===0&&this.since.append(q("span","tb-head-label","—"),q("span","tb-head-value","NOTHING MOVED"));for(const n of i)this.since.append(q("span","tb-head-label",n.label),q("span",`tb-head-value ${n.bad?"tb-bad":"tb-good"}`,n.change));this.rest.range_set(xs("how-long",e),this.rest.value_get(),`STARDATES · ${e.mission.timeLeft.toFixed(1)} LEFT`,4),this.inThatTime_note()}question_show(e){Ud(this.pills,e);const s=e===null?null:xs(e.question,this.readout),i=e!==null&&(e.command===null||["rest","dock","undock"].includes(e.command.id))?e:null;Fd(this.head,"helm",i,s),this.rest.lit_set(gi(e,["how-long"]),"REST")}damage_draw(e){this.damage.replaceChildren();for(const i of["DEVICE","","IN FLIGHT","DOCKED",""])this.damage.append(q("span","tb-dc-head",i));const s=Math.max(1,...e.damaged.map(i=>(i.repairAt??0)-e.mission.stardate));for(const i of e.devices){const n=Sv(i,e),r=q("div","tb-bar-track"),o=q("div",`tb-bar-fill${n===null?" tb-bar-ok":" tb-bar-down"}`);o.style.width=n===null?"100%":`${Math.max(4,Math.min(100,Math.round(100*((i.repairAt??0)-e.mission.stardate)/s)))}%`,r.append(o),this.damage.append(q("span",`tb-dc-name${n===null?"":" tb-bad"}`,i.name.toUpperCase()),r,q("span","tb-dc-time",n===null?"—":n.inFlight.toFixed(2)),q("span","tb-dc-time",n===null?"—":n.docked.toFixed(2)),q("span",`tb-dc-state${n===null?" tb-good":" tb-bad"}`,n===null?"OK":"DOWN"))}}systems_draw(e){const{ship:s}=e;this.systems.replaceChildren();const i=(l,c,h,d,u)=>{const p=q("div","tb-bar-track"),f=q("div",`tb-bar-fill${u?" tb-bar-down":" tb-bar-ok"}`);f.style.width=`${Math.max(0,Math.min(100,Math.round(100*c/Math.max(1,h))))}%`,p.append(f),this.systems.append(q("span","tb-dc-name",l),p,q("span","tb-dc-time tb-sys-value",d))};i("ENERGY",s.energy,s.energyMax,`${s.energy} / ${s.energyMax}`,s.energy<s.energyMax/4),i("SHIELDS",s.shield,s.shieldMax,`${s.shieldsUp?"UP":"DOWN"} · ${s.shield} / ${s.shieldMax}`,s.shield<s.shieldMax/4),i("LIFE SUPPORT",s.reserves,s.reservesMax,`RESERVES ${s.reserves.toFixed(1)} / ${s.reservesMax.toFixed(1)}`,s.reserves<s.reservesMax/4);const n=q("div","tb-pips");for(let l=0;l<s.torpedoesMax;l++)n.append(q("span",`tb-pip${l<s.torpedoes?" tb-pip-on":""}`));this.systems.append(q("span","tb-dc-name","TORPEDOES"),n,q("span","tb-dc-time tb-sys-value",`${s.torpedoes} / ${s.torpedoesMax}`));const r=(l,c)=>{this.systems.append(q("span","tb-dc-name",l),q("span","tb-sys-text",c))};r("CREW",`${s.crew}${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:" · BRIG EMPTY"}`);const o=e.damaged.some(l=>/warp/i.test(l.name));r("WARP",`${s.warp.toFixed(1)} · ENGINES ${o?"DOWN":"OK"}`);const a=e.damaged.some(l=>/cloak/i.test(l.name));r("CLOAK",`${s.cloaked?"ON":"OFF"} · DEVICE ${a?"DOWN":"OK"}`)}inThatTime_note(){if(this.readout===null)return;const e=this.rest.value_get();this.inThatTime.replaceChildren();const s=this.readout.damaged.filter(n=>(Sv(n,this.readout)?.inFlight??1/0)<=e).map(n=>n.name.toUpperCase());this.inThatTime.append(q("span","tb-head-value tb-good",s.length===0?e>0?"NO REPAIR COMPLETES":"—":`${s.join(" · ")} REPAIRED`));const i=this.readout.klingons.length;i>0&&this.inThatTime.append(q("span","tb-head-value tb-bad",`${i} KLINGON${i===1?"":"S"} IN THE QUADRANT WILL FIRE · SPOCK MAY ASK TO CANCEL`))}}const Iv=[{label:"CHART",line:"ch",asks:[]},{label:"TRAJECTORY",line:"t",asks:[]},{label:"COURSE",line:"c",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"MOVE",line:"m",asks:["quadrant","quadrant-y","sector","sector-y"]},{label:"SCORE",line:"s",asks:[]},{label:"PHASER EFFECT",line:"p",asks:["range"]},{label:"WARP COST",line:"w",asks:["computer-distance","computer-warp"]},{label:"IMPULSE COST",line:"i",asks:["computer-distance"]},{label:"DISTRESS LIST",line:"d",asks:[]}];class F6{constructor(e){this.host=e,this.root=q("div","tb-view-body tb-view-computer");const s=q("section","tb-panel tb-chart-section");s.append(q("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN"),q("span","tb-note","PRESS A QUADRANT: THE COURSE PANEL AIMS AT IT · HUNDREDS KLINGONS, TENS BASES, ONES STARS")),this.chart=q("div","tb-chart-big"),s.append(this.chart);const i=q("section","tb-station tb-station-computer");this.head=Wd("COMPUTER",e);const n=q("div","tb-pills tb-command-pills");for(const d of Iv){const u=Os("tb-command tb-request",d.label,()=>this.request_send(d));u.dataset.request=d.line,this.requestPills.push(u),n.append(u)}const r=q("div","tb-computer-panels"),o=q("div","tb-panel");o.append(q("span","tb-title","COURSE AND DISTANCE")),this.courseGrid=q("div","tb-head-grid");const a=q("div","tb-pills");a.append(Os("tb-commit tb-send-helm","SEND TO HELM",()=>this.helm_send()),Os("tb-commit tb-move-now","MOVE THERE NOW",()=>this.request_send(Iv[3]))),o.append(this.courseGrid,a);const l=q("div","tb-panel");l.append(q("span","tb-title","WARP COST")),this.wcDistance=new xr("tbc-distance","DISTANCE",2,()=>{}),this.wcWarp=new xr("tbc-warp","WARP FACTOR",1,()=>{}),this.wcDistance.root.classList.add("tb-local"),this.wcWarp.root.classList.add("tb-local"),this.wcDistance.input_listen(()=>this.costs_note()),this.wcWarp.input_listen(()=>{this.warpTouched=!0,this.costs_note()}),this.wcResult=q("div","tb-head-grid"),l.append(this.wcDistance.root,this.wcWarp.root,this.wcResult);const c=q("div","tb-panel");c.append(q("span","tb-title","TRAJECTORY · KLINGONS HERE")),this.trajectory=q("div","tb-targets"),c.append(this.trajectory,q("span","tb-title","SCORE SO FAR")),this.score=q("div","tb-score"),c.append(this.score);const h=q("div","tb-panel tb-answer-panel");h.append(q("span","tb-title","THE COMPUTER ANSWERS")),this.answer=q("pre","tb-computer-answer","—"),h.append(this.answer),r.append(o,l,c,h),i.append(this.head.root,n,r),this.root.append(s,i)}host;root;head;chart;requestPills=[];courseGrid;wcDistance;wcWarp;wcResult;trajectory;score;answer;readout=null;target=null;open=null;warpTouched=!1;state_show(e){this.readout=e,this.target===null&&(this.target={quadrant:{...e.position.quadrant},sector:{...e.position.sector}}),this.chart_draw(e),this.wcWarp.range_set(xs("computer-warp",e),this.warpTouched?this.wcWarp.value_get():e.ship.warp,"THE SHIP'S NOW",4),this.wcDistance.range_set(xs("computer-distance",e),this.wcDistance.value_get(),"QUADRANTS · FILLED FROM THE COURSE",4),this.wcDistance.lit_set(!0,""),this.wcWarp.lit_set(!0,""),this.course_note(),this.trajectory_draw(e),this.score_draw(e)}question_show(e){this.open=e;const s=e===null?null:xs(e.question,this.readout);Fd(this.head,"ship",e,s);const i=e?.question==="command"||e?.question==="request";for(const n of this.requestPills)n.disabled=!i}answer_take(e){if(e===null){this.answer.textContent="";return}this.answer.textContent=`${this.answer.textContent??""}${e}`.replace(/^\s*\n/,"")}sector_set(e){this.readout!==null&&(this.target={quadrant:this.target?.quadrant??{...this.readout.position.quadrant},sector:{x:e.x,y:e.y}},this.course_note())}request_send(e){const s=e.asks.map(n=>[n,this.plannedAnswer_derive(n)]);if(this.open?.question==="request"){this.host.plan_set(s),this.answer_take(null),this.host.answer_send(e.line,gr(e.label,"computer")),this.host.voice.cue("thinking");return}const i=Pd.find(n=>n.id==="computer");if(i===void 0||this.open?.question!=="command"){this.host.voice.cue("deny");return}this.host.plan_set([["request",e.line],...s]),this.answer_take(null),this.host.voice.pill(gr(e.label,"computer")),this.host.command_send(i)}plannedAnswer_derive(e){const s=this.target,i=this.readout?.klingons[0];switch(e){case"quadrant":return String(s?.quadrant.x??0);case"quadrant-y":return String(s?.quadrant.y??0);case"sector":return String(s?.sector.x??0);case"sector-y":return String(s?.sector.y??0);case"range":return(i===void 0?this.wcDistance.value_get():i.range/10).toFixed(2);case"computer-distance":return this.wcDistance.value_get().toFixed(2);case"computer-warp":return this.wcWarp.value_get().toFixed(1);default:return""}}helm_send(){if(this.readout===null||this.target===null)return;const e=zv(this.readout,this.target);this.host.voice.pill("SEND TO HELM"),this.host.course_set(e.course,Math.round(e.distance*10)/10)}chart_draw(e){this.chart.replaceChildren(),this.chart.append(q("span","tb-srs-corner",""));for(let s=0;s<(e.chart[0]?.length??0);s++)this.chart.append(q("span","tb-srs-axis",String(s)));for(const s of e.chart){this.chart.append(q("span","tb-srs-axis",String(s[0]?.x??"")));for(const i of s)this.chart.append(this.quadrantButton_make(i))}}quadrantButton_make(e){const s=this.target?.quadrant.x===e.x&&this.target.quadrant.y===e.y,i=Os(`tb-cq${e.here?" tb-here":""}${e.klingons>0?" tb-hostile":""}${e.bases>0?" tb-based":""}${e.code===null?" tb-unscanned":""}${s?" tb-pressed":""}`,"",()=>{this.readout!==null&&(this.target={quadrant:{x:e.x,y:e.y},sector:this.target?.sector??{...this.readout.position.sector}},this.host.voice.cue("scanner"),this.chart_draw(this.readout),this.course_note())});return i.dataset.x=String(e.x),i.dataset.y=String(e.y),i.append(dm("tb-cq-code",e),q("span","tb-cq-at",`${e.x},${e.y}`)),i.title=um(e),i}course_note(){if(this.readout===null||this.target===null)return;const{position:e}=this.readout,s=zv(this.readout,this.target);this.courseGrid.replaceChildren(q("span","tb-head-label","FROM"),q("span","tb-head-value",`QUADRANT ${e.quadrant.x},${e.quadrant.y} · SECTOR ${e.sector.x},${e.sector.y}`),q("span","tb-head-label","TO"),q("span","tb-head-value",`QUADRANT ${this.target.quadrant.x},${this.target.quadrant.y} · SECTOR ${this.target.sector.x},${this.target.sector.y}`),q("span","tb-head-label","COURSE"),q("span","tb-head-value tb-course-value",`${s.course}°`),q("span","tb-head-label","DISTANCE"),q("span","tb-head-value tb-distance-value",s.distance.toFixed(2))),this.wcDistance.value_set(Math.round(s.distance*100)/100),this.costs_note()}costs_note(){if(this.readout===null)return;const e=this.wcDistance.value_get(),s=W1(e,this.wcWarp.value_get(),this.readout.param.warptime),i=x6(e);this.wcResult.replaceChildren(q("span","tb-head-label","TIME"),q("span","tb-head-value",`${s.stardates.toFixed(2)} STARDATES`),q("span","tb-head-label","ENERGY"),q("span","tb-head-value",`${s.units} UNITS · ${s.unitsShielded} WITH SHIELDS UP`),q("span","tb-head-label","AT IMPULSE"),q("span","tb-head-value",`${i.stardates.toFixed(2)} STARDATES · ${i.units} UNITS`))}trajectory_draw(e){if(this.trajectory.replaceChildren(),e.klingons.length===0){this.trajectory.append(q("span","tb-note","NO KLINGONS IN THIS QUADRANT"));return}for(const s of["AT","COURSE","RANGE","PHASER HIT"])this.trajectory.append(q("span","tb-target-head",s));for(const s of e.klingons)this.trajectory.append(H1(s,()=>{this.host.voice.cue("scanner"),this.host.course_set(s.bearing,s.range/10)}),q("span","tb-target-cell",`${Math.round(s.bearing)}°`),q("span","tb-target-cell",s.range.toFixed(1)),q("span","tb-target-cell",`${F1(s.range/10)}%`))}score_draw(e){const s=L1(e);this.score.replaceChildren();for(const i of s.items.filter(n=>n.points!==0||/killed|remaining/.test(n.label)))this.score.append(q("span","tb-score-label",i.label.toUpperCase()),q("span",`tb-score-points${i.points<0?" tb-bad":" tb-good"}`,`${i.points>0?"+":""}${i.points}`));this.score.append(q("span","tb-score-label tb-score-total","TOTAL"),q("span","tb-score-points tb-score-total",String(s.total)))}}const U6=["bridge","helm","tactical","engineering","computer"],$6=400,j6="-0.6 -0.6 10.6 10.6",H6=.7,V6=/^S\.R\. scanners$/i,q6=/^L\.R\. scanners$/i,K6={ArrowUp:[-1,0],ArrowDown:[1,0],ArrowLeft:[0,-1],ArrowRight:[0,1]},Y6=["length","skill","request","quadrant","quadrant-y","sector","sector-y","range","computer-distance","computer-warp","status-report","another","yes-no","unknown"];class X6{constructor(e,s){this.hooks=e,this.harness=new T6({question_changed:d=>{this.partial_flush(),this.question_show(d)},text_written:d=>this.text_take(d),state_shown:d=>this.state_show(d),ended:()=>{this.leaving||this.hooks.voice.cue("gameover")}}),this.root=q("section","trek-bridge"),this.root.id="trek-bridge",this.root.dataset.view="bridge",this.root.setAttribute("aria-label","trek: the bridge");const i={},n=qj();n!==null&&this.root.append(n);const r=this.gutter_build(i,s),[o,a]=this.frame_build(),l=this.header_build(i),c=this.body_build(i);this.strip_build(i);const h=this.log_build(i);this.leaveAsk_build(i),this.root.append(r,o,l,a,c,i.ask,h,i.leaveAsk),this.parts=i,this.question_show(null)}hooks;root;harness;readout=null;previous=null;view="bridge";nextDistance=null;plan=new Map;answering=!1;computerRunning=!1;leaving=!1;tracker=new Tl;heading=0;pressedSector=null;scanDue=!1;fold=null;frames=new C6;shown=null;torpedo=null;trackPrinting=!1;partial="";lrsBloom=null;parts;stationHost_get(){return{answer_send:(e,s)=>this.answer_send(e,s),command_send:e=>this.command_send(e),plan_set:e=>{for(const[s,i]of e)this.plan.set(s,i)},course_set:(e,s)=>this.course_set(e,s),voice:this.hooks.voice}}gutter_build(e,s){const i=q("aside","tb-gutter"),n=q("div","tb-block");n.append(q("span","tb-block-name","TREK"),q("span","tb-block-sub","ARGUS · BSD TREK")),e.seed=q("div","tb-seed",s===null?"RANDOM GALAXY":`SEED ${s}`);const r=q("nav","tb-views");r.setAttribute("aria-label","views"),e.views=new Map;for(const c of U6){const h=Os(`tb-view tb-view-${c}`,c.toUpperCase(),()=>this.view_set(c));h.classList.remove("tb-pill"),h.dataset.view=c,e.views.set(c,h),r.append(h)}const o=Os("tb-leave","LEAVE BRIDGE",()=>this.leave_ask());o.classList.remove("tb-pill");const a=q("div","tb-gutter-top");a.append(n,e.seed,q("div","tb-gutter-fill"));const l=q("div","tb-gutter-body");return l.append(q("div","tb-gutter-cap"),r,q("div","tb-gutter-fill"),o),i.append(a,l),i}frame_build(){const e=q("div","tb-bar tb-bar-top");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c","tb-bar-d"])e.append(q("span",i));const s=q("div","tb-bar tb-bar-body");for(const i of["tb-bar-a","tb-bar-b","tb-bar-c"])s.append(q("span",i));return[e,s]}header_build(e){const s=q("header","tb-header"),i=q("section","tb-head-condition"),n=q("div","tb-condition");n.append(q("span","tb-condition-label","CONDITION")),e.condition=q("span","tb-condition-name","—"),n.append(e.condition),e.conditionWhy=q("div","tb-condition-why",""),i.append(n,e.conditionWhy);const r=p=>{const f=q("section","tb-head-section");f.append(q("span","tb-head-title",p));const _=q("div","tb-head-grid");return f.append(_),[f,_]},[o,a]=r("SHIP"),[l,c]=r("MISSION"),[h,d]=r("POSITION"),u=q("div","tb-head-grid tb-head-since");return l.append(q("span","tb-head-title","SINCE LAST COMMAND"),u),e.ship=a,e.mission=c,e.position=d,e.since=u,s.append(i,o,l,h),s}body_build(e){const s=this.stationHost_get(),i=q("main","tb-body");i.dataset.view="bridge",e.body=i;const n=q("section","tb-scans");n.append(q("span","tb-title","LONG RANGE")),e.lrs=q("div","tb-lrs"),n.append(e.lrs,q("span","tb-title","GALAXY · WHAT THE SHIP HAS SEEN")),e.chart=q("div","tb-chart"),n.append(e.chart);const r=q("section","tb-srs-section");e.srsTitle=q("span","tb-title","SHORT RANGE"),r.append(e.srsTitle),e.scan=st("svg",{class:"tb-scan",viewBox:j6,role:"grid","aria-label":"short range scan"}),e.scan.addEventListener("keydown",l=>this.scan_key(l)),e.legend=this.legend_build(),r.append(e.scan,q("span","tb-note","PRESS A SECTOR: ITS COURSE AND DISTANCE FILL IN"),e.legend),e.shipPills=new Map;const o=q("div","tb-pills tb-ship-pills");o.append(q("span","tb-slider-label","SHIP"));for(const l of Pd.filter(c=>c.station==="ship")){const c=d_(l,s);e.shipPills.set(l.id,c),o.append(c)}r.append(o);const a=q("section","tb-stations");return e.helm=new Av(s,150,"tb"),e.tactical=new Tv(s,150,"tb"),a.append(e.helm.root,e.tactical.root),e.helmView=new Av(s,260,"tbh"),e.helmView.root.classList.add("tb-view-body","tb-view-helm"),e.tacticalView=new Tv(s,260,"tbt"),e.tacticalView.root.classList.add("tb-view-body","tb-view-tactical"),e.engineeringView=new W6(s),e.computerView=new F6(s),i.append(n,r,a,e.helmView.root,e.tacticalView.root,e.engineeringView.root,e.computerView.root),i}legend_build(){const e=q("div","tb-legend");for(const s of Kj){const i=q("span",`tb-legend-item tb-legend-${s.kind}`),n=s.kind==="klingon"?fr:[null];for(const r of n)i.append(h_(s.kind,r));i.append(q("span","tb-legend-glyph",Jc[s.kind].trim()===""?"␠":Jc[s.kind]),q("span","tb-legend-name",s.name)),e.append(i)}return e}strip_build(e){e.ask=q("div","tb-ask"),e.ask.hidden=!0,e.ask.setAttribute("role","dialog"),e.askText=q("span","tb-ask-text",""),e.askPills=q("div","tb-pills"),e.askInput=document.createElement("input"),e.askInput.type="text",e.askInput.className="tb-ask-input",e.askInput.setAttribute("aria-label","the answer");const s=e.askInput;e.askSend=Os("tb-commit","ANSWER",()=>this.answer_send(s.value,"ANSWER")),s.addEventListener("keydown",i=>{i.key==="Enter"&&this.answer_send(s.value,"ANSWER")}),e.ask.append(q("span","tb-ask-label","THE GAME ASKS"),e.askText,e.askPills,e.askInput,e.askSend)}log_build(e){const s=q("footer","tb-log-section"),i=q("div","tb-log-head");return i.append(q("span","tb-title","SHIP'S LOG"),q("span","tb-note","READ ONLY")),e.log=q("div","tb-log"),e.log.setAttribute("aria-live","polite"),s.append(i,e.log),s}leaveAsk_build(e){e.leaveAsk=q("div","tb-leave-ask"),e.leaveAsk.hidden=!0,e.leaveAsk.setAttribute("role","dialog");const s=e.leaveAsk,i=Os("tb-grave","LEAVE · THE GAME ENDS",()=>{this.leaving=!0,this.hooks.voice.cue("close"),this.hooks.leave()}),n=Os("","STAY",()=>{s.hidden=!0});e.leaveAsk.append(q("span","tb-ask-label","LEAVE THE BRIDGE?"),q("span","tb-ask-text","The game ends where it stands; dump first to keep it."),i,n)}harness_get(){return this.harness}leave_ask(){this.frames.skip(),this.parts.leaveAsk.hidden&&this.hooks.voice.pill("LEAVE BRIDGE"),this.parts.leaveAsk.hidden=!1}frames_get(){return{played:{...this.frames.played},pending:this.frames.pending_count(),busy:this.frames.busy_is()}}frames_settle(){return this.frames.settle()}leaveAsk_isOpen(){return!this.parts.leaveAsk.hidden}leaveAsk_close(){this.parts.leaveAsk.hidden=!0}view_get(){return this.view}view_set(e){this.frames.skip(),this.view=e,this.root.dataset.view=e,this.parts.body.dataset.view=e;for(const[s,i]of this.parts.views)i.classList.toggle("tb-view-on",s===e);this.hooks.voice.pill(gr(e.toUpperCase(),"view"))}readout_get(){return this.readout}command_send(e){if(this.frames.skip(),!this.harness.command_send(e))return this.hooks.voice.cue("deny"),!1;const s=i6(e.id);return s===null?this.hooks.voice.pill(gr(e.label,"command")):this.hooks.voice.cue(s),this.nextDistance=null,this.computerRunning=e.id==="computer",this.computerRunning&&this.parts.computerView.answer_take(null),this.log_write(`Command: ${e.line}
|
|
4354
4354
|
`,!0),!0}answer_send(e,s){const i=this.harness.question_get();if(!this.harness.answer(e)){this.hooks.voice.cue("deny");return}const n=i===null?null:n6(i.question,i.command?.id??null);n!==null?this.hooks.voice.cue(n):s!==null&&this.hooks.voice.pill(s);const r=i===null?"":i.prompt.trim();this.log_write(`${r===""?"":`${r} `}${e}
|
|
4355
4355
|
`,!0),i?.question==="course"&&Number.isFinite(Number(e))&&(this.heading=(Number(e)%360+360)%360,this.shown!==null&&this.srs_draw(this.shown))}course_set(e,s){const{parts:i}=this;for(const n of[i.helm,i.helmView,i.tactical,i.tacticalView])n.wheel.degrees_set(e);s!==null&&(i.helm.distance.value_set(s),i.helmView.distance.value_set(s),this.nextDistance=s)}state_show(e){this.previous=this.readout;const s=y6(e);this.readout=s;const{parts:i}=this,n=this.previous===null||this.previous.position.quadrant.x!==s.position.quadrant.x||this.previous.position.quadrant.y!==s.position.quadrant.y;this.tracker.reconcile(s.klingons,{reset:n,byOrder:!this.device_isOk(s,V6)});for(const r of s.klingons)r.mark=this.tracker.mark_find(r);n&&(this.pressedSector=null),n&&this.device_isOk(s,q6)&&(this.scanDue=!0),i.condition.textContent=s.condition.name,i.condition.parentElement?.setAttribute("data-condition",s.condition.name.toLowerCase()),i.conditionWhy.textContent=s.condition.why.toUpperCase(),this.header_draw(s);for(const r of[i.helm,i.helmView,i.tactical,i.tacticalView,i.computerView])r.state_show(s);i.engineeringView.state_show(s,this.previous),this.partial_flush(),this.frames.push(this.stateFrame_make(s,this.previous)),this.question_show(this.harness.question_get())}stateFrame_make(e,s){return{kind:"state",run:async i=>{const n=this.parts.scan;await this.torpedo_end(!0);const r=this.shown,o=r!==null&&(r.position.quadrant.x!==e.position.quadrant.x||r.position.quadrant.y!==e.position.quadrant.y),a=r!==null&&(o||r.position.sector.x!==e.position.sector.x||r.position.sector.y!==e.position.sector.y);if(a&&r!==null){const c={x:r.position.quadrant.x*10+r.position.sector.x,y:r.position.quadrant.y*10+r.position.sector.y},h={x:e.position.quadrant.x*10+e.position.sector.x,y:e.position.quadrant.y*10+e.position.sector.y};this.heading=Math.round($1(c,h))}const l={kind:"ship",variant:null};if(a&&!i&&r!==null&&!o)this.srs_draw(r,!1),await tl(n,this.frames,l,r.position.sector,e.position.sector,{heading:this.heading});else if(a&&!i&&r!==null&&o){const{exit:c,entry:h}=N6(r.position,e.position);this.srs_draw(r,!1),await tl(n,this.frames,l,r.position.sector,c,{heading:this.heading}),Ev(n,!0),this.shown=Dv(e),this.srs_draw(this.shown,!1),this.lrs_draw(this.shown,!0),this.chart_draw(this.shown),await this.frames.wait(Un.rescan),Ev(n,!1),await tl(n,this.frames,l,h,e.position.sector,{heading:this.heading})}this.shown=Dv(e),this.srs_draw(this.shown),this.lrs_draw(this.shown,o&&i),this.chart_draw(this.shown);for(const c of s6(s,e))this.hooks.voice.cue(c);this.standingOrder_try()}}}header_draw(e){const{parts:s}=this,i=(o,a)=>{o.replaceChildren();for(const[l,c,h]of a)o.append(q("span","tb-head-label",l),q("span",`tb-head-value${h===void 0?"":` ${h}`}`,c))},n=(o,a)=>`${Math.max(0,Math.min(100,Math.round(100*o/Math.max(1,a))))}`;i(s.ship,[["ENERGY",`${e.ship.energy} / ${e.ship.energyMax}`],["SHIELDS",`${e.ship.shieldsUp?"UP":"DOWN"} · ${e.ship.shield} (${n(e.ship.shield,e.ship.shieldMax)}%)`],["TORPEDOES",`${e.ship.torpedoes} / ${e.ship.torpedoesMax}`],["WARP",`${e.ship.warp.toFixed(1)}${e.ship.cloaked?" · CLOAKED":""}`]]),i(s.mission,[["STARDATE",e.mission.stardate.toFixed(2)],["TIME LEFT",e.mission.timeLeft.toFixed(2)],["KLINGONS",`${e.mission.klingonsLeft} LEFT · ${e.mission.killed} KILLED${e.mission.captives>0?` · ${e.mission.captives} CAPTIVE`:""}`],["STARBASES",e.nearestBase===null?`${e.mission.starbases}`:`${e.mission.starbases} · NEAREST ${e.nearestBase.at.x},${e.nearestBase.at.y}${e.nearestBase.here?" HERE":""}`]]),i(s.position,[["QUADRANT",`${e.position.quadrant.x},${e.position.quadrant.y}`],["SECTOR",`${e.position.sector.x},${e.position.sector.y}`],["CREW",`${e.ship.crew}`],["LIFE SUPPORT",`${e.ship.reserves.toFixed(1)} / ${e.ship.reservesMax.toFixed(1)}`],["SCORE",`${L1(e).total}`]]);const r=this.previous===null?[]:U1(this.previous,e);i(s.since,r.length===0?[["—","NOTHING MOVED"]]:r.map(o=>[o.label,o.change,o.bad?"tb-bad":"tb-good"]))}srs_draw(e,s=!0){const{parts:i}=this;i.srsTitle.textContent=`SHORT RANGE · QUADRANT ${e.position.quadrant.x},${e.position.quadrant.y}`;const n=i.scan,r=[...n.querySelectorAll(":scope > .tb-motion")];n.replaceChildren();const o=e.sectors[0]?.length??0;for(let c=0;c<o;c++)n.append(this.axis_make(String(c),c+.5,-.3));for(const c of e.sectors)n.append(this.axis_make(String(c[0]?.x??""),-.3,(c[0]?.x??0)+.5));const a=e.position.sector,l=this.pressedSector??a;for(const c of e.sectors)for(const h of c)n.append(this.sector_make(h,e,a,l,s));if(s){const c=Jj(e.ship.shield,e.ship.shieldMax,e.ship.shieldsUp,e.condition.name==="DOCKED"),h=st("circle",{class:c.className,cx:a.y+.5,cy:a.x+.5,r:.46,"stroke-width":c.width});h.dataset.percent=String(Math.round(c.percent)),n.append(h)}n.append(...r)}axis_make(e,s,i){const n=st("text",{class:"tb-scan-axis",x:s,y:i});return n.textContent=e,n}sector_make(e,s,i,n,r=!0){const o=xh(i,e),a=ad(i,e),l=this.pressedSector?.x===e.x&&this.pressedSector.y===e.y,c=st("g",{class:`tb-sector tb-sector-${e.kind}${l?" tb-pressed":""}`,role:"button",tabindex:n.x===e.x&&n.y===e.y?0:-1});c.dataset.x=String(e.x),c.dataset.y=String(e.y);const h=st("title",{}),d=e.kind==="empty"?"·":Jc[e.kind];if(h.textContent=e.kind==="ship"?`the ship · ${e.x},${e.y}`:`${e.x},${e.y} ${d.trim()===""?"black hole":d} · course ${Math.round(o)}° · ${(a/10).toFixed(1)}`,c.append(h,st("rect",{class:"tb-cell",x:e.y+.04,y:e.x+.04,width:.92,height:.92,rx:.16})),e.kind==="empty"||e.kind==="ship"&&!r)c.append(st("circle",{class:"tb-cell-dot",cx:e.y+.5,cy:e.x+.5,r:.03}));else{const p=e.kind,f=p==="klingon"?s.klingons.find(m=>m.x===e.x&&m.y===e.y):void 0,_=p==="ship"?this.heading:p==="klingon"?xh(e,i):0,g=c_(p,{cx:e.y+.5,cy:e.x+.5,size:H6},f?.mark??null,_);p==="star"&&g.style.setProperty("--tb-breathe",`-${(e.x*7+e.y*3)%11*.33}s`),c.append(g)}const u=()=>this.sector_press(e,o,a);return c.addEventListener("click",u),c.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())}),c}scan_key(e){const s=K6[e.key],i=e.target?.closest(".tb-sector")??null;if(s===void 0||i===null)return;const n=Number(i.dataset.x)+s[0],r=Number(i.dataset.y)+s[1],o=this.parts.scan.querySelector(`.tb-sector[data-x="${n}"][data-y="${r}"]`);o!==null&&(e.preventDefault(),i.setAttribute("tabindex","-1"),o.setAttribute("tabindex","0"),o.focus())}sector_press(e,s,i){this.hooks.voice.cue("scanner"),this.course_set(s,Math.round(i)/10),this.parts.computerView.sector_set(e),this.pressedSector={x:e.x,y:e.y};for(const n of this.parts.scan.querySelectorAll(".tb-sector")){const r=n.dataset.x===String(e.x)&&n.dataset.y===String(e.y);n.classList.toggle("tb-pressed",r),n.setAttribute("tabindex",r?"0":"-1")}}device_isOk(e,s){const i=e.devices.find(n=>s.test(n.name));return i===void 0||i.repairAt===null}lrs_draw(e,s=!1){const{parts:i}=this;i.lrs.replaceChildren();const{quadrant:n}=e.position,r=this.lrsBloom;this.lrsBloom=null;for(let o=-1;o<=1;o++)for(let a=-1;a<=1;a++){const l=e.chart[n.x+o]?.[n.y+a];if(l===void 0){const h=q("div","tb-lrs-cell tb-lrs-edge");h.append(q("span","tb-lrs-code","—"),q("span","tb-lrs-at","EDGE")),h.title="outside the galaxy",i.lrs.append(h);continue}const c=q("div",`tb-lrs-cell${l.here?" tb-here":""}${l.klingons>0?" tb-hostile":""}${l.code===null?" tb-unscanned":""}${l.supernova?" tb-supernova":""}`);c.append(dm("tb-lrs-code",l),q("span","tb-lrs-at",`${l.x},${l.y}`)),c.title=um(l),c.dataset.x=String(l.x),c.dataset.y=String(l.y),i.lrs.append(c),(s&&l.here||r!==null&&r.at.x===l.x&&r.at.y===l.y)&&L6(c,r!==null&&!l.here&&r.hostile)}}chart_draw(e){const{parts:s}=this;s.chart.replaceChildren();for(const i of e.chart)for(const n of i){const r=dm(`tb-quadrant${n.here?" tb-here":""}${n.klingons>0?" tb-hostile":""}${n.bases>0?" tb-based":""}${n.code===null?" tb-unscanned":""}${n.supernova?" tb-supernova":""}`,n);r.title=um(n),s.chart.append(r)}}question_show(e){const{parts:s}=this;if(e?.question==="command"&&(this.plan.clear(),this.computerRunning=!1,this.fold_close(),this.standingOrder_try()))return;const i=e===null?void 0:this.plan.get(e.question);if(i!==void 0&&e!==null&&!this.answering){this.plan.delete(e.question),this.answering=!0;try{this.answer_send(i,null)}finally{this.answering=!1}return}Ud(s.shipPills,e);for(const n of[s.helm,s.helmView,s.tactical,s.tacticalView,s.engineeringView,s.computerView])n.question_show(e);e?.question==="distance"&&this.nextDistance!==null&&(s.helm.distance.value_set(this.nextDistance),s.helmView.distance.value_set(this.nextDistance)),this.strip_show(e),this.lit_reveal()}lit_reveal(){const e=[...this.parts.body.querySelectorAll(".tb-lit")].find(s=>s.getClientRects().length>0);e!==void 0&&typeof e.scrollIntoView=="function"&&e.scrollIntoView({block:"nearest"})}strip_show(e){const{parts:s}=this,i=e?.question??null,n=i===null?null:xs(i,this.readout),r=n!==null&&i!==null&&i!=="command"&&(n.kind==="yesno"||n.kind==="text"||Y6.includes(i));if(s.ask.hidden=!r,!r||n===null||e===null)return;s.askText.textContent=e.prompt.replace(/[:\s]+$/,"").trim(),s.askPills.replaceChildren();for(const a of n.choices??[])s.askPills.append(Os("tb-choice",a.label,()=>this.answer_send(a.line,a.label)));const o=n.kind==="text"||n.kind==="slider";s.askInput.hidden=!o,s.askSend.hidden=!o,o&&(s.askInput.value="",s.askInput.focus())}standingOrder_try(){if(!this.scanDue||this.answering||this.harness.question_get()?.question!=="command")return!1;this.scanDue=!1;const e=this.readout?.position.quadrant;return this.fold_open(`LONG RANGE SCAN · STANDING ORDER${e===void 0?"":` · QUADRANT ${e.x},${e.y}`}`),this.harness.answer("l")?(this.log_write(`Command: l
|
|
4356
4356
|
`,!0),!0):(this.fold_close(),!1)}fold_open(e){this.frames.push({kind:"fold",run:()=>{const s=q("details","tb-log-fold");s.append(q("summary","tb-log-fold-head",e)),this.parts.log.append(s),this.fold=s}})}fold_close(){this.frames.push({kind:"fold",run:()=>{this.fold=null}})}text_take(e){const s=e.replace(/\x1b\[[0-9;]*m/g,"").replace(/\x07/g,"");this.computerRunning&&this.parts.computerView.answer_take(s);const i=(this.partial+s).split(`
|
|
@@ -4363,7 +4363,7 @@ ${f instanceof Error?f.message:String(f)}`}}if(s!==null)return s.domain_choose(d
|
|
|
4363
4363
|
`)}finally{i=!1}await a()},size_read:l,stop:()=>t.client.stop_send(),leave:c,voice:{pill:p=>Ci.pill_play(p),cue:p=>Ci.cue_play(p)}});return s=u,document.body.append(u.root),document.body.dataset.takeover="controller",Ci.preload(),Ci.cue_play("open"),a().then(()=>u.domain_choose(d)),`domain: the TD controller takes the screen${d===""?"":` on ${d}`} (Esc or LEAVE gives it back)`},active_is:()=>s!==null,running_is:()=>s!==null&&i,ask:d=>s===null?Promise.resolve(null):s.ask_take(d.message,d.kind),output_take:d=>{s?.output_take(d)},event_take:(d,u)=>{if(d!==Uk||s===null)return;o.events++;const p=_z.safeParse(u);if(!p.success){o.lastError=p.error.message;return}s.domain_take(p.data)},names_get:()=>[...n]}}function vH(t){return`${t.date??"undated"} · ${t.entries.map(e=>`${e.package} ${e.version}`).join(" · ")}`}function wH(t,e){return t.releases.map(s=>{const i=s.merge??s.date??"undated",n=[];for(const r of s.entries)r.changes.forEach((o,a)=>{const l=`${i}:${r.package}:${a}`,c=o.body!=="";n.push({key:l,tag:r.package,text:o.headline,body:!1,more:c,internal:o.internal,of:l}),c&&e.has(l)&&n.push({key:`${l}:body`,tag:"",text:o.body,body:!0,more:!1,internal:o.internal,of:l})});return{key:i,title:vH(s),rows:n}})}class yH{constructor(e,s){this.hooks=s;const i=e.querySelector(".notes-panel");if(i===null)throw new Error("notes pane: no .notes-panel in its template");this.state=e.querySelector(".pane-state"),this.sincePill=e.querySelector(".notes-since"),this.internalPill=e.querySelector(".notes-internal"),this.listing=new Ir({mount:i,traits:this.traits_declare(),key:n=>n.key,chrome:{root:e,prefix:"notes"},caps:"root",activatable:n=>n.more,activate:n=>this.unfold_toggle(n.of),row:{className:n=>`notes-row${n.body?" notes-row-body":""}${n.internal?" notes-row-internal":""}${n.more?" notes-row-more":""}`}}),this.sincePill?.addEventListener("click",()=>{this.since_cycle()}),this.internalPill?.addEventListener("click",()=>{this.internal_toggle()}),this.pills_paint()}hooks;listing;state;sincePill;internalPill;model=null;unfolded=new Set;ask={since:1,all:!1};traits_declare(){return[{key:"tag",label:"PACKAGE",className:"notes-tag",width:"minmax(5em, 7em)",cell:e=>e.tag},{key:"text",label:"CHANGE",className:"notes-text",width:"minmax(16em, 1fr)",cell:e=>e.more&&!e.body?`${e.text} ▸`:e.text}]}model_show(e){this.model=e,this.ask={since:e.releases.length>1?e.releases.length>=e.total?"all":e.releases.length:1,all:e.all},this.render()}releases_shown(){return this.model?.releases.length??0}unfolded_is(e){return this.unfolded.has(e)}unfold_toggle(e){this.unfolded.has(e)?this.unfolded.delete(e):this.unfolded.add(e),this.render()}async since_cycle(){const e=this.ask.since===1?5:this.ask.since===5?"all":1;await this.ask_again({...this.ask,since:e})}async internal_toggle(){await this.ask_again({...this.ask,all:!this.ask.all})}async ask_again(e){const s=e.since==="all"?"9999":String(e.since),i=await this.hooks.ask(`notes --since ${s}${e.all?" --all":""}`);i!==null&&(this.ask=e,this.model_show(i))}pills_paint(){this.sincePill!==null&&(this.sincePill.textContent=this.ask.since==="all"?"ALL RELEASES":this.ask.since===1?"LATEST RELEASE":`LAST ${this.ask.since} RELEASES`),this.internalPill!==null&&(this.internalPill.textContent=this.ask.all?"INTERNAL ON":"INTERNAL OFF",this.internalPill.classList.toggle("rail-off",!this.ask.all))}render(){const e=this.model;if(e===null)return;const s=n=>{const r=document.createElement("header");return r.className="files-path notes-block-head",r.textContent=n,r},i=wH(e,this.unfolded).map(n=>({key:n.key,header:s(n.title),rows:n.rows}));if(this.listing.rows_set(i,{field:"notes"}),this.state!==null){const n=Object.entries(e.installed).map(([r,o])=>`${r} ${o}`).join(" · ");this.state.textContent=`${e.source.toUpperCase()} · ${n}`}this.pills_paint()}}function zH(t){for(const e of t.envelopes){if(e.model?.kind!==Mk)continue;const s=zk.safeParse(e.model.data);if(s.success)return s.data}return null}function SH(t,e){const{layout:s,panels:i,subjects:n}=t,r=async c=>zH(await e.ask(c)),o=c=>{const h=e.template_stamp("tpl-pane-notes");return i.set("notes",c,new yH(h,{ask:r})),{id:c,kind:"notes",mount:h,dispose:()=>{i.delete(c),n.pane_leave(c)}}},a=c=>{r("notes").then(h=>{h!==null&&i.get("notes",c)?.model_show(h)})};return{instance_build:o,open:()=>{const c=i.ids("notes").find(f=>s.panes_shown().includes(f));if(c!==void 0)return s.focus_set(c),a(c),"notes: on stage";const h=e.launcher_active();e.launcher_yield();const d=s.focused_get()??"files",u=e.instance_spawn("notes");return(h?s.leaf_replace("files",u.id):s.leaf_split(d,"col",u.id,!1))?(h?s.focus_set(u.id):e.birth_record(u.id,d,"col",!1),a(u.id),"notes: what the installed releases changed, as a pane (notes in the console prints it)"):(As(u.id),s.mount_remove(u.id),"notes: could not open a pane")},latest:()=>r("notes")}}function Uv(t){return[...t.querySelectorAll(".mode-frame button")].filter(e=>!e.disabled&&!e.hidden&&e.offsetParent!==null)}function xH(t){return[...t.querySelectorAll(".listing-row")].filter(e=>e.offsetParent!==null)}function OH(t,e,s){if(e===0)return null;switch(s){case"ArrowDown":return t<0?0:Math.min(e-1,t+1);case"ArrowUp":return t<0?e-1:Math.max(0,t-1);case"Home":return 0;case"End":return e-1;default:return null}}function EH(t,e){const{layout:s,panels:i,paneInstance_get:n}=t,r=[()=>e.palette_isOpen()?(e.palette_close(),"claimed"):"passed",()=>t.terminal.ask_abandon()?"claimed":"passed",()=>m1()?"claimed":"passed",()=>e.errand_abandon()?"claimed":"passed",()=>{const f=document.activeElement;return!(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement)||f.closest(".workspace-pane")===null||f.closest("#terminal")!==null?"passed":(f.blur(),"claimed")},()=>i.values("image").some(f=>f.field_release())?"claimed":"passed",()=>i.values("edit").some(f=>f.field_release())?"claimed":"passed",()=>i.values("games").some(f=>f.field_release())?"claimed":"passed",()=>{if(t.terminal.ask_isOpen())return"passed";let f=!1;for(const _ of i.values("files"))_.select_isOn()&&(_.select_toggle(!1),f=!0);return f?"claimed":"passed"},()=>{const f=e.drawers_close(),_=e.modeFrames_close();return f||_?"claimed":"passed"},()=>document.body.dataset.zoom!==void 0?"yielded":"passed",()=>e.dive_leave()?"claimed":"passed",()=>e.overlay_escape()?"claimed":"passed",()=>{const f=i.entries("dag").find(([,_])=>_.inside_isHeld());return f===void 0?"passed":(f[1].flight_back(()=>{}),"claimed")},()=>{const f=s.focused_get(),_=i.entries("files").filter(([,g])=>g.content_isShown()).sort(([g],[m])=>g===f?-1:m===f?1:0)[0];return _===void 0?"passed":(_[1].listing_restore(),"claimed")},()=>i.values("dag").some(f=>f.nav_pop())?"claimed":"passed"],o=f=>{if(document.body.dataset.zoom!=="launcher")for(const _ of r){const g=_();if(g==="yielded")return;if(g==="claimed"){f.stopImmediatePropagation(),_!==r[0]&&t.sound("audio3");return}}},a=(f,_)=>{const g=()=>{f.preventDefault(),f.stopImmediatePropagation()},m=oB(f.key);if(f.ctrlKey&&!f.metaKey&&!f.altKey&&m!==null){const v=s.focused_get();return v!==null&&e.verbs.resize(v,m,.05),g(),!0}if(f.ctrlKey||f.metaKey||f.altKey)return!1;const w=v=>(e.drawers_close(),v(),g(),!0);if(m!==null)return w(()=>{l(),Vz(e.host(),ki[m].focusWord)!==null&&t.sound("audio3")});switch(f.key){case"o":case"O":{const v=s.panes_shown(),z=v.indexOf(s.focused_get()??""),x=v[(z+(f.key==="o"?1:v.length-1))%v.length];return w(()=>{l(),x!==void 0&&(s.focus_set(x),t.sound("audio3"))})}case"?":return w(()=>t.terminal.line_run("argus keys"));case";":return w(()=>{l(),s.focus_last()!==null&&t.sound("audio3")});case"q":return w(()=>{for(const v of s.panes_shown())e.verbs.bar_note(v,`@${v}`)});case" ":{const v=s.focused_get();return w(()=>{v!==null&&e.verbs.flip(v)})}case"!":{const v=s.focused_get();return w(()=>{v!==null&&s.panes_shown().length>1&&(e.stage_alone(v),e.verbs.bar_note(v,"ALONE ON STAGE"),t.sound("audio3"))})}case"w":return w(()=>e.element_require("gutter-panes").click());case"r":return w(()=>{l();const v=c();v!==null&&h(v)});case"&":return w(()=>t.terminal.line_run("pane close all"));case"[":return w(()=>{const v=document.querySelector(".argus-output");v!==null&&(v.tabIndex=-1,v.focus())})}const y=pn.find(v=>v.key===f.key&&v.selector!==null);if(y===void 0||y.selector===null)return!1;y.move===!0&&_.querySelector('.drawer-mode[data-mode="move"]')?.click();const b=_.querySelector(y.selector);return b===null||b.disabled?y.move===!0&&_.querySelector('.drawer-mode[data-mode="split"]')?.click():b.click(),g(),!0},l=()=>{const f=document.activeElement;f instanceof HTMLElement&&f.closest("#drawer")!==null&&f.blur(),e.console_release()},c=()=>{const f=document.body.dataset.zoom;if(f==="console"||f==="launcher")return null;const _=f!==void 0?f:s.focused_get();if(_===null)return null;const g=n(_)?.mount??null;return g?.closest(".workspace-pane")??g},h=f=>{f.classList.contains("workspace-pane")&&(f.dataset.modes="open");let _=0;const g=()=>{_+=1;const m=document.activeElement;!(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&f.contains(m))&&(m===null||m===document.body)&&Uv(f)[0]?.focus(),_<30&&window.requestAnimationFrame(g)};return g(),t.sound("audio3"),!0},d=f=>{if(f.ctrlKey||f.metaKey||f.altKey||f.shiftKey)return!1;const _=c();if(_===null)return!1;const g=()=>(f.preventDefault(),f.stopImmediatePropagation(),!0),m=document.activeElement;if(m instanceof HTMLButtonElement&&m.closest(".mode-frame")!==null&&_.contains(m)){const x=Uv(_),M=x.indexOf(m);return f.key==="ArrowLeft"?(m.blur(),g()):f.key==="ArrowDown"||f.key==="ArrowUp"?(x[f.key==="ArrowDown"?Math.min(x.length-1,M+1):Math.max(0,M-1)]?.focus(),g()):!1}if(m!==null&&m!==document.body&&!m.classList.contains("listing-row"))return!1;const w=xH(_);if(w.length===0)return!1;const y=w.findIndex(x=>x.classList.contains("listing-cursor")),b=y>=0?y:w.findIndex(x=>x.classList.contains("listing-indicated"));if(f.key==="ArrowRight")return h(_)&&g();if(f.key==="Enter"){const x=w[b];if(x===void 0)return!1;if(x.classList.contains("listing-indicated")){const M=x.querySelector(".listing-control");M!==null?M.click():x.dispatchEvent(new MouseEvent("dblclick",{bubbles:!0,cancelable:!0}))}else x.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}));return g()}const v=OH(b,w.length,f.key);if(v===null)return!1;for(const x of w)x.classList.remove("listing-cursor");const z=w[v];return z?.classList.add("listing-cursor"),z?.scrollIntoView({block:"nearest"}),g()},u=f=>{const _=document.querySelector(".pane-drawer:not([hidden])")!==null;if(f.key===":"&&_){e.drawers_close(),e.palette_open(),f.preventDefault(),f.stopImmediatePropagation();return}if(!(f.key==="b"&&f.ctrlKey&&!f.altKey&&!f.metaKey))return;if(f.preventDefault(),_){e.drawers_close(),e.palette_open();return}const g=document.body.dataset.zoom,m=g==="console"||g===void 0&&e.consoleFocused(),w=g!==void 0&&g!=="console"?g:s.focused_get()??"files",y=m?e.element_require("console-drawer"):n(w)?.mount?.querySelector(".pane-drawer")??null;y!==null&&(y.hidden=!y.hidden,y.hidden||y.querySelector("button")?.focus(),t.sound("audio3"))},p=f=>{if(f.key==="Escape"){o(f);return}const _=document.querySelector(".pane-drawer:not([hidden])"),g=f.target instanceof HTMLInputElement||f.target instanceof HTMLTextAreaElement||f.target instanceof HTMLElement&&f.target.isContentEditable;_!==null&&!g&&a(f,_)||_===null&&!g&&!e.palette_isOpen()&&d(f)||u(f)};return window.addEventListener("keydown",p,{capture:!0}),()=>window.removeEventListener("keydown",p,{capture:!0})}function AH(t,e){const{layout:s,panels:i,subjects:n}=t,r=(l,c,h)=>{h.addEventListener("click",_=>{_.target instanceof Element&&_.target.closest("button")!==null||(c.hidden=!c.hidden,c.hidden||c.querySelector("button")?.focus(),t.sound("audio3"))});const d=c.querySelector(".drawer-zoom");d!==null&&(d.dataset.pane=l),h.addEventListener("dblclick",_=>{_.target instanceof Element&&_.target.closest("button")!==null||(window.getSelection()?.removeAllRanges(),d?.click())});for(const _ of c.querySelectorAll(".drawer-bind"))_.addEventListener("click",()=>{for(const g of c.querySelectorAll(".drawer-bind"))g.classList.remove("drawer-bind-selected");_.classList.add("drawer-bind-selected"),t.sound("audio3")});const u=[...c.querySelectorAll("[data-split]")],p=_=>nB(_.dataset.split,_.dataset.place)??"right",f=_=>{c.dataset.mode=_;for(const g of c.querySelectorAll(".drawer-mode"))g.classList.toggle("drawer-mode-selected",g.dataset.mode===_);for(const g of u){const m=p(g);g.disabled=_==="move"&&!s.move_possible(l,m);const w=xi(m);g.title=_==="move"?`this pane moves ${m}${e.verbs.chordKeys_format(w,!0)}`:`new pane opens ${m}${e.verbs.chordKeys_format(w,!1)}`}};for(const _ of c.querySelectorAll(".drawer-mode"))_.addEventListener("click",()=>{const g=_.dataset.mode==="move"?"move":"split";f(g==="move"&&c.dataset.mode==="move"?"split":g),t.sound("audio3")});for(const _ of u)_.addEventListener("click",()=>{if(c.dataset.mode==="move"){e.verbs.move(l,p(_)),f("split"),c.hidden=!0;return}const g=_.dataset.split==="row"?"row":"col",m=_.dataset.place==="before",w=c.querySelector(".drawer-bind-selected")?.dataset.bind??"unlinked",y=w==="viewer"?"view":w==="fs"?"fs":"empty";e.pillPane_spawn(l,y,g,m)!==null&&(c.hidden=!0,t.sound("audio3"))});for(const _ of new Set(pn.filter(g=>g.selector!==null&&g.move!==!0).map(g=>g.selector??""))){const g=c.querySelector(_);g!==null&&!g.title.includes("[keys ")&&(g.title=`${g.title}${e.verbs.chordKeys_format(_,!1)}`)}c.querySelector(".drawer-close")?.addEventListener("click",()=>{if(l==="dag"){e.dag_dismiss(),e.home_apply();return}s.leaf_close(l)||e.home_apply(),e.orphans_dispose(),t.sound("audio3")})},o=(l,c,h)=>{const{browser:d}=e,u=c.querySelector(".drawer-binding");if(u!==null){const g=document.createElement("span");g.className="drawer-label drawer-label-cwd",g.textContent="CWD",u.appendChild(g);const m=(w,y,b)=>{const v=document.createElement("button");v.className="pacs-capsule drawer-cwdbind",v.dataset.follow=y?"on":"off",v.textContent=w,v.title=b,v.addEventListener("click",()=>{d.follows(l)!==y&&d.follow_set(l,y),t.sound("audio3")}),u.appendChild(v)};m("FOLLOW CWD",!0,"bind this browser to the session cwd (the console's browser)"),m("ROOT HERE",!1,"unbind from the cwd: this browser keeps its own place"),d.cwdBind_sync_register(l,()=>{const w=d.follows(l);for(const y of u.querySelectorAll(".drawer-cwdbind"))y.classList.toggle("drawer-bind-selected",y.dataset.follow==="on"===w)}),d.cwdBind_sync(l)}const p=()=>i.get("files",l);h.querySelector(".files-home")?.addEventListener("click",()=>{if(d.follows(l)){t.terminal.line_run("cd ~");return}const g=p();g!==void 0&&d.rooted_walk(l,g,"~")}),h.querySelector(".files-back")?.addEventListener("click",()=>{if(d.follows(l)){t.terminal.line_run("cd -");return}const g=p();g!==void 0&&d.rooted_back(l,g)});const f=()=>p()?.path_current()??null;h.querySelector(".files-mkdir")?.addEventListener("click",()=>{const g=f();g!==null&&d.directory_make(l,g)}),h.querySelector(".files-refresh")?.addEventListener("click",()=>{const g=f();g!==null&&d.listing_refresh(l,g)});const _=h.querySelector(".files-upload-input");h.querySelector(".files-upload")?.addEventListener("click",()=>{f()!==null&&_?.click()}),_?.addEventListener("change",()=>{const g=f(),m=_.files;g===null||m===null||m.length===0||(d.files_deliver(l,g,Array.from(m)),_.value="")})},a=(l,c)=>{const h=d=>d.modelKind==="fs.file"?d.address.replace(/\/[^/]*$/,"")||"/":d.address;c("ENTER NODE","move the session into the indicated node (its data directory)",()=>{const d=n.regard_get(l),u=i.get("dag",l)?.feed_get()??null,p=d===null?u===null?null:`/proc/jobs/feed_${u}`:h(d);p!==null&&t.terminal.line_run(`cd "${p}"`)}),c("PROCESS NODE","run an executable on the indicated node's output (a catalogue opens beside)",()=>{const d=n.regard_get(l),u=i.get("dag",l)?.feed_get()??null;if(d===null||u===null)return;const p=h(d),f=am(p)??(/_(\d+)\/?$/.exec(p)===null?null:parseInt(/_(\d+)\/?$/.exec(p)?.[1]??"",10));f!==null&&e.process_open(l,{input:p.replace(/\/data\/?$/,"")+"/data",feed:u,node:f})}),c("ENTER FEED","move the session into the feed on stage (or the one picked in the roster)",()=>{const d=i.get("dag",l)?.feed_get()??null;d!==null&&t.terminal.line_run(`cd "/proc/jobs/feed_${d}"`)}),c("BACK","return to the previous listing inside the node",()=>e.overlay_back(l)),c("CLEAR DETAIL","dismiss the node facts (a click on empty space does too)",()=>{i.get("dag",l)?.detail_clear()}),c("REFRESH","revisit the feed now (a watch keeps sampling it while it runs)",()=>{i.get("dag",l)?.refresh()})};return(l,c,h)=>{const d=h.querySelector(".pane-drawer"),u=h.querySelector(".pane-handle");if(d===null||u===null)return;r(l,d,u);const p=d.querySelector(".drawer-children");if(p===null)return;const f=(_,g,m)=>{const w=document.createElement("button");w.className="pacs-capsule drawer-child",w.textContent=_,w.title=g,w.addEventListener("click",()=>{m(),d.hidden=!0,t.sound("audio3")}),p.appendChild(w)};(c==="files"||c==="catalogue")&&o(l,d,h),c==="dag"&&a(l,f)}}async function TH(t,e){if(!Vl(window.location.search))return`${t}: this page did not come through a porter, so there is no other session to switch to`;const s=Dl(window.location.pathname,"switch");let i;try{i=await(await fetch(s,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t==="stratus"?{to:t,cloud:"oci",spend:e}:{to:t})})).json()}catch(r){return`${t}: the porter did not answer (${r instanceof Error?r.message:String(r)})`}if(i.error!==void 0||i.key===void 0)return`${t}: ${i.error??"the porter refused"}`;const n=s.slice(0,-6);return window.location.assign(i.state==="starting"?`${n}greet/${i.key}`:`${n}s/${i.key}/?door`),t==="stratus"?`switching to your stratus session${e?" (may spend)":" (read-only)"}…`:"switching to your ChRIS session…"}function IH(t,e){const{layout:s,panels:i,paneInstance_get:n,subjects:r}=t,o=d=>n(d)?.kind??null,a=(d,u)=>{const p=new Set(s.panes_shown()),f=r.group_resolve(u),_=i.entries(d).filter(([g])=>p.has(g));return i.get(d,u)??_.find(([g])=>r.group_resolve(g)===f)?.[1]??(_.length===1?_[0]?.[1]:void 0)},l=async(d,u,p)=>{if(u==="state"){const f=d.state_get();if(f===null)return"image state: no image on the field";const _=(f.viewports??[]).map(g=>`${g.id.replace(/^.*-/,"")} scale=${g.scale.toFixed(3)} focus=${g.focus.map(m=>m.toFixed(2)).join(",")} voi=${g.voi===null?"-":`${g.voi.lower.toFixed(1)}..${g.voi.upper.toFixed(1)}`}`).join(" | ");return`image: layout=${f.layout} tool=${f.tool} primary=${f.primaryTool??"-"} slice=${f.slice}/${f.slices} refused=${f.refused} annotations=${f.annotations} filled=${f.filled}
|
|
4364
4364
|
viewports: ${_||"(none)"}`}if(u==="layout"){const f=p[0]??"";return $2.includes(f)?await d.layout_set(f)?`image layout ${f}`:d.state_get()?.waiting===f?`image layout ${f}: waiting for LOAD`:`image layout ${f}: not offered`:"image layout single|mpr|3d|slab"}if(u==="slice"){const f=Number(p[0]);return!Number.isInteger(f)||f<1?"image slice <n>":d.slice_set(f)?`image slice ${f}`:`image slice ${f}: not offered`}if(u==="series"){const f=Number(p[0]),_=d.siblings_get();if(_.length===0)return"image series: this pane holds one series, not a study";const g=_[f-1];if(g===void 0)return`image series <1..${_.length}>: ${_.map((w,y)=>`${y+1} ${w.label}`).join(" · ")}`;const m=await e.series_ask(g.path);return m===null?`image series ${f}: ${g.path}: not a readable DICOM series`:(d.series_show(m,{siblings:[..._]}),`image series ${f} ${g.label}`)}if(u==="wl"){if((p[0]??"").toLowerCase()==="preset"){const g=p[1]??"";return g===""?"image wl preset <brain|bone|lung|soft|liver>":d.wlPreset_set(g)?`image wl preset ${g}`:`image wl preset ${g}: none for this modality`}const f=Number(p[0]),_=Number(p[1]);return!Number.isFinite(f)||!Number.isFinite(_)||f>=_?"image wl <lower> <upper> | image wl preset <name>":d.wl_set(f,_)?`image wl ${f} ${_}`:"image wl: not offered"}if(u==="colormap"){const f=(p[0]??"").toLowerCase();return dh.includes(f)?d.colormap_set(f)?`image colormap ${f}`:`image colormap ${f}: not offered`:"image colormap gray|hot|jet|cool"}if(u==="save")return await d.annotations_save()?"image save":"image save: nothing saved (the console says why)";if(u==="load")return await d.load_press()?"image load":"image load: nothing was waiting";if(u==="guard"){if((p[0]??"").toLowerCase()==="off")return d.guard_set(null),"image guard off";const _=Number(p[0]);return!Number.isFinite(_)||_<0?`image guard <bytes>|off (now ${d.guard_get()===null?"off":d.guard_get()})`:(d.guard_set(_),`image guard ${_}`)}if(u==="ghost"){const _=(p[0]??"").toLowerCase()==="off"?null:Number(p[0]);return _!==null&&(!Number.isFinite(_)||_<0||_>1)?"image ghost <0..1>|off (SLAB layout)":d.ghost_set(_)?`image ghost ${_===null?"off":_}`:"image ghost: SLAB layout only"}if(u==="tags"){const f=i.idOf("image",d);return f===null?"image tags: no image pane":e.tagsPane_open(f)}return"image <path> · layout single|mpr|3d · slice <n> · series <n> · wl <lo> <hi> | wl preset <name> · colormap <name> · save"},c=(d,u,p)=>{if(u==="redact"){const f=(p[0]??"").toLowerCase();return f!=="on"&&f!=="off"?"tags redact on|off":(d.redact_set(f==="on"),`tags redact ${f}`)}if(u==="filter"){const f=p.join(" ");return f===""||f.toLowerCase()==="off"?(d.filter_set(null),"tags filter off"):(d.filter_set(f),`tags filter ${f}`)}return"tags redact on|off · filter <text>|off"},h=()=>{const d=s.tree_get();if(d===null)return"# empty desktop";const u=[],p=v=>"pane"in v?v.pane:p(v.first),f=p(d),_=o(f);u.push(`view ${_==="dag"?"runs":_==="pacs"?"pacs":"files"}`);let g=1;const m=(v,z)=>{const x=o(v);x==="dag"&&v!==f&&u.push(`pane %${z} claim runs`),x==="files"&&v!==f&&r.group_resolve(v)===v&&u.push(`pane %${z} claim files`);const M=x==="files"?i.get("files",v)?.path_current()??null:null;M!==null&&u.push(`file %${z} open ${M}`);const S=x==="dag"?i.get("dag",v):void 0;if(S!==void 0&&S.graph_isShown())for(const T of S.view_lines())u.push(T.replace(/^dag /,`dag %${z} `));else if(x==="dag"){const T=n(v)?.mount,I=T?.querySelector(".dag-strategy")?.textContent?.toLowerCase()??"ranked",E=T?.querySelector(".dag-projection")?.textContent?.toLowerCase()??"3d",O=T?.querySelector(".dag-hue")?.textContent?.toLowerCase()??"status";I!=="ranked"&&u.push(`dag %${z} layout ${I}`),E!=="3d"&&u.push(`dag %${z} projection ${E}`),O!=="status"&&u.push(`dag %${z} hue ${O}`)}},w=(v,z)=>{if("pane"in v){m(v.pane,z);return}const x=p(v.second),M=o(x),S=M==="view"?"viewer":M==="files"&&r.group_resolve(x)!==x?"fs":"unlinked";u.push(`pane %${z} bind ${S}`),u.push(`pane %${z} split ${v.dir==="col"?"right":"below"}`);const T=++g;w(v.first,z),w(v.second,T)};w(d,g);const y=document.body.dataset.header;return y!==void 0&&u.push(`header ${y}`),document.getElementById("drawer")?.classList.contains("drawer-closed")&&u.push("console close"),u.join(`
|
|
4365
4365
|
`)};return{focused_get:()=>{const d=document.body.dataset.zoom;return d!==void 0&&d!=="console"?d:s.focused_get()??s.panes_shown()[0]??null},focus_set:d=>n(d)===void 0?!1:(s.focus_set(d),!0),panes_shown:()=>s.panes_shown(),pane_move:e.verbs.move,pane_flip:e.verbs.flip,pane_resize:e.verbs.resize,help_open:e.help_open,notes_open:e.notes_open,focus_last:()=>{const d=s.focus_last();return d!==null&&t.sound("audio3"),d===null?null:`focused ${d}`},paneRect_get:d=>document.querySelector(`.layout-leaf[data-leaf="${d}"]`)?.getBoundingClientRect()??null,paneMount_get:d=>n(d)?.mount??null,paneKind_get:o,paneLinked_get:d=>r.group_resolve(d)!==d,feed_enter:e.feed_enter,consoleZoom_toggle:e.consoleZoom_toggle,launcher_enter:e.launcher_enter,trek_open:e.trek_open,session_switch:TH,stage_keep:e.stage_keep,viewModes_hold:UU,identity_get:e.identity_get,dag_jump:(d,u,p=!1)=>{const f=i.get("dag",d)??i.values("dag")[0];return f===void 0?!1:(f.target_jumpTo(u,p),!0)},node_immerse:d=>{const p=r.regard_get(d)?.address.match(/_(\d+)(?:\/data)?\/?$/)??null;return p===null?!1:i.get("dag",d)?.node_flyTo(parseInt(p[1]??"",10))??!1},files_open:e.files_open,file_download:d=>{const u=r.regard_get(d);return u===null||u.modelKind!=="fs.file"?!1:(e.file_save(u.address),!0)},image_open:(d,u,p)=>e.image_open(d,u,p??{}),image_control:async(d,u,p)=>{const f=a("image",d);return f===void 0?`image ${u}: no image pane on stage for '${d}'`:l(f,u,p)},universe_control:(d,u,p)=>{const f=new Set(s.panes_shown()),_=(d!==null?i.get("universe",d):void 0)??i.entries("universe").find(([g])=>f.has(g))?.[1];return _===void 0?"universe: no universe pane on stage (press the dashboard tile)":_.control(u,p)},tags_control:(d,u,p)=>{const f=a("tags",d);return f===void 0?`tags ${u}: no tags pane on stage for '${d}'`:c(f,u,p)},file_delete:d=>{const u=r.regard_get(d);return u===null||u.modelKind!=="fs.file"?!1:(t.terminal.line_run(`rm "${u.address}"`),!0)},session_run:async d=>{try{return(await t.client.line_execute(d,{silent:!0,observe:!1})).envelopes.map(p=>p.renderedErr??p.rendered).join(`
|
|
4366
|
-
`)}catch(u){return u instanceof Error?u.message:String(u)}},desktop_serialize:h}}function DH(t,e,s){if(s===!0)return"daemon-older";if(e===void 0)return null;const i=e.surface;return s===!1?i!==void 0&&t.built<i.built?"argus-older":null:i===void 0?"daemon-older":i.git===t.git&&i.built===t.built?null:t.built>=i.built?"daemon-older":"argus-older"}const u_={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function Y1(t){const e=u_[t];return`${e.before}${e.cure}${e.after}`}async function CH(t){try{const e=t??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const s=await e("notes.json",{cache:"no-store"});if(!s.ok)return null;const i=await s.json(),r=i.releases?.[0]?.changes?.find(o=>o.internal!==!0)?.headline;return typeof r!="string"||typeof i.version!="string"?null:{version:i.version,headline:r}}catch{return null}}const $v=96;function RH(t){const e=t.headline.length>$v?`${t.headline.slice(0,$v-1).trimEnd()}…`:t.headline;return`argus ${t.version} · ${e} — WHAT'S NEW after restart`}function kH(t,e,s,i,n=document.body,r){n.querySelector(".build-mismatch")?.remove();const o=s.surface!==void 0?`ARGUS ${s.surface.git} built ${s.surface.built}Z`:"an ARGUS too old to say its build";i(`argus: ${Y1(t)}`);const a=s.surface!==void 0&&s.surface.git===e.git&&s.surface.built===e.built;i(a?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${o}`);const l=u_[t],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=t,c.setAttribute("role","alert");const h=document.createElement("span");h.className="stale-page-words";let d=document.createTextNode(l.cure);if(t==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),d=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),d=p}h.append(document.createTextNode(l.before),d,document.createTextNode(l.after));const u=document.createElement("button");u.type="button",u.className="build-mismatch-dismiss",u.textContent="×",u.title="dismiss (the status strip keeps saying it)",u.addEventListener("click",()=>{c.remove()}),c.append(h,u),n.appendChild(c),t==="daemon-older"&&CH().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=RH(p),h.appendChild(f)})}function NH(t,e,s,i=document.body){const n={git:"
|
|
4366
|
+
`)}catch(u){return u instanceof Error?u.message:String(u)}},desktop_serialize:h}}function DH(t,e,s){if(s===!0)return"daemon-older";if(e===void 0)return null;const i=e.surface;return s===!1?i!==void 0&&t.built<i.built?"argus-older":null:i===void 0?"daemon-older":i.git===t.git&&i.built===t.built?null:t.built>=i.built?"daemon-older":"argus-older"}const u_={"daemon-older":{readout:"CALYPSO DAEMON OUT OF DATE",before:"The calypso daemon has been updated and should be restarted; some controls may not work until then. ",cure:"Restart the calypso daemon",after:"."},"argus-older":{readout:"ARGUS OUT OF DATE",before:"ARGUS is older than the calypso daemon. ",cure:"Refresh",after:" to load the new ARGUS."}};function Y1(t){const e=u_[t];return`${e.before}${e.cure}${e.after}`}async function CH(t){try{const e=t??(typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):void 0);if(e===void 0)return null;const s=await e("notes.json",{cache:"no-store"});if(!s.ok)return null;const i=await s.json(),r=i.releases?.[0]?.changes?.find(o=>o.internal!==!0)?.headline;return typeof r!="string"||typeof i.version!="string"?null:{version:i.version,headline:r}}catch{return null}}const $v=96;function RH(t){const e=t.headline.length>$v?`${t.headline.slice(0,$v-1).trimEnd()}…`:t.headline;return`argus ${t.version} · ${e} — WHAT'S NEW after restart`}function kH(t,e,s,i,n=document.body,r){n.querySelector(".build-mismatch")?.remove();const o=s.surface!==void 0?`ARGUS ${s.surface.git} built ${s.surface.built}Z`:"an ARGUS too old to say its build";i(`argus: ${Y1(t)}`);const a=s.surface!==void 0&&s.surface.git===e.git&&s.surface.built===e.built;i(a?`argus: the calypso daemon's own code on disk has changed since it started (ARGUS ${e.git} built ${e.built}Z)`:`argus: ARGUS ${e.git} built ${e.built}Z · calypso daemon started with ${o}`);const l=u_[t],c=document.createElement("div");c.className="stale-page build-mismatch",c.dataset.mismatch=t,c.setAttribute("role","alert");const h=document.createElement("span");h.className="stale-page-words";let d=document.createTextNode(l.cure);if(t==="argus-older"){const p=document.createElement("button");p.type="button",p.className="stale-page-reload",p.textContent=l.cure,p.title="reload this tab to load the new ARGUS",p.addEventListener("click",()=>{window.location.reload()}),d=p}else if(r!==void 0){const p=document.createElement("button");p.type="button",p.className="stale-page-reload build-mismatch-restart",p.textContent=l.cure,p.title="restart the calypso daemon (asks first; you stay logged in)",p.addEventListener("click",r),d=p}h.append(document.createTextNode(l.before),d,document.createTextNode(l.after));const u=document.createElement("button");u.type="button",u.className="build-mismatch-dismiss",u.textContent="×",u.title="dismiss (the status strip keeps saying it)",u.addEventListener("click",()=>{c.remove()}),c.append(h,u),n.appendChild(c),t==="daemon-older"&&CH().then(p=>{if(p===null||!c.isConnected)return;const f=document.createElement("span");f.className="build-mismatch-news",f.textContent=RH(p),h.appendChild(f)})}function NH(t,e,s,i=document.body){const n={git:"79ee8a07",built:"2026-10-25 02:44"};let r=[],o,a=null;const l=h=>{r!==null?r.push(h):e(h)},c=h=>{if(o===void 0)return;const d=DH(n,o,h);if(d!==a){if(a=d,d===null){t.build_show(null),i.querySelector(".build-mismatch")?.remove();return}t.build_show(u_[d].readout,Y1(d)),kH(d,n,o,l,i,Vl(window.location.search)?s:void 0)}};return{attach_take:h=>{o=h.stack,c(h.stale)},stale_take:h=>c(h),release:()=>{const h=r??[];r=null;for(const d of h)e(d)}}}function BH(t=document.getElementById("door-pill")){t===null||!Vl(window.location.search)||(t.hidden=!1,t.addEventListener("click",()=>{const e=Dl(window.location.pathname,"logout"),s=Dl(window.location.pathname,"login");fetch(e,{method:"POST",headers:{accept:"application/json"}}).catch(()=>{}).then(()=>{window.location.assign(s)})}))}const GH="Restart the calypso daemon? You'll stay logged in; the page reloads when the new daemon is up.";function PH(t){const e=[];t.running!==null&&e.push(`the running command: ${t.running}`);for(const r of t.unsaved)e.push(`an unsaved edit in ${r}`);const s=t.others.filter(r=>r.kind==="browser").length,i=t.others.length-s,n=[];return s>0&&n.push(s===1?"1 other browser":`${s} other browsers`),i>0&&n.push(i===1?"1 chell":`${i} chells`),n.length>0&&e.push(`${n.join(" and ")}, which will be disconnected`),e}function LH(t){return t==="restart"?"The calypso daemon is restarting (asked from another browser or surface). Following it…":t==="end"?"The calypso daemon was ended by an administrator.":"The calypso daemon stopped."}function WH(t,e){const s=document.createElement("div");s.className="stale-page restart-question",s.setAttribute("role","alertdialog");const i=document.createElement("div");i.className="stale-page-words";const n=document.createElement("div");if(n.textContent=GH,i.append(n),t.length>0){const h=document.createElement("ul");h.className="restart-cuts";const d=document.createElement("li");d.className="restart-cuts-lead",d.textContent="This will cut off:",h.append(d);for(const u of t){const p=document.createElement("li");p.textContent=u,h.append(p)}i.append(h)}const r=document.createElement("button");r.type="button",r.className="restart-yes",r.textContent="YES";const o=document.createElement("button");o.type="button",o.className="restart-no",o.textContent="NO";let a=!1;const l=h=>{a||(a=!0,s.remove(),e(h))};r.addEventListener("click",()=>l(!0)),o.addEventListener("click",()=>l(!1)),s.addEventListener("keydown",h=>{h.key!=="Enter"&&h.key!=="Escape"||(h.preventDefault(),h.stopPropagation(),l(h.key==="Enter"))});const c=document.createElement("div");return c.className="restart-answers",c.append(r,o),s.append(i,c),s}function FH(t,e=document.body){const s=Vl(window.location.search);let i=null,n=null,r=[],o=!1;const a=u=>{e.querySelector(".restart-said")?.remove();const p=document.createElement("div");p.className="stale-page restart-said",p.setAttribute("role","alert"),p.textContent=u,e.appendChild(p)},l=u=>{window.location.assign(`${Dl(window.location.pathname,"greet")}/${encodeURIComponent(u)}`)},c=async()=>{o=!0,a("Restarting the calypso daemon…");try{const u=await fetch(Dl(window.location.pathname,"restart"),{method:"POST",headers:{accept:"application/json"}}),p=await u.json();if(!u.ok||p.key===void 0)throw new Error(p.error??`the door answered ${u.status}`);l(p.key)}catch(u){o=!1,a(`The calypso daemon could not be restarted: ${u instanceof Error?u.message:String(u)}`)}},h=()=>{if(!s||e.querySelector(".restart-question")!==null)return;const u={running:n,unsaved:t.unsaved(),others:r.filter(f=>f.id!==i)},p=WH(PH(u),f=>{f&&c()});e.querySelector(".build-mismatch")?.remove(),e.appendChild(p),p.querySelector(".restart-yes")?.focus()},d=document.getElementById("restart-pill");return d!==null&&s&&(d.hidden=!1,d.addEventListener("click",h)),{ask:h,attach_take:u=>{i=u.surface??null},telemetry_take:u=>{u?.lane!==void 0&&(n=u.lane.running?.line??null),u?.surfaces!==void 0&&(r=u.surfaces)},closing_take:u=>{if(o||(a(LH(u)),u!=="restart"||!s))return;const p=window.location.pathname.split("/").filter(f=>f.length>0).at(-1);p!==void 0&&setTimeout(()=>l(p),1200)}}}function UH(t,e,s,i){t.line_execute(`motd ${s}`,{silent:!0,observe:!1}).then(n=>{const r=n.envelopes.filter(o=>o.status==="ok").map(o=>o.rendered).join("").trimEnd();r.length>0&&e.greeting_write(r.split(`
|
|
4367
4367
|
`))}).catch(()=>{}).finally(i)}var X1=Object.defineProperty,$H=Object.getOwnPropertyDescriptor,jH=(t,e)=>{for(var s in e)X1(t,s,{get:e[s],enumerable:!0})},es=(t,e,s,i)=>{for(var n=i>1?void 0:i?$H(e,s):e,r=t.length-1,o;r>=0;r--)(o=t[r])&&(n=(i?o(e,s,n):o(n))||n);return i&&n&&X1(e,s,n),n},Re=(t,e)=>(s,i)=>e(s,i,t),jv="Terminal input",fm={get:()=>jv,set:t=>jv=t},Hv="Too much output to announce, navigate to rows manually to read",pm={get:()=>Hv,set:t=>Hv=t};function HH(t){return t.replace(/\r?\n/g,"\r")}function VH(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function qH(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function KH(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let n=t.clipboardData.getData("text/plain");Z1(n,e,s,i)}}function Z1(t,e,s,i){t=HH(t),t=VH(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function J1(t,e,s){let i=s.getBoundingClientRect(),n=t.clientX-i.left-10,r=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.zIndex="1000",e.focus()}function Vv(t,e,s,i,n){J1(t,e,s),n&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function dr(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function $d(t,e=0,s=t.length){let i="";for(let n=e;n<s;++n){let r=t[n];r>65535?(r-=65536,i+=String.fromCharCode((r>>10)+55296)+String.fromCharCode(r%1024+56320)):i+=String.fromCharCode(r)}return i}var YH=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,n=0;if(this._interim){let r=t.charCodeAt(n++);56320<=r&&r<=57343?e[i++]=(this._interim-55296)*1024+r-56320+65536:(e[i++]=this._interim,e[i++]=r),this._interim=0}for(let r=n;r<s;++r){let o=t.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=s)return this._interim=o,i;let a=t.charCodeAt(r);56320<=a&&a<=57343?e[i++]=(o-55296)*1024+a-56320+65536:(e[i++]=o,e[i++]=a);continue}o!==65279&&(e[i++]=o)}return i}},XH=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,n,r,o,a,l=0,c=0;if(this.interim[0]){let u=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let f=0,_;for(;(_=this.interim[++f]&63)&&f<4;)p<<=6,p|=_;let g=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=g-f;for(;c<m;){if(c>=s)return 0;if(_=t[c++],(_&192)!==128){c--,u=!0;break}else this.interim[f++]=_,p<<=6,p|=_&63}u||(g===2?p<128?c--:e[i++]=p:g===3?p<2048||p>=55296&&p<=57343||p===65279||(e[i++]=p):p<65536||p>1114111||(e[i++]=p)),this.interim.fill(0)}let h=s-4,d=c;for(;d<s;){for(;d<h&&!((n=t[d])&128)&&!((r=t[d+1])&128)&&!((o=t[d+2])&128)&&!((a=t[d+3])&128);)e[i++]=n,e[i++]=r,e[i++]=o,e[i++]=a,d+=4;if(n=t[d++],n<128)e[i++]=n;else if((n&224)===192){if(d>=s)return this.interim[0]=n,i;if(r=t[d++],(r&192)!==128){d--;continue}if(l=(n&31)<<6|r&63,l<128){d--;continue}e[i++]=l}else if((n&240)===224){if(d>=s)return this.interim[0]=n,i;if(r=t[d++],(r&192)!==128){d--;continue}if(d>=s)return this.interim[0]=n,this.interim[1]=r,i;if(o=t[d++],(o&192)!==128){d--;continue}if(l=(n&15)<<12|(r&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;e[i++]=l}else if((n&248)===240){if(d>=s)return this.interim[0]=n,i;if(r=t[d++],(r&192)!==128){d--;continue}if(d>=s)return this.interim[0]=n,this.interim[1]=r,i;if(o=t[d++],(o&192)!==128){d--;continue}if(d>=s)return this.interim[0]=n,this.interim[1]=r,this.interim[2]=o,i;if(a=t[d++],(a&192)!==128){d--;continue}if(l=(n&7)<<18|(r&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;e[i++]=l}}return i}},Q1="",_r=" ",Xl=class ex{constructor(){this.fg=0,this.bg=0,this.extended=new ld}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new ex;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ld=class tx{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new tx(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ni=class sx extends Xl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ld,this.combinedData=""}static fromCharData(e){let s=new sx;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let n=e[1].charCodeAt(1);56320<=n&&n<=57343?this.content=(i-55296)*1024+n-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},qv="di$target",mm="di$dependencies",pf=new Map;function ZH(t){return t[mm]||[]}function zs(t){if(pf.has(t))return pf.get(t);let e=function(s,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");JH(e,s,n)};return e._id=t,pf.set(t,e),e}function JH(t,e,s){e[qv]===e?e[mm].push({id:t,index:s}):(e[mm]=[{id:t,index:s}],e[qv]=e)}var Zs=zs("BufferService"),ix=zs("CoreMouseService"),zo=zs("CoreService"),QH=zs("CharsetService"),f_=zs("InstantiationService"),nx=zs("LogService"),Js=zs("OptionsService"),rx=zs("OscLinkService"),e9=zs("UnicodeService"),Zl=zs("DecorationService"),gm=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],n=this._optionsService.rawOptions.linkHandler,r=new Ni,o=s.getTrimmedLength(),a=-1,l=-1,c=!1;for(let h=0;h<o;h++)if(!(l===-1&&!s.hasContent(h))){if(s.loadCell(h,r),r.hasExtendedAttrs()&&r.extended.urlId)if(l===-1){l=h,a=r.extended.urlId;continue}else c=r.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&h===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let u={start:{x:l+1,y:t},end:{x:h+(!c&&h===o-1?1:0),y:t}},p=!1;if(!n?.allowNonHttpProtocols)try{let f=new URL(d);["http:","https:"].includes(f.protocol)||(p=!0)}catch{p=!0}p||i.push({text:d,range:u,activate:(f,_)=>n?n.activate(f,_,u):t9(f,_),hover:(f,_)=>n?.hover?.(f,_,u),leave:(f,_)=>n?.leave?.(f,_,u)})}c=!1,r.hasExtendedAttrs()&&r.extended.urlId?(l=h,a=r.extended.urlId):(l=-1,a=-1)}}e(i)}};gm=es([Re(0,Zs),Re(1,Js),Re(2,rx)],gm);function t9(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4368
4368
|
|
|
4369
4369
|
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var jd=zs("CharSizeService"),Kn=zs("CoreBrowserService"),p_=zs("MouseService"),Yn=zs("RenderService"),s9=zs("SelectionService"),ox=zs("CharacterJoinerService"),Oa=zs("ThemeService"),ax=zs("LinkProviderService"),i9=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Kv.isErrorNoTelemetry(t)?new Kv(t.message+`
|
|
@@ -4387,7 +4387,7 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
|
|
|
4387
4387
|
`).slice(2).join(`
|
|
4388
4388
|
`))}},bq=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},Mq=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},vq=0,Tf=class{constructor(t){this.value=t,this.id=vq++}},wq=2,yq,ar=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new gq(t?.onListenerError??Af,this._options?.leakWarningThreshold??mq):void 0,this._perfMon=this._options?._profName?new pq(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,e,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let o=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(o);let a=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Mq(`${o}. HINT: Stack shows most frequent listener (${a[1]}-times)`,a[0]);return(this._options?.onListenerError||Af)(l),pd.None}if(this._disposed)return pd.None;e&&(t=t.bind(e));let i=new Tf(t),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=_q.create(),n=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof Tf?(this._deliveryQueue??=new zq,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let r=Ux(()=>{n?.(),this._removeListener(i)});return s instanceof z_?s.add(r):Array.isArray(s)&&s.push(r),r},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let e=this._listeners,s=e.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[s]=void 0;let i=this._deliveryQueue.current===this;if(this._size*wq<=e.length){let n=0;for(let r=0;r<e.length;r++)e[r]?e[n++]=e[r]:i&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=n}}_deliver(t,e){if(!t)return;let s=this._options?.onListenerError||Af;if(!s){t.value(e);return}try{t.value(e)}catch(i){s(i)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Tf)this._deliver(this._listeners,t);else{let e=this._deliveryQueue;e.enqueue(this,t,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},zq=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,s){this.i=0,this.end=s,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},md=class Rh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ar,this.onChange=this._onChange.event;let e=new iq;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,s,i=!1){return(e&16777215)<<3|(s&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let s=0,i=0,n=e.length;for(let r=0;r<n;++r){let o=e.charCodeAt(r);if(55296<=o&&o<=56319){if(++r>=n)return s+this.wcwidth(o);let c=e.charCodeAt(r);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:s+=this.wcwidth(c)}let a=this.charProperties(o,i),l=Rh.extractWidth(a);Rh.extractShouldJoin(a)&&(l-=Rh.extractWidth(i)),s+=l,i=a}return s}charProperties(e,s){return this._activeProvider.charProperties(e,s)}},If=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],Sq=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],Df=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],xq=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],Tn;function Lw(t,e){let s=0,i=e.length-1,n;if(t<e[0][0]||t>e[i][1])return!1;for(;i>=s;)if(n=s+i>>1,t>e[n][1])s=n+1;else if(t<e[n][0])i=n-1;else return!0;return!1}var Oq=class{constructor(){if(this.version="11",!Tn){Tn=new Uint8Array(65536),Tn.fill(1),Tn[0]=0,Tn.fill(0,1,32),Tn.fill(0,127,160);for(let t=0;t<If.length;++t)Tn.fill(0,If[t][0],If[t][1]+1);for(let t=0;t<Df.length;++t)Tn.fill(2,Df[t][0],Df[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Tn[t]:Lw(t,Sq)?0:Lw(t,xq)?2:1}charProperties(t,e){let s=this.wcwidth(t),i=s===0&&e!==0;if(i){let n=md.extractWidth(e);n===0?i=!1:n>s&&(s=n)}return md.createPropertyValue(0,s,i)}},Eq=class{activate(t){t.unicode.register(new Oq)}dispose(){}};var Aq=class{constructor(t,e,s,i={}){this._terminal=t,this._regex=e,this._handler=s,this._options=i}provideLinks(t,e){let s=Iq.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(s))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(s,i)=>{if(this._options.hover){let{range:n}=e;this._options.hover(s,i,n)}},e))}};function Tq(t){try{let e=new URL(t),s=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}var Iq=class kh{static computeLink(e,s,i,n){let r=new RegExp(s.source,(s.flags||"")+"g"),[o,a]=kh._getWindowedLineStrings(e-1,i),l=o.join(""),c,h=[];for(;c=r.exec(l);){let d=c[0];if(!Tq(d))continue;let[u,p]=kh._mapStrIdx(i,a,0,c.index),[f,_]=kh._mapStrIdx(i,u,p,d.length);if(u===-1||p===-1||f===-1||_===-1)continue;let g={start:{x:p+1,y:u+1},end:{x:_,y:f+1}};h.push({range:g,text:d,activate:n})}return h}static _getWindowedLineStrings(e,s){let i,n=e,r=e,o=0,a="",l=[];if(i=s.buffer.active.getLine(e)){let c=i.translateToString(!0);if(i.isWrapped&&c[0]!==" "){for(o=0;(i=s.buffer.active.getLine(--n))&&o<2048&&(a=i.translateToString(!0),o+=a.length,l.push(a),!(!i.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(c),o=0;(i=s.buffer.active.getLine(++r))&&i.isWrapped&&o<2048&&(a=i.translateToString(!0),o+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,n]}static _mapStrIdx(e,s,i,n){let r=e.buffer.active,o=r.getNullCell(),a=i;for(;n;){let l=r.getLine(s);if(!l)return[-1,-1];for(let c=a;c<l.length;++c){l.getCell(c,o);let h=o.getChars();if(o.getWidth()&&(n-=h.length||1,c===l.length-1&&h==="")){let d=r.getLine(s+1);d&&d.isWrapped&&(d.getCell(0,o),o.getWidth()===2&&(n+=1))}if(n<0)return[s,c]}s++,a=0}return[s,a]}},Dq=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Cq(t,e){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var Rq=class{constructor(t=Cq,e={}){this._handler=t,this._options=e}activate(t){this._terminal=t;let e=this._options,s=e.urlRegex||Dq;this._linkProvider=this._terminal.registerLinkProvider(new Aq(this._terminal,s,this._handler,e))}dispose(){this._linkProvider?.dispose()}};const kq=6677;function Nq(t){const e=/^state=(idle|busy|asking|playing)$/.exec(t.trim());return e===null?null:e[1]}const eg="argus.terminalId",Bq="'JetBrainsMono NF Mono', 'MesloLGS NF', monospace",Gq=[{label:"ESC",data:"\x1B"},{label:"TAB",data:" "},{label:"CTRL",data:"ctrl"},{label:"←",data:"\x1B[D"},{label:"↑",data:"\x1B[A"},{label:"↓",data:"\x1B[B"},{label:"→",data:"\x1B[C"}];function Pq(t){const[e,s,i,n,r,o,a,l,c,h,d,u,p,f,_,g]=Qk;return{background:"#000000",foreground:t,cursor:t,cursorAccent:"#000000",selectionBackground:"#44556680",black:e,red:s,green:i,yellow:n,blue:r,magenta:o,cyan:a,white:l,brightBlack:c,brightRed:h,brightGreen:d,brightYellow:u,brightBlue:p,brightMagenta:f,brightCyan:_,brightWhite:g}}function Lq(t){if(t.length!==1)return t;const e=t.toUpperCase().charCodeAt(0);return e>=64&&e<=95?String.fromCharCode(e-64):t}function Wq(){try{return sessionStorage.getItem(eg)??void 0}catch{return}}function Ww(t){try{t===null?sessionStorage.removeItem(eg):sessionStorage.setItem(eg,t)}catch{}}class Fq{constructor(e,s,i,n=()=>{}){this.mount=e,this.wire=s,this.refused=i,this.state=n;const r=getComputedStyle(e).color||"#ffaa44";this.term=new ZV({fontFamily:Bq,fontSize:Math.max(10,Math.floor(parseFloat(getComputedStyle(e).fontSize)||13)),theme:Pq(r),cursorBlink:!0,scrollback:5e3,allowProposedApi:!0}),this.term.loadAddon(this.fit),this.term.loadAddon(new Rq),this.term.loadAddon(new Eq),this.term.unicode.activeVersion="11";const o=document.createElement("div");o.className="argus-xterm",e.appendChild(o),this.term.open(o),this.keyRow_build(),this.term.onData(a=>this.keys_send(a)),this.term.onLineFeed(()=>{this.feeds++}),this.term.parser.registerOscHandler(kq,a=>{const l=Nq(a);return l!==null&&this.state(l),!0}),this.term.onResize(({cols:a,rows:l})=>{this.terminalId!==null&&this.wire.resize(this.terminalId,a,l)}),this.observer=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>this.size_fit()),this.observer?.observe(e),this.size_fit(),this.wire.open(this.term.cols,this.term.rows,Wq())}mount;wire;refused;state;term;fit=new eq;terminalId=null;ended=!1;ctrlHeld=!1;resizeFrame=null;feeds=0;observer;size_fit(){this.resizeFrame===null&&(this.resizeFrame=requestAnimationFrame(()=>{if(this.resizeFrame=null,this.mount.offsetParent!==null)try{this.fit.fit()}catch{}}))}terminalId_get(){return this.terminalId}focus(){this.term.focus()}opened(e,s,i){if(i!==void 0){this.refused(i);return}this.terminalId=e,this.ended=!1,Ww(e),s!==""&&this.term.write(s),this.wire.resize(e,this.term.cols,this.term.rows)}data(e,s){e===this.terminalId&&this.term.write(s)}exited(e,s){e===this.terminalId&&(this.ended=!0,this.terminalId=null,Ww(null),this.term.write(`\r
|
|
4389
4389
|
\x1B[90m[the console's shell exited${s===0?"":` (${s})`}; press a key for a new one]\x1B[0m\r
|
|
4390
|
-
`))}offer(e){this.terminalId!==null&&this.wire.input(this.terminalId,`${e}`),this.focus()}buffer_lines(){const e=this.term.buffer.active,s=[];for(let i=0;i<e.length;i++){const n=e.getLine(i),r=n?.translateToString(!0)??"";n?.isWrapped===!0&&s.length>0?s[s.length-1]+=r:s.push(r)}for(;s.length>0&&s[s.length-1]==="";)s.pop();return s}mark(){return this.feeds}lines_since(e){const s=this.buffer_lines(),i=Math.max(0,this.feeds-e)+1;return s.slice(Math.max(0,s.length-i))}type(e){this.keys_send(e)}dispose(){this.observer?.disconnect(),this.term.dispose()}keys_send(e){if(this.ended){this.ended=!1,this.term.reset(),this.wire.open(this.term.cols,this.term.rows);return}if(this.terminalId===null)return;let s=e;this.ctrlHeld&&(s=Lq(e),this.ctrlHeld=!1,this.mount.querySelector(".argus-xterm-key.held")?.classList.remove("held")),this.wire.input(this.terminalId,s)}keyRow_build(){const e=document.createElement("div");e.className="argus-xterm-keys";for(const s of Gq){const i=document.createElement("button");i.type="button",i.className="argus-xterm-key",i.textContent=s.label,i.addEventListener("pointerdown",n=>{n.preventDefault(),s.data==="ctrl"?(this.ctrlHeld=!this.ctrlHeld,i.classList.toggle("held",this.ctrlHeld)):this.keys_send(s.data),this.focus()}),e.appendChild(i)}this.mount.appendChild(e)}}const Uq="argus.consoleMode",$q="console: the transcript, deprecated: this host offers no pseudo-terminal (node-pty did not build). Install python, make and g++ and reinstall for the terminal console.";function jq(){try{localStorage.removeItem(Uq)}catch{}}function Hq(t){const{client:e,terminal:s,offered:i}=t,n=document.getElementById("terminal");let r=null,o="transcript";const a=l=>{if(n!==null)if(l==="terminal"&&i){if(n.classList.add("console-terminal"),r===null){const h=document.createElement("div");h.className="argus-terminal-mount",n.appendChild(h),r=new Fq(h,{open:(d,u,p)=>e.terminal_open(d,u,p),input:(d,u)=>e.terminal_input(d,u),resize:(d,u,p)=>e.terminal_resize(d,u,p)},d=>{a("transcript"),s.line_note(`console: ${d}`)},d=>{n.dataset.terminalState=d}),n.dataset.terminalState="busy",t.screen_set(r)}const c=r;e.mirror_set(!0),s.delegate_set({note:h=>e.note_send(h),offer:h=>c.offer(h),focus:()=>c.focus(),fit:()=>c.size_fit()}),c.size_fit(),o="terminal"}else n.classList.remove("console-terminal"),e.mirror_set(!1),s.delegate_set(null),o="transcript"};return jq(),a(i?"terminal":"transcript"),i||s.line_note($q),Object.assign(globalThis,{__argusConsole:{mode:()=>o,state:()=>n?.dataset.terminalState??"busy",type:l=>r?.type(l),lines:()=>r?.buffer_lines()??[],mark:()=>r?.mark()??0,since:l=>r?.lines_since(l)??[]}}),{terminal_is:()=>o==="terminal",question_sheet:async l=>{document.querySelector(".question-sheet")?.remove();const c=document.createElement("div");c.className="share-sheet question-sheet",c.setAttribute("role","dialog");const h=document.createElement("div");h.className="share-head",h.textContent="THE SESSION ASKS",c.appendChild(h),document.body.appendChild(c);try{return await a_(s,c,l)}finally{c.remove()}}}}const Vq=new Set(["busy","asking","playing"]);function qq(t,e=()=>null){const s=document.querySelector(".console-stop"),i=document.getElementById("terminal");if(s===null||i===null)return;const n=()=>{const o=i.classList.contains("console-terminal")?Vq.has(i.dataset.terminalState??""):i.dataset.busy==="true";s.hidden=!o};new MutationObserver(n).observe(i,{attributes:!0,attributeFilter:["data-busy","data-terminal-state","class"]}),n(),s.addEventListener("click",()=>{const r=i.classList.contains("console-terminal")?e():null;r!==null&&t.terminal_input(r,""),t.stop_send()})}let Xr=()=>{};function Fw(){Xr(document.body.dataset.zoom==="console"?null:"console")}const Kq=mO(),Yq=_O(),Xq=new URL("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9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EyMCIgeT0iMjY4IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBmb250LWZhbWlseT0iTW9udHNlcnJhdCxIZWx2ZXRpY2EsQXJpYWwsc2Fucy1zZXJpZiIgZm9udC13ZWlnaHQ9IjcwMCIgZm9udC1zaXplPSIzOCIgZmlsbD0iIzJhNjNiZiIgbGV0dGVyLXNwYWNpbmc9IjQiPk9DSSBURDwvdGV4dD4KPC9zdmc+",import.meta.url).href,Zq=`data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" fill="#000"/><rect x="6" y="14" width="52" height="36" rx="18" fill="#20bdef"/><rect x="34" y="14" width="24" height="36" fill="#20bdef"/></svg>')}`;function Uw(t){for(const e of document.querySelectorAll('link[rel="icon"], link[rel="apple-touch-icon"]'))e.href=t}const Jq="ARGUS",$w="argus-audio",Qq=.4;let lr=!1;const eK={audio1:{file:"press",cue:"press"},audio2:{file:"arrive",cue:"ack"},audio3:{file:"retreat",cue:"close"},audio4:{file:"refuse",cue:"deny"}},Yx=new Set;function tK(){fetch("sounds/index.json").then(t=>t.ok?t.json():Promise.resolve(null)).then(t=>{const e=typeof t=="object"&&t!==null?t.files:void 0;if(Array.isArray(e))for(const s of e)typeof s=="string"&&Yx.add(s.replace(/\.[a-z0-9]+$/,""))}).catch(()=>{})}function Ii(t){if(lr)return;const e=eK[t];if(e!==void 0&&!Yx.has(e.file)){Ci.cue_play(e.cue);return}const s=document.getElementById(t);s instanceof HTMLAudioElement&&(s.currentTime=0,s.volume=Qq,s.play().catch(()=>{}))}function sK(){const t=Qe("head-menu-pill"),e=s=>{s?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,t.setAttribute("aria-expanded",String(s))};t.addEventListener("click",s=>{s.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",s=>{if(document.body.dataset.headMenu!=="open")return;s.target instanceof Element&&s.target.closest("#header-dag-info")!==null||e(!1)})}function iK(){const t=Qe("audio-pill");try{lr=window.localStorage.getItem($w)==="off"}catch{lr=!1}const e=()=>{t.classList.toggle("audio-off",lr),Ci.muted_set(lr)};e(),tK(),t.addEventListener("click",()=>{lr=!lr;try{window.localStorage.setItem($w,lr?"off":"on")}catch{}e(),Ii("audio2")})}function nK(){return bO(window.location)}let Cf=null,gd=0;function S_(t,e){const s=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(gd=Math.ceil(t.offsetTop+t.offsetHeight),e.style.setProperty("--zoom-header-height",`${gd}px`))};s(),Cf===null&&(Cf=new ResizeObserver(s),Cf.observe(t))}const jw=120,rK=96;function oK(t,e,s,i){let n="";const r=h=>{h?(n=t.style.height,t.style.height=""):n!==""&&(t.style.height=n),t.classList.toggle("drawer-closed",h),Ii("audio3"),h||(i.size_fit(),i.focus_take())};s.addEventListener("click",()=>r(!t.classList.contains("drawer-closed")));let o=0,a=0,l=!1;e.addEventListener("pointerdown",h=>{l=!0,o=h.clientY,a=t.getBoundingClientRect().height,t.classList.add("drawer-dragging"),e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{if(!l)return;const d=Math.max(jw,window.innerHeight-rK),u=a+(h.clientY-o),p=Math.min(Math.max(jw,u),d);t.style.height=`${p}px`,i.size_fit()});const c=()=>{l=!1,t.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function aK(t){const e=document.body,s=document.querySelector(".wrap:not(#gap)");let i;const n=r=>{for(const o of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))o.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,i!==void 0&&(e.dataset.header=i,i=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(i="away",delete e.dataset.header,gd>0&&e.style.setProperty("--zoom-header-height",`${gd}px`)):s!==null&&S_(s,e),e.dataset.zoom=r;const a=zh(r)?.mount?.parentElement??null;a?.classList.add("pane-zoomed");let l=a?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const o of document.querySelectorAll(".drawer-zoom"))o.textContent=r!==null&&o.dataset.pane===r?"RESTORE":"ZOOM";Ii("audio3")};return Qe("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&n(null)}),document.addEventListener("click",r=>{const o=r.target;if(!(o instanceof Element))return;const a=o.closest("[data-pane]");if(a===null)return;const l=a.dataset.pane??"";l!==""&&n(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(n(null),r.stopImmediatePropagation())}),Qe("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&t.size_fit()}),n}function lK(){const t=new Y$(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&t.telemetryPanel_bind(e),t}const Rf=96,cK=220,Hw="argus.headerBand.height",hK=52;function dK(){const t=document.documentElement,e=document.getElementById("header-strip"),s=document.querySelector(".wrap:not(#gap)");if(e===null||s===null)return;const i=h=>{const d=Math.max(Rf,window.innerHeight-cK),u=Math.min(Math.max(Rf,h),d);t.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(Hw,String(u))}catch{}},n=(()=>{try{return window.localStorage.getItem(Hw)}catch{return null}})();n!==null&&Number.isFinite(Number(n))&&i(Number(n));const r=()=>{const h=s.getBoundingClientRect();e.style.top=`${Math.max(0,h.bottom-hK)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let o=!1,a=0,l=0;e.addEventListener("pointerdown",h=>{const d=document.querySelector(".header-face");o=!0,a=h.clientY,l=d===null?Rf:d.getBoundingClientRect().height,e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{o&&(i(l+(h.clientY-a)),r())});const c=()=>{o=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let x_=null;function uK(t){const e=t.querySelector(".gather-rows");if(e===null)return;const s=Mi(e,{rows:".listing-row",label:i=>`+${i} MORE · ON STAGE`,press:()=>{x_?.()},className:"strategy-pill gather-more",mount:t});s.title="the whole cohort as a pane on the main panel"}function Vw(t){Mi(t,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function fK(){const t=e=>{for(const s of e.querySelectorAll(".mode-frame:not([data-more])"))Vw(s)};new MutationObserver(e=>{for(const s of e)for(const i of s.addedNodes)i instanceof HTMLElement&&(i.matches(".mode-frame")&&i.dataset.more===void 0&&Vw(i),t(i))}).observe(document.body,{childList:!0,subtree:!0}),t(document)}function qw(t){const e=t?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const s=new SpeechSynthesisUtterance(e);s.rate=1,window.speechSynthesis.speak(s)}function pK(){const t=document.body,e=document.querySelector(".wrap:not(#gap)"),s=r=>{t.dataset.header===r?(e!==null&&S_(e,t),t.dataset.header="away"):t.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>s("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>s("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>s("gather"));const i=document.querySelector(".header-gather-field");i?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),x_?.()}),i!==null&&uK(i),fK();const n=()=>{t.dataset.zoom===void 0&&(delete t.dataset.header,Ii("audio3"))};Qe("header-restore").addEventListener("click",n),window.addEventListener("keydown",r=>{r.key==="Escape"&&t.dataset.header==="away"&&t.dataset.zoom===void 0&&t.dataset.gutter!=="away"&&n()})}const Zo=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],Xx="argus-landing",mK=15e3;function Kw(){try{return(window.localStorage.getItem(Xx)??"launcher")==="launcher"}catch{return!0}}function gK(t){try{window.localStorage.setItem(Xx,t?"launcher":"last")}catch{}}const Yw="argus-theme",_K="argus-lcars",bK="medical",MK={sickbay:"medical"};function vK(){const t=Qe("theme-pill"),e=Math.max(Zo.findIndex(r=>r.key===bK),0);let s=e;try{const r=window.localStorage.getItem(Yw)??window.localStorage.getItem(_K),o=r===null?null:MK[r]??r,a=Zo.findIndex(l=>l.key===o);s=a>=0?a:e}catch{s=e}const i=document.documentElement,n=()=>{const r=Zo[s]??Zo[0];r.key==="lower-decks"?delete i.dataset.theme:i.dataset.theme=r.key,t.textContent=r.label};n(),t.addEventListener("click",()=>{s=(s+1)%Zo.length,n();try{window.localStorage.setItem(Yw,Zo[s]?.key??"lower-decks")}catch{}Ii("audio2")})}function wK(t){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const i={...Xk(t)==="chris"?{cumin:t.stack?.cumin,salsa:t.stack?.salsa,chili:t.stack?.chili}:{},brasa:t.stack?.brasa,calypso:t.stack?.calypso,chell:t.stack?.chell},n=[];for(const[r,o]of Object.entries(i))o!==void 0&&n.push([r.toUpperCase(),o]);n.push(["MENU","0.30.0"],["ARGUS","319788e2 · 2026-10-25 00:46Z"],["WIRE",`V${t.protocolVersion}`]),t.stack?.build!==void 0&&n.push(["BUILD",t.stack.build]);for(const[r,o]of n){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");l.className="telemetry-label",l.textContent=r;const c=document.createElement("span");c.className="telemetry-value",c.textContent=o,c.title=o,a.append(l,c),e.appendChild(a)}}function yK(){for(const t of document.querySelectorAll(".left-frame button, .left-frame-top button"))t.addEventListener("click",()=>Ii("audio2"))}let Jo=null;async function zK(t){let e=null;const s=await vO(t),i=s==="chris";document.body.dataset.composition=s;const n=new U$(document),r=i?k$(Qe("index-instrument"),{dag_primary:()=>At,dag_instances:()=>a.values("dag"),universes:()=>a.values("universe"),pacs:()=>A,runs_show:D=>N(D)}):{promptContext_take:()=>{},telemetry_take:()=>{},progress_take:()=>{}},o=new j$(Qe("lane-instrument"));window.setInterval(()=>o.tick(),500);const a=new s$;i&&m0(sj(()=>Z)),s==="stratus"&&m0(D$(()=>({...Z,controller_open:D=>Wi.open(D)})));const l=new B$;l.writeObserver_set((D,j)=>{gt.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:j,paneId:D.paneId}),Y()});const c={get layout(){return $},panels:a,paneInstance_get:zh,subjects:l,get dormant(){return oe},sound:Ii,get terminal(){return Ce},get client(){return gt}},h=fj(c,{catalogue_find:D=>T.get(D),run_press:(D,j,le)=>{he(D,j,le)}}),d=h.entry_show,u=D=>sg(D,t),p=Y5(c,{vfsUrl_build:u,downloadUrl_build:D=>wO(D,t),image_open:(D,j)=>k(D,j),process_open:(D,j)=>B(D,j),run_press:(D,j,le)=>{he(D,j,le)},cohort_gather:D=>ie(D),verbLine_run:(D,j)=>Et(D,j),askOnPane_await:(D,j)=>P(D,j),binEntry_show:d,catalogue_find:D=>T.get(D),promptUser:()=>M,template_stamp:qi,pane_find:Ks}),{previewProvider:f,fileText_fetch:_,file_save:g,rootedListing_show:m,listing_refresh:w,directory_make:y,files_deliver:b,filesBody_stamp:v,rowVerbs_build:z}=p,x=p.instance_build;let M=null,S=null;const T=new Map,{imageInstance_build:I,tagsInstance_build:E,tagsPane_follow:O,tagsPane_open:R,series_ask:C,image_open:k}=y$({client:()=>gt,terminal:()=>Ce,panels:()=>a,subjects:()=>l,layout:()=>$,desktop:()=>re,instance_spawn:(D,j)=>Ie(D,j),errandHost_find:()=>V(),launcher_yield:()=>_e(),birth_record:(D,j,le,xe,Ge)=>ge(D,j,le,xe,Ge),vfsUrl_build:D=>u(D)}),B=(D,j)=>{_e();const le=new Set($.panes_shown());for(const[ft,li]of T)if(le.has(ft)&&li.input===j.input){$.focus_set(ft);return}const xe=le.has(D)?D:V()??D,Ge=Ie("catalogue",D);if(!$.leaf_split(xe,re.replayPlace_get()?.dir??"col",Ge.id,re.replayPlace_get()?.before??!1)){As(Ge.id),$.mount_remove(Ge.id);return}ge(Ge.id,xe,re.replayPlace_get()?.dir??"col",re.replayPlace_get()?.before??!1),T.set(Ge.id,j);const mt=a.get("files",Ge.id);mt!==void 0&&(mt.binding_set({input:j.input,place:j.feed===null?"new feed":`feed ${j.feed}${j.node===null?"":` · node ${j.node}`}`}),mt.feedOpen_declare(ft=>X(Ge.id,ft)),m(Ge.id,mt,"/bin"),ee(mt),$.focus_set(Ge.id))},L=5,F=40,ee=D=>{gt.line_execute(`plugininstance list --limit ${F} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(le=>{const xe=[];for(const Ge of le.envelopes)if(!(Ge.model?.kind!=="plugininstance.list"||!Array.isArray(Ge.model.data)))for(const mt of Ge.model.data){if(typeof mt.pluginName!="string"||typeof mt.pluginVersion!="string"||M!==null&&typeof mt.owner=="string"&&mt.owner!==M||mt.pluginName==="pl-dircopy")continue;const ft=`${mt.pluginName}-v${mt.pluginVersion}`;if(xe.includes(ft)||xe.push(ft),xe.length>=L)break}D.recent_set(xe.length===0?null:xe)}).catch(()=>{})},X=(D,j)=>{_e();const le=new Set($.panes_shown());for(const[mt,ft]of a.entries("dag"))if(mt!=="dag"&&le.has(mt)&&ft.feed_get()===j){$.focus_set(mt);return}const xe=le.has(D)?D:V()??D,Ge=Ie("dag",D);if(!$.leaf_split(xe,re.replayPlace_get()?.dir??"col",Ge.id,re.replayPlace_get()?.before??!1)){As(Ge.id),$.mount_remove(Ge.id);return}ge(Ge.id,xe,re.replayPlace_get()?.dir??"col",re.replayPlace_get()?.before??!1),a.get("dag",Ge.id)?.feed_enter(j)},he=async(D,j,le)=>{const xe=T.get(D),Ge=a.get("files",D);if(xe===void 0||Ge===void 0)return;const mt=$s=>{Ce.output_write("err",`\x1B[31m${$s}\x1B[0m
|
|
4390
|
+
`))}offer(e){this.terminalId!==null&&this.wire.input(this.terminalId,`${e}`),this.focus()}buffer_lines(){const e=this.term.buffer.active,s=[];for(let i=0;i<e.length;i++){const n=e.getLine(i),r=n?.translateToString(!0)??"";n?.isWrapped===!0&&s.length>0?s[s.length-1]+=r:s.push(r)}for(;s.length>0&&s[s.length-1]==="";)s.pop();return s}mark(){return this.feeds}lines_since(e){const s=this.buffer_lines(),i=Math.max(0,this.feeds-e)+1;return s.slice(Math.max(0,s.length-i))}type(e){this.keys_send(e)}dispose(){this.observer?.disconnect(),this.term.dispose()}keys_send(e){if(this.ended){this.ended=!1,this.term.reset(),this.wire.open(this.term.cols,this.term.rows);return}if(this.terminalId===null)return;let s=e;this.ctrlHeld&&(s=Lq(e),this.ctrlHeld=!1,this.mount.querySelector(".argus-xterm-key.held")?.classList.remove("held")),this.wire.input(this.terminalId,s)}keyRow_build(){const e=document.createElement("div");e.className="argus-xterm-keys";for(const s of Gq){const i=document.createElement("button");i.type="button",i.className="argus-xterm-key",i.textContent=s.label,i.addEventListener("pointerdown",n=>{n.preventDefault(),s.data==="ctrl"?(this.ctrlHeld=!this.ctrlHeld,i.classList.toggle("held",this.ctrlHeld)):this.keys_send(s.data),this.focus()}),e.appendChild(i)}this.mount.appendChild(e)}}const Uq="argus.consoleMode",$q="console: the transcript, deprecated: this host offers no pseudo-terminal (node-pty did not build). Install python, make and g++ and reinstall for the terminal console.";function jq(){try{localStorage.removeItem(Uq)}catch{}}function Hq(t){const{client:e,terminal:s,offered:i}=t,n=document.getElementById("terminal");let r=null,o="transcript";const a=l=>{if(n!==null)if(l==="terminal"&&i){if(n.classList.add("console-terminal"),r===null){const h=document.createElement("div");h.className="argus-terminal-mount",n.appendChild(h),r=new Fq(h,{open:(d,u,p)=>e.terminal_open(d,u,p),input:(d,u)=>e.terminal_input(d,u),resize:(d,u,p)=>e.terminal_resize(d,u,p)},d=>{a("transcript"),s.line_note(`console: ${d}`)},d=>{n.dataset.terminalState=d}),n.dataset.terminalState="busy",t.screen_set(r)}const c=r;e.mirror_set(!0),s.delegate_set({note:h=>e.note_send(h),offer:h=>c.offer(h),focus:()=>c.focus(),fit:()=>c.size_fit()}),c.size_fit(),o="terminal"}else n.classList.remove("console-terminal"),e.mirror_set(!1),s.delegate_set(null),o="transcript"};return jq(),a(i?"terminal":"transcript"),i||s.line_note($q),Object.assign(globalThis,{__argusConsole:{mode:()=>o,state:()=>n?.dataset.terminalState??"busy",type:l=>r?.type(l),lines:()=>r?.buffer_lines()??[],mark:()=>r?.mark()??0,since:l=>r?.lines_since(l)??[]}}),{terminal_is:()=>o==="terminal",question_sheet:async l=>{document.querySelector(".question-sheet")?.remove();const c=document.createElement("div");c.className="share-sheet question-sheet",c.setAttribute("role","dialog");const h=document.createElement("div");h.className="share-head",h.textContent="THE SESSION ASKS",c.appendChild(h),document.body.appendChild(c);try{return await a_(s,c,l)}finally{c.remove()}}}}const Vq=new Set(["busy","asking","playing"]);function qq(t,e=()=>null){const s=document.querySelector(".console-stop"),i=document.getElementById("terminal");if(s===null||i===null)return;const n=()=>{const o=i.classList.contains("console-terminal")?Vq.has(i.dataset.terminalState??""):i.dataset.busy==="true";s.hidden=!o};new MutationObserver(n).observe(i,{attributes:!0,attributeFilter:["data-busy","data-terminal-state","class"]}),n(),s.addEventListener("click",()=>{const r=i.classList.contains("console-terminal")?e():null;r!==null&&t.terminal_input(r,""),t.stop_send()})}let Xr=()=>{};function Fw(){Xr(document.body.dataset.zoom==="console"?null:"console")}const Kq=mO(),Yq=_O(),Xq=new URL("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNDAgMjkwIj4KPGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjQwIiB5MT0iMCIgeDI9IjIwMCIgeTI9IjIyNCI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjMmE2M2JmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2FkM2YxIi8+PC9saW5lYXJHcmFkaWVudD4KPHJhZGlhbEdyYWRpZW50IGlkPSJoIj48c3RvcC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="64" fill="#000"/><rect x="6" y="14" width="52" height="36" rx="18" fill="#20bdef"/><rect x="34" y="14" width="24" height="36" fill="#20bdef"/></svg>')}`;function Uw(t){for(const e of document.querySelectorAll('link[rel="icon"], link[rel="apple-touch-icon"]'))e.href=t}const Jq="ARGUS",$w="argus-audio",Qq=.4;let lr=!1;const eK={audio1:{file:"press",cue:"press"},audio2:{file:"arrive",cue:"ack"},audio3:{file:"retreat",cue:"close"},audio4:{file:"refuse",cue:"deny"}},Yx=new Set;function tK(){fetch("sounds/index.json").then(t=>t.ok?t.json():Promise.resolve(null)).then(t=>{const e=typeof t=="object"&&t!==null?t.files:void 0;if(Array.isArray(e))for(const s of e)typeof s=="string"&&Yx.add(s.replace(/\.[a-z0-9]+$/,""))}).catch(()=>{})}function Ii(t){if(lr)return;const e=eK[t];if(e!==void 0&&!Yx.has(e.file)){Ci.cue_play(e.cue);return}const s=document.getElementById(t);s instanceof HTMLAudioElement&&(s.currentTime=0,s.volume=Qq,s.play().catch(()=>{}))}function sK(){const t=Qe("head-menu-pill"),e=s=>{s?document.body.dataset.headMenu="open":delete document.body.dataset.headMenu,t.setAttribute("aria-expanded",String(s))};t.addEventListener("click",s=>{s.stopPropagation(),e(document.body.dataset.headMenu!=="open")}),document.addEventListener("click",s=>{if(document.body.dataset.headMenu!=="open")return;s.target instanceof Element&&s.target.closest("#header-dag-info")!==null||e(!1)})}function iK(){const t=Qe("audio-pill");try{lr=window.localStorage.getItem($w)==="off"}catch{lr=!1}const e=()=>{t.classList.toggle("audio-off",lr),Ci.muted_set(lr)};e(),tK(),t.addEventListener("click",()=>{lr=!lr;try{window.localStorage.setItem($w,lr?"off":"on")}catch{}e(),Ii("audio2")})}function nK(){return bO(window.location)}let Cf=null,gd=0;function S_(t,e){const s=()=>{e.dataset.zoom!==void 0||e.dataset.header==="away"||(gd=Math.ceil(t.offsetTop+t.offsetHeight),e.style.setProperty("--zoom-header-height",`${gd}px`))};s(),Cf===null&&(Cf=new ResizeObserver(s),Cf.observe(t))}const jw=120,rK=96;function oK(t,e,s,i){let n="";const r=h=>{h?(n=t.style.height,t.style.height=""):n!==""&&(t.style.height=n),t.classList.toggle("drawer-closed",h),Ii("audio3"),h||(i.size_fit(),i.focus_take())};s.addEventListener("click",()=>r(!t.classList.contains("drawer-closed")));let o=0,a=0,l=!1;e.addEventListener("pointerdown",h=>{l=!0,o=h.clientY,a=t.getBoundingClientRect().height,t.classList.add("drawer-dragging"),e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{if(!l)return;const d=Math.max(jw,window.innerHeight-rK),u=a+(h.clientY-o),p=Math.min(Math.max(jw,u),d);t.style.height=`${p}px`,i.size_fit()});const c=()=>{l=!1,t.classList.remove("drawer-dragging")};return e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c),r}function aK(t){const e=document.body,s=document.querySelector(".wrap:not(#gap)");let i;const n=r=>{for(const o of document.querySelectorAll(".pane-zoomed, .pane-zoomed-path"))o.classList.remove("pane-zoomed","pane-zoomed-path");if(r===null)delete e.dataset.zoom,i!==void 0&&(e.dataset.header=i,i=void 0);else{window.scrollTo(0,0),e.dataset.header==="away"?(i="away",delete e.dataset.header,gd>0&&e.style.setProperty("--zoom-header-height",`${gd}px`)):s!==null&&S_(s,e),e.dataset.zoom=r;const a=zh(r)?.mount?.parentElement??null;a?.classList.add("pane-zoomed");let l=a?.parentElement??null;for(;l!==null&&l.id!=="layout-root";)l.classList.add("pane-zoomed-path"),l=l.parentElement}for(const o of document.querySelectorAll(".drawer-zoom"))o.textContent=r!==null&&o.dataset.pane===r?"RESTORE":"ZOOM";Ii("audio3")};return Qe("header-restore").addEventListener("click",()=>{e.dataset.zoom!==void 0&&n(null)}),document.addEventListener("click",r=>{const o=r.target;if(!(o instanceof Element))return;const a=o.closest("[data-pane]");if(a===null)return;const l=a.dataset.pane??"";l!==""&&n(e.dataset.zoom===l?null:l)}),window.addEventListener("keydown",r=>{r.key==="Escape"&&e.dataset.zoom!==void 0&&(n(null),r.stopImmediatePropagation())}),Qe("drawer").addEventListener("transitionend",r=>{r.propertyName==="height"&&t.size_fit()}),n}function lK(){const t=new Y$(document.getElementById("data-cascade")),e=document.getElementById("header-telemetry");return e!==null&&t.telemetryPanel_bind(e),t}const Rf=96,cK=220,Hw="argus.headerBand.height",hK=52;function dK(){const t=document.documentElement,e=document.getElementById("header-strip"),s=document.querySelector(".wrap:not(#gap)");if(e===null||s===null)return;const i=h=>{const d=Math.max(Rf,window.innerHeight-cK),u=Math.min(Math.max(Rf,h),d);t.style.setProperty("--header-band-h",`${u}px`);try{window.localStorage.setItem(Hw,String(u))}catch{}},n=(()=>{try{return window.localStorage.getItem(Hw)}catch{return null}})();n!==null&&Number.isFinite(Number(n))&&i(Number(n));const r=()=>{const h=s.getBoundingClientRect();e.style.top=`${Math.max(0,h.bottom-hK)}px`};r(),window.addEventListener("resize",r),new MutationObserver(r).observe(document.body,{attributes:!0,attributeFilter:["data-header"]}),window.setInterval(r,500);let o=!1,a=0,l=0;e.addEventListener("pointerdown",h=>{const d=document.querySelector(".header-face");o=!0,a=h.clientY,l=d===null?Rf:d.getBoundingClientRect().height,e.setPointerCapture(h.pointerId),h.preventDefault()}),e.addEventListener("pointermove",h=>{o&&(i(l+(h.clientY-a)),r())});const c=()=>{o=!1,r()};e.addEventListener("pointerup",c),e.addEventListener("pointercancel",c)}let x_=null;function uK(t){const e=t.querySelector(".gather-rows");if(e===null)return;const s=Mi(e,{rows:".listing-row",label:i=>`+${i} MORE · ON STAGE`,press:()=>{x_?.()},className:"strategy-pill gather-more",mount:t});s.title="the whole cohort as a pane on the main panel"}function Vw(t){Mi(t,{rows:".strategy-pill, .listing-action, .holder-mark",className:"frame-more"})}function fK(){const t=e=>{for(const s of e.querySelectorAll(".mode-frame:not([data-more])"))Vw(s)};new MutationObserver(e=>{for(const s of e)for(const i of s.addedNodes)i instanceof HTMLElement&&(i.matches(".mode-frame")&&i.dataset.more===void 0&&Vw(i),t(i))}).observe(document.body,{childList:!0,subtree:!0}),t(document)}function qw(t){const e=t?.text;if(typeof e!="string"||e.length===0||typeof window.speechSynthesis>"u")return;const s=new SpeechSynthesisUtterance(e);s.rate=1,window.speechSynthesis.speak(s)}function pK(){const t=document.body,e=document.querySelector(".wrap:not(#gap)"),s=r=>{t.dataset.header===r?(e!==null&&S_(e,t),t.dataset.header="away"):t.dataset.header=r};document.querySelector(".panel-1")?.addEventListener("click",()=>s("stats")),document.querySelector(".panel-2")?.addEventListener("click",()=>s("dag")),document.querySelector(".panel-gather")?.addEventListener("click",()=>s("gather"));const i=document.querySelector(".header-gather-field");i?.querySelector(".gather-stage")?.addEventListener("click",r=>{r.stopPropagation(),x_?.()}),i!==null&&uK(i),fK();const n=()=>{t.dataset.zoom===void 0&&(delete t.dataset.header,Ii("audio3"))};Qe("header-restore").addEventListener("click",n),window.addEventListener("keydown",r=>{r.key==="Escape"&&t.dataset.header==="away"&&t.dataset.zoom===void 0&&t.dataset.gutter!=="away"&&n()})}const Zo=[{key:"lower-decks",label:"LOWER DECKS"},{key:"gold",label:"CERRITOS GOLD"},{key:"medical",label:"MEDICAL"},{key:"nemesis",label:"NEMESIS"},{key:"pharos",label:"PHAROS"}],Xx="argus-landing",mK=15e3;function Kw(){try{return(window.localStorage.getItem(Xx)??"launcher")==="launcher"}catch{return!0}}function gK(t){try{window.localStorage.setItem(Xx,t?"launcher":"last")}catch{}}const Yw="argus-theme",_K="argus-lcars",bK="medical",MK={sickbay:"medical"};function vK(){const t=Qe("theme-pill"),e=Math.max(Zo.findIndex(r=>r.key===bK),0);let s=e;try{const r=window.localStorage.getItem(Yw)??window.localStorage.getItem(_K),o=r===null?null:MK[r]??r,a=Zo.findIndex(l=>l.key===o);s=a>=0?a:e}catch{s=e}const i=document.documentElement,n=()=>{const r=Zo[s]??Zo[0];r.key==="lower-decks"?delete i.dataset.theme:i.dataset.theme=r.key,t.textContent=r.label};n(),t.addEventListener("click",()=>{s=(s+1)%Zo.length,n();try{window.localStorage.setItem(Yw,Zo[s]?.key??"lower-decks")}catch{}Ii("audio2")})}function wK(t){const e=document.getElementById("about-rows");if(e===null)return;e.replaceChildren();const i={...Xk(t)==="chris"?{cumin:t.stack?.cumin,salsa:t.stack?.salsa,chili:t.stack?.chili}:{},brasa:t.stack?.brasa,calypso:t.stack?.calypso,chell:t.stack?.chell},n=[];for(const[r,o]of Object.entries(i))o!==void 0&&n.push([r.toUpperCase(),o]);n.push(["MENU","0.30.0"],["ARGUS","79ee8a07 · 2026-10-25 02:44Z"],["WIRE",`V${t.protocolVersion}`]),t.stack?.build!==void 0&&n.push(["BUILD",t.stack.build]);for(const[r,o]of n){const a=document.createElement("div");a.className="telemetry-row";const l=document.createElement("span");l.className="telemetry-label",l.textContent=r;const c=document.createElement("span");c.className="telemetry-value",c.textContent=o,c.title=o,a.append(l,c),e.appendChild(a)}}function yK(){for(const t of document.querySelectorAll(".left-frame button, .left-frame-top button"))t.addEventListener("click",()=>Ii("audio2"))}let Jo=null;async function zK(t){let e=null;const s=await vO(t),i=s==="chris";document.body.dataset.composition=s;const n=new U$(document),r=i?k$(Qe("index-instrument"),{dag_primary:()=>At,dag_instances:()=>a.values("dag"),universes:()=>a.values("universe"),pacs:()=>A,runs_show:D=>N(D)}):{promptContext_take:()=>{},telemetry_take:()=>{},progress_take:()=>{}},o=new j$(Qe("lane-instrument"));window.setInterval(()=>o.tick(),500);const a=new s$;i&&m0(sj(()=>Z)),s==="stratus"&&m0(D$(()=>({...Z,controller_open:D=>Wi.open(D)})));const l=new B$;l.writeObserver_set((D,j)=>{gt.regard_send({address:D.address,...D.modelKind!==void 0?{modelKind:D.modelKind}:{},groupId:j,paneId:D.paneId}),Y()});const c={get layout(){return $},panels:a,paneInstance_get:zh,subjects:l,get dormant(){return oe},sound:Ii,get terminal(){return Ce},get client(){return gt}},h=fj(c,{catalogue_find:D=>T.get(D),run_press:(D,j,le)=>{he(D,j,le)}}),d=h.entry_show,u=D=>sg(D,t),p=Y5(c,{vfsUrl_build:u,downloadUrl_build:D=>wO(D,t),image_open:(D,j)=>k(D,j),process_open:(D,j)=>B(D,j),run_press:(D,j,le)=>{he(D,j,le)},cohort_gather:D=>ie(D),verbLine_run:(D,j)=>Et(D,j),askOnPane_await:(D,j)=>P(D,j),binEntry_show:d,catalogue_find:D=>T.get(D),promptUser:()=>M,template_stamp:qi,pane_find:Ks}),{previewProvider:f,fileText_fetch:_,file_save:g,rootedListing_show:m,listing_refresh:w,directory_make:y,files_deliver:b,filesBody_stamp:v,rowVerbs_build:z}=p,x=p.instance_build;let M=null,S=null;const T=new Map,{imageInstance_build:I,tagsInstance_build:E,tagsPane_follow:O,tagsPane_open:R,series_ask:C,image_open:k}=y$({client:()=>gt,terminal:()=>Ce,panels:()=>a,subjects:()=>l,layout:()=>$,desktop:()=>re,instance_spawn:(D,j)=>Ie(D,j),errandHost_find:()=>V(),launcher_yield:()=>_e(),birth_record:(D,j,le,xe,Ge)=>ge(D,j,le,xe,Ge),vfsUrl_build:D=>u(D)}),B=(D,j)=>{_e();const le=new Set($.panes_shown());for(const[ft,li]of T)if(le.has(ft)&&li.input===j.input){$.focus_set(ft);return}const xe=le.has(D)?D:V()??D,Ge=Ie("catalogue",D);if(!$.leaf_split(xe,re.replayPlace_get()?.dir??"col",Ge.id,re.replayPlace_get()?.before??!1)){As(Ge.id),$.mount_remove(Ge.id);return}ge(Ge.id,xe,re.replayPlace_get()?.dir??"col",re.replayPlace_get()?.before??!1),T.set(Ge.id,j);const mt=a.get("files",Ge.id);mt!==void 0&&(mt.binding_set({input:j.input,place:j.feed===null?"new feed":`feed ${j.feed}${j.node===null?"":` · node ${j.node}`}`}),mt.feedOpen_declare(ft=>X(Ge.id,ft)),m(Ge.id,mt,"/bin"),ee(mt),$.focus_set(Ge.id))},L=5,F=40,ee=D=>{gt.line_execute(`plugininstance list --limit ${F} --fields id,plugin_name,plugin_version,owner_username`,{silent:!0,observe:!1}).then(le=>{const xe=[];for(const Ge of le.envelopes)if(!(Ge.model?.kind!=="plugininstance.list"||!Array.isArray(Ge.model.data)))for(const mt of Ge.model.data){if(typeof mt.pluginName!="string"||typeof mt.pluginVersion!="string"||M!==null&&typeof mt.owner=="string"&&mt.owner!==M||mt.pluginName==="pl-dircopy")continue;const ft=`${mt.pluginName}-v${mt.pluginVersion}`;if(xe.includes(ft)||xe.push(ft),xe.length>=L)break}D.recent_set(xe.length===0?null:xe)}).catch(()=>{})},X=(D,j)=>{_e();const le=new Set($.panes_shown());for(const[mt,ft]of a.entries("dag"))if(mt!=="dag"&&le.has(mt)&&ft.feed_get()===j){$.focus_set(mt);return}const xe=le.has(D)?D:V()??D,Ge=Ie("dag",D);if(!$.leaf_split(xe,re.replayPlace_get()?.dir??"col",Ge.id,re.replayPlace_get()?.before??!1)){As(Ge.id),$.mount_remove(Ge.id);return}ge(Ge.id,xe,re.replayPlace_get()?.dir??"col",re.replayPlace_get()?.before??!1),a.get("dag",Ge.id)?.feed_enter(j)},he=async(D,j,le)=>{const xe=T.get(D),Ge=a.get("files",D);if(xe===void 0||Ge===void 0)return;const mt=$s=>{Ce.output_write("err",`\x1B[31m${$s}\x1B[0m
|
|
4391
4391
|
`);const Yd=Ge.indicated_get();Yd!==null&&Ge.rowReadout_show(Yd,$s.toUpperCase().slice(0,80))};if(le==="pipeline"&&xe.node===null){mt(`${j}: a pipeline runs on a node — PROCESS a node of a feed`);return}let ft=Ge.commandLine_get();if((ft===""||eS(ft)!==j)&&(ft=Zz(xe.input,j)),xe.feed===null&&!SB(ft)){const $s=xe.input.split("/").filter(Boolean).pop()??"feed",R_=(await P(D,{message:"Feed title: ",kind:"text",suggest:$s,commit:"RUN"})??"").trim();if(R_==="")return;ft=xB(ft,R_)}Ge.commandLine_set(ft),Ce.line_echo(ft);let li;try{li=await gt.line_execute(ft,{silent:!0})}catch($s){mt($s instanceof Error?$s.message:String($s));return}Ce.outcome_write(li),li.envelopes.some($s=>$s.model?.kind==="fs.cwd")&>.line_execute("ls",{silent:!0});const tc=li.envelopes.find($s=>$s.model?.kind==="run.scheduled"||$s.model?.kind==="pipeline.scheduled")?.model?.data;if(typeof tc?.feedId=="number"){Ge.run_show(tc.feedId);return}const D_=li.envelopes.map($s=>$s.renderedErr??"").join(" ").replace(/\x1b\[[0-9;]*m/g,"").trim().split(`
|
|
4392
4392
|
`)[0]??"",C_=Ge.indicated_get();C_!==null&&Ge.rowReadout_show(C_,D_===""?"NOT SCHEDULED":D_.toUpperCase().slice(0,80))},Oe=D=>{_e();const j=new Set($.panes_shown());for(const[ft]of a.entries("files"))if(j.has(ft)&&l.regard_get(ft)?.address===D){$.focus_set(ft);return}let le;for(const[ft,li]of a.entries("image"))if(j.has(ft)&&(l.regard_get(ft)?.address===D||li.state_get()?.path===D)){le=ft;break}const xe=V();if(xe===null)return;const Ge=Ie("files",le);if(!$.leaf_split(xe,re.replayPlace_get()?.dir??"col",Ge.id,re.replayPlace_get()?.before??!1)){As(Ge.id),$.mount_remove(Ge.id);return}ge(Ge.id,xe,re.replayPlace_get()?.dir??"col",re.replayPlace_get()?.before??!1),le===void 0&&l.regard_write(Ge.id,{address:D,modelKind:"dicom.series"});const mt=a.get("files",Ge.id);mt!==void 0&&m(Ge.id,mt,D)},De=vj(c,{image_open:(D,j)=>k(D,j),process_open:(D,j)=>B(D,j),feed_open:(D,j)=>X(D,j),askOnPane_await:(D,j)=>P(D,j),errandHost_find:()=>V(),instance_spawn:(D,j)=>Ie(D,j),birth_record:(D,j,le,xe)=>ge(D,j,le,xe),replayPlace_get:()=>re.replayPlace_get(),stage_relight:()=>Y(),home_apply:()=>Ue(),orphans_dispose:()=>we(),template_stamp:qi,pane_find:Ks,element_require:Qe}),ke=De.instance_build,ie=De.gather,ae=De.open,fe=D=>{const j=qi("tpl-pane-view");Mi(Ks(j,".view-body"));const le=new N$(Ks(j,".view-body"),Ks(j,".view-title"),{content_fetch:async xe=>(await _(xe)).text,imageUrl_build:u,path_isImage:Od});return a.set("view",D,le),{id:D,kind:"view",mount:j,dispose:()=>{a.delete(D),l.pane_leave(D)}}},Fe=pj(c,{filesBody_stamp:v,rootedListing_show:m,rowVerbs_build:z,image_open:(D,j)=>k(D,j),imagery_is:S1,tableFile_is:D=>z1.test(D),vfsUrl_build:u,fileText_fetch:_,previewProvider:f}),Ze=Fe.open;Fe.close;const Ve=N5(c,{askOnPane_await:(D,j)=>P(D,j),promptUser:()=>M,changed:()=>{for(const D of a.values("dag"))D.roster_ask(),D.marks_refresh(),D.indicated_refresh()}}),yt=J5({client:()=>gt,terminal:()=>Ce,panels:()=>a,subjects:()=>l,context:()=>c,feedVerbs:()=>Ve,nodeOverlay:()=>Fe,nodeOverlay_open:(D,j)=>Ze(D,j),process_open:(D,j)=>B(D,j),promptUser:()=>M,runs_show:()=>N(),dag_primary:()=>At,binEntry_show:(D,j,le,xe)=>d(D,j,le,xe),dag_summon:()=>$e()}),Ne=x("files",!0);Yc(Ne);const wt=z$({panes:yt,dicom:{imageInstance_build:I,tagsInstance_build:E},gather_build:ke,pacsMount:Qe("pacs-workspace")}),ut=i?wt:{primaries:[],domains:[],presets:[],factories:[]};for(const D of ut.primaries)Yc(D);for(const D of ut.domains)Q5(D);const ct=qi("tpl-pane-launcher");Yc({id:"launcher",kind:"launcher",mount:ct});const Pt=qi("tpl-pane-panes");Yc({id:"panes",kind:"panes",mount:Pt});const ts=a.get("files","files"),At=a.get("dag","dag"),ns=new J$(Qe("pipeline-cycler"),Qe("pipeline-cycler-name"),D=>{gt.line_execute(D,{silent:!0})});let Nt=null;const $t=mj(c,{instance_spawn:(D,j)=>Ie(D,j),birth_record:(D,j,le,xe)=>ge(D,j,le,xe),replayPlace_get:()=>re.replayPlace_get(),rootedListing_show:m,console_expose:()=>Nt?.(!1),questionSheet_ask:D=>e!==null&&e.terminal_is()?e.question_sheet(D):null}),{errandHost_find:V,errand_open:Cs,verbLine_run:Et,askOnPane_await:P}=$t;Mi(Qe("pacs-workspace"),{rows:".listing-row"});const A=new BB(Qe("pacs-workspace"),{command_run:D=>{const j=/^(pacs query|pull )/.test(D);j&&Ce.line_echo(D),gt.line_execute(D,{silent:!0,operator:j}).then(le=>{for(const xe of le.envelopes)A.envelope_observe(xe)})},command_show:D=>{Ce.line_run(D)},note:D=>Ce.line_note(D),image_open:D=>{k(null,D).then(j=>Ce.line_note(j))},dir_open:D=>Oe(D),process_open:D=>B("pacs",{input:D,feed:null,node:null}),gather_add:D=>ie([D]),gathered_is:D=>De.has(D),workspace_close:()=>Ue()}),Y=()=>{const D=new Set($.panes_shown()),j=new Map;for(const le of Sh()){if(!D.has(le.id))continue;const xe=l.regard_get(le.id)?.address;if(xe===void 0)continue;const Ge=te(le.id);if(Ge!=="image"&&Ge!=="files")continue;const mt=xe.replace(/\/$/,""),ft=j.get(mt)??{viewer:!1,browser:!1};Ge==="image"?ft.viewer=!0:ft.browser=!0,j.set(mt,ft)}A.stage_lit(j)},$=new ij(Qe("layout-root"),new Map([...ut.primaries.map(D=>[D.id,D.mount]),["files",Ne.mount],["launcher",ct],["panes",Pt]]));let ne=!1;const me=()=>ne?{dir:"col",ratio:.45,first:{pane:"files"},second:{pane:"dag"}}:{pane:"files"};$.preset_register("files",me);for(const[D,j]of ut.presets)$.preset_register(D,j);$.preset_register("panes",()=>({pane:"panes"})),$.preset_register("launcher",()=>({pane:"launcher"})),$.renderObserver_set(()=>{document.body.dataset.zoom==="launcher"&&!$.panes_shown().includes("launcher")&&Xr(null),window.requestAnimationFrame(()=>{for(const D of a.values("dag"))D.size_fit()})});const ve=(D,j,le,xe)=>{const Ge=j==="view"?Ie("view",D):j==="fs"?Ie("files",D):Ie("empty");if(!$.leaf_split(D,le,Ge.id,xe))return As(Ge.id),$.mount_remove(Ge.id),null;if(ge(Ge.id,D,le,xe,j),j==="fs"){const mt=li=>{const Kd=a.get("files",Ge.id);if(Kd===void 0)return;const tc=li.modelKind==="fs.file"?li.address.replace(/\/[^/]*$/,"")||"/":li.address;m(Ge.id,Kd,tc)};l.regard_subscribe(Ge.id,mt);const ft=l.regard_get(D);ft!==null&&mt(ft)}return Ge.id},oe=new sO(Xw,Zw());Object.assign(globalThis,{__argusDormant:{list:()=>oe.list(),get:D=>oe.get(D),dismiss:D=>oe.dismiss(D)}});const re=aj(c,{image_open:k,dir_open:Oe,process_open:B,gather_open:ae,feed_open:X,edit_open:D=>Ra.edit_open(D),pillPane_spawn:ve,pacsQuery_get:()=>A.query_get(),catalogue_find:D=>T.get(D),catalogueIds:()=>[...T.keys()],stage_relight:()=>Y()}),{birth_record:ge,domain_enter:Pe,orphans_dispose:we}=re,ye=re.capture,Ye=re.restore,Ue=()=>{Pe("files"),At.size_fit()},it=()=>{Pe("launcher"),Ee.render(),$.focus_set("launcher"),Xr("launcher")},H=(D=!1)=>{if(document.body.dataset.zoom!=="launcher"||(Xr(null),!D))return;const j=document.querySelector(".wrap:not(#gap)");j!==null&&S_(j,document.body),document.body.dataset.header="away",Nt?.(!0)},_e=()=>{H(),$.activePreset_get()==="launcher"&&(ne=!1,Ue())};let de=!1;const ze=vB({ask:D=>gt.line_execute(D,{silent:!0,observe:!1}),home_open:()=>{ne=!1,Ue(),$.focus_set("files")},home_cd:D=>{ne=!1,Ue(),Ce.line_run(`cd "${D}"`)},desktops:()=>oe.list(),desktop_restore:D=>{Ye(D)},panes_open:()=>{Pe("panes"),pe.render(),$.focus_set("panes")},keys_open:()=>{Lr()},notes_open:()=>{So.open()},notes_latest:()=>So.latest(),daemon_stale:()=>de,console_open:()=>Qe("gutter-console").click(),...i?{contribution:S$({ask:D=>gt.line_execute(D,{silent:!0,observe:!1}),universe_show:()=>K(),runs_show:D=>N(D),feed_enter:D=>{N(),a.get("dag","dag")?.feed_enter(D)},line_offer:D=>Ce.line_offer(D),pacs_query:()=>A.query_get()??"",pacs_open:()=>{Pe("pacs"),$.focus_set("pacs")}})}:{},...s!=="stratus"?{}:{contribution:T$({ask:D=>gt.line_execute(D,{silent:!0,observe:!1}),domain_open:D=>{Wi.open(D)},home_open:()=>{ne=!1,Ue(),$.focus_set("files")},line_run:D=>{Qe("gutter-console").click(),Ce.line_run(D)},names_seen:D=>Ca(D)})}}),Ee=new tB(ct,{tiles:ze,leave:()=>H(!0),startHere_get:Kw,startHere_set:gK});setInterval(()=>{$.activePreset_get()==="launcher"&&(!ct.isConnected||document.visibilityState!=="visible"||Ee.render())},mK),Mi(Ks(Pt,".panes-body"),{rows:".panes-card"});const pe=new hO(Pt,{list:()=>oe.list(),restore:D=>{Ye(D)},dismiss:D=>{oe.dismiss(D)}}),$e=()=>{const D=$.activePreset_get();if(D==="pacs"||D==="dag"||D==="launcher"){ne=!0;return}ne&&D==="files"||(ne=!0,Ue())},Ie=(D,j)=>{const le=t$(D);return l.pane_join(le.id,j!==void 0?l.group_resolve(j):le.id),D==="tags"&&l.regard_subscribe(le.id,xe=>{xe.modelKind==="dicom.instance"&&O(le.id,xe.address)}),D==="view"&&(l.viewer_mark(le.id),l.regard_subscribe(le.id,xe=>{xe.modelKind!=="dicom.instance"&&a.get("view",le.id)?.regard_show(xe)})),$.mount_register(le.id,le.mount),Br(le.id,D,le.mount),le},{bar_note:jt,move:It,flip:oi,resize:ai,chordKeys_format:qd}=rj(c),Br=AH(c,{verbs:{move:It,chordKeys_format:qd},browser:p,pillPane_spawn:ve,process_open:(D,j)=>B(D,j),overlay_back:D=>Fe.back(D),home_apply:()=>Ue(),orphans_dispose:()=>we(),dag_dismiss:()=>{ne=!1}});Br("files","files",Ne.mount);for(const D of ut.primaries)Br(D.id,D.kind,D.mount);Br("launcher","launcher",ct),Br("panes","panes",Pt);let Gr=!1;const Pi=D=>{Gr=D};for(const D of["click","focusin"])document.addEventListener(D,j=>{j.target instanceof Element&&(j.target.closest("#drawer")!==null?Gr=!0:j.target.closest("#layout-root")!==null&&(Gr=!1))});const ec=()=>{let D=!1;for(const j of document.querySelectorAll(".pane-drawer:not([hidden])"))j.hidden=!0,D=!0;return D},Aa=()=>{let D=!1;for(const j of document.querySelectorAll('.workspace-pane[data-modes="open"], [data-frame-host][data-modes="open"]'))delete j.dataset.modes,D=!0;return A.serverStrip_isOpen()&&(A.serverStrip_close(),D=!0),D};document.addEventListener("click",D=>{if(!(D.target instanceof Element)||D.target.closest(".mode-frame")!==null&&D.target.closest(".mode-fill")===null||D.target.closest("#pacs-server-strip")!==null||D.target.closest("#pacs-f-server")!==null||D.target.closest(".listing-framed .listing-row, .ask-bar")!==null)return;const j=D.target.closest(".mode-strip"),le=j?.closest(".workspace-pane, [data-frame-host]")??null,xe=le?.dataset.modes==="open",Ge=Aa();if(j!==null&&le!==null&&!xe){le.dataset.modes="open",Ii("audio3");return}Ge&&Ii("audio3")}),EH(c,{palette_isOpen:()=>!J.hidden,palette_open:()=>We(),palette_close:()=>Le(),errand_abandon:()=>$t.errand_abandon(),dive_leave:()=>h.dive_leave(),overlay_escape:()=>Fe.escape(),drawers_close:ec,modeFrames_close:Aa,consoleFocused:()=>Gr,console_release:()=>Pi(!1),verbs:{bar_note:jt,flip:oi,resize:ai},host:()=>Z,stage_alone:D=>{ye(),$.tree_set({pane:D}),we()},element_require:Qe});const Li=new FB,Qi=(D,j)=>{const le=Ie(j);return $.leaf_replace(D,le.id),As(D),$.mount_remove(D),le};Li.claim_add("fs.listing","files"),i&&UB(Li,{dag_target:()=>{const D=$.focused_get();return D!==null&&a.has("dag",D)?a.get("dag",D):At},dags:()=>[At,...a.values("dag")],universes:()=>a.values("universe"),pacs:()=>A,pacs_present:()=>{$.preset_apply("pacs"),we()},image_open:(D,j)=>{k($.focused_get(),D,j?{force:!0}:{}).then(le=>Ce.line_note(le))},pane_replace:(D,j)=>Qi(D,j).id,cohort_adopt:D=>De.envelope_observe(D),dag_get:D=>a.get("dag",D),image_get:D=>a.get("image",D),tags_get:D=>a.get("tags",D)});const Ta=(D,j,le)=>{const xe=Li.claimer_get(j);if(xe!==void 0){xe(D,le);return}const Ge=Qi(D,j),mt=a.get("files",Ge.id);for(const ft of le)mt?.envelope_observe(ft)},Pr={instance_spawn:Ie,birth_record:ge,launcher_yield:_e,launcher_active:()=>$.activePreset_get()==="launcher",template_stamp:qi},Ia=Sj(c,Pr),Lr=Ia.open,Da=Hj(c,Pr),Fs=nH(c);function Ca(D){I$(D)&&c.client.claims_send(p0())}const Wi=MH(c,D=>Ca(D)),So=SH(c,{...Pr,ask:D=>gt.line_execute(D,{silent:!0})}),Ra=yj(c,{...Pr,replayPlace_get:re.replayPlace_get,errandHost_find:V,saved:()=>{for(const D of a.values("dag"))D.marks_refresh()}});En("files",D=>x(D,!1)),En("catalogue",D=>x(D,!1,!0)),En("view",fe),En("help",Ia.instance_build),En("games",Da.instance_build),En("notes",So.instance_build),En("edit",Ra.instance_build);for(const[D,j]of ut.factories)En(D,j);En("empty",D=>{const j=qi("tpl-pane-empty");return new LB(j,{execute:le=>gt.line_execute(le,{silent:!0,observe:!1}),claim:(le,xe)=>Ta(D,le,xe),claimKind_find:le=>Li.claimKind_find(le)}),{id:D,kind:"empty",mount:j}});const ka=D=>{D?document.body.dataset.gutter="away":delete document.body.dataset.gutter,Ii("audio3")},Wr=(D,j)=>{if($.activePreset_get()===D&&$.panes_shown().includes(D)){ka(!0);return}document.body.dataset.gutter==="away"&&delete document.body.dataset.gutter,j()};Qe("gutter-restore").addEventListener("click",()=>ka(!1)),window.addEventListener("keydown",D=>{D.key==="Escape"&&document.body.dataset.gutter==="away"&&document.body.dataset.zoom===void 0&&ka(!1)}),Qe("gutter-files").addEventListener("click",()=>{Wr("files",()=>{ne=!1,Ue(),$.focus_set("files"),Pi(!1)})});const N=(D="")=>{Pe("dag"),At.stage_returned(),At.list_reset(),At.roster_filter(D),At.feedsChooser_request(),$.focus_set("dag"),Pi(!1)},K=()=>{Pe("universe");const D=a.get("universe","universe");D!==void 0&&!D.shown_get()&&D.request(),D?.stage_returned(),$.focus_set("universe"),Pi(!1)};Qe("gutter-runs").addEventListener("click",()=>Wr("dag",()=>N())),Qe("gutter-console").addEventListener("click",()=>{Qe("drawer").classList.contains("drawer-closed")&&Qe("drawer-toggle").click(),Ce.focus_take(),Pi(!0)}),Qe("gutter-tools").addEventListener("click",()=>{Wr("pacs",()=>{Pe("pacs"),$.focus_set("pacs"),Pi(!1)})}),Qe("gutter-dashboard").addEventListener("click",()=>{Wr("launcher",it)}),Qe("gutter-panes").addEventListener("click",()=>{Wr("panes",()=>{Pe("panes"),pe.render(),$.focus_set("panes"),Pi(!1)})});const te=D=>zh(D)?.kind??null,Z=IH(c,{verbs:{move:It,flip:oi,resize:ai},help_open:Lr,notes_open:So.open,launcher_enter:it,trek_open:D=>Fs.active_is()?"trek: the bridge is already up":(Fs.open(D),"trek: the bridge takes the screen (Esc or LEAVE BRIDGE gives it back)"),identity_get:()=>S,consoleZoom_toggle:Fw,feed_enter:D=>At.feed_enter(D),file_save:g,stage_keep:()=>ye(),files_open:(D,j)=>{const le=a.get("files",D);return le===void 0?!1:(p.follow_set(D,!1),m(D,le,j),!0)},image_open:(D,j,le)=>k(D,j,le),series_ask:C,tagsPane_open:R}),J=Qe("lang-palette"),Me=Qe("lang-input"),Be=Qe("lang-result"),Se=Qe("lang-pill"),We=()=>{ec(),J.hidden=!1,Se.classList.add("lang-live"),Be.textContent="",Me.value="",Me.focus(),Ii("audio3")},Le=()=>{J.hidden=!0,Se.classList.remove("lang-live"),Be.textContent=""};Se.addEventListener("click",()=>{J.hidden?We():Le()});const nt=["pane","view","runs","node","dag","file","pacs","header","console","back","desktop","argus","help","notes"],ot={pane:["split","zoom","close","bind","claim","focus","flip","resize"],resize:["left","right","up","down"],help:["keys","verbs"],notes:["pane"],focus:["left","right","up","down","last"],view:["files","runs","pacs"],runs:["enter","sort","filter"],node:["enter","immerse","back","clear"],dag:["layout","projection","scale","hue","draw","pulse","census","gravity","select","enter","physics","refresh"],draw:["spheres","stars"],pulse:["on","off"],census:["on","off"],gravity:["on","off"],physics:["charge","link","collide","gravity","reset"],file:["home","back","download","delete","sort","filter","follow","root","list","cards","preview"],pacs:["sort","filter","connect","disconnect","list","query","pull","status"],header:["stats","dag","away","restore"],console:["open","close","toggle","zoom","height"],desktop:["save","load","show","list","delete","clear","share"],split:["left","right","above","below"],bind:["unlinked","fs","viewer"],claim:["files","runs","pacs"],layout:["ranked","molecule"],projection:["2d","3d"],scale:["time","size"],hue:["status","compute"],argus:["verbs"]};if(Me.addEventListener("keydown",D=>{if(D.key==="Escape"){D.stopPropagation(),Le();return}if(D.key==="Tab"){D.preventDefault();const j=Me.value.split(/\s+/),le=j[j.length-1]??"",xe=j.length<=1?"":j[j.length-2]??"",mt=(j.length<=1?nt:ot[xe]??ot[j[0]??""]??[]).find(ft=>ft.startsWith(le.toLowerCase()));mt!==void 0&&(j[j.length-1]=mt,Me.value=`${j.join(" ")} `);return}if(D.key==="Enter"){const j=Me.value.trim();if(j.length===0){Le();return}ph(Z,j).then(le=>{le!==null&&(Fs.active_is()||Wi.active_is())?(Ce.output_write("data",`: ${j}
|
|
4393
4393
|
${le}
|