@rr0/ufoathome 0.189.1 → 0.190.0
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-embed-scene/{BeamEditor-Cu6NLBA7.js → BeamEditor-BLtQJ7dq.js} +1 -1
- package/dist-embed-scene/{BirdEditor-BxlHc4L5.js → BirdEditor-C6dn5_wS.js} +1 -1
- package/dist-embed-scene/DroneEditor-iXr-XzB2.js +16 -0
- package/dist-embed-scene/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-scene/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-scene/DroneFlight-D0-Y_wej.js +1 -0
- package/dist-embed-scene/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-scene/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-scene/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-scene/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-scene/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-scene/{LanternEditor-CpNWWMyY.js → LanternEditor-CHkp6fvG.js} +1 -1
- package/dist-embed-scene/{LaunchEditor-fuFCnkV4.js → LaunchEditor-C2XidkVF.js} +1 -1
- package/dist-embed-scene/{ModuleSession-Dd9RVc7I.js → ModuleSession-CnHhUFre.js} +2 -2
- package/dist-embed-scene/ModuleThree-BzKlu4H2.js +1 -0
- package/dist-embed-scene/{ParameterForm-DP2rnIe1.js → ParameterForm-liNpnZ93.js} +11 -11
- package/dist-embed-scene/{ReentryEditor-DGLg57vB.js → ReentryEditor-DqSDU-se.js} +1 -1
- package/dist-embed-scene/rr0-scene.mjs +314 -314
- package/dist-embed-scene/sightingSchema-CLXF9VE3.js +1 -0
- package/dist-embed-sighting/{BeamEditor-B1s17C_I.js → BeamEditor-Bl_2xUBv.js} +1 -1
- package/dist-embed-sighting/{BeamSystem-DTraCa17.js → BeamSystem-BdJfIbJy.js} +1 -1
- package/dist-embed-sighting/{BirdEditor-B__-UnpK.js → BirdEditor-DAw14Ex2.js} +1 -1
- package/dist-embed-sighting/{CaseReportExport-GwM0Pm21.js → CaseReportExport-pqKd-0cF.js} +1 -1
- package/dist-embed-sighting/DroneEditor-C6uGwJCK.js +16 -0
- package/dist-embed-sighting/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-sighting/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-sighting/DroneFlight-BPuws32_.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-sighting/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-sighting/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-sighting/{GLTFLoader-61IhKnLS.js → GLTFLoader-BPxbcVGH.js} +1 -1
- package/dist-embed-sighting/{LanternEditor-C6tHr2lo.js → LanternEditor-2qGw33iQ.js} +1 -1
- package/dist-embed-sighting/{LaserBeam-R7ItI6m-.js → LaserBeam-DotCCB1U.js} +1 -1
- package/dist-embed-sighting/{LaunchEditor-CbQXmqaL.js → LaunchEditor-QW4_Sx3j.js} +1 -1
- package/dist-embed-sighting/{LaunchPlume-uRfBKA0Y.js → LaunchPlume-CNTwnOG6.js} +1 -1
- package/dist-embed-sighting/{LaunchSimulation-DgsYJUKz.js → LaunchSimulation-CoJIQGLm.js} +1 -1
- package/dist-embed-sighting/{ModuleSession-YoBCzrOV.js → ModuleSession-CQnRKmzR.js} +2 -2
- package/dist-embed-sighting/ModuleThree-FBgB1-pu.js +1 -0
- package/dist-embed-sighting/{ParameterForm-CkZQ1FlH.js → ParameterForm-DviNoiD5.js} +1 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
- package/dist-embed-sighting/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
- package/dist-embed-sighting/{ReentryEditor-BzOyu6AB.js → ReentryEditor-MgbKtSa4.js} +1 -1
- package/dist-embed-sighting/{ReentrySimulation-BDnSb3zB.js → ReentrySimulation-BR0KO3U0.js} +1 -1
- package/dist-embed-sighting/rr0-sighting.mjs +369 -367
- package/dist-embed-sighting/sightingSchema-CLXF9VE3.js +1 -0
- package/dist-embed-sighting-editor/{BallesterGuaspAssessor-CeyXntPc.js → BallesterGuaspAssessor-CapyLOHE.js} +1 -1
- package/dist-embed-sighting-editor/{BeamEditor-DQcdww5w.js → BeamEditor-8960brcL.js} +1 -1
- package/dist-embed-sighting-editor/{BeamSystem-d2pPAwht.js → BeamSystem-BoMHmOf3.js} +1 -1
- package/dist-embed-sighting-editor/{CaseReportExport-DNBdWKUJ.js → CaseReportExport-CYUM0gPZ.js} +1 -1
- package/dist-embed-sighting-editor/{ContrailSystem-B4tXvQXF.js → ContrailSystem-teTrI30G.js} +1 -1
- package/dist-embed-sighting-editor/{ControlPasses-C2E5CKcL.js → ControlPasses-PiJOqNOu.js} +1 -1
- package/dist-embed-sighting-editor/{CoverageAssessor-DvVcSmz6.js → CoverageAssessor-Zh8Hw6yp.js} +1 -1
- package/dist-embed-sighting-editor/DroneEditor-CnlkmY64.js +16 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_en-BViHK30c.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_es-D6bhIOAa.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_fr-CvV0RyOT.js +1 -0
- package/dist-embed-sighting-editor/DroneEditorMessages_it-CYi-jmVN.js +1 -0
- package/dist-embed-sighting-editor/DroneFlight-D4RRsn4m.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_en-CLygXcsv.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_es-B9XFRYnQ.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_fr-CAX15_pk.js +1 -0
- package/dist-embed-sighting-editor/DroneKindMessages_it-CSGsCaJQ.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_en-sL1dR2RG.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_es-Bg8_8XVE.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_fr-B8Ym7Yz6.js +1 -0
- package/dist-embed-sighting-editor/DroneParameterTexts_it-DfvWjvoc.js +1 -0
- package/dist-embed-sighting-editor/{GLTFLoader-fTZft-Zt.js → GLTFLoader-DWambWcY.js} +1 -1
- package/dist-embed-sighting-editor/{HeadlightSystem-uWB_oNGK.js → HeadlightSystem-LL1DHYBg.js} +1 -1
- package/dist-embed-sighting-editor/{HynekAssessor-D-u8nJfp.js → HynekAssessor-wtavw_WK.js} +1 -1
- package/dist-embed-sighting-editor/{InterviewEditorElement-MBuptUl8.js → InterviewEditorElement-46F4WJC9.js} +2 -2
- package/dist-embed-sighting-editor/{LaserBeam-DOGz1dOz.js → LaserBeam-BcOjgC8-.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchEditor-0BCDGChg.js → LaunchEditor-CUw-IXhX.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchPlume-DdX9-Rlw.js → LaunchPlume-By8E1xvy.js} +1 -1
- package/dist-embed-sighting-editor/{LaunchSimulation-BkdI45NE.js → LaunchSimulation-gytH8ZVf.js} +1 -1
- package/dist-embed-sighting-editor/{ModuleConformance-_3-3Kbbt.js → ModuleConformance-DRVG5aJw.js} +2 -2
- package/dist-embed-sighting-editor/{ModuleSession-mVLpd6IE.js → ModuleSession-o0MYjWCQ.js} +2 -2
- package/dist-embed-sighting-editor/ModuleThree-D1RGQ8X2.js +1 -0
- package/dist-embed-sighting-editor/{ModulesPanelElement-DZ7dkdsm.js → ModulesPanelElement-Uk66Ixvl.js} +3 -3
- package/dist-embed-sighting-editor/{NearestApproach-BDjtUet2.js → NearestApproach-CgC-W_0w.js} +1 -1
- package/dist-embed-sighting-editor/{PoherAssessor-DrseSHg-.js → PoherAssessor-C0PuGZ7E.js} +1 -1
- package/dist-embed-sighting-editor/{RailwaySystem-De5BYxNx.js → RailwaySystem-CzCL0bVV.js} +1 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_en-ChQHFyxb.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_es-BbFqHsvR.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_fr-Dl4a8udu.js +1 -0
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_it-CwiJfUo_.js +1 -0
- package/dist-embed-sighting-editor/{ReentryEditor-DWqXWztK.js → ReentryEditor-v66u2mvZ.js} +1 -1
- package/dist-embed-sighting-editor/{ReentrySimulation-DpIG9b07.js → ReentrySimulation-CLu3E046.js} +1 -1
- package/dist-embed-sighting-editor/{ReferenceSystem-BoCM4vB1.js → ReferenceSystem-BWEFysoI.js} +1 -1
- package/dist-embed-sighting-editor/{SightingFileEditor-Dtz8Azd2.js → SightingFileEditor-CQtQqTVl.js} +1 -1
- package/dist-embed-sighting-editor/{TraceSystem-DdEd9Z5I.js → TraceSystem-DrdYmWMC.js} +2 -2
- package/dist-embed-sighting-editor/{WaterSystem-DntD2XIE.js → WaterSystem-DJVs_drg.js} +2 -2
- package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +376 -374
- package/dist-embed-sighting-editor/sightingSchema-CLXF9VE3.js +1 -0
- package/package.json +1 -1
- package/dist-embed-scene/ModuleThree-q18pyqmA.js +0 -1
- package/dist-embed-scene/sightingSchema-DjI7FV42.js +0 -1
- package/dist-embed-sighting/ModuleThree-BHRi7HrA.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_en-CF6XauSj.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_es-Ca-13TTT.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_fr-Djdd6Hdq.js +0 -1
- package/dist-embed-sighting/ReadingSensitivityMessages_it-CPUXxMqD.js +0 -1
- package/dist-embed-sighting/sightingSchema-DjI7FV42.js +0 -1
- package/dist-embed-sighting-editor/ModuleThree-cXvmWIn4.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_en-CF6XauSj.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_es-Ca-13TTT.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_fr-Djdd6Hdq.js +0 -1
- package/dist-embed-sighting-editor/ReadingSensitivityMessages_it-CPUXxMqD.js +0 -1
- package/dist-embed-sighting-editor/sightingSchema-DjI7FV42.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./interviewImport-CgWyTdKb.js","./interviewJson-iURHP4Zk.js","./rr0-sighting-editor.mjs","./SightingFileEditor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BrowserWhisperProvider-Dn44ZE45.js","./TranscriptionAudio-C_xvRUv2.js","./TranscriptionError-D_TCbYbt.js","./OpenAiTranscriptionProvider-DDW446tK.js","./AssemblyAiTranscriptionProvider-o2kkPD5o.js","./interviewImport-CgWyTdKb.js","./interviewJson-iURHP4Zk.js","./rr0-sighting-editor.mjs","./SightingFileEditor-CQtQqTVl.js","./index-DSNA74v6.js","./sightingSchema-CLXF9VE3.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{S as P,a as I,H as V,s as J,U as G,I as K,b as X,P as Q,c as S,W as $,M as j,_ as x,d as L,r as Z,e as ee,E as M,f as F,A as U,g as O,h as C,i as k,l as te}from"./rr0-sighting-editor.mjs";import{InterviewMedia as B}from"./InterviewMedia-CvAxC62V.js";import{InterviewFile as g}from"./interviewJson-iURHP4Zk.js";const q="rr0-interview",re=`
|
|
3
3
|
rr0-interview { display: block; --rr0-interview-line: color-mix(in srgb, currentColor 35%, transparent); }
|
|
4
4
|
rr0-interview [hidden] { display: none !important; }
|
|
@@ -267,4 +267,4 @@ rr0-interview .turn .ref svg { width: 1.1em; height: 1.1em; }
|
|
|
267
267
|
</section>
|
|
268
268
|
</div>
|
|
269
269
|
`;class u extends HTMLElement{shadow=this.attachShadow({mode:"open"});get importInput(){return this.shadow.getElementById("import")}messages;said=new P(["en"]);language="en";localeToken=0;current;options=[];group="summary";base;text;fileEditor;fileEditorLoading;shownFor;ready=Promise.resolve();player;drawn;takenOut=new Map;redactTarget;exchangesShown=Promise.resolve();lastReason;static transcriptionSourceId=A[0].id;transcribing;constructor(){super(),this.shadow.innerHTML=ie,customElements.upgrade(this.shadow),this.importInput.build();for(const r of["title","time","by","url","summary","witness","medium"])this.shadow.getElementById(r).addEventListener(r==="witness"||r==="medium"?"change":"input",()=>this.write(r));for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.addEventListener("click",()=>this.openGroup(u.GROUPS[r.getAttribute("aria-controls")]??"summary"));this.shadow.getElementById("url").addEventListener("change",()=>{this.shownFor=void 0,this.text===void 0&&this.group==="file"&&this.showTranscript()}),this.importInput.addEventListener("filepick",r=>{const s=r.detail;s.file?this.importFromFile(s.file):this.importFromUrl(s.url)}),this.shadow.getElementById("save").addEventListener("click",()=>this.save()),this.shadow.getElementById("transcribe-start").addEventListener("click",()=>void this.transcribe()),this.shadow.getElementById("transcribe-stop").addEventListener("click",()=>this.transcribing?.abort()),this.shadow.getElementById("transcribe-source").addEventListener("change",r=>{u.transcriptionSourceId=r.target.value,this.transcribeOutcome=void 0,this.renderTranscribe()}),this.shadow.getElementById("transcribe-key").addEventListener("input",r=>{L.set(u.transcriptionSourceId,r.target.value),this.renderTranscribeStart()});const e=this.shadow.getElementById("exchanges");e.addEventListener("pointerup",()=>setTimeout(()=>this.selectionMade(),0)),e.addEventListener("keyup",r=>{r.shiftKey&&this.selectionMade()}),e.addEventListener("click",r=>{const s=r.target.closest(".bar.redacted-label");s&&this.openBar(s)}),e.addEventListener("keydown",r=>{const s=r.target.closest(".bar.redacted-label");s&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.openBar(s))}),this.shadow.getElementById("redact-take").addEventListener("click",()=>void this.redactSelection()),this.shadow.getElementById("redact-restore").addEventListener("click",()=>{const r=this.redactTarget;this.closeRedactPop(),r?.kind==="bar"&&r.restorable&&this.restore(r.restorable)});const t=this.field("redact-reason");t.addEventListener("change",()=>{this.redactTarget?.kind==="bar"&&this.changeReason()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&this.closeRedactPop(),r.key==="Enter"&&(r.preventDefault(),this.redactTarget?.kind==="selection"?this.redactSelection():this.changeReason().then(()=>this.closeRedactPop()))})}static GROUPS={"group-summary":"summary","group-exchanges":"exchanges","group-transcript":"file"};static get observedAttributes(){return["readonly"]}attributeChangedCallback(){this.applyReadonly()}connectedCallback(){this.ready=this.loadLocale(),document.addEventListener("pointerdown",this.pressedElsewhere,!0)}pressedElsewhere=e=>{const t=this.shadow.getElementById("redact-pop");t&&!t.hidden&&!e.composedPath().includes(t)&&this.closeRedactPop()};disconnectedCallback(){document.removeEventListener("pointerdown",this.pressedElsewhere,!0),queueMicrotask(()=>{this.isConnected||this.releaseFileEditor()})}releaseFileEditor(){this.fileEditor&&(this.text=this.fileEditor.text,this.fileEditor.destroy(),this.fileEditor=void 0,this.fileEditorLoading=void 0,this.shownFor=void 0)}get event(){return this.current}set event(e){e!==this.current&&(this.shownFor=void 0),this.current=e,this.render(),this.takenOut.clear(),this.group==="file"&&this.showTranscript(),queueMicrotask(()=>{this.current===e&&this.showExchanges()})}set witnesses(e){this.options=e,this.render()}set documentUrl(e){this.base=e}get transcriptText(){return this.text}set transcriptText(e){this.text=e,this.shownFor=void 0}field(e){return this.shadow.getElementById(e)}async loadLocale(){const e=++this.localeToken,t=V.preferencesFor(this),r=J(t,G),s=await K.load(r);e===this.localeToken&&(this.language=r,this.said=new P(t),this.messages=s,this.player||(this.player=new Y(this.shadow.getElementById("player"),{timeChanged:i=>this.markCurrentTurn(i),recordingsChanged:i=>void this.editTranscript(n=>{i.length===0?delete n.recordings:n.recordings=i})},s),this.render()),this.render())}applyReadonly(){const e=this.hasAttribute("readonly");for(const t of["title","time","by","url","summary"])this.field(t).readOnly=e;for(const t of this.shadow.querySelectorAll("#witness input"))t.disabled=e;this.field("medium").disabled=e,this.importInput.disabled=e,this.shadow.getElementById("transcribe").hidden=e}static byText(e){return(e??[]).map(t=>"people"in t?t.people:"org"in t?t.org:t.title??"").filter(t=>t!=="").join(", ")}render(){const e=this.messages;if(!e)return;const t=(d,c)=>{this.shadow.getElementById(d).textContent=c};t("label-summary-group",e.summaryTab),t("label-file-group",e.fileTab),t("label-exchanges-group",e.exchangesTab),t("label-title",e.title),t("label-witness",e.witness),t("label-medium",e.medium),t("label-time",e.time),t("label-by",e.by),t("label-summary",e.summary),t("label-url",e.transcript),F.say(this.shadow.getElementById("label-import-file"),e.importFile,e.importFileHint),t("redact-take",e.redactSelection),t("redact-restore",e.redactRestore),t("label-redact-reason",e.redactReasonLabel);const r=this.field("redact-reason");r.placeholder=e.redactReason,r.title=e.redactReasonHint,t("transcribe-start",e.transcribe),this.shadow.getElementById("transcribe-hint").replaceChildren(F.of(e.transcribeHint)),t("label-transcribe-with",e.transcribeWith),t("label-transcribe-key",e.transcribeKey),t("transcribe-key-get",e.transcribeKeyGet),t("transcribe-stop",e.transcribeStop),this.field("transcribe-key").title=e.transcribeKeyHint,this.renderTranscribe(),this.player?.setMessages(e),this.importInput.messages=e,t("save",e.saveButton),this.field("url").title=e.transcriptHint,this.field("by").title=e.byHint;const s=this.current,i=this.shadow.activeElement,n=(d,c)=>{this.field(d)!==i&&(this.field(d).value=c)};n("title",this.said.read(s?.title)??""),n("time",s?.time??""),n("by",u.byText(s?.by)),n("url",s?.url??""),n("summary",this.said.read(s?.summary)??"");const a=[s?.interviewOf].flat().filter(d=>typeof d=="string"),o=this.shadow.getElementById("witness"),h=[...this.options,...a.filter(d=>!this.options.some(c=>c.id===d)).map(d=>({id:d,label:d}))];o.replaceChildren(o.querySelector("legend"),...h.map(d=>{const c=document.createElement("label"),m=document.createElement("input");return m.type="checkbox",m.value=d.id,m.checked=a.includes(d.id),c.append(m,d.label),c}));const l=this.shadow.getElementById("medium");if(l.replaceChildren(...B.ALL.map(d=>new Option(B.label(d,this.language),d))),s?.medium!==void 0&&!B.ALL.includes(s.medium)&&l.append(new Option(String(s.medium),String(s.medium))),s?.medium===void 0){const d=new Option(e.witnessNone,"");d.disabled=!0,d.hidden=!0,l.prepend(d)}l.value=s?.medium??"",this.applyReadonly()}write(e){const t=this.current;if(!t)return;const r=e==="witness"?"":this.field(e).value;switch(e){case"title":{const s=this.said.write(t.title,r,this.language);s===void 0?delete t.title:t.title=s;break}case"summary":{const s=this.said.write(t.summary,r,this.language);s===void 0?delete t.summary:t.summary=s;break}case"time":r.trim()===""?delete t.time:t.time=r.trim();break;case"url":r.trim()===""?delete t.url:t.url=r.trim();break;case"by":{const s=r.split(",").map(i=>i.trim()).filter(i=>i!=="");s.length===0?delete t.by:t.by=s.map(i=>({people:i}));break}case"witness":{const s=[...this.shadow.querySelectorAll("#witness input:checked")].map(i=>i.value);if(s.length===0){this.render();return}t.interviewOf=s.length===1?s[0]:s;break}case"medium":r===""?delete t.medium:t.medium=r;break}this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:e,event:t}})),e==="medium"&&this.render(),e!=="url"&&this.syncFileFromEvent()}openGroup(e){this.group=e;const t={summary:"group-summary",exchanges:"group-exchanges",file:"group-transcript"};for(const r of this.shadow.querySelectorAll("#tabs .group-tab"))r.setAttribute("aria-expanded",String(r.getAttribute("aria-controls")===t[e]));for(const[r,s]of Object.entries(t))this.shadow.getElementById(s).hidden=r!==e;e==="file"&&this.showTranscript(),e==="exchanges"&&this.showExchanges()}exchangesToken=0;async transcriptJson(e){try{const t=this.fileEditor?.text??this.text;if(t!==void 0)return g.read(JSON.parse(t));const r=this.transcriptUrl(e);if(r!==void 0)return g.read(await I.json(r))}catch{}}async showExchanges(){const e=this.current;if(!e)return;const t=++this.exchangesToken,r=await this.transcriptJson(e);await this.ready,!(t!==this.exchangesToken||this.current!==e)&&this.drawExchanges(r)}drawExchanges(e){const t=this.shadow.getElementById("exchanges");t.documentUrl=this.current?this.transcriptUrl(this.current):void 0,t.interview=e,this.drawn=e,this.player?.show(e,this.current?this.transcriptUrl(this.current):void 0),this.renderReview(e),this.renderRedactReasons(e),this.decorateExchanges(e),this.renderTranscribe()}async editTranscript(e){const t=this.current;if(!t||this.hasAttribute("readonly"))return;const r=await this.transcriptJson(t)??JSON.parse(this.template(t));Array.isArray(r.segments)||(r.segments=[]),e(r);const s=u.pretty(u.withEventFields(r,t));this.fileEditor?.replaceText(s,!1),this.onEdited(s),await this.exchangesShown}get redactReason(){return this.reasonOf(this.lastReason)}reasonOf(e){e=e?.trim()||this.messages.redactReason;const t=this.givenReasons(this.drawn).find(r=>this.said.read(r)===e);return t!==void 0?typeof t=="string"?t:{...t}:this.said.write(void 0,e,this.language)??e}givenReasons(e){const t=new Map;for(const r of e?.segments??[])for(const s of[r.redacted,...(r.parts??[]).map(i=>"redacted"in i?i.redacted:void 0)]){if(!s)continue;const i=JSON.stringify(s.reason),n=t.get(i);n?n.n++:t.set(i,{reason:s.reason,n:1})}return[...t.values()].sort((r,s)=>s.n-r.n).map(r=>r.reason)}renderRedactReasons(e){const t=this.messages;if(!t)return;const r=this.givenReasons(e).map(n=>this.said.read(n)??"").filter(n=>n!==""),s=t.redactReasons.filter(n=>!r.some(a=>a.toLowerCase().startsWith(n.toLowerCase()))),i=[...new Set([...r,...s])];this.shadow.getElementById("redact-reasons").replaceChildren(...i.map(n=>new Option(n,n)))}speakerLabel(e,t){const r=g.speakerName(e,t),s=e.speakers?.[t]?.role;return s===g.UNATTRIBUTED&&e.speakers[t].title?this.messages.voiceNamed.replace("{name}",r):r===s&&s in this.messages.roles?this.messages.roles[s]:r}renderReview(e){const t=this.shadow.getElementById("review"),r=Object.entries(e?.speakers??{}).filter(([,o])=>o.role!==g.UNATTRIBUTED).map(([o])=>o);if(t.hidden=!e||r.length===0,!e||r.length===0)return;const s=o=>["approved","covered"].includes(e.proofreading?.[o]?.status??""),i=r.filter(o=>!s(o)),n=document.createElement("span");n.textContent=i.length===0?this.messages.proofreadAll:this.messages.proofreadPending.replace("{names}",i.map(o=>this.speakerLabel(e,o)).join(", ")),t.toggleAttribute("data-done",i.length===0);const a=document.createElement("span");a.className="review-boxes";for(const o of r){const h=document.createElement("label"),l=document.createElement("input");l.type="checkbox",l.checked=s(o),l.disabled=this.hasAttribute("readonly"),l.addEventListener("change",()=>void this.editTranscript(d=>{d.proofreading??={},l.checked?d.proofreading[o]={status:"approved",date:new Date().toISOString().slice(0,10)}:d.proofreading[o]={status:"pending"}})),h.append(l,this.messages.reviewedBy.replace("{name}",this.speakerLabel(e,o))),a.append(h)}t.replaceChildren(n,a)}momentsOf(e,t){const r=e.speakers?.[t]?.of??g.sightingsOf(e)[0];return this.options.find(s=>s.id===r)?.moments??this.options.flatMap(s=>s.moments??[])}decorateExchanges(e){if(!e)return;const t=this.messages,r=this.hasAttribute("readonly");for(const s of this.shadow.querySelectorAll("#exchanges .turn[data-segment]")){const i=Number(s.dataset.segment),n=e.segments[i];if(!n)continue;if(n.start!==void 0){const h=document.createElement("button");h.type="button",h.className="turn-time",h.textContent=g.clock(n.start),h.addEventListener("click",()=>this.player?.seek(n.start)),s.prepend(h)}const a=n.redacted?[n.redacted]:b.partsOf(n).flatMap(h=>"redacted"in h?[h.redacted]:[]);s.querySelectorAll(".bar").forEach((h,l)=>{const d=a[l]?.words;h.textContent=d!==void 0?t.redactedWords.replace("{n}",String(d)):t.redacted,h.classList.add("redacted-label");const c=n.redacted?`${i}:all`:`${i}:${l}`;this.takenOut.has(c)&&(h.dataset.restorable=c)});const o=this.momentsOf(e,n.speaker);s.querySelectorAll(".ref").forEach((h,l)=>{const d=n.refs?.[l];if(!d)return;const c=o.find(p=>Math.abs(p.at-d.at)<.05);if(c){const p=document.createElement("span");p.className="moment-letter",p.textContent=c.label.slice(0,2),h.replaceChildren(p,t.momentLabel.replace("{k}",c.label).replace("{text}",c.note??g.clock(d.at)))}if(r)return;const m=document.createElement("button");m.type="button",m.className="ref-unlink",m.textContent="×",m.title=t.unlinkMoment,m.setAttribute("aria-label",t.unlinkMoment),m.addEventListener("click",()=>void this.editTranscript(p=>{p.segments[i].refs?.splice(l,1),p.segments[i].refs?.length===0&&delete p.segments[i].refs})),h.after(m)}),r||s.append(this.turnTools(e,i,n,o))}}turnTools(e,t,r,s){const i=this.messages,n=document.createElement("div");n.className="turn-tools";const a=(l,d)=>{const c=document.createElement("button");return c.type="button",c.textContent=l,c.addEventListener("click",d),c};if(e.speakers?.[r.speaker]?.role==="witness"&&!r.redacted){const l=a(i.linkMoment,()=>{});n.append(l),new U(l,`moment-menu-${t}`,c=>void this.editTranscript(m=>{const p=m.segments[t].refs??[];p.some(w=>Math.abs(w.at-Number(c))<.05)||p.push({at:Number(c)}),m.segments[t].refs=p}),c=>`moment-${t}-${c}`).setKinds(s.length>0?s.map(c=>({value:String(c.at),label:i.momentLabel.replace("{k}",c.label).replace("{text}",c.note??g.clock(c.at))})):[{value:"",label:i.noMoments,disabledReason:i.noMoments}])}if(r.redacted||n.append(a(i.editTurn,()=>this.editTurn(t))),!r.redacted&&!this.hasAttribute("readonly")){const l=a(i.whoSpeaks,()=>{});n.append(l),new U(l,`speaker-menu-${t}`,c=>void x(async()=>{const{InterviewImport:m}=await import("./interviewImport-CgWyTdKb.js");return{InterviewImport:m}},__vite__mapDeps([5,6,7]),import.meta.url).then(({InterviewImport:m})=>this.editTranscript(p=>{m.attribute(p,t,c)})),c=>`speaker-${t}-${c}`).setKinds(Object.keys(e.speakers??{}).map(c=>({value:c,label:this.speakerLabel(e,c),...c===r.speaker?{disabledReason:this.speakerLabel(e,c)}:{}})))}const o=this.takenOut.has(`${t}:all`)||[...this.takenOut.keys()].some(l=>l.startsWith(`${t}:`));if(r.redacted||r.parts&&o){const l=a(i.restoreAll,()=>void this.restoreAll(t));l.disabled=!o,n.append(l)}else n.append(a(i.redactAll,()=>void this.editTranscript(l=>{this.forget(t),this.takenOut.set(`${t}:all`,b.redactWhole(l.segments[t],this.redactReason))}).then(()=>{const l=this.shadow.querySelector(`#exchanges .turn[data-segment="${t}"] .bar.redacted-label`);l&&this.openBar(l)})));const h=a("",()=>void this.editTranscript(l=>{l.segments.splice(t,1),this.shiftTakenOut(t)}));return h.className="icon-btn",h.innerHTML=S.TRASH,h.title=i.deleteTurn,h.setAttribute("aria-label",i.deleteTurn),n.append(h),n}selectionMade(){const e=this.messages;if(!e||this.hasAttribute("readonly"))return;const t=this.shadow.getSelection?.()??document.getSelection(),r=t&&t.rangeCount>0?t.getRangeAt(0):void 0,s=this.shadow.getElementById("exchanges");if(!r||r.collapsed||!s.contains(r.startContainer)||!s.contains(r.endContainer))return;const i=c=>c instanceof Element?c:c.parentElement,n=i(r.startContainer)?.closest(".said");if(!n&&!i(r.endContainer)?.closest(".said"))return;const a=n&&i(r.endContainer)?.closest(".said")===n&&!i(r.startContainer)?.closest(".bar")&&!i(r.endContainer)?.closest(".bar"),o=r.getBoundingClientRect();if(!a){this.openRedactPop({kind:"selection",index:-1,from:0,to:0},o,e.selectionOnePassage);return}const h=Number(n.closest(".turn").dataset.segment),l=u.offsetIn(n,r.startContainer,r.startOffset),d=u.offsetIn(n,r.endContainer,r.endOffset);this.openRedactPop({kind:"selection",index:h,from:Math.min(l,d),to:Math.max(l,d)},o),u.markPending(r)}static PENDING="rr0-redact-pending";static markPending(e){const t=globalThis.CSS?.highlights,r=globalThis.Highlight;!t||!r||(e?t.set(u.PENDING,new r(e.cloneRange())):t.delete(u.PENDING))}openBar(e){if(this.hasAttribute("readonly"))return;const t=e.closest(".turn");if(!t)return;const r=Number(t.dataset.segment),s=[...t.querySelectorAll(".bar")].indexOf(e),i=this.drawn?.segments[r];if(!i)return;const n=i.redacted?"all":s,a=`${r}:${n}`;this.openRedactPop({kind:"bar",index:r,nth:n,restorable:this.takenOut.has(a)?a:void 0},e.getBoundingClientRect())}openRedactPop(e,t,r){const s=this.shadow.getElementById("redact-pop"),i=this.field("redact-reason");u.markPending(),this.redactTarget=e;const n=this.shadow.getElementById("redact-take"),a=this.shadow.getElementById("redact-restore");n.hidden=e.kind!=="selection",n.disabled=!!r,a.hidden=e.kind!=="bar"||!e.restorable,i.disabled=!!r,i.value=e.kind==="bar"?this.said.read(this.redactionAt(this.drawn,e.index,e.nth)?.reason)??"":this.lastReason??"";const o=this.shadow.getElementById("redact-note");o.textContent=r??"",o.classList.toggle("error",!!r),s.hidden=!1,typeof s.showPopover=="function"&&s.isConnected&&(s.setAttribute("popover","manual"),s.matches(":popover-open")||s.showPopover());const h=s.offsetWidth||320,l=s.offsetHeight||120,d=t.bottom+6+l<=window.innerHeight;s.style.top=`${Math.max(8,d?t.bottom+6:t.top-6-l)}px`,s.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-h-8))}px`,r||i.focus({preventScroll:!0})}closeRedactPop(){const e=this.shadow.getElementById("redact-pop");this.redactTarget=void 0,u.markPending(),typeof e.hidePopover=="function"&&e.matches?.(":popover-open")&&e.hidePopover(),e.hidden=!0}redactionAt(e,t,r){const s=e?.segments[t];if(s)return r==="all"?s.redacted:b.partsOf(s).flatMap(i=>"redacted"in i?[i.redacted]:[])[r]}async changeReason(){const e=this.redactTarget;if(e?.kind!=="bar")return;const t=this.reasonOf(this.field("redact-reason").value),r=this.redactionAt(this.drawn,e.index,e.nth);!r||JSON.stringify(r.reason)===JSON.stringify(t)||await this.editTranscript(s=>{if(e.nth!=="all"){const n=this.redactionAt(s,e.index,e.nth);n&&(n.reason=t);return}const i=JSON.stringify(s.segments[e.index].redacted?.reason);for(let n=e.index;n<s.segments.length;n++){const a=s.segments[n].redacted;if(!a||n>e.index&&JSON.stringify(a.reason)!==i)break;a.reason=t}})}async redactSelection(){const e=this.messages,t=this.redactTarget;if(t?.kind!=="selection"||t.index<0)return;this.lastReason=this.field("redact-reason").value.trim()||void 0;const r=this.redactReason;let s=!1;if(await this.editTranscript(i=>{const n=b.redact(i.segments[t.index],t.from,t.to,r);n&&(s=!0,this.shiftParts(t.index,n.nth),this.takenOut.set(`${t.index}:${n.nth}`,n.text))}),!s){const i=this.shadow.getElementById("redact-note");i.textContent=e.selectionOnePassage,i.classList.add("error");return}this.closeRedactPop(),(this.shadow.getSelection?.()??document.getSelection())?.removeAllRanges()}static offsetIn(e,t,r){let s=0;const i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:n=>n.parentElement?.closest(".bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let n=i.nextNode();n;n=i.nextNode()){if(n===t)return s+r;if(t.contains(n)&&t!==n){const o=[...t.childNodes].slice(0,r);return s+o.reduce((h,l)=>h+(l instanceof Element&&l.closest(".bar")?0:(l.textContent??"").length),0)}s+=(n.textContent??"").length}return s}async restore(e){const t=this.takenOut.get(e);if(t===void 0)return;const[r,s]=e.split(":"),i=Number(r);await this.editTranscript(n=>{s==="all"?b.restoreWhole(n.segments[i],t):(b.restorePart(n.segments[i],Number(s),t),this.shiftParts(i,Number(s),-1)),this.takenOut.delete(e)})}async restoreAll(e){if(this.takenOut.has(`${e}:all`)){await this.restore(`${e}:all`);return}const t=[...this.takenOut.keys()].filter(r=>r.startsWith(`${e}:`)).map(r=>Number(r.split(":")[1])).sort((r,s)=>s-r);for(const r of t)await this.restore(`${e}:${r}`)}editTurn(e){const r=this.drawn?.segments[e],s=this.shadow.querySelector(`#exchanges .turn[data-segment="${e}"] .said`);if(!r||!s)return;const i=this.messages,n=document.createElement("div");n.className="turn-edit";const a=document.createElement("textarea");a.value=b.raw(r,c=>this.takenOut.get(`${e}:${c}`));const o=document.createElement("span");o.className="hint",o.textContent=i.turnEditHint;const h=document.createElement("div");h.className="buttons";const l=document.createElement("button");l.type="button",l.className="pill-btn primary",l.textContent=i.saveTurn,l.addEventListener("click",()=>void this.editTranscript(c=>{const m=b.fromRaw(c.segments[e],a.value,this.redactReason);this.forget(e);for(const[p,w]of m)this.takenOut.set(`${e}:${p}`,w)}));const d=document.createElement("button");d.type="button",d.className="pill-btn",d.textContent=i.cancelTurn,d.addEventListener("click",()=>this.drawExchanges(this.drawn)),h.append(l,d),n.append(a,o,h),s.replaceWith(n),a.focus()}forget(e){for(const t of[...this.takenOut.keys()])t.startsWith(`${e}:`)&&this.takenOut.delete(t)}shiftParts(e,t,r=1){const s=[...this.takenOut].filter(([i])=>i.startsWith(`${e}:`)&&i!==`${e}:all`&&Number(i.split(":")[1])>=t+(r<0?1:0));for(const[i]of s)this.takenOut.delete(i);for(const[i,n]of s)this.takenOut.set(`${e}:${Number(i.split(":")[1])+r}`,n)}shiftTakenOut(e){const t=[...this.takenOut];this.takenOut.clear();for(const[r,s]of t){const[i,n]=r.split(":"),a=Number(i);a<e?this.takenOut.set(r,s):a>e&&this.takenOut.set(`${a-1}:${n}`,s)}}markCurrentTurn(e){const t=this.drawn?.segments??[];let r=-1;t.forEach((n,a)=>{n.start!==void 0&&n.start<=e&&(r=a)});for(const n of this.shadow.querySelectorAll("#exchanges .turn.current"))n.classList.remove("current");const s=this.shadow.querySelector(`#exchanges .turn[data-segment="${r}"]`);if(!s)return;s.classList.add("current");const i=s.closest(".rr0-interview-turns");i&&(s.offsetTop<i.scrollTop||s.offsetTop>i.scrollTop+i.clientHeight-s.offsetHeight)&&i.scrollTo({top:s.offsetTop-i.clientHeight/3,behavior:"smooth"})}async revealSegment(e){this.openGroup("exchanges"),await this.showExchanges(),this.shadow.getElementById("exchanges").revealSegment(e)}transcribeOutcome;renderTranscribe(){const e=this.messages;if(!e)return;const t=this.shadow.getElementById("transcribe-source");[...t.options].map(l=>l.value).join()!==A.map(l=>l.id).join()&&t.replaceChildren(...A.map(l=>{const d=new Option(l.name,l.id);return d.title=l.credit,d}));const r=C(A,u.transcriptionSourceId);t.value=r.id;const s=this.shadow.getElementById("transcribe-credit");s.href=r.creditUrl,s.textContent=r.credit,this.shadow.getElementById("transcribe-key-row").hidden=!r.keyUrl,this.shadow.getElementById("transcribe-key-get").href=r.keyUrl??"";const i=this.field("transcribe-key");if(i!==this.shadow.activeElement&&(i.value=L.of(r.id)??""),this.transcribing)return;const n=this.player?.recordingUrl();this.renderTranscribeStart();const a=this.shadow.getElementById("transcribe-note");if(this.transcribeOutcome){k.show(a,this.transcribeOutcome.text,this.transcribeOutcome.kind);return}if(!n){k.show(a,e.transcribeNoRecording);return}const o=r.create(),h=[o.sendsAudio?e.transcribeSends.replace("{name}",r.name):e.transcribeLocal.replace("{mb}",String(Math.round((o.downloadBytes??0)/1e6)))];(this.drawn?.segments?.length??0)>0&&h.push(e.transcribeReplaces),k.show(a,h.join(" "),o.sendsAudio?"warning":"info")}renderTranscribeStart(){if(this.transcribing||!this.messages)return;const e=C(A,u.transcriptionSourceId),t=this.shadow.getElementById("transcribe-start");t.disabled=!!e.keyUrl&&!L.of(e.id),t.title=t.disabled?this.messages.transcribeErrors.noKey:""}showTranscribing(e){this.shadow.getElementById("transcribe-start").disabled=e,this.shadow.getElementById("transcribe-stop").hidden=!e,this.shadow.getElementById("transcribe-source").disabled=e,this.field("transcribe-key").disabled=e,this.shadow.getElementById("transcribe-progress").hidden=!e}showProgress(e){const t=this.messages,r=this.shadow.getElementById("transcribe-note"),s=this.shadow.getElementById("transcribe-progress"),i=n=>String(Math.round(n/1e6));if(e==="reading")s.removeAttribute("value"),k.show(r,t.transcribeReading);else if(e.stage==="loading")e.total?(s.max=e.total,s.value=e.loaded,k.show(r,t.transcribeLoading.replace("{loaded}",i(e.loaded)).replace("{total}",i(e.total)))):(s.removeAttribute("value"),k.show(r,t.transcribeLoadingSoFar.replace("{loaded}",i(e.loaded))));else if(e.stage==="sending"||e.stage==="waiting"){s.removeAttribute("value");const n=C(A,u.transcriptionSourceId).name;k.show(r,(e.stage==="sending"?t.transcribeSending:t.transcribeWaiting).replace("{name}",n))}else s.max=e.total,s.value=e.done,k.show(r,t.transcribeProgress.replace("{done}",g.clock(Math.round(e.done))).replace("{total}",g.clock(Math.round(e.total))))}async transcribe(){const e=this.messages,t=this.current,r=this.player?.recordingUrl();if(!e||!t||this.transcribing||this.hasAttribute("readonly"))return;if(!r){this.player?.showWindow();return}const s=C(A,u.transcriptionSourceId),i=s.create(),n=this.transcribing=new AbortController;this.transcribeOutcome=void 0,this.showTranscribing(!0),this.showProgress("reading");try{const[{TranscriptionAudio:a},{TranscriptionError:o},{InterviewImport:h}]=await Promise.all([x(()=>import("./TranscriptionAudio-C_xvRUv2.js"),[],import.meta.url),x(()=>import("./TranscriptionError-D_TCbYbt.js"),[],import.meta.url),x(()=>import("./interviewImport-CgWyTdKb.js"),__vite__mapDeps([5,6,7]),import.meta.url)]),l=await fetch(r,{signal:n.signal});if(!l.ok)throw new o("failed",`HTTP ${l.status}`);if(Number(l.headers.get("content-length")??0)>a.MAX_BYTES)throw new o("tooLarge");const d=await l.arrayBuffer();if(d.byteLength>a.MAX_BYTES)throw new o("tooLarge");const c=await a.decode(d).catch(()=>{throw new o("failed",e.loadFailed)}),m=this.drawn?.language??this.language,p=await i.transcribe({samples:c,language:m,signal:n.signal,progress:f=>this.showProgress(f)}),w=[t.interviewOf].flat().filter(f=>typeof f=="string"),y=h.transcribed(p,{by:(t.by??[]).flatMap(f=>"people"in f?[f.people]:[]),witnesses:this.options.filter(f=>w.length===0||w.includes(f.id)).map(({id:f,label:R})=>({id:f,label:R}))});if(!y)throw new o("failed",e.exchangesEmpty);if(n.signal.aborted||this.current!==t)throw new DOMException("Aborted","AbortError");const{anonymization:v,...T}=await this.transcriptJson(t)??{};await this.take({...T,...y,language:m,transcription:{method:"automatic",engine:i.engine,note:`Transcribed in UFO@home by ${i.engine}: whose each voice is was not known, to be attributed, then proofread.`}}),this.transcribeOutcome={text:e.transcribeDone.replace("{engine}",s.name),kind:"info"}}catch(a){const o=a;n.signal.aborted||o?.name==="AbortError"?this.transcribeOutcome={text:e.transcribeStopped,kind:"info"}:o?.name==="TranscriptionError"&&o.code?this.transcribeOutcome={text:e.transcribeErrors[o.code].replace("{detail}",o.detail??""),kind:"error"}:this.transcribeOutcome={text:e.transcribeErrors.failed.replace("{detail}",String(o?.message??a)),kind:"error"}}finally{this.transcribing=void 0,this.showTranscribing(!1),this.renderTranscribe()}}note(e,t="info"){k.show(this.shadow.getElementById("file-note"),e,t)}transcriptUrl(e){return e.url?new URL(e.url,this.base??location.href).href:void 0}static pretty(e){return JSON.stringify(e,null,2)+`
|
|
270
|
-
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of u.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of u.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},n=(a,o,h)=>{h.forEach((l,d)=>{const c=d===0?a:`${a}${d+1}`;i[c]?i[c]={...i[c],[o]:l}:d>0&&(i[c]={role:a,[o]:l})})};n("interviewer","by",t.by??[]),n("witness","of",u.witnessesOf(t.interviewOf)),r.speakers=i}return u.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(u.SHARED.map(a=>r[a])),i=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:i,summary:i,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of u.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(u.SHARED.map(a=>r[a]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=u.pretty(u.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return u.pretty(u.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([x(()=>import("./SightingFileEditor-
|
|
270
|
+
`}static SHARED=["title","time","medium","by","interviewOf","summary"];static ORDER=["version","id","language","title","time","medium","by","interviewOf","summary","speakers","transcription","proofreading","anonymization","recordings","segments"];static ordered(e){const t={};for(const r of u.ORDER)r in e&&(t[r]=e[r]);for(const r of Object.keys(e))r in t||(t[r]=e[r]);return t}static witnessesOf(e){return[e].flat().filter(t=>typeof t=="string")}static withEventFields(e,t){const r={...e};for(const i of u.SHARED)t[i]===void 0?delete r[i]:r[i]=structuredClone(t[i]);const s=r.speakers;if(typeof s=="object"&&s!==null){const i={...s},n=(a,o,h)=>{h.forEach((l,d)=>{const c=d===0?a:`${a}${d+1}`;i[c]?i[c]={...i[c],[o]:l}:d>0&&(i[c]={role:a,[o]:l})})};n("interviewer","by",t.by??[]),n("witness","of",u.witnessesOf(t.interviewOf)),r.speakers=i}return u.ordered(r)}applyFileToEvent(e,t){const r=this.current;if(!r)return!1;const s=JSON.stringify(u.SHARED.map(a=>r[a])),i=a=>typeof a=="string"||typeof a=="object"&&a!==null&&!Array.isArray(a),n={title:i,summary:i,time:a=>typeof a=="string",medium:a=>typeof a=="string",by:a=>Array.isArray(a),interviewOf:a=>typeof a=="string"||Array.isArray(a)};for(const a of u.SHARED){const o=e[a];o!==void 0&&n[a](o)?r[a]=structuredClone(o):t&&delete r[a]}return JSON.stringify(u.SHARED.map(a=>r[a]))!==s}syncFileFromEvent(){const e=this.current,t=this.fileEditor?.text??this.text;if(!e||t===void 0)return;let r;try{r=JSON.parse(t)}catch{return}if(typeof r!="object"||r===null||Array.isArray(r))return;const s=u.pretty(u.withEventFields(r,e));s!==t&&(this.text=s,this.fileEditor?.replaceText(s,!1),this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:"transcript",event:e,text:s}})))}template(e){return u.pretty(u.withEventFields({version:1,language:this.language,speakers:{interviewer:{role:"interviewer"},witness:{role:"witness"}},segments:[]},e))}loadFileEditor(e){return this.fileEditorLoading??=(async()=>{try{const[{SightingFileEditor:t},{default:r},s]=await Promise.all([x(()=>import("./SightingFileEditor-CQtQqTVl.js"),__vite__mapDeps([8,9,10]),import.meta.url),x(()=>import("./interviewSchema-Dk0AWHwc.js"),[],import.meta.url),te(this.language)]);return this.fileEditor=new t(this.shadow.getElementById("file-editor"),e,i=>this.onEdited(i),this.messages.editorLabel,{baseline:e,phrases:s.fileSearchPhrases,schema:r}),this.fileEditor}catch(t){throw this.fileEditorLoading=void 0,t}})(),this.fileEditorLoading}async showTranscript(){const e=this.current;if(!e||this.shownFor===e)return;this.note(this.messages.loading);let t=this.text;if(t===void 0){const r=this.transcriptUrl(e);if(r!==void 0)try{const s=await I.json(r);this.current===e&&typeof s=="object"&&s!==null&&!Array.isArray(s)?(this.applyFileToEvent(s,!1)&&this.fileChangedEvent(),t=u.pretty(u.withEventFields(s,e))):t=u.pretty(s)}catch{this.note(this.messages.loadFailed,"error")}t??=this.template(e)}if(this.current===e)try{const r=await this.loadFileEditor(t);if(this.current!==e)return;r.replaceText(t,!1),this.shownFor=e,this.text!==void 0||this.transcriptUrl(e)===void 0?this.note(void 0):this.shadow.getElementById("file-note").textContent===this.messages.loading&&this.note(void 0)}catch{this.note(this.messages.loadFailed,"error")}}onEdited(e){this.text=e;let t,r=!0;try{t=JSON.parse(e)}catch{r=!1}this.note(r?void 0:this.messages.invalid,"error");const s=this.current;if(r&&s&&typeof t=="object"&&t!==null&&!Array.isArray(t)&&this.applyFileToEvent(t,!0)&&this.fileChangedEvent(),s&&!s.url&&e.trim()!==""){const i=s.id??"1";s.url=`${i.startsWith("interview")?i:`interview-${i}`}.json`,this.field("url").value=s.url,this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:"url",event:s}}))}this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:"transcript",event:s,text:e}})),this.exchangesShown=this.showExchanges()}fileChangedEvent(){this.render(),this.dispatchEvent(new CustomEvent(O,{bubbles:!0,composed:!0,detail:{field:"file",event:this.current}}))}async take(e){if(typeof e!="object"||e===null||!Array.isArray(e.segments)){this.note(this.messages.notATranscript,"error");return}const t=this.current;t&&this.applyFileToEvent(e,!1)&&this.fileChangedEvent();const r=u.pretty(t?u.withEventFields(e,t):e);await this.loadFileEditor(r).then(s=>s.replaceText(r,!1),()=>{}),this.shownFor=this.current,this.note(void 0),this.onEdited(r)}async importFromFile(e){try{const t=await e.text();let r;try{r=JSON.parse(t)}catch{r=void 0}if(typeof r!="object"||r===null){const{InterviewImport:s}=await x(async()=>{const{InterviewImport:o}=await import("./interviewImport-CgWyTdKb.js");return{InterviewImport:o}},__vite__mapDeps([5,6,7]),import.meta.url),i=this.current,n=[i?.interviewOf].flat().filter(o=>typeof o=="string"),a=s.parse(t,{by:(i?.by??[]).map(o=>u.byText([o])).filter(o=>o!==""),witnesses:this.options.filter(o=>n.length===0||n.includes(o.id))});r=a&&{...a,transcription:{note:`Imported from ${e.name}: who speaks and when are as the file gave them, to be checked.`}}}r===void 0?this.note(this.messages.notATranscript,"error"):await this.take(r)}catch{this.note(this.messages.loadFailed,"error")}}async importFromUrl(e){try{await this.take(await I.json(new URL(e,this.base??location.href).href))}catch{this.note(this.messages.loadFailed,"error")}}save(){const e=this.fileEditor?.text??this.text;if(e===void 0)return;const t=(this.current?.url??"").split("/").pop()||`${this.current?.id??"interview"}.json`,r=URL.createObjectURL(new Blob([e],{type:"application/json"})),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}}function de(){se(),Z(),customElements.get(z)||customElements.define(z,u)}export{O as INTERVIEW_CHANGE_EVENT,z as INTERVIEW_EDITOR_ELEMENT_NAME,X as INTERVIEW_SEEK_EVENT,u as InterviewEditorElement,de as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ac as O,
|
|
1
|
+
import{ac as O,aJ as D,aK as y}from"./rr0-sighting-editor.mjs";class l{static DEFAULT_DIVERGENCE_MRAD=.1;static DEFAULT_APERTURE_M=.01;static AEROSOL_SINGLE_SCATTERING_ALBEDO=.9;static AEROSOL_ASYMMETRY=.7;static DEFAULT_PATCHINESS=.35;static PATCH_M=120;static STEP_M=25;static MAX_SAMPLES=2e3;static viewsAt(n,o,t,s){return l.onAt(n,o).map(c=>l.viewOf(c,t,s))}static viewOf(n,o,t){return{id:n.id,wavelengthNm:n.wavelengthNm,patchiness:n.patchiness??l.DEFAULT_PATCHINESS,samples:l.samplesOf(n,o,t)}}static onAt(n,o){return n.filter(t=>(t.fromT===void 0||o>=t.fromT)&&(t.untilT===void 0||o<=t.untilT)).map(t=>l.stateAt(t,o)).filter(t=>t.path.length>=2)}static stateAt(n,o){if(!n.light?.length&&!n.moves?.length)return n;const t={...n};if(n.light?.length){const s=l.joined(n.light.filter(e=>e.wavelengthNm!==void 0),o,e=>e.wavelengthNm),c=l.joined(n.light.filter(e=>e.powerW!==void 0),o,e=>e.powerW);s!==void 0&&(t.wavelengthNm=s),c!==void 0&&(t.powerW=c)}return n.moves?.length&&(t.path=l.pathAt(n.moves,o)),t}static joined(n,o,t){if(n.length===0)return;const s=[...n].sort((a,i)=>a.t-i.t);if(o<=s[0].t)return t(s[0]);const c=s[s.length-1];if(o>=c.t)return t(c);const e=s.findIndex(a=>a.t>o),r=s[e-1],h=s[e],M=(o-r.t)/(h.t-r.t);return t(r)+(t(h)-t(r))*M}static pathAt(n,o){const t=[...n].sort((a,i)=>a.t-i.t);if(o<=t[0].t)return t[0].path;const s=t[t.length-1];if(o>=s.t)return s.path;const c=t.findIndex(a=>a.t>o),e=t[c-1],r=t[c];if(e.path.length!==r.path.length)return e.path;const h=(o-e.t)/(r.t-e.t),M=(a,i)=>a+(i-a)*h;return e.path.map((a,i)=>({lat:M(a.lat,r.path[i].lat),lng:M(a.lng,r.path[i].lng),altitudeM:M(a.altitudeM,r.path[i].altitudeM)}))}static patchAt(n,o,t){if(t.patchiness<=0)return 1;const s=o/1e3,c=(r,h)=>{const M=(n-t.windAlongMS*s)/r,a=(Math.abs(t.windAcrossMS)+.3)*s/r+h;return l.valueNoise(M,a)},e=(2*c(l.PATCH_M,0)+c(l.PATCH_M/3,17.3))/3;return 1+t.patchiness*(2*e-1)}static valueNoise(n,o){const t=Math.floor(n),s=Math.floor(o),c=n-t,e=o-s,r=i=>i*i*(3-2*i),h=(i,g)=>{const v=Math.sin(i*127.1+g*311.7)*43758.5453;return v-Math.floor(v)},M=h(t,s)+(h(t+1,s)-h(t,s))*r(c),a=h(t,s+1)+(h(t+1,s+1)-h(t,s+1))*r(c);return M+(a-M)*r(e)}static samplesOf(n,o,t){const s=O.ecef({lat:o.lat,lng:o.lng,heightM:0}),c=o.lat*Math.PI/180,e=o.lng*Math.PI/180,r=u=>{const p=u[0]-s[0],A=u[1]-s[1],f=u[2]-s[2];return[-Math.sin(e)*p+Math.cos(e)*A,-Math.sin(c)*Math.cos(e)*p-Math.sin(c)*Math.sin(e)*A+Math.cos(c)*f,Math.cos(c)*Math.cos(e)*p+Math.cos(c)*Math.sin(e)*A+Math.sin(c)*f]},h=(n.divergenceMrad??l.DEFAULT_DIVERGENCE_MRAD)/1e3,M=n.apertureM??l.DEFAULT_APERTURE_M,a=[];let i=0,g=n.powerW,v=0;for(let u=0;u+1<n.path.length;u++){const p=n.path[u],A=n.path[u+1],f=O.ecef({lat:p.lat,lng:p.lng,heightM:p.altitudeM}),w=O.ecef({lat:A.lat,lng:A.lng,heightM:A.altitudeM}),d=Math.hypot(w[0]-f[0],w[1]-f[1],w[2]-f[2]),[C,S]=(()=>{const[E,R]=r(f),[N,T]=r(w);return[(N-E)/(d||1),(T-R)/(d||1)]})(),I=Math.max(1,Math.min(l.MAX_SAMPLES,Math.ceil(d/l.STEP_M)));for(let E=u===0?0:1;E<=I;E++){const R=E/I,N=[0,1,2].map(P=>f[P]+(w[P]-f[P])*R),T=R*d,x=p.altitudeM+(A.altitudeM-p.altitudeM)*R+l.bulgeM(T,d);if(E>0){const P=a[a.length-1],W=T+i-P.fromSourceM,H=l.extinctionAt(t,n.wavelengthNm,(P.altitudeM+x)/2);v+=H*W,g=n.powerW*Math.exp(-v)}const[U,F,G]=r(N);a.push({eastM:U,northM:F,upM:G,altitudeM:x,fromSourceM:i+T,dirEast:C,dirNorth:S,widthM:M+h*(i+T),powerW:g})}i+=d}return a}static bulgeM(n,o){return n*(o-n)/(2*6371e3)}static extinctionAt(n,o,t){const{rayleighPerM:s,aerosolPerM:c}=l.coefficientsAt(n,o,t);return s+c}static coefficientsAt(n,o,t){const s=D.rayleighAt(o)*D.rayleighDensity(t),c=n.aerosol[1]*(o/550)**-1.3*D.aerosolDensity(t);return{rayleighPerM:s,aerosolPerM:c}}static phasedScattering(n,o){const t=3/(16*Math.PI)*(1+o*o),s=l.AEROSOL_ASYMMETRY,c=(1-s*s)/(4*Math.PI*(1+s*s-2*s*o)**1.5);return n.rayleighPerM*t+n.aerosolPerM*l.AEROSOL_SINGLE_SCATTERING_ALBEDO*c}static efficacy(n){return 683*Math.max(0,y.colourMatching(n)[1])}static colourOf(n){const[o,t,s]=y.colourMatching(n);if(t<=0)return[0,0,0];const c=y.linearSrgbOf([o/t,1,s/t]).map(r=>Math.max(0,r)),e=.2126*c[0]+.7152*c[1]+.0722*c[2];return c.map(r=>r/e)}static luminanceCdM2(n,o,t,s,c){return l.efficacy(o)*n*t/(s*Math.max(c,.001))}}export{l as L};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as y,_ as d,az as b,a1 as x,a2 as E,c as g,$ as w,a0 as j,a3 as v,aK as k}from"./rr0-sighting-editor.mjs";import{S as I}from"./SkyEventEditorStyle-CvY_AhbI.js";import{L as T}from"./LaunchPlume-DdX9-Rlw.js";const S=y.catalog({en:()=>d(()=>import("./LaunchParameterTexts_en-DvrCwbDM.js"),[],import.meta.url).then(r=>r.launchParameterTexts_en),fr:()=>d(()=>import("./LaunchParameterTexts_fr-Bh_1zVzy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_fr),es:()=>d(()=>import("./LaunchParameterTexts_es--RUAegVp.js"),[],import.meta.url).then(r=>r.launchParameterTexts_es),it:()=>d(()=>import("./LaunchParameterTexts_it-CWDx9nJy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_it)});class n{static plumeValue(e){return t=>T.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:n.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:"engine",effective:i=>t.ends(i.track??[])?.t}}static placeAt(e,t){if(e.length===0)return{t,lat:0,lng:0,altitudeKm:0};if(e.length===1)return{t,lat:e[0].lat,lng:e[0].lng,altitudeKm:e[0].altitudeKm};let i=0;for(;i<e.length-2&&e[i+1].t<t;)i++;const s=e[i],a=e[i+1],l=a.t===s.t?0:(t-s.t)/(a.t-s.t),o=(m,h)=>m+(h-m)*l;return{t,lat:o(s.lat,a.lat),lng:o(s.lng,a.lng),altitudeKm:Math.max(0,o(s.altitudeKm,a.altitudeKm))}}static instantsOf(e){return[...e.track.map(t=>t.t),...[e.burnFromT,e.burnUntilT].filter(t=>t!==void 0),...(e.jets??[]).flatMap(t=>[t.fromT,t.untilT])]}static SET={kind:"launch",title:"launch",parameters:[{type:"said",key:"title",label:"name",group:"vehicle"},{type:"text",key:"vehicle.mission",label:"mission",placeholder:"Starlink Group 10-49",group:"vehicle"},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:"thrustVacuum",hint:"merlinVacuum934Rl10110A",group:"engine"},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:"specificImpulseVacuum",hint:"times981MSIt",group:"engine"},{type:"choice",key:"vehicle.engine.propellant",label:"propellant",hint:"whatTheExhaustIsMadeOf",choices:[{value:"rp1-lox",label:"keroseneAndOxygen"},{value:"methane-lox",label:"methaneAndOxygen"},{value:"hydrogen-lox",label:"hydrogenAndOxygen"},{value:"hypergolic",label:"hypergolic"},{value:"solid",label:"solid"}],group:"engine"},n.burn("burnFromT",{label:"engineStart",hint:"whenTheEngineStartedInSeconds",ends:e=>e[0]}),n.burn("burnUntilT",{label:"engineCutOff",hint:"whenTheEngineStoppedInSeconds",ends:e=>e[e.length-1]}),n.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:"exhaustFlow",hint:"howMuchExhaustLeavesTheEngine",group:"plume"}),n.plume("condensedShare",{min:0,max:1,step:.01,label:"shareThatScatters",hint:"theShareOfTheExhaustThat",group:"plume"}),n.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:"particleRadius",group:"plume"}),n.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:"trailLifetime",hint:"howLongTheNarrowTrailLasts",group:"plume"}),n.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:"trailSpreading",group:"plume"}),n.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:"radiusAtRelease",group:"plume"}),n.plume("collarShare",{min:0,max:1,step:.01,label:"shareInTheCollar",hint:"theCollarIsTheExhaustJust",group:"collar"}),n.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:"collarSpreading",hint:"howFastTheCollarWidensThree",group:"collar"}),n.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:"collarLifetime",group:"collar"})]};static PLACE={kind:"launch-place",title:"placeOfThePath",parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecordingNegativeBefore"},{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,label:"position"},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:"altitude"}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:s,index:a}=i??{};return s?e(T.releaseOf(s,t,a)):void 0}}static JET_GROUP="jet";static JET={kind:"launch-jet",title:"jet",parameters:[{type:"choice",key:"kind",required:!0,label:"what",choices:[{value:"burn",label:"engineBurn"},{value:"vent",label:"propellantVented"}],group:n.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"from",hint:"secondsOfTheRecordingNegativeBefore2",group:n.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"until",group:n.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:"directionFromAft",hint:"t0StraightBackAlongTheStage",group:n.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:"side",hint:"roundTheLineOfMotionWhich",group:n.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:"spinPeriod",hint:"howLongTheStageTakesTo",group:n.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:n.jetValue(e=>e.speedKmPerS),label:"speed",hint:"howFastItLeavesTheStage",group:n.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:n.jetValue(e=>e.massKgPerS),label:"flow",group:n.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:n.jetValue(e=>e.condensedShare),label:"shareThatScatters",group:n.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:n.jetValue(e=>e.particleRadiusUm),label:"particleRadius",group:n.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:n.jetValue(e=>e.populations[0].expansionKmPerS),label:"spreading",hint:"howFastEachPuffOfIt",group:n.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:n.jetValue(e=>e.initialRadiusKm),label:"radiusAtRelease",group:n.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:n.jetValue(e=>e.populations[0].lifetimeS),label:"lifetime",group:n.JET_GROUP}]};static publish(){b.publish(n.SET)}}const O=y.catalog({en:()=>d(()=>import("./LaunchEditorMessages_en-BnzNAYW9.js"),[],import.meta.url).then(r=>r.launchEditorMessages_en),fr:()=>d(()=>import("./LaunchEditorMessages_fr-Ds_VOB8c.js"),[],import.meta.url).then(r=>r.launchEditorMessages_fr),es:()=>d(()=>import("./LaunchEditorMessages_es-BE0dEl7I.js"),[],import.meta.url).then(r=>r.launchEditorMessages_es),it:()=>d(()=>import("./LaunchEditorMessages_it-DPQaR8HY.js"),[],import.meta.url).then(r=>r.launchEditorMessages_it)});class u{constructor(e,t,i){this.container=e,this.host=t,I.attach(e,"launch-editor-part",u.STYLE),this.language=i,b.of("launch")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="path";placeForm;placeIndex=0;jetForm;jetIndex=0;language;shown=[];static STYLE='.launch-editor-part { flex-basis: 100%; min-width: 0; } .launch-editor-part #launch-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .launch-editor-part .launch-path > .icon-btn { align-self: flex-end; } .launch-editor-part #launch-list, .launch-editor-part #launch-places { flex-basis: 100%; min-width: 0; } .launch-editor-part .launch-editor, .launch-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .launch-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .launch-editor-part [hidden] { display: none !important; } .launch-editor-part select { min-width: 0; width: 100%; } .launch-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-track { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .launch-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .launch-editor-part input, .launch-editor-part select { max-width: 100%; box-sizing: border-box; } .launch-editor-part input[type="text"] { width: 12em; } .launch-editor-part #launch-title { width: 18em; } .launch-editor-part label { min-width: 0; max-width: 100%; } .launch-editor-part input.parameter-derived::placeholder { opacity: .65; } .launch-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([O.load(e),S.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlace(!0),this.syncJet(!0);const i=this.resolved(b.of("launch"));this.form??=new x(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;if(e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.jetIndex=0,this.sync())}resolved(e){return E.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
1
|
+
import{o as y,_ as d,az as b,a1 as x,a2 as E,c as g,$ as w,a0 as j,a3 as v,aL as k}from"./rr0-sighting-editor.mjs";import{S as I}from"./SkyEventEditorStyle-CvY_AhbI.js";import{L as T}from"./LaunchPlume-By8E1xvy.js";const S=y.catalog({en:()=>d(()=>import("./LaunchParameterTexts_en-DvrCwbDM.js"),[],import.meta.url).then(r=>r.launchParameterTexts_en),fr:()=>d(()=>import("./LaunchParameterTexts_fr-Bh_1zVzy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_fr),es:()=>d(()=>import("./LaunchParameterTexts_es--RUAegVp.js"),[],import.meta.url).then(r=>r.launchParameterTexts_es),it:()=>d(()=>import("./LaunchParameterTexts_it-CWDx9nJy.js"),[],import.meta.url).then(r=>r.launchParameterTexts_it)});class n{static plumeValue(e){return t=>T.plumeOf(t)[e]}static plume(e,t){return{type:"number",key:`plume.${e}`,effective:n.plumeValue(e),...t}}static burn(e,t){return{type:"number",key:e,min:-3600,max:36e3,step:.1,unit:"s",scale:.001,label:t.label,hint:t.hint,group:"engine",effective:i=>t.ends(i.track??[])?.t}}static placeAt(e,t){if(e.length===0)return{t,lat:0,lng:0,altitudeKm:0};if(e.length===1)return{t,lat:e[0].lat,lng:e[0].lng,altitudeKm:e[0].altitudeKm};let i=0;for(;i<e.length-2&&e[i+1].t<t;)i++;const s=e[i],a=e[i+1],l=a.t===s.t?0:(t-s.t)/(a.t-s.t),o=(m,h)=>m+(h-m)*l;return{t,lat:o(s.lat,a.lat),lng:o(s.lng,a.lng),altitudeKm:Math.max(0,o(s.altitudeKm,a.altitudeKm))}}static instantsOf(e){return[...e.track.map(t=>t.t),...[e.burnFromT,e.burnUntilT].filter(t=>t!==void 0),...(e.jets??[]).flatMap(t=>[t.fromT,t.untilT])]}static SET={kind:"launch",title:"launch",parameters:[{type:"said",key:"title",label:"name",group:"vehicle"},{type:"text",key:"vehicle.mission",label:"mission",placeholder:"Starlink Group 10-49",group:"vehicle"},{type:"number",key:"vehicle.engine.thrustKN",min:1,max:1e5,step:1,unit:"kN",label:"thrustVacuum",hint:"merlinVacuum934Rl10110A",group:"engine"},{type:"number",key:"vehicle.engine.specificImpulseS",min:100,max:500,step:1,unit:"s",label:"specificImpulseVacuum",hint:"times981MSIt",group:"engine"},{type:"choice",key:"vehicle.engine.propellant",label:"propellant",hint:"whatTheExhaustIsMadeOf",choices:[{value:"rp1-lox",label:"keroseneAndOxygen"},{value:"methane-lox",label:"methaneAndOxygen"},{value:"hydrogen-lox",label:"hydrogenAndOxygen"},{value:"hypergolic",label:"hypergolic"},{value:"solid",label:"solid"}],group:"engine"},n.burn("burnFromT",{label:"engineStart",hint:"whenTheEngineStartedInSeconds",ends:e=>e[0]}),n.burn("burnUntilT",{label:"engineCutOff",hint:"whenTheEngineStoppedInSeconds",ends:e=>e[e.length-1]}),n.plume("exhaustKgPerS",{min:.1,max:1e5,step:.1,unit:"kg/s",label:"exhaustFlow",hint:"howMuchExhaustLeavesTheEngine",group:"plume"}),n.plume("condensedShare",{min:0,max:1,step:.01,label:"shareThatScatters",hint:"theShareOfTheExhaustThat",group:"plume"}),n.plume("particleRadiusUm",{min:.05,max:5,step:.05,unit:"µm",label:"particleRadius",group:"plume"}),n.plume("lifetimeS",{min:10,max:3600,step:10,unit:"s",label:"trailLifetime",hint:"howLongTheNarrowTrailLasts",group:"plume"}),n.plume("expansionKmPerS",{min:0,max:5,step:.01,unit:"km/s",label:"trailSpreading",group:"plume"}),n.plume("initialRadiusKm",{min:0,max:50,step:.1,unit:"km",label:"radiusAtRelease",group:"plume"}),n.plume("collarShare",{min:0,max:1,step:.01,label:"shareInTheCollar",hint:"theCollarIsTheExhaustJust",group:"collar"}),n.plume("collarExpansionKmPerS",{min:0,max:10,step:.05,unit:"km/s",label:"collarSpreading",hint:"howFastTheCollarWidensThree",group:"collar"}),n.plume("collarLifetimeS",{min:1,max:300,step:1,unit:"s",label:"collarLifetime",group:"collar"})]};static PLACE={kind:"launch-place",title:"placeOfThePath",parameters:[{type:"number",key:"t",min:-3600,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"time",hint:"secondsOfTheRecordingNegativeBefore"},{type:"position",key:"lat",secondKey:"lng",saidKey:"saidPosition",native:"geo",step:1,label:"position"},{type:"number",key:"altitudeKm",min:0,max:2e3,step:.1,unit:"km",required:!0,label:"altitude"}]};static jetContext(e,t){return{launch:e,index:t}}static jetValue(e){return(t,i)=>{const{launch:s,index:a}=i??{};return s?e(T.releaseOf(s,t,a)):void 0}}static JET_GROUP="jet";static JET={kind:"launch-jet",title:"jet",parameters:[{type:"choice",key:"kind",required:!0,label:"what",choices:[{value:"burn",label:"engineBurn"},{value:"vent",label:"propellantVented"}],group:n.JET_GROUP},{type:"number",key:"fromT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"from",hint:"secondsOfTheRecordingNegativeBefore2",group:n.JET_GROUP},{type:"number",key:"untilT",min:-36e3,max:36e3,step:.1,unit:"s",scale:.001,required:!0,label:"until",group:n.JET_GROUP},{type:"number",key:"angleDeg",min:0,max:180,step:1,unit:"°",effective:()=>0,label:"directionFromAft",hint:"t0StraightBackAlongTheStage",group:n.JET_GROUP},{type:"number",key:"azimuthDeg",min:-360,max:360,step:1,unit:"°",effective:()=>0,label:"side",hint:"roundTheLineOfMotionWhich",group:n.JET_GROUP},{type:"number",key:"spinPeriodS",min:-3600,max:3600,step:.1,unit:"s",label:"spinPeriod",hint:"howLongTheStageTakesTo",group:n.JET_GROUP},{type:"number",key:"speedKmPerS",min:0,max:10,step:.01,unit:"km/s",effective:n.jetValue(e=>e.speedKmPerS),label:"speed",hint:"howFastItLeavesTheStage",group:n.JET_GROUP},{type:"number",key:"massKgPerS",min:0,max:1e5,step:.1,unit:"kg/s",effective:n.jetValue(e=>e.massKgPerS),label:"flow",group:n.JET_GROUP},{type:"number",key:"condensedShare",min:0,max:1,step:.01,effective:n.jetValue(e=>e.condensedShare),label:"shareThatScatters",group:n.JET_GROUP},{type:"number",key:"particleRadiusUm",min:.05,max:5,step:.05,unit:"µm",effective:n.jetValue(e=>e.particleRadiusUm),label:"particleRadius",group:n.JET_GROUP},{type:"number",key:"expansionKmPerS",min:0,max:5,step:.01,unit:"km/s",effective:n.jetValue(e=>e.populations[0].expansionKmPerS),label:"spreading",hint:"howFastEachPuffOfIt",group:n.JET_GROUP},{type:"number",key:"initialRadiusKm",min:0,max:50,step:.1,unit:"km",effective:n.jetValue(e=>e.initialRadiusKm),label:"radiusAtRelease",group:n.JET_GROUP},{type:"number",key:"lifetimeS",min:1,max:7200,step:1,unit:"s",effective:n.jetValue(e=>e.populations[0].lifetimeS),label:"lifetime",group:n.JET_GROUP}]};static publish(){b.publish(n.SET)}}const O=y.catalog({en:()=>d(()=>import("./LaunchEditorMessages_en-BnzNAYW9.js"),[],import.meta.url).then(r=>r.launchEditorMessages_en),fr:()=>d(()=>import("./LaunchEditorMessages_fr-Ds_VOB8c.js"),[],import.meta.url).then(r=>r.launchEditorMessages_fr),es:()=>d(()=>import("./LaunchEditorMessages_es-BE0dEl7I.js"),[],import.meta.url).then(r=>r.launchEditorMessages_es),it:()=>d(()=>import("./LaunchEditorMessages_it-DPQaR8HY.js"),[],import.meta.url).then(r=>r.launchEditorMessages_it)});class u{constructor(e,t,i){this.container=e,this.host=t,I.attach(e,"launch-editor-part",u.STYLE),this.language=i,b.of("launch")||n.publish(),this.ready=this.setLanguage(i)}messages;ready;parameterTexts;languageToken=0;currentId;form;list;timeline;row="path";placeForm;placeIndex=0;jetForm;jetIndex=0;language;shown=[];static STYLE='.launch-editor-part { flex-basis: 100%; min-width: 0; } .launch-editor-part #launch-timeline { flex-basis: 100%; min-width: 0; padding: 4px 0; } .launch-editor-part .launch-path > .icon-btn { align-self: flex-end; } .launch-editor-part #launch-list, .launch-editor-part #launch-places { flex-basis: 100%; min-width: 0; } .launch-editor-part .launch-editor, .launch-editor-part .launch-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; } .launch-editor-part .launch-fields { flex-basis: 100%; min-width: 0; } .launch-editor-part [hidden] { display: none !important; } .launch-editor-part select { min-width: 0; width: 100%; } .launch-editor-part .launch-intro { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-track { flex-basis: 100%; margin: 0; } .launch-editor-part .launch-parameters { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; } .launch-editor-part .parameter-group { flex: 1 1 14em; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; align-content: flex-start; } .launch-editor-part input, .launch-editor-part select { max-width: 100%; box-sizing: border-box; } .launch-editor-part input[type="text"] { width: 12em; } .launch-editor-part #launch-title { width: 18em; } .launch-editor-part label { min-width: 0; max-width: 100%; } .launch-editor-part input.parameter-derived::placeholder { opacity: .65; } .launch-editor-part .launch-path { flex: 1 1 100%; min-width: 0; box-sizing: border-box; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }';async setLanguage(e){const t=++this.languageToken;this.language=e;const[i,s]=await Promise.all([O.load(e),S.load(e)]);t===this.languageToken&&(this.messages=i,this.parameterTexts=s,this.render(),this.sync())}sync(){if(!this.messages)return;const e=this.launches;this.shown=[...e],e.some(s=>s.id===this.currentId)||(this.currentId=e[0]?.id),this.list?.setItems(e.map(s=>({id:s.id,label:this.labelOf(s)})),this.currentId),this.syncAddState();const t=this.current;if(this.element("launch-fields").hidden=t===void 0,!t)return;this.syncPlace(!0),this.syncJet(!0);const i=this.resolved(b.of("launch"));this.form??=new x(this.element("launch-parameters"),this.language,"",{said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()}),this.form.show(i,t,()=>this.written())}refresh(){if(!this.messages)return;this.syncAddState();const e=this.launches;if(e.length===this.shown.length&&e.every((t,i)=>t===this.shown[i])){this.syncTimeline();return}this.sync()}setTime(e){this.messages&&this.timeline?.setTime(e)}syncAddState(){const e=this.startOfNew()!==void 0;this.list?.setAddState(e,e?void 0:this.messages.addLaunchNowhere)}get current(){return this.launches.find(e=>e.id===this.currentId)}show(e){this.messages&&(this.currentId=e,this.row="path",this.placeIndex=0,this.jetIndex=0,this.sync())}resolved(e){return E.resolve(e,this.parameterTexts)}render(){if(!this.messages)return;const e=this.messages;this.form=void 0,this.container.innerHTML=`<div class="launch-editor">
|
|
2
2
|
<p class="launch-intro">${e.intro}</p>
|
|
3
3
|
<div id="launch-list"></div>
|
|
4
4
|
<div id="launch-fields" class="launch-fields">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aO as F,aP as v,aQ as b,aR as Y,ac as H}from"./rr0-sighting-editor.mjs";class K{static MU=398600.4418;static OMEGA=72921159e-12;static EARTH_RADIUS_KM=6371;static STEP_S=1;static DENSITY=[[0,1.225],[20,.0889],[40,.004],[60,31e-5],[80,185e-7],[100,56e-8],[120,222e-10],[150,208e-11],[200,254e-12],[250,607e-13],[300,192e-13],[400,28e-13],[500,522e-15],[600,114e-15],[700,307e-16],[800,114e-16],[900,576e-17],[1e3,356e-17]];static FREE_PATH_TIMES_DENSITY=68e-9;static ICE_DENSITY=917;static airDensity(s){const t=K.DENSITY;if(s<=t[0][0])return t[0][1];let e=0;for(;e<t.length-2&&t[e+1][0]<s;)e++;const[a,i]=t[e],[o,n]=t[e+1];return i*Math.exp(Math.log(n/i)*(s-a)/(o-a))}static dragPerKm(s,t,e,a=.5){const i=K.airDensity(s),o=K.FREE_PATH_TIMES_DENSITY/i/1e3,n=Math.exp(-o/t),p=i*1e9*Math.PI*t*t/Math.max(e,1e-9),d=3*i/(4*a*1e-6*K.ICE_DENSITY)*1e3;return n*p+(1-n)*d}static step(s,t,e,a,i){const[o,n,p,d,R,h]=s,m=Math.hypot(o,n,p),T=K.OMEGA,M=-398600.4418/(m*m*m),y=M*o+2*T*R+T*T*o,U=M*n-2*T*d+T*T*n,I=M*p,E=Math.hypot(d,R,h),c=1/(1+K.dragPerKm(m-K.EARTH_RADIUS_KM,e,a,i)*E*t);s[3]=(d+y*t)*c,s[4]=(R+U*t)*c,s[5]=(h+I*t)*c,s[0]=o+s[3]*t,s[1]=n+s[4]*t,s[2]=p+s[5]*t;const f=Math.hypot(s[0],s[1],s[2]);if(f<K.EARTH_RADIUS_KM){const A=K.EARTH_RADIUS_KM/f;s[0]*=A,s[1]*=A,s[2]*=A,s[3]=s[4]=s[5]=0}}}class _{constructor(s,t,e,a,i=.5){this.massKg=e,this.radiusAt=a,this.particleRadiusUm=i,this.state=Float64Array.of(...s,...t),this.positions=new Float64Array(192),this.positions.set(s,0)}positions;steps=0;state;at(s){const t=K.STEP_S,e=Math.max(0,s/t),a=Math.ceil(e);for(;this.steps<a;){if(K.step(this.state,t,this.radiusAt(this.steps*t),this.massKg,this.particleRadiusUm),this.steps++,3*(this.steps+1)>this.positions.length){const p=new Float64Array(this.positions.length*2);p.set(this.positions),this.positions=p}this.positions.set(this.state.subarray(0,3),3*this.steps)}const i=Math.floor(e),o=e-i,n=this.positions;return o===0||i>=this.steps?[n[3*i],n[3*i+1],n[3*i+2]]:[0,1,2].map(p=>n[3*i+p]+(n[3*i+3+p]-n[3*i+p])*o)}}class r{static EARTH_RADIUS_KM=6371;static SHADOW_RADIUS_KM=r.EARTH_RADIUS_KM+15;static PENUMBRA_KM=10;static SUN_ILLUMINANCE_LUX=127e3;static RAYLEIGH_PER_M=[58e-7,135e-7,331e-7];static SCALE_HEIGHT_M=8e3;static OZONE_GRAZING_DEPTH=[2.4,1.8,.24];static ANISOTROPY=.7;static ALBEDO=.99;static WAVELENGTHS_UM=[.61,.55,.465];static ICE_INDEX=1.31;static DEFAULTS={exhaustKgPerS:273,condensedShare:.065,particleRadiusUm:.5,expansionKmPerS:.15,initialRadiusKm:.5,lifetimeS:420,collarShare:.85,collarExpansionKmPerS:2.5,collarLifetimeS:20};static PROPELLANTS={"rp1-lox":{condensedShare:.065,particleRadiusUm:.5},"methane-lox":{condensedShare:.09,particleRadiusUm:.5},"hydrogen-lox":{condensedShare:.13,particleRadiusUm:.5},hypergolic:{condensedShare:.079,particleRadiusUm:.4},solid:{condensedShare:.27,particleRadiusUm:.8}};static G0=9.80665;static COLLAR_SPREAD_OF_EXHAUST_VELOCITY=.735;static plumeOf(s){const t={},e=s.vehicle?.engine;if(e){const a=e.specificImpulseS===void 0?void 0:e.specificImpulseS*r.G0;e.thrustKN!==void 0&&a&&(t.exhaustKgPerS=e.thrustKN*1e3/a),a&&(t.collarExpansionKmPerS=a/1e3*r.COLLAR_SPREAD_OF_EXHAUST_VELOCITY),e.propellant&&Object.assign(t,r.PROPELLANTS[e.propellant])}return{...r.DEFAULTS,...t,...s.plume}}static PUFF_EVERY_S=.5;static SIGMA_OF_RADIUS=.5;static MAX_PUFFS=320;static DEG=Math.PI/180;static EARTH_ROTATION=72921159e-12;static VENT_DEFAULTS={speedKmPerS:.7,massKgPerS:20,condensedShare:.5,particleRadiusUm:.5,expansionKmPerS:.1,initialRadiusKm:.2,lifetimeS:600};static paths=new WeakMap;static exhaustVelocityKmPerS(s){return(s.vehicle?.engine?.specificImpulseS??348)*r.G0/1e3}static releasesOf(s){const t=[],e=s.jets??[];if(e.length===0||s.burnFromT!==void 0||s.burnUntilT!==void 0){const a=s.track[0]?.t??0,i=s.track[s.track.length-1]?.t??0;t.push(r.engineRelease(s,"burn",{fromT:s.burnFromT??a,untilT:s.burnUntilT??i}))}return e.forEach((a,i)=>t.push(r.releaseOf(s,a,i))),t}static releaseOf(s,t,e){const a=`jet:${t.id??e}`;if((t.kind??"burn")==="burn")return r.engineRelease(s,a,t);const i=r.VENT_DEFAULTS;return{key:a,fromT:t.fromT,untilT:t.untilT,angleDeg:t.angleDeg??0,azimuthDeg:t.azimuthDeg??0,spinPeriodS:t.spinPeriodS,speedKmPerS:t.speedKmPerS??i.speedKmPerS,massKgPerS:t.massKgPerS??i.massKgPerS,condensedShare:t.condensedShare??i.condensedShare,particleRadiusUm:t.particleRadiusUm??i.particleRadiusUm,initialRadiusKm:t.initialRadiusKm??i.initialRadiusKm,populations:[{share:1,expansionKmPerS:t.expansionKmPerS??i.expansionKmPerS,lifetimeS:t.lifetimeS??i.lifetimeS}]}}static engineRelease(s,t,e){const a=r.plumeOf(s);return{key:t,fromT:e.fromT,untilT:e.untilT,angleDeg:e.angleDeg??0,azimuthDeg:e.azimuthDeg??0,spinPeriodS:e.spinPeriodS,speedKmPerS:e.speedKmPerS??r.exhaustVelocityKmPerS(s),massKgPerS:e.massKgPerS??a.exhaustKgPerS,condensedShare:e.condensedShare??a.condensedShare,particleRadiusUm:e.particleRadiusUm??a.particleRadiusUm,initialRadiusKm:e.initialRadiusKm??a.initialRadiusKm,populations:[{share:1-a.collarShare,expansionKmPerS:e.expansionKmPerS??a.expansionKmPerS,lifetimeS:e.lifetimeS??a.lifetimeS},{share:a.collarShare,expansionKmPerS:a.collarExpansionKmPerS,lifetimeS:a.collarLifetimeS}]}}static extinctionEfficiency(s,t){const e=2*Math.PI*s/t,a=r.ICE_INDEX**2,i=8/3*e**4*((a-1)/(a+2))**2,o=2*e*(r.ICE_INDEX-1),n=o<.001?o*o/2:2-4/o*Math.sin(o)+4/(o*o)*(1-Math.cos(o));return Math.min(i,n)}static scatteringColour(s){const t=r.extinctionEfficiency(s,r.WAVELENGTHS_UM[1]);return r.WAVELENGTHS_UM.map(e=>r.extinctionEfficiency(s,e)/t)}static sunDirectionAt(s){const t=new F(0,0,-6378137),e=v(b.Sun,s,t,!0,!0),a=(e.ra-Y(s))*15*r.DEG,i=e.dec*r.DEG;return[Math.cos(i)*Math.cos(a),Math.cos(i)*Math.sin(a),Math.sin(i)]}static puffsAt(s,t){const e=[];for(const a of s){let i=r.paths.get(a);i||r.paths.set(a,i=new Map);for(const o of r.releasesOf(a)){const n=Math.min(o.untilT,t);if(n<=o.fromT)continue;const p=Math.max(r.PUFF_EVERY_S*1e3,(o.untilT-o.fromT)/r.MAX_PUFFS),d=[];for(let M=o.fromT;M<n;M+=p)d.push(M);d.push(n);const R=o.massKgPerS*(p/1e3),m=3*r.extinctionEfficiency(o.particleRadiusUm,r.WAVELENGTHS_UM[1])/(4*917*o.particleRadiusUm*1e-6),T=r.scatteringColour(o.particleRadiusUm);o.populations.forEach((M,y)=>{if(M.share<=0)return;const U=E=>o.initialRadiusKm+M.expansionKmPerS*E,I=[];for(const E of d){const D=(t-E)/1e3;if(D>M.lifetimeS)continue;const c=E!==n||n===o.untilT,f=`${o.key}|${y}|${E}`;let A=c?i.get(f):void 0;if(!A){if(A=r.launchPuff(a,o,E,R*M.share,U),!A)continue;c&&i.set(f,A)}I.push({ageS:D,position:A.at(D)})}for(let E=I.length-1;E>=0;E--){const{ageS:D,position:c}=I[E],f=I[E-1]??I[E+1],A=f?Math.hypot(c[0]-f.position[0],c[1]-f.position[1],c[2]-f.position[2]):0,l=U(D)+A/2,O=r.SIGMA_OF_RADIUS*l*1e3,N=R*o.condensedShare*M.share*m/(2*Math.PI*O*O),x=Math.max(0,1-(D/M.lifetimeS)**2);N*x<=0||e.push({launchId:a.id,release:o.key,at:r.geoPoint(c),radiusKm:l,opticalDepth:N*x,colour:T,ageS:D})}})}}return e}static viewsAt(s,t,e,a){const i=[];for(const o of r.puffsAt(s,t)){const n=H.seenFrom(e,o.at);if(n.altitudeDeg<0)continue;const p=r.sunlightAt(o.at,a);if(p.lit<=0)continue;const d=r.scatteringPhase(e,o.at,a),R=r.SUN_ILLUMINANCE_LUX*r.ALBEDO*d*o.opticalDepth*p.lit;R<=0||i.push({launchId:o.launchId,release:o.release,heightKm:o.at.heightM/1e3,centre:n,radiusDeg:Math.atan2(o.radiusKm,n.distanceKm)/r.DEG,luminanceCdM2:R,sunTransmittance:p.transmittance,colour:o.colour,lit:p.lit,ageS:o.ageS})}return i}static launchPuff(s,t,e,a,i){const o={id:s.id,track:s.track,fragments:[]},n=H.leadAt(o,e);if(!n)return;const p=s.track[0].t,d=s.track[s.track.length-1].t,R=Math.max(p,e-500),h=Math.min(d,e+500),m=r.earthCentred(n),T=r.earthCentred(H.leadAt(o,R)),M=r.earthCentred(H.leadAt(o,h)),y=Math.max(.001,(h-R)/1e3),U=[0,1,2].map(S=>(M[S]-T[S])/y),I=r.EARTH_ROTATION,E=[U[0]-I*m[1],U[1]+I*m[0],U[2]],D=S=>{const k=Math.hypot(S[0],S[1],S[2])||1;return S.map(w=>w/k)},c=D(E),f=D(m),A=f[0]*c[0]+f[1]*c[1]+f[2]*c[2];let l=[f[0]-A*c[0],f[1]-A*c[1],f[2]-A*c[2]];Math.hypot(l[0],l[1],l[2])<1e-6&&(l=[-c[2]*c[0],-c[2]*c[1],1-c[2]*c[2]]),l=D(l);const O=[c[1]*l[2]-c[2]*l[1],c[2]*l[0]-c[0]*l[2],c[0]*l[1]-c[1]*l[0]],N=t.spinPeriodS?360*((e-t.fromT)/1e3)/t.spinPeriodS:0,x=(t.azimuthDeg+N)*r.DEG,G=t.angleDeg*r.DEG,C=[0,1,2].map(S=>-c[S]*Math.cos(G)+Math.sin(G)*(Math.cos(x)*l[S]+Math.sin(x)*O[S])),P=[0,1,2].map(S=>U[S]+t.speedKmPerS*C[S]);return new _(m,P,a,i,t.particleRadiusUm)}static geoPoint(s){const t=Math.hypot(s[0],s[1],s[2]);return{lat:Math.asin(s[2]/t)/r.DEG,lng:Math.atan2(s[1],s[0])/r.DEG,heightM:(t-K.EARTH_RADIUS_KM)*1e3}}static sunlightAt(s,t){const e=r.earthCentred(s),a=e[0]*t[0]+e[1]*t[1]+e[2]*t[2];if(a>=0)return{lit:1,transmittance:[1,1,1]};const i=Math.hypot(e[0]-a*t[0],e[1]-a*t[1],e[2]-a*t[2]),o=r.PENUMBRA_KM,n=Math.min(1,Math.max(0,(i-(r.SHADOW_RADIUS_KM-o/2))/o));if(n<=0)return{lit:0,transmittance:[0,0,0]};const p=Math.max(0,(i-r.EARTH_RADIUS_KM)*1e3),d=Math.exp(-p/r.SCALE_HEIGHT_M),R=Math.sqrt(2*Math.PI*r.EARTH_RADIUS_KM*1e3*r.SCALE_HEIGHT_M),h=Math.exp(-(((p/1e3-25)/15)**2)),m=[0,1,2].map(T=>Math.exp(-r.RAYLEIGH_PER_M[T]*d*R-r.OZONE_GRAZING_DEPTH[T]*h));return{lit:n,transmittance:m}}static scatteringPhase(s,t,e){const a=r.earthCentred(s),i=r.earthCentred(t),o=[a[0]-i[0],a[1]-i[1],a[2]-i[2]],n=Math.hypot(o[0],o[1],o[2])||1,p=-(o[0]*e[0]+o[1]*e[1]+o[2]*e[2])/n,d=r.ANISOTROPY;return(1-d*d)/(4*Math.PI*(1+d*d-2*d*p)**1.5)}static earthCentred(s){const t=s.lat*r.DEG,e=s.lng*r.DEG,a=r.EARTH_RADIUS_KM+s.heightM/1e3;return[a*Math.cos(t)*Math.cos(e),a*Math.cos(t)*Math.sin(e),a*Math.sin(t)]}}export{r as L};
|
package/dist-embed-sighting-editor/{LaunchSimulation-BkdI45NE.js → LaunchSimulation-gytH8ZVf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as I}from"./LaunchPlume-
|
|
1
|
+
import{L as I}from"./LaunchPlume-By8E1xvy.js";import{am as T,aE as F,aF as f,ap as z,aM as w,aN as A}from"./rr0-sighting-editor.mjs";class n{static RADIUS=840;static MAX_PUFFS=1e3;static RINGS=[0,.25,.5,.75,1,1.25];static COLUMN=n.RINGS.map(t=>{const i=o=>Math.exp(-((o/I.SIGMA_OF_RADIUS)**2)/2),s=i(n.RINGS[n.RINGS.length-1]);return Math.max(0,(i(t)-s)/(1-s))});static SECTORS=12;static VERTICES_PER_PUFF=n.SECTORS*(3+6*(n.RINGS.length-2));static BRIGHTEST_RELATIVE=6e4;object=new T;mesh;positions=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);colors=new Float32Array(n.MAX_PUFFS*n.VERTICES_PER_PUFF*3);shown=0;drawn=[];static VISIBLE_CONTRAST=.1;constructor(){this.object.name="plumes";const t=new F;t.setAttribute("position",new f(this.positions,3)),t.setAttribute("color",new f(this.colors,3)),t.setDrawRange(0,0),this.mesh=new z(t,w.material()),this.mesh.frustumCulled=!1,w.track(this.mesh),this.object.add(this.mesh)}get count(){return this.shown}set(t,i,s,o){let a=0,c=0;this.drawn=[];for(const p of t){if(c>=n.MAX_PUFFS)break;const d=o(p.centre);if(d<=0)continue;const h=s(p.centre),r=[0,1,2].map(g=>Math.min(n.BRIGHTEST_RELATIVE,p.luminanceCdM2*(p.colour?.[g]??1)*i*p.sunTransmittance[g]*h[g]*d));Math.max(...r)<=0||(a=this.pushPuff(a,p,r),this.drawn.push({view:p,direction:this.normalise(A(p.centre.altitudeDeg,p.centre.azimuthDeg,1)),radiusRad:p.radiusDeg*Math.PI/180,luminance:.2126*r[0]+.7152*r[1]+.0722*r[2]}),c++)}this.shown=c;const u=this.mesh.geometry;u.setDrawRange(0,a),u.getAttribute("position").needsUpdate=!0,u.getAttribute("color").needsUpdate=!0}pushPuff(t,i,s){const o=A(i.centre.altitudeDeg,i.centre.azimuthDeg,n.RADIUS),a=this.normalise(o),c=this.normalise(this.cross({x:0,y:1,z:0},a)),u=this.cross(a,c),p=n.RADIUS*Math.tan(i.radiusDeg*Math.PI/180),d=(r,g)=>{const e=g/n.SECTORS*2*Math.PI,M=n.RINGS[r]*p,R=Math.cos(e)*M,l=Math.sin(e)*M;return{x:o.x+c.x*R+u.x*l,y:o.y+c.y*R+u.y*l,z:o.z+c.z*R+u.z*l}},h=r=>n.COLUMN[r];for(let r=0;r<n.SECTORS;r++){const g=(r+1)%n.SECTORS;t=this.push(t,o,s,h(0)),t=this.push(t,d(1,r),s,h(1)),t=this.push(t,d(1,g),s,h(1));for(let e=1;e<n.RINGS.length-1;e++){const M=d(e,r),R=d(e,g),l=d(e+1,r),E=d(e+1,g);t=this.push(t,M,s,h(e)),t=this.push(t,R,s,h(e)),t=this.push(t,l,s,h(e+1)),t=this.push(t,R,s,h(e)),t=this.push(t,E,s,h(e+1)),t=this.push(t,l,s,h(e+1))}}return t}pickAt(t,i,s=0){const o=this.normalise(t);let a=0,c;for(const u of this.drawn){const p=Math.max(-1,Math.min(1,o.x*u.direction.x+o.y*u.direction.y+o.z*u.direction.z)),d=Math.max(0,Math.acos(p)-i)/Math.max(u.radiusRad,1e-9),h=u.luminance*n.profile(d);h<=0||(a+=h,(!c||h>c.light)&&(c={view:u.view,light:h}))}return c&&a>=n.VISIBLE_CONTRAST*s?c.view:void 0}static profile(t){const i=n.RINGS;if(t>=i[i.length-1])return 0;let s=0;for(;t>i[s+1];)s++;const o=(t-i[s])/(i[s+1]-i[s]);return n.COLUMN[s]+(n.COLUMN[s+1]-n.COLUMN[s])*o}push(t,i,s,o){const a=t*3;return this.positions[a]=i.x,this.positions[a+1]=i.y,this.positions[a+2]=i.z,this.colors[a]=s[0]*o,this.colors[a+1]=s[1]*o,this.colors[a+2]=s[2]*o,t+1}cross(t,i){return this.normalise({x:t.y*i.z-t.z*i.y,y:t.z*i.x-t.x*i.z,z:t.x*i.y-t.y*i.x})}normalise(t){const i=Math.hypot(t.x,t.y,t.z)||1;return{x:t.x/i,y:t.y/i,z:t.z/i}}dispose(){this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.object.removeFromParent()}}class N{inSky=!0;plumes=new n;get object(){return this.plumes.object}get drawnCount(){return this.plumes.count}update(t,i,s){const o=t.length===0||!s.date?[]:I.viewsAt(t,i,s.observer,I.sunDirectionAt(s.date));o.length===0&&this.plumes.count===0||this.plumes.set(o,s.relativeScale,a=>s.transmittanceFromSpace(a),a=>s.cloudTransmission(a))}pick(t,i,s){const o=this.plumes.pickAt(i,s.toleranceRad,s.skyLightTowards(i));return o&&{id:o.launchId,detail:o}}dispose(){this.plumes.dispose()}}export{N as LaunchSimulation};
|
package/dist-embed-sighting-editor/{ModuleConformance-_3-3Kbbt.js → ModuleConformance-DRVG5aJw.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-
|
|
2
|
-
import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","compute"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"],reentryTypes:["key","nature","messages","template"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(i,a={}){const r=[];i.hasScript&&!i.scriptRun&&r.push({level:"note",code:"scriptNotRun"});for(const[t,s]of Object.entries(i.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(s)?await n.checkPoint(t,s,a,r):r.push({level:"failed",code:"notAList",point:t}):r.push({level:"failed",code:"unknownPoint",point:t});return r}static async checkPoint(i,a,r,t){const s=new Set;for(const e of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:i,source:typeof e?.id=="string"?e.id:void 0,detail:d})};if(s.has(e?.id)&&c("duplicateId"),s.add(e?.id),n.checkEntry(e,c),typeof e?.create!="function"){c("createMissing");continue}const o=n.build(e,c);if(o===void 0)continue;const h=n.MEMBERS[i].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(i==="weather"&&await n.checkWeather(e.id,o,r,c),i==="skyEvents"&&await n.checkSkyEventKind(e.id,o,r,c),i==="interpretations"&&await n.checkInterpretationKind(e.id,o,r,c))}}static checkEntry(i,a){for(const r of["id","name","credit","creditUrl"]){const t=i?.[r];(typeof t!="string"||t.trim()==="")&&a("entryField",r)}typeof i?.creditUrl=="string"&&i.creditUrl!==""&&!URL.canParse(i.creditUrl)&&a("entryField","creditUrl")}static build(i,a){let r=!1;const t=(async()=>(r=!0,new Response("",{status:503}))),s=globalThis.fetch;globalThis.fetch=t;try{const e=i.create(t);if(r&&a("createAsked"),e==null){a("createEmpty");return}return e}catch(e){a("createThrew",n.told(e));return}finally{globalThis.fetch=s}}static async checkWeather(i,a,r,t){const s=r.weatherQuery;if(!s){t("weatherNotAsked",void 0,"note");return}let e;try{e=await n.within(a.getWeather(s),r)}catch(l){t("weatherThrew",n.told(l));return}if(e===void 0){t("weatherNoRecord",void 0,"note");return}const c=e?.samples;if(!Array.isArray(c)||c.length!==s.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${s.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==s.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),e.source?.id!==i&&t("weatherSource","id"),(typeof e.source?.name!="string"||e.source.name==="")&&t("weatherSource","name"),(typeof e.source?.url!="string"||e.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],r,t);let s;try{s=(await n.within(a.simulation(),r))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:e}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-D1RGQ8X2.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as w}from"./rr0-sighting-editor.mjs";class n{static MEMBERS={weather:["getWeather"],place:["attribution","search","reverse"],timeZone:["zoneAt"],narrative:["settings","draft"],assessment:["assess"],lightPollution:["year","citation","lookUp"],aircraft:["citation","between"],upperAir:["between"],elevation:["getElevationGrid"],imagery:["attribution","getImageryTexture"],surroundings:["id","name","attribution","creditUrl","contemporary","covers","getSurroundings"],decorModels:["attribution","entries","entry"],skyEvents:["key","messages","simulation"],interpretations:["key","messages","compute"],perception:["id","messages","sources","settings","perceive"],transcription:["sendsAudio","engine","transcribe"],reentryTypes:["key","nature","messages","template"]};static WEATHER_SHARES=["cloudCover","cloudDarkness","precipitationIntensity","highCloudCover","lowerCloudCover","iceCrystalAlignment","rareIceCrystals","relativeHumidity"];static WEATHER_REQUIRED=["cloudCover","cloudDarkness","precipitationIntensity"];static PRECIPITATIONS=["none","rain","snow","hail"];static HIGH_WIND_MS=60;static TIMEOUT_MS=3e4;static async check(i,a={}){const r=[];i.hasScript&&!i.scriptRun&&r.push({level:"note",code:"scriptNotRun"});for(const[t,s]of Object.entries(i.module.contributes))Object.hasOwn(n.MEMBERS,t)?Array.isArray(s)?await n.checkPoint(t,s,a,r):r.push({level:"failed",code:"notAList",point:t}):r.push({level:"failed",code:"unknownPoint",point:t});return r}static async checkPoint(i,a,r,t){const s=new Set;for(const e of a){const c=(l,d,g="failed")=>{t.push({level:g,code:l,point:i,source:typeof e?.id=="string"?e.id:void 0,detail:d})};if(s.has(e?.id)&&c("duplicateId"),s.add(e?.id),n.checkEntry(e,c),typeof e?.create!="function"){c("createMissing");continue}const o=n.build(e,c);if(o===void 0)continue;const h=n.MEMBERS[i].filter(l=>o[l]===void 0);for(const l of h)c("missingMember",l);h.length>0||(i==="weather"&&await n.checkWeather(e.id,o,r,c),i==="skyEvents"&&await n.checkSkyEventKind(e.id,o,r,c),i==="interpretations"&&await n.checkInterpretationKind(e.id,o,r,c))}}static checkEntry(i,a){for(const r of["id","name","credit","creditUrl"]){const t=i?.[r];(typeof t!="string"||t.trim()==="")&&a("entryField",r)}typeof i?.creditUrl=="string"&&i.creditUrl!==""&&!URL.canParse(i.creditUrl)&&a("entryField","creditUrl")}static build(i,a){let r=!1;const t=(async()=>(r=!0,new Response("",{status:503}))),s=globalThis.fetch;globalThis.fetch=t;try{const e=i.create(t);if(r&&a("createAsked"),e==null){a("createEmpty");return}return e}catch(e){a("createThrew",n.told(e));return}finally{globalThis.fetch=s}}static async checkWeather(i,a,r,t){const s=r.weatherQuery;if(!s){t("weatherNotAsked",void 0,"note");return}let e;try{e=await n.within(a.getWeather(s),r)}catch(l){t("weatherThrew",n.told(l));return}if(e===void 0){t("weatherNoRecord",void 0,"note");return}const c=e?.samples;if(!Array.isArray(c)||c.length!==s.points.length){t("weatherSamples",`${Array.isArray(c)?c.length:0}/${s.points.length}`);return}c.some((l,d)=>l?.time?.getTime?.()!==s.points[d].time.getTime())&&t("weatherOrder");const o=new Set;let h=!1;for(const l of c){const d=l?.weather??{};for(const g of n.WEATHER_SHARES){const u=d[g],p=n.WEATHER_REQUIRED.includes(g);(u!==void 0||p)&&!n.between(u,0,1)&&o.add(`${g} = ${String(u)}`)}n.between(d.windDirectionDeg,0,360)||o.add(`windDirectionDeg = ${String(d.windDirectionDeg)}`),n.between(d.windSpeed,0,1/0)?d.windSpeed>n.HIGH_WIND_MS&&(h=!0):o.add(`windSpeed = ${String(d.windSpeed)}`),n.PRECIPITATIONS.includes(d.precipitationType)||o.add(`precipitationType = ${String(d.precipitationType)}`),typeof d.storm!="boolean"&&o.add(`storm = ${String(d.storm)}`)}for(const l of o)t("weatherValue",l);h&&t("weatherWindHigh",void 0,"note"),e.source?.id!==i&&t("weatherSource","id"),(typeof e.source?.name!="string"||e.source.name==="")&&t("weatherSource","name"),(typeof e.source?.url!="string"||e.source.url==="")&&t("weatherSource","url")}static async checkSkyEventKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title","name"],r,t);let s;try{s=(await n.within(a.simulation(),r))()}catch(o){t("simulationFailed",n.told(o));return}const{MODULE_THREE:e}=await w(async()=>{const{MODULE_THREE:o}=await import("./ModuleThree-D1RGQ8X2.js");return{MODULE_THREE:o}},__vite__mapDeps([0,1]),import.meta.url);if(!(s?.object instanceof e.Object3D)){t("secondThree");return}try{s.update([],0,n.frame(new e.Vector3)),s.drawnCount!==0&&t("drawnWithoutEvents",String(s.drawnCount))}catch(o){t("updateThrew",n.told(o))}const c=new e.Group;c.add(s.object);try{s.dispose(),s.object.parent===c&&t("disposeLeft")}catch(o){t("disposeThrew",n.told(o))}}static async checkInterpretationKind(i,a,r,t){a.key!==i&&t("kindKey",String(a.key)),await n.checkTexts(a.messages,["title"],r,t);const s=r.interpretation?.[a.key];if(!Array.isArray(s)||s.length===0){t("readingNotTried",void 0,"note");return}let e;try{if(e=await n.within(a.compute(),r),typeof e!="function"){t("readingThrew","compute");return}}catch(c){t("readingThrew",n.told(c));return}for(const c of s)try{const o=e(c);Array.isArray(o)||t("readingNotAList")}catch(o){t("readingThrew",n.told(o))}}static async checkTexts(i,a,r,t){for(const s of["en","fr"])try{const e=await n.within(i.load(s),r);for(const c of a)(typeof e?.[c]!="string"||e[c]==="")&&t("kindMessages",`${s}: ${c}`)}catch(e){t("kindMessages",`${s}: ${n.told(e)}`)}}static frame(i){return{reference:{lat:0,lng:0},origin:{x:0,z:0},eastScale:1,siteElevationM:0,eye:i,pixelRad:.001,relativeScale:1,air:{},transmittanceTo:()=>[1,1,1],groundYAt:()=>0,wind:{eastMS:0,northMS:0},observer:{lat:0,lng:0,heightM:0},date:new Date(0),magnitudeLimit:6,cloudTransmission:()=>1,arrivingIlluminance:()=>[0,0,0],transmittanceFromSpace:()=>[1,1,1],lightFrom:()=>{},glareFrom:()=>{}}}static between(i,a,r){return typeof i=="number"&&!Number.isNaN(i)&&i>=a&&i<=r}static told(i){return i instanceof Error?i.message:String(i)}static within(i,a){const r=a.timeoutMs??n.TIMEOUT_MS;let t;const s=new Promise((e,c)=>{t=setTimeout(()=>c(new Error(`> ${r/1e3} s`)),r)});return Promise.race([i,s]).finally(()=>clearTimeout(t))}}export{n as ModuleConformance};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleThree-D1RGQ8X2.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{C as g,D as w,_ as b,M as p}from"./rr0-sighting-editor.mjs";class n{static STORAGE_KEY="ufoathome.modules";static FORMAT=1;static empty(){return{format:1,modules:[]}}static read(t=n.storage()){try{const e=t?.getItem(n.STORAGE_KEY);return e?n.parse(e):n.empty()}catch{return n.empty()}}static write(t,e=n.storage()){try{return e?(t.modules.length===0?e.removeItem(n.STORAGE_KEY):e.setItem(n.STORAGE_KEY,n.text(t)),!0):!1}catch{return!1}}static parse(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||!Array.isArray(e.modules))throw new Error("not a UFO@home module list");if(typeof e.format=="number"&&e.format>n.FORMAT)throw new Error(`format ${e.format} is newer than ${n.FORMAT}`);const r=new Set,s=[];for(const i of e.modules)typeof i?.url!="string"||r.has(i.url)||(r.add(i.url),s.push({url:i.url,enabled:i.enabled!==!1}));return{format:1,modules:s}}static text(t){return JSON.stringify({format:n.FORMAT,modules:t.modules},null,2)+`
|
|
3
|
-
`}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.tileUrl(this.tileUrlTemplate,r),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-
|
|
3
|
+
`}static storage(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}}class E{constructor(t,e){this.attribution=t,this.models=e}async entries(t){return t?this.models.filter(e=>[e.kind].flat().includes(t)):[...this.models]}async entry(t){return this.models.find(e=>e.id===t)}}class f{attribution;fetchImpl;tileUrlTemplate;constructor(t){this.attribution=t.attribution,this.tileUrlTemplate=t.tileUrlTemplate,this.fetchImpl=t.fetchImpl??fetch.bind(globalThis)}getImageryTexture(t,e){return g(t,e,r=>f.tileUrl(this.tileUrlTemplate,r),this.fetchImpl)}static tileUrl(t,e){return t.replaceAll("{z}",String(e.z)).replaceAll("{x}",String(e.x)).replaceAll("{y}",String(e.y))}}class v extends Error{constructor(t,e){super(`${t}: ${e}`),this.url=t,this.reason=e,this.name="ModuleManifestError"}}class d{static FORMAT=1;static check(t,e){const r=o=>{throw new v(e,o)};(t===null||typeof t!="object"||Array.isArray(t))&&r("not a JSON object");const s=t;typeof s.format!="number"&&r('no "format"'),s.format>d.FORMAT&&r(`format ${s.format} is newer than ${d.FORMAT}, which this version reads`),(typeof s.id!="string"||!/^[a-z0-9][a-z0-9._-]*$/.test(s.id))&&r(`"id" must be lowercase letters, digits, '.', '_' or '-'`),(typeof s.name!="string"||s.name.trim()==="")&&r('no "name"'),s.script!==void 0&&typeof s.script!="string"&&r('"script" must be an address');const i=s.contributes??{};for(const o of["imagery","elevation"]){const c=i[o];c!==void 0&&(Array.isArray(c)||r(`"contributes.${o}" must be a list`),c.forEach((l,h)=>{for(const m of["id","name","credit","creditUrl","tiles"])(typeof l?.[m]!="string"||l[m]==="")&&r(`"contributes.${o}[${h}].${m}" is missing`);["{z}","{x}","{y}"].every(m=>l.tiles.includes(m))||r(`"contributes.${o}[${h}].tiles" must hold {z}, {x} and {y}`)}))}const a=i.models;return a!==void 0&&(Array.isArray(a)||r('"contributes.models" must be a list'),a.forEach((o,c)=>{for(const l of["id","name","file"])(typeof o?.[l]!="string"||o[l]==="")&&r(`"contributes.models[${c}].${l}" is missing`);o.kind===void 0&&r(`"contributes.models[${c}].kind" is missing`),(!o.credit||typeof o.credit!="object")&&r(`"contributes.models[${c}].credit" is missing: a model is shown with its author and licence`)})),s}static contributions(t,e){const r=t.contributes??{},s={};if(r.imagery?.length&&(s.imagery=r.imagery.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new f({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),attribution:i.credit,fetchImpl:a})}))),r.elevation?.length&&(s.elevation=r.elevation.map(i=>({id:i.id,name:i.name,credit:i.credit,creditUrl:i.creditUrl,create:a=>new w({tileUrlTemplate:d.absoluteTemplate(i.tiles,e),fetchImpl:a})}))),r.models?.length){const i=r.models.map(({file:o,...c})=>({...c,url:new URL(o,e).href})),a=t.credit??t.name;s.decorModels=[{id:`${t.id}-models`,name:t.name,credit:a,creditUrl:t.creditUrl??e,create:()=>new E(a,i)}]}return s}static module(t,e,r={}){const s=d.contributions(t,e);for(const[i,a]of Object.entries(r))Array.isArray(a)&&(s[i]=[...s[i]??[],...a]);return{id:t.id,name:t.name,credit:t.credit,creditUrl:t.creditUrl,url:e,contributes:s}}static absoluteTemplate(t,e){const r=t.replaceAll("{z}","__Z__").replaceAll("{x}","__X__").replaceAll("{y}","__Y__");return new URL(r,e).href.replaceAll("__Z__","{z}").replaceAll("__X__","{x}").replaceAll("__Y__","{y}")}}class T{fetchImpl;importImpl;constructor(t={}){this.fetchImpl=t.fetchImpl??fetch.bind(globalThis),this.importImpl=t.importImpl??(e=>import(e))}async load(t,e){const r=await this.fetchImpl(t);if(!r.ok)throw new Error(`${t}: HTTP ${r.status}`);const s=d.check(await r.json(),t),i=s.script!==void 0;let a={};if(i&&e.runScript){const o=new URL(s.script,t).href,c=await this.importImpl(o);if(typeof c.default!="function")throw new Error(`${o}: its default export is not a function`);const{MODULE_THREE:l}=await b(async()=>{const{MODULE_THREE:h}=await import("./ModuleThree-D1RGQ8X2.js");return{MODULE_THREE:h}},__vite__mapDeps([0,1]),import.meta.url);a=await c.default({manifestUrl:t,three:l})??{}}return{url:t,manifest:s,module:d.module(s,t,a),hasScript:i,scriptRun:i&&e.runScript}}}class y{constructor(t=new T,e){this.loader=t,this.storage=e}static shared=new y;changes=new EventTarget;states=new Map;config=n.empty();started;list(){const t=[...this.states.values()];return[...t.filter(e=>e.addedByPerson),...t.filter(e=>!e.addedByPerson)]}state(t){return this.states.get(t)}start(){return this.started??=this.applyConfig(n.read(this.storage)),this.started}async add(t){await this.start();const e=new URL(t,typeof location>"u"?void 0:location.href).href;return this.config.modules.some(r=>r.url===e)||(this.config={...this.config,modules:[...this.config.modules,{url:e,enabled:!0}]},this.save()),this.reload(e)}async remove(t){this.config={...this.config,modules:this.config.modules.filter(e=>e.url!==t)},this.save(),await this.reload(t)}async setEnabled(t,e){this.config={...this.config,modules:this.config.modules.map(r=>r.url===t?{...r,enabled:e}:r)},this.save(),await this.reload(t)}exportText(){return n.text(this.config)}async importText(t){const e=n.parse(t);await this.start();const r=this.config.modules.map(s=>s.url);this.config=e,this.save(),await Promise.all([...new Set([...r,...e.modules.map(s=>s.url)])].map(s=>this.reload(s)))}async require(t,e){t?.length&&(await this.start(),await Promise.all(t.map(async r=>{let s;try{s=new URL(r,e??(typeof location>"u"?void 0:location.href)).href}catch{return}const i=this.states.get(s);if(i&&i.status!=="off")return i.status==="loading"?this.pending.get(s):void 0;this.named.add(s),await this.reload(s)})))}named=new Set;pending=new Map;async applyConfig(t){this.config=t,await Promise.all(t.modules.map(e=>this.reload(e.url)))}reload(t){const e=this.reloadNow(t);return this.pending.set(t,e),e}async reloadNow(t){const e=this.config.modules.find(a=>a.url===t),r=this.states.get(t);r?.loaded&&p.uninstall(r.loaded.module.id);const s=e!==void 0,i=e?.enabled??!0;if(!s&&!this.named.has(t))return this.states.delete(t),this.announce(),{url:t,addedByPerson:s,enabled:i,status:"off"};if(s&&!i&&!this.named.has(t))return this.set({url:t,addedByPerson:s,enabled:i,status:"off"});this.set({url:t,addedByPerson:s,enabled:i,status:"loading"});try{const a=await this.loader.load(t,{runScript:s&&i});return p.install(a.module),this.set({url:t,addedByPerson:s,enabled:i,status:"installed",loaded:a})}catch(a){return this.set({url:t,addedByPerson:s,enabled:i,status:"failed",error:a instanceof Error?a.message:String(a)})}}set(t){return this.states.set(t.url,t),this.announce(),t}save(){n.write(this.config,this.storage)}announce(){this.changes.dispatchEvent(new Event("change"))}}export{y as ModuleSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as a,bb as e,cn as s,bu as t,bw as r,bJ as i,bm as o,Q as n,bt as c,aT as b,bS as l,bK as m,G as u,co as d,ar as M,aG as G,ap as S,K as B,c7 as p,c4 as y,c8 as f,am as h,cl as g,bg as x,J as E,aH as L,cp as T,cq as C,cr as D,aV as P,bv as V,aE as v,aF as A,cs as F,bI as H,aI as I}from"./rr0-sighting-editor.mjs";const K={AdditiveBlending:I,BackSide:H,BoxGeometry:F,BufferAttribute:A,BufferGeometry:v,CanvasTexture:V,Color:P,ConeGeometry:D,CylinderGeometry:C,DataTexture:T,DoubleSide:L,Euler:E,Float32BufferAttribute:x,FrontSide:g,Group:h,Line:f,LineBasicMaterial:y,LineSegments:p,Matrix4:B,Mesh:S,MeshBasicMaterial:G,MeshStandardMaterial:M,NormalBlending:d,Object3D:u,PlaneGeometry:m,PointLight:l,Points:b,PointsMaterial:c,Quaternion:n,ShaderMaterial:o,SphereGeometry:i,Sprite:r,SpriteMaterial:t,TorusGeometry:s,Vector2:e,Vector3:a};export{K as MODULE_THREE};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-
|
|
2
|
-
import{o as _,_ as x,H as y,z as L,i as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModuleConformance-DRVG5aJw.js","./rr0-sighting-editor.mjs"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as _,_ as x,H as y,z as L,i as m}from"./rr0-sighting-editor.mjs";import{ModuleSession as C}from"./ModuleSession-o0MYjWCQ.js";const P=_.catalog({en:()=>x(()=>import("./ModulesPanelMessages_en-DuwrY3Pm.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_en),fr:()=>x(()=>import("./ModulesPanelMessages_fr-B8cSDc6o.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_fr),es:()=>x(()=>import("./ModulesPanelMessages_es-Bq5X-XuT.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_es),it:()=>x(()=>import("./ModulesPanelMessages_it-BdC626aJ.js"),[],import.meta.url).then(b=>b.modulesPanelMessages_it)}),N="rr0-modules-panel",A=`
|
|
3
3
|
rr0-modules-panel { display: block; }
|
|
4
4
|
rr0-modules-panel .mp-add { display: flex; gap: .4em; align-items: center; margin: .4em 0; }
|
|
5
5
|
rr0-modules-panel .mp-add input { flex: 1 1 16em; min-width: 0; }
|
|
@@ -12,4 +12,4 @@ rr0-modules-panel .mp-head .mp-remove { margin-left: auto; }
|
|
|
12
12
|
rr0-modules-panel .mp-module p { margin: .2em 0; }
|
|
13
13
|
rr0-modules-panel .mp-findings { margin: .3em 0; padding-left: 1.2em; }
|
|
14
14
|
rr0-modules-panel .mp-files { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; margin-top: .6em; }
|
|
15
|
-
`;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(y.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-
|
|
15
|
+
`;class M extends HTMLElement{session=C.shared;messages;languageAsked=!1;named=[];recordingBase;note;languageToken=0;draft="";onChange=()=>this.render();checkContext;checks=new Map;set moduleSession(e){this.session.changes.removeEventListener("change",this.onChange),this.session=e,this.isConnected&&this.session.changes.addEventListener("change",this.onChange),this.render()}get recordingModules(){return[...this.named]}set recordingModules(e){this.named=[...e??[]],this.render()}set base(e){this.recordingBase=e,this.render()}async setLanguage(e){this.languageAsked=!0;const t=++this.languageToken,n=await P.load(e);t===this.languageToken&&(this.messages=n,this.render())}connectedCallback(){this.languageAsked||this.setLanguage(y.preferencesFor(this)[0]??"en"),this.session.changes.addEventListener("change",this.onChange),this.session.start(),this.render()}disconnectedCallback(){this.session.changes.removeEventListener("change",this.onChange)}absolute(e){try{return new URL(e,this.recordingBase??location.href).href}catch{return}}isNamed(e){return this.named.some(t=>this.absolute(t)===e)}setNamed(e,t){t!==this.isNamed(e)&&(this.named=t?[...this.named,L.of(e,this.recordingBase)]:this.named.filter(n=>this.absolute(n)!==e),t&&this.session.require([e]),this.dispatchEvent(new Event("recordingmoduleschange",{bubbles:!0})),this.render())}render(){const e=this.messages;if(!this.isConnected||!this.messages)return;const t=this.ownerDocument,n=t.createElement("style");n.textContent=A;const s=t.createElement("p");s.className=m.INFO,s.textContent=e.intro;const a=t.createElement("form");a.className="mp-add";const i=t.createElement("input");i.type="url",i.id="module-url",i.required=!0,i.placeholder=e.urlPlaceholder,i.value=this.draft,i.addEventListener("input",()=>{this.draft=i.value}),i.setAttribute("aria-label",e.urlPlaceholder);const u=t.createElement("button");u.type="submit",u.textContent=e.add,a.append(i,u),a.addEventListener("submit",r=>{r.preventDefault();const w=i.value.trim();w&&(this.draft="",this.session.add(w))});const l=t.createElement("p");l.className=m.WARNING,l.textContent=e.codeWarning;const c=this.session.list(),h=new Set(c.map(r=>r.url)),v=this.named.map(r=>this.absolute(r)).filter(r=>r!==void 0&&!h.has(r)),g=t.createElement("ul");g.className="mp-list",g.append(...c.map(r=>this.item(r)),...v.map(r=>this.item({url:r,addedByPerson:!1,enabled:!0,status:"loading"})));const k=t.createElement("p");k.className=m.INFO,k.textContent=e.none,k.hidden=g.childElementCount>0;const f=t.createElement("div");f.className="mp-files";const E=t.createElement("button");E.type="button",E.id="modules-export",E.textContent=e.exportConfig,E.disabled=!c.some(r=>r.addedByPerson),E.addEventListener("click",()=>this.download());const p=t.createElement("input");p.type="file",p.id="modules-import",p.accept="application/json,.json",p.hidden=!0;const o=t.createElement("button");o.type="button",o.textContent=e.importConfig,o.addEventListener("click",()=>p.click()),p.addEventListener("change",()=>{const r=p.files?.[0];r&&this.importFile(r),p.value=""}),f.append(E,o,p);const d=t.createElement("p");d.id="modules-note",d.setAttribute("role","status"),m.show(d,this.note?.text,this.note?.kind),this.replaceChildren(n,s,a,l,g,k,f,d)}item(e){const t=this.messages,n=this.ownerDocument,s=e.loaded,a=n.createElement("li");a.className="mp-module",a.dataset.url=e.url;const i=n.createElement("div");if(i.className="mp-head",e.addedByPerson){const o=n.createElement("label"),d=n.createElement("input");d.type="checkbox",d.className="mp-enabled",d.checked=e.enabled,d.addEventListener("change",()=>void this.session.setEnabled(e.url,d.checked)),o.append(d,n.createTextNode(` ${t.enabled}`)),i.append(o)}const u=n.createElement("span");u.className="mp-name",u.textContent=e.loaded?.module.name??e.url,i.append(u);const l=e.loaded?.module.credit;if(l){const o=n.createElement(e.loaded?.module.creditUrl?"a":"span");o.className=m.INFO,o.textContent=l,o instanceof HTMLAnchorElement&&(o.href=e.loaded.module.creditUrl,o.target="_blank",o.rel="noopener noreferrer"),i.append(o)}const c=n.createElement("button");if(c.type="button",c.className="mp-remove",e.addedByPerson?(c.textContent=t.remove,c.addEventListener("click",()=>void this.session.remove(e.url))):(c.textContent=t.addToMine,c.addEventListener("click",()=>void this.session.add(e.url))),e.status==="installed"&&s){const o=n.createElement("button");o.type="button",o.className="mp-check";const d=this.checks.get(e.url),r=d?.of===s&&d.findings===void 0&&d.crash===void 0;o.textContent=r?t.checking:t.check,o.disabled=r,o.addEventListener("click",()=>void this.check(e.url,s)),i.append(o)}i.append(c);const h=n.createElement("p");h.className=`${m.INFO} mp-url`,h.textContent=e.url;const v=n.createElement("p");v.className="mp-status",e.status==="loading"?m.show(v,t.loading):e.status==="failed"?m.show(v,t.failed.replace("{error}",e.error??""),"error"):e.status==="off"?m.show(v,t.off):m.show(v,this.brings(e));const g=n.createElement("p");g.className="mp-code",s?.scriptRun?m.show(g,t.runsCode,"warning"):s?.hasScript?m.show(g,t.codeNotRun,"info"):g.hidden=!0;const k=n.createElement("label");k.title=t.namedByRecordingHint;const f=n.createElement("input");f.type="checkbox",f.className="mp-named",f.checked=this.isNamed(e.url),f.addEventListener("change",()=>this.setNamed(e.url,f.checked)),k.append(f,n.createTextNode(` ${t.namedByRecording}`));const E=n.createElement("p");E.append(k),a.append(i,h,v,g,E);const p=this.checks.get(e.url);return p&&p.of===s&&a.append(...this.checkResult(p)),a}async check(e,t){const n={of:t};this.checks.set(e,n),this.render();try{const{ModuleConformance:s}=await x(async()=>{const{ModuleConformance:a}=await import("./ModuleConformance-DRVG5aJw.js");return{ModuleConformance:a}},__vite__mapDeps([0,1]),import.meta.url);n.findings=await s.check(t,this.checkContext?.())}catch(s){n.crash=s instanceof Error?s.message:String(s)}this.render()}checkResult(e){const t=this.messages,n=this.ownerDocument,s=(l,c)=>{const h=n.createElement("p");return h.className="mp-check-result",h.setAttribute("role","status"),m.show(h,l,c),h};if(e.crash!==void 0)return[s(t.checkCrashed.replace("{error}",()=>e.crash),"error")];if(!e.findings)return[];const a=e.findings.filter(l=>l.level==="failed"),i=e.findings.filter(l=>l.level==="note"),u=[];if(a.length===0&&u.push(s(t.checkPassed,"info")),a.length+i.length>0){const l=n.createElement("ul");l.className="mp-findings";for(const c of[...a,...i]){const h=n.createElement("li");m.show(h,this.finding(c),c.level==="failed"?"error":"info"),l.append(h)}u.push(l)}return u}finding(e){const t=this.messages,n=e.point===void 0?"":t.points[e.point]??e.point,s=t.checks[e.code].replace("{point}",()=>e.point??"").replace("{detail}",()=>e.detail??""),a=e.source??(e.code==="unknownPoint"||e.code==="notAList"?void 0:n);return a?t.checkAbout.replace("{about}",()=>a).replace("{text}",()=>s):s}brings(e){const t=Object.entries(e.loaded?.module.contributes??{}).filter(([,n])=>Array.isArray(n)&&n.length>0).map(([n,s])=>`${this.messages.points[n]??n} (${s.length})`);return t.length>0?this.messages.brings.replace("{points}",t.join(", ")):this.messages.bringsNothing}download(){const e=new Blob([this.session.exportText()],{type:"application/json"}),t=URL.createObjectURL(e),n=this.ownerDocument.createElement("a");n.href=t,n.download="ufoathome-modules.json",n.click(),URL.revokeObjectURL(t)}async importFile(e){try{await this.session.importText(await e.text());const t=this.session.list().filter(n=>n.addedByPerson).length;this.note={text:this.messages.imported.replace("{count}",String(t)),kind:"info"}}catch(t){this.note={text:this.messages.importFailed.replace("{error}",t instanceof Error?t.message:String(t)),kind:"error"}}this.render()}}function B(){customElements.get(N)||customElements.define(N,M)}export{N as MODULES_PANEL_ELEMENT_NAME,M as ModulesPanelElement,B as register};
|
package/dist-embed-sighting-editor/{NearestApproach-BDjtUet2.js → NearestApproach-CgC-W_0w.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b5 as b,B as h}from"./rr0-sighting-editor.mjs";class c{static FLAT={heightAt:()=>0};static of(e){const s=e.timeline.sourceIds.map(n=>b.of(e,n)?.nearestM).filter(n=>n!==void 0);return s.length>0?{m:Math.min(...s),basis:"derived",paths:["timeline","observerTrack"]}:c.interpreted(e)}static interpreted(e){const s=(e.interpretation?.bodies??[]).map((t,i)=>({body:t,index:i})).filter(({body:t})=>Array.isArray(t.track)),n=s.filter(({body:t})=>(t.explains?.length??0)>0),u=n.length>0?n:s,d=c.FLAT,l=t=>h.eyeOf(e,t,d);let o;const p=[];for(const{body:t,index:i}of u){const M=new h(t,d,l);for(const{t:f}of t.track){const r=M.at(f),a=l(f);if(!r||!a)continue;const m=Math.hypot(r.eastM-a.eastM,r.northM-a.northM,r.upM-a.upM);(o===void 0||m<o)&&(o=m)}p.push(`interpretation.bodies.${i}`)}return o===void 0?void 0:{m:o,basis:"assumed",paths:p}}}export{c as N};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b7 as u}from"./rr0-sighting-editor.mjs";class o{about="shape";static STEP_DEG=2;static TURN_DEG=60;static ERRATIC_TURNS=3;static OSCILLATIONS=["vibrate","spiral","roll"];async assess(n){const t=this.trajectory(n),s=this.vanish(n),e=this.oscillation(n),a=this.landing(n),c=this.judged(n,"traces"),r=this.occupants(n),h=a.shown&&r.shown?5:a.shown&&c.shown?4:a.shown||t.value==="erratic"||s.shown||e.shown?3:t.value==="abnormal"?2:t.value==="straight"?1:0,i=[{id:"poher-trajectory",basis:t.basis,paths:t.paths,value:o.TRAJECTORIES.indexOf(t.value)},this.criterion("poher-vanish",s),this.criterion("poher-oscillation",e),{...this.criterion("poher-landing",a),unsupported:a.basis===void 0},this.criterion("poher-traces",c),this.criterion("poher-occupants",r)];return{verdict:String(h),criteria:i}}static TRAJECTORIES=["unknown","still","straight","abnormal","erratic"];criterion(n,t){return{id:n,value:t.shown?1:0,basis:t.basis,paths:t.basis===void 0?[]:t.paths}}trajectory(n){let t="unknown";for(const s of n.timeline.sourceIds){const e=this.seen(n,s).filter(i=>i.aim!==void 0).map(i=>i.aim);if(e.length<2)continue;const a=[o.unit(e[0])];for(const i of e.slice(1)){const l=o.unit(i);o.angleDeg(a[a.length-1],l)>=o.STEP_DEG&&a.push(l)}const c=a.length-1;let r=0;for(let i=1;i<a.length-1;i++){const l=o.cross(a[i-1],a[i]),d=o.cross(a[i],a[i+1]);o.angleDeg(l,d)>=o.TURN_DEG&&r++}const h=c===0?"still":r>=o.ERRATIC_TURNS?"erratic":r>0?"abnormal":"straight";o.TRAJECTORIES.indexOf(h)>o.TRAJECTORIES.indexOf(t)&&(t=h)}return t==="unknown"?{value:t,paths:[]}:{value:t,basis:"derived",paths:["timeline"]}}vanish(n){const t=(n.events??[]).findIndex(s=>s.eventType==="vanish"&&u.isPhenomenon(n,s));return t>=0?{shown:!0,basis:"stated",paths:[`events.${t}`]}:{shown:!1,paths:[]}}oscillation(n){const t=new Set((n.interpretation?.bodies??[]).map(e=>e.id)),s=(n.events??[]).findIndex(e=>o.OSCILLATIONS.includes(e.eventType)&&(u.isPhenomenon(n,e)||t.has(e.who?.split("/")[0]??"")));return s>=0?{shown:!0,basis:"stated",paths:[`events.${s}`]}:{shown:!1,paths:[]}}landing(n){const t=e=>!e.onGround&&((e.altitudeAboveGroundM??0)>0||(e.altitudeM??0)>0),s=(n.interpretation?.bodies??[]).findIndex(e=>Array.isArray(e.track)&&e.track.some(a=>a.onGround)&&e.track.some(t));return s>=0?{shown:!0,basis:"assumed",paths:[`interpretation.bodies.${s}`]}:{shown:!1,paths:[]}}occupants(n){const t=n.decor.findIndex(s=>s.kind==="entity");return t>=0?{shown:!0,basis:"stated",paths:[`decor.${t}`]}:this.judged(n,"beings")}judged(n,t){const s=n.account?.strangeness?.[t];return s===void 0?{shown:!1,paths:[]}:{shown:s,basis:"stated",paths:[`account.strangeness.${t}`]}}instants(n,t){return n.timeline.allKeyframes.map(s=>({t:s.t,shape:s.shapes.find(e=>e.sourceId===t)?.shape})).filter(({shape:s})=>s!==void 0).map(({t:s,shape:e})=>({t:s,aim:e.aim,visible:e.transparency<1})).sort((s,e)=>s.t-e.t)}seen(n,t){return this.instants(n,t).filter(s=>s.visible)}static unit(n){const[t,s]=[n.azimuthDeg*Math.PI/180,n.altitudeDeg*Math.PI/180];return[Math.cos(s)*Math.sin(t),Math.cos(s)*Math.cos(t),Math.sin(s)]}static cross(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}static angleDeg(n,t){const s=Math.hypot(...n)*Math.hypot(...t);if(s===0)return 0;const e=(n[0]*t[0]+n[1]*t[1]+n[2]*t[2])/s;return Math.acos(Math.max(-1,Math.min(1,e)))*180/Math.PI}}export{o as PoherAssessor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{am as F,ar as P,aU as H,n as K,aD as w,aE as N,ap as U,bg as k}from"./rr0-sighting-editor.mjs";class b{static HOLLOW_M=1;static COVERED_M=3;static WINDOW_M=30;static SAMPLE_M=4;static MAX_GRADE={rail:.025,highSpeed:.035,subway:.04,light_rail:.06,tram:.08,funicular:1/0};static heights(t,s,e){const n=t.map(a=>a.level===0),o=t.map((a,i)=>n[i]?b.targets(a,s,e):[]),c=t.map((a,i)=>n[i]?b.samples(a,o[i]):[]),r=new Map;t.forEach((a,i)=>{if(n[i])for(const h of b.ends(a)){const u=b.key(h),p=r.get(u);p?p.push(i):r.set(u,[i])}});const M=a=>{const i=r.get(b.key(a));if(i)return b.median(i.flatMap(h=>c[h]),a)};return t.map((a,i)=>{if(n[i]){const h=[...new Set([i,...b.ends(a).flatMap(d=>r.get(b.key(d))??[])])].flatMap(d=>c[d]),u=a.centre.map((d,O)=>b.median(h,d)??o[i][O]),[p,A]=b.ends(a);return u[0]=M(p)??u[0],u[u.length-1]=M(A)??u[u.length-1],b.graded(u,a.along,a.highSpeed?b.MAX_GRADE.highSpeed:b.MAX_GRADE[a.kind])}return b.carried(a,s,e,M)})}static targets(t,s,e){return t.centre.map(n=>{const o=s(n.x,n.z);if(e===void 0||n.altitudeM===void 0)return o;const c=n.altitudeM+e;return c-o>b.HOLLOW_M||o-c>b.COVERED_M?c:o})}static samples(t,s){const e=[];let n=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<n&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:s[c]}),n=t.along[c]+b.SAMPLE_M)}),e}static median(t,s){const e=[];for(const o of t)Math.hypot(o.x-s.x,o.z-s.z)<=b.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const n=e.length>>1;return e.length%2===1?e[n]:(e[n-1]+e[n])/2}static graded(t,s,e){if(!Number.isFinite(e)||t.length<3)return t;const n=[...t],o=n.length-1,c=s[o];if(Math.abs(n[o]-n[0])>e*c)return s.map(r=>n[0]+(n[o]-n[0])*r/c);for(let r=1;r<o;r++){const M=e*(s[r]-s[r-1]);n[r]=Math.min(n[r-1]+M,Math.max(n[r-1]-M,n[r]))}for(let r=o-1;r>0;r--){const M=e*(s[r+1]-s[r]);n[r]=Math.min(n[r+1]+M,Math.max(n[r+1]-M,n[r]))}return n}static carried(t,s,e,n){const[o,c]=b.ends(t),r=t.along[t.along.length-1],M=n(o),a=n(c);if(e!==void 0&&t.centre.every(u=>u.altitudeM!==void 0)){const u=t.centre.map(d=>d.altitudeM+e),p=M!==void 0?M-u[0]:0,A=a!==void 0?a-u[u.length-1]:0;return u.map((d,O)=>d+p+(A-p)*t.along[O]/r)}const i=M??s(o.x,o.z),h=a??s(c.x,c.z);return t.along.map(u=>i+(h-i)*u/r)}static ends(t){return[t.centre[0],t.centre[t.centre.length-1]]}static key(t){return`${Math.round(t.x*2)},${Math.round(t.z*2)}`}}class B{positions=[];indices=[];along=[];get vertexCount(){return this.positions.length/3}strip(t,s,e){const n=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,s[o].x,s[o].y,s[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=n+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,s,e,n=!0){const o=s.x-t.x,c=s.y-t.y,r=s.z-t.z,M=Math.hypot(o,c,r);if(M<1e-6)return;const a={x:o/M,y:c/M,z:r/M},i=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},h=a.y*i.z-a.z*i.y,u=a.z*i.x-a.x*i.z,p=a.x*i.y-a.y*i.x,A=Math.hypot(h,u,p),d={x:h/A*e/2,y:u/A*e/2,z:p/A*e/2},O={x:a.y*d.z-a.z*d.y,y:a.z*d.x-a.x*d.z,z:a.x*d.y-a.y*d.x},g=(f,x,E)=>({x:f.x+d.x*x+O.x*E,y:f.y+d.y*x+O.y*E,z:f.z+d.z*x+O.z*E}),_=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let f=0;f<4;f++){const[x,E]=_[f],[z,v]=_[(f+1)%4];this.quad(g(t,x,E),g(t,z,v),g(s,z,v),g(s,x,E))}n&&(this.quad(...[..._].reverse().map(([f,x])=>g(t,f,x))),this.quad(..._.map(([f,x])=>g(s,f,x))))}quad(t,s,e,n){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,s.x,s.y,s.z,e.x,e.y,e.z,n.x,n.y,n.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class l{static STEP_M=6;static BALLAST_HEIGHT_M=.5;static BALLAST_SLOPE=1.5;static BALLAST_SHOULDER_M=.45;static DECK_DEPTH_M=.8;static BANK_SLOPE=1.5;static SLEEPER_LENGTH_M=2.4;static SLEEPER_WIDTH_M=.29;static SLEEPER_SPACING_M=.6;static RAIL_HEAD_M=.072;static RAIL_HEIGHT_M=.18;static TRAM_RAIL_HEIGHT_M=.03;static LIFT_M=.06;static CATENARY={rail:{contactM:5.5,systemM:1.4,spanM:54,staggerM:.2},highSpeed:{contactM:5.08,systemM:1.4,spanM:63,staggerM:.2},service:{contactM:5.5,systemM:1.2,spanM:45,staggerM:.2},tram:{contactM:6,systemM:0,spanM:30,staggerM:.2}};static MESSENGER_SAG_M=.55;static MAST_SIDE_M=.26;static MAST_OFFSET_M=3.1;static MAST_ABOVE_M=.6;static CONTACT_DIAMETER_M=.012;static MESSENGER_DIAMETER_M=.011;static ARM_SIDE_M=.06;static TRACK_SPACING_M={rail:3.7,highSpeed:4.5,tram:3.1,subway:3.4,light_rail:3.4,funicular:3.2};static BALLAST_ALBEDO=[.17,.16,.15];static BANK_ALBEDO=[.085,.09,.05];static DECK_ALBEDO=[.26,.255,.24];static CONCRETE_ALBEDO=[.36,.35,.33];static WOOD_ALBEDO=[.07,.055,.045];static RUST_ALBEDO=[.085,.068,.058];static STEEL_ALBEDO=[.3,.31,.32];static COPPER_ALBEDO=[.09,.085,.07];static LINE_REACH_M=20;group=new F;stepM=l.STEP_M;drawn=0;laid=[];ballastMaterial=l.pebbled(l.lambert(l.BALLAST_ALBEDO,!0));earthMaterial=l.lambert(l.BANK_ALBEDO,!0);deckMaterial=l.lambert(l.DECK_ALBEDO,!1);concreteSleepers=l.sleeperMaterial(l.CONCRETE_ALBEDO);woodSleepers=l.sleeperMaterial(l.WOOD_ALBEDO);rustMaterial=l.lambert(l.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=l.lambert(l.STEEL_ALBEDO,!1);wireMaterial=l.lambert(l.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(l.STEP_M,Math.max(1.5,t/2)):l.STEP_M}set(t,s,e,n,o=1/0){this.clear();const r=t.map(p=>({line:p,path:p.points.map(A=>({...K(A.lat,A.lng,s,e),altitudeM:A.altitudeM}))})).filter(({line:p,path:A})=>p.level>=0&&l.within(A,o)),M=l.altitudeOffset(r,n),a=r.flatMap(({line:p,path:A})=>{const d=this.layoutOf(p,A);return d?[{line:p,layout:d}]:[]}),i=b.heights(a.map(({layout:p})=>p),n,M),h={ballast:new B,earth:new B,deck:new B,concrete:new B,wood:new B,rust:new B,head:new B,steel:new B,wire:new B};a.forEach(({line:p,layout:A},d)=>{this.lay(p,{...A,y:i[d]},n,h),this.laid.push({line:p,centre:A.centre}),this.drawn++});const u=[[h.ballast,this.ballastMaterial,"ballast",!1],[h.earth,this.earthMaterial,"embankments",!1],[h.deck,this.deckMaterial,"decks",!0],[h.concrete,this.concreteSleepers,"sleepers",!1],[h.wood,this.woodSleepers,"sleepers wood",!1],[h.rust,this.rustMaterial,"rails",!1],[h.head,this.headMaterial,"rail heads",!1],[h.steel,this.steelMaterial,"catenary masts",!0],[h.wire,this.wireMaterial,"catenary wires",!1]];for(const[p,A,d,O]of u){const g=l.meshOf(p,A);g&&(g.name=`railways ${d}`,g.castShadow=O,g.receiveShadow=!0,this.group.add(g))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,s){let e;for(const{line:n,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],M=o[c+1],a=M.x-r.x,i=M.z-r.z,h=a*a+i*i,u=h===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(s-r.z)*i)/h)),p=Math.hypot(t-(r.x+a*u),s-(r.z+i*u));p<=l.LINE_REACH_M&&(!e||p<e.distance)&&(e={line:n,distance:p})}return e?.line}mayMeet(t,s,e,n){const o=Math.hypot(s.x,s.z);if(o<1e-6)return this.lineAt(t.x,t.z)!==void 0;const c=s.x/o,r=s.z/o,M=l.LINE_REACH_M;for(const{centre:a}of this.laid)for(let i=0;i<a.length-1;i++){const h=a[i],u=a[i+1];for(const p of[0,.5,1]){const A=h.x+(u.x-h.x)*p,d=h.z+(u.z-h.z)*p,O=(A-t.x)*c+(d-t.z)*r;if(O<0)continue;const g=Math.abs((A-t.x)*r-(d-t.z)*c),_=Math.hypot(u.x-h.x,u.z-h.z)/2;if(g>M+_)continue;if(t.y+s.y*(O/o)<=e(A,d)+n)return!0}}return!1}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return l.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?l.CATENARY.tram:t.highSpeed?l.CATENARY.highSpeed:t.service?l.CATENARY.service:l.CATENARY.rail}dispose(){this.clear();for(const t of[this.ballastMaterial,this.earthMaterial,this.deckMaterial,this.concreteSleepers,this.woodSleepers,this.rustMaterial,this.headMaterial,this.steelMaterial,this.wireMaterial])t.dispose()}static within(t,s){if(!Number.isFinite(s))return!0;const e=s*1.1+100;return t.some((n,o)=>Math.hypot(n.x,n.z)<=e||o>0&&Math.hypot((n.x+t[o-1].x)/2,(n.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,s){const e=[];for(const{line:n,path:o}of t)if(n.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(s(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((n,o)=>n-o),e[Math.floor(e.length/2)]}layoutOf(t,s){const e=[];for(let c=0;c<s.length-1;c++){const r=s[c],M=s[c+1],a=Math.max(1,Math.ceil(Math.hypot(M.x-r.x,M.z-r.z)/this.stepM));for(let i=0;i<a;i++){const h=i/a,u=r.altitudeM!==void 0&&M.altitudeM!==void 0?r.altitudeM+(M.altitudeM-r.altitudeM)*h:void 0;e.push({x:r.x+(M.x-r.x)*h,z:r.z+(M.z-r.z)*h,altitudeM:u})}}if(e.push(s[s.length-1]),e.length<2)return;const n=[0];for(let c=1;c<e.length;c++)n.push(n[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(n[n.length-1]<.5)return;const o=e.map((c,r)=>{const M=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],i=a.x-M.x,h=a.z-M.z,u=Math.hypot(i,h);return u<1e-6?{x:1,z:0}:{x:i/u,z:h/u}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:n,dir:o}}lay(t,s,e,n){const o=t.highSpeed?l.TRACK_SPACING_M.highSpeed:l.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(g,_)=>(_-(c-1)/2)*o),M=t.kind==="tram",a=M?0:l.BALLAST_HEIGHT_M,i=l.LIFT_M,h=(g,_,f)=>({x:s.centre[g].x-s.dir[g].z*_,y:s.y[g]+f,z:s.centre[g].z+s.dir[g].x*_}),u=s.centre.map((g,_)=>_);if(!M){const g=l.SLEEPER_LENGTH_M/2+l.BALLAST_SHOULDER_M+(r[r.length-1]??0),_=u.map(x=>h(x,g,a+i)),f=u.map(x=>h(x,-g,a+i));if(n.ballast.strip(_,f),t.level===0){const x=g+a*l.BALLAST_SLOPE;for(const E of[1,-1]){const z=[],v=[];let m=!1;for(const L of u){const C=h(L,E*x,i),S=e(C.x,C.z)+i,T=C.y-S;T<0&&(C.y=Math.min(S,s.y[L]+a-.05+i)),z.push(C);const I=h(L,E*(x+Math.max(0,T)*l.BANK_SLOPE),i);I.y=Math.min(e(I.x,I.z)+i,C.y),C.y-I.y>.02&&(m=!0),v.push(I)}const D=E>0?_:f;E>0?n.ballast.strip(z,D):n.ballast.strip(D,z),m&&(E>0?n.earth.strip(v,z):n.earth.strip(z,v))}}else{const x=-l.DECK_DEPTH_M,E=g+.15,z=u.map(L=>h(L,E,a+i+.1)),v=u.map(L=>h(L,-E,a+i+.1)),m=u.map(L=>h(L,E,x)),D=u.map(L=>h(L,-E,x));n.deck.strip(m,z),n.deck.strip(v,D),n.deck.strip(D,m),n.deck.strip(z,u.map(L=>h(L,g,a+i+.1))),n.deck.strip(u.map(L=>h(L,-g,a+i+.1)),v)}}const p=t.service?n.wood:n.concrete,A=t.gaugeMm/2e3+l.RAIL_HEAD_M/2,d=M?l.TRAM_RAIL_HEIGHT_M:l.RAIL_HEIGHT_M,O=a+i;for(const g of r){if(!M){const _=l.SLEEPER_LENGTH_M/2;p.strip(u.map(f=>h(f,g+_,O+.004)),u.map(f=>h(f,g-_,O+.004)),s.along)}for(const _ of[1,-1]){const f=g+_*A,x=l.RAIL_HEAD_M/2,E=u.map(v=>h(v,f+x,O+d)),z=u.map(v=>h(v,f-x,O+d));n.head.strip(E,z),n.rust.strip(u.map(v=>h(v,f+x,O)),E),n.rust.strip(z,u.map(v=>h(v,f-x,O)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,s,r,O+d,h,e,n)}catenary(t,s,e,n,o,c,r){const M=l.catenaryOf(t),a=s.along[s.along.length-1],i=Math.max(1,Math.round(a/M.spanM)),h=a/i,u=Array.from({length:i},(E,z)=>(z+.5)*h),p=n+M.contactM,A=p+M.systemM,d=(M.systemM>0?A:p)+l.MAST_ABOVE_M,O=e[e.length-1],g=e.length>2,_=e.length===1?[1]:[1,-1],f=(E,z,v)=>{let m=0,D=s.along.length-2;for(;m<D;){const T=m+D+1>>1;s.along[T]<=E?m=T:D=T-1}const L=Math.min(1,Math.max(0,(E-s.along[m])/Math.max(1e-6,s.along[m+1]-s.along[m]))),C=o(m,z,v),S=o(m+1,z,v);return{x:C.x+(S.x-C.x)*L,y:C.y+(S.y-C.y)*L,z:C.z+(S.z-C.z)*L}};for(const E of u){const z=f(E,0,p);if(!(t.level===0&&c(z.x,z.z)>z.y)){for(const v of _){const m=v*(O+l.MAST_OFFSET_M),D=f(E,m,0);t.level===0&&(D.y=Math.min(D.y,c(D.x,D.z)));const L=f(E,m,d);if(r.steel.beam(D,L,l.MAST_SIDE_M),g)continue;const S=(_.length===1?e[0]:v*O)-v*.6,T=M.systemM>0?A:p+.3;r.steel.beam(f(E,m,T),f(E,S,T),l.ARM_SIDE_M),r.steel.beam(f(E,m,p-.4),f(E,S,T),l.ARM_SIDE_M)}if(g){const v=O+l.MAST_OFFSET_M;r.steel.beam(f(E,v,d-.2),f(E,-v,d-.2),l.MAST_SIDE_M*.8)}}}const x=[0,...u,a];for(const[E,z]of e.entries()){const v=m=>m===0||m===x.length-1?0:((m+E)%2===0?1:-1)*M.staggerM;for(let m=0;m<x.length-1;m++){const D=x[m],L=x[m+1];if(L-D<.1||(r.wire.beam(f(D,z+v(m),p),f(L,z+v(m+1),p),l.CONTACT_DIAMETER_M,!1),M.systemM<=0))continue;const C=4,S=T=>{const I=m===0?.5+T/2:m===x.length-2?T/2:T;return A-l.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<C;T++){const I=T/C,G=(T+1)/C;r.wire.beam(f(D+(L-D)*I,z,S(I)),f(D+(L-D)*G,z,S(G)),l.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,s){if(t.indices.length===0)return;const e=new w;return e.setAttribute("position",new N(new Float32Array(t.positions),3)),t.along.length>0&&e.setAttribute("aAlong",new N(new Float32Array(t.along),1)),e.setIndex(new N(new Uint32Array(t.indices),1)),e.computeVertexNormals(),new U(e,s)}static lambert(t,s){return new k({color:new H(...t),...s?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=s=>{s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
|
|
1
|
+
import{am as F,ar as P,aV as H,n as K,aE as w,aF as N,ap as U,bh as k}from"./rr0-sighting-editor.mjs";class b{static HOLLOW_M=1;static COVERED_M=3;static WINDOW_M=30;static SAMPLE_M=4;static MAX_GRADE={rail:.025,highSpeed:.035,subway:.04,light_rail:.06,tram:.08,funicular:1/0};static heights(t,s,e){const n=t.map(a=>a.level===0),o=t.map((a,i)=>n[i]?b.targets(a,s,e):[]),c=t.map((a,i)=>n[i]?b.samples(a,o[i]):[]),r=new Map;t.forEach((a,i)=>{if(n[i])for(const h of b.ends(a)){const u=b.key(h),p=r.get(u);p?p.push(i):r.set(u,[i])}});const M=a=>{const i=r.get(b.key(a));if(i)return b.median(i.flatMap(h=>c[h]),a)};return t.map((a,i)=>{if(n[i]){const h=[...new Set([i,...b.ends(a).flatMap(d=>r.get(b.key(d))??[])])].flatMap(d=>c[d]),u=a.centre.map((d,O)=>b.median(h,d)??o[i][O]),[p,A]=b.ends(a);return u[0]=M(p)??u[0],u[u.length-1]=M(A)??u[u.length-1],b.graded(u,a.along,a.highSpeed?b.MAX_GRADE.highSpeed:b.MAX_GRADE[a.kind])}return b.carried(a,s,e,M)})}static targets(t,s,e){return t.centre.map(n=>{const o=s(n.x,n.z);if(e===void 0||n.altitudeM===void 0)return o;const c=n.altitudeM+e;return c-o>b.HOLLOW_M||o-c>b.COVERED_M?c:o})}static samples(t,s){const e=[];let n=0;return t.centre.forEach((o,c)=>{t.along[c]+1e-6<n&&c<t.centre.length-1||(e.push({x:o.x,z:o.z,y:s[c]}),n=t.along[c]+b.SAMPLE_M)}),e}static median(t,s){const e=[];for(const o of t)Math.hypot(o.x-s.x,o.z-s.z)<=b.WINDOW_M&&e.push(o.y);if(e.length===0)return;e.sort((o,c)=>o-c);const n=e.length>>1;return e.length%2===1?e[n]:(e[n-1]+e[n])/2}static graded(t,s,e){if(!Number.isFinite(e)||t.length<3)return t;const n=[...t],o=n.length-1,c=s[o];if(Math.abs(n[o]-n[0])>e*c)return s.map(r=>n[0]+(n[o]-n[0])*r/c);for(let r=1;r<o;r++){const M=e*(s[r]-s[r-1]);n[r]=Math.min(n[r-1]+M,Math.max(n[r-1]-M,n[r]))}for(let r=o-1;r>0;r--){const M=e*(s[r+1]-s[r]);n[r]=Math.min(n[r+1]+M,Math.max(n[r+1]-M,n[r]))}return n}static carried(t,s,e,n){const[o,c]=b.ends(t),r=t.along[t.along.length-1],M=n(o),a=n(c);if(e!==void 0&&t.centre.every(u=>u.altitudeM!==void 0)){const u=t.centre.map(d=>d.altitudeM+e),p=M!==void 0?M-u[0]:0,A=a!==void 0?a-u[u.length-1]:0;return u.map((d,O)=>d+p+(A-p)*t.along[O]/r)}const i=M??s(o.x,o.z),h=a??s(c.x,c.z);return t.along.map(u=>i+(h-i)*u/r)}static ends(t){return[t.centre[0],t.centre[t.centre.length-1]]}static key(t){return`${Math.round(t.x*2)},${Math.round(t.z*2)}`}}class B{positions=[];indices=[];along=[];get vertexCount(){return this.positions.length/3}strip(t,s,e){const n=this.vertexCount;for(let o=0;o<t.length;o++)this.positions.push(t[o].x,t[o].y,t[o].z,s[o].x,s[o].y,s[o].z),e&&this.along.push(e[o],e[o]);for(let o=0;o<t.length-1;o++){const c=n+o*2;this.indices.push(c,c+2,c+1,c+1,c+2,c+3)}}beam(t,s,e,n=!0){const o=s.x-t.x,c=s.y-t.y,r=s.z-t.z,M=Math.hypot(o,c,r);if(M<1e-6)return;const a={x:o/M,y:c/M,z:r/M},i=Math.abs(a.y)>.9?{x:1,y:0,z:0}:{x:0,y:1,z:0},h=a.y*i.z-a.z*i.y,u=a.z*i.x-a.x*i.z,p=a.x*i.y-a.y*i.x,A=Math.hypot(h,u,p),d={x:h/A*e/2,y:u/A*e/2,z:p/A*e/2},O={x:a.y*d.z-a.z*d.y,y:a.z*d.x-a.x*d.z,z:a.x*d.y-a.y*d.x},g=(f,x,E)=>({x:f.x+d.x*x+O.x*E,y:f.y+d.y*x+O.y*E,z:f.z+d.z*x+O.z*E}),_=[[1,1],[-1,1],[-1,-1],[1,-1]];for(let f=0;f<4;f++){const[x,E]=_[f],[z,v]=_[(f+1)%4];this.quad(g(t,x,E),g(t,z,v),g(s,z,v),g(s,x,E))}n&&(this.quad(...[..._].reverse().map(([f,x])=>g(t,f,x))),this.quad(..._.map(([f,x])=>g(s,f,x))))}quad(t,s,e,n){const o=this.vertexCount;this.positions.push(t.x,t.y,t.z,s.x,s.y,s.z,e.x,e.y,e.z,n.x,n.y,n.z),this.indices.push(o,o+1,o+2,o,o+2,o+3)}}class l{static STEP_M=6;static BALLAST_HEIGHT_M=.5;static BALLAST_SLOPE=1.5;static BALLAST_SHOULDER_M=.45;static DECK_DEPTH_M=.8;static BANK_SLOPE=1.5;static SLEEPER_LENGTH_M=2.4;static SLEEPER_WIDTH_M=.29;static SLEEPER_SPACING_M=.6;static RAIL_HEAD_M=.072;static RAIL_HEIGHT_M=.18;static TRAM_RAIL_HEIGHT_M=.03;static LIFT_M=.06;static CATENARY={rail:{contactM:5.5,systemM:1.4,spanM:54,staggerM:.2},highSpeed:{contactM:5.08,systemM:1.4,spanM:63,staggerM:.2},service:{contactM:5.5,systemM:1.2,spanM:45,staggerM:.2},tram:{contactM:6,systemM:0,spanM:30,staggerM:.2}};static MESSENGER_SAG_M=.55;static MAST_SIDE_M=.26;static MAST_OFFSET_M=3.1;static MAST_ABOVE_M=.6;static CONTACT_DIAMETER_M=.012;static MESSENGER_DIAMETER_M=.011;static ARM_SIDE_M=.06;static TRACK_SPACING_M={rail:3.7,highSpeed:4.5,tram:3.1,subway:3.4,light_rail:3.4,funicular:3.2};static BALLAST_ALBEDO=[.17,.16,.15];static BANK_ALBEDO=[.085,.09,.05];static DECK_ALBEDO=[.26,.255,.24];static CONCRETE_ALBEDO=[.36,.35,.33];static WOOD_ALBEDO=[.07,.055,.045];static RUST_ALBEDO=[.085,.068,.058];static STEEL_ALBEDO=[.3,.31,.32];static COPPER_ALBEDO=[.09,.085,.07];static LINE_REACH_M=20;group=new F;stepM=l.STEP_M;drawn=0;laid=[];ballastMaterial=l.pebbled(l.lambert(l.BALLAST_ALBEDO,!0));earthMaterial=l.lambert(l.BANK_ALBEDO,!0);deckMaterial=l.lambert(l.DECK_ALBEDO,!1);concreteSleepers=l.sleeperMaterial(l.CONCRETE_ALBEDO);woodSleepers=l.sleeperMaterial(l.WOOD_ALBEDO);rustMaterial=l.lambert(l.RUST_ALBEDO,!0);headMaterial=new P({color:new H(.62,.62,.62),metalness:1,roughness:.28,polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2});steelMaterial=l.lambert(l.STEEL_ALBEDO,!1);wireMaterial=l.lambert(l.COPPER_ALBEDO,!1);constructor(){this.group.name="railways"}get count(){return this.drawn}setGroundSpacing(t){this.stepM=Number.isFinite(t)&&t>0?Math.min(l.STEP_M,Math.max(1.5,t/2)):l.STEP_M}set(t,s,e,n,o=1/0){this.clear();const r=t.map(p=>({line:p,path:p.points.map(A=>({...K(A.lat,A.lng,s,e),altitudeM:A.altitudeM}))})).filter(({line:p,path:A})=>p.level>=0&&l.within(A,o)),M=l.altitudeOffset(r,n),a=r.flatMap(({line:p,path:A})=>{const d=this.layoutOf(p,A);return d?[{line:p,layout:d}]:[]}),i=b.heights(a.map(({layout:p})=>p),n,M),h={ballast:new B,earth:new B,deck:new B,concrete:new B,wood:new B,rust:new B,head:new B,steel:new B,wire:new B};a.forEach(({line:p,layout:A},d)=>{this.lay(p,{...A,y:i[d]},n,h),this.laid.push({line:p,centre:A.centre}),this.drawn++});const u=[[h.ballast,this.ballastMaterial,"ballast",!1],[h.earth,this.earthMaterial,"embankments",!1],[h.deck,this.deckMaterial,"decks",!0],[h.concrete,this.concreteSleepers,"sleepers",!1],[h.wood,this.woodSleepers,"sleepers wood",!1],[h.rust,this.rustMaterial,"rails",!1],[h.head,this.headMaterial,"rail heads",!1],[h.steel,this.steelMaterial,"catenary masts",!0],[h.wire,this.wireMaterial,"catenary wires",!1]];for(const[p,A,d,O]of u){const g=l.meshOf(p,A);g&&(g.name=`railways ${d}`,g.castShadow=O,g.receiveShadow=!0,this.group.add(g))}}clear(){for(const t of[...this.group.children])this.group.remove(t),t.geometry?.dispose();this.drawn=0,this.laid=[]}lineAt(t,s){let e;for(const{line:n,centre:o}of this.laid)for(let c=0;c<o.length-1;c++){const r=o[c],M=o[c+1],a=M.x-r.x,i=M.z-r.z,h=a*a+i*i,u=h===0?0:Math.max(0,Math.min(1,((t-r.x)*a+(s-r.z)*i)/h)),p=Math.hypot(t-(r.x+a*u),s-(r.z+i*u));p<=l.LINE_REACH_M&&(!e||p<e.distance)&&(e={line:n,distance:p})}return e?.line}mayMeet(t,s,e,n){const o=Math.hypot(s.x,s.z);if(o<1e-6)return this.lineAt(t.x,t.z)!==void 0;const c=s.x/o,r=s.z/o,M=l.LINE_REACH_M;for(const{centre:a}of this.laid)for(let i=0;i<a.length-1;i++){const h=a[i],u=a[i+1];for(const p of[0,.5,1]){const A=h.x+(u.x-h.x)*p,d=h.z+(u.z-h.z)*p,O=(A-t.x)*c+(d-t.z)*r;if(O<0)continue;const g=Math.abs((A-t.x)*r-(d-t.z)*c),_=Math.hypot(u.x-h.x,u.z-h.z)/2;if(g>M+_)continue;if(t.y+s.y*(O/o)<=e(A,d)+n)return!0}}return!1}contactHeightM(t){if(!(t.electrification!=="overhead"||t.kind==="subway"||t.kind==="funicular"))return l.catenaryOf(t).contactM}static catenaryOf(t){return t.kind==="tram"?l.CATENARY.tram:t.highSpeed?l.CATENARY.highSpeed:t.service?l.CATENARY.service:l.CATENARY.rail}dispose(){this.clear();for(const t of[this.ballastMaterial,this.earthMaterial,this.deckMaterial,this.concreteSleepers,this.woodSleepers,this.rustMaterial,this.headMaterial,this.steelMaterial,this.wireMaterial])t.dispose()}static within(t,s){if(!Number.isFinite(s))return!0;const e=s*1.1+100;return t.some((n,o)=>Math.hypot(n.x,n.z)<=e||o>0&&Math.hypot((n.x+t[o-1].x)/2,(n.z+t[o-1].z)/2)<=e)}static altitudeOffset(t,s){const e=[];for(const{line:n,path:o}of t)if(n.level===0)for(const c of o)c.altitudeM!==void 0&&e.push(s(c.x,c.z)-c.altitudeM);if(!(e.length<5))return e.sort((n,o)=>n-o),e[Math.floor(e.length/2)]}layoutOf(t,s){const e=[];for(let c=0;c<s.length-1;c++){const r=s[c],M=s[c+1],a=Math.max(1,Math.ceil(Math.hypot(M.x-r.x,M.z-r.z)/this.stepM));for(let i=0;i<a;i++){const h=i/a,u=r.altitudeM!==void 0&&M.altitudeM!==void 0?r.altitudeM+(M.altitudeM-r.altitudeM)*h:void 0;e.push({x:r.x+(M.x-r.x)*h,z:r.z+(M.z-r.z)*h,altitudeM:u})}}if(e.push(s[s.length-1]),e.length<2)return;const n=[0];for(let c=1;c<e.length;c++)n.push(n[c-1]+Math.hypot(e[c].x-e[c-1].x,e[c].z-e[c-1].z));if(n[n.length-1]<.5)return;const o=e.map((c,r)=>{const M=e[Math.max(0,r-1)],a=e[Math.min(e.length-1,r+1)],i=a.x-M.x,h=a.z-M.z,u=Math.hypot(i,h);return u<1e-6?{x:1,z:0}:{x:i/u,z:h/u}});return{kind:t.kind,...t.highSpeed?{highSpeed:!0}:{},level:t.level,centre:e,along:n,dir:o}}lay(t,s,e,n){const o=t.highSpeed?l.TRACK_SPACING_M.highSpeed:l.TRACK_SPACING_M[t.kind],c=Math.min(8,Math.max(1,t.tracks)),r=Array.from({length:c},(g,_)=>(_-(c-1)/2)*o),M=t.kind==="tram",a=M?0:l.BALLAST_HEIGHT_M,i=l.LIFT_M,h=(g,_,f)=>({x:s.centre[g].x-s.dir[g].z*_,y:s.y[g]+f,z:s.centre[g].z+s.dir[g].x*_}),u=s.centre.map((g,_)=>_);if(!M){const g=l.SLEEPER_LENGTH_M/2+l.BALLAST_SHOULDER_M+(r[r.length-1]??0),_=u.map(x=>h(x,g,a+i)),f=u.map(x=>h(x,-g,a+i));if(n.ballast.strip(_,f),t.level===0){const x=g+a*l.BALLAST_SLOPE;for(const E of[1,-1]){const z=[],v=[];let m=!1;for(const L of u){const C=h(L,E*x,i),S=e(C.x,C.z)+i,T=C.y-S;T<0&&(C.y=Math.min(S,s.y[L]+a-.05+i)),z.push(C);const I=h(L,E*(x+Math.max(0,T)*l.BANK_SLOPE),i);I.y=Math.min(e(I.x,I.z)+i,C.y),C.y-I.y>.02&&(m=!0),v.push(I)}const D=E>0?_:f;E>0?n.ballast.strip(z,D):n.ballast.strip(D,z),m&&(E>0?n.earth.strip(v,z):n.earth.strip(z,v))}}else{const x=-l.DECK_DEPTH_M,E=g+.15,z=u.map(L=>h(L,E,a+i+.1)),v=u.map(L=>h(L,-E,a+i+.1)),m=u.map(L=>h(L,E,x)),D=u.map(L=>h(L,-E,x));n.deck.strip(m,z),n.deck.strip(v,D),n.deck.strip(D,m),n.deck.strip(z,u.map(L=>h(L,g,a+i+.1))),n.deck.strip(u.map(L=>h(L,-g,a+i+.1)),v)}}const p=t.service?n.wood:n.concrete,A=t.gaugeMm/2e3+l.RAIL_HEAD_M/2,d=M?l.TRAM_RAIL_HEIGHT_M:l.RAIL_HEIGHT_M,O=a+i;for(const g of r){if(!M){const _=l.SLEEPER_LENGTH_M/2;p.strip(u.map(f=>h(f,g+_,O+.004)),u.map(f=>h(f,g-_,O+.004)),s.along)}for(const _ of[1,-1]){const f=g+_*A,x=l.RAIL_HEAD_M/2,E=u.map(v=>h(v,f+x,O+d)),z=u.map(v=>h(v,f-x,O+d));n.head.strip(E,z),n.rust.strip(u.map(v=>h(v,f+x,O)),E),n.rust.strip(z,u.map(v=>h(v,f-x,O)))}}t.electrification==="overhead"&&t.kind!=="subway"&&t.kind!=="funicular"&&this.catenary(t,s,r,O+d,h,e,n)}catenary(t,s,e,n,o,c,r){const M=l.catenaryOf(t),a=s.along[s.along.length-1],i=Math.max(1,Math.round(a/M.spanM)),h=a/i,u=Array.from({length:i},(E,z)=>(z+.5)*h),p=n+M.contactM,A=p+M.systemM,d=(M.systemM>0?A:p)+l.MAST_ABOVE_M,O=e[e.length-1],g=e.length>2,_=e.length===1?[1]:[1,-1],f=(E,z,v)=>{let m=0,D=s.along.length-2;for(;m<D;){const T=m+D+1>>1;s.along[T]<=E?m=T:D=T-1}const L=Math.min(1,Math.max(0,(E-s.along[m])/Math.max(1e-6,s.along[m+1]-s.along[m]))),C=o(m,z,v),S=o(m+1,z,v);return{x:C.x+(S.x-C.x)*L,y:C.y+(S.y-C.y)*L,z:C.z+(S.z-C.z)*L}};for(const E of u){const z=f(E,0,p);if(!(t.level===0&&c(z.x,z.z)>z.y)){for(const v of _){const m=v*(O+l.MAST_OFFSET_M),D=f(E,m,0);t.level===0&&(D.y=Math.min(D.y,c(D.x,D.z)));const L=f(E,m,d);if(r.steel.beam(D,L,l.MAST_SIDE_M),g)continue;const S=(_.length===1?e[0]:v*O)-v*.6,T=M.systemM>0?A:p+.3;r.steel.beam(f(E,m,T),f(E,S,T),l.ARM_SIDE_M),r.steel.beam(f(E,m,p-.4),f(E,S,T),l.ARM_SIDE_M)}if(g){const v=O+l.MAST_OFFSET_M;r.steel.beam(f(E,v,d-.2),f(E,-v,d-.2),l.MAST_SIDE_M*.8)}}}const x=[0,...u,a];for(const[E,z]of e.entries()){const v=m=>m===0||m===x.length-1?0:((m+E)%2===0?1:-1)*M.staggerM;for(let m=0;m<x.length-1;m++){const D=x[m],L=x[m+1];if(L-D<.1||(r.wire.beam(f(D,z+v(m),p),f(L,z+v(m+1),p),l.CONTACT_DIAMETER_M,!1),M.systemM<=0))continue;const C=4,S=T=>{const I=m===0?.5+T/2:m===x.length-2?T/2:T;return A-l.MESSENGER_SAG_M*4*I*(1-I)};for(let T=0;T<C;T++){const I=T/C,G=(T+1)/C;r.wire.beam(f(D+(L-D)*I,z,S(I)),f(D+(L-D)*G,z,S(G)),l.MESSENGER_DIAMETER_M,!1)}}}}static meshOf(t,s){if(t.indices.length===0)return;const e=new w;return e.setAttribute("position",new N(new Float32Array(t.positions),3)),t.along.length>0&&e.setAttribute("aAlong",new N(new Float32Array(t.along),1)),e.setIndex(new N(new Uint32Array(t.indices),1)),e.computeVertexNormals(),new U(e,s)}static lambert(t,s){return new k({color:new H(...t),...s?{polygonOffset:!0,polygonOffsetFactor:-2,polygonOffsetUnits:-2}:{}})}static pebbled(t){return t.onBeforeCompile=s=>{s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
|
|
2
2
|
varying vec3 vBallast;`).replace("#include <begin_vertex>",`#include <begin_vertex>
|
|
3
3
|
vBallast = position;`),s.fragmentShader=s.fragmentShader.replace("#include <common>",`#include <common>
|
|
4
4
|
varying vec3 vBallast;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={heading:"Sensitivity:",hint:"What is compared: each direction or size the recording traces to the witness, with what it rests on, against what the body the reading places would look like from where the witness stood, at the same instant. A gap is a contradiction only beyond what a witness's estimate of that kind may be off. The margins say how far each value the reading supposed can be moved before it reproduces less: a narrow margin is a fine-tuning, a wide one a robust reading. A margin is sufficient when it covers at least half of the value's uncertainty each way, as the witness error laws give it (a factor of 10 for a supposed distance): not all of it, since agreement is already judged with that uncertainty.",nothingToConfront:"nothing to set against the account: no body of the reading says which phenomenon it is",noneSaid:"nothing to set against the account: it traces no direction and no size to the witness",noneAgrees:"reproduces none of the witness's {compared} indications",lightSizedContested:"its lights sized as Tycho saw the stars, carried past them: a contested law",agreementOne:"reproduces 1 of the witness's {compared} indications",agreement:"reproduces {agreed} of the witness's {compared} indications",allAgree:"reproduces all the witness's {compared} indications",tooFew:"too few to measure how robust it is",noFreeValue:"nothing supposed: no value to move",tightest:"tightest: {knob}, from {lower} to {upper}",margin:"{knob}: holds from {lower} to {upper}; no law says how uncertain it is",marginJudged:"{knob}: holds from {lower} to {upper}, for an uncertainty of {refLower} to {refUpper} ({coverage} % covered)",sufficient:"sufficient margin",fineTuned:"fine-tuned: {knob} covers only {coverage} % of its uncertainty",atLeast:"{value} and beyond",better:"Another setting reproduces more: {knob} {amount}, {agreed} of {compared}",knobs:{azimuth:"direction",altitude:"height",distance:"distance",size:"size",time:"time"},comparison:{heading:"Readings compared ({n})",hint:"One row per reading of the case, set against the account it reads, as each reading's own sensitivity says it: how many of the witness's indications it reproduces, the median gap between what the witness said and what the reading shows (directions only), whether its margins are sufficient, and how many values it supposed. The more values a reading supposes, the easier a likeness is to make.",reading:"Reading",witness:"Reads",reproduced:"Reproduced",gap:"Median gap",robustness:"Robustness",supposed:"Supposed values",sortBy:"Sort by “{column}”; again to reverse",loading:"…",nothing:"nothing to compare",sufficient:"sufficient",fineTuned:"fine-tuned ({knob})",tooFew:"too little reproduced",unjudged:"no law to judge it"}};export{e as readingSensitivityMessages_en};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={heading:"Sensibilidad:",hint:"Lo que se compara: cada dirección o tamaño que la grabación atribuye al testigo diciendo en qué se basa, frente a lo que daría, visto desde su posición y en el mismo instante, el cuerpo que coloca la lectura. Una diferencia solo es contradicción más allá de la incertidumbre de un testigo para ese tipo de estimación. Los márgenes dicen cuánto se puede desplazar cada valor supuesto por la lectura antes de que reproduzca menos: un margen estrecho indica un ajuste fino, uno amplio una lectura robusta. Un margen es suficiente si cubre al menos la mitad de la incertidumbre del valor a cada lado, según las leyes de error de los testigos (un factor 10 para una distancia supuesta): no toda, pues el acuerdo ya se juzga con esa incertidumbre.",nothingToConfront:"nada que confrontar con el relato: ningún cuerpo de la lectura dice qué fenómeno es",noneSaid:"nada que confrontar: el relato no atribuye al testigo, diciendo en qué se basan, ninguna dirección ni tamaño",noneAgrees:"no reproduce ninguna de las {compared} indicaciones del testigo",lightSizedContested:"sus luces medidas como Tycho veía las estrellas, prolongado más allá: una ley discutida",agreementOne:"reproduce 1 de las {compared} indicaciones del testigo",agreement:"reproduce {agreed} de las {compared} indicaciones del testigo",allAgree:"reproduce las {compared} indicaciones del testigo",tooFew:"demasiado pocas para medir su robustez",noFreeValue:"nada supuesto: ningún valor que desplazar",tightest:"lo más ajustado: {knob}, de {lower} a {upper}",margin:"{knob}: se sostiene de {lower} a {upper}; ninguna ley dice su incertidumbre",marginJudged:"{knob}: se sostiene de {lower} a {upper}, para una incertidumbre de {refLower} a {refUpper} ({coverage} % cubierto)",sufficient:"margen suficiente",fineTuned:"ajuste fino: {knob} solo cubre el {coverage} % de su incertidumbre",atLeast:"{value} y más allá",better:"Otro ajuste reproduce más: {knob} {amount}, {agreed} de {compared}",knobs:{azimuth:"dirección",altitude:"altura",distance:"distancia",size:"tamaño",time:"instante"},comparison:{heading:"Lecturas comparadas ({n})",hint:"Una fila por lectura del caso, confrontada con el relato que lee, como lo dice la sensibilidad de cada lectura: cuántas indicaciones del testigo reproduce, la diferencia mediana entre lo que dijo el testigo y lo que muestra la lectura (solo direcciones), si sus márgenes son suficientes y cuántos valores supuso. Cuantos más valores supone una lectura, más fácil es obtener un parecido.",reading:"Lectura",witness:"Lee",reproduced:"Reproduce",gap:"Diferencia mediana",robustness:"Robustez",supposed:"Valores supuestos",sortBy:"Ordenar por «{column}»; otra vez para invertir",loading:"…",nothing:"nada que confrontar",sufficient:"suficiente",fineTuned:"ajuste fino ({knob})",tooFew:"demasiado poco reproducido",unjudged:"ninguna ley para juzgarla"}};export{e as readingSensitivityMessages_es};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={heading:"Sensibilité :",hint:"Ce qui est comparé : chaque direction ou taille que l'enregistrement attribue au témoin en disant sur quoi elle repose, et ce que donnerait, vu de sa position et au même instant, le corps que place la lecture. Un écart n'est une contradiction qu'au-delà de l'incertitude d'un témoin pour ce type d'estimation. Les marges disent de combien on peut décaler chaque valeur supposée par la lecture avant qu'elle reproduise moins : une marge étroite signale un réglage fin, une marge large une lecture robuste. Une marge est suffisante si elle couvre au moins la moitié de l'incertitude de la valeur de chaque côté, d'après les lois d'erreur des témoins (un facteur 10 pour une distance supposée) : pas la totalité, puisque l'accord est déjà jugé avec cette incertitude.",nothingToConfront:"rien à confronter au compte rendu : aucun corps de la lecture ne dit quel phénomène il est",noneSaid:"rien à confronter : le compte rendu n'attribue au témoin, en disant sur quoi elles reposent, aucune direction ni taille",noneAgrees:"ne reproduit aucune des {compared} indications du témoin",lightSizedContested:"ses feux mesurés comme Tycho voyait les étoiles, prolongé au-delà : une loi contestée",agreementOne:"reproduit 1 des {compared} indications du témoin",agreement:"reproduit {agreed} des {compared} indications du témoin",allAgree:"reproduit les {compared} indications du témoin",tooFew:"trop peu pour mesurer sa robustesse",noFreeValue:"rien de supposé : aucune valeur à décaler",tightest:"le plus serré : {knob}, de {lower} à {upper}",margin:"{knob} : tient de {lower} à {upper} ; aucune loi ne dit son incertitude",marginJudged:"{knob} : tient de {lower} à {upper}, pour une incertitude de {refLower} à {refUpper} ({coverage} % couverts)",sufficient:"marge suffisante",fineTuned:"réglage fin : {knob} ne couvre que {coverage} % de son incertitude",atLeast:"{value} et au-delà",better:"Un autre réglage en reproduit davantage : {knob} {amount}, {agreed} sur {compared}",knobs:{azimuth:"direction",altitude:"hauteur",distance:"distance",size:"taille",time:"instant"},comparison:{heading:"Lectures comparées ({n})",hint:"Une ligne par lecture du dossier, confrontée au compte rendu qu'elle lit, comme le dit la sensibilité de chaque lecture : combien des indications du témoin elle reproduit, l'écart médian entre ce qu'a dit le témoin et ce que montre la lecture (directions seulement), si ses marges sont suffisantes, et combien de valeurs elle a supposées. Plus une lecture suppose de valeurs, plus une ressemblance est facile à obtenir.",reading:"Lecture",witness:"Lit",reproduced:"Reproduit",gap:"Écart médian",robustness:"Robustesse",supposed:"Valeurs supposées",sortBy:"Trier par « {column} » ; à nouveau pour inverser",loading:"…",nothing:"rien à confronter",sufficient:"suffisante",fineTuned:"réglage fin ({knob})",tooFew:"trop peu reproduit",unjudged:"aucune loi pour en juger"}};export{e as readingSensitivityMessages_fr};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={heading:"Sensibilità:",hint:"Ciò che si confronta: ogni direzione o dimensione che la registrazione attribuisce al testimone dicendo su cosa si basa, con ciò che darebbe, visto dalla sua posizione e nello stesso istante, il corpo che la lettura colloca. Uno scarto è una contraddizione solo oltre l'incertezza di un testimone per quel tipo di stima. I margini dicono di quanto si può spostare ciascun valore supposto dalla lettura prima che riproduca meno: un margine stretto segnala una regolazione fine, uno ampio una lettura robusta. Un margine è sufficiente se copre almeno metà dell'incertezza del valore da ciascun lato, secondo le leggi di errore dei testimoni (un fattore 10 per una distanza supposta): non tutta, poiché l'accordo è già giudicato con quell'incertezza.",nothingToConfront:"niente da confrontare con il resoconto: nessun corpo della lettura dice quale fenomeno sia",noneSaid:"niente da confrontare: il resoconto non attribuisce al testimone, dicendo su cosa si basano, nessuna direzione né dimensione",noneAgrees:"non riproduce nessuna delle {compared} indicazioni del testimone",lightSizedContested:"le sue luci misurate come Tycho vedeva le stelle, prolungato oltre: una legge contestata",agreementOne:"riproduce 1 delle {compared} indicazioni del testimone",agreement:"riproduce {agreed} delle {compared} indicazioni del testimone",allAgree:"riproduce tutte le {compared} indicazioni del testimone",tooFew:"troppo poche per misurarne la robustezza",noFreeValue:"niente di supposto: nessun valore da spostare",tightest:"il più stretto: {knob}, da {lower} a {upper}",margin:"{knob}: regge da {lower} a {upper}; nessuna legge ne dice l'incertezza",marginJudged:"{knob}: regge da {lower} a {upper}, per un'incertezza da {refLower} a {refUpper} ({coverage} % coperto)",sufficient:"margine sufficiente",fineTuned:"regolazione fine: {knob} copre solo il {coverage} % della sua incertezza",atLeast:"{value} e oltre",better:"Un'altra regolazione ne riproduce di più: {knob} {amount}, {agreed} su {compared}",knobs:{azimuth:"direzione",altitude:"altezza",distance:"distanza",size:"dimensione",time:"istante"},comparison:{heading:"Letture a confronto ({n})",hint:"Una riga per lettura del caso, confrontata con il resoconto che legge, come dice la sensibilità di ciascuna lettura: quante indicazioni del testimone riproduce, lo scarto mediano tra ciò che ha detto il testimone e ciò che mostra la lettura (solo direzioni), se i suoi margini sono sufficienti e quanti valori ha supposto. Più valori una lettura suppone, più è facile ottenere una somiglianza.",reading:"Lettura",witness:"Legge",reproduced:"Riproduce",gap:"Scarto mediano",robustness:"Robustezza",supposed:"Valori supposti",sortBy:"Ordina per «{column}»; di nuovo per invertire",loading:"…",nothing:"niente da confrontare",sufficient:"sufficiente",fineTuned:"regolazione fine ({knob})",tooFew:"troppo poco riprodotto",unjudged:"nessuna legge per giudicarla"}};export{e as readingSensitivityMessages_it};
|