@rr0/ufoathome 0.125.0 → 0.126.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.
Files changed (27) hide show
  1. package/dist-embed-scene/rr0-scene.mjs +294 -294
  2. package/dist-embed-sighting/rr0-sighting.mjs +296 -296
  3. package/dist-embed-sighting-editor/BodyEditor-BAT3yx6v.js +27 -0
  4. package/dist-embed-sighting-editor/{CloudEditorMessages_es-RrGoxm6z.js → CloudEditorMessages_es-DFCuS9Qg.js} +1 -1
  5. package/dist-embed-sighting-editor/{CloudEditorMessages_fr-CAnkW7tI.js → CloudEditorMessages_fr-SvL-CR04.js} +1 -1
  6. package/dist-embed-sighting-editor/{CloudEditorMessages_it-Batpxtii.js → CloudEditorMessages_it-BvfiHWV9.js} +1 -1
  7. package/dist-embed-sighting-editor/{ContrailSystem-Bh3PmOP9.js → ContrailSystem-B24rkkhS.js} +1 -1
  8. package/dist-embed-sighting-editor/{CoverageAssessor-DCGCl8ic.js → CoverageAssessor-BPhdv7QL.js} +1 -1
  9. package/dist-embed-sighting-editor/{GLTFLoader-Bpggnw6G.js → GLTFLoader-C7miE2gT.js} +1 -1
  10. package/dist-embed-sighting-editor/{HeadlightSystem-DOjC-oxf.js → HeadlightSystem-DaWqNslK.js} +1 -1
  11. package/dist-embed-sighting-editor/HynekAssessor-DVFjzROZ.js +1 -0
  12. package/dist-embed-sighting-editor/{InterviewEditorElement-BRL8pvdi.js → InterviewEditorElement-CcEomZL0.js} +7 -6
  13. package/dist-embed-sighting-editor/{LaunchEditor-CFmH6y0N.js → LaunchEditor-BXDWiKWm.js} +2 -3
  14. package/dist-embed-sighting-editor/{ModelSource-SZRN-dar.js → ModelSource-gIw80dOv.js} +1 -1
  15. package/dist-embed-sighting-editor/{ModelThumbnails-6N7NAP44.js → ModelThumbnails-CGklRkoB.js} +1 -1
  16. package/dist-embed-sighting-editor/{ModelViewer-C_mVYZ1c.js → ModelViewer-Bg9kN_Zq.js} +1 -1
  17. package/dist-embed-sighting-editor/{RailwaySystem-BTm6OfuJ.js → RailwaySystem-BNAIqpAH.js} +1 -1
  18. package/dist-embed-sighting-editor/{RoadMarkings-AaLPDthv.js → RoadMarkings-aj_cbh3H.js} +1 -1
  19. package/dist-embed-sighting-editor/{SightingEditorMessages_es-1QZ2n8km.js → SightingEditorMessages_es-C2q5UZrw.js} +1 -1
  20. package/dist-embed-sighting-editor/{SightingEditorMessages_fr-DAg8lRfr.js → SightingEditorMessages_fr-DyELrz-P.js} +1 -1
  21. package/dist-embed-sighting-editor/{SightingEditorMessages_it-C2TQ7muu.js → SightingEditorMessages_it-CUKdtgr1.js} +1 -1
  22. package/dist-embed-sighting-editor/{TraceSystem-D8oL7SlQ.js → TraceSystem-CZSZY6ZM.js} +2 -2
  23. package/dist-embed-sighting-editor/{WaterSystem-1r0jEJ6E.js → WaterSystem-Bd010I79.js} +1 -1
  24. package/dist-embed-sighting-editor/rr0-sighting-editor.mjs +548 -422
  25. package/package.json +1 -1
  26. package/dist-embed-sighting-editor/BodyEditor-DinH26FA.js +0 -28
  27. package/dist-embed-sighting-editor/HynekAssessor-DTuaJ9gE.js +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rr0/ufoathome",
3
3
  "type": "module",
4
- "version": "0.125.0",
4
+ "version": "0.126.0",
5
5
  "description": "UFO@home — record and replay a UFO sighting's shape, movement and appearance",
6
6
  "author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
7
7
  "license": "MIT",
@@ -1,28 +0,0 @@
1
- import{U as A,j as z,B as u,E as f,k as M,m as v}from"./rr0-sighting-editor.mjs";import{bodyEditorMessages_en as k}from"./BodyEditorMessages_en-C3VGB1gD.js";class m{static before(e,o){const t=[...e.track].sort((s,n)=>s.t-n.t);return[...t].reverse().find(s=>s.t<=o)??t[0]}static viewOf(e,o,t){const s=m.before(e,o),n=i=>Number(i.toFixed(2));return{mode:s?.eastM!==void 0&&s.northM!==void 0?"world":"observer",azimuthDeg:n(t.azimuthDeg),elevationDeg:n(t.altitudeDeg),distanceM:n(t.distanceM),eastM:n(t.eastM),northM:n(t.northM),aboveGroundM:n(t.aboveGroundM),onGround:s?.onGround===!0,widthM:n(t.sizeM.widthM),lengthM:n(t.sizeM.lengthM),heightM:n(t.sizeM.heightM),headingDeg:n(t.attitude.headingDeg),pitchDeg:n(t.attitude.pitchDeg),rollDeg:n(t.attitude.rollDeg),color:t.appearance.color,albedo:n(t.appearance.albedo),luminanceCdM2:n(t.appearance.luminanceCdM2),transparency:n(t.appearance.transparency??0),haloScale:n(t.appearance.haloScale??1)}}static keyframeOf(e,o,t,s){const n=r=>Number.isFinite(r)?r:0,i=e.mode==="world"?{t:o,eastM:n(e.eastM),northM:n(e.northM),...e.onGround?{onGround:!0}:{altitudeAboveGroundM:n(e.aboveGroundM)}}:{t:o,azimuthDeg:n(e.azimuthDeg),altitudeDeg:n(e.elevationDeg),distanceM:Math.max(.1,n(e.distanceM)),...e.onGround?{onGround:!0}:{}},d=s?{color:e.color,albedo:Math.max(0,Math.min(1,n(e.albedo))),luminanceCdM2:Math.max(0,n(e.luminanceCdM2)),transparency:Math.max(0,Math.min(1,n(e.transparency))),haloScale:Math.max(0,n(e.haloScale))}:t?.appearance;return{...m.withoutPlacement(t),...i,sizeM:{widthM:Math.max(.01,n(e.widthM)),lengthM:Math.max(.01,n(e.lengthM)),heightM:Math.max(.01,n(e.heightM))},attitude:{headingDeg:n(e.headingDeg),pitchDeg:n(e.pitchDeg),rollDeg:n(e.rollDeg)},...d?{appearance:d}:{}}}static withoutPlacement(e){if(!e)return{};const{eastM:o,northM:t,azimuthDeg:s,altitudeDeg:n,distanceM:i,onGround:d,altitudeAboveGroundM:r,sizeM:a,attitude:h,appearance:c,...b}=e;return b}}class l{static number(e,o,t,s,n,i,d={}){return{type:"number",key:e,label:o,min:t,max:s,step:n,unit:i,required:!0,...d}}static BODY={kind:"body",title:{en:"Body",fr:"Corps",es:"Cuerpo",it:"Corpo"},parameters:[{type:"text",key:"id",required:!0,label:{en:"ID",fr:"Identifiant",es:"Identificador",it:"Identificativo"},validate:(e,o,t)=>!(t?.ids??[]).some(s=>s===e&&s!==o.id)},{type:"said",key:"title",label:{en:"Name",fr:"Nom",es:"Nombre",it:"Nome"}},{type:"set",key:"explains",label:{en:"Stands for the shapes",fr:"Représente les formes",es:"Representa las formas",it:"Rappresenta le forme"},options:(e,o)=>{const t=o?.shapes??[],s=(e.explains??[]).filter(n=>!t.some(i=>i.value===n));return[...t,...s.map(n=>({value:n,label:n}))]},empty:{en:"No shape",fr:"Aucune forme",es:"Ninguna forma",it:"Nessuna forma"}},{type:"text",key:"outlineNode",label:{en:"Part drawn by the observer",fr:"Partie dessinée par l'observateur",es:"Parte dibujada por el observador",it:"Parte disegnata dall'osservatore"},placeholder:{en:"Node of the model, e.g. hull",fr:"Nœud du modèle, par ex. hull",es:"Nodo del modelo, p. ej. hull",it:"Nodo del modello, ad es. hull"}}]};static KEYFRAME={kind:"body-keyframe",title:{en:"At the playhead",fr:"À l'instant courant",es:"En el instante actual",it:"All'istante corrente"},parameters:[{type:"choice",key:"mode",required:!0,label:{en:"Position",fr:"Position",es:"Posición",it:"Posizione"},choices:[{value:"observer",label:{en:"From the observer",fr:"Depuis l'observateur",es:"Desde el observador",it:"Dall'osservatore"}},{value:"world",label:{en:"In the world",fr:"Dans le monde",es:"En el mundo",it:"Nel mondo"}}]},l.number("azimuthDeg",{en:"Azimuth",fr:"Azimut",es:"Acimut",it:"Azimut"},0,360,.01,"°",{visibleWhen:e=>e.mode==="observer"}),l.number("elevationDeg",{en:"Elevation",fr:"Hauteur",es:"Elevación",it:"Elevazione"},-90,90,.01,"°",{visibleWhen:e=>e.mode==="observer"}),l.number("distanceM",{en:"Distance",fr:"Distance",es:"Distancia",it:"Distanza"},.1,3e4,.1,"m",{visibleWhen:e=>e.mode==="observer"}),l.number("eastM",{en:"East",fr:"Est",es:"Este",it:"Est"},-3e4,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"}),l.number("northM",{en:"North",fr:"Nord",es:"Norte",it:"Nord"},-3e4,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"}),{type:"boolean",key:"onGround",label:{en:"On the ground",fr:"Au sol",es:"En el suelo",it:"A terra"}},l.number("aboveGroundM",{en:"Above the ground",fr:"Au-dessus du sol",es:"Sobre el suelo",it:"Sopra il suolo"},0,3e4,.1,"m",{visibleWhen:e=>e.mode==="world"&&e.onGround!==!0}),l.number("widthM",{en:"Width",fr:"Largeur",es:"Ancho",it:"Larghezza"},.01,1e3,.01,"m"),l.number("lengthM",{en:"Length",fr:"Longueur",es:"Largo",it:"Lunghezza"},.01,1e3,.01,"m"),l.number("heightM",{en:"Height",fr:"Hauteur",es:"Alto",it:"Altezza"},.01,1e3,.01,"m"),l.number("headingDeg",{en:"Heading",fr:"Cap",es:"Rumbo",it:"Rotta"},0,360,.1,"°"),l.number("pitchDeg",{en:"Pitch",fr:"Tangage",es:"Cabeceo",it:"Beccheggio"},-90,90,.1,"°"),l.number("rollDeg",{en:"Roll",fr:"Roulis",es:"Alabeo",it:"Rollio"},-180,180,.1,"°"),{type:"colour",key:"color",label:{en:"Colour",fr:"Couleur",es:"Color",it:"Colore"},fallback:"#c8c8c8",visibleWhen:(e,o)=>o?.drawnFromModel!==!0},l.number("albedo",{en:"Albedo",fr:"Albédo",es:"Albedo",it:"Albedo"},0,1,.01,void 0),l.number("luminanceCdM2",{en:"Light of its own",fr:"Lumière propre",es:"Luz propia",it:"Luce propria"},0,1e10,.1,"cd/m²"),l.number("transparency",{en:"Transparency",fr:"Transparence",es:"Transparencia",it:"Trasparenza"},0,1,.01,void 0),l.number("haloScale",{en:"Halo",fr:"Halo",es:"Halo",it:"Alone"},0,20,.1,"×")]}}class p{constructor(e,o,t){this.container=e,this.host=o,this.language=t,this.render(),this.setLanguage(t)}static APPEARANCE_KEYS=["color","albedo","luminanceCdM2","transparency","haloScale"];messages=k;languageToken=0;currentId;catalogueToken=0;shownEntry;syncedId;bodyForm;keyForm;async setLanguage(e){const o=++this.languageToken;this.language=e;const t=A.includes(e)?e:"en",s=t==="en"?k:await z(t);o===this.languageToken&&s!==this.messages&&(this.messages=s,this.render())}sync(){const e=this.bodies;e.some(i=>i.id===this.currentId)||(this.currentId=e[0]?.id),this.input("body-interpretation-title").value=this.host.said().read(this.interpretation?.title)??"",this.list?.setItems(e.map(i=>({id:i.id,label:this.labelOf(i)})),this.currentId);const o=this.host.newBodyStart();this.list?.setAddState(o!==void 0,o?o.label!==void 0?this.messages.addBodyHint.replace("{shape}",o.label):this.messages.addBodyHintView:void 0),this.input("body-interpretation-title").closest("label").hidden=!1;const t=this.current;if(this.element("body-none").hidden=e.length>0,this.element("body-fields").hidden=t===void 0,!t)return;this.bodyForm?.sync(),this.syncModelOptions(t);const s=t.model;this.input("body-model-url").value=s.url??"",this.input("body-model-title").value=s.credit?.title??"",this.input("body-model-author").value=s.credit?.author??"",this.input("body-model-license").value=s.credit?.license??"",this.input("body-model-source").value=s.credit?.sourceUrl??"";const n=this.element("body-model-advanced");n.open=s.url!==void 0||n.open&&t.id===this.syncedId,this.syncedId=t.id,this.element("body-model-incomplete").hidden=s.url===void 0||s.credit?.title!==void 0&&s.credit.license!==void 0,this.syncKeyframe()}syncKeyframe(e=!1){const o=this.current;if(!o)return;const t=this.host.currentTime(),s=this.messages;this.element("body-key-legend").textContent=s.atPlayhead.replace("{t}",p.seconds(t));const n=this.host.readingOf(o,t),i=o.track.find(d=>d.t===t);this.element("body-key-note").textContent=n?i?s.keyframeHere:s.keyframeAdded:s.notPlaced,this.keyList?.setItems(o.track.map(d=>({id:String(d.t),label:p.seconds(d.t)})),i?String(i.t):""),this.keyList?.setAddState(n!==void 0&&i===void 0),this.keyList?.setStepState(o.track.some(d=>d.t<t),o.track.some(d=>d.t>t)),this.element("body-key-parameters").hidden=!n,n&&this.keyForm?.sync(e)}stepKeyframe(e){const o=this.current;if(!o)return;const t=this.host.currentTime(),s=o.track.map(n=>n.t).filter(n=>e<0?n<t:n>t);s.length!==0&&(this.host.seekTo(e<0?Math.max(...s):Math.min(...s)),this.syncKeyframe(!0))}keyframeContext(){const e=this.current?.model;return{drawnFromModel:e===void 0||e.url!==void 0||!u.includes(e.id??"")}}keyframeView(){const e=this.current;if(!e)return;const o=this.host.currentTime(),t=this.host.readingOf(e,o);return t?m.viewOf(e,o,t):void 0}render(){const e=this.messages,o=(i,d,r="text",a="",h="",c="")=>`<label><span>${d}</span> <input id="${i}" type="${r}" placeholder="${a}" ${c} autocomplete="off"/>${h?` ${h}`:""}</label>`;this.container.innerHTML=`<div class="body-editor">
2
- <p class="body-intro">${e.intro}</p>
3
- ${o("body-interpretation-title",e.interpretationTitle)}
4
- <p id="body-none" class="body-intro">${e.none}</p>
5
- <div id="body-list" class="body-list"></div>
6
- <div id="body-fields" class="body-fields">
7
- <div id="body-parameters" class="body-parameters"></div>
8
- <label><span>${e.model}</span> <select id="body-model"></select></label>
9
- <details id="body-model-advanced" class="decor-model-advanced" hidden>
10
- <summary>${e.modelAdvanced}</summary>
11
- ${o("body-model-url",e.modelUrl,"text",e.modelUrlHint)}
12
- ${o("body-model-title",e.modelTitle)}
13
- ${o("body-model-author",e.modelAuthor)}
14
- ${o("body-model-license",e.modelLicense,"text","CC0 1.0")}
15
- ${o("body-model-source",e.modelSource,"url","https://…")}
16
- <p id="body-model-incomplete" class="body-intro" hidden>${e.modelIncomplete}</p>
17
- <p id="body-model-catalogue" class="body-intro" hidden>${e.modelFromCatalogue}</p>
18
- </details>
19
- <div id="body-keys" class="body-keys"></div>
20
- <fieldset class="body-key">
21
- <legend id="body-key-legend"></legend>
22
- <p id="body-key-note" class="body-intro"></p>
23
- <div id="body-key-parameters" class="body-parameters"></div>
24
- <p class="body-intro">${e.appearanceNote}</p>
25
- <p class="body-intro">${e.pictureHint}</p>
26
- </fieldset>
27
- </div>
28
- </div>`;const t=this.element("body-list");this.list=new f({header:t,footer:t,rowClass:"body-list-add",ids:{list:"body-select",remove:"body-delete",add:"body-add"},actions:[{id:"body-look",glyph:"🎯",onClick:()=>{const i=this.current;i&&this.host.lookAt(i)}}],onSelect:i=>{this.currentId=i,this.sync()},onAdd:()=>this.addBody(),onRemove:()=>this.deleteCurrent()}),this.list.setLabels({list:e.body,remove:e.deleteBody,add:e.addBody,actions:{"body-look":e.lookAtBody}}),this.input("body-interpretation-title").addEventListener("change",()=>this.updateInterpretationTitle());for(const i of["body-model-url","body-model-title","body-model-author","body-model-license","body-model-source"])this.input(i).addEventListener("change",()=>this.updateCurrent());this.select("body-model").addEventListener("change",()=>{const i=this.select("body-model").value;i!==""&&(this.input("body-model-url").value=""),this.updateCurrent(),this.syncModelOptions(this.current),i!==""&&this.adoptCatalogueSize(i),this.element("body-model-advanced").open=i!==""&&!u.includes(i)});const s=this.element("body-keys");this.keyList=new f({header:s,footer:s,rowClass:"body-keys-add",optional:!0,ids:{list:"body-key",remove:"body-key-delete",add:"body-key-add"},navigation:{scope:this.container,onStep:i=>this.stepKeyframe(i)},onSelect:i=>{i!==""&&this.host.seekTo(Number(i)),this.syncKeyframe(!0)},onAdd:()=>this.editView(()=>{}),onRemove:()=>this.deleteKeyframe()}),this.keyList.setLabels({list:e.keyframes,remove:e.deleteKeyframe,add:e.addKeyframe,none:e.noKeyframeHere,previous:e.previousKeyframe,next:e.nextKeyframe}),this.host.modelPicker().enhance(this.select("body-model"),async i=>u.includes(i)?{shape:i}:this.host.modelProvider().entry(i).then(d=>d&&{url:d.url,headingOffsetDeg:d.headingOffsetDeg}),{current:()=>{const i=this.current?.model;return i?.url===void 0?void 0:{url:i.url,title:i.credit?.title??"",author:i.credit?.author??"",license:i.credit?.license??"",source:i.credit?.sourceUrl??""}},apply:i=>{this.input("body-model-url").value=i.url,this.input("body-model-title").value=i.title,this.input("body-model-author").value=i.author,this.input("body-model-license").value=i.license,this.input("body-model-source").value=i.source,this.shownEntry=void 0,this.select("body-model").value="",this.updateCurrent(),this.syncModelOptions(this.current)}});const n={said:()=>this.host.said(),writingLanguage:()=>this.host.writingLanguage()};this.bodyForm=new M(this.element("body-parameters"),this.language,"body.",n),this.bodyForm.show(l.BODY,new v(()=>this.current,i=>this.editBody(i),()=>({ids:this.bodies.map(i=>i.id),shapes:this.host.shapes().map(i=>({value:i.id,label:i.label}))})),()=>{}),this.keyForm=new M(this.element("body-key-parameters"),this.language,"bodyKey."),this.keyForm.show(l.KEYFRAME,new v(()=>this.keyframeView(),(i,d)=>this.editView(i,p.APPEARANCE_KEYS.includes(d.key)),()=>this.keyframeContext()),()=>{}),this.sync()}async syncModelOptions(e){const o=++this.catalogueToken,t=await this.host.modelProvider().entries().catch(()=>[]);if(o!==this.catalogueToken)return;const s=this.messages,n=this.select("body-model"),i=e.model.url===void 0?e.model.id:void 0,d=i===void 0||u.includes(i)||t.some(a=>a.id===i),r=[s.primitives,s.catalogue,t.map(a=>`${a.id}:${a.name}`).join(),e.model.url!==void 0,d?"":i].join("|");if(n.dataset.signature!==r){n.dataset.signature=r;const a=document.createElement("optgroup");a.label=s.primitives,a.append(...u.map(c=>new Option(s.primitive[c],c)));const h=document.createElement("optgroup");h.label=s.catalogue,h.append(...t.map(c=>new Option(c.name,c.id))),n.replaceChildren(a,h),e.model.url!==void 0&&n.prepend(new Option(s.modelAdvanced,"")),d||n.append(new Option(i,i))}n.value=i??"",this.showCatalogueModel(e.model.url===void 0?t.find(a=>a.id===e.model.id):void 0)}showCatalogueModel(e){const o=this.current;if(!o||o.model.url!==void 0){this.shownEntry=void 0,this.element("body-model-catalogue").hidden=!0;return}this.shownEntry=e;const t=this.container.getRootNode().activeElement,s=[["body-model-url",e?.url],["body-model-title",e?.credit.title],["body-model-author",e?.credit.author],["body-model-license",e?.credit.license],["body-model-source",e?.credit.sourceUrl]];for(const[n,i]of s)this.input(n)!==t&&(this.input(n).value=i??"");this.element("body-model-catalogue").hidden=e===void 0,this.element("body-model-incomplete").hidden=!0}updateInterpretationTitle(){const e=this.interpretation??{bodies:[]},o=this.host.said().write(e.title,this.input("body-interpretation-title").value,this.host.writingLanguage());this.write({...e,title:o})}updateCurrent(){const e=this.current;e&&this.write({...this.interpretation,bodies:this.bodies.map(o=>o===e?{...e,model:this.statedModel(e.model)}:o)})}editBody(e){const o=this.current;if(!o)return;const t=structuredClone(o);e(t),this.currentId=t.id,this.write({...this.interpretation,bodies:this.bodies.map(s=>s===o?t:s)})}editView(e,o=!1){const t=this.current,s=this.keyframeView();if(!t||!s)return;const n=this.host.currentTime();e(s);const i=m.keyframeOf(s,n,t.track.find(r=>r.t===n),o),d=[...t.track.filter(r=>r.t!==n),i].sort((r,a)=>r.t-a.t);this.write({...this.interpretation,bodies:this.bodies.map(r=>r===t?{...t,track:d}:r)}),this.syncKeyframe()}addBody(){const e=this.host.newBodyStart();if(!e)return;const o=new Set(this.bodies.map(i=>i.id));let t=o.size+1;for(;o.has(`body-${t}`);)t++;const s={id:`body-${t}`,explains:e.sourceId!==void 0?[e.sourceId]:void 0,model:{id:"ellipsoid"},track:[e.keyframe]};this.currentId=s.id;const n=this.interpretation??{bodies:[]};this.write({...n,bodies:[...this.bodies,s]},!0)}async adoptCatalogueSize(e){const t=(await this.host.modelProvider().entry(e).catch(()=>{}))?.sizeM,s=this.current;if(!t||!s||s.model.id!==e)return;if(!s.track.some(i=>i.sizeM)&&s.track.length>0){const[i,...d]=[...s.track].sort((h,c)=>h.t-c.t),r={widthM:t.widthM??1,lengthM:t.lengthM??t.widthM??1,heightM:t.heightM??1},a=[{...i,sizeM:r},...d];this.write({...this.interpretation,bodies:this.bodies.map(h=>h===s?{...s,track:a}:h)},!0);return}const n=s.track.map(i=>{const d=i.sizeM?.widthM,r=t.widthM??d;if(!i.sizeM||d===void 0||r===void 0||d<=0)return i;const a=r/d,h={widthM:t.widthM??i.sizeM.widthM*a,lengthM:t.lengthM??i.sizeM.lengthM*a,heightM:t.heightM??i.sizeM.heightM*a};return i.distanceM!==void 0&&i.azimuthDeg!==void 0?{...i,sizeM:h,distanceM:Number((i.distanceM*a).toFixed(1))}:{...i,sizeM:h}});this.write({...this.interpretation,bodies:this.bodies.map(i=>i===s?{...s,track:n}:i)},!0)}get currentBodyId(){return this.current?.id}resize(e){const o=t=>Number(Math.max(.01,t).toFixed(2));this.editView(t=>Object.assign(t,{widthM:o(e.widthM),lengthM:o(e.lengthM),heightM:o(e.heightM)}))}turnTo(e){const o=t=>((t+180)%360+360)%360-180;this.editView(t=>Object.assign(t,{headingDeg:Number(((e.headingDeg%360+360)%360).toFixed(1)),pitchDeg:Number(Math.max(-90,Math.min(90,e.pitchDeg)).toFixed(1)),rollDeg:Number(o(e.rollDeg).toFixed(1))}))}show(e){!this.bodies.some(o=>o.id===e)||e===this.currentId||(this.currentId=e,this.sync())}readingNow(){const e=this.current;return e&&this.host.readingOf(e,this.host.currentTime())}dragTo(e,o){const t=this.readingNow();if(!t)return;const s=this.host.currentTime(),n=Math.PI/180,i=d=>Number(d.toFixed(2));this.editView(d=>{const r=d,a=r.onGround?this.host.groundAlong(e,o,s):void 0;if(r.mode==="world"){const h=Math.cos(t.altitudeDeg*n),c=t.eastM-Math.sin(t.azimuthDeg*n)*h*t.distanceM,b=t.northM-Math.cos(t.azimuthDeg*n)*h*t.distanceM,w=Math.hypot(t.eastM-c,t.northM-b),y=a!==void 0?a*Math.cos(o*n):w;if(r.eastM=i(c+Math.sin(e*n)*y),r.northM=i(b+Math.cos(e*n)*y),!r.onGround){const g=D=>Math.max(-89,Math.min(89,D))*n;r.aboveGroundM=i(Math.max(0,t.aboveGroundM+y*(Math.tan(g(o))-Math.tan(g(t.altitudeDeg)))))}}else r.azimuthDeg=i((e%360+360)%360),r.elevationDeg=i(Math.max(-90,Math.min(90,o))),a!==void 0&&(r.distanceM=i(a))})}scaleDistance(e){const o=this.readingNow();if(!o)return;const t=s=>Number(s.toFixed(2));this.editView(s=>{const n=s;if(n.mode==="world"){const i=Math.PI/180,d=Math.cos(o.altitudeDeg*i),r=o.eastM-Math.sin(o.azimuthDeg*i)*d*o.distanceM,a=o.northM-Math.cos(o.azimuthDeg*i)*d*o.distanceM;n.eastM=t(r+(o.eastM-r)*e),n.northM=t(a+(o.northM-a)*e)}else n.distanceM=t(Math.max(.1,o.distanceM*e))})}deleteKeyframe(){const e=this.current;if(!e)return;const o=this.host.currentTime(),t=e.track.filter(s=>s.t!==o);t.length!==e.track.length&&this.write({...this.interpretation,bodies:this.bodies.map(s=>s===e?{...e,track:t}:s)},!0)}static seconds(e){return`${Math.round(e/100)/10} s`}deleteCurrent(){const e=this.current;e&&(this.currentId=void 0,this.write({...this.interpretation,bodies:this.bodies.filter(o=>o!==e)},!0))}statedModel(e){const o=this.stringOrUndefined(this.input("body-model-url").value),t=this.shownEntry,s=i=>this.stringOrUndefined(this.input(i).value);if(t&&o===t.url&&s("body-model-title")===t.credit.title&&s("body-model-author")===t.credit.author&&s("body-model-license")===t.credit.license&&s("body-model-source")===t.credit.sourceUrl)return{id:t.id};if(o){const i=this.stringOrUndefined(this.input("body-model-title").value),d=this.stringOrUndefined(this.input("body-model-license").value);return{url:o,headingOffsetDeg:e.url!==void 0?e.headingOffsetDeg:void 0,credit:i!==void 0&&d!==void 0?{title:i,license:d,author:this.stringOrUndefined(this.input("body-model-author").value),sourceUrl:this.stringOrUndefined(this.input("body-model-source").value)}:void 0}}return{id:this.stringOrUndefined(this.select("body-model").value)??e.id??"ellipsoid"}}write(e,o=!1){const t=e.bodies.length===0&&e.title===void 0&&e.smoke===void 0&&e.reentries===void 0&&e.launches===void 0;if(this.host.sighting().interpretation=t?void 0:e,this.host.changed(),o){this.sync();return}this.list?.setItems(this.bodies.map(n=>({id:n.id,label:this.labelOf(n)})),this.currentId);const s=this.current;s&&(this.element("body-model-incomplete").hidden=s.model.url===void 0||s.model.credit!==void 0,this.syncModelOptions(s))}labelOf(e){const o=this.host.said().read(e.title);return o?`${o} (${e.id})`:e.id}get interpretation(){return this.host.sighting().interpretation}get bodies(){return this.interpretation?.bodies??[]}get current(){return this.bodies.find(e=>e.id===this.currentId)}stringOrUndefined(e){const o=e.trim();return o===""?void 0:o}list;keyList;element(e){return this.container.querySelector("#"+e)}input(e){return this.element(e)}select(e){return this.element(e)}}export{p as BodyEditor};
@@ -1 +0,0 @@
1
- import{$ as r,a0 as c,a1 as l}from"./rr0-sighting-editor.mjs";const v=-6,p=150;class o{about="temporal";async assess(e){const t=o.daylight(e),i=e.decor.map((s,n)=>({object:s,index:n})).filter(({object:s})=>s.kind==="entity"),a=o.nearest(e),d=a!==void 0&&a<=p;return{verdict:i.length>0?"ce3":d?"ce1":t===void 0?void 0:t?"dd":"nl",criteria:[{id:"entities",basis:i.length>0?"stated":void 0,paths:i.map(({index:s})=>`decor.${s}`)},{id:"traces",paths:[],unsupported:!0},{id:"proximity",basis:a===void 0?void 0:"derived",paths:a===void 0?[]:["timeline","observerTrack"]},{id:"radar",paths:[],unsupported:!0},{id:"daylight",basis:t===void 0?void 0:"derived",paths:t===void 0?[]:["time","place"]}]}}static nearest(e){const t=e.timeline.sourceIds.map(i=>r.of(e,i)?.nearestM).filter(i=>i!==void 0);return t.length>0?Math.min(...t):void 0}static daylight(e){const t=e.event.place?.[0],i=e.event.time;if(!t||!i)return;const a=c(i,t.lng,e.event.utcOffsetHours);if(a)return l("Sun",a,{lat:t.lat,lng:t.lng,elevationM:0}).altitudeDeg>v}}export{o as HynekAssessor};